var uX=Object.defineProperty;var dX=(e,n,r)=>n in e?uX(e,n,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[n]=r;var $n=(e,n,r)=>dX(e,typeof n!="symbol"?n+"":n,r);function hX(e,n){for(var r=0;r<n.length;r++){const i=n[r];if(typeof i!="string"&&!Array.isArray(i)){for(const s in i)if(s!=="default"&&!(s in e)){const a=Object.getOwnPropertyDescriptor(i,s);a&&Object.defineProperty(e,s,a.get?a:{enumerable:!0,get:()=>i[s]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const n=document.createElement("link").relList;if(n&&n.supports&&n.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))i(s);new MutationObserver(s=>{for(const a of s)if(a.type==="childList")for(const o of a.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&i(o)}).observe(document,{childList:!0,subtree:!0});function r(s){const a={};return s.integrity&&(a.integrity=s.integrity),s.referrerPolicy&&(a.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?a.credentials="include":s.crossOrigin==="anonymous"?a.credentials="omit":a.credentials="same-origin",a}function i(s){if(s.ep)return;s.ep=!0;const a=r(s);fetch(s.href,a)}})();function wu(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var jw={exports:{}},rm={};/**
 * @license React
 * react-jsx-runtime.production.js
 *
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */var $3;function fX(){if($3)return rm;$3=1;var e=Symbol.for("react.transitional.element"),n=Symbol.for("react.fragment");function r(i,s,a){var o=null;if(a!==void 0&&(o=""+a),s.key!==void 0&&(o=""+s.key),"key"in s){a={};for(var l in s)l!=="key"&&(a[l]=s[l])}else a=s;return s=a.ref,{$$typeof:e,type:i,key:o,ref:s!==void 0?s:null,props:a}}return rm.Fragment=n,rm.jsx=r,rm.jsxs=r,rm}var F3;function pX(){return F3||(F3=1,jw.exports=fX()),jw.exports}var c=pX(),Nw={exports:{}},Yt={};/**
 * @license React
 * react.production.js
 *
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */var H3;function mX(){if(H3)return Yt;H3=1;var e=Symbol.for("react.transitional.element"),n=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),i=Symbol.for("react.strict_mode"),s=Symbol.for("react.profiler"),a=Symbol.for("react.consumer"),o=Symbol.for("react.context"),l=Symbol.for("react.forward_ref"),u=Symbol.for("react.suspense"),d=Symbol.for("react.memo"),p=Symbol.for("react.lazy"),f=Symbol.for("react.activity"),g=Symbol.iterator;function _(R){return R===null||typeof R!="object"?null:(R=g&&R[g]||R["@@iterator"],typeof R=="function"?R:null)}var x={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},v=Object.assign,S={};function w(R,q,W){this.props=R,this.context=q,this.refs=S,this.updater=W||x}w.prototype.isReactComponent={},w.prototype.setState=function(R,q){if(typeof R!="object"&&typeof R!="function"&&R!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,R,q,"setState")},w.prototype.forceUpdate=function(R){this.updater.enqueueForceUpdate(this,R,"forceUpdate")};function j(){}j.prototype=w.prototype;function C(R,q,W){this.props=R,this.context=q,this.refs=S,this.updater=W||x}var T=C.prototype=new j;T.constructor=C,v(T,w.prototype),T.isPureReactComponent=!0;var E=Array.isArray;function A(){}var O={H:null,A:null,T:null,S:null},F=Object.prototype.hasOwnProperty;function L(R,q,W){var te=W.ref;return{$$typeof:e,type:R,key:q,ref:te!==void 0?te:null,props:W}}function $(R,q){return L(R.type,q,R.props)}function z(R){return typeof R=="object"&&R!==null&&R.$$typeof===e}function B(R){var q={"=":"=0",":":"=2"};return"$"+R.replace(/[=:]/g,function(W){return q[W]})}var H=/\/+/g;function D(R,q){return typeof R=="object"&&R!==null&&R.key!=null?B(""+R.key):q.toString(36)}function U(R){switch(R.status){case"fulfilled":return R.value;case"rejected":throw R.reason;default:switch(typeof R.status=="string"?R.then(A,A):(R.status="pending",R.then(function(q){R.status==="pending"&&(R.status="fulfilled",R.value=q)},function(q){R.status==="pending"&&(R.status="rejected",R.reason=q)})),R.status){case"fulfilled":return R.value;case"rejected":throw R.reason}}throw R}function I(R,q,W,te,J){var G=typeof R;(G==="undefined"||G==="boolean")&&(R=null);var re=!1;if(R===null)re=!0;else switch(G){case"bigint":case"string":case"number":re=!0;break;case"object":switch(R.$$typeof){case e:case n:re=!0;break;case p:return re=R._init,I(re(R._payload),q,W,te,J)}}if(re)return J=J(R),re=te===""?"."+D(R,0):te,E(J)?(W="",re!=null&&(W=re.replace(H,"$&/")+"/"),I(J,q,W,"",function(oe){return oe})):J!=null&&(z(J)&&(J=$(J,W+(J.key==null||R&&R.key===J.key?"":(""+J.key).replace(H,"$&/")+"/")+re)),q.push(J)),1;re=0;var ne=te===""?".":te+":";if(E(R))for(var le=0;le<R.length;le++)te=R[le],G=ne+D(te,le),re+=I(te,q,W,G,J);else if(le=_(R),typeof le=="function")for(R=le.call(R),le=0;!(te=R.next()).done;)te=te.value,G=ne+D(te,le++),re+=I(te,q,W,G,J);else if(G==="object"){if(typeof R.then=="function")return I(U(R),q,W,te,J);throw q=String(R),Error("Objects are not valid as a React child (found: "+(q==="[object Object]"?"object with keys {"+Object.keys(R).join(", ")+"}":q)+"). If you meant to render a collection of children, use an array instead.")}return re}function X(R,q,W){if(R==null)return R;var te=[],J=0;return I(R,te,"","",function(G){return q.call(W,G,J++)}),te}function K(R){if(R._status===-1){var q=R._result;q=q(),q.then(function(W){(R._status===0||R._status===-1)&&(R._status=1,R._result=W)},function(W){(R._status===0||R._status===-1)&&(R._status=2,R._result=W)}),R._status===-1&&(R._status=0,R._result=q)}if(R._status===1)return R._result.default;throw R._result}var Q=typeof reportError=="function"?reportError:function(R){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var q=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof R=="object"&&R!==null&&typeof R.message=="string"?String(R.message):String(R),error:R});if(!window.dispatchEvent(q))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",R);return}console.error(R)},V={map:X,forEach:function(R,q,W){X(R,function(){q.apply(this,arguments)},W)},count:function(R){var q=0;return X(R,function(){q++}),q},toArray:function(R){return X(R,function(q){return q})||[]},only:function(R){if(!z(R))throw Error("React.Children.only expected to receive a single React element child.");return R}};return Yt.Activity=f,Yt.Children=V,Yt.Component=w,Yt.Fragment=r,Yt.Profiler=s,Yt.PureComponent=C,Yt.StrictMode=i,Yt.Suspense=u,Yt.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=O,Yt.__COMPILER_RUNTIME={__proto__:null,c:function(R){return O.H.useMemoCache(R)}},Yt.cache=function(R){return function(){return R.apply(null,arguments)}},Yt.cacheSignal=function(){return null},Yt.cloneElement=function(R,q,W){if(R==null)throw Error("The argument must be a React element, but you passed "+R+".");var te=v({},R.props),J=R.key;if(q!=null)for(G in q.key!==void 0&&(J=""+q.key),q)!F.call(q,G)||G==="key"||G==="__self"||G==="__source"||G==="ref"&&q.ref===void 0||(te[G]=q[G]);var G=arguments.length-2;if(G===1)te.children=W;else if(1<G){for(var re=Array(G),ne=0;ne<G;ne++)re[ne]=arguments[ne+2];te.children=re}return L(R.type,J,te)},Yt.createContext=function(R){return R={$$typeof:o,_currentValue:R,_currentValue2:R,_threadCount:0,Provider:null,Consumer:null},R.Provider=R,R.Consumer={$$typeof:a,_context:R},R},Yt.createElement=function(R,q,W){var te,J={},G=null;if(q!=null)for(te in q.key!==void 0&&(G=""+q.key),q)F.call(q,te)&&te!=="key"&&te!=="__self"&&te!=="__source"&&(J[te]=q[te]);var re=arguments.length-2;if(re===1)J.children=W;else if(1<re){for(var ne=Array(re),le=0;le<re;le++)ne[le]=arguments[le+2];J.children=ne}if(R&&R.defaultProps)for(te in re=R.defaultProps,re)J[te]===void 0&&(J[te]=re[te]);return L(R,G,J)},Yt.createRef=function(){return{current:null}},Yt.forwardRef=function(R){return{$$typeof:l,render:R}},Yt.isValidElement=z,Yt.lazy=function(R){return{$$typeof:p,_payload:{_status:-1,_result:R},_init:K}},Yt.memo=function(R,q){return{$$typeof:d,type:R,compare:q===void 0?null:q}},Yt.startTransition=function(R){var q=O.T,W={};O.T=W;try{var te=R(),J=O.S;J!==null&&J(W,te),typeof te=="object"&&te!==null&&typeof te.then=="function"&&te.then(A,Q)}catch(G){Q(G)}finally{q!==null&&W.types!==null&&(q.types=W.types),O.T=q}},Yt.unstable_useCacheRefresh=function(){return O.H.useCacheRefresh()},Yt.use=function(R){return O.H.use(R)},Yt.useActionState=function(R,q,W){return O.H.useActionState(R,q,W)},Yt.useCallback=function(R,q){return O.H.useCallback(R,q)},Yt.useContext=function(R){return O.H.useContext(R)},Yt.useDebugValue=function(){},Yt.useDeferredValue=function(R,q){return O.H.useDeferredValue(R,q)},Yt.useEffect=function(R,q){return O.H.useEffect(R,q)},Yt.useEffectEvent=function(R){return O.H.useEffectEvent(R)},Yt.useId=function(){return O.H.useId()},Yt.useImperativeHandle=function(R,q,W){return O.H.useImperativeHandle(R,q,W)},Yt.useInsertionEffect=function(R,q){return O.H.useInsertionEffect(R,q)},Yt.useLayoutEffect=function(R,q){return O.H.useLayoutEffect(R,q)},Yt.useMemo=function(R,q){return O.H.useMemo(R,q)},Yt.useOptimistic=function(R,q){return O.H.useOptimistic(R,q)},Yt.useReducer=function(R,q,W){return O.H.useReducer(R,q,W)},Yt.useRef=function(R){return O.H.useRef(R)},Yt.useState=function(R){return O.H.useState(R)},Yt.useSyncExternalStore=function(R,q,W){return O.H.useSyncExternalStore(R,q,W)},Yt.useTransition=function(){return O.H.useTransition()},Yt.version="19.2.4",Yt}var W3;function mv(){return W3||(W3=1,Nw.exports=mX()),Nw.exports}var b=mv();const ip=wu(b),jE=hX({__proto__:null,default:ip},[b]);var Ew={exports:{}},im={},Aw={exports:{}},Tw={};/**
 * @license React
 * scheduler.production.js
 *
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */var q3;function gX(){return q3||(q3=1,(function(e){function n(I,X){var K=I.length;I.push(X);e:for(;0<K;){var Q=K-1>>>1,V=I[Q];if(0<s(V,X))I[Q]=X,I[K]=V,K=Q;else break e}}function r(I){return I.length===0?null:I[0]}function i(I){if(I.length===0)return null;var X=I[0],K=I.pop();if(K!==X){I[0]=K;e:for(var Q=0,V=I.length,R=V>>>1;Q<R;){var q=2*(Q+1)-1,W=I[q],te=q+1,J=I[te];if(0>s(W,K))te<V&&0>s(J,W)?(I[Q]=J,I[te]=K,Q=te):(I[Q]=W,I[q]=K,Q=q);else if(te<V&&0>s(J,K))I[Q]=J,I[te]=K,Q=te;else break e}}return X}function s(I,X){var K=I.sortIndex-X.sortIndex;return K!==0?K:I.id-X.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,l=o.now();e.unstable_now=function(){return o.now()-l}}var u=[],d=[],p=1,f=null,g=3,_=!1,x=!1,v=!1,S=!1,w=typeof setTimeout=="function"?setTimeout:null,j=typeof clearTimeout=="function"?clearTimeout:null,C=typeof setImmediate<"u"?setImmediate:null;function T(I){for(var X=r(d);X!==null;){if(X.callback===null)i(d);else if(X.startTime<=I)i(d),X.sortIndex=X.expirationTime,n(u,X);else break;X=r(d)}}function E(I){if(v=!1,T(I),!x)if(r(u)!==null)x=!0,A||(A=!0,B());else{var X=r(d);X!==null&&U(E,X.startTime-I)}}var A=!1,O=-1,F=5,L=-1;function $(){return S?!0:!(e.unstable_now()-L<F)}function z(){if(S=!1,A){var I=e.unstable_now();L=I;var X=!0;try{e:{x=!1,v&&(v=!1,j(O),O=-1),_=!0;var K=g;try{t:{for(T(I),f=r(u);f!==null&&!(f.expirationTime>I&&$());){var Q=f.callback;if(typeof Q=="function"){f.callback=null,g=f.priorityLevel;var V=Q(f.expirationTime<=I);if(I=e.unstable_now(),typeof V=="function"){f.callback=V,T(I),X=!0;break t}f===r(u)&&i(u),T(I)}else i(u);f=r(u)}if(f!==null)X=!0;else{var R=r(d);R!==null&&U(E,R.startTime-I),X=!1}}break e}finally{f=null,g=K,_=!1}X=void 0}}finally{X?B():A=!1}}}var B;if(typeof C=="function")B=function(){C(z)};else if(typeof MessageChannel<"u"){var H=new MessageChannel,D=H.port2;H.port1.onmessage=z,B=function(){D.postMessage(null)}}else B=function(){w(z,0)};function U(I,X){O=w(function(){I(e.unstable_now())},X)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(I){I.callback=null},e.unstable_forceFrameRate=function(I){0>I||125<I?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):F=0<I?Math.floor(1e3/I):5},e.unstable_getCurrentPriorityLevel=function(){return g},e.unstable_next=function(I){switch(g){case 1:case 2:case 3:var X=3;break;default:X=g}var K=g;g=X;try{return I()}finally{g=K}},e.unstable_requestPaint=function(){S=!0},e.unstable_runWithPriority=function(I,X){switch(I){case 1:case 2:case 3:case 4:case 5:break;default:I=3}var K=g;g=I;try{return X()}finally{g=K}},e.unstable_scheduleCallback=function(I,X,K){var Q=e.unstable_now();switch(typeof K=="object"&&K!==null?(K=K.delay,K=typeof K=="number"&&0<K?Q+K:Q):K=Q,I){case 1:var V=-1;break;case 2:V=250;break;case 5:V=1073741823;break;case 4:V=1e4;break;default:V=5e3}return V=K+V,I={id:p++,callback:X,priorityLevel:I,startTime:K,expirationTime:V,sortIndex:-1},K>Q?(I.sortIndex=K,n(d,I),r(u)===null&&I===r(d)&&(v?(j(O),O=-1):v=!0,U(E,K-Q))):(I.sortIndex=V,n(u,I),x||_||(x=!0,A||(A=!0,B()))),I},e.unstable_shouldYield=$,e.unstable_wrapCallback=function(I){var X=g;return function(){var K=g;g=X;try{return I.apply(this,arguments)}finally{g=K}}}})(Tw)),Tw}var U3;function vX(){return U3||(U3=1,Aw.exports=gX()),Aw.exports}var Mw={exports:{}},Bi={};/**
 * @license React
 * react-dom.production.js
 *
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */var K3;function yX(){if(K3)return Bi;K3=1;var e=mv();function n(u){var d="https://react.dev/errors/"+u;if(1<arguments.length){d+="?args[]="+encodeURIComponent(arguments[1]);for(var p=2;p<arguments.length;p++)d+="&args[]="+encodeURIComponent(arguments[p])}return"Minified React error #"+u+"; visit "+d+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function r(){}var i={d:{f:r,r:function(){throw Error(n(522))},D:r,C:r,L:r,m:r,X:r,S:r,M:r},p:0,findDOMNode:null},s=Symbol.for("react.portal");function a(u,d,p){var f=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:s,key:f==null?null:""+f,children:u,containerInfo:d,implementation:p}}var o=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function l(u,d){if(u==="font")return"";if(typeof d=="string")return d==="use-credentials"?d:""}return Bi.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=i,Bi.createPortal=function(u,d){var p=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!d||d.nodeType!==1&&d.nodeType!==9&&d.nodeType!==11)throw Error(n(299));return a(u,d,null,p)},Bi.flushSync=function(u){var d=o.T,p=i.p;try{if(o.T=null,i.p=2,u)return u()}finally{o.T=d,i.p=p,i.d.f()}},Bi.preconnect=function(u,d){typeof u=="string"&&(d?(d=d.crossOrigin,d=typeof d=="string"?d==="use-credentials"?d:"":void 0):d=null,i.d.C(u,d))},Bi.prefetchDNS=function(u){typeof u=="string"&&i.d.D(u)},Bi.preinit=function(u,d){if(typeof u=="string"&&d&&typeof d.as=="string"){var p=d.as,f=l(p,d.crossOrigin),g=typeof d.integrity=="string"?d.integrity:void 0,_=typeof d.fetchPriority=="string"?d.fetchPriority:void 0;p==="style"?i.d.S(u,typeof d.precedence=="string"?d.precedence:void 0,{crossOrigin:f,integrity:g,fetchPriority:_}):p==="script"&&i.d.X(u,{crossOrigin:f,integrity:g,fetchPriority:_,nonce:typeof d.nonce=="string"?d.nonce:void 0})}},Bi.preinitModule=function(u,d){if(typeof u=="string")if(typeof d=="object"&&d!==null){if(d.as==null||d.as==="script"){var p=l(d.as,d.crossOrigin);i.d.M(u,{crossOrigin:p,integrity:typeof d.integrity=="string"?d.integrity:void 0,nonce:typeof d.nonce=="string"?d.nonce:void 0})}}else d==null&&i.d.M(u)},Bi.preload=function(u,d){if(typeof u=="string"&&typeof d=="object"&&d!==null&&typeof d.as=="string"){var p=d.as,f=l(p,d.crossOrigin);i.d.L(u,p,{crossOrigin:f,integrity:typeof d.integrity=="string"?d.integrity:void 0,nonce:typeof d.nonce=="string"?d.nonce:void 0,type:typeof d.type=="string"?d.type:void 0,fetchPriority:typeof d.fetchPriority=="string"?d.fetchPriority:void 0,referrerPolicy:typeof d.referrerPolicy=="string"?d.referrerPolicy:void 0,imageSrcSet:typeof d.imageSrcSet=="string"?d.imageSrcSet:void 0,imageSizes:typeof d.imageSizes=="string"?d.imageSizes:void 0,media:typeof d.media=="string"?d.media:void 0})}},Bi.preloadModule=function(u,d){if(typeof u=="string")if(d){var p=l(d.as,d.crossOrigin);i.d.m(u,{as:typeof d.as=="string"&&d.as!=="script"?d.as:void 0,crossOrigin:p,integrity:typeof d.integrity=="string"?d.integrity:void 0})}else i.d.m(u)},Bi.requestFormReset=function(u){i.d.r(u)},Bi.unstable_batchedUpdates=function(u,d){return u(d)},Bi.useFormState=function(u,d,p){return o.H.useFormState(u,d,p)},Bi.useFormStatus=function(){return o.H.useHostTransitionStatus()},Bi.version="19.2.4",Bi}var V3;function jB(){if(V3)return Mw.exports;V3=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(n){console.error(n)}}return e(),Mw.exports=yX(),Mw.exports}/**
 * @license React
 * react-dom-client.production.js
 *
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */var Y3;function _X(){if(Y3)return im;Y3=1;var e=vX(),n=mv(),r=jB();function i(h){var m="https://react.dev/errors/"+h;if(1<arguments.length){m+="?args[]="+encodeURIComponent(arguments[1]);for(var y=2;y<arguments.length;y++)m+="&args[]="+encodeURIComponent(arguments[y])}return"Minified React error #"+h+"; visit "+m+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function s(h){return!(!h||h.nodeType!==1&&h.nodeType!==9&&h.nodeType!==11)}function a(h){var m=h,y=h;if(h.alternate)for(;m.return;)m=m.return;else{h=m;do m=h,(m.flags&4098)!==0&&(y=m.return),h=m.return;while(h)}return m.tag===3?y:null}function o(h){if(h.tag===13){var m=h.memoizedState;if(m===null&&(h=h.alternate,h!==null&&(m=h.memoizedState)),m!==null)return m.dehydrated}return null}function l(h){if(h.tag===31){var m=h.memoizedState;if(m===null&&(h=h.alternate,h!==null&&(m=h.memoizedState)),m!==null)return m.dehydrated}return null}function u(h){if(a(h)!==h)throw Error(i(188))}function d(h){var m=h.alternate;if(!m){if(m=a(h),m===null)throw Error(i(188));return m!==h?null:h}for(var y=h,k=m;;){var N=y.return;if(N===null)break;var M=N.alternate;if(M===null){if(k=N.return,k!==null){y=k;continue}break}if(N.child===M.child){for(M=N.child;M;){if(M===y)return u(N),h;if(M===k)return u(N),m;M=M.sibling}throw Error(i(188))}if(y.return!==k.return)y=N,k=M;else{for(var Y=!1,ee=N.child;ee;){if(ee===y){Y=!0,y=N,k=M;break}if(ee===k){Y=!0,k=N,y=M;break}ee=ee.sibling}if(!Y){for(ee=M.child;ee;){if(ee===y){Y=!0,y=M,k=N;break}if(ee===k){Y=!0,k=M,y=N;break}ee=ee.sibling}if(!Y)throw Error(i(189))}}if(y.alternate!==k)throw Error(i(190))}if(y.tag!==3)throw Error(i(188));return y.stateNode.current===y?h:m}function p(h){var m=h.tag;if(m===5||m===26||m===27||m===6)return h;for(h=h.child;h!==null;){if(m=p(h),m!==null)return m;h=h.sibling}return null}var f=Object.assign,g=Symbol.for("react.element"),_=Symbol.for("react.transitional.element"),x=Symbol.for("react.portal"),v=Symbol.for("react.fragment"),S=Symbol.for("react.strict_mode"),w=Symbol.for("react.profiler"),j=Symbol.for("react.consumer"),C=Symbol.for("react.context"),T=Symbol.for("react.forward_ref"),E=Symbol.for("react.suspense"),A=Symbol.for("react.suspense_list"),O=Symbol.for("react.memo"),F=Symbol.for("react.lazy"),L=Symbol.for("react.activity"),$=Symbol.for("react.memo_cache_sentinel"),z=Symbol.iterator;function B(h){return h===null||typeof h!="object"?null:(h=z&&h[z]||h["@@iterator"],typeof h=="function"?h:null)}var H=Symbol.for("react.client.reference");function D(h){if(h==null)return null;if(typeof h=="function")return h.$$typeof===H?null:h.displayName||h.name||null;if(typeof h=="string")return h;switch(h){case v:return"Fragment";case w:return"Profiler";case S:return"StrictMode";case E:return"Suspense";case A:return"SuspenseList";case L:return"Activity"}if(typeof h=="object")switch(h.$$typeof){case x:return"Portal";case C:return h.displayName||"Context";case j:return(h._context.displayName||"Context")+".Consumer";case T:var m=h.render;return h=h.displayName,h||(h=m.displayName||m.name||"",h=h!==""?"ForwardRef("+h+")":"ForwardRef"),h;case O:return m=h.displayName||null,m!==null?m:D(h.type)||"Memo";case F:m=h._payload,h=h._init;try{return D(h(m))}catch{}}return null}var U=Array.isArray,I=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,X=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,K={pending:!1,data:null,method:null,action:null},Q=[],V=-1;function R(h){return{current:h}}function q(h){0>V||(h.current=Q[V],Q[V]=null,V--)}function W(h,m){V++,Q[V]=h.current,h.current=m}var te=R(null),J=R(null),G=R(null),re=R(null);function ne(h,m){switch(W(G,m),W(J,h),W(te,null),m.nodeType){case 9:case 11:h=(h=m.documentElement)&&(h=h.namespaceURI)?c3(h):0;break;default:if(h=m.tagName,m=m.namespaceURI)m=c3(m),h=u3(m,h);else switch(h){case"svg":h=1;break;case"math":h=2;break;default:h=0}}q(te),W(te,h)}function le(){q(te),q(J),q(G)}function oe(h){h.memoizedState!==null&&W(re,h);var m=te.current,y=u3(m,h.type);m!==y&&(W(J,h),W(te,y))}function ie(h){J.current===h&&(q(te),q(J)),re.current===h&&(q(re),Jp._currentValue=K)}var he,Z;function de(h){if(he===void 0)try{throw Error()}catch(y){var m=y.stack.trim().match(/\n( *(at )?)/);he=m&&m[1]||"",Z=-1<y.stack.indexOf(`
    at`)?" (<anonymous>)":-1<y.stack.indexOf("@")?"@unknown:0:0":""}return`
`+he+h+Z}var ue=!1;function pe(h,m){if(!h||ue)return"";ue=!0;var y=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var k={DetermineComponentFrameRoot:function(){try{if(m){var $e=function(){throw Error()};if(Object.defineProperty($e.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct($e,[])}catch(Ae){var je=Ae}Reflect.construct(h,[],$e)}else{try{$e.call()}catch(Ae){je=Ae}h.call($e.prototype)}}else{try{throw Error()}catch(Ae){je=Ae}($e=h())&&typeof $e.catch=="function"&&$e.catch(function(){})}}catch(Ae){if(Ae&&je&&typeof Ae.stack=="string")return[Ae.stack,je.stack]}return[null,null]}};k.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var N=Object.getOwnPropertyDescriptor(k.DetermineComponentFrameRoot,"name");N&&N.configurable&&Object.defineProperty(k.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var M=k.DetermineComponentFrameRoot(),Y=M[0],ee=M[1];if(Y&&ee){var ce=Y.split(`
`),we=ee.split(`
`);for(N=k=0;k<ce.length&&!ce[k].includes("DetermineComponentFrameRoot");)k++;for(;N<we.length&&!we[N].includes("DetermineComponentFrameRoot");)N++;if(k===ce.length||N===we.length)for(k=ce.length-1,N=we.length-1;1<=k&&0<=N&&ce[k]!==we[N];)N--;for(;1<=k&&0<=N;k--,N--)if(ce[k]!==we[N]){if(k!==1||N!==1)do if(k--,N--,0>N||ce[k]!==we[N]){var De=`
`+ce[k].replace(" at new "," at ");return h.displayName&&De.includes("<anonymous>")&&(De=De.replace("<anonymous>",h.displayName)),De}while(1<=k&&0<=N);break}}}finally{ue=!1,Error.prepareStackTrace=y}return(y=h?h.displayName||h.name:"")?de(y):""}function Oe(h,m){switch(h.tag){case 26:case 27:case 5:return de(h.type);case 16:return de("Lazy");case 13:return h.child!==m&&m!==null?de("Suspense Fallback"):de("Suspense");case 19:return de("SuspenseList");case 0:case 15:return pe(h.type,!1);case 11:return pe(h.type.render,!1);case 1:return pe(h.type,!0);case 31:return de("Activity");default:return""}}function fe(h){try{var m="",y=null;do m+=Oe(h,y),y=h,h=h.return;while(h);return m}catch(k){return`
Error generating stack: `+k.message+`
`+k.stack}}var Le=Object.prototype.hasOwnProperty,Ee=e.unstable_scheduleCallback,Bt=e.unstable_cancelCallback,Xe=e.unstable_shouldYield,St=e.unstable_requestPaint,yt=e.unstable_now,Rt=e.unstable_getCurrentPriorityLevel,be=e.unstable_ImmediatePriority,He=e.unstable_UserBlockingPriority,ht=e.unstable_NormalPriority,ot=e.unstable_LowPriority,$t=e.unstable_IdlePriority,jn=e.log,Pn=e.unstable_setDisableYieldValue,We=null,ut=null;function Ct(h){if(typeof jn=="function"&&Pn(h),ut&&typeof ut.setStrictMode=="function")try{ut.setStrictMode(We,h)}catch{}}var Mt=Math.clz32?Math.clz32:bt,Ge=Math.log,tt=Math.LN2;function bt(h){return h>>>=0,h===0?32:31-(Ge(h)/tt|0)|0}var Nt=256,it=262144,dt=4194304;function Vt(h){var m=h&42;if(m!==0)return m;switch(h&-h){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return h&261888;case 262144:case 524288:case 1048576:case 2097152:return h&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return h&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return h}}function jt(h,m,y){var k=h.pendingLanes;if(k===0)return 0;var N=0,M=h.suspendedLanes,Y=h.pingedLanes;h=h.warmLanes;var ee=k&134217727;return ee!==0?(k=ee&~M,k!==0?N=Vt(k):(Y&=ee,Y!==0?N=Vt(Y):y||(y=ee&~h,y!==0&&(N=Vt(y))))):(ee=k&~M,ee!==0?N=Vt(ee):Y!==0?N=Vt(Y):y||(y=k&~h,y!==0&&(N=Vt(y)))),N===0?0:m!==0&&m!==N&&(m&M)===0&&(M=N&-N,y=m&-m,M>=y||M===32&&(y&4194048)!==0)?m:N}function Ht(h,m){return(h.pendingLanes&~(h.suspendedLanes&~h.pingedLanes)&m)===0}function rr(h,m){switch(h){case 1:case 2:case 4:case 8:case 64:return m+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return m+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Wt(){var h=dt;return dt<<=1,(dt&62914560)===0&&(dt=4194304),h}function Mn(h){for(var m=[],y=0;31>y;y++)m.push(h);return m}function ge(h,m){h.pendingLanes|=m,m!==268435456&&(h.suspendedLanes=0,h.pingedLanes=0,h.warmLanes=0)}function Re(h,m,y,k,N,M){var Y=h.pendingLanes;h.pendingLanes=y,h.suspendedLanes=0,h.pingedLanes=0,h.warmLanes=0,h.expiredLanes&=y,h.entangledLanes&=y,h.errorRecoveryDisabledLanes&=y,h.shellSuspendCounter=0;var ee=h.entanglements,ce=h.expirationTimes,we=h.hiddenUpdates;for(y=Y&~y;0<y;){var De=31-Mt(y),$e=1<<De;ee[De]=0,ce[De]=-1;var je=we[De];if(je!==null)for(we[De]=null,De=0;De<je.length;De++){var Ae=je[De];Ae!==null&&(Ae.lane&=-536870913)}y&=~$e}k!==0&&et(h,k,0),M!==0&&N===0&&h.tag!==0&&(h.suspendedLanes|=M&~(Y&~m))}function et(h,m,y){h.pendingLanes|=m,h.suspendedLanes&=~m;var k=31-Mt(m);h.entangledLanes|=m,h.entanglements[k]=h.entanglements[k]|1073741824|y&261930}function tn(h,m){var y=h.entangledLanes|=m;for(h=h.entanglements;y;){var k=31-Mt(y),N=1<<k;N&m|h[k]&m&&(h[k]|=m),y&=~N}}function Jt(h,m){var y=m&-m;return y=(y&42)!==0?1:Ft(y),(y&(h.suspendedLanes|m))!==0?0:y}function Ft(h){switch(h){case 2:h=1;break;case 8:h=4;break;case 32:h=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:h=128;break;case 268435456:h=134217728;break;default:h=0}return h}function ir(h){return h&=-h,2<h?8<h?(h&134217727)!==0?32:268435456:8:2}function xi(){var h=X.p;return h!==0?h:(h=window.event,h===void 0?32:O3(h.type))}function on(h,m){var y=X.p;try{return X.p=h,m()}finally{X.p=y}}var qt=Math.random().toString(36).slice(2),P="__reactFiber$"+qt,Ie="__reactProps$"+qt,st="__reactContainer$"+qt,Kt="__reactEvents$"+qt,jr="__reactListeners$"+qt,Zr="__reactHandles$"+qt,ho="__reactResources$"+qt,hs="__reactMarker$"+qt;function ll(h){delete h[P],delete h[Ie],delete h[Kt],delete h[jr],delete h[Zr]}function fs(h){var m=h[P];if(m)return m;for(var y=h.parentNode;y;){if(m=y[st]||y[P]){if(y=m.alternate,m.child!==null||y!==null&&y.child!==null)for(h=v3(h);h!==null;){if(y=h[P])return y;h=v3(h)}return m}h=y,y=h.parentNode}return null}function Pi(h){if(h=h[P]||h[st]){var m=h.tag;if(m===5||m===6||m===13||m===31||m===26||m===27||m===3)return h}return null}function Qi(h){var m=h.tag;if(m===5||m===26||m===27||m===6)return h.stateNode;throw Error(i(33))}function Fr(h){var m=h[ho];return m||(m=h[ho]={hoistableStyles:new Map,hoistableScripts:new Map}),m}function Vn(h){h[hs]=!0}var cl=new Set,lc={};function Ls(h,m){la(h,m),la(h+"Capture",m)}function la(h,m){for(lc[h]=m,h=0;h<m.length;h++)cl.add(m[h])}var Eu=RegExp("^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$"),ul={},Is={};function dl(h){return Le.call(Is,h)?!0:Le.call(ul,h)?!1:Eu.test(h)?Is[h]=!0:(ul[h]=!0,!1)}function hr(h,m,y){if(dl(m))if(y===null)h.removeAttribute(m);else{switch(typeof y){case"undefined":case"function":case"symbol":h.removeAttribute(m);return;case"boolean":var k=m.toLowerCase().slice(0,5);if(k!=="data-"&&k!=="aria-"){h.removeAttribute(m);return}}h.setAttribute(m,""+y)}}function Bs(h,m,y){if(y===null)h.removeAttribute(m);else{switch(typeof y){case"undefined":case"function":case"symbol":case"boolean":h.removeAttribute(m);return}h.setAttribute(m,""+y)}}function Jr(h,m,y,k){if(k===null)h.removeAttribute(y);else{switch(typeof k){case"undefined":case"function":case"symbol":case"boolean":h.removeAttribute(y);return}h.setAttributeNS(m,y,""+k)}}function li(h){switch(typeof h){case"bigint":case"boolean":case"number":case"string":case"undefined":return h;case"object":return h;default:return""}}function fo(h){var m=h.type;return(h=h.nodeName)&&h.toLowerCase()==="input"&&(m==="checkbox"||m==="radio")}function Au(h,m,y){var k=Object.getOwnPropertyDescriptor(h.constructor.prototype,m);if(!h.hasOwnProperty(m)&&typeof k<"u"&&typeof k.get=="function"&&typeof k.set=="function"){var N=k.get,M=k.set;return Object.defineProperty(h,m,{configurable:!0,get:function(){return N.call(this)},set:function(Y){y=""+Y,M.call(this,Y)}}),Object.defineProperty(h,m,{enumerable:k.enumerable}),{getValue:function(){return y},setValue:function(Y){y=""+Y},stopTracking:function(){h._valueTracker=null,delete h[m]}}}}function bi(h){if(!h._valueTracker){var m=fo(h)?"checked":"value";h._valueTracker=Au(h,m,""+h[m])}}function po(h){if(!h)return!1;var m=h._valueTracker;if(!m)return!0;var y=m.getValue(),k="";return h&&(k=fo(h)?h.checked?"true":"false":h.value),h=k,h!==y?(m.setValue(h),!0):!1}function ae(h){if(h=h||(typeof document<"u"?document:void 0),typeof h>"u")return null;try{return h.activeElement||h.body}catch{return h.body}}var Ce=/[\n"\\]/g;function at(h){return h.replace(Ce,function(m){return"\\"+m.charCodeAt(0).toString(16)+" "})}function Ot(h,m,y,k,N,M,Y,ee){h.name="",Y!=null&&typeof Y!="function"&&typeof Y!="symbol"&&typeof Y!="boolean"?h.type=Y:h.removeAttribute("type"),m!=null?Y==="number"?(m===0&&h.value===""||h.value!=m)&&(h.value=""+li(m)):h.value!==""+li(m)&&(h.value=""+li(m)):Y!=="submit"&&Y!=="reset"||h.removeAttribute("value"),m!=null?Li(h,Y,li(m)):y!=null?Li(h,Y,li(y)):k!=null&&h.removeAttribute("value"),N==null&&M!=null&&(h.defaultChecked=!!M),N!=null&&(h.checked=N&&typeof N!="function"&&typeof N!="symbol"),ee!=null&&typeof ee!="function"&&typeof ee!="symbol"&&typeof ee!="boolean"?h.name=""+li(ee):h.removeAttribute("name")}function Yn(h,m,y,k,N,M,Y,ee){if(M!=null&&typeof M!="function"&&typeof M!="symbol"&&typeof M!="boolean"&&(h.type=M),m!=null||y!=null){if(!(M!=="submit"&&M!=="reset"||m!=null)){bi(h);return}y=y!=null?""+li(y):"",m=m!=null?""+li(m):y,ee||m===h.value||(h.value=m),h.defaultValue=m}k=k??N,k=typeof k!="function"&&typeof k!="symbol"&&!!k,h.checked=ee?h.checked:!!k,h.defaultChecked=!!k,Y!=null&&typeof Y!="function"&&typeof Y!="symbol"&&typeof Y!="boolean"&&(h.name=Y),bi(h)}function Li(h,m,y){m==="number"&&ae(h.ownerDocument)===h||h.defaultValue===""+y||(h.defaultValue=""+y)}function Ii(h,m,y,k){if(h=h.options,m){m={};for(var N=0;N<y.length;N++)m["$"+y[N]]=!0;for(y=0;y<h.length;y++)N=m.hasOwnProperty("$"+h[y].value),h[y].selected!==N&&(h[y].selected=N),N&&k&&(h[y].defaultSelected=!0)}else{for(y=""+li(y),m=null,N=0;N<h.length;N++){if(h[N].value===y){h[N].selected=!0,k&&(h[N].defaultSelected=!0);return}m!==null||h[N].disabled||(m=h[N])}m!==null&&(m.selected=!0)}}function gp(h,m,y){if(m!=null&&(m=""+li(m),m!==h.value&&(h.value=m),y==null)){h.defaultValue!==m&&(h.defaultValue=m);return}h.defaultValue=y!=null?""+li(y):""}function Xd(h,m,y,k){if(m==null){if(k!=null){if(y!=null)throw Error(i(92));if(U(k)){if(1<k.length)throw Error(i(93));k=k[0]}y=k}y==null&&(y=""),m=y}y=li(m),h.defaultValue=y,k=h.textContent,k===y&&k!==""&&k!==null&&(h.value=k),bi(h)}function mo(h,m){if(m){var y=h.firstChild;if(y&&y===h.lastChild&&y.nodeType===3){y.nodeValue=m;return}}h.textContent=m}var ey=new Set("animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp".split(" "));function vp(h,m,y){var k=m.indexOf("--")===0;y==null||typeof y=="boolean"||y===""?k?h.setProperty(m,""):m==="float"?h.cssFloat="":h[m]="":k?h.setProperty(m,y):typeof y!="number"||y===0||ey.has(m)?m==="float"?h.cssFloat=y:h[m]=(""+y).trim():h[m]=y+"px"}function ty(h,m,y){if(m!=null&&typeof m!="object")throw Error(i(62));if(h=h.style,y!=null){for(var k in y)!y.hasOwnProperty(k)||m!=null&&m.hasOwnProperty(k)||(k.indexOf("--")===0?h.setProperty(k,""):k==="float"?h.cssFloat="":h[k]="");for(var N in m)k=m[N],m.hasOwnProperty(N)&&y[N]!==k&&vp(h,N,k)}else for(var M in m)m.hasOwnProperty(M)&&vp(h,M,m[M])}function yp(h){if(h.indexOf("-")===-1)return!1;switch(h){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var Ek=new Map([["acceptCharset","accept-charset"],["htmlFor","for"],["httpEquiv","http-equiv"],["crossOrigin","crossorigin"],["accentHeight","accent-height"],["alignmentBaseline","alignment-baseline"],["arabicForm","arabic-form"],["baselineShift","baseline-shift"],["capHeight","cap-height"],["clipPath","clip-path"],["clipRule","clip-rule"],["colorInterpolation","color-interpolation"],["colorInterpolationFilters","color-interpolation-filters"],["colorProfile","color-profile"],["colorRendering","color-rendering"],["dominantBaseline","dominant-baseline"],["enableBackground","enable-background"],["fillOpacity","fill-opacity"],["fillRule","fill-rule"],["floodColor","flood-color"],["floodOpacity","flood-opacity"],["fontFamily","font-family"],["fontSize","font-size"],["fontSizeAdjust","font-size-adjust"],["fontStretch","font-stretch"],["fontStyle","font-style"],["fontVariant","font-variant"],["fontWeight","font-weight"],["glyphName","glyph-name"],["glyphOrientationHorizontal","glyph-orientation-horizontal"],["glyphOrientationVertical","glyph-orientation-vertical"],["horizAdvX","horiz-adv-x"],["horizOriginX","horiz-origin-x"],["imageRendering","image-rendering"],["letterSpacing","letter-spacing"],["lightingColor","lighting-color"],["markerEnd","marker-end"],["markerMid","marker-mid"],["markerStart","marker-start"],["overlinePosition","overline-position"],["overlineThickness","overline-thickness"],["paintOrder","paint-order"],["panose-1","panose-1"],["pointerEvents","pointer-events"],["renderingIntent","rendering-intent"],["shapeRendering","shape-rendering"],["stopColor","stop-color"],["stopOpacity","stop-opacity"],["strikethroughPosition","strikethrough-position"],["strikethroughThickness","strikethrough-thickness"],["strokeDasharray","stroke-dasharray"],["strokeDashoffset","stroke-dashoffset"],["strokeLinecap","stroke-linecap"],["strokeLinejoin","stroke-linejoin"],["strokeMiterlimit","stroke-miterlimit"],["strokeOpacity","stroke-opacity"],["strokeWidth","stroke-width"],["textAnchor","text-anchor"],["textDecoration","text-decoration"],["textRendering","text-rendering"],["transformOrigin","transform-origin"],["underlinePosition","underline-position"],["underlineThickness","underline-thickness"],["unicodeBidi","unicode-bidi"],["unicodeRange","unicode-range"],["unitsPerEm","units-per-em"],["vAlphabetic","v-alphabetic"],["vHanging","v-hanging"],["vIdeographic","v-ideographic"],["vMathematical","v-mathematical"],["vectorEffect","vector-effect"],["vertAdvY","vert-adv-y"],["vertOriginX","vert-origin-x"],["vertOriginY","vert-origin-y"],["wordSpacing","word-spacing"],["writingMode","writing-mode"],["xmlnsXlink","xmlns:xlink"],["xHeight","x-height"]]),Ak=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function Qd(h){return Ak.test(""+h)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":h}function ca(){}var _p=null;function Zd(h){return h=h.target||h.srcElement||window,h.correspondingUseElement&&(h=h.correspondingUseElement),h.nodeType===3?h.parentNode:h}var Ia=null,go=null;function se(h){var m=Pi(h);if(m&&(h=m.stateNode)){var y=h[Ie]||null;e:switch(h=m.stateNode,m.type){case"input":if(Ot(h,y.value,y.defaultValue,y.defaultValue,y.checked,y.defaultChecked,y.type,y.name),m=y.name,y.type==="radio"&&m!=null){for(y=h;y.parentNode;)y=y.parentNode;for(y=y.querySelectorAll('input[name="'+at(""+m)+'"][type="radio"]'),m=0;m<y.length;m++){var k=y[m];if(k!==h&&k.form===h.form){var N=k[Ie]||null;if(!N)throw Error(i(90));Ot(k,N.value,N.defaultValue,N.defaultValue,N.checked,N.defaultChecked,N.type,N.name)}}for(m=0;m<y.length;m++)k=y[m],k.form===h.form&&po(k)}break e;case"textarea":gp(h,y.value,y.defaultValue);break e;case"select":m=y.value,m!=null&&Ii(h,!!y.multiple,m,!1)}}}var ye=!1;function Ne(h,m,y){if(ye)return h(m,y);ye=!0;try{var k=h(m);return k}finally{if(ye=!1,(Ia!==null||go!==null)&&(By(),Ia&&(m=Ia,h=go,go=Ia=null,se(m),h)))for(m=0;m<h.length;m++)se(h[m])}}function Me(h,m){var y=h.stateNode;if(y===null)return null;var k=y[Ie]||null;if(k===null)return null;y=k[m];e:switch(m){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(k=!k.disabled)||(h=h.type,k=!(h==="button"||h==="input"||h==="select"||h==="textarea")),h=!k;break e;default:h=!1}if(h)return null;if(y&&typeof y!="function")throw Error(i(231,m,typeof y));return y}var Ue=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Qe=!1;if(Ue)try{var mt={};Object.defineProperty(mt,"passive",{get:function(){Qe=!0}}),window.addEventListener("test",mt,mt),window.removeEventListener("test",mt,mt)}catch{Qe=!1}var ln=null,Nn=null,en=null;function Dt(){if(en)return en;var h,m=Nn,y=m.length,k,N="value"in ln?ln.value:ln.textContent,M=N.length;for(h=0;h<y&&m[h]===N[h];h++);var Y=y-h;for(k=1;k<=Y&&m[y-k]===N[M-k];k++);return en=N.slice(h,1<k?1-k:void 0)}function xn(h){var m=h.keyCode;return"charCode"in h?(h=h.charCode,h===0&&m===13&&(h=13)):h=m,h===10&&(h=13),32<=h||h===13?h:0}function Lt(){return!0}function Rn(){return!1}function mn(h){function m(y,k,N,M,Y){this._reactName=y,this._targetInst=N,this.type=k,this.nativeEvent=M,this.target=Y,this.currentTarget=null;for(var ee in h)h.hasOwnProperty(ee)&&(y=h[ee],this[ee]=y?y(M):M[ee]);return this.isDefaultPrevented=(M.defaultPrevented!=null?M.defaultPrevented:M.returnValue===!1)?Lt:Rn,this.isPropagationStopped=Rn,this}return f(m.prototype,{preventDefault:function(){this.defaultPrevented=!0;var y=this.nativeEvent;y&&(y.preventDefault?y.preventDefault():typeof y.returnValue!="unknown"&&(y.returnValue=!1),this.isDefaultPrevented=Lt)},stopPropagation:function(){var y=this.nativeEvent;y&&(y.stopPropagation?y.stopPropagation():typeof y.cancelBubble!="unknown"&&(y.cancelBubble=!0),this.isPropagationStopped=Lt)},persist:function(){},isPersistent:Lt}),m}var Nr={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(h){return h.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Gn=mn(Nr),ki=f({},Nr,{view:0,detail:0}),vo=mn(ki),yo,Tu,Mu,ny=f({},ki,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Mk,button:0,buttons:0,relatedTarget:function(h){return h.relatedTarget===void 0?h.fromElement===h.srcElement?h.toElement:h.fromElement:h.relatedTarget},movementX:function(h){return"movementX"in h?h.movementX:(h!==Mu&&(Mu&&h.type==="mousemove"?(yo=h.screenX-Mu.screenX,Tu=h.screenY-Mu.screenY):Tu=yo=0,Mu=h),yo)},movementY:function(h){return"movementY"in h?h.movementY:Tu}}),hM=mn(ny),cY=f({},ny,{dataTransfer:0}),uY=mn(cY),dY=f({},ki,{relatedTarget:0}),Tk=mn(dY),hY=f({},Nr,{animationName:0,elapsedTime:0,pseudoElement:0}),fY=mn(hY),pY=f({},Nr,{clipboardData:function(h){return"clipboardData"in h?h.clipboardData:window.clipboardData}}),mY=mn(pY),gY=f({},Nr,{data:0}),fM=mn(gY),vY={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},yY={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},_Y={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function xY(h){var m=this.nativeEvent;return m.getModifierState?m.getModifierState(h):(h=_Y[h])?!!m[h]:!1}function Mk(){return xY}var bY=f({},ki,{key:function(h){if(h.key){var m=vY[h.key]||h.key;if(m!=="Unidentified")return m}return h.type==="keypress"?(h=xn(h),h===13?"Enter":String.fromCharCode(h)):h.type==="keydown"||h.type==="keyup"?yY[h.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Mk,charCode:function(h){return h.type==="keypress"?xn(h):0},keyCode:function(h){return h.type==="keydown"||h.type==="keyup"?h.keyCode:0},which:function(h){return h.type==="keypress"?xn(h):h.type==="keydown"||h.type==="keyup"?h.keyCode:0}}),kY=mn(bY),wY=f({},ny,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),pM=mn(wY),SY=f({},ki,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Mk}),CY=mn(SY),jY=f({},Nr,{propertyName:0,elapsedTime:0,pseudoElement:0}),NY=mn(jY),EY=f({},ny,{deltaX:function(h){return"deltaX"in h?h.deltaX:"wheelDeltaX"in h?-h.wheelDeltaX:0},deltaY:function(h){return"deltaY"in h?h.deltaY:"wheelDeltaY"in h?-h.wheelDeltaY:"wheelDelta"in h?-h.wheelDelta:0},deltaZ:0,deltaMode:0}),AY=mn(EY),TY=f({},Nr,{newState:0,oldState:0}),MY=mn(TY),RY=[9,13,27,32],Rk=Ue&&"CompositionEvent"in window,xp=null;Ue&&"documentMode"in document&&(xp=document.documentMode);var OY=Ue&&"TextEvent"in window&&!xp,mM=Ue&&(!Rk||xp&&8<xp&&11>=xp),gM=" ",vM=!1;function yM(h,m){switch(h){case"keyup":return RY.indexOf(m.keyCode)!==-1;case"keydown":return m.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function _M(h){return h=h.detail,typeof h=="object"&&"data"in h?h.data:null}var Jd=!1;function DY(h,m){switch(h){case"compositionend":return _M(m);case"keypress":return m.which!==32?null:(vM=!0,gM);case"textInput":return h=m.data,h===gM&&vM?null:h;default:return null}}function PY(h,m){if(Jd)return h==="compositionend"||!Rk&&yM(h,m)?(h=Dt(),en=Nn=ln=null,Jd=!1,h):null;switch(h){case"paste":return null;case"keypress":if(!(m.ctrlKey||m.altKey||m.metaKey)||m.ctrlKey&&m.altKey){if(m.char&&1<m.char.length)return m.char;if(m.which)return String.fromCharCode(m.which)}return null;case"compositionend":return mM&&m.locale!=="ko"?null:m.data;default:return null}}var LY={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function xM(h){var m=h&&h.nodeName&&h.nodeName.toLowerCase();return m==="input"?!!LY[h.type]:m==="textarea"}function bM(h,m,y,k){Ia?go?go.push(k):go=[k]:Ia=k,m=Uy(m,"onChange"),0<m.length&&(y=new Gn("onChange","change",null,y,k),h.push({event:y,listeners:m}))}var bp=null,kp=null;function IY(h){r3(h,0)}function ry(h){var m=Qi(h);if(po(m))return h}function kM(h,m){if(h==="change")return m}var wM=!1;if(Ue){var Ok;if(Ue){var Dk="oninput"in document;if(!Dk){var SM=document.createElement("div");SM.setAttribute("oninput","return;"),Dk=typeof SM.oninput=="function"}Ok=Dk}else Ok=!1;wM=Ok&&(!document.documentMode||9<document.documentMode)}function CM(){bp&&(bp.detachEvent("onpropertychange",jM),kp=bp=null)}function jM(h){if(h.propertyName==="value"&&ry(kp)){var m=[];bM(m,kp,h,Zd(h)),Ne(IY,m)}}function BY(h,m,y){h==="focusin"?(CM(),bp=m,kp=y,bp.attachEvent("onpropertychange",jM)):h==="focusout"&&CM()}function zY(h){if(h==="selectionchange"||h==="keyup"||h==="keydown")return ry(kp)}function $Y(h,m){if(h==="click")return ry(m)}function FY(h,m){if(h==="input"||h==="change")return ry(m)}function HY(h,m){return h===m&&(h!==0||1/h===1/m)||h!==h&&m!==m}var zs=typeof Object.is=="function"?Object.is:HY;function wp(h,m){if(zs(h,m))return!0;if(typeof h!="object"||h===null||typeof m!="object"||m===null)return!1;var y=Object.keys(h),k=Object.keys(m);if(y.length!==k.length)return!1;for(k=0;k<y.length;k++){var N=y[k];if(!Le.call(m,N)||!zs(h[N],m[N]))return!1}return!0}function NM(h){for(;h&&h.firstChild;)h=h.firstChild;return h}function EM(h,m){var y=NM(h);h=0;for(var k;y;){if(y.nodeType===3){if(k=h+y.textContent.length,h<=m&&k>=m)return{node:y,offset:m-h};h=k}e:{for(;y;){if(y.nextSibling){y=y.nextSibling;break e}y=y.parentNode}y=void 0}y=NM(y)}}function AM(h,m){return h&&m?h===m?!0:h&&h.nodeType===3?!1:m&&m.nodeType===3?AM(h,m.parentNode):"contains"in h?h.contains(m):h.compareDocumentPosition?!!(h.compareDocumentPosition(m)&16):!1:!1}function TM(h){h=h!=null&&h.ownerDocument!=null&&h.ownerDocument.defaultView!=null?h.ownerDocument.defaultView:window;for(var m=ae(h.document);m instanceof h.HTMLIFrameElement;){try{var y=typeof m.contentWindow.location.href=="string"}catch{y=!1}if(y)h=m.contentWindow;else break;m=ae(h.document)}return m}function Pk(h){var m=h&&h.nodeName&&h.nodeName.toLowerCase();return m&&(m==="input"&&(h.type==="text"||h.type==="search"||h.type==="tel"||h.type==="url"||h.type==="password")||m==="textarea"||h.contentEditable==="true")}var WY=Ue&&"documentMode"in document&&11>=document.documentMode,eh=null,Lk=null,Sp=null,Ik=!1;function MM(h,m,y){var k=y.window===y?y.document:y.nodeType===9?y:y.ownerDocument;Ik||eh==null||eh!==ae(k)||(k=eh,"selectionStart"in k&&Pk(k)?k={start:k.selectionStart,end:k.selectionEnd}:(k=(k.ownerDocument&&k.ownerDocument.defaultView||window).getSelection(),k={anchorNode:k.anchorNode,anchorOffset:k.anchorOffset,focusNode:k.focusNode,focusOffset:k.focusOffset}),Sp&&wp(Sp,k)||(Sp=k,k=Uy(Lk,"onSelect"),0<k.length&&(m=new Gn("onSelect","select",null,m,y),h.push({event:m,listeners:k}),m.target=eh)))}function Ru(h,m){var y={};return y[h.toLowerCase()]=m.toLowerCase(),y["Webkit"+h]="webkit"+m,y["Moz"+h]="moz"+m,y}var th={animationend:Ru("Animation","AnimationEnd"),animationiteration:Ru("Animation","AnimationIteration"),animationstart:Ru("Animation","AnimationStart"),transitionrun:Ru("Transition","TransitionRun"),transitionstart:Ru("Transition","TransitionStart"),transitioncancel:Ru("Transition","TransitionCancel"),transitionend:Ru("Transition","TransitionEnd")},Bk={},RM={};Ue&&(RM=document.createElement("div").style,"AnimationEvent"in window||(delete th.animationend.animation,delete th.animationiteration.animation,delete th.animationstart.animation),"TransitionEvent"in window||delete th.transitionend.transition);function Ou(h){if(Bk[h])return Bk[h];if(!th[h])return h;var m=th[h],y;for(y in m)if(m.hasOwnProperty(y)&&y in RM)return Bk[h]=m[y];return h}var OM=Ou("animationend"),DM=Ou("animationiteration"),PM=Ou("animationstart"),qY=Ou("transitionrun"),UY=Ou("transitionstart"),KY=Ou("transitioncancel"),LM=Ou("transitionend"),IM=new Map,zk="abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");zk.push("scrollEnd");function Ba(h,m){IM.set(h,m),Ls(m,[h])}var iy=typeof reportError=="function"?reportError:function(h){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var m=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof h=="object"&&h!==null&&typeof h.message=="string"?String(h.message):String(h),error:h});if(!window.dispatchEvent(m))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",h);return}console.error(h)},ua=[],nh=0,$k=0;function sy(){for(var h=nh,m=$k=nh=0;m<h;){var y=ua[m];ua[m++]=null;var k=ua[m];ua[m++]=null;var N=ua[m];ua[m++]=null;var M=ua[m];if(ua[m++]=null,k!==null&&N!==null){var Y=k.pending;Y===null?N.next=N:(N.next=Y.next,Y.next=N),k.pending=N}M!==0&&BM(y,N,M)}}function ay(h,m,y,k){ua[nh++]=h,ua[nh++]=m,ua[nh++]=y,ua[nh++]=k,$k|=k,h.lanes|=k,h=h.alternate,h!==null&&(h.lanes|=k)}function Fk(h,m,y,k){return ay(h,m,y,k),oy(h)}function Du(h,m){return ay(h,null,null,m),oy(h)}function BM(h,m,y){h.lanes|=y;var k=h.alternate;k!==null&&(k.lanes|=y);for(var N=!1,M=h.return;M!==null;)M.childLanes|=y,k=M.alternate,k!==null&&(k.childLanes|=y),M.tag===22&&(h=M.stateNode,h===null||h._visibility&1||(N=!0)),h=M,M=M.return;return h.tag===3?(M=h.stateNode,N&&m!==null&&(N=31-Mt(y),h=M.hiddenUpdates,k=h[N],k===null?h[N]=[m]:k.push(m),m.lane=y|536870912),M):null}function oy(h){if(50<Kp)throw Kp=0,X1=null,Error(i(185));for(var m=h.return;m!==null;)h=m,m=h.return;return h.tag===3?h.stateNode:null}var rh={};function VY(h,m,y,k){this.tag=h,this.key=y,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=m,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=k,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function $s(h,m,y,k){return new VY(h,m,y,k)}function Hk(h){return h=h.prototype,!(!h||!h.isReactComponent)}function hl(h,m){var y=h.alternate;return y===null?(y=$s(h.tag,m,h.key,h.mode),y.elementType=h.elementType,y.type=h.type,y.stateNode=h.stateNode,y.alternate=h,h.alternate=y):(y.pendingProps=m,y.type=h.type,y.flags=0,y.subtreeFlags=0,y.deletions=null),y.flags=h.flags&65011712,y.childLanes=h.childLanes,y.lanes=h.lanes,y.child=h.child,y.memoizedProps=h.memoizedProps,y.memoizedState=h.memoizedState,y.updateQueue=h.updateQueue,m=h.dependencies,y.dependencies=m===null?null:{lanes:m.lanes,firstContext:m.firstContext},y.sibling=h.sibling,y.index=h.index,y.ref=h.ref,y.refCleanup=h.refCleanup,y}function zM(h,m){h.flags&=65011714;var y=h.alternate;return y===null?(h.childLanes=0,h.lanes=m,h.child=null,h.subtreeFlags=0,h.memoizedProps=null,h.memoizedState=null,h.updateQueue=null,h.dependencies=null,h.stateNode=null):(h.childLanes=y.childLanes,h.lanes=y.lanes,h.child=y.child,h.subtreeFlags=0,h.deletions=null,h.memoizedProps=y.memoizedProps,h.memoizedState=y.memoizedState,h.updateQueue=y.updateQueue,h.type=y.type,m=y.dependencies,h.dependencies=m===null?null:{lanes:m.lanes,firstContext:m.firstContext}),h}function ly(h,m,y,k,N,M){var Y=0;if(k=h,typeof h=="function")Hk(h)&&(Y=1);else if(typeof h=="string")Y=ZG(h,y,te.current)?26:h==="html"||h==="head"||h==="body"?27:5;else e:switch(h){case L:return h=$s(31,y,m,N),h.elementType=L,h.lanes=M,h;case v:return Pu(y.children,N,M,m);case S:Y=8,N|=24;break;case w:return h=$s(12,y,m,N|2),h.elementType=w,h.lanes=M,h;case E:return h=$s(13,y,m,N),h.elementType=E,h.lanes=M,h;case A:return h=$s(19,y,m,N),h.elementType=A,h.lanes=M,h;default:if(typeof h=="object"&&h!==null)switch(h.$$typeof){case C:Y=10;break e;case j:Y=9;break e;case T:Y=11;break e;case O:Y=14;break e;case F:Y=16,k=null;break e}Y=29,y=Error(i(130,h===null?"null":typeof h,"")),k=null}return m=$s(Y,y,m,N),m.elementType=h,m.type=k,m.lanes=M,m}function Pu(h,m,y,k){return h=$s(7,h,k,m),h.lanes=y,h}function Wk(h,m,y){return h=$s(6,h,null,m),h.lanes=y,h}function $M(h){var m=$s(18,null,null,0);return m.stateNode=h,m}function qk(h,m,y){return m=$s(4,h.children!==null?h.children:[],h.key,m),m.lanes=y,m.stateNode={containerInfo:h.containerInfo,pendingChildren:null,implementation:h.implementation},m}var FM=new WeakMap;function da(h,m){if(typeof h=="object"&&h!==null){var y=FM.get(h);return y!==void 0?y:(m={value:h,source:m,stack:fe(m)},FM.set(h,m),m)}return{value:h,source:m,stack:fe(m)}}var ih=[],sh=0,cy=null,Cp=0,ha=[],fa=0,cc=null,_o=1,xo="";function fl(h,m){ih[sh++]=Cp,ih[sh++]=cy,cy=h,Cp=m}function HM(h,m,y){ha[fa++]=_o,ha[fa++]=xo,ha[fa++]=cc,cc=h;var k=_o;h=xo;var N=32-Mt(k)-1;k&=~(1<<N),y+=1;var M=32-Mt(m)+N;if(30<M){var Y=N-N%5;M=(k&(1<<Y)-1).toString(32),k>>=Y,N-=Y,_o=1<<32-Mt(m)+N|y<<N|k,xo=M+h}else _o=1<<M|y<<N|k,xo=h}function Uk(h){h.return!==null&&(fl(h,1),HM(h,1,0))}function Kk(h){for(;h===cy;)cy=ih[--sh],ih[sh]=null,Cp=ih[--sh],ih[sh]=null;for(;h===cc;)cc=ha[--fa],ha[fa]=null,xo=ha[--fa],ha[fa]=null,_o=ha[--fa],ha[fa]=null}function WM(h,m){ha[fa++]=_o,ha[fa++]=xo,ha[fa++]=cc,_o=m.id,xo=m.overflow,cc=h}var wi=null,sr=null,gn=!1,uc=null,pa=!1,Vk=Error(i(519));function dc(h){var m=Error(i(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw jp(da(m,h)),Vk}function qM(h){var m=h.stateNode,y=h.type,k=h.memoizedProps;switch(m[P]=h,m[Ie]=k,y){case"dialog":dn("cancel",m),dn("close",m);break;case"iframe":case"object":case"embed":dn("load",m);break;case"video":case"audio":for(y=0;y<Yp.length;y++)dn(Yp[y],m);break;case"source":dn("error",m);break;case"img":case"image":case"link":dn("error",m),dn("load",m);break;case"details":dn("toggle",m);break;case"input":dn("invalid",m),Yn(m,k.value,k.defaultValue,k.checked,k.defaultChecked,k.type,k.name,!0);break;case"select":dn("invalid",m);break;case"textarea":dn("invalid",m),Xd(m,k.value,k.defaultValue,k.children)}y=k.children,typeof y!="string"&&typeof y!="number"&&typeof y!="bigint"||m.textContent===""+y||k.suppressHydrationWarning===!0||o3(m.textContent,y)?(k.popover!=null&&(dn("beforetoggle",m),dn("toggle",m)),k.onScroll!=null&&dn("scroll",m),k.onScrollEnd!=null&&dn("scrollend",m),k.onClick!=null&&(m.onclick=ca),m=!0):m=!1,m||dc(h,!0)}function UM(h){for(wi=h.return;wi;)switch(wi.tag){case 5:case 31:case 13:pa=!1;return;case 27:case 3:pa=!0;return;default:wi=wi.return}}function ah(h){if(h!==wi)return!1;if(!gn)return UM(h),gn=!0,!1;var m=h.tag,y;if((y=m!==3&&m!==27)&&((y=m===5)&&(y=h.type,y=!(y!=="form"&&y!=="button")||dw(h.type,h.memoizedProps)),y=!y),y&&sr&&dc(h),UM(h),m===13){if(h=h.memoizedState,h=h!==null?h.dehydrated:null,!h)throw Error(i(317));sr=g3(h)}else if(m===31){if(h=h.memoizedState,h=h!==null?h.dehydrated:null,!h)throw Error(i(317));sr=g3(h)}else m===27?(m=sr,Cc(h.type)?(h=gw,gw=null,sr=h):sr=m):sr=wi?ga(h.stateNode.nextSibling):null;return!0}function Lu(){sr=wi=null,gn=!1}function Yk(){var h=uc;return h!==null&&(vs===null?vs=h:vs.push.apply(vs,h),uc=null),h}function jp(h){uc===null?uc=[h]:uc.push(h)}var Gk=R(null),Iu=null,pl=null;function hc(h,m,y){W(Gk,m._currentValue),m._currentValue=y}function ml(h){h._currentValue=Gk.current,q(Gk)}function Xk(h,m,y){for(;h!==null;){var k=h.alternate;if((h.childLanes&m)!==m?(h.childLanes|=m,k!==null&&(k.childLanes|=m)):k!==null&&(k.childLanes&m)!==m&&(k.childLanes|=m),h===y)break;h=h.return}}function Qk(h,m,y,k){var N=h.child;for(N!==null&&(N.return=h);N!==null;){var M=N.dependencies;if(M!==null){var Y=N.child;M=M.firstContext;e:for(;M!==null;){var ee=M;M=N;for(var ce=0;ce<m.length;ce++)if(ee.context===m[ce]){M.lanes|=y,ee=M.alternate,ee!==null&&(ee.lanes|=y),Xk(M.return,y,h),k||(Y=null);break e}M=ee.next}}else if(N.tag===18){if(Y=N.return,Y===null)throw Error(i(341));Y.lanes|=y,M=Y.alternate,M!==null&&(M.lanes|=y),Xk(Y,y,h),Y=null}else Y=N.child;if(Y!==null)Y.return=N;else for(Y=N;Y!==null;){if(Y===h){Y=null;break}if(N=Y.sibling,N!==null){N.return=Y.return,Y=N;break}Y=Y.return}N=Y}}function oh(h,m,y,k){h=null;for(var N=m,M=!1;N!==null;){if(!M){if((N.flags&524288)!==0)M=!0;else if((N.flags&262144)!==0)break}if(N.tag===10){var Y=N.alternate;if(Y===null)throw Error(i(387));if(Y=Y.memoizedProps,Y!==null){var ee=N.type;zs(N.pendingProps.value,Y.value)||(h!==null?h.push(ee):h=[ee])}}else if(N===re.current){if(Y=N.alternate,Y===null)throw Error(i(387));Y.memoizedState.memoizedState!==N.memoizedState.memoizedState&&(h!==null?h.push(Jp):h=[Jp])}N=N.return}h!==null&&Qk(m,h,y,k),m.flags|=262144}function uy(h){for(h=h.firstContext;h!==null;){if(!zs(h.context._currentValue,h.memoizedValue))return!0;h=h.next}return!1}function Bu(h){Iu=h,pl=null,h=h.dependencies,h!==null&&(h.firstContext=null)}function Si(h){return KM(Iu,h)}function dy(h,m){return Iu===null&&Bu(h),KM(h,m)}function KM(h,m){var y=m._currentValue;if(m={context:m,memoizedValue:y,next:null},pl===null){if(h===null)throw Error(i(308));pl=m,h.dependencies={lanes:0,firstContext:m},h.flags|=524288}else pl=pl.next=m;return y}var YY=typeof AbortController<"u"?AbortController:function(){var h=[],m=this.signal={aborted:!1,addEventListener:function(y,k){h.push(k)}};this.abort=function(){m.aborted=!0,h.forEach(function(y){return y()})}},GY=e.unstable_scheduleCallback,XY=e.unstable_NormalPriority,Hr={$$typeof:C,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Zk(){return{controller:new YY,data:new Map,refCount:0}}function Np(h){h.refCount--,h.refCount===0&&GY(XY,function(){h.controller.abort()})}var Ep=null,Jk=0,lh=0,ch=null;function QY(h,m){if(Ep===null){var y=Ep=[];Jk=0,lh=nw(),ch={status:"pending",value:void 0,then:function(k){y.push(k)}}}return Jk++,m.then(VM,VM),m}function VM(){if(--Jk===0&&Ep!==null){ch!==null&&(ch.status="fulfilled");var h=Ep;Ep=null,lh=0,ch=null;for(var m=0;m<h.length;m++)(0,h[m])()}}function ZY(h,m){var y=[],k={status:"pending",value:null,reason:null,then:function(N){y.push(N)}};return h.then(function(){k.status="fulfilled",k.value=m;for(var N=0;N<y.length;N++)(0,y[N])(m)},function(N){for(k.status="rejected",k.reason=N,N=0;N<y.length;N++)(0,y[N])(void 0)}),k}var YM=I.S;I.S=function(h,m){M5=yt(),typeof m=="object"&&m!==null&&typeof m.then=="function"&&QY(h,m),YM!==null&&YM(h,m)};var zu=R(null);function e1(){var h=zu.current;return h!==null?h:Xn.pooledCache}function hy(h,m){m===null?W(zu,zu.current):W(zu,m.pool)}function GM(){var h=e1();return h===null?null:{parent:Hr._currentValue,pool:h}}var uh=Error(i(460)),t1=Error(i(474)),fy=Error(i(542)),py={then:function(){}};function XM(h){return h=h.status,h==="fulfilled"||h==="rejected"}function QM(h,m,y){switch(y=h[y],y===void 0?h.push(m):y!==m&&(m.then(ca,ca),m=y),m.status){case"fulfilled":return m.value;case"rejected":throw h=m.reason,JM(h),h;default:if(typeof m.status=="string")m.then(ca,ca);else{if(h=Xn,h!==null&&100<h.shellSuspendCounter)throw Error(i(482));h=m,h.status="pending",h.then(function(k){if(m.status==="pending"){var N=m;N.status="fulfilled",N.value=k}},function(k){if(m.status==="pending"){var N=m;N.status="rejected",N.reason=k}})}switch(m.status){case"fulfilled":return m.value;case"rejected":throw h=m.reason,JM(h),h}throw Fu=m,uh}}function $u(h){try{var m=h._init;return m(h._payload)}catch(y){throw y!==null&&typeof y=="object"&&typeof y.then=="function"?(Fu=y,uh):y}}var Fu=null;function ZM(){if(Fu===null)throw Error(i(459));var h=Fu;return Fu=null,h}function JM(h){if(h===uh||h===fy)throw Error(i(483))}var dh=null,Ap=0;function my(h){var m=Ap;return Ap+=1,dh===null&&(dh=[]),QM(dh,h,m)}function Tp(h,m){m=m.props.ref,h.ref=m!==void 0?m:null}function gy(h,m){throw m.$$typeof===g?Error(i(525)):(h=Object.prototype.toString.call(m),Error(i(31,h==="[object Object]"?"object with keys {"+Object.keys(m).join(", ")+"}":h)))}function eR(h){function m(xe,me){if(h){var ke=xe.deletions;ke===null?(xe.deletions=[me],xe.flags|=16):ke.push(me)}}function y(xe,me){if(!h)return null;for(;me!==null;)m(xe,me),me=me.sibling;return null}function k(xe){for(var me=new Map;xe!==null;)xe.key!==null?me.set(xe.key,xe):me.set(xe.index,xe),xe=xe.sibling;return me}function N(xe,me){return xe=hl(xe,me),xe.index=0,xe.sibling=null,xe}function M(xe,me,ke){return xe.index=ke,h?(ke=xe.alternate,ke!==null?(ke=ke.index,ke<me?(xe.flags|=67108866,me):ke):(xe.flags|=67108866,me)):(xe.flags|=1048576,me)}function Y(xe){return h&&xe.alternate===null&&(xe.flags|=67108866),xe}function ee(xe,me,ke,ze){return me===null||me.tag!==6?(me=Wk(ke,xe.mode,ze),me.return=xe,me):(me=N(me,ke),me.return=xe,me)}function ce(xe,me,ke,ze){var Tt=ke.type;return Tt===v?De(xe,me,ke.props.children,ze,ke.key):me!==null&&(me.elementType===Tt||typeof Tt=="object"&&Tt!==null&&Tt.$$typeof===F&&$u(Tt)===me.type)?(me=N(me,ke.props),Tp(me,ke),me.return=xe,me):(me=ly(ke.type,ke.key,ke.props,null,xe.mode,ze),Tp(me,ke),me.return=xe,me)}function we(xe,me,ke,ze){return me===null||me.tag!==4||me.stateNode.containerInfo!==ke.containerInfo||me.stateNode.implementation!==ke.implementation?(me=qk(ke,xe.mode,ze),me.return=xe,me):(me=N(me,ke.children||[]),me.return=xe,me)}function De(xe,me,ke,ze,Tt){return me===null||me.tag!==7?(me=Pu(ke,xe.mode,ze,Tt),me.return=xe,me):(me=N(me,ke),me.return=xe,me)}function $e(xe,me,ke){if(typeof me=="string"&&me!==""||typeof me=="number"||typeof me=="bigint")return me=Wk(""+me,xe.mode,ke),me.return=xe,me;if(typeof me=="object"&&me!==null){switch(me.$$typeof){case _:return ke=ly(me.type,me.key,me.props,null,xe.mode,ke),Tp(ke,me),ke.return=xe,ke;case x:return me=qk(me,xe.mode,ke),me.return=xe,me;case F:return me=$u(me),$e(xe,me,ke)}if(U(me)||B(me))return me=Pu(me,xe.mode,ke,null),me.return=xe,me;if(typeof me.then=="function")return $e(xe,my(me),ke);if(me.$$typeof===C)return $e(xe,dy(xe,me),ke);gy(xe,me)}return null}function je(xe,me,ke,ze){var Tt=me!==null?me.key:null;if(typeof ke=="string"&&ke!==""||typeof ke=="number"||typeof ke=="bigint")return Tt!==null?null:ee(xe,me,""+ke,ze);if(typeof ke=="object"&&ke!==null){switch(ke.$$typeof){case _:return ke.key===Tt?ce(xe,me,ke,ze):null;case x:return ke.key===Tt?we(xe,me,ke,ze):null;case F:return ke=$u(ke),je(xe,me,ke,ze)}if(U(ke)||B(ke))return Tt!==null?null:De(xe,me,ke,ze,null);if(typeof ke.then=="function")return je(xe,me,my(ke),ze);if(ke.$$typeof===C)return je(xe,me,dy(xe,ke),ze);gy(xe,ke)}return null}function Ae(xe,me,ke,ze,Tt){if(typeof ze=="string"&&ze!==""||typeof ze=="number"||typeof ze=="bigint")return xe=xe.get(ke)||null,ee(me,xe,""+ze,Tt);if(typeof ze=="object"&&ze!==null){switch(ze.$$typeof){case _:return xe=xe.get(ze.key===null?ke:ze.key)||null,ce(me,xe,ze,Tt);case x:return xe=xe.get(ze.key===null?ke:ze.key)||null,we(me,xe,ze,Tt);case F:return ze=$u(ze),Ae(xe,me,ke,ze,Tt)}if(U(ze)||B(ze))return xe=xe.get(ke)||null,De(me,xe,ze,Tt,null);if(typeof ze.then=="function")return Ae(xe,me,ke,my(ze),Tt);if(ze.$$typeof===C)return Ae(xe,me,ke,dy(me,ze),Tt);gy(me,ze)}return null}function _t(xe,me,ke,ze){for(var Tt=null,En=null,kt=me,Qt=me=0,pn=null;kt!==null&&Qt<ke.length;Qt++){kt.index>Qt?(pn=kt,kt=null):pn=kt.sibling;var An=je(xe,kt,ke[Qt],ze);if(An===null){kt===null&&(kt=pn);break}h&&kt&&An.alternate===null&&m(xe,kt),me=M(An,me,Qt),En===null?Tt=An:En.sibling=An,En=An,kt=pn}if(Qt===ke.length)return y(xe,kt),gn&&fl(xe,Qt),Tt;if(kt===null){for(;Qt<ke.length;Qt++)kt=$e(xe,ke[Qt],ze),kt!==null&&(me=M(kt,me,Qt),En===null?Tt=kt:En.sibling=kt,En=kt);return gn&&fl(xe,Qt),Tt}for(kt=k(kt);Qt<ke.length;Qt++)pn=Ae(kt,xe,Qt,ke[Qt],ze),pn!==null&&(h&&pn.alternate!==null&&kt.delete(pn.key===null?Qt:pn.key),me=M(pn,me,Qt),En===null?Tt=pn:En.sibling=pn,En=pn);return h&&kt.forEach(function(Tc){return m(xe,Tc)}),gn&&fl(xe,Qt),Tt}function zt(xe,me,ke,ze){if(ke==null)throw Error(i(151));for(var Tt=null,En=null,kt=me,Qt=me=0,pn=null,An=ke.next();kt!==null&&!An.done;Qt++,An=ke.next()){kt.index>Qt?(pn=kt,kt=null):pn=kt.sibling;var Tc=je(xe,kt,An.value,ze);if(Tc===null){kt===null&&(kt=pn);break}h&&kt&&Tc.alternate===null&&m(xe,kt),me=M(Tc,me,Qt),En===null?Tt=Tc:En.sibling=Tc,En=Tc,kt=pn}if(An.done)return y(xe,kt),gn&&fl(xe,Qt),Tt;if(kt===null){for(;!An.done;Qt++,An=ke.next())An=$e(xe,An.value,ze),An!==null&&(me=M(An,me,Qt),En===null?Tt=An:En.sibling=An,En=An);return gn&&fl(xe,Qt),Tt}for(kt=k(kt);!An.done;Qt++,An=ke.next())An=Ae(kt,xe,Qt,An.value,ze),An!==null&&(h&&An.alternate!==null&&kt.delete(An.key===null?Qt:An.key),me=M(An,me,Qt),En===null?Tt=An:En.sibling=An,En=An);return h&&kt.forEach(function(cX){return m(xe,cX)}),gn&&fl(xe,Qt),Tt}function Wn(xe,me,ke,ze){if(typeof ke=="object"&&ke!==null&&ke.type===v&&ke.key===null&&(ke=ke.props.children),typeof ke=="object"&&ke!==null){switch(ke.$$typeof){case _:e:{for(var Tt=ke.key;me!==null;){if(me.key===Tt){if(Tt=ke.type,Tt===v){if(me.tag===7){y(xe,me.sibling),ze=N(me,ke.props.children),ze.return=xe,xe=ze;break e}}else if(me.elementType===Tt||typeof Tt=="object"&&Tt!==null&&Tt.$$typeof===F&&$u(Tt)===me.type){y(xe,me.sibling),ze=N(me,ke.props),Tp(ze,ke),ze.return=xe,xe=ze;break e}y(xe,me);break}else m(xe,me);me=me.sibling}ke.type===v?(ze=Pu(ke.props.children,xe.mode,ze,ke.key),ze.return=xe,xe=ze):(ze=ly(ke.type,ke.key,ke.props,null,xe.mode,ze),Tp(ze,ke),ze.return=xe,xe=ze)}return Y(xe);case x:e:{for(Tt=ke.key;me!==null;){if(me.key===Tt)if(me.tag===4&&me.stateNode.containerInfo===ke.containerInfo&&me.stateNode.implementation===ke.implementation){y(xe,me.sibling),ze=N(me,ke.children||[]),ze.return=xe,xe=ze;break e}else{y(xe,me);break}else m(xe,me);me=me.sibling}ze=qk(ke,xe.mode,ze),ze.return=xe,xe=ze}return Y(xe);case F:return ke=$u(ke),Wn(xe,me,ke,ze)}if(U(ke))return _t(xe,me,ke,ze);if(B(ke)){if(Tt=B(ke),typeof Tt!="function")throw Error(i(150));return ke=Tt.call(ke),zt(xe,me,ke,ze)}if(typeof ke.then=="function")return Wn(xe,me,my(ke),ze);if(ke.$$typeof===C)return Wn(xe,me,dy(xe,ke),ze);gy(xe,ke)}return typeof ke=="string"&&ke!==""||typeof ke=="number"||typeof ke=="bigint"?(ke=""+ke,me!==null&&me.tag===6?(y(xe,me.sibling),ze=N(me,ke),ze.return=xe,xe=ze):(y(xe,me),ze=Wk(ke,xe.mode,ze),ze.return=xe,xe=ze),Y(xe)):y(xe,me)}return function(xe,me,ke,ze){try{Ap=0;var Tt=Wn(xe,me,ke,ze);return dh=null,Tt}catch(kt){if(kt===uh||kt===fy)throw kt;var En=$s(29,kt,null,xe.mode);return En.lanes=ze,En.return=xe,En}finally{}}}var Hu=eR(!0),tR=eR(!1),fc=!1;function n1(h){h.updateQueue={baseState:h.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function r1(h,m){h=h.updateQueue,m.updateQueue===h&&(m.updateQueue={baseState:h.baseState,firstBaseUpdate:h.firstBaseUpdate,lastBaseUpdate:h.lastBaseUpdate,shared:h.shared,callbacks:null})}function pc(h){return{lane:h,tag:0,payload:null,callback:null,next:null}}function mc(h,m,y){var k=h.updateQueue;if(k===null)return null;if(k=k.shared,(On&2)!==0){var N=k.pending;return N===null?m.next=m:(m.next=N.next,N.next=m),k.pending=m,m=oy(h),BM(h,null,y),m}return ay(h,k,m,y),oy(h)}function Mp(h,m,y){if(m=m.updateQueue,m!==null&&(m=m.shared,(y&4194048)!==0)){var k=m.lanes;k&=h.pendingLanes,y|=k,m.lanes=y,tn(h,y)}}function i1(h,m){var y=h.updateQueue,k=h.alternate;if(k!==null&&(k=k.updateQueue,y===k)){var N=null,M=null;if(y=y.firstBaseUpdate,y!==null){do{var Y={lane:y.lane,tag:y.tag,payload:y.payload,callback:null,next:null};M===null?N=M=Y:M=M.next=Y,y=y.next}while(y!==null);M===null?N=M=m:M=M.next=m}else N=M=m;y={baseState:k.baseState,firstBaseUpdate:N,lastBaseUpdate:M,shared:k.shared,callbacks:k.callbacks},h.updateQueue=y;return}h=y.lastBaseUpdate,h===null?y.firstBaseUpdate=m:h.next=m,y.lastBaseUpdate=m}var s1=!1;function Rp(){if(s1){var h=ch;if(h!==null)throw h}}function Op(h,m,y,k){s1=!1;var N=h.updateQueue;fc=!1;var M=N.firstBaseUpdate,Y=N.lastBaseUpdate,ee=N.shared.pending;if(ee!==null){N.shared.pending=null;var ce=ee,we=ce.next;ce.next=null,Y===null?M=we:Y.next=we,Y=ce;var De=h.alternate;De!==null&&(De=De.updateQueue,ee=De.lastBaseUpdate,ee!==Y&&(ee===null?De.firstBaseUpdate=we:ee.next=we,De.lastBaseUpdate=ce))}if(M!==null){var $e=N.baseState;Y=0,De=we=ce=null,ee=M;do{var je=ee.lane&-536870913,Ae=je!==ee.lane;if(Ae?(fn&je)===je:(k&je)===je){je!==0&&je===lh&&(s1=!0),De!==null&&(De=De.next={lane:0,tag:ee.tag,payload:ee.payload,callback:null,next:null});e:{var _t=h,zt=ee;je=m;var Wn=y;switch(zt.tag){case 1:if(_t=zt.payload,typeof _t=="function"){$e=_t.call(Wn,$e,je);break e}$e=_t;break e;case 3:_t.flags=_t.flags&-65537|128;case 0:if(_t=zt.payload,je=typeof _t=="function"?_t.call(Wn,$e,je):_t,je==null)break e;$e=f({},$e,je);break e;case 2:fc=!0}}je=ee.callback,je!==null&&(h.flags|=64,Ae&&(h.flags|=8192),Ae=N.callbacks,Ae===null?N.callbacks=[je]:Ae.push(je))}else Ae={lane:je,tag:ee.tag,payload:ee.payload,callback:ee.callback,next:null},De===null?(we=De=Ae,ce=$e):De=De.next=Ae,Y|=je;if(ee=ee.next,ee===null){if(ee=N.shared.pending,ee===null)break;Ae=ee,ee=Ae.next,Ae.next=null,N.lastBaseUpdate=Ae,N.shared.pending=null}}while(!0);De===null&&(ce=$e),N.baseState=ce,N.firstBaseUpdate=we,N.lastBaseUpdate=De,M===null&&(N.shared.lanes=0),xc|=Y,h.lanes=Y,h.memoizedState=$e}}function nR(h,m){if(typeof h!="function")throw Error(i(191,h));h.call(m)}function rR(h,m){var y=h.callbacks;if(y!==null)for(h.callbacks=null,h=0;h<y.length;h++)nR(y[h],m)}var hh=R(null),vy=R(0);function iR(h,m){h=Sl,W(vy,h),W(hh,m),Sl=h|m.baseLanes}function a1(){W(vy,Sl),W(hh,hh.current)}function o1(){Sl=vy.current,q(hh),q(vy)}var Fs=R(null),ma=null;function gc(h){var m=h.alternate;W(Pr,Pr.current&1),W(Fs,h),ma===null&&(m===null||hh.current!==null||m.memoizedState!==null)&&(ma=h)}function l1(h){W(Pr,Pr.current),W(Fs,h),ma===null&&(ma=h)}function sR(h){h.tag===22?(W(Pr,Pr.current),W(Fs,h),ma===null&&(ma=h)):vc()}function vc(){W(Pr,Pr.current),W(Fs,Fs.current)}function Hs(h){q(Fs),ma===h&&(ma=null),q(Pr)}var Pr=R(0);function yy(h){for(var m=h;m!==null;){if(m.tag===13){var y=m.memoizedState;if(y!==null&&(y=y.dehydrated,y===null||pw(y)||mw(y)))return m}else if(m.tag===19&&(m.memoizedProps.revealOrder==="forwards"||m.memoizedProps.revealOrder==="backwards"||m.memoizedProps.revealOrder==="unstable_legacy-backwards"||m.memoizedProps.revealOrder==="together")){if((m.flags&128)!==0)return m}else if(m.child!==null){m.child.return=m,m=m.child;continue}if(m===h)break;for(;m.sibling===null;){if(m.return===null||m.return===h)return null;m=m.return}m.sibling.return=m.return,m=m.sibling}return null}var gl=0,Xt=null,Fn=null,Wr=null,_y=!1,fh=!1,Wu=!1,xy=0,Dp=0,ph=null,JY=0;function Er(){throw Error(i(321))}function c1(h,m){if(m===null)return!1;for(var y=0;y<m.length&&y<h.length;y++)if(!zs(h[y],m[y]))return!1;return!0}function u1(h,m,y,k,N,M){return gl=M,Xt=m,m.memoizedState=null,m.updateQueue=null,m.lanes=0,I.H=h===null||h.memoizedState===null?HR:C1,Wu=!1,M=y(k,N),Wu=!1,fh&&(M=oR(m,y,k,N)),aR(h),M}function aR(h){I.H=Ip;var m=Fn!==null&&Fn.next!==null;if(gl=0,Wr=Fn=Xt=null,_y=!1,Dp=0,ph=null,m)throw Error(i(300));h===null||qr||(h=h.dependencies,h!==null&&uy(h)&&(qr=!0))}function oR(h,m,y,k){Xt=h;var N=0;do{if(fh&&(ph=null),Dp=0,fh=!1,25<=N)throw Error(i(301));if(N+=1,Wr=Fn=null,h.updateQueue!=null){var M=h.updateQueue;M.lastEffect=null,M.events=null,M.stores=null,M.memoCache!=null&&(M.memoCache.index=0)}I.H=WR,M=m(y,k)}while(fh);return M}function eG(){var h=I.H,m=h.useState()[0];return m=typeof m.then=="function"?Pp(m):m,h=h.useState()[0],(Fn!==null?Fn.memoizedState:null)!==h&&(Xt.flags|=1024),m}function d1(){var h=xy!==0;return xy=0,h}function h1(h,m,y){m.updateQueue=h.updateQueue,m.flags&=-2053,h.lanes&=~y}function f1(h){if(_y){for(h=h.memoizedState;h!==null;){var m=h.queue;m!==null&&(m.pending=null),h=h.next}_y=!1}gl=0,Wr=Fn=Xt=null,fh=!1,Dp=xy=0,ph=null}function Zi(){var h={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Wr===null?Xt.memoizedState=Wr=h:Wr=Wr.next=h,Wr}function Lr(){if(Fn===null){var h=Xt.alternate;h=h!==null?h.memoizedState:null}else h=Fn.next;var m=Wr===null?Xt.memoizedState:Wr.next;if(m!==null)Wr=m,Fn=h;else{if(h===null)throw Xt.alternate===null?Error(i(467)):Error(i(310));Fn=h,h={memoizedState:Fn.memoizedState,baseState:Fn.baseState,baseQueue:Fn.baseQueue,queue:Fn.queue,next:null},Wr===null?Xt.memoizedState=Wr=h:Wr=Wr.next=h}return Wr}function by(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Pp(h){var m=Dp;return Dp+=1,ph===null&&(ph=[]),h=QM(ph,h,m),m=Xt,(Wr===null?m.memoizedState:Wr.next)===null&&(m=m.alternate,I.H=m===null||m.memoizedState===null?HR:C1),h}function ky(h){if(h!==null&&typeof h=="object"){if(typeof h.then=="function")return Pp(h);if(h.$$typeof===C)return Si(h)}throw Error(i(438,String(h)))}function p1(h){var m=null,y=Xt.updateQueue;if(y!==null&&(m=y.memoCache),m==null){var k=Xt.alternate;k!==null&&(k=k.updateQueue,k!==null&&(k=k.memoCache,k!=null&&(m={data:k.data.map(function(N){return N.slice()}),index:0})))}if(m==null&&(m={data:[],index:0}),y===null&&(y=by(),Xt.updateQueue=y),y.memoCache=m,y=m.data[m.index],y===void 0)for(y=m.data[m.index]=Array(h),k=0;k<h;k++)y[k]=$;return m.index++,y}function vl(h,m){return typeof m=="function"?m(h):m}function wy(h){var m=Lr();return m1(m,Fn,h)}function m1(h,m,y){var k=h.queue;if(k===null)throw Error(i(311));k.lastRenderedReducer=y;var N=h.baseQueue,M=k.pending;if(M!==null){if(N!==null){var Y=N.next;N.next=M.next,M.next=Y}m.baseQueue=N=M,k.pending=null}if(M=h.baseState,N===null)h.memoizedState=M;else{m=N.next;var ee=Y=null,ce=null,we=m,De=!1;do{var $e=we.lane&-536870913;if($e!==we.lane?(fn&$e)===$e:(gl&$e)===$e){var je=we.revertLane;if(je===0)ce!==null&&(ce=ce.next={lane:0,revertLane:0,gesture:null,action:we.action,hasEagerState:we.hasEagerState,eagerState:we.eagerState,next:null}),$e===lh&&(De=!0);else if((gl&je)===je){we=we.next,je===lh&&(De=!0);continue}else $e={lane:0,revertLane:we.revertLane,gesture:null,action:we.action,hasEagerState:we.hasEagerState,eagerState:we.eagerState,next:null},ce===null?(ee=ce=$e,Y=M):ce=ce.next=$e,Xt.lanes|=je,xc|=je;$e=we.action,Wu&&y(M,$e),M=we.hasEagerState?we.eagerState:y(M,$e)}else je={lane:$e,revertLane:we.revertLane,gesture:we.gesture,action:we.action,hasEagerState:we.hasEagerState,eagerState:we.eagerState,next:null},ce===null?(ee=ce=je,Y=M):ce=ce.next=je,Xt.lanes|=$e,xc|=$e;we=we.next}while(we!==null&&we!==m);if(ce===null?Y=M:ce.next=ee,!zs(M,h.memoizedState)&&(qr=!0,De&&(y=ch,y!==null)))throw y;h.memoizedState=M,h.baseState=Y,h.baseQueue=ce,k.lastRenderedState=M}return N===null&&(k.lanes=0),[h.memoizedState,k.dispatch]}function g1(h){var m=Lr(),y=m.queue;if(y===null)throw Error(i(311));y.lastRenderedReducer=h;var k=y.dispatch,N=y.pending,M=m.memoizedState;if(N!==null){y.pending=null;var Y=N=N.next;do M=h(M,Y.action),Y=Y.next;while(Y!==N);zs(M,m.memoizedState)||(qr=!0),m.memoizedState=M,m.baseQueue===null&&(m.baseState=M),y.lastRenderedState=M}return[M,k]}function lR(h,m,y){var k=Xt,N=Lr(),M=gn;if(M){if(y===void 0)throw Error(i(407));y=y()}else y=m();var Y=!zs((Fn||N).memoizedState,y);if(Y&&(N.memoizedState=y,qr=!0),N=N.queue,_1(dR.bind(null,k,N,h),[h]),N.getSnapshot!==m||Y||Wr!==null&&Wr.memoizedState.tag&1){if(k.flags|=2048,mh(9,{destroy:void 0},uR.bind(null,k,N,y,m),null),Xn===null)throw Error(i(349));M||(gl&127)!==0||cR(k,m,y)}return y}function cR(h,m,y){h.flags|=16384,h={getSnapshot:m,value:y},m=Xt.updateQueue,m===null?(m=by(),Xt.updateQueue=m,m.stores=[h]):(y=m.stores,y===null?m.stores=[h]:y.push(h))}function uR(h,m,y,k){m.value=y,m.getSnapshot=k,hR(m)&&fR(h)}function dR(h,m,y){return y(function(){hR(m)&&fR(h)})}function hR(h){var m=h.getSnapshot;h=h.value;try{var y=m();return!zs(h,y)}catch{return!0}}function fR(h){var m=Du(h,2);m!==null&&ys(m,h,2)}function v1(h){var m=Zi();if(typeof h=="function"){var y=h;if(h=y(),Wu){Ct(!0);try{y()}finally{Ct(!1)}}}return m.memoizedState=m.baseState=h,m.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:vl,lastRenderedState:h},m}function pR(h,m,y,k){return h.baseState=y,m1(h,Fn,typeof k=="function"?k:vl)}function tG(h,m,y,k,N){if(jy(h))throw Error(i(485));if(h=m.action,h!==null){var M={payload:N,action:h,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(Y){M.listeners.push(Y)}};I.T!==null?y(!0):M.isTransition=!1,k(M),y=m.pending,y===null?(M.next=m.pending=M,mR(m,M)):(M.next=y.next,m.pending=y.next=M)}}function mR(h,m){var y=m.action,k=m.payload,N=h.state;if(m.isTransition){var M=I.T,Y={};I.T=Y;try{var ee=y(N,k),ce=I.S;ce!==null&&ce(Y,ee),gR(h,m,ee)}catch(we){y1(h,m,we)}finally{M!==null&&Y.types!==null&&(M.types=Y.types),I.T=M}}else try{M=y(N,k),gR(h,m,M)}catch(we){y1(h,m,we)}}function gR(h,m,y){y!==null&&typeof y=="object"&&typeof y.then=="function"?y.then(function(k){vR(h,m,k)},function(k){return y1(h,m,k)}):vR(h,m,y)}function vR(h,m,y){m.status="fulfilled",m.value=y,yR(m),h.state=y,m=h.pending,m!==null&&(y=m.next,y===m?h.pending=null:(y=y.next,m.next=y,mR(h,y)))}function y1(h,m,y){var k=h.pending;if(h.pending=null,k!==null){k=k.next;do m.status="rejected",m.reason=y,yR(m),m=m.next;while(m!==k)}h.action=null}function yR(h){h=h.listeners;for(var m=0;m<h.length;m++)(0,h[m])()}function _R(h,m){return m}function xR(h,m){if(gn){var y=Xn.formState;if(y!==null){e:{var k=Xt;if(gn){if(sr){t:{for(var N=sr,M=pa;N.nodeType!==8;){if(!M){N=null;break t}if(N=ga(N.nextSibling),N===null){N=null;break t}}M=N.data,N=M==="F!"||M==="F"?N:null}if(N){sr=ga(N.nextSibling),k=N.data==="F!";break e}}dc(k)}k=!1}k&&(m=y[0])}}return y=Zi(),y.memoizedState=y.baseState=m,k={pending:null,lanes:0,dispatch:null,lastRenderedReducer:_R,lastRenderedState:m},y.queue=k,y=zR.bind(null,Xt,k),k.dispatch=y,k=v1(!1),M=S1.bind(null,Xt,!1,k.queue),k=Zi(),N={state:m,dispatch:null,action:h,pending:null},k.queue=N,y=tG.bind(null,Xt,N,M,y),N.dispatch=y,k.memoizedState=h,[m,y,!1]}function bR(h){var m=Lr();return kR(m,Fn,h)}function kR(h,m,y){if(m=m1(h,m,_R)[0],h=wy(vl)[0],typeof m=="object"&&m!==null&&typeof m.then=="function")try{var k=Pp(m)}catch(Y){throw Y===uh?fy:Y}else k=m;m=Lr();var N=m.queue,M=N.dispatch;return y!==m.memoizedState&&(Xt.flags|=2048,mh(9,{destroy:void 0},nG.bind(null,N,y),null)),[k,M,h]}function nG(h,m){h.action=m}function wR(h){var m=Lr(),y=Fn;if(y!==null)return kR(m,y,h);Lr(),m=m.memoizedState,y=Lr();var k=y.queue.dispatch;return y.memoizedState=h,[m,k,!1]}function mh(h,m,y,k){return h={tag:h,create:y,deps:k,inst:m,next:null},m=Xt.updateQueue,m===null&&(m=by(),Xt.updateQueue=m),y=m.lastEffect,y===null?m.lastEffect=h.next=h:(k=y.next,y.next=h,h.next=k,m.lastEffect=h),h}function SR(){return Lr().memoizedState}function Sy(h,m,y,k){var N=Zi();Xt.flags|=h,N.memoizedState=mh(1|m,{destroy:void 0},y,k===void 0?null:k)}function Cy(h,m,y,k){var N=Lr();k=k===void 0?null:k;var M=N.memoizedState.inst;Fn!==null&&k!==null&&c1(k,Fn.memoizedState.deps)?N.memoizedState=mh(m,M,y,k):(Xt.flags|=h,N.memoizedState=mh(1|m,M,y,k))}function CR(h,m){Sy(8390656,8,h,m)}function _1(h,m){Cy(2048,8,h,m)}function rG(h){Xt.flags|=4;var m=Xt.updateQueue;if(m===null)m=by(),Xt.updateQueue=m,m.events=[h];else{var y=m.events;y===null?m.events=[h]:y.push(h)}}function jR(h){var m=Lr().memoizedState;return rG({ref:m,nextImpl:h}),function(){if((On&2)!==0)throw Error(i(440));return m.impl.apply(void 0,arguments)}}function NR(h,m){return Cy(4,2,h,m)}function ER(h,m){return Cy(4,4,h,m)}function AR(h,m){if(typeof m=="function"){h=h();var y=m(h);return function(){typeof y=="function"?y():m(null)}}if(m!=null)return h=h(),m.current=h,function(){m.current=null}}function TR(h,m,y){y=y!=null?y.concat([h]):null,Cy(4,4,AR.bind(null,m,h),y)}function x1(){}function MR(h,m){var y=Lr();m=m===void 0?null:m;var k=y.memoizedState;return m!==null&&c1(m,k[1])?k[0]:(y.memoizedState=[h,m],h)}function RR(h,m){var y=Lr();m=m===void 0?null:m;var k=y.memoizedState;if(m!==null&&c1(m,k[1]))return k[0];if(k=h(),Wu){Ct(!0);try{h()}finally{Ct(!1)}}return y.memoizedState=[k,m],k}function b1(h,m,y){return y===void 0||(gl&1073741824)!==0&&(fn&261930)===0?h.memoizedState=m:(h.memoizedState=y,h=O5(),Xt.lanes|=h,xc|=h,y)}function OR(h,m,y,k){return zs(y,m)?y:hh.current!==null?(h=b1(h,y,k),zs(h,m)||(qr=!0),h):(gl&42)===0||(gl&1073741824)!==0&&(fn&261930)===0?(qr=!0,h.memoizedState=y):(h=O5(),Xt.lanes|=h,xc|=h,m)}function DR(h,m,y,k,N){var M=X.p;X.p=M!==0&&8>M?M:8;var Y=I.T,ee={};I.T=ee,S1(h,!1,m,y);try{var ce=N(),we=I.S;if(we!==null&&we(ee,ce),ce!==null&&typeof ce=="object"&&typeof ce.then=="function"){var De=ZY(ce,k);Lp(h,m,De,Us(h))}else Lp(h,m,k,Us(h))}catch($e){Lp(h,m,{then:function(){},status:"rejected",reason:$e},Us())}finally{X.p=M,Y!==null&&ee.types!==null&&(Y.types=ee.types),I.T=Y}}function iG(){}function k1(h,m,y,k){if(h.tag!==5)throw Error(i(476));var N=PR(h).queue;DR(h,N,m,K,y===null?iG:function(){return LR(h),y(k)})}function PR(h){var m=h.memoizedState;if(m!==null)return m;m={memoizedState:K,baseState:K,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:vl,lastRenderedState:K},next:null};var y={};return m.next={memoizedState:y,baseState:y,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:vl,lastRenderedState:y},next:null},h.memoizedState=m,h=h.alternate,h!==null&&(h.memoizedState=m),m}function LR(h){var m=PR(h);m.next===null&&(m=h.alternate.memoizedState),Lp(h,m.next.queue,{},Us())}function w1(){return Si(Jp)}function IR(){return Lr().memoizedState}function BR(){return Lr().memoizedState}function sG(h){for(var m=h.return;m!==null;){switch(m.tag){case 24:case 3:var y=Us();h=pc(y);var k=mc(m,h,y);k!==null&&(ys(k,m,y),Mp(k,m,y)),m={cache:Zk()},h.payload=m;return}m=m.return}}function aG(h,m,y){var k=Us();y={lane:k,revertLane:0,gesture:null,action:y,hasEagerState:!1,eagerState:null,next:null},jy(h)?$R(m,y):(y=Fk(h,m,y,k),y!==null&&(ys(y,h,k),FR(y,m,k)))}function zR(h,m,y){var k=Us();Lp(h,m,y,k)}function Lp(h,m,y,k){var N={lane:k,revertLane:0,gesture:null,action:y,hasEagerState:!1,eagerState:null,next:null};if(jy(h))$R(m,N);else{var M=h.alternate;if(h.lanes===0&&(M===null||M.lanes===0)&&(M=m.lastRenderedReducer,M!==null))try{var Y=m.lastRenderedState,ee=M(Y,y);if(N.hasEagerState=!0,N.eagerState=ee,zs(ee,Y))return ay(h,m,N,0),Xn===null&&sy(),!1}catch{}finally{}if(y=Fk(h,m,N,k),y!==null)return ys(y,h,k),FR(y,m,k),!0}return!1}function S1(h,m,y,k){if(k={lane:2,revertLane:nw(),gesture:null,action:k,hasEagerState:!1,eagerState:null,next:null},jy(h)){if(m)throw Error(i(479))}else m=Fk(h,y,k,2),m!==null&&ys(m,h,2)}function jy(h){var m=h.alternate;return h===Xt||m!==null&&m===Xt}function $R(h,m){fh=_y=!0;var y=h.pending;y===null?m.next=m:(m.next=y.next,y.next=m),h.pending=m}function FR(h,m,y){if((y&4194048)!==0){var k=m.lanes;k&=h.pendingLanes,y|=k,m.lanes=y,tn(h,y)}}var Ip={readContext:Si,use:ky,useCallback:Er,useContext:Er,useEffect:Er,useImperativeHandle:Er,useLayoutEffect:Er,useInsertionEffect:Er,useMemo:Er,useReducer:Er,useRef:Er,useState:Er,useDebugValue:Er,useDeferredValue:Er,useTransition:Er,useSyncExternalStore:Er,useId:Er,useHostTransitionStatus:Er,useFormState:Er,useActionState:Er,useOptimistic:Er,useMemoCache:Er,useCacheRefresh:Er};Ip.useEffectEvent=Er;var HR={readContext:Si,use:ky,useCallback:function(h,m){return Zi().memoizedState=[h,m===void 0?null:m],h},useContext:Si,useEffect:CR,useImperativeHandle:function(h,m,y){y=y!=null?y.concat([h]):null,Sy(4194308,4,AR.bind(null,m,h),y)},useLayoutEffect:function(h,m){return Sy(4194308,4,h,m)},useInsertionEffect:function(h,m){Sy(4,2,h,m)},useMemo:function(h,m){var y=Zi();m=m===void 0?null:m;var k=h();if(Wu){Ct(!0);try{h()}finally{Ct(!1)}}return y.memoizedState=[k,m],k},useReducer:function(h,m,y){var k=Zi();if(y!==void 0){var N=y(m);if(Wu){Ct(!0);try{y(m)}finally{Ct(!1)}}}else N=m;return k.memoizedState=k.baseState=N,h={pending:null,lanes:0,dispatch:null,lastRenderedReducer:h,lastRenderedState:N},k.queue=h,h=h.dispatch=aG.bind(null,Xt,h),[k.memoizedState,h]},useRef:function(h){var m=Zi();return h={current:h},m.memoizedState=h},useState:function(h){h=v1(h);var m=h.queue,y=zR.bind(null,Xt,m);return m.dispatch=y,[h.memoizedState,y]},useDebugValue:x1,useDeferredValue:function(h,m){var y=Zi();return b1(y,h,m)},useTransition:function(){var h=v1(!1);return h=DR.bind(null,Xt,h.queue,!0,!1),Zi().memoizedState=h,[!1,h]},useSyncExternalStore:function(h,m,y){var k=Xt,N=Zi();if(gn){if(y===void 0)throw Error(i(407));y=y()}else{if(y=m(),Xn===null)throw Error(i(349));(fn&127)!==0||cR(k,m,y)}N.memoizedState=y;var M={value:y,getSnapshot:m};return N.queue=M,CR(dR.bind(null,k,M,h),[h]),k.flags|=2048,mh(9,{destroy:void 0},uR.bind(null,k,M,y,m),null),y},useId:function(){var h=Zi(),m=Xn.identifierPrefix;if(gn){var y=xo,k=_o;y=(k&~(1<<32-Mt(k)-1)).toString(32)+y,m="_"+m+"R_"+y,y=xy++,0<y&&(m+="H"+y.toString(32)),m+="_"}else y=JY++,m="_"+m+"r_"+y.toString(32)+"_";return h.memoizedState=m},useHostTransitionStatus:w1,useFormState:xR,useActionState:xR,useOptimistic:function(h){var m=Zi();m.memoizedState=m.baseState=h;var y={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return m.queue=y,m=S1.bind(null,Xt,!0,y),y.dispatch=m,[h,m]},useMemoCache:p1,useCacheRefresh:function(){return Zi().memoizedState=sG.bind(null,Xt)},useEffectEvent:function(h){var m=Zi(),y={impl:h};return m.memoizedState=y,function(){if((On&2)!==0)throw Error(i(440));return y.impl.apply(void 0,arguments)}}},C1={readContext:Si,use:ky,useCallback:MR,useContext:Si,useEffect:_1,useImperativeHandle:TR,useInsertionEffect:NR,useLayoutEffect:ER,useMemo:RR,useReducer:wy,useRef:SR,useState:function(){return wy(vl)},useDebugValue:x1,useDeferredValue:function(h,m){var y=Lr();return OR(y,Fn.memoizedState,h,m)},useTransition:function(){var h=wy(vl)[0],m=Lr().memoizedState;return[typeof h=="boolean"?h:Pp(h),m]},useSyncExternalStore:lR,useId:IR,useHostTransitionStatus:w1,useFormState:bR,useActionState:bR,useOptimistic:function(h,m){var y=Lr();return pR(y,Fn,h,m)},useMemoCache:p1,useCacheRefresh:BR};C1.useEffectEvent=jR;var WR={readContext:Si,use:ky,useCallback:MR,useContext:Si,useEffect:_1,useImperativeHandle:TR,useInsertionEffect:NR,useLayoutEffect:ER,useMemo:RR,useReducer:g1,useRef:SR,useState:function(){return g1(vl)},useDebugValue:x1,useDeferredValue:function(h,m){var y=Lr();return Fn===null?b1(y,h,m):OR(y,Fn.memoizedState,h,m)},useTransition:function(){var h=g1(vl)[0],m=Lr().memoizedState;return[typeof h=="boolean"?h:Pp(h),m]},useSyncExternalStore:lR,useId:IR,useHostTransitionStatus:w1,useFormState:wR,useActionState:wR,useOptimistic:function(h,m){var y=Lr();return Fn!==null?pR(y,Fn,h,m):(y.baseState=h,[h,y.queue.dispatch])},useMemoCache:p1,useCacheRefresh:BR};WR.useEffectEvent=jR;function j1(h,m,y,k){m=h.memoizedState,y=y(k,m),y=y==null?m:f({},m,y),h.memoizedState=y,h.lanes===0&&(h.updateQueue.baseState=y)}var N1={enqueueSetState:function(h,m,y){h=h._reactInternals;var k=Us(),N=pc(k);N.payload=m,y!=null&&(N.callback=y),m=mc(h,N,k),m!==null&&(ys(m,h,k),Mp(m,h,k))},enqueueReplaceState:function(h,m,y){h=h._reactInternals;var k=Us(),N=pc(k);N.tag=1,N.payload=m,y!=null&&(N.callback=y),m=mc(h,N,k),m!==null&&(ys(m,h,k),Mp(m,h,k))},enqueueForceUpdate:function(h,m){h=h._reactInternals;var y=Us(),k=pc(y);k.tag=2,m!=null&&(k.callback=m),m=mc(h,k,y),m!==null&&(ys(m,h,y),Mp(m,h,y))}};function qR(h,m,y,k,N,M,Y){return h=h.stateNode,typeof h.shouldComponentUpdate=="function"?h.shouldComponentUpdate(k,M,Y):m.prototype&&m.prototype.isPureReactComponent?!wp(y,k)||!wp(N,M):!0}function UR(h,m,y,k){h=m.state,typeof m.componentWillReceiveProps=="function"&&m.componentWillReceiveProps(y,k),typeof m.UNSAFE_componentWillReceiveProps=="function"&&m.UNSAFE_componentWillReceiveProps(y,k),m.state!==h&&N1.enqueueReplaceState(m,m.state,null)}function qu(h,m){var y=m;if("ref"in m){y={};for(var k in m)k!=="ref"&&(y[k]=m[k])}if(h=h.defaultProps){y===m&&(y=f({},y));for(var N in h)y[N]===void 0&&(y[N]=h[N])}return y}function KR(h){iy(h)}function VR(h){console.error(h)}function YR(h){iy(h)}function Ny(h,m){try{var y=h.onUncaughtError;y(m.value,{componentStack:m.stack})}catch(k){setTimeout(function(){throw k})}}function GR(h,m,y){try{var k=h.onCaughtError;k(y.value,{componentStack:y.stack,errorBoundary:m.tag===1?m.stateNode:null})}catch(N){setTimeout(function(){throw N})}}function E1(h,m,y){return y=pc(y),y.tag=3,y.payload={element:null},y.callback=function(){Ny(h,m)},y}function XR(h){return h=pc(h),h.tag=3,h}function QR(h,m,y,k){var N=y.type.getDerivedStateFromError;if(typeof N=="function"){var M=k.value;h.payload=function(){return N(M)},h.callback=function(){GR(m,y,k)}}var Y=y.stateNode;Y!==null&&typeof Y.componentDidCatch=="function"&&(h.callback=function(){GR(m,y,k),typeof N!="function"&&(bc===null?bc=new Set([this]):bc.add(this));var ee=k.stack;this.componentDidCatch(k.value,{componentStack:ee!==null?ee:""})})}function oG(h,m,y,k,N){if(y.flags|=32768,k!==null&&typeof k=="object"&&typeof k.then=="function"){if(m=y.alternate,m!==null&&oh(m,y,N,!0),y=Fs.current,y!==null){switch(y.tag){case 31:case 13:return ma===null?zy():y.alternate===null&&Ar===0&&(Ar=3),y.flags&=-257,y.flags|=65536,y.lanes=N,k===py?y.flags|=16384:(m=y.updateQueue,m===null?y.updateQueue=new Set([k]):m.add(k),J1(h,k,N)),!1;case 22:return y.flags|=65536,k===py?y.flags|=16384:(m=y.updateQueue,m===null?(m={transitions:null,markerInstances:null,retryQueue:new Set([k])},y.updateQueue=m):(y=m.retryQueue,y===null?m.retryQueue=new Set([k]):y.add(k)),J1(h,k,N)),!1}throw Error(i(435,y.tag))}return J1(h,k,N),zy(),!1}if(gn)return m=Fs.current,m!==null?((m.flags&65536)===0&&(m.flags|=256),m.flags|=65536,m.lanes=N,k!==Vk&&(h=Error(i(422),{cause:k}),jp(da(h,y)))):(k!==Vk&&(m=Error(i(423),{cause:k}),jp(da(m,y))),h=h.current.alternate,h.flags|=65536,N&=-N,h.lanes|=N,k=da(k,y),N=E1(h.stateNode,k,N),i1(h,N),Ar!==4&&(Ar=2)),!1;var M=Error(i(520),{cause:k});if(M=da(M,y),Up===null?Up=[M]:Up.push(M),Ar!==4&&(Ar=2),m===null)return!0;k=da(k,y),y=m;do{switch(y.tag){case 3:return y.flags|=65536,h=N&-N,y.lanes|=h,h=E1(y.stateNode,k,h),i1(y,h),!1;case 1:if(m=y.type,M=y.stateNode,(y.flags&128)===0&&(typeof m.getDerivedStateFromError=="function"||M!==null&&typeof M.componentDidCatch=="function"&&(bc===null||!bc.has(M))))return y.flags|=65536,N&=-N,y.lanes|=N,N=XR(N),QR(N,h,y,k),i1(y,N),!1}y=y.return}while(y!==null);return!1}var A1=Error(i(461)),qr=!1;function Ci(h,m,y,k){m.child=h===null?tR(m,null,y,k):Hu(m,h.child,y,k)}function ZR(h,m,y,k,N){y=y.render;var M=m.ref;if("ref"in k){var Y={};for(var ee in k)ee!=="ref"&&(Y[ee]=k[ee])}else Y=k;return Bu(m),k=u1(h,m,y,Y,M,N),ee=d1(),h!==null&&!qr?(h1(h,m,N),yl(h,m,N)):(gn&&ee&&Uk(m),m.flags|=1,Ci(h,m,k,N),m.child)}function JR(h,m,y,k,N){if(h===null){var M=y.type;return typeof M=="function"&&!Hk(M)&&M.defaultProps===void 0&&y.compare===null?(m.tag=15,m.type=M,e5(h,m,M,k,N)):(h=ly(y.type,null,k,m,m.mode,N),h.ref=m.ref,h.return=m,m.child=h)}if(M=h.child,!I1(h,N)){var Y=M.memoizedProps;if(y=y.compare,y=y!==null?y:wp,y(Y,k)&&h.ref===m.ref)return yl(h,m,N)}return m.flags|=1,h=hl(M,k),h.ref=m.ref,h.return=m,m.child=h}function e5(h,m,y,k,N){if(h!==null){var M=h.memoizedProps;if(wp(M,k)&&h.ref===m.ref)if(qr=!1,m.pendingProps=k=M,I1(h,N))(h.flags&131072)!==0&&(qr=!0);else return m.lanes=h.lanes,yl(h,m,N)}return T1(h,m,y,k,N)}function t5(h,m,y,k){var N=k.children,M=h!==null?h.memoizedState:null;if(h===null&&m.stateNode===null&&(m.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),k.mode==="hidden"){if((m.flags&128)!==0){if(M=M!==null?M.baseLanes|y:y,h!==null){for(k=m.child=h.child,N=0;k!==null;)N=N|k.lanes|k.childLanes,k=k.sibling;k=N&~M}else k=0,m.child=null;return n5(h,m,M,y,k)}if((y&536870912)!==0)m.memoizedState={baseLanes:0,cachePool:null},h!==null&&hy(m,M!==null?M.cachePool:null),M!==null?iR(m,M):a1(),sR(m);else return k=m.lanes=536870912,n5(h,m,M!==null?M.baseLanes|y:y,y,k)}else M!==null?(hy(m,M.cachePool),iR(m,M),vc(),m.memoizedState=null):(h!==null&&hy(m,null),a1(),vc());return Ci(h,m,N,y),m.child}function Bp(h,m){return h!==null&&h.tag===22||m.stateNode!==null||(m.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),m.sibling}function n5(h,m,y,k,N){var M=e1();return M=M===null?null:{parent:Hr._currentValue,pool:M},m.memoizedState={baseLanes:y,cachePool:M},h!==null&&hy(m,null),a1(),sR(m),h!==null&&oh(h,m,k,!0),m.childLanes=N,null}function Ey(h,m){return m=Ty({mode:m.mode,children:m.children},h.mode),m.ref=h.ref,h.child=m,m.return=h,m}function r5(h,m,y){return Hu(m,h.child,null,y),h=Ey(m,m.pendingProps),h.flags|=2,Hs(m),m.memoizedState=null,h}function lG(h,m,y){var k=m.pendingProps,N=(m.flags&128)!==0;if(m.flags&=-129,h===null){if(gn){if(k.mode==="hidden")return h=Ey(m,k),m.lanes=536870912,Bp(null,h);if(l1(m),(h=sr)?(h=m3(h,pa),h=h!==null&&h.data==="&"?h:null,h!==null&&(m.memoizedState={dehydrated:h,treeContext:cc!==null?{id:_o,overflow:xo}:null,retryLane:536870912,hydrationErrors:null},y=$M(h),y.return=m,m.child=y,wi=m,sr=null)):h=null,h===null)throw dc(m);return m.lanes=536870912,null}return Ey(m,k)}var M=h.memoizedState;if(M!==null){var Y=M.dehydrated;if(l1(m),N)if(m.flags&256)m.flags&=-257,m=r5(h,m,y);else if(m.memoizedState!==null)m.child=h.child,m.flags|=128,m=null;else throw Error(i(558));else if(qr||oh(h,m,y,!1),N=(y&h.childLanes)!==0,qr||N){if(k=Xn,k!==null&&(Y=Jt(k,y),Y!==0&&Y!==M.retryLane))throw M.retryLane=Y,Du(h,Y),ys(k,h,Y),A1;zy(),m=r5(h,m,y)}else h=M.treeContext,sr=ga(Y.nextSibling),wi=m,gn=!0,uc=null,pa=!1,h!==null&&WM(m,h),m=Ey(m,k),m.flags|=4096;return m}return h=hl(h.child,{mode:k.mode,children:k.children}),h.ref=m.ref,m.child=h,h.return=m,h}function Ay(h,m){var y=m.ref;if(y===null)h!==null&&h.ref!==null&&(m.flags|=4194816);else{if(typeof y!="function"&&typeof y!="object")throw Error(i(284));(h===null||h.ref!==y)&&(m.flags|=4194816)}}function T1(h,m,y,k,N){return Bu(m),y=u1(h,m,y,k,void 0,N),k=d1(),h!==null&&!qr?(h1(h,m,N),yl(h,m,N)):(gn&&k&&Uk(m),m.flags|=1,Ci(h,m,y,N),m.child)}function i5(h,m,y,k,N,M){return Bu(m),m.updateQueue=null,y=oR(m,k,y,N),aR(h),k=d1(),h!==null&&!qr?(h1(h,m,M),yl(h,m,M)):(gn&&k&&Uk(m),m.flags|=1,Ci(h,m,y,M),m.child)}function s5(h,m,y,k,N){if(Bu(m),m.stateNode===null){var M=rh,Y=y.contextType;typeof Y=="object"&&Y!==null&&(M=Si(Y)),M=new y(k,M),m.memoizedState=M.state!==null&&M.state!==void 0?M.state:null,M.updater=N1,m.stateNode=M,M._reactInternals=m,M=m.stateNode,M.props=k,M.state=m.memoizedState,M.refs={},n1(m),Y=y.contextType,M.context=typeof Y=="object"&&Y!==null?Si(Y):rh,M.state=m.memoizedState,Y=y.getDerivedStateFromProps,typeof Y=="function"&&(j1(m,y,Y,k),M.state=m.memoizedState),typeof y.getDerivedStateFromProps=="function"||typeof M.getSnapshotBeforeUpdate=="function"||typeof M.UNSAFE_componentWillMount!="function"&&typeof M.componentWillMount!="function"||(Y=M.state,typeof M.componentWillMount=="function"&&M.componentWillMount(),typeof M.UNSAFE_componentWillMount=="function"&&M.UNSAFE_componentWillMount(),Y!==M.state&&N1.enqueueReplaceState(M,M.state,null),Op(m,k,M,N),Rp(),M.state=m.memoizedState),typeof M.componentDidMount=="function"&&(m.flags|=4194308),k=!0}else if(h===null){M=m.stateNode;var ee=m.memoizedProps,ce=qu(y,ee);M.props=ce;var we=M.context,De=y.contextType;Y=rh,typeof De=="object"&&De!==null&&(Y=Si(De));var $e=y.getDerivedStateFromProps;De=typeof $e=="function"||typeof M.getSnapshotBeforeUpdate=="function",ee=m.pendingProps!==ee,De||typeof M.UNSAFE_componentWillReceiveProps!="function"&&typeof M.componentWillReceiveProps!="function"||(ee||we!==Y)&&UR(m,M,k,Y),fc=!1;var je=m.memoizedState;M.state=je,Op(m,k,M,N),Rp(),we=m.memoizedState,ee||je!==we||fc?(typeof $e=="function"&&(j1(m,y,$e,k),we=m.memoizedState),(ce=fc||qR(m,y,ce,k,je,we,Y))?(De||typeof M.UNSAFE_componentWillMount!="function"&&typeof M.componentWillMount!="function"||(typeof M.componentWillMount=="function"&&M.componentWillMount(),typeof M.UNSAFE_componentWillMount=="function"&&M.UNSAFE_componentWillMount()),typeof M.componentDidMount=="function"&&(m.flags|=4194308)):(typeof M.componentDidMount=="function"&&(m.flags|=4194308),m.memoizedProps=k,m.memoizedState=we),M.props=k,M.state=we,M.context=Y,k=ce):(typeof M.componentDidMount=="function"&&(m.flags|=4194308),k=!1)}else{M=m.stateNode,r1(h,m),Y=m.memoizedProps,De=qu(y,Y),M.props=De,$e=m.pendingProps,je=M.context,we=y.contextType,ce=rh,typeof we=="object"&&we!==null&&(ce=Si(we)),ee=y.getDerivedStateFromProps,(we=typeof ee=="function"||typeof M.getSnapshotBeforeUpdate=="function")||typeof M.UNSAFE_componentWillReceiveProps!="function"&&typeof M.componentWillReceiveProps!="function"||(Y!==$e||je!==ce)&&UR(m,M,k,ce),fc=!1,je=m.memoizedState,M.state=je,Op(m,k,M,N),Rp();var Ae=m.memoizedState;Y!==$e||je!==Ae||fc||h!==null&&h.dependencies!==null&&uy(h.dependencies)?(typeof ee=="function"&&(j1(m,y,ee,k),Ae=m.memoizedState),(De=fc||qR(m,y,De,k,je,Ae,ce)||h!==null&&h.dependencies!==null&&uy(h.dependencies))?(we||typeof M.UNSAFE_componentWillUpdate!="function"&&typeof M.componentWillUpdate!="function"||(typeof M.componentWillUpdate=="function"&&M.componentWillUpdate(k,Ae,ce),typeof M.UNSAFE_componentWillUpdate=="function"&&M.UNSAFE_componentWillUpdate(k,Ae,ce)),typeof M.componentDidUpdate=="function"&&(m.flags|=4),typeof M.getSnapshotBeforeUpdate=="function"&&(m.flags|=1024)):(typeof M.componentDidUpdate!="function"||Y===h.memoizedProps&&je===h.memoizedState||(m.flags|=4),typeof M.getSnapshotBeforeUpdate!="function"||Y===h.memoizedProps&&je===h.memoizedState||(m.flags|=1024),m.memoizedProps=k,m.memoizedState=Ae),M.props=k,M.state=Ae,M.context=ce,k=De):(typeof M.componentDidUpdate!="function"||Y===h.memoizedProps&&je===h.memoizedState||(m.flags|=4),typeof M.getSnapshotBeforeUpdate!="function"||Y===h.memoizedProps&&je===h.memoizedState||(m.flags|=1024),k=!1)}return M=k,Ay(h,m),k=(m.flags&128)!==0,M||k?(M=m.stateNode,y=k&&typeof y.getDerivedStateFromError!="function"?null:M.render(),m.flags|=1,h!==null&&k?(m.child=Hu(m,h.child,null,N),m.child=Hu(m,null,y,N)):Ci(h,m,y,N),m.memoizedState=M.state,h=m.child):h=yl(h,m,N),h}function a5(h,m,y,k){return Lu(),m.flags|=256,Ci(h,m,y,k),m.child}var M1={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function R1(h){return{baseLanes:h,cachePool:GM()}}function O1(h,m,y){return h=h!==null?h.childLanes&~y:0,m&&(h|=qs),h}function o5(h,m,y){var k=m.pendingProps,N=!1,M=(m.flags&128)!==0,Y;if((Y=M)||(Y=h!==null&&h.memoizedState===null?!1:(Pr.current&2)!==0),Y&&(N=!0,m.flags&=-129),Y=(m.flags&32)!==0,m.flags&=-33,h===null){if(gn){if(N?gc(m):vc(),(h=sr)?(h=m3(h,pa),h=h!==null&&h.data!=="&"?h:null,h!==null&&(m.memoizedState={dehydrated:h,treeContext:cc!==null?{id:_o,overflow:xo}:null,retryLane:536870912,hydrationErrors:null},y=$M(h),y.return=m,m.child=y,wi=m,sr=null)):h=null,h===null)throw dc(m);return mw(h)?m.lanes=32:m.lanes=536870912,null}var ee=k.children;return k=k.fallback,N?(vc(),N=m.mode,ee=Ty({mode:"hidden",children:ee},N),k=Pu(k,N,y,null),ee.return=m,k.return=m,ee.sibling=k,m.child=ee,k=m.child,k.memoizedState=R1(y),k.childLanes=O1(h,Y,y),m.memoizedState=M1,Bp(null,k)):(gc(m),D1(m,ee))}var ce=h.memoizedState;if(ce!==null&&(ee=ce.dehydrated,ee!==null)){if(M)m.flags&256?(gc(m),m.flags&=-257,m=P1(h,m,y)):m.memoizedState!==null?(vc(),m.child=h.child,m.flags|=128,m=null):(vc(),ee=k.fallback,N=m.mode,k=Ty({mode:"visible",children:k.children},N),ee=Pu(ee,N,y,null),ee.flags|=2,k.return=m,ee.return=m,k.sibling=ee,m.child=k,Hu(m,h.child,null,y),k=m.child,k.memoizedState=R1(y),k.childLanes=O1(h,Y,y),m.memoizedState=M1,m=Bp(null,k));else if(gc(m),mw(ee)){if(Y=ee.nextSibling&&ee.nextSibling.dataset,Y)var we=Y.dgst;Y=we,k=Error(i(419)),k.stack="",k.digest=Y,jp({value:k,source:null,stack:null}),m=P1(h,m,y)}else if(qr||oh(h,m,y,!1),Y=(y&h.childLanes)!==0,qr||Y){if(Y=Xn,Y!==null&&(k=Jt(Y,y),k!==0&&k!==ce.retryLane))throw ce.retryLane=k,Du(h,k),ys(Y,h,k),A1;pw(ee)||zy(),m=P1(h,m,y)}else pw(ee)?(m.flags|=192,m.child=h.child,m=null):(h=ce.treeContext,sr=ga(ee.nextSibling),wi=m,gn=!0,uc=null,pa=!1,h!==null&&WM(m,h),m=D1(m,k.children),m.flags|=4096);return m}return N?(vc(),ee=k.fallback,N=m.mode,ce=h.child,we=ce.sibling,k=hl(ce,{mode:"hidden",children:k.children}),k.subtreeFlags=ce.subtreeFlags&65011712,we!==null?ee=hl(we,ee):(ee=Pu(ee,N,y,null),ee.flags|=2),ee.return=m,k.return=m,k.sibling=ee,m.child=k,Bp(null,k),k=m.child,ee=h.child.memoizedState,ee===null?ee=R1(y):(N=ee.cachePool,N!==null?(ce=Hr._currentValue,N=N.parent!==ce?{parent:ce,pool:ce}:N):N=GM(),ee={baseLanes:ee.baseLanes|y,cachePool:N}),k.memoizedState=ee,k.childLanes=O1(h,Y,y),m.memoizedState=M1,Bp(h.child,k)):(gc(m),y=h.child,h=y.sibling,y=hl(y,{mode:"visible",children:k.children}),y.return=m,y.sibling=null,h!==null&&(Y=m.deletions,Y===null?(m.deletions=[h],m.flags|=16):Y.push(h)),m.child=y,m.memoizedState=null,y)}function D1(h,m){return m=Ty({mode:"visible",children:m},h.mode),m.return=h,h.child=m}function Ty(h,m){return h=$s(22,h,null,m),h.lanes=0,h}function P1(h,m,y){return Hu(m,h.child,null,y),h=D1(m,m.pendingProps.children),h.flags|=2,m.memoizedState=null,h}function l5(h,m,y){h.lanes|=m;var k=h.alternate;k!==null&&(k.lanes|=m),Xk(h.return,m,y)}function L1(h,m,y,k,N,M){var Y=h.memoizedState;Y===null?h.memoizedState={isBackwards:m,rendering:null,renderingStartTime:0,last:k,tail:y,tailMode:N,treeForkCount:M}:(Y.isBackwards=m,Y.rendering=null,Y.renderingStartTime=0,Y.last=k,Y.tail=y,Y.tailMode=N,Y.treeForkCount=M)}function c5(h,m,y){var k=m.pendingProps,N=k.revealOrder,M=k.tail;k=k.children;var Y=Pr.current,ee=(Y&2)!==0;if(ee?(Y=Y&1|2,m.flags|=128):Y&=1,W(Pr,Y),Ci(h,m,k,y),k=gn?Cp:0,!ee&&h!==null&&(h.flags&128)!==0)e:for(h=m.child;h!==null;){if(h.tag===13)h.memoizedState!==null&&l5(h,y,m);else if(h.tag===19)l5(h,y,m);else if(h.child!==null){h.child.return=h,h=h.child;continue}if(h===m)break e;for(;h.sibling===null;){if(h.return===null||h.return===m)break e;h=h.return}h.sibling.return=h.return,h=h.sibling}switch(N){case"forwards":for(y=m.child,N=null;y!==null;)h=y.alternate,h!==null&&yy(h)===null&&(N=y),y=y.sibling;y=N,y===null?(N=m.child,m.child=null):(N=y.sibling,y.sibling=null),L1(m,!1,N,y,M,k);break;case"backwards":case"unstable_legacy-backwards":for(y=null,N=m.child,m.child=null;N!==null;){if(h=N.alternate,h!==null&&yy(h)===null){m.child=N;break}h=N.sibling,N.sibling=y,y=N,N=h}L1(m,!0,y,null,M,k);break;case"together":L1(m,!1,null,null,void 0,k);break;default:m.memoizedState=null}return m.child}function yl(h,m,y){if(h!==null&&(m.dependencies=h.dependencies),xc|=m.lanes,(y&m.childLanes)===0)if(h!==null){if(oh(h,m,y,!1),(y&m.childLanes)===0)return null}else return null;if(h!==null&&m.child!==h.child)throw Error(i(153));if(m.child!==null){for(h=m.child,y=hl(h,h.pendingProps),m.child=y,y.return=m;h.sibling!==null;)h=h.sibling,y=y.sibling=hl(h,h.pendingProps),y.return=m;y.sibling=null}return m.child}function I1(h,m){return(h.lanes&m)!==0?!0:(h=h.dependencies,!!(h!==null&&uy(h)))}function cG(h,m,y){switch(m.tag){case 3:ne(m,m.stateNode.containerInfo),hc(m,Hr,h.memoizedState.cache),Lu();break;case 27:case 5:oe(m);break;case 4:ne(m,m.stateNode.containerInfo);break;case 10:hc(m,m.type,m.memoizedProps.value);break;case 31:if(m.memoizedState!==null)return m.flags|=128,l1(m),null;break;case 13:var k=m.memoizedState;if(k!==null)return k.dehydrated!==null?(gc(m),m.flags|=128,null):(y&m.child.childLanes)!==0?o5(h,m,y):(gc(m),h=yl(h,m,y),h!==null?h.sibling:null);gc(m);break;case 19:var N=(h.flags&128)!==0;if(k=(y&m.childLanes)!==0,k||(oh(h,m,y,!1),k=(y&m.childLanes)!==0),N){if(k)return c5(h,m,y);m.flags|=128}if(N=m.memoizedState,N!==null&&(N.rendering=null,N.tail=null,N.lastEffect=null),W(Pr,Pr.current),k)break;return null;case 22:return m.lanes=0,t5(h,m,y,m.pendingProps);case 24:hc(m,Hr,h.memoizedState.cache)}return yl(h,m,y)}function u5(h,m,y){if(h!==null)if(h.memoizedProps!==m.pendingProps)qr=!0;else{if(!I1(h,y)&&(m.flags&128)===0)return qr=!1,cG(h,m,y);qr=(h.flags&131072)!==0}else qr=!1,gn&&(m.flags&1048576)!==0&&HM(m,Cp,m.index);switch(m.lanes=0,m.tag){case 16:e:{var k=m.pendingProps;if(h=$u(m.elementType),m.type=h,typeof h=="function")Hk(h)?(k=qu(h,k),m.tag=1,m=s5(null,m,h,k,y)):(m.tag=0,m=T1(null,m,h,k,y));else{if(h!=null){var N=h.$$typeof;if(N===T){m.tag=11,m=ZR(null,m,h,k,y);break e}else if(N===O){m.tag=14,m=JR(null,m,h,k,y);break e}}throw m=D(h)||h,Error(i(306,m,""))}}return m;case 0:return T1(h,m,m.type,m.pendingProps,y);case 1:return k=m.type,N=qu(k,m.pendingProps),s5(h,m,k,N,y);case 3:e:{if(ne(m,m.stateNode.containerInfo),h===null)throw Error(i(387));k=m.pendingProps;var M=m.memoizedState;N=M.element,r1(h,m),Op(m,k,null,y);var Y=m.memoizedState;if(k=Y.cache,hc(m,Hr,k),k!==M.cache&&Qk(m,[Hr],y,!0),Rp(),k=Y.element,M.isDehydrated)if(M={element:k,isDehydrated:!1,cache:Y.cache},m.updateQueue.baseState=M,m.memoizedState=M,m.flags&256){m=a5(h,m,k,y);break e}else if(k!==N){N=da(Error(i(424)),m),jp(N),m=a5(h,m,k,y);break e}else{switch(h=m.stateNode.containerInfo,h.nodeType){case 9:h=h.body;break;default:h=h.nodeName==="HTML"?h.ownerDocument.body:h}for(sr=ga(h.firstChild),wi=m,gn=!0,uc=null,pa=!0,y=tR(m,null,k,y),m.child=y;y;)y.flags=y.flags&-3|4096,y=y.sibling}else{if(Lu(),k===N){m=yl(h,m,y);break e}Ci(h,m,k,y)}m=m.child}return m;case 26:return Ay(h,m),h===null?(y=b3(m.type,null,m.pendingProps,null))?m.memoizedState=y:gn||(y=m.type,h=m.pendingProps,k=Ky(G.current).createElement(y),k[P]=m,k[Ie]=h,ji(k,y,h),Vn(k),m.stateNode=k):m.memoizedState=b3(m.type,h.memoizedProps,m.pendingProps,h.memoizedState),null;case 27:return oe(m),h===null&&gn&&(k=m.stateNode=y3(m.type,m.pendingProps,G.current),wi=m,pa=!0,N=sr,Cc(m.type)?(gw=N,sr=ga(k.firstChild)):sr=N),Ci(h,m,m.pendingProps.children,y),Ay(h,m),h===null&&(m.flags|=4194304),m.child;case 5:return h===null&&gn&&((N=k=sr)&&(k=zG(k,m.type,m.pendingProps,pa),k!==null?(m.stateNode=k,wi=m,sr=ga(k.firstChild),pa=!1,N=!0):N=!1),N||dc(m)),oe(m),N=m.type,M=m.pendingProps,Y=h!==null?h.memoizedProps:null,k=M.children,dw(N,M)?k=null:Y!==null&&dw(N,Y)&&(m.flags|=32),m.memoizedState!==null&&(N=u1(h,m,eG,null,null,y),Jp._currentValue=N),Ay(h,m),Ci(h,m,k,y),m.child;case 6:return h===null&&gn&&((h=y=sr)&&(y=$G(y,m.pendingProps,pa),y!==null?(m.stateNode=y,wi=m,sr=null,h=!0):h=!1),h||dc(m)),null;case 13:return o5(h,m,y);case 4:return ne(m,m.stateNode.containerInfo),k=m.pendingProps,h===null?m.child=Hu(m,null,k,y):Ci(h,m,k,y),m.child;case 11:return ZR(h,m,m.type,m.pendingProps,y);case 7:return Ci(h,m,m.pendingProps,y),m.child;case 8:return Ci(h,m,m.pendingProps.children,y),m.child;case 12:return Ci(h,m,m.pendingProps.children,y),m.child;case 10:return k=m.pendingProps,hc(m,m.type,k.value),Ci(h,m,k.children,y),m.child;case 9:return N=m.type._context,k=m.pendingProps.children,Bu(m),N=Si(N),k=k(N),m.flags|=1,Ci(h,m,k,y),m.child;case 14:return JR(h,m,m.type,m.pendingProps,y);case 15:return e5(h,m,m.type,m.pendingProps,y);case 19:return c5(h,m,y);case 31:return lG(h,m,y);case 22:return t5(h,m,y,m.pendingProps);case 24:return Bu(m),k=Si(Hr),h===null?(N=e1(),N===null&&(N=Xn,M=Zk(),N.pooledCache=M,M.refCount++,M!==null&&(N.pooledCacheLanes|=y),N=M),m.memoizedState={parent:k,cache:N},n1(m),hc(m,Hr,N)):((h.lanes&y)!==0&&(r1(h,m),Op(m,null,null,y),Rp()),N=h.memoizedState,M=m.memoizedState,N.parent!==k?(N={parent:k,cache:k},m.memoizedState=N,m.lanes===0&&(m.memoizedState=m.updateQueue.baseState=N),hc(m,Hr,k)):(k=M.cache,hc(m,Hr,k),k!==N.cache&&Qk(m,[Hr],y,!0))),Ci(h,m,m.pendingProps.children,y),m.child;case 29:throw m.pendingProps}throw Error(i(156,m.tag))}function _l(h){h.flags|=4}function B1(h,m,y,k,N){if((m=(h.mode&32)!==0)&&(m=!1),m){if(h.flags|=16777216,(N&335544128)===N)if(h.stateNode.complete)h.flags|=8192;else if(I5())h.flags|=8192;else throw Fu=py,t1}else h.flags&=-16777217}function d5(h,m){if(m.type!=="stylesheet"||(m.state.loading&4)!==0)h.flags&=-16777217;else if(h.flags|=16777216,!j3(m))if(I5())h.flags|=8192;else throw Fu=py,t1}function My(h,m){m!==null&&(h.flags|=4),h.flags&16384&&(m=h.tag!==22?Wt():536870912,h.lanes|=m,_h|=m)}function zp(h,m){if(!gn)switch(h.tailMode){case"hidden":m=h.tail;for(var y=null;m!==null;)m.alternate!==null&&(y=m),m=m.sibling;y===null?h.tail=null:y.sibling=null;break;case"collapsed":y=h.tail;for(var k=null;y!==null;)y.alternate!==null&&(k=y),y=y.sibling;k===null?m||h.tail===null?h.tail=null:h.tail.sibling=null:k.sibling=null}}function ar(h){var m=h.alternate!==null&&h.alternate.child===h.child,y=0,k=0;if(m)for(var N=h.child;N!==null;)y|=N.lanes|N.childLanes,k|=N.subtreeFlags&65011712,k|=N.flags&65011712,N.return=h,N=N.sibling;else for(N=h.child;N!==null;)y|=N.lanes|N.childLanes,k|=N.subtreeFlags,k|=N.flags,N.return=h,N=N.sibling;return h.subtreeFlags|=k,h.childLanes=y,m}function uG(h,m,y){var k=m.pendingProps;switch(Kk(m),m.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return ar(m),null;case 1:return ar(m),null;case 3:return y=m.stateNode,k=null,h!==null&&(k=h.memoizedState.cache),m.memoizedState.cache!==k&&(m.flags|=2048),ml(Hr),le(),y.pendingContext&&(y.context=y.pendingContext,y.pendingContext=null),(h===null||h.child===null)&&(ah(m)?_l(m):h===null||h.memoizedState.isDehydrated&&(m.flags&256)===0||(m.flags|=1024,Yk())),ar(m),null;case 26:var N=m.type,M=m.memoizedState;return h===null?(_l(m),M!==null?(ar(m),d5(m,M)):(ar(m),B1(m,N,null,k,y))):M?M!==h.memoizedState?(_l(m),ar(m),d5(m,M)):(ar(m),m.flags&=-16777217):(h=h.memoizedProps,h!==k&&_l(m),ar(m),B1(m,N,h,k,y)),null;case 27:if(ie(m),y=G.current,N=m.type,h!==null&&m.stateNode!=null)h.memoizedProps!==k&&_l(m);else{if(!k){if(m.stateNode===null)throw Error(i(166));return ar(m),null}h=te.current,ah(m)?qM(m):(h=y3(N,k,y),m.stateNode=h,_l(m))}return ar(m),null;case 5:if(ie(m),N=m.type,h!==null&&m.stateNode!=null)h.memoizedProps!==k&&_l(m);else{if(!k){if(m.stateNode===null)throw Error(i(166));return ar(m),null}if(M=te.current,ah(m))qM(m);else{var Y=Ky(G.current);switch(M){case 1:M=Y.createElementNS("http://www.w3.org/2000/svg",N);break;case 2:M=Y.createElementNS("http://www.w3.org/1998/Math/MathML",N);break;default:switch(N){case"svg":M=Y.createElementNS("http://www.w3.org/2000/svg",N);break;case"math":M=Y.createElementNS("http://www.w3.org/1998/Math/MathML",N);break;case"script":M=Y.createElement("div"),M.innerHTML="<script><\/script>",M=M.removeChild(M.firstChild);break;case"select":M=typeof k.is=="string"?Y.createElement("select",{is:k.is}):Y.createElement("select"),k.multiple?M.multiple=!0:k.size&&(M.size=k.size);break;default:M=typeof k.is=="string"?Y.createElement(N,{is:k.is}):Y.createElement(N)}}M[P]=m,M[Ie]=k;e:for(Y=m.child;Y!==null;){if(Y.tag===5||Y.tag===6)M.appendChild(Y.stateNode);else if(Y.tag!==4&&Y.tag!==27&&Y.child!==null){Y.child.return=Y,Y=Y.child;continue}if(Y===m)break e;for(;Y.sibling===null;){if(Y.return===null||Y.return===m)break e;Y=Y.return}Y.sibling.return=Y.return,Y=Y.sibling}m.stateNode=M;e:switch(ji(M,N,k),N){case"button":case"input":case"select":case"textarea":k=!!k.autoFocus;break e;case"img":k=!0;break e;default:k=!1}k&&_l(m)}}return ar(m),B1(m,m.type,h===null?null:h.memoizedProps,m.pendingProps,y),null;case 6:if(h&&m.stateNode!=null)h.memoizedProps!==k&&_l(m);else{if(typeof k!="string"&&m.stateNode===null)throw Error(i(166));if(h=G.current,ah(m)){if(h=m.stateNode,y=m.memoizedProps,k=null,N=wi,N!==null)switch(N.tag){case 27:case 5:k=N.memoizedProps}h[P]=m,h=!!(h.nodeValue===y||k!==null&&k.suppressHydrationWarning===!0||o3(h.nodeValue,y)),h||dc(m,!0)}else h=Ky(h).createTextNode(k),h[P]=m,m.stateNode=h}return ar(m),null;case 31:if(y=m.memoizedState,h===null||h.memoizedState!==null){if(k=ah(m),y!==null){if(h===null){if(!k)throw Error(i(318));if(h=m.memoizedState,h=h!==null?h.dehydrated:null,!h)throw Error(i(557));h[P]=m}else Lu(),(m.flags&128)===0&&(m.memoizedState=null),m.flags|=4;ar(m),h=!1}else y=Yk(),h!==null&&h.memoizedState!==null&&(h.memoizedState.hydrationErrors=y),h=!0;if(!h)return m.flags&256?(Hs(m),m):(Hs(m),null);if((m.flags&128)!==0)throw Error(i(558))}return ar(m),null;case 13:if(k=m.memoizedState,h===null||h.memoizedState!==null&&h.memoizedState.dehydrated!==null){if(N=ah(m),k!==null&&k.dehydrated!==null){if(h===null){if(!N)throw Error(i(318));if(N=m.memoizedState,N=N!==null?N.dehydrated:null,!N)throw Error(i(317));N[P]=m}else Lu(),(m.flags&128)===0&&(m.memoizedState=null),m.flags|=4;ar(m),N=!1}else N=Yk(),h!==null&&h.memoizedState!==null&&(h.memoizedState.hydrationErrors=N),N=!0;if(!N)return m.flags&256?(Hs(m),m):(Hs(m),null)}return Hs(m),(m.flags&128)!==0?(m.lanes=y,m):(y=k!==null,h=h!==null&&h.memoizedState!==null,y&&(k=m.child,N=null,k.alternate!==null&&k.alternate.memoizedState!==null&&k.alternate.memoizedState.cachePool!==null&&(N=k.alternate.memoizedState.cachePool.pool),M=null,k.memoizedState!==null&&k.memoizedState.cachePool!==null&&(M=k.memoizedState.cachePool.pool),M!==N&&(k.flags|=2048)),y!==h&&y&&(m.child.flags|=8192),My(m,m.updateQueue),ar(m),null);case 4:return le(),h===null&&aw(m.stateNode.containerInfo),ar(m),null;case 10:return ml(m.type),ar(m),null;case 19:if(q(Pr),k=m.memoizedState,k===null)return ar(m),null;if(N=(m.flags&128)!==0,M=k.rendering,M===null)if(N)zp(k,!1);else{if(Ar!==0||h!==null&&(h.flags&128)!==0)for(h=m.child;h!==null;){if(M=yy(h),M!==null){for(m.flags|=128,zp(k,!1),h=M.updateQueue,m.updateQueue=h,My(m,h),m.subtreeFlags=0,h=y,y=m.child;y!==null;)zM(y,h),y=y.sibling;return W(Pr,Pr.current&1|2),gn&&fl(m,k.treeForkCount),m.child}h=h.sibling}k.tail!==null&&yt()>Ly&&(m.flags|=128,N=!0,zp(k,!1),m.lanes=4194304)}else{if(!N)if(h=yy(M),h!==null){if(m.flags|=128,N=!0,h=h.updateQueue,m.updateQueue=h,My(m,h),zp(k,!0),k.tail===null&&k.tailMode==="hidden"&&!M.alternate&&!gn)return ar(m),null}else 2*yt()-k.renderingStartTime>Ly&&y!==536870912&&(m.flags|=128,N=!0,zp(k,!1),m.lanes=4194304);k.isBackwards?(M.sibling=m.child,m.child=M):(h=k.last,h!==null?h.sibling=M:m.child=M,k.last=M)}return k.tail!==null?(h=k.tail,k.rendering=h,k.tail=h.sibling,k.renderingStartTime=yt(),h.sibling=null,y=Pr.current,W(Pr,N?y&1|2:y&1),gn&&fl(m,k.treeForkCount),h):(ar(m),null);case 22:case 23:return Hs(m),o1(),k=m.memoizedState!==null,h!==null?h.memoizedState!==null!==k&&(m.flags|=8192):k&&(m.flags|=8192),k?(y&536870912)!==0&&(m.flags&128)===0&&(ar(m),m.subtreeFlags&6&&(m.flags|=8192)):ar(m),y=m.updateQueue,y!==null&&My(m,y.retryQueue),y=null,h!==null&&h.memoizedState!==null&&h.memoizedState.cachePool!==null&&(y=h.memoizedState.cachePool.pool),k=null,m.memoizedState!==null&&m.memoizedState.cachePool!==null&&(k=m.memoizedState.cachePool.pool),k!==y&&(m.flags|=2048),h!==null&&q(zu),null;case 24:return y=null,h!==null&&(y=h.memoizedState.cache),m.memoizedState.cache!==y&&(m.flags|=2048),ml(Hr),ar(m),null;case 25:return null;case 30:return null}throw Error(i(156,m.tag))}function dG(h,m){switch(Kk(m),m.tag){case 1:return h=m.flags,h&65536?(m.flags=h&-65537|128,m):null;case 3:return ml(Hr),le(),h=m.flags,(h&65536)!==0&&(h&128)===0?(m.flags=h&-65537|128,m):null;case 26:case 27:case 5:return ie(m),null;case 31:if(m.memoizedState!==null){if(Hs(m),m.alternate===null)throw Error(i(340));Lu()}return h=m.flags,h&65536?(m.flags=h&-65537|128,m):null;case 13:if(Hs(m),h=m.memoizedState,h!==null&&h.dehydrated!==null){if(m.alternate===null)throw Error(i(340));Lu()}return h=m.flags,h&65536?(m.flags=h&-65537|128,m):null;case 19:return q(Pr),null;case 4:return le(),null;case 10:return ml(m.type),null;case 22:case 23:return Hs(m),o1(),h!==null&&q(zu),h=m.flags,h&65536?(m.flags=h&-65537|128,m):null;case 24:return ml(Hr),null;case 25:return null;default:return null}}function h5(h,m){switch(Kk(m),m.tag){case 3:ml(Hr),le();break;case 26:case 27:case 5:ie(m);break;case 4:le();break;case 31:m.memoizedState!==null&&Hs(m);break;case 13:Hs(m);break;case 19:q(Pr);break;case 10:ml(m.type);break;case 22:case 23:Hs(m),o1(),h!==null&&q(zu);break;case 24:ml(Hr)}}function $p(h,m){try{var y=m.updateQueue,k=y!==null?y.lastEffect:null;if(k!==null){var N=k.next;y=N;do{if((y.tag&h)===h){k=void 0;var M=y.create,Y=y.inst;k=M(),Y.destroy=k}y=y.next}while(y!==N)}}catch(ee){zn(m,m.return,ee)}}function yc(h,m,y){try{var k=m.updateQueue,N=k!==null?k.lastEffect:null;if(N!==null){var M=N.next;k=M;do{if((k.tag&h)===h){var Y=k.inst,ee=Y.destroy;if(ee!==void 0){Y.destroy=void 0,N=m;var ce=y,we=ee;try{we()}catch(De){zn(N,ce,De)}}}k=k.next}while(k!==M)}}catch(De){zn(m,m.return,De)}}function f5(h){var m=h.updateQueue;if(m!==null){var y=h.stateNode;try{rR(m,y)}catch(k){zn(h,h.return,k)}}}function p5(h,m,y){y.props=qu(h.type,h.memoizedProps),y.state=h.memoizedState;try{y.componentWillUnmount()}catch(k){zn(h,m,k)}}function Fp(h,m){try{var y=h.ref;if(y!==null){switch(h.tag){case 26:case 27:case 5:var k=h.stateNode;break;case 30:k=h.stateNode;break;default:k=h.stateNode}typeof y=="function"?h.refCleanup=y(k):y.current=k}}catch(N){zn(h,m,N)}}function bo(h,m){var y=h.ref,k=h.refCleanup;if(y!==null)if(typeof k=="function")try{k()}catch(N){zn(h,m,N)}finally{h.refCleanup=null,h=h.alternate,h!=null&&(h.refCleanup=null)}else if(typeof y=="function")try{y(null)}catch(N){zn(h,m,N)}else y.current=null}function m5(h){var m=h.type,y=h.memoizedProps,k=h.stateNode;try{e:switch(m){case"button":case"input":case"select":case"textarea":y.autoFocus&&k.focus();break e;case"img":y.src?k.src=y.src:y.srcSet&&(k.srcset=y.srcSet)}}catch(N){zn(h,h.return,N)}}function z1(h,m,y){try{var k=h.stateNode;OG(k,h.type,y,m),k[Ie]=m}catch(N){zn(h,h.return,N)}}function g5(h){return h.tag===5||h.tag===3||h.tag===26||h.tag===27&&Cc(h.type)||h.tag===4}function $1(h){e:for(;;){for(;h.sibling===null;){if(h.return===null||g5(h.return))return null;h=h.return}for(h.sibling.return=h.return,h=h.sibling;h.tag!==5&&h.tag!==6&&h.tag!==18;){if(h.tag===27&&Cc(h.type)||h.flags&2||h.child===null||h.tag===4)continue e;h.child.return=h,h=h.child}if(!(h.flags&2))return h.stateNode}}function F1(h,m,y){var k=h.tag;if(k===5||k===6)h=h.stateNode,m?(y.nodeType===9?y.body:y.nodeName==="HTML"?y.ownerDocument.body:y).insertBefore(h,m):(m=y.nodeType===9?y.body:y.nodeName==="HTML"?y.ownerDocument.body:y,m.appendChild(h),y=y._reactRootContainer,y!=null||m.onclick!==null||(m.onclick=ca));else if(k!==4&&(k===27&&Cc(h.type)&&(y=h.stateNode,m=null),h=h.child,h!==null))for(F1(h,m,y),h=h.sibling;h!==null;)F1(h,m,y),h=h.sibling}function Ry(h,m,y){var k=h.tag;if(k===5||k===6)h=h.stateNode,m?y.insertBefore(h,m):y.appendChild(h);else if(k!==4&&(k===27&&Cc(h.type)&&(y=h.stateNode),h=h.child,h!==null))for(Ry(h,m,y),h=h.sibling;h!==null;)Ry(h,m,y),h=h.sibling}function v5(h){var m=h.stateNode,y=h.memoizedProps;try{for(var k=h.type,N=m.attributes;N.length;)m.removeAttributeNode(N[0]);ji(m,k,y),m[P]=h,m[Ie]=y}catch(M){zn(h,h.return,M)}}var xl=!1,Ur=!1,H1=!1,y5=typeof WeakSet=="function"?WeakSet:Set,ci=null;function hG(h,m){if(h=h.containerInfo,cw=Jy,h=TM(h),Pk(h)){if("selectionStart"in h)var y={start:h.selectionStart,end:h.selectionEnd};else e:{y=(y=h.ownerDocument)&&y.defaultView||window;var k=y.getSelection&&y.getSelection();if(k&&k.rangeCount!==0){y=k.anchorNode;var N=k.anchorOffset,M=k.focusNode;k=k.focusOffset;try{y.nodeType,M.nodeType}catch{y=null;break e}var Y=0,ee=-1,ce=-1,we=0,De=0,$e=h,je=null;t:for(;;){for(var Ae;$e!==y||N!==0&&$e.nodeType!==3||(ee=Y+N),$e!==M||k!==0&&$e.nodeType!==3||(ce=Y+k),$e.nodeType===3&&(Y+=$e.nodeValue.length),(Ae=$e.firstChild)!==null;)je=$e,$e=Ae;for(;;){if($e===h)break t;if(je===y&&++we===N&&(ee=Y),je===M&&++De===k&&(ce=Y),(Ae=$e.nextSibling)!==null)break;$e=je,je=$e.parentNode}$e=Ae}y=ee===-1||ce===-1?null:{start:ee,end:ce}}else y=null}y=y||{start:0,end:0}}else y=null;for(uw={focusedElem:h,selectionRange:y},Jy=!1,ci=m;ci!==null;)if(m=ci,h=m.child,(m.subtreeFlags&1028)!==0&&h!==null)h.return=m,ci=h;else for(;ci!==null;){switch(m=ci,M=m.alternate,h=m.flags,m.tag){case 0:if((h&4)!==0&&(h=m.updateQueue,h=h!==null?h.events:null,h!==null))for(y=0;y<h.length;y++)N=h[y],N.ref.impl=N.nextImpl;break;case 11:case 15:break;case 1:if((h&1024)!==0&&M!==null){h=void 0,y=m,N=M.memoizedProps,M=M.memoizedState,k=y.stateNode;try{var _t=qu(y.type,N);h=k.getSnapshotBeforeUpdate(_t,M),k.__reactInternalSnapshotBeforeUpdate=h}catch(zt){zn(y,y.return,zt)}}break;case 3:if((h&1024)!==0){if(h=m.stateNode.containerInfo,y=h.nodeType,y===9)fw(h);else if(y===1)switch(h.nodeName){case"HEAD":case"HTML":case"BODY":fw(h);break;default:h.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((h&1024)!==0)throw Error(i(163))}if(h=m.sibling,h!==null){h.return=m.return,ci=h;break}ci=m.return}}function _5(h,m,y){var k=y.flags;switch(y.tag){case 0:case 11:case 15:kl(h,y),k&4&&$p(5,y);break;case 1:if(kl(h,y),k&4)if(h=y.stateNode,m===null)try{h.componentDidMount()}catch(Y){zn(y,y.return,Y)}else{var N=qu(y.type,m.memoizedProps);m=m.memoizedState;try{h.componentDidUpdate(N,m,h.__reactInternalSnapshotBeforeUpdate)}catch(Y){zn(y,y.return,Y)}}k&64&&f5(y),k&512&&Fp(y,y.return);break;case 3:if(kl(h,y),k&64&&(h=y.updateQueue,h!==null)){if(m=null,y.child!==null)switch(y.child.tag){case 27:case 5:m=y.child.stateNode;break;case 1:m=y.child.stateNode}try{rR(h,m)}catch(Y){zn(y,y.return,Y)}}break;case 27:m===null&&k&4&&v5(y);case 26:case 5:kl(h,y),m===null&&k&4&&m5(y),k&512&&Fp(y,y.return);break;case 12:kl(h,y);break;case 31:kl(h,y),k&4&&k5(h,y);break;case 13:kl(h,y),k&4&&w5(h,y),k&64&&(h=y.memoizedState,h!==null&&(h=h.dehydrated,h!==null&&(y=bG.bind(null,y),FG(h,y))));break;case 22:if(k=y.memoizedState!==null||xl,!k){m=m!==null&&m.memoizedState!==null||Ur,N=xl;var M=Ur;xl=k,(Ur=m)&&!M?wl(h,y,(y.subtreeFlags&8772)!==0):kl(h,y),xl=N,Ur=M}break;case 30:break;default:kl(h,y)}}function x5(h){var m=h.alternate;m!==null&&(h.alternate=null,x5(m)),h.child=null,h.deletions=null,h.sibling=null,h.tag===5&&(m=h.stateNode,m!==null&&ll(m)),h.stateNode=null,h.return=null,h.dependencies=null,h.memoizedProps=null,h.memoizedState=null,h.pendingProps=null,h.stateNode=null,h.updateQueue=null}var fr=null,ps=!1;function bl(h,m,y){for(y=y.child;y!==null;)b5(h,m,y),y=y.sibling}function b5(h,m,y){if(ut&&typeof ut.onCommitFiberUnmount=="function")try{ut.onCommitFiberUnmount(We,y)}catch{}switch(y.tag){case 26:Ur||bo(y,m),bl(h,m,y),y.memoizedState?y.memoizedState.count--:y.stateNode&&(y=y.stateNode,y.parentNode.removeChild(y));break;case 27:Ur||bo(y,m);var k=fr,N=ps;Cc(y.type)&&(fr=y.stateNode,ps=!1),bl(h,m,y),Xp(y.stateNode),fr=k,ps=N;break;case 5:Ur||bo(y,m);case 6:if(k=fr,N=ps,fr=null,bl(h,m,y),fr=k,ps=N,fr!==null)if(ps)try{(fr.nodeType===9?fr.body:fr.nodeName==="HTML"?fr.ownerDocument.body:fr).removeChild(y.stateNode)}catch(M){zn(y,m,M)}else try{fr.removeChild(y.stateNode)}catch(M){zn(y,m,M)}break;case 18:fr!==null&&(ps?(h=fr,f3(h.nodeType===9?h.body:h.nodeName==="HTML"?h.ownerDocument.body:h,y.stateNode),Nh(h)):f3(fr,y.stateNode));break;case 4:k=fr,N=ps,fr=y.stateNode.containerInfo,ps=!0,bl(h,m,y),fr=k,ps=N;break;case 0:case 11:case 14:case 15:yc(2,y,m),Ur||yc(4,y,m),bl(h,m,y);break;case 1:Ur||(bo(y,m),k=y.stateNode,typeof k.componentWillUnmount=="function"&&p5(y,m,k)),bl(h,m,y);break;case 21:bl(h,m,y);break;case 22:Ur=(k=Ur)||y.memoizedState!==null,bl(h,m,y),Ur=k;break;default:bl(h,m,y)}}function k5(h,m){if(m.memoizedState===null&&(h=m.alternate,h!==null&&(h=h.memoizedState,h!==null))){h=h.dehydrated;try{Nh(h)}catch(y){zn(m,m.return,y)}}}function w5(h,m){if(m.memoizedState===null&&(h=m.alternate,h!==null&&(h=h.memoizedState,h!==null&&(h=h.dehydrated,h!==null))))try{Nh(h)}catch(y){zn(m,m.return,y)}}function fG(h){switch(h.tag){case 31:case 13:case 19:var m=h.stateNode;return m===null&&(m=h.stateNode=new y5),m;case 22:return h=h.stateNode,m=h._retryCache,m===null&&(m=h._retryCache=new y5),m;default:throw Error(i(435,h.tag))}}function Oy(h,m){var y=fG(h);m.forEach(function(k){if(!y.has(k)){y.add(k);var N=kG.bind(null,h,k);k.then(N,N)}})}function ms(h,m){var y=m.deletions;if(y!==null)for(var k=0;k<y.length;k++){var N=y[k],M=h,Y=m,ee=Y;e:for(;ee!==null;){switch(ee.tag){case 27:if(Cc(ee.type)){fr=ee.stateNode,ps=!1;break e}break;case 5:fr=ee.stateNode,ps=!1;break e;case 3:case 4:fr=ee.stateNode.containerInfo,ps=!0;break e}ee=ee.return}if(fr===null)throw Error(i(160));b5(M,Y,N),fr=null,ps=!1,M=N.alternate,M!==null&&(M.return=null),N.return=null}if(m.subtreeFlags&13886)for(m=m.child;m!==null;)S5(m,h),m=m.sibling}var za=null;function S5(h,m){var y=h.alternate,k=h.flags;switch(h.tag){case 0:case 11:case 14:case 15:ms(m,h),gs(h),k&4&&(yc(3,h,h.return),$p(3,h),yc(5,h,h.return));break;case 1:ms(m,h),gs(h),k&512&&(Ur||y===null||bo(y,y.return)),k&64&&xl&&(h=h.updateQueue,h!==null&&(k=h.callbacks,k!==null&&(y=h.shared.hiddenCallbacks,h.shared.hiddenCallbacks=y===null?k:y.concat(k))));break;case 26:var N=za;if(ms(m,h),gs(h),k&512&&(Ur||y===null||bo(y,y.return)),k&4){var M=y!==null?y.memoizedState:null;if(k=h.memoizedState,y===null)if(k===null)if(h.stateNode===null){e:{k=h.type,y=h.memoizedProps,N=N.ownerDocument||N;t:switch(k){case"title":M=N.getElementsByTagName("title")[0],(!M||M[hs]||M[P]||M.namespaceURI==="http://www.w3.org/2000/svg"||M.hasAttribute("itemprop"))&&(M=N.createElement(k),N.head.insertBefore(M,N.querySelector("head > title"))),ji(M,k,y),M[P]=h,Vn(M),k=M;break e;case"link":var Y=S3("link","href",N).get(k+(y.href||""));if(Y){for(var ee=0;ee<Y.length;ee++)if(M=Y[ee],M.getAttribute("href")===(y.href==null||y.href===""?null:y.href)&&M.getAttribute("rel")===(y.rel==null?null:y.rel)&&M.getAttribute("title")===(y.title==null?null:y.title)&&M.getAttribute("crossorigin")===(y.crossOrigin==null?null:y.crossOrigin)){Y.splice(ee,1);break t}}M=N.createElement(k),ji(M,k,y),N.head.appendChild(M);break;case"meta":if(Y=S3("meta","content",N).get(k+(y.content||""))){for(ee=0;ee<Y.length;ee++)if(M=Y[ee],M.getAttribute("content")===(y.content==null?null:""+y.content)&&M.getAttribute("name")===(y.name==null?null:y.name)&&M.getAttribute("property")===(y.property==null?null:y.property)&&M.getAttribute("http-equiv")===(y.httpEquiv==null?null:y.httpEquiv)&&M.getAttribute("charset")===(y.charSet==null?null:y.charSet)){Y.splice(ee,1);break t}}M=N.createElement(k),ji(M,k,y),N.head.appendChild(M);break;default:throw Error(i(468,k))}M[P]=h,Vn(M),k=M}h.stateNode=k}else C3(N,h.type,h.stateNode);else h.stateNode=w3(N,k,h.memoizedProps);else M!==k?(M===null?y.stateNode!==null&&(y=y.stateNode,y.parentNode.removeChild(y)):M.count--,k===null?C3(N,h.type,h.stateNode):w3(N,k,h.memoizedProps)):k===null&&h.stateNode!==null&&z1(h,h.memoizedProps,y.memoizedProps)}break;case 27:ms(m,h),gs(h),k&512&&(Ur||y===null||bo(y,y.return)),y!==null&&k&4&&z1(h,h.memoizedProps,y.memoizedProps);break;case 5:if(ms(m,h),gs(h),k&512&&(Ur||y===null||bo(y,y.return)),h.flags&32){N=h.stateNode;try{mo(N,"")}catch(_t){zn(h,h.return,_t)}}k&4&&h.stateNode!=null&&(N=h.memoizedProps,z1(h,N,y!==null?y.memoizedProps:N)),k&1024&&(H1=!0);break;case 6:if(ms(m,h),gs(h),k&4){if(h.stateNode===null)throw Error(i(162));k=h.memoizedProps,y=h.stateNode;try{y.nodeValue=k}catch(_t){zn(h,h.return,_t)}}break;case 3:if(Gy=null,N=za,za=Vy(m.containerInfo),ms(m,h),za=N,gs(h),k&4&&y!==null&&y.memoizedState.isDehydrated)try{Nh(m.containerInfo)}catch(_t){zn(h,h.return,_t)}H1&&(H1=!1,C5(h));break;case 4:k=za,za=Vy(h.stateNode.containerInfo),ms(m,h),gs(h),za=k;break;case 12:ms(m,h),gs(h);break;case 31:ms(m,h),gs(h),k&4&&(k=h.updateQueue,k!==null&&(h.updateQueue=null,Oy(h,k)));break;case 13:ms(m,h),gs(h),h.child.flags&8192&&h.memoizedState!==null!=(y!==null&&y.memoizedState!==null)&&(Py=yt()),k&4&&(k=h.updateQueue,k!==null&&(h.updateQueue=null,Oy(h,k)));break;case 22:N=h.memoizedState!==null;var ce=y!==null&&y.memoizedState!==null,we=xl,De=Ur;if(xl=we||N,Ur=De||ce,ms(m,h),Ur=De,xl=we,gs(h),k&8192)e:for(m=h.stateNode,m._visibility=N?m._visibility&-2:m._visibility|1,N&&(y===null||ce||xl||Ur||Uu(h)),y=null,m=h;;){if(m.tag===5||m.tag===26){if(y===null){ce=y=m;try{if(M=ce.stateNode,N)Y=M.style,typeof Y.setProperty=="function"?Y.setProperty("display","none","important"):Y.display="none";else{ee=ce.stateNode;var $e=ce.memoizedProps.style,je=$e!=null&&$e.hasOwnProperty("display")?$e.display:null;ee.style.display=je==null||typeof je=="boolean"?"":(""+je).trim()}}catch(_t){zn(ce,ce.return,_t)}}}else if(m.tag===6){if(y===null){ce=m;try{ce.stateNode.nodeValue=N?"":ce.memoizedProps}catch(_t){zn(ce,ce.return,_t)}}}else if(m.tag===18){if(y===null){ce=m;try{var Ae=ce.stateNode;N?p3(Ae,!0):p3(ce.stateNode,!1)}catch(_t){zn(ce,ce.return,_t)}}}else if((m.tag!==22&&m.tag!==23||m.memoizedState===null||m===h)&&m.child!==null){m.child.return=m,m=m.child;continue}if(m===h)break e;for(;m.sibling===null;){if(m.return===null||m.return===h)break e;y===m&&(y=null),m=m.return}y===m&&(y=null),m.sibling.return=m.return,m=m.sibling}k&4&&(k=h.updateQueue,k!==null&&(y=k.retryQueue,y!==null&&(k.retryQueue=null,Oy(h,y))));break;case 19:ms(m,h),gs(h),k&4&&(k=h.updateQueue,k!==null&&(h.updateQueue=null,Oy(h,k)));break;case 30:break;case 21:break;default:ms(m,h),gs(h)}}function gs(h){var m=h.flags;if(m&2){try{for(var y,k=h.return;k!==null;){if(g5(k)){y=k;break}k=k.return}if(y==null)throw Error(i(160));switch(y.tag){case 27:var N=y.stateNode,M=$1(h);Ry(h,M,N);break;case 5:var Y=y.stateNode;y.flags&32&&(mo(Y,""),y.flags&=-33);var ee=$1(h);Ry(h,ee,Y);break;case 3:case 4:var ce=y.stateNode.containerInfo,we=$1(h);F1(h,we,ce);break;default:throw Error(i(161))}}catch(De){zn(h,h.return,De)}h.flags&=-3}m&4096&&(h.flags&=-4097)}function C5(h){if(h.subtreeFlags&1024)for(h=h.child;h!==null;){var m=h;C5(m),m.tag===5&&m.flags&1024&&m.stateNode.reset(),h=h.sibling}}function kl(h,m){if(m.subtreeFlags&8772)for(m=m.child;m!==null;)_5(h,m.alternate,m),m=m.sibling}function Uu(h){for(h=h.child;h!==null;){var m=h;switch(m.tag){case 0:case 11:case 14:case 15:yc(4,m,m.return),Uu(m);break;case 1:bo(m,m.return);var y=m.stateNode;typeof y.componentWillUnmount=="function"&&p5(m,m.return,y),Uu(m);break;case 27:Xp(m.stateNode);case 26:case 5:bo(m,m.return),Uu(m);break;case 22:m.memoizedState===null&&Uu(m);break;case 30:Uu(m);break;default:Uu(m)}h=h.sibling}}function wl(h,m,y){for(y=y&&(m.subtreeFlags&8772)!==0,m=m.child;m!==null;){var k=m.alternate,N=h,M=m,Y=M.flags;switch(M.tag){case 0:case 11:case 15:wl(N,M,y),$p(4,M);break;case 1:if(wl(N,M,y),k=M,N=k.stateNode,typeof N.componentDidMount=="function")try{N.componentDidMount()}catch(we){zn(k,k.return,we)}if(k=M,N=k.updateQueue,N!==null){var ee=k.stateNode;try{var ce=N.shared.hiddenCallbacks;if(ce!==null)for(N.shared.hiddenCallbacks=null,N=0;N<ce.length;N++)nR(ce[N],ee)}catch(we){zn(k,k.return,we)}}y&&Y&64&&f5(M),Fp(M,M.return);break;case 27:v5(M);case 26:case 5:wl(N,M,y),y&&k===null&&Y&4&&m5(M),Fp(M,M.return);break;case 12:wl(N,M,y);break;case 31:wl(N,M,y),y&&Y&4&&k5(N,M);break;case 13:wl(N,M,y),y&&Y&4&&w5(N,M);break;case 22:M.memoizedState===null&&wl(N,M,y),Fp(M,M.return);break;case 30:break;default:wl(N,M,y)}m=m.sibling}}function W1(h,m){var y=null;h!==null&&h.memoizedState!==null&&h.memoizedState.cachePool!==null&&(y=h.memoizedState.cachePool.pool),h=null,m.memoizedState!==null&&m.memoizedState.cachePool!==null&&(h=m.memoizedState.cachePool.pool),h!==y&&(h!=null&&h.refCount++,y!=null&&Np(y))}function q1(h,m){h=null,m.alternate!==null&&(h=m.alternate.memoizedState.cache),m=m.memoizedState.cache,m!==h&&(m.refCount++,h!=null&&Np(h))}function $a(h,m,y,k){if(m.subtreeFlags&10256)for(m=m.child;m!==null;)j5(h,m,y,k),m=m.sibling}function j5(h,m,y,k){var N=m.flags;switch(m.tag){case 0:case 11:case 15:$a(h,m,y,k),N&2048&&$p(9,m);break;case 1:$a(h,m,y,k);break;case 3:$a(h,m,y,k),N&2048&&(h=null,m.alternate!==null&&(h=m.alternate.memoizedState.cache),m=m.memoizedState.cache,m!==h&&(m.refCount++,h!=null&&Np(h)));break;case 12:if(N&2048){$a(h,m,y,k),h=m.stateNode;try{var M=m.memoizedProps,Y=M.id,ee=M.onPostCommit;typeof ee=="function"&&ee(Y,m.alternate===null?"mount":"update",h.passiveEffectDuration,-0)}catch(ce){zn(m,m.return,ce)}}else $a(h,m,y,k);break;case 31:$a(h,m,y,k);break;case 13:$a(h,m,y,k);break;case 23:break;case 22:M=m.stateNode,Y=m.alternate,m.memoizedState!==null?M._visibility&2?$a(h,m,y,k):Hp(h,m):M._visibility&2?$a(h,m,y,k):(M._visibility|=2,gh(h,m,y,k,(m.subtreeFlags&10256)!==0||!1)),N&2048&&W1(Y,m);break;case 24:$a(h,m,y,k),N&2048&&q1(m.alternate,m);break;default:$a(h,m,y,k)}}function gh(h,m,y,k,N){for(N=N&&((m.subtreeFlags&10256)!==0||!1),m=m.child;m!==null;){var M=h,Y=m,ee=y,ce=k,we=Y.flags;switch(Y.tag){case 0:case 11:case 15:gh(M,Y,ee,ce,N),$p(8,Y);break;case 23:break;case 22:var De=Y.stateNode;Y.memoizedState!==null?De._visibility&2?gh(M,Y,ee,ce,N):Hp(M,Y):(De._visibility|=2,gh(M,Y,ee,ce,N)),N&&we&2048&&W1(Y.alternate,Y);break;case 24:gh(M,Y,ee,ce,N),N&&we&2048&&q1(Y.alternate,Y);break;default:gh(M,Y,ee,ce,N)}m=m.sibling}}function Hp(h,m){if(m.subtreeFlags&10256)for(m=m.child;m!==null;){var y=h,k=m,N=k.flags;switch(k.tag){case 22:Hp(y,k),N&2048&&W1(k.alternate,k);break;case 24:Hp(y,k),N&2048&&q1(k.alternate,k);break;default:Hp(y,k)}m=m.sibling}}var Wp=8192;function vh(h,m,y){if(h.subtreeFlags&Wp)for(h=h.child;h!==null;)N5(h,m,y),h=h.sibling}function N5(h,m,y){switch(h.tag){case 26:vh(h,m,y),h.flags&Wp&&h.memoizedState!==null&&JG(y,za,h.memoizedState,h.memoizedProps);break;case 5:vh(h,m,y);break;case 3:case 4:var k=za;za=Vy(h.stateNode.containerInfo),vh(h,m,y),za=k;break;case 22:h.memoizedState===null&&(k=h.alternate,k!==null&&k.memoizedState!==null?(k=Wp,Wp=16777216,vh(h,m,y),Wp=k):vh(h,m,y));break;default:vh(h,m,y)}}function E5(h){var m=h.alternate;if(m!==null&&(h=m.child,h!==null)){m.child=null;do m=h.sibling,h.sibling=null,h=m;while(h!==null)}}function qp(h){var m=h.deletions;if((h.flags&16)!==0){if(m!==null)for(var y=0;y<m.length;y++){var k=m[y];ci=k,T5(k,h)}E5(h)}if(h.subtreeFlags&10256)for(h=h.child;h!==null;)A5(h),h=h.sibling}function A5(h){switch(h.tag){case 0:case 11:case 15:qp(h),h.flags&2048&&yc(9,h,h.return);break;case 3:qp(h);break;case 12:qp(h);break;case 22:var m=h.stateNode;h.memoizedState!==null&&m._visibility&2&&(h.return===null||h.return.tag!==13)?(m._visibility&=-3,Dy(h)):qp(h);break;default:qp(h)}}function Dy(h){var m=h.deletions;if((h.flags&16)!==0){if(m!==null)for(var y=0;y<m.length;y++){var k=m[y];ci=k,T5(k,h)}E5(h)}for(h=h.child;h!==null;){switch(m=h,m.tag){case 0:case 11:case 15:yc(8,m,m.return),Dy(m);break;case 22:y=m.stateNode,y._visibility&2&&(y._visibility&=-3,Dy(m));break;default:Dy(m)}h=h.sibling}}function T5(h,m){for(;ci!==null;){var y=ci;switch(y.tag){case 0:case 11:case 15:yc(8,y,m);break;case 23:case 22:if(y.memoizedState!==null&&y.memoizedState.cachePool!==null){var k=y.memoizedState.cachePool.pool;k!=null&&k.refCount++}break;case 24:Np(y.memoizedState.cache)}if(k=y.child,k!==null)k.return=y,ci=k;else e:for(y=h;ci!==null;){k=ci;var N=k.sibling,M=k.return;if(x5(k),k===y){ci=null;break e}if(N!==null){N.return=M,ci=N;break e}ci=M}}}var pG={getCacheForType:function(h){var m=Si(Hr),y=m.data.get(h);return y===void 0&&(y=h(),m.data.set(h,y)),y},cacheSignal:function(){return Si(Hr).controller.signal}},mG=typeof WeakMap=="function"?WeakMap:Map,On=0,Xn=null,un=null,fn=0,Bn=0,Ws=null,_c=!1,yh=!1,U1=!1,Sl=0,Ar=0,xc=0,Ku=0,K1=0,qs=0,_h=0,Up=null,vs=null,V1=!1,Py=0,M5=0,Ly=1/0,Iy=null,bc=null,ei=0,kc=null,xh=null,Cl=0,Y1=0,G1=null,R5=null,Kp=0,X1=null;function Us(){return(On&2)!==0&&fn!==0?fn&-fn:I.T!==null?nw():xi()}function O5(){if(qs===0)if((fn&536870912)===0||gn){var h=it;it<<=1,(it&3932160)===0&&(it=262144),qs=h}else qs=536870912;return h=Fs.current,h!==null&&(h.flags|=32),qs}function ys(h,m,y){(h===Xn&&(Bn===2||Bn===9)||h.cancelPendingCommit!==null)&&(bh(h,0),wc(h,fn,qs,!1)),ge(h,y),((On&2)===0||h!==Xn)&&(h===Xn&&((On&2)===0&&(Ku|=y),Ar===4&&wc(h,fn,qs,!1)),ko(h))}function D5(h,m,y){if((On&6)!==0)throw Error(i(327));var k=!y&&(m&127)===0&&(m&h.expiredLanes)===0||Ht(h,m),N=k?yG(h,m):Z1(h,m,!0),M=k;do{if(N===0){yh&&!k&&wc(h,m,0,!1);break}else{if(y=h.current.alternate,M&&!gG(y)){N=Z1(h,m,!1),M=!1;continue}if(N===2){if(M=m,h.errorRecoveryDisabledLanes&M)var Y=0;else Y=h.pendingLanes&-536870913,Y=Y!==0?Y:Y&536870912?536870912:0;if(Y!==0){m=Y;e:{var ee=h;N=Up;var ce=ee.current.memoizedState.isDehydrated;if(ce&&(bh(ee,Y).flags|=256),Y=Z1(ee,Y,!1),Y!==2){if(U1&&!ce){ee.errorRecoveryDisabledLanes|=M,Ku|=M,N=4;break e}M=vs,vs=N,M!==null&&(vs===null?vs=M:vs.push.apply(vs,M))}N=Y}if(M=!1,N!==2)continue}}if(N===1){bh(h,0),wc(h,m,0,!0);break}e:{switch(k=h,M=N,M){case 0:case 1:throw Error(i(345));case 4:if((m&4194048)!==m)break;case 6:wc(k,m,qs,!_c);break e;case 2:vs=null;break;case 3:case 5:break;default:throw Error(i(329))}if((m&62914560)===m&&(N=Py+300-yt(),10<N)){if(wc(k,m,qs,!_c),jt(k,0,!0)!==0)break e;Cl=m,k.timeoutHandle=d3(P5.bind(null,k,y,vs,Iy,V1,m,qs,Ku,_h,_c,M,"Throttled",-0,0),N);break e}P5(k,y,vs,Iy,V1,m,qs,Ku,_h,_c,M,null,-0,0)}}break}while(!0);ko(h)}function P5(h,m,y,k,N,M,Y,ee,ce,we,De,$e,je,Ae){if(h.timeoutHandle=-1,$e=m.subtreeFlags,$e&8192||($e&16785408)===16785408){$e={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:ca},N5(m,M,$e);var _t=(M&62914560)===M?Py-yt():(M&4194048)===M?M5-yt():0;if(_t=eX($e,_t),_t!==null){Cl=M,h.cancelPendingCommit=_t(W5.bind(null,h,m,M,y,k,N,Y,ee,ce,De,$e,null,je,Ae)),wc(h,M,Y,!we);return}}W5(h,m,M,y,k,N,Y,ee,ce)}function gG(h){for(var m=h;;){var y=m.tag;if((y===0||y===11||y===15)&&m.flags&16384&&(y=m.updateQueue,y!==null&&(y=y.stores,y!==null)))for(var k=0;k<y.length;k++){var N=y[k],M=N.getSnapshot;N=N.value;try{if(!zs(M(),N))return!1}catch{return!1}}if(y=m.child,m.subtreeFlags&16384&&y!==null)y.return=m,m=y;else{if(m===h)break;for(;m.sibling===null;){if(m.return===null||m.return===h)return!0;m=m.return}m.sibling.return=m.return,m=m.sibling}}return!0}function wc(h,m,y,k){m&=~K1,m&=~Ku,h.suspendedLanes|=m,h.pingedLanes&=~m,k&&(h.warmLanes|=m),k=h.expirationTimes;for(var N=m;0<N;){var M=31-Mt(N),Y=1<<M;k[M]=-1,N&=~Y}y!==0&&et(h,y,m)}function By(){return(On&6)===0?(Vp(0),!1):!0}function Q1(){if(un!==null){if(Bn===0)var h=un.return;else h=un,pl=Iu=null,f1(h),dh=null,Ap=0,h=un;for(;h!==null;)h5(h.alternate,h),h=h.return;un=null}}function bh(h,m){var y=h.timeoutHandle;y!==-1&&(h.timeoutHandle=-1,LG(y)),y=h.cancelPendingCommit,y!==null&&(h.cancelPendingCommit=null,y()),Cl=0,Q1(),Xn=h,un=y=hl(h.current,null),fn=m,Bn=0,Ws=null,_c=!1,yh=Ht(h,m),U1=!1,_h=qs=K1=Ku=xc=Ar=0,vs=Up=null,V1=!1,(m&8)!==0&&(m|=m&32);var k=h.entangledLanes;if(k!==0)for(h=h.entanglements,k&=m;0<k;){var N=31-Mt(k),M=1<<N;m|=h[N],k&=~M}return Sl=m,sy(),y}function L5(h,m){Xt=null,I.H=Ip,m===uh||m===fy?(m=ZM(),Bn=3):m===t1?(m=ZM(),Bn=4):Bn=m===A1?8:m!==null&&typeof m=="object"&&typeof m.then=="function"?6:1,Ws=m,un===null&&(Ar=1,Ny(h,da(m,h.current)))}function I5(){var h=Fs.current;return h===null?!0:(fn&4194048)===fn?ma===null:(fn&62914560)===fn||(fn&536870912)!==0?h===ma:!1}function B5(){var h=I.H;return I.H=Ip,h===null?Ip:h}function z5(){var h=I.A;return I.A=pG,h}function zy(){Ar=4,_c||(fn&4194048)!==fn&&Fs.current!==null||(yh=!0),(xc&134217727)===0&&(Ku&134217727)===0||Xn===null||wc(Xn,fn,qs,!1)}function Z1(h,m,y){var k=On;On|=2;var N=B5(),M=z5();(Xn!==h||fn!==m)&&(Iy=null,bh(h,m)),m=!1;var Y=Ar;e:do try{if(Bn!==0&&un!==null){var ee=un,ce=Ws;switch(Bn){case 8:Q1(),Y=6;break e;case 3:case 2:case 9:case 6:Fs.current===null&&(m=!0);var we=Bn;if(Bn=0,Ws=null,kh(h,ee,ce,we),y&&yh){Y=0;break e}break;default:we=Bn,Bn=0,Ws=null,kh(h,ee,ce,we)}}vG(),Y=Ar;break}catch(De){L5(h,De)}while(!0);return m&&h.shellSuspendCounter++,pl=Iu=null,On=k,I.H=N,I.A=M,un===null&&(Xn=null,fn=0,sy()),Y}function vG(){for(;un!==null;)$5(un)}function yG(h,m){var y=On;On|=2;var k=B5(),N=z5();Xn!==h||fn!==m?(Iy=null,Ly=yt()+500,bh(h,m)):yh=Ht(h,m);e:do try{if(Bn!==0&&un!==null){m=un;var M=Ws;t:switch(Bn){case 1:Bn=0,Ws=null,kh(h,m,M,1);break;case 2:case 9:if(XM(M)){Bn=0,Ws=null,F5(m);break}m=function(){Bn!==2&&Bn!==9||Xn!==h||(Bn=7),ko(h)},M.then(m,m);break e;case 3:Bn=7;break e;case 4:Bn=5;break e;case 7:XM(M)?(Bn=0,Ws=null,F5(m)):(Bn=0,Ws=null,kh(h,m,M,7));break;case 5:var Y=null;switch(un.tag){case 26:Y=un.memoizedState;case 5:case 27:var ee=un;if(Y?j3(Y):ee.stateNode.complete){Bn=0,Ws=null;var ce=ee.sibling;if(ce!==null)un=ce;else{var we=ee.return;we!==null?(un=we,$y(we)):un=null}break t}}Bn=0,Ws=null,kh(h,m,M,5);break;case 6:Bn=0,Ws=null,kh(h,m,M,6);break;case 8:Q1(),Ar=6;break e;default:throw Error(i(462))}}_G();break}catch(De){L5(h,De)}while(!0);return pl=Iu=null,I.H=k,I.A=N,On=y,un!==null?0:(Xn=null,fn=0,sy(),Ar)}function _G(){for(;un!==null&&!Xe();)$5(un)}function $5(h){var m=u5(h.alternate,h,Sl);h.memoizedProps=h.pendingProps,m===null?$y(h):un=m}function F5(h){var m=h,y=m.alternate;switch(m.tag){case 15:case 0:m=i5(y,m,m.pendingProps,m.type,void 0,fn);break;case 11:m=i5(y,m,m.pendingProps,m.type.render,m.ref,fn);break;case 5:f1(m);default:h5(y,m),m=un=zM(m,Sl),m=u5(y,m,Sl)}h.memoizedProps=h.pendingProps,m===null?$y(h):un=m}function kh(h,m,y,k){pl=Iu=null,f1(m),dh=null,Ap=0;var N=m.return;try{if(oG(h,N,m,y,fn)){Ar=1,Ny(h,da(y,h.current)),un=null;return}}catch(M){if(N!==null)throw un=N,M;Ar=1,Ny(h,da(y,h.current)),un=null;return}m.flags&32768?(gn||k===1?h=!0:yh||(fn&536870912)!==0?h=!1:(_c=h=!0,(k===2||k===9||k===3||k===6)&&(k=Fs.current,k!==null&&k.tag===13&&(k.flags|=16384))),H5(m,h)):$y(m)}function $y(h){var m=h;do{if((m.flags&32768)!==0){H5(m,_c);return}h=m.return;var y=uG(m.alternate,m,Sl);if(y!==null){un=y;return}if(m=m.sibling,m!==null){un=m;return}un=m=h}while(m!==null);Ar===0&&(Ar=5)}function H5(h,m){do{var y=dG(h.alternate,h);if(y!==null){y.flags&=32767,un=y;return}if(y=h.return,y!==null&&(y.flags|=32768,y.subtreeFlags=0,y.deletions=null),!m&&(h=h.sibling,h!==null)){un=h;return}un=h=y}while(h!==null);Ar=6,un=null}function W5(h,m,y,k,N,M,Y,ee,ce){h.cancelPendingCommit=null;do Fy();while(ei!==0);if((On&6)!==0)throw Error(i(327));if(m!==null){if(m===h.current)throw Error(i(177));if(M=m.lanes|m.childLanes,M|=$k,Re(h,y,M,Y,ee,ce),h===Xn&&(un=Xn=null,fn=0),xh=m,kc=h,Cl=y,Y1=M,G1=N,R5=k,(m.subtreeFlags&10256)!==0||(m.flags&10256)!==0?(h.callbackNode=null,h.callbackPriority=0,wG(ht,function(){return Y5(),null})):(h.callbackNode=null,h.callbackPriority=0),k=(m.flags&13878)!==0,(m.subtreeFlags&13878)!==0||k){k=I.T,I.T=null,N=X.p,X.p=2,Y=On,On|=4;try{hG(h,m,y)}finally{On=Y,X.p=N,I.T=k}}ei=1,q5(),U5(),K5()}}function q5(){if(ei===1){ei=0;var h=kc,m=xh,y=(m.flags&13878)!==0;if((m.subtreeFlags&13878)!==0||y){y=I.T,I.T=null;var k=X.p;X.p=2;var N=On;On|=4;try{S5(m,h);var M=uw,Y=TM(h.containerInfo),ee=M.focusedElem,ce=M.selectionRange;if(Y!==ee&&ee&&ee.ownerDocument&&AM(ee.ownerDocument.documentElement,ee)){if(ce!==null&&Pk(ee)){var we=ce.start,De=ce.end;if(De===void 0&&(De=we),"selectionStart"in ee)ee.selectionStart=we,ee.selectionEnd=Math.min(De,ee.value.length);else{var $e=ee.ownerDocument||document,je=$e&&$e.defaultView||window;if(je.getSelection){var Ae=je.getSelection(),_t=ee.textContent.length,zt=Math.min(ce.start,_t),Wn=ce.end===void 0?zt:Math.min(ce.end,_t);!Ae.extend&&zt>Wn&&(Y=Wn,Wn=zt,zt=Y);var xe=EM(ee,zt),me=EM(ee,Wn);if(xe&&me&&(Ae.rangeCount!==1||Ae.anchorNode!==xe.node||Ae.anchorOffset!==xe.offset||Ae.focusNode!==me.node||Ae.focusOffset!==me.offset)){var ke=$e.createRange();ke.setStart(xe.node,xe.offset),Ae.removeAllRanges(),zt>Wn?(Ae.addRange(ke),Ae.extend(me.node,me.offset)):(ke.setEnd(me.node,me.offset),Ae.addRange(ke))}}}}for($e=[],Ae=ee;Ae=Ae.parentNode;)Ae.nodeType===1&&$e.push({element:Ae,left:Ae.scrollLeft,top:Ae.scrollTop});for(typeof ee.focus=="function"&&ee.focus(),ee=0;ee<$e.length;ee++){var ze=$e[ee];ze.element.scrollLeft=ze.left,ze.element.scrollTop=ze.top}}Jy=!!cw,uw=cw=null}finally{On=N,X.p=k,I.T=y}}h.current=m,ei=2}}function U5(){if(ei===2){ei=0;var h=kc,m=xh,y=(m.flags&8772)!==0;if((m.subtreeFlags&8772)!==0||y){y=I.T,I.T=null;var k=X.p;X.p=2;var N=On;On|=4;try{_5(h,m.alternate,m)}finally{On=N,X.p=k,I.T=y}}ei=3}}function K5(){if(ei===4||ei===3){ei=0,St();var h=kc,m=xh,y=Cl,k=R5;(m.subtreeFlags&10256)!==0||(m.flags&10256)!==0?ei=5:(ei=0,xh=kc=null,V5(h,h.pendingLanes));var N=h.pendingLanes;if(N===0&&(bc=null),ir(y),m=m.stateNode,ut&&typeof ut.onCommitFiberRoot=="function")try{ut.onCommitFiberRoot(We,m,void 0,(m.current.flags&128)===128)}catch{}if(k!==null){m=I.T,N=X.p,X.p=2,I.T=null;try{for(var M=h.onRecoverableError,Y=0;Y<k.length;Y++){var ee=k[Y];M(ee.value,{componentStack:ee.stack})}}finally{I.T=m,X.p=N}}(Cl&3)!==0&&Fy(),ko(h),N=h.pendingLanes,(y&261930)!==0&&(N&42)!==0?h===X1?Kp++:(Kp=0,X1=h):Kp=0,Vp(0)}}function V5(h,m){(h.pooledCacheLanes&=m)===0&&(m=h.pooledCache,m!=null&&(h.pooledCache=null,Np(m)))}function Fy(){return q5(),U5(),K5(),Y5()}function Y5(){if(ei!==5)return!1;var h=kc,m=Y1;Y1=0;var y=ir(Cl),k=I.T,N=X.p;try{X.p=32>y?32:y,I.T=null,y=G1,G1=null;var M=kc,Y=Cl;if(ei=0,xh=kc=null,Cl=0,(On&6)!==0)throw Error(i(331));var ee=On;if(On|=4,A5(M.current),j5(M,M.current,Y,y),On=ee,Vp(0,!1),ut&&typeof ut.onPostCommitFiberRoot=="function")try{ut.onPostCommitFiberRoot(We,M)}catch{}return!0}finally{X.p=N,I.T=k,V5(h,m)}}function G5(h,m,y){m=da(y,m),m=E1(h.stateNode,m,2),h=mc(h,m,2),h!==null&&(ge(h,2),ko(h))}function zn(h,m,y){if(h.tag===3)G5(h,h,y);else for(;m!==null;){if(m.tag===3){G5(m,h,y);break}else if(m.tag===1){var k=m.stateNode;if(typeof m.type.getDerivedStateFromError=="function"||typeof k.componentDidCatch=="function"&&(bc===null||!bc.has(k))){h=da(y,h),y=XR(2),k=mc(m,y,2),k!==null&&(QR(y,k,m,h),ge(k,2),ko(k));break}}m=m.return}}function J1(h,m,y){var k=h.pingCache;if(k===null){k=h.pingCache=new mG;var N=new Set;k.set(m,N)}else N=k.get(m),N===void 0&&(N=new Set,k.set(m,N));N.has(y)||(U1=!0,N.add(y),h=xG.bind(null,h,m,y),m.then(h,h))}function xG(h,m,y){var k=h.pingCache;k!==null&&k.delete(m),h.pingedLanes|=h.suspendedLanes&y,h.warmLanes&=~y,Xn===h&&(fn&y)===y&&(Ar===4||Ar===3&&(fn&62914560)===fn&&300>yt()-Py?(On&2)===0&&bh(h,0):K1|=y,_h===fn&&(_h=0)),ko(h)}function X5(h,m){m===0&&(m=Wt()),h=Du(h,m),h!==null&&(ge(h,m),ko(h))}function bG(h){var m=h.memoizedState,y=0;m!==null&&(y=m.retryLane),X5(h,y)}function kG(h,m){var y=0;switch(h.tag){case 31:case 13:var k=h.stateNode,N=h.memoizedState;N!==null&&(y=N.retryLane);break;case 19:k=h.stateNode;break;case 22:k=h.stateNode._retryCache;break;default:throw Error(i(314))}k!==null&&k.delete(m),X5(h,y)}function wG(h,m){return Ee(h,m)}var Hy=null,wh=null,ew=!1,Wy=!1,tw=!1,Sc=0;function ko(h){h!==wh&&h.next===null&&(wh===null?Hy=wh=h:wh=wh.next=h),Wy=!0,ew||(ew=!0,CG())}function Vp(h,m){if(!tw&&Wy){tw=!0;do for(var y=!1,k=Hy;k!==null;){if(h!==0){var N=k.pendingLanes;if(N===0)var M=0;else{var Y=k.suspendedLanes,ee=k.pingedLanes;M=(1<<31-Mt(42|h)+1)-1,M&=N&~(Y&~ee),M=M&201326741?M&201326741|1:M?M|2:0}M!==0&&(y=!0,e3(k,M))}else M=fn,M=jt(k,k===Xn?M:0,k.cancelPendingCommit!==null||k.timeoutHandle!==-1),(M&3)===0||Ht(k,M)||(y=!0,e3(k,M));k=k.next}while(y);tw=!1}}function SG(){Q5()}function Q5(){Wy=ew=!1;var h=0;Sc!==0&&PG()&&(h=Sc);for(var m=yt(),y=null,k=Hy;k!==null;){var N=k.next,M=Z5(k,m);M===0?(k.next=null,y===null?Hy=N:y.next=N,N===null&&(wh=y)):(y=k,(h!==0||(M&3)!==0)&&(Wy=!0)),k=N}ei!==0&&ei!==5||Vp(h),Sc!==0&&(Sc=0)}function Z5(h,m){for(var y=h.suspendedLanes,k=h.pingedLanes,N=h.expirationTimes,M=h.pendingLanes&-62914561;0<M;){var Y=31-Mt(M),ee=1<<Y,ce=N[Y];ce===-1?((ee&y)===0||(ee&k)!==0)&&(N[Y]=rr(ee,m)):ce<=m&&(h.expiredLanes|=ee),M&=~ee}if(m=Xn,y=fn,y=jt(h,h===m?y:0,h.cancelPendingCommit!==null||h.timeoutHandle!==-1),k=h.callbackNode,y===0||h===m&&(Bn===2||Bn===9)||h.cancelPendingCommit!==null)return k!==null&&k!==null&&Bt(k),h.callbackNode=null,h.callbackPriority=0;if((y&3)===0||Ht(h,y)){if(m=y&-y,m===h.callbackPriority)return m;switch(k!==null&&Bt(k),ir(y)){case 2:case 8:y=He;break;case 32:y=ht;break;case 268435456:y=$t;break;default:y=ht}return k=J5.bind(null,h),y=Ee(y,k),h.callbackPriority=m,h.callbackNode=y,m}return k!==null&&k!==null&&Bt(k),h.callbackPriority=2,h.callbackNode=null,2}function J5(h,m){if(ei!==0&&ei!==5)return h.callbackNode=null,h.callbackPriority=0,null;var y=h.callbackNode;if(Fy()&&h.callbackNode!==y)return null;var k=fn;return k=jt(h,h===Xn?k:0,h.cancelPendingCommit!==null||h.timeoutHandle!==-1),k===0?null:(D5(h,k,m),Z5(h,yt()),h.callbackNode!=null&&h.callbackNode===y?J5.bind(null,h):null)}function e3(h,m){if(Fy())return null;D5(h,m,!0)}function CG(){IG(function(){(On&6)!==0?Ee(be,SG):Q5()})}function nw(){if(Sc===0){var h=lh;h===0&&(h=Nt,Nt<<=1,(Nt&261888)===0&&(Nt=256)),Sc=h}return Sc}function t3(h){return h==null||typeof h=="symbol"||typeof h=="boolean"?null:typeof h=="function"?h:Qd(""+h)}function n3(h,m){var y=m.ownerDocument.createElement("input");return y.name=m.name,y.value=m.value,h.id&&y.setAttribute("form",h.id),m.parentNode.insertBefore(y,m),h=new FormData(h),y.parentNode.removeChild(y),h}function jG(h,m,y,k,N){if(m==="submit"&&y&&y.stateNode===N){var M=t3((N[Ie]||null).action),Y=k.submitter;Y&&(m=(m=Y[Ie]||null)?t3(m.formAction):Y.getAttribute("formAction"),m!==null&&(M=m,Y=null));var ee=new Gn("action","action",null,k,N);h.push({event:ee,listeners:[{instance:null,listener:function(){if(k.defaultPrevented){if(Sc!==0){var ce=Y?n3(N,Y):new FormData(N);k1(y,{pending:!0,data:ce,method:N.method,action:M},null,ce)}}else typeof M=="function"&&(ee.preventDefault(),ce=Y?n3(N,Y):new FormData(N),k1(y,{pending:!0,data:ce,method:N.method,action:M},M,ce))},currentTarget:N}]})}}for(var rw=0;rw<zk.length;rw++){var iw=zk[rw],NG=iw.toLowerCase(),EG=iw[0].toUpperCase()+iw.slice(1);Ba(NG,"on"+EG)}Ba(OM,"onAnimationEnd"),Ba(DM,"onAnimationIteration"),Ba(PM,"onAnimationStart"),Ba("dblclick","onDoubleClick"),Ba("focusin","onFocus"),Ba("focusout","onBlur"),Ba(qY,"onTransitionRun"),Ba(UY,"onTransitionStart"),Ba(KY,"onTransitionCancel"),Ba(LM,"onTransitionEnd"),la("onMouseEnter",["mouseout","mouseover"]),la("onMouseLeave",["mouseout","mouseover"]),la("onPointerEnter",["pointerout","pointerover"]),la("onPointerLeave",["pointerout","pointerover"]),Ls("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Ls("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Ls("onBeforeInput",["compositionend","keypress","textInput","paste"]),Ls("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Ls("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Ls("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Yp="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),AG=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Yp));function r3(h,m){m=(m&4)!==0;for(var y=0;y<h.length;y++){var k=h[y],N=k.event;k=k.listeners;e:{var M=void 0;if(m)for(var Y=k.length-1;0<=Y;Y--){var ee=k[Y],ce=ee.instance,we=ee.currentTarget;if(ee=ee.listener,ce!==M&&N.isPropagationStopped())break e;M=ee,N.currentTarget=we;try{M(N)}catch(De){iy(De)}N.currentTarget=null,M=ce}else for(Y=0;Y<k.length;Y++){if(ee=k[Y],ce=ee.instance,we=ee.currentTarget,ee=ee.listener,ce!==M&&N.isPropagationStopped())break e;M=ee,N.currentTarget=we;try{M(N)}catch(De){iy(De)}N.currentTarget=null,M=ce}}}}function dn(h,m){var y=m[Kt];y===void 0&&(y=m[Kt]=new Set);var k=h+"__bubble";y.has(k)||(i3(m,h,2,!1),y.add(k))}function sw(h,m,y){var k=0;m&&(k|=4),i3(y,h,k,m)}var qy="_reactListening"+Math.random().toString(36).slice(2);function aw(h){if(!h[qy]){h[qy]=!0,cl.forEach(function(y){y!=="selectionchange"&&(AG.has(y)||sw(y,!1,h),sw(y,!0,h))});var m=h.nodeType===9?h:h.ownerDocument;m===null||m[qy]||(m[qy]=!0,sw("selectionchange",!1,m))}}function i3(h,m,y,k){switch(O3(m)){case 2:var N=rX;break;case 8:N=iX;break;default:N=bw}y=N.bind(null,m,y,h),N=void 0,!Qe||m!=="touchstart"&&m!=="touchmove"&&m!=="wheel"||(N=!0),k?N!==void 0?h.addEventListener(m,y,{capture:!0,passive:N}):h.addEventListener(m,y,!0):N!==void 0?h.addEventListener(m,y,{passive:N}):h.addEventListener(m,y,!1)}function ow(h,m,y,k,N){var M=k;if((m&1)===0&&(m&2)===0&&k!==null)e:for(;;){if(k===null)return;var Y=k.tag;if(Y===3||Y===4){var ee=k.stateNode.containerInfo;if(ee===N)break;if(Y===4)for(Y=k.return;Y!==null;){var ce=Y.tag;if((ce===3||ce===4)&&Y.stateNode.containerInfo===N)return;Y=Y.return}for(;ee!==null;){if(Y=fs(ee),Y===null)return;if(ce=Y.tag,ce===5||ce===6||ce===26||ce===27){k=M=Y;continue e}ee=ee.parentNode}}k=k.return}Ne(function(){var we=M,De=Zd(y),$e=[];e:{var je=IM.get(h);if(je!==void 0){var Ae=Gn,_t=h;switch(h){case"keypress":if(xn(y)===0)break e;case"keydown":case"keyup":Ae=kY;break;case"focusin":_t="focus",Ae=Tk;break;case"focusout":_t="blur",Ae=Tk;break;case"beforeblur":case"afterblur":Ae=Tk;break;case"click":if(y.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":Ae=hM;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":Ae=uY;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":Ae=CY;break;case OM:case DM:case PM:Ae=fY;break;case LM:Ae=NY;break;case"scroll":case"scrollend":Ae=vo;break;case"wheel":Ae=AY;break;case"copy":case"cut":case"paste":Ae=mY;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":Ae=pM;break;case"toggle":case"beforetoggle":Ae=MY}var zt=(m&4)!==0,Wn=!zt&&(h==="scroll"||h==="scrollend"),xe=zt?je!==null?je+"Capture":null:je;zt=[];for(var me=we,ke;me!==null;){var ze=me;if(ke=ze.stateNode,ze=ze.tag,ze!==5&&ze!==26&&ze!==27||ke===null||xe===null||(ze=Me(me,xe),ze!=null&&zt.push(Gp(me,ze,ke))),Wn)break;me=me.return}0<zt.length&&(je=new Ae(je,_t,null,y,De),$e.push({event:je,listeners:zt}))}}if((m&7)===0){e:{if(je=h==="mouseover"||h==="pointerover",Ae=h==="mouseout"||h==="pointerout",je&&y!==_p&&(_t=y.relatedTarget||y.fromElement)&&(fs(_t)||_t[st]))break e;if((Ae||je)&&(je=De.window===De?De:(je=De.ownerDocument)?je.defaultView||je.parentWindow:window,Ae?(_t=y.relatedTarget||y.toElement,Ae=we,_t=_t?fs(_t):null,_t!==null&&(Wn=a(_t),zt=_t.tag,_t!==Wn||zt!==5&&zt!==27&&zt!==6)&&(_t=null)):(Ae=null,_t=we),Ae!==_t)){if(zt=hM,ze="onMouseLeave",xe="onMouseEnter",me="mouse",(h==="pointerout"||h==="pointerover")&&(zt=pM,ze="onPointerLeave",xe="onPointerEnter",me="pointer"),Wn=Ae==null?je:Qi(Ae),ke=_t==null?je:Qi(_t),je=new zt(ze,me+"leave",Ae,y,De),je.target=Wn,je.relatedTarget=ke,ze=null,fs(De)===we&&(zt=new zt(xe,me+"enter",_t,y,De),zt.target=ke,zt.relatedTarget=Wn,ze=zt),Wn=ze,Ae&&_t)t:{for(zt=TG,xe=Ae,me=_t,ke=0,ze=xe;ze;ze=zt(ze))ke++;ze=0;for(var Tt=me;Tt;Tt=zt(Tt))ze++;for(;0<ke-ze;)xe=zt(xe),ke--;for(;0<ze-ke;)me=zt(me),ze--;for(;ke--;){if(xe===me||me!==null&&xe===me.alternate){zt=xe;break t}xe=zt(xe),me=zt(me)}zt=null}else zt=null;Ae!==null&&s3($e,je,Ae,zt,!1),_t!==null&&Wn!==null&&s3($e,Wn,_t,zt,!0)}}e:{if(je=we?Qi(we):window,Ae=je.nodeName&&je.nodeName.toLowerCase(),Ae==="select"||Ae==="input"&&je.type==="file")var En=kM;else if(xM(je))if(wM)En=FY;else{En=zY;var kt=BY}else Ae=je.nodeName,!Ae||Ae.toLowerCase()!=="input"||je.type!=="checkbox"&&je.type!=="radio"?we&&yp(we.elementType)&&(En=kM):En=$Y;if(En&&(En=En(h,we))){bM($e,En,y,De);break e}kt&&kt(h,je,we),h==="focusout"&&we&&je.type==="number"&&we.memoizedProps.value!=null&&Li(je,"number",je.value)}switch(kt=we?Qi(we):window,h){case"focusin":(xM(kt)||kt.contentEditable==="true")&&(eh=kt,Lk=we,Sp=null);break;case"focusout":Sp=Lk=eh=null;break;case"mousedown":Ik=!0;break;case"contextmenu":case"mouseup":case"dragend":Ik=!1,MM($e,y,De);break;case"selectionchange":if(WY)break;case"keydown":case"keyup":MM($e,y,De)}var Qt;if(Rk)e:{switch(h){case"compositionstart":var pn="onCompositionStart";break e;case"compositionend":pn="onCompositionEnd";break e;case"compositionupdate":pn="onCompositionUpdate";break e}pn=void 0}else Jd?yM(h,y)&&(pn="onCompositionEnd"):h==="keydown"&&y.keyCode===229&&(pn="onCompositionStart");pn&&(mM&&y.locale!=="ko"&&(Jd||pn!=="onCompositionStart"?pn==="onCompositionEnd"&&Jd&&(Qt=Dt()):(ln=De,Nn="value"in ln?ln.value:ln.textContent,Jd=!0)),kt=Uy(we,pn),0<kt.length&&(pn=new fM(pn,h,null,y,De),$e.push({event:pn,listeners:kt}),Qt?pn.data=Qt:(Qt=_M(y),Qt!==null&&(pn.data=Qt)))),(Qt=OY?DY(h,y):PY(h,y))&&(pn=Uy(we,"onBeforeInput"),0<pn.length&&(kt=new fM("onBeforeInput","beforeinput",null,y,De),$e.push({event:kt,listeners:pn}),kt.data=Qt)),jG($e,h,we,y,De)}r3($e,m)})}function Gp(h,m,y){return{instance:h,listener:m,currentTarget:y}}function Uy(h,m){for(var y=m+"Capture",k=[];h!==null;){var N=h,M=N.stateNode;if(N=N.tag,N!==5&&N!==26&&N!==27||M===null||(N=Me(h,y),N!=null&&k.unshift(Gp(h,N,M)),N=Me(h,m),N!=null&&k.push(Gp(h,N,M))),h.tag===3)return k;h=h.return}return[]}function TG(h){if(h===null)return null;do h=h.return;while(h&&h.tag!==5&&h.tag!==27);return h||null}function s3(h,m,y,k,N){for(var M=m._reactName,Y=[];y!==null&&y!==k;){var ee=y,ce=ee.alternate,we=ee.stateNode;if(ee=ee.tag,ce!==null&&ce===k)break;ee!==5&&ee!==26&&ee!==27||we===null||(ce=we,N?(we=Me(y,M),we!=null&&Y.unshift(Gp(y,we,ce))):N||(we=Me(y,M),we!=null&&Y.push(Gp(y,we,ce)))),y=y.return}Y.length!==0&&h.push({event:m,listeners:Y})}var MG=/\r\n?/g,RG=/\u0000|\uFFFD/g;function a3(h){return(typeof h=="string"?h:""+h).replace(MG,`
`).replace(RG,"")}function o3(h,m){return m=a3(m),a3(h)===m}function Hn(h,m,y,k,N,M){switch(y){case"children":typeof k=="string"?m==="body"||m==="textarea"&&k===""||mo(h,k):(typeof k=="number"||typeof k=="bigint")&&m!=="body"&&mo(h,""+k);break;case"className":Bs(h,"class",k);break;case"tabIndex":Bs(h,"tabindex",k);break;case"dir":case"role":case"viewBox":case"width":case"height":Bs(h,y,k);break;case"style":ty(h,k,M);break;case"data":if(m!=="object"){Bs(h,"data",k);break}case"src":case"href":if(k===""&&(m!=="a"||y!=="href")){h.removeAttribute(y);break}if(k==null||typeof k=="function"||typeof k=="symbol"||typeof k=="boolean"){h.removeAttribute(y);break}k=Qd(""+k),h.setAttribute(y,k);break;case"action":case"formAction":if(typeof k=="function"){h.setAttribute(y,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof M=="function"&&(y==="formAction"?(m!=="input"&&Hn(h,m,"name",N.name,N,null),Hn(h,m,"formEncType",N.formEncType,N,null),Hn(h,m,"formMethod",N.formMethod,N,null),Hn(h,m,"formTarget",N.formTarget,N,null)):(Hn(h,m,"encType",N.encType,N,null),Hn(h,m,"method",N.method,N,null),Hn(h,m,"target",N.target,N,null)));if(k==null||typeof k=="symbol"||typeof k=="boolean"){h.removeAttribute(y);break}k=Qd(""+k),h.setAttribute(y,k);break;case"onClick":k!=null&&(h.onclick=ca);break;case"onScroll":k!=null&&dn("scroll",h);break;case"onScrollEnd":k!=null&&dn("scrollend",h);break;case"dangerouslySetInnerHTML":if(k!=null){if(typeof k!="object"||!("__html"in k))throw Error(i(61));if(y=k.__html,y!=null){if(N.children!=null)throw Error(i(60));h.innerHTML=y}}break;case"multiple":h.multiple=k&&typeof k!="function"&&typeof k!="symbol";break;case"muted":h.muted=k&&typeof k!="function"&&typeof k!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(k==null||typeof k=="function"||typeof k=="boolean"||typeof k=="symbol"){h.removeAttribute("xlink:href");break}y=Qd(""+k),h.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",y);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":k!=null&&typeof k!="function"&&typeof k!="symbol"?h.setAttribute(y,""+k):h.removeAttribute(y);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":k&&typeof k!="function"&&typeof k!="symbol"?h.setAttribute(y,""):h.removeAttribute(y);break;case"capture":case"download":k===!0?h.setAttribute(y,""):k!==!1&&k!=null&&typeof k!="function"&&typeof k!="symbol"?h.setAttribute(y,k):h.removeAttribute(y);break;case"cols":case"rows":case"size":case"span":k!=null&&typeof k!="function"&&typeof k!="symbol"&&!isNaN(k)&&1<=k?h.setAttribute(y,k):h.removeAttribute(y);break;case"rowSpan":case"start":k==null||typeof k=="function"||typeof k=="symbol"||isNaN(k)?h.removeAttribute(y):h.setAttribute(y,k);break;case"popover":dn("beforetoggle",h),dn("toggle",h),hr(h,"popover",k);break;case"xlinkActuate":Jr(h,"http://www.w3.org/1999/xlink","xlink:actuate",k);break;case"xlinkArcrole":Jr(h,"http://www.w3.org/1999/xlink","xlink:arcrole",k);break;case"xlinkRole":Jr(h,"http://www.w3.org/1999/xlink","xlink:role",k);break;case"xlinkShow":Jr(h,"http://www.w3.org/1999/xlink","xlink:show",k);break;case"xlinkTitle":Jr(h,"http://www.w3.org/1999/xlink","xlink:title",k);break;case"xlinkType":Jr(h,"http://www.w3.org/1999/xlink","xlink:type",k);break;case"xmlBase":Jr(h,"http://www.w3.org/XML/1998/namespace","xml:base",k);break;case"xmlLang":Jr(h,"http://www.w3.org/XML/1998/namespace","xml:lang",k);break;case"xmlSpace":Jr(h,"http://www.w3.org/XML/1998/namespace","xml:space",k);break;case"is":hr(h,"is",k);break;case"innerText":case"textContent":break;default:(!(2<y.length)||y[0]!=="o"&&y[0]!=="O"||y[1]!=="n"&&y[1]!=="N")&&(y=Ek.get(y)||y,hr(h,y,k))}}function lw(h,m,y,k,N,M){switch(y){case"style":ty(h,k,M);break;case"dangerouslySetInnerHTML":if(k!=null){if(typeof k!="object"||!("__html"in k))throw Error(i(61));if(y=k.__html,y!=null){if(N.children!=null)throw Error(i(60));h.innerHTML=y}}break;case"children":typeof k=="string"?mo(h,k):(typeof k=="number"||typeof k=="bigint")&&mo(h,""+k);break;case"onScroll":k!=null&&dn("scroll",h);break;case"onScrollEnd":k!=null&&dn("scrollend",h);break;case"onClick":k!=null&&(h.onclick=ca);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!lc.hasOwnProperty(y))e:{if(y[0]==="o"&&y[1]==="n"&&(N=y.endsWith("Capture"),m=y.slice(2,N?y.length-7:void 0),M=h[Ie]||null,M=M!=null?M[y]:null,typeof M=="function"&&h.removeEventListener(m,M,N),typeof k=="function")){typeof M!="function"&&M!==null&&(y in h?h[y]=null:h.hasAttribute(y)&&h.removeAttribute(y)),h.addEventListener(m,k,N);break e}y in h?h[y]=k:k===!0?h.setAttribute(y,""):hr(h,y,k)}}}function ji(h,m,y){switch(m){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":dn("error",h),dn("load",h);var k=!1,N=!1,M;for(M in y)if(y.hasOwnProperty(M)){var Y=y[M];if(Y!=null)switch(M){case"src":k=!0;break;case"srcSet":N=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(i(137,m));default:Hn(h,m,M,Y,y,null)}}N&&Hn(h,m,"srcSet",y.srcSet,y,null),k&&Hn(h,m,"src",y.src,y,null);return;case"input":dn("invalid",h);var ee=M=Y=N=null,ce=null,we=null;for(k in y)if(y.hasOwnProperty(k)){var De=y[k];if(De!=null)switch(k){case"name":N=De;break;case"type":Y=De;break;case"checked":ce=De;break;case"defaultChecked":we=De;break;case"value":M=De;break;case"defaultValue":ee=De;break;case"children":case"dangerouslySetInnerHTML":if(De!=null)throw Error(i(137,m));break;default:Hn(h,m,k,De,y,null)}}Yn(h,M,ee,ce,we,Y,N,!1);return;case"select":dn("invalid",h),k=Y=M=null;for(N in y)if(y.hasOwnProperty(N)&&(ee=y[N],ee!=null))switch(N){case"value":M=ee;break;case"defaultValue":Y=ee;break;case"multiple":k=ee;default:Hn(h,m,N,ee,y,null)}m=M,y=Y,h.multiple=!!k,m!=null?Ii(h,!!k,m,!1):y!=null&&Ii(h,!!k,y,!0);return;case"textarea":dn("invalid",h),M=N=k=null;for(Y in y)if(y.hasOwnProperty(Y)&&(ee=y[Y],ee!=null))switch(Y){case"value":k=ee;break;case"defaultValue":N=ee;break;case"children":M=ee;break;case"dangerouslySetInnerHTML":if(ee!=null)throw Error(i(91));break;default:Hn(h,m,Y,ee,y,null)}Xd(h,k,N,M);return;case"option":for(ce in y)if(y.hasOwnProperty(ce)&&(k=y[ce],k!=null))switch(ce){case"selected":h.selected=k&&typeof k!="function"&&typeof k!="symbol";break;default:Hn(h,m,ce,k,y,null)}return;case"dialog":dn("beforetoggle",h),dn("toggle",h),dn("cancel",h),dn("close",h);break;case"iframe":case"object":dn("load",h);break;case"video":case"audio":for(k=0;k<Yp.length;k++)dn(Yp[k],h);break;case"image":dn("error",h),dn("load",h);break;case"details":dn("toggle",h);break;case"embed":case"source":case"link":dn("error",h),dn("load",h);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(we in y)if(y.hasOwnProperty(we)&&(k=y[we],k!=null))switch(we){case"children":case"dangerouslySetInnerHTML":throw Error(i(137,m));default:Hn(h,m,we,k,y,null)}return;default:if(yp(m)){for(De in y)y.hasOwnProperty(De)&&(k=y[De],k!==void 0&&lw(h,m,De,k,y,void 0));return}}for(ee in y)y.hasOwnProperty(ee)&&(k=y[ee],k!=null&&Hn(h,m,ee,k,y,null))}function OG(h,m,y,k){switch(m){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var N=null,M=null,Y=null,ee=null,ce=null,we=null,De=null;for(Ae in y){var $e=y[Ae];if(y.hasOwnProperty(Ae)&&$e!=null)switch(Ae){case"checked":break;case"value":break;case"defaultValue":ce=$e;default:k.hasOwnProperty(Ae)||Hn(h,m,Ae,null,k,$e)}}for(var je in k){var Ae=k[je];if($e=y[je],k.hasOwnProperty(je)&&(Ae!=null||$e!=null))switch(je){case"type":M=Ae;break;case"name":N=Ae;break;case"checked":we=Ae;break;case"defaultChecked":De=Ae;break;case"value":Y=Ae;break;case"defaultValue":ee=Ae;break;case"children":case"dangerouslySetInnerHTML":if(Ae!=null)throw Error(i(137,m));break;default:Ae!==$e&&Hn(h,m,je,Ae,k,$e)}}Ot(h,Y,ee,ce,we,De,M,N);return;case"select":Ae=Y=ee=je=null;for(M in y)if(ce=y[M],y.hasOwnProperty(M)&&ce!=null)switch(M){case"value":break;case"multiple":Ae=ce;default:k.hasOwnProperty(M)||Hn(h,m,M,null,k,ce)}for(N in k)if(M=k[N],ce=y[N],k.hasOwnProperty(N)&&(M!=null||ce!=null))switch(N){case"value":je=M;break;case"defaultValue":ee=M;break;case"multiple":Y=M;default:M!==ce&&Hn(h,m,N,M,k,ce)}m=ee,y=Y,k=Ae,je!=null?Ii(h,!!y,je,!1):!!k!=!!y&&(m!=null?Ii(h,!!y,m,!0):Ii(h,!!y,y?[]:"",!1));return;case"textarea":Ae=je=null;for(ee in y)if(N=y[ee],y.hasOwnProperty(ee)&&N!=null&&!k.hasOwnProperty(ee))switch(ee){case"value":break;case"children":break;default:Hn(h,m,ee,null,k,N)}for(Y in k)if(N=k[Y],M=y[Y],k.hasOwnProperty(Y)&&(N!=null||M!=null))switch(Y){case"value":je=N;break;case"defaultValue":Ae=N;break;case"children":break;case"dangerouslySetInnerHTML":if(N!=null)throw Error(i(91));break;default:N!==M&&Hn(h,m,Y,N,k,M)}gp(h,je,Ae);return;case"option":for(var _t in y)if(je=y[_t],y.hasOwnProperty(_t)&&je!=null&&!k.hasOwnProperty(_t))switch(_t){case"selected":h.selected=!1;break;default:Hn(h,m,_t,null,k,je)}for(ce in k)if(je=k[ce],Ae=y[ce],k.hasOwnProperty(ce)&&je!==Ae&&(je!=null||Ae!=null))switch(ce){case"selected":h.selected=je&&typeof je!="function"&&typeof je!="symbol";break;default:Hn(h,m,ce,je,k,Ae)}return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var zt in y)je=y[zt],y.hasOwnProperty(zt)&&je!=null&&!k.hasOwnProperty(zt)&&Hn(h,m,zt,null,k,je);for(we in k)if(je=k[we],Ae=y[we],k.hasOwnProperty(we)&&je!==Ae&&(je!=null||Ae!=null))switch(we){case"children":case"dangerouslySetInnerHTML":if(je!=null)throw Error(i(137,m));break;default:Hn(h,m,we,je,k,Ae)}return;default:if(yp(m)){for(var Wn in y)je=y[Wn],y.hasOwnProperty(Wn)&&je!==void 0&&!k.hasOwnProperty(Wn)&&lw(h,m,Wn,void 0,k,je);for(De in k)je=k[De],Ae=y[De],!k.hasOwnProperty(De)||je===Ae||je===void 0&&Ae===void 0||lw(h,m,De,je,k,Ae);return}}for(var xe in y)je=y[xe],y.hasOwnProperty(xe)&&je!=null&&!k.hasOwnProperty(xe)&&Hn(h,m,xe,null,k,je);for($e in k)je=k[$e],Ae=y[$e],!k.hasOwnProperty($e)||je===Ae||je==null&&Ae==null||Hn(h,m,$e,je,k,Ae)}function l3(h){switch(h){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function DG(){if(typeof performance.getEntriesByType=="function"){for(var h=0,m=0,y=performance.getEntriesByType("resource"),k=0;k<y.length;k++){var N=y[k],M=N.transferSize,Y=N.initiatorType,ee=N.duration;if(M&&ee&&l3(Y)){for(Y=0,ee=N.responseEnd,k+=1;k<y.length;k++){var ce=y[k],we=ce.startTime;if(we>ee)break;var De=ce.transferSize,$e=ce.initiatorType;De&&l3($e)&&(ce=ce.responseEnd,Y+=De*(ce<ee?1:(ee-we)/(ce-we)))}if(--k,m+=8*(M+Y)/(N.duration/1e3),h++,10<h)break}}if(0<h)return m/h/1e6}return navigator.connection&&(h=navigator.connection.downlink,typeof h=="number")?h:5}var cw=null,uw=null;function Ky(h){return h.nodeType===9?h:h.ownerDocument}function c3(h){switch(h){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function u3(h,m){if(h===0)switch(m){case"svg":return 1;case"math":return 2;default:return 0}return h===1&&m==="foreignObject"?0:h}function dw(h,m){return h==="textarea"||h==="noscript"||typeof m.children=="string"||typeof m.children=="number"||typeof m.children=="bigint"||typeof m.dangerouslySetInnerHTML=="object"&&m.dangerouslySetInnerHTML!==null&&m.dangerouslySetInnerHTML.__html!=null}var hw=null;function PG(){var h=window.event;return h&&h.type==="popstate"?h===hw?!1:(hw=h,!0):(hw=null,!1)}var d3=typeof setTimeout=="function"?setTimeout:void 0,LG=typeof clearTimeout=="function"?clearTimeout:void 0,h3=typeof Promise=="function"?Promise:void 0,IG=typeof queueMicrotask=="function"?queueMicrotask:typeof h3<"u"?function(h){return h3.resolve(null).then(h).catch(BG)}:d3;function BG(h){setTimeout(function(){throw h})}function Cc(h){return h==="head"}function f3(h,m){var y=m,k=0;do{var N=y.nextSibling;if(h.removeChild(y),N&&N.nodeType===8)if(y=N.data,y==="/$"||y==="/&"){if(k===0){h.removeChild(N),Nh(m);return}k--}else if(y==="$"||y==="$?"||y==="$~"||y==="$!"||y==="&")k++;else if(y==="html")Xp(h.ownerDocument.documentElement);else if(y==="head"){y=h.ownerDocument.head,Xp(y);for(var M=y.firstChild;M;){var Y=M.nextSibling,ee=M.nodeName;M[hs]||ee==="SCRIPT"||ee==="STYLE"||ee==="LINK"&&M.rel.toLowerCase()==="stylesheet"||y.removeChild(M),M=Y}}else y==="body"&&Xp(h.ownerDocument.body);y=N}while(y);Nh(m)}function p3(h,m){var y=h;h=0;do{var k=y.nextSibling;if(y.nodeType===1?m?(y._stashedDisplay=y.style.display,y.style.display="none"):(y.style.display=y._stashedDisplay||"",y.getAttribute("style")===""&&y.removeAttribute("style")):y.nodeType===3&&(m?(y._stashedText=y.nodeValue,y.nodeValue=""):y.nodeValue=y._stashedText||""),k&&k.nodeType===8)if(y=k.data,y==="/$"){if(h===0)break;h--}else y!=="$"&&y!=="$?"&&y!=="$~"&&y!=="$!"||h++;y=k}while(y)}function fw(h){var m=h.firstChild;for(m&&m.nodeType===10&&(m=m.nextSibling);m;){var y=m;switch(m=m.nextSibling,y.nodeName){case"HTML":case"HEAD":case"BODY":fw(y),ll(y);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(y.rel.toLowerCase()==="stylesheet")continue}h.removeChild(y)}}function zG(h,m,y,k){for(;h.nodeType===1;){var N=y;if(h.nodeName.toLowerCase()!==m.toLowerCase()){if(!k&&(h.nodeName!=="INPUT"||h.type!=="hidden"))break}else if(k){if(!h[hs])switch(m){case"meta":if(!h.hasAttribute("itemprop"))break;return h;case"link":if(M=h.getAttribute("rel"),M==="stylesheet"&&h.hasAttribute("data-precedence"))break;if(M!==N.rel||h.getAttribute("href")!==(N.href==null||N.href===""?null:N.href)||h.getAttribute("crossorigin")!==(N.crossOrigin==null?null:N.crossOrigin)||h.getAttribute("title")!==(N.title==null?null:N.title))break;return h;case"style":if(h.hasAttribute("data-precedence"))break;return h;case"script":if(M=h.getAttribute("src"),(M!==(N.src==null?null:N.src)||h.getAttribute("type")!==(N.type==null?null:N.type)||h.getAttribute("crossorigin")!==(N.crossOrigin==null?null:N.crossOrigin))&&M&&h.hasAttribute("async")&&!h.hasAttribute("itemprop"))break;return h;default:return h}}else if(m==="input"&&h.type==="hidden"){var M=N.name==null?null:""+N.name;if(N.type==="hidden"&&h.getAttribute("name")===M)return h}else return h;if(h=ga(h.nextSibling),h===null)break}return null}function $G(h,m,y){if(m==="")return null;for(;h.nodeType!==3;)if((h.nodeType!==1||h.nodeName!=="INPUT"||h.type!=="hidden")&&!y||(h=ga(h.nextSibling),h===null))return null;return h}function m3(h,m){for(;h.nodeType!==8;)if((h.nodeType!==1||h.nodeName!=="INPUT"||h.type!=="hidden")&&!m||(h=ga(h.nextSibling),h===null))return null;return h}function pw(h){return h.data==="$?"||h.data==="$~"}function mw(h){return h.data==="$!"||h.data==="$?"&&h.ownerDocument.readyState!=="loading"}function FG(h,m){var y=h.ownerDocument;if(h.data==="$~")h._reactRetry=m;else if(h.data!=="$?"||y.readyState!=="loading")m();else{var k=function(){m(),y.removeEventListener("DOMContentLoaded",k)};y.addEventListener("DOMContentLoaded",k),h._reactRetry=k}}function ga(h){for(;h!=null;h=h.nextSibling){var m=h.nodeType;if(m===1||m===3)break;if(m===8){if(m=h.data,m==="$"||m==="$!"||m==="$?"||m==="$~"||m==="&"||m==="F!"||m==="F")break;if(m==="/$"||m==="/&")return null}}return h}var gw=null;function g3(h){h=h.nextSibling;for(var m=0;h;){if(h.nodeType===8){var y=h.data;if(y==="/$"||y==="/&"){if(m===0)return ga(h.nextSibling);m--}else y!=="$"&&y!=="$!"&&y!=="$?"&&y!=="$~"&&y!=="&"||m++}h=h.nextSibling}return null}function v3(h){h=h.previousSibling;for(var m=0;h;){if(h.nodeType===8){var y=h.data;if(y==="$"||y==="$!"||y==="$?"||y==="$~"||y==="&"){if(m===0)return h;m--}else y!=="/$"&&y!=="/&"||m++}h=h.previousSibling}return null}function y3(h,m,y){switch(m=Ky(y),h){case"html":if(h=m.documentElement,!h)throw Error(i(452));return h;case"head":if(h=m.head,!h)throw Error(i(453));return h;case"body":if(h=m.body,!h)throw Error(i(454));return h;default:throw Error(i(451))}}function Xp(h){for(var m=h.attributes;m.length;)h.removeAttributeNode(m[0]);ll(h)}var va=new Map,_3=new Set;function Vy(h){return typeof h.getRootNode=="function"?h.getRootNode():h.nodeType===9?h:h.ownerDocument}var jl=X.d;X.d={f:HG,r:WG,D:qG,C:UG,L:KG,m:VG,X:GG,S:YG,M:XG};function HG(){var h=jl.f(),m=By();return h||m}function WG(h){var m=Pi(h);m!==null&&m.tag===5&&m.type==="form"?LR(m):jl.r(h)}var Sh=typeof document>"u"?null:document;function x3(h,m,y){var k=Sh;if(k&&typeof m=="string"&&m){var N=at(m);N='link[rel="'+h+'"][href="'+N+'"]',typeof y=="string"&&(N+='[crossorigin="'+y+'"]'),_3.has(N)||(_3.add(N),h={rel:h,crossOrigin:y,href:m},k.querySelector(N)===null&&(m=k.createElement("link"),ji(m,"link",h),Vn(m),k.head.appendChild(m)))}}function qG(h){jl.D(h),x3("dns-prefetch",h,null)}function UG(h,m){jl.C(h,m),x3("preconnect",h,m)}function KG(h,m,y){jl.L(h,m,y);var k=Sh;if(k&&h&&m){var N='link[rel="preload"][as="'+at(m)+'"]';m==="image"&&y&&y.imageSrcSet?(N+='[imagesrcset="'+at(y.imageSrcSet)+'"]',typeof y.imageSizes=="string"&&(N+='[imagesizes="'+at(y.imageSizes)+'"]')):N+='[href="'+at(h)+'"]';var M=N;switch(m){case"style":M=Ch(h);break;case"script":M=jh(h)}va.has(M)||(h=f({rel:"preload",href:m==="image"&&y&&y.imageSrcSet?void 0:h,as:m},y),va.set(M,h),k.querySelector(N)!==null||m==="style"&&k.querySelector(Qp(M))||m==="script"&&k.querySelector(Zp(M))||(m=k.createElement("link"),ji(m,"link",h),Vn(m),k.head.appendChild(m)))}}function VG(h,m){jl.m(h,m);var y=Sh;if(y&&h){var k=m&&typeof m.as=="string"?m.as:"script",N='link[rel="modulepreload"][as="'+at(k)+'"][href="'+at(h)+'"]',M=N;switch(k){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":M=jh(h)}if(!va.has(M)&&(h=f({rel:"modulepreload",href:h},m),va.set(M,h),y.querySelector(N)===null)){switch(k){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(y.querySelector(Zp(M)))return}k=y.createElement("link"),ji(k,"link",h),Vn(k),y.head.appendChild(k)}}}function YG(h,m,y){jl.S(h,m,y);var k=Sh;if(k&&h){var N=Fr(k).hoistableStyles,M=Ch(h);m=m||"default";var Y=N.get(M);if(!Y){var ee={loading:0,preload:null};if(Y=k.querySelector(Qp(M)))ee.loading=5;else{h=f({rel:"stylesheet",href:h,"data-precedence":m},y),(y=va.get(M))&&vw(h,y);var ce=Y=k.createElement("link");Vn(ce),ji(ce,"link",h),ce._p=new Promise(function(we,De){ce.onload=we,ce.onerror=De}),ce.addEventListener("load",function(){ee.loading|=1}),ce.addEventListener("error",function(){ee.loading|=2}),ee.loading|=4,Yy(Y,m,k)}Y={type:"stylesheet",instance:Y,count:1,state:ee},N.set(M,Y)}}}function GG(h,m){jl.X(h,m);var y=Sh;if(y&&h){var k=Fr(y).hoistableScripts,N=jh(h),M=k.get(N);M||(M=y.querySelector(Zp(N)),M||(h=f({src:h,async:!0},m),(m=va.get(N))&&yw(h,m),M=y.createElement("script"),Vn(M),ji(M,"link",h),y.head.appendChild(M)),M={type:"script",instance:M,count:1,state:null},k.set(N,M))}}function XG(h,m){jl.M(h,m);var y=Sh;if(y&&h){var k=Fr(y).hoistableScripts,N=jh(h),M=k.get(N);M||(M=y.querySelector(Zp(N)),M||(h=f({src:h,async:!0,type:"module"},m),(m=va.get(N))&&yw(h,m),M=y.createElement("script"),Vn(M),ji(M,"link",h),y.head.appendChild(M)),M={type:"script",instance:M,count:1,state:null},k.set(N,M))}}function b3(h,m,y,k){var N=(N=G.current)?Vy(N):null;if(!N)throw Error(i(446));switch(h){case"meta":case"title":return null;case"style":return typeof y.precedence=="string"&&typeof y.href=="string"?(m=Ch(y.href),y=Fr(N).hoistableStyles,k=y.get(m),k||(k={type:"style",instance:null,count:0,state:null},y.set(m,k)),k):{type:"void",instance:null,count:0,state:null};case"link":if(y.rel==="stylesheet"&&typeof y.href=="string"&&typeof y.precedence=="string"){h=Ch(y.href);var M=Fr(N).hoistableStyles,Y=M.get(h);if(Y||(N=N.ownerDocument||N,Y={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},M.set(h,Y),(M=N.querySelector(Qp(h)))&&!M._p&&(Y.instance=M,Y.state.loading=5),va.has(h)||(y={rel:"preload",as:"style",href:y.href,crossOrigin:y.crossOrigin,integrity:y.integrity,media:y.media,hrefLang:y.hrefLang,referrerPolicy:y.referrerPolicy},va.set(h,y),M||QG(N,h,y,Y.state))),m&&k===null)throw Error(i(528,""));return Y}if(m&&k!==null)throw Error(i(529,""));return null;case"script":return m=y.async,y=y.src,typeof y=="string"&&m&&typeof m!="function"&&typeof m!="symbol"?(m=jh(y),y=Fr(N).hoistableScripts,k=y.get(m),k||(k={type:"script",instance:null,count:0,state:null},y.set(m,k)),k):{type:"void",instance:null,count:0,state:null};default:throw Error(i(444,h))}}function Ch(h){return'href="'+at(h)+'"'}function Qp(h){return'link[rel="stylesheet"]['+h+"]"}function k3(h){return f({},h,{"data-precedence":h.precedence,precedence:null})}function QG(h,m,y,k){h.querySelector('link[rel="preload"][as="style"]['+m+"]")?k.loading=1:(m=h.createElement("link"),k.preload=m,m.addEventListener("load",function(){return k.loading|=1}),m.addEventListener("error",function(){return k.loading|=2}),ji(m,"link",y),Vn(m),h.head.appendChild(m))}function jh(h){return'[src="'+at(h)+'"]'}function Zp(h){return"script[async]"+h}function w3(h,m,y){if(m.count++,m.instance===null)switch(m.type){case"style":var k=h.querySelector('style[data-href~="'+at(y.href)+'"]');if(k)return m.instance=k,Vn(k),k;var N=f({},y,{"data-href":y.href,"data-precedence":y.precedence,href:null,precedence:null});return k=(h.ownerDocument||h).createElement("style"),Vn(k),ji(k,"style",N),Yy(k,y.precedence,h),m.instance=k;case"stylesheet":N=Ch(y.href);var M=h.querySelector(Qp(N));if(M)return m.state.loading|=4,m.instance=M,Vn(M),M;k=k3(y),(N=va.get(N))&&vw(k,N),M=(h.ownerDocument||h).createElement("link"),Vn(M);var Y=M;return Y._p=new Promise(function(ee,ce){Y.onload=ee,Y.onerror=ce}),ji(M,"link",k),m.state.loading|=4,Yy(M,y.precedence,h),m.instance=M;case"script":return M=jh(y.src),(N=h.querySelector(Zp(M)))?(m.instance=N,Vn(N),N):(k=y,(N=va.get(M))&&(k=f({},y),yw(k,N)),h=h.ownerDocument||h,N=h.createElement("script"),Vn(N),ji(N,"link",k),h.head.appendChild(N),m.instance=N);case"void":return null;default:throw Error(i(443,m.type))}else m.type==="stylesheet"&&(m.state.loading&4)===0&&(k=m.instance,m.state.loading|=4,Yy(k,y.precedence,h));return m.instance}function Yy(h,m,y){for(var k=y.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),N=k.length?k[k.length-1]:null,M=N,Y=0;Y<k.length;Y++){var ee=k[Y];if(ee.dataset.precedence===m)M=ee;else if(M!==N)break}M?M.parentNode.insertBefore(h,M.nextSibling):(m=y.nodeType===9?y.head:y,m.insertBefore(h,m.firstChild))}function vw(h,m){h.crossOrigin==null&&(h.crossOrigin=m.crossOrigin),h.referrerPolicy==null&&(h.referrerPolicy=m.referrerPolicy),h.title==null&&(h.title=m.title)}function yw(h,m){h.crossOrigin==null&&(h.crossOrigin=m.crossOrigin),h.referrerPolicy==null&&(h.referrerPolicy=m.referrerPolicy),h.integrity==null&&(h.integrity=m.integrity)}var Gy=null;function S3(h,m,y){if(Gy===null){var k=new Map,N=Gy=new Map;N.set(y,k)}else N=Gy,k=N.get(y),k||(k=new Map,N.set(y,k));if(k.has(h))return k;for(k.set(h,null),y=y.getElementsByTagName(h),N=0;N<y.length;N++){var M=y[N];if(!(M[hs]||M[P]||h==="link"&&M.getAttribute("rel")==="stylesheet")&&M.namespaceURI!=="http://www.w3.org/2000/svg"){var Y=M.getAttribute(m)||"";Y=h+Y;var ee=k.get(Y);ee?ee.push(M):k.set(Y,[M])}}return k}function C3(h,m,y){h=h.ownerDocument||h,h.head.insertBefore(y,m==="title"?h.querySelector("head > title"):null)}function ZG(h,m,y){if(y===1||m.itemProp!=null)return!1;switch(h){case"meta":case"title":return!0;case"style":if(typeof m.precedence!="string"||typeof m.href!="string"||m.href==="")break;return!0;case"link":if(typeof m.rel!="string"||typeof m.href!="string"||m.href===""||m.onLoad||m.onError)break;switch(m.rel){case"stylesheet":return h=m.disabled,typeof m.precedence=="string"&&h==null;default:return!0}case"script":if(m.async&&typeof m.async!="function"&&typeof m.async!="symbol"&&!m.onLoad&&!m.onError&&m.src&&typeof m.src=="string")return!0}return!1}function j3(h){return!(h.type==="stylesheet"&&(h.state.loading&3)===0)}function JG(h,m,y,k){if(y.type==="stylesheet"&&(typeof k.media!="string"||matchMedia(k.media).matches!==!1)&&(y.state.loading&4)===0){if(y.instance===null){var N=Ch(k.href),M=m.querySelector(Qp(N));if(M){m=M._p,m!==null&&typeof m=="object"&&typeof m.then=="function"&&(h.count++,h=Xy.bind(h),m.then(h,h)),y.state.loading|=4,y.instance=M,Vn(M);return}M=m.ownerDocument||m,k=k3(k),(N=va.get(N))&&vw(k,N),M=M.createElement("link"),Vn(M);var Y=M;Y._p=new Promise(function(ee,ce){Y.onload=ee,Y.onerror=ce}),ji(M,"link",k),y.instance=M}h.stylesheets===null&&(h.stylesheets=new Map),h.stylesheets.set(y,m),(m=y.state.preload)&&(y.state.loading&3)===0&&(h.count++,y=Xy.bind(h),m.addEventListener("load",y),m.addEventListener("error",y))}}var _w=0;function eX(h,m){return h.stylesheets&&h.count===0&&Zy(h,h.stylesheets),0<h.count||0<h.imgCount?function(y){var k=setTimeout(function(){if(h.stylesheets&&Zy(h,h.stylesheets),h.unsuspend){var M=h.unsuspend;h.unsuspend=null,M()}},6e4+m);0<h.imgBytes&&_w===0&&(_w=62500*DG());var N=setTimeout(function(){if(h.waitingForImages=!1,h.count===0&&(h.stylesheets&&Zy(h,h.stylesheets),h.unsuspend)){var M=h.unsuspend;h.unsuspend=null,M()}},(h.imgBytes>_w?50:800)+m);return h.unsuspend=y,function(){h.unsuspend=null,clearTimeout(k),clearTimeout(N)}}:null}function Xy(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Zy(this,this.stylesheets);else if(this.unsuspend){var h=this.unsuspend;this.unsuspend=null,h()}}}var Qy=null;function Zy(h,m){h.stylesheets=null,h.unsuspend!==null&&(h.count++,Qy=new Map,m.forEach(tX,h),Qy=null,Xy.call(h))}function tX(h,m){if(!(m.state.loading&4)){var y=Qy.get(h);if(y)var k=y.get(null);else{y=new Map,Qy.set(h,y);for(var N=h.querySelectorAll("link[data-precedence],style[data-precedence]"),M=0;M<N.length;M++){var Y=N[M];(Y.nodeName==="LINK"||Y.getAttribute("media")!=="not all")&&(y.set(Y.dataset.precedence,Y),k=Y)}k&&y.set(null,k)}N=m.instance,Y=N.getAttribute("data-precedence"),M=y.get(Y)||k,M===k&&y.set(null,N),y.set(Y,N),this.count++,k=Xy.bind(this),N.addEventListener("load",k),N.addEventListener("error",k),M?M.parentNode.insertBefore(N,M.nextSibling):(h=h.nodeType===9?h.head:h,h.insertBefore(N,h.firstChild)),m.state.loading|=4}}var Jp={$$typeof:C,Provider:null,Consumer:null,_currentValue:K,_currentValue2:K,_threadCount:0};function nX(h,m,y,k,N,M,Y,ee,ce){this.tag=1,this.containerInfo=h,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=Mn(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Mn(0),this.hiddenUpdates=Mn(null),this.identifierPrefix=k,this.onUncaughtError=N,this.onCaughtError=M,this.onRecoverableError=Y,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=ce,this.incompleteTransitions=new Map}function N3(h,m,y,k,N,M,Y,ee,ce,we,De,$e){return h=new nX(h,m,y,Y,ce,we,De,$e,ee),m=1,M===!0&&(m|=24),M=$s(3,null,null,m),h.current=M,M.stateNode=h,m=Zk(),m.refCount++,h.pooledCache=m,m.refCount++,M.memoizedState={element:k,isDehydrated:y,cache:m},n1(M),h}function E3(h){return h?(h=rh,h):rh}function A3(h,m,y,k,N,M){N=E3(N),k.context===null?k.context=N:k.pendingContext=N,k=pc(m),k.payload={element:y},M=M===void 0?null:M,M!==null&&(k.callback=M),y=mc(h,k,m),y!==null&&(ys(y,h,m),Mp(y,h,m))}function T3(h,m){if(h=h.memoizedState,h!==null&&h.dehydrated!==null){var y=h.retryLane;h.retryLane=y!==0&&y<m?y:m}}function xw(h,m){T3(h,m),(h=h.alternate)&&T3(h,m)}function M3(h){if(h.tag===13||h.tag===31){var m=Du(h,67108864);m!==null&&ys(m,h,67108864),xw(h,67108864)}}function R3(h){if(h.tag===13||h.tag===31){var m=Us();m=Ft(m);var y=Du(h,m);y!==null&&ys(y,h,m),xw(h,m)}}var Jy=!0;function rX(h,m,y,k){var N=I.T;I.T=null;var M=X.p;try{X.p=2,bw(h,m,y,k)}finally{X.p=M,I.T=N}}function iX(h,m,y,k){var N=I.T;I.T=null;var M=X.p;try{X.p=8,bw(h,m,y,k)}finally{X.p=M,I.T=N}}function bw(h,m,y,k){if(Jy){var N=kw(k);if(N===null)ow(h,m,k,e_,y),D3(h,k);else if(aX(N,h,m,y,k))k.stopPropagation();else if(D3(h,k),m&4&&-1<sX.indexOf(h)){for(;N!==null;){var M=Pi(N);if(M!==null)switch(M.tag){case 3:if(M=M.stateNode,M.current.memoizedState.isDehydrated){var Y=Vt(M.pendingLanes);if(Y!==0){var ee=M;for(ee.pendingLanes|=2,ee.entangledLanes|=2;Y;){var ce=1<<31-Mt(Y);ee.entanglements[1]|=ce,Y&=~ce}ko(M),(On&6)===0&&(Ly=yt()+500,Vp(0))}}break;case 31:case 13:ee=Du(M,2),ee!==null&&ys(ee,M,2),By(),xw(M,2)}if(M=kw(k),M===null&&ow(h,m,k,e_,y),M===N)break;N=M}N!==null&&k.stopPropagation()}else ow(h,m,k,null,y)}}function kw(h){return h=Zd(h),ww(h)}var e_=null;function ww(h){if(e_=null,h=fs(h),h!==null){var m=a(h);if(m===null)h=null;else{var y=m.tag;if(y===13){if(h=o(m),h!==null)return h;h=null}else if(y===31){if(h=l(m),h!==null)return h;h=null}else if(y===3){if(m.stateNode.current.memoizedState.isDehydrated)return m.tag===3?m.stateNode.containerInfo:null;h=null}else m!==h&&(h=null)}}return e_=h,null}function O3(h){switch(h){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(Rt()){case be:return 2;case He:return 8;case ht:case ot:return 32;case $t:return 268435456;default:return 32}default:return 32}}var Sw=!1,jc=null,Nc=null,Ec=null,em=new Map,tm=new Map,Ac=[],sX="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset".split(" ");function D3(h,m){switch(h){case"focusin":case"focusout":jc=null;break;case"dragenter":case"dragleave":Nc=null;break;case"mouseover":case"mouseout":Ec=null;break;case"pointerover":case"pointerout":em.delete(m.pointerId);break;case"gotpointercapture":case"lostpointercapture":tm.delete(m.pointerId)}}function nm(h,m,y,k,N,M){return h===null||h.nativeEvent!==M?(h={blockedOn:m,domEventName:y,eventSystemFlags:k,nativeEvent:M,targetContainers:[N]},m!==null&&(m=Pi(m),m!==null&&M3(m)),h):(h.eventSystemFlags|=k,m=h.targetContainers,N!==null&&m.indexOf(N)===-1&&m.push(N),h)}function aX(h,m,y,k,N){switch(m){case"focusin":return jc=nm(jc,h,m,y,k,N),!0;case"dragenter":return Nc=nm(Nc,h,m,y,k,N),!0;case"mouseover":return Ec=nm(Ec,h,m,y,k,N),!0;case"pointerover":var M=N.pointerId;return em.set(M,nm(em.get(M)||null,h,m,y,k,N)),!0;case"gotpointercapture":return M=N.pointerId,tm.set(M,nm(tm.get(M)||null,h,m,y,k,N)),!0}return!1}function P3(h){var m=fs(h.target);if(m!==null){var y=a(m);if(y!==null){if(m=y.tag,m===13){if(m=o(y),m!==null){h.blockedOn=m,on(h.priority,function(){R3(y)});return}}else if(m===31){if(m=l(y),m!==null){h.blockedOn=m,on(h.priority,function(){R3(y)});return}}else if(m===3&&y.stateNode.current.memoizedState.isDehydrated){h.blockedOn=y.tag===3?y.stateNode.containerInfo:null;return}}}h.blockedOn=null}function t_(h){if(h.blockedOn!==null)return!1;for(var m=h.targetContainers;0<m.length;){var y=kw(h.nativeEvent);if(y===null){y=h.nativeEvent;var k=new y.constructor(y.type,y);_p=k,y.target.dispatchEvent(k),_p=null}else return m=Pi(y),m!==null&&M3(m),h.blockedOn=y,!1;m.shift()}return!0}function L3(h,m,y){t_(h)&&y.delete(m)}function oX(){Sw=!1,jc!==null&&t_(jc)&&(jc=null),Nc!==null&&t_(Nc)&&(Nc=null),Ec!==null&&t_(Ec)&&(Ec=null),em.forEach(L3),tm.forEach(L3)}function n_(h,m){h.blockedOn===m&&(h.blockedOn=null,Sw||(Sw=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,oX)))}var r_=null;function I3(h){r_!==h&&(r_=h,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){r_===h&&(r_=null);for(var m=0;m<h.length;m+=3){var y=h[m],k=h[m+1],N=h[m+2];if(typeof k!="function"){if(ww(k||y)===null)continue;break}var M=Pi(y);M!==null&&(h.splice(m,3),m-=3,k1(M,{pending:!0,data:N,method:y.method,action:k},k,N))}}))}function Nh(h){function m(ce){return n_(ce,h)}jc!==null&&n_(jc,h),Nc!==null&&n_(Nc,h),Ec!==null&&n_(Ec,h),em.forEach(m),tm.forEach(m);for(var y=0;y<Ac.length;y++){var k=Ac[y];k.blockedOn===h&&(k.blockedOn=null)}for(;0<Ac.length&&(y=Ac[0],y.blockedOn===null);)P3(y),y.blockedOn===null&&Ac.shift();if(y=(h.ownerDocument||h).$$reactFormReplay,y!=null)for(k=0;k<y.length;k+=3){var N=y[k],M=y[k+1],Y=N[Ie]||null;if(typeof M=="function")Y||I3(y);else if(Y){var ee=null;if(M&&M.hasAttribute("formAction")){if(N=M,Y=M[Ie]||null)ee=Y.formAction;else if(ww(N)!==null)continue}else ee=Y.action;typeof ee=="function"?y[k+1]=ee:(y.splice(k,3),k-=3),I3(y)}}}function B3(){function h(M){M.canIntercept&&M.info==="react-transition"&&M.intercept({handler:function(){return new Promise(function(Y){return N=Y})},focusReset:"manual",scroll:"manual"})}function m(){N!==null&&(N(),N=null),k||setTimeout(y,20)}function y(){if(!k&&!navigation.transition){var M=navigation.currentEntry;M&&M.url!=null&&navigation.navigate(M.url,{state:M.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var k=!1,N=null;return navigation.addEventListener("navigate",h),navigation.addEventListener("navigatesuccess",m),navigation.addEventListener("navigateerror",m),setTimeout(y,100),function(){k=!0,navigation.removeEventListener("navigate",h),navigation.removeEventListener("navigatesuccess",m),navigation.removeEventListener("navigateerror",m),N!==null&&(N(),N=null)}}}function Cw(h){this._internalRoot=h}i_.prototype.render=Cw.prototype.render=function(h){var m=this._internalRoot;if(m===null)throw Error(i(409));var y=m.current,k=Us();A3(y,k,h,m,null,null)},i_.prototype.unmount=Cw.prototype.unmount=function(){var h=this._internalRoot;if(h!==null){this._internalRoot=null;var m=h.containerInfo;A3(h.current,2,null,h,null,null),By(),m[st]=null}};function i_(h){this._internalRoot=h}i_.prototype.unstable_scheduleHydration=function(h){if(h){var m=xi();h={blockedOn:null,target:h,priority:m};for(var y=0;y<Ac.length&&m!==0&&m<Ac[y].priority;y++);Ac.splice(y,0,h),y===0&&P3(h)}};var z3=n.version;if(z3!=="19.2.4")throw Error(i(527,z3,"19.2.4"));X.findDOMNode=function(h){var m=h._reactInternals;if(m===void 0)throw typeof h.render=="function"?Error(i(188)):(h=Object.keys(h).join(","),Error(i(268,h)));return h=d(m),h=h!==null?p(h):null,h=h===null?null:h.stateNode,h};var lX={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:I,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var s_=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!s_.isDisabled&&s_.supportsFiber)try{We=s_.inject(lX),ut=s_}catch{}}return im.createRoot=function(h,m){if(!s(h))throw Error(i(299));var y=!1,k="",N=KR,M=VR,Y=YR;return m!=null&&(m.unstable_strictMode===!0&&(y=!0),m.identifierPrefix!==void 0&&(k=m.identifierPrefix),m.onUncaughtError!==void 0&&(N=m.onUncaughtError),m.onCaughtError!==void 0&&(M=m.onCaughtError),m.onRecoverableError!==void 0&&(Y=m.onRecoverableError)),m=N3(h,1,!1,null,null,y,k,null,N,M,Y,B3),h[st]=m.current,aw(h),new Cw(m)},im.hydrateRoot=function(h,m,y){if(!s(h))throw Error(i(299));var k=!1,N="",M=KR,Y=VR,ee=YR,ce=null;return y!=null&&(y.unstable_strictMode===!0&&(k=!0),y.identifierPrefix!==void 0&&(N=y.identifierPrefix),y.onUncaughtError!==void 0&&(M=y.onUncaughtError),y.onCaughtError!==void 0&&(Y=y.onCaughtError),y.onRecoverableError!==void 0&&(ee=y.onRecoverableError),y.formState!==void 0&&(ce=y.formState)),m=N3(h,1,!0,m,y??null,k,N,ce,M,Y,ee,B3),m.context=E3(null),y=m.current,k=Us(),k=Ft(k),N=pc(k),N.callback=null,mc(y,N,k),y=k,m.current.lanes=y,ge(m,y),ko(m),h[st]=m.current,aw(h),new i_(m)},im.version="19.2.4",im}var G3;function xX(){if(G3)return Ew.exports;G3=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(n){console.error(n)}}return e(),Ew.exports=_X(),Ew.exports}var bX=xX();const kX=wu(bX);/**
 * react-router v7.13.0
 *
 * Copyright (c) Remix Software Inc.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE.md file in the root directory of this source tree.
 *
 * @license MIT
 */var X3="popstate";function wX(e={}){function n(i,s){let{pathname:a,search:o,hash:l}=i.location;return SC("",{pathname:a,search:o,hash:l},s.state&&s.state.usr||null,s.state&&s.state.key||"default")}function r(i,s){return typeof s=="string"?s:jg(s)}return CX(n,r,null,e)}function xr(e,n){if(e===!1||e===null||typeof e>"u")throw new Error(n)}function Oa(e,n){if(!e){typeof console<"u"&&console.warn(n);try{throw new Error(n)}catch{}}}function SX(){return Math.random().toString(36).substring(2,10)}function Q3(e,n){return{usr:e.state,key:e.key,idx:n}}function SC(e,n,r=null,i){return{pathname:typeof e=="string"?e:e.pathname,search:"",hash:"",...typeof n=="string"?sp(n):n,state:r,key:n&&n.key||i||SX()}}function jg({pathname:e="/",search:n="",hash:r=""}){return n&&n!=="?"&&(e+=n.charAt(0)==="?"?n:"?"+n),r&&r!=="#"&&(e+=r.charAt(0)==="#"?r:"#"+r),e}function sp(e){let n={};if(e){let r=e.indexOf("#");r>=0&&(n.hash=e.substring(r),e=e.substring(0,r));let i=e.indexOf("?");i>=0&&(n.search=e.substring(i),e=e.substring(0,i)),e&&(n.pathname=e)}return n}function CX(e,n,r,i={}){let{window:s=document.defaultView,v5Compat:a=!1}=i,o=s.history,l="POP",u=null,d=p();d==null&&(d=0,o.replaceState({...o.state,idx:d},""));function p(){return(o.state||{idx:null}).idx}function f(){l="POP";let S=p(),w=S==null?null:S-d;d=S,u&&u({action:l,location:v.location,delta:w})}function g(S,w){l="PUSH";let j=SC(v.location,S,w);d=p()+1;let C=Q3(j,d),T=v.createHref(j);try{o.pushState(C,"",T)}catch(E){if(E instanceof DOMException&&E.name==="DataCloneError")throw E;s.location.assign(T)}a&&u&&u({action:l,location:v.location,delta:1})}function _(S,w){l="REPLACE";let j=SC(v.location,S,w);d=p();let C=Q3(j,d),T=v.createHref(j);o.replaceState(C,"",T),a&&u&&u({action:l,location:v.location,delta:0})}function x(S){return jX(S)}let v={get action(){return l},get location(){return e(s,o)},listen(S){if(u)throw new Error("A history only accepts one active listener");return s.addEventListener(X3,f),u=S,()=>{s.removeEventListener(X3,f),u=null}},createHref(S){return n(s,S)},createURL:x,encodeLocation(S){let w=x(S);return{pathname:w.pathname,search:w.search,hash:w.hash}},push:g,replace:_,go(S){return o.go(S)}};return v}function jX(e,n=!1){let r="http://localhost";typeof window<"u"&&(r=window.location.origin!=="null"?window.location.origin:window.location.href),xr(r,"No window.location.(origin|href) available to create URL");let i=typeof e=="string"?e:jg(e);return i=i.replace(/ $/,"%20"),!n&&i.startsWith("//")&&(i=r+i),new URL(i,r)}function NB(e,n,r="/"){return NX(e,n,r,!1)}function NX(e,n,r,i){let s=typeof n=="string"?sp(n):n,a=Gl(s.pathname||"/",r);if(a==null)return null;let o=EB(e);EX(o);let l=null;for(let u=0;l==null&&u<o.length;++u){let d=zX(a);l=IX(o[u],d,i)}return l}function EB(e,n=[],r=[],i="",s=!1){let a=(o,l,u=s,d)=>{let p={relativePath:d===void 0?o.path||"":d,caseSensitive:o.caseSensitive===!0,childrenIndex:l,route:o};if(p.relativePath.startsWith("/")){if(!p.relativePath.startsWith(i)&&u)return;xr(p.relativePath.startsWith(i),`Absolute route path "${p.relativePath}" nested under path "${i}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),p.relativePath=p.relativePath.slice(i.length)}let f=ql([i,p.relativePath]),g=r.concat(p);o.children&&o.children.length>0&&(xr(o.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${f}".`),EB(o.children,n,g,f,u)),!(o.path==null&&!o.index)&&n.push({path:f,score:PX(f,o.index),routesMeta:g})};return e.forEach((o,l)=>{var u;if(o.path===""||!((u=o.path)!=null&&u.includes("?")))a(o,l);else for(let d of AB(o.path))a(o,l,!0,d)}),n}function AB(e){let n=e.split("/");if(n.length===0)return[];let[r,...i]=n,s=r.endsWith("?"),a=r.replace(/\?$/,"");if(i.length===0)return s?[a,""]:[a];let o=AB(i.join("/")),l=[];return l.push(...o.map(u=>u===""?a:[a,u].join("/"))),s&&l.push(...o),l.map(u=>e.startsWith("/")&&u===""?"/":u)}function EX(e){e.sort((n,r)=>n.score!==r.score?r.score-n.score:LX(n.routesMeta.map(i=>i.childrenIndex),r.routesMeta.map(i=>i.childrenIndex)))}var AX=/^:[\w-]+$/,TX=3,MX=2,RX=1,OX=10,DX=-2,Z3=e=>e==="*";function PX(e,n){let r=e.split("/"),i=r.length;return r.some(Z3)&&(i+=DX),n&&(i+=MX),r.filter(s=>!Z3(s)).reduce((s,a)=>s+(AX.test(a)?TX:a===""?RX:OX),i)}function LX(e,n){return e.length===n.length&&e.slice(0,-1).every((i,s)=>i===n[s])?e[e.length-1]-n[n.length-1]:0}function IX(e,n,r=!1){let{routesMeta:i}=e,s={},a="/",o=[];for(let l=0;l<i.length;++l){let u=i[l],d=l===i.length-1,p=a==="/"?n:n.slice(a.length)||"/",f=Xx({path:u.relativePath,caseSensitive:u.caseSensitive,end:d},p),g=u.route;if(!f&&d&&r&&!i[i.length-1].route.index&&(f=Xx({path:u.relativePath,caseSensitive:u.caseSensitive,end:!1},p)),!f)return null;Object.assign(s,f.params),o.push({params:s,pathname:ql([a,f.pathname]),pathnameBase:WX(ql([a,f.pathnameBase])),route:g}),f.pathnameBase!=="/"&&(a=ql([a,f.pathnameBase]))}return o}function Xx(e,n){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[r,i]=BX(e.path,e.caseSensitive,e.end),s=n.match(r);if(!s)return null;let a=s[0],o=a.replace(/(.)\/+$/,"$1"),l=s.slice(1);return{params:i.reduce((d,{paramName:p,isOptional:f},g)=>{if(p==="*"){let x=l[g]||"";o=a.slice(0,a.length-x.length).replace(/(.)\/+$/,"$1")}const _=l[g];return f&&!_?d[p]=void 0:d[p]=(_||"").replace(/%2F/g,"/"),d},{}),pathname:a,pathnameBase:o,pattern:e}}function BX(e,n=!1,r=!0){Oa(e==="*"||!e.endsWith("*")||e.endsWith("/*"),`Route path "${e}" will be treated as if it were "${e.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/,"/*")}".`);let i=[],s="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(o,l,u)=>(i.push({paramName:l,isOptional:u!=null}),u?"/?([^\\/]+)?":"/([^\\/]+)")).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return e.endsWith("*")?(i.push({paramName:"*"}),s+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):r?s+="\\/*$":e!==""&&e!=="/"&&(s+="(?:(?=\\/|$))"),[new RegExp(s,n?void 0:"i"),i]}function zX(e){try{return e.split("/").map(n=>decodeURIComponent(n).replace(/\//g,"%2F")).join("/")}catch(n){return Oa(!1,`The URL path "${e}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${n}).`),e}}function Gl(e,n){if(n==="/")return e;if(!e.toLowerCase().startsWith(n.toLowerCase()))return null;let r=n.endsWith("/")?n.length-1:n.length,i=e.charAt(r);return i&&i!=="/"?null:e.slice(r)||"/"}var $X=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;function FX(e,n="/"){let{pathname:r,search:i="",hash:s=""}=typeof e=="string"?sp(e):e,a;return r?(r=r.replace(/\/\/+/g,"/"),r.startsWith("/")?a=J3(r.substring(1),"/"):a=J3(r,n)):a=n,{pathname:a,search:qX(i),hash:UX(s)}}function J3(e,n){let r=n.replace(/\/+$/,"").split("/");return e.split("/").forEach(s=>{s===".."?r.length>1&&r.pop():s!=="."&&r.push(s)}),r.length>1?r.join("/"):"/"}function Rw(e,n,r,i){return`Cannot include a '${e}' character in a manually specified \`to.${n}\` field [${JSON.stringify(i)}].  Please separate it out to the \`to.${r}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function HX(e){return e.filter((n,r)=>r===0||n.route.path&&n.route.path.length>0)}function NE(e){let n=HX(e);return n.map((r,i)=>i===n.length-1?r.pathname:r.pathnameBase)}function EE(e,n,r,i=!1){let s;typeof e=="string"?s=sp(e):(s={...e},xr(!s.pathname||!s.pathname.includes("?"),Rw("?","pathname","search",s)),xr(!s.pathname||!s.pathname.includes("#"),Rw("#","pathname","hash",s)),xr(!s.search||!s.search.includes("#"),Rw("#","search","hash",s)));let a=e===""||s.pathname==="",o=a?"/":s.pathname,l;if(o==null)l=r;else{let f=n.length-1;if(!i&&o.startsWith("..")){let g=o.split("/");for(;g[0]==="..";)g.shift(),f-=1;s.pathname=g.join("/")}l=f>=0?n[f]:"/"}let u=FX(s,l),d=o&&o!=="/"&&o.endsWith("/"),p=(a||o===".")&&r.endsWith("/");return!u.pathname.endsWith("/")&&(d||p)&&(u.pathname+="/"),u}var ql=e=>e.join("/").replace(/\/\/+/g,"/"),WX=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),qX=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,UX=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e,KX=class{constructor(e,n,r,i=!1){this.status=e,this.statusText=n||"",this.internal=i,r instanceof Error?(this.data=r.toString(),this.error=r):this.data=r}};function VX(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}function YX(e){return e.map(n=>n.route.path).filter(Boolean).join("/").replace(/\/\/*/g,"/")||"/"}var TB=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function MB(e,n){let r=e;if(typeof r!="string"||!$X.test(r))return{absoluteURL:void 0,isExternal:!1,to:r};let i=r,s=!1;if(TB)try{let a=new URL(window.location.href),o=r.startsWith("//")?new URL(a.protocol+r):new URL(r),l=Gl(o.pathname,n);o.origin===a.origin&&l!=null?r=l+o.search+o.hash:s=!0}catch{Oa(!1,`<Link to="${r}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:i,isExternal:s,to:r}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var RB=["POST","PUT","PATCH","DELETE"];new Set(RB);var GX=["GET",...RB];new Set(GX);var ap=b.createContext(null);ap.displayName="DataRouter";var y0=b.createContext(null);y0.displayName="DataRouterState";var XX=b.createContext(!1),OB=b.createContext({isTransitioning:!1});OB.displayName="ViewTransition";var QX=b.createContext(new Map);QX.displayName="Fetchers";var ZX=b.createContext(null);ZX.displayName="Await";var sa=b.createContext(null);sa.displayName="Navigation";var gv=b.createContext(null);gv.displayName="Location";var so=b.createContext({outlet:null,matches:[],isDataRoute:!1});so.displayName="Route";var AE=b.createContext(null);AE.displayName="RouteError";var DB="REACT_ROUTER_ERROR",JX="REDIRECT",eQ="ROUTE_ERROR_RESPONSE";function tQ(e){if(e.startsWith(`${DB}:${JX}:{`))try{let n=JSON.parse(e.slice(28));if(typeof n=="object"&&n&&typeof n.status=="number"&&typeof n.statusText=="string"&&typeof n.location=="string"&&typeof n.reloadDocument=="boolean"&&typeof n.replace=="boolean")return n}catch{}}function nQ(e){if(e.startsWith(`${DB}:${eQ}:{`))try{let n=JSON.parse(e.slice(40));if(typeof n=="object"&&n&&typeof n.status=="number"&&typeof n.statusText=="string")return new KX(n.status,n.statusText,n.data)}catch{}}function rQ(e,{relative:n}={}){xr(op(),"useHref() may be used only in the context of a <Router> component.");let{basename:r,navigator:i}=b.useContext(sa),{hash:s,pathname:a,search:o}=yv(e,{relative:n}),l=a;return r!=="/"&&(l=a==="/"?r:ql([r,a])),i.createHref({pathname:l,search:o,hash:s})}function op(){return b.useContext(gv)!=null}function aa(){return xr(op(),"useLocation() may be used only in the context of a <Router> component."),b.useContext(gv).location}var PB="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function LB(e){b.useContext(sa).static||b.useLayoutEffect(e)}function vv(){let{isDataRoute:e}=b.useContext(so);return e?yQ():iQ()}function iQ(){xr(op(),"useNavigate() may be used only in the context of a <Router> component.");let e=b.useContext(ap),{basename:n,navigator:r}=b.useContext(sa),{matches:i}=b.useContext(so),{pathname:s}=aa(),a=JSON.stringify(NE(i)),o=b.useRef(!1);return LB(()=>{o.current=!0}),b.useCallback((u,d={})=>{if(Oa(o.current,PB),!o.current)return;if(typeof u=="number"){r.go(u);return}let p=EE(u,JSON.parse(a),s,d.relative==="path");e==null&&n!=="/"&&(p.pathname=p.pathname==="/"?n:ql([n,p.pathname])),(d.replace?r.replace:r.push)(p,d.state,d)},[n,r,a,s,e])}var sQ=b.createContext(null);function aQ(e){let n=b.useContext(so).outlet;return b.useMemo(()=>n&&b.createElement(sQ.Provider,{value:e},n),[n,e])}function yv(e,{relative:n}={}){let{matches:r}=b.useContext(so),{pathname:i}=aa(),s=JSON.stringify(NE(r));return b.useMemo(()=>EE(e,JSON.parse(s),i,n==="path"),[e,s,i,n])}function oQ(e,n){return IB(e,n)}function IB(e,n,r,i,s){var j;xr(op(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:a}=b.useContext(sa),{matches:o}=b.useContext(so),l=o[o.length-1],u=l?l.params:{},d=l?l.pathname:"/",p=l?l.pathnameBase:"/",f=l&&l.route;{let C=f&&f.path||"";zB(d,!f||C.endsWith("*")||C.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${d}" (under <Route path="${C}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.

Please change the parent <Route path="${C}"> to <Route path="${C==="/"?"*":`${C}/*`}">.`)}let g=aa(),_;if(n){let C=typeof n=="string"?sp(n):n;xr(p==="/"||((j=C.pathname)==null?void 0:j.startsWith(p)),`When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${p}" but pathname "${C.pathname}" was given in the \`location\` prop.`),_=C}else _=g;let x=_.pathname||"/",v=x;if(p!=="/"){let C=p.replace(/^\//,"").split("/");v="/"+x.replace(/^\//,"").split("/").slice(C.length).join("/")}let S=NB(e,{pathname:v});Oa(f||S!=null,`No routes matched location "${_.pathname}${_.search}${_.hash}" `),Oa(S==null||S[S.length-1].route.element!==void 0||S[S.length-1].route.Component!==void 0||S[S.length-1].route.lazy!==void 0,`Matched leaf route at location "${_.pathname}${_.search}${_.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`);let w=hQ(S&&S.map(C=>Object.assign({},C,{params:Object.assign({},u,C.params),pathname:ql([p,a.encodeLocation?a.encodeLocation(C.pathname.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:C.pathname]),pathnameBase:C.pathnameBase==="/"?p:ql([p,a.encodeLocation?a.encodeLocation(C.pathnameBase.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:C.pathnameBase])})),o,r,i,s);return n&&w?b.createElement(gv.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",..._},navigationType:"POP"}},w):w}function lQ(){let e=vQ(),n=VX(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),r=e instanceof Error?e.stack:null,i="rgba(200,200,200, 0.5)",s={padding:"0.5rem",backgroundColor:i},a={padding:"2px 4px",backgroundColor:i},o=null;return console.error("Error handled by React Router default ErrorBoundary:",e),o=b.createElement(b.Fragment,null,b.createElement("p",null,"💿 Hey developer 👋"),b.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",b.createElement("code",{style:a},"ErrorBoundary")," or"," ",b.createElement("code",{style:a},"errorElement")," prop on your route.")),b.createElement(b.Fragment,null,b.createElement("h2",null,"Unexpected Application Error!"),b.createElement("h3",{style:{fontStyle:"italic"}},n),r?b.createElement("pre",{style:s},r):null,o)}var cQ=b.createElement(lQ,null),BB=class extends b.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,n){return n.location!==e.location||n.revalidation!=="idle"&&e.revalidation==="idle"?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error!==void 0?e.error:n.error,location:n.location,revalidation:e.revalidation||n.revalidation}}componentDidCatch(e,n){this.props.onError?this.props.onError(e,n):console.error("React Router caught the following error during render",e)}render(){let e=this.state.error;if(this.context&&typeof e=="object"&&e&&"digest"in e&&typeof e.digest=="string"){const r=nQ(e.digest);r&&(e=r)}let n=e!==void 0?b.createElement(so.Provider,{value:this.props.routeContext},b.createElement(AE.Provider,{value:e,children:this.props.component})):this.props.children;return this.context?b.createElement(uQ,{error:e},n):n}};BB.contextType=XX;var Ow=new WeakMap;function uQ({children:e,error:n}){let{basename:r}=b.useContext(sa);if(typeof n=="object"&&n&&"digest"in n&&typeof n.digest=="string"){let i=tQ(n.digest);if(i){let s=Ow.get(n);if(s)throw s;let a=MB(i.location,r);if(TB&&!Ow.get(n))if(a.isExternal||i.reloadDocument)window.location.href=a.absoluteURL||a.to;else{const o=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(a.to,{replace:i.replace}));throw Ow.set(n,o),o}return b.createElement("meta",{httpEquiv:"refresh",content:`0;url=${a.absoluteURL||a.to}`})}}return e}function dQ({routeContext:e,match:n,children:r}){let i=b.useContext(ap);return i&&i.static&&i.staticContext&&(n.route.errorElement||n.route.ErrorBoundary)&&(i.staticContext._deepestRenderedBoundaryId=n.route.id),b.createElement(so.Provider,{value:e},r)}function hQ(e,n=[],r=null,i=null,s=null){if(e==null){if(!r)return null;if(r.errors)e=r.matches;else if(n.length===0&&!r.initialized&&r.matches.length>0)e=r.matches;else return null}let a=e,o=r==null?void 0:r.errors;if(o!=null){let p=a.findIndex(f=>f.route.id&&(o==null?void 0:o[f.route.id])!==void 0);xr(p>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(o).join(",")}`),a=a.slice(0,Math.min(a.length,p+1))}let l=!1,u=-1;if(r)for(let p=0;p<a.length;p++){let f=a[p];if((f.route.HydrateFallback||f.route.hydrateFallbackElement)&&(u=p),f.route.id){let{loaderData:g,errors:_}=r,x=f.route.loader&&!g.hasOwnProperty(f.route.id)&&(!_||_[f.route.id]===void 0);if(f.route.lazy||x){l=!0,u>=0?a=a.slice(0,u+1):a=[a[0]];break}}}let d=r&&i?(p,f)=>{var g,_;i(p,{location:r.location,params:((_=(g=r.matches)==null?void 0:g[0])==null?void 0:_.params)??{},unstable_pattern:YX(r.matches),errorInfo:f})}:void 0;return a.reduceRight((p,f,g)=>{let _,x=!1,v=null,S=null;r&&(_=o&&f.route.id?o[f.route.id]:void 0,v=f.route.errorElement||cQ,l&&(u<0&&g===0?(zB("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),x=!0,S=null):u===g&&(x=!0,S=f.route.hydrateFallbackElement||null)));let w=n.concat(a.slice(0,g+1)),j=()=>{let C;return _?C=v:x?C=S:f.route.Component?C=b.createElement(f.route.Component,null):f.route.element?C=f.route.element:C=p,b.createElement(dQ,{match:f,routeContext:{outlet:p,matches:w,isDataRoute:r!=null},children:C})};return r&&(f.route.ErrorBoundary||f.route.errorElement||g===0)?b.createElement(BB,{location:r.location,revalidation:r.revalidation,component:v,error:_,children:j(),routeContext:{outlet:null,matches:w,isDataRoute:!0},onError:d}):j()},null)}function TE(e){return`${e} must be used within a data router.  See https://reactrouter.com/en/main/routers/picking-a-router.`}function fQ(e){let n=b.useContext(ap);return xr(n,TE(e)),n}function pQ(e){let n=b.useContext(y0);return xr(n,TE(e)),n}function mQ(e){let n=b.useContext(so);return xr(n,TE(e)),n}function ME(e){let n=mQ(e),r=n.matches[n.matches.length-1];return xr(r.route.id,`${e} can only be used on routes that contain a unique "id"`),r.route.id}function gQ(){return ME("useRouteId")}function vQ(){var i;let e=b.useContext(AE),n=pQ("useRouteError"),r=ME("useRouteError");return e!==void 0?e:(i=n.errors)==null?void 0:i[r]}function yQ(){let{router:e}=fQ("useNavigate"),n=ME("useNavigate"),r=b.useRef(!1);return LB(()=>{r.current=!0}),b.useCallback(async(s,a={})=>{Oa(r.current,PB),r.current&&(typeof s=="number"?await e.navigate(s):await e.navigate(s,{fromRouteId:n,...a}))},[e,n])}var eO={};function zB(e,n,r){!n&&!eO[e]&&(eO[e]=!0,Oa(!1,r))}b.memo(_Q);function _Q({routes:e,future:n,state:r,onError:i}){return IB(e,void 0,r,i,n)}function tO({to:e,replace:n,state:r,relative:i}){xr(op(),"<Navigate> may be used only in the context of a <Router> component.");let{static:s}=b.useContext(sa);Oa(!s,"<Navigate> must not be used on the initial render in a <StaticRouter>. This is a no-op, but you should modify your code so the <Navigate> is only ever rendered in response to some user interaction or state change.");let{matches:a}=b.useContext(so),{pathname:o}=aa(),l=vv(),u=EE(e,NE(a),o,i==="path"),d=JSON.stringify(u);return b.useEffect(()=>{l(JSON.parse(d),{replace:n,state:r,relative:i})},[l,d,i,n,r]),null}function xQ(e){return aQ(e.context)}function gr(e){xr(!1,"A <Route> is only ever to be used as the child of <Routes> element, never rendered directly. Please wrap your <Route> in a <Routes>.")}function bQ({basename:e="/",children:n=null,location:r,navigationType:i="POP",navigator:s,static:a=!1,unstable_useTransitions:o}){xr(!op(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let l=e.replace(/^\/*/,"/"),u=b.useMemo(()=>({basename:l,navigator:s,static:a,unstable_useTransitions:o,future:{}}),[l,s,a,o]);typeof r=="string"&&(r=sp(r));let{pathname:d="/",search:p="",hash:f="",state:g=null,key:_="default"}=r,x=b.useMemo(()=>{let v=Gl(d,l);return v==null?null:{location:{pathname:v,search:p,hash:f,state:g,key:_},navigationType:i}},[l,d,p,f,g,_,i]);return Oa(x!=null,`<Router basename="${l}"> is not able to match the URL "${d}${p}${f}" because it does not start with the basename, so the <Router> won't render anything.`),x==null?null:b.createElement(sa.Provider,{value:u},b.createElement(gv.Provider,{children:n,value:x}))}function nO({children:e,location:n}){return oQ(CC(e),n)}function CC(e,n=[]){let r=[];return b.Children.forEach(e,(i,s)=>{if(!b.isValidElement(i))return;let a=[...n,s];if(i.type===b.Fragment){r.push.apply(r,CC(i.props.children,a));return}xr(i.type===gr,`[${typeof i.type=="string"?i.type:i.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),xr(!i.props.index||!i.props.children,"An index route cannot have child routes.");let o={id:i.props.id||a.join("-"),caseSensitive:i.props.caseSensitive,element:i.props.element,Component:i.props.Component,index:i.props.index,path:i.props.path,middleware:i.props.middleware,loader:i.props.loader,action:i.props.action,hydrateFallbackElement:i.props.hydrateFallbackElement,HydrateFallback:i.props.HydrateFallback,errorElement:i.props.errorElement,ErrorBoundary:i.props.ErrorBoundary,hasErrorBoundary:i.props.hasErrorBoundary===!0||i.props.ErrorBoundary!=null||i.props.errorElement!=null,shouldRevalidate:i.props.shouldRevalidate,handle:i.props.handle,lazy:i.props.lazy};i.props.children&&(o.children=CC(i.props.children,a)),r.push(o)}),r}var gx="get",vx="application/x-www-form-urlencoded";function _0(e){return typeof HTMLElement<"u"&&e instanceof HTMLElement}function kQ(e){return _0(e)&&e.tagName.toLowerCase()==="button"}function wQ(e){return _0(e)&&e.tagName.toLowerCase()==="form"}function SQ(e){return _0(e)&&e.tagName.toLowerCase()==="input"}function CQ(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function jQ(e,n){return e.button===0&&(!n||n==="_self")&&!CQ(e)}function jC(e=""){return new URLSearchParams(typeof e=="string"||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((n,r)=>{let i=e[r];return n.concat(Array.isArray(i)?i.map(s=>[r,s]):[[r,i]])},[]))}function NQ(e,n){let r=jC(e);return n&&n.forEach((i,s)=>{r.has(s)||n.getAll(s).forEach(a=>{r.append(s,a)})}),r}var a_=null;function EQ(){if(a_===null)try{new FormData(document.createElement("form"),0),a_=!1}catch{a_=!0}return a_}var AQ=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function Dw(e){return e!=null&&!AQ.has(e)?(Oa(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${vx}"`),null):e}function TQ(e,n){let r,i,s,a,o;if(wQ(e)){let l=e.getAttribute("action");i=l?Gl(l,n):null,r=e.getAttribute("method")||gx,s=Dw(e.getAttribute("enctype"))||vx,a=new FormData(e)}else if(kQ(e)||SQ(e)&&(e.type==="submit"||e.type==="image")){let l=e.form;if(l==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let u=e.getAttribute("formaction")||l.getAttribute("action");if(i=u?Gl(u,n):null,r=e.getAttribute("formmethod")||l.getAttribute("method")||gx,s=Dw(e.getAttribute("formenctype"))||Dw(l.getAttribute("enctype"))||vx,a=new FormData(l,e),!EQ()){let{name:d,type:p,value:f}=e;if(p==="image"){let g=d?`${d}.`:"";a.append(`${g}x`,"0"),a.append(`${g}y`,"0")}else d&&a.append(d,f)}}else{if(_0(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');r=gx,i=null,s=vx,o=e}return a&&s==="text/plain"&&(o=a,a=void 0),{action:i,method:r.toLowerCase(),encType:s,formData:a,body:o}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function RE(e,n){if(e===!1||e===null||typeof e>"u")throw new Error(n)}function MQ(e,n,r,i){let s=typeof e=="string"?new URL(e,typeof window>"u"?"server://singlefetch/":window.location.origin):e;return r?s.pathname.endsWith("/")?s.pathname=`${s.pathname}_.${i}`:s.pathname=`${s.pathname}.${i}`:s.pathname==="/"?s.pathname=`_root.${i}`:n&&Gl(s.pathname,n)==="/"?s.pathname=`${n.replace(/\/$/,"")}/_root.${i}`:s.pathname=`${s.pathname.replace(/\/$/,"")}.${i}`,s}async function RQ(e,n){if(e.id in n)return n[e.id];try{let r=await import(e.module);return n[e.id]=r,r}catch(r){return console.error(`Error loading route module \`${e.module}\`, reloading page...`),console.error(r),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function OQ(e){return e==null?!1:e.href==null?e.rel==="preload"&&typeof e.imageSrcSet=="string"&&typeof e.imageSizes=="string":typeof e.rel=="string"&&typeof e.href=="string"}async function DQ(e,n,r){let i=await Promise.all(e.map(async s=>{let a=n.routes[s.route.id];if(a){let o=await RQ(a,r);return o.links?o.links():[]}return[]}));return BQ(i.flat(1).filter(OQ).filter(s=>s.rel==="stylesheet"||s.rel==="preload").map(s=>s.rel==="stylesheet"?{...s,rel:"prefetch",as:"style"}:{...s,rel:"prefetch"}))}function rO(e,n,r,i,s,a){let o=(u,d)=>r[d]?u.route.id!==r[d].route.id:!0,l=(u,d)=>{var p;return r[d].pathname!==u.pathname||((p=r[d].route.path)==null?void 0:p.endsWith("*"))&&r[d].params["*"]!==u.params["*"]};return a==="assets"?n.filter((u,d)=>o(u,d)||l(u,d)):a==="data"?n.filter((u,d)=>{var f;let p=i.routes[u.route.id];if(!p||!p.hasLoader)return!1;if(o(u,d)||l(u,d))return!0;if(u.route.shouldRevalidate){let g=u.route.shouldRevalidate({currentUrl:new URL(s.pathname+s.search+s.hash,window.origin),currentParams:((f=r[0])==null?void 0:f.params)||{},nextUrl:new URL(e,window.origin),nextParams:u.params,defaultShouldRevalidate:!0});if(typeof g=="boolean")return g}return!0}):[]}function PQ(e,n,{includeHydrateFallback:r}={}){return LQ(e.map(i=>{let s=n.routes[i.route.id];if(!s)return[];let a=[s.module];return s.clientActionModule&&(a=a.concat(s.clientActionModule)),s.clientLoaderModule&&(a=a.concat(s.clientLoaderModule)),r&&s.hydrateFallbackModule&&(a=a.concat(s.hydrateFallbackModule)),s.imports&&(a=a.concat(s.imports)),a}).flat(1))}function LQ(e){return[...new Set(e)]}function IQ(e){let n={},r=Object.keys(e).sort();for(let i of r)n[i]=e[i];return n}function BQ(e,n){let r=new Set;return new Set(n),e.reduce((i,s)=>{let a=JSON.stringify(IQ(s));return r.has(a)||(r.add(a),i.push({key:a,link:s})),i},[])}function $B(){let e=b.useContext(ap);return RE(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}function zQ(){let e=b.useContext(y0);return RE(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}var OE=b.createContext(void 0);OE.displayName="FrameworkContext";function FB(){let e=b.useContext(OE);return RE(e,"You must render this element inside a <HydratedRouter> element"),e}function $Q(e,n){let r=b.useContext(OE),[i,s]=b.useState(!1),[a,o]=b.useState(!1),{onFocus:l,onBlur:u,onMouseEnter:d,onMouseLeave:p,onTouchStart:f}=n,g=b.useRef(null);b.useEffect(()=>{if(e==="render"&&o(!0),e==="viewport"){let v=w=>{w.forEach(j=>{o(j.isIntersecting)})},S=new IntersectionObserver(v,{threshold:.5});return g.current&&S.observe(g.current),()=>{S.disconnect()}}},[e]),b.useEffect(()=>{if(i){let v=setTimeout(()=>{o(!0)},100);return()=>{clearTimeout(v)}}},[i]);let _=()=>{s(!0)},x=()=>{s(!1),o(!1)};return r?e!=="intent"?[a,g,{}]:[a,g,{onFocus:sm(l,_),onBlur:sm(u,x),onMouseEnter:sm(d,_),onMouseLeave:sm(p,x),onTouchStart:sm(f,_)}]:[!1,g,{}]}function sm(e,n){return r=>{e&&e(r),r.defaultPrevented||n(r)}}function FQ({page:e,...n}){let{router:r}=$B(),i=b.useMemo(()=>NB(r.routes,e,r.basename),[r.routes,e,r.basename]);return i?b.createElement(WQ,{page:e,matches:i,...n}):null}function HQ(e){let{manifest:n,routeModules:r}=FB(),[i,s]=b.useState([]);return b.useEffect(()=>{let a=!1;return DQ(e,n,r).then(o=>{a||s(o)}),()=>{a=!0}},[e,n,r]),i}function WQ({page:e,matches:n,...r}){let i=aa(),{future:s,manifest:a,routeModules:o}=FB(),{basename:l}=$B(),{loaderData:u,matches:d}=zQ(),p=b.useMemo(()=>rO(e,n,d,a,i,"data"),[e,n,d,a,i]),f=b.useMemo(()=>rO(e,n,d,a,i,"assets"),[e,n,d,a,i]),g=b.useMemo(()=>{if(e===i.pathname+i.search+i.hash)return[];let v=new Set,S=!1;if(n.forEach(j=>{var T;let C=a.routes[j.route.id];!C||!C.hasLoader||(!p.some(E=>E.route.id===j.route.id)&&j.route.id in u&&((T=o[j.route.id])!=null&&T.shouldRevalidate)||C.hasClientLoader?S=!0:v.add(j.route.id))}),v.size===0)return[];let w=MQ(e,l,s.unstable_trailingSlashAwareDataRequests,"data");return S&&v.size>0&&w.searchParams.set("_routes",n.filter(j=>v.has(j.route.id)).map(j=>j.route.id).join(",")),[w.pathname+w.search]},[l,s.unstable_trailingSlashAwareDataRequests,u,i,a,p,n,e,o]),_=b.useMemo(()=>PQ(f,a),[f,a]),x=HQ(f);return b.createElement(b.Fragment,null,g.map(v=>b.createElement("link",{key:v,rel:"prefetch",as:"fetch",href:v,...r})),_.map(v=>b.createElement("link",{key:v,rel:"modulepreload",href:v,...r})),x.map(({key:v,link:S})=>b.createElement("link",{key:v,nonce:r.nonce,...S,crossOrigin:S.crossOrigin??r.crossOrigin})))}function qQ(...e){return n=>{e.forEach(r=>{typeof r=="function"?r(n):r!=null&&(r.current=n)})}}var UQ=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{UQ&&(window.__reactRouterVersion="7.13.0")}catch{}function KQ({basename:e,children:n,unstable_useTransitions:r,window:i}){let s=b.useRef();s.current==null&&(s.current=wX({window:i,v5Compat:!0}));let a=s.current,[o,l]=b.useState({action:a.action,location:a.location}),u=b.useCallback(d=>{r===!1?l(d):b.startTransition(()=>l(d))},[r]);return b.useLayoutEffect(()=>a.listen(u),[a,u]),b.createElement(bQ,{basename:e,children:n,location:o.location,navigationType:o.action,navigator:a,unstable_useTransitions:r})}var HB=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Ss=b.forwardRef(function({onClick:n,discover:r="render",prefetch:i="none",relative:s,reloadDocument:a,replace:o,state:l,target:u,to:d,preventScrollReset:p,viewTransition:f,unstable_defaultShouldRevalidate:g,..._},x){let{basename:v,unstable_useTransitions:S}=b.useContext(sa),w=typeof d=="string"&&HB.test(d),j=MB(d,v);d=j.to;let C=rQ(d,{relative:s}),[T,E,A]=$Q(i,_),O=GQ(d,{replace:o,state:l,target:u,preventScrollReset:p,relative:s,viewTransition:f,unstable_defaultShouldRevalidate:g,unstable_useTransitions:S});function F($){n&&n($),$.defaultPrevented||O($)}let L=b.createElement("a",{..._,...A,href:j.absoluteURL||C,onClick:j.isExternal||a?n:F,ref:qQ(x,E),target:u,"data-discover":!w&&r==="render"?"true":void 0});return T&&!w?b.createElement(b.Fragment,null,L,b.createElement(FQ,{page:C})):L});Ss.displayName="Link";var WB=b.forwardRef(function({"aria-current":n="page",caseSensitive:r=!1,className:i="",end:s=!1,style:a,to:o,viewTransition:l,children:u,...d},p){let f=yv(o,{relative:d.relative}),g=aa(),_=b.useContext(y0),{navigator:x,basename:v}=b.useContext(sa),S=_!=null&&eZ(f)&&l===!0,w=x.encodeLocation?x.encodeLocation(f).pathname:f.pathname,j=g.pathname,C=_&&_.navigation&&_.navigation.location?_.navigation.location.pathname:null;r||(j=j.toLowerCase(),C=C?C.toLowerCase():null,w=w.toLowerCase()),C&&v&&(C=Gl(C,v)||C);const T=w!=="/"&&w.endsWith("/")?w.length-1:w.length;let E=j===w||!s&&j.startsWith(w)&&j.charAt(T)==="/",A=C!=null&&(C===w||!s&&C.startsWith(w)&&C.charAt(w.length)==="/"),O={isActive:E,isPending:A,isTransitioning:S},F=E?n:void 0,L;typeof i=="function"?L=i(O):L=[i,E?"active":null,A?"pending":null,S?"transitioning":null].filter(Boolean).join(" ");let $=typeof a=="function"?a(O):a;return b.createElement(Ss,{...d,"aria-current":F,className:L,ref:p,style:$,to:o,viewTransition:l},typeof u=="function"?u(O):u)});WB.displayName="NavLink";var VQ=b.forwardRef(({discover:e="render",fetcherKey:n,navigate:r,reloadDocument:i,replace:s,state:a,method:o=gx,action:l,onSubmit:u,relative:d,preventScrollReset:p,viewTransition:f,unstable_defaultShouldRevalidate:g,..._},x)=>{let{unstable_useTransitions:v}=b.useContext(sa),S=ZQ(),w=JQ(l,{relative:d}),j=o.toLowerCase()==="get"?"get":"post",C=typeof l=="string"&&HB.test(l),T=E=>{if(u&&u(E),E.defaultPrevented)return;E.preventDefault();let A=E.nativeEvent.submitter,O=(A==null?void 0:A.getAttribute("formmethod"))||o,F=()=>S(A||E.currentTarget,{fetcherKey:n,method:O,navigate:r,replace:s,state:a,relative:d,preventScrollReset:p,viewTransition:f,unstable_defaultShouldRevalidate:g});v&&r!==!1?b.startTransition(()=>F()):F()};return b.createElement("form",{ref:x,method:j,action:w,onSubmit:i?u:T,..._,"data-discover":!C&&e==="render"?"true":void 0})});VQ.displayName="Form";function YQ(e){return`${e} must be used within a data router.  See https://reactrouter.com/en/main/routers/picking-a-router.`}function qB(e){let n=b.useContext(ap);return xr(n,YQ(e)),n}function GQ(e,{target:n,replace:r,state:i,preventScrollReset:s,relative:a,viewTransition:o,unstable_defaultShouldRevalidate:l,unstable_useTransitions:u}={}){let d=vv(),p=aa(),f=yv(e,{relative:a});return b.useCallback(g=>{if(jQ(g,n)){g.preventDefault();let _=r!==void 0?r:jg(p)===jg(f),x=()=>d(e,{replace:_,state:i,preventScrollReset:s,relative:a,viewTransition:o,unstable_defaultShouldRevalidate:l});u?b.startTransition(()=>x()):x()}},[p,d,f,r,i,n,e,s,a,o,l,u])}function _v(e){Oa(typeof URLSearchParams<"u","You cannot use the `useSearchParams` hook in a browser that does not support the URLSearchParams API. If you need to support Internet Explorer 11, we recommend you load a polyfill such as https://github.com/ungap/url-search-params.");let n=b.useRef(jC(e)),r=b.useRef(!1),i=aa(),s=b.useMemo(()=>NQ(i.search,r.current?null:n.current),[i.search]),a=vv(),o=b.useCallback((l,u)=>{const d=jC(typeof l=="function"?l(new URLSearchParams(s)):l);r.current=!0,a("?"+d,u)},[a,s]);return[s,o]}var XQ=0,QQ=()=>`__${String(++XQ)}__`;function ZQ(){let{router:e}=qB("useSubmit"),{basename:n}=b.useContext(sa),r=gQ(),i=e.fetch,s=e.navigate;return b.useCallback(async(a,o={})=>{let{action:l,method:u,encType:d,formData:p,body:f}=TQ(a,n);if(o.navigate===!1){let g=o.fetcherKey||QQ();await i(g,r,o.action||l,{unstable_defaultShouldRevalidate:o.unstable_defaultShouldRevalidate,preventScrollReset:o.preventScrollReset,formData:p,body:f,formMethod:o.method||u,formEncType:o.encType||d,flushSync:o.flushSync})}else await s(o.action||l,{unstable_defaultShouldRevalidate:o.unstable_defaultShouldRevalidate,preventScrollReset:o.preventScrollReset,formData:p,body:f,formMethod:o.method||u,formEncType:o.encType||d,replace:o.replace,state:o.state,fromRouteId:r,flushSync:o.flushSync,viewTransition:o.viewTransition})},[i,s,n,r])}function JQ(e,{relative:n}={}){let{basename:r}=b.useContext(sa),i=b.useContext(so);xr(i,"useFormAction must be used inside a RouteContext");let[s]=i.matches.slice(-1),a={...yv(e||".",{relative:n})},o=aa();if(e==null){a.search=o.search;let l=new URLSearchParams(a.search),u=l.getAll("index");if(u.some(p=>p==="")){l.delete("index"),u.filter(f=>f).forEach(f=>l.append("index",f));let p=l.toString();a.search=p?`?${p}`:""}}return(!e||e===".")&&s.route.index&&(a.search=a.search?a.search.replace(/^\?/,"?index&"):"?index"),r!=="/"&&(a.pathname=a.pathname==="/"?r:ql([r,a.pathname])),jg(a)}function eZ(e,{relative:n}={}){let r=b.useContext(OB);xr(r!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`.  Did you accidentally import `RouterProvider` from `react-router`?");let{basename:i}=qB("useViewTransitionState"),s=yv(e,{relative:n});if(!r.isTransitioning)return!1;let a=Gl(r.currentLocation.pathname,i)||r.currentLocation.pathname,o=Gl(r.nextLocation.pathname,i)||r.nextLocation.pathname;return Xx(s.pathname,o)!=null||Xx(s.pathname,a)!=null}var oa=jB();const tZ=wu(oa),UB={system:'system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif',inter:'"Inter", system-ui, sans-serif',segoe:'"Segoe UI", system-ui, sans-serif',sf:'-apple-system, BlinkMacSystemFont, "SF Pro Text", sans-serif'},KB={jetbrains:'"JetBrains Mono", "Fira Code", "Cascadia Code", monospace',fira:'"Fira Code", "JetBrains Mono", "Cascadia Code", monospace',cascadia:'"Cascadia Code", "JetBrains Mono", "Fira Code", monospace',"system-mono":'ui-monospace, "SF Mono", "Cascadia Code", "Fira Code", monospace'},VB=b.createContext({theme:"dark",accent:"cyan",colorTheme:"default-dark",uiFont:"system",monoFont:"jetbrains",uiFontSize:15,monoFontSize:14,resolvedTheme:"dark",activeSkinId:null,activeSkinName:null,installedSkins:[],skinsLoading:!1,setTheme:()=>{},setAccent:()=>{},setColorTheme:()=>{},setUiFont:()=>{},setMonoFont:()=>{},setUiFontSize:()=>{},setMonoFontSize:()=>{},refreshSkins:async()=>{},setSkin:()=>{},importSkinZip:async()=>{throw new Error("Skin import unavailable")},deleteSkin:async()=>{},getSkinAsset:()=>null});function zi(e,n,r,i,s,a,o,l,u,d,p){const f=parseInt(d.slice(1,3),16),g=parseInt(d.slice(3,5),16),_=parseInt(d.slice(5,7),16);return{"--pc-bg-base":e,"--color-scheme":"dark","--pc-bg-surface":n,"--pc-bg-elevated":r,"--pc-bg-input":i,"--pc-bg-sidebar":`${e}f2`,"--pc-bg-code":s,"--pc-border":"rgba(255,255,255,0.08)","--pc-border-strong":"rgba(255,255,255,0.12)","--pc-text-primary":a,"--pc-text-secondary":o,"--pc-text-muted":l,"--pc-text-faint":u,"--pc-scrollbar-thumb":u,"--pc-scrollbar-track":n,"--pc-scrollbar-thumb-hover":l,"--pc-hover":"rgba(255,255,255,0.05)","--pc-hover-strong":"rgba(255,255,255,0.08)","--pc-separator":"rgba(255,255,255,0.05)","--pc-accent":d,"--pc-accent-light":p,"--pc-accent-dim":`rgba(${f},${g},${_},0.3)`,"--pc-accent-glow":`rgba(${f},${g},${_},0.1)`,"--pc-accent-rgb":`${f},${g},${_}`}}function Mc(e,n,r,i,s,a,o,l,u,d,p){const f=parseInt(d.slice(1,3),16),g=parseInt(d.slice(3,5),16),_=parseInt(d.slice(5,7),16);return{"--pc-bg-base":e,"--color-scheme":"light","--pc-bg-surface":n,"--pc-bg-elevated":r,"--pc-bg-input":i,"--pc-bg-sidebar":`${n}f2`,"--pc-bg-code":s,"--pc-border":"rgba(0,0,0,0.08)","--pc-border-strong":"rgba(0,0,0,0.12)","--pc-text-primary":a,"--pc-text-secondary":o,"--pc-text-muted":l,"--pc-text-faint":u,"--pc-scrollbar-thumb":l,"--pc-scrollbar-track":"transparent","--pc-scrollbar-thumb-hover":o,"--pc-hover":"rgba(0,0,0,0.04)","--pc-hover-strong":"rgba(0,0,0,0.07)","--pc-separator":"rgba(0,0,0,0.06)","--pc-accent":d,"--pc-accent-light":p,"--pc-accent-dim":`rgba(${f},${g},${_},0.25)`,"--pc-accent-glow":`rgba(${f},${g},${_},0.08)`,"--pc-accent-rgb":`${f},${g},${_}`}}const nZ=[{id:"default-dark",name:"Default Dark",scheme:"dark",preview:["#0b0d10","#6f83d6","#8fa8c8","#f6b44b","#f7f8fc"],vars:zi("#0b0d10","#13161d","#191f27","#10141a","#10141a","#f7f8fc","#c8ceda","#929bad","#687386","#6f83d6","#7c8ddd")},{id:"default-light",name:"Default Light",scheme:"light",preview:["#eef1f5","#596cc6","#4f75a8","#b86f00","#111827"],vars:Mc("#eef1f5","#f7f9fb","#e9edf3","#eef2f6","#e5eaf0","#111827","#334155","#64748b","#94a3b8","#596cc6","#6575d3")},{id:"oled-black",name:"OLED Black",scheme:"dark",preview:["#000000","#22d3ee","#8b5cf6","#10b981","#d4d4d8"],vars:zi("#000000","#0a0a0a","#141414","#0a0a0a","#0a0a0a","#d4d4d8","#a1a1aa","#71717a","#3f3f46","#22d3ee","#67e8f9")},{id:"nord-dark",name:"Nord Dark",scheme:"dark",preview:["#2e3440","#88c0d0","#81a1c1","#a3be8c","#eceff4"],vars:zi("#2e3440","#3b4252","#434c5e","#2e3440","#2e3440","#eceff4","#d8dee9","#7b88a1","#4c566a","#88c0d0","#8fbcbb")},{id:"nord-light",name:"Nord Light",scheme:"light",preview:["#eceff4","#5e81ac","#88c0d0","#a3be8c","#2e3440"],vars:Mc("#eceff4","#e5e9f0","#d8dee9","#e5e9f0","#e5e9f0","#2e3440","#3b4252","#4c566a","#7b88a1","#5e81ac","#81a1c1")},{id:"dracula",name:"Dracula",scheme:"dark",preview:["#282a36","#bd93f9","#ff79c6","#50fa7b","#f8f8f2"],vars:zi("#282a36","#21222c","#343746","#1e1f29","#1e1f29","#f8f8f2","#c0c0d0","#6272a4","#44475a","#bd93f9","#caa9fa")},{id:"monokai",name:"Monokai",scheme:"dark",preview:["#272822","#f92672","#a6e22e","#e6db74","#f8f8f2"],vars:zi("#272822","#2d2e27","#3e3d32","#1e1f1c","#1e1f1c","#f8f8f2","#c0c0b0","#75715e","#49483e","#f92672","#fd5fa0")},{id:"solarized-dark",name:"Solarized Dark",scheme:"dark",preview:["#002b36","#268bd2","#2aa198","#b58900","#839496"],vars:zi("#002b36","#073642","#0a4050","#002028","#002028","#839496","#93a1a1","#657b83","#586e75","#268bd2","#6cb6e8")},{id:"solarized-light",name:"Solarized Light",scheme:"light",preview:["#fdf6e3","#268bd2","#2aa198","#b58900","#073642"],vars:Mc("#fdf6e3","#eee8d5","#ddd6c1","#fdf6e3","#eee8d5","#073642","#586e75","#657b83","#93a1a1","#268bd2","#2aa198")},{id:"kanagawa-wave",name:"Kanagawa Wave",scheme:"dark",preview:["#1f1f28","#7e9cd8","#957fb8","#e6c384","#dcd7ba"],vars:zi("#1f1f28","#2a2a37","#363646","#16161d","#16161d","#dcd7ba","#c8c093","#727169","#54546d","#7e9cd8","#7fb4ca")},{id:"kanagawa-dragon",name:"Kanagawa Dragon",scheme:"dark",preview:["#181616","#8ba4b0","#a292a3","#c4b28a","#c5c9c5"],vars:zi("#181616","#201d1d","#2d2a2a","#12120f","#12120f","#c5c9c5","#a6a69c","#737c73","#625e5a","#8ba4b0","#9cabba")},{id:"kanagawa-lotus",name:"Kanagawa Lotus",scheme:"light",preview:["#f2ecbc","#4d699b","#b35b79","#836f4a","#1f1f28"],vars:Mc("#f2ecbc","#e7dba0","#d5cea3","#f2ecbc","#e7dba0","#1f1f28","#545464","#716e61","#8a8980","#4d699b","#6693bf")},{id:"rose-pine",name:"Rosé Pine",scheme:"dark",preview:["#191724","#ebbcba","#c4a7e7","#f6c177","#e0def4"],vars:zi("#191724","#1f1d2e","#26233a","#13111e","#13111e","#e0def4","#908caa","#6e6a86","#524f67","#ebbcba","#f2d5ce")},{id:"rose-pine-moon",name:"Rosé Pine Moon",scheme:"dark",preview:["#232136","#ea9a97","#c4a7e7","#f6c177","#e0def4"],vars:zi("#232136","#2a273f","#393552","#1b1930","#1b1930","#e0def4","#908caa","#6e6a86","#44415a","#ea9a97","#f0b8b6")},{id:"rose-pine-dawn",name:"Rosé Pine Dawn",scheme:"light",preview:["#faf4ed","#d7827e","#907aa9","#ea9d34","#575279"],vars:Mc("#faf4ed","#fffaf3","#f2e9de","#fffaf3","#f2e9de","#575279","#797593","#9893a5","#cecacd","#d7827e","#b4637a")},{id:"night-owl",name:"Night Owl",scheme:"dark",preview:["#011627","#82aaff","#c792ea","#addb67","#d6deeb"],vars:zi("#011627","#0b2942","#122d42","#010e1a","#010e1a","#d6deeb","#a7bbc7","#5f7e97","#37536b","#82aaff","#a0c4ff")},{id:"everforest-dark",name:"Everforest Dark",scheme:"dark",preview:["#2d353b","#a7c080","#83c092","#dbbc7f","#d3c6aa"],vars:zi("#2d353b","#343f44","#3d484d","#272e33","#272e33","#d3c6aa","#9da9a0","#7a8478","#56635f","#a7c080","#83c092")},{id:"everforest-light",name:"Everforest Light",scheme:"light",preview:["#fdf6e3","#8da101","#35a77c","#dfa000","#5c6a72"],vars:Mc("#fdf6e3","#f3ead3","#e9dfc4","#f3ead3","#eee8d5","#5c6a72","#708089","#829181","#a6b0a0","#8da101","#93b259")},{id:"cobalt2",name:"Cobalt2",scheme:"dark",preview:["#193549","#ffc600","#ff9d00","#80ffbb","#ffffff"],vars:zi("#193549","#1f4662","#234d6e","#0d2b3e","#0d2b3e","#ffffff","#a0c4d8","#507a8f","#305a6f","#ffc600","#ffd740")},{id:"flexoki-dark",name:"Flexoki Dark",scheme:"dark",preview:["#100f0f","#ce5d97","#879a39","#da702c","#cecdc3"],vars:zi("#100f0f","#1c1b1a","#282726","#100f0f","#1c1b1a","#cecdc3","#b7b5ac","#878580","#575653","#ce5d97","#d68fb2")},{id:"flexoki-light",name:"Flexoki Light",scheme:"light",preview:["#fffcf0","#ce5d97","#879a39","#da702c","#100f0f"],vars:Mc("#fffcf0","#f2f0e5","#e6e4d9","#fffcf0","#f2f0e5","#100f0f","#343331","#575653","#878580","#ce5d97","#a02f6f")},{id:"hacker-green",name:"Hacker Green",scheme:"dark",preview:["#0a0e0a","#00ff41","#00cc33","#008f11","#33ff66"],vars:zi("#0a0e0a","#0d120d","#121a12","#080c08","#080c08","#00ff41","#00cc33","#008f11","#005a0a","#00ff41","#33ff66")},{id:"material-dark",name:"Material Dark",scheme:"dark",preview:["#212121","#89ddff","#c792ea","#ffcb6b","#eeffff"],vars:zi("#212121","#292929","#333333","#1a1a1a","#1a1a1a","#eeffff","#b0bec5","#616161","#424242","#89ddff","#80cbc4")},{id:"material-light",name:"Material Light",scheme:"light",preview:["#fafafa","#6182b8","#7c4dff","#f76d47","#212121"],vars:Mc("#fafafa","#ffffff","#eaeaea","#ffffff","#f5f5f5","#212121","#424242","#757575","#bdbdbd","#6182b8","#7c4dff")}],nu=Object.fromEntries(nZ.map(e=>[e.id,e])),NC="default-dark",iO="default-light",YB="revka-theme",rZ="revka",Vu={theme:"dark",accent:"cyan",colorTheme:"default-dark",uiFont:"system",monoFont:"jetbrains",uiFontSize:15,monoFontSize:14,activeSkinId:rZ},iZ=["dark","light","oled","system"],sZ=["cyan","violet","emerald","amber","rose","blue"];function aZ(e){switch(e){case"light":return"default-light";case"oled":return"oled-black";default:return"default-dark"}}function oZ(){try{const e=localStorage.getItem(YB);if(e){const n=JSON.parse(e),r=iZ.includes(n.theme),i=sZ.includes(n.accent),s=UB[n.uiFont]?n.uiFont:Vu.uiFont,a=KB[n.monoFont]?n.monoFont:Vu.monoFont,o=Number.isFinite(n.uiFontSize)?Math.min(20,Math.max(12,Number(n.uiFontSize))):Vu.uiFontSize,l=Number.isFinite(n.monoFontSize)?Math.min(20,Math.max(12,Number(n.monoFontSize))):Vu.monoFontSize,u=Object.prototype.hasOwnProperty.call(n,"activeSkinId"),d=typeof n.activeSkinId=="string"&&n.activeSkinId.trim()?n.activeSkinId:u?null:Vu.activeSkinId;let p=Vu.colorTheme;if(n.colorTheme&&nu[n.colorTheme]?p=n.colorTheme:r&&(p=aZ(n.theme)),r&&i)return{theme:n.theme,accent:n.accent,colorTheme:p,uiFont:s,monoFont:a,uiFontSize:o,monoFontSize:l,activeSkinId:d}}}catch{}return Vu}const sO=new Set;function yf(e,n="400;500;600"){const r=`gfont-${e.replace(/\s+/g,"-").toLowerCase()}`;if(sO.has(r))return;sO.add(r);const i=document.createElement("link");i.id=r,i.rel="stylesheet",i.href=`https://fonts.googleapis.com/css2?family=${encodeURIComponent(e)}:wght@${n}&display=swap`,document.head.appendChild(i)}function aO(e){e==="inter"&&yf("Inter"),e==="segoe"&&yf("Segoe UI"),e==="sf"&&yf("SF Pro Text")}function oO(e){e==="jetbrains"&&yf("JetBrains Mono"),e==="fira"&&yf("Fira Code"),e==="cascadia"&&yf("Cascadia Code")}const lZ=["brandLogo","operatorAvatar","dashboardHero","shellTexture","panelDecoration","pageBackdrop","sidebarBackdrop","headerBackdrop","dashboardShowcase","dashboardAccent","graphBackdrop","metricDecoration","runCardDecoration","stepCardDecoration","timelineDecoration","riskRailDecoration","agentRailDecoration","commandBandDecoration","recentRunsDecoration","statusRunningBadge","statusSuccessBadge","statusFailedBadge","statusPendingBadge","statusSkippedBadge"],Ng="revka_token",lO="revka_token";try{if(!localStorage.getItem(Ng)){const e=localStorage.getItem(lO);e&&(localStorage.setItem(Ng,e),localStorage.removeItem(lO))}}catch{}function os(){try{return localStorage.getItem(Ng)}catch{return null}}function GB(e){try{localStorage.setItem(Ng,e)}catch{}}function XB(){try{localStorage.removeItem(Ng)}catch{}}function Pw(){const e=os();return e!==null&&e.length>0}const lp=()=>"__TAURI__"in window,cZ=()=>window.__REVKA_GATEWAY__??"http://127.0.0.1:42617",Xr=lp()?"":(window.__REVKA_BASE__??"").replace(/\/+$/,""),Oi=lp()?cZ():"",uZ=`${Xr}/_app`;function fd(e){const n=e.replace(/^\/+/,""),r=uZ.replace(/\/+$/,"");return r?`${r}/${n}`:`/${n}`}function tg(e,n){const r=encodeURIComponent(e),i=n.replace(/^\/+/,"").replace(/^assets\//,"").split("/").map(s=>encodeURIComponent(s)).join("/");return`${Oi}${Xr}/api/skins/${r}/assets/${i}`}const cO="revka.editor.session_id";let Lw=null;function uO(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():`s-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,10)}`}function DE(){try{const e=sessionStorage.getItem(cO);if(e)return e;const n=uO();return sessionStorage.setItem(cO,n),n}catch{return Lw||(Lw=uO()),Lw}}const QB="X-Revka-Session";class Xl extends Error{constructor(r,i,s,a=null){super(i);$n(this,"status");$n(this,"body");$n(this,"errorCode");if(this.name="ApiError",this.status=r,this.body=s,a===null&&s&&typeof s=="object"){const o=s,l=o.error_code??o.code;this.errorCode=typeof l=="string"?l:null}else this.errorCode=a}}function dZ(e,n){if(n&&n.toLowerCase().startsWith("text/html"))return!0;const r=e.trimStart().slice(0,16).toLowerCase();return r.startsWith("<!doctype")||r.startsWith("<html")}function PE(e,n,r,i){let s=null;if(r)try{s=JSON.parse(r)}catch{s=r}const a=s&&typeof s=="object"&&"error"in s?String(s.error):null,o=dZ(r,i)?`Service temporarily unavailable (HTTP ${e})`:null,l=a||o||(r&&typeof s=="string"?r:null)||n||`API ${e}`;return new Xl(e,`API ${e}: ${l}`,s)}class hZ extends Error{constructor(){super("Unauthorized"),this.name="UnauthorizedError"}}async function Ye(e,n={}){const r=os(),i=new Headers(n.headers);r&&i.set("Authorization",`Bearer ${r}`),n.body&&typeof n.body=="string"&&!i.has("Content-Type")&&i.set("Content-Type","application/json");const s=await fetch(`${Oi}${Xr}${e}`,{...n,headers:i});if(s.status===401)throw XB(),window.dispatchEvent(new Event("revka-unauthorized")),new hZ;if(!s.ok){const a=await s.text().catch(()=>""),o=s.headers.get("content-type");throw PE(s.status,s.statusText,a,o)}if(s.status!==204)return s.json()}function In(e,n){if(e!==null&&typeof e=="object"&&!Array.isArray(e)&&n in e){const r=e[n];if(r!==void 0)return r}return e}function bd(e){const n=e==null?void 0:e.trim();return n?n.slice(0,120):void 0}function fZ(){var i;if(typeof navigator>"u")return;const e=navigator,n=bd(((i=e.userAgentData)==null?void 0:i.platform)||e.platform);if(n)return n;const r=navigator.userAgent;if(/android/i.test(r))return"Android";if(/iphone|ipad/i.test(r))return"iOS";if(/windows/i.test(r))return"Windows";if(/macintosh|mac os/i.test(r))return"macOS";if(/linux/i.test(r))return"Linux"}function ZB(e){if(typeof navigator>"u")return{device_name:"Dashboard browser",device_type:e??"browser"};const n=navigator.userAgent,r=/android|iphone|ipad|mobile/i.test(n);return{device_name:r?"Dashboard mobile":"Dashboard browser",device_type:e??(r?"mobile":"browser"),hardware:fZ()}}function pZ(e){const n={},r=bd(e==null?void 0:e.device_name),i=bd(e==null?void 0:e.device_type),s=bd(e==null?void 0:e.hardware);return r&&(n["X-Revka-Device-Name"]=r),i&&(n["X-Revka-Device-Type"]=i),s&&(n["X-Revka-Device-Hardware"]=s),n}async function mZ(e,n=ZB()){const r=await fetch(`${Oi}${Xr}/pair`,{method:"POST",headers:{"X-Pairing-Code":e,...pZ(n)}});if(!r.ok){const s=await r.text().catch(()=>"");throw new Error(`Pairing failed (${r.status}): ${s||r.statusText}`)}const i=await r.json();return GB(i.token),i}async function gZ(e,n){const r=await fetch(`${Oi}${Xr}/api/pair`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:e,device_name:bd(n.device_name),device_type:bd(n.device_type),hardware:bd(n.hardware)})});if(!r.ok){const i=await r.text().catch(()=>""),s=r.headers.get("content-type");throw PE(r.status,r.statusText,i,s)}return r.json()}async function JB(){const e=await fetch(`${Xr}/pair/code`);if(e.ok)return e.json();const n=await fetch("/admin/paircode");if(!n.ok)throw new Error(`Failed to fetch pairing code (${n.status})`);return n.json()}async function vZ(){const e=await fetch(`${Xr}/health`);if(!e.ok)throw new Error(`Health check failed (${e.status})`);return e.json()}function yZ(){return Ye("/api/status")}function _Z(){return Ye("/api/config").then(e=>typeof e=="string"?e:e.content)}function xZ(e){return Ye("/api/config",{method:"PUT",headers:{"Content-Type":"application/toml"},body:e})}function bZ(){return Ye("/api/skins").then(e=>In(e,"skins"))}function kZ(e){return Ye("/api/skins/import",{method:"POST",headers:{"Content-Type":e.type||"application/zip"},body:e}).then(n=>In(n,"skin"))}function wZ(e){return Ye(`/api/skins/${encodeURIComponent(e)}`,{method:"DELETE"})}function SZ(){return Ye("/api/tools").then(e=>In(e,"tools"))}function CZ(){return Ye("/api/cron").then(e=>In(e,"jobs"))}function jZ(e){return Ye("/api/cron",{method:"POST",body:JSON.stringify(e)}).then(n=>typeof n.job=="object"?n.job:n)}function NZ(e){return Ye(`/api/cron/${encodeURIComponent(e)}`,{method:"DELETE"})}function EZ(e,n){return Ye(`/api/cron/${encodeURIComponent(e)}`,{method:"PATCH",body:JSON.stringify(n)}).then(r=>typeof r.job=="object"?r.job:r)}function AZ(e,n=20){const r=new URLSearchParams({limit:String(n)});return Ye(`/api/cron/${encodeURIComponent(e)}/runs?${r}`).then(i=>In(i,"runs"))}function TZ(){return Ye("/api/cron/settings")}function MZ(e){return Ye("/api/cron/settings",{method:"PATCH",body:JSON.stringify(e)})}function RZ(){return Ye("/api/integrations").then(e=>In(e,"integrations"))}function OZ(e){return Ye("/api/mcp/servers/test",{method:"POST",body:JSON.stringify(e)})}function DZ(){return Ye("/api/doctor",{method:"POST",body:JSON.stringify({})}).then(e=>Array.isArray(e)?e:e.results)}function ez(){return Ye("/api/cost").then(e=>In(e,"cost"))}function PZ(e){const n=new URLSearchParams;n.set("limit",String(e.limit)),e!=null&&e.event_type&&n.set("event_type",e.event_type),e!=null&&e.since&&n.set("since",e.since);const r=n.toString();return Ye(`/api/audit${r?`?${r}`:""}`)}function Qx(){return Ye("/api/audit/verify")}function tz(){return Ye("/api/sessions").then(e=>Array.isArray(e)?{sessions:e,archivedSessionIds:[]}:{sessions:e.sessions,archivedSessionIds:e.archived_session_ids??[]})}function LZ(){return tz().then(e=>e.sessions)}function IZ(e){return Ye(`/api/sessions/${encodeURIComponent(e)}/messages`)}function BZ(e){return Ye(`/api/sessions/${encodeURIComponent(e)}`,{method:"DELETE"})}function zZ(e,n){return Ye(`/api/sessions/${encodeURIComponent(e)}`,{method:"PUT",body:JSON.stringify({name:n})})}function $Z(e,n){const r=new FormData;return r.append("file",n,n.name),Ye(`/api/sessions/${encodeURIComponent(e)}/attachments`,{method:"POST",body:r})}function nz(){return Ye("/api/channels").then(e=>In(e,"channels"))}function FZ(){return Ye("/api/cli-tools").then(e=>In(e,"cli_tools"))}async function LE(e=!1,n=1,r=9){const i=new URLSearchParams;return e&&i.set("include_deprecated","true"),i.set("page",String(n)),i.set("per_page",String(r)),Ye(`/api/agents?${i}`)}async function rz(e){return Ye("/api/agents",{method:"POST",body:JSON.stringify(e)}).then(n=>In(n,"agent"))}async function HZ(e){const n=e.kref.replace(/^kref:\/\//,"");return Ye(`/api/agents/${n}`,{method:"PUT",body:JSON.stringify(e)}).then(r=>In(r,"agent"))}async function EC(e,n){const r=new FormData;return r.append("kref",e),r.append("file",n,n.name),Ye("/api/agents/avatar",{method:"POST",body:r}).then(i=>In(i,"agent"))}async function WZ(e,n){return Ye("/api/agents/deprecate",{method:"POST",body:JSON.stringify({kref:e,deprecated:n})}).then(r=>In(r,"agent"))}async function qZ(e){const n=e.replace(/^kref:\/\//,"");return Ye(`/api/agents/${n}`,{method:"DELETE"})}async function UZ(){return(await Ye("/api/auth/profiles")).profiles??[]}async function KZ(e){return Ye("/api/auth/profiles",{method:"POST",body:JSON.stringify(e)}).then(n=>In(n,"profile"))}async function VZ(e){return Ye(`/api/auth/profiles/${encodeURIComponent(e)}`,{method:"DELETE"})}async function YZ(){return Ye("/api/gcloud/configs")}async function GZ(e){return Ye("/api/gcloud/configs",{method:"POST",body:JSON.stringify(e)}).then(n=>In(n,"config"))}async function iz(e=!1,n=1,r=9){const i=new URLSearchParams;return e&&i.set("include_deprecated","true"),i.set("page",String(n)),i.set("per_page",String(r)),Ye(`/api/skills?${i}`)}async function XZ(e){const n=e.replace("kref://","");return Ye(`/api/skills/${n}`).then(r=>r.skill)}async function QZ(e){return Ye("/api/skills",{method:"POST",body:JSON.stringify(e)}).then(n=>In(n,"skill"))}async function ZZ(e){const n=e.kref.replace(/^kref:\/\//,"");return Ye(`/api/skills/${n}`,{method:"PUT",body:JSON.stringify(e)}).then(r=>In(r,"skill"))}async function JZ(e,n){return Ye("/api/skills/deprecate",{method:"POST",body:JSON.stringify({kref:e,deprecated:n})}).then(r=>In(r,"skill"))}async function eJ(e){const n=e.replace(/^kref:\/\//,"");return Ye(`/api/skills/${n}`,{method:"DELETE"})}function sz(e){return e.map(n=>{const r=n.skill??n,i=n.latestVersion??r.latestVersion??{},s=r.stats??n.stats??{};return{score:n.score??0,slug:r.slug??n.slug??"",displayName:r.displayName??r.name??n.displayName??n.name,name:r.name??r.displayName??n.name??n.displayName,description:r.description??r.summary??n.description??n.summary??"",version:i.version??r.version??n.version??"",downloads:s.downloads??s.installsAllTime??n.downloads,stars:s.stars??n.stars,verified:r.verified??n.verified,updatedAt:r.updatedAt??n.updatedAt}})}async function dO(e,n=20){const r=new URLSearchParams({q:e,limit:String(n)});return Ye(`/api/clawhub/search?${r}`).then(i=>{const s=Array.isArray(i)?i:(i==null?void 0:i.results)??(i==null?void 0:i.items)??[];return sz(s)})}async function tJ(e=20){const n=new URLSearchParams({limit:String(e)});return Ye(`/api/clawhub/trending?${n}`).then(r=>{const i=Array.isArray(r)?r:(r==null?void 0:r.results)??(r==null?void 0:r.items)??(r==null?void 0:r.skills)??[];return sz(i)})}async function hO(e){return Ye(`/api/clawhub/install/${encodeURIComponent(e)}`,{method:"POST"})}async function az(e=!1,n=!0){const r=new URLSearchParams;return e&&r.set("include_deprecated","true"),n||r.set("include_definition","false"),Ye(`/api/workflows?${r}`).then(i=>In(i,"workflows"))}async function nJ(e){return Ye("/api/workflows",{method:"POST",body:JSON.stringify(e),headers:{[QB]:DE()}}).then(n=>In(n,"workflow"))}async function rJ(e){const n=e.kref.replace(/^kref:\/\//,"");return Ye(`/api/workflows/${n}`,{method:"PUT",body:JSON.stringify(e),headers:{[QB]:DE()}}).then(r=>In(r,"workflow"))}async function iJ(e,n){return Ye("/api/workflows/deprecate",{method:"POST",body:JSON.stringify({kref:e,deprecated:n})}).then(r=>In(r,"workflow"))}async function sJ(e){const n=e.replace(/^kref:\/\//,"");return Ye(`/api/workflows/${n}`,{method:"DELETE"})}async function x0(e){const n=encodeURIComponent(e.replace(/^kref:\/\//,""));return Ye(`/api/workflows/revisions/${n}`).then(r=>In(r,"workflow"))}async function oz(e=20,n){const r=new URLSearchParams({limit:String(e)});return Ye(`/api/workflows/runs?${r}`).then(i=>In(i,"runs"))}async function aJ(e){return Ye(`/api/workflows/runs/${encodeURIComponent(e)}`,{method:"DELETE"})}async function Do(e){return Ye(`/api/workflows/runs/${encodeURIComponent(e)}`).then(n=>In(n,"run"))}async function oJ(e,n,r){return Ye(`/api/workflows/runs/${encodeURIComponent(e)}/approve`,{method:"POST",body:JSON.stringify({approved:n,feedback:r})})}async function lJ(e,n){return Ye(`/api/workflows/runs/${encodeURIComponent(e)}/retry`,{method:"POST",body:JSON.stringify({})})}async function cJ(e){return Ye(`/api/workflows/runs/${encodeURIComponent(e)}/cancel`,{method:"POST",body:JSON.stringify({})})}async function lz(e,n,r,i){const s={inputs:{}};return i!=null&&i.targetStepId&&(s.target_step_id=i.targetStepId),Ye(`/api/workflows/run/${encodeURIComponent(e)}`,{method:"POST",body:JSON.stringify(s)})}async function uJ(e){const n=new URLSearchParams({workflow_kref:e});return Ye(`/api/architect/revisions?${n}`)}async function dJ(e){return Ye("/api/architect/republish",{method:"POST",body:JSON.stringify({revision_kref:e})})}async function hJ(e){return Ye("/api/architect/validate_yaml",{method:"POST",body:JSON.stringify(e)})}async function fO(e,n="summary",r=100){return Ye(`/api/workflows/agent-activity/${encodeURIComponent(e)}?view=${n}&limit=${r}`)}async function fJ(e=!0){const n=new URLSearchParams;e||n.set("include_definition","false");const r=n.toString();return Ye(`/api/workflows/dashboard${r?`?${r}`:""}`).then(i=>In(i,"dashboard"))}async function pJ(e=!1,n=1,r=9){const i=new URLSearchParams;return e&&i.set("include_deprecated","true"),i.set("page",String(n)),i.set("per_page",String(r)),Ye(`/api/teams?${i}`)}async function pO(e){const n=e.replace(/^kref:\/\//,"");return Ye(`/api/teams/${n}`).then(r=>In(r,"team"))}async function mJ(e){return Ye("/api/teams",{method:"POST",body:JSON.stringify(e)}).then(n=>In(n,"team"))}async function gJ(e){const n=e.kref.replace(/^kref:\/\//,"");return Ye(`/api/teams/${n}`,{method:"PUT",body:JSON.stringify(e)}).then(r=>In(r,"team"))}async function mO(e,n){const r=new FormData;return r.append("kref",e),r.append("file",n,n.name),Ye("/api/teams/avatar",{method:"POST",body:r}).then(i=>In(i,"team"))}async function vJ(e,n){return Ye("/api/teams/deprecate",{method:"POST",body:JSON.stringify({kref:e,deprecated:n})})}async function yJ(e){const n=e.replace(/^kref:\/\//,"");return Ye(`/api/teams/${n}`,{method:"DELETE"})}async function _J(e){const n=new URLSearchParams;if(e)for(const[i,s]of Object.entries(e))s!=null&&s!==""&&n.set(i,String(s));const r=n.toString();return Ye(`/api/memory/graph${r?`?${r}`:""}`)}async function Ro(e,n){const r=new URLSearchParams;if(n)for(const[a,o]of Object.entries(n))o!=null&&o!==""&&r.set(a,String(o));const i=r.toString(),s=e.startsWith("/")?e.slice(1):e;return Ye(`/api/kumiho/${s}${i?`?${i}`:""}`)}async function xJ(e){return Ye("/api/assets/projects",{method:"POST",body:JSON.stringify(e)}).then(n=>n.project)}async function bJ(e){return Ye("/api/assets/spaces",{method:"POST",body:JSON.stringify(e)}).then(n=>n.space)}async function gO(e){return Ye("/api/assets/items",{method:"POST",body:JSON.stringify(e)}).then(n=>n.item)}async function Iw(e){return Ye("/api/assets/revisions",{method:"POST",body:JSON.stringify(e)}).then(n=>n.revision)}async function kJ(e){return Ye("/api/assets/bundles",{method:"POST",body:JSON.stringify(e)}).then(n=>n.bundle)}async function wJ(e,n){const r=new URLSearchParams({project:e});return n&&r.set("space_path",n),Ye(`/api/assets/bundles?${r.toString()}`).then(i=>i.bundles)}async function SJ(e){const n=new URLSearchParams({bundle_kref:e});return Ye(`/api/assets/bundles/members?${n.toString()}`)}async function CJ(e){await Ye("/api/assets/bundles/members",{method:"POST",body:JSON.stringify(e)})}async function jJ(e){await Ye("/api/assets/bundles/members",{method:"DELETE",body:JSON.stringify(e)})}async function Bw(e){return Ye("/api/assets/artifacts",{method:"POST",body:JSON.stringify(e)}).then(n=>n.artifact)}async function NJ(e){return Ye("/api/assets/edges",{method:"POST",body:JSON.stringify(e)}).then(n=>n.edge)}async function EJ(e,n){return Ye("/api/assets/revisions/tags",{method:"POST",body:JSON.stringify({kref:e,tag:n})}).then(r=>r.revision)}async function AJ(e,n){return Ye("/api/assets/revisions/tags",{method:"DELETE",body:JSON.stringify({kref:e,tag:n})}).then(r=>r.revision)}async function TJ(e){const n=new URLSearchParams;for(const[r,i]of Object.entries(e))i!=null&&i!==""&&n.set(r,String(i));return Ye(`/api/assets/dependency-graph?${n.toString()}`)}async function MJ(e,n){return Ye("/api/assets/items/deprecate",{method:"POST",body:JSON.stringify({kref:e,deprecated:n})}).then(r=>r.item)}async function RJ(e,n){return Ye("/api/assets/revisions/deprecate",{method:"POST",body:JSON.stringify({kref:e,deprecated:n})}).then(r=>r.revision)}async function OJ(e){return Ye("/api/assets/revisions/publish",{method:"POST",body:JSON.stringify({kref:e})}).then(n=>n.revision)}async function DJ(e,n){return Ye("/api/assets/artifacts/deprecate",{method:"POST",body:JSON.stringify({kref:e,deprecated:n})}).then(r=>r.artifact)}async function PJ(e,n,r){return Ye("/api/assets/artifacts/content",{method:"PUT",body:JSON.stringify({artifact_kref:e,revision_kref:n,content:r})})}async function LJ(e){const n=os(),r=new Headers;n&&r.set("Authorization",`Bearer ${n}`);const i=await fetch(`${Oi}${Xr}/api/artifact-body?location=${encodeURIComponent(e)}`,{headers:r});if(!i.ok){const s=await i.text().catch(()=>""),a=i.headers.get("content-type");throw PE(i.status,i.statusText,s,a)}return i.text()}const cz=b.createContext(null);function IJ({children:e}){const[n,r]=b.useState(os),[i,s]=b.useState(Pw),[a,o]=b.useState(!0),[l,u]=b.useState(!Pw());b.useEffect(()=>{if(Pw())return;let g=!1;return vZ().then(_=>{g||_.require_pairing||(o(!1),s(!0))}).catch(()=>{}).finally(()=>{g||u(!1)}),()=>{g=!0}},[]),b.useEffect(()=>{const g=_=>{if(_.key==="revka_token"){const x=os();r(x),s(x!==null&&x.length>0)}};return window.addEventListener("storage",g),()=>window.removeEventListener("storage",g)},[]);const d=b.useCallback(async g=>{const{token:_}=await mZ(g);GB(_),r(_),s(!0)},[]),p=b.useCallback(()=>{XB(),r(null),s(!1)},[]),f={token:n,isAuthenticated:i,requiresPairing:a,loading:l,pair:d,logout:p};return ip.createElement(cz.Provider,{value:f},e)}function uz(){const e=b.useContext(cz);if(!e)throw new Error("useAuth must be used within an <AuthProvider>");return e}const BJ={cyan:{"--pc-accent":"#8fa8c8","--pc-accent-light":"#a4bad6","--pc-accent-dim":"rgba(143,168,200,0.22)","--pc-accent-glow":"rgba(143,168,200,0.08)","--pc-accent-rgb":"143,168,200"},violet:{"--pc-accent":"#8b5cf6","--pc-accent-light":"#a78bfa","--pc-accent-dim":"rgba(139,92,246,0.3)","--pc-accent-glow":"rgba(139,92,246,0.1)","--pc-accent-rgb":"139,92,246"},emerald:{"--pc-accent":"#10b981","--pc-accent-light":"#34d399","--pc-accent-dim":"rgba(16,185,129,0.3)","--pc-accent-glow":"rgba(16,185,129,0.1)","--pc-accent-rgb":"16,185,129"},amber:{"--pc-accent":"#f59e0b","--pc-accent-light":"#fbbf24","--pc-accent-dim":"rgba(245,158,11,0.3)","--pc-accent-glow":"rgba(245,158,11,0.1)","--pc-accent-rgb":"245,158,11"},rose:{"--pc-accent":"#f43f5e","--pc-accent-light":"#fb7185","--pc-accent-dim":"rgba(244,63,94,0.3)","--pc-accent-glow":"rgba(244,63,94,0.1)","--pc-accent-rgb":"244,63,94"},blue:{"--pc-accent":"#6f83d6","--pc-accent-light":"#7c8ddd","--pc-accent-dim":"rgba(111,131,214,0.22)","--pc-accent-glow":"rgba(111,131,214,0.08)","--pc-accent-rgb":"111,131,214"}};function zJ(e){const n=document.documentElement;for(const[r,i]of Object.entries(e))r==="--color-scheme"?n.style.colorScheme=i:n.style.setProperty(r,i)}let vO=new Set;function $J(e){const n=document.documentElement;for(const r of vO)r in e||n.style.removeProperty(r);vO=new Set(Object.keys(e))}const FJ={"--revka-bg-base":["--pc-bg-base"],"--revka-bg-surface":["--pc-bg-surface"],"--revka-bg-elevated":["--pc-bg-elevated","--pc-bg-code"],"--revka-bg-input":["--pc-bg-input"],"--revka-bg-shell":["--pc-bg-sidebar"],"--revka-border-soft":["--pc-border"],"--revka-border-strong":["--pc-border-strong"],"--revka-text-primary":["--pc-text-primary"],"--revka-text-secondary":["--pc-text-secondary"],"--revka-text-muted":["--pc-text-muted"],"--revka-text-faint":["--pc-text-faint"],"--revka-signal-live":["--pc-accent"],"--revka-signal-selected":["--pc-accent-light"],"--revka-signal-live-soft":["--pc-accent-glow"],"--revka-signal-network-soft":["--pc-hover"],"--revka-border-neutral":["--pc-separator"]};function HJ(e){const n=e.trim().toLowerCase();if(!n.startsWith("#"))return null;const r=n.slice(1);if(r.length===3||r.length===4){const[i,s,a]=r.slice(0,3).split("").map(o=>parseInt(o+o,16));return[i,s,a].every(o=>Number.isFinite(o))?`${i}, ${s}, ${a}`:null}if(r.length===6||r.length===8){const i=parseInt(r.slice(0,2),16),s=parseInt(r.slice(2,4),16),a=parseInt(r.slice(4,6),16);return[i,s,a].every(o=>Number.isFinite(o))?`${i}, ${s}, ${a}`:null}return null}function WJ(e){const n={};for(const[i,s]of Object.entries(FJ)){const a=e[i];if(a)for(const o of s)n[o]=a}const r=e["--revka-signal-live"];if(r){const i=HJ(r);i&&(n["--pc-accent-rgb"]=i),n["--pc-accent-dim"]=`color-mix(in srgb, ${r} 30%, transparent)`,n["--pc-accent-glow"]=e["--revka-signal-live-soft"]??`color-mix(in srgb, ${r} 12%, transparent)`,n["--pc-accent-glow-strong"]=`color-mix(in srgb, ${r} 22%, transparent)`}return n}function dz(e,n){if(e==="system"){const r=window.matchMedia("(prefers-color-scheme: light)").matches,i=nu[n];return i&&(r&&i.scheme==="light"||!r&&i.scheme==="dark")?n:r?iO:NC}if(e==="oled")return"oled-black";if(e==="light"){const r=nu[n];return(r==null?void 0:r.scheme)==="light"?n:iO}if(e==="dark"){const r=nu[n];return(r==null?void 0:r.scheme)==="dark"?n:NC}return n}function yO(e,n){if(e==="oled")return"oled";if(e==="light"||e==="dark")return e;const r=dz(e,n),i=nu[r];return(i==null?void 0:i.scheme)??"dark"}function qJ(e,n,r,i){return{"--pc-font-ui":UB[e],"--pc-font-mono":KB[n],"--pc-font-size":`${r}px`,"--pc-font-size-mono":`${i}px`}}function hz(e,n){return e?(n==="light"?e.manifest.modes.light:e.manifest.modes.dark)??e.manifest.modes.dark??e.manifest.modes.light??null:null}function UJ(e){return`url("${e.replace(/"/g,"%22")}")`}function KJ(e,n){const r={};for(const i of lZ){const s=n[i];r[`--revka-skin-${i}`]=s&&e?UJ(tg(e.id,s)):"none"}return r}function VJ(e){const n={},r=e["--revka-bg-base"],i=e["--revka-bg-surface"],s=e["--revka-bg-panel"],a=e["--revka-bg-panel-strong"],o=e["--revka-border-soft"],l=e["--revka-signal-live"],u=e["--revka-signal-network"],d=e["--revka-signal-selected"]??l,p=a??i??s,f=e["--revka-status-success"]??d??l;if(p&&!e["--revka-bg-input"]&&(n["--revka-bg-input"]=`color-mix(in srgb, ${p} 88%, ${r??"black"})`),(o||d)&&!e["--revka-border-neutral"]){const g=d?`color-mix(in srgb, ${d} 18%, ${o??"transparent"})`:o;g&&(n["--revka-border-neutral"]=g)}return l&&!e["--revka-signal-live-soft"]&&(n["--revka-signal-live-soft"]=`color-mix(in srgb, ${l} 16%, transparent)`),u&&!e["--revka-signal-network-soft"]&&(n["--revka-signal-network-soft"]=`color-mix(in srgb, ${u} 14%, transparent)`),d&&!e["--revka-signal-selected-soft"]&&(n["--revka-signal-selected-soft"]=`color-mix(in srgb, ${d} 18%, transparent)`),d&&!e["--revka-hover-surface"]&&(n["--revka-hover-surface"]=`color-mix(in srgb, ${d} 10%, var(--revka-bg-surface))`),f&&!e["--revka-status-success"]&&(n["--revka-status-success"]=f),f&&!e["--revka-status-ok"]&&(n["--revka-status-ok"]=f),e["--revka-status-danger"]&&!e["--revka-status-error"]&&(n["--revka-status-error"]=e["--revka-status-danger"]),n}function YJ(e,n){const r=hz(e,n),i=(r==null?void 0:r.tokens)??{},s={...VJ(i),...i},a=(r==null?void 0:r.assets)??{};return{...s,...WJ(s),...KJ(e,a)}}function GJ({children:e}){const{isAuthenticated:n,loading:r}=uz(),[i]=b.useState(oZ),[s,a]=b.useState(i.theme),[o,l]=b.useState(i.accent),[u,d]=b.useState(i.colorTheme),[p,f]=b.useState(i.uiFont),[g,_]=b.useState(i.monoFont),[x,v]=b.useState(i.uiFontSize),[S,w]=b.useState(i.monoFontSize),[j,C]=b.useState(i.activeSkinId),[T,E]=b.useState([]),[A,O]=b.useState(!1),F=b.useCallback(G=>{localStorage.setItem(YB,JSON.stringify({theme:G.theme,accent:G.accent,colorTheme:G.colorTheme,uiFont:G.uiFont,monoFont:G.monoFont,uiFontSize:G.uiFontSize,monoFontSize:G.monoFontSize,activeSkinId:G.activeSkinId}))},[]),L=b.useCallback(G=>{const re=dz(G.theme,G.colorTheme),ne=nu[re],le=(ne==null?void 0:ne.vars)??nu[NC].vars,oe=yO(G.theme,G.colorTheme),ie=T.find(Z=>Z.id===G.activeSkinId)??null,he=YJ(ie,oe);document.documentElement.dataset.revkaSkin=(ie==null?void 0:ie.id)??G.activeSkinId??"none",$J(he),zJ({...le,...BJ[G.accent],...qJ(G.uiFont,G.monoFont,G.uiFontSize,G.monoFontSize),...he})},[T]),$=b.useCallback(G=>{a(G);const re={theme:G,accent:o,colorTheme:u,uiFont:p,monoFont:g,uiFontSize:x,monoFontSize:S,activeSkinId:j};L(re),F(re)},[o,u,p,g,x,S,j,L,F]),z=b.useCallback(G=>{l(G);const re={theme:s,accent:G,colorTheme:u,uiFont:p,monoFont:g,uiFontSize:x,monoFontSize:S,activeSkinId:j};L(re),F(re)},[s,u,p,g,x,S,j,L,F]),B=b.useCallback(G=>{d(G);const re=nu[G];let ne=s;re&&s!=="system"&&(G==="oled-black"?ne="oled":ne=re.scheme,a(ne));const le={theme:ne,accent:o,colorTheme:G,uiFont:p,monoFont:g,uiFontSize:x,monoFontSize:S,activeSkinId:j};L(le),F(le)},[s,o,p,g,x,S,j,L,F]),H=b.useCallback(G=>{f(G),aO(G);const re={theme:s,accent:o,colorTheme:u,uiFont:G,monoFont:g,uiFontSize:x,monoFontSize:S,activeSkinId:j};L(re),F(re)},[s,o,u,j,L,F,g,x,S]),D=b.useCallback(G=>{_(G),oO(G);const re={theme:s,accent:o,colorTheme:u,uiFont:p,monoFont:G,uiFontSize:x,monoFontSize:S,activeSkinId:j};L(re),F(re)},[s,o,u,j,L,F,p,x,S]),U=b.useCallback(G=>{const re=Math.min(20,Math.max(12,G));v(re);const ne={theme:s,accent:o,colorTheme:u,uiFont:p,monoFont:g,uiFontSize:re,monoFontSize:S,activeSkinId:j};L(ne),F(ne)},[s,o,u,j,L,F,p,g,S]),I=b.useCallback(G=>{const re=Math.min(20,Math.max(12,G));w(re);const ne={theme:s,accent:o,colorTheme:u,uiFont:p,monoFont:g,uiFontSize:x,monoFontSize:re,activeSkinId:j};L(ne),F(ne)},[s,o,u,j,L,F,p,g,x]),X=b.useCallback(G=>{const re=G&&T.some(le=>le.id===G)?G:null;C(re);const ne={theme:s,accent:o,colorTheme:u,uiFont:p,monoFont:g,uiFontSize:x,monoFontSize:S,activeSkinId:re};L(ne),F(ne)},[s,o,u,p,g,x,S,T,L,F]),K=b.useCallback(async()=>{if(n){O(!0);try{const G=await bZ();if(E(G),j&&!G.some(re=>re.id===j)){C(null);const re={theme:s,accent:o,colorTheme:u,uiFont:p,monoFont:g,uiFontSize:x,monoFontSize:S,activeSkinId:null};L(re),F(re)}}finally{O(!1)}}},[n,j,s,o,u,p,g,x,S,L,F]),Q=b.useCallback(async G=>{const re=await kZ(G);return E(ne=>[...ne.filter(oe=>oe.id!==re.id),re].sort((oe,ie)=>oe.name.localeCompare(ie.name)||oe.id.localeCompare(ie.id))),re},[]),V=b.useCallback(async G=>{if(await wZ(G),E(re=>re.filter(ne=>ne.id!==G)),j===G){C(null);const re={theme:s,accent:o,colorTheme:u,uiFont:p,monoFont:g,uiFontSize:x,monoFontSize:S,activeSkinId:null};L(re),F(re)}},[j,s,o,u,p,g,x,S,L,F]);b.useEffect(()=>{aO(p),oO(g)},[]),b.useEffect(()=>{L({theme:s,accent:o,colorTheme:u,uiFont:p,monoFont:g,uiFontSize:x,monoFontSize:S,activeSkinId:j})},[s,o,u,p,g,x,S,j,L]),b.useEffect(()=>{r||!n||K().catch(()=>{})},[r,n,K]),b.useEffect(()=>{if(s!=="system")return;const G=window.matchMedia("(prefers-color-scheme: light)"),re=()=>L({theme:s,accent:o,colorTheme:u,uiFont:p,monoFont:g,uiFontSize:x,monoFontSize:S,activeSkinId:j});return G.addEventListener("change",re),()=>G.removeEventListener("change",re)},[s,o,u,L,p,g,x,S,j]);const R=yO(s,u),q=T.find(G=>G.id===j)??null,W=(q==null?void 0:q.name)??null,te=b.useCallback(G=>{var le;const re=hz(q,R),ne=(le=re==null?void 0:re.assets)==null?void 0:le[G];return q&&ne?tg(q.id,ne):null},[q,R]),J={theme:s,accent:o,colorTheme:u,uiFont:p,monoFont:g,uiFontSize:x,monoFontSize:S,resolvedTheme:R,activeSkinId:j,activeSkinName:W,installedSkins:T,skinsLoading:A,setTheme:$,setAccent:z,setColorTheme:B,setUiFont:H,setMonoFont:D,setUiFontSize:U,setMonoFontSize:I,refreshSkins:K,setSkin:X,importSkinZip:Q,deleteSkin:V,getSkinAsset:te};return c.jsx(VB.Provider,{value:J,children:e})}/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const XJ=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),fz=(...e)=>e.filter((n,r,i)=>!!n&&n.trim()!==""&&i.indexOf(n)===r).join(" ").trim();/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */var QJ={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const ZJ=b.forwardRef(({color:e="currentColor",size:n=24,strokeWidth:r=2,absoluteStrokeWidth:i,className:s="",children:a,iconNode:o,...l},u)=>b.createElement("svg",{ref:u,...QJ,width:n,height:n,stroke:e,strokeWidth:i?Number(r)*24/Number(n):r,className:fz("lucide",s),...l},[...o.map(([d,p])=>b.createElement(d,p)),...Array.isArray(a)?a:[a]]));/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Pe=(e,n)=>{const r=b.forwardRef(({className:i,...s},a)=>b.createElement(ZJ,{ref:a,iconNode:n,className:fz(`lucide-${XJ(e)}`,i),...s}));return r.displayName=`${e}`,r};/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const xv=Pe("Activity",[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const JJ=Pe("Archive",[["rect",{width:"20",height:"5",x:"2",y:"3",rx:"1",key:"1wp1u1"}],["path",{d:"M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8",key:"1s80jp"}],["path",{d:"M10 12h4",key:"a56b0p"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const eee=Pe("ArrowDownRight",[["path",{d:"m7 7 10 10",key:"1fmybs"}],["path",{d:"M17 7v10H7",key:"6fjiku"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const tee=Pe("ArrowDown",[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const nee=Pe("ArrowLeft",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const ree=Pe("ArrowRightLeft",[["path",{d:"m16 3 4 4-4 4",key:"1x1c3m"}],["path",{d:"M20 7H4",key:"zbl0bi"}],["path",{d:"m8 21-4-4 4-4",key:"h9nckh"}],["path",{d:"M4 17h16",key:"g4d7ey"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const _f=Pe("ArrowRight",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const yx=Pe("Ban",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m4.9 4.9 14.2 14.2",key:"1m5liu"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const iee=Pe("Bell",[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326",key:"11g9vi"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const AC=Pe("BookOpen",[["path",{d:"M12 7v14",key:"1akyts"}],["path",{d:"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z",key:"ruj8y"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Ul=Pe("Bot",[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const see=Pe("Boxes",[["path",{d:"M2.97 12.92A2 2 0 0 0 2 14.63v3.24a2 2 0 0 0 .97 1.71l3 1.8a2 2 0 0 0 2.06 0L12 19v-5.5l-5-3-4.03 2.42Z",key:"lc1i9w"}],["path",{d:"m7 16.5-4.74-2.85",key:"1o9zyk"}],["path",{d:"m7 16.5 5-3",key:"va8pkn"}],["path",{d:"M7 16.5v5.17",key:"jnp8gn"}],["path",{d:"M12 13.5V19l3.97 2.38a2 2 0 0 0 2.06 0l3-1.8a2 2 0 0 0 .97-1.71v-3.24a2 2 0 0 0-.97-1.71L17 10.5l-5 3Z",key:"8zsnat"}],["path",{d:"m17 16.5-5-3",key:"8arw3v"}],["path",{d:"m17 16.5 4.74-2.85",key:"8rfmw"}],["path",{d:"M17 16.5v5.17",key:"k6z78m"}],["path",{d:"M7.97 4.42A2 2 0 0 0 7 6.13v4.37l5 3 5-3V6.13a2 2 0 0 0-.97-1.71l-3-1.8a2 2 0 0 0-2.06 0l-3 1.8Z",key:"1xygjf"}],["path",{d:"M12 8 7.26 5.15",key:"1vbdud"}],["path",{d:"m12 8 4.74-2.85",key:"3rx089"}],["path",{d:"M12 13.5V8",key:"1io7kd"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const aee=Pe("Braces",[["path",{d:"M8 3H7a2 2 0 0 0-2 2v5a2 2 0 0 1-2 2 2 2 0 0 1 2 2v5c0 1.1.9 2 2 2h1",key:"ezmyqa"}],["path",{d:"M16 21h1a2 2 0 0 0 2-2v-5c0-1.1.9-2 2-2a2 2 0 0 1-2-2V5a2 2 0 0 0-2-2h-1",key:"e1hn23"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const ng=Pe("Brain",[["path",{d:"M12 5a3 3 0 1 0-5.997.125 4 4 0 0 0-2.526 5.77 4 4 0 0 0 .556 6.588A4 4 0 1 0 12 18Z",key:"l5xja"}],["path",{d:"M12 5a3 3 0 1 1 5.997.125 4 4 0 0 1 2.526 5.77 4 4 0 0 1-.556 6.588A4 4 0 1 1 12 18Z",key:"ep3f8r"}],["path",{d:"M15 13a4.5 4.5 0 0 1-3-4 4.5 4.5 0 0 1-3 4",key:"1p4c4q"}],["path",{d:"M17.599 6.5a3 3 0 0 0 .399-1.375",key:"tmeiqw"}],["path",{d:"M6.003 5.125A3 3 0 0 0 6.401 6.5",key:"105sqy"}],["path",{d:"M3.477 10.896a4 4 0 0 1 .585-.396",key:"ql3yin"}],["path",{d:"M19.938 10.5a4 4 0 0 1 .585.396",key:"1qfode"}],["path",{d:"M6 18a4 4 0 0 1-1.967-.516",key:"2e4loj"}],["path",{d:"M19.967 17.484A4 4 0 0 1 18 18",key:"159ez6"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const oee=Pe("Calculator",[["rect",{width:"16",height:"20",x:"4",y:"2",rx:"2",key:"1nb95v"}],["line",{x1:"8",x2:"16",y1:"6",y2:"6",key:"x4nwl0"}],["line",{x1:"16",x2:"16",y1:"14",y2:"18",key:"wjye3r"}],["path",{d:"M16 10h.01",key:"1m94wz"}],["path",{d:"M12 10h.01",key:"1nrarc"}],["path",{d:"M8 10h.01",key:"19clt8"}],["path",{d:"M12 14h.01",key:"1etili"}],["path",{d:"M8 14h.01",key:"6423bh"}],["path",{d:"M12 18h.01",key:"mhygvu"}],["path",{d:"M8 18h.01",key:"lrp35t"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const no=Pe("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Yo=Pe("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const _O=Pe("ChevronLeft",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const du=Pe("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const lee=Pe("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const cee=Pe("ChevronsLeft",[["path",{d:"m11 17-5-5 5-5",key:"13zhaf"}],["path",{d:"m18 17-5-5 5-5",key:"h8a8et"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const uee=Pe("ChevronsRight",[["path",{d:"m6 17 5-5-5-5",key:"xnjwq"}],["path",{d:"m13 17 5-5-5-5",key:"17xmmf"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const bv=Pe("CircleAlert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Of=Pe("CircleCheckBig",[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Zx=Pe("CircleCheck",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const xO=Pe("CirclePause",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"10",x2:"10",y1:"15",y2:"9",key:"c1nkhi"}],["line",{x1:"14",x2:"14",y1:"15",y2:"9",key:"h65svq"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const dee=Pe("CirclePlay",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polygon",{points:"10 8 16 12 10 16 10 8",key:"1cimsy"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const ru=Pe("CircleX",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const hee=Pe("Clipboard",[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Jx=Pe("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const fee=Pe("CloudUpload",[["path",{d:"M12 13v8",key:"1l5pq0"}],["path",{d:"M4 14.899A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.242",key:"1pljnt"}],["path",{d:"m8 17 4-4 4 4",key:"1quai1"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const pee=Pe("Cloud",[["path",{d:"M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z",key:"p7xjir"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const pz=Pe("CodeXml",[["path",{d:"m18 16 4-4-4-4",key:"1inbqp"}],["path",{d:"m6 8-4 4 4 4",key:"15zrgr"}],["path",{d:"m14.5 4-5 16",key:"e7oirm"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const mee=Pe("Code",[["polyline",{points:"16 18 22 12 16 6",key:"z7tu5w"}],["polyline",{points:"8 6 2 12 8 18",key:"1eg1df"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const gee=Pe("Columns2",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M12 3v18",key:"108xh3"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const rc=Pe("Copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const IE=Pe("Crosshair",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"22",x2:"18",y1:"12",y2:"12",key:"l9bcsi"}],["line",{x1:"6",x2:"2",y1:"12",y2:"12",key:"13hhkx"}],["line",{x1:"12",x2:"12",y1:"6",y2:"2",key:"10w3f3"}],["line",{x1:"12",x2:"12",y1:"22",y2:"18",key:"15g9kq"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const vee=Pe("Crown",[["path",{d:"M11.562 3.266a.5.5 0 0 1 .876 0L15.39 8.87a1 1 0 0 0 1.516.294L21.183 5.5a.5.5 0 0 1 .798.519l-2.834 10.246a1 1 0 0 1-.956.734H5.81a1 1 0 0 1-.957-.734L2.02 6.02a.5.5 0 0 1 .798-.519l4.276 3.664a1 1 0 0 0 1.516-.294z",key:"1vdc57"}],["path",{d:"M5 21h14",key:"11awu3"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const b0=Pe("Database",[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const BE=Pe("DollarSign",[["line",{x1:"12",x2:"12",y1:"2",y2:"22",key:"7eqyqh"}],["path",{d:"M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6",key:"1b0p4s"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const mz=Pe("ExternalLink",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const zE=Pe("EyeOff",[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const kv=Pe("Eye",[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const yee=Pe("FileCode2",[["path",{d:"M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4",key:"1pf5j1"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"m5 12-3 3 3 3",key:"oke12k"}],["path",{d:"m9 18 3-3-3-3",key:"112psh"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const _ee=Pe("FileCode",[["path",{d:"M10 12.5 8 15l2 2.5",key:"1tg20x"}],["path",{d:"m14 12.5 2 2.5-2 2.5",key:"yinavb"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7z",key:"1mlx9k"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const xee=Pe("FilePlus2",[["path",{d:"M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4",key:"1pf5j1"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M3 15h6",key:"4e2qda"}],["path",{d:"M6 12v6",key:"1u72j0"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const wv=Pe("FileText",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const bee=Pe("FileUp",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M12 12v6",key:"3ahymv"}],["path",{d:"m15 15-3-3-3 3",key:"15xj92"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const kee=Pe("Film",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M7 3v18",key:"bbkbws"}],["path",{d:"M3 7.5h4",key:"zfgn84"}],["path",{d:"M3 12h18",key:"1i2n21"}],["path",{d:"M3 16.5h4",key:"1230mu"}],["path",{d:"M17 3v18",key:"in4fa5"}],["path",{d:"M17 7.5h4",key:"myr1c1"}],["path",{d:"M17 16.5h4",key:"go4c1d"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const gz=Pe("Filter",[["polygon",{points:"22 3 2 3 10 12.46 10 19 14 21 14 12.46 22 3",key:"1yg77f"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const vz=Pe("FolderOpen",[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Td=Pe("GitBranch",[["line",{x1:"6",x2:"6",y1:"3",y2:"15",key:"17qcm7"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M18 9a9 9 0 0 1-9 9",key:"n2h4wq"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const $E=Pe("Globe",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const FE=Pe("Hash",[["line",{x1:"4",x2:"20",y1:"9",y2:"9",key:"4lhtct"}],["line",{x1:"4",x2:"20",y1:"15",y2:"15",key:"vyu0kd"}],["line",{x1:"10",x2:"8",y1:"3",y2:"21",key:"1ggp8o"}],["line",{x1:"16",x2:"14",y1:"3",y2:"21",key:"weycgp"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const HE=Pe("History",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M12 7v5l4 2",key:"1fdv2h"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const WE=Pe("ImagePlus",[["path",{d:"M16 5h6",key:"1vod17"}],["path",{d:"M19 2v6",key:"4bpg5p"}],["path",{d:"M21 11.5V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h7.5",key:"1ue2ih"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const qE=Pe("Image",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const wee=Pe("Inbox",[["polyline",{points:"22 12 16 12 14 15 10 15 8 12 2 12",key:"o97t9d"}],["path",{d:"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",key:"oot6mr"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const See=Pe("Info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const bO=Pe("KeyRound",[["path",{d:"M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z",key:"1s6t7t"}],["circle",{cx:"16.5",cy:"7.5",r:".5",fill:"currentColor",key:"w0ekpg"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Cee=Pe("Keyboard",[["path",{d:"M10 8h.01",key:"1r9ogq"}],["path",{d:"M12 12h.01",key:"1mp3jc"}],["path",{d:"M14 8h.01",key:"1primd"}],["path",{d:"M16 12h.01",key:"1l6xoz"}],["path",{d:"M18 8h.01",key:"emo2bl"}],["path",{d:"M6 8h.01",key:"x9i8wu"}],["path",{d:"M7 16h10",key:"wp8him"}],["path",{d:"M8 12h.01",key:"czm47f"}],["rect",{width:"20",height:"16",x:"2",y:"4",rx:"2",key:"18n3k1"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const jee=Pe("Languages",[["path",{d:"m5 8 6 6",key:"1wu5hv"}],["path",{d:"m4 14 6-6 2-3",key:"1k1g8d"}],["path",{d:"M2 5h12",key:"or177f"}],["path",{d:"M7 2h1",key:"1t2jsx"}],["path",{d:"m22 22-5-10-5 10",key:"don7ne"}],["path",{d:"M14 18h6",key:"1m8k6r"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const UE=Pe("Layers",[["path",{d:"M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z",key:"zw3jo"}],["path",{d:"M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12",key:"1wduqc"}],["path",{d:"M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17",key:"kqbvx6"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Nee=Pe("LayoutDashboard",[["rect",{width:"7",height:"9",x:"3",y:"3",rx:"1",key:"10lvy0"}],["rect",{width:"7",height:"5",x:"14",y:"3",rx:"1",key:"16une8"}],["rect",{width:"7",height:"9",x:"14",y:"12",rx:"1",key:"1hutg5"}],["rect",{width:"7",height:"5",x:"3",y:"16",rx:"1",key:"ldoo1y"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const yz=Pe("LayoutGrid",[["rect",{width:"7",height:"7",x:"3",y:"3",rx:"1",key:"1g98yp"}],["rect",{width:"7",height:"7",x:"14",y:"3",rx:"1",key:"6d4xhi"}],["rect",{width:"7",height:"7",x:"14",y:"14",rx:"1",key:"nxv5o0"}],["rect",{width:"7",height:"7",x:"3",y:"14",rx:"1",key:"1bb6yr"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Eee=Pe("Link2Off",[["path",{d:"M9 17H7A5 5 0 0 1 7 7",key:"10o201"}],["path",{d:"M15 7h2a5 5 0 0 1 4 8",key:"1d3206"}],["line",{x1:"8",x2:"12",y1:"12",y2:"12",key:"rvw6j4"}],["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const _z=Pe("Link2",[["path",{d:"M9 17H7A5 5 0 0 1 7 7h2",key:"8i5ue5"}],["path",{d:"M15 7h2a5 5 0 1 1 0 10h-2",key:"1b9ql8"}],["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Aee=Pe("ListPlus",[["path",{d:"M11 12H3",key:"51ecnj"}],["path",{d:"M16 6H3",key:"1wxfjs"}],["path",{d:"M16 18H3",key:"12xzn7"}],["path",{d:"M18 9v6",key:"1twb98"}],["path",{d:"M21 12h-6",key:"bt1uis"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Rr=Pe("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Eg=Pe("Lock",[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Tee=Pe("Mail",[["rect",{width:"20",height:"16",x:"2",y:"4",rx:"2",key:"18n3k1"}],["path",{d:"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7",key:"1ocrg3"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const xz=Pe("MapPinned",[["path",{d:"M18 8c0 3.613-3.869 7.429-5.393 8.795a1 1 0 0 1-1.214 0C9.87 15.429 6 11.613 6 8a6 6 0 0 1 12 0",key:"11u0oz"}],["circle",{cx:"12",cy:"8",r:"2",key:"1822b1"}],["path",{d:"M8.714 14h-3.71a1 1 0 0 0-.948.683l-2.004 6A1 1 0 0 0 3 22h18a1 1 0 0 0 .948-1.316l-2-6a1 1 0 0 0-.949-.684h-3.712",key:"q8zwxj"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Mee=Pe("Menu",[["line",{x1:"4",x2:"20",y1:"12",y2:"12",key:"1e0a9i"}],["line",{x1:"4",x2:"20",y1:"6",y2:"6",key:"1owob3"}],["line",{x1:"4",x2:"20",y1:"18",y2:"18",key:"yk5zj1"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const TC=Pe("MessageSquareText",[["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}],["path",{d:"M13 8H7",key:"14i4kc"}],["path",{d:"M17 12H7",key:"16if0g"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Ag=Pe("MessageSquare",[["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const kO=Pe("MonitorCog",[["path",{d:"M12 17v4",key:"1riwvh"}],["path",{d:"m15.2 4.9-.9-.4",key:"12wd2u"}],["path",{d:"m15.2 7.1-.9.4",key:"1r2vl7"}],["path",{d:"m16.9 3.2-.4-.9",key:"3zbo91"}],["path",{d:"m16.9 8.8-.4.9",key:"1qr2dn"}],["path",{d:"m19.5 2.3-.4.9",key:"1rjrkq"}],["path",{d:"m19.5 9.7-.4-.9",key:"heryx5"}],["path",{d:"m21.7 4.5-.9.4",key:"17fqt1"}],["path",{d:"m21.7 7.5-.9-.4",key:"14zyni"}],["path",{d:"M22 13v2a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h7",key:"1tnzv8"}],["path",{d:"M8 21h8",key:"1ev6f3"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const bz=Pe("Monitor",[["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["line",{x1:"8",x2:"16",y1:"21",y2:"21",key:"1svkeh"}],["line",{x1:"12",x2:"12",y1:"17",y2:"21",key:"vw1qmm"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const wO=Pe("MoonStar",[["path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9",key:"4ay0iu"}],["path",{d:"M20 3v4",key:"1olli1"}],["path",{d:"M22 5h-4",key:"1gvqau"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Df=Pe("Network",[["rect",{x:"16",y:"16",width:"6",height:"6",rx:"1",key:"4q2zg0"}],["rect",{x:"2",y:"16",width:"6",height:"6",rx:"1",key:"8cvhb9"}],["rect",{x:"9",y:"2",width:"6",height:"6",rx:"1",key:"1egb70"}],["path",{d:"M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3",key:"1jsf9p"}],["path",{d:"M12 12V8",key:"2874zd"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Ql=Pe("Package",[["path",{d:"M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z",key:"1a0edw"}],["path",{d:"M12 22V12",key:"d0xqtd"}],["path",{d:"m3.3 7 7.703 4.734a2 2 0 0 0 1.994 0L20.7 7",key:"yx3hmr"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const MC=Pe("Palette",[["circle",{cx:"13.5",cy:"6.5",r:".5",fill:"currentColor",key:"1okk4w"}],["circle",{cx:"17.5",cy:"10.5",r:".5",fill:"currentColor",key:"f64h9f"}],["circle",{cx:"8.5",cy:"7.5",r:".5",fill:"currentColor",key:"fotxhn"}],["circle",{cx:"6.5",cy:"12.5",r:".5",fill:"currentColor",key:"qy21gx"}],["path",{d:"M12 2C6.5 2 2 6.5 2 12s4.5 10 10 10c.926 0 1.648-.746 1.648-1.688 0-.437-.18-.835-.437-1.125-.29-.289-.438-.652-.438-1.125a1.64 1.64 0 0 1 1.668-1.668h1.996c3.051 0 5.555-2.503 5.555-5.554C21.965 6.012 17.461 2 12 2z",key:"12rzf8"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Ree=Pe("Paperclip",[["path",{d:"M13.234 20.252 21 12.3",key:"1cbrk9"}],["path",{d:"m16 6-8.414 8.586a2 2 0 0 0 0 2.828 2 2 0 0 0 2.828 0l8.414-8.586a4 4 0 0 0 0-5.656 4 4 0 0 0-5.656 0l-8.415 8.585a6 6 0 1 0 8.486 8.486",key:"1pkts6"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const kz=Pe("Pause",[["rect",{x:"14",y:"4",width:"4",height:"16",rx:"1",key:"zuxfzm"}],["rect",{x:"6",y:"4",width:"4",height:"16",rx:"1",key:"1okwgv"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const wz=Pe("PenLine",[["path",{d:"M12 20h9",key:"t2du7b"}],["path",{d:"M16.376 3.622a1 1 0 0 1 3.002 3.002L7.368 18.635a2 2 0 0 1-.855.506l-2.872.838a.5.5 0 0 1-.62-.62l.838-2.872a2 2 0 0 1 .506-.854z",key:"1ykcvy"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Sv=Pe("Pencil",[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const k0=Pe("Play",[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const ls=Pe("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const w0=Pe("Power",[["path",{d:"M12 2v10",key:"mnfbl"}],["path",{d:"M18.4 6.6a9 9 0 1 1-12.77.04",key:"obofu9"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Sz=Pe("Puzzle",[["path",{d:"M15.39 4.39a1 1 0 0 0 1.68-.474 2.5 2.5 0 1 1 3.014 3.015 1 1 0 0 0-.474 1.68l1.683 1.682a2.414 2.414 0 0 1 0 3.414L19.61 15.39a1 1 0 0 1-1.68-.474 2.5 2.5 0 1 0-3.014 3.015 1 1 0 0 1 .474 1.68l-1.683 1.682a2.414 2.414 0 0 1-3.414 0L8.61 19.61a1 1 0 0 0-1.68.474 2.5 2.5 0 1 1-3.014-3.015 1 1 0 0 0 .474-1.68l-1.683-1.682a2.414 2.414 0 0 1 0-3.414L4.39 8.61a1 1 0 0 1 1.68.474 2.5 2.5 0 1 0 3.014-3.015 1 1 0 0 1-.474-1.68l1.683-1.682a2.414 2.414 0 0 1 3.414 0z",key:"w46dr5"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Oee=Pe("QrCode",[["rect",{width:"5",height:"5",x:"3",y:"3",rx:"1",key:"1tu5fj"}],["rect",{width:"5",height:"5",x:"16",y:"3",rx:"1",key:"1v8r4q"}],["rect",{width:"5",height:"5",x:"3",y:"16",rx:"1",key:"1x03jg"}],["path",{d:"M21 16h-3a2 2 0 0 0-2 2v3",key:"177gqh"}],["path",{d:"M21 21v.01",key:"ents32"}],["path",{d:"M12 7v3a2 2 0 0 1-2 2H7",key:"8crl2c"}],["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M12 3h.01",key:"n36tog"}],["path",{d:"M12 16v.01",key:"133mhm"}],["path",{d:"M16 12h1",key:"1slzba"}],["path",{d:"M21 12v.01",key:"1lwtk9"}],["path",{d:"M12 21v-1",key:"1880an"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Dee=Pe("RadioTower",[["path",{d:"M4.9 16.1C1 12.2 1 5.8 4.9 1.9",key:"s0qx1y"}],["path",{d:"M7.8 4.7a6.14 6.14 0 0 0-.8 7.5",key:"1idnkw"}],["circle",{cx:"12",cy:"9",r:"2",key:"1092wv"}],["path",{d:"M16.2 4.8c2 2 2.26 5.11.8 7.47",key:"ojru2q"}],["path",{d:"M19.1 1.9a9.96 9.96 0 0 1 0 14.1",key:"rhi7fg"}],["path",{d:"M9.5 18h5",key:"mfy3pd"}],["path",{d:"m8 22 4-11 4 11",key:"25yftu"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const eb=Pe("Radio",[["path",{d:"M4.9 19.1C1 15.2 1 8.8 4.9 4.9",key:"1vaf9d"}],["path",{d:"M7.8 16.2c-2.3-2.3-2.3-6.1 0-8.5",key:"u1ii0m"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}],["path",{d:"M16.2 7.8c2.3 2.3 2.3 6.1 0 8.5",key:"1j5fej"}],["path",{d:"M19.1 4.9C23 8.8 23 15.1 19.1 19",key:"10b0cb"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Cz=Pe("RefreshCcw",[["path",{d:"M21 12a9 9 0 0 0-9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"14sxne"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M3 12a9 9 0 0 0 9 9 9.75 9.75 0 0 0 6.74-2.74L21 16",key:"1hlbsb"}],["path",{d:"M16 16h5v5",key:"ccwih5"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const $r=Pe("RefreshCw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Pee=Pe("Repeat",[["path",{d:"m17 2 4 4-4 4",key:"nntrym"}],["path",{d:"M3 11v-1a4 4 0 0 1 4-4h14",key:"84bu3i"}],["path",{d:"m7 22-4-4 4-4",key:"1wqhfi"}],["path",{d:"M21 13v1a4 4 0 0 1-4 4H3",key:"1rx37r"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Lee=Pe("RotateCcw",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Iee=Pe("RotateCw",[["path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8",key:"1p45f6"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Bee=Pe("Rows2",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 12h18",key:"1i2n21"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const KE=Pe("Save",[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Da=Pe("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const VE=Pe("Send",[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const S0=Pe("Settings",[["path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z",key:"1qme2f"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const C0=Pe("ShieldAlert",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"M12 8v4",key:"1got3b"}],["path",{d:"M12 16h.01",key:"1drbdi"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Cv=Pe("ShieldCheck",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const jz=Pe("Shield",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Nz=Pe("ShoppingBag",[["path",{d:"M6 2 3 6v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V6l-3-4Z",key:"hou9p0"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M16 10a4 4 0 0 1-8 0",key:"1ltviw"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const zee=Pe("SlidersHorizontal",[["line",{x1:"21",x2:"14",y1:"4",y2:"4",key:"obuewd"}],["line",{x1:"10",x2:"3",y1:"4",y2:"4",key:"1q6298"}],["line",{x1:"21",x2:"12",y1:"12",y2:"12",key:"1iu8h1"}],["line",{x1:"8",x2:"3",y1:"12",y2:"12",key:"ntss68"}],["line",{x1:"21",x2:"16",y1:"20",y2:"20",key:"14d8ph"}],["line",{x1:"12",x2:"3",y1:"20",y2:"20",key:"m0wm8r"}],["line",{x1:"14",x2:"14",y1:"2",y2:"6",key:"14e1ph"}],["line",{x1:"8",x2:"8",y1:"10",y2:"14",key:"1i6ji0"}],["line",{x1:"16",x2:"16",y1:"18",y2:"22",key:"1lctlv"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const RC=Pe("Smartphone",[["rect",{width:"14",height:"20",x:"5",y:"2",rx:"2",ry:"2",key:"1yt0o3"}],["path",{d:"M12 18h.01",key:"mhygvu"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const hu=Pe("Sparkles",[["path",{d:"M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z",key:"4pj2yx"}],["path",{d:"M20 3v4",key:"1olli1"}],["path",{d:"M22 5h-4",key:"1gvqau"}],["path",{d:"M4 17v2",key:"vumght"}],["path",{d:"M5 18H3",key:"zchphs"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const $ee=Pe("Split",[["path",{d:"M16 3h5v5",key:"1806ms"}],["path",{d:"M8 3H3v5",key:"15dfkv"}],["path",{d:"M12 22v-8.3a4 4 0 0 0-1.172-2.872L3 3",key:"1qrqzj"}],["path",{d:"m15 9 6-6",key:"ko1vev"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Fee=Pe("SquareSplitHorizontal",[["path",{d:"M8 19H5c-1 0-2-1-2-2V7c0-1 1-2 2-2h3",key:"lubmu8"}],["path",{d:"M16 5h3c1 0 2 1 2 2v10c0 1-1 2-2 2h-3",key:"1ag34g"}],["line",{x1:"12",x2:"12",y1:"4",y2:"20",key:"1tx1rr"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Hee=Pe("Square",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Ez=Pe("Stethoscope",[["path",{d:"M11 2v2",key:"1539x4"}],["path",{d:"M5 2v2",key:"1yf1q8"}],["path",{d:"M5 3H4a2 2 0 0 0-2 2v4a6 6 0 0 0 12 0V5a2 2 0 0 0-2-2h-1",key:"rb5t3r"}],["path",{d:"M8 15a6 6 0 0 0 12 0v-3",key:"x18d4x"}],["circle",{cx:"20",cy:"10",r:"2",key:"ts1r5v"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const SO=Pe("SunMedium",[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 3v1",key:"1asbbs"}],["path",{d:"M12 20v1",key:"1wcdkc"}],["path",{d:"M3 12h1",key:"lp3yf2"}],["path",{d:"M20 12h1",key:"1vloll"}],["path",{d:"m18.364 5.636-.707.707",key:"1hakh0"}],["path",{d:"m6.343 17.657-.707.707",key:"18m9nf"}],["path",{d:"m5.636 5.636.707.707",key:"1xv1c5"}],["path",{d:"m17.657 17.657.707.707",key:"vl76zb"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const tb=Pe("Tag",[["path",{d:"M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z",key:"vktsd0"}],["circle",{cx:"7.5",cy:"7.5",r:".5",fill:"currentColor",key:"kqv944"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Az=Pe("Target",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"12",r:"6",key:"1vlfrh"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const jv=Pe("Terminal",[["polyline",{points:"4 17 10 11 4 5",key:"akl6gq"}],["line",{x1:"12",x2:"20",y1:"19",y2:"19",key:"q2wloq"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Ki=Pe("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Wee=Pe("TrendingUp",[["polyline",{points:"22 7 13.5 15.5 8.5 10.5 2 17",key:"126l90"}],["polyline",{points:"16 7 22 7 22 13",key:"kwv8wd"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const As=Pe("TriangleAlert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const j0=Pe("Users",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["path",{d:"M16 3.13a4 4 0 0 1 0 7.75",key:"1da9ce"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Tz=Pe("WandSparkles",[["path",{d:"m21.64 3.64-1.28-1.28a1.21 1.21 0 0 0-1.72 0L2.36 18.64a1.21 1.21 0 0 0 0 1.72l1.28 1.28a1.2 1.2 0 0 0 1.72 0L21.64 5.36a1.2 1.2 0 0 0 0-1.72",key:"ul74o6"}],["path",{d:"m14 7 3 3",key:"1r5n42"}],["path",{d:"M5 6v4",key:"ilb8ba"}],["path",{d:"M19 14v4",key:"blhpug"}],["path",{d:"M10 2v2",key:"7u0qdc"}],["path",{d:"M7 8H3",key:"zfb6yr"}],["path",{d:"M21 16h-4",key:"1cnmox"}],["path",{d:"M11 3H9",key:"1obp7u"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const N0=Pe("Workflow",[["rect",{width:"8",height:"8",x:"3",y:"3",rx:"2",key:"by2w9f"}],["path",{d:"M7 11v4a2 2 0 0 0 2 2h4",key:"xkn7yn"}],["rect",{width:"8",height:"8",x:"13",y:"13",rx:"2",key:"1cgmvn"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const E0=Pe("Wrench",[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z",key:"cbrjhi"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const vi=Pe("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);/**
 * @license lucide-react v0.468.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const A0=Pe("Zap",[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]]),nb={zh:{"nav.dashboard":"仪表盘","nav.agent":"智能体","nav.tools":"工具","nav.cron":"定时任务","nav.integrations":"集成","nav.memory":"记忆","nav.config":"配置","nav.cost":"成本追踪","nav.logs":"日志","nav.doctor":"诊断","nav.agents":"智能体池","nav.skills":"技能库","nav.teams":"AI 代理团队","nav.assets":"资产浏览器","nav.skins":"皮肤","nav.memoryAuditor":"记忆审计","nav.audit":"审计追踪","nav.canvas":"画布","nav.workflows":"工作流","dashboard.title":"仪表盘","dashboard.provider":"提供商","dashboard.model":"模型","dashboard.uptime":"运行时间","dashboard.temperature":"温度","dashboard.gateway_port":"网关端口","dashboard.memory_backend":"记忆后端","dashboard.paired":"已配对","dashboard.channels":"频道","dashboard.health":"健康状态","dashboard.status":"状态","dashboard.overview":"概览","dashboard.system_info":"系统信息","dashboard.quick_actions":"快速操作","agent.title":"智能体对话","agent.send":"发送","agent.placeholder":"输入消息...","agent.start_conversation":"发送消息开始对话","agent.type_message":"输入消息...","agent.connecting":"连接中...","agent.connected":"已连接","agent.disconnected":"已断开","agent.reconnecting":"重新连接中...","agent.thinking":"思考中...","agent.tool_call":"工具调用","agent.tool_result":"工具结果","agent.connection_error":"连接错误，正在尝试重连...","agent.tool_call_prefix":"[工具调用]","agent.tool_result_prefix":"[工具结果]","agent.error_prefix":"[错误]","agent.unknown_error":"未知错误","agent.send_error":"发送消息失败，请重试。","agent.copy_message":"复制消息","agent.connected_status":"已连接","agent.disconnected_status":"已断开","agent.copy_code":"复制代码","agent.copied_code":"代码已复制","agent.copy":"复制","agent.copied":"已复制","agent.code_language_fallback":"代码","agent.jump_to_latest":"跳到最新","agent.placeholder_steer_next_step":"引导下一步…","agent.placeholder_queue_next":"排队下一条消息…","agent.placeholder_message":"消息…","agent.placeholder_connecting":"连接中…","agent.send_mode":"发送模式","agent.send_mode_queue":"排队","agent.send_mode_steer":"引导","agent.queue_after_current_response":"当前响应后排队","agent.steer_text_only":"引导仅支持文本；附件会改为排队","agent.steer_next_step":"引导下一步","agent.queue_message":"排队消息","agent.send_message":"发送消息","agent.send_enter":"发送 (Enter)","agent.steer_prefix":"[引导]","agent.tool_output_truncated":"聊天视图中的输出已截断；请复制或检查运行日志以查看完整结果。","agent.activity_input_label":"输入","agent.activity_diff_label":"差异","agent.activity_output_label":"输出","agent.reasoning_trace_label":"思考过程","tools.name":"名称","tools.parameters":"参数","tools.search":"搜索工具...","tools.empty":"暂无可用工具。","tools.count":"工具总数","tools.agent_tools":"智能体工具箱","tools.cli_tools":"CLI 工具箱","tools.path":"路径","tools.version":"版本","tools.category":"类别","tools.load_error":"加载工具失败","cron.title":"定时任务","cron.scheduled_tasks":"定时任务","cron.add":"添加任务","cron.add_job":"添加任务","cron.add_modal_title":"添加 Cron 任务","cron.delete":"删除","cron.enable":"启用","cron.disable":"禁用","cron.name":"名称","cron.name_optional":"名称（可选）","cron.command":"命令","cron.command_required":"命令","cron.schedule":"计划","cron.schedule_required":"计划","cron.next_run":"下次执行","cron.last_run":"上次执行","cron.last_status":"上次状态","cron.enabled":"已启用","cron.enabled_status":"启用","cron.disabled_status":"禁用","cron.empty":"暂无定时任务。","cron.confirm_delete":"确定要删除此任务吗？","cron.load_error":"加载定时任务失败","cron.validation_error":"计划和命令是必需的。","cron.add_error":"添加任务失败","cron.delete_error":"删除任务失败","cron.cancel":"取消","cron.adding":"添加中...","cron.id":"ID","cron.actions":"操作","cron.loading_run_history":"加载运行历史...","cron.load_run_history_error":"加载运行历史失败","cron.no_runs":"暂无运行记录。","cron.recent_runs":"最近运行","cron.yes":"是","cron.no":"否","cron.edit":"编辑","cron.edit_modal_title":"编辑 Cron 任务","cron.edit_error":"更新任务失败","cron.saving":"保存中...","cron.save":"保存","integrations.available":"可用","integrations.active":"活跃","integrations.coming_soon":"即将推出","integrations.category":"类别","integrations.status":"状态","integrations.search":"搜索集成...","integrations.empty":"未找到集成。","integrations.activate":"激活","integrations.deactivate":"停用","integrations.load_error":"加载集成失败","integrations.status_active":"活跃","integrations.status_available":"可用","integrations.status_coming_soon":"即将推出","memory.title":"记忆存储","memory.memory_title":"记忆","memory.search":"搜索记忆...","memory.search_placeholder":"搜索记忆条目...","memory.add":"存储记忆","memory.add_memory":"添加记忆","memory.add_modal_title":"添加记忆","memory.delete":"删除","memory.key":"键","memory.key_required":"键","memory.content":"内容","memory.content_required":"内容","memory.category":"类别","memory.category_optional":"类别（可选）","memory.timestamp":"时间戳","memory.session":"会话","memory.score":"分数","memory.empty":"未找到记忆条目。","memory.confirm_delete":"确定要删除此记忆条目吗？","memory.all_categories":"所有类别","memory.search_button":"搜索","memory.load_error":"加载记忆失败","memory.saving":"保存中...","memory.validation_error":"键和内容是必需的。","memory.store_error":"保存记忆失败","memory.delete_error":"删除记忆失败","memory.delete_confirm":"删除？","memory.yes":"是","memory.no":"否","memory.cancel":"取消","config.title":"配置","config.save":"保存","config.saving":"保存中...","config.reset":"重置","config.saved":"配置保存成功。","config.error":"配置保存失败。","config.loading":"加载配置中...","config.editor_placeholder":"TOML 配置...","config.configuration_title":"配置","config.sensitive_title":"敏感字段已隐藏","config.sensitive_hint":"API 密钥、令牌和密码已隐藏以保护安全。要更新已隐藏的字段，请将整个隐藏值替换为您的新值。","config.save_success":"配置保存成功。","config.save_error":"保存配置失败","config.toml_label":"TOML 配置","config.lines":"行","cost.session":"会话成本","cost.daily":"每日成本","cost.monthly":"每月成本","cost.request_count":"请求数","cost.by_model":"按模型统计","cost.model":"模型","cost.usd":"成本（美元）","cost.load_error":"加载成本数据失败","cost.total_requests":"总请求数","cost.token_statistics":"Token 统计","cost.avg_tokens_per_request":"平均 Token / 请求","cost.cost_per_1k_tokens":"每 1K Token 成本","cost.model_breakdown":"模型细分","cost.cost":"成本","cost.share":"占比","logs.live_logs":"实时日志","logs.clear":"清除","logs.filter":"筛选日志...","logs.filter_label":"筛选","logs.empty":"暂无日志条目。","logs.events":"事件","logs.paused_hint":"日志流已暂停。","logs.waiting_hint":"等待事件...","doctor.diagnostics_title":"系统诊断","doctor.run_diagnostics":"运行诊断","doctor.running_btn":"运行中...","doctor.running_desc":"正在运行诊断...","doctor.running_hint":"这可能需要几秒钟。","doctor.error":"错误","doctor.severity":"严重程度","doctor.category":"类别","doctor.message":"消息","doctor.empty":"尚未运行诊断。","doctor.summary":"诊断摘要","doctor.issues_found":"发现问题","doctor.warnings_summary":"警告","doctor.all_clear":"一切正常","doctor.system_diagnostics":"系统诊断","doctor.empty_hint":'点击"运行诊断"检查您的 Revka 安装。',"auth.pair":"配对设备","auth.pairing_code":"配对码","auth.pair_button":"配对","auth.logout":"退出","auth.pairing_success":"配对成功！","auth.pairing_failed":"配对失败，请重试。","auth.enter_code":"请输入配对码以连接到智能体。","common.loading":"加载中...","common.error":"发生错误。","common.retry":"重试","common.cancel":"取消","common.confirm":"确认","common.save":"保存","common.delete":"删除","common.edit":"编辑","common.execute":"执行","common.close":"关闭","common.yes":"是","common.no":"否","common.search":"搜索...","common.no_data":"暂无数据。","common.refresh":"刷新","common.back":"返回","common.actions":"操作","common.name":"名称","common.description":"描述","common.status":"状态","common.created":"创建时间","common.updated":"更新时间","health.title":"系统健康","health.component":"组件","health.status":"状态","health.last_ok":"上次正常","health.last_error":"上次错误","health.restart_count":"重启次数","health.pid":"进程 ID","health.uptime":"运行时间","health.updated_at":"最后更新","dashboard.provider_model":"提供商 / 模型","dashboard.since_last_restart":"自上次重启","dashboard.paired_yes":"是","dashboard.paired_no":"否","dashboard.cost_overview":"成本概览","dashboard.active_channels":"活跃频道","dashboard.filter_active":"活跃","dashboard.filter_all":"全部","dashboard.no_active_channels":"没有活跃频道","dashboard.component_health":"组件健康","dashboard.load_error":"加载仪表盘失败","dashboard.session_label":"会话","dashboard.daily_label":"每日","dashboard.monthly_label":"每月","dashboard.total_tokens_label":"总 Tokens","dashboard.requests_label":"请求","dashboard.by_model":"按模型","dashboard.no_channels":"未配置频道","dashboard.active":"活跃","dashboard.inactive":"非活跃","dashboard.no_components":"没有组件报告","dashboard.restarts":"重启次数","dashboard.tab_overview":"概览","dashboard.tab_sessions":"会话","dashboard.tab_channels":"频道","dashboard.tab_audit":"审计日志","dashboard.tab_workflows":"工作流","dashboard.audit_disabled":"审计日志未启用。请在配置中启用以查看事件。","dashboard.audit_all_types":"所有事件类型","dashboard.audit_refresh":"刷新","dashboard.audit_verify_chain":"验证链","dashboard.audit_chain_valid":"链完整性已验证","dashboard.audit_chain_invalid":"链完整性验证失败","dashboard.audit_no_events":"未找到审计事件","dashboard.sessions_title":"活跃会话","dashboard.no_sessions":"没有活跃会话","dashboard.session_id":"会话 ID","dashboard.session_channel":"频道","dashboard.session_started":"开始时间","dashboard.session_last_activity":"最近活动","dashboard.session_status":"状态","dashboard.session_messages":"消息数","dashboard.session_details":"会话详情","dashboard.session_history":"查看历史","dashboard.channels_title":"频道状态","dashboard.no_channels_detail":"没有频道详情","dashboard.channel_type":"类型","dashboard.channel_messages":"消息数","dashboard.channel_last_message":"最近消息","dashboard.channel_config":"配置摘要","dashboard.channel_enabled":"已启用","dashboard.channel_disabled":"已禁用","dashboard.loading_sessions":"加载会话中...","dashboard.loading_channels":"加载频道中...","dashboard.load_sessions_error":"加载会话失败","dashboard.load_channels_error":"加载频道失败","dashboard.never":"从未","dashboard.tab_clawhub":"ClawHub","dashboard.tab_nodes":"节点","dashboard.clawhub_title":"ClawHub 市场","dashboard.clawhub_search":"搜索模板、技能、团队…","dashboard.clawhub_no_items":"未找到项目。发布您的第一个模板或技能！","dashboard.clawhub_publish":"发布","dashboard.clawhub_install":"安装","dashboard.clawhub_downloads":"下载次数","dashboard.clawhub_by":"作者","dashboard.nodes_title":"已连接节点","dashboard.nodes_no_nodes":"未连接节点。节点通过 WebSocket 连接到 /ws/nodes。","dashboard.nodes_capabilities":"能力","dashboard.nodes_invoke":"调用","settings.title":"设置","settings.tab.appearance":"外观","settings.tab.typography":"排版","settings.appearance":"外观设置","settings.typography":"字体设置","settings.fontUi":"界面字体","settings.fontMono":"代码字体","settings.fontSize":"界面字号","settings.fontMonoSize":"代码字号","settings.preview":"预览","settings.previewText":"界面字体预览文本","settings.fontNote":"字体设置需要刷新页面后生效","settings.language":"界面语言","chat_panel.ai_assistant":"AI 助手","chat_panel.agent_placeholder":'让我帮你创建一个智能体，例如"创建一个 Rust 安全专家"',"chat_panel.team_placeholder":'让我帮你组建一个团队，例如"组建一个前端迁移团队"',"chat_panel.skill_placeholder":'让我帮你创建一个技能，例如"创建一个代码审查技能"',"chat_panel.close":"关闭","clawhub.tab_local":"本地技能","clawhub.tab_clawhub":"ClawHub","clawhub.search_placeholder":"搜索 ClawHub 技能...","clawhub.trending":"热门","clawhub.install":"安装","clawhub.installing":"安装中...","clawhub.installed":"已安装","clawhub.downloads":"下载","clawhub.stars":"收藏","clawhub.verified":"已验证","clawhub.no_results":"未找到技能","clawhub.search_hint":"搜索 ClawHub 上的 13,000+ 社区技能","clawhub.error":"无法连接 ClawHub","clawhub.details":"详情","clawhub.less":"收起","clawhub.author":"作者","clawhub.tags":"标签","theme.mode":"主题模式","theme.accent":"强调色","theme.system":"跟随系统","theme.dark":"深色","theme.light":"浅色","theme.oled":"纯黑","nav.pairing":"设备配对","nav.section.orchestration":"编排","nav.section.operations":"运营","nav.section.inspection":"检查","nav.dashboard.blurb":"实时运行态势与活动中的 DAG 状态","nav.workflows.blurb":"定义 DAG 并直接查看执行记录","nav.agents.blurb":"可复用的参与者与工作流角色","nav.canvas.blurb":"可视化工作区与编排画布","nav.teams.blurb":"查看委派拓扑与归属关系","nav.assets.blurb":"工件与工作流相关资源","nav.skins.blurb":"基于令牌和资产的界面皮肤","nav.skills.blurb":"可复用的运营能力","nav.tools.blurb":"智能体工具目录与 CLI 二进制文件","nav.integrations.blurb":"已连接的系统与渠道","nav.cron.blurb":"定时任务与补跑行为","nav.pairing.blurb":"设备注册与信任管理","nav.config.blurb":"运行时 TOML 与运维配置","nav.cost.blurb":"按工作流与执行统计的支出与效率","nav.memory.blurb":"Kumiho 记忆图谱浏览器与版本历史","nav.logs.blurb":"运维追踪与节点关联事件","nav.audit.blurb":"信任链与批准验证","nav.doctor.blurb":"诊断与运行时恢复态势","sidebar.brand_subtitle":"智能体操作系统","sidebar.shell":"Revka","sidebar.shell_description":"本地优先的智能体操作系统，在你的项目中编排 AI 工作流、工具与运行时。","header.tagline":"以编排为先的智能体操作系统。","header.runtime_healthy":"运行时健康","header.trust_verified":"信任已验证","header.trust_unverified":"信任未验证","header.trust_checking":"正在验证信任…","header.operator":"操作员","common.duplicate":"复制","common.reenable":"重新启用","common.deprecate":"弃用","common.create":"创建","dashboard.kicker":"编排中心","dashboard.live_orchestration_pane":"实时编排面板","dashboard.active_workflow_posture":"当前工作流状态","dashboard.open_workflow_definition":"打开工作流定义","dashboard.selected_run":"当前运行","dashboard.run_posture":"运行状态","dashboard.signal_focus":"信号焦点","dashboard.hotspots":"热点","dashboard.count.running":"运行中","dashboard.count.failed":"失败","dashboard.count.completed":"已完成","dashboard.count.pending":"待处理","dashboard.count.skipped":"已跳过","dashboard.prev_signal":"上一信号","dashboard.next_signal":"下一信号","dashboard.intervention_points":"{count} 个干预点","dashboard.label.failure":"失败: {id}","dashboard.label.running":"运行中: {id}","dashboard.label.blocked":"受阻: {id}","dashboard.selected_step":"当前步骤","dashboard.inspect_node_in_runs":"在运行工作区中查看该节点","dashboard.open_definition_node":"打开定义节点","dashboard.select_dag_node":"在 DAG 中选择一个节点以查看活动分支。","dashboard.priority_timeline":"优先级时间线","dashboard.no_run_selected":"未选择运行。","dashboard.open_full_run_workspace":"打开完整运行工作区","dashboard.open_all_runs":"打开所有工作流运行","dashboard.status.blocked":"受阻","dashboard.scene.operator":"操作员简报","dashboard.scene.error":"仪表盘遥测出现异常。请先查看运行轨和日志，再继续下一步。","dashboard.scene.selected_run":"{workflow} 当前为 {status}。已完成 {completed}/{total} 个步骤。","dashboard.scene.run_failed":"{workflow} 需要关注：{failed} 个步骤失败，已完成 {completed}/{total} 个步骤。","dashboard.scene.active_overview":"当前有 {active} 个运行中流程，已加载 {definitions} 个定义。","dashboard.scene.idle_overview":"当前没有选中的运行。已准备好 {definitions} 个定义，历史运行总数为 {total}。","workflows.kicker":"编排中心","workflows.title":"工作流","workflows.create":"创建工作流","workflows.workflow_info":"v{version} · {steps} 个节点 · {runs} 次运行","workflows.workflow_info_short":"v{version} · {steps} 个节点","workflows.status.off":"关闭","workflows.status.ready":"就绪","workflows.tab.definition":"定义","workflows.tab.runs":"运行","workflows.loading":"正在加载工作流…","workflows.empty_title":"暂无工作流","workflows.empty_desc":"创建你的第一个工作流以开始。","workflows.definition_unavailable_title":"工作流定义不可用","workflows.definition_unavailable_desc":"运行时返回了空定义——无法渲染图。这是后端数据问题，需要在上游修复。","workflows.no_runs_title":"暂无运行记录","workflows.no_runs_desc":"运行该工作流以查看执行状态。","workflows.open_node_in_runs":"在运行中打开节点","workflows.select_dag_node":"在 DAG 中选择一个节点。","workflows.run_step":"运行步骤","workflows.select_dag_node_step":"在 DAG 中选择一个节点以查看该步骤。","workflows.save_failure":"保存工作流失败","workflows.save_failure_dot":"保存工作流失败。","workflows.run_failure":"启动工作流失败","workflows.status_failure":"更改工作流状态失败","workflows.status_failure_dot":"更改工作流状态失败。","workflows.delete_failure":"删除工作流失败","workflows.delete_failure_dot":"删除工作流失败。","workflows.toast.updated":'工作流 "{name}" 已更新。',"workflows.toast.created":'工作流 "{name}" 已创建。',"workflows.toast.reenabled":'已重新启用工作流 "{name}"。',"workflows.toast.deprecated":'已弃用工作流 "{name}"。',"workflows.toast.deleted":'工作流 "{name}" 已删除。',"workflows.toast.run_started":'工作流 "{name}" 已启动（运行 {runId}）。',"workflows.run_option":"{prefix} — {status} ({completed}/{total})","workflows.copy_suffix":"副本","doctor.kicker":"检查","doctor.title":"诊断器","doctor.description":"运行运行时诊断并检查 Revka 栈中分组的健康发现。","doctor.run":"运行诊断","doctor.running":"正在运行…","doctor.failed_title":"诊断失败","doctor.loading_title":"正在运行系统诊断…","doctor.loading_desc":"检查运行时组件、配置和运行状态。","doctor.health_summary":"健康总览","doctor.passing":"通过","doctor.warnings":"警告","doctor.failures":"失败","doctor.run_context":"运行上下文","doctor.context_p1":"诊断器最强大的时候是像一个检查板，而不是终端转储。此面板首先突出显示整体状态，然后将发现分解为子系统组。","doctor.context_p2":"使用分类面板识别警告集中的位置，然后再深入了解单独的消息。","doctor.subsystem_boards":"子系统面板","doctor.checks":"{count} 项检查","doctor.ok":"ok","doctor.warn":"warn","doctor.fail":"fail","doctor.system_diag_title":"系统诊断","doctor.system_diag_desc":"运行诊断器以检查 Revka 外壳中的警告、故障和全部通过的检查。","doctor.run_failed":"运行诊断失败","cost.kicker":"运营","cost.title":"成本","cost.error_title":"无法加载成本数据","cost.loading_title":"正在加载成本数据…","cost.spend_posture":"支出状态","cost.session_cost":"会话成本","cost.daily_cost":"每日成本","cost.monthly_cost":"每月成本","cost.requests":"请求数","cost.token_efficiency":"令牌效率","cost.total_tokens":"总令牌数","cost.avg_tokens":"每次请求平均令牌","cost.cost_per_1k":"每千令牌成本","cost.model_workspace":"模型工作区","cost.spend_by_model":"按模型划分的支出","cost.no_model_data":"暂无模型数据","cost.no_model_data_desc":"记录请求后会显示模型级别的支出。","cost.tokens_label":"{count} 令牌","cost.requests_label":"{count} 请求","cost.share_label":"{share}% 月度支出","cost.selected_model":"选定模型","cost.no_model_selected":"未选择模型","cost.no_model_selected_desc":"从工作区选择一个模型以检查支出集中度和效率。","cost.monthly_spend":"月度支出","cost.tokens":"令牌","cost.share_monthly":"月度支出占比","cost.interpretation":"解读","cost.interp_p1":"较大的月度占比表示成本集中在单一模型家族上。","cost.interp_p2":"较高的每次请求令牌数与较低的请求次数通常表示长上下文或生成密集型工作流。","logs.kicker":"检查","logs.title":"日志","logs.description":"Revka 守护进程 stderr 日志的实时跟踪。运行时代理事件位于审计页面。","logs.pause":"暂停","logs.resume":"继续","logs.jump_to_bottom":"跳到底部","logs.stream_status":"流状态","logs.connected":"已连接","logs.disconnected":"已断开","logs.visible_lines":"{count} 行可见。正在跟踪 ~/.revka/logs/daemon.stderr.log。","logs.event_filters":"事件过滤器","logs.no_event_types":"暂无事件类型","logs.no_event_types_desc":"流接收到活动后将显示过滤器。","logs.clear_filters":"清除过滤器","logs.live_event_feed":"实时事件流","logs.no_events":"暂无事件","logs.no_events_desc":"SSE 流接收到运行时事件后，代理活动将在此处流式传输。","tools.kicker":"运营","tools.title":"工具","tools.description":"代理可用的工具目录以及运行时可调用的主机 CLI 二进制文件。","tools.reload":"重新加载","tools.search_placeholder":"按名称、描述或类别搜索工具…","tools.loading":"正在加载工具…","tools.agent_tools_count":"代理工具 · {count}","tools.no_matches":"无匹配项","tools.no_agent_tools":"未注册代理工具","tools.try_different":"尝试其他搜索词。","tools.agent_tools_empty_desc":"运行时注册后，代理工具将显示在此处。","tools.parameter_schema":"参数架构","tools.cli_tools_count":"CLI 工具 · {count}","tools.no_cli_tools":"未检测到 CLI 工具","tools.cli_tools_empty_desc":"Revka 会在启动时探测常见的 CLI 二进制文件。安装其中一个并重新加载。","tools.col.name":"名称","tools.col.path":"路径","tools.col.version":"版本","tools.col.category":"类别","tools.failed_load":"加载工具失败: {message}","audit.kicker":"检查","audit.title":"审计","audit.description":"对操作行为进行信任链验证、事件审查和安全状态检查。","audit.refresh":"刷新","audit.verify_chain":"验证链","audit.disabled_title":"审计跟踪已禁用","audit.disabled_desc":"启用审计记录以在此处检查审批、策略和安全事件。","audit.filters":"过滤器","audit.all_event_types":"所有事件类型","audit.event.command_execution":"命令执行","audit.event.file_access":"文件访问","audit.event.config_change":"配置变更","audit.event.auth_success":"认证成功","audit.event.auth_failure":"认证失败","audit.event.policy_violation":"策略违规","audit.event.security_event":"安全事件","audit.chain_verified":"链已验证","audit.chain_invalid":"链无效","audit.entries_verified":"已验证 {count} 条条目。","audit.stream_title":"审计事件流","audit.stream_subtitle":"记录的操作和审批","audit.loading":"正在加载审计事件…","audit.empty_title":"暂无审计事件","audit.empty_desc":"一旦发出操作或审批，记录的事件将显示在此处。","audit.col.sequence":"序列","audit.col.action":"操作","audit.col.result":"结果","audit.col.hash":"哈希","audit.result_success":"成功","audit.result_recorded":"已记录","audit.policy_violation_badge":"策略违规","audit.time.seconds_ago":"{n} 秒前","audit.time.minutes_ago":"{n} 分钟前","audit.time.hours_ago":"{n} 小时前","audit.time.days_ago":"{n} 天前","integrations.kicker":"运营","integrations.title":"集成","integrations.loading":"正在加载集成…","integrations.coverage":"覆盖范围","integrations.metric.active":"活跃","integrations.metric.available":"可用","integrations.metric.coming_soon":"即将推出","integrations.categories":"分类","integrations.category_all":"全部","integrations.workspace":"集成工作区","integrations.all_integrations":"所有集成","integrations.category_integrations":"{category} 集成","integrations.empty_title":"无集成","integrations.empty_desc":"没有集成匹配当前的分类过滤器。","integrations.badge.active":"活跃","integrations.badge.available":"可用","integrations.badge.coming_soon":"即将推出","integrations.selected":"选定的集成","integrations.no_selected_title":"未选择集成","integrations.no_selected_desc":"从工作区选择一个集成以检查其推出状态。","integrations.detail.category":"类别","integrations.detail.status":"状态","integrations.detail.operational_readiness":"运行就绪度","integrations.readiness.active":"已在运行时中激活。","integrations.readiness.available":"操作员准备好后即可启用。","integrations.readiness.coming_soon":"计划中的表面，尚未准备激活。","integrations.legend":"状态图例","integrations.legend.p1":"`Active` 集成已连接到运行时工作流。","integrations.legend.p2":"`Available` 集成可从当前构建安装或连接。","integrations.legend.p3":"`Coming Soon` 集成已规划但尚未可用。","pairing.kicker":"运营","pairing.title":"配对","pairing.description":"发放配对码、渲染用于移动注册的二维码，并管理受信任的设备。","pairing.reload":"重新加载","pairing.pair_new_device":"配对新设备","pairing.generating":"正在生成…","pairing.active_code":"当前配对码","pairing.rendering":"渲染中…","pairing.code_hint":"使用 Revka 配套应用扫描二维码，或在配对设备上输入 6 位代码。当设备完成注册或您生成新代码时，代码会过期。","pairing.copy_code":"复制代码","pairing.rotate":"轮换","pairing.cli_device_name":"CLI 设备名称","pairing.cli_hardware":"硬件","pairing.cli_hardware_placeholder":"可选平台标签","pairing.mint_cli_token":"铸造 CLI 令牌","pairing.minting_token":"正在铸造…","pairing.minted_token":"已铸造的 Bearer 令牌","pairing.copy_token":"复制令牌","pairing.no_code_title":"无活动配对码","pairing.no_code_desc":'按"配对新设备"生成新代码和二维码。代码是短期的，用于单次注册。',"pairing.how_to_scan":"如何扫描","pairing.scan_step1":"在新设备上打开 Revka 配套应用。","pairing.scan_step2_prefix":"选择 ","pairing.scan_step2_action":"与中心配对","pairing.scan_step2_suffix":"。","pairing.scan_step3":"扫描二维码或手动输入 6 位代码。","pairing.scan_step4":"注册完成后，设备将出现在下方列表中。","pairing.paired_devices":"已配对设备 · {count}","pairing.loading_devices":"正在加载设备…","pairing.no_devices_title":"尚未配对任何设备","pairing.no_devices_desc":"成功注册后，已配对的设备将显示在此处。","pairing.col.name":"名称","pairing.col.type":"类型","pairing.col.hardware":"硬件","pairing.col.paired":"配对时间","pairing.col.last_seen":"最后在线","pairing.col.ip":"IP","pairing.col.actions":"操作","pairing.unnamed":"未命名","pairing.unknown":"未知","pairing.device_type.api_client":"API 客户端","pairing.device_type.browser":"浏览器","pairing.device_type.cli":"CLI","pairing.device_type.mobile":"移动设备","pairing.device_type.tablet":"平板","pairing.revoke":"撤销？","pairing.yes":"是","pairing.no":"否","pairing.revoke_title":"撤销设备","pairing.toast.code_generated":"已生成新的配对码。","pairing.toast.code_copied":"代码已复制。","pairing.toast.token_minted":"Bearer 令牌已铸造。请立即复制。","pairing.toast.token_copied":"令牌已复制。","pairing.toast.copy_failed":"复制失败。请手动选择。","pairing.toast.device_revoked":"设备已撤销。","pairing.err.load_devices":"加载设备失败","pairing.err.gen_code":"生成配对码失败","pairing.err.mint_token":"铸造 Bearer 令牌失败","pairing.err.revoke":"撤销设备失败","cron.kicker":"运营","cron.description":"定时任务、追赶行为和最近的运行历史。","cron.reload":"重新加载","cron.startup_behaviour":"启动行为","cron.catch_up_title":"启动时追赶错过的任务","cron.catch_up_desc":"当 Revka 在停机后启动时，运行所有过期任务。","cron.loading_jobs":"正在加载定时任务…","cron.no_jobs_title":"没有预定的任务","cron.no_jobs_desc":"添加一个 cron 任务以按计划运行命令。","cron.col.id":"ID","cron.col.name":"名称","cron.col.command":"命令","cron.col.next_run":"下次运行","cron.col.last_status":"上次状态","cron.col.enabled":"已启用","cron.col.actions":"操作","cron.enabled_badge":"已启用","cron.disabled_badge":"已禁用","cron.toggle_history":"切换运行历史","cron.confirm":"确认？","cron.history.loading":"正在加载运行历史…","cron.history.error_title":"无法加载运行历史","cron.history.retry":"重试","cron.history.no_runs_title":"尚无运行","cron.history.no_runs_desc":"此任务自创建以来尚未执行。","cron.history.refresh":"刷新","cron.history.recent":"最近运行 · {count}","cron.history.refresh_title":"刷新运行","cron.modal.edit_title":"编辑 Cron 任务","cron.modal.add_title":"添加 Cron 任务","cron.modal.description":"名称为可选。计划使用标准 cron 表达式。","cron.form.name":"名称","cron.form.optional":"（可选）","cron.form.name_placeholder":"例如：每日清理","cron.form.schedule":"计划","cron.form.command":"命令","cron.form.command_placeholder":"例如：cleanup --older-than 7d","cron.form.cancel":"取消","cron.form.saving":"保存中…","cron.form.adding":"添加中…","cron.form.save":"保存","cron.err.load":"加载任务失败：{message}","cron.err.settings":"更新设置失败","cron.err.save":"保存任务失败","cron.err.delete":"删除任务失败","cron.err.form_required":"计划和命令是必需的。","cron.toast.updated":'已更新"{name}"。',"cron.toast.added":'已添加"{name}"。',"cron.toast.deleted":"任务已删除。","canvas.kicker":"编排中心","canvas.title":"画布","canvas.reconnect":"重新连接","canvas.control":"画布控制","canvas.connected":"已连接","canvas.disconnected":"已断开","canvas.canvas_id_placeholder":"画布 ID","canvas.switch":"切换","canvas.clear":"清除","canvas.available":"可用画布","canvas.loading_list":"正在加载画布…","canvas.loading_list_desc":"正在轮询实时画布注册表。","canvas.no_active_title":"无活动画布","canvas.no_active_desc":"代理或工作流推送帧后，画布 ID 将显示在此处。","canvas.active":"活跃","canvas.viewport":"画布视口","canvas.live_output":"实时帧输出","canvas.canvas_label":"画布","canvas.connection":"连接","canvas.live":"实时","canvas.offline":"离线","canvas.frame_type":"帧类型","canvas.last_update":"上次更新","canvas.waiting_label":"等待帧","canvas.frame_suffix":"帧","canvas.waiting_for_content":'正在等待"{id}"上的内容',"canvas.waiting_for_content_desc":"代理可以使用画布工具将内容推送到此处。帧到达后会立即在此视口中渲染。","canvas.disconnected_title":"画布套接字已断开","canvas.disconnected_desc":"重新连接到当前画布或切换到另一个实时画布 ID。","canvas.reconnect_button":"重新连接画布","canvas.frame_id":"帧 ID","canvas.guidance":"画布指南","canvas.guidance_desc":"使用助手直接在此视口中生成图表、图示、markdown 报告和 HTML 仪表板。","canvas.history":"帧历史","canvas.hide":"隐藏","canvas.show":"显示","canvas.history_collapsed_title":"历史已折叠","canvas.history_collapsed_desc":"展开此栏以检查活动画布上的先前帧。","canvas.no_frames_title":"尚无帧","canvas.no_frames_desc":"帧到达时将存储在此处以便快速回溯。","skills.kicker":"运营","skills.title":"技能","skills.create_skill":"创建技能","skills.registry_status":"注册表状态","skills.summary.total":"总计","skills.summary.active":"活跃","skills.summary.deprecated":"已弃用","skills.summary.domains":"领域","skills.index":"技能索引","skills.search_placeholder":"搜索技能…","skills.loading":"正在加载技能…","skills.no_skills_title":"未找到技能","skills.no_skills_desc":"创建本地技能以开始填充运营注册表。","skills.status.active":"活跃","skills.status.deprecated":"已弃用","skills.workspace":"技能工作区","skills.select_placeholder":"选择一个技能","skills.description":"描述","skills.content":"技能内容","skills.content_empty":"该技能没有可显示的内容。","skills.edit":"编辑","skills.reenable":"重新启用","skills.deprecate":"弃用","skills.deleting":"删除中…","skills.delete":"删除","skills.no_selected_title":"未选择技能","skills.no_selected_desc":"选择一个技能以检查其内容和运营元数据。","skills.install_github":"从 GitHub 安装","skills.install_github_desc":"粘贴 GitHub 仓库 URL 以直接安装技能。","skills.github_placeholder":"https://github.com/org/skill-repo","skills.installing":"正在安装…","skills.install":"安装","skills.marketplace":"市场","skills.marketplace_shown":"{count} 显示","skills.marketplace_placeholder":"搜索 ClawHub 技能…","skills.search":"搜索","skills.trending":"热门","skills.marketplace_loading":"正在加载市场…","skills.marketplace_empty":"没有市场结果","skills.modal.edit_title":"编辑技能","skills.modal.create_title":"创建技能","skills.modal.description":"技能是可以附加到代理和运行的可重用操作能力。","skills.modal.name_placeholder":"技能名称","skills.modal.description_placeholder":"描述","skills.modal.tags_placeholder":"逗号分隔的标签","skills.modal.content_placeholder":"技能 markdown 内容","skills.modal.cancel":"取消","skills.modal.saving":"保存中…","skills.modal.save_skill":"保存技能","skills.toast.updated":'技能"{name}"已更新。',"skills.toast.created":'技能"{name}"已创建。',"skills.toast.reenabled":'已重新启用技能"{name}"。',"skills.toast.deprecated":'已弃用技能"{name}"。',"skills.toast.deleted":'技能"{name}"已删除。',"skills.toast.installed":'已安装技能"{name}"。',"skills.toast.installed_github":'已从 GitHub 安装技能"{name}"。',"skills.err.save":"保存技能失败。","skills.err.load_detail":"加载技能内容失败。","skills.err.toggle":"更改技能状态失败。","skills.err.delete":"删除技能失败。","skills.err.install":"安装市场技能失败。","skills.err.install_github":"从 GitHub URL 安装技能失败。","teams.kicker":"编排中心","teams.title":"团队","teams.create":"创建团队","teams.refresh":"刷新","teams.count":"{count} 个团队","teams.agent_count":"{count} 个代理","teams.loading":"加载中…","teams.loading_desc":"正在加载团队…","teams.empty_title":"无团队","teams.empty_desc":"创建一个团队以开始。","teams.none_selected_title":"未选择团队","teams.none_selected_desc":"从索引中选择一个团队。","teams.members_suffix":"{members} 成员 · {edges} 边","teams.status.off":"关闭","teams.status.live":"运行","teams.status.deprecated":"已弃用","teams.status.active":"活跃","teams.action.edit":"编辑","teams.action.reenable":"重新启用","teams.action.deprecate":"弃用","teams.action.delete":"删除","teams.stats.members":"成员","teams.stats.edges":"边","teams.stats.status":"状态","teams.tab.summary":"概览","teams.tab.member":"成员","teams.open_agent_registry":"打开代理注册表","teams.modal.edit_title":"编辑团队","teams.modal.create_title":"创建团队","teams.modal.description":"团队编辑器现在直接在新界面中处理身份、组成以及核心报告/依赖边。","teams.form.name":"团队名称","teams.form.description":"描述","teams.form.members":"成员","teams.form.topology_preview":"拓扑预览","teams.form.edge_authoring":"边编辑","teams.form.from_member":"源成员","teams.form.to_member":"目标成员","teams.form.edge_reports_to":"报告给","teams.form.edge_supports":"支持","teams.form.edge_depends_on":"依赖于","teams.form.add_edge":"添加边","teams.form.remove":"移除","teams.form.no_edges":"尚未定义拓扑边。","teams.form.draft_summary":"草稿摘要","teams.form.draft_members":"成员","teams.form.draft_edges":"边","teams.form.draft_hint":"`REPORTS_TO` 用于层级,`SUPPORTS` 用于协作通道,`DEPENDS_ON` 用于阻塞执行关系。","teams.form.draft_team_name":"草稿团队","teams.form.cancel":"取消","teams.form.saving":"保存中…","teams.form.save":"保存团队","teams.toast.updated":"团队 “{name}” 已更新。","teams.toast.created":"团队 “{name}” 已创建。","teams.toast.deleted":"团队 “{name}” 已删除。","teams.toast.reenabled":"团队 “{name}” 已重新启用。","teams.toast.deprecated":"团队 “{name}” 已弃用。","teams.err.save":"保存团队失败。","teams.err.toggle":"更改团队状态失败。","teams.err.delete":"删除团队失败。","agents.kicker":"编排中心","agents.title":"代理","agents.create":"创建代理","agents.refresh":"刷新","agents.search_placeholder":"搜索代理…","agents.filter.all_roles":"所有角色","agents.filter.coder":"编码员","agents.filter.reviewer":"审阅者","agents.filter.researcher":"研究员","agents.filter.hide_disabled":"隐藏已停用","agents.filter.show_disabled":"显示已停用","agents.count":"{count} 个代理","agents.loading":"加载中…","agents.loading_desc":"正在加载代理…","agents.empty_title":"无代理","agents.empty_desc":"调整筛选条件或创建一个。","agents.none_selected_title":"未选择代理","agents.none_selected_desc":"从索引中选择一个代理。","agents.status.disabled":"已停用","agents.status.active":"活跃","agents.stats.registry":"注册表","agents.stats.active":"活跃","agents.stats.codex":"Codex","agents.section.identity":"身份","agents.section.soul":"灵魂","agents.section.soul_empty":"未提供灵魂描述。","agents.section.expertise":"专长","agents.section.no_expertise":"没有专长标签。","agents.section.voice":"语气","agents.section.voice_empty":"未指定","agents.section.revision":"修订","agents.section.created":"创建时间","agents.action.edit":"编辑","agents.action.reenable":"重新启用","agents.action.deprecate":"弃用","agents.action.delete":"删除","agents.action.deleting":"删除中…","agents.tab.summary":"概览","agents.tab.prompt":"提示","agents.summary.name":"名称","agents.summary.role":"角色","agents.summary.type":"类型","agents.summary.model":"模型","agents.summary.model_default":"默认","agents.summary.tone":"语气","agents.summary.revision":"修订","agents.summary.created":"创建时间","agents.prompt.system_hint":"系统提示","agents.prompt.system_hint_empty":"未配置系统提示。","agents.prompt.identity_seed":"身份种子","agents.modal.create_title":"创建代理","agents.modal.edit_title":"编辑代理","agents.modal.description":"代理是以身份驱动的操作者。Revka 将人设、模型和提示表面集中在一处。","agents.form.name":"名称","agents.form.tone":"语气","agents.form.tone_placeholder":"简洁直接","agents.form.identity":"身份","agents.form.soul":"灵魂","agents.form.role":"角色","agents.form.role.coder":"编码员","agents.form.role.reviewer":"审阅者","agents.form.role.researcher":"研究员","agents.form.agent_type":"代理类型","agents.form.model":"模型","agents.form.model_placeholder":"gpt-5.4 / claude-sonnet-4-6","agents.form.expertise":"专长","agents.form.expertise_placeholder":"rust, review, orchestration","agents.form.system_hint":"系统提示","agents.form.cancel":"取消","agents.form.saving":"保存中…","agents.form.save_create":"创建代理","agents.form.save_edit":"保存代理","agents.toast.updated":"代理 “{name}” 已更新。","agents.toast.created":"代理 “{name}” 已创建。","agents.toast.deleted":"代理 “{name}” 已删除。","agents.toast.reenabled":"代理 “{name}” 已重新启用。","agents.toast.deprecated":"代理 “{name}” 已弃用。","agents.err.load":"加载代理失败。","agents.err.save":"保存代理失败。","agents.err.toggle":"更改代理状态失败。","agents.err.delete":"删除代理失败。","runs.kicker":"编排中心","runs.title":"工作流运行","runs.refresh":"刷新","runs.index.title":"运行索引","runs.empty.title":"无运行记录","runs.empty.desc":"执行工作流以填充此索引。","runs.error.title":"加载错误","runs.stats.steps_fraction":"{completed}/{total} 步骤","runs.stats.expanded_steps":"{count} 个展开步骤","runs.stats.loop_fraction":"循环 {iteration}/{total}: {step}","runs.stats.loop_iteration":"循环 {iteration}: {step}","runs.open_definition":"打开定义","runs.action.retry_failed":"重试失败步骤","runs.action.retrying":"重试中…","runs.action.retry_tooltip":"重试失败的步骤","runs.action.stop":"停止","runs.action.stopping":"停止中…","runs.action.stop_tooltip":"停止此运行实例","runs.action.delete_tooltip":"删除运行","runs.none_selected.title":"未选择运行","runs.none_selected.desc":"从索引中选择一个运行。","runs.banner.label":"当前选择","runs.overlay.path_mode":"路径模式","runs.overlay.path.all":"全部","runs.overlay.path.failed":"失败","runs.overlay.path.blocked":"阻塞","runs.overlay.signals":"信号","runs.overlay.prev":"上一个","runs.overlay.next":"下一个","runs.overlay.signal_count":"{count} 个信号","runs.overlay.posture":"状态","runs.overlay.running":"运行中","runs.overlay.failed":"失败","runs.overlay.done":"完成","runs.overlay.pending":"待处理","runs.overlay.skipped":"已跳过","runs.overlay.hotspots":"热点","runs.overlay.legend_running":"运行中","runs.overlay.legend_failure":"失败","runs.overlay.legend_blocked":"阻塞","runs.overlay.legend_skipped":"已跳过","runs.overlay.legend_gate":"门","runs.overlay.fail_label":"失败:{id}","runs.overlay.run_label":"运行:{id}","runs.overlay.block_label":"阻塞:{id}","runs.started_at":"开始于 {time}","runs.inspector.title":"步骤检查器","runs.tab.summary":"概览","runs.tab.output":"输出","runs.tab.tools":"工具","runs.tab.transcript":"记录","runs.tab.jsonl":"JSONL 日志","runs.detail.select_node":"选择 DAG 节点以检查。","runs.detail.no_description":"无描述。","runs.detail.depends_on":"依赖:{list}","runs.detail.depends_none":"无","runs.detail.agent":"代理:{type}{role}","runs.detail.agent_na":"不适用","runs.detail.skills":"技能:{list}","runs.detail.dashboard_link":"仪表板","runs.detail.definition_link":"定义","runs.detail.select_step":"选择一个步骤。","runs.detail.step_output":"步骤输出","runs.detail.agent_output":"代理输出","runs.detail.no_output":"未捕获输出。","runs.detail.loading":"加载中…","runs.detail.tools_calls":"调用","runs.detail.tools_errors":"错误","runs.detail.no_tools":"未记录工具调用。","runs.detail.no_activity":"无代理活动记录。","runs.detail.no_jsonl":"未找到此代理的 JSONL 条目。","runs.detail.no_jsonl_filter":"没有条目匹配筛选条件。","runs.detail.no_transcript":"无记录。","runs.detail.tool_default":"工具","runs.detail.tool_status_ok":"ok","runs.timeline":"时间线 ({count})","runs.toast.retry_started":"运行 {id} 的重试已开始。","runs.toast.stop_requested":"运行 {id} 的停止请求已发送。","runs.toast.deleted":"运行 {id} 已删除。","runs.err.retry":"重试运行失败。","runs.err.stop":"停止运行失败。","runs.err.delete":"删除运行失败。","memory.kicker":"检查","memory.page_title":"记忆","memory.page_description":"记忆图检查,支持种类过滤、空间作用域、搜索高亮和节点关联的详情钻取。","memory.selected_memory":"选中的记忆","memory.loading_detail":"正在加载节点详情…","memory.relative.just_now":"刚刚","memory.relative.minutes":"{count} 分钟前","memory.relative.hours":"{count} 小时前","memory.relative.days":"{count} 天前","memory.detail.metadata":"元数据","memory.detail.bundle_members":"捆绑成员","memory.controls.title":"图控件","memory.controls.search_placeholder":"高亮记忆…","memory.controls.all_spaces":"所有空间","memory.controls.node_limit":"节点数限制","memory.filters.title":"筛选器","memory.filters.empty_title":"尚未加载种类","memory.filters.empty_desc":"一旦记忆数据可用,图筛选器就会显示。","memory.graph.kicker":"记忆图","memory.graph.heading":"语义记忆拓扑","memory.graph.items":"条目","memory.graph.edges":"边","memory.graph.shown":"已显示","memory.graph.matches":"{count} 个匹配","memory.graph.match":"{count} 个匹配","memory.graph.loading_title":"正在加载记忆图…","memory.graph.loading_desc":"正在获取语义记忆拓扑和关系边。","memory.graph.error_title":"无法加载记忆图","memory.graph.retry":"重试","memory.graph.empty_title":"未找到记忆","memory.graph.empty_desc":"调整筛选条件、清除搜索或增加节点数以扩展图。","memory.none_selected_title":"未选择记忆","memory.none_selected_desc":"在图中选择一个节点以查看元数据、基于修订的详情和捆绑成员关系。","memory.err.load":"加载记忆图失败","assets.kicker":"运维","assets.title":"资产","assets.search_placeholder":"搜索资产…","assets.project":"项目","assets.up":"上一级","assets.err.load":"加载 Kumiho 项目失败。请检查 Kumiho API 是否可达。","assets.col.name":"名称","assets.col.kind":"类型","assets.col.author":"作者","assets.col.created":"创建时间","assets.loading.projects":"正在加载项目…","assets.loading.space":"正在加载空间…","assets.loading.generic":"加载中…","assets.folder":"文件夹","assets.empty.title":"空的空间","assets.empty.desc":"此位置没有文件夹或资产。","assets.search.empty_title":"无结果","assets.search.empty_desc":'没有资产匹配 "{query}"。',"assets.search.result_count":'"{query}" 的 {count} 个结果',"assets.copy_kref":"复制 kref","assets.close_inspector":"关闭检查器","assets.deprecated":"已弃用","assets.active":"活跃","assets.rev_count":"{count} 个修订","assets.rev_count_one":"{count} 个修订","assets.by":"由 {author}","assets.section.revisions":"修订","assets.section.artifacts":"工件","assets.section.edges":"边","assets.section.metadata":"元数据","assets.section.revisions_empty":"无修订。","assets.section.artifacts_empty":"无工件。","assets.section.edges_empty":"无边。","assets.section.metadata_empty":"无元数据。","assets.tag.latest":"最新","assets.tag.published":"已发布","assets.action.view":"查看","assets.action.edit":"编辑","assets.action.restore":"恢复","assets.action.deprecate":"弃用","assets.action.publish":"发布","assets.action.published":"已发布","assets.action.save_artifact":"保存工件","assets.action.deprecate_item":"弃用选中项目","assets.action.restore_item":"恢复选中项目","assets.action.deprecate_revision":"弃用选中修订","assets.action.restore_revision":"恢复选中修订","assets.action.publish_revision":"将选中修订标记为已发布","assets.action.edit_artifact":"编辑工件","assets.action.deprecate_artifact":"弃用工件","assets.action.restore_artifact":"恢复工件","assets.toast.item_deprecated":"项目已弃用。","assets.toast.item_restored":"项目已恢复。","assets.toast.revision_deprecated":"修订已弃用。","assets.toast.revision_restored":"修订已恢复。","assets.toast.revision_published":"修订已标记为已发布。","assets.toast.artifact_deprecated":"工件已弃用。","assets.toast.artifact_restored":"工件已恢复。","assets.toast.artifact_saved":"工件内容已更新。","assets.toast.artifact_saved_new_revision":"已创建新修订并附加更新后的工件。","assets.err.action":"资产操作失败。","assets.err.load_artifact":"加载工件内容失败。","assets.editor.title":"编辑 {name}","assets.editor.mutable_desc":"保存会更新当前修订的工件文件。","assets.editor.published_desc":"此修订已发布且不可变。保存会创建新修订并附加更新后的工件。","config.kicker":"运维","config.page_title":"配置","config.reload":"重新加载","config.save_button":"保存配置","config.saving_button":"保存中…","config.loading_title":"正在加载配置…","config.toast.saved":"配置已保存。","config.err.load":"加载配置失败。","config.err.save":"保存配置失败。","config.err.mcp_errors":"保存前请修复 MCP 服务器错误。","config.map":"配置地图","config.workspace":"TOML 工作区","config.workspace.structured_heading":"结构化控件","config.workspace.source_heading":"源代码编辑器","config.tab.structured":"结构化","config.tab.source":"源代码","config.tabs_aria":"配置工作区标签","config.hide_preview":"隐藏预览","config.show_preview":"显示预览","config.mapped_paths":"映射的 TOML 路径","config.structured.error_title":"无法构建结构化控件","config.structured.error_desc":"在显示分组配置控件之前,原始 TOML 必须可解析。","config.summary.title":"解析摘要","config.summary.error_title":"无法解析 TOML","config.summary.error_desc":"只有当编辑器包含可解析的 TOML 段时,摘要面板才会更新。","config.source_health":"源代码健康状况","config.row.workspace_mode":"工作区模式","config.row.preview":"预览","config.row.sections":"段","config.row.parse_status":"解析状态","config.row.parse_valid":"有效","config.row.parse_needs":"需要注意","config.mode.structured":"结构化","config.mode.source":"源代码","config.toggle.enabled":"已启用","config.toggle.disabled":"已禁用","config.section.provider":"提供商","config.section.provider_desc":"默认模型提供商、API 路由和生成参数。","config.section.agent":"代理","config.section.agent_desc":"代理运行时的循环限制、上下文预算和推理默认值。","config.section.memory":"记忆","config.section.memory_desc":"记忆后端、Kumiho 连接和持久化行为。","config.section.runtime":"运行时","config.section.runtime_desc":"网关绑定设置、配对和自治姿态。","config.section.security":"安全/成本","config.section.security_desc":"审计和沙箱设置以及成本限额控制。","config.section.channels":"通道","config.section.channels_desc":"运营通道的 CLI 和消息传递表面行为。","config.section.mcp":"MCP 服务器","config.section.mcp_desc":"模型上下文协议客户端 — 顶层开关和结构化服务器条目。","config.section.extra_desc":"在 config.toml 中发现的附加章节 — 通用编辑器。","config.generic.empty":"此章节暂无字段。","config.generic.empty_array":"（空数组）","config.generic.array_readonly":"数组在通用编辑器中为只读 — 请使用源代码标签修改。","config.provider.default_provider":"默认提供商","config.provider.default_model":"默认模型","config.provider.temperature":"温度","config.provider.timeout":"提供商超时","config.provider.max_tokens":"提供商最大 Token","config.agent.max_tool_iterations":"最大工具迭代次数","config.agent.max_context_tokens":"最大上下文 Token","config.agent.max_history_messages":"最大历史消息数","config.agent.gpt55_context_window":"GPT-5.5 上下文窗口","config.agent.context_window_safety_ratio":"上下文安全比例","config.agent.parallel_tools":"并行工具","config.agent.thinking_level":"思考级别","config.memory.kumiho_enabled":"Kumiho 启用","config.memory.memory_project":"记忆项目","config.memory.harness_project":"Harness 项目","config.memory.retrieval_limit":"检索限制","config.memory.backend":"记忆后端","config.memory.auto_save":"自动保存","config.memory.snapshots":"快照","config.runtime.gateway_host":"网关主机","config.runtime.gateway_port":"网关端口","config.runtime.require_pairing":"需要配对","config.runtime.session_persistence":"会话持久化","config.runtime.autonomy_level":"自治级别","config.runtime.max_actions_hour":"每小时最大操作数","config.security.audit_enabled":"审计已启用","config.security.sandbox_backend":"沙箱后端","config.security.daily_limit":"每日限额 USD","config.security.monthly_limit":"每月限额 USD","config.security.warn_percent":"警告百分比","config.channels.cli":"CLI 通道","config.channels.ack_reactions":"确认反应","config.channels.show_tool_calls":"显示工具调用","config.channels.message_timeout":"消息超时秒数","config.summary.api_url":"API URL","config.summary.provider":"提供商","config.summary.model":"模型","config.summary.temperature":"温度","config.summary.timeout":"超时","config.summary.max_tokens":"最大 Token","config.summary.runtime":"运行时","config.summary.gateway":"网关","config.summary.pairing_required":"需要配对","config.summary.session_persistence":"会话持久化","config.summary.autonomy_level":"自治级别","config.summary.workspace_only":"仅工作区","config.summary.max_actions_hour":"每小时最大操作数","config.summary.memory":"记忆","config.summary.backend":"后端","config.summary.auto_save":"自动保存","config.summary.hygiene":"卫生处理","config.summary.snapshots":"快照","config.summary.kumiho_enabled":"Kumiho 启用","config.summary.memory_project":"记忆项目","config.summary.retrieval_limit":"检索限制","config.summary.safety_cost":"安全/成本","config.summary.audit_enabled":"审计已启用","config.summary.sandbox_backend":"沙箱后端","config.summary.daily_limit":"每日限额","config.summary.monthly_limit":"每月限额","config.summary.warn_percent":"警告百分比","config.summary.channels":"通道","config.summary.cli":"CLI","config.summary.telegram":"Telegram","config.summary.discord":"Discord","config.summary.slack":"Slack","config.summary.matrix":"Matrix","config.summary.signal":"Signal","config.summary.whatsapp":"WhatsApp","config.row.enabled":"已启用","config.row.disabled":"已禁用","config.mcp.title":"MCP","config.mcp.enabled":"MCP 已启用","config.mcp.deferred":"延迟加载","config.mcp.servers":"服务器","config.mcp.no_servers":"尚未配置任何服务器。","config.mcp.server_count":"已配置 {count} 个服务器。","config.mcp.server_count_one":"已配置 1 个服务器。","config.mcp.add_server":"添加 MCP 服务器","config.mcp.confirm_remove":"移除 {label}?","config.mcp.entry_label":"条目 {index}","config.mcp.server_default":"服务器 {index}","config.mcp.stdio_empty":"stdio — 未设置命令","config.mcp.transport_empty":"{transport} — 未设置 url","config.mcp.test":"测试","config.mcp.testing":"测试中…","config.mcp.test_tooltip":"运行 MCP initialize + tools/list 握手","config.mcp.test_blocked":"测试前请修复验证错误","config.mcp.delete_label":"删除 {label}","config.mcp.connecting":"连接中…","config.mcp.tool_count":"{count} 个工具 · {latency}ms","config.mcp.tool_count_one":"1 个工具 · {latency}ms","config.mcp.tools_list":"工具:{list}","config.mcp.handshake_failed":"握手失败","config.mcp.field_name":"名称","config.mcp.field_name_placeholder":"例如 memory","config.mcp.field_transport":"传输","config.mcp.field_command":"命令","config.mcp.field_command_placeholder":"/usr/local/bin/mcp-server","config.mcp.field_args":"参数","config.mcp.field_args_placeholder":"--flag","config.mcp.field_env":"环境变量","config.mcp.field_env_key":"KEY","config.mcp.field_env_value":"value","config.mcp.field_url":"URL","config.mcp.field_url_placeholder":"https://example.com/mcp","config.mcp.field_headers":"头部","config.mcp.field_headers_key":"Header-Name","config.mcp.field_headers_value":"value","config.mcp.field_timeout":"超时 (毫秒)","config.mcp.field_timeout_placeholder":"30000","config.mcp.add_entry":"添加 {label}","config.mcp.remove_entry":"移除 {label} 条目 {index}","landing.skip_link":"跳转到主要内容","landing.nav.aria_label":"站点导航","landing.nav.logo_alt":"Revka 徽标","landing.nav.features":"功能","landing.nav.launch":"打开仪表盘","landing.hero.aria_label":"首屏","landing.hero.badge":"记忆原生 · Rust 原生 · 图原生","landing.hero.tagline":"记忆原生的智能体运行时","landing.hero.description":"基于 Kumiho 的图原生记忆构建。每一次会话、计划、技能和信任分数都存在于图中 — 只要发生过,就可以被查询。","landing.hero.cta_primary":"打开仪表盘","landing.hero.cta_secondary":"浏览功能","landing.hero.banner_alt":"Revka — 记忆原生的智能体运行时仪表盘","landing.hero.scroll_cue":"向下滚动","landing.stats.aria_label":"关键指标","landing.stats.runtime_label":"运行时","landing.stats.namespaces_label":"命名空间","landing.stats.memory_label":"记忆图谱","landing.stats.goals_label":"目标追踪","landing.stats.orchestration_label":"编排","landing.pillars.aria_label":"三大支柱","landing.pillars.badge":"三大支柱","landing.pillars.title":"一个运行时,适配任意界面","landing.pillars.description":"Revka 构建在三大基石之上 — 提供商无关的智能体、图原生的记忆,以及任意渠道的触达。","landing.pillars.agents.title":"智能体","landing.pillars.agents.desc":"提供商无关的智能体(OpenAI、Anthropic、本地模型)通过工作流和集群进行编排 — 全部运行在你的设备上。","landing.pillars.memory.title":"记忆","landing.pillars.memory.desc":"通过 Kumiho、SQLite 或 Markdown 跨会话保留知识。智能体会记住你、你的项目和过往的决策。","landing.pillars.channels.title":"渠道","landing.pillars.channels.desc":"通过 Telegram、Discord、Slack、iMessage、Matrix、邮件等渠道与 Revka 交流。一个运行时,适配任意界面。","landing.features.aria_label":"功能","landing.features.badge":"能力","landing.features.title":"为智能体时代而生","landing.features.description":"每个组件都围绕持久化记忆和多智能体协作设计 — 从生成到退役的全流程。","landing.features.featured_badge":"核心记忆基石","landing.features.memory.title":"Kumiho 记忆","landing.features.memory.desc":"图原生的持久化记忆。每次会话、计划和技能都经过版本管理、链接且可查询 — 不依赖任何回退后端。","landing.features.operator.title":"Operator","landing.features.operator.desc":"多智能体编排,支持角色委派(编码者、审核者、研究员)、带记忆唤起的派生以及信任评分。","landing.features.pool.title":"智能体池","landing.features.pool.desc":"可复用的智能体定义,包含角色、能力和模型偏好。用量追踪会优先呈现表现优秀的智能体。","landing.features.clawhub.title":"ClawHub 市场","landing.features.clawhub.desc":"在共享注册中心发布、搜索和安装智能体模板、技能和团队配置。","landing.features.goals.title":"目标层级","landing.features.goals.desc":"三层目标追踪:战略级、战术级和任务级 — 全部带状态与依赖关系持久化在图中。","landing.features.audit.title":"审计轨迹","landing.features.audit.desc":"Merkle 哈希链防篡改日志。每次操作都以可加密验证的方式记录。","landing.how.aria_label":"工作原理","landing.how.badge":"流程","landing.how.title":"Revka 是如何工作的","landing.how.description":"从智能体部署到持续回忆 — 三个紧密衔接的步骤管理完整生命周期。","landing.how.step1.title":"部署智能体","landing.how.step1.desc":"配置角色、能力和模型偏好。Revka 会将模板存入图中以便复用与回忆。","landing.how.step2.title":"记忆持续累积","landing.how.step2.desc":"每一次会话、计划、技能和交互都会在 Kumiho 中进行版本化和边连接。没有任何东西会丢失。","landing.how.step3.title":"对一切进行查询","landing.how.step3.desc":"利用目标层级、信任评分和图遍历,从所有智能体历史中挖掘洞察。","landing.cli.aria_label":"命令行参考","landing.cli.badge":"命令行","landing.cli.title":"从终端操控一切","landing.cli.description":"守护进程必须运行,仪表盘和渠道才能响应。UI 上的所有操作都对应一个命令。","landing.cli.cmd.onboard":"运行交互式初始化向导","landing.cli.cmd.reinit":"从头重置并重新配置(含隧道)","landing.cli.cmd.daemon":"启动长期运行的运行时","landing.cli.cmd.doctor":"检查守护进程、调度器和渠道的健康状态","landing.cli.cmd.status":"打印完整的系统状态","landing.cli.cmd.channel_list":"列出已配置的渠道","landing.cli.cmd.channel_add":"添加 Telegram 机器人","landing.cli.cmd.providers":"列出受支持的 AI 提供商","landing.cli.cmd.memory_stats":"查看智能体记忆大小","landing.cli.cmd.service_install":"作为 launchd/systemd 用户服务安装","landing.arch.aria_label":"架构","landing.arch.badge":"图原生","landing.arch.title":"一切尽在图中","landing.arch.description":"所有持久化状态都位于 Kumiho 的严格命名空间层级之下 — 版本化、边链接,并可跨会话查询。","landing.arch.ns.agentpool":"可复用的智能体模板","landing.arch.ns.plans":"执行计划和步骤","landing.arch.ns.sessions":"跨会话连续性","landing.arch.ns.goals":"战略目标追踪","landing.arch.ns.clawhub":"已发布的模板和技能","landing.arch.ns.teams":"团队定义","landing.arch.ns.skills":"共享技能库","landing.arch.ns.trust":"信任评分和历史","landing.arch.connection_note":"所有命名空间通过 Kumiho 的图边互相连接","landing.tunnels.aria_label":"关于隧道","landing.tunnels.badge":"隧道","landing.tunnels.title":"公开访问,本地可信","landing.tunnels.description_prefix":"你的网关运行在 ","landing.tunnels.description_suffix":" 上 — 仅本机可访问。基于 Webhook 的渠道(Telegram、Slack 事件、WhatsApp、WeChat)需要公共 URL。隧道可将一个公共主机名转发到你本地的网关,而无需打开防火墙端口。","landing.tunnels.provider.cloudflare.name":"Cloudflare Tunnel","landing.tunnels.provider.cloudflare.desc":"免费且达到生产级别。需要 Zero Trust 账户和一个隧道令牌。","landing.tunnels.provider.ngrok.name":"ngrok","landing.tunnels.provider.ngrok.desc":"快捷且临时,非常适合本地开发和测试。","landing.tunnels.provider.tailscale.name":"Tailscale Funnel","landing.tunnels.provider.tailscale.desc":"使用你的 tailnet 身份将一个 tailnet 服务公开共享。","landing.tunnels.provider.custom.name":"自定义","landing.tunnels.provider.custom.desc":"自带反向代理或公共 URL。","landing.tunnels.setup_hint_prefix":"运行 ","landing.tunnels.setup_hint_suffix":" 并在提示时选择一个提供商。","landing.cta.aria_label":"开始使用","landing.cta.headline_prefix":"准备好","landing.cta.headline_highlight":"开始构建","landing.cta.headline_suffix":"了吗?","landing.cta.description":"打开仪表盘来管理智能体、浏览技能库、编排团队,以及探索图中记录的一切。","landing.cta.button":"打开仪表盘","landing.footer.tagline":"记忆原生的智能体运行时"},en:{"nav.dashboard":"Dashboard","nav.agent":"Agent","nav.tools":"Tools","nav.cron":"Scheduled Jobs","nav.integrations":"Integrations","nav.memory":"Memory","nav.config":"Configuration","nav.cost":"Cost Tracker","nav.logs":"Logs","nav.doctor":"Doctor","nav.agents":"Agent Pool","nav.skills":"Skills Library","nav.teams":"Agent Teams","nav.assets":"Asset Browser","nav.skins":"Skins","nav.memoryAuditor":"Memory Auditor","nav.audit":"Audit Trail","nav.canvas":"Canvas","nav.workflows":"Workflows","dashboard.title":"Dashboard","dashboard.provider":"Provider","dashboard.model":"Model","dashboard.uptime":"Uptime","dashboard.temperature":"Temperature","dashboard.gateway_port":"Gateway Port","dashboard.memory_backend":"Memory Backend","dashboard.paired":"Paired","dashboard.channels":"Channels","dashboard.health":"Health","dashboard.status":"Status","dashboard.overview":"Overview","dashboard.system_info":"System Information","dashboard.quick_actions":"Quick Actions","agent.title":"Agent Chat","agent.send":"Send","agent.placeholder":"Type a message...","agent.start_conversation":"Send a message to start the conversation","agent.type_message":"Type a message...","agent.connecting":"Connecting...","agent.connected":"Connected","agent.disconnected":"Disconnected","agent.reconnecting":"Reconnecting...","agent.thinking":"Thinking...","agent.tool_call":"Tool Call","agent.tool_result":"Tool Result","agent.connection_error":"Connection error. Attempting to reconnect...","agent.tool_call_prefix":"[Tool Call]","agent.tool_result_prefix":"[Tool Result]","agent.error_prefix":"[Error]","agent.unknown_error":"Unknown error","agent.send_error":"Failed to send message. Please try again.","agent.copy_message":"Copy message","agent.connected_status":"Connected","agent.disconnected_status":"Disconnected","agent.copy_code":"Copy code","agent.copied_code":"Copied code","agent.copy":"copy","agent.copied":"copied","agent.code_language_fallback":"code","agent.jump_to_latest":"Jump to latest","agent.placeholder_steer_next_step":"steer next step…","agent.placeholder_queue_next":"queue next message…","agent.placeholder_message":"message…","agent.placeholder_connecting":"connecting…","agent.send_mode":"Send mode","agent.send_mode_queue":"queue","agent.send_mode_steer":"steer","agent.queue_after_current_response":"Queue after current response","agent.steer_text_only":"Steering is text-only; attachments will queue instead","agent.steer_next_step":"Steer next step","agent.queue_message":"Queue message","agent.send_message":"Send message","agent.send_enter":"Send (Enter)","agent.steer_prefix":"[steer]","agent.tool_output_truncated":"Output truncated in chat view; copy or inspect the run log for the full result.","agent.activity_input_label":"Input","agent.activity_diff_label":"Diff","agent.activity_output_label":"Output","agent.reasoning_trace_label":"Reasoning trace","tools.name":"Name","tools.parameters":"Parameters","tools.search":"Search tools...","tools.empty":"No tools available.","tools.count":"Total tools","tools.agent_tools":"Agent Tools","tools.cli_tools":"CLI Tools","tools.path":"Path","tools.version":"Version","tools.category":"Category","tools.load_error":"Failed to load tools","cron.title":"Scheduled Jobs","cron.scheduled_tasks":"Scheduled Tasks","cron.add":"Add Job","cron.add_job":"Add Job","cron.add_modal_title":"Add Cron Job","cron.delete":"Delete","cron.enable":"Enable","cron.disable":"Disable","cron.name":"Name","cron.name_optional":"Name (optional)","cron.command":"Command","cron.command_required":"Command","cron.schedule":"Schedule","cron.schedule_required":"Schedule","cron.next_run":"Next Run","cron.last_run":"Last Run","cron.last_status":"Last Status","cron.enabled":"Enabled","cron.enabled_status":"Enabled","cron.disabled_status":"Disabled","cron.empty":"No scheduled jobs.","cron.confirm_delete":"Are you sure you want to delete this job?","cron.load_error":"Failed to load cron jobs","cron.validation_error":"Schedule and command are required.","cron.add_error":"Failed to add job","cron.delete_error":"Failed to delete job","cron.cancel":"Cancel","cron.adding":"Adding...","cron.id":"ID","cron.actions":"Actions","cron.loading_run_history":"Loading run history...","cron.load_run_history_error":"Failed to load run history","cron.no_runs":"No runs recorded yet.","cron.recent_runs":"Recent Runs","cron.yes":"Yes","cron.no":"No","cron.edit":"Edit","cron.edit_modal_title":"Edit Cron Job","cron.edit_error":"Failed to update job","cron.saving":"Saving...","cron.save":"Save","integrations.available":"Available","integrations.active":"Active","integrations.coming_soon":"Coming Soon","integrations.category":"Category","integrations.status":"Status","integrations.search":"Search integrations...","integrations.empty":"No integrations found.","integrations.activate":"Activate","integrations.deactivate":"Deactivate","integrations.load_error":"Failed to load integrations","integrations.status_active":"Active","integrations.status_available":"Available","integrations.status_coming_soon":"Coming Soon","memory.title":"Memory Store","memory.memory_title":"Memory","memory.search":"Search memory...","memory.search_placeholder":"Search memory entries...","memory.add":"Store Memory","memory.add_memory":"Add Memory","memory.add_modal_title":"Add Memory","memory.delete":"Delete","memory.key":"Key","memory.key_required":"Key","memory.content":"Content","memory.content_required":"Content","memory.category":"Category","memory.category_optional":"Category (optional)","memory.timestamp":"Timestamp","memory.session":"Session","memory.score":"Score","memory.empty":"No memory entries found.","memory.confirm_delete":"Are you sure you want to delete this memory entry?","memory.all_categories":"All Categories","memory.search_button":"Search","memory.load_error":"Failed to load memory","memory.saving":"Saving...","memory.validation_error":"Key and content are required.","memory.store_error":"Failed to store memory","memory.delete_error":"Failed to delete memory","memory.delete_confirm":"Delete?","memory.yes":"Yes","memory.no":"No","memory.cancel":"Cancel","config.title":"Configuration","config.save":"Save","config.saving":"Saving...","config.reset":"Reset","config.saved":"Configuration saved successfully.","config.error":"Failed to save configuration.","config.loading":"Loading configuration...","config.editor_placeholder":"TOML configuration...","config.configuration_title":"Configuration","config.sensitive_title":"Sensitive fields are masked","config.sensitive_hint":"API keys, tokens, and passwords are hidden for security. To update a masked field, replace the entire masked value with your new value.","config.save_success":"Configuration saved successfully.","config.save_error":"Failed to save configuration","config.toml_label":"TOML Configuration","config.lines":"lines","cost.session":"Session Cost","cost.daily":"Daily Cost","cost.monthly":"Monthly Cost","cost.request_count":"Requests","cost.by_model":"Cost by Model","cost.model":"Model","cost.usd":"Cost (USD)","cost.load_error":"Failed to load cost data","cost.total_requests":"Total Requests","cost.token_statistics":"Token Statistics","cost.avg_tokens_per_request":"Avg Tokens / Request","cost.cost_per_1k_tokens":"Cost per 1K Tokens","cost.model_breakdown":"Model Breakdown","cost.cost":"Cost","cost.share":"Share","logs.live_logs":"Live Logs","logs.clear":"Clear","logs.filter":"Filter logs...","logs.filter_label":"Filter","logs.empty":"No log entries.","logs.events":"events","logs.paused_hint":"Log streaming is paused.","logs.waiting_hint":"Waiting for events...","doctor.diagnostics_title":"Diagnostics","doctor.run_diagnostics":"Run Diagnostics","doctor.running_btn":"Running...","doctor.running_desc":"Running diagnostics...","doctor.running_hint":"This may take a few seconds.","doctor.error":"Error","doctor.severity":"Severity","doctor.category":"Category","doctor.message":"Message","doctor.empty":"No diagnostics have been run yet.","doctor.summary":"Diagnostic Summary","doctor.issues_found":"Issues Found","doctor.warnings_summary":"Warnings","doctor.all_clear":"All Clear","doctor.system_diagnostics":"System Diagnostics","doctor.empty_hint":'Click "Run Diagnostics" to check your Revka installation.',"auth.pair":"Pair Device","auth.pairing_code":"Pairing Code","auth.pair_button":"Pair","auth.logout":"Logout","auth.pairing_success":"Pairing successful!","auth.pairing_failed":"Pairing failed. Please try again.","auth.enter_code":"Enter your pairing code to connect to the agent.","common.loading":"Loading...","common.error":"An error occurred.","common.retry":"Retry","common.cancel":"Cancel","common.confirm":"Confirm","common.save":"Save","common.delete":"Delete","common.edit":"Edit","common.execute":"Execute","common.close":"Close","common.yes":"Yes","common.no":"No","common.search":"Search...","common.no_data":"No data available.","common.refresh":"Refresh","common.back":"Back","common.actions":"Actions","common.name":"Name","common.description":"Description","common.status":"Status","common.created":"Created","common.updated":"Updated","health.title":"System Health","health.component":"Component","health.status":"Status","health.last_ok":"Last OK","health.last_error":"Last Error","health.restart_count":"Restarts","health.pid":"Process ID","health.uptime":"Uptime","health.updated_at":"Last Updated","dashboard.provider_model":"Provider / Model","dashboard.since_last_restart":"Since last restart","dashboard.paired_yes":"Yes","dashboard.paired_no":"No","dashboard.cost_overview":"Cost Overview","dashboard.active_channels":"Active Channels","dashboard.filter_active":"Active","dashboard.filter_all":"All","dashboard.no_active_channels":"No active channels","dashboard.component_health":"Component Health","dashboard.load_error":"Failed to load dashboard","dashboard.session_label":"Session","dashboard.daily_label":"Daily","dashboard.monthly_label":"Monthly","dashboard.total_tokens_label":"Total Tokens","dashboard.requests_label":"Requests","dashboard.by_model":"By Model","dashboard.no_channels":"No channels configured","dashboard.active":"Active","dashboard.inactive":"Inactive","dashboard.no_components":"No components reporting","dashboard.restarts":"Restarts","dashboard.tab_overview":"Overview","dashboard.tab_sessions":"Sessions","dashboard.tab_channels":"Channels","dashboard.tab_audit":"Audit Trail","dashboard.tab_workflows":"Workflows","dashboard.audit_disabled":"Audit logging is not enabled. Enable it in config to see events.","dashboard.audit_all_types":"All Event Types","dashboard.audit_refresh":"Refresh","dashboard.audit_verify_chain":"Verify Chain","dashboard.audit_chain_valid":"Chain integrity verified","dashboard.audit_chain_invalid":"Chain integrity check failed","dashboard.audit_no_events":"No audit events found","dashboard.sessions_title":"Active Sessions","dashboard.no_sessions":"No active sessions","dashboard.session_id":"Session ID","dashboard.session_channel":"Channel","dashboard.session_started":"Started","dashboard.session_last_activity":"Last Activity","dashboard.session_status":"Status","dashboard.session_messages":"Messages","dashboard.session_details":"Session Details","dashboard.session_history":"View History","dashboard.channels_title":"Channel Status","dashboard.no_channels_detail":"No channel details available","dashboard.channel_type":"Type","dashboard.channel_messages":"Messages","dashboard.channel_last_message":"Last Message","dashboard.channel_config":"Configuration","dashboard.channel_enabled":"Enabled","dashboard.channel_disabled":"Disabled","dashboard.loading_sessions":"Loading sessions...","dashboard.loading_channels":"Loading channels...","dashboard.load_sessions_error":"Failed to load sessions","dashboard.load_channels_error":"Failed to load channels","dashboard.never":"Never","dashboard.tab_clawhub":"ClawHub","dashboard.tab_nodes":"Nodes","dashboard.clawhub_title":"ClawHub Marketplace","dashboard.clawhub_search":"Search templates, skills, teams…","dashboard.clawhub_no_items":"No items found. Publish your first template or skill!","dashboard.clawhub_publish":"Publish","dashboard.clawhub_install":"Install","dashboard.clawhub_downloads":"downloads","dashboard.clawhub_by":"by","dashboard.nodes_title":"Connected Nodes","dashboard.nodes_no_nodes":"No nodes connected. Nodes connect via WebSocket to /ws/nodes.","dashboard.nodes_capabilities":"Capabilities","dashboard.nodes_invoke":"Invoke","settings.title":"Settings","settings.tab.appearance":"Appearance","settings.tab.typography":"Typography","settings.appearance":"Appearance","settings.typography":"Typography","settings.fontUi":"UI Font","settings.fontMono":"Code Font","settings.fontSize":"UI Font Size","settings.fontMonoSize":"Code Font Size","settings.preview":"Preview","settings.previewText":"The quick brown fox jumps over the lazy dog.","settings.fontNote":"Font changes apply on page reload.","settings.language":"Language","chat_panel.ai_assistant":"AI Assistant","chat_panel.agent_placeholder":'Ask me to create an agent, e.g. "Create a Rust security specialist"',"chat_panel.team_placeholder":'Ask me to build a team, e.g. "Build a team for the frontend migration"',"chat_panel.skill_placeholder":'Ask me to create a skill, e.g. "Create a code review skill"',"chat_panel.close":"Close","clawhub.tab_local":"Local Skills","clawhub.tab_clawhub":"ClawHub","clawhub.search_placeholder":"Search ClawHub skills...","clawhub.trending":"Trending","clawhub.install":"Install","clawhub.installing":"Installing...","clawhub.installed":"Installed","clawhub.downloads":"downloads","clawhub.stars":"stars","clawhub.verified":"Verified","clawhub.no_results":"No skills found","clawhub.search_hint":"Search 13,000+ community skills on ClawHub","clawhub.error":"Could not connect to ClawHub","clawhub.details":"Details","clawhub.less":"Less","clawhub.author":"Author","clawhub.tags":"Tags","theme.mode":"Theme Mode","theme.accent":"Accent Color","theme.system":"System","theme.dark":"Dark","theme.light":"Light","theme.oled":"OLED Black","nav.pairing":"Pairing","nav.section.orchestration":"Orchestration","nav.section.operations":"Operations","nav.section.inspection":"Inspection","nav.dashboard.blurb":"Live runtime posture and active DAG state","nav.workflows.blurb":"Define DAGs and drill into runs from the same flow","nav.agents.blurb":"Reusable actors and workflow participants","nav.canvas.blurb":"Visual workspace and orchestration canvases","nav.teams.blurb":"View delegation topology and ownership","nav.assets.blurb":"Artifacts and workflow-adjacent resources","nav.skins.blurb":"Token and asset based UI skins","nav.skills.blurb":"Reusable operational capabilities","nav.tools.blurb":"Agent tool catalog and CLI binaries","nav.integrations.blurb":"Connected systems and channel surfaces","nav.cron.blurb":"Scheduled jobs and catch-up behaviour","nav.pairing.blurb":"Device enrolment and trust management","nav.config.blurb":"Runtime TOML and operational configuration","nav.cost.blurb":"Spend and efficiency by workflow and run","nav.memory.blurb":"Kumiho memory graph explorer and revisions","nav.logs.blurb":"Operational traces and node-linked events","nav.audit.blurb":"Trust chain and approval verification","nav.doctor.blurb":"Diagnostics and runtime recovery posture","sidebar.brand_subtitle":"Agent OS","sidebar.shell":"Revka","sidebar.shell_description":"A local-first agent OS that orchestrates AI workflows, tools, and runtime across your projects.","header.tagline":"Orchestration-first agent operating system.","header.runtime_healthy":"Runtime healthy","header.trust_verified":"Trust verified","header.trust_unverified":"Trust unverified","header.trust_checking":"Verifying trust…","header.operator":"Operator","common.duplicate":"Duplicate","common.reenable":"Re-enable","common.deprecate":"Deprecate","common.create":"Create","dashboard.kicker":"Orchestration Center","dashboard.live_orchestration_pane":"Live Orchestration Pane","dashboard.active_workflow_posture":"Active workflow posture","dashboard.open_workflow_definition":"Open workflow definition","dashboard.selected_run":"Selected Run","dashboard.run_posture":"Run Posture","dashboard.signal_focus":"Signal Focus","dashboard.hotspots":"Hotspots","dashboard.count.running":"Running","dashboard.count.failed":"Failed","dashboard.count.completed":"Completed","dashboard.count.pending":"Pending","dashboard.count.skipped":"Skipped","dashboard.prev_signal":"Prev Signal","dashboard.next_signal":"Next Signal","dashboard.intervention_points":"{count} intervention points","dashboard.label.failure":"Failure: {id}","dashboard.label.running":"Running: {id}","dashboard.label.blocked":"Blocked: {id}","dashboard.selected_step":"Selected Step","dashboard.inspect_node_in_runs":"Inspect this node in run workspace","dashboard.open_definition_node":"Open definition node","dashboard.select_dag_node":"Select a node in the DAG to inspect the active branch.","dashboard.priority_timeline":"Priority Timeline","dashboard.no_run_selected":"No run selected.","dashboard.open_full_run_workspace":"Open full run workspace","dashboard.open_all_runs":"Open all workflow runs","dashboard.status.blocked":"blocked","dashboard.scene.operator":"Operator Brief","dashboard.scene.error":"Dashboard telemetry is degraded. Check the run rail and logs before committing to the next action.","dashboard.scene.selected_run":"{workflow} is {status}. {completed}/{total} steps are complete.","dashboard.scene.run_failed":"{workflow} needs attention: {failed} steps failed, with {completed}/{total} steps complete.","dashboard.scene.active_overview":"{active} runs are active across {definitions} workflow definitions.","dashboard.scene.idle_overview":"No run is selected. {definitions} definitions are ready, with {total} total runs recorded.","workflows.kicker":"Orchestration Center","workflows.title":"Workflows","workflows.create":"Create Workflow","workflows.workflow_info":"v{version} · {steps} nodes · {runs} runs","workflows.workflow_info_short":"v{version} · {steps} nodes","workflows.status.off":"Off","workflows.status.ready":"Ready","workflows.tab.definition":"Definition","workflows.tab.runs":"Runs","workflows.loading":"Loading workflows…","workflows.empty_title":"No workflows yet","workflows.empty_desc":"Create your first workflow to get started.","workflows.definition_unavailable_title":"Workflow definition unavailable","workflows.definition_unavailable_desc":"The runtime returned an empty definition for this workflow — the graph can't be rendered. This is a backend data issue and needs to be fixed upstream.","workflows.no_runs_title":"No runs yet","workflows.no_runs_desc":"Run this workflow to see execution state.","workflows.open_node_in_runs":"Open node in runs","workflows.select_dag_node":"Select a node in the DAG.","workflows.run_step":"Run Step","workflows.select_dag_node_step":"Select a DAG node to inspect the step.","workflows.save_failure":"Failed to save workflow","workflows.save_failure_dot":"Failed to save workflow.","workflows.run_failure":"Failed to start workflow run","workflows.status_failure":"Failed to change workflow status","workflows.status_failure_dot":"Failed to change workflow status.","workflows.delete_failure":"Failed to delete workflow","workflows.delete_failure_dot":"Failed to delete workflow.","workflows.toast.updated":'Workflow "{name}" updated.',"workflows.toast.created":'Workflow "{name}" created.',"workflows.toast.reenabled":'Re-enabled workflow "{name}".',"workflows.toast.deprecated":'Deprecated workflow "{name}".',"workflows.toast.deleted":'Workflow "{name}" deleted.',"workflows.toast.run_started":'Workflow "{name}" started (run {runId}).',"workflows.run_option":"{prefix} — {status} ({completed}/{total})","workflows.copy_suffix":"Copy","doctor.kicker":"Inspection","doctor.title":"Doctor","doctor.description":"Run runtime diagnostics and inspect grouped health findings across the Revka stack.","doctor.run":"Run Diagnostics","doctor.running":"Running…","doctor.failed_title":"Diagnostics failed","doctor.loading_title":"Running system diagnostics…","doctor.loading_desc":"Checking runtime components, configuration, and operational health.","doctor.health_summary":"Health Summary","doctor.passing":"Passing","doctor.warnings":"Warnings","doctor.failures":"Failures","doctor.run_context":"Run Context","doctor.context_p1":"The doctor is strongest when it behaves like an inspection board, not a terminal dump. This panel highlights overall posture first, then breaks findings into subsystem groups.","doctor.context_p2":"Use the category boards to identify where warnings cluster before diving into individual messages.","doctor.subsystem_boards":"Subsystem Boards","doctor.checks":"{count} checks","doctor.ok":"ok","doctor.warn":"warn","doctor.fail":"fail","doctor.system_diag_title":"System diagnostics","doctor.system_diag_desc":"Run the doctor to inspect warnings, failures, and all-clear checks in the Revka shell.","doctor.run_failed":"Failed to run diagnostics","cost.kicker":"Operations","cost.title":"Cost","cost.error_title":"Unable to load cost data","cost.loading_title":"Loading cost data…","cost.spend_posture":"Spend Posture","cost.session_cost":"Session Cost","cost.daily_cost":"Daily Cost","cost.monthly_cost":"Monthly Cost","cost.requests":"Requests","cost.token_efficiency":"Token Efficiency","cost.total_tokens":"Total Tokens","cost.avg_tokens":"Avg Tokens / Request","cost.cost_per_1k":"Cost / 1K Tokens","cost.model_workspace":"Model Workspace","cost.spend_by_model":"Spend by model","cost.no_model_data":"No model data","cost.no_model_data_desc":"Model-level spend appears after requests have been recorded.","cost.tokens_label":"{count} tokens","cost.requests_label":"{count} requests","cost.share_label":"{share}% of monthly spend","cost.selected_model":"Selected Model","cost.no_model_selected":"No model selected","cost.no_model_selected_desc":"Choose a model from the workspace to inspect spend concentration and efficiency.","cost.monthly_spend":"Monthly Spend","cost.tokens":"Tokens","cost.share_monthly":"Share of Monthly Spend","cost.interpretation":"Interpretation","cost.interp_p1":"Large monthly-share values indicate cost concentration around a single model family.","cost.interp_p2":"High tokens per request with low request counts usually points to long-context or generation-heavy workflows.","logs.kicker":"Inspection","logs.title":"Logs","logs.description":"Tail of the Revka daemon stderr log. Runtime agent events live on the Audit page.","logs.pause":"Pause","logs.resume":"Resume","logs.jump_to_bottom":"Jump To Bottom","logs.stream_status":"Stream Status","logs.connected":"Connected","logs.disconnected":"Disconnected","logs.visible_lines":"{count} visible lines. Tailing ~/.revka/logs/daemon.stderr.log.","logs.event_filters":"Event Filters","logs.no_event_types":"No event types yet","logs.no_event_types_desc":"Filters appear after the stream receives activity.","logs.clear_filters":"Clear Filters","logs.live_event_feed":"Live Event Feed","logs.no_events":"No events yet","logs.no_events_desc":"Agent activity will stream here once the SSE feed receives runtime events.","tools.kicker":"Operations","tools.title":"Tools","tools.description":"Agent-facing tool catalog and host CLI binaries the runtime can shell out to.","tools.reload":"Reload","tools.search_placeholder":"Search tools by name, description, or category…","tools.loading":"Loading tools…","tools.agent_tools_count":"Agent Tools · {count}","tools.no_matches":"No matches","tools.no_agent_tools":"No agent tools registered","tools.try_different":"Try a different search term.","tools.agent_tools_empty_desc":"Agent tools will appear once the runtime registers them.","tools.parameter_schema":"Parameter Schema","tools.cli_tools_count":"CLI Tools · {count}","tools.no_cli_tools":"No CLI tools detected","tools.cli_tools_empty_desc":"Revka probes common CLI binaries at startup. Install one and reload.","tools.col.name":"Name","tools.col.path":"Path","tools.col.version":"Version","tools.col.category":"Category","tools.failed_load":"Failed to load tools: {message}","audit.kicker":"Inspection","audit.title":"Audit","audit.description":"Trust-chain verification, event review, and security posture for operational actions.","audit.refresh":"Refresh","audit.verify_chain":"Verify Chain","audit.disabled_title":"Audit trail is disabled","audit.disabled_desc":"Enable audit recording to inspect approval, policy, and security events here.","audit.filters":"Filters","audit.all_event_types":"All event types","audit.event.command_execution":"Command Execution","audit.event.file_access":"File Access","audit.event.config_change":"Config Change","audit.event.auth_success":"Auth Success","audit.event.auth_failure":"Auth Failure","audit.event.policy_violation":"Policy Violation","audit.event.security_event":"Security Event","audit.chain_verified":"Chain verified","audit.chain_invalid":"Chain invalid","audit.entries_verified":"{count} entries verified.","audit.stream_title":"Audit Event Stream","audit.stream_subtitle":"Recorded actions and approvals","audit.loading":"Loading audit events…","audit.empty_title":"No audit events","audit.empty_desc":"Recorded events will appear here once actions or approvals are emitted.","audit.col.sequence":"Sequence","audit.col.action":"Action","audit.col.result":"Result","audit.col.hash":"Hash","audit.result_success":"Success","audit.result_recorded":"Recorded","audit.policy_violation_badge":"Policy violation","audit.time.seconds_ago":"{n}s ago","audit.time.minutes_ago":"{n}m ago","audit.time.hours_ago":"{n}h ago","audit.time.days_ago":"{n}d ago","integrations.kicker":"Operations","integrations.title":"Integrations","integrations.loading":"Loading integrations…","integrations.coverage":"Coverage","integrations.metric.active":"Active","integrations.metric.available":"Available","integrations.metric.coming_soon":"Coming Soon","integrations.categories":"Categories","integrations.category_all":"all","integrations.workspace":"Integration Workspace","integrations.all_integrations":"All integrations","integrations.category_integrations":"{category} integrations","integrations.empty_title":"No integrations","integrations.empty_desc":"No integrations matched the current category filter.","integrations.badge.active":"Active","integrations.badge.available":"Available","integrations.badge.coming_soon":"Coming Soon","integrations.selected":"Selected Integration","integrations.no_selected_title":"No integration selected","integrations.no_selected_desc":"Choose an integration from the workspace to inspect its rollout posture.","integrations.detail.category":"Category","integrations.detail.status":"Status","integrations.detail.operational_readiness":"Operational Readiness","integrations.readiness.active":"Already active in the runtime.","integrations.readiness.available":"Available to enable when the operator is ready.","integrations.readiness.coming_soon":"Planned surface that is not ready to activate yet.","integrations.legend":"Status Legend","integrations.legend.p1":"`Active` integrations are already wired into runtime workflows.","integrations.legend.p2":"`Available` integrations are installable or connectable from the current build.","integrations.legend.p3":"`Coming Soon` integrations are planned but not yet ready for operators.","pairing.kicker":"Operations","pairing.title":"Pairing","pairing.description":"Issue pairing codes, render a QR for mobile enrolment, and manage trusted devices.","pairing.reload":"Reload","pairing.pair_new_device":"Pair New Device","pairing.generating":"Generating…","pairing.active_code":"Active Pairing Code","pairing.rendering":"Rendering…","pairing.code_hint":"Scan the QR with the Revka companion app, or enter the 6-digit code on the paired device. Codes expire when a device completes enrolment or when you generate a new one.","pairing.copy_code":"Copy Code","pairing.rotate":"Rotate","pairing.cli_device_name":"CLI device name","pairing.cli_hardware":"Hardware","pairing.cli_hardware_placeholder":"Optional platform label","pairing.mint_cli_token":"Mint CLI Token","pairing.minting_token":"Minting…","pairing.minted_token":"Minted Bearer Token","pairing.copy_token":"Copy Token","pairing.no_code_title":"No active pairing code","pairing.no_code_desc":'Press "Pair New Device" to generate a fresh code and QR. Codes are short-lived and intended for a single enrolment.',"pairing.how_to_scan":"How to scan","pairing.scan_step1":"Open the Revka companion app on the new device.","pairing.scan_step2_prefix":"Choose ","pairing.scan_step2_action":"Pair with hub","pairing.scan_step2_suffix":".","pairing.scan_step3":"Scan the QR or type the 6-digit code manually.","pairing.scan_step4":"The device appears in the list below once enrolment completes.","pairing.paired_devices":"Paired Devices · {count}","pairing.loading_devices":"Loading devices…","pairing.no_devices_title":"No devices paired yet","pairing.no_devices_desc":"Paired devices will appear here after a successful enrolment.","pairing.col.name":"Name","pairing.col.type":"Type","pairing.col.hardware":"Hardware","pairing.col.paired":"Paired","pairing.col.last_seen":"Last Seen","pairing.col.ip":"IP","pairing.col.actions":"Actions","pairing.unnamed":"Unnamed","pairing.unknown":"Unknown","pairing.device_type.api_client":"API Client","pairing.device_type.browser":"Browser","pairing.device_type.cli":"CLI","pairing.device_type.mobile":"Mobile","pairing.device_type.tablet":"Tablet","pairing.revoke":"Revoke?","pairing.yes":"Yes","pairing.no":"No","pairing.revoke_title":"Revoke device","pairing.toast.code_generated":"New pairing code generated.","pairing.toast.code_copied":"Code copied.","pairing.toast.token_minted":"Bearer token minted. Copy it now.","pairing.toast.token_copied":"Token copied.","pairing.toast.copy_failed":"Copy failed. Select it manually.","pairing.toast.device_revoked":"Device revoked.","pairing.err.load_devices":"Failed to load devices","pairing.err.gen_code":"Failed to generate pairing code","pairing.err.mint_token":"Failed to mint bearer token","pairing.err.revoke":"Failed to revoke device","cron.kicker":"Operations","cron.description":"Scheduled jobs, catch-up behaviour, and recent run history.","cron.reload":"Reload","cron.startup_behaviour":"Startup Behaviour","cron.catch_up_title":"Catch up missed jobs on startup","cron.catch_up_desc":"Run all overdue jobs when Revka starts after downtime.","cron.loading_jobs":"Loading scheduled jobs…","cron.no_jobs_title":"No scheduled jobs","cron.no_jobs_desc":"Add a cron job to run commands on a schedule.","cron.col.id":"ID","cron.col.name":"Name","cron.col.command":"Command","cron.col.next_run":"Next Run","cron.col.last_status":"Last Status","cron.col.enabled":"Enabled","cron.col.actions":"Actions","cron.enabled_badge":"Enabled","cron.disabled_badge":"Disabled","cron.toggle_history":"Toggle run history","cron.confirm":"Confirm?","cron.history.loading":"Loading run history…","cron.history.error_title":"Unable to load run history","cron.history.retry":"Retry","cron.history.no_runs_title":"No runs yet","cron.history.no_runs_desc":"This job hasn’t executed since it was created.","cron.history.refresh":"Refresh","cron.history.recent":"Recent runs · {count}","cron.history.refresh_title":"Refresh runs","cron.modal.edit_title":"Edit Cron Job","cron.modal.add_title":"Add Cron Job","cron.modal.description":"Name is optional. Schedule uses standard cron expressions.","cron.form.name":"Name","cron.form.optional":"(optional)","cron.form.name_placeholder":"e.g. Daily cleanup","cron.form.schedule":"Schedule","cron.form.command":"Command","cron.form.command_placeholder":"e.g. cleanup --older-than 7d","cron.form.cancel":"Cancel","cron.form.saving":"Saving…","cron.form.adding":"Adding…","cron.form.save":"Save","cron.err.load":"Failed to load jobs: {message}","cron.err.settings":"Failed to update settings","cron.err.save":"Failed to save job","cron.err.delete":"Failed to delete job","cron.err.form_required":"Schedule and command are required.","cron.toast.updated":"Updated “{name}”.","cron.toast.added":"Added “{name}”.","cron.toast.deleted":"Job deleted.","canvas.kicker":"Orchestration Center","canvas.title":"Canvas","canvas.reconnect":"Reconnect","canvas.control":"Canvas Control","canvas.connected":"Connected","canvas.disconnected":"Disconnected","canvas.canvas_id_placeholder":"Canvas ID","canvas.switch":"Switch","canvas.clear":"Clear","canvas.available":"Available Canvases","canvas.loading_list":"Loading canvases…","canvas.loading_list_desc":"Polling the live canvas registry.","canvas.no_active_title":"No active canvases","canvas.no_active_desc":"Canvas IDs will appear here once an agent or workflow pushes a frame.","canvas.active":"Active","canvas.viewport":"Canvas Viewport","canvas.live_output":"Live frame output","canvas.canvas_label":"Canvas","canvas.connection":"Connection","canvas.live":"Live","canvas.offline":"Offline","canvas.frame_type":"Frame Type","canvas.last_update":"Last Update","canvas.waiting_label":"Waiting for frame","canvas.frame_suffix":"frame","canvas.waiting_for_content":'Waiting for content on "{id}"',"canvas.waiting_for_content_desc":"The agent can push content here using the canvas tool. Once a frame arrives it will render immediately in this viewport.","canvas.disconnected_title":"Canvas socket disconnected","canvas.disconnected_desc":"Reconnect to the current canvas or switch to another live canvas ID.","canvas.reconnect_button":"Reconnect Canvas","canvas.frame_id":"Frame ID","canvas.guidance":"Canvas Guidance","canvas.guidance_desc":"Use the assistant to generate charts, diagrams, markdown reports, and HTML dashboards directly into this viewport.","canvas.history":"Frame History","canvas.hide":"Hide","canvas.show":"Show","canvas.history_collapsed_title":"History collapsed","canvas.history_collapsed_desc":"Expand this rail to inspect previous frames on the active canvas.","canvas.no_frames_title":"No frames yet","canvas.no_frames_desc":"As frames arrive they will be stored here for quick backtracking.","skills.kicker":"Operations","skills.title":"Skills","skills.create_skill":"Create Skill","skills.registry_status":"Registry Status","skills.summary.total":"Total","skills.summary.active":"Active","skills.summary.deprecated":"Deprecated","skills.summary.domains":"Domains","skills.index":"Skill Index","skills.search_placeholder":"Search skills…","skills.loading":"Loading skills…","skills.no_skills_title":"No skills found","skills.no_skills_desc":"Create a local skill to start populating the operational registry.","skills.status.active":"Active","skills.status.deprecated":"Deprecated","skills.workspace":"Skill Workspace","skills.select_placeholder":"Select a skill","skills.description":"Description","skills.content":"Skill Content","skills.content_empty":"This skill has no content to display.","skills.edit":"Edit","skills.reenable":"Re-enable","skills.deprecate":"Deprecate","skills.deleting":"Deleting…","skills.delete":"Delete","skills.no_selected_title":"No skill selected","skills.no_selected_desc":"Select a skill to inspect its content and operational metadata.","skills.install_github":"Install from GitHub","skills.install_github_desc":"Paste a GitHub repository URL to install a skill directly.","skills.github_placeholder":"https://github.com/org/skill-repo","skills.installing":"Installing…","skills.install":"Install","skills.marketplace":"Marketplace","skills.marketplace_shown":"{count} shown","skills.marketplace_placeholder":"Search ClawHub skills…","skills.search":"Search","skills.trending":"Trending","skills.marketplace_loading":"Loading marketplace…","skills.marketplace_empty":"No marketplace results","skills.modal.edit_title":"Edit Skill","skills.modal.create_title":"Create Skill","skills.modal.description":"Skills are reusable operational capabilities that can be attached to agents and runs.","skills.modal.name_placeholder":"Skill name","skills.modal.description_placeholder":"Description","skills.modal.tags_placeholder":"comma,separated,tags","skills.modal.content_placeholder":"Skill markdown content","skills.modal.cancel":"Cancel","skills.modal.saving":"Saving…","skills.modal.save_skill":"Save Skill","skills.toast.updated":'Skill "{name}" updated.',"skills.toast.created":'Skill "{name}" created.',"skills.toast.reenabled":'Re-enabled skill "{name}".',"skills.toast.deprecated":'Deprecated skill "{name}".',"skills.toast.deleted":'Skill "{name}" deleted.',"skills.toast.installed":'Installed skill "{name}".',"skills.toast.installed_github":'Installed skill "{name}" from GitHub.',"skills.err.save":"Failed to save skill.","skills.err.load_detail":"Failed to load skill content.","skills.err.toggle":"Failed to change skill status.","skills.err.delete":"Failed to delete skill.","skills.err.install":"Failed to install marketplace skill.","skills.err.install_github":"Failed to install skill from GitHub URL.","teams.kicker":"Orchestration Center","teams.title":"Teams","teams.create":"Create Team","teams.refresh":"Refresh","teams.count":"{count} teams","teams.agent_count":"{count} agents","teams.loading":"Loading…","teams.loading_desc":"Loading teams…","teams.empty_title":"No teams","teams.empty_desc":"Create a team to start.","teams.none_selected_title":"No team selected","teams.none_selected_desc":"Select a team from the index.","teams.members_suffix":"{members} members · {edges} edges","teams.status.off":"Off","teams.status.live":"Live","teams.status.deprecated":"Deprecated","teams.status.active":"Active","teams.action.edit":"Edit","teams.action.reenable":"Re-enable","teams.action.deprecate":"Deprecate","teams.action.delete":"Delete","teams.stats.members":"Members","teams.stats.edges":"Edges","teams.stats.status":"Status","teams.tab.summary":"Summary","teams.tab.member":"Member","teams.open_agent_registry":"Open agent registry","teams.modal.edit_title":"Edit Team","teams.modal.create_title":"Create Team","teams.modal.description":"The team editor now handles identity, composition, and core reporting/dependency edges directly in the new shell.","teams.form.name":"Team Name","teams.form.description":"Description","teams.form.members":"Members","teams.form.topology_preview":"Topology Preview","teams.form.edge_authoring":"Edge Authoring","teams.form.from_member":"From member","teams.form.to_member":"To member","teams.form.edge_reports_to":"Reports To","teams.form.edge_supports":"Supports","teams.form.edge_depends_on":"Depends On","teams.form.add_edge":"Add Edge","teams.form.remove":"Remove","teams.form.no_edges":"No topology edges defined yet.","teams.form.draft_summary":"Draft Summary","teams.form.draft_members":"Members","teams.form.draft_edges":"Edges","teams.form.draft_hint":"Use `REPORTS_TO` for hierarchy, `SUPPORTS` for collaboration lanes, and `DEPENDS_ON` for blocking execution relationships.","teams.form.draft_team_name":"Draft Team","teams.form.cancel":"Cancel","teams.form.saving":"Saving…","teams.form.save":"Save Team","teams.toast.updated":'Team "{name}" updated.',"teams.toast.created":'Team "{name}" created.',"teams.toast.deleted":'Team "{name}" deleted.',"teams.toast.reenabled":'Re-enabled team "{name}".',"teams.toast.deprecated":'Deprecated team "{name}".',"teams.err.save":"Failed to save team.","teams.err.toggle":"Failed to change team status.","teams.err.delete":"Failed to delete team.","agents.kicker":"Orchestration Center","agents.title":"Agents","agents.create":"Create Agent","agents.refresh":"Refresh","agents.search_placeholder":"Search agents…","agents.filter.all_roles":"All roles","agents.filter.coder":"Coder","agents.filter.reviewer":"Reviewer","agents.filter.researcher":"Researcher","agents.filter.hide_disabled":"Hide Disabled","agents.filter.show_disabled":"Show Disabled","agents.count":"{count} agents","agents.loading":"Loading…","agents.loading_desc":"Loading agents…","agents.empty_title":"No agents","agents.empty_desc":"Adjust filters or create one.","agents.none_selected_title":"No agent selected","agents.none_selected_desc":"Select an agent from the index.","agents.status.disabled":"Disabled","agents.status.active":"Active","agents.stats.registry":"Registry","agents.stats.active":"Active","agents.stats.codex":"Codex","agents.section.identity":"Identity","agents.section.soul":"Soul","agents.section.soul_empty":"No soul description provided.","agents.section.expertise":"Expertise","agents.section.no_expertise":"No expertise tags.","agents.section.voice":"Voice","agents.section.voice_empty":"Not specified","agents.section.revision":"Revision","agents.section.created":"Created","agents.action.edit":"Edit","agents.action.reenable":"Re-enable","agents.action.deprecate":"Deprecate","agents.action.delete":"Delete","agents.action.deleting":"Deleting…","agents.tab.summary":"Summary","agents.tab.prompt":"Prompt","agents.summary.name":"Name","agents.summary.role":"Role","agents.summary.type":"Type","agents.summary.model":"Model","agents.summary.model_default":"Default","agents.summary.tone":"Tone","agents.summary.revision":"Revision","agents.summary.created":"Created","agents.prompt.system_hint":"System Hint","agents.prompt.system_hint_empty":"No system hint configured.","agents.prompt.identity_seed":"Identity Seed","agents.modal.create_title":"Create Agent","agents.modal.edit_title":"Edit Agent","agents.modal.description":"Agents are identity-driven operators. Revka keeps the persona, model, and prompting surface in one place.","agents.form.name":"Name","agents.form.tone":"Tone","agents.form.tone_placeholder":"concise and direct","agents.form.identity":"Identity","agents.form.soul":"Soul","agents.form.role":"Role","agents.form.role.coder":"Coder","agents.form.role.reviewer":"Reviewer","agents.form.role.researcher":"Researcher","agents.form.agent_type":"Agent Type","agents.form.model":"Model","agents.form.model_placeholder":"gpt-5.4 / claude-sonnet-4-6","agents.form.expertise":"Expertise","agents.form.expertise_placeholder":"rust, review, orchestration","agents.form.system_hint":"System Hint","agents.form.cancel":"Cancel","agents.form.saving":"Saving…","agents.form.save_create":"Create Agent","agents.form.save_edit":"Save Agent","agents.toast.updated":'Agent "{name}" updated.',"agents.toast.created":'Agent "{name}" created.',"agents.toast.deleted":'Agent "{name}" deleted.',"agents.toast.reenabled":'Re-enabled agent "{name}".',"agents.toast.deprecated":'Deprecated agent "{name}".',"agents.err.load":"Failed to load agents.","agents.err.save":"Failed to save agent.","agents.err.toggle":"Failed to change agent status.","agents.err.delete":"Failed to delete agent.","runs.kicker":"Orchestration Center","runs.title":"Workflow Runs","runs.refresh":"Refresh","runs.index.title":"Run Index","runs.empty.title":"No runs","runs.empty.desc":"Execute a workflow to populate this index.","runs.error.title":"Load error","runs.stats.steps_fraction":"{completed}/{total} steps","runs.stats.expanded_steps":"{count} expanded","runs.stats.loop_fraction":"Loop {iteration}/{total}: {step}","runs.stats.loop_iteration":"Loop {iteration}: {step}","runs.open_definition":"Open definition","runs.action.retry_failed":"Retry failed","runs.action.retrying":"Retrying…","runs.action.retry_tooltip":"Retry failed steps","runs.action.stop":"Stop","runs.action.stopping":"Stopping…","runs.action.stop_tooltip":"Stop this run instance","runs.action.delete_tooltip":"Delete run","runs.none_selected.title":"No run selected","runs.none_selected.desc":"Choose a run from the index.","runs.banner.label":"Active Selection","runs.overlay.path_mode":"Path Mode","runs.overlay.path.all":"All","runs.overlay.path.failed":"Failed","runs.overlay.path.blocked":"Blocked","runs.overlay.signals":"Signals","runs.overlay.prev":"Prev","runs.overlay.next":"Next","runs.overlay.signal_count":"{count} signals","runs.overlay.posture":"Posture","runs.overlay.running":"Running","runs.overlay.failed":"Failed","runs.overlay.done":"Done","runs.overlay.pending":"Pending","runs.overlay.skipped":"Skipped","runs.overlay.hotspots":"Hotspots","runs.overlay.legend_running":"Running","runs.overlay.legend_failure":"Failure","runs.overlay.legend_blocked":"Blocked","runs.overlay.legend_skipped":"Skipped","runs.overlay.legend_gate":"Gate","runs.overlay.fail_label":"Fail: {id}","runs.overlay.run_label":"Run: {id}","runs.overlay.block_label":"Block: {id}","runs.started_at":"Started {time}","runs.inspector.title":"Step Inspector","runs.tab.summary":"Summary","runs.tab.output":"Output","runs.tab.tools":"Tools","runs.tab.transcript":"Transcript","runs.tab.jsonl":"JSONL Log","runs.detail.select_node":"Select a DAG node to inspect.","runs.detail.no_description":"No description.","runs.detail.depends_on":"Depends on: {list}","runs.detail.depends_none":"none","runs.detail.agent":"Agent: {type}{role}","runs.detail.agent_na":"n/a","runs.detail.skills":"Skills: {list}","runs.detail.dashboard_link":"Dashboard","runs.detail.definition_link":"Definition","runs.detail.select_step":"Select a step.","runs.detail.step_output":"Step Output","runs.detail.agent_output":"Agent Output","runs.detail.no_output":"No output captured.","runs.detail.loading":"Loading…","runs.detail.tools_calls":"Calls","runs.detail.tools_errors":"Errors","runs.detail.no_tools":"No tool calls recorded.","runs.detail.no_activity":"No agent activity available.","runs.detail.no_jsonl":"No JSONL entries found for this agent.","runs.detail.no_jsonl_filter":"No entries match your filter.","runs.detail.no_transcript":"No transcript available.","runs.detail.tool_default":"Tool","runs.detail.tool_status_ok":"ok","runs.timeline":"Timeline ({count})","runs.toast.retry_started":"Run {id} retry started.","runs.toast.stop_requested":"Stop requested for run {id}.","runs.toast.deleted":"Run {id} deleted.","runs.err.retry":"Failed to retry run.","runs.err.stop":"Failed to stop run.","runs.err.delete":"Failed to delete run.","memory.kicker":"Inspection","memory.page_title":"Memory","memory.page_description":"Memory graph inspection with kind filters, space scoping, search highlighting, and node-linked detail drilldown.","memory.selected_memory":"Selected Memory","memory.loading_detail":"Loading node details…","memory.relative.just_now":"just now","memory.relative.minutes":"{count}m ago","memory.relative.hours":"{count}h ago","memory.relative.days":"{count}d ago","memory.detail.metadata":"Metadata","memory.detail.bundle_members":"Bundle Members","memory.controls.title":"Graph Controls","memory.controls.search_placeholder":"Highlight memories…","memory.controls.all_spaces":"All spaces","memory.controls.node_limit":"Node limit","memory.filters.title":"Filters","memory.filters.empty_title":"No kinds loaded yet","memory.filters.empty_desc":"Graph filters will appear once memory data is available.","memory.graph.kicker":"Memory Graph","memory.graph.heading":"Semantic memory topology","memory.graph.items":"items","memory.graph.edges":"edges","memory.graph.shown":"shown","memory.graph.matches":"{count} matches","memory.graph.match":"{count} match","memory.graph.loading_title":"Loading memory graph…","memory.graph.loading_desc":"Fetching semantic memory topology and relationship edges.","memory.graph.error_title":"Unable to load memory graph","memory.graph.retry":"Retry","memory.graph.empty_title":"No memories found","memory.graph.empty_desc":"Adjust filters, clear search, or increase the node limit to broaden the graph.","memory.none_selected_title":"No memory selected","memory.none_selected_desc":"Select a node in the graph to inspect metadata, revision-backed detail, and bundle membership.","memory.err.load":"Failed to load memory graph","assets.kicker":"Operations","assets.title":"Assets","assets.search_placeholder":"Search assets…","assets.project":"Project","assets.up":"Up","assets.err.load":"Failed to load Kumiho projects. Check that the Kumiho API is reachable.","assets.col.name":"Name","assets.col.kind":"Kind","assets.col.author":"Author","assets.col.created":"Created","assets.loading.projects":"Loading projects…","assets.loading.space":"Loading space…","assets.loading.generic":"Loading…","assets.folder":"folder","assets.empty.title":"Empty space","assets.empty.desc":"No folders or assets in this location.","assets.search.empty_title":"No results","assets.search.empty_desc":'No assets match "{query}".',"assets.search.result_count":'{count} results for "{query}"',"assets.copy_kref":"Copy kref","assets.close_inspector":"Close inspector","assets.deprecated":"Deprecated","assets.active":"Active","assets.rev_count":"{count} revs","assets.rev_count_one":"{count} rev","assets.by":"by {author}","assets.section.revisions":"Revisions","assets.section.artifacts":"Artifacts","assets.section.edges":"Edges","assets.section.metadata":"Metadata","assets.section.revisions_empty":"No revisions.","assets.section.artifacts_empty":"No artifacts.","assets.section.edges_empty":"No edges.","assets.section.metadata_empty":"No metadata.","assets.tag.latest":"latest","assets.tag.published":"published","assets.action.view":"View","assets.action.edit":"Edit","assets.action.restore":"Restore","assets.action.deprecate":"Deprecate","assets.action.publish":"Publish","assets.action.published":"Published","assets.action.save_artifact":"Save artifact","assets.action.deprecate_item":"Deprecate selected item","assets.action.restore_item":"Restore selected item","assets.action.deprecate_revision":"Deprecate selected revision","assets.action.restore_revision":"Restore selected revision","assets.action.publish_revision":"Tag selected revision as published","assets.action.edit_artifact":"Edit artifact","assets.action.deprecate_artifact":"Deprecate artifact","assets.action.restore_artifact":"Restore artifact","assets.toast.item_deprecated":"Item deprecated.","assets.toast.item_restored":"Item restored.","assets.toast.revision_deprecated":"Revision deprecated.","assets.toast.revision_restored":"Revision restored.","assets.toast.revision_published":"Revision tagged published.","assets.toast.artifact_deprecated":"Artifact deprecated.","assets.toast.artifact_restored":"Artifact restored.","assets.toast.artifact_saved":"Artifact content updated.","assets.toast.artifact_saved_new_revision":"Created a new revision with the updated artifact attached.","assets.err.action":"Asset action failed.","assets.err.load_artifact":"Failed to load artifact content.","assets.editor.title":"Edit {name}","assets.editor.mutable_desc":"Saving updates the artifact file on the current revision.","assets.editor.published_desc":"This revision is published and immutable. Saving creates a new revision with the updated artifact attached.","config.kicker":"Operations","config.page_title":"Config","config.reload":"Reload","config.save_button":"Save Config","config.saving_button":"Saving…","config.loading_title":"Loading configuration…","config.toast.saved":"Configuration saved.","config.err.load":"Failed to load config.","config.err.save":"Failed to save config.","config.err.mcp_errors":"Fix MCP server errors before saving.","config.map":"Config Map","config.workspace":"TOML Workspace","config.workspace.structured_heading":"Structured controls","config.workspace.source_heading":"Source editor","config.tab.structured":"Structured","config.tab.source":"Source","config.tabs_aria":"Config workspace tabs","config.hide_preview":"Hide Preview","config.show_preview":"Show Preview","config.mapped_paths":"Mapped TOML Paths","config.structured.error_title":"Unable to build structured controls","config.structured.error_desc":"The raw TOML needs to be parseable before the grouped config controls can be shown.","config.summary.title":"Parsed Summary","config.summary.error_title":"Unable to parse TOML","config.summary.error_desc":"The summary panel only updates when the editor contains parseable TOML sections.","config.source_health":"Source Health","config.row.workspace_mode":"Workspace Mode","config.row.preview":"Preview","config.row.sections":"Sections","config.row.parse_status":"Parse Status","config.row.parse_valid":"Valid","config.row.parse_needs":"Needs Attention","config.mode.structured":"Structured","config.mode.source":"Source","config.toggle.enabled":"Enabled","config.toggle.disabled":"Disabled","config.section.provider":"Provider","config.section.provider_desc":"Default model provider, API routing, and generation tuning.","config.section.agent":"Agent","config.section.agent_desc":"Loop limits, context budgets, and reasoning defaults for the agent runtime.","config.section.memory":"Memory","config.section.memory_desc":"Memory backend, Kumiho wiring, and persistence behavior.","config.section.runtime":"Runtime","config.section.runtime_desc":"Gateway bind settings, pairing, and autonomy posture.","config.section.security":"Security / Cost","config.section.security_desc":"Audit and sandbox settings plus cost limit controls.","config.section.channels":"Channels","config.section.channels_desc":"CLI and messaging surface behavior for operational channels.","config.section.mcp":"MCP Servers","config.section.mcp_desc":"Model Context Protocol client — top-level toggles and structured server entries.","config.section.extra_desc":"Additional section discovered in config.toml — generic editor.","config.generic.empty":"No fields in this section yet.","config.generic.empty_array":"(empty array)","config.generic.array_readonly":"Arrays are read-only in the generic editor — edit via the Source tab.","config.provider.default_provider":"Default Provider","config.provider.default_model":"Default Model","config.provider.temperature":"Temperature","config.provider.timeout":"Provider Timeout","config.provider.max_tokens":"Provider Max Tokens","config.agent.max_tool_iterations":"Max Tool Iterations","config.agent.max_context_tokens":"Max Context Tokens","config.agent.max_history_messages":"Max History Messages","config.agent.gpt55_context_window":"GPT-5.5 Context Window","config.agent.context_window_safety_ratio":"Context Safety Ratio","config.agent.parallel_tools":"Parallel Tools","config.agent.thinking_level":"Thinking Level","config.memory.kumiho_enabled":"Kumiho Enabled","config.memory.memory_project":"Memory Project","config.memory.harness_project":"Harness Project","config.memory.retrieval_limit":"Retrieval Limit","config.memory.backend":"Memory Backend","config.memory.auto_save":"Auto Save","config.memory.snapshots":"Snapshots","config.runtime.gateway_host":"Gateway Host","config.runtime.gateway_port":"Gateway Port","config.runtime.require_pairing":"Require Pairing","config.runtime.session_persistence":"Session Persistence","config.runtime.autonomy_level":"Autonomy Level","config.runtime.max_actions_hour":"Max Actions / Hour","config.security.audit_enabled":"Audit Enabled","config.security.sandbox_backend":"Sandbox Backend","config.security.daily_limit":"Daily Limit USD","config.security.monthly_limit":"Monthly Limit USD","config.security.warn_percent":"Warn At Percent","config.channels.cli":"CLI Channel","config.channels.ack_reactions":"Ack Reactions","config.channels.show_tool_calls":"Show Tool Calls","config.channels.message_timeout":"Message Timeout Seconds","config.summary.api_url":"API URL","config.summary.provider":"Provider","config.summary.model":"Model","config.summary.temperature":"Temperature","config.summary.timeout":"Timeout","config.summary.max_tokens":"Max Tokens","config.summary.runtime":"Runtime","config.summary.gateway":"Gateway","config.summary.pairing_required":"Pairing Required","config.summary.session_persistence":"Session Persistence","config.summary.autonomy_level":"Autonomy Level","config.summary.workspace_only":"Workspace Only","config.summary.max_actions_hour":"Max Actions / Hour","config.summary.memory":"Memory","config.summary.backend":"Backend","config.summary.auto_save":"Auto Save","config.summary.hygiene":"Hygiene","config.summary.snapshots":"Snapshots","config.summary.kumiho_enabled":"Kumiho Enabled","config.summary.memory_project":"Memory Project","config.summary.retrieval_limit":"Retrieval Limit","config.summary.safety_cost":"Safety / Cost","config.summary.audit_enabled":"Audit Enabled","config.summary.sandbox_backend":"Sandbox Backend","config.summary.daily_limit":"Daily Limit","config.summary.monthly_limit":"Monthly Limit","config.summary.warn_percent":"Warn At %","config.summary.channels":"Channels","config.summary.cli":"CLI","config.summary.telegram":"Telegram","config.summary.discord":"Discord","config.summary.slack":"Slack","config.summary.matrix":"Matrix","config.summary.signal":"Signal","config.summary.whatsapp":"WhatsApp","config.row.enabled":"Enabled","config.row.disabled":"Disabled","config.mcp.title":"MCP","config.mcp.enabled":"MCP Enabled","config.mcp.deferred":"Deferred Loading","config.mcp.servers":"Servers","config.mcp.no_servers":"No servers configured yet.","config.mcp.server_count":"{count} servers configured.","config.mcp.server_count_one":"1 server configured.","config.mcp.add_server":"Add MCP Server","config.mcp.confirm_remove":"Remove {label}?","config.mcp.entry_label":"entry {index}","config.mcp.server_default":"Server {index}","config.mcp.stdio_empty":"stdio — no command set","config.mcp.transport_empty":"{transport} — no url set","config.mcp.test":"Test","config.mcp.testing":"Testing…","config.mcp.test_tooltip":"Run MCP initialize + tools/list handshake","config.mcp.test_blocked":"Fix validation errors before testing","config.mcp.delete_label":"Delete {label}","config.mcp.connecting":"connecting…","config.mcp.tool_count":"{count} tools · {latency}ms","config.mcp.tool_count_one":"1 tool · {latency}ms","config.mcp.tools_list":"tools: {list}","config.mcp.handshake_failed":"handshake failed","config.mcp.field_name":"Name","config.mcp.field_name_placeholder":"e.g. memory","config.mcp.field_transport":"Transport","config.mcp.field_command":"Command","config.mcp.field_command_placeholder":"/usr/local/bin/mcp-server","config.mcp.field_args":"Args","config.mcp.field_args_placeholder":"--flag","config.mcp.field_env":"Env","config.mcp.field_env_key":"KEY","config.mcp.field_env_value":"value","config.mcp.field_url":"URL","config.mcp.field_url_placeholder":"https://example.com/mcp","config.mcp.field_headers":"Headers","config.mcp.field_headers_key":"Header-Name","config.mcp.field_headers_value":"value","config.mcp.field_timeout":"Timeout (ms)","config.mcp.field_timeout_placeholder":"30000","config.mcp.add_entry":"Add {label}","config.mcp.remove_entry":"Remove {label} entry {index}","landing.skip_link":"Skip to main content","landing.nav.aria_label":"Site navigation","landing.nav.logo_alt":"Revka logo","landing.nav.features":"Features","landing.nav.launch":"Launch Dashboard","landing.hero.aria_label":"Hero","landing.hero.badge":"Memory-native · Rust-native · Graph-native","landing.hero.tagline":"Memory-native agent runtime","landing.hero.description":"Built on Kumiho's graph-native memory. Every session, plan, skill, and trust score lives in a graph — if it happened, it's queryable.","landing.hero.cta_primary":"Launch Dashboard","landing.hero.cta_secondary":"Explore Features","landing.hero.banner_alt":"Revka — Memory-native agent runtime dashboard","landing.hero.scroll_cue":"Scroll","landing.stats.aria_label":"Key stats","landing.stats.runtime_label":"Runtime","landing.stats.namespaces_label":"Namespaces","landing.stats.memory_label":"Memory graph","landing.stats.goals_label":"Goal tracking","landing.stats.orchestration_label":"Orchestration","landing.pillars.aria_label":"Pillars","landing.pillars.badge":"Three pillars","landing.pillars.title":"One runtime, any surface","landing.pillars.description":"Revka is built on three foundations — provider-agnostic agents, graph-native memory, and any-channel delivery.","landing.pillars.agents.title":"Agents","landing.pillars.agents.desc":"Provider-agnostic agents (OpenAI, Anthropic, local models) orchestrated through workflows and swarms — all on your machine.","landing.pillars.memory.title":"Memory","landing.pillars.memory.desc":"Persistent knowledge across sessions via Kumiho, SQLite, or Markdown. Your agents remember you, your projects, and prior decisions.","landing.pillars.channels.title":"Channels","landing.pillars.channels.desc":"Talk to Revka from Telegram, Discord, Slack, iMessage, Matrix, email, and more. One runtime, any surface.","landing.features.aria_label":"Features","landing.features.badge":"Capabilities","landing.features.title":"Built for the agentic era","landing.features.description":"Every component is designed around persistent memory and multi-agent collaboration — from spawn to retirement.","landing.features.featured_badge":"Core memory foundation","landing.features.memory.title":"Kumiho Memory","landing.features.memory.desc":"Graph-native persistent memory. Every session, plan, and skill is versioned, linked, and queryable—no fallback backends.","landing.features.operator.title":"Operator","landing.features.operator.desc":"Multi-agent orchestration with role delegation (coder, reviewer, researcher), spawn-with-recall, and trust scoring.","landing.features.pool.title":"Agent Pool","landing.features.pool.desc":"Reusable agent definitions with role, capabilities, and model preferences. Usage tracking surfaces high-performers first.","landing.features.clawhub.title":"ClawHub Marketplace","landing.features.clawhub.desc":"Publish, search, and install agent templates, skills, and team configurations in a shared registry.","landing.features.goals.title":"Goal Hierarchy","landing.features.goals.desc":"Three-tier goal tracking: strategic, tactical, and task-level—all persisted in the graph with status and dependencies.","landing.features.audit.title":"Audit Trail","landing.features.audit.desc":"Merkle hash-chain tamper-evident logging. Every action is recorded with cryptographically verifiable history.","landing.how.aria_label":"How it works","landing.how.badge":"Workflow","landing.how.title":"How Revka works","landing.how.description":"From agent deployment to persistent recall — the full lifecycle managed in three cohesive steps.","landing.how.step1.title":"Deploy your agent","landing.how.step1.desc":"Configure role, capabilities, and model preferences. Revka stores the template in the graph for reuse and recall.","landing.how.step2.title":"Memory accumulates","landing.how.step2.desc":"Every session, plan, skill, and interaction is versioned and edge-linked in Kumiho. Nothing is ever lost.","landing.how.step3.title":"Query everything","landing.how.step3.desc":"Use goal hierarchies, trust scores, and graph traversal to surface insights across all agent history.","landing.cli.aria_label":"CLI reference","landing.cli.badge":"CLI","landing.cli.title":"Drive it from the terminal","landing.cli.description":"The daemon must be running for the dashboard and channels to respond. Everything you can do in the UI maps to a command.","landing.cli.cmd.onboard":"Run the interactive setup wizard","landing.cli.cmd.reinit":"Reset and reconfigure from scratch (incl. tunnel)","landing.cli.cmd.daemon":"Start the long-running runtime","landing.cli.cmd.doctor":"Check daemon, scheduler, and channel health","landing.cli.cmd.status":"Print full system status","landing.cli.cmd.channel_list":"List configured channels","landing.cli.cmd.channel_add":"Add a Telegram bot","landing.cli.cmd.providers":"List supported AI providers","landing.cli.cmd.memory_stats":"Inspect agent memory size","landing.cli.cmd.service_install":"Install as a launchd/systemd user service","landing.arch.aria_label":"Architecture","landing.arch.badge":"Graph-native","landing.arch.title":"Everything in the graph","landing.arch.description":"All persistent state lives under a strict namespace hierarchy in Kumiho — versioned, edge-linked, and queryable across sessions.","landing.arch.ns.agentpool":"Reusable agent templates","landing.arch.ns.plans":"Execution plans & steps","landing.arch.ns.sessions":"Cross-session continuity","landing.arch.ns.goals":"Strategic goal tracking","landing.arch.ns.clawhub":"Published templates & skills","landing.arch.ns.teams":"Team definitions","landing.arch.ns.skills":"Shared skill library","landing.arch.ns.trust":"Trust scores & history","landing.arch.connection_note":"All namespaces connected via Kumiho graph edges","landing.tunnels.aria_label":"About tunnels","landing.tunnels.badge":"Tunnels","landing.tunnels.title":"Public reach, local trust","landing.tunnels.description_prefix":"Your gateway runs on ","landing.tunnels.description_suffix":" — only reachable from this machine. Webhook-based channels (Telegram, Slack events, WhatsApp, WeChat) need a public URL. A tunnel forwards a public hostname to your local gateway without opening firewall ports.","landing.tunnels.provider.cloudflare.name":"Cloudflare Tunnel","landing.tunnels.provider.cloudflare.desc":"Free, production-grade. Needs a Zero Trust account and a tunnel token.","landing.tunnels.provider.ngrok.name":"ngrok","landing.tunnels.provider.ngrok.desc":"Quick and ephemeral. Great for local development and testing.","landing.tunnels.provider.tailscale.name":"Tailscale Funnel","landing.tunnels.provider.tailscale.desc":"Share a tailnet service publicly using your tailnet identity.","landing.tunnels.provider.custom.name":"Custom","landing.tunnels.provider.custom.desc":"Bring your own reverse proxy or public URL.","landing.tunnels.setup_hint_prefix":"Run ","landing.tunnels.setup_hint_suffix":" and pick a provider when prompted.","landing.cta.aria_label":"Get started","landing.cta.headline_prefix":"Ready to ","landing.cta.headline_highlight":"start building","landing.cta.headline_suffix":"?","landing.cta.description":"Open the dashboard to manage agents, browse the skill library, orchestrate teams, and explore everything the graph remembers.","landing.cta.button":"Launch Dashboard","landing.footer.tagline":"Memory-native agent runtime"},tr:{"nav.dashboard":"Kontrol Paneli","nav.agent":"Ajan","nav.tools":"Araçlar","nav.cron":"Zamanlanmış Görevler","nav.integrations":"Entegrasyonlar","nav.memory":"Hafıza","nav.config":"Yapılandırma","nav.cost":"Maliyet Takibi","nav.logs":"Kayıtlar","nav.doctor":"Doktor","nav.agents":"Ajan Havuzu","nav.skills":"Beceri Kütüphanesi","nav.teams":"Ajan Takımları","nav.assets":"Varlik Gezgini","nav.skins":"Görünümler","nav.memoryAuditor":"Bellek Denetcisi","nav.audit":"Denetim İzi","nav.canvas":"Tuval","nav.workflows":"Is Akislari","dashboard.title":"Kontrol Paneli","dashboard.provider":"Sağlayıcı","dashboard.model":"Model","dashboard.uptime":"Çalışma Süresi","dashboard.temperature":"Sıcaklık","dashboard.gateway_port":"Ağ Geçidi Portu","dashboard.locale":"Dil","dashboard.memory_backend":"Hafıza Motoru","dashboard.paired":"Eşleştirilmiş","dashboard.channels":"Kanallar","dashboard.health":"Sağlık","dashboard.status":"Durum","dashboard.overview":"Genel Bakış","dashboard.system_info":"Sistem Bilgisi","dashboard.quick_actions":"Hızlı İşlemler","dashboard.provider_model":"Sağlayıcı / Model","dashboard.since_last_restart":"Son Yeniden Başlatmadan Beri","dashboard.paired_yes":"Evet","dashboard.paired_no":"Hayır","dashboard.cost_overview":"Maliyet Genel Bakışı","dashboard.active_channels":"Aktif Kanallar","dashboard.filter_active":"Aktif","dashboard.filter_all":"Tümü","dashboard.no_active_channels":"Aktif kanal yok","dashboard.component_health":"Bileşen Sağlığı","dashboard.load_error":"Kontrol paneli yüklenemedi","dashboard.session_label":"Oturum","dashboard.daily_label":"Günlük","dashboard.monthly_label":"Aylık","dashboard.total_tokens_label":"Toplam Token","dashboard.requests_label":"İstekler","dashboard.by_model":"Modele Göre","dashboard.no_channels":"Kanal yapılandırılmamış","dashboard.active":"Aktif","dashboard.inactive":"Aktif Değil","dashboard.no_components":"Bileşen raporlamıyor","dashboard.restarts":"Yeniden Başlatmalar","dashboard.tab_overview":"Genel Bakış","dashboard.tab_sessions":"Oturumlar","dashboard.tab_channels":"Kanallar","dashboard.tab_audit":"Denetim İzi","dashboard.tab_workflows":"Is Akislari","dashboard.audit_disabled":"Denetim günlüğü etkin değil.","dashboard.audit_all_types":"Tüm Olay Türleri","dashboard.audit_refresh":"Yenile","dashboard.audit_verify_chain":"Zinciri Doğrula","dashboard.audit_chain_valid":"Zincir bütünlüğü doğrulandı","dashboard.audit_chain_invalid":"Zincir bütünlüğü doğrulaması başarısız","dashboard.audit_no_events":"Denetim olayı bulunamadı","dashboard.sessions_title":"Aktif Oturumlar","dashboard.no_sessions":"Aktif oturum yok","dashboard.session_id":"Oturum Kimliği","dashboard.session_channel":"Kanal","dashboard.session_started":"Başlangıç","dashboard.session_last_activity":"Son Etkinlik","dashboard.session_status":"Durum","dashboard.session_messages":"Mesajlar","dashboard.session_details":"Oturum Ayrıntıları","dashboard.session_history":"Geçmişi Görüntüle","dashboard.channels_title":"Kanal Durumu","dashboard.no_channels_detail":"Kanal ayrıntısı yok","dashboard.channel_type":"Tür","dashboard.channel_messages":"Mesajlar","dashboard.channel_last_message":"Son Mesaj","dashboard.channel_config":"Yapılandırma","dashboard.channel_enabled":"Etkin","dashboard.channel_disabled":"Devre Dışı","dashboard.loading_sessions":"Oturumlar yükleniyor...","dashboard.loading_channels":"Kanallar yükleniyor...","dashboard.load_sessions_error":"Oturumlar yüklenemedi","dashboard.load_channels_error":"Kanallar yüklenemedi","dashboard.never":"Hiç","dashboard.tab_clawhub":"ClawHub","dashboard.tab_nodes":"Düğümler","dashboard.clawhub_title":"ClawHub Pazaryeri","dashboard.clawhub_search":"Şablon, yetenek, takım ara…","dashboard.clawhub_no_items":"Öğe bulunamadı. İlk şablonunuzu veya yeteneğinizi yayınlayın!","dashboard.clawhub_publish":"Yayınla","dashboard.clawhub_install":"Yükle","dashboard.clawhub_downloads":"indirme","dashboard.clawhub_by":"yazar","dashboard.nodes_title":"Bağlı Düğümler","dashboard.nodes_no_nodes":"Bağlı düğüm yok. Düğümler WebSocket ile /ws/nodes üzerinden bağlanır.","dashboard.nodes_capabilities":"Yetenekler","dashboard.nodes_invoke":"Çağır","agent.title":"Ajan Sohbeti","agent.send":"Gönder","agent.placeholder":"Bir mesaj yazın...","agent.start_conversation":"Sohbeti başlatmak için mesaj gönderin","agent.type_message":"Bir mesaj yazın...","agent.connecting":"Bağlanıyor...","agent.connected":"Bağlandı","agent.disconnected":"Bağlantı kesildi","agent.reconnecting":"Yeniden bağlanıyor...","agent.thinking":"Düşünüyor...","agent.tool_call":"Araç Çağrısı","agent.tool_result":"Araç Sonucu","agent.connection_error":"Bağlantı hatası. Yeniden bağlanmaya çalışılıyor...","agent.tool_call_prefix":"[Araç Çağrısı]","agent.tool_result_prefix":"[Araç Sonucu]","agent.error_prefix":"[Hata]","agent.unknown_error":"Bilinmeyen hata","agent.send_error":"Mesaj gönderilemedi. Lütfen tekrar deneyin.","agent.copy_message":"Mesajı kopyala","agent.connected_status":"Bağlandı","agent.disconnected_status":"Bağlantı kesildi","agent.copy_code":"Kodu kopyala","agent.copied_code":"Kod kopyalandı","agent.copy":"kopyala","agent.copied":"kopyalandı","agent.code_language_fallback":"kod","agent.jump_to_latest":"En yeniye git","agent.placeholder_steer_next_step":"sonraki adımı yönlendir…","agent.placeholder_queue_next":"sonraki mesajı sıraya al…","agent.placeholder_message":"mesaj…","agent.placeholder_connecting":"bağlanıyor…","agent.send_mode":"Gönderme modu","agent.send_mode_queue":"sıra","agent.send_mode_steer":"yönlendir","agent.queue_after_current_response":"Geçerli yanıttan sonra sıraya al","agent.steer_text_only":"Yönlendirme yalnızca metindir; ekler sıraya alınır","agent.steer_next_step":"Sonraki adımı yönlendir","agent.queue_message":"Mesajı sıraya al","agent.send_message":"Mesaj gönder","agent.send_enter":"Gönder (Enter)","agent.steer_prefix":"[yönlendir]","agent.tool_output_truncated":"Sohbet görünümünde çıktı kısaltıldı; tam sonuç için kopyalayın veya çalışma günlüğünü inceleyin.","agent.activity_input_label":"Girdi","agent.activity_diff_label":"Diff","agent.activity_output_label":"Çıktı","agent.reasoning_trace_label":"Düşünce izi","tools.name":"Ad","tools.parameters":"Parametreler","tools.search":"Araç ara...","tools.empty":"Araç bulunamadı.","tools.count":"Toplam araç","tools.agent_tools":"Ajan Araçları","tools.cli_tools":"CLI Araçları","tools.path":"Yol","tools.version":"Sürüm","tools.category":"Kategori","tools.load_error":"Araçlar yüklenemedi","cron.title":"Zamanlanmış Görevler","cron.scheduled_tasks":"Zamanlanmış Görevler","cron.add":"Görev Ekle","cron.add_job":"Görev Ekle","cron.add_modal_title":"Cron Görevi Ekle","cron.delete":"Sil","cron.enable":"Etkinleştir","cron.disable":"Devre Dışı Bırak","cron.name":"Ad","cron.name_optional":"Ad (isteğe bağlı)","cron.command":"Komut","cron.command_required":"Komut","cron.schedule":"Zamanlama","cron.schedule_required":"Zamanlama","cron.next_run":"Sonraki Çalıştırma","cron.last_run":"Son Çalıştırma","cron.last_status":"Son Durum","cron.enabled":"Etkin","cron.enabled_status":"Etkin","cron.disabled_status":"Devre Dışı","cron.empty":"Zamanlanmış görev bulunamadı.","cron.confirm_delete":"Bu görevi silmek istediğinizden emin misiniz?","cron.load_error":"Cron görevleri yüklenemedi","cron.validation_error":"Zamanlama ve komut gereklidir.","cron.add_error":"Görev eklenemedi","cron.delete_error":"Görev silinemedi","cron.cancel":"İptal","cron.adding":"Ekleniyor...","cron.id":"ID","cron.actions":"İşlemler","cron.loading_run_history":"Çalıştırma geçmişi yükleniyor...","cron.load_run_history_error":"Çalıştırma geçmişi yüklenemedi","cron.no_runs":"Henüz çalıştırma kaydı yok.","cron.recent_runs":"Son Çalıştırmalar","cron.yes":"Evet","cron.no":"Hayır","cron.edit":"Düzenle","cron.edit_modal_title":"Cron Görevini Düzenle","cron.edit_error":"Görev güncellenemedi","cron.saving":"Kaydediliyor...","cron.save":"Kaydet","integrations.available":"Mevcut","integrations.active":"Aktif","integrations.coming_soon":"Yakında","integrations.category":"Kategori","integrations.status":"Durum","integrations.search":"Entegrasyon ara...","integrations.empty":"Entegrasyon bulunamadı.","integrations.activate":"Etkinleştir","integrations.deactivate":"Devre Dışı Bırak","integrations.load_error":"Entegrasyonlar yüklenemedi","integrations.all":"Tümü","integrations.status_active":"Aktif","integrations.status_available":"Mevcut","integrations.status_coming_soon":"Yakında","memory.title":"Hafıza Deposu","memory.memory_title":"Hafıza","memory.search":"Hafıza ara...","memory.search_placeholder":"Hafıza girişleri ara...","memory.add":"Hafıza Ekle","memory.add_memory":"Hafıza Ekle","memory.add_modal_title":"Hafıza Ekle","memory.delete":"Sil","memory.key":"Anahtar","memory.key_required":"Anahtar","memory.content":"İçerik","memory.content_required":"İçerik","memory.category":"Kategori","memory.category_optional":"Kategori (isteğe bağlı)","memory.timestamp":"Zaman Damgası","memory.session":"Oturum","memory.score":"Puan","memory.empty":"Hafıza girişi bulunamadı.","memory.confirm_delete":"Bu hafıza girişini silmek istediğinizden emin misiniz?","memory.all_categories":"Tüm Kategoriler","memory.search_button":"Ara","memory.load_error":"Hafıza yüklenemedi","memory.saving":"Kaydediliyor...","memory.validation_error":"Anahtar ve içerik gereklidir.","memory.store_error":"Hafıza kaydedilemedi","memory.delete_error":"Hafıza silinemedi","memory.delete_confirm":"Sil?","memory.yes":"Evet","memory.no":"Hayır","memory.cancel":"İptal","config.title":"Yapılandırma","config.save":"Kaydet","config.saving":"Kaydediliyor...","config.reset":"Sıfırla","config.saved":"Yapılandırma başarıyla kaydedildi.","config.error":"Yapılandırma kaydedilemedi.","config.loading":"Yapılandırma yükleniyor...","config.editor_placeholder":"TOML yapılandırması...","config.configuration_title":"Yapılandırma","config.sensitive_title":"Hassas alanlar gizlendi","config.sensitive_hint":"API anahtarları, belirteçler ve parolalar güvenlik için gizlendi. Maskeli bir alanı güncellemek için, tüm maskeli değeri yeni değerinizle değiştirin.","config.save_success":"Yapılandırma başarıyla kaydedildi.","config.save_error":"Yapılandırma kaydedilemedi","config.toml_label":"TOML Yapılandırması","config.lines":"satır","cost.session":"Oturum Maliyeti","cost.daily":"Günlük Maliyet","cost.monthly":"Aylık Maliyet","cost.request_count":"İstek Sayısı","cost.by_model":"Modele Göre Maliyet","cost.model":"Model","cost.usd":"Maliyet (USD)","cost.load_error":"Maliyet verileri yüklenemedi","cost.total_requests":"Toplam İstek","cost.token_statistics":"Token İstatistikleri","cost.avg_tokens_per_request":"Ortalama Token / İstek","cost.cost_per_1k_tokens":"1K Token Başına Maliyet","cost.model_breakdown":"Model Detayı","cost.cost":"Maliyet","cost.share":"Pay","logs.live_logs":"Canlı Kayıtlar","logs.clear":"Temizle","logs.filter":"Kayıtları filtrele...","logs.filter_label":"Filtre","logs.empty":"Kayıt girişi bulunamadı.","logs.events":"olay","logs.paused_hint":"Kayıt akışı duraklatıldı.","logs.waiting_hint":"Olay bekleniyor...","doctor.diagnostics_title":"Tanılar","doctor.run_diagnostics":"Tanı Çalıştır","doctor.running_btn":"Çalıştırılıyor...","doctor.running_desc":"Tanı çalıştırılıyor...","doctor.running_hint":"Bu birkaç saniye sürebilir.","doctor.error":"Hata","doctor.severity":"Şiddet","doctor.category":"Kategori","doctor.message":"Mesaj","doctor.empty":"Henüz tanı çalıştırılmadı.","doctor.summary":"Tanı Özeti","doctor.issues_found":"Sorunlar Bulundu","doctor.warnings_summary":"Uyarılar","doctor.all_clear":"Her Şey Yolunda","doctor.system_diagnostics":"Sistem Tanıları","doctor.empty_hint":'Revka kurulumunuzu kontrol etmek için "Tanı Çalıştır" düğmesine tıklayın.',"auth.pair":"Cihaz Eşleştir","auth.pairing_code":"Eşleştirme Kodu","auth.pair_button":"Eşleştir","auth.logout":"Çıkış Yap","auth.pairing_success":"Eşleştirme başarılı!","auth.pairing_failed":"Eşleştirme başarısız. Lütfen tekrar deneyin.","auth.enter_code":"Akıllı birine bağlanmak için eşleştirme kodunuzu girin.","common.loading":"Yükleniyor...","common.error":"Bir hata oluştu.","common.retry":"Tekrar Dene","common.cancel":"İptal","common.confirm":"Onayla","common.save":"Kaydet","common.delete":"Sil","common.edit":"Düzenle","common.execute":"Çalıştır","common.close":"Kapat","common.yes":"Evet","common.no":"Hayır","common.search":"Ara...","common.no_data":"Veri mevcut değil.","common.refresh":"Yenile","common.back":"Geri","common.actions":"İşlemler","common.name":"Ad","common.description":"Açıklama","common.status":"Durum","common.created":"Oluşturulma","common.updated":"Güncellenme","health.title":"Sistem Sağlığı","health.component":"Bileşen","health.status":"Durum","health.last_ok":"Son Başarılı","health.last_error":"Son Hata","health.restart_count":"Yeniden Başlatmalar","health.pid":"İşlem Kimliği","health.uptime":"Çalışma Süresi","health.updated_at":"Son Güncelleme","settings.title":"Ayarlar","settings.tab.appearance":"Görünüm","settings.tab.typography":"Tipografi","settings.appearance":"Görünüm","settings.typography":"Tipografi","settings.fontUi":"Arayüz Yazı Tipi","settings.fontMono":"Kod Yazı Tipi","settings.fontSize":"Arayüz Boyutu","settings.fontMonoSize":"Kod Boyutu","settings.preview":"Önizleme","settings.previewText":"Tembel köpek üzerinde hızlı kahverengi tilki zıplar.","settings.fontNote":"Yazı tipi değişiklikleri sayfa yeniden yüklendikten sonra geçerli olur.","settings.language":"Dil","chat_panel.ai_assistant":"AI Asistanı","chat_panel.agent_placeholder":'Bir ajan oluşturmamı isteyin, ör. "Bir Rust güvenlik uzmanı oluştur"',"chat_panel.team_placeholder":'Bir takım kurmamı isteyin, ör. "Frontend taşıma için bir takım kur"',"chat_panel.skill_placeholder":'Bir yetenek oluşturmamı isteyin, ör. "Kod inceleme yeteneği oluştur"',"chat_panel.close":"Kapat","clawhub.tab_local":"Yerel Yetenekler","clawhub.tab_clawhub":"ClawHub","clawhub.search_placeholder":"ClawHub yeteneklerini ara...","clawhub.trending":"Trend","clawhub.install":"Yükle","clawhub.installing":"Yükleniyor...","clawhub.installed":"Yüklendi","clawhub.downloads":"indirme","clawhub.stars":"yıldız","clawhub.verified":"Doğrulanmış","clawhub.no_results":"Yetenek bulunamadı","clawhub.search_hint":"ClawHub'daki 13.000+ topluluk yeteneğini arayın","clawhub.error":"ClawHub'a bağlanılamadı","clawhub.details":"Detaylar","clawhub.less":"Kapat","clawhub.author":"Yazar","clawhub.tags":"Etiketler","theme.mode":"Tema Modu","theme.accent":"Vurgu Rengi","theme.system":"Sistem","theme.dark":"Koyu","theme.light":"Açık","theme.oled":"OLED Siyah","nav.pairing":"Eşleştirme","nav.section.orchestration":"Orkestrasyon","nav.section.operations":"İşlemler","nav.section.inspection":"İnceleme","nav.dashboard.blurb":"Canlı çalışma durumu ve aktif DAG durumu","nav.workflows.blurb":"DAG tanımlayın ve çalışmalara aynı akıştan dalın","nav.agents.blurb":"Yeniden kullanılabilir aktörler ve iş akışı katılımcıları","nav.canvas.blurb":"Görsel çalışma alanı ve orkestrasyon tuvalleri","nav.teams.blurb":"Yetki devri topolojisi ve sahipliği görüntüleyin","nav.assets.blurb":"Yapı çıktıları ve iş akışı ile ilgili kaynaklar","nav.skins.blurb":"Belirteç ve varlık tabanlı arayüz görünümleri","nav.skills.blurb":"Yeniden kullanılabilir operasyonel yetenekler","nav.tools.blurb":"Ajan araç kataloğu ve CLI ikili dosyaları","nav.integrations.blurb":"Bağlı sistemler ve kanal yüzeyleri","nav.cron.blurb":"Zamanlanmış işler ve telafi davranışı","nav.pairing.blurb":"Cihaz kaydı ve güven yönetimi","nav.config.blurb":"Çalışma zamanı TOML ve operasyonel yapılandırma","nav.cost.blurb":"İş akışı ve çalışmaya göre harcama ve verimlilik","nav.memory.blurb":"Kumiho bellek grafiği gezgini ve revizyonlar","nav.logs.blurb":"Operasyonel izler ve düğüm bağlantılı olaylar","nav.audit.blurb":"Güven zinciri ve onay doğrulama","nav.doctor.blurb":"Tanılama ve çalışma zamanı kurtarma durumu","sidebar.brand_subtitle":"Ajan OS","sidebar.shell":"Revka","sidebar.shell_description":"Projelerinde AI iş akışlarını, araçları ve çalışma zamanını düzenleyen yerel öncelikli bir ajan işletim sistemi.","header.tagline":"Orkestrasyon öncelikli ajan işletim sistemi.","header.runtime_healthy":"Çalışma zamanı sağlıklı","header.trust_verified":"Güven doğrulandı","header.trust_unverified":"Güven doğrulanmadı","header.trust_checking":"Güven doğrulanıyor…","header.operator":"Operatör","common.duplicate":"Çoğalt","common.reenable":"Yeniden Etkinleştir","common.deprecate":"Kullanımdan Kaldır","common.create":"Oluştur","dashboard.kicker":"Orkestrasyon Merkezi","dashboard.live_orchestration_pane":"Canlı Orkestrasyon Paneli","dashboard.active_workflow_posture":"Aktif iş akışı durumu","dashboard.open_workflow_definition":"İş akışı tanımını aç","dashboard.selected_run":"Seçili Çalıştırma","dashboard.run_posture":"Çalıştırma Durumu","dashboard.signal_focus":"Sinyal Odağı","dashboard.hotspots":"Sıcak Noktalar","dashboard.count.running":"Çalışıyor","dashboard.count.failed":"Başarısız","dashboard.count.completed":"Tamamlandı","dashboard.count.pending":"Bekliyor","dashboard.count.skipped":"Atlandı","dashboard.prev_signal":"Önceki Sinyal","dashboard.next_signal":"Sonraki Sinyal","dashboard.intervention_points":"{count} müdahale noktası","dashboard.label.failure":"Başarısız: {id}","dashboard.label.running":"Çalışıyor: {id}","dashboard.label.blocked":"Engellendi: {id}","dashboard.selected_step":"Seçili Adım","dashboard.inspect_node_in_runs":"Bu düğümü çalıştırma çalışma alanında incele","dashboard.open_definition_node":"Tanım düğümünü aç","dashboard.select_dag_node":"Aktif dalı incelemek için DAG'da bir düğüm seçin.","dashboard.priority_timeline":"Öncelik Zaman Çizelgesi","dashboard.no_run_selected":"Çalıştırma seçilmedi.","dashboard.open_full_run_workspace":"Tam çalıştırma çalışma alanını aç","dashboard.open_all_runs":"Tüm iş akışı çalıştırmalarını aç","dashboard.status.blocked":"engellendi","dashboard.scene.operator":"Operatör Özeti","dashboard.scene.error":"Pano telemetrisi bozuldu. Sonraki adımdan önce çalıştırma rayını ve günlükleri kontrol edin.","dashboard.scene.selected_run":"{workflow} şu anda {status}. {completed}/{total} adım tamamlandı.","dashboard.scene.run_failed":"{workflow} dikkat istiyor: {failed} adım başarısız, {completed}/{total} adım tamamlandı.","dashboard.scene.active_overview":"{definitions} iş akışı tanımı genelinde {active} aktif çalıştırma var.","dashboard.scene.idle_overview":"Seçili çalıştırma yok. {definitions} tanım hazır, toplam {total} çalıştırma kaydedildi.","workflows.kicker":"Orkestrasyon Merkezi","workflows.title":"İş Akışları","workflows.create":"İş Akışı Oluştur","workflows.workflow_info":"v{version} · {steps} düğüm · {runs} çalıştırma","workflows.workflow_info_short":"v{version} · {steps} düğüm","workflows.status.off":"Kapalı","workflows.status.ready":"Hazır","workflows.tab.definition":"Tanım","workflows.tab.runs":"Çalıştırmalar","workflows.loading":"İş akışları yükleniyor…","workflows.empty_title":"Henüz iş akışı yok","workflows.empty_desc":"Başlamak için ilk iş akışınızı oluşturun.","workflows.definition_unavailable_title":"İş akışı tanımı kullanılamıyor","workflows.definition_unavailable_desc":"Çalışma zamanı bu iş akışı için boş bir tanım döndürdü — grafik oluşturulamıyor. Bu bir arka uç veri sorunudur ve yukarı akışta düzeltilmelidir.","workflows.no_runs_title":"Henüz çalıştırma yok","workflows.no_runs_desc":"Yürütme durumunu görmek için bu iş akışını çalıştırın.","workflows.open_node_in_runs":"Düğümü çalıştırmalarda aç","workflows.select_dag_node":"DAG'da bir düğüm seçin.","workflows.run_step":"Çalıştırma Adımı","workflows.select_dag_node_step":"Adımı incelemek için bir DAG düğümü seçin.","workflows.save_failure":"İş akışı kaydedilemedi","workflows.save_failure_dot":"İş akışı kaydedilemedi.","workflows.run_failure":"İş akışı çalıştırılamadı","workflows.status_failure":"İş akışı durumu değiştirilemedi","workflows.status_failure_dot":"İş akışı durumu değiştirilemedi.","workflows.delete_failure":"İş akışı silinemedi","workflows.delete_failure_dot":"İş akışı silinemedi.","workflows.toast.updated":'"{name}" iş akışı güncellendi.',"workflows.toast.created":'"{name}" iş akışı oluşturuldu.',"workflows.toast.reenabled":'"{name}" iş akışı yeniden etkinleştirildi.',"workflows.toast.deprecated":'"{name}" iş akışı kullanımdan kaldırıldı.',"workflows.toast.deleted":'"{name}" iş akışı silindi.',"workflows.toast.run_started":'"{name}" iş akışı başlatıldı (çalıştırma {runId}).',"workflows.run_option":"{prefix} — {status} ({completed}/{total})","workflows.copy_suffix":"Kopya","doctor.kicker":"İnceleme","doctor.title":"Doktor","doctor.description":"Çalışma zamanı tanılamalarını çalıştırın ve Revka yığınındaki gruplanmış sağlık bulgularını inceleyin.","doctor.run":"Tanılamaları Çalıştır","doctor.running":"Çalışıyor…","doctor.failed_title":"Tanılamalar başarısız","doctor.loading_title":"Sistem tanılamaları çalışıyor…","doctor.loading_desc":"Çalışma zamanı bileşenleri, yapılandırma ve operasyonel sağlık kontrol ediliyor.","doctor.health_summary":"Sağlık Özeti","doctor.passing":"Geçen","doctor.warnings":"Uyarılar","doctor.failures":"Başarısızlıklar","doctor.run_context":"Çalıştırma Bağlamı","doctor.context_p1":"Doktor, bir terminal dökümü değil, bir inceleme panosu gibi davrandığında en güçlüdür. Bu panel önce genel durumu vurgular, ardından bulguları alt sistem gruplarına ayırır.","doctor.context_p2":"Bireysel mesajlara dalmadan önce uyarıların nerede kümelendiğini belirlemek için kategori panolarını kullanın.","doctor.subsystem_boards":"Alt Sistem Panoları","doctor.checks":"{count} kontrol","doctor.ok":"ok","doctor.warn":"uyarı","doctor.fail":"hata","doctor.system_diag_title":"Sistem tanılamaları","doctor.system_diag_desc":"Revka kabuğundaki uyarıları, başarısızlıkları ve tüm temiz kontrolleri incelemek için doktoru çalıştırın.","doctor.run_failed":"Tanılamalar çalıştırılamadı","cost.kicker":"İşlemler","cost.title":"Maliyet","cost.error_title":"Maliyet verileri yüklenemiyor","cost.loading_title":"Maliyet verileri yükleniyor…","cost.spend_posture":"Harcama Durumu","cost.session_cost":"Oturum Maliyeti","cost.daily_cost":"Günlük Maliyet","cost.monthly_cost":"Aylık Maliyet","cost.requests":"İstekler","cost.token_efficiency":"Token Verimliliği","cost.total_tokens":"Toplam Token","cost.avg_tokens":"Ort. Token / İstek","cost.cost_per_1k":"Maliyet / 1K Token","cost.model_workspace":"Model Çalışma Alanı","cost.spend_by_model":"Modele göre harcama","cost.no_model_data":"Model verisi yok","cost.no_model_data_desc":"Model düzeyinde harcama, istekler kaydedildikten sonra görünür.","cost.tokens_label":"{count} token","cost.requests_label":"{count} istek","cost.share_label":"Aylık harcamanın %{share}'i","cost.selected_model":"Seçili Model","cost.no_model_selected":"Model seçilmedi","cost.no_model_selected_desc":"Harcama yoğunluğunu ve verimliliği incelemek için çalışma alanından bir model seçin.","cost.monthly_spend":"Aylık Harcama","cost.tokens":"Tokenlar","cost.share_monthly":"Aylık Harcama Payı","cost.interpretation":"Yorum","cost.interp_p1":"Büyük aylık pay değerleri, maliyetin tek bir model ailesinde yoğunlaştığını gösterir.","cost.interp_p2":"Düşük istek sayısıyla yüksek istek başına token genellikle uzun bağlamlı veya üretim yoğun iş akışlarına işaret eder.","logs.kicker":"İnceleme","logs.title":"Kayıtlar","logs.description":"Revka arka plan işlem stderr günlüğünün takibi. Çalışma zamanı ajan olayları Denetim sayfasındadır.","logs.pause":"Duraklat","logs.resume":"Devam Et","logs.jump_to_bottom":"En Alta Git","logs.stream_status":"Akış Durumu","logs.connected":"Bağlı","logs.disconnected":"Bağlantı Kesildi","logs.visible_lines":"{count} görünür satır. ~/.revka/logs/daemon.stderr.log takip ediliyor.","logs.event_filters":"Olay Filtreleri","logs.no_event_types":"Henüz olay türü yok","logs.no_event_types_desc":"Akış etkinlik aldıktan sonra filtreler görünür.","logs.clear_filters":"Filtreleri Temizle","logs.live_event_feed":"Canlı Olay Akışı","logs.no_events":"Henüz olay yok","logs.no_events_desc":"SSE beslemesi çalışma zamanı olaylarını aldıktan sonra ajan etkinlikleri burada akacaktır.","tools.kicker":"İşlemler","tools.title":"Araçlar","tools.description":"Ajan tarafına yönelik araç kataloğu ve çalışma zamanının çağırabileceği ana bilgisayar CLI ikili dosyaları.","tools.reload":"Yeniden Yükle","tools.search_placeholder":"Araçları ada, açıklamaya veya kategoriye göre arayın…","tools.loading":"Araçlar yükleniyor…","tools.agent_tools_count":"Ajan Araçları · {count}","tools.no_matches":"Eşleşme yok","tools.no_agent_tools":"Kayıtlı ajan aracı yok","tools.try_different":"Farklı bir arama terimi deneyin.","tools.agent_tools_empty_desc":"Çalışma zamanı kaydettiğinde ajan araçları görünür.","tools.parameter_schema":"Parametre Şeması","tools.cli_tools_count":"CLI Araçları · {count}","tools.no_cli_tools":"CLI aracı algılanmadı","tools.cli_tools_empty_desc":"Revka başlangıçta yaygın CLI ikili dosyalarını araştırır. Birini yükleyin ve yeniden yükleyin.","tools.col.name":"Ad","tools.col.path":"Yol","tools.col.version":"Sürüm","tools.col.category":"Kategori","tools.failed_load":"Araçlar yüklenemedi: {message}","audit.kicker":"İnceleme","audit.title":"Denetim","audit.description":"Operasyonel eylemler için güven zinciri doğrulaması, olay incelemesi ve güvenlik duruşu.","audit.refresh":"Yenile","audit.verify_chain":"Zinciri Doğrula","audit.disabled_title":"Denetim izi devre dışı","audit.disabled_desc":"Burada onay, politika ve güvenlik olaylarını incelemek için denetim kaydını etkinleştirin.","audit.filters":"Filtreler","audit.all_event_types":"Tüm olay türleri","audit.event.command_execution":"Komut Yürütme","audit.event.file_access":"Dosya Erişimi","audit.event.config_change":"Yapılandırma Değişikliği","audit.event.auth_success":"Kimlik Doğrulama Başarılı","audit.event.auth_failure":"Kimlik Doğrulama Başarısız","audit.event.policy_violation":"Politika İhlali","audit.event.security_event":"Güvenlik Olayı","audit.chain_verified":"Zincir doğrulandı","audit.chain_invalid":"Zincir geçersiz","audit.entries_verified":"{count} giriş doğrulandı.","audit.stream_title":"Denetim Olay Akışı","audit.stream_subtitle":"Kayıtlı eylemler ve onaylar","audit.loading":"Denetim olayları yükleniyor…","audit.empty_title":"Denetim olayı yok","audit.empty_desc":"Eylemler veya onaylar yayıldığında kayıtlı olaylar burada görünecektir.","audit.col.sequence":"Sıra","audit.col.action":"Eylem","audit.col.result":"Sonuç","audit.col.hash":"Hash","audit.result_success":"Başarılı","audit.result_recorded":"Kaydedildi","audit.policy_violation_badge":"Politika ihlali","audit.time.seconds_ago":"{n}s önce","audit.time.minutes_ago":"{n}dk önce","audit.time.hours_ago":"{n}sa önce","audit.time.days_ago":"{n}g önce","integrations.kicker":"Operasyon","integrations.title":"Entegrasyonlar","integrations.loading":"Entegrasyonlar yükleniyor…","integrations.coverage":"Kapsam","integrations.metric.active":"Aktif","integrations.metric.available":"Mevcut","integrations.metric.coming_soon":"Yakında","integrations.categories":"Kategoriler","integrations.category_all":"tümü","integrations.workspace":"Entegrasyon Çalışma Alanı","integrations.all_integrations":"Tüm entegrasyonlar","integrations.category_integrations":"{category} entegrasyonları","integrations.empty_title":"Entegrasyon yok","integrations.empty_desc":"Hiçbir entegrasyon mevcut kategori filtresiyle eşleşmedi.","integrations.badge.active":"Aktif","integrations.badge.available":"Mevcut","integrations.badge.coming_soon":"Yakında","integrations.selected":"Seçili Entegrasyon","integrations.no_selected_title":"Entegrasyon seçilmedi","integrations.no_selected_desc":"Dağıtım duruşunu incelemek için çalışma alanından bir entegrasyon seçin.","integrations.detail.category":"Kategori","integrations.detail.status":"Durum","integrations.detail.operational_readiness":"Operasyonel Hazırlık","integrations.readiness.active":"Çalışma zamanında zaten aktif.","integrations.readiness.available":"Operatör hazır olduğunda etkinleştirilebilir.","integrations.readiness.coming_soon":"Henüz etkinleştirilmeye hazır olmayan planlı yüzey.","integrations.legend":"Durum Açıklaması","integrations.legend.p1":"`Active` entegrasyonlar zaten çalışma zamanı iş akışlarına bağlı.","integrations.legend.p2":"`Available` entegrasyonlar mevcut sürümden kurulabilir veya bağlanabilir.","integrations.legend.p3":"`Coming Soon` entegrasyonlar planlanmış ancak henüz operatörler için hazır değil.","pairing.kicker":"Operasyon","pairing.title":"Eşleştirme","pairing.description":"Eşleştirme kodları verin, mobil kayıt için QR oluşturun ve güvenilen cihazları yönetin.","pairing.reload":"Yeniden Yükle","pairing.pair_new_device":"Yeni Cihaz Eşleştir","pairing.generating":"Oluşturuluyor…","pairing.active_code":"Aktif Eşleştirme Kodu","pairing.rendering":"Render ediliyor…","pairing.code_hint":"QR kodunu Revka yardımcı uygulamasıyla tarayın veya eşleştirilen cihaza 6 haneli kodu girin. Kodlar, bir cihaz kaydı tamamladığında veya yenisini oluşturduğunuzda sona erer.","pairing.copy_code":"Kodu Kopyala","pairing.rotate":"Döndür","pairing.cli_device_name":"CLI cihaz adı","pairing.cli_hardware":"Donanım","pairing.cli_hardware_placeholder":"İsteğe bağlı platform etiketi","pairing.mint_cli_token":"CLI Token Oluştur","pairing.minting_token":"Oluşturuluyor…","pairing.minted_token":"Oluşturulan Bearer Token","pairing.copy_token":"Token Kopyala","pairing.no_code_title":"Aktif eşleştirme kodu yok","pairing.no_code_desc":'Yeni bir kod ve QR oluşturmak için "Yeni Cihaz Eşleştir"e basın. Kodlar kısa ömürlüdür ve tek bir kayıt içindir.',"pairing.how_to_scan":"Nasıl taranır","pairing.scan_step1":"Yeni cihazda Revka yardımcı uygulamasını açın.","pairing.scan_step2_prefix":"Seçin: ","pairing.scan_step2_action":"Hub ile eşleştir","pairing.scan_step2_suffix":".","pairing.scan_step3":"QR kodunu tarayın veya 6 haneli kodu manuel olarak girin.","pairing.scan_step4":"Kayıt tamamlandığında cihaz aşağıdaki listede görünür.","pairing.paired_devices":"Eşleştirilen Cihazlar · {count}","pairing.loading_devices":"Cihazlar yükleniyor…","pairing.no_devices_title":"Henüz eşleştirilmiş cihaz yok","pairing.no_devices_desc":"Başarılı bir kayıttan sonra eşleştirilmiş cihazlar burada görünecek.","pairing.col.name":"Ad","pairing.col.type":"Tür","pairing.col.hardware":"Donanım","pairing.col.paired":"Eşleştirildi","pairing.col.last_seen":"Son Görülme","pairing.col.ip":"IP","pairing.col.actions":"Eylemler","pairing.unnamed":"İsimsiz","pairing.unknown":"Bilinmeyen","pairing.device_type.api_client":"API İstemcisi","pairing.device_type.browser":"Tarayıcı","pairing.device_type.cli":"CLI","pairing.device_type.mobile":"Mobil","pairing.device_type.tablet":"Tablet","pairing.revoke":"İptal et?","pairing.yes":"Evet","pairing.no":"Hayır","pairing.revoke_title":"Cihazı iptal et","pairing.toast.code_generated":"Yeni eşleştirme kodu oluşturuldu.","pairing.toast.code_copied":"Kod kopyalandı.","pairing.toast.token_minted":"Bearer token oluşturuldu. Şimdi kopyalayın.","pairing.toast.token_copied":"Token kopyalandı.","pairing.toast.copy_failed":"Kopyalama başarısız. Manuel olarak seçin.","pairing.toast.device_revoked":"Cihaz iptal edildi.","pairing.err.load_devices":"Cihazlar yüklenemedi","pairing.err.gen_code":"Eşleştirme kodu oluşturulamadı","pairing.err.mint_token":"Bearer token oluşturulamadı","pairing.err.revoke":"Cihaz iptal edilemedi","cron.kicker":"Operasyon","cron.description":"Zamanlanmış görevler, yakalama davranışı ve son çalıştırma geçmişi.","cron.reload":"Yeniden Yükle","cron.startup_behaviour":"Başlangıç Davranışı","cron.catch_up_title":"Başlangıçta kaçırılan görevleri yakala","cron.catch_up_desc":"Revka durgunluktan sonra başlatıldığında gecikmiş tüm görevleri çalıştırın.","cron.loading_jobs":"Zamanlanmış görevler yükleniyor…","cron.no_jobs_title":"Zamanlanmış görev yok","cron.no_jobs_desc":"Bir zamanlamaya göre komut çalıştırmak için bir cron görevi ekleyin.","cron.col.id":"ID","cron.col.name":"Ad","cron.col.command":"Komut","cron.col.next_run":"Sonraki Çalıştırma","cron.col.last_status":"Son Durum","cron.col.enabled":"Etkin","cron.col.actions":"Eylemler","cron.enabled_badge":"Etkin","cron.disabled_badge":"Devre Dışı","cron.toggle_history":"Çalıştırma geçmişini aç/kapat","cron.confirm":"Onaylıyor musunuz?","cron.history.loading":"Çalıştırma geçmişi yükleniyor…","cron.history.error_title":"Çalıştırma geçmişi yüklenemiyor","cron.history.retry":"Tekrar Dene","cron.history.no_runs_title":"Henüz çalıştırma yok","cron.history.no_runs_desc":"Bu görev oluşturulduğundan beri çalıştırılmadı.","cron.history.refresh":"Yenile","cron.history.recent":"Son çalıştırmalar · {count}","cron.history.refresh_title":"Çalıştırmaları yenile","cron.modal.edit_title":"Cron Görevini Düzenle","cron.modal.add_title":"Cron Görevi Ekle","cron.modal.description":"Ad isteğe bağlıdır. Program standart cron ifadelerini kullanır.","cron.form.name":"Ad","cron.form.optional":"(isteğe bağlı)","cron.form.name_placeholder":"örn. Günlük temizlik","cron.form.schedule":"Program","cron.form.command":"Komut","cron.form.command_placeholder":"örn. cleanup --older-than 7d","cron.form.cancel":"İptal","cron.form.saving":"Kaydediliyor…","cron.form.adding":"Ekleniyor…","cron.form.save":"Kaydet","cron.err.load":"Görevler yüklenemedi: {message}","cron.err.settings":"Ayarlar güncellenemedi","cron.err.save":"Görev kaydedilemedi","cron.err.delete":"Görev silinemedi","cron.err.form_required":"Program ve komut gereklidir.","cron.toast.updated":'"{name}" güncellendi.',"cron.toast.added":'"{name}" eklendi.',"cron.toast.deleted":"Görev silindi.","canvas.kicker":"Orkestrasyon Merkezi","canvas.title":"Tuval","canvas.reconnect":"Yeniden Bağlan","canvas.control":"Tuval Kontrolü","canvas.connected":"Bağlı","canvas.disconnected":"Bağlantı Kesildi","canvas.canvas_id_placeholder":"Tuval Kimliği","canvas.switch":"Değiştir","canvas.clear":"Temizle","canvas.available":"Mevcut Tuvaller","canvas.loading_list":"Tuvaller yükleniyor…","canvas.loading_list_desc":"Canlı tuval kaydı sorgulanıyor.","canvas.no_active_title":"Aktif tuval yok","canvas.no_active_desc":"Bir ajan veya iş akışı çerçeve gönderdiğinde tuval kimlikleri burada görünecek.","canvas.active":"Aktif","canvas.viewport":"Tuval Görünümü","canvas.live_output":"Canlı çerçeve çıkışı","canvas.canvas_label":"Tuval","canvas.connection":"Bağlantı","canvas.live":"Canlı","canvas.offline":"Çevrimdışı","canvas.frame_type":"Çerçeve Türü","canvas.last_update":"Son Güncelleme","canvas.waiting_label":"Çerçeve bekleniyor","canvas.frame_suffix":"çerçeve","canvas.waiting_for_content":'"{id}" üzerinde içerik bekleniyor',"canvas.waiting_for_content_desc":"Ajan tuval aracını kullanarak buraya içerik gönderebilir. Bir çerçeve geldiğinde bu görünümde hemen oluşturulur.","canvas.disconnected_title":"Tuval soketi bağlantısı kesildi","canvas.disconnected_desc":"Mevcut tuvale yeniden bağlanın veya başka bir canlı tuval kimliğine geçin.","canvas.reconnect_button":"Tuvali Yeniden Bağla","canvas.frame_id":"Çerçeve Kimliği","canvas.guidance":"Tuval Kılavuzu","canvas.guidance_desc":"Doğrudan bu görünüme grafikler, diyagramlar, markdown raporları ve HTML gösterge panoları oluşturmak için asistanı kullanın.","canvas.history":"Çerçeve Geçmişi","canvas.hide":"Gizle","canvas.show":"Göster","canvas.history_collapsed_title":"Geçmiş daraltıldı","canvas.history_collapsed_desc":"Aktif tuval üzerindeki önceki çerçeveleri incelemek için bu çubuğu genişletin.","canvas.no_frames_title":"Henüz çerçeve yok","canvas.no_frames_desc":"Çerçeveler geldikçe hızlı geri izleme için burada saklanacak.","skills.kicker":"Operasyon","skills.title":"Beceriler","skills.create_skill":"Beceri Oluştur","skills.registry_status":"Kayıt Durumu","skills.summary.total":"Toplam","skills.summary.active":"Aktif","skills.summary.deprecated":"Kullanımdan Kaldırıldı","skills.summary.domains":"Alanlar","skills.index":"Beceri Dizini","skills.search_placeholder":"Becerileri ara…","skills.loading":"Beceriler yükleniyor…","skills.no_skills_title":"Beceri bulunamadı","skills.no_skills_desc":"Operasyonel kaydı doldurmaya başlamak için yerel bir beceri oluşturun.","skills.status.active":"Aktif","skills.status.deprecated":"Kullanımdan Kaldırıldı","skills.workspace":"Beceri Çalışma Alanı","skills.select_placeholder":"Bir beceri seçin","skills.description":"Açıklama","skills.content":"Beceri İçeriği","skills.content_empty":"Bu beceride gösterilecek içerik yok.","skills.edit":"Düzenle","skills.reenable":"Yeniden Etkinleştir","skills.deprecate":"Kullanımdan Kaldır","skills.deleting":"Siliniyor…","skills.delete":"Sil","skills.no_selected_title":"Beceri seçilmedi","skills.no_selected_desc":"İçeriğini ve operasyonel meta verilerini incelemek için bir beceri seçin.","skills.install_github":"GitHub’dan Kur","skills.install_github_desc":"Doğrudan bir beceri kurmak için bir GitHub deposu URL’si yapıştırın.","skills.github_placeholder":"https://github.com/org/skill-repo","skills.installing":"Kuruluyor…","skills.install":"Kur","skills.marketplace":"Pazar Yeri","skills.marketplace_shown":"{count} gösterildi","skills.marketplace_placeholder":"ClawHub becerilerini ara…","skills.search":"Ara","skills.trending":"Popüler","skills.marketplace_loading":"Pazar yeri yükleniyor…","skills.marketplace_empty":"Pazar yeri sonucu yok","skills.modal.edit_title":"Beceriyi Düzenle","skills.modal.create_title":"Beceri Oluştur","skills.modal.description":"Beceriler, ajanlara ve çalıştırmalara eklenebilecek yeniden kullanılabilir operasyonel yeteneklerdir.","skills.modal.name_placeholder":"Beceri adı","skills.modal.description_placeholder":"Açıklama","skills.modal.tags_placeholder":"virgülle,ayrılmış,etiketler","skills.modal.content_placeholder":"Beceri markdown içeriği","skills.modal.cancel":"İptal","skills.modal.saving":"Kaydediliyor…","skills.modal.save_skill":"Beceriyi Kaydet","skills.toast.updated":'"{name}" becerisi güncellendi.',"skills.toast.created":'"{name}" becerisi oluşturuldu.',"skills.toast.reenabled":'"{name}" becerisi yeniden etkinleştirildi.',"skills.toast.deprecated":'"{name}" becerisi kullanımdan kaldırıldı.',"skills.toast.deleted":'"{name}" becerisi silindi.',"skills.toast.installed":'"{name}" becerisi kuruldu.',"skills.toast.installed_github":'"{name}" becerisi GitHub’dan kuruldu.',"skills.err.save":"Beceri kaydedilemedi.","skills.err.load_detail":"Beceri içeriği yüklenemedi.","skills.err.toggle":"Beceri durumu değiştirilemedi.","skills.err.delete":"Beceri silinemedi.","skills.err.install":"Pazar yeri becerisi kurulamadı.","skills.err.install_github":"GitHub URL’sinden beceri kurulamadı.","teams.kicker":"Orkestrasyon Merkezi","teams.title":"Takımlar","teams.create":"Takım Oluştur","teams.refresh":"Yenile","teams.count":"{count} takım","teams.agent_count":"{count} ajan","teams.loading":"Yükleniyor…","teams.loading_desc":"Takımlar yükleniyor…","teams.empty_title":"Takım yok","teams.empty_desc":"Başlamak için bir takım oluşturun.","teams.none_selected_title":"Takım seçilmedi","teams.none_selected_desc":"Dizinden bir takım seçin.","teams.members_suffix":"{members} üye · {edges} kenar","teams.status.off":"Kapalı","teams.status.live":"Canlı","teams.status.deprecated":"Kullanımdan kaldırıldı","teams.status.active":"Aktif","teams.action.edit":"Düzenle","teams.action.reenable":"Yeniden etkinleştir","teams.action.deprecate":"Kullanımdan kaldır","teams.action.delete":"Sil","teams.stats.members":"Üyeler","teams.stats.edges":"Kenarlar","teams.stats.status":"Durum","teams.tab.summary":"Özet","teams.tab.member":"Üye","teams.open_agent_registry":"Ajan kayıt defterini aç","teams.modal.edit_title":"Takımı Düzenle","teams.modal.create_title":"Takım Oluştur","teams.modal.description":"Takım düzenleyici artık kimlik, kompozisyon ve temel raporlama/bağımlılık kenarlarını doğrudan yeni arayüzde yönetiyor.","teams.form.name":"Takım Adı","teams.form.description":"Açıklama","teams.form.members":"Üyeler","teams.form.topology_preview":"Topoloji Önizleme","teams.form.edge_authoring":"Kenar Yazma","teams.form.from_member":"Kaynak üye","teams.form.to_member":"Hedef üye","teams.form.edge_reports_to":"Rapor Verir","teams.form.edge_supports":"Destekler","teams.form.edge_depends_on":"Bağımlı","teams.form.add_edge":"Kenar Ekle","teams.form.remove":"Kaldır","teams.form.no_edges":"Henüz topoloji kenarı tanımlanmadı.","teams.form.draft_summary":"Taslak Özeti","teams.form.draft_members":"Üyeler","teams.form.draft_edges":"Kenarlar","teams.form.draft_hint":"Hiyerarşi için `REPORTS_TO`, işbirliği şeritleri için `SUPPORTS` ve engelleyici yürütme ilişkileri için `DEPENDS_ON` kullanın.","teams.form.draft_team_name":"Taslak Takım","teams.form.cancel":"İptal","teams.form.saving":"Kaydediliyor…","teams.form.save":"Takımı Kaydet","teams.toast.updated":'"{name}" takımı güncellendi.',"teams.toast.created":'"{name}" takımı oluşturuldu.',"teams.toast.deleted":'"{name}" takımı silindi.',"teams.toast.reenabled":'"{name}" takımı yeniden etkinleştirildi.',"teams.toast.deprecated":'"{name}" takımı kullanımdan kaldırıldı.',"teams.err.save":"Takım kaydedilemedi.","teams.err.toggle":"Takım durumu değiştirilemedi.","teams.err.delete":"Takım silinemedi.","agents.kicker":"Orkestrasyon Merkezi","agents.title":"Ajanlar","agents.create":"Ajan Oluştur","agents.refresh":"Yenile","agents.search_placeholder":"Ajan ara…","agents.filter.all_roles":"Tüm roller","agents.filter.coder":"Geliştirici","agents.filter.reviewer":"İnceleyici","agents.filter.researcher":"Araştırmacı","agents.filter.hide_disabled":"Devre Dışı Olanları Gizle","agents.filter.show_disabled":"Devre Dışı Olanları Göster","agents.count":"{count} ajan","agents.loading":"Yükleniyor…","agents.loading_desc":"Ajanlar yükleniyor…","agents.empty_title":"Ajan yok","agents.empty_desc":"Filtreleri ayarlayın veya bir tane oluşturun.","agents.none_selected_title":"Ajan seçilmedi","agents.none_selected_desc":"Dizinden bir ajan seçin.","agents.status.disabled":"Devre dışı","agents.status.active":"Aktif","agents.stats.registry":"Kayıt Defteri","agents.stats.active":"Aktif","agents.stats.codex":"Codex","agents.section.identity":"Kimlik","agents.section.soul":"Ruh","agents.section.soul_empty":"Ruh açıklaması girilmedi.","agents.section.expertise":"Uzmanlık","agents.section.no_expertise":"Uzmanlık etiketi yok.","agents.section.voice":"Ses","agents.section.voice_empty":"Belirtilmedi","agents.section.revision":"Revizyon","agents.section.created":"Oluşturuldu","agents.action.edit":"Düzenle","agents.action.reenable":"Yeniden etkinleştir","agents.action.deprecate":"Kullanımdan kaldır","agents.action.delete":"Sil","agents.action.deleting":"Siliniyor…","agents.tab.summary":"Özet","agents.tab.prompt":"İstem","agents.summary.name":"Ad","agents.summary.role":"Rol","agents.summary.type":"Tür","agents.summary.model":"Model","agents.summary.model_default":"Varsayılan","agents.summary.tone":"Ton","agents.summary.revision":"Revizyon","agents.summary.created":"Oluşturuldu","agents.prompt.system_hint":"Sistem İpucu","agents.prompt.system_hint_empty":"Sistem ipucu yapılandırılmadı.","agents.prompt.identity_seed":"Kimlik Çekirdeği","agents.modal.create_title":"Ajan Oluştur","agents.modal.edit_title":"Ajanı Düzenle","agents.modal.description":"Ajanlar kimlik odaklı operatörlerdir. Revka; persona, model ve istem yüzeyini tek yerde tutar.","agents.form.name":"Ad","agents.form.tone":"Ton","agents.form.tone_placeholder":"kısa ve doğrudan","agents.form.identity":"Kimlik","agents.form.soul":"Ruh","agents.form.role":"Rol","agents.form.role.coder":"Geliştirici","agents.form.role.reviewer":"İnceleyici","agents.form.role.researcher":"Araştırmacı","agents.form.agent_type":"Ajan Türü","agents.form.model":"Model","agents.form.model_placeholder":"gpt-5.4 / claude-sonnet-4-6","agents.form.expertise":"Uzmanlık","agents.form.expertise_placeholder":"rust, review, orchestration","agents.form.system_hint":"Sistem İpucu","agents.form.cancel":"İptal","agents.form.saving":"Kaydediliyor…","agents.form.save_create":"Ajan Oluştur","agents.form.save_edit":"Ajanı Kaydet","agents.toast.updated":'"{name}" ajanı güncellendi.',"agents.toast.created":'"{name}" ajanı oluşturuldu.',"agents.toast.deleted":'"{name}" ajanı silindi.',"agents.toast.reenabled":'"{name}" ajanı yeniden etkinleştirildi.',"agents.toast.deprecated":'"{name}" ajanı kullanımdan kaldırıldı.',"agents.err.load":"Ajanlar yüklenemedi.","agents.err.save":"Ajan kaydedilemedi.","agents.err.toggle":"Ajan durumu değiştirilemedi.","agents.err.delete":"Ajan silinemedi.","runs.kicker":"Orkestrasyon Merkezi","runs.title":"İş Akışı Çalışmaları","runs.refresh":"Yenile","runs.index.title":"Çalışma Dizini","runs.empty.title":"Çalışma yok","runs.empty.desc":"Bu dizini doldurmak için bir iş akışı çalıştırın.","runs.error.title":"Yükleme hatası","runs.stats.steps_fraction":"{completed}/{total} adım","runs.stats.expanded_steps":"{count} genişletilmiş","runs.stats.loop_fraction":"Dongu {iteration}/{total}: {step}","runs.stats.loop_iteration":"Dongu {iteration}: {step}","runs.open_definition":"Tanımı aç","runs.action.retry_failed":"Başarısız olanları yeniden dene","runs.action.retrying":"Yeniden deneniyor…","runs.action.retry_tooltip":"Başarısız adımları yeniden dene","runs.action.stop":"Durdur","runs.action.stopping":"Durduruluyor…","runs.action.stop_tooltip":"Bu çalışma örneğini durdur","runs.action.delete_tooltip":"Çalışmayı sil","runs.none_selected.title":"Çalışma seçilmedi","runs.none_selected.desc":"Dizinden bir çalışma seçin.","runs.banner.label":"Aktif Seçim","runs.overlay.path_mode":"Yol Modu","runs.overlay.path.all":"Tümü","runs.overlay.path.failed":"Başarısız","runs.overlay.path.blocked":"Engelli","runs.overlay.signals":"Sinyaller","runs.overlay.prev":"Önceki","runs.overlay.next":"Sonraki","runs.overlay.signal_count":"{count} sinyal","runs.overlay.posture":"Durum","runs.overlay.running":"Çalışıyor","runs.overlay.failed":"Başarısız","runs.overlay.done":"Tamamlandı","runs.overlay.pending":"Beklemede","runs.overlay.skipped":"Atlandı","runs.overlay.hotspots":"Sıcak Noktalar","runs.overlay.legend_running":"Çalışıyor","runs.overlay.legend_failure":"Başarısızlık","runs.overlay.legend_blocked":"Engelli","runs.overlay.legend_skipped":"Atlandı","runs.overlay.legend_gate":"Kapı","runs.overlay.fail_label":"Başarısız: {id}","runs.overlay.run_label":"Çalışıyor: {id}","runs.overlay.block_label":"Engel: {id}","runs.started_at":"{time} başladı","runs.inspector.title":"Adım İnceleyici","runs.tab.summary":"Özet","runs.tab.output":"Çıktı","runs.tab.tools":"Araçlar","runs.tab.transcript":"Döküm","runs.tab.jsonl":"JSONL Günlüğü","runs.detail.select_node":"İncelemek için bir DAG düğümü seçin.","runs.detail.no_description":"Açıklama yok.","runs.detail.depends_on":"Bağımlı: {list}","runs.detail.depends_none":"yok","runs.detail.agent":"Ajan: {type}{role}","runs.detail.agent_na":"yok","runs.detail.skills":"Beceriler: {list}","runs.detail.dashboard_link":"Kontrol Paneli","runs.detail.definition_link":"Tanım","runs.detail.select_step":"Bir adım seçin.","runs.detail.step_output":"Adım Çıktısı","runs.detail.agent_output":"Ajan Çıktısı","runs.detail.no_output":"Çıktı yakalanmadı.","runs.detail.loading":"Yükleniyor…","runs.detail.tools_calls":"Çağrılar","runs.detail.tools_errors":"Hatalar","runs.detail.no_tools":"Araç çağrısı kaydedilmedi.","runs.detail.no_activity":"Ajan etkinliği bulunamadı.","runs.detail.no_jsonl":"Bu ajan için JSONL girdisi bulunamadı.","runs.detail.no_jsonl_filter":"Filtrenizle eşleşen girdi yok.","runs.detail.no_transcript":"Döküm yok.","runs.detail.tool_default":"Araç","runs.detail.tool_status_ok":"ok","runs.timeline":"Zaman Çizelgesi ({count})","runs.toast.retry_started":"{id} çalışması için yeniden deneme başladı.","runs.toast.stop_requested":"{id} çalışması için durdurma istendi.","runs.toast.deleted":"{id} çalışması silindi.","runs.err.retry":"Çalışma yeniden denenemedi.","runs.err.stop":"Çalışma durdurulamadı.","runs.err.delete":"Çalışma silinemedi.","memory.kicker":"İnceleme","memory.page_title":"Bellek","memory.page_description":"Tür filtreleri, alan kapsamlandırma, arama vurgulama ve düğüme bağlı detay incelemesi sunan bellek grafiği incelemesi.","memory.selected_memory":"Seçilen Bellek","memory.loading_detail":"Düğüm detayları yükleniyor…","memory.relative.just_now":"az önce","memory.relative.minutes":"{count}d önce","memory.relative.hours":"{count}s önce","memory.relative.days":"{count}g önce","memory.detail.metadata":"Meta Veri","memory.detail.bundle_members":"Paket Üyeleri","memory.controls.title":"Grafik Kontrolleri","memory.controls.search_placeholder":"Belleği vurgula…","memory.controls.all_spaces":"Tüm alanlar","memory.controls.node_limit":"Düğüm sınırı","memory.filters.title":"Filtreler","memory.filters.empty_title":"Henüz tür yüklenmedi","memory.filters.empty_desc":"Bellek verisi geldiğinde grafik filtreleri görünecek.","memory.graph.kicker":"Bellek Grafiği","memory.graph.heading":"Anlamsal bellek topolojisi","memory.graph.items":"öğe","memory.graph.edges":"kenar","memory.graph.shown":"gösterilen","memory.graph.matches":"{count} eşleşme","memory.graph.match":"{count} eşleşme","memory.graph.loading_title":"Bellek grafiği yükleniyor…","memory.graph.loading_desc":"Anlamsal bellek topolojisi ve ilişki kenarları getiriliyor.","memory.graph.error_title":"Bellek grafiği yüklenemiyor","memory.graph.retry":"Yeniden dene","memory.graph.empty_title":"Bellek bulunamadı","memory.graph.empty_desc":"Grafiği genişletmek için filtreleri ayarlayın, aramayı temizleyin veya düğüm sınırını artırın.","memory.none_selected_title":"Bellek seçilmedi","memory.none_selected_desc":"Meta veri, revizyon destekli detay ve paket üyeliğini incelemek için grafikte bir düğüm seçin.","memory.err.load":"Bellek grafiği yüklenemedi","assets.kicker":"Operasyonlar","assets.title":"Varlıklar","assets.search_placeholder":"Varlık ara…","assets.project":"Proje","assets.up":"Yukarı","assets.err.load":"Kumiho projeleri yüklenemedi. Kumiho API'sinin erişilebilir olduğundan emin olun.","assets.col.name":"Ad","assets.col.kind":"Tür","assets.col.author":"Yazar","assets.col.created":"Oluşturuldu","assets.loading.projects":"Projeler yükleniyor…","assets.loading.space":"Alan yükleniyor…","assets.loading.generic":"Yükleniyor…","assets.folder":"klasör","assets.empty.title":"Boş alan","assets.empty.desc":"Bu konumda klasör veya varlık yok.","assets.search.empty_title":"Sonuç yok","assets.search.empty_desc":'"{query}" ile eşleşen varlık yok.',"assets.search.result_count":'"{query}" için {count} sonuç',"assets.copy_kref":"kref'i kopyala","assets.close_inspector":"İnceleyiciyi kapat","assets.deprecated":"Kullanımdan kaldırıldı","assets.active":"Aktif","assets.rev_count":"{count} rev","assets.rev_count_one":"{count} rev","assets.by":"yazan: {author}","assets.section.revisions":"Revizyonlar","assets.section.artifacts":"Yapıtlar","assets.section.edges":"Kenarlar","assets.section.metadata":"Meta Veri","assets.section.revisions_empty":"Revizyon yok.","assets.section.artifacts_empty":"Yapıt yok.","assets.section.edges_empty":"Kenar yok.","assets.section.metadata_empty":"Meta veri yok.","assets.tag.latest":"en son","assets.tag.published":"yayınlandı","assets.action.view":"Görüntüle","assets.action.edit":"Düzenle","assets.action.restore":"Geri yükle","assets.action.deprecate":"Kullanımdan kaldır","assets.action.publish":"Yayınla","assets.action.published":"Yayınlandı","assets.action.save_artifact":"Yapıtı kaydet","assets.action.deprecate_item":"Seçili öğeyi kullanımdan kaldır","assets.action.restore_item":"Seçili öğeyi geri yükle","assets.action.deprecate_revision":"Seçili revizyonu kullanımdan kaldır","assets.action.restore_revision":"Seçili revizyonu geri yükle","assets.action.publish_revision":"Seçili revizyonu yayınlandı olarak etiketle","assets.action.edit_artifact":"Yapıtı düzenle","assets.action.deprecate_artifact":"Yapıtı kullanımdan kaldır","assets.action.restore_artifact":"Yapıtı geri yükle","assets.toast.item_deprecated":"Öğe kullanımdan kaldırıldı.","assets.toast.item_restored":"Öğe geri yüklendi.","assets.toast.revision_deprecated":"Revizyon kullanımdan kaldırıldı.","assets.toast.revision_restored":"Revizyon geri yüklendi.","assets.toast.revision_published":"Revizyon yayınlandı olarak etiketlendi.","assets.toast.artifact_deprecated":"Yapıt kullanımdan kaldırıldı.","assets.toast.artifact_restored":"Yapıt geri yüklendi.","assets.toast.artifact_saved":"Yapıt içeriği güncellendi.","assets.toast.artifact_saved_new_revision":"Güncellenen yapıtın eklendiği yeni bir revizyon oluşturuldu.","assets.err.action":"Varlık işlemi başarısız oldu.","assets.err.load_artifact":"Yapıt içeriği yüklenemedi.","assets.editor.title":"{name} düzenle","assets.editor.mutable_desc":"Kaydetmek, geçerli revizyondaki yapıt dosyasını günceller.","assets.editor.published_desc":"Bu revizyon yayınlanmış ve değiştirilemez. Kaydetmek, güncellenen yapıtın eklendiği yeni bir revizyon oluşturur.","config.kicker":"Operasyonlar","config.page_title":"Yapılandırma","config.reload":"Yeniden yükle","config.save_button":"Yapılandırmayı Kaydet","config.saving_button":"Kaydediliyor…","config.loading_title":"Yapılandırma yükleniyor…","config.toast.saved":"Yapılandırma kaydedildi.","config.err.load":"Yapılandırma yüklenemedi.","config.err.save":"Yapılandırma kaydedilemedi.","config.err.mcp_errors":"Kaydetmeden önce MCP sunucu hatalarını düzeltin.","config.map":"Yapılandırma Haritası","config.workspace":"TOML Çalışma Alanı","config.workspace.structured_heading":"Yapılandırılmış kontroller","config.workspace.source_heading":"Kaynak düzenleyici","config.tab.structured":"Yapılandırılmış","config.tab.source":"Kaynak","config.tabs_aria":"Yapılandırma çalışma alanı sekmeleri","config.hide_preview":"Önizlemeyi Gizle","config.show_preview":"Önizlemeyi Göster","config.mapped_paths":"Eşleştirilmiş TOML Yolları","config.structured.error_title":"Yapılandırılmış kontroller oluşturulamıyor","config.structured.error_desc":"Gruplandırılmış yapılandırma kontrollerinin gösterilebilmesi için ham TOML'un ayrıştırılabilir olması gerekir.","config.summary.title":"Ayrıştırılmış Özet","config.summary.error_title":"TOML ayrıştırılamıyor","config.summary.error_desc":"Özet paneli yalnızca düzenleyici ayrıştırılabilir TOML bölümleri içerdiğinde güncellenir.","config.source_health":"Kaynak Sağlığı","config.row.workspace_mode":"Çalışma Alanı Modu","config.row.preview":"Önizleme","config.row.sections":"Bölümler","config.row.parse_status":"Ayrıştırma Durumu","config.row.parse_valid":"Geçerli","config.row.parse_needs":"Dikkat Gerekiyor","config.mode.structured":"Yapılandırılmış","config.mode.source":"Kaynak","config.toggle.enabled":"Etkin","config.toggle.disabled":"Devre dışı","config.section.provider":"Sağlayıcı","config.section.provider_desc":"Varsayılan model sağlayıcısı, API yönlendirmesi ve üretim ayarları.","config.section.agent":"Ajan","config.section.agent_desc":"Ajan çalışma zamanı için döngü sınırları, bağlam bütçeleri ve muhakeme varsayılanları.","config.section.memory":"Bellek","config.section.memory_desc":"Bellek arka ucu, Kumiho bağlantısı ve kalıcılık davranışı.","config.section.runtime":"Çalışma Zamanı","config.section.runtime_desc":"Ağ geçidi bağlama ayarları, eşleştirme ve otonomi duruşu.","config.section.security":"Güvenlik / Maliyet","config.section.security_desc":"Denetim ve korumalı alan ayarları ile maliyet sınırı kontrolleri.","config.section.channels":"Kanallar","config.section.channels_desc":"Operasyonel kanallar için CLI ve mesajlaşma yüzeyi davranışı.","config.section.mcp":"MCP Sunucuları","config.section.mcp_desc":"Model Context Protocol istemcisi — üst düzey anahtarlar ve yapılandırılmış sunucu girdileri.","config.section.extra_desc":"config.toml içinde keşfedilen ek bölüm — genel düzenleyici.","config.generic.empty":"Bu bölümde henüz alan yok.","config.generic.empty_array":"(boş dizi)","config.generic.array_readonly":"Diziler genel düzenleyicide salt okunurdur — Kaynak sekmesinden düzenleyin.","config.provider.default_provider":"Varsayılan Sağlayıcı","config.provider.default_model":"Varsayılan Model","config.provider.temperature":"Sıcaklık","config.provider.timeout":"Sağlayıcı Zaman Aşımı","config.provider.max_tokens":"Sağlayıcı Maks. Token","config.agent.max_tool_iterations":"Maks. Araç Yinelemesi","config.agent.max_context_tokens":"Maks. Bağlam Token'ı","config.agent.max_history_messages":"Maks. Geçmiş Mesajı","config.agent.gpt55_context_window":"GPT-5.5 Bağlam Penceresi","config.agent.context_window_safety_ratio":"Bağlam Güvenlik Oranı","config.agent.parallel_tools":"Paralel Araçlar","config.agent.thinking_level":"Düşünce Seviyesi","config.memory.kumiho_enabled":"Kumiho Etkin","config.memory.memory_project":"Bellek Projesi","config.memory.harness_project":"Harness Projesi","config.memory.retrieval_limit":"Getirme Limiti","config.memory.backend":"Bellek Arka Ucu","config.memory.auto_save":"Otomatik Kaydet","config.memory.snapshots":"Anlık Görüntüler","config.runtime.gateway_host":"Ağ Geçidi Ana Bilgisayarı","config.runtime.gateway_port":"Ağ Geçidi Bağlantı Noktası","config.runtime.require_pairing":"Eşleştirme Gerekli","config.runtime.session_persistence":"Oturum Kalıcılığı","config.runtime.autonomy_level":"Otonomi Seviyesi","config.runtime.max_actions_hour":"Saatte Maks. Eylem","config.security.audit_enabled":"Denetim Etkin","config.security.sandbox_backend":"Korumalı Alan Arka Ucu","config.security.daily_limit":"Günlük Limit USD","config.security.monthly_limit":"Aylık Limit USD","config.security.warn_percent":"Uyarı Yüzdesi","config.channels.cli":"CLI Kanalı","config.channels.ack_reactions":"Ack Tepkileri","config.channels.show_tool_calls":"Araç Çağrılarını Göster","config.channels.message_timeout":"Mesaj Zaman Aşımı (sn)","config.summary.api_url":"API URL","config.summary.provider":"Sağlayıcı","config.summary.model":"Model","config.summary.temperature":"Sıcaklık","config.summary.timeout":"Zaman Aşımı","config.summary.max_tokens":"Maks. Token","config.summary.runtime":"Çalışma Zamanı","config.summary.gateway":"Ağ Geçidi","config.summary.pairing_required":"Eşleştirme Gerekli","config.summary.session_persistence":"Oturum Kalıcılığı","config.summary.autonomy_level":"Otonomi Seviyesi","config.summary.workspace_only":"Yalnızca Çalışma Alanı","config.summary.max_actions_hour":"Saatte Maks. Eylem","config.summary.memory":"Bellek","config.summary.backend":"Arka Uç","config.summary.auto_save":"Otomatik Kaydet","config.summary.hygiene":"Hijyen","config.summary.snapshots":"Anlık Görüntüler","config.summary.kumiho_enabled":"Kumiho Etkin","config.summary.memory_project":"Bellek Projesi","config.summary.retrieval_limit":"Getirme Limiti","config.summary.safety_cost":"Güvenlik / Maliyet","config.summary.audit_enabled":"Denetim Etkin","config.summary.sandbox_backend":"Korumalı Alan Arka Ucu","config.summary.daily_limit":"Günlük Limit","config.summary.monthly_limit":"Aylık Limit","config.summary.warn_percent":"Uyarı %","config.summary.channels":"Kanallar","config.summary.cli":"CLI","config.summary.telegram":"Telegram","config.summary.discord":"Discord","config.summary.slack":"Slack","config.summary.matrix":"Matrix","config.summary.signal":"Signal","config.summary.whatsapp":"WhatsApp","config.row.enabled":"Etkin","config.row.disabled":"Devre dışı","config.mcp.title":"MCP","config.mcp.enabled":"MCP Etkin","config.mcp.deferred":"Geciktirilmiş Yükleme","config.mcp.servers":"Sunucular","config.mcp.no_servers":"Henüz yapılandırılmış sunucu yok.","config.mcp.server_count":"{count} sunucu yapılandırıldı.","config.mcp.server_count_one":"1 sunucu yapılandırıldı.","config.mcp.add_server":"MCP Sunucusu Ekle","config.mcp.confirm_remove":"{label} kaldırılsın mı?","config.mcp.entry_label":"giriş {index}","config.mcp.server_default":"Sunucu {index}","config.mcp.stdio_empty":"stdio — komut ayarlanmadı","config.mcp.transport_empty":"{transport} — url ayarlanmadı","config.mcp.test":"Test","config.mcp.testing":"Test ediliyor…","config.mcp.test_tooltip":"MCP initialize + tools/list el sıkışmasını çalıştır","config.mcp.test_blocked":"Test etmeden önce doğrulama hatalarını düzeltin","config.mcp.delete_label":"{label} sil","config.mcp.connecting":"bağlanıyor…","config.mcp.tool_count":"{count} araç · {latency}ms","config.mcp.tool_count_one":"1 araç · {latency}ms","config.mcp.tools_list":"araçlar: {list}","config.mcp.handshake_failed":"el sıkışma başarısız","config.mcp.field_name":"Ad","config.mcp.field_name_placeholder":"ör. memory","config.mcp.field_transport":"Taşıma","config.mcp.field_command":"Komut","config.mcp.field_command_placeholder":"/usr/local/bin/mcp-server","config.mcp.field_args":"Argümanlar","config.mcp.field_args_placeholder":"--flag","config.mcp.field_env":"Ortam","config.mcp.field_env_key":"KEY","config.mcp.field_env_value":"value","config.mcp.field_url":"URL","config.mcp.field_url_placeholder":"https://example.com/mcp","config.mcp.field_headers":"Başlıklar","config.mcp.field_headers_key":"Header-Name","config.mcp.field_headers_value":"value","config.mcp.field_timeout":"Zaman Aşımı (ms)","config.mcp.field_timeout_placeholder":"30000","config.mcp.add_entry":"{label} Ekle","config.mcp.remove_entry":"{label} girişi {index} kaldır","landing.skip_link":"Ana içeriğe atla","landing.nav.aria_label":"Site gezintisi","landing.nav.logo_alt":"Revka logosu","landing.nav.features":"Özellikler","landing.nav.launch":"Paneli Aç","landing.hero.aria_label":"Tanıtım","landing.hero.badge":"Bellek-yerel · Rust-yerel · Graf-yerel","landing.hero.tagline":"Bellek yerelli ajan çalışma zamanı","landing.hero.description":"Kumiho'nun graf yerelli belleği üzerine kurulu. Her oturum, plan, yetenek ve güven skoru bir grafta yaşar — yaşandıysa, sorgulanabilir.","landing.hero.cta_primary":"Paneli Aç","landing.hero.cta_secondary":"Özellikleri Keşfet","landing.hero.banner_alt":"Revka — Bellek yerelli ajan çalışma zamanı paneli","landing.hero.scroll_cue":"Kaydır","landing.stats.aria_label":"Temel istatistikler","landing.stats.runtime_label":"Çalışma zamanı","landing.stats.namespaces_label":"Ad alanları","landing.stats.memory_label":"Bellek grafı","landing.stats.goals_label":"Hedef takibi","landing.stats.orchestration_label":"Orkestrasyon","landing.pillars.aria_label":"Sütunlar","landing.pillars.badge":"Üç sütun","landing.pillars.title":"Tek çalışma zamanı, her yüzey","landing.pillars.description":"Revka üç temel üzerine kuruludur — sağlayıcıdan bağımsız ajanlar, graf yerelli bellek ve her kanaldan erişim.","landing.pillars.agents.title":"Ajanlar","landing.pillars.agents.desc":"Sağlayıcıdan bağımsız ajanlar (OpenAI, Anthropic, yerel modeller) iş akışları ve sürüler aracılığıyla düzenlenir — hepsi kendi makinende.","landing.pillars.memory.title":"Bellek","landing.pillars.memory.desc":"Kumiho, SQLite veya Markdown üzerinden oturumlar arası kalıcı bilgi. Ajanların seni, projelerini ve önceki kararları hatırlar.","landing.pillars.channels.title":"Kanallar","landing.pillars.channels.desc":"Revka ile Telegram, Discord, Slack, iMessage, Matrix, e-posta ve daha fazlası üzerinden konuş. Tek çalışma zamanı, her yüzey.","landing.features.aria_label":"Özellikler","landing.features.badge":"Yetenekler","landing.features.title":"Ajan çağı için tasarlandı","landing.features.description":"Her bileşen kalıcı bellek ve çok ajanlı iş birliği etrafında tasarlandı — üretimden emekliliğe kadar.","landing.features.featured_badge":"Temel bellek altyapısı","landing.features.memory.title":"Kumiho Bellek","landing.features.memory.desc":"Graf yerelli kalıcı bellek. Her oturum, plan ve yetenek sürümlenir, bağlanır ve sorgulanabilir — yedek arka uç yok.","landing.features.operator.title":"Operator","landing.features.operator.desc":"Rol delegasyonlu (kodlayıcı, inceleyici, araştırmacı) çok ajanlı orkestrasyon, geri çağırmalı üretim ve güven puanlaması.","landing.features.pool.title":"Ajan Havuzu","landing.features.pool.desc":"Rol, yetenek ve model tercihi içeren yeniden kullanılabilir ajan tanımları. Kullanım takibi yüksek performans gösterenleri öne çıkarır.","landing.features.clawhub.title":"ClawHub Pazar Yeri","landing.features.clawhub.desc":"Ajan şablonlarını, yeteneklerini ve takım yapılandırmalarını ortak bir kayıt defterinde yayınla, ara ve kur.","landing.features.goals.title":"Hedef Hiyerarşisi","landing.features.goals.desc":"Üç katmanlı hedef takibi: stratejik, taktik ve görev düzeyi — hepsi durum ve bağımlılıklarla grafta saklanır.","landing.features.audit.title":"Denetim İzi","landing.features.audit.desc":"Merkle karma zincirli, kurcalamaya karşı koruyucu günlükleme. Her eylem kriptografik olarak doğrulanabilir bir geçmişle kayıt altına alınır.","landing.how.aria_label":"Nasıl çalışır","landing.how.badge":"İş akışı","landing.how.title":"Revka nasıl çalışır","landing.how.description":"Ajan dağıtımından kalıcı geri çağırmaya — tüm yaşam döngüsü birbirine bağlı üç adımda yönetilir.","landing.how.step1.title":"Ajanını dağıt","landing.how.step1.desc":"Rol, yetenek ve model tercihlerini yapılandır. Revka şablonu yeniden kullanım ve geri çağırma için grafa kaydeder.","landing.how.step2.title":"Bellek birikir","landing.how.step2.desc":"Her oturum, plan, yetenek ve etkileşim Kumiho'da sürümlenir ve kenarlarla bağlanır. Hiçbir şey kaybolmaz.","landing.how.step3.title":"Her şeyi sorgula","landing.how.step3.desc":"Tüm ajan geçmişinden iç görüler çıkarmak için hedef hiyerarşilerini, güven puanlarını ve graf gezinmesini kullan.","landing.cli.aria_label":"CLI referansı","landing.cli.badge":"CLI","landing.cli.title":"Terminalden yönet","landing.cli.description":"Panelin ve kanalların yanıt vermesi için daemon çalışıyor olmalı. Arayüzde yapabildiğin her şeyin bir komut karşılığı vardır.","landing.cli.cmd.onboard":"İnteraktif kurulum sihirbazını çalıştır","landing.cli.cmd.reinit":"Sıfırdan sıfırla ve yeniden yapılandır (tünel dahil)","landing.cli.cmd.daemon":"Uzun ömürlü çalışma zamanını başlat","landing.cli.cmd.doctor":"Daemon, zamanlayıcı ve kanal sağlığını kontrol et","landing.cli.cmd.status":"Tüm sistem durumunu yazdır","landing.cli.cmd.channel_list":"Yapılandırılmış kanalları listele","landing.cli.cmd.channel_add":"Bir Telegram botu ekle","landing.cli.cmd.providers":"Desteklenen AI sağlayıcılarını listele","landing.cli.cmd.memory_stats":"Ajan bellek boyutunu incele","landing.cli.cmd.service_install":"launchd/systemd kullanıcı servisi olarak kur","landing.arch.aria_label":"Mimari","landing.arch.badge":"Graf-yerel","landing.arch.title":"Her şey grafta","landing.arch.description":"Tüm kalıcı durum, Kumiho içindeki sıkı bir ad alanı hiyerarşisi altında yaşar — sürümlenir, kenarlarla bağlanır ve oturumlar arası sorgulanabilir.","landing.arch.ns.agentpool":"Yeniden kullanılabilir ajan şablonları","landing.arch.ns.plans":"Yürütme planları ve adımları","landing.arch.ns.sessions":"Oturumlar arası süreklilik","landing.arch.ns.goals":"Stratejik hedef takibi","landing.arch.ns.clawhub":"Yayınlanmış şablonlar ve yetenekler","landing.arch.ns.teams":"Takım tanımları","landing.arch.ns.skills":"Paylaşılan yetenek kitaplığı","landing.arch.ns.trust":"Güven puanları ve geçmişi","landing.arch.connection_note":"Tüm ad alanları Kumiho graf kenarlarıyla bağlıdır","landing.tunnels.aria_label":"Tüneller hakkında","landing.tunnels.badge":"Tüneller","landing.tunnels.title":"Herkese açık erişim, yerel güven","landing.tunnels.description_prefix":"Ağ geçidin ","landing.tunnels.description_suffix":" üzerinde çalışır — yalnızca bu makineden erişilebilir. Webhook tabanlı kanallar (Telegram, Slack olayları, WhatsApp, WeChat) genel bir URL gerektirir. Tünel, güvenlik duvarı portları açmadan genel bir ana bilgisayar adını yerel ağ geçidine iletir.","landing.tunnels.provider.cloudflare.name":"Cloudflare Tunnel","landing.tunnels.provider.cloudflare.desc":"Ücretsiz, üretim kalitesinde. Bir Zero Trust hesabı ve tünel belirteci gerektirir.","landing.tunnels.provider.ngrok.name":"ngrok","landing.tunnels.provider.ngrok.desc":"Hızlı ve geçici. Yerel geliştirme ve test için harika.","landing.tunnels.provider.tailscale.name":"Tailscale Funnel","landing.tunnels.provider.tailscale.desc":"Tailnet kimliğinle bir tailnet servisini herkese açık paylaş.","landing.tunnels.provider.custom.name":"Özel","landing.tunnels.provider.custom.desc":"Kendi ters proxy veya genel URL'ini getir.","landing.tunnels.setup_hint_prefix":"Çalıştır: ","landing.tunnels.setup_hint_suffix":" ve sorulduğunda bir sağlayıcı seç.","landing.cta.aria_label":"Başla","landing.cta.headline_prefix":"İnşa etmeye ","landing.cta.headline_highlight":"başlamaya","landing.cta.headline_suffix":" hazır mısın?","landing.cta.description":"Ajanları yönetmek, yetenek kitaplığına göz atmak, takımları düzenlemek ve grafın hatırladığı her şeyi keşfetmek için paneli aç.","landing.cta.button":"Paneli Aç","landing.footer.tagline":"Bellek yerelli ajan çalışma zamanı"},ko:{"nav.dashboard":"대시보드","nav.agent":"에이전트","nav.tools":"도구","nav.cron":"예약 작업","nav.integrations":"연동","nav.memory":"메모리","nav.config":"설정","nav.cost":"비용 추적","nav.logs":"로그","nav.doctor":"진단","nav.agents":"에이전트 풀","nav.skills":"스킬 라이브러리","nav.teams":"에이전트 팀","nav.assets":"자산 브라우저","nav.skins":"스킨","nav.memoryAuditor":"메모리 감사","nav.audit":"감사 추적","nav.canvas":"캔버스","nav.workflows":"워크플로","dashboard.title":"대시보드","dashboard.provider":"제공자","dashboard.model":"모델","dashboard.uptime":"가동 시간","dashboard.temperature":"온도","dashboard.gateway_port":"게이트웨이 포트","dashboard.memory_backend":"메모리 백엔드","dashboard.paired":"페어링","dashboard.channels":"채널","dashboard.health":"상태","dashboard.status":"상태","dashboard.overview":"개요","dashboard.system_info":"시스템 정보","dashboard.quick_actions":"빠른 작업","agent.title":"에이전트 채팅","agent.send":"전송","agent.placeholder":"메시지를 입력하세요...","agent.start_conversation":"대화를 시작하려면 메시지를 보내세요","agent.type_message":"메시지를 입력하세요...","agent.connecting":"연결 중...","agent.connected":"연결됨","agent.disconnected":"연결 끊김","agent.reconnecting":"재연결 중...","agent.thinking":"생각 중...","agent.tool_call":"도구 호출","agent.tool_result":"도구 결과","agent.connection_error":"연결 오류. 재연결을 시도합니다...","agent.tool_call_prefix":"[도구 호출]","agent.tool_result_prefix":"[도구 결과]","agent.error_prefix":"[오류]","agent.unknown_error":"알 수 없는 오류","agent.send_error":"메시지 전송에 실패했습니다. 다시 시도해 주세요.","agent.copy_message":"메시지 복사","agent.connected_status":"연결됨","agent.disconnected_status":"연결 끊김","agent.copy_code":"코드 복사","agent.copied_code":"코드 복사됨","agent.copy":"복사","agent.copied":"복사됨","agent.code_language_fallback":"코드","agent.jump_to_latest":"최신으로 이동","agent.placeholder_steer_next_step":"다음 단계 조정…","agent.placeholder_queue_next":"다음 메시지 대기열 추가…","agent.placeholder_message":"메시지…","agent.placeholder_connecting":"연결 중…","agent.send_mode":"전송 모드","agent.send_mode_queue":"대기열","agent.send_mode_steer":"조정","agent.queue_after_current_response":"현재 응답 뒤에 대기열 추가","agent.steer_text_only":"조정은 텍스트만 지원합니다. 첨부는 대기열에 추가됩니다","agent.steer_next_step":"다음 단계 조정","agent.queue_message":"메시지 대기열 추가","agent.send_message":"메시지 전송","agent.send_enter":"전송 (Enter)","agent.steer_prefix":"[조정]","agent.tool_output_truncated":"채팅 보기에서 출력이 잘렸습니다. 전체 결과는 복사하거나 실행 로그에서 확인하세요.","agent.activity_input_label":"입력","agent.activity_diff_label":"Diff","agent.activity_output_label":"출력","agent.reasoning_trace_label":"사고 과정","tools.name":"이름","tools.parameters":"매개변수","tools.search":"도구 검색...","tools.empty":"사용 가능한 도구가 없습니다.","tools.count":"전체 도구","tools.agent_tools":"에이전트 도구","tools.cli_tools":"CLI 도구","tools.path":"경로","tools.version":"버전","tools.category":"카테고리","tools.load_error":"도구를 불러오지 못했습니다","cron.title":"예약 작업","cron.scheduled_tasks":"예약된 작업","cron.add":"작업 추가","cron.add_job":"작업 추가","cron.add_modal_title":"크론 작업 추가","cron.delete":"삭제","cron.enable":"활성화","cron.disable":"비활성화","cron.name":"이름","cron.name_optional":"이름 (선택)","cron.command":"명령어","cron.command_required":"명령어","cron.schedule":"스케줄","cron.schedule_required":"스케줄","cron.next_run":"다음 실행","cron.last_run":"마지막 실행","cron.last_status":"마지막 상태","cron.enabled":"활성화됨","cron.enabled_status":"활성화됨","cron.disabled_status":"비활성화됨","cron.empty":"예약된 작업이 없습니다.","cron.confirm_delete":"이 작업을 삭제하시겠습니까?","cron.load_error":"크론 작업을 불러오지 못했습니다","cron.validation_error":"스케줄과 명령어가 필요합니다.","cron.add_error":"작업 추가에 실패했습니다","cron.delete_error":"작업 삭제에 실패했습니다","cron.cancel":"취소","cron.adding":"추가 중...","cron.id":"ID","cron.actions":"작업","cron.loading_run_history":"실행 기록 불러오는 중...","cron.load_run_history_error":"실행 기록을 불러오지 못했습니다","cron.no_runs":"아직 실행 기록이 없습니다.","cron.recent_runs":"최근 실행","cron.yes":"예","cron.no":"아니오","cron.edit":"편집","cron.edit_modal_title":"크론 작업 편집","cron.edit_error":"작업 업데이트에 실패했습니다","cron.saving":"저장 중...","cron.save":"저장","integrations.available":"사용 가능","integrations.active":"활성","integrations.coming_soon":"준비 중","integrations.category":"카테고리","integrations.status":"상태","integrations.search":"연동 검색...","integrations.empty":"연동을 찾을 수 없습니다.","integrations.activate":"활성화","integrations.deactivate":"비활성화","integrations.load_error":"연동을 불러오지 못했습니다","integrations.status_active":"활성","integrations.status_available":"사용 가능","integrations.status_coming_soon":"준비 중","memory.title":"메모리 저장소","memory.memory_title":"메모리","memory.search":"메모리 검색...","memory.search_placeholder":"메모리 항목 검색...","memory.add":"메모리 저장","memory.add_memory":"메모리 추가","memory.add_modal_title":"메모리 추가","memory.delete":"삭제","memory.key":"키","memory.key_required":"키","memory.content":"내용","memory.content_required":"내용","memory.category":"카테고리","memory.category_optional":"카테고리 (선택)","memory.timestamp":"타임스탬프","memory.session":"세션","memory.score":"점수","memory.empty":"메모리 항목을 찾을 수 없습니다.","memory.confirm_delete":"이 메모리 항목을 삭제하시겠습니까?","memory.all_categories":"전체 카테고리","memory.search_button":"검색","memory.load_error":"메모리를 불러오지 못했습니다","memory.saving":"저장 중...","memory.validation_error":"키와 내용이 필요합니다.","memory.store_error":"메모리 저장에 실패했습니다","memory.delete_error":"메모리 삭제에 실패했습니다","memory.delete_confirm":"삭제하시겠습니까?","memory.yes":"예","memory.no":"아니오","memory.cancel":"취소","config.title":"설정","config.save":"저장","config.saving":"저장 중...","config.reset":"초기화","config.saved":"설정이 저장되었습니다.","config.error":"설정 저장에 실패했습니다.","config.loading":"설정 불러오는 중...","config.editor_placeholder":"TOML 설정...","config.configuration_title":"설정","config.sensitive_title":"민감한 필드가 마스킹되어 있습니다","config.sensitive_hint":"API 키, 토큰, 비밀번호는 보안을 위해 숨겨져 있습니다. 마스킹된 값을 업데이트하려면 전체 값을 새 값으로 교체하세요.","config.save_success":"설정이 저장되었습니다.","config.save_error":"설정 저장에 실패했습니다","config.toml_label":"TOML 설정","config.lines":"줄","cost.session":"세션 비용","cost.daily":"일일 비용","cost.monthly":"월간 비용","cost.request_count":"요청 수","cost.by_model":"모델별 비용","cost.model":"모델","cost.usd":"비용 (USD)","cost.load_error":"비용 데이터를 불러오지 못했습니다","cost.total_requests":"전체 요청","cost.token_statistics":"토큰 통계","cost.avg_tokens_per_request":"요청당 평균 토큰","cost.cost_per_1k_tokens":"1K 토큰당 비용","cost.model_breakdown":"모델별 분석","cost.cost":"비용","cost.share":"비중","logs.live_logs":"실시간 로그","logs.clear":"지우기","logs.filter":"로그 필터...","logs.filter_label":"필터","logs.empty":"로그 항목이 없습니다.","logs.events":"이벤트","logs.paused_hint":"로그 스트리밍이 일시정지되었습니다.","logs.waiting_hint":"이벤트 대기 중...","doctor.diagnostics_title":"진단","doctor.run_diagnostics":"진단 실행","doctor.running_btn":"실행 중...","doctor.running_desc":"진단을 실행하고 있습니다...","doctor.running_hint":"몇 초 정도 걸릴 수 있습니다.","doctor.error":"오류","doctor.severity":"심각도","doctor.category":"카테고리","doctor.message":"메시지","doctor.empty":"아직 진단이 실행되지 않았습니다.","doctor.summary":"진단 요약","doctor.issues_found":"발견된 문제","doctor.warnings_summary":"경고","doctor.all_clear":"이상 없음","doctor.system_diagnostics":"시스템 진단","doctor.empty_hint":'"진단 실행"을 클릭하여 설치 상태를 확인하세요.',"auth.pair":"기기 페어링","auth.pairing_code":"페어링 코드","auth.pair_button":"페어링","auth.logout":"로그아웃","auth.pairing_success":"페어링 성공!","auth.pairing_failed":"페어링 실패. 다시 시도해 주세요.","auth.enter_code":"에이전트에 연결하려면 페어링 코드를 입력하세요.","common.loading":"불러오는 중...","common.error":"오류가 발생했습니다.","common.retry":"재시도","common.cancel":"취소","common.confirm":"확인","common.save":"저장","common.delete":"삭제","common.edit":"편집","common.execute":"실행","common.close":"닫기","common.yes":"예","common.no":"아니오","common.search":"검색...","common.no_data":"데이터가 없습니다.","common.refresh":"새로고침","common.back":"뒤로","common.actions":"작업","common.name":"이름","common.description":"설명","common.status":"상태","common.created":"생성일","common.updated":"수정일","health.title":"시스템 상태","health.component":"컴포넌트","health.status":"상태","health.last_ok":"마지막 정상","health.last_error":"마지막 오류","health.restart_count":"재시작 횟수","health.pid":"프로세스 ID","health.uptime":"가동 시간","health.updated_at":"마지막 업데이트","dashboard.provider_model":"제공자 / 모델","dashboard.since_last_restart":"마지막 재시작 이후","dashboard.paired_yes":"예","dashboard.paired_no":"아니오","dashboard.cost_overview":"비용 개요","dashboard.active_channels":"활성 채널","dashboard.filter_active":"활성","dashboard.filter_all":"전체","dashboard.no_active_channels":"활성 채널이 없습니다","dashboard.component_health":"컴포넌트 상태","dashboard.load_error":"대시보드를 불러오지 못했습니다","dashboard.session_label":"세션","dashboard.daily_label":"일간","dashboard.monthly_label":"월간","dashboard.total_tokens_label":"전체 토큰","dashboard.requests_label":"요청","dashboard.by_model":"모델별","dashboard.no_channels":"설정된 채널이 없습니다","dashboard.active":"활성","dashboard.inactive":"비활성","dashboard.no_components":"보고 중인 컴포넌트가 없습니다","dashboard.restarts":"재시작","dashboard.tab_overview":"개요","dashboard.tab_sessions":"세션","dashboard.tab_channels":"채널","dashboard.tab_audit":"감사 추적","dashboard.tab_workflows":"워크플로","dashboard.audit_disabled":"감사 로깅이 활성화되지 않았습니다. 이벤트를 보려면 설정에서 활성화하세요.","dashboard.audit_all_types":"모든 이벤트 유형","dashboard.audit_refresh":"새로고침","dashboard.audit_verify_chain":"체인 검증","dashboard.audit_chain_valid":"체인 무결성 검증됨","dashboard.audit_chain_invalid":"체인 무결성 검증 실패","dashboard.audit_no_events":"감사 이벤트를 찾을 수 없습니다","dashboard.sessions_title":"활성 세션","dashboard.no_sessions":"활성 세션이 없습니다","dashboard.session_id":"세션 ID","dashboard.session_channel":"채널","dashboard.session_started":"시작","dashboard.session_last_activity":"마지막 활동","dashboard.session_status":"상태","dashboard.session_messages":"메시지","dashboard.session_details":"세션 상세","dashboard.session_history":"기록 보기","dashboard.channels_title":"채널 상태","dashboard.no_channels_detail":"채널 상세 정보를 사용할 수 없습니다","dashboard.channel_type":"유형","dashboard.channel_messages":"메시지","dashboard.channel_last_message":"마지막 메시지","dashboard.channel_config":"설정","dashboard.channel_enabled":"활성화됨","dashboard.channel_disabled":"비활성화됨","dashboard.loading_sessions":"세션 불러오는 중...","dashboard.loading_channels":"채널 불러오는 중...","dashboard.load_sessions_error":"세션을 불러오지 못했습니다","dashboard.load_channels_error":"채널을 불러오지 못했습니다","dashboard.never":"없음","dashboard.tab_clawhub":"ClawHub","dashboard.tab_nodes":"노드","dashboard.clawhub_title":"ClawHub 마켓플레이스","dashboard.clawhub_search":"템플릿, 스킬, 팀 검색…","dashboard.clawhub_no_items":"항목을 찾을 수 없습니다. 첫 번째 템플릿이나 스킬을 게시하세요!","dashboard.clawhub_publish":"게시","dashboard.clawhub_install":"설치","dashboard.clawhub_downloads":"다운로드","dashboard.clawhub_by":"작성자","dashboard.nodes_title":"연결된 노드","dashboard.nodes_no_nodes":"연결된 노드가 없습니다. 노드는 WebSocket을 통해 /ws/nodes에 연결됩니다.","dashboard.nodes_capabilities":"기능","dashboard.nodes_invoke":"호출","settings.title":"설정","settings.tab.appearance":"외관","settings.tab.typography":"타이포그래피","settings.appearance":"외관","settings.typography":"타이포그래피","settings.fontUi":"UI 글꼴","settings.fontMono":"코드 글꼴","settings.fontSize":"UI 글꼴 크기","settings.fontMonoSize":"코드 글꼴 크기","settings.preview":"미리보기","settings.previewText":"다람쥐 헌 쳇바퀴에 타고파.","settings.fontNote":"글꼴 변경은 페이지 새로고침 후 적용됩니다.","settings.language":"언어","chat_panel.ai_assistant":"AI 어시스턴트","chat_panel.agent_placeholder":'에이전트를 만들어 달라고 요청하세요, 예: "Rust 보안 전문가를 만들어줘"',"chat_panel.team_placeholder":'팀을 구성해 달라고 요청하세요, 예: "프론트엔드 마이그레이션 팀을 만들어줘"',"chat_panel.skill_placeholder":'스킬을 만들어 달라고 요청하세요, 예: "코드 리뷰 스킬을 만들어줘"',"chat_panel.close":"닫기","clawhub.tab_local":"로컬 스킬","clawhub.tab_clawhub":"ClawHub","clawhub.search_placeholder":"ClawHub 스킬 검색...","clawhub.trending":"인기","clawhub.install":"설치","clawhub.installing":"설치 중...","clawhub.installed":"설치됨","clawhub.downloads":"다운로드","clawhub.stars":"스타","clawhub.verified":"인증됨","clawhub.no_results":"스킬을 찾을 수 없습니다","clawhub.search_hint":"ClawHub에서 13,000개 이상의 커뮤니티 스킬 검색","clawhub.error":"ClawHub에 연결할 수 없습니다","clawhub.details":"상세정보","clawhub.less":"접기","clawhub.author":"작성자","clawhub.tags":"태그","theme.mode":"테마 모드","theme.accent":"강조 색상","theme.system":"시스템","theme.dark":"다크","theme.light":"라이트","theme.oled":"OLED 블랙","nav.pairing":"페어링","nav.section.orchestration":"오케스트레이션","nav.section.operations":"운영","nav.section.inspection":"검사","nav.dashboard.blurb":"실시간 런타임 상태 및 활성 DAG 상태","nav.workflows.blurb":"DAG을 정의하고 동일한 흐름에서 실행 기록으로 이동","nav.agents.blurb":"재사용 가능한 행위자 및 워크플로 참여자","nav.canvas.blurb":"시각적 작업 공간 및 오케스트레이션 캔버스","nav.teams.blurb":"위임 토폴로지 및 소유권 보기","nav.assets.blurb":"아티팩트 및 워크플로 관련 리소스","nav.skins.blurb":"토큰 및 자산 기반 UI 스킨","nav.skills.blurb":"재사용 가능한 운영 기능","nav.tools.blurb":"에이전트 도구 카탈로그 및 CLI 바이너리","nav.integrations.blurb":"연결된 시스템 및 채널 표면","nav.cron.blurb":"예약된 작업 및 따라잡기 동작","nav.pairing.blurb":"기기 등록 및 신뢰 관리","nav.config.blurb":"런타임 TOML 및 운영 구성","nav.cost.blurb":"워크플로 및 실행별 지출 및 효율성","nav.memory.blurb":"Kumiho 메모리 그래프 탐색기 및 리비전","nav.logs.blurb":"운영 추적 및 노드 연결 이벤트","nav.audit.blurb":"신뢰 체인 및 승인 검증","nav.doctor.blurb":"진단 및 런타임 복구 상태","sidebar.brand_subtitle":"에이전트 OS","sidebar.shell":"Revka","sidebar.shell_description":"로컬 우선의 에이전트 OS로, 프로젝트 전반의 AI 워크플로, 도구, 런타임을 오케스트레이션합니다.","header.tagline":"오케스트레이션 우선의 에이전트 운영 체제.","header.runtime_healthy":"런타임 정상","header.trust_verified":"신뢰 검증됨","header.trust_unverified":"신뢰 미검증","header.trust_checking":"신뢰 검증 중…","header.operator":"오퍼레이터","common.duplicate":"복제","common.reenable":"다시 활성화","common.deprecate":"사용 중지","common.create":"생성","dashboard.kicker":"오케스트레이션 센터","dashboard.live_orchestration_pane":"실시간 오케스트레이션 패널","dashboard.active_workflow_posture":"활성 워크플로 상태","dashboard.open_workflow_definition":"워크플로 정의 열기","dashboard.selected_run":"선택된 실행","dashboard.run_posture":"실행 상태","dashboard.signal_focus":"신호 포커스","dashboard.hotspots":"핫스팟","dashboard.count.running":"실행 중","dashboard.count.failed":"실패","dashboard.count.completed":"완료","dashboard.count.pending":"대기","dashboard.count.skipped":"건너뜀","dashboard.prev_signal":"이전 신호","dashboard.next_signal":"다음 신호","dashboard.intervention_points":"{count}개의 개입 지점","dashboard.label.failure":"실패: {id}","dashboard.label.running":"실행 중: {id}","dashboard.label.blocked":"차단됨: {id}","dashboard.selected_step":"선택된 단계","dashboard.inspect_node_in_runs":"실행 작업 공간에서 이 노드 검사","dashboard.open_definition_node":"정의 노드 열기","dashboard.select_dag_node":"활성 분기를 검사하려면 DAG에서 노드를 선택하세요.","dashboard.priority_timeline":"우선순위 타임라인","dashboard.no_run_selected":"선택된 실행이 없습니다.","dashboard.open_full_run_workspace":"전체 실행 작업 공간 열기","dashboard.open_all_runs":"모든 워크플로 실행 열기","dashboard.status.blocked":"차단됨","dashboard.scene.operator":"오퍼레이터 브리프","dashboard.scene.error":"대시보드 텔레메트리가 불안정합니다. 다음 액션 전에 실행 레일과 로그를 확인하세요.","dashboard.scene.selected_run":"{workflow}는 현재 {status} 상태입니다. {completed}/{total} 단계가 완료됐습니다.","dashboard.scene.run_failed":"{workflow}에 확인이 필요합니다. {failed}개 단계가 실패했고 {completed}/{total} 단계가 완료됐습니다.","dashboard.scene.active_overview":"{definitions}개 워크플로 정의에서 {active}개 실행이 진행 중입니다.","dashboard.scene.idle_overview":"선택된 실행이 없습니다. {definitions}개 정의가 준비됐고 총 {total}회 실행이 기록됐습니다.","workflows.kicker":"오케스트레이션 센터","workflows.title":"워크플로","workflows.create":"워크플로 생성","workflows.workflow_info":"v{version} · {steps}개 노드 · {runs}회 실행","workflows.workflow_info_short":"v{version} · {steps}개 노드","workflows.status.off":"꺼짐","workflows.status.ready":"준비됨","workflows.tab.definition":"정의","workflows.tab.runs":"실행","workflows.loading":"워크플로를 불러오는 중…","workflows.empty_title":"아직 워크플로가 없습니다","workflows.empty_desc":"시작하려면 첫 번째 워크플로를 생성하세요.","workflows.definition_unavailable_title":"워크플로 정의를 사용할 수 없습니다","workflows.definition_unavailable_desc":"런타임이 이 워크플로에 대해 빈 정의를 반환했습니다 — 그래프를 렌더링할 수 없습니다. 이는 백엔드 데이터 문제이며 업스트림에서 수정해야 합니다.","workflows.no_runs_title":"아직 실행이 없습니다","workflows.no_runs_desc":"실행 상태를 보려면 이 워크플로를 실행하세요.","workflows.open_node_in_runs":"실행에서 노드 열기","workflows.select_dag_node":"DAG에서 노드를 선택하세요.","workflows.run_step":"실행 단계","workflows.select_dag_node_step":"단계를 검사하려면 DAG 노드를 선택하세요.","workflows.save_failure":"워크플로 저장 실패","workflows.save_failure_dot":"워크플로 저장에 실패했습니다.","workflows.run_failure":"워크플로 실행 시작 실패","workflows.status_failure":"워크플로 상태 변경 실패","workflows.status_failure_dot":"워크플로 상태 변경에 실패했습니다.","workflows.delete_failure":"워크플로 삭제 실패","workflows.delete_failure_dot":"워크플로 삭제에 실패했습니다.","workflows.toast.updated":'워크플로 "{name}"이(가) 업데이트되었습니다.',"workflows.toast.created":'워크플로 "{name}"이(가) 생성되었습니다.',"workflows.toast.reenabled":'워크플로 "{name}"이(가) 다시 활성화되었습니다.',"workflows.toast.deprecated":'워크플로 "{name}"이(가) 사용 중지되었습니다.',"workflows.toast.deleted":'워크플로 "{name}"이(가) 삭제되었습니다.',"workflows.toast.run_started":'워크플로 "{name}"이(가) 시작되었습니다 (실행 {runId}).',"workflows.run_option":"{prefix} — {status} ({completed}/{total})","workflows.copy_suffix":"사본","doctor.kicker":"검사","doctor.title":"닥터","doctor.description":"런타임 진단을 실행하고 Revka 스택 전반에 걸친 그룹화된 상태 결과를 검사합니다.","doctor.run":"진단 실행","doctor.running":"실행 중…","doctor.failed_title":"진단 실패","doctor.loading_title":"시스템 진단 실행 중…","doctor.loading_desc":"런타임 구성 요소, 구성 및 운영 상태를 확인하는 중입니다.","doctor.health_summary":"상태 요약","doctor.passing":"통과","doctor.warnings":"경고","doctor.failures":"실패","doctor.run_context":"실행 컨텍스트","doctor.context_p1":"닥터는 터미널 덤프가 아닌 검사 보드처럼 동작할 때 가장 강력합니다. 이 패널은 먼저 전체 상태를 강조한 다음 발견 사항을 하위 시스템 그룹으로 분류합니다.","doctor.context_p2":"개별 메시지를 살펴보기 전에 카테고리 보드를 사용하여 경고가 어디에 모여 있는지 확인하세요.","doctor.subsystem_boards":"하위 시스템 보드","doctor.checks":"{count}개 확인","doctor.ok":"ok","doctor.warn":"경고","doctor.fail":"실패","doctor.system_diag_title":"시스템 진단","doctor.system_diag_desc":"Revka 셸에서 경고, 실패 및 모두 정상 확인을 검사하려면 닥터를 실행하세요.","doctor.run_failed":"진단 실행 실패","cost.kicker":"운영","cost.title":"비용","cost.error_title":"비용 데이터를 불러올 수 없습니다","cost.loading_title":"비용 데이터를 불러오는 중…","cost.spend_posture":"지출 상태","cost.session_cost":"세션 비용","cost.daily_cost":"일일 비용","cost.monthly_cost":"월간 비용","cost.requests":"요청 수","cost.token_efficiency":"토큰 효율","cost.total_tokens":"총 토큰","cost.avg_tokens":"요청당 평균 토큰","cost.cost_per_1k":"1K 토큰당 비용","cost.model_workspace":"모델 작업 공간","cost.spend_by_model":"모델별 지출","cost.no_model_data":"모델 데이터 없음","cost.no_model_data_desc":"요청이 기록된 후 모델 수준의 지출이 표시됩니다.","cost.tokens_label":"{count} 토큰","cost.requests_label":"{count} 요청","cost.share_label":"월간 지출의 {share}%","cost.selected_model":"선택된 모델","cost.no_model_selected":"선택된 모델 없음","cost.no_model_selected_desc":"지출 집중도와 효율성을 검사하려면 작업 공간에서 모델을 선택하세요.","cost.monthly_spend":"월간 지출","cost.tokens":"토큰","cost.share_monthly":"월간 지출 비중","cost.interpretation":"해석","cost.interp_p1":"큰 월간 비중 값은 비용이 단일 모델 제품군에 집중되어 있음을 나타냅니다.","cost.interp_p2":"요청 수는 적지만 요청당 토큰이 많은 경우 일반적으로 긴 컨텍스트 또는 생성 중심 워크플로를 의미합니다.","logs.kicker":"검사","logs.title":"로그","logs.description":"Revka 데몬 stderr 로그의 실시간 추적. 런타임 에이전트 이벤트는 감사 페이지에 있습니다.","logs.pause":"일시 중지","logs.resume":"재개","logs.jump_to_bottom":"하단으로 이동","logs.stream_status":"스트림 상태","logs.connected":"연결됨","logs.disconnected":"연결 끊김","logs.visible_lines":"{count}개의 표시되는 줄. ~/.revka/logs/daemon.stderr.log 추적 중.","logs.event_filters":"이벤트 필터","logs.no_event_types":"아직 이벤트 유형이 없습니다","logs.no_event_types_desc":"스트림이 활동을 수신한 후 필터가 표시됩니다.","logs.clear_filters":"필터 지우기","logs.live_event_feed":"실시간 이벤트 피드","logs.no_events":"아직 이벤트가 없습니다","logs.no_events_desc":"SSE 피드가 런타임 이벤트를 수신하면 에이전트 활동이 여기에 스트리밍됩니다.","tools.kicker":"운영","tools.title":"도구","tools.description":"에이전트용 도구 카탈로그와 런타임이 호출할 수 있는 호스트 CLI 바이너리.","tools.reload":"다시 로드","tools.search_placeholder":"이름, 설명 또는 카테고리로 도구 검색…","tools.loading":"도구를 불러오는 중…","tools.agent_tools_count":"에이전트 도구 · {count}","tools.no_matches":"일치 항목 없음","tools.no_agent_tools":"등록된 에이전트 도구 없음","tools.try_different":"다른 검색어를 시도하세요.","tools.agent_tools_empty_desc":"런타임이 등록하면 에이전트 도구가 표시됩니다.","tools.parameter_schema":"매개변수 스키마","tools.cli_tools_count":"CLI 도구 · {count}","tools.no_cli_tools":"감지된 CLI 도구 없음","tools.cli_tools_empty_desc":"Revka는 시작 시 일반적인 CLI 바이너리를 탐색합니다. 하나를 설치하고 다시 로드하세요.","tools.col.name":"이름","tools.col.path":"경로","tools.col.version":"버전","tools.col.category":"카테고리","tools.failed_load":"도구 로드 실패: {message}","audit.kicker":"검사","audit.title":"감사","audit.description":"운영 작업에 대한 신뢰 체인 검증, 이벤트 검토 및 보안 상태.","audit.refresh":"새로고침","audit.verify_chain":"체인 검증","audit.disabled_title":"감사 추적이 비활성화됨","audit.disabled_desc":"여기에서 승인, 정책 및 보안 이벤트를 검사하려면 감사 기록을 활성화하세요.","audit.filters":"필터","audit.all_event_types":"모든 이벤트 유형","audit.event.command_execution":"명령 실행","audit.event.file_access":"파일 접근","audit.event.config_change":"구성 변경","audit.event.auth_success":"인증 성공","audit.event.auth_failure":"인증 실패","audit.event.policy_violation":"정책 위반","audit.event.security_event":"보안 이벤트","audit.chain_verified":"체인 확인됨","audit.chain_invalid":"체인 무효","audit.entries_verified":"{count}개 항목이 확인되었습니다.","audit.stream_title":"감사 이벤트 스트림","audit.stream_subtitle":"기록된 작업 및 승인","audit.loading":"감사 이벤트 로드 중…","audit.empty_title":"감사 이벤트 없음","audit.empty_desc":"작업 또는 승인이 발생하면 기록된 이벤트가 여기에 표시됩니다.","audit.col.sequence":"순서","audit.col.action":"작업","audit.col.result":"결과","audit.col.hash":"해시","audit.result_success":"성공","audit.result_recorded":"기록됨","audit.policy_violation_badge":"정책 위반","audit.time.seconds_ago":"{n}초 전","audit.time.minutes_ago":"{n}분 전","audit.time.hours_ago":"{n}시간 전","audit.time.days_ago":"{n}일 전","integrations.kicker":"운영","integrations.title":"통합","integrations.loading":"통합 로드 중…","integrations.coverage":"커버리지","integrations.metric.active":"활성","integrations.metric.available":"사용 가능","integrations.metric.coming_soon":"출시 예정","integrations.categories":"카테고리","integrations.category_all":"전체","integrations.workspace":"통합 작업공간","integrations.all_integrations":"모든 통합","integrations.category_integrations":"{category} 통합","integrations.empty_title":"통합 없음","integrations.empty_desc":"현재 카테고리 필터와 일치하는 통합이 없습니다.","integrations.badge.active":"활성","integrations.badge.available":"사용 가능","integrations.badge.coming_soon":"출시 예정","integrations.selected":"선택된 통합","integrations.no_selected_title":"선택된 통합 없음","integrations.no_selected_desc":"배포 상태를 검사하려면 작업공간에서 통합을 선택하세요.","integrations.detail.category":"카테고리","integrations.detail.status":"상태","integrations.detail.operational_readiness":"운영 준비 상태","integrations.readiness.active":"런타임에서 이미 활성화됨.","integrations.readiness.available":"운영자 준비 시 활성화 가능.","integrations.readiness.coming_soon":"아직 활성화할 준비가 되지 않은 계획된 영역.","integrations.legend":"상태 범례","integrations.legend.p1":"`Active` 통합은 이미 런타임 워크플로우에 연결되어 있습니다.","integrations.legend.p2":"`Available` 통합은 현재 빌드에서 설치 또는 연결할 수 있습니다.","integrations.legend.p3":"`Coming Soon` 통합은 계획되었지만 아직 운영자용으로 준비되지 않았습니다.","pairing.kicker":"운영","pairing.title":"페어링","pairing.description":"페어링 코드 발급, 모바일 등록용 QR 생성 및 신뢰 장치 관리.","pairing.reload":"다시 로드","pairing.pair_new_device":"새 장치 페어링","pairing.generating":"생성 중…","pairing.active_code":"활성 페어링 코드","pairing.rendering":"렌더링 중…","pairing.code_hint":"Revka 컴패니언 앱으로 QR을 스캔하거나 페어링된 장치에 6자리 코드를 입력하세요. 장치 등록이 완료되거나 새 코드를 생성하면 코드가 만료됩니다.","pairing.copy_code":"코드 복사","pairing.rotate":"순환","pairing.cli_device_name":"CLI 장치 이름","pairing.cli_hardware":"하드웨어","pairing.cli_hardware_placeholder":"선택적 플랫폼 라벨","pairing.mint_cli_token":"CLI 토큰 발급","pairing.minting_token":"발급 중…","pairing.minted_token":"발급된 Bearer 토큰","pairing.copy_token":"토큰 복사","pairing.no_code_title":"활성 페어링 코드 없음","pairing.no_code_desc":'"새 장치 페어링"을 눌러 새 코드와 QR을 생성하세요. 코드는 단기간용이며 단일 등록용입니다.',"pairing.how_to_scan":"스캔 방법","pairing.scan_step1":"새 장치에서 Revka 컴패니언 앱을 엽니다.","pairing.scan_step2_prefix":"선택: ","pairing.scan_step2_action":"허브와 페어링","pairing.scan_step2_suffix":".","pairing.scan_step3":"QR을 스캔하거나 6자리 코드를 수동으로 입력합니다.","pairing.scan_step4":"등록이 완료되면 장치가 아래 목록에 나타납니다.","pairing.paired_devices":"페어링된 장치 · {count}","pairing.loading_devices":"장치 로드 중…","pairing.no_devices_title":"페어링된 장치가 아직 없습니다","pairing.no_devices_desc":"성공적인 등록 후 페어링된 장치가 여기에 표시됩니다.","pairing.col.name":"이름","pairing.col.type":"유형","pairing.col.hardware":"하드웨어","pairing.col.paired":"페어링됨","pairing.col.last_seen":"마지막 활동","pairing.col.ip":"IP","pairing.col.actions":"작업","pairing.unnamed":"이름 없음","pairing.unknown":"알 수 없음","pairing.device_type.api_client":"API 클라이언트","pairing.device_type.browser":"브라우저","pairing.device_type.cli":"CLI","pairing.device_type.mobile":"모바일","pairing.device_type.tablet":"태블릿","pairing.revoke":"취소?","pairing.yes":"예","pairing.no":"아니오","pairing.revoke_title":"장치 취소","pairing.toast.code_generated":"새 페어링 코드가 생성되었습니다.","pairing.toast.code_copied":"코드가 복사되었습니다.","pairing.toast.token_minted":"Bearer 토큰이 발급되었습니다. 지금 복사하세요.","pairing.toast.token_copied":"토큰이 복사되었습니다.","pairing.toast.copy_failed":"복사 실패. 직접 선택하세요.","pairing.toast.device_revoked":"장치가 취소되었습니다.","pairing.err.load_devices":"장치 로드 실패","pairing.err.gen_code":"페어링 코드 생성 실패","pairing.err.mint_token":"Bearer 토큰 발급 실패","pairing.err.revoke":"장치 취소 실패","cron.kicker":"운영","cron.description":"예약된 작업, 캐치업 동작 및 최근 실행 이력.","cron.reload":"다시 로드","cron.startup_behaviour":"시작 동작","cron.catch_up_title":"시작 시 놓친 작업 따라잡기","cron.catch_up_desc":"다운타임 후 Revka가 시작될 때 기한이 지난 모든 작업을 실행합니다.","cron.loading_jobs":"예약된 작업 로드 중…","cron.no_jobs_title":"예약된 작업이 없습니다","cron.no_jobs_desc":"명령을 예약 실행하려면 cron 작업을 추가하세요.","cron.col.id":"ID","cron.col.name":"이름","cron.col.command":"명령","cron.col.next_run":"다음 실행","cron.col.last_status":"마지막 상태","cron.col.enabled":"활성화됨","cron.col.actions":"작업","cron.enabled_badge":"활성","cron.disabled_badge":"비활성","cron.toggle_history":"실행 이력 토글","cron.confirm":"확인?","cron.history.loading":"실행 이력 로드 중…","cron.history.error_title":"실행 이력을 로드할 수 없습니다","cron.history.retry":"다시 시도","cron.history.no_runs_title":"아직 실행 없음","cron.history.no_runs_desc":"이 작업은 생성된 이후 실행되지 않았습니다.","cron.history.refresh":"새로고침","cron.history.recent":"최근 실행 · {count}","cron.history.refresh_title":"실행 새로고침","cron.modal.edit_title":"Cron 작업 편집","cron.modal.add_title":"Cron 작업 추가","cron.modal.description":"이름은 선택 사항입니다. 일정은 표준 cron 표현식을 사용합니다.","cron.form.name":"이름","cron.form.optional":"(선택)","cron.form.name_placeholder":"예: 매일 정리","cron.form.schedule":"일정","cron.form.command":"명령","cron.form.command_placeholder":"예: cleanup --older-than 7d","cron.form.cancel":"취소","cron.form.saving":"저장 중…","cron.form.adding":"추가 중…","cron.form.save":"저장","cron.err.load":"작업 로드 실패: {message}","cron.err.settings":"설정 업데이트 실패","cron.err.save":"작업 저장 실패","cron.err.delete":"작업 삭제 실패","cron.err.form_required":"일정과 명령이 필요합니다.","cron.toast.updated":'"{name}"이(가) 업데이트되었습니다.',"cron.toast.added":'"{name}"이(가) 추가되었습니다.',"cron.toast.deleted":"작업이 삭제되었습니다.","canvas.kicker":"오케스트레이션 센터","canvas.title":"캔버스","canvas.reconnect":"다시 연결","canvas.control":"캔버스 제어","canvas.connected":"연결됨","canvas.disconnected":"연결 끊김","canvas.canvas_id_placeholder":"캔버스 ID","canvas.switch":"전환","canvas.clear":"지우기","canvas.available":"사용 가능한 캔버스","canvas.loading_list":"캔버스 로드 중…","canvas.loading_list_desc":"실시간 캔버스 레지스트리를 폴링 중.","canvas.no_active_title":"활성 캔버스 없음","canvas.no_active_desc":"에이전트나 워크플로우가 프레임을 푸시하면 캔버스 ID가 여기에 표시됩니다.","canvas.active":"활성","canvas.viewport":"캔버스 뷰포트","canvas.live_output":"실시간 프레임 출력","canvas.canvas_label":"캔버스","canvas.connection":"연결","canvas.live":"실시간","canvas.offline":"오프라인","canvas.frame_type":"프레임 유형","canvas.last_update":"마지막 업데이트","canvas.waiting_label":"프레임 대기 중","canvas.frame_suffix":"프레임","canvas.waiting_for_content":'"{id}"의 콘텐츠 대기 중',"canvas.waiting_for_content_desc":"에이전트는 캔버스 도구를 사용하여 여기에 콘텐츠를 푸시할 수 있습니다. 프레임이 도착하면 이 뷰포트에 즉시 렌더링됩니다.","canvas.disconnected_title":"캔버스 소켓 연결 끊김","canvas.disconnected_desc":"현재 캔버스에 다시 연결하거나 다른 실시간 캔버스 ID로 전환하세요.","canvas.reconnect_button":"캔버스 다시 연결","canvas.frame_id":"프레임 ID","canvas.guidance":"캔버스 안내","canvas.guidance_desc":"어시스턴트를 사용하여 이 뷰포트에 차트, 다이어그램, 마크다운 보고서 및 HTML 대시보드를 직접 생성하세요.","canvas.history":"프레임 이력","canvas.hide":"숨기기","canvas.show":"표시","canvas.history_collapsed_title":"이력 축소됨","canvas.history_collapsed_desc":"활성 캔버스의 이전 프레임을 검사하려면 이 레일을 확장하세요.","canvas.no_frames_title":"아직 프레임 없음","canvas.no_frames_desc":"프레임이 도착하면 빠른 추적을 위해 여기에 저장됩니다.","skills.kicker":"운영","skills.title":"스킬","skills.create_skill":"스킬 생성","skills.registry_status":"레지스트리 상태","skills.summary.total":"전체","skills.summary.active":"활성","skills.summary.deprecated":"사용 중단됨","skills.summary.domains":"도메인","skills.index":"스킬 인덱스","skills.search_placeholder":"스킬 검색…","skills.loading":"스킬 로드 중…","skills.no_skills_title":"스킬을 찾을 수 없습니다","skills.no_skills_desc":"운영 레지스트리를 채우려면 로컬 스킬을 생성하세요.","skills.status.active":"활성","skills.status.deprecated":"사용 중단됨","skills.workspace":"스킬 작업공간","skills.select_placeholder":"스킬 선택","skills.description":"설명","skills.content":"스킬 콘텐츠","skills.content_empty":"이 스킬에는 표시할 콘텐츠가 없습니다.","skills.edit":"편집","skills.reenable":"재활성화","skills.deprecate":"사용 중단","skills.deleting":"삭제 중…","skills.delete":"삭제","skills.no_selected_title":"선택된 스킬 없음","skills.no_selected_desc":"콘텐츠와 운영 메타데이터를 검사하려면 스킬을 선택하세요.","skills.install_github":"GitHub에서 설치","skills.install_github_desc":"GitHub 저장소 URL을 붙여넣어 스킬을 직접 설치하세요.","skills.github_placeholder":"https://github.com/org/skill-repo","skills.installing":"설치 중…","skills.install":"설치","skills.marketplace":"마켓플레이스","skills.marketplace_shown":"{count}개 표시","skills.marketplace_placeholder":"ClawHub 스킬 검색…","skills.search":"검색","skills.trending":"인기","skills.marketplace_loading":"마켓플레이스 로드 중…","skills.marketplace_empty":"마켓플레이스 결과 없음","skills.modal.edit_title":"스킬 편집","skills.modal.create_title":"스킬 생성","skills.modal.description":"스킬은 에이전트와 실행에 연결할 수 있는 재사용 가능한 운영 기능입니다.","skills.modal.name_placeholder":"스킬 이름","skills.modal.description_placeholder":"설명","skills.modal.tags_placeholder":"쉼표,구분,태그","skills.modal.content_placeholder":"스킬 마크다운 콘텐츠","skills.modal.cancel":"취소","skills.modal.saving":"저장 중…","skills.modal.save_skill":"스킬 저장","skills.toast.updated":'"{name}" 스킬이 업데이트되었습니다.',"skills.toast.created":'"{name}" 스킬이 생성되었습니다.',"skills.toast.reenabled":'"{name}" 스킬이 재활성화되었습니다.',"skills.toast.deprecated":'"{name}" 스킬이 사용 중단되었습니다.',"skills.toast.deleted":'"{name}" 스킬이 삭제되었습니다.',"skills.toast.installed":'"{name}" 스킬이 설치되었습니다.',"skills.toast.installed_github":'GitHub에서 "{name}" 스킬을 설치했습니다.',"skills.err.save":"스킬 저장 실패.","skills.err.load_detail":"스킬 콘텐츠를 로드하지 못했습니다.","skills.err.toggle":"스킬 상태 변경 실패.","skills.err.delete":"스킬 삭제에 실패했습니다.","skills.err.install":"마켓플레이스 스킬 설치 실패.","skills.err.install_github":"GitHub URL에서 스킬 설치 실패.","teams.kicker":"오케스트레이션 센터","teams.title":"팀","teams.create":"팀 생성","teams.refresh":"새로고침","teams.count":"{count}개 팀","teams.agent_count":"{count}개 에이전트","teams.loading":"로딩 중…","teams.loading_desc":"팀 로드 중…","teams.empty_title":"팀 없음","teams.empty_desc":"시작하려면 팀을 생성하세요.","teams.none_selected_title":"선택된 팀 없음","teams.none_selected_desc":"인덱스에서 팀을 선택하세요.","teams.members_suffix":"멤버 {members}명 · 엣지 {edges}개","teams.status.off":"꺼짐","teams.status.live":"운영","teams.status.deprecated":"사용 중단됨","teams.status.active":"활성","teams.action.edit":"편집","teams.action.reenable":"재활성화","teams.action.deprecate":"사용 중단","teams.action.delete":"삭제","teams.stats.members":"멤버","teams.stats.edges":"엣지","teams.stats.status":"상태","teams.tab.summary":"요약","teams.tab.member":"멤버","teams.open_agent_registry":"에이전트 레지스트리 열기","teams.modal.edit_title":"팀 편집","teams.modal.create_title":"팀 생성","teams.modal.description":"팀 편집기는 이제 새로운 셸에서 정체성, 구성, 핵심 보고/종속 엣지를 직접 관리합니다.","teams.form.name":"팀 이름","teams.form.description":"설명","teams.form.members":"멤버","teams.form.topology_preview":"토폴로지 미리보기","teams.form.edge_authoring":"엣지 작성","teams.form.from_member":"출발 멤버","teams.form.to_member":"도착 멤버","teams.form.edge_reports_to":"보고 대상","teams.form.edge_supports":"지원","teams.form.edge_depends_on":"의존","teams.form.add_edge":"엣지 추가","teams.form.remove":"제거","teams.form.no_edges":"아직 토폴로지 엣지가 정의되지 않았습니다.","teams.form.draft_summary":"초안 요약","teams.form.draft_members":"멤버","teams.form.draft_edges":"엣지","teams.form.draft_hint":"계층 구조에는 `REPORTS_TO`, 협업 레인에는 `SUPPORTS`, 실행 차단 관계에는 `DEPENDS_ON`을 사용하세요.","teams.form.draft_team_name":"초안 팀","teams.form.cancel":"취소","teams.form.saving":"저장 중…","teams.form.save":"팀 저장","teams.toast.updated":'팀 "{name}"이(가) 업데이트되었습니다.',"teams.toast.created":'팀 "{name}"이(가) 생성되었습니다.',"teams.toast.deleted":'팀 "{name}"이(가) 삭제되었습니다.',"teams.toast.reenabled":'팀 "{name}"이(가) 재활성화되었습니다.',"teams.toast.deprecated":'팀 "{name}"이(가) 사용 중단되었습니다.',"teams.err.save":"팀 저장 실패.","teams.err.toggle":"팀 상태 변경 실패.","teams.err.delete":"팀 삭제 실패.","agents.kicker":"오케스트레이션 센터","agents.title":"에이전트","agents.create":"에이전트 생성","agents.refresh":"새로고침","agents.search_placeholder":"에이전트 검색…","agents.filter.all_roles":"모든 역할","agents.filter.coder":"코더","agents.filter.reviewer":"리뷰어","agents.filter.researcher":"리서처","agents.filter.hide_disabled":"비활성 숨기기","agents.filter.show_disabled":"비활성 표시","agents.count":"{count}개 에이전트","agents.loading":"로딩 중…","agents.loading_desc":"에이전트 로드 중…","agents.empty_title":"에이전트 없음","agents.empty_desc":"필터를 조정하거나 새로 만드세요.","agents.none_selected_title":"선택된 에이전트 없음","agents.none_selected_desc":"인덱스에서 에이전트를 선택하세요.","agents.status.disabled":"비활성","agents.status.active":"활성","agents.stats.registry":"레지스트리","agents.stats.active":"활성","agents.stats.codex":"Codex","agents.section.identity":"정체성","agents.section.soul":"영혼","agents.section.soul_empty":"영혼 설명이 제공되지 않았습니다.","agents.section.expertise":"전문 분야","agents.section.no_expertise":"전문 분야 태그 없음.","agents.section.voice":"보이스","agents.section.voice_empty":"지정되지 않음","agents.section.revision":"리비전","agents.section.created":"생성됨","agents.action.edit":"편집","agents.action.reenable":"재활성화","agents.action.deprecate":"사용 중단","agents.action.delete":"삭제","agents.action.deleting":"삭제 중…","agents.tab.summary":"요약","agents.tab.prompt":"프롬프트","agents.summary.name":"이름","agents.summary.role":"역할","agents.summary.type":"유형","agents.summary.model":"모델","agents.summary.model_default":"기본값","agents.summary.tone":"톤","agents.summary.revision":"리비전","agents.summary.created":"생성됨","agents.prompt.system_hint":"시스템 힌트","agents.prompt.system_hint_empty":"시스템 힌트가 구성되지 않았습니다.","agents.prompt.identity_seed":"정체성 시드","agents.modal.create_title":"에이전트 생성","agents.modal.edit_title":"에이전트 편집","agents.modal.description":"에이전트는 정체성 기반의 오퍼레이터입니다. Revka는 페르소나, 모델, 프롬프트 표면을 한 곳에 모읍니다.","agents.form.name":"이름","agents.form.tone":"톤","agents.form.tone_placeholder":"간결하고 직접적","agents.form.identity":"정체성","agents.form.soul":"영혼","agents.form.role":"역할","agents.form.role.coder":"코더","agents.form.role.reviewer":"리뷰어","agents.form.role.researcher":"리서처","agents.form.agent_type":"에이전트 유형","agents.form.model":"모델","agents.form.model_placeholder":"gpt-5.4 / claude-sonnet-4-6","agents.form.expertise":"전문 분야","agents.form.expertise_placeholder":"rust, review, orchestration","agents.form.system_hint":"시스템 힌트","agents.form.cancel":"취소","agents.form.saving":"저장 중…","agents.form.save_create":"에이전트 생성","agents.form.save_edit":"에이전트 저장","agents.toast.updated":'에이전트 "{name}"이(가) 업데이트되었습니다.',"agents.toast.created":'에이전트 "{name}"이(가) 생성되었습니다.',"agents.toast.deleted":'에이전트 "{name}"이(가) 삭제되었습니다.',"agents.toast.reenabled":'에이전트 "{name}"이(가) 재활성화되었습니다.',"agents.toast.deprecated":'에이전트 "{name}"이(가) 사용 중단되었습니다.',"agents.err.load":"에이전트 로드 실패.","agents.err.save":"에이전트 저장 실패.","agents.err.toggle":"에이전트 상태 변경 실패.","agents.err.delete":"에이전트 삭제 실패.","runs.kicker":"오케스트레이션 센터","runs.title":"워크플로 실행","runs.refresh":"새로고침","runs.index.title":"실행 인덱스","runs.empty.title":"실행 없음","runs.empty.desc":"인덱스를 채우려면 워크플로를 실행하세요.","runs.error.title":"로드 오류","runs.stats.steps_fraction":"{completed}/{total} 단계","runs.stats.expanded_steps":"확장 {count}개","runs.stats.loop_fraction":"반복 {iteration}/{total}: {step}","runs.stats.loop_iteration":"반복 {iteration}: {step}","runs.open_definition":"정의 열기","runs.action.retry_failed":"실패 재시도","runs.action.retrying":"재시도 중…","runs.action.retry_tooltip":"실패한 단계 재시도","runs.action.stop":"중지","runs.action.stopping":"중지 중…","runs.action.stop_tooltip":"이 실행 인스턴스 중지","runs.action.delete_tooltip":"실행 삭제","runs.none_selected.title":"선택된 실행 없음","runs.none_selected.desc":"인덱스에서 실행을 선택하세요.","runs.banner.label":"활성 선택","runs.overlay.path_mode":"경로 모드","runs.overlay.path.all":"전체","runs.overlay.path.failed":"실패","runs.overlay.path.blocked":"차단됨","runs.overlay.signals":"신호","runs.overlay.prev":"이전","runs.overlay.next":"다음","runs.overlay.signal_count":"신호 {count}개","runs.overlay.posture":"상태","runs.overlay.running":"실행 중","runs.overlay.failed":"실패","runs.overlay.done":"완료","runs.overlay.pending":"대기","runs.overlay.skipped":"건너뜀","runs.overlay.hotspots":"핫스팟","runs.overlay.legend_running":"실행 중","runs.overlay.legend_failure":"실패","runs.overlay.legend_blocked":"차단됨","runs.overlay.legend_skipped":"건너뜀","runs.overlay.legend_gate":"게이트","runs.overlay.fail_label":"실패: {id}","runs.overlay.run_label":"실행: {id}","runs.overlay.block_label":"차단: {id}","runs.started_at":"{time}에 시작됨","runs.inspector.title":"단계 인스펙터","runs.tab.summary":"요약","runs.tab.output":"출력","runs.tab.tools":"도구","runs.tab.transcript":"기록","runs.tab.jsonl":"JSONL 로그","runs.detail.select_node":"검사할 DAG 노드를 선택하세요.","runs.detail.no_description":"설명 없음.","runs.detail.depends_on":"의존: {list}","runs.detail.depends_none":"없음","runs.detail.agent":"에이전트: {type}{role}","runs.detail.agent_na":"해당 없음","runs.detail.skills":"스킬: {list}","runs.detail.dashboard_link":"대시보드","runs.detail.definition_link":"정의","runs.detail.select_step":"단계를 선택하세요.","runs.detail.step_output":"단계 출력","runs.detail.agent_output":"에이전트 출력","runs.detail.no_output":"캡처된 출력 없음.","runs.detail.loading":"로딩 중…","runs.detail.tools_calls":"호출","runs.detail.tools_errors":"오류","runs.detail.no_tools":"기록된 도구 호출 없음.","runs.detail.no_activity":"사용 가능한 에이전트 활동 없음.","runs.detail.no_jsonl":"이 에이전트의 JSONL 항목을 찾을 수 없습니다.","runs.detail.no_jsonl_filter":"필터와 일치하는 항목이 없습니다.","runs.detail.no_transcript":"사용 가능한 기록 없음.","runs.detail.tool_default":"도구","runs.detail.tool_status_ok":"ok","runs.timeline":"타임라인 ({count})","runs.toast.retry_started":"실행 {id} 재시도 시작됨.","runs.toast.stop_requested":"실행 {id} 중지가 요청됨.","runs.toast.deleted":"실행 {id} 삭제됨.","runs.err.retry":"실행 재시도 실패.","runs.err.stop":"실행 중지 실패.","runs.err.delete":"실행 삭제 실패.","memory.kicker":"검사","memory.page_title":"메모리","memory.page_description":"종류 필터, 공간 범위, 검색 강조, 노드 연결 세부 드릴다운을 지원하는 메모리 그래프 검사.","memory.selected_memory":"선택된 메모리","memory.loading_detail":"노드 세부 정보 로드 중…","memory.relative.just_now":"방금 전","memory.relative.minutes":"{count}분 전","memory.relative.hours":"{count}시간 전","memory.relative.days":"{count}일 전","memory.detail.metadata":"메타데이터","memory.detail.bundle_members":"번들 멤버","memory.controls.title":"그래프 컨트롤","memory.controls.search_placeholder":"메모리 강조…","memory.controls.all_spaces":"모든 공간","memory.controls.node_limit":"노드 제한","memory.filters.title":"필터","memory.filters.empty_title":"아직 로드된 종류 없음","memory.filters.empty_desc":"메모리 데이터가 사용 가능해지면 그래프 필터가 표시됩니다.","memory.graph.kicker":"메모리 그래프","memory.graph.heading":"의미 메모리 토폴로지","memory.graph.items":"항목","memory.graph.edges":"엣지","memory.graph.shown":"표시됨","memory.graph.matches":"{count}개 일치","memory.graph.match":"{count}개 일치","memory.graph.loading_title":"메모리 그래프 로드 중…","memory.graph.loading_desc":"의미 메모리 토폴로지와 관계 엣지를 가져오는 중입니다.","memory.graph.error_title":"메모리 그래프를 로드할 수 없음","memory.graph.retry":"재시도","memory.graph.empty_title":"메모리를 찾을 수 없음","memory.graph.empty_desc":"그래프를 넓히려면 필터를 조정하거나 검색을 지우거나 노드 제한을 늘리세요.","memory.none_selected_title":"선택된 메모리 없음","memory.none_selected_desc":"메타데이터, 리비전 기반 세부 정보, 번들 멤버십을 검사하려면 그래프에서 노드를 선택하세요.","memory.err.load":"메모리 그래프 로드 실패","assets.kicker":"운영","assets.title":"자산","assets.search_placeholder":"자산 검색…","assets.project":"프로젝트","assets.up":"위로","assets.err.load":"Kumiho 프로젝트 로드에 실패했습니다. Kumiho API에 연결할 수 있는지 확인하세요.","assets.col.name":"이름","assets.col.kind":"종류","assets.col.author":"작성자","assets.col.created":"생성됨","assets.loading.projects":"프로젝트 로드 중…","assets.loading.space":"공간 로드 중…","assets.loading.generic":"로딩 중…","assets.folder":"폴더","assets.empty.title":"빈 공간","assets.empty.desc":"이 위치에 폴더나 자산이 없습니다.","assets.search.empty_title":"결과 없음","assets.search.empty_desc":'"{query}"과(와) 일치하는 자산이 없습니다.',"assets.search.result_count":'"{query}"의 결과 {count}개',"assets.copy_kref":"kref 복사","assets.close_inspector":"인스펙터 닫기","assets.deprecated":"사용 중단됨","assets.active":"활성","assets.rev_count":"리비전 {count}개","assets.rev_count_one":"리비전 {count}개","assets.by":"작성자: {author}","assets.section.revisions":"리비전","assets.section.artifacts":"아티팩트","assets.section.edges":"엣지","assets.section.metadata":"메타데이터","assets.section.revisions_empty":"리비전 없음.","assets.section.artifacts_empty":"아티팩트 없음.","assets.section.edges_empty":"엣지 없음.","assets.section.metadata_empty":"메타데이터 없음.","assets.tag.latest":"최신","assets.tag.published":"게시됨","assets.action.view":"보기","assets.action.edit":"편집","assets.action.restore":"복원","assets.action.deprecate":"사용 중단","assets.action.publish":"게시","assets.action.published":"게시됨","assets.action.save_artifact":"아티팩트 저장","assets.action.deprecate_item":"선택한 항목 사용 중단","assets.action.restore_item":"선택한 항목 복원","assets.action.deprecate_revision":"선택한 리비전 사용 중단","assets.action.restore_revision":"선택한 리비전 복원","assets.action.publish_revision":"선택한 리비전을 게시됨으로 태그","assets.action.edit_artifact":"아티팩트 편집","assets.action.deprecate_artifact":"아티팩트 사용 중단","assets.action.restore_artifact":"아티팩트 복원","assets.toast.item_deprecated":"항목을 사용 중단했습니다.","assets.toast.item_restored":"항목을 복원했습니다.","assets.toast.revision_deprecated":"리비전을 사용 중단했습니다.","assets.toast.revision_restored":"리비전을 복원했습니다.","assets.toast.revision_published":"리비전을 게시됨으로 태그했습니다.","assets.toast.artifact_deprecated":"아티팩트를 사용 중단했습니다.","assets.toast.artifact_restored":"아티팩트를 복원했습니다.","assets.toast.artifact_saved":"아티팩트 내용을 업데이트했습니다.","assets.toast.artifact_saved_new_revision":"업데이트된 아티팩트를 첨부한 새 리비전을 만들었습니다.","assets.err.action":"자산 작업에 실패했습니다.","assets.err.load_artifact":"아티팩트 내용을 불러오지 못했습니다.","assets.editor.title":"{name} 편집","assets.editor.mutable_desc":"저장하면 현재 리비전의 아티팩트 파일을 업데이트합니다.","assets.editor.published_desc":"이 리비전은 게시되어 변경할 수 없습니다. 저장하면 업데이트된 아티팩트를 첨부한 새 리비전을 만듭니다.","config.kicker":"운영","config.page_title":"구성","config.reload":"다시 로드","config.save_button":"구성 저장","config.saving_button":"저장 중…","config.loading_title":"구성 로드 중…","config.toast.saved":"구성이 저장되었습니다.","config.err.load":"구성 로드 실패.","config.err.save":"구성 저장 실패.","config.err.mcp_errors":"저장하기 전에 MCP 서버 오류를 수정하세요.","config.map":"구성 맵","config.workspace":"TOML 작업 공간","config.workspace.structured_heading":"구조화된 컨트롤","config.workspace.source_heading":"소스 편집기","config.tab.structured":"구조화","config.tab.source":"소스","config.tabs_aria":"구성 작업 공간 탭","config.hide_preview":"미리보기 숨기기","config.show_preview":"미리보기 표시","config.mapped_paths":"매핑된 TOML 경로","config.structured.error_title":"구조화된 컨트롤을 구성할 수 없음","config.structured.error_desc":"그룹화된 구성 컨트롤을 표시하려면 원시 TOML을 파싱할 수 있어야 합니다.","config.summary.title":"파싱된 요약","config.summary.error_title":"TOML을 파싱할 수 없음","config.summary.error_desc":"요약 패널은 편집기에 파싱 가능한 TOML 섹션이 있을 때만 업데이트됩니다.","config.source_health":"소스 상태","config.row.workspace_mode":"작업 공간 모드","config.row.preview":"미리보기","config.row.sections":"섹션","config.row.parse_status":"파싱 상태","config.row.parse_valid":"유효","config.row.parse_needs":"확인 필요","config.mode.structured":"구조화","config.mode.source":"소스","config.toggle.enabled":"활성화됨","config.toggle.disabled":"비활성화됨","config.section.provider":"프로바이더","config.section.provider_desc":"기본 모델 프로바이더, API 라우팅, 생성 튜닝.","config.section.agent":"에이전트","config.section.agent_desc":"에이전트 런타임을 위한 루프 제한, 컨텍스트 예산, 추론 기본값.","config.section.memory":"메모리","config.section.memory_desc":"메모리 백엔드, Kumiho 연결, 영속성 동작.","config.section.runtime":"런타임","config.section.runtime_desc":"게이트웨이 바인딩 설정, 페어링, 자율성 정책.","config.section.security":"보안/비용","config.section.security_desc":"감사 및 샌드박스 설정과 비용 한도 제어.","config.section.channels":"채널","config.section.channels_desc":"운영 채널을 위한 CLI 및 메시징 표면 동작.","config.section.mcp":"MCP 서버","config.section.mcp_desc":"Model Context Protocol 클라이언트 — 최상위 토글 및 구조화된 서버 항목.","config.section.extra_desc":"config.toml에서 발견된 추가 섹션 — 범용 편집기.","config.generic.empty":"이 섹션에는 아직 필드가 없습니다.","config.generic.empty_array":"(빈 배열)","config.generic.array_readonly":"배열은 범용 편집기에서 읽기 전용입니다 — 소스 탭에서 편집하세요.","config.provider.default_provider":"기본 프로바이더","config.provider.default_model":"기본 모델","config.provider.temperature":"온도","config.provider.timeout":"프로바이더 타임아웃","config.provider.max_tokens":"프로바이더 최대 토큰","config.agent.max_tool_iterations":"최대 도구 반복","config.agent.max_context_tokens":"최대 컨텍스트 토큰","config.agent.max_history_messages":"최대 기록 메시지","config.agent.gpt55_context_window":"GPT-5.5 컨텍스트 창","config.agent.context_window_safety_ratio":"컨텍스트 안전 비율","config.agent.parallel_tools":"병렬 도구","config.agent.thinking_level":"사고 수준","config.memory.kumiho_enabled":"Kumiho 활성화","config.memory.memory_project":"메모리 프로젝트","config.memory.harness_project":"Harness 프로젝트","config.memory.retrieval_limit":"검색 제한","config.memory.backend":"메모리 백엔드","config.memory.auto_save":"자동 저장","config.memory.snapshots":"스냅샷","config.runtime.gateway_host":"게이트웨이 호스트","config.runtime.gateway_port":"게이트웨이 포트","config.runtime.require_pairing":"페어링 필요","config.runtime.session_persistence":"세션 영속성","config.runtime.autonomy_level":"자율성 수준","config.runtime.max_actions_hour":"시간당 최대 액션","config.security.audit_enabled":"감사 활성화","config.security.sandbox_backend":"샌드박스 백엔드","config.security.daily_limit":"일일 한도 USD","config.security.monthly_limit":"월별 한도 USD","config.security.warn_percent":"경고 백분율","config.channels.cli":"CLI 채널","config.channels.ack_reactions":"확인 반응","config.channels.show_tool_calls":"도구 호출 표시","config.channels.message_timeout":"메시지 타임아웃 초","config.summary.api_url":"API URL","config.summary.provider":"프로바이더","config.summary.model":"모델","config.summary.temperature":"온도","config.summary.timeout":"타임아웃","config.summary.max_tokens":"최대 토큰","config.summary.runtime":"런타임","config.summary.gateway":"게이트웨이","config.summary.pairing_required":"페어링 필요","config.summary.session_persistence":"세션 영속성","config.summary.autonomy_level":"자율성 수준","config.summary.workspace_only":"작업 공간 전용","config.summary.max_actions_hour":"시간당 최대 액션","config.summary.memory":"메모리","config.summary.backend":"백엔드","config.summary.auto_save":"자동 저장","config.summary.hygiene":"정리","config.summary.snapshots":"스냅샷","config.summary.kumiho_enabled":"Kumiho 활성화","config.summary.memory_project":"메모리 프로젝트","config.summary.retrieval_limit":"검색 제한","config.summary.safety_cost":"안전/비용","config.summary.audit_enabled":"감사 활성화","config.summary.sandbox_backend":"샌드박스 백엔드","config.summary.daily_limit":"일일 한도","config.summary.monthly_limit":"월별 한도","config.summary.warn_percent":"경고 %","config.summary.channels":"채널","config.summary.cli":"CLI","config.summary.telegram":"Telegram","config.summary.discord":"Discord","config.summary.slack":"Slack","config.summary.matrix":"Matrix","config.summary.signal":"Signal","config.summary.whatsapp":"WhatsApp","config.row.enabled":"활성화됨","config.row.disabled":"비활성화됨","config.mcp.title":"MCP","config.mcp.enabled":"MCP 활성화","config.mcp.deferred":"지연 로딩","config.mcp.servers":"서버","config.mcp.no_servers":"아직 구성된 서버가 없습니다.","config.mcp.server_count":"서버 {count}개가 구성되었습니다.","config.mcp.server_count_one":"서버 1개가 구성되었습니다.","config.mcp.add_server":"MCP 서버 추가","config.mcp.confirm_remove":"{label}을(를) 제거하시겠습니까?","config.mcp.entry_label":"항목 {index}","config.mcp.server_default":"서버 {index}","config.mcp.stdio_empty":"stdio — 명령이 설정되지 않음","config.mcp.transport_empty":"{transport} — url이 설정되지 않음","config.mcp.test":"테스트","config.mcp.testing":"테스트 중…","config.mcp.test_tooltip":"MCP initialize + tools/list 핸드셰이크 실행","config.mcp.test_blocked":"테스트하기 전에 유효성 검사 오류를 수정하세요","config.mcp.delete_label":"{label} 삭제","config.mcp.connecting":"연결 중…","config.mcp.tool_count":"도구 {count}개 · {latency}ms","config.mcp.tool_count_one":"도구 1개 · {latency}ms","config.mcp.tools_list":"도구: {list}","config.mcp.handshake_failed":"핸드셰이크 실패","config.mcp.field_name":"이름","config.mcp.field_name_placeholder":"예: memory","config.mcp.field_transport":"전송","config.mcp.field_command":"명령","config.mcp.field_command_placeholder":"/usr/local/bin/mcp-server","config.mcp.field_args":"인수","config.mcp.field_args_placeholder":"--flag","config.mcp.field_env":"환경 변수","config.mcp.field_env_key":"KEY","config.mcp.field_env_value":"value","config.mcp.field_url":"URL","config.mcp.field_url_placeholder":"https://example.com/mcp","config.mcp.field_headers":"헤더","config.mcp.field_headers_key":"Header-Name","config.mcp.field_headers_value":"value","config.mcp.field_timeout":"타임아웃 (ms)","config.mcp.field_timeout_placeholder":"30000","config.mcp.add_entry":"{label} 추가","config.mcp.remove_entry":"{label} 항목 {index} 제거","landing.skip_link":"본문으로 건너뛰기","landing.nav.aria_label":"사이트 탐색","landing.nav.logo_alt":"Revka 로고","landing.nav.features":"기능","landing.nav.launch":"대시보드 열기","landing.hero.aria_label":"대표 영역","landing.hero.badge":"메모리 네이티브 · Rust 네이티브 · 그래프 네이티브","landing.hero.tagline":"메모리 네이티브 에이전트 런타임","landing.hero.description":"Kumiho의 그래프 네이티브 메모리를 기반으로 구축되었습니다. 모든 세션, 계획, 스킬, 신뢰 점수가 그래프에 저장되며 — 일어난 일이라면 언제든 조회할 수 있습니다.","landing.hero.cta_primary":"대시보드 열기","landing.hero.cta_secondary":"기능 살펴보기","landing.hero.banner_alt":"Revka — 메모리 네이티브 에이전트 런타임 대시보드","landing.hero.scroll_cue":"스크롤","landing.stats.aria_label":"주요 지표","landing.stats.runtime_label":"런타임","landing.stats.namespaces_label":"네임스페이스","landing.stats.memory_label":"메모리 그래프","landing.stats.goals_label":"목표 추적","landing.stats.orchestration_label":"오케스트레이션","landing.pillars.aria_label":"세 가지 축","landing.pillars.badge":"세 가지 축","landing.pillars.title":"하나의 런타임, 어떤 표면에서든","landing.pillars.description":"Revka는 세 가지 기반 위에 구축됩니다 — 공급자 중립 에이전트, 그래프 네이티브 메모리, 그리고 모든 채널을 통한 전달입니다.","landing.pillars.agents.title":"에이전트","landing.pillars.agents.desc":"공급자에 구애받지 않는 에이전트(OpenAI, Anthropic, 로컬 모델)를 워크플로와 스웜으로 오케스트레이션합니다 — 모두 사용자 기기에서 실행됩니다.","landing.pillars.memory.title":"메모리","landing.pillars.memory.desc":"Kumiho, SQLite 또는 Markdown을 통해 세션 전반에 걸친 지속적인 지식을 유지합니다. 에이전트가 사용자와 프로젝트, 이전 결정을 기억합니다.","landing.pillars.channels.title":"채널","landing.pillars.channels.desc":"Telegram, Discord, Slack, iMessage, Matrix, 이메일 등 다양한 채널에서 Revka와 대화하세요. 하나의 런타임, 어떤 표면에서든.","landing.features.aria_label":"기능","landing.features.badge":"역량","landing.features.title":"에이전트 시대를 위한 설계","landing.features.description":"모든 구성 요소는 지속적 메모리와 다중 에이전트 협업을 중심으로 설계되었습니다 — 생성에서 은퇴까지.","landing.features.featured_badge":"핵심 메모리 기반","landing.features.memory.title":"Kumiho 메모리","landing.features.memory.desc":"그래프 네이티브 지속 메모리입니다. 모든 세션, 계획, 스킬이 버전 관리되고 연결되어 조회 가능하며, 대체 백엔드는 사용하지 않습니다.","landing.features.operator.title":"Operator","landing.features.operator.desc":"역할 위임(코더, 리뷰어, 연구원), 회상을 동반한 스폰, 신뢰 점수 기능을 갖춘 다중 에이전트 오케스트레이션입니다.","landing.features.pool.title":"에이전트 풀","landing.features.pool.desc":"역할, 역량, 모델 선호도를 포함한 재사용 가능한 에이전트 정의입니다. 사용량 추적으로 성과가 좋은 에이전트를 먼저 노출합니다.","landing.features.clawhub.title":"ClawHub 마켓플레이스","landing.features.clawhub.desc":"공유 레지스트리에서 에이전트 템플릿, 스킬, 팀 구성을 게시하고 검색하고 설치합니다.","landing.features.goals.title":"목표 계층","landing.features.goals.desc":"전략적, 전술적, 작업 단위의 3계층 목표 추적 — 모두 상태와 의존성과 함께 그래프에 저장됩니다.","landing.features.audit.title":"감사 추적","landing.features.audit.desc":"머클 해시 체인 기반의 변조 방지 로깅입니다. 모든 행동이 암호학적으로 검증 가능한 이력으로 기록됩니다.","landing.how.aria_label":"작동 방식","landing.how.badge":"워크플로","landing.how.title":"Revka는 이렇게 동작합니다","landing.how.description":"에이전트 배포부터 지속적 회상까지 — 전체 생애주기를 세 단계로 일관되게 관리합니다.","landing.how.step1.title":"에이전트 배포하기","landing.how.step1.desc":"역할, 역량, 모델 선호도를 설정합니다. Revka는 템플릿을 그래프에 저장해 재사용과 회상이 가능하도록 합니다.","landing.how.step2.title":"메모리가 축적됩니다","landing.how.step2.desc":"모든 세션, 계획, 스킬, 상호작용이 Kumiho에서 버전 관리되고 엣지로 연결됩니다. 어떤 것도 사라지지 않습니다.","landing.how.step3.title":"모든 것을 조회하기","landing.how.step3.desc":"목표 계층, 신뢰 점수, 그래프 탐색을 활용해 모든 에이전트 이력에서 통찰을 끌어냅니다.","landing.cli.aria_label":"CLI 참조","landing.cli.badge":"CLI","landing.cli.title":"터미널에서 제어하세요","landing.cli.description":"대시보드와 채널이 응답하려면 데몬이 실행 중이어야 합니다. UI에서 할 수 있는 모든 작업은 명령어로도 매핑됩니다.","landing.cli.cmd.onboard":"대화형 초기 설정 마법사 실행","landing.cli.cmd.reinit":"처음부터 초기화하고 재구성 (터널 포함)","landing.cli.cmd.daemon":"장기 실행 런타임 시작","landing.cli.cmd.doctor":"데몬, 스케줄러, 채널 상태 확인","landing.cli.cmd.status":"전체 시스템 상태 출력","landing.cli.cmd.channel_list":"구성된 채널 목록 보기","landing.cli.cmd.channel_add":"Telegram 봇 추가","landing.cli.cmd.providers":"지원되는 AI 공급자 목록 보기","landing.cli.cmd.memory_stats":"에이전트 메모리 크기 확인","landing.cli.cmd.service_install":"launchd/systemd 사용자 서비스로 설치","landing.arch.aria_label":"아키텍처","landing.arch.badge":"그래프 네이티브","landing.arch.title":"모든 것이 그래프 안에","landing.arch.description":"모든 지속 상태는 Kumiho의 엄격한 네임스페이스 계층 아래에 저장됩니다 — 버전 관리되고, 엣지로 연결되며, 세션 간에 조회할 수 있습니다.","landing.arch.ns.agentpool":"재사용 가능한 에이전트 템플릿","landing.arch.ns.plans":"실행 계획 및 단계","landing.arch.ns.sessions":"세션 간 연속성","landing.arch.ns.goals":"전략적 목표 추적","landing.arch.ns.clawhub":"게시된 템플릿과 스킬","landing.arch.ns.teams":"팀 정의","landing.arch.ns.skills":"공유 스킬 라이브러리","landing.arch.ns.trust":"신뢰 점수와 이력","landing.arch.connection_note":"모든 네임스페이스가 Kumiho 그래프 엣지로 연결되어 있습니다","landing.tunnels.aria_label":"터널 안내","landing.tunnels.badge":"터널","landing.tunnels.title":"공개 도달, 로컬 신뢰","landing.tunnels.description_prefix":"게이트웨이는 ","landing.tunnels.description_suffix":" 에서 실행되며 — 이 기기에서만 접근할 수 있습니다. 웹훅 기반 채널(Telegram, Slack 이벤트, WhatsApp, WeChat)은 공개 URL이 필요합니다. 터널은 방화벽 포트를 열지 않고도 공개 호스트명을 로컬 게이트웨이로 전달합니다.","landing.tunnels.provider.cloudflare.name":"Cloudflare Tunnel","landing.tunnels.provider.cloudflare.desc":"무료이며 프로덕션 수준입니다. Zero Trust 계정과 터널 토큰이 필요합니다.","landing.tunnels.provider.ngrok.name":"ngrok","landing.tunnels.provider.ngrok.desc":"빠르고 일시적입니다. 로컬 개발과 테스트에 적합합니다.","landing.tunnels.provider.tailscale.name":"Tailscale Funnel","landing.tunnels.provider.tailscale.desc":"tailnet 신원을 이용해 tailnet 서비스를 공개적으로 공유합니다.","landing.tunnels.provider.custom.name":"사용자 지정","landing.tunnels.provider.custom.desc":"직접 준비한 리버스 프록시나 공개 URL을 사용합니다.","landing.tunnels.setup_hint_prefix":"다음 명령을 실행하세요: ","landing.tunnels.setup_hint_suffix":" 그리고 안내에 따라 공급자를 선택하세요.","landing.cta.aria_label":"시작하기","landing.cta.headline_prefix":"이제 ","landing.cta.headline_highlight":"구축을 시작할","landing.cta.headline_suffix":" 준비가 되셨나요?","landing.cta.description":"대시보드를 열어 에이전트를 관리하고, 스킬 라이브러리를 둘러보고, 팀을 오케스트레이션하며, 그래프가 기억하는 모든 것을 탐색해 보세요.","landing.cta.button":"대시보드 열기","landing.footer.tagline":"메모리 네이티브 에이전트 런타임"}};let Mz="en";function CO(e){Mz=e}function Xs(e){var n;return((n=nb[Mz])==null?void 0:n[e])??nb.en[e]??e}function Rz(e,n){var r;return((r=nb[n])==null?void 0:r[e])??nb.en[e]??e}function qee(e,n,r={}){return Uee(Rz(e,n),r)}function Uee(e,n){return e.replace(/\{(\w+)\}/g,(r,i)=>Object.prototype.hasOwnProperty.call(n,i)?String(n[i]):r)}const Oz=[{code:"en",label:"English"},{code:"zh",label:"中文"},{code:"tr",label:"Türkçe"},{code:"ko",label:"한국어"}];function an(){var o;const{locale:e,setAppLocale:n}=tLe(),r=((o=Oz.find(l=>l.code===e))==null?void 0:o.code)??"en",i=b.useCallback(l=>Rz(l,r),[r]),s=b.useCallback((l,u)=>qee(l,r,u),[r]),a=b.useCallback(l=>n(l),[n]);return b.useMemo(()=>({locale:r,t:i,tpl:s,setLocale:a}),[r,i,s,a])}function bs(e=.1){const n=b.useRef(null),[r,i]=b.useState(()=>typeof window<"u"?window.matchMedia("(prefers-reduced-motion: reduce)").matches:!1);return b.useEffect(()=>{const s=n.current;if(!s)return;const a=new IntersectionObserver(o=>{const l=o[0];l!=null&&l.isIntersecting&&(i(!0),a.unobserve(s))},{threshold:e});return a.observe(s),()=>a.disconnect()},[e]),{ref:n,visible:r}}function Kee(e=.18){const[n,r]=b.useState(0),i=typeof window<"u"?window.matchMedia("(prefers-reduced-motion: reduce)").matches:!0;return b.useEffect(()=>{if(i)return;const s=()=>r(window.scrollY*e);return window.addEventListener("scroll",s,{passive:!0}),()=>window.removeEventListener("scroll",s)},[e,i]),n}const Vee=[{id:"memory",icon:ng,titleKey:"landing.features.memory.title",descKey:"landing.features.memory.desc",color:"#8fa8c8",featured:!0},{id:"operator",icon:Df,titleKey:"landing.features.operator.title",descKey:"landing.features.operator.desc",color:"#6f83d6",featured:!1},{id:"pool",icon:Ql,titleKey:"landing.features.pool.title",descKey:"landing.features.pool.desc",color:"#6575d3",featured:!1},{id:"clawhub",icon:Nz,titleKey:"landing.features.clawhub.title",descKey:"landing.features.clawhub.desc",color:"#f59e0b",featured:!1},{id:"goals",icon:Az,titleKey:"landing.features.goals.title",descKey:"landing.features.goals.desc",color:"#2fbf75",featured:!1},{id:"audit",icon:jz,titleKey:"landing.features.audit.title",descKey:"landing.features.audit.desc",color:"#ff4466",featured:!1}],Yee=[{ns:"Revka/AgentPool/",purposeKey:"landing.arch.ns.agentpool",icon:Ql},{ns:"Revka/Plans/",purposeKey:"landing.arch.ns.plans",icon:Az},{ns:"Revka/Sessions/",purposeKey:"landing.arch.ns.sessions",icon:AC},{ns:"Revka/Goals/",purposeKey:"landing.arch.ns.goals",icon:$E},{ns:"Revka/ClawHub/",purposeKey:"landing.arch.ns.clawhub",icon:Nz},{ns:"Revka/Teams/",purposeKey:"landing.arch.ns.teams",icon:Df},{ns:"CognitiveMemory/Skills/",purposeKey:"landing.arch.ns.skills",icon:b0},{ns:"Revka/AgentTrust/",purposeKey:"landing.arch.ns.trust",icon:jz}],Gee=[{value:"Rust",labelKey:"landing.stats.runtime_label"},{value:"8",labelKey:"landing.stats.namespaces_label"},{value:"Neo4j",labelKey:"landing.stats.memory_label"},{value:"3-tier",labelKey:"landing.stats.goals_label"},{value:"MCP",labelKey:"landing.stats.orchestration_label"}],Xee=[{id:"agents",icon:Ul,titleKey:"landing.pillars.agents.title",descKey:"landing.pillars.agents.desc",color:"#6f83d6"},{id:"memory",icon:ng,titleKey:"landing.pillars.memory.title",descKey:"landing.pillars.memory.desc",color:"#8fa8c8"},{id:"channels",icon:eb,titleKey:"landing.pillars.channels.title",descKey:"landing.pillars.channels.desc",color:"#6575d3"}],Qee=[{cmd:"revka onboard",descKey:"landing.cli.cmd.onboard"},{cmd:"revka onboard --reinit",descKey:"landing.cli.cmd.reinit"},{cmd:"revka daemon",descKey:"landing.cli.cmd.daemon"},{cmd:"revka doctor",descKey:"landing.cli.cmd.doctor"},{cmd:"revka status",descKey:"landing.cli.cmd.status"},{cmd:"revka channel list",descKey:"landing.cli.cmd.channel_list"},{cmd:`revka channel add telegram '{"bot_token":"..."}'`,descKey:"landing.cli.cmd.channel_add"},{cmd:"revka providers",descKey:"landing.cli.cmd.providers"},{cmd:"revka memory stats",descKey:"landing.cli.cmd.memory_stats"},{cmd:"revka service install",descKey:"landing.cli.cmd.service_install"}],Zee=[{id:"cloudflare",nameKey:"landing.tunnels.provider.cloudflare.name",descKey:"landing.tunnels.provider.cloudflare.desc"},{id:"ngrok",nameKey:"landing.tunnels.provider.ngrok.name",descKey:"landing.tunnels.provider.ngrok.desc"},{id:"tailscale",nameKey:"landing.tunnels.provider.tailscale.name",descKey:"landing.tunnels.provider.tailscale.desc"},{id:"custom",nameKey:"landing.tunnels.provider.custom.name",descKey:"landing.tunnels.provider.custom.desc"}],jO=[{step:"01",icon:UE,titleKey:"landing.how.step1.title",descKey:"landing.how.step1.desc",color:"#8fa8c8"},{step:"02",icon:Td,titleKey:"landing.how.step2.title",descKey:"landing.how.step2.desc",color:"#6f83d6"},{step:"03",icon:Da,titleKey:"landing.how.step3.title",descKey:"landing.how.step3.desc",color:"#6575d3"}];function Jee({icon:e,title:n,desc:r,color:i,delay:s,featured:a,featuredBadge:o}){const{ref:l,visible:u}=bs(.08);return c.jsxs("div",{ref:l,className:["card feature-card p-6 flex flex-col",a?"feature-card--featured":""].join(" "),style:{opacity:u?1:0,transform:u?"translateY(0)":"translateY(28px)",transition:`opacity 0.55s ease ${s}ms, transform 0.55s ease ${s}ms`},children:[c.jsx("div",{className:"inline-flex h-11 w-11 items-center justify-center rounded-2xl mb-4 flex-shrink-0",style:{background:`${i}1a`,border:`1px solid ${i}33`},children:c.jsx(e,{className:"h-5 w-5",style:{color:i}})}),c.jsx("h3",{className:"font-semibold text-base mb-2",style:{color:"var(--pc-text-primary)"},children:n}),c.jsx("p",{className:"text-sm leading-relaxed flex-1",style:{color:"var(--pc-text-muted)"},children:r}),a&&c.jsxs("div",{className:"mt-5 pt-4 flex items-center gap-2 text-xs font-medium",style:{borderTop:`1px solid ${i}22`,color:i},children:[c.jsx(A0,{className:"h-3 w-3"}),o]})]})}function ete({ns:e,purpose:n,icon:r,delay:i}){const{ref:s,visible:a}=bs(.05);return c.jsxs("div",{ref:s,className:"glass-card px-4 py-3.5 flex items-start gap-3",style:{opacity:a?1:0,transform:a?"translateX(0)":"translateX(-16px)",transition:`opacity 0.5s ease ${i}ms, transform 0.5s ease ${i}ms`},children:[c.jsx(r,{className:"h-4 w-4 mt-0.5 flex-shrink-0",style:{color:"var(--pc-accent)"}}),c.jsxs("div",{className:"min-w-0",children:[c.jsx("code",{className:"text-xs font-mono block mb-0.5 truncate",style:{color:"var(--pc-accent-light)"},children:e}),c.jsx("span",{className:"text-xs",style:{color:"var(--pc-text-muted)"},children:n})]})]})}function tte({step:e,icon:n,title:r,desc:i,color:s,delay:a,isLast:o}){const{ref:l,visible:u}=bs(.1);return c.jsxs("div",{ref:l,className:"how-step relative flex flex-col items-center text-center",style:{opacity:u?1:0,transform:u?"translateY(0)":"translateY(24px)",transition:`opacity 0.6s ease ${a}ms, transform 0.6s ease ${a}ms`},children:[c.jsx("div",{className:"how-step-num mb-4 text-xs font-mono font-bold tracking-widest",style:{color:`${s}99`},children:e}),c.jsx("div",{className:"how-step-icon mb-5",style:{background:`${s}14`,border:`1px solid ${s}33`,boxShadow:`0 0 32px ${s}18`},children:c.jsx(n,{className:"h-7 w-7",style:{color:s}})}),c.jsx("h3",{className:"font-semibold text-lg mb-2",style:{color:"var(--pc-text-primary)"},children:r}),c.jsx("p",{className:"text-sm leading-relaxed max-w-xs",style:{color:"var(--pc-text-muted)"},children:i}),!o&&c.jsx("div",{className:"how-step-connector",style:{background:`linear-gradient(90deg, ${s}44, transparent)`},"aria-hidden":"true"})]})}function nte(){const e=vv(),{t:n}=an(),[r,i]=b.useState(!1),s=b.useRef(null),a=Kee(.12);b.useEffect(()=>{const H=()=>i(window.scrollY>48);return window.addEventListener("scroll",H,{passive:!0}),()=>window.removeEventListener("scroll",H)},[]);const{ref:o,visible:l}=bs(.01),{ref:u,visible:d}=bs(.01),{ref:p,visible:f}=bs(.01),{ref:g,visible:_}=bs(.1),{ref:x,visible:v}=bs(.08),{ref:S,visible:w}=bs(.08),{ref:j,visible:C}=bs(.08),{ref:T,visible:E}=bs(.08),{ref:A,visible:O}=bs(.08),{ref:F,visible:L}=bs(.08),{ref:$,visible:z}=bs(.1),B=b.useCallback(()=>{var D;const H=window.matchMedia("(prefers-reduced-motion: reduce)").matches;(D=s.current)==null||D.scrollIntoView({behavior:H?"auto":"smooth"})},[]);return c.jsxs("div",{className:"landing-page min-h-screen overflow-x-hidden",style:{background:"var(--pc-bg-base)",color:"var(--pc-text-primary)"},children:[c.jsx("a",{href:"#main-content",className:"skip-link",children:n("landing.skip_link")}),c.jsxs("nav",{className:["landing-nav sticky top-0 z-50 flex items-center justify-between px-6 py-4",r?"landing-nav--scrolled":""].join(" "),"aria-label":n("landing.nav.aria_label"),children:[c.jsxs("div",{className:"flex items-center gap-2.5",children:[c.jsx("img",{src:fd("revka-icon.png"),alt:n("landing.nav.logo_alt"),className:"revka-brand-logo h-8 w-8 rounded-xl object-contain",onError:H=>{H.currentTarget.style.display="none"}}),c.jsx("span",{className:"font-bold text-base tracking-tight",children:"Revka"})]}),c.jsxs("div",{className:"flex items-center gap-3",children:[c.jsx("button",{onClick:B,className:"hidden sm:block text-sm font-medium transition-colors",style:{color:"var(--pc-text-muted)"},onMouseEnter:H=>{H.currentTarget.style.color="var(--pc-text-primary)"},onMouseLeave:H=>{H.currentTarget.style.color="var(--pc-text-muted)"},children:n("landing.nav.features")}),c.jsxs("button",{onClick:()=>e("/dashboard"),className:"btn-electric flex items-center gap-1.5 px-5 py-2 text-sm font-semibold",children:[n("landing.nav.launch"),c.jsx(_f,{className:"h-3.5 w-3.5"})]})]})]}),c.jsxs("main",{id:"main-content",children:[c.jsxs("section",{className:"hero-section relative flex min-h-[96vh] flex-col items-center justify-center px-4 pt-12 pb-0 overflow-hidden","aria-label":n("landing.hero.aria_label"),children:[c.jsx("div",{className:"hero-orb hero-orb-1","aria-hidden":"true"}),c.jsx("div",{className:"hero-orb hero-orb-2","aria-hidden":"true"}),c.jsx("div",{className:"hero-orb hero-orb-3","aria-hidden":"true"}),c.jsxs("div",{ref:o,className:"shell-chip mb-7",style:{opacity:l?1:0,transform:l?"translateY(0)":"translateY(-12px)",transition:"opacity 0.7s ease, transform 0.7s ease"},children:[c.jsx(A0,{className:"h-3 w-3"}),n("landing.hero.badge")]}),c.jsxs("div",{ref:u,className:"text-center mb-10",style:{opacity:d?1:0,transform:d?"translateY(0)":"translateY(20px)",transition:"opacity 0.7s ease 0.1s, transform 0.7s ease 0.1s"},children:[c.jsx("h1",{className:"text-5xl font-bold mb-4 tracking-tight sm:text-6xl lg:text-7xl xl:text-8xl",children:c.jsx("span",{className:"text-gradient-fox text-gradient-fox--shimmer",children:"Revka"})}),c.jsx("p",{className:"text-xl mb-3 max-w-xl mx-auto font-medium sm:text-2xl",style:{color:"var(--pc-text-secondary)"},children:n("landing.hero.tagline")}),c.jsx("p",{className:"text-base mb-10 max-w-lg mx-auto leading-relaxed",style:{color:"var(--pc-text-muted)"},children:n("landing.hero.description")}),c.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:justify-center",children:[c.jsxs("button",{onClick:()=>e("/dashboard"),className:"btn-electric flex items-center justify-center gap-2 px-8 py-3.5 text-base font-semibold rounded-2xl",children:[n("landing.hero.cta_primary"),c.jsx(_f,{className:"h-4 w-4"})]}),c.jsx("button",{onClick:B,className:"shell-pill-button flex items-center justify-center gap-2 px-8 py-3.5 text-base font-semibold rounded-2xl",children:n("landing.hero.cta_secondary")})]})]}),c.jsxs("div",{ref:p,className:"hero-banner-wrap relative w-full",style:{opacity:f?1:0,transform:f?`translateY(${a}px)`:`scale(0.94) translateY(${16+a}px)`,transition:f?"opacity 0.9s ease 0.25s":"opacity 0.9s ease 0.25s, transform 0.9s ease 0.25s"},children:[c.jsx("img",{src:fd("revka-banner.png"),alt:n("landing.hero.banner_alt"),className:"hero-banner hero-banner--v2",onError:H=>{H.currentTarget.style.display="none"}}),c.jsx("div",{className:"hero-banner-glow","aria-hidden":"true"}),c.jsx("div",{className:"hero-banner-fade","aria-hidden":"true"})]}),c.jsxs("div",{className:"absolute bottom-8 left-1/2 -translate-x-1/2 flex flex-col items-center gap-2","aria-hidden":"true",style:{opacity:d?.4:0,transition:"opacity 1s ease 1.5s"},children:[c.jsx("span",{className:"text-xs tracking-widest uppercase",style:{color:"var(--pc-text-faint)"},children:n("landing.hero.scroll_cue")}),c.jsx("div",{className:"scroll-cue-line"})]})]}),c.jsx("section",{className:"stats-strip relative px-4 py-12","aria-label":n("landing.stats.aria_label"),children:c.jsx("div",{ref:g,className:"mx-auto max-w-4xl",style:{opacity:_?1:0,transform:_?"translateY(0)":"translateY(16px)",transition:"opacity 0.6s ease, transform 0.6s ease"},children:c.jsx("dl",{className:"stats-list",children:Gee.map((H,D)=>c.jsxs("div",{className:"stat-item",style:{opacity:_?1:0,transform:_?"translateY(0)":"translateY(12px)",transition:`opacity 0.5s ease ${D*80}ms, transform 0.5s ease ${D*80}ms`},children:[c.jsx("dt",{className:"stat-value",children:H.value}),c.jsx("dd",{className:"stat-label",children:n(H.labelKey)})]},H.labelKey))})})}),c.jsx("section",{className:"pillars-section relative px-4 py-20","aria-label":n("landing.pillars.aria_label"),children:c.jsxs("div",{className:"mx-auto max-w-5xl",children:[c.jsxs("div",{ref:x,className:"mb-10 text-center",style:{opacity:v?1:0,transform:v?"translateY(0)":"translateY(20px)",transition:"opacity 0.6s ease, transform 0.6s ease"},children:[c.jsxs("div",{className:"shell-chip inline-flex mb-4",children:[c.jsx(UE,{className:"h-3 w-3"}),n("landing.pillars.badge")]}),c.jsx("h2",{className:"text-3xl font-bold mb-3 sm:text-4xl",style:{color:"var(--pc-text-primary)"},children:n("landing.pillars.title")}),c.jsx("p",{className:"text-base max-w-2xl mx-auto leading-relaxed",style:{color:"var(--pc-text-muted)"},children:n("landing.pillars.description")})]}),c.jsx("div",{className:"grid gap-4 sm:grid-cols-3",children:Xee.map((H,D)=>{const U=H.icon;return c.jsxs("div",{className:"card p-6 flex flex-col",style:{opacity:v?1:0,transform:v?"translateY(0)":"translateY(18px)",transition:`opacity 0.55s ease ${120+D*80}ms, transform 0.55s ease ${120+D*80}ms`},children:[c.jsx("div",{className:"inline-flex h-10 w-10 items-center justify-center rounded-2xl mb-4",style:{background:`${H.color}1a`,border:`1px solid ${H.color}33`},children:c.jsx(U,{className:"h-5 w-5",style:{color:H.color}})}),c.jsx("h3",{className:"font-semibold text-base mb-2",style:{color:"var(--pc-text-primary)"},children:n(H.titleKey)}),c.jsx("p",{className:"text-sm leading-relaxed",style:{color:"var(--pc-text-muted)"},children:n(H.descKey)})]},H.id)})})]})}),c.jsx("section",{ref:s,className:"features-section relative px-4 py-24","aria-label":n("landing.features.aria_label"),children:c.jsxs("div",{className:"mx-auto max-w-6xl",children:[c.jsxs("div",{ref:S,className:"mb-12 text-center",style:{opacity:w?1:0,transform:w?"translateY(0)":"translateY(20px)",transition:"opacity 0.6s ease, transform 0.6s ease"},children:[c.jsxs("div",{className:"shell-chip inline-flex mb-4",children:[c.jsx(FE,{className:"h-3 w-3"}),n("landing.features.badge")]}),c.jsx("h2",{className:"text-3xl font-bold mb-3 sm:text-4xl",style:{color:"var(--pc-text-primary)"},children:n("landing.features.title")}),c.jsx("p",{className:"text-base max-w-2xl mx-auto leading-relaxed",style:{color:"var(--pc-text-muted)"},children:n("landing.features.description")})]}),c.jsx("div",{className:"bento-grid",children:Vee.map((H,D)=>c.jsx("div",{className:H.featured?"bento-cell bento-cell--wide":"bento-cell",children:c.jsx(Jee,{icon:H.icon,title:n(H.titleKey),desc:n(H.descKey),color:H.color,featured:H.featured,delay:D*75,featuredBadge:n("landing.features.featured_badge")})},H.id))})]})}),c.jsxs("section",{className:"how-section relative px-4 py-24","aria-label":n("landing.how.aria_label"),children:[c.jsx("div",{className:"how-bg-orb","aria-hidden":"true"}),c.jsxs("div",{className:"mx-auto max-w-5xl",children:[c.jsxs("div",{ref:j,className:"mb-16 text-center",style:{opacity:C?1:0,transform:C?"translateY(0)":"translateY(20px)",transition:"opacity 0.6s ease, transform 0.6s ease"},children:[c.jsxs("div",{className:"shell-chip inline-flex mb-4",children:[c.jsx(Td,{className:"h-3 w-3"}),n("landing.how.badge")]}),c.jsx("h2",{className:"text-3xl font-bold mb-3 sm:text-4xl",style:{color:"var(--pc-text-primary)"},children:n("landing.how.title")}),c.jsx("p",{className:"text-base max-w-2xl mx-auto leading-relaxed",style:{color:"var(--pc-text-muted)"},children:n("landing.how.description")})]}),c.jsx("div",{className:"how-steps-grid",children:jO.map((H,D)=>c.jsx(tte,{step:H.step,icon:H.icon,title:n(H.titleKey),desc:n(H.descKey),color:H.color,delay:D*120,isLast:D===jO.length-1},H.step))})]})]}),c.jsx("section",{className:"cli-section relative px-4 py-24","aria-label":n("landing.cli.aria_label"),children:c.jsxs("div",{className:"mx-auto max-w-5xl",children:[c.jsxs("div",{ref:T,className:"mb-12 text-center",style:{opacity:E?1:0,transform:E?"translateY(0)":"translateY(20px)",transition:"opacity 0.6s ease, transform 0.6s ease"},children:[c.jsxs("div",{className:"shell-chip inline-flex mb-4",children:[c.jsx(jv,{className:"h-3 w-3"}),n("landing.cli.badge")]}),c.jsx("h2",{className:"text-3xl font-bold mb-3 sm:text-4xl",style:{color:"var(--pc-text-primary)"},children:n("landing.cli.title")}),c.jsx("p",{className:"text-base max-w-2xl mx-auto leading-relaxed",style:{color:"var(--pc-text-muted)"},children:n("landing.cli.description")})]}),c.jsx("div",{className:"grid gap-3 sm:grid-cols-2",children:Qee.map(({cmd:H,descKey:D},U)=>c.jsxs("div",{className:"glass-card px-4 py-3",style:{opacity:E?1:0,transform:E?"translateY(0)":"translateY(14px)",transition:`opacity 0.5s ease ${100+U*50}ms, transform 0.5s ease ${100+U*50}ms`},children:[c.jsx("code",{className:"text-xs font-mono block mb-1",style:{color:"var(--pc-accent-light)"},children:H}),c.jsx("span",{className:"text-xs",style:{color:"var(--pc-text-muted)"},children:n(D)})]},H))})]})}),c.jsxs("section",{className:"arch-section relative px-4 py-24","aria-label":n("landing.arch.aria_label"),children:[c.jsx("div",{className:"arch-bg-orb","aria-hidden":"true"}),c.jsxs("div",{className:"mx-auto max-w-5xl",children:[c.jsxs("div",{ref:A,className:"mb-12 text-center",style:{opacity:O?1:0,transform:O?"translateY(0)":"translateY(20px)",transition:"opacity 0.6s ease, transform 0.6s ease"},children:[c.jsxs("div",{className:"shell-chip inline-flex mb-4",children:[c.jsx(b0,{className:"h-3 w-3"}),n("landing.arch.badge")]}),c.jsx("h2",{className:"text-3xl font-bold mb-3 sm:text-4xl",style:{color:"var(--pc-text-primary)"},children:n("landing.arch.title")}),c.jsx("p",{className:"text-base max-w-2xl mx-auto leading-relaxed",style:{color:"var(--pc-text-muted)"},children:n("landing.arch.description")})]}),c.jsx("div",{className:"grid gap-3 sm:grid-cols-2 lg:grid-cols-4",children:Yee.map((H,D)=>c.jsx(ete,{ns:H.ns,purpose:n(H.purposeKey),icon:H.icon,delay:D*60},H.ns))}),c.jsx("div",{className:"arch-connect-bar mt-8","aria-hidden":"true"}),c.jsx("p",{className:"text-xs text-center mt-4",style:{color:"var(--pc-text-faint)"},children:n("landing.arch.connection_note")})]})]}),c.jsx("section",{className:"tunnels-section relative px-4 py-24","aria-label":n("landing.tunnels.aria_label"),children:c.jsxs("div",{className:"mx-auto max-w-4xl",children:[c.jsxs("div",{ref:F,className:"mb-10 text-center",style:{opacity:L?1:0,transform:L?"translateY(0)":"translateY(20px)",transition:"opacity 0.6s ease, transform 0.6s ease"},children:[c.jsxs("div",{className:"shell-chip inline-flex mb-4",children:[c.jsx($E,{className:"h-3 w-3"}),n("landing.tunnels.badge")]}),c.jsx("h2",{className:"text-3xl font-bold mb-3 sm:text-4xl",style:{color:"var(--pc-text-primary)"},children:n("landing.tunnels.title")}),c.jsxs("p",{className:"text-base max-w-2xl mx-auto leading-relaxed",style:{color:"var(--pc-text-muted)"},children:[n("landing.tunnels.description_prefix"),c.jsx("span",{className:"font-mono",style:{color:"var(--pc-accent-light)"},children:"127.0.0.1"}),n("landing.tunnels.description_suffix")]})]}),c.jsx("div",{className:"grid gap-3 sm:grid-cols-2",children:Zee.map((H,D)=>c.jsxs("div",{className:"glass-card px-4 py-4",style:{opacity:L?1:0,transform:L?"translateY(0)":"translateY(14px)",transition:`opacity 0.5s ease ${100+D*70}ms, transform 0.5s ease ${100+D*70}ms`},children:[c.jsx("div",{className:"text-sm font-semibold mb-1",style:{color:"var(--pc-text-primary)"},children:n(H.nameKey)}),c.jsx("p",{className:"text-xs leading-relaxed",style:{color:"var(--pc-text-muted)"},children:n(H.descKey)})]},H.id))}),c.jsxs("p",{className:"text-xs text-center mt-6",style:{color:"var(--pc-text-faint)"},children:[n("landing.tunnels.setup_hint_prefix"),c.jsx("span",{className:"font-mono",style:{color:"var(--pc-accent-light)"},children:"revka onboard --reinit"}),n("landing.tunnels.setup_hint_suffix")]})]})}),c.jsxs("section",{className:"cta-section relative px-4 py-32 text-center overflow-hidden","aria-label":n("landing.cta.aria_label"),children:[c.jsx("div",{className:"cta-orb-1","aria-hidden":"true"}),c.jsx("div",{className:"cta-orb-2","aria-hidden":"true"}),c.jsxs("div",{ref:$,className:"relative mx-auto max-w-2xl",style:{opacity:z?1:0,transform:z?"translateY(0) scale(1)":"translateY(24px) scale(0.97)",transition:"opacity 0.7s ease, transform 0.7s ease"},children:[c.jsx("img",{src:fd("revka-icon.png"),alt:"",className:"revka-brand-logo h-20 w-20 rounded-2xl object-contain mx-auto mb-6 animate-float","aria-hidden":"true",onError:H=>{H.currentTarget.style.display="none"}}),c.jsxs("h2",{className:"text-4xl font-bold mb-4 sm:text-5xl",style:{color:"var(--pc-text-primary)"},children:[n("landing.cta.headline_prefix"),c.jsx("span",{className:"text-gradient-fox",children:n("landing.cta.headline_highlight")}),n("landing.cta.headline_suffix")]}),c.jsx("p",{className:"text-base mb-10 max-w-xl mx-auto leading-relaxed",style:{color:"var(--pc-text-muted)"},children:n("landing.cta.description")}),c.jsxs("button",{onClick:()=>e("/dashboard"),className:"btn-electric inline-flex items-center gap-2 px-10 py-4 text-lg font-semibold rounded-2xl",children:[n("landing.cta.button"),c.jsx(_f,{className:"h-5 w-5"})]})]})]})]}),c.jsx("footer",{className:"landing-footer px-6 py-10",style:{borderTop:"1px solid var(--pc-border)"},children:c.jsxs("div",{className:"mx-auto max-w-5xl flex flex-col items-center gap-4 sm:flex-row sm:justify-between",children:[c.jsxs("div",{className:"flex items-center gap-2.5",children:[c.jsx("img",{src:fd("revka-icon.png"),alt:"",className:"revka-brand-logo h-6 w-6 rounded-lg object-contain","aria-hidden":"true",onError:H=>{H.currentTarget.style.display="none"}}),c.jsx("span",{className:"text-sm font-semibold",style:{color:"var(--pc-text-secondary)"},children:"Revka"})]}),c.jsx("div",{className:"flex items-center gap-2 flex-wrap justify-center",children:["Rust","React","Kumiho","Neo4j","MCP"].map(H=>c.jsx("span",{className:"footer-tech-chip",children:H},H))}),c.jsx("p",{className:"text-xs",style:{color:"var(--pc-text-faint)"},children:n("landing.footer.tagline")})]})})]})}const Pa=()=>b.useContext(VB);function ur(){if(typeof crypto<"u"&&typeof crypto.randomUUID=="function")return crypto.randomUUID();const e=globalThis.crypto,n=new Uint8Array(16);e.getRandomValues(n),n[6]=n[6]&15|64,n[8]=n[8]&63|128;const r=Array.from(n,i=>i.toString(16).padStart(2,"0")).join("");return`${r.slice(0,8)}-${r.slice(8,12)}-${r.slice(12,16)}-${r.slice(16,20)}-${r.slice(20)}`}const rte=1e3,ite=3e4,NO="revka_session_id";function ste(){let e=sessionStorage.getItem(NO);return e||(e=ur(),sessionStorage.setItem(NO,e)),e}class ate{constructor(n={}){$n(this,"ws",null);$n(this,"currentDelay");$n(this,"reconnectTimer",null);$n(this,"intentionallyClosed",!1);$n(this,"onMessage",null);$n(this,"onOpen",null);$n(this,"onClose",null);$n(this,"onError",null);$n(this,"baseUrl");$n(this,"sessionId");$n(this,"name");$n(this,"reconnectDelay");$n(this,"maxReconnectDelay");$n(this,"autoReconnect");let r;lp()&&Oi?r=Oi.replace(/^http/,"ws"):r=`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}`,this.baseUrl=n.baseUrl??r,this.sessionId=n.sessionId,this.name=n.name,this.reconnectDelay=n.reconnectDelay??rte,this.maxReconnectDelay=n.maxReconnectDelay??ite,this.autoReconnect=n.autoReconnect??!0,this.currentDelay=this.reconnectDelay}connect(){this.intentionallyClosed=!1,this.clearReconnectTimer(),this.ws&&(this.ws.onopen=null,this.ws.onmessage=null,this.ws.onclose=null,this.ws.onerror=null,this.ws.close(),this.ws=null);const n=os(),r=this.sessionId??ste(),i=new URLSearchParams;n&&i.set("token",n),i.set("session_id",r),this.name&&i.set("name",this.name);const s=`${this.baseUrl}${Xr}/ws/chat?${i.toString()}`;this.ws=new WebSocket(s,["revka.v1"]),this.ws.onopen=()=>{var a;this.currentDelay=this.reconnectDelay,(a=this.onOpen)==null||a.call(this)},this.ws.onmessage=a=>{var o;try{const l=JSON.parse(a.data);(o=this.onMessage)==null||o.call(this,l)}catch{}},this.ws.onclose=a=>{var o;(o=this.onClose)==null||o.call(this,a),this.scheduleReconnect()},this.ws.onerror=a=>{var o;(o=this.onError)==null||o.call(this,a)}}sendConnect(){!this.ws||this.ws.readyState!==WebSocket.OPEN||this.ws.send(JSON.stringify({type:"connect"}))}sendMessage(n,r,i){if(!this.ws||this.ws.readyState!==WebSocket.OPEN)throw new Error("WebSocket is not connected");const s={type:"message",content:n};r&&(s.page_context=r),i&&i.length>0&&(s.attachments=i),this.ws.send(JSON.stringify(s))}sendSteer(n,r){if(!this.ws||this.ws.readyState!==WebSocket.OPEN)throw new Error("WebSocket is not connected");const i={type:"steer",content:n};r&&(i.page_context=r),this.ws.send(JSON.stringify(i))}sendStop(){if(!this.ws||this.ws.readyState!==WebSocket.OPEN)throw new Error("WebSocket is not connected");this.ws.send(JSON.stringify({type:"stop"}))}disconnect(){this.intentionallyClosed=!0,this.clearReconnectTimer(),this.ws&&(this.ws.close(),this.ws=null)}get connected(){var n;return((n=this.ws)==null?void 0:n.readyState)===WebSocket.OPEN}scheduleReconnect(){this.intentionallyClosed||!this.autoReconnect||(this.reconnectTimer=setTimeout(()=>{this.currentDelay=Math.min(this.currentDelay*2,this.maxReconnectDelay),this.connect()},this.currentDelay))}clearReconnectTimer(){this.reconnectTimer!==null&&(clearTimeout(this.reconnectTimer),this.reconnectTimer=null)}}const OC=b.createContext({getDraft:()=>"",setDraft:()=>{},clearDraft:()=>{}});function ote(){const e=b.useRef(new Map),n=b.useCallback(s=>e.current.get(s)??"",[]),r=b.useCallback((s,a)=>{e.current.set(s,a)},[]),i=b.useCallback(s=>{e.current.delete(s)},[]);return b.useMemo(()=>({getDraft:n,setDraft:r,clearDraft:i}),[n,r,i])}const lte=100,cte="revka_chat_history_v1:";function Dz(e){return`${cte}${e}`}function zw(e){var n;try{const r=localStorage.getItem(Dz(e));if(!r)return[];const i=JSON.parse(r);return(n=i.messages)!=null&&n.length?i.messages:[]}catch{return[]}}function ute(e,n){try{const r=n.slice(-lte);localStorage.setItem(Dz(e),JSON.stringify({messages:r}))}catch{}}function dte(e){const n=Date.now()-e.length*1e3,r=[];let i=0;for(const s of e){if(s.role==="system")continue;const a=new Date(n+i*1e3).toISOString();i+=1,s.role==="user"?r.push({id:ur(),role:"user",content:s.content,timestamp:a}):s.role==="assistant"?r.push({id:ur(),role:"agent",content:s.content,markdown:!0,timestamp:a}):r.push({id:ur(),role:"agent",content:s.content,markdown:!1,timestamp:a})}return r}function EO(e){return e.map(n=>({id:n.id,role:n.role,content:n.content,thinking:n.thinking,markdown:n.markdown,timestamp:new Date(n.timestamp)}))}function hte(e){return e.map(n=>({id:n.id,role:n.role,content:n.content,thinking:n.thinking,markdown:n.markdown,timestamp:n.timestamp.toISOString()}))}function $w(e){return{save_agent:"Creating agent",save_agent_template:"Saving agent template",create_team:"Building team",search_agents:"Searching agents",search_agent_pool:"Searching agent pool",search_teams:"Searching teams",list_agent_templates:"Listing agents",list_teams:"Listing teams",get_team:"Fetching team details",save_plan:"Saving plan",save_skill:"Saving skill",set_agent_trust:"Setting trust level",set_agent_goal:"Setting agent goal",shell:"Running command",search_clawhub:"Searching ClawHub",browse_clawhub:"Browsing ClawHub",install_from_clawhub:"Installing from ClawHub",render_canvas:"Rendering to canvas",clear_canvas:"Clearing canvas"}[e]||e.replace(/_/g," ")}function AO(e){switch(e){case"spawning":return"🤖";case"waiting":return"⏳";case"delegating":return"📨";case"collecting":case"collected":return"📋";case"checking":case"listing":case"searching":return"🔍";case"saving":return"💾";case"steering":return"🎯";case"finalizing":return"⏳";case"spawned":case"completed":return"✅";case"failed":return"❌";case"blocked":return"🛑";case"running":return"🏃";default:return"⚙️"}}function TO(e){return!!e&&!["completed","spawned","collected","failed","blocked"].includes(e)}async function ro(e){var n;if(typeof navigator<"u"&&((n=navigator.clipboard)!=null&&n.writeText)&&window.isSecureContext)try{return await navigator.clipboard.writeText(e),!0}catch{}return fte(e)}function fte(e){if(typeof document>"u")return!1;const n=document.createElement("textarea");n.value=e,n.setAttribute("readonly",""),n.style.position="fixed",n.style.top="0",n.style.left="0",n.style.opacity="0",document.body.appendChild(n);const r=document.getSelection(),i=r&&r.rangeCount>0?r.getRangeAt(0):null;n.select(),n.setSelectionRange(0,e.length);let s=!1;try{s=document.execCommand("copy")}catch{s=!1}finally{document.body.removeChild(n),i&&r&&(r.removeAllRanges(),r.addRange(i))}return s}const pte=500,mte=12e3;function gte(e){return e?/(^|\n)(diff --git|@@ |--- |\+\+\+ |\*\*\* Begin Patch|\*\*\* Update File:)/.test(e):!1}function vte(e){return e==="file_edit"||e==="file_write"}function yte(e,n){if(!n)return n;const r=gte(n)||vte(e)?mte:pte;return n.length<=r?n:`${n.slice(0,r)}

${Xs("agent.tool_output_truncated")}`}function _te(e){if(e)try{const n=JSON.parse(e);return n&&typeof n=="object"&&!Array.isArray(n)?n:void 0}catch{return}}function MO(e,n){return(n.length>0?n.split(/\r?\n/):[""]).map(i=>`${e}${i}`)}function xte(e,n){const r=_te(n),i=typeof(r==null?void 0:r.path)=="string"?r.path:"file";if(e==="file_edit"){const s=typeof(r==null?void 0:r.old_string)=="string"?r.old_string:void 0,a=typeof(r==null?void 0:r.new_string)=="string"?r.new_string:void 0;return s===void 0||a===void 0?void 0:[`--- ${i}`,`+++ ${i}`,"@@",...MO("-",s),...MO("+",a)].join(`
`)}}function Pz({sessionId:e,sessionName:n,draftKey:r,pageContext:i,onUserMessage:s,onToolResult:a}){const{getDraft:o,setDraft:l,clearDraft:u}=b.useContext(OC),[d,p]=b.useState([]),[f,g]=b.useState(!1),[_,x]=b.useState(()=>o(r)),[v,S]=b.useState(!1),[w,j]=b.useState(!1),[C,T]=b.useState(null),[E,A]=b.useState([]),[O,F]=b.useState(""),[L,$]=b.useState(""),[z,B]=b.useState(null),[H,D]=b.useState([]),[U,I]=b.useState([]),[X,K]=b.useState(!1),[Q,V]=b.useState([]),[R,q]=b.useState(0),W=b.useRef(null),te=b.useRef(null),J=b.useRef(""),G=b.useRef(""),re=b.useRef(""),ne=b.useRef([]),le=b.useRef(null),oe=b.useRef(null),ie=b.useRef(!1),he=b.useRef(!1),Z=b.useRef(new Map),de=b.useRef(!1),ue=b.useRef(s);ue.current=s;const pe=b.useRef(a);pe.current=a;const Oe=b.useRef(r);Oe.current=r;const fe=b.useRef(!1);b.useEffect(()=>{ie.current=v},[v]);const Le=b.useCallback(()=>{if(le.current===null){if(typeof window>"u"||typeof window.requestAnimationFrame!="function"){F(J.current),$(G.current);return}le.current=window.requestAnimationFrame(()=>{le.current=null,F(J.current),$(G.current)})}},[]),Ee=b.useCallback(()=>{le.current!==null&&typeof window<"u"&&(window.cancelAnimationFrame(le.current),le.current=null),F(J.current),$(G.current)},[]),Bt=b.useCallback(()=>{if(oe.current===null){if(typeof window>"u"||typeof window.requestAnimationFrame!="function"){A(ne.current);return}oe.current=window.requestAnimationFrame(()=>{oe.current=null,A(ne.current)})}},[]),Xe=b.useCallback(()=>{oe.current!==null&&typeof window<"u"&&(window.cancelAnimationFrame(oe.current),oe.current=null),A(ne.current)},[]);b.useEffect(()=>()=>{le.current!==null&&typeof window<"u"&&window.cancelAnimationFrame(le.current),oe.current!==null&&typeof window<"u"&&window.cancelAnimationFrame(oe.current)},[]);const St=b.useCallback(()=>{Z.current.size===0&&!de.current||(Z.current.clear(),de.current=!1,p(Ge=>{let tt=!1;const bt=Ge.map(Nt=>Nt.deliveryStatus!=="sending"?Nt:(tt=!0,{...Nt,deliveryStatus:"sent"}));return tt?bt:Ge}))},[]),yt=b.useCallback(()=>{const Ge=Array.from(Z.current.values()),tt=Ge[Ge.length-1];return tt?(Z.current.delete(tt.id),I(bt=>bt.some(Nt=>Nt.id===tt.id)?bt:[tt,...bt]),p(bt=>bt.map(Nt=>Nt.id===tt.id?{...Nt,deliveryStatus:"queued"}:Nt)),!0):!1},[]);b.useEffect(()=>{x(o(r))},[e]),b.useEffect(()=>{l(Oe.current,_)},[_,l]),b.useEffect(()=>{let Ge=!1;return p([]),A([]),D([]),I([]),he.current=!1,Z.current.clear(),de.current=!1,K(!1),ne.current=[],oe.current!==null&&typeof window<"u"&&(window.cancelAnimationFrame(oe.current),oe.current=null),le.current!==null&&typeof window<"u"&&(window.cancelAnimationFrame(le.current),le.current=null),F(""),$(""),S(!1),T(null),g(!1),fe.current=!1,(async()=>{try{const tt=await IZ(e);if(Ge)return;const bt=zw(e),Nt=tt.session_persistence?dte(tt.messages):[],it=Nt.length>0?Nt:bt;it.length>0&&(fe.current=!0),p(it.length?EO(it):[])}catch{if(!Ge){const tt=zw(e);tt.length>0&&(fe.current=!0),p(tt.length?EO(tt):[])}}finally{Ge||g(!0)}})(),()=>{Ge=!0}},[e]),b.useEffect(()=>{if(!f)return;const Ge=hte(d.filter(tt=>tt.role!=="operator"));if(Ge.length>0)fe.current=!0;else if(!fe.current&&zw(e).length>0)return;ute(e,Ge)},[f,d,e]),b.useEffect(()=>{let Ge=!1,tt=null;const bt=setTimeout(()=>{if(Ge)return;tt=new ate({sessionId:e,name:n}),tt.onOpen=()=>{Ge||(j(!0),T(null))};const Nt=()=>{S(!1),Z.current.clear(),de.current=!1,J.current="",G.current="",re.current="",Ee(),ne.current=[],Xe(),K(!1)};tt.onClose=it=>{if(!Ge&&(j(!1),Nt(),it.code!==1e3&&it.code!==1001)){const dt=it.code===1006?"Connection interrupted; reconnecting...":`Connection closed unexpectedly (code: ${it.code}). Reconnecting...`;T(dt)}},tt.onError=()=>{Ge||(Nt(),T(Xs("agent.connection_error")))},tt.onMessage=it=>{if(!Ge)switch(it.type){case"session_start":case"connected":break;case"thinking":{St(),S(!0);const dt=it.content??"";G.current+=dt,Le();const Vt=ne.current,jt=Vt[Vt.length-1],Ht=(jt==null?void 0:jt.kind)==="thinking"?[...Vt.slice(0,-1),{...jt,label:Xs("agent.reasoning_trace_label"),detail:(jt.detail??"")+dt}]:[...Vt,{id:ur(),kind:"thinking",label:Xs("agent.reasoning_trace_label"),detail:dt||void 0,timestamp:new Date}];ne.current=Ht,Bt();break}case"chunk":St(),S(!0),J.current+=it.content??"",Le();break;case"chunk_reset":re.current=G.current,J.current="",G.current="",Ee();break;case"message":case"done":{const dt=it.full_response??it.content??J.current,Vt=re.current||G.current||void 0,jt=ne.current.filter(Ht=>Ht.kind!=="thinking"||!!Ht.detail);ne.current=[],Xe(),dt?p(Ht=>[...Ht,{id:ur(),role:"agent",content:dt,thinking:Vt,markdown:!0,timestamp:new Date,activityLog:jt.length>0?jt:void 0}]):jt.length>0&&p(Ht=>[...Ht,{id:ur(),role:"operator",content:jt.map(rr=>rr.label).join(`
`),operatorPhase:"completed",timestamp:new Date,activityLog:jt}]),J.current="",G.current="",re.current="",Ee(),St(),S(!1),K(!1);break}case"tool_call":{St(),S(!0);const dt=it.name??"tool",Vt=[...ne.current,{id:ur(),kind:"tool_call",label:$w(dt),detail:it.args?typeof it.args=="string"?it.args:JSON.stringify(it.args,null,2):void 0,toolName:dt,status:"running",timestamp:new Date}];ne.current=Vt,A(Vt);break}case"tool_result":{St();const dt=it.name??"tool",Vt=yte(dt,it.output),jt=ne.current,Ht=[...jt].reverse().findIndex(Mn=>Mn.kind==="tool_call"&&Mn.toolName===dt&&Mn.status!=="done"),rr=Ht>=0?jt.length-1-Ht:-1,Wt=rr>=0?jt.map((Mn,ge)=>{var Jt;if(ge!==rr)return Mn;const Re=(Jt=Mn.detail)==null?void 0:Jt.trim(),et=xte(dt,Re),tn=[Re?`${Xs("agent.activity_input_label")}
${Re}`:"",et?`${Xs("agent.activity_diff_label")}
${et}`:"",Vt?`${Xs("agent.activity_output_label")}
${Vt}`:""].filter(Boolean).join(`

`);return{...Mn,kind:"tool_result",label:`${$w(dt)} - done`,detail:tn||void 0,status:"done",timestamp:new Date}}):[...jt,{id:ur(),kind:"tool_result",label:`${$w(dt)} - done`,detail:Vt,toolName:dt,status:"done",timestamp:new Date}];ne.current=Wt,A(Wt),pe.current&&it.name&&pe.current({id:ur(),name:it.name,output:it.output??""});break}case"stopped":{const dt=ne.current;ne.current=[],Xe(),J.current="",G.current="",re.current="",Ee(),St(),S(!1),K(!1),p(Vt=>[...Vt,{id:ur(),role:"operator",content:it.message??"Stopped current Operator turn.",operatorPhase:"stopped",timestamp:new Date,activityLog:dt.length>0?dt:void 0}]);break}case"operator_status":{const dt=it.phase??"working",Vt=it.detail??"";dt==="queued"?yt():St(),S(!0);const jt={id:ur(),kind:"operator",label:`${AO(dt)} ${Vt}`,detail:Vt||void 0,timestamp:new Date},Ht=ne.current,rr=Ht[Ht.length-1],Wt=TO(dt)&&(rr==null?void 0:rr.kind)==="operator"?[...Ht.slice(0,-1),{...jt,id:rr.id}]:[...Ht,jt];ne.current=Wt,A(Wt),TO(dt)||p(Mn=>[...Mn,{id:ur(),role:"operator",content:`${AO(dt)} ${Vt}`,operatorPhase:dt,timestamp:new Date}]);break}case"agent_event":{const dt=it.event;dt&&D(Vt=>[...Vt,dt]);break}case"error":p(dt=>[...dt,{id:ur(),role:"agent",content:`${Xs("agent.error_prefix")} ${it.message??Xs("agent.unknown_error")}`,timestamp:new Date}]),it.code==="AGENT_INIT_FAILED"||it.code==="AUTH_ERROR"||it.code==="PROVIDER_ERROR"?T(`Configuration error: ${it.message}. Please check your provider settings (API key, model, etc.).`):(it.code==="INVALID_JSON"||it.code==="UNKNOWN_MESSAGE_TYPE"||it.code==="EMPTY_CONTENT")&&T(`Message error: ${it.message}`),S(!1),J.current="",G.current="",re.current="",Ee(),ne.current=[],Xe(),St(),K(!1);break}},tt.connect(),W.current=tt},50);return()=>{Ge=!0,clearTimeout(bt),tt&&tt.disconnect(),W.current=null}},[Xe,Ee,St,yt,Bt,Le,e,n]);const Rt=b.useCallback((Ge,tt)=>{var bt,Nt;if(!((bt=W.current)!=null&&bt.connected))return!1;try{W.current.sendMessage(Ge.content,i,Ge.attachments.map(it=>it.file_id)),Z.current.set(Ge.id,Ge),(Nt=ue.current)==null||Nt.call(ue,Ge.content),tt&&(de.current=!0,p(it=>it.map(dt=>dt.id===Ge.id?{...dt,deliveryStatus:"sending"}:dt))),S(!0),J.current="",G.current="",re.current="",Ee(),ne.current=[],Xe()}catch{return T(Xs("agent.send_error")),!1}return!0},[Xe,Ee,i]),be=b.useCallback(()=>{var it;const Ge=_.trim();if(!Ge&&Q.length===0||!((it=W.current)!=null&&it.connected)||R>0)return!1;const tt=Q.length>0?`
`+Q.map(dt=>`[Attached: ${dt.filename} (${dt.size}b)]`).join(`
`):"",bt=Ge+tt,Nt={id:ur(),content:Ge,attachments:Q};if(ie.current)I(dt=>[...dt,Nt]),p(dt=>[...dt,{id:Nt.id,role:"user",content:bt,deliveryStatus:"queued",timestamp:new Date}]);else if(de.current=!0,p(dt=>[...dt,{id:Nt.id,role:"user",content:bt,deliveryStatus:"sending",timestamp:new Date}]),!Rt(Nt,!1))return!1;return x(""),V([]),u(Oe.current),te.current&&(te.current.style.height="auto",te.current.focus()),!0},[Q,u,_,Rt,R]);b.useEffect(()=>{if(v||!w||U.length===0||he.current)return;const Ge=U[0];if(!Ge)return;const tt=U.slice(1);he.current=!0,I(tt),Rt(Ge,!0)||I(bt=>[Ge,...bt]),queueMicrotask(()=>{he.current=!1})},[w,U,Rt,v]);const He=b.useCallback(()=>{var Ge;if(!ie.current||!((Ge=W.current)!=null&&Ge.connected)||X)return!1;try{return W.current.sendStop(),K(!0),!0}catch{return T(Xs("agent.send_error")),!1}},[X]),ht=b.useCallback(()=>{var tt;const Ge=_.trim();if(!Ge||!ie.current||!((tt=W.current)!=null&&tt.connected)||Q.length>0||R>0)return!1;try{return W.current.sendSteer(Ge,i),de.current=!0,p(bt=>[...bt,{id:ur(),role:"user",content:`${Xs("agent.steer_prefix")} ${Ge}`,deliveryStatus:"sending",timestamp:new Date}]),x(""),u(Oe.current),te.current&&(te.current.style.height="auto",te.current.focus()),!0}catch{return T(Xs("agent.send_error")),!1}},[Q.length,u,_,i,R]),ot=b.useCallback(Ge=>{var Nt;const tt=Ge.trim();if(!tt||!((Nt=W.current)!=null&&Nt.connected))return!1;const bt={id:ur(),content:tt,attachments:[]};return ie.current?(I(it=>[...it,bt]),p(it=>[...it,{id:bt.id,role:"user",content:tt,deliveryStatus:"queued",timestamp:new Date}]),!0):(de.current=!0,p(it=>[...it,{id:bt.id,role:"user",content:tt,deliveryStatus:"sending",timestamp:new Date}]),Rt(bt,!1))},[Rt]),$t=b.useCallback(async Ge=>{q(tt=>tt+1);try{const tt=await $Z(e,Ge);let bt;tt.mime.startsWith("image/")&&(bt=await new Promise(it=>{const dt=new FileReader;dt.onload=()=>it(typeof dt.result=="string"?dt.result:void 0),dt.onerror=()=>it(void 0),dt.readAsDataURL(Ge)}));const Nt={...tt,previewUrl:bt};return V(it=>[...it,Nt]),Nt}catch(tt){const bt=tt instanceof Error?tt.message:"upload failed";return T(`Attachment upload failed: ${bt}`),null}finally{q(tt=>Math.max(0,tt-1))}},[e]),jn=b.useCallback(Ge=>{V(tt=>tt.filter(bt=>bt.file_id!==Ge))},[]),Pn=b.useCallback(()=>{V([])},[]),We=b.useCallback(Ge=>{x(Ge.target.value),Ge.target.style.height="auto",Ge.target.style.height=`${Math.min(Ge.target.scrollHeight,200)}px`},[]),ut=b.useCallback(()=>{fe.current=!0,p([]),ne.current=[],J.current="",G.current="",re.current="",Xe(),Ee(),de.current=!1,S(!1),T(null)},[Xe,Ee]),Ct=b.useCallback(Ge=>{p(tt=>[...tt,{id:ur(),role:"operator",content:Ge,operatorPhase:"completed",timestamp:new Date}])},[]),Mt=b.useCallback(async(Ge,tt)=>{await ro(tt)&&(B(Ge),setTimeout(()=>B(bt=>bt===Ge?null:bt),2e3))},[]);return{activities:E,addAttachment:$t,agentEvents:H,appendSystemMessage:Ct,attachments:Q,clearAttachments:Pn,clearMessages:ut,connected:w,copiedId:z,copyMessage:Mt,error:C,handleSend:be,handleTextareaChange:We,input:_,inputRef:te,messages:d,removeAttachment:jn,setInput:x,streamingContent:O,streamingThinking:L,queuedTurns:U,stopCurrentTurn:He,steerCurrentTurn:ht,stopping:X,submitMessage:ot,typing:v,uploadingCount:R}}const Lz=b.createContext({open:!1,openAssistant:()=>{},closeAssistant:()=>{},toggleAssistant:()=>{}});function YE(){return b.useContext(Lz)}function bte({children:e}){const[n,r]=b.useState(!1),[i,s]=b.useState(),[a,o]=b.useState(),[l,u]=b.useState(),d=b.useMemo(()=>({open:n,pageContextOverride:i,titleOverride:a,placeholderOverride:l,openAssistant:p=>{s(p==null?void 0:p.pageContext),o(p==null?void 0:p.title),u(p==null?void 0:p.placeholder),r(!0)},closeAssistant:()=>{r(!1),s(void 0),o(void 0),u(void 0)},toggleAssistant:()=>{n?(r(!1),s(void 0),o(void 0),u(void 0)):r(!0)}}),[n,i,l,a]);return c.jsx(Lz.Provider,{value:d,children:e})}const Iz=[{id:"orchestration",label:"Orchestration",labelKey:"nav.section.orchestration",items:[{to:"/dashboard",label:"Dashboard",labelKey:"nav.dashboard",icon:Nee,blurb:"Live runtime posture and active DAG state",blurbKey:"nav.dashboard.blurb"},{to:"/workflows",label:"Workflows",labelKey:"nav.workflows",icon:N0,blurb:"Define DAGs and drill into runs from the same flow",blurbKey:"nav.workflows.blurb"},{to:"/agents",label:"Agents",labelKey:"nav.agents",icon:Ul,blurb:"Reusable actors and workflow participants",blurbKey:"nav.agents.blurb"},{to:"/canvas",label:"Canvas",labelKey:"nav.canvas",icon:bz,blurb:"Visual workspace and orchestration canvases",blurbKey:"nav.canvas.blurb"},{to:"/teams",label:"Teams",labelKey:"nav.teams",icon:j0,blurb:"View delegation topology and ownership",blurbKey:"nav.teams.blurb"}]},{id:"operations",label:"Operations",labelKey:"nav.section.operations",items:[{to:"/assets",label:"Assets",labelKey:"nav.assets",icon:b0,blurb:"Artifacts and workflow-adjacent resources",blurbKey:"nav.assets.blurb"},{to:"/skills",label:"Skills",labelKey:"nav.skills",icon:hu,blurb:"Reusable operational capabilities",blurbKey:"nav.skills.blurb"},{to:"/tools",label:"Tools",labelKey:"nav.tools",icon:E0,blurb:"Agent tool catalog and CLI binaries",blurbKey:"nav.tools.blurb"},{to:"/integrations",label:"Integrations",labelKey:"nav.integrations",icon:Sz,blurb:"Connected systems and channel surfaces",blurbKey:"nav.integrations.blurb"},{to:"/cron",label:"Cron",labelKey:"nav.cron",icon:Jx,blurb:"Scheduled jobs and catch-up behaviour",blurbKey:"nav.cron.blurb"},{to:"/pairing",label:"Pairing",labelKey:"nav.pairing",icon:RC,blurb:"Device enrolment and trust management",blurbKey:"nav.pairing.blurb"},{to:"/config",label:"Config",labelKey:"nav.config",icon:S0,blurb:"Runtime TOML and operational configuration",blurbKey:"nav.config.blurb"},{to:"/cost",label:"Cost",labelKey:"nav.cost",icon:BE,blurb:"Spend and efficiency by workflow and run",blurbKey:"nav.cost.blurb"},{to:"/skins",label:"Skins",labelKey:"nav.skins",icon:MC,blurb:"Token and asset based UI skins",blurbKey:"nav.skins.blurb"}]},{id:"inspection",label:"Inspection",labelKey:"nav.section.inspection",items:[{to:"/memory",label:"Memory",labelKey:"nav.memory",icon:Df,blurb:"Kumiho memory graph explorer and revisions",blurbKey:"nav.memory.blurb"},{to:"/logs",label:"Logs",labelKey:"nav.logs",icon:xv,blurb:"Operational traces and node-linked events",blurbKey:"nav.logs.blurb"},{to:"/audit",label:"Audit",labelKey:"nav.audit",icon:Cv,blurb:"Trust chain and approval verification",blurbKey:"nav.audit.blurb"},{to:"/doctor",label:"Doctor",labelKey:"nav.doctor",icon:Ez,blurb:"Diagnostics and runtime recovery posture",blurbKey:"nav.doctor.blurb"}]}],Bz=Object.fromEntries(Iz.flatMap(e=>e.items.map(n=>[n.to,{title:n.label,description:n.blurb,titleKey:n.labelKey,descriptionKey:n.blurbKey}]))),rg={matrix:{label:"Matrix",colors:{primary:"#7dff9b",secondary:"#72d8ff",user:"#e6e6e6",system:"#72d8ff",glow:"0 0 6px rgba(125,255,155,0.25)",glowSecondary:"0 0 6px rgba(114,216,255,0.25)",cursorColor:"#7dff9b"}},amber:{label:"Amber",colors:{primary:"#ffc857",secondary:"#ff9f43",user:"#e6e6e6",system:"#ff9f43",glow:"0 0 6px rgba(255,200,87,0.25)",glowSecondary:"0 0 6px rgba(255,159,67,0.25)",cursorColor:"#ffc857"}},cyan:{label:"Revka",colors:{primary:"#8fa8c8",secondary:"#6f83d6",user:"#e6e6e6",system:"#7c8ddd",glow:"0 0 6px rgba(143,168,200,0.18)",glowSecondary:"0 0 6px rgba(111,131,214,0.18)",cursorColor:"#8fa8c8"}},minimal:{label:"Minimal",colors:{primary:"#b0b0b0",secondary:"#808080",user:"#e6e6e6",system:"#808080",glow:"none",glowSecondary:"none",cursorColor:"#e6e6e6"}}},kte=Object.keys(rg),zz="revka-assistant-config",ig={colorScheme:"cyan",fontSize:13,cursorBlink:!0,panelHeightPercent:60,panelOpacity:1};function wte(){try{const e=localStorage.getItem(zz);return e?{...ig,...JSON.parse(e)}:ig}catch{return ig}}function RO(e){try{localStorage.setItem(zz,JSON.stringify(e))}catch{}}function Ste(){const[e,n]=b.useState(wte),r=b.useMemo(()=>rg[e.colorScheme].colors,[e.colorScheme]),i=b.useCallback(a=>{n(o=>{const l={...o,...a};return RO(l),l})},[]),s=b.useCallback(()=>{n(ig),RO(ig)},[]);return{config:e,colors:r,updateConfig:i,resetConfig:s}}/**
 * Copyright (c) 2014-2024 The xterm.js authors. All rights reserved.
 * @license MIT
 *
 * Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)
 * @license MIT
 *
 * Originally forked from (with the author's permission):
 *   Fabrice Bellard's javascript vt100 for jslinux:
 *   http://bellard.org/jslinux/
 *   Copyright (c) 2011 Fabrice Bellard
 */var $z=Object.defineProperty,Cte=Object.getOwnPropertyDescriptor,jte=(e,n)=>{for(var r in n)$z(e,r,{get:n[r],enumerable:!0})},Dr=(e,n,r,i)=>{for(var s=i>1?void 0:i?Cte(n,r):n,a=e.length-1,o;a>=0;a--)(o=e[a])&&(s=(i?o(n,r,s):o(s))||s);return i&&s&&$z(n,r,s),s},vt=(e,n)=>(r,i)=>n(r,i,e),OO="Terminal input",DC={get:()=>OO,set:e=>OO=e},DO="Too much output to announce, navigate to rows manually to read",PC={get:()=>DO,set:e=>DO=e};function Nte(e){return e.replace(/\r?\n/g,"\r")}function Ete(e,n){return n?"\x1B[200~"+e+"\x1B[201~":e}function Ate(e,n){e.clipboardData&&e.clipboardData.setData("text/plain",n.selectionText),e.preventDefault()}function Tte(e,n,r,i){if(e.stopPropagation(),e.clipboardData){let s=e.clipboardData.getData("text/plain");Fz(s,n,r,i)}}function Fz(e,n,r,i){e=Nte(e),e=Ete(e,r.decPrivateModes.bracketedPasteMode&&i.rawOptions.ignoreBracketedPasteMode!==!0),r.triggerDataEvent(e,!0),n.value=""}function Hz(e,n,r){let i=r.getBoundingClientRect(),s=e.clientX-i.left-10,a=e.clientY-i.top-10;n.style.width="20px",n.style.height="20px",n.style.left=`${s}px`,n.style.top=`${a}px`,n.style.zIndex="1000",n.focus()}function PO(e,n,r,i,s){Hz(e,n,r),s&&i.rightClickSelect(e),n.value=i.selectionText,n.select()}function qc(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}function T0(e,n=0,r=e.length){let i="";for(let s=n;s<r;++s){let a=e[s];a>65535?(a-=65536,i+=String.fromCharCode((a>>10)+55296)+String.fromCharCode(a%1024+56320)):i+=String.fromCharCode(a)}return i}var Mte=class{constructor(){this._interim=0}clear(){this._interim=0}decode(e,n){let r=e.length;if(!r)return 0;let i=0,s=0;if(this._interim){let a=e.charCodeAt(s++);56320<=a&&a<=57343?n[i++]=(this._interim-55296)*1024+a-56320+65536:(n[i++]=this._interim,n[i++]=a),this._interim=0}for(let a=s;a<r;++a){let o=e.charCodeAt(a);if(55296<=o&&o<=56319){if(++a>=r)return this._interim=o,i;let l=e.charCodeAt(a);56320<=l&&l<=57343?n[i++]=(o-55296)*1024+l-56320+65536:(n[i++]=o,n[i++]=l);continue}o!==65279&&(n[i++]=o)}return i}},Rte=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(e,n){let r=e.length;if(!r)return 0;let i=0,s,a,o,l,u=0,d=0;if(this.interim[0]){let g=!1,_=this.interim[0];_&=(_&224)===192?31:(_&240)===224?15:7;let x=0,v;for(;(v=this.interim[++x]&63)&&x<4;)_<<=6,_|=v;let S=(this.interim[0]&224)===192?2:(this.interim[0]&240)===224?3:4,w=S-x;for(;d<w;){if(d>=r)return 0;if(v=e[d++],(v&192)!==128){d--,g=!0;break}else this.interim[x++]=v,_<<=6,_|=v&63}g||(S===2?_<128?d--:n[i++]=_:S===3?_<2048||_>=55296&&_<=57343||_===65279||(n[i++]=_):_<65536||_>1114111||(n[i++]=_)),this.interim.fill(0)}let p=r-4,f=d;for(;f<r;){for(;f<p&&!((s=e[f])&128)&&!((a=e[f+1])&128)&&!((o=e[f+2])&128)&&!((l=e[f+3])&128);)n[i++]=s,n[i++]=a,n[i++]=o,n[i++]=l,f+=4;if(s=e[f++],s<128)n[i++]=s;else if((s&224)===192){if(f>=r)return this.interim[0]=s,i;if(a=e[f++],(a&192)!==128){f--;continue}if(u=(s&31)<<6|a&63,u<128){f--;continue}n[i++]=u}else if((s&240)===224){if(f>=r)return this.interim[0]=s,i;if(a=e[f++],(a&192)!==128){f--;continue}if(f>=r)return this.interim[0]=s,this.interim[1]=a,i;if(o=e[f++],(o&192)!==128){f--;continue}if(u=(s&15)<<12|(a&63)<<6|o&63,u<2048||u>=55296&&u<=57343||u===65279)continue;n[i++]=u}else if((s&248)===240){if(f>=r)return this.interim[0]=s,i;if(a=e[f++],(a&192)!==128){f--;continue}if(f>=r)return this.interim[0]=s,this.interim[1]=a,i;if(o=e[f++],(o&192)!==128){f--;continue}if(f>=r)return this.interim[0]=s,this.interim[1]=a,this.interim[2]=o,i;if(l=e[f++],(l&192)!==128){f--;continue}if(u=(s&7)<<18|(a&63)<<12|(o&63)<<6|l&63,u<65536||u>1114111)continue;n[i++]=u}}return i}},Wz="",Jc=" ",Nv=class qz{constructor(){this.fg=0,this.bg=0,this.extended=new rb}static toColorRGB(n){return[n>>>16&255,n>>>8&255,n&255]}static fromColorRGB(n){return(n[0]&255)<<16|(n[1]&255)<<8|n[2]&255}clone(){let n=new qz;return n.fg=this.fg,n.bg=this.bg,n.extended=this.extended.clone(),n}isInverse(){return this.fg&67108864}isBold(){return this.fg&134217728}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:this.fg&268435456}isBlink(){return this.fg&536870912}isInvisible(){return this.fg&1073741824}isItalic(){return this.bg&67108864}isDim(){return this.bg&134217728}isStrikethrough(){return this.fg&2147483648}isProtected(){return this.bg&536870912}isOverline(){return this.bg&1073741824}getFgColorMode(){return this.fg&50331648}getBgColorMode(){return this.bg&50331648}isFgRGB(){return(this.fg&50331648)===50331648}isBgRGB(){return(this.bg&50331648)===50331648}isFgPalette(){return(this.fg&50331648)===16777216||(this.fg&50331648)===33554432}isBgPalette(){return(this.bg&50331648)===16777216||(this.bg&50331648)===33554432}isFgDefault(){return(this.fg&50331648)===0}isBgDefault(){return(this.bg&50331648)===0}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(this.fg&50331648){case 16777216:case 33554432:return this.fg&255;case 50331648:return this.fg&16777215;default:return-1}}getBgColor(){switch(this.bg&50331648){case 16777216:case 33554432:return this.bg&255;case 50331648:return this.bg&16777215;default:return-1}}hasExtendedAttrs(){return this.bg&268435456}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(this.bg&268435456&&~this.extended.underlineColor)switch(this.extended.underlineColor&50331648){case 16777216:case 33554432:return this.extended.underlineColor&255;case 50331648:return this.extended.underlineColor&16777215;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return this.bg&268435456&&~this.extended.underlineColor?this.extended.underlineColor&50331648:this.getFgColorMode()}isUnderlineColorRGB(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===50331648:this.isFgRGB()}isUnderlineColorPalette(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===16777216||(this.extended.underlineColor&50331648)===33554432:this.isFgPalette()}isUnderlineColorDefault(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===0:this.isFgDefault()}getUnderlineStyle(){return this.fg&268435456?this.bg&268435456?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}},rb=class Uz{constructor(n=0,r=0){this._ext=0,this._urlId=0,this._ext=n,this._urlId=r}get ext(){return this._urlId?this._ext&-469762049|this.underlineStyle<<26:this._ext}set ext(n){this._ext=n}get underlineStyle(){return this._urlId?5:(this._ext&469762048)>>26}set underlineStyle(n){this._ext&=-469762049,this._ext|=n<<26&469762048}get underlineColor(){return this._ext&67108863}set underlineColor(n){this._ext&=-67108864,this._ext|=n&67108863}get urlId(){return this._urlId}set urlId(n){this._urlId=n}get underlineVariantOffset(){let n=(this._ext&3758096384)>>29;return n<0?n^4294967288:n}set underlineVariantOffset(n){this._ext&=536870911,this._ext|=n<<29&3758096384}clone(){return new Uz(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},Ma=class Kz extends Nv{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new rb,this.combinedData=""}static fromCharData(n){let r=new Kz;return r.setFromCharData(n),r}isCombined(){return this.content&2097152}getWidth(){return this.content>>22}getChars(){return this.content&2097152?this.combinedData:this.content&2097151?qc(this.content&2097151):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):this.content&2097151}setFromCharData(n){this.fg=n[0],this.bg=0;let r=!1;if(n[1].length>2)r=!0;else if(n[1].length===2){let i=n[1].charCodeAt(0);if(55296<=i&&i<=56319){let s=n[1].charCodeAt(1);56320<=s&&s<=57343?this.content=(i-55296)*1024+s-56320+65536|n[2]<<22:r=!0}else r=!0}else this.content=n[1].charCodeAt(0)|n[2]<<22;r&&(this.combinedData=n[1],this.content=2097152|n[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},LO="di$target",LC="di$dependencies",Fw=new Map;function Ote(e){return e[LC]||[]}function yi(e){if(Fw.has(e))return Fw.get(e);let n=function(r,i,s){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");Dte(n,r,s)};return n._id=e,Fw.set(e,n),n}function Dte(e,n,r){n[LO]===n?n[LC].push({id:e,index:r}):(n[LC]=[{id:e,index:r}],n[LO]=n)}var cs=yi("BufferService"),Vz=yi("CoreMouseService"),qd=yi("CoreService"),Pte=yi("CharsetService"),GE=yi("InstantiationService"),Yz=yi("LogService"),us=yi("OptionsService"),Gz=yi("OscLinkService"),Lte=yi("UnicodeService"),Ev=yi("DecorationService"),IC=class{constructor(e,n,r){this._bufferService=e,this._optionsService=n,this._oscLinkService=r}provideLinks(e,n){var p;let r=this._bufferService.buffer.lines.get(e-1);if(!r){n(void 0);return}let i=[],s=this._optionsService.rawOptions.linkHandler,a=new Ma,o=r.getTrimmedLength(),l=-1,u=-1,d=!1;for(let f=0;f<o;f++)if(!(u===-1&&!r.hasContent(f))){if(r.loadCell(f,a),a.hasExtendedAttrs()&&a.extended.urlId)if(u===-1){u=f,l=a.extended.urlId;continue}else d=a.extended.urlId!==l;else u!==-1&&(d=!0);if(d||u!==-1&&f===o-1){let g=(p=this._oscLinkService.getLinkData(l))==null?void 0:p.uri;if(g){let _={start:{x:u+1,y:e},end:{x:f+(!d&&f===o-1?1:0),y:e}},x=!1;if(!(s!=null&&s.allowNonHttpProtocols))try{let v=new URL(g);["http:","https:"].includes(v.protocol)||(x=!0)}catch{x=!0}x||i.push({text:g,range:_,activate:(v,S)=>s?s.activate(v,S,_):Ite(v,S),hover:(v,S)=>{var w;return(w=s==null?void 0:s.hover)==null?void 0:w.call(s,v,S,_)},leave:(v,S)=>{var w;return(w=s==null?void 0:s.leave)==null?void 0:w.call(s,v,S,_)}})}d=!1,a.hasExtendedAttrs()&&a.extended.urlId?(u=f,l=a.extended.urlId):(u=-1,l=-1)}}n(i)}};IC=Dr([vt(0,cs),vt(1,us),vt(2,Gz)],IC);function Ite(e,n){if(confirm(`Do you want to navigate to ${n}?

WARNING: This link could potentially be dangerous`)){let r=window.open();if(r){try{r.opener=null}catch{}r.location.href=n}else console.warn("Opening link blocked as opener could not be cleared")}}var M0=yi("CharSizeService"),ic=yi("CoreBrowserService"),XE=yi("MouseService"),sc=yi("RenderService"),Bte=yi("SelectionService"),Xz=yi("CharacterJoinerService"),cp=yi("ThemeService"),Qz=yi("LinkProviderService"),zte=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?IO.isErrorNoTelemetry(e)?new IO(e.message+`

`+e.stack):new Error(e.message+`

`+e.stack):e},0)}}addListener(e){return this.listeners.push(e),()=>{this._removeListener(e)}}emit(e){this.listeners.forEach(n=>{n(e)})}_removeListener(e){this.listeners.splice(this.listeners.indexOf(e),1)}setUnexpectedErrorHandler(e){this.unexpectedErrorHandler=e}getUnexpectedErrorHandler(){return this.unexpectedErrorHandler}onUnexpectedError(e){this.unexpectedErrorHandler(e),this.emit(e)}onUnexpectedExternalError(e){this.unexpectedErrorHandler(e)}},$te=new zte;function _x(e){Fte(e)||$te.onUnexpectedError(e)}var BC="Canceled";function Fte(e){return e instanceof Hte?!0:e instanceof Error&&e.name===BC&&e.message===BC}var Hte=class extends Error{constructor(){super(BC),this.name=this.message}};function Wte(e){return new Error(`Illegal argument: ${e}`)}var IO=class zC extends Error{constructor(n){super(n),this.name="CodeExpectedError"}static fromError(n){if(n instanceof zC)return n;let r=new zC;return r.message=n.message,r.stack=n.stack,r}static isErrorNoTelemetry(n){return n.name==="CodeExpectedError"}},$C=class Zz extends Error{constructor(n){super(n||"An unexpected bug occurred."),Object.setPrototypeOf(this,Zz.prototype)}};function Ks(e,n=0){return e[e.length-(1+n)]}var qte;(e=>{function n(a){return a<0}e.isLessThan=n;function r(a){return a<=0}e.isLessThanOrEqual=r;function i(a){return a>0}e.isGreaterThan=i;function s(a){return a===0}e.isNeitherLessOrGreaterThan=s,e.greaterThan=1,e.lessThan=-1,e.neitherLessOrGreaterThan=0})(qte||(qte={}));function Ute(e,n){let r=this,i=!1,s;return function(){return i||(i=!0,n||(s=e.apply(r,arguments))),s}}var Jz;(e=>{function n(T){return T&&typeof T=="object"&&typeof T[Symbol.iterator]=="function"}e.is=n;let r=Object.freeze([]);function i(){return r}e.empty=i;function*s(T){yield T}e.single=s;function a(T){return n(T)?T:s(T)}e.wrap=a;function o(T){return T||r}e.from=o;function*l(T){for(let E=T.length-1;E>=0;E--)yield T[E]}e.reverse=l;function u(T){return!T||T[Symbol.iterator]().next().done===!0}e.isEmpty=u;function d(T){return T[Symbol.iterator]().next().value}e.first=d;function p(T,E){let A=0;for(let O of T)if(E(O,A++))return!0;return!1}e.some=p;function f(T,E){for(let A of T)if(E(A))return A}e.find=f;function*g(T,E){for(let A of T)E(A)&&(yield A)}e.filter=g;function*_(T,E){let A=0;for(let O of T)yield E(O,A++)}e.map=_;function*x(T,E){let A=0;for(let O of T)yield*E(O,A++)}e.flatMap=x;function*v(...T){for(let E of T)yield*E}e.concat=v;function S(T,E,A){let O=A;for(let F of T)O=E(O,F);return O}e.reduce=S;function*w(T,E,A=T.length){for(E<0&&(E+=T.length),A<0?A+=T.length:A>T.length&&(A=T.length);E<A;E++)yield T[E]}e.slice=w;function j(T,E=Number.POSITIVE_INFINITY){let A=[];if(E===0)return[A,T];let O=T[Symbol.iterator]();for(let F=0;F<E;F++){let L=O.next();if(L.done)return[A,e.empty()];A.push(L.value)}return[A,{[Symbol.iterator](){return O}}]}e.consume=j;async function C(T){let E=[];for await(let A of T)E.push(A);return Promise.resolve(E)}e.asyncToArray=C})(Jz||(Jz={}));function Md(e){if(Jz.is(e)){let n=[];for(let r of e)if(r)try{r.dispose()}catch(i){n.push(i)}if(n.length===1)throw n[0];if(n.length>1)throw new AggregateError(n,"Encountered errors while disposing of store");return Array.isArray(e)?[]:e}else if(e)return e.dispose(),e}function Kte(...e){return br(()=>Md(e))}function br(e){return{dispose:Ute(()=>{e()})}}var e9=class t9{constructor(){this._toDispose=new Set,this._isDisposed=!1}dispose(){this._isDisposed||(this._isDisposed=!0,this.clear())}get isDisposed(){return this._isDisposed}clear(){if(this._toDispose.size!==0)try{Md(this._toDispose)}finally{this._toDispose.clear()}}add(n){if(!n)return n;if(n===this)throw new Error("Cannot register a disposable on itself!");return this._isDisposed?t9.DISABLE_DISPOSED_WARNING||console.warn(new Error("Trying to add a disposable to a DisposableStore that has already been disposed of. The added object will be leaked!").stack):this._toDispose.add(n),n}delete(n){if(n){if(n===this)throw new Error("Cannot dispose a disposable on itself!");this._toDispose.delete(n),n.dispose()}}deleteAndLeak(n){n&&this._toDispose.has(n)&&(this._toDispose.delete(n),void 0)}};e9.DISABLE_DISPOSED_WARNING=!1;var iu=e9,sn=class{constructor(){this._store=new iu,this._store}dispose(){this._store.dispose()}_register(n){if(n===this)throw new Error("Cannot register a disposable on itself!");return this._store.add(n)}};sn.None=Object.freeze({dispose(){}});var Pf=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(n){var r;this._isDisposed||n===this._value||((r=this._value)==null||r.dispose(),this._value=n)}clear(){this.value=void 0}dispose(){var n;this._isDisposed=!0,(n=this._value)==null||n.dispose(),this._value=void 0}clearAndLeak(){let n=this._value;return this._value=void 0,n}},Fl=typeof window=="object"?window:globalThis,FC=class HC{constructor(n){this.element=n,this.next=HC.Undefined,this.prev=HC.Undefined}};FC.Undefined=new FC(void 0);var wr=FC,BO=class{constructor(){this._first=wr.Undefined,this._last=wr.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===wr.Undefined}clear(){let e=this._first;for(;e!==wr.Undefined;){let n=e.next;e.prev=wr.Undefined,e.next=wr.Undefined,e=n}this._first=wr.Undefined,this._last=wr.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,n){let r=new wr(e);if(this._first===wr.Undefined)this._first=r,this._last=r;else if(n){let s=this._last;this._last=r,r.prev=s,s.next=r}else{let s=this._first;this._first=r,r.next=s,s.prev=r}this._size+=1;let i=!1;return()=>{i||(i=!0,this._remove(r))}}shift(){if(this._first!==wr.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==wr.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==wr.Undefined&&e.next!==wr.Undefined){let n=e.prev;n.next=e.next,e.next.prev=n}else e.prev===wr.Undefined&&e.next===wr.Undefined?(this._first=wr.Undefined,this._last=wr.Undefined):e.next===wr.Undefined?(this._last=this._last.prev,this._last.next=wr.Undefined):e.prev===wr.Undefined&&(this._first=this._first.next,this._first.prev=wr.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==wr.Undefined;)yield e.element,e=e.next}},Vte=globalThis.performance&&typeof globalThis.performance.now=="function",Yte=class n9{static create(n){return new n9(n)}constructor(n){this._now=Vte&&n===!1?Date.now:globalThis.performance.now.bind(globalThis.performance),this._startTime=this._now(),this._stopTime=-1}stop(){this._stopTime=this._now()}reset(){this._startTime=this._now(),this._stopTime=-1}elapsed(){return this._stopTime!==-1?this._stopTime-this._startTime:this._now()-this._startTime}},Ti;(e=>{e.None=()=>sn.None;function n(B,H){return f(B,()=>{},0,void 0,!0,void 0,H)}e.defer=n;function r(B){return(H,D=null,U)=>{let I=!1,X;return X=B(K=>{if(!I)return X?X.dispose():I=!0,H.call(D,K)},null,U),I&&X.dispose(),X}}e.once=r;function i(B,H,D){return d((U,I=null,X)=>B(K=>U.call(I,H(K)),null,X),D)}e.map=i;function s(B,H,D){return d((U,I=null,X)=>B(K=>{H(K),U.call(I,K)},null,X),D)}e.forEach=s;function a(B,H,D){return d((U,I=null,X)=>B(K=>H(K)&&U.call(I,K),null,X),D)}e.filter=a;function o(B){return B}e.signal=o;function l(...B){return(H,D=null,U)=>{let I=Kte(...B.map(X=>X(K=>H.call(D,K))));return p(I,U)}}e.any=l;function u(B,H,D,U){let I=D;return i(B,X=>(I=H(I,X),I),U)}e.reduce=u;function d(B,H){let D,U={onWillAddFirstListener(){D=B(I.fire,I)},onDidRemoveLastListener(){D==null||D.dispose()}},I=new nt(U);return H==null||H.add(I),I.event}function p(B,H){return H instanceof Array?H.push(B):H&&H.add(B),B}function f(B,H,D=100,U=!1,I=!1,X,K){let Q,V,R,q=0,W,te={leakWarningThreshold:X,onWillAddFirstListener(){Q=B(G=>{q++,V=H(V,G),U&&!R&&(J.fire(V),V=void 0),W=()=>{let re=V;V=void 0,R=void 0,(!U||q>1)&&J.fire(re),q=0},typeof D=="number"?(clearTimeout(R),R=setTimeout(W,D)):R===void 0&&(R=0,queueMicrotask(W))})},onWillRemoveListener(){I&&q>0&&(W==null||W())},onDidRemoveLastListener(){W=void 0,Q.dispose()}},J=new nt(te);return K==null||K.add(J),J.event}e.debounce=f;function g(B,H=0,D){return e.debounce(B,(U,I)=>U?(U.push(I),U):[I],H,void 0,!0,void 0,D)}e.accumulate=g;function _(B,H=(U,I)=>U===I,D){let U=!0,I;return a(B,X=>{let K=U||!H(X,I);return U=!1,I=X,K},D)}e.latch=_;function x(B,H,D){return[e.filter(B,H,D),e.filter(B,U=>!H(U),D)]}e.split=x;function v(B,H=!1,D=[],U){let I=D.slice(),X=B(V=>{I?I.push(V):Q.fire(V)});U&&U.add(X);let K=()=>{I==null||I.forEach(V=>Q.fire(V)),I=null},Q=new nt({onWillAddFirstListener(){X||(X=B(V=>Q.fire(V)),U&&U.add(X))},onDidAddFirstListener(){I&&(H?setTimeout(K):K())},onDidRemoveLastListener(){X&&X.dispose(),X=null}});return U&&U.add(Q),Q.event}e.buffer=v;function S(B,H){return(D,U,I)=>{let X=H(new j);return B(function(K){let Q=X.evaluate(K);Q!==w&&D.call(U,Q)},void 0,I)}}e.chain=S;let w=Symbol("HaltChainable");class j{constructor(){this.steps=[]}map(H){return this.steps.push(H),this}forEach(H){return this.steps.push(D=>(H(D),D)),this}filter(H){return this.steps.push(D=>H(D)?D:w),this}reduce(H,D){let U=D;return this.steps.push(I=>(U=H(U,I),U)),this}latch(H=(D,U)=>D===U){let D=!0,U;return this.steps.push(I=>{let X=D||!H(I,U);return D=!1,U=I,X?I:w}),this}evaluate(H){for(let D of this.steps)if(H=D(H),H===w)break;return H}}function C(B,H,D=U=>U){let U=(...Q)=>K.fire(D(...Q)),I=()=>B.on(H,U),X=()=>B.removeListener(H,U),K=new nt({onWillAddFirstListener:I,onDidRemoveLastListener:X});return K.event}e.fromNodeEventEmitter=C;function T(B,H,D=U=>U){let U=(...Q)=>K.fire(D(...Q)),I=()=>B.addEventListener(H,U),X=()=>B.removeEventListener(H,U),K=new nt({onWillAddFirstListener:I,onDidRemoveLastListener:X});return K.event}e.fromDOMEventEmitter=T;function E(B){return new Promise(H=>r(B)(H))}e.toPromise=E;function A(B){let H=new nt;return B.then(D=>{H.fire(D)},()=>{H.fire(void 0)}).finally(()=>{H.dispose()}),H.event}e.fromPromise=A;function O(B,H){return B(D=>H.fire(D))}e.forward=O;function F(B,H,D){return H(D),B(U=>H(U))}e.runAndSubscribe=F;class L{constructor(H,D){this._observable=H,this._counter=0,this._hasChanged=!1;let U={onWillAddFirstListener:()=>{H.addObserver(this)},onDidRemoveLastListener:()=>{H.removeObserver(this)}};this.emitter=new nt(U),D&&D.add(this.emitter)}beginUpdate(H){this._counter++}handlePossibleChange(H){}handleChange(H,D){this._hasChanged=!0}endUpdate(H){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function $(B,H){return new L(B,H).emitter.event}e.fromObservable=$;function z(B){return(H,D,U)=>{let I=0,X=!1,K={beginUpdate(){I++},endUpdate(){I--,I===0&&(B.reportChanges(),X&&(X=!1,H.call(D)))},handlePossibleChange(){},handleChange(){X=!0}};B.addObserver(K),B.reportChanges();let Q={dispose(){B.removeObserver(K)}};return U instanceof iu?U.add(Q):Array.isArray(U)&&U.push(Q),Q}}e.fromObservableLight=z})(Ti||(Ti={}));var WC=class qC{constructor(n){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${n}_${qC._idPool++}`,qC.all.add(this)}start(n){this._stopWatch=new Yte,this.listenerCount=n}stop(){if(this._stopWatch){let n=this._stopWatch.elapsed();this.durations.push(n),this.elapsedOverall+=n,this.invocationCount+=1,this._stopWatch=void 0}}};WC.all=new Set,WC._idPool=0;var Gte=WC,Xte=-1,r9=class i9{constructor(n,r,i=(i9._idPool++).toString(16).padStart(3,"0")){this._errorHandler=n,this.threshold=r,this.name=i,this._warnCountdown=0}dispose(){var n;(n=this._stacks)==null||n.clear()}check(n,r){let i=this.threshold;if(i<=0||r<i)return;this._stacks||(this._stacks=new Map);let s=this._stacks.get(n.value)||0;if(this._stacks.set(n.value,s+1),this._warnCountdown-=1,this._warnCountdown<=0){this._warnCountdown=i*.5;let[a,o]=this.getMostFrequentStack(),l=`[${this.name}] potential listener LEAK detected, having ${r} listeners already. MOST frequent listener (${o}):`;console.warn(l),console.warn(a);let u=new Jte(l,a);this._errorHandler(u)}return()=>{let a=this._stacks.get(n.value)||0;this._stacks.set(n.value,a-1)}}getMostFrequentStack(){if(!this._stacks)return;let n,r=0;for(let[i,s]of this._stacks)(!n||r<s)&&(n=[i,s],r=s);return n}};r9._idPool=1;var Qte=r9,Zte=class s9{constructor(n){this.value=n}static create(){let n=new Error;return new s9(n.stack??"")}print(){console.warn(this.value.split(`
`).slice(2).join(`
`))}},Jte=class extends Error{constructor(e,n){super(e),this.name="ListenerLeakError",this.stack=n}},ene=class extends Error{constructor(e,n){super(e),this.name="ListenerRefusalError",this.stack=n}},tne=0,Hw=class{constructor(e){this.value=e,this.id=tne++}},nne=2,rne,nt=class{constructor(n){var r,i,s,a;this._size=0,this._options=n,this._leakageMon=(r=this._options)!=null&&r.leakWarningThreshold?new Qte((n==null?void 0:n.onListenerError)??_x,((i=this._options)==null?void 0:i.leakWarningThreshold)??Xte):void 0,this._perfMon=(s=this._options)!=null&&s._profName?new Gte(this._options._profName):void 0,this._deliveryQueue=(a=this._options)==null?void 0:a.deliveryQueue}dispose(){var n,r,i,s;this._disposed||(this._disposed=!0,((n=this._deliveryQueue)==null?void 0:n.current)===this&&this._deliveryQueue.reset(),this._listeners&&(this._listeners=void 0,this._size=0),(i=(r=this._options)==null?void 0:r.onDidRemoveLastListener)==null||i.call(r),(s=this._leakageMon)==null||s.dispose())}get event(){return this._event??(this._event=(n,r,i)=>{var l,u,d,p,f;if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let g=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(g);let _=this._leakageMon.getMostFrequentStack()??["UNKNOWN stack",-1],x=new ene(`${g}. HINT: Stack shows most frequent listener (${_[1]}-times)`,_[0]);return(((l=this._options)==null?void 0:l.onListenerError)||_x)(x),sn.None}if(this._disposed)return sn.None;r&&(n=n.bind(r));let s=new Hw(n),a;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(s.stack=Zte.create(),a=this._leakageMon.check(s.stack,this._size+1)),this._listeners?this._listeners instanceof Hw?(this._deliveryQueue??(this._deliveryQueue=new ine),this._listeners=[this._listeners,s]):this._listeners.push(s):((d=(u=this._options)==null?void 0:u.onWillAddFirstListener)==null||d.call(u,this),this._listeners=s,(f=(p=this._options)==null?void 0:p.onDidAddFirstListener)==null||f.call(p,this)),this._size++;let o=br(()=>{a==null||a(),this._removeListener(s)});return i instanceof iu?i.add(o):Array.isArray(i)&&i.push(o),o}),this._event}_removeListener(n){var a,o,l,u;if((o=(a=this._options)==null?void 0:a.onWillRemoveListener)==null||o.call(a,this),!this._listeners)return;if(this._size===1){this._listeners=void 0,(u=(l=this._options)==null?void 0:l.onDidRemoveLastListener)==null||u.call(l,this),this._size=0;return}let r=this._listeners,i=r.indexOf(n);if(i===-1)throw console.log("disposed?",this._disposed),console.log("size?",this._size),console.log("arr?",JSON.stringify(this._listeners)),new Error("Attempted to dispose unknown listener");this._size--,r[i]=void 0;let s=this._deliveryQueue.current===this;if(this._size*nne<=r.length){let d=0;for(let p=0;p<r.length;p++)r[p]?r[d++]=r[p]:s&&(this._deliveryQueue.end--,d<this._deliveryQueue.i&&this._deliveryQueue.i--);r.length=d}}_deliver(n,r){var s;if(!n)return;let i=((s=this._options)==null?void 0:s.onListenerError)||_x;if(!i){n.value(r);return}try{n.value(r)}catch(a){i(a)}}_deliverQueue(n){let r=n.current._listeners;for(;n.i<n.end;)this._deliver(r[n.i++],n.value);n.reset()}fire(n){var r,i,s,a;if((r=this._deliveryQueue)!=null&&r.current&&(this._deliverQueue(this._deliveryQueue),(i=this._perfMon)==null||i.stop()),(s=this._perfMon)==null||s.start(this._size),this._listeners)if(this._listeners instanceof Hw)this._deliver(this._listeners,n);else{let o=this._deliveryQueue;o.enqueue(this,n,this._listeners.length),this._deliverQueue(o)}(a=this._perfMon)==null||a.stop()}hasListeners(){return this._size>0}},ine=class{constructor(){this.i=-1,this.end=0}enqueue(e,n,r){this.i=0,this.end=r,this.current=e,this.value=n}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},UC=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new nt,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new nt,this.onDidChangeFullscreen=this._onDidChangeFullscreen.event,this.mapWindowIdToFullScreen=new Map}getZoomLevel(n){return this.mapWindowIdToZoomLevel.get(this.getWindowId(n))??0}setZoomLevel(n,r){if(this.getZoomLevel(r)===n)return;let i=this.getWindowId(r);this.mapWindowIdToZoomLevel.set(i,n),this._onDidChangeZoomLevel.fire(i)}getZoomFactor(n){return this.mapWindowIdToZoomFactor.get(this.getWindowId(n))??1}setZoomFactor(n,r){this.mapWindowIdToZoomFactor.set(this.getWindowId(r),n)}setFullscreen(n,r){if(this.isFullscreen(r)===n)return;let i=this.getWindowId(r);this.mapWindowIdToFullScreen.set(i,n),this._onDidChangeFullscreen.fire(i)}isFullscreen(n){return!!this.mapWindowIdToFullScreen.get(this.getWindowId(n))}getWindowId(n){return n.vscodeWindowId}};UC.INSTANCE=new UC;var QE=UC;function sne(e,n,r){typeof n=="string"&&(n=e.matchMedia(n)),n.addEventListener("change",r)}QE.INSTANCE.onDidChangeZoomLevel;function ane(e){return QE.INSTANCE.getZoomFactor(e)}QE.INSTANCE.onDidChangeFullscreen;var up=typeof navigator=="object"?navigator.userAgent:"",KC=up.indexOf("Firefox")>=0,one=up.indexOf("AppleWebKit")>=0,ZE=up.indexOf("Chrome")>=0,lne=!ZE&&up.indexOf("Safari")>=0;up.indexOf("Electron/")>=0;up.indexOf("Android")>=0;var Ww=!1;if(typeof Fl.matchMedia=="function"){let e=Fl.matchMedia("(display-mode: standalone) or (display-mode: window-controls-overlay)"),n=Fl.matchMedia("(display-mode: fullscreen)");Ww=e.matches,sne(Fl,e,({matches:r})=>{Ww&&n.matches||(Ww=r)})}var sf="en",VC=!1,YC=!1,xx=!1,a9=!1,o_,bx=sf,zO=sf,cne,Fa,kd=globalThis,Ei,wB;typeof kd.vscode<"u"&&typeof kd.vscode.process<"u"?Ei=kd.vscode.process:typeof process<"u"&&typeof((wB=process==null?void 0:process.versions)==null?void 0:wB.node)=="string"&&(Ei=process);var SB,une=typeof((SB=Ei==null?void 0:Ei.versions)==null?void 0:SB.electron)=="string",dne=une&&(Ei==null?void 0:Ei.type)==="renderer",CB;if(typeof Ei=="object"){VC=Ei.platform==="win32",YC=Ei.platform==="darwin",xx=Ei.platform==="linux",xx&&Ei.env.SNAP&&Ei.env.SNAP_REVISION,Ei.env.CI||Ei.env.BUILD_ARTIFACTSTAGINGDIRECTORY,o_=sf,bx=sf;let e=Ei.env.VSCODE_NLS_CONFIG;if(e)try{let n=JSON.parse(e);o_=n.userLocale,zO=n.osLocale,bx=n.resolvedLanguage||sf,cne=(CB=n.languagePack)==null?void 0:CB.translationsConfigFile}catch{}a9=!0}else typeof navigator=="object"&&!dne?(Fa=navigator.userAgent,VC=Fa.indexOf("Windows")>=0,YC=Fa.indexOf("Macintosh")>=0,(Fa.indexOf("Macintosh")>=0||Fa.indexOf("iPad")>=0||Fa.indexOf("iPhone")>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints>0,xx=Fa.indexOf("Linux")>=0,(Fa==null?void 0:Fa.indexOf("Mobi"))>=0,bx=globalThis._VSCODE_NLS_LANGUAGE||sf,o_=navigator.language.toLowerCase(),zO=o_):console.error("Unable to resolve platform.");var o9=VC,Go=YC,hne=xx,$O=a9,Jo=Fa,Rc=bx,fne;(e=>{function n(){return Rc}e.value=n;function r(){return Rc.length===2?Rc==="en":Rc.length>=3?Rc[0]==="e"&&Rc[1]==="n"&&Rc[2]==="-":!1}e.isDefaultVariant=r;function i(){return Rc==="en"}e.isDefault=i})(fne||(fne={}));var pne=typeof kd.postMessage=="function"&&!kd.importScripts;(()=>{if(pne){let e=[];kd.addEventListener("message",r=>{if(r.data&&r.data.vscodeScheduleAsyncWork)for(let i=0,s=e.length;i<s;i++){let a=e[i];if(a.id===r.data.vscodeScheduleAsyncWork){e.splice(i,1),a.callback();return}}});let n=0;return r=>{let i=++n;e.push({id:i,callback:r}),kd.postMessage({vscodeScheduleAsyncWork:i},"*")}}return e=>setTimeout(e)})();var mne=!!(Jo&&Jo.indexOf("Chrome")>=0);Jo&&Jo.indexOf("Firefox")>=0;!mne&&Jo&&Jo.indexOf("Safari")>=0;Jo&&Jo.indexOf("Edg/")>=0;Jo&&Jo.indexOf("Android")>=0;var Eh=typeof navigator=="object"?navigator:{};$O||document.queryCommandSupported&&document.queryCommandSupported("copy")||Eh&&Eh.clipboard&&Eh.clipboard.writeText,$O||Eh&&Eh.clipboard&&Eh.clipboard.readText;var JE=class{constructor(){this._keyCodeToStr=[],this._strToKeyCode=Object.create(null)}define(e,n){this._keyCodeToStr[e]=n,this._strToKeyCode[n.toLowerCase()]=e}keyCodeToStr(e){return this._keyCodeToStr[e]}strToKeyCode(e){return this._strToKeyCode[e.toLowerCase()]||0}},qw=new JE,FO=new JE,HO=new JE,gne=new Array(230),l9;(e=>{function n(l){return qw.keyCodeToStr(l)}e.toString=n;function r(l){return qw.strToKeyCode(l)}e.fromString=r;function i(l){return FO.keyCodeToStr(l)}e.toUserSettingsUS=i;function s(l){return HO.keyCodeToStr(l)}e.toUserSettingsGeneral=s;function a(l){return FO.strToKeyCode(l)||HO.strToKeyCode(l)}e.fromUserSettings=a;function o(l){if(l>=98&&l<=113)return null;switch(l){case 16:return"Up";case 18:return"Down";case 15:return"Left";case 17:return"Right"}return qw.keyCodeToStr(l)}e.toElectronAccelerator=o})(l9||(l9={}));var vne=class c9{constructor(n,r,i,s,a){this.ctrlKey=n,this.shiftKey=r,this.altKey=i,this.metaKey=s,this.keyCode=a}equals(n){return n instanceof c9&&this.ctrlKey===n.ctrlKey&&this.shiftKey===n.shiftKey&&this.altKey===n.altKey&&this.metaKey===n.metaKey&&this.keyCode===n.keyCode}getHashCode(){let n=this.ctrlKey?"1":"0",r=this.shiftKey?"1":"0",i=this.altKey?"1":"0",s=this.metaKey?"1":"0";return`K${n}${r}${i}${s}${this.keyCode}`}isModifierKey(){return this.keyCode===0||this.keyCode===5||this.keyCode===57||this.keyCode===6||this.keyCode===4}toKeybinding(){return new yne([this])}isDuplicateModifierCase(){return this.ctrlKey&&this.keyCode===5||this.shiftKey&&this.keyCode===4||this.altKey&&this.keyCode===6||this.metaKey&&this.keyCode===57}},yne=class{constructor(e){if(e.length===0)throw Wte("chords");this.chords=e}getHashCode(){let e="";for(let n=0,r=this.chords.length;n<r;n++)n!==0&&(e+=";"),e+=this.chords[n].getHashCode();return e}equals(e){if(e===null||this.chords.length!==e.chords.length)return!1;for(let n=0;n<this.chords.length;n++)if(!this.chords[n].equals(e.chords[n]))return!1;return!0}};function _ne(e){if(e.charCode){let r=String.fromCharCode(e.charCode).toUpperCase();return l9.fromString(r)}let n=e.keyCode;if(n===3)return 7;if(KC)switch(n){case 59:return 85;case 60:if(hne)return 97;break;case 61:return 86;case 107:return 109;case 109:return 111;case 173:return 88;case 224:if(Go)return 57;break}else if(one&&(Go&&n===93||!Go&&n===92))return 57;return gne[n]||0}var xne=Go?256:2048,bne=512,kne=1024,wne=Go?2048:256,WO=class{constructor(e){var r;this._standardKeyboardEventBrand=!0;let n=e;this.browserEvent=n,this.target=n.target,this.ctrlKey=n.ctrlKey,this.shiftKey=n.shiftKey,this.altKey=n.altKey,this.metaKey=n.metaKey,this.altGraphKey=(r=n.getModifierState)==null?void 0:r.call(n,"AltGraph"),this.keyCode=_ne(n),this.code=n.code,this.ctrlKey=this.ctrlKey||this.keyCode===5,this.altKey=this.altKey||this.keyCode===6,this.shiftKey=this.shiftKey||this.keyCode===4,this.metaKey=this.metaKey||this.keyCode===57,this._asKeybinding=this._computeKeybinding(),this._asKeyCodeChord=this._computeKeyCodeChord()}preventDefault(){this.browserEvent&&this.browserEvent.preventDefault&&this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent&&this.browserEvent.stopPropagation&&this.browserEvent.stopPropagation()}toKeyCodeChord(){return this._asKeyCodeChord}equals(e){return this._asKeybinding===e}_computeKeybinding(){let e=0;this.keyCode!==5&&this.keyCode!==4&&this.keyCode!==6&&this.keyCode!==57&&(e=this.keyCode);let n=0;return this.ctrlKey&&(n|=xne),this.altKey&&(n|=bne),this.shiftKey&&(n|=kne),this.metaKey&&(n|=wne),n|=e,n}_computeKeyCodeChord(){let e=0;return this.keyCode!==5&&this.keyCode!==4&&this.keyCode!==6&&this.keyCode!==57&&(e=this.keyCode),new vne(this.ctrlKey,this.shiftKey,this.altKey,this.metaKey,e)}},qO=new WeakMap;function Sne(e){if(!e.parent||e.parent===e)return null;try{let n=e.location,r=e.parent.location;if(n.origin!=="null"&&r.origin!=="null"&&n.origin!==r.origin)return null}catch{return null}return e.parent}var Cne=class{static getSameOriginWindowChain(e){let n=qO.get(e);if(!n){n=[],qO.set(e,n);let r=e,i;do i=Sne(r),i?n.push({window:new WeakRef(r),iframeElement:r.frameElement||null}):n.push({window:new WeakRef(r),iframeElement:null}),r=i;while(r)}return n.slice(0)}static getPositionOfChildWindowRelativeToAncestorWindow(e,n){if(!n||e===n)return{top:0,left:0};let r=0,i=0,s=this.getSameOriginWindowChain(e);for(let a of s){let o=a.window.deref();if(r+=(o==null?void 0:o.scrollY)??0,i+=(o==null?void 0:o.scrollX)??0,o===n||!a.iframeElement)break;let l=a.iframeElement.getBoundingClientRect();r+=l.top,i+=l.left}return{top:r,left:i}}},l_=class{constructor(e,n){this.timestamp=Date.now(),this.browserEvent=n,this.leftButton=n.button===0,this.middleButton=n.button===1,this.rightButton=n.button===2,this.buttons=n.buttons,this.target=n.target,this.detail=n.detail||1,n.type==="dblclick"&&(this.detail=2),this.ctrlKey=n.ctrlKey,this.shiftKey=n.shiftKey,this.altKey=n.altKey,this.metaKey=n.metaKey,typeof n.pageX=="number"?(this.posx=n.pageX,this.posy=n.pageY):(this.posx=n.clientX+this.target.ownerDocument.body.scrollLeft+this.target.ownerDocument.documentElement.scrollLeft,this.posy=n.clientY+this.target.ownerDocument.body.scrollTop+this.target.ownerDocument.documentElement.scrollTop);let r=Cne.getPositionOfChildWindowRelativeToAncestorWindow(e,n.view);this.posx-=r.left,this.posy-=r.top}preventDefault(){this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent.stopPropagation()}},UO=class{constructor(e,n=0,r=0){var s;this.browserEvent=e||null,this.target=e?e.target||e.targetNode||e.srcElement:null,this.deltaY=r,this.deltaX=n;let i=!1;if(ZE){let a=navigator.userAgent.match(/Chrome\/(\d+)/);i=(a?parseInt(a[1]):123)<=122}if(e){let a=e,o=e,l=((s=e.view)==null?void 0:s.devicePixelRatio)||1;if(typeof a.wheelDeltaY<"u")i?this.deltaY=a.wheelDeltaY/(120*l):this.deltaY=a.wheelDeltaY/120;else if(typeof o.VERTICAL_AXIS<"u"&&o.axis===o.VERTICAL_AXIS)this.deltaY=-o.detail/3;else if(e.type==="wheel"){let u=e;u.deltaMode===u.DOM_DELTA_LINE?KC&&!Go?this.deltaY=-e.deltaY/3:this.deltaY=-e.deltaY:this.deltaY=-e.deltaY/40}if(typeof a.wheelDeltaX<"u")lne&&o9?this.deltaX=-(a.wheelDeltaX/120):i?this.deltaX=a.wheelDeltaX/(120*l):this.deltaX=a.wheelDeltaX/120;else if(typeof o.HORIZONTAL_AXIS<"u"&&o.axis===o.HORIZONTAL_AXIS)this.deltaX=-e.detail/3;else if(e.type==="wheel"){let u=e;u.deltaMode===u.DOM_DELTA_LINE?KC&&!Go?this.deltaX=-e.deltaX/3:this.deltaX=-e.deltaX:this.deltaX=-e.deltaX/40}this.deltaY===0&&this.deltaX===0&&e.wheelDelta&&(i?this.deltaY=e.wheelDelta/(120*l):this.deltaY=e.wheelDelta/120)}}preventDefault(){var e;(e=this.browserEvent)==null||e.preventDefault()}stopPropagation(){var e;(e=this.browserEvent)==null||e.stopPropagation()}},u9=Object.freeze(function(e,n){let r=setTimeout(e.bind(n),0);return{dispose(){clearTimeout(r)}}}),jne;(e=>{function n(r){return r===e.None||r===e.Cancelled||r instanceof Nne?!0:!r||typeof r!="object"?!1:typeof r.isCancellationRequested=="boolean"&&typeof r.onCancellationRequested=="function"}e.isCancellationToken=n,e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:Ti.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:u9})})(jne||(jne={}));var Nne=class{constructor(){this._isCancelled=!1,this._emitter=null}cancel(){this._isCancelled||(this._isCancelled=!0,this._emitter&&(this._emitter.fire(void 0),this.dispose()))}get isCancellationRequested(){return this._isCancelled}get onCancellationRequested(){return this._isCancelled?u9:(this._emitter||(this._emitter=new nt),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}},eA=class{constructor(e,n){this._isDisposed=!1,this._token=-1,typeof e=="function"&&typeof n=="number"&&this.setIfNotSet(e,n)}dispose(){this.cancel(),this._isDisposed=!0}cancel(){this._token!==-1&&(clearTimeout(this._token),this._token=-1)}cancelAndSet(e,n){if(this._isDisposed)throw new $C("Calling 'cancelAndSet' on a disposed TimeoutTimer");this.cancel(),this._token=setTimeout(()=>{this._token=-1,e()},n)}setIfNotSet(e,n){if(this._isDisposed)throw new $C("Calling 'setIfNotSet' on a disposed TimeoutTimer");this._token===-1&&(this._token=setTimeout(()=>{this._token=-1,e()},n))}},Ene=class{constructor(){this.disposable=void 0,this.isDisposed=!1}cancel(){var e;(e=this.disposable)==null||e.dispose(),this.disposable=void 0}cancelAndSet(e,n,r=globalThis){if(this.isDisposed)throw new $C("Calling 'cancelAndSet' on a disposed IntervalTimer");this.cancel();let i=r.setInterval(()=>{e()},n);this.disposable=br(()=>{r.clearInterval(i),this.disposable=void 0})}dispose(){this.cancel(),this.isDisposed=!0}},Ane;(e=>{async function n(i){let s,a=await Promise.all(i.map(o=>o.then(l=>l,l=>{s||(s=l)})));if(typeof s<"u")throw s;return a}e.settled=n;function r(i){return new Promise(async(s,a)=>{try{await i(s,a)}catch(o){a(o)}})}e.withAsyncBody=r})(Ane||(Ane={}));var KO=class ba{static fromArray(n){return new ba(r=>{r.emitMany(n)})}static fromPromise(n){return new ba(async r=>{r.emitMany(await n)})}static fromPromises(n){return new ba(async r=>{await Promise.all(n.map(async i=>r.emitOne(await i)))})}static merge(n){return new ba(async r=>{await Promise.all(n.map(async i=>{for await(let s of i)r.emitOne(s)}))})}constructor(n,r){this._state=0,this._results=[],this._error=null,this._onReturn=r,this._onStateChanged=new nt,queueMicrotask(async()=>{let i={emitOne:s=>this.emitOne(s),emitMany:s=>this.emitMany(s),reject:s=>this.reject(s)};try{await Promise.resolve(n(i)),this.resolve()}catch(s){this.reject(s)}finally{i.emitOne=void 0,i.emitMany=void 0,i.reject=void 0}})}[Symbol.asyncIterator](){let n=0;return{next:async()=>{do{if(this._state===2)throw this._error;if(n<this._results.length)return{done:!1,value:this._results[n++]};if(this._state===1)return{done:!0,value:void 0};await Ti.toPromise(this._onStateChanged.event)}while(!0)},return:async()=>{var r;return(r=this._onReturn)==null||r.call(this),{done:!0,value:void 0}}}}static map(n,r){return new ba(async i=>{for await(let s of n)i.emitOne(r(s))})}map(n){return ba.map(this,n)}static filter(n,r){return new ba(async i=>{for await(let s of n)r(s)&&i.emitOne(s)})}filter(n){return ba.filter(this,n)}static coalesce(n){return ba.filter(n,r=>!!r)}coalesce(){return ba.coalesce(this)}static async toPromise(n){let r=[];for await(let i of n)r.push(i);return r}toPromise(){return ba.toPromise(this)}emitOne(n){this._state===0&&(this._results.push(n),this._onStateChanged.fire())}emitMany(n){this._state===0&&(this._results=this._results.concat(n),this._onStateChanged.fire())}resolve(){this._state===0&&(this._state=1,this._onStateChanged.fire())}reject(n){this._state===0&&(this._state=2,this._error=n,this._onStateChanged.fire())}};KO.EMPTY=KO.fromArray([]);var{getWindow:Fo,getWindowId:Tne,onDidRegisterWindow:Mne}=(function(){let e=new Map,n={window:Fl,disposables:new iu};e.set(Fl.vscodeWindowId,n);let r=new nt,i=new nt,s=new nt;function a(o,l){return(typeof o=="number"?e.get(o):void 0)??(l?n:void 0)}return{onDidRegisterWindow:r.event,onWillUnregisterWindow:s.event,onDidUnregisterWindow:i.event,registerWindow(o){if(e.has(o.vscodeWindowId))return sn.None;let l=new iu,u={window:o,disposables:l.add(new iu)};return e.set(o.vscodeWindowId,u),l.add(br(()=>{e.delete(o.vscodeWindowId),i.fire(o)})),l.add(Ut(o,ui.BEFORE_UNLOAD,()=>{s.fire(o)})),r.fire(u),l},getWindows(){return e.values()},getWindowsCount(){return e.size},getWindowId(o){return o.vscodeWindowId},hasWindow(o){return e.has(o)},getWindowById:a,getWindow(o){var d;let l=o;if((d=l==null?void 0:l.ownerDocument)!=null&&d.defaultView)return l.ownerDocument.defaultView.window;let u=o;return u!=null&&u.view?u.view.window:Fl},getDocument(o){return Fo(o).document}}})(),Rne=class{constructor(e,n,r,i){this._node=e,this._type=n,this._handler=r,this._options=i||!1,this._node.addEventListener(this._type,this._handler,this._options)}dispose(){this._handler&&(this._node.removeEventListener(this._type,this._handler,this._options),this._node=null,this._handler=null)}};function Ut(e,n,r,i){return new Rne(e,n,r,i)}var VO=function(e,n,r,i){return Ut(e,n,r,i)},tA,One=class extends Ene{constructor(e){super(),this.defaultTarget=e&&Fo(e)}cancelAndSet(e,n,r){return super.cancelAndSet(e,n,r??this.defaultTarget)}},YO=class{constructor(e,n=0){this._runner=e,this.priority=n,this._canceled=!1}dispose(){this._canceled=!0}execute(){if(!this._canceled)try{this._runner()}catch(e){_x(e)}}static sort(e,n){return n.priority-e.priority}};(function(){let e=new Map,n=new Map,r=new Map,i=new Map,s=a=>{r.set(a,!1);let o=e.get(a)??[];for(n.set(a,o),e.set(a,[]),i.set(a,!0);o.length>0;)o.sort(YO.sort),o.shift().execute();i.set(a,!1)};tA=(a,o,l=0)=>{let u=Tne(a),d=new YO(o,l),p=e.get(u);return p||(p=[],e.set(u,p)),p.push(d),r.get(u)||(r.set(u,!0),a.requestAnimationFrame(()=>s(u))),d}})();function Dne(e){let n=e.getBoundingClientRect(),r=Fo(e);return{left:n.left+r.scrollX,top:n.top+r.scrollY,width:n.width,height:n.height}}var ui={CLICK:"click",MOUSE_DOWN:"mousedown",MOUSE_OVER:"mouseover",MOUSE_LEAVE:"mouseleave",MOUSE_WHEEL:"wheel",POINTER_UP:"pointerup",POINTER_DOWN:"pointerdown",POINTER_MOVE:"pointermove",KEY_DOWN:"keydown",KEY_UP:"keyup",BEFORE_UNLOAD:"beforeunload",CHANGE:"change",FOCUS:"focus",BLUR:"blur",INPUT:"input"},Pne=class{constructor(e){this.domNode=e,this._maxWidth="",this._width="",this._height="",this._top="",this._left="",this._bottom="",this._right="",this._paddingTop="",this._paddingLeft="",this._paddingBottom="",this._paddingRight="",this._fontFamily="",this._fontWeight="",this._fontSize="",this._fontStyle="",this._fontFeatureSettings="",this._fontVariationSettings="",this._textDecoration="",this._lineHeight="",this._letterSpacing="",this._className="",this._display="",this._position="",this._visibility="",this._color="",this._backgroundColor="",this._layerHint=!1,this._contain="none",this._boxShadow=""}setMaxWidth(e){let n=_s(e);this._maxWidth!==n&&(this._maxWidth=n,this.domNode.style.maxWidth=this._maxWidth)}setWidth(e){let n=_s(e);this._width!==n&&(this._width=n,this.domNode.style.width=this._width)}setHeight(e){let n=_s(e);this._height!==n&&(this._height=n,this.domNode.style.height=this._height)}setTop(e){let n=_s(e);this._top!==n&&(this._top=n,this.domNode.style.top=this._top)}setLeft(e){let n=_s(e);this._left!==n&&(this._left=n,this.domNode.style.left=this._left)}setBottom(e){let n=_s(e);this._bottom!==n&&(this._bottom=n,this.domNode.style.bottom=this._bottom)}setRight(e){let n=_s(e);this._right!==n&&(this._right=n,this.domNode.style.right=this._right)}setPaddingTop(e){let n=_s(e);this._paddingTop!==n&&(this._paddingTop=n,this.domNode.style.paddingTop=this._paddingTop)}setPaddingLeft(e){let n=_s(e);this._paddingLeft!==n&&(this._paddingLeft=n,this.domNode.style.paddingLeft=this._paddingLeft)}setPaddingBottom(e){let n=_s(e);this._paddingBottom!==n&&(this._paddingBottom=n,this.domNode.style.paddingBottom=this._paddingBottom)}setPaddingRight(e){let n=_s(e);this._paddingRight!==n&&(this._paddingRight=n,this.domNode.style.paddingRight=this._paddingRight)}setFontFamily(e){this._fontFamily!==e&&(this._fontFamily=e,this.domNode.style.fontFamily=this._fontFamily)}setFontWeight(e){this._fontWeight!==e&&(this._fontWeight=e,this.domNode.style.fontWeight=this._fontWeight)}setFontSize(e){let n=_s(e);this._fontSize!==n&&(this._fontSize=n,this.domNode.style.fontSize=this._fontSize)}setFontStyle(e){this._fontStyle!==e&&(this._fontStyle=e,this.domNode.style.fontStyle=this._fontStyle)}setFontFeatureSettings(e){this._fontFeatureSettings!==e&&(this._fontFeatureSettings=e,this.domNode.style.fontFeatureSettings=this._fontFeatureSettings)}setFontVariationSettings(e){this._fontVariationSettings!==e&&(this._fontVariationSettings=e,this.domNode.style.fontVariationSettings=this._fontVariationSettings)}setTextDecoration(e){this._textDecoration!==e&&(this._textDecoration=e,this.domNode.style.textDecoration=this._textDecoration)}setLineHeight(e){let n=_s(e);this._lineHeight!==n&&(this._lineHeight=n,this.domNode.style.lineHeight=this._lineHeight)}setLetterSpacing(e){let n=_s(e);this._letterSpacing!==n&&(this._letterSpacing=n,this.domNode.style.letterSpacing=this._letterSpacing)}setClassName(e){this._className!==e&&(this._className=e,this.domNode.className=this._className)}toggleClassName(e,n){this.domNode.classList.toggle(e,n),this._className=this.domNode.className}setDisplay(e){this._display!==e&&(this._display=e,this.domNode.style.display=this._display)}setPosition(e){this._position!==e&&(this._position=e,this.domNode.style.position=this._position)}setVisibility(e){this._visibility!==e&&(this._visibility=e,this.domNode.style.visibility=this._visibility)}setColor(e){this._color!==e&&(this._color=e,this.domNode.style.color=this._color)}setBackgroundColor(e){this._backgroundColor!==e&&(this._backgroundColor=e,this.domNode.style.backgroundColor=this._backgroundColor)}setLayerHinting(e){this._layerHint!==e&&(this._layerHint=e,this.domNode.style.transform=this._layerHint?"translate3d(0px, 0px, 0px)":"")}setBoxShadow(e){this._boxShadow!==e&&(this._boxShadow=e,this.domNode.style.boxShadow=e)}setContain(e){this._contain!==e&&(this._contain=e,this.domNode.style.contain=this._contain)}setAttribute(e,n){this.domNode.setAttribute(e,n)}removeAttribute(e){this.domNode.removeAttribute(e)}appendChild(e){this.domNode.appendChild(e.domNode)}removeChild(e){this.domNode.removeChild(e.domNode)}};function _s(e){return typeof e=="number"?`${e}px`:e}function sg(e){return new Pne(e)}var d9=class{constructor(){this._hooks=new iu,this._pointerMoveCallback=null,this._onStopCallback=null}dispose(){this.stopMonitoring(!1),this._hooks.dispose()}stopMonitoring(e,n){if(!this.isMonitoring())return;this._hooks.clear(),this._pointerMoveCallback=null;let r=this._onStopCallback;this._onStopCallback=null,e&&r&&r(n)}isMonitoring(){return!!this._pointerMoveCallback}startMonitoring(e,n,r,i,s){this.isMonitoring()&&this.stopMonitoring(!1),this._pointerMoveCallback=i,this._onStopCallback=s;let a=e;try{e.setPointerCapture(n),this._hooks.add(br(()=>{try{e.releasePointerCapture(n)}catch{}}))}catch{a=Fo(e)}this._hooks.add(Ut(a,ui.POINTER_MOVE,o=>{if(o.buttons!==r){this.stopMonitoring(!0);return}o.preventDefault(),this._pointerMoveCallback(o)})),this._hooks.add(Ut(a,ui.POINTER_UP,o=>this.stopMonitoring(!0)))}};function Lne(e,n,r){let i=null,s=null;if(typeof r.value=="function"?(i="value",s=r.value,s.length!==0&&console.warn("Memoize should only be used in functions with zero parameters")):typeof r.get=="function"&&(i="get",s=r.get),!s)throw new Error("not supported");let a=`$memoize$${n}`;r[i]=function(...o){return this.hasOwnProperty(a)||Object.defineProperty(this,a,{configurable:!1,enumerable:!1,writable:!1,value:s.apply(this,o)}),this[a]}}var Ao;(e=>(e.Tap="-xterm-gesturetap",e.Change="-xterm-gesturechange",e.Start="-xterm-gesturestart",e.End="-xterm-gesturesend",e.Contextmenu="-xterm-gesturecontextmenu"))(Ao||(Ao={}));var $m=class Hi extends sn{constructor(){super(),this.dispatched=!1,this.targets=new BO,this.ignoreTargets=new BO,this.activeTouches={},this.handle=null,this._lastSetTapCountTime=0,this._register(Ti.runAndSubscribe(Mne,({window:n,disposables:r})=>{r.add(Ut(n.document,"touchstart",i=>this.onTouchStart(i),{passive:!1})),r.add(Ut(n.document,"touchend",i=>this.onTouchEnd(n,i))),r.add(Ut(n.document,"touchmove",i=>this.onTouchMove(i),{passive:!1}))},{window:Fl,disposables:this._store}))}static addTarget(n){if(!Hi.isTouchDevice())return sn.None;Hi.INSTANCE||(Hi.INSTANCE=new Hi);let r=Hi.INSTANCE.targets.push(n);return br(r)}static ignoreTarget(n){if(!Hi.isTouchDevice())return sn.None;Hi.INSTANCE||(Hi.INSTANCE=new Hi);let r=Hi.INSTANCE.ignoreTargets.push(n);return br(r)}static isTouchDevice(){return"ontouchstart"in Fl||navigator.maxTouchPoints>0}dispose(){this.handle&&(this.handle.dispose(),this.handle=null),super.dispose()}onTouchStart(n){let r=Date.now();this.handle&&(this.handle.dispose(),this.handle=null);for(let i=0,s=n.targetTouches.length;i<s;i++){let a=n.targetTouches.item(i);this.activeTouches[a.identifier]={id:a.identifier,initialTarget:a.target,initialTimeStamp:r,initialPageX:a.pageX,initialPageY:a.pageY,rollingTimestamps:[r],rollingPageX:[a.pageX],rollingPageY:[a.pageY]};let o=this.newGestureEvent(Ao.Start,a.target);o.pageX=a.pageX,o.pageY=a.pageY,this.dispatchEvent(o)}this.dispatched&&(n.preventDefault(),n.stopPropagation(),this.dispatched=!1)}onTouchEnd(n,r){let i=Date.now(),s=Object.keys(this.activeTouches).length;for(let a=0,o=r.changedTouches.length;a<o;a++){let l=r.changedTouches.item(a);if(!this.activeTouches.hasOwnProperty(String(l.identifier))){console.warn("move of an UNKNOWN touch",l);continue}let u=this.activeTouches[l.identifier],d=Date.now()-u.initialTimeStamp;if(d<Hi.HOLD_DELAY&&Math.abs(u.initialPageX-Ks(u.rollingPageX))<30&&Math.abs(u.initialPageY-Ks(u.rollingPageY))<30){let p=this.newGestureEvent(Ao.Tap,u.initialTarget);p.pageX=Ks(u.rollingPageX),p.pageY=Ks(u.rollingPageY),this.dispatchEvent(p)}else if(d>=Hi.HOLD_DELAY&&Math.abs(u.initialPageX-Ks(u.rollingPageX))<30&&Math.abs(u.initialPageY-Ks(u.rollingPageY))<30){let p=this.newGestureEvent(Ao.Contextmenu,u.initialTarget);p.pageX=Ks(u.rollingPageX),p.pageY=Ks(u.rollingPageY),this.dispatchEvent(p)}else if(s===1){let p=Ks(u.rollingPageX),f=Ks(u.rollingPageY),g=Ks(u.rollingTimestamps)-u.rollingTimestamps[0],_=p-u.rollingPageX[0],x=f-u.rollingPageY[0],v=[...this.targets].filter(S=>u.initialTarget instanceof Node&&S.contains(u.initialTarget));this.inertia(n,v,i,Math.abs(_)/g,_>0?1:-1,p,Math.abs(x)/g,x>0?1:-1,f)}this.dispatchEvent(this.newGestureEvent(Ao.End,u.initialTarget)),delete this.activeTouches[l.identifier]}this.dispatched&&(r.preventDefault(),r.stopPropagation(),this.dispatched=!1)}newGestureEvent(n,r){let i=document.createEvent("CustomEvent");return i.initEvent(n,!1,!0),i.initialTarget=r,i.tapCount=0,i}dispatchEvent(n){if(n.type===Ao.Tap){let r=new Date().getTime(),i=0;r-this._lastSetTapCountTime>Hi.CLEAR_TAP_COUNT_TIME?i=1:i=2,this._lastSetTapCountTime=r,n.tapCount=i}else(n.type===Ao.Change||n.type===Ao.Contextmenu)&&(this._lastSetTapCountTime=0);if(n.initialTarget instanceof Node){for(let i of this.ignoreTargets)if(i.contains(n.initialTarget))return;let r=[];for(let i of this.targets)if(i.contains(n.initialTarget)){let s=0,a=n.initialTarget;for(;a&&a!==i;)s++,a=a.parentElement;r.push([s,i])}r.sort((i,s)=>i[0]-s[0]);for(let[i,s]of r)s.dispatchEvent(n),this.dispatched=!0}}inertia(n,r,i,s,a,o,l,u,d){this.handle=tA(n,()=>{let p=Date.now(),f=p-i,g=0,_=0,x=!0;s+=Hi.SCROLL_FRICTION*f,l+=Hi.SCROLL_FRICTION*f,s>0&&(x=!1,g=a*s*f),l>0&&(x=!1,_=u*l*f);let v=this.newGestureEvent(Ao.Change);v.translationX=g,v.translationY=_,r.forEach(S=>S.dispatchEvent(v)),x||this.inertia(n,r,p,s,a,o+g,l,u,d+_)})}onTouchMove(n){let r=Date.now();for(let i=0,s=n.changedTouches.length;i<s;i++){let a=n.changedTouches.item(i);if(!this.activeTouches.hasOwnProperty(String(a.identifier))){console.warn("end of an UNKNOWN touch",a);continue}let o=this.activeTouches[a.identifier],l=this.newGestureEvent(Ao.Change,o.initialTarget);l.translationX=a.pageX-Ks(o.rollingPageX),l.translationY=a.pageY-Ks(o.rollingPageY),l.pageX=a.pageX,l.pageY=a.pageY,this.dispatchEvent(l),o.rollingPageX.length>3&&(o.rollingPageX.shift(),o.rollingPageY.shift(),o.rollingTimestamps.shift()),o.rollingPageX.push(a.pageX),o.rollingPageY.push(a.pageY),o.rollingTimestamps.push(r)}this.dispatched&&(n.preventDefault(),n.stopPropagation(),this.dispatched=!1)}};$m.SCROLL_FRICTION=-.005,$m.HOLD_DELAY=700,$m.CLEAR_TAP_COUNT_TIME=400,Dr([Lne],$m,"isTouchDevice",1);var Ine=$m,nA=class extends sn{onclick(e,n){this._register(Ut(e,ui.CLICK,r=>n(new l_(Fo(e),r))))}onmousedown(e,n){this._register(Ut(e,ui.MOUSE_DOWN,r=>n(new l_(Fo(e),r))))}onmouseover(e,n){this._register(Ut(e,ui.MOUSE_OVER,r=>n(new l_(Fo(e),r))))}onmouseleave(e,n){this._register(Ut(e,ui.MOUSE_LEAVE,r=>n(new l_(Fo(e),r))))}onkeydown(e,n){this._register(Ut(e,ui.KEY_DOWN,r=>n(new WO(r))))}onkeyup(e,n){this._register(Ut(e,ui.KEY_UP,r=>n(new WO(r))))}oninput(e,n){this._register(Ut(e,ui.INPUT,n))}onblur(e,n){this._register(Ut(e,ui.BLUR,n))}onfocus(e,n){this._register(Ut(e,ui.FOCUS,n))}onchange(e,n){this._register(Ut(e,ui.CHANGE,n))}ignoreGesture(e){return Ine.ignoreTarget(e)}},GO=11,Bne=class extends nA{constructor(e){super(),this._onActivate=e.onActivate,this.bgDomNode=document.createElement("div"),this.bgDomNode.className="arrow-background",this.bgDomNode.style.position="absolute",this.bgDomNode.style.width=e.bgWidth+"px",this.bgDomNode.style.height=e.bgHeight+"px",typeof e.top<"u"&&(this.bgDomNode.style.top="0px"),typeof e.left<"u"&&(this.bgDomNode.style.left="0px"),typeof e.bottom<"u"&&(this.bgDomNode.style.bottom="0px"),typeof e.right<"u"&&(this.bgDomNode.style.right="0px"),this.domNode=document.createElement("div"),this.domNode.className=e.className,this.domNode.style.position="absolute",this.domNode.style.width=GO+"px",this.domNode.style.height=GO+"px",typeof e.top<"u"&&(this.domNode.style.top=e.top+"px"),typeof e.left<"u"&&(this.domNode.style.left=e.left+"px"),typeof e.bottom<"u"&&(this.domNode.style.bottom=e.bottom+"px"),typeof e.right<"u"&&(this.domNode.style.right=e.right+"px"),this._pointerMoveMonitor=this._register(new d9),this._register(VO(this.bgDomNode,ui.POINTER_DOWN,n=>this._arrowPointerDown(n))),this._register(VO(this.domNode,ui.POINTER_DOWN,n=>this._arrowPointerDown(n))),this._pointerdownRepeatTimer=this._register(new One),this._pointerdownScheduleRepeatTimer=this._register(new eA)}_arrowPointerDown(e){if(!e.target||!(e.target instanceof Element))return;let n=()=>{this._pointerdownRepeatTimer.cancelAndSet(()=>this._onActivate(),1e3/24,Fo(e))};this._onActivate(),this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancelAndSet(n,200),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,r=>{},()=>{this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancel()}),e.preventDefault()}},zne=class GC{constructor(n,r,i,s,a,o,l){this._forceIntegerValues=n,this._scrollStateBrand=void 0,this._forceIntegerValues&&(r=r|0,i=i|0,s=s|0,a=a|0,o=o|0,l=l|0),this.rawScrollLeft=s,this.rawScrollTop=l,r<0&&(r=0),s+r>i&&(s=i-r),s<0&&(s=0),a<0&&(a=0),l+a>o&&(l=o-a),l<0&&(l=0),this.width=r,this.scrollWidth=i,this.scrollLeft=s,this.height=a,this.scrollHeight=o,this.scrollTop=l}equals(n){return this.rawScrollLeft===n.rawScrollLeft&&this.rawScrollTop===n.rawScrollTop&&this.width===n.width&&this.scrollWidth===n.scrollWidth&&this.scrollLeft===n.scrollLeft&&this.height===n.height&&this.scrollHeight===n.scrollHeight&&this.scrollTop===n.scrollTop}withScrollDimensions(n,r){return new GC(this._forceIntegerValues,typeof n.width<"u"?n.width:this.width,typeof n.scrollWidth<"u"?n.scrollWidth:this.scrollWidth,r?this.rawScrollLeft:this.scrollLeft,typeof n.height<"u"?n.height:this.height,typeof n.scrollHeight<"u"?n.scrollHeight:this.scrollHeight,r?this.rawScrollTop:this.scrollTop)}withScrollPosition(n){return new GC(this._forceIntegerValues,this.width,this.scrollWidth,typeof n.scrollLeft<"u"?n.scrollLeft:this.rawScrollLeft,this.height,this.scrollHeight,typeof n.scrollTop<"u"?n.scrollTop:this.rawScrollTop)}createScrollEvent(n,r){let i=this.width!==n.width,s=this.scrollWidth!==n.scrollWidth,a=this.scrollLeft!==n.scrollLeft,o=this.height!==n.height,l=this.scrollHeight!==n.scrollHeight,u=this.scrollTop!==n.scrollTop;return{inSmoothScrolling:r,oldWidth:n.width,oldScrollWidth:n.scrollWidth,oldScrollLeft:n.scrollLeft,width:this.width,scrollWidth:this.scrollWidth,scrollLeft:this.scrollLeft,oldHeight:n.height,oldScrollHeight:n.scrollHeight,oldScrollTop:n.scrollTop,height:this.height,scrollHeight:this.scrollHeight,scrollTop:this.scrollTop,widthChanged:i,scrollWidthChanged:s,scrollLeftChanged:a,heightChanged:o,scrollHeightChanged:l,scrollTopChanged:u}}},$ne=class extends sn{constructor(e){super(),this._scrollableBrand=void 0,this._onScroll=this._register(new nt),this.onScroll=this._onScroll.event,this._smoothScrollDuration=e.smoothScrollDuration,this._scheduleAtNextAnimationFrame=e.scheduleAtNextAnimationFrame,this._state=new zne(e.forceIntegerValues,0,0,0,0,0,0),this._smoothScrolling=null}dispose(){this._smoothScrolling&&(this._smoothScrolling.dispose(),this._smoothScrolling=null),super.dispose()}setSmoothScrollDuration(e){this._smoothScrollDuration=e}validateScrollPosition(e){return this._state.withScrollPosition(e)}getScrollDimensions(){return this._state}setScrollDimensions(e,n){var i;let r=this._state.withScrollDimensions(e,n);this._setState(r,!!this._smoothScrolling),(i=this._smoothScrolling)==null||i.acceptScrollDimensions(this._state)}getFutureScrollPosition(){return this._smoothScrolling?this._smoothScrolling.to:this._state}getCurrentScrollPosition(){return this._state}setScrollPositionNow(e){let n=this._state.withScrollPosition(e);this._smoothScrolling&&(this._smoothScrolling.dispose(),this._smoothScrolling=null),this._setState(n,!1)}setScrollPositionSmooth(e,n){if(this._smoothScrollDuration===0)return this.setScrollPositionNow(e);if(this._smoothScrolling){e={scrollLeft:typeof e.scrollLeft>"u"?this._smoothScrolling.to.scrollLeft:e.scrollLeft,scrollTop:typeof e.scrollTop>"u"?this._smoothScrolling.to.scrollTop:e.scrollTop};let r=this._state.withScrollPosition(e);if(this._smoothScrolling.to.scrollLeft===r.scrollLeft&&this._smoothScrolling.to.scrollTop===r.scrollTop)return;let i;n?i=new QO(this._smoothScrolling.from,r,this._smoothScrolling.startTime,this._smoothScrolling.duration):i=this._smoothScrolling.combine(this._state,r,this._smoothScrollDuration),this._smoothScrolling.dispose(),this._smoothScrolling=i}else{let r=this._state.withScrollPosition(e);this._smoothScrolling=QO.start(this._state,r,this._smoothScrollDuration)}this._smoothScrolling.animationFrameDisposable=this._scheduleAtNextAnimationFrame(()=>{this._smoothScrolling&&(this._smoothScrolling.animationFrameDisposable=null,this._performSmoothScrolling())})}hasPendingScrollAnimation(){return!!this._smoothScrolling}_performSmoothScrolling(){if(!this._smoothScrolling)return;let e=this._smoothScrolling.tick(),n=this._state.withScrollPosition(e);if(this._setState(n,!0),!!this._smoothScrolling){if(e.isDone){this._smoothScrolling.dispose(),this._smoothScrolling=null;return}this._smoothScrolling.animationFrameDisposable=this._scheduleAtNextAnimationFrame(()=>{this._smoothScrolling&&(this._smoothScrolling.animationFrameDisposable=null,this._performSmoothScrolling())})}}_setState(e,n){let r=this._state;r.equals(e)||(this._state=e,this._onScroll.fire(this._state.createScrollEvent(r,n)))}},XO=class{constructor(e,n,r){this.scrollLeft=e,this.scrollTop=n,this.isDone=r}};function Uw(e,n){let r=n-e;return function(i){return e+r*Wne(i)}}function Fne(e,n,r){return function(i){return i<r?e(i/r):n((i-r)/(1-r))}}var QO=class XC{constructor(n,r,i,s){this.from=n,this.to=r,this.duration=s,this.startTime=i,this.animationFrameDisposable=null,this._initAnimations()}_initAnimations(){this.scrollLeft=this._initAnimation(this.from.scrollLeft,this.to.scrollLeft,this.to.width),this.scrollTop=this._initAnimation(this.from.scrollTop,this.to.scrollTop,this.to.height)}_initAnimation(n,r,i){if(Math.abs(n-r)>2.5*i){let s,a;return n<r?(s=n+.75*i,a=r-.75*i):(s=n-.75*i,a=r+.75*i),Fne(Uw(n,s),Uw(a,r),.33)}return Uw(n,r)}dispose(){this.animationFrameDisposable!==null&&(this.animationFrameDisposable.dispose(),this.animationFrameDisposable=null)}acceptScrollDimensions(n){this.to=n.withScrollPosition(this.to),this._initAnimations()}tick(){return this._tick(Date.now())}_tick(n){let r=(n-this.startTime)/this.duration;if(r<1){let i=this.scrollLeft(r),s=this.scrollTop(r);return new XO(i,s,!1)}return new XO(this.to.scrollLeft,this.to.scrollTop,!0)}combine(n,r,i){return XC.start(n,r,i)}static start(n,r,i){i=i+10;let s=Date.now()-10;return new XC(n,r,s,i)}};function Hne(e){return Math.pow(e,3)}function Wne(e){return 1-Hne(1-e)}var qne=class extends sn{constructor(e,n,r){super(),this._visibility=e,this._visibleClassName=n,this._invisibleClassName=r,this._domNode=null,this._isVisible=!1,this._isNeeded=!1,this._rawShouldBeVisible=!1,this._shouldBeVisible=!1,this._revealTimer=this._register(new eA)}setVisibility(e){this._visibility!==e&&(this._visibility=e,this._updateShouldBeVisible())}setShouldBeVisible(e){this._rawShouldBeVisible=e,this._updateShouldBeVisible()}_applyVisibilitySetting(){return this._visibility===2?!1:this._visibility===3?!0:this._rawShouldBeVisible}_updateShouldBeVisible(){let e=this._applyVisibilitySetting();this._shouldBeVisible!==e&&(this._shouldBeVisible=e,this.ensureVisibility())}setIsNeeded(e){this._isNeeded!==e&&(this._isNeeded=e,this.ensureVisibility())}setDomNode(e){this._domNode=e,this._domNode.setClassName(this._invisibleClassName),this.setShouldBeVisible(!1)}ensureVisibility(){if(!this._isNeeded){this._hide(!1);return}this._shouldBeVisible?this._reveal():this._hide(!0)}_reveal(){this._isVisible||(this._isVisible=!0,this._revealTimer.setIfNotSet(()=>{var e;(e=this._domNode)==null||e.setClassName(this._visibleClassName)},0))}_hide(e){var n;this._revealTimer.cancel(),this._isVisible&&(this._isVisible=!1,(n=this._domNode)==null||n.setClassName(this._invisibleClassName+(e?" fade":"")))}},Une=140,h9=class extends nA{constructor(e){super(),this._lazyRender=e.lazyRender,this._host=e.host,this._scrollable=e.scrollable,this._scrollByPage=e.scrollByPage,this._scrollbarState=e.scrollbarState,this._visibilityController=this._register(new qne(e.visibility,"visible scrollbar "+e.extraScrollbarClassName,"invisible scrollbar "+e.extraScrollbarClassName)),this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._pointerMoveMonitor=this._register(new d9),this._shouldRender=!0,this.domNode=sg(document.createElement("div")),this.domNode.setAttribute("role","presentation"),this.domNode.setAttribute("aria-hidden","true"),this._visibilityController.setDomNode(this.domNode),this.domNode.setPosition("absolute"),this._register(Ut(this.domNode.domNode,ui.POINTER_DOWN,n=>this._domNodePointerDown(n)))}_createArrow(e){let n=this._register(new Bne(e));this.domNode.domNode.appendChild(n.bgDomNode),this.domNode.domNode.appendChild(n.domNode)}_createSlider(e,n,r,i){this.slider=sg(document.createElement("div")),this.slider.setClassName("slider"),this.slider.setPosition("absolute"),this.slider.setTop(e),this.slider.setLeft(n),typeof r=="number"&&this.slider.setWidth(r),typeof i=="number"&&this.slider.setHeight(i),this.slider.setLayerHinting(!0),this.slider.setContain("strict"),this.domNode.domNode.appendChild(this.slider.domNode),this._register(Ut(this.slider.domNode,ui.POINTER_DOWN,s=>{s.button===0&&(s.preventDefault(),this._sliderPointerDown(s))})),this.onclick(this.slider.domNode,s=>{s.leftButton&&s.stopPropagation()})}_onElementSize(e){return this._scrollbarState.setVisibleSize(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}_onElementScrollSize(e){return this._scrollbarState.setScrollSize(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}_onElementScrollPosition(e){return this._scrollbarState.setScrollPosition(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}beginReveal(){this._visibilityController.setShouldBeVisible(!0)}beginHide(){this._visibilityController.setShouldBeVisible(!1)}render(){this._shouldRender&&(this._shouldRender=!1,this._renderDomNode(this._scrollbarState.getRectangleLargeSize(),this._scrollbarState.getRectangleSmallSize()),this._updateSlider(this._scrollbarState.getSliderSize(),this._scrollbarState.getArrowSize()+this._scrollbarState.getSliderPosition()))}_domNodePointerDown(e){e.target===this.domNode.domNode&&this._onPointerDown(e)}delegatePointerDown(e){let n=this.domNode.domNode.getClientRects()[0].top,r=n+this._scrollbarState.getSliderPosition(),i=n+this._scrollbarState.getSliderPosition()+this._scrollbarState.getSliderSize(),s=this._sliderPointerPosition(e);r<=s&&s<=i?e.button===0&&(e.preventDefault(),this._sliderPointerDown(e)):this._onPointerDown(e)}_onPointerDown(e){let n,r;if(e.target===this.domNode.domNode&&typeof e.offsetX=="number"&&typeof e.offsetY=="number")n=e.offsetX,r=e.offsetY;else{let s=Dne(this.domNode.domNode);n=e.pageX-s.left,r=e.pageY-s.top}let i=this._pointerDownRelativePosition(n,r);this._setDesiredScrollPositionNow(this._scrollByPage?this._scrollbarState.getDesiredScrollPositionFromOffsetPaged(i):this._scrollbarState.getDesiredScrollPositionFromOffset(i)),e.button===0&&(e.preventDefault(),this._sliderPointerDown(e))}_sliderPointerDown(e){if(!e.target||!(e.target instanceof Element))return;let n=this._sliderPointerPosition(e),r=this._sliderOrthogonalPointerPosition(e),i=this._scrollbarState.clone();this.slider.toggleClassName("active",!0),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,s=>{let a=this._sliderOrthogonalPointerPosition(s),o=Math.abs(a-r);if(o9&&o>Une){this._setDesiredScrollPositionNow(i.getScrollPosition());return}let l=this._sliderPointerPosition(s)-n;this._setDesiredScrollPositionNow(i.getDesiredScrollPositionFromDelta(l))},()=>{this.slider.toggleClassName("active",!1),this._host.onDragEnd()}),this._host.onDragStart()}_setDesiredScrollPositionNow(e){let n={};this.writeScrollPosition(n,e),this._scrollable.setScrollPositionNow(n)}updateScrollbarSize(e){this._updateScrollbarSize(e),this._scrollbarState.setScrollbarSize(e),this._shouldRender=!0,this._lazyRender||this.render()}isNeeded(){return this._scrollbarState.isNeeded()}},f9=class QC{constructor(n,r,i,s,a,o){this._scrollbarSize=Math.round(r),this._oppositeScrollbarSize=Math.round(i),this._arrowSize=Math.round(n),this._visibleSize=s,this._scrollSize=a,this._scrollPosition=o,this._computedAvailableSize=0,this._computedIsNeeded=!1,this._computedSliderSize=0,this._computedSliderRatio=0,this._computedSliderPosition=0,this._refreshComputedValues()}clone(){return new QC(this._arrowSize,this._scrollbarSize,this._oppositeScrollbarSize,this._visibleSize,this._scrollSize,this._scrollPosition)}setVisibleSize(n){let r=Math.round(n);return this._visibleSize!==r?(this._visibleSize=r,this._refreshComputedValues(),!0):!1}setScrollSize(n){let r=Math.round(n);return this._scrollSize!==r?(this._scrollSize=r,this._refreshComputedValues(),!0):!1}setScrollPosition(n){let r=Math.round(n);return this._scrollPosition!==r?(this._scrollPosition=r,this._refreshComputedValues(),!0):!1}setScrollbarSize(n){this._scrollbarSize=Math.round(n)}setOppositeScrollbarSize(n){this._oppositeScrollbarSize=Math.round(n)}static _computeValues(n,r,i,s,a){let o=Math.max(0,i-n),l=Math.max(0,o-2*r),u=s>0&&s>i;if(!u)return{computedAvailableSize:Math.round(o),computedIsNeeded:u,computedSliderSize:Math.round(l),computedSliderRatio:0,computedSliderPosition:0};let d=Math.round(Math.max(20,Math.floor(i*l/s))),p=(l-d)/(s-i),f=a*p;return{computedAvailableSize:Math.round(o),computedIsNeeded:u,computedSliderSize:Math.round(d),computedSliderRatio:p,computedSliderPosition:Math.round(f)}}_refreshComputedValues(){let n=QC._computeValues(this._oppositeScrollbarSize,this._arrowSize,this._visibleSize,this._scrollSize,this._scrollPosition);this._computedAvailableSize=n.computedAvailableSize,this._computedIsNeeded=n.computedIsNeeded,this._computedSliderSize=n.computedSliderSize,this._computedSliderRatio=n.computedSliderRatio,this._computedSliderPosition=n.computedSliderPosition}getArrowSize(){return this._arrowSize}getScrollPosition(){return this._scrollPosition}getRectangleLargeSize(){return this._computedAvailableSize}getRectangleSmallSize(){return this._scrollbarSize}isNeeded(){return this._computedIsNeeded}getSliderSize(){return this._computedSliderSize}getSliderPosition(){return this._computedSliderPosition}getDesiredScrollPositionFromOffset(n){if(!this._computedIsNeeded)return 0;let r=n-this._arrowSize-this._computedSliderSize/2;return Math.round(r/this._computedSliderRatio)}getDesiredScrollPositionFromOffsetPaged(n){if(!this._computedIsNeeded)return 0;let r=n-this._arrowSize,i=this._scrollPosition;return r<this._computedSliderPosition?i-=this._visibleSize:i+=this._visibleSize,i}getDesiredScrollPositionFromDelta(n){if(!this._computedIsNeeded)return 0;let r=this._computedSliderPosition+n;return Math.round(r/this._computedSliderRatio)}},Kne=class extends h9{constructor(e,n,r){let i=e.getScrollDimensions(),s=e.getCurrentScrollPosition();if(super({lazyRender:n.lazyRender,host:r,scrollbarState:new f9(n.horizontalHasArrows?n.arrowSize:0,n.horizontal===2?0:n.horizontalScrollbarSize,n.vertical===2?0:n.verticalScrollbarSize,i.width,i.scrollWidth,s.scrollLeft),visibility:n.horizontal,extraScrollbarClassName:"horizontal",scrollable:e,scrollByPage:n.scrollByPage}),n.horizontalHasArrows)throw new Error("horizontalHasArrows is not supported in xterm.js");this._createSlider(Math.floor((n.horizontalScrollbarSize-n.horizontalSliderSize)/2),0,void 0,n.horizontalSliderSize)}_updateSlider(e,n){this.slider.setWidth(e),this.slider.setLeft(n)}_renderDomNode(e,n){this.domNode.setWidth(e),this.domNode.setHeight(n),this.domNode.setLeft(0),this.domNode.setBottom(0)}onDidScroll(e){return this._shouldRender=this._onElementScrollSize(e.scrollWidth)||this._shouldRender,this._shouldRender=this._onElementScrollPosition(e.scrollLeft)||this._shouldRender,this._shouldRender=this._onElementSize(e.width)||this._shouldRender,this._shouldRender}_pointerDownRelativePosition(e,n){return e}_sliderPointerPosition(e){return e.pageX}_sliderOrthogonalPointerPosition(e){return e.pageY}_updateScrollbarSize(e){this.slider.setHeight(e)}writeScrollPosition(e,n){e.scrollLeft=n}updateOptions(e){this.updateScrollbarSize(e.horizontal===2?0:e.horizontalScrollbarSize),this._scrollbarState.setOppositeScrollbarSize(e.vertical===2?0:e.verticalScrollbarSize),this._visibilityController.setVisibility(e.horizontal),this._scrollByPage=e.scrollByPage}},Vne=class extends h9{constructor(e,n,r){let i=e.getScrollDimensions(),s=e.getCurrentScrollPosition();if(super({lazyRender:n.lazyRender,host:r,scrollbarState:new f9(n.verticalHasArrows?n.arrowSize:0,n.vertical===2?0:n.verticalScrollbarSize,0,i.height,i.scrollHeight,s.scrollTop),visibility:n.vertical,extraScrollbarClassName:"vertical",scrollable:e,scrollByPage:n.scrollByPage}),n.verticalHasArrows)throw new Error("horizontalHasArrows is not supported in xterm.js");this._createSlider(0,Math.floor((n.verticalScrollbarSize-n.verticalSliderSize)/2),n.verticalSliderSize,void 0)}_updateSlider(e,n){this.slider.setHeight(e),this.slider.setTop(n)}_renderDomNode(e,n){this.domNode.setWidth(n),this.domNode.setHeight(e),this.domNode.setRight(0),this.domNode.setTop(0)}onDidScroll(e){return this._shouldRender=this._onElementScrollSize(e.scrollHeight)||this._shouldRender,this._shouldRender=this._onElementScrollPosition(e.scrollTop)||this._shouldRender,this._shouldRender=this._onElementSize(e.height)||this._shouldRender,this._shouldRender}_pointerDownRelativePosition(e,n){return n}_sliderPointerPosition(e){return e.pageY}_sliderOrthogonalPointerPosition(e){return e.pageX}_updateScrollbarSize(e){this.slider.setWidth(e)}writeScrollPosition(e,n){e.scrollTop=n}updateOptions(e){this.updateScrollbarSize(e.vertical===2?0:e.verticalScrollbarSize),this._scrollbarState.setOppositeScrollbarSize(0),this._visibilityController.setVisibility(e.vertical),this._scrollByPage=e.scrollByPage}},Yne=500,ZO=50,Gne=class{constructor(e,n,r){this.timestamp=e,this.deltaX=n,this.deltaY=r,this.score=0}},ZC=class{constructor(){this._capacity=5,this._memory=[],this._front=-1,this._rear=-1}isPhysicalMouseWheel(){if(this._front===-1&&this._rear===-1)return!1;let n=1,r=0,i=1,s=this._rear;do{let a=s===this._front?n:Math.pow(2,-i);if(n-=a,r+=this._memory[s].score*a,s===this._front)break;s=(this._capacity+s-1)%this._capacity,i++}while(!0);return r<=.5}acceptStandardWheelEvent(n){if(ZE){let r=Fo(n.browserEvent),i=ane(r);this.accept(Date.now(),n.deltaX*i,n.deltaY*i)}else this.accept(Date.now(),n.deltaX,n.deltaY)}accept(n,r,i){let s=null,a=new Gne(n,r,i);this._front===-1&&this._rear===-1?(this._memory[0]=a,this._front=0,this._rear=0):(s=this._memory[this._rear],this._rear=(this._rear+1)%this._capacity,this._rear===this._front&&(this._front=(this._front+1)%this._capacity),this._memory[this._rear]=a),a.score=this._computeScore(a,s)}_computeScore(n,r){if(Math.abs(n.deltaX)>0&&Math.abs(n.deltaY)>0)return 1;let i=.5;if((!this._isAlmostInt(n.deltaX)||!this._isAlmostInt(n.deltaY))&&(i+=.25),r){let s=Math.abs(n.deltaX),a=Math.abs(n.deltaY),o=Math.abs(r.deltaX),l=Math.abs(r.deltaY),u=Math.max(Math.min(s,o),1),d=Math.max(Math.min(a,l),1),p=Math.max(s,o),f=Math.max(a,l);p%u===0&&f%d===0&&(i-=.5)}return Math.min(Math.max(i,0),1)}_isAlmostInt(n){return Math.abs(Math.round(n)-n)<.01}};ZC.INSTANCE=new ZC;var Xne=ZC,Qne=class extends nA{constructor(e,n,r){super(),this._onScroll=this._register(new nt),this.onScroll=this._onScroll.event,this._onWillScroll=this._register(new nt),this.onWillScroll=this._onWillScroll.event,this._options=Jne(n),this._scrollable=r,this._register(this._scrollable.onScroll(s=>{this._onWillScroll.fire(s),this._onDidScroll(s),this._onScroll.fire(s)}));let i={onMouseWheel:s=>this._onMouseWheel(s),onDragStart:()=>this._onDragStart(),onDragEnd:()=>this._onDragEnd()};this._verticalScrollbar=this._register(new Vne(this._scrollable,this._options,i)),this._horizontalScrollbar=this._register(new Kne(this._scrollable,this._options,i)),this._domNode=document.createElement("div"),this._domNode.className="xterm-scrollable-element "+this._options.className,this._domNode.setAttribute("role","presentation"),this._domNode.style.position="relative",this._domNode.appendChild(e),this._domNode.appendChild(this._horizontalScrollbar.domNode.domNode),this._domNode.appendChild(this._verticalScrollbar.domNode.domNode),this._options.useShadows?(this._leftShadowDomNode=sg(document.createElement("div")),this._leftShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._leftShadowDomNode.domNode),this._topShadowDomNode=sg(document.createElement("div")),this._topShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._topShadowDomNode.domNode),this._topLeftShadowDomNode=sg(document.createElement("div")),this._topLeftShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._topLeftShadowDomNode.domNode)):(this._leftShadowDomNode=null,this._topShadowDomNode=null,this._topLeftShadowDomNode=null),this._listenOnDomNode=this._options.listenOnDomNode||this._domNode,this._mouseWheelToDispose=[],this._setListeningToMouseWheel(this._options.handleMouseWheel),this.onmouseover(this._listenOnDomNode,s=>this._onMouseOver(s)),this.onmouseleave(this._listenOnDomNode,s=>this._onMouseLeave(s)),this._hideTimeout=this._register(new eA),this._isDragging=!1,this._mouseIsOver=!1,this._shouldRender=!0,this._revealOnScroll=!0}get options(){return this._options}dispose(){this._mouseWheelToDispose=Md(this._mouseWheelToDispose),super.dispose()}getDomNode(){return this._domNode}getOverviewRulerLayoutInfo(){return{parent:this._domNode,insertBefore:this._verticalScrollbar.domNode.domNode}}delegateVerticalScrollbarPointerDown(e){this._verticalScrollbar.delegatePointerDown(e)}getScrollDimensions(){return this._scrollable.getScrollDimensions()}setScrollDimensions(e){this._scrollable.setScrollDimensions(e,!1)}updateClassName(e){this._options.className=e,Go&&(this._options.className+=" mac"),this._domNode.className="xterm-scrollable-element "+this._options.className}updateOptions(e){typeof e.handleMouseWheel<"u"&&(this._options.handleMouseWheel=e.handleMouseWheel,this._setListeningToMouseWheel(this._options.handleMouseWheel)),typeof e.mouseWheelScrollSensitivity<"u"&&(this._options.mouseWheelScrollSensitivity=e.mouseWheelScrollSensitivity),typeof e.fastScrollSensitivity<"u"&&(this._options.fastScrollSensitivity=e.fastScrollSensitivity),typeof e.scrollPredominantAxis<"u"&&(this._options.scrollPredominantAxis=e.scrollPredominantAxis),typeof e.horizontal<"u"&&(this._options.horizontal=e.horizontal),typeof e.vertical<"u"&&(this._options.vertical=e.vertical),typeof e.horizontalScrollbarSize<"u"&&(this._options.horizontalScrollbarSize=e.horizontalScrollbarSize),typeof e.verticalScrollbarSize<"u"&&(this._options.verticalScrollbarSize=e.verticalScrollbarSize),typeof e.scrollByPage<"u"&&(this._options.scrollByPage=e.scrollByPage),this._horizontalScrollbar.updateOptions(this._options),this._verticalScrollbar.updateOptions(this._options),this._options.lazyRender||this._render()}setRevealOnScroll(e){this._revealOnScroll=e}delegateScrollFromMouseWheelEvent(e){this._onMouseWheel(new UO(e))}_setListeningToMouseWheel(e){if(this._mouseWheelToDispose.length>0!==e&&(this._mouseWheelToDispose=Md(this._mouseWheelToDispose),e)){let n=r=>{this._onMouseWheel(new UO(r))};this._mouseWheelToDispose.push(Ut(this._listenOnDomNode,ui.MOUSE_WHEEL,n,{passive:!1}))}}_onMouseWheel(e){var s;if((s=e.browserEvent)!=null&&s.defaultPrevented)return;let n=Xne.INSTANCE;n.acceptStandardWheelEvent(e);let r=!1;if(e.deltaY||e.deltaX){let a=e.deltaY*this._options.mouseWheelScrollSensitivity,o=e.deltaX*this._options.mouseWheelScrollSensitivity;this._options.scrollPredominantAxis&&(this._options.scrollYToX&&o+a===0?o=a=0:Math.abs(a)>=Math.abs(o)?o=0:a=0),this._options.flipAxes&&([a,o]=[o,a]);let l=!Go&&e.browserEvent&&e.browserEvent.shiftKey;(this._options.scrollYToX||l)&&!o&&(o=a,a=0),e.browserEvent&&e.browserEvent.altKey&&(o=o*this._options.fastScrollSensitivity,a=a*this._options.fastScrollSensitivity);let u=this._scrollable.getFutureScrollPosition(),d={};if(a){let p=ZO*a,f=u.scrollTop-(p<0?Math.floor(p):Math.ceil(p));this._verticalScrollbar.writeScrollPosition(d,f)}if(o){let p=ZO*o,f=u.scrollLeft-(p<0?Math.floor(p):Math.ceil(p));this._horizontalScrollbar.writeScrollPosition(d,f)}d=this._scrollable.validateScrollPosition(d),(u.scrollLeft!==d.scrollLeft||u.scrollTop!==d.scrollTop)&&(this._options.mouseWheelSmoothScroll&&n.isPhysicalMouseWheel()?this._scrollable.setScrollPositionSmooth(d):this._scrollable.setScrollPositionNow(d),r=!0)}let i=r;!i&&this._options.alwaysConsumeMouseWheel&&(i=!0),!i&&this._options.consumeMouseWheelIfScrollbarIsNeeded&&(this._verticalScrollbar.isNeeded()||this._horizontalScrollbar.isNeeded())&&(i=!0),i&&(e.preventDefault(),e.stopPropagation())}_onDidScroll(e){this._shouldRender=this._horizontalScrollbar.onDidScroll(e)||this._shouldRender,this._shouldRender=this._verticalScrollbar.onDidScroll(e)||this._shouldRender,this._options.useShadows&&(this._shouldRender=!0),this._revealOnScroll&&this._reveal(),this._options.lazyRender||this._render()}renderNow(){if(!this._options.lazyRender)throw new Error("Please use `lazyRender` together with `renderNow`!");this._render()}_render(){if(this._shouldRender&&(this._shouldRender=!1,this._horizontalScrollbar.render(),this._verticalScrollbar.render(),this._options.useShadows)){let e=this._scrollable.getCurrentScrollPosition(),n=e.scrollTop>0,r=e.scrollLeft>0,i=r?" left":"",s=n?" top":"",a=r||n?" top-left-corner":"";this._leftShadowDomNode.setClassName(`shadow${i}`),this._topShadowDomNode.setClassName(`shadow${s}`),this._topLeftShadowDomNode.setClassName(`shadow${a}${s}${i}`)}}_onDragStart(){this._isDragging=!0,this._reveal()}_onDragEnd(){this._isDragging=!1,this._hide()}_onMouseLeave(e){this._mouseIsOver=!1,this._hide()}_onMouseOver(e){this._mouseIsOver=!0,this._reveal()}_reveal(){this._verticalScrollbar.beginReveal(),this._horizontalScrollbar.beginReveal(),this._scheduleHide()}_hide(){!this._mouseIsOver&&!this._isDragging&&(this._verticalScrollbar.beginHide(),this._horizontalScrollbar.beginHide())}_scheduleHide(){!this._mouseIsOver&&!this._isDragging&&this._hideTimeout.cancelAndSet(()=>this._hide(),Yne)}},Zne=class extends Qne{constructor(e,n,r){super(e,n,r)}setScrollPosition(e){e.reuseAnimation?this._scrollable.setScrollPositionSmooth(e,e.reuseAnimation):this._scrollable.setScrollPositionNow(e)}getScrollPosition(){return this._scrollable.getCurrentScrollPosition()}};function Jne(e){let n={lazyRender:typeof e.lazyRender<"u"?e.lazyRender:!1,className:typeof e.className<"u"?e.className:"",useShadows:typeof e.useShadows<"u"?e.useShadows:!0,handleMouseWheel:typeof e.handleMouseWheel<"u"?e.handleMouseWheel:!0,flipAxes:typeof e.flipAxes<"u"?e.flipAxes:!1,consumeMouseWheelIfScrollbarIsNeeded:typeof e.consumeMouseWheelIfScrollbarIsNeeded<"u"?e.consumeMouseWheelIfScrollbarIsNeeded:!1,alwaysConsumeMouseWheel:typeof e.alwaysConsumeMouseWheel<"u"?e.alwaysConsumeMouseWheel:!1,scrollYToX:typeof e.scrollYToX<"u"?e.scrollYToX:!1,mouseWheelScrollSensitivity:typeof e.mouseWheelScrollSensitivity<"u"?e.mouseWheelScrollSensitivity:1,fastScrollSensitivity:typeof e.fastScrollSensitivity<"u"?e.fastScrollSensitivity:5,scrollPredominantAxis:typeof e.scrollPredominantAxis<"u"?e.scrollPredominantAxis:!0,mouseWheelSmoothScroll:typeof e.mouseWheelSmoothScroll<"u"?e.mouseWheelSmoothScroll:!0,arrowSize:typeof e.arrowSize<"u"?e.arrowSize:11,listenOnDomNode:typeof e.listenOnDomNode<"u"?e.listenOnDomNode:null,horizontal:typeof e.horizontal<"u"?e.horizontal:1,horizontalScrollbarSize:typeof e.horizontalScrollbarSize<"u"?e.horizontalScrollbarSize:10,horizontalSliderSize:typeof e.horizontalSliderSize<"u"?e.horizontalSliderSize:0,horizontalHasArrows:typeof e.horizontalHasArrows<"u"?e.horizontalHasArrows:!1,vertical:typeof e.vertical<"u"?e.vertical:1,verticalScrollbarSize:typeof e.verticalScrollbarSize<"u"?e.verticalScrollbarSize:10,verticalHasArrows:typeof e.verticalHasArrows<"u"?e.verticalHasArrows:!1,verticalSliderSize:typeof e.verticalSliderSize<"u"?e.verticalSliderSize:0,scrollByPage:typeof e.scrollByPage<"u"?e.scrollByPage:!1};return n.horizontalSliderSize=typeof e.horizontalSliderSize<"u"?e.horizontalSliderSize:n.horizontalScrollbarSize,n.verticalSliderSize=typeof e.verticalSliderSize<"u"?e.verticalSliderSize:n.verticalScrollbarSize,Go&&(n.className+=" mac"),n}var JC=class extends sn{constructor(e,n,r,i,s,a,o,l){super(),this._bufferService=r,this._optionsService=o,this._renderService=l,this._onRequestScrollLines=this._register(new nt),this.onRequestScrollLines=this._onRequestScrollLines.event,this._isSyncing=!1,this._isHandlingScroll=!1,this._suppressOnScrollHandler=!1;let u=this._register(new $ne({forceIntegerValues:!1,smoothScrollDuration:this._optionsService.rawOptions.smoothScrollDuration,scheduleAtNextAnimationFrame:d=>tA(i.window,d)}));this._register(this._optionsService.onSpecificOptionChange("smoothScrollDuration",()=>{u.setSmoothScrollDuration(this._optionsService.rawOptions.smoothScrollDuration)})),this._scrollableElement=this._register(new Zne(n,{vertical:1,horizontal:2,useShadows:!1,mouseWheelSmoothScroll:!0,...this._getChangeOptions()},u)),this._register(this._optionsService.onMultipleOptionChange(["scrollSensitivity","fastScrollSensitivity","overviewRuler"],()=>this._scrollableElement.updateOptions(this._getChangeOptions()))),this._register(s.onProtocolChange(d=>{this._scrollableElement.updateOptions({handleMouseWheel:!(d&16)})})),this._scrollableElement.setScrollDimensions({height:0,scrollHeight:0}),this._register(Ti.runAndSubscribe(a.onChangeColors,()=>{this._scrollableElement.getDomNode().style.backgroundColor=a.colors.background.css})),e.appendChild(this._scrollableElement.getDomNode()),this._register(br(()=>this._scrollableElement.getDomNode().remove())),this._styleElement=i.mainDocument.createElement("style"),n.appendChild(this._styleElement),this._register(br(()=>this._styleElement.remove())),this._register(Ti.runAndSubscribe(a.onChangeColors,()=>{this._styleElement.textContent=[".xterm .xterm-scrollable-element > .scrollbar > .slider {",`  background: ${a.colors.scrollbarSliderBackground.css};`,"}",".xterm .xterm-scrollable-element > .scrollbar > .slider:hover {",`  background: ${a.colors.scrollbarSliderHoverBackground.css};`,"}",".xterm .xterm-scrollable-element > .scrollbar > .slider.active {",`  background: ${a.colors.scrollbarSliderActiveBackground.css};`,"}"].join(`
`)})),this._register(this._bufferService.onResize(()=>this.queueSync())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._latestYDisp=void 0,this.queueSync()})),this._register(this._bufferService.onScroll(()=>this._sync())),this._register(this._scrollableElement.onScroll(d=>this._handleScroll(d)))}scrollLines(e){let n=this._scrollableElement.getScrollPosition();this._scrollableElement.setScrollPosition({reuseAnimation:!0,scrollTop:n.scrollTop+e*this._renderService.dimensions.css.cell.height})}scrollToLine(e,n){n&&(this._latestYDisp=e),this._scrollableElement.setScrollPosition({reuseAnimation:!n,scrollTop:e*this._renderService.dimensions.css.cell.height})}_getChangeOptions(){var e;return{mouseWheelScrollSensitivity:this._optionsService.rawOptions.scrollSensitivity,fastScrollSensitivity:this._optionsService.rawOptions.fastScrollSensitivity,verticalScrollbarSize:((e=this._optionsService.rawOptions.overviewRuler)==null?void 0:e.width)||14}}queueSync(e){e!==void 0&&(this._latestYDisp=e),this._queuedAnimationFrame===void 0&&(this._queuedAnimationFrame=this._renderService.addRefreshCallback(()=>{this._queuedAnimationFrame=void 0,this._sync(this._latestYDisp)}))}_sync(e=this._bufferService.buffer.ydisp){!this._renderService||this._isSyncing||(this._isSyncing=!0,this._suppressOnScrollHandler=!0,this._scrollableElement.setScrollDimensions({height:this._renderService.dimensions.css.canvas.height,scrollHeight:this._renderService.dimensions.css.cell.height*this._bufferService.buffer.lines.length}),this._suppressOnScrollHandler=!1,e!==this._latestYDisp&&this._scrollableElement.setScrollPosition({scrollTop:e*this._renderService.dimensions.css.cell.height}),this._isSyncing=!1)}_handleScroll(e){if(!this._renderService||this._isHandlingScroll||this._suppressOnScrollHandler)return;this._isHandlingScroll=!0;let n=Math.round(e.scrollTop/this._renderService.dimensions.css.cell.height),r=n-this._bufferService.buffer.ydisp;r!==0&&(this._latestYDisp=n,this._onRequestScrollLines.fire(r)),this._isHandlingScroll=!1}};JC=Dr([vt(2,cs),vt(3,ic),vt(4,Vz),vt(5,cp),vt(6,us),vt(7,sc)],JC);var ej=class extends sn{constructor(e,n,r,i,s){super(),this._screenElement=e,this._bufferService=n,this._coreBrowserService=r,this._decorationService=i,this._renderService=s,this._decorationElements=new Map,this._altBufferIsActive=!1,this._dimensionsChanged=!1,this._container=document.createElement("div"),this._container.classList.add("xterm-decoration-container"),this._screenElement.appendChild(this._container),this._register(this._renderService.onRenderedViewportChange(()=>this._doRefreshDecorations())),this._register(this._renderService.onDimensionsChange(()=>{this._dimensionsChanged=!0,this._queueRefresh()})),this._register(this._coreBrowserService.onDprChange(()=>this._queueRefresh())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._altBufferIsActive=this._bufferService.buffer===this._bufferService.buffers.alt})),this._register(this._decorationService.onDecorationRegistered(()=>this._queueRefresh())),this._register(this._decorationService.onDecorationRemoved(a=>this._removeDecoration(a))),this._register(br(()=>{this._container.remove(),this._decorationElements.clear()}))}_queueRefresh(){this._animationFrame===void 0&&(this._animationFrame=this._renderService.addRefreshCallback(()=>{this._doRefreshDecorations(),this._animationFrame=void 0}))}_doRefreshDecorations(){for(let e of this._decorationService.decorations)this._renderDecoration(e);this._dimensionsChanged=!1}_renderDecoration(e){this._refreshStyle(e),this._dimensionsChanged&&this._refreshXPosition(e)}_createElement(e){var i;let n=this._coreBrowserService.mainDocument.createElement("div");n.classList.add("xterm-decoration"),n.classList.toggle("xterm-decoration-top-layer",((i=e==null?void 0:e.options)==null?void 0:i.layer)==="top"),n.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,n.style.height=`${(e.options.height||1)*this._renderService.dimensions.css.cell.height}px`,n.style.top=`${(e.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height}px`,n.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;let r=e.options.x??0;return r&&r>this._bufferService.cols&&(n.style.display="none"),this._refreshXPosition(e,n),n}_refreshStyle(e){let n=e.marker.line-this._bufferService.buffers.active.ydisp;if(n<0||n>=this._bufferService.rows)e.element&&(e.element.style.display="none",e.onRenderEmitter.fire(e.element));else{let r=this._decorationElements.get(e);r||(r=this._createElement(e),e.element=r,this._decorationElements.set(e,r),this._container.appendChild(r),e.onDispose(()=>{this._decorationElements.delete(e),r.remove()})),r.style.display=this._altBufferIsActive?"none":"block",this._altBufferIsActive||(r.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,r.style.height=`${(e.options.height||1)*this._renderService.dimensions.css.cell.height}px`,r.style.top=`${n*this._renderService.dimensions.css.cell.height}px`,r.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`),e.onRenderEmitter.fire(r)}}_refreshXPosition(e,n=e.element){if(!n)return;let r=e.options.x??0;(e.options.anchor||"left")==="right"?n.style.right=r?`${r*this._renderService.dimensions.css.cell.width}px`:"":n.style.left=r?`${r*this._renderService.dimensions.css.cell.width}px`:""}_removeDecoration(e){var n;(n=this._decorationElements.get(e))==null||n.remove(),this._decorationElements.delete(e),e.dispose()}};ej=Dr([vt(1,cs),vt(2,ic),vt(3,Ev),vt(4,sc)],ej);var ere=class{constructor(){this._zones=[],this._zonePool=[],this._zonePoolIndex=0,this._linePadding={full:0,left:0,center:0,right:0}}get zones(){return this._zonePool.length=Math.min(this._zonePool.length,this._zones.length),this._zones}clear(){this._zones.length=0,this._zonePoolIndex=0}addDecoration(e){if(e.options.overviewRulerOptions){for(let n of this._zones)if(n.color===e.options.overviewRulerOptions.color&&n.position===e.options.overviewRulerOptions.position){if(this._lineIntersectsZone(n,e.marker.line))return;if(this._lineAdjacentToZone(n,e.marker.line,e.options.overviewRulerOptions.position)){this._addLineToZone(n,e.marker.line);return}}if(this._zonePoolIndex<this._zonePool.length){this._zonePool[this._zonePoolIndex].color=e.options.overviewRulerOptions.color,this._zonePool[this._zonePoolIndex].position=e.options.overviewRulerOptions.position,this._zonePool[this._zonePoolIndex].startBufferLine=e.marker.line,this._zonePool[this._zonePoolIndex].endBufferLine=e.marker.line,this._zones.push(this._zonePool[this._zonePoolIndex++]);return}this._zones.push({color:e.options.overviewRulerOptions.color,position:e.options.overviewRulerOptions.position,startBufferLine:e.marker.line,endBufferLine:e.marker.line}),this._zonePool.push(this._zones[this._zones.length-1]),this._zonePoolIndex++}}setPadding(e){this._linePadding=e}_lineIntersectsZone(e,n){return n>=e.startBufferLine&&n<=e.endBufferLine}_lineAdjacentToZone(e,n,r){return n>=e.startBufferLine-this._linePadding[r||"full"]&&n<=e.endBufferLine+this._linePadding[r||"full"]}_addLineToZone(e,n){e.startBufferLine=Math.min(e.startBufferLine,n),e.endBufferLine=Math.max(e.endBufferLine,n)}},wo={full:0,left:0,center:0,right:0},Oc={full:0,left:0,center:0,right:0},am={full:0,left:0,center:0,right:0},ib=class extends sn{constructor(e,n,r,i,s,a,o,l){var d;super(),this._viewportElement=e,this._screenElement=n,this._bufferService=r,this._decorationService=i,this._renderService=s,this._optionsService=a,this._themeService=o,this._coreBrowserService=l,this._colorZoneStore=new ere,this._shouldUpdateDimensions=!0,this._shouldUpdateAnchor=!0,this._lastKnownBufferLength=0,this._canvas=this._coreBrowserService.mainDocument.createElement("canvas"),this._canvas.classList.add("xterm-decoration-overview-ruler"),this._refreshCanvasDimensions(),(d=this._viewportElement.parentElement)==null||d.insertBefore(this._canvas,this._viewportElement),this._register(br(()=>{var p;return(p=this._canvas)==null?void 0:p.remove()}));let u=this._canvas.getContext("2d");if(u)this._ctx=u;else throw new Error("Ctx cannot be null");this._register(this._decorationService.onDecorationRegistered(()=>this._queueRefresh(void 0,!0))),this._register(this._decorationService.onDecorationRemoved(()=>this._queueRefresh(void 0,!0))),this._register(this._renderService.onRenderedViewportChange(()=>this._queueRefresh())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._canvas.style.display=this._bufferService.buffer===this._bufferService.buffers.alt?"none":"block"})),this._register(this._bufferService.onScroll(()=>{this._lastKnownBufferLength!==this._bufferService.buffers.normal.lines.length&&(this._refreshDrawHeightConstants(),this._refreshColorZonePadding())})),this._register(this._renderService.onRender(()=>{(!this._containerHeight||this._containerHeight!==this._screenElement.clientHeight)&&(this._queueRefresh(!0),this._containerHeight=this._screenElement.clientHeight)})),this._register(this._coreBrowserService.onDprChange(()=>this._queueRefresh(!0))),this._register(this._optionsService.onSpecificOptionChange("overviewRuler",()=>this._queueRefresh(!0))),this._register(this._themeService.onChangeColors(()=>this._queueRefresh())),this._queueRefresh(!0)}get _width(){var e;return((e=this._optionsService.options.overviewRuler)==null?void 0:e.width)||0}_refreshDrawConstants(){let e=Math.floor((this._canvas.width-1)/3),n=Math.ceil((this._canvas.width-1)/3);Oc.full=this._canvas.width,Oc.left=e,Oc.center=n,Oc.right=e,this._refreshDrawHeightConstants(),am.full=1,am.left=1,am.center=1+Oc.left,am.right=1+Oc.left+Oc.center}_refreshDrawHeightConstants(){wo.full=Math.round(2*this._coreBrowserService.dpr);let e=this._canvas.height/this._bufferService.buffer.lines.length,n=Math.round(Math.max(Math.min(e,12),6)*this._coreBrowserService.dpr);wo.left=n,wo.center=n,wo.right=n}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*wo.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*wo.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*wo.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*wo.right)}),this._lastKnownBufferLength=this._bufferService.buffers.normal.lines.length}_refreshCanvasDimensions(){this._canvas.style.width=`${this._width}px`,this._canvas.width=Math.round(this._width*this._coreBrowserService.dpr),this._canvas.style.height=`${this._screenElement.clientHeight}px`,this._canvas.height=Math.round(this._screenElement.clientHeight*this._coreBrowserService.dpr),this._refreshDrawConstants(),this._refreshColorZonePadding()}_refreshDecorations(){this._shouldUpdateDimensions&&this._refreshCanvasDimensions(),this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height),this._colorZoneStore.clear();for(let n of this._decorationService.decorations)this._colorZoneStore.addDecoration(n);this._ctx.lineWidth=1,this._renderRulerOutline();let e=this._colorZoneStore.zones;for(let n of e)n.position!=="full"&&this._renderColorZone(n);for(let n of e)n.position==="full"&&this._renderColorZone(n);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderRulerOutline(){this._ctx.fillStyle=this._themeService.colors.overviewRulerBorder.css,this._ctx.fillRect(0,0,1,this._canvas.height),this._optionsService.rawOptions.overviewRuler.showTopBorder&&this._ctx.fillRect(1,0,this._canvas.width-1,1),this._optionsService.rawOptions.overviewRuler.showBottomBorder&&this._ctx.fillRect(1,this._canvas.height-1,this._canvas.width-1,this._canvas.height)}_renderColorZone(e){this._ctx.fillStyle=e.color,this._ctx.fillRect(am[e.position||"full"],Math.round((this._canvas.height-1)*(e.startBufferLine/this._bufferService.buffers.active.lines.length)-wo[e.position||"full"]/2),Oc[e.position||"full"],Math.round((this._canvas.height-1)*((e.endBufferLine-e.startBufferLine)/this._bufferService.buffers.active.lines.length)+wo[e.position||"full"]))}_queueRefresh(e,n){this._shouldUpdateDimensions=e||this._shouldUpdateDimensions,this._shouldUpdateAnchor=n||this._shouldUpdateAnchor,this._animationFrame===void 0&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._refreshDecorations(),this._animationFrame=void 0}))}};ib=Dr([vt(2,cs),vt(3,Ev),vt(4,sc),vt(5,us),vt(6,cp),vt(7,ic)],ib);var Fe;(e=>(e.NUL="\0",e.SOH="",e.STX="",e.ETX="",e.EOT="",e.ENQ="",e.ACK="",e.BEL="\x07",e.BS="\b",e.HT="	",e.LF=`
`,e.VT="\v",e.FF="\f",e.CR="\r",e.SO="",e.SI="",e.DLE="",e.DC1="",e.DC2="",e.DC3="",e.DC4="",e.NAK="",e.SYN="",e.ETB="",e.CAN="",e.EM="",e.SUB="",e.ESC="\x1B",e.FS="",e.GS="",e.RS="",e.US="",e.SP=" ",e.DEL=""))(Fe||(Fe={}));var kx;(e=>(e.PAD="",e.HOP="",e.BPH="",e.NBH="",e.IND="",e.NEL="",e.SSA="",e.ESA="",e.HTS="",e.HTJ="",e.VTS="",e.PLD="",e.PLU="",e.RI="",e.SS2="",e.SS3="",e.DCS="",e.PU1="",e.PU2="",e.STS="",e.CCH="",e.MW="",e.SPA="",e.EPA="",e.SOS="",e.SGCI="",e.SCI="",e.CSI="",e.ST="",e.OSC="",e.PM="",e.APC=""))(kx||(kx={}));var p9;(e=>e.ST=`${Fe.ESC}\\`)(p9||(p9={}));var tj=class{constructor(e,n,r,i,s,a){this._textarea=e,this._compositionView=n,this._bufferService=r,this._optionsService=i,this._coreService=s,this._renderService=a,this._isComposing=!1,this._isSendingComposition=!1,this._compositionPosition={start:0,end:0},this._dataAlreadySent=""}get isComposing(){return this._isComposing}compositionstart(){this._isComposing=!0,this._compositionPosition.start=this._textarea.value.length,this._compositionView.textContent="",this._dataAlreadySent="",this._compositionView.classList.add("active")}compositionupdate(e){this._compositionView.textContent=e.data,this.updateCompositionElements(),setTimeout(()=>{this._compositionPosition.end=this._textarea.value.length},0)}compositionend(){this._finalizeComposition(!0)}keydown(e){if(this._isComposing||this._isSendingComposition){if(e.keyCode===20||e.keyCode===229||e.keyCode===16||e.keyCode===17||e.keyCode===18)return!1;this._finalizeComposition(!1)}return e.keyCode===229?(this._handleAnyTextareaChanges(),!1):!0}_finalizeComposition(e){if(this._compositionView.classList.remove("active"),this._isComposing=!1,e){let n={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout(()=>{if(this._isSendingComposition){this._isSendingComposition=!1;let r;n.start+=this._dataAlreadySent.length,this._isComposing?r=this._textarea.value.substring(n.start,this._compositionPosition.start):r=this._textarea.value.substring(n.start),r.length>0&&this._coreService.triggerDataEvent(r,!0)}},0)}else{this._isSendingComposition=!1;let n=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(n,!0)}}_handleAnyTextareaChanges(){let e=this._textarea.value;setTimeout(()=>{if(!this._isComposing){let n=this._textarea.value,r=n.replace(e,"");this._dataAlreadySent=r,n.length>e.length?this._coreService.triggerDataEvent(r,!0):n.length<e.length?this._coreService.triggerDataEvent(`${Fe.DEL}`,!0):n.length===e.length&&n!==e&&this._coreService.triggerDataEvent(n,!0)}},0)}updateCompositionElements(e){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){let n=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),r=this._renderService.dimensions.css.cell.height,i=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,s=n*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=s+"px",this._compositionView.style.top=i+"px",this._compositionView.style.height=r+"px",this._compositionView.style.lineHeight=r+"px",this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+"px";let a=this._compositionView.getBoundingClientRect();this._textarea.style.left=s+"px",this._textarea.style.top=i+"px",this._textarea.style.width=Math.max(a.width,1)+"px",this._textarea.style.height=Math.max(a.height,1)+"px",this._textarea.style.lineHeight=a.height+"px"}e||setTimeout(()=>this.updateCompositionElements(!0),0)}}};tj=Dr([vt(2,cs),vt(3,us),vt(4,qd),vt(5,sc)],tj);var di=0,hi=0,fi=0,Tr=0,JO={css:"#00000000",rgba:0},Yr;(e=>{function n(s,a,o,l){return l!==void 0?`#${Yu(s)}${Yu(a)}${Yu(o)}${Yu(l)}`:`#${Yu(s)}${Yu(a)}${Yu(o)}`}e.toCss=n;function r(s,a,o,l=255){return(s<<24|a<<16|o<<8|l)>>>0}e.toRgba=r;function i(s,a,o,l){return{css:e.toCss(s,a,o,l),rgba:e.toRgba(s,a,o,l)}}e.toColor=i})(Yr||(Yr={}));var cr;(e=>{function n(u,d){if(Tr=(d.rgba&255)/255,Tr===1)return{css:d.css,rgba:d.rgba};let p=d.rgba>>24&255,f=d.rgba>>16&255,g=d.rgba>>8&255,_=u.rgba>>24&255,x=u.rgba>>16&255,v=u.rgba>>8&255;di=_+Math.round((p-_)*Tr),hi=x+Math.round((f-x)*Tr),fi=v+Math.round((g-v)*Tr);let S=Yr.toCss(di,hi,fi),w=Yr.toRgba(di,hi,fi);return{css:S,rgba:w}}e.blend=n;function r(u){return(u.rgba&255)===255}e.isOpaque=r;function i(u,d,p){let f=wx.ensureContrastRatio(u.rgba,d.rgba,p);if(f)return Yr.toColor(f>>24&255,f>>16&255,f>>8&255)}e.ensureContrastRatio=i;function s(u){let d=(u.rgba|255)>>>0;return[di,hi,fi]=wx.toChannels(d),{css:Yr.toCss(di,hi,fi),rgba:d}}e.opaque=s;function a(u,d){return Tr=Math.round(d*255),[di,hi,fi]=wx.toChannels(u.rgba),{css:Yr.toCss(di,hi,fi,Tr),rgba:Yr.toRgba(di,hi,fi,Tr)}}e.opacity=a;function o(u,d){return Tr=u.rgba&255,a(u,Tr*d/255)}e.multiplyOpacity=o;function l(u){return[u.rgba>>24&255,u.rgba>>16&255,u.rgba>>8&255]}e.toColorRGB=l})(cr||(cr={}));var Sr;(e=>{let n,r;try{let s=document.createElement("canvas");s.width=1,s.height=1;let a=s.getContext("2d",{willReadFrequently:!0});a&&(n=a,n.globalCompositeOperation="copy",r=n.createLinearGradient(0,0,1,1))}catch{}function i(s){if(s.match(/#[\da-f]{3,8}/i))switch(s.length){case 4:return di=parseInt(s.slice(1,2).repeat(2),16),hi=parseInt(s.slice(2,3).repeat(2),16),fi=parseInt(s.slice(3,4).repeat(2),16),Yr.toColor(di,hi,fi);case 5:return di=parseInt(s.slice(1,2).repeat(2),16),hi=parseInt(s.slice(2,3).repeat(2),16),fi=parseInt(s.slice(3,4).repeat(2),16),Tr=parseInt(s.slice(4,5).repeat(2),16),Yr.toColor(di,hi,fi,Tr);case 7:return{css:s,rgba:(parseInt(s.slice(1),16)<<8|255)>>>0};case 9:return{css:s,rgba:parseInt(s.slice(1),16)>>>0}}let a=s.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(a)return di=parseInt(a[1]),hi=parseInt(a[2]),fi=parseInt(a[3]),Tr=Math.round((a[5]===void 0?1:parseFloat(a[5]))*255),Yr.toColor(di,hi,fi,Tr);if(!n||!r)throw new Error("css.toColor: Unsupported css format");if(n.fillStyle=r,n.fillStyle=s,typeof n.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(n.fillRect(0,0,1,1),[di,hi,fi,Tr]=n.getImageData(0,0,1,1).data,Tr!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:Yr.toRgba(di,hi,fi,Tr),css:s}}e.toColor=i})(Sr||(Sr={}));var Ji;(e=>{function n(i){return r(i>>16&255,i>>8&255,i&255)}e.relativeLuminance=n;function r(i,s,a){let o=i/255,l=s/255,u=a/255,d=o<=.03928?o/12.92:Math.pow((o+.055)/1.055,2.4),p=l<=.03928?l/12.92:Math.pow((l+.055)/1.055,2.4),f=u<=.03928?u/12.92:Math.pow((u+.055)/1.055,2.4);return d*.2126+p*.7152+f*.0722}e.relativeLuminance2=r})(Ji||(Ji={}));var wx;(e=>{function n(o,l){if(Tr=(l&255)/255,Tr===1)return l;let u=l>>24&255,d=l>>16&255,p=l>>8&255,f=o>>24&255,g=o>>16&255,_=o>>8&255;return di=f+Math.round((u-f)*Tr),hi=g+Math.round((d-g)*Tr),fi=_+Math.round((p-_)*Tr),Yr.toRgba(di,hi,fi)}e.blend=n;function r(o,l,u){let d=Ji.relativeLuminance(o>>8),p=Ji.relativeLuminance(l>>8);if(Nl(d,p)<u){if(p<d){let _=i(o,l,u),x=Nl(d,Ji.relativeLuminance(_>>8));if(x<u){let v=s(o,l,u),S=Nl(d,Ji.relativeLuminance(v>>8));return x>S?_:v}return _}let f=s(o,l,u),g=Nl(d,Ji.relativeLuminance(f>>8));if(g<u){let _=i(o,l,u),x=Nl(d,Ji.relativeLuminance(_>>8));return g>x?f:_}return f}}e.ensureContrastRatio=r;function i(o,l,u){let d=o>>24&255,p=o>>16&255,f=o>>8&255,g=l>>24&255,_=l>>16&255,x=l>>8&255,v=Nl(Ji.relativeLuminance2(g,_,x),Ji.relativeLuminance2(d,p,f));for(;v<u&&(g>0||_>0||x>0);)g-=Math.max(0,Math.ceil(g*.1)),_-=Math.max(0,Math.ceil(_*.1)),x-=Math.max(0,Math.ceil(x*.1)),v=Nl(Ji.relativeLuminance2(g,_,x),Ji.relativeLuminance2(d,p,f));return(g<<24|_<<16|x<<8|255)>>>0}e.reduceLuminance=i;function s(o,l,u){let d=o>>24&255,p=o>>16&255,f=o>>8&255,g=l>>24&255,_=l>>16&255,x=l>>8&255,v=Nl(Ji.relativeLuminance2(g,_,x),Ji.relativeLuminance2(d,p,f));for(;v<u&&(g<255||_<255||x<255);)g=Math.min(255,g+Math.ceil((255-g)*.1)),_=Math.min(255,_+Math.ceil((255-_)*.1)),x=Math.min(255,x+Math.ceil((255-x)*.1)),v=Nl(Ji.relativeLuminance2(g,_,x),Ji.relativeLuminance2(d,p,f));return(g<<24|_<<16|x<<8|255)>>>0}e.increaseLuminance=s;function a(o){return[o>>24&255,o>>16&255,o>>8&255,o&255]}e.toChannels=a})(wx||(wx={}));function Yu(e){let n=e.toString(16);return n.length<2?"0"+n:n}function Nl(e,n){return e<n?(n+.05)/(e+.05):(e+.05)/(n+.05)}var tre=class extends Nv{constructor(e,n,r){super(),this.content=0,this.combinedData="",this.fg=e.fg,this.bg=e.bg,this.combinedData=n,this._width=r}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(e){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},sb=class{constructor(e){this._bufferService=e,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new Ma}register(e){let n={id:this._nextCharacterJoinerId++,handler:e};return this._characterJoiners.push(n),n.id}deregister(e){for(let n=0;n<this._characterJoiners.length;n++)if(this._characterJoiners[n].id===e)return this._characterJoiners.splice(n,1),!0;return!1}getJoinedCharacters(e){if(this._characterJoiners.length===0)return[];let n=this._bufferService.buffer.lines.get(e);if(!n||n.length===0)return[];let r=[],i=n.translateToString(!0),s=0,a=0,o=0,l=n.getFg(0),u=n.getBg(0);for(let d=0;d<n.getTrimmedLength();d++)if(n.loadCell(d,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==l||this._workCell.bg!==u){if(d-s>1){let p=this._getJoinedRanges(i,o,a,n,s);for(let f=0;f<p.length;f++)r.push(p[f])}s=d,o=a,l=this._workCell.fg,u=this._workCell.bg}a+=this._workCell.getChars().length||Jc.length}if(this._bufferService.cols-s>1){let d=this._getJoinedRanges(i,o,a,n,s);for(let p=0;p<d.length;p++)r.push(d[p])}return r}_getJoinedRanges(e,n,r,i,s){let a=e.substring(n,r),o=[];try{o=this._characterJoiners[0].handler(a)}catch(l){console.error(l)}for(let l=1;l<this._characterJoiners.length;l++)try{let u=this._characterJoiners[l].handler(a);for(let d=0;d<u.length;d++)sb._mergeRanges(o,u[d])}catch(u){console.error(u)}return this._stringRangesToCellRanges(o,i,s),o}_stringRangesToCellRanges(e,n,r){let i=0,s=!1,a=0,o=e[i];if(o){for(let l=r;l<this._bufferService.cols;l++){let u=n.getWidth(l),d=n.getString(l).length||Jc.length;if(u!==0){if(!s&&o[0]<=a&&(o[0]=l,s=!0),o[1]<=a){if(o[1]=l,o=e[++i],!o)break;o[0]<=a?(o[0]=l,s=!0):s=!1}a+=d}}o&&(o[1]=this._bufferService.cols)}}static _mergeRanges(e,n){let r=!1;for(let i=0;i<e.length;i++){let s=e[i];if(r){if(n[1]<=s[0])return e[i-1][1]=n[1],e;if(n[1]<=s[1])return e[i-1][1]=Math.max(n[1],s[1]),e.splice(i,1),e;e.splice(i,1),i--}else{if(n[1]<=s[0])return e.splice(i,0,n),e;if(n[1]<=s[1])return s[0]=Math.min(n[0],s[0]),e;n[0]<s[1]&&(s[0]=Math.min(n[0],s[0]),r=!0);continue}}return r?e[e.length-1][1]=n[1]:e.push(n),e}};sb=Dr([vt(0,cs)],sb);function nre(e){return 57508<=e&&e<=57558}function rre(e){return 9472<=e&&e<=9631}function ire(e){return nre(e)||rre(e)}function sre(){return{css:{canvas:c_(),cell:c_()},device:{canvas:c_(),cell:c_(),char:{width:0,height:0,left:0,top:0}}}}function c_(){return{width:0,height:0}}var nj=class{constructor(e,n,r,i,s,a,o){this._document=e,this._characterJoinerService=n,this._optionsService=r,this._coreBrowserService=i,this._coreService=s,this._decorationService=a,this._themeService=o,this._workCell=new Ma,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(e,n,r){this._selectionStart=e,this._selectionEnd=n,this._columnSelectMode=r}createRow(e,n,r,i,s,a,o,l,u,d,p){let f=[],g=this._characterJoinerService.getJoinedCharacters(n),_=this._themeService.colors,x=e.getNoBgTrimmedLength();r&&x<a+1&&(x=a+1);let v,S=0,w="",j=0,C=0,T=0,E=0,A=!1,O=0,F=!1,L=0,$=0,z=[],B=d!==-1&&p!==-1;for(let H=0;H<x;H++){e.loadCell(H,this._workCell);let D=this._workCell.getWidth();if(D===0)continue;let U=!1,I=H>=$,X=H,K=this._workCell;if(g.length>0&&H===g[0][0]&&I){let Z=g.shift(),de=this._isCellInSelection(Z[0],n);for(j=Z[0]+1;j<Z[1];j++)I&&(I=de===this._isCellInSelection(j,n));I&&(I=!r||a<Z[0]||a>=Z[1]),I?(U=!0,K=new tre(this._workCell,e.translateToString(!0,Z[0],Z[1]),Z[1]-Z[0]),X=Z[1]-1,D=K.getWidth()):$=Z[1]}let Q=this._isCellInSelection(H,n),V=r&&H===a,R=B&&H>=d&&H<=p,q=!1;this._decorationService.forEachDecorationAtCell(H,n,void 0,Z=>{q=!0});let W=K.getChars()||Jc;if(W===" "&&(K.isUnderline()||K.isOverline())&&(W=" "),L=D*l-u.get(W,K.isBold(),K.isItalic()),!v)v=this._document.createElement("span");else if(S&&(Q&&F||!Q&&!F&&K.bg===C)&&(Q&&F&&_.selectionForeground||K.fg===T)&&K.extended.ext===E&&R===A&&L===O&&!V&&!U&&!q&&I){K.isInvisible()?w+=Jc:w+=W,S++;continue}else S&&(v.textContent=w),v=this._document.createElement("span"),S=0,w="";if(C=K.bg,T=K.fg,E=K.extended.ext,A=R,O=L,F=Q,U&&a>=H&&a<=X&&(a=H),!this._coreService.isCursorHidden&&V&&this._coreService.isCursorInitialized){if(z.push("xterm-cursor"),this._coreBrowserService.isFocused)o&&z.push("xterm-cursor-blink"),z.push(i==="bar"?"xterm-cursor-bar":i==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(s)switch(s){case"outline":z.push("xterm-cursor-outline");break;case"block":z.push("xterm-cursor-block");break;case"bar":z.push("xterm-cursor-bar");break;case"underline":z.push("xterm-cursor-underline");break}}if(K.isBold()&&z.push("xterm-bold"),K.isItalic()&&z.push("xterm-italic"),K.isDim()&&z.push("xterm-dim"),K.isInvisible()?w=Jc:w=K.getChars()||Jc,K.isUnderline()&&(z.push(`xterm-underline-${K.extended.underlineStyle}`),w===" "&&(w=" "),!K.isUnderlineColorDefault()))if(K.isUnderlineColorRGB())v.style.textDecorationColor=`rgb(${Nv.toColorRGB(K.getUnderlineColor()).join(",")})`;else{let Z=K.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&K.isBold()&&Z<8&&(Z+=8),v.style.textDecorationColor=_.ansi[Z].css}K.isOverline()&&(z.push("xterm-overline"),w===" "&&(w=" ")),K.isStrikethrough()&&z.push("xterm-strikethrough"),R&&(v.style.textDecoration="underline");let te=K.getFgColor(),J=K.getFgColorMode(),G=K.getBgColor(),re=K.getBgColorMode(),ne=!!K.isInverse();if(ne){let Z=te;te=G,G=Z;let de=J;J=re,re=de}let le,oe,ie=!1;this._decorationService.forEachDecorationAtCell(H,n,void 0,Z=>{Z.options.layer!=="top"&&ie||(Z.backgroundColorRGB&&(re=50331648,G=Z.backgroundColorRGB.rgba>>8&16777215,le=Z.backgroundColorRGB),Z.foregroundColorRGB&&(J=50331648,te=Z.foregroundColorRGB.rgba>>8&16777215,oe=Z.foregroundColorRGB),ie=Z.options.layer==="top")}),!ie&&Q&&(le=this._coreBrowserService.isFocused?_.selectionBackgroundOpaque:_.selectionInactiveBackgroundOpaque,G=le.rgba>>8&16777215,re=50331648,ie=!0,_.selectionForeground&&(J=50331648,te=_.selectionForeground.rgba>>8&16777215,oe=_.selectionForeground)),ie&&z.push("xterm-decoration-top");let he;switch(re){case 16777216:case 33554432:he=_.ansi[G],z.push(`xterm-bg-${G}`);break;case 50331648:he=Yr.toColor(G>>16,G>>8&255,G&255),this._addStyle(v,`background-color:#${e4((G>>>0).toString(16),"0",6)}`);break;case 0:default:ne?(he=_.foreground,z.push("xterm-bg-257")):he=_.background}switch(le||K.isDim()&&(le=cr.multiplyOpacity(he,.5)),J){case 16777216:case 33554432:K.isBold()&&te<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(te+=8),this._applyMinimumContrast(v,he,_.ansi[te],K,le,void 0)||z.push(`xterm-fg-${te}`);break;case 50331648:let Z=Yr.toColor(te>>16&255,te>>8&255,te&255);this._applyMinimumContrast(v,he,Z,K,le,oe)||this._addStyle(v,`color:#${e4(te.toString(16),"0",6)}`);break;case 0:default:this._applyMinimumContrast(v,he,_.foreground,K,le,oe)||ne&&z.push("xterm-fg-257")}z.length&&(v.className=z.join(" "),z.length=0),!V&&!U&&!q&&I?S++:v.textContent=w,L!==this.defaultSpacing&&(v.style.letterSpacing=`${L}px`),f.push(v),H=X}return v&&S&&(v.textContent=w),f}_applyMinimumContrast(e,n,r,i,s,a){if(this._optionsService.rawOptions.minimumContrastRatio===1||ire(i.getCode()))return!1;let o=this._getContrastCache(i),l;if(!s&&!a&&(l=o.getColor(n.rgba,r.rgba)),l===void 0){let u=this._optionsService.rawOptions.minimumContrastRatio/(i.isDim()?2:1);l=cr.ensureContrastRatio(s||n,a||r,u),o.setColor((s||n).rgba,(a||r).rgba,l??null)}return l?(this._addStyle(e,`color:${l.css}`),!0):!1}_getContrastCache(e){return e.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(e,n){e.setAttribute("style",`${e.getAttribute("style")||""}${n};`)}_isCellInSelection(e,n){let r=this._selectionStart,i=this._selectionEnd;return!r||!i?!1:this._columnSelectMode?r[0]<=i[0]?e>=r[0]&&n>=r[1]&&e<i[0]&&n<=i[1]:e<r[0]&&n>=r[1]&&e>=i[0]&&n<=i[1]:n>r[1]&&n<i[1]||r[1]===i[1]&&n===r[1]&&e>=r[0]&&e<i[0]||r[1]<i[1]&&n===i[1]&&e<i[0]||r[1]<i[1]&&n===r[1]&&e>=r[0]}};nj=Dr([vt(1,Xz),vt(2,us),vt(3,ic),vt(4,qd),vt(5,Ev),vt(6,cp)],nj);function e4(e,n,r){for(;e.length<r;)e=n+e;return e}var are=class{constructor(e,n){this._flat=new Float32Array(256),this._font="",this._fontSize=0,this._weight="normal",this._weightBold="bold",this._measureElements=[],this._container=e.createElement("div"),this._container.classList.add("xterm-width-cache-measure-container"),this._container.setAttribute("aria-hidden","true"),this._container.style.whiteSpace="pre",this._container.style.fontKerning="none";let r=e.createElement("span");r.classList.add("xterm-char-measure-element");let i=e.createElement("span");i.classList.add("xterm-char-measure-element"),i.style.fontWeight="bold";let s=e.createElement("span");s.classList.add("xterm-char-measure-element"),s.style.fontStyle="italic";let a=e.createElement("span");a.classList.add("xterm-char-measure-element"),a.style.fontWeight="bold",a.style.fontStyle="italic",this._measureElements=[r,i,s,a],this._container.appendChild(r),this._container.appendChild(i),this._container.appendChild(s),this._container.appendChild(a),n.appendChild(this._container),this.clear()}dispose(){this._container.remove(),this._measureElements.length=0,this._holey=void 0}clear(){this._flat.fill(-9999),this._holey=new Map}setFont(e,n,r,i){e===this._font&&n===this._fontSize&&r===this._weight&&i===this._weightBold||(this._font=e,this._fontSize=n,this._weight=r,this._weightBold=i,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${r}`,this._measureElements[1].style.fontWeight=`${i}`,this._measureElements[2].style.fontWeight=`${r}`,this._measureElements[3].style.fontWeight=`${i}`,this.clear())}get(e,n,r){let i=0;if(!n&&!r&&e.length===1&&(i=e.charCodeAt(0))<256){if(this._flat[i]!==-9999)return this._flat[i];let o=this._measure(e,0);return o>0&&(this._flat[i]=o),o}let s=e;n&&(s+="B"),r&&(s+="I");let a=this._holey.get(s);if(a===void 0){let o=0;n&&(o|=1),r&&(o|=2),a=this._measure(e,o),a>0&&this._holey.set(s,a)}return a}_measure(e,n){let r=this._measureElements[n];return r.textContent=e.repeat(32),r.offsetWidth/32}},ore=class{constructor(){this.clear()}clear(){this.hasSelection=!1,this.columnSelectMode=!1,this.viewportStartRow=0,this.viewportEndRow=0,this.viewportCappedStartRow=0,this.viewportCappedEndRow=0,this.startCol=0,this.endCol=0,this.selectionStart=void 0,this.selectionEnd=void 0}update(e,n,r,i=!1){if(this.selectionStart=n,this.selectionEnd=r,!n||!r||n[0]===r[0]&&n[1]===r[1]){this.clear();return}let s=e.buffers.active.ydisp,a=n[1]-s,o=r[1]-s,l=Math.max(a,0),u=Math.min(o,e.rows-1);if(l>=e.rows||u<0){this.clear();return}this.hasSelection=!0,this.columnSelectMode=i,this.viewportStartRow=a,this.viewportEndRow=o,this.viewportCappedStartRow=l,this.viewportCappedEndRow=u,this.startCol=n[0],this.endCol=r[0]}isCellSelected(e,n,r){return this.hasSelection?(r-=e.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?n>=this.startCol&&r>=this.viewportCappedStartRow&&n<this.endCol&&r<=this.viewportCappedEndRow:n<this.startCol&&r>=this.viewportCappedStartRow&&n>=this.endCol&&r<=this.viewportCappedEndRow:r>this.viewportStartRow&&r<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&r===this.viewportStartRow&&n>=this.startCol&&n<this.endCol||this.viewportStartRow<this.viewportEndRow&&r===this.viewportEndRow&&n<this.endCol||this.viewportStartRow<this.viewportEndRow&&r===this.viewportStartRow&&n>=this.startCol):!1}};function lre(){return new ore}var Kw="xterm-dom-renderer-owner-",ya="xterm-rows",u_="xterm-fg-",t4="xterm-bg-",om="xterm-focus",d_="xterm-selection",cre=1,rj=class extends sn{constructor(e,n,r,i,s,a,o,l,u,d,p,f,g,_){super(),this._terminal=e,this._document=n,this._element=r,this._screenElement=i,this._viewportElement=s,this._helperContainer=a,this._linkifier2=o,this._charSizeService=u,this._optionsService=d,this._bufferService=p,this._coreService=f,this._coreBrowserService=g,this._themeService=_,this._terminalClass=cre++,this._rowElements=[],this._selectionRenderModel=lre(),this.onRequestRedraw=this._register(new nt).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(ya),this._rowContainer.style.lineHeight="normal",this._rowContainer.setAttribute("aria-hidden","true"),this._refreshRowElements(this._bufferService.cols,this._bufferService.rows),this._selectionContainer=this._document.createElement("div"),this._selectionContainer.classList.add(d_),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=sre(),this._updateDimensions(),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._themeService.onChangeColors(x=>this._injectCss(x))),this._injectCss(this._themeService.colors),this._rowFactory=l.createInstance(nj,document),this._element.classList.add(Kw+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this._register(this._linkifier2.onShowLinkUnderline(x=>this._handleLinkHover(x))),this._register(this._linkifier2.onHideLinkUnderline(x=>this._handleLinkLeave(x))),this._register(br(()=>{this._element.classList.remove(Kw+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()})),this._widthCache=new are(this._document,this._helperContainer),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}_updateDimensions(){let e=this._coreBrowserService.dpr;this.dimensions.device.char.width=this._charSizeService.width*e,this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*e),this.dimensions.device.cell.width=this.dimensions.device.char.width+Math.round(this._optionsService.rawOptions.letterSpacing),this.dimensions.device.cell.height=Math.floor(this.dimensions.device.char.height*this._optionsService.rawOptions.lineHeight),this.dimensions.device.char.left=0,this.dimensions.device.char.top=0,this.dimensions.device.canvas.width=this.dimensions.device.cell.width*this._bufferService.cols,this.dimensions.device.canvas.height=this.dimensions.device.cell.height*this._bufferService.rows,this.dimensions.css.canvas.width=Math.round(this.dimensions.device.canvas.width/e),this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/e),this.dimensions.css.cell.width=this.dimensions.css.canvas.width/this._bufferService.cols,this.dimensions.css.cell.height=this.dimensions.css.canvas.height/this._bufferService.rows;for(let r of this._rowElements)r.style.width=`${this.dimensions.css.canvas.width}px`,r.style.height=`${this.dimensions.css.cell.height}px`,r.style.lineHeight=`${this.dimensions.css.cell.height}px`,r.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));let n=`${this._terminalSelector} .${ya} span { display: inline-block; height: 100%; vertical-align: top;}`;this._dimensionsStyleElement.textContent=n,this._selectionContainer.style.height=this._viewportElement.style.height,this._screenElement.style.width=`${this.dimensions.css.canvas.width}px`,this._screenElement.style.height=`${this.dimensions.css.canvas.height}px`}_injectCss(e){this._themeStyleElement||(this._themeStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._themeStyleElement));let n=`${this._terminalSelector} .${ya} { pointer-events: none; color: ${e.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}`;n+=`${this._terminalSelector} .${ya} .xterm-dim { color: ${cr.multiplyOpacity(e.foreground,.5).css};}`,n+=`${this._terminalSelector} span:not(.xterm-bold) { font-weight: ${this._optionsService.rawOptions.fontWeight};}${this._terminalSelector} span.xterm-bold { font-weight: ${this._optionsService.rawOptions.fontWeightBold};}${this._terminalSelector} span.xterm-italic { font-style: italic;}`;let r=`blink_underline_${this._terminalClass}`,i=`blink_bar_${this._terminalClass}`,s=`blink_block_${this._terminalClass}`;n+=`@keyframes ${r} { 50% {  border-bottom-style: hidden; }}`,n+=`@keyframes ${i} { 50% {  box-shadow: none; }}`,n+=`@keyframes ${s} { 0% {  background-color: ${e.cursor.css};  color: ${e.cursorAccent.css}; } 50% {  background-color: inherit;  color: ${e.cursor.css}; }}`,n+=`${this._terminalSelector} .${ya}.${om} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${r} 1s step-end infinite;}${this._terminalSelector} .${ya}.${om} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${i} 1s step-end infinite;}${this._terminalSelector} .${ya}.${om} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${s} 1s step-end infinite;}${this._terminalSelector} .${ya} .xterm-cursor.xterm-cursor-block { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css};}${this._terminalSelector} .${ya} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${e.cursor.css} !important; color: ${e.cursorAccent.css} !important;}${this._terminalSelector} .${ya} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${e.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${ya} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${e.cursor.css} inset;}${this._terminalSelector} .${ya} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${e.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,n+=`${this._terminalSelector} .${d_} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${d_} div { position: absolute; background-color: ${e.selectionBackgroundOpaque.css};}${this._terminalSelector} .${d_} div { position: absolute; background-color: ${e.selectionInactiveBackgroundOpaque.css};}`;for(let[a,o]of e.ansi.entries())n+=`${this._terminalSelector} .${u_}${a} { color: ${o.css}; }${this._terminalSelector} .${u_}${a}.xterm-dim { color: ${cr.multiplyOpacity(o,.5).css}; }${this._terminalSelector} .${t4}${a} { background-color: ${o.css}; }`;n+=`${this._terminalSelector} .${u_}257 { color: ${cr.opaque(e.background).css}; }${this._terminalSelector} .${u_}257.xterm-dim { color: ${cr.multiplyOpacity(cr.opaque(e.background),.5).css}; }${this._terminalSelector} .${t4}257 { background-color: ${e.foreground.css}; }`,this._themeStyleElement.textContent=n}_setDefaultSpacing(){let e=this.dimensions.css.cell.width-this._widthCache.get("W",!1,!1);this._rowContainer.style.letterSpacing=`${e}px`,this._rowFactory.defaultSpacing=e}handleDevicePixelRatioChange(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}_refreshRowElements(e,n){for(let r=this._rowElements.length;r<=n;r++){let i=this._document.createElement("div");this._rowContainer.appendChild(i),this._rowElements.push(i)}for(;this._rowElements.length>n;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(e,n){this._refreshRowElements(e,n),this._updateDimensions(),this.handleSelectionChanged(this._selectionRenderModel.selectionStart,this._selectionRenderModel.selectionEnd,this._selectionRenderModel.columnSelectMode)}handleCharSizeChanged(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}handleBlur(){this._rowContainer.classList.remove(om),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(om),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(e,n,r){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(e,n,r),this.renderRows(0,this._bufferService.rows-1),!e||!n||(this._selectionRenderModel.update(this._terminal,e,n,r),!this._selectionRenderModel.hasSelection))return;let i=this._selectionRenderModel.viewportStartRow,s=this._selectionRenderModel.viewportEndRow,a=this._selectionRenderModel.viewportCappedStartRow,o=this._selectionRenderModel.viewportCappedEndRow,l=this._document.createDocumentFragment();if(r){let u=e[0]>n[0];l.appendChild(this._createSelectionElement(a,u?n[0]:e[0],u?e[0]:n[0],o-a+1))}else{let u=i===a?e[0]:0,d=a===s?n[0]:this._bufferService.cols;l.appendChild(this._createSelectionElement(a,u,d));let p=o-a-1;if(l.appendChild(this._createSelectionElement(a+1,0,this._bufferService.cols,p)),a!==o){let f=s===o?n[0]:this._bufferService.cols;l.appendChild(this._createSelectionElement(o,0,f))}}this._selectionContainer.appendChild(l)}_createSelectionElement(e,n,r,i=1){let s=this._document.createElement("div"),a=n*this.dimensions.css.cell.width,o=this.dimensions.css.cell.width*(r-n);return a+o>this.dimensions.css.canvas.width&&(o=this.dimensions.css.canvas.width-a),s.style.height=`${i*this.dimensions.css.cell.height}px`,s.style.top=`${e*this.dimensions.css.cell.height}px`,s.style.left=`${a}px`,s.style.width=`${o}px`,s}handleCursorMove(){}_handleOptionsChanged(){this._updateDimensions(),this._injectCss(this._themeService.colors),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}clear(){for(let e of this._rowElements)e.replaceChildren()}renderRows(e,n){let r=this._bufferService.buffer,i=r.ybase+r.y,s=Math.min(r.x,this._bufferService.cols-1),a=this._coreService.decPrivateModes.cursorBlink??this._optionsService.rawOptions.cursorBlink,o=this._coreService.decPrivateModes.cursorStyle??this._optionsService.rawOptions.cursorStyle,l=this._optionsService.rawOptions.cursorInactiveStyle;for(let u=e;u<=n;u++){let d=u+r.ydisp,p=this._rowElements[u],f=r.lines.get(d);if(!p||!f)break;p.replaceChildren(...this._rowFactory.createRow(f,d,d===i,o,l,s,a,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${Kw}${this._terminalClass}`}_handleLinkHover(e){this._setCellUnderline(e.x1,e.x2,e.y1,e.y2,e.cols,!0)}_handleLinkLeave(e){this._setCellUnderline(e.x1,e.x2,e.y1,e.y2,e.cols,!1)}_setCellUnderline(e,n,r,i,s,a){r<0&&(e=0),i<0&&(n=0);let o=this._bufferService.rows-1;r=Math.max(Math.min(r,o),0),i=Math.max(Math.min(i,o),0),s=Math.min(s,this._bufferService.cols);let l=this._bufferService.buffer,u=l.ybase+l.y,d=Math.min(l.x,s-1),p=this._optionsService.rawOptions.cursorBlink,f=this._optionsService.rawOptions.cursorStyle,g=this._optionsService.rawOptions.cursorInactiveStyle;for(let _=r;_<=i;++_){let x=_+l.ydisp,v=this._rowElements[_],S=l.lines.get(x);if(!v||!S)break;v.replaceChildren(...this._rowFactory.createRow(S,x,x===u,f,g,d,p,this.dimensions.css.cell.width,this._widthCache,a?_===r?e:0:-1,a?(_===i?n:s)-1:-1))}}};rj=Dr([vt(7,GE),vt(8,M0),vt(9,us),vt(10,cs),vt(11,qd),vt(12,ic),vt(13,cp)],rj);var ij=class extends sn{constructor(e,n,r){super(),this._optionsService=r,this.width=0,this.height=0,this._onCharSizeChange=this._register(new nt),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this._register(new dre(this._optionsService))}catch{this._measureStrategy=this._register(new ure(e,n,this._optionsService))}this._register(this._optionsService.onMultipleOptionChange(["fontFamily","fontSize"],()=>this.measure()))}get hasValidSize(){return this.width>0&&this.height>0}measure(){let e=this._measureStrategy.measure();(e.width!==this.width||e.height!==this.height)&&(this.width=e.width,this.height=e.height,this._onCharSizeChange.fire())}};ij=Dr([vt(2,us)],ij);var m9=class extends sn{constructor(){super(...arguments),this._result={width:0,height:0}}_validateAndSet(e,n){e!==void 0&&e>0&&n!==void 0&&n>0&&(this._result.width=e,this._result.height=n)}},ure=class extends m9{constructor(e,n,r){super(),this._document=e,this._parentElement=n,this._optionsService=r,this._measureElement=this._document.createElement("span"),this._measureElement.classList.add("xterm-char-measure-element"),this._measureElement.textContent="W".repeat(32),this._measureElement.setAttribute("aria-hidden","true"),this._measureElement.style.whiteSpace="pre",this._measureElement.style.fontKerning="none",this._parentElement.appendChild(this._measureElement)}measure(){return this._measureElement.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._measureElement.style.fontSize=`${this._optionsService.rawOptions.fontSize}px`,this._validateAndSet(Number(this._measureElement.offsetWidth)/32,Number(this._measureElement.offsetHeight)),this._result}},dre=class extends m9{constructor(e){super(),this._optionsService=e,this._canvas=new OffscreenCanvas(100,100),this._ctx=this._canvas.getContext("2d");let n=this._ctx.measureText("W");if(!("width"in n&&"fontBoundingBoxAscent"in n&&"fontBoundingBoxDescent"in n))throw new Error("Required font metrics not supported")}measure(){this._ctx.font=`${this._optionsService.rawOptions.fontSize}px ${this._optionsService.rawOptions.fontFamily}`;let e=this._ctx.measureText("W");return this._validateAndSet(e.width,e.fontBoundingBoxAscent+e.fontBoundingBoxDescent),this._result}},hre=class extends sn{constructor(e,n,r){super(),this._textarea=e,this._window=n,this.mainDocument=r,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=this._register(new fre(this._window)),this._onDprChange=this._register(new nt),this.onDprChange=this._onDprChange.event,this._onWindowChange=this._register(new nt),this.onWindowChange=this._onWindowChange.event,this._register(this.onWindowChange(i=>this._screenDprMonitor.setWindow(i))),this._register(Ti.forward(this._screenDprMonitor.onDprChange,this._onDprChange)),this._register(Ut(this._textarea,"focus",()=>this._isFocused=!0)),this._register(Ut(this._textarea,"blur",()=>this._isFocused=!1))}get window(){return this._window}set window(e){this._window!==e&&(this._window=e,this._onWindowChange.fire(this._window))}get dpr(){return this.window.devicePixelRatio}get isFocused(){return this._cachedIsFocused===void 0&&(this._cachedIsFocused=this._isFocused&&this._textarea.ownerDocument.hasFocus(),queueMicrotask(()=>this._cachedIsFocused=void 0)),this._cachedIsFocused}},fre=class extends sn{constructor(e){super(),this._parentWindow=e,this._windowResizeListener=this._register(new Pf),this._onDprChange=this._register(new nt),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this._register(br(()=>this.clearListener()))}setWindow(e){this._parentWindow=e,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=Ut(this._parentWindow,"resize",()=>this._setDprAndFireIfDiffers())}_setDprAndFireIfDiffers(){this._parentWindow.devicePixelRatio!==this._currentDevicePixelRatio&&this._onDprChange.fire(this._parentWindow.devicePixelRatio),this._updateDpr()}_updateDpr(){var e;this._outerListener&&((e=this._resolutionMediaMatchList)==null||e.removeListener(this._outerListener),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._resolutionMediaMatchList=this._parentWindow.matchMedia(`screen and (resolution: ${this._parentWindow.devicePixelRatio}dppx)`),this._resolutionMediaMatchList.addListener(this._outerListener))}clearListener(){!this._resolutionMediaMatchList||!this._outerListener||(this._resolutionMediaMatchList.removeListener(this._outerListener),this._resolutionMediaMatchList=void 0,this._outerListener=void 0)}},pre=class extends sn{constructor(){super(),this.linkProviders=[],this._register(br(()=>this.linkProviders.length=0))}registerLinkProvider(e){return this.linkProviders.push(e),{dispose:()=>{let n=this.linkProviders.indexOf(e);n!==-1&&this.linkProviders.splice(n,1)}}}};function rA(e,n,r){let i=r.getBoundingClientRect(),s=e.getComputedStyle(r),a=parseInt(s.getPropertyValue("padding-left")),o=parseInt(s.getPropertyValue("padding-top"));return[n.clientX-i.left-a,n.clientY-i.top-o]}function mre(e,n,r,i,s,a,o,l,u){if(!a)return;let d=rA(e,n,r);if(d)return d[0]=Math.ceil((d[0]+(u?o/2:0))/o),d[1]=Math.ceil(d[1]/l),d[0]=Math.min(Math.max(d[0],1),i+(u?1:0)),d[1]=Math.min(Math.max(d[1],1),s),d}var sj=class{constructor(e,n){this._renderService=e,this._charSizeService=n}getCoords(e,n,r,i,s){return mre(window,e,n,r,i,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,s)}getMouseReportCoords(e,n){let r=rA(window,e,n);if(this._charSizeService.hasValidSize)return r[0]=Math.min(Math.max(r[0],0),this._renderService.dimensions.css.canvas.width-1),r[1]=Math.min(Math.max(r[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(r[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(r[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(r[0]),y:Math.floor(r[1])}}};sj=Dr([vt(0,sc),vt(1,M0)],sj);var gre=class{constructor(e,n){this._renderCallback=e,this._coreBrowserService=n,this._refreshCallbacks=[]}dispose(){this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}addRefreshCallback(e){return this._refreshCallbacks.push(e),this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh())),this._animationFrame}refresh(e,n,r){this._rowCount=r,e=e!==void 0?e:0,n=n!==void 0?n:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,e):e,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,n):n,!this._animationFrame&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh()))}_innerRefresh(){if(this._animationFrame=void 0,this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0){this._runRefreshCallbacks();return}let e=Math.max(this._rowStart,0),n=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(e,n),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(let e of this._refreshCallbacks)e(0);this._refreshCallbacks=[]}},g9={};jte(g9,{getSafariVersion:()=>yre,isChromeOS:()=>x9,isFirefox:()=>v9,isIpad:()=>_re,isIphone:()=>xre,isLegacyEdge:()=>vre,isLinux:()=>iA,isMac:()=>ab,isNode:()=>R0,isSafari:()=>y9,isWindows:()=>_9});var R0=typeof process<"u"&&"title"in process,Av=R0?"node":navigator.userAgent,Tv=R0?"node":navigator.platform,v9=Av.includes("Firefox"),vre=Av.includes("Edge"),y9=/^((?!chrome|android).)*safari/i.test(Av);function yre(){if(!y9)return 0;let e=Av.match(/Version\/(\d+)/);return e===null||e.length<2?0:parseInt(e[1])}var ab=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(Tv),_re=Tv==="iPad",xre=Tv==="iPhone",_9=["Windows","Win16","Win32","WinCE"].includes(Tv),iA=Tv.indexOf("Linux")>=0,x9=/\bCrOS\b/.test(Av),b9=class{constructor(){this._tasks=[],this._i=0}enqueue(e){this._tasks.push(e),this._start()}flush(){for(;this._i<this._tasks.length;)this._tasks[this._i]()||this._i++;this.clear()}clear(){this._idleCallback&&(this._cancelCallback(this._idleCallback),this._idleCallback=void 0),this._i=0,this._tasks.length=0}_start(){this._idleCallback||(this._idleCallback=this._requestCallback(this._process.bind(this)))}_process(e){this._idleCallback=void 0;let n=0,r=0,i=e.timeRemaining(),s=0;for(;this._i<this._tasks.length;){if(n=performance.now(),this._tasks[this._i]()||this._i++,n=Math.max(1,performance.now()-n),r=Math.max(n,r),s=e.timeRemaining(),r*1.5>s){i-n<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(i-n))}ms`),this._start();return}i=s}this.clear()}},bre=class extends b9{_requestCallback(e){return setTimeout(()=>e(this._createDeadline(16)))}_cancelCallback(e){clearTimeout(e)}_createDeadline(e){let n=performance.now()+e;return{timeRemaining:()=>Math.max(0,n-performance.now())}}},kre=class extends b9{_requestCallback(e){return requestIdleCallback(e)}_cancelCallback(e){cancelIdleCallback(e)}},ob=!R0&&"requestIdleCallback"in window?kre:bre,wre=class{constructor(){this._queue=new ob}set(e){this._queue.clear(),this._queue.enqueue(e)}flush(){this._queue.flush()}},aj=class extends sn{constructor(e,n,r,i,s,a,o,l,u){super(),this._rowCount=e,this._optionsService=r,this._charSizeService=i,this._coreService=s,this._coreBrowserService=l,this._renderer=this._register(new Pf),this._pausedResizeTask=new wre,this._observerDisposable=this._register(new Pf),this._isPaused=!1,this._needsFullRefresh=!1,this._isNextRenderRedrawOnly=!0,this._needsSelectionRefresh=!1,this._canvasWidth=0,this._canvasHeight=0,this._selectionState={start:void 0,end:void 0,columnSelectMode:!1},this._onDimensionsChange=this._register(new nt),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this._register(new nt),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this._register(new nt),this.onRender=this._onRender.event,this._onRefreshRequest=this._register(new nt),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new gre((d,p)=>this._renderRows(d,p),this._coreBrowserService),this._register(this._renderDebouncer),this._syncOutputHandler=new Sre(this._coreBrowserService,this._coreService,()=>this._fullRefresh()),this._register(br(()=>this._syncOutputHandler.dispose())),this._register(this._coreBrowserService.onDprChange(()=>this.handleDevicePixelRatioChange())),this._register(o.onResize(()=>this._fullRefresh())),this._register(o.buffers.onBufferActivate(()=>{var d;return(d=this._renderer.value)==null?void 0:d.clear()})),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._charSizeService.onCharSizeChange(()=>this.handleCharSizeChanged())),this._register(a.onDecorationRegistered(()=>this._fullRefresh())),this._register(a.onDecorationRemoved(()=>this._fullRefresh())),this._register(this._optionsService.onMultipleOptionChange(["customGlyphs","drawBoldTextInBrightColors","letterSpacing","lineHeight","fontFamily","fontSize","fontWeight","fontWeightBold","minimumContrastRatio","rescaleOverlappingGlyphs"],()=>{this.clear(),this.handleResize(o.cols,o.rows),this._fullRefresh()})),this._register(this._optionsService.onMultipleOptionChange(["cursorBlink","cursorStyle"],()=>this.refreshRows(o.buffer.y,o.buffer.y,!0))),this._register(u.onChangeColors(()=>this._fullRefresh())),this._registerIntersectionObserver(this._coreBrowserService.window,n),this._register(this._coreBrowserService.onWindowChange(d=>this._registerIntersectionObserver(d,n)))}get dimensions(){return this._renderer.value.dimensions}_registerIntersectionObserver(e,n){if("IntersectionObserver"in e){let r=new e.IntersectionObserver(i=>this._handleIntersectionChange(i[i.length-1]),{threshold:0});r.observe(n),this._observerDisposable.value=br(()=>r.disconnect())}}_handleIntersectionChange(e){this._isPaused=e.isIntersecting===void 0?e.intersectionRatio===0:!e.isIntersecting,!this._isPaused&&!this._charSizeService.hasValidSize&&this._charSizeService.measure(),!this._isPaused&&this._needsFullRefresh&&(this._pausedResizeTask.flush(),this.refreshRows(0,this._rowCount-1),this._needsFullRefresh=!1)}refreshRows(e,n,r=!1){if(this._isPaused){this._needsFullRefresh=!0;return}if(this._coreService.decPrivateModes.synchronizedOutput){this._syncOutputHandler.bufferRows(e,n);return}let i=this._syncOutputHandler.flush();i&&(e=Math.min(e,i.start),n=Math.max(n,i.end)),r||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(e,n,this._rowCount)}_renderRows(e,n){if(this._renderer.value){if(this._coreService.decPrivateModes.synchronizedOutput){this._syncOutputHandler.bufferRows(e,n);return}e=Math.min(e,this._rowCount-1),n=Math.min(n,this._rowCount-1),this._renderer.value.renderRows(e,n),this._needsSelectionRefresh&&(this._renderer.value.handleSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode),this._needsSelectionRefresh=!1),this._isNextRenderRedrawOnly||this._onRenderedViewportChange.fire({start:e,end:n}),this._onRender.fire({start:e,end:n}),this._isNextRenderRedrawOnly=!0}}resize(e,n){this._rowCount=n,this._fireOnCanvasResize()}_handleOptionsChanged(){this._renderer.value&&(this.refreshRows(0,this._rowCount-1),this._fireOnCanvasResize())}_fireOnCanvasResize(){this._renderer.value&&(this._renderer.value.dimensions.css.canvas.width===this._canvasWidth&&this._renderer.value.dimensions.css.canvas.height===this._canvasHeight||this._onDimensionsChange.fire(this._renderer.value.dimensions))}hasRenderer(){return!!this._renderer.value}setRenderer(e){this._renderer.value=e,this._renderer.value&&(this._renderer.value.onRequestRedraw(n=>this.refreshRows(n.start,n.end,!0)),this._needsSelectionRefresh=!0,this._fullRefresh())}addRefreshCallback(e){return this._renderDebouncer.addRefreshCallback(e)}_fullRefresh(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)}clearTextureAtlas(){var e,n;this._renderer.value&&((n=(e=this._renderer.value).clearTextureAtlas)==null||n.call(e),this._fullRefresh())}handleDevicePixelRatioChange(){this._charSizeService.measure(),this._renderer.value&&(this._renderer.value.handleDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1))}handleResize(e,n){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set(()=>{var r;return(r=this._renderer.value)==null?void 0:r.handleResize(e,n)}):this._renderer.value.handleResize(e,n),this._fullRefresh())}handleCharSizeChanged(){var e;(e=this._renderer.value)==null||e.handleCharSizeChanged()}handleBlur(){var e;(e=this._renderer.value)==null||e.handleBlur()}handleFocus(){var e;(e=this._renderer.value)==null||e.handleFocus()}handleSelectionChanged(e,n,r){var i;this._selectionState.start=e,this._selectionState.end=n,this._selectionState.columnSelectMode=r,(i=this._renderer.value)==null||i.handleSelectionChanged(e,n,r)}handleCursorMove(){var e;(e=this._renderer.value)==null||e.handleCursorMove()}clear(){var e;(e=this._renderer.value)==null||e.clear()}};aj=Dr([vt(2,us),vt(3,M0),vt(4,qd),vt(5,Ev),vt(6,cs),vt(7,ic),vt(8,cp)],aj);var Sre=class{constructor(e,n,r){this._coreBrowserService=e,this._coreService=n,this._onTimeout=r,this._start=0,this._end=0,this._isBuffering=!1}bufferRows(e,n){this._isBuffering?(this._start=Math.min(this._start,e),this._end=Math.max(this._end,n)):(this._start=e,this._end=n,this._isBuffering=!0),this._timeout===void 0&&(this._timeout=this._coreBrowserService.window.setTimeout(()=>{this._timeout=void 0,this._coreService.decPrivateModes.synchronizedOutput=!1,this._onTimeout()},1e3))}flush(){if(this._timeout!==void 0&&(this._coreBrowserService.window.clearTimeout(this._timeout),this._timeout=void 0),!this._isBuffering)return;let e={start:this._start,end:this._end};return this._isBuffering=!1,e}dispose(){this._timeout!==void 0&&(this._coreBrowserService.window.clearTimeout(this._timeout),this._timeout=void 0)}};function Cre(e,n,r,i){let s=r.buffer.x,a=r.buffer.y;if(!r.buffer.hasScrollback)return Ere(s,a,e,n,r,i)+O0(a,n,r,i)+Are(s,a,e,n,r,i);let o;if(a===n)return o=s>e?"D":"C",Mg(Math.abs(s-e),Tg(o,i));o=a>n?"D":"C";let l=Math.abs(a-n),u=Nre(a>n?e:s,r)+(l-1)*r.cols+1+jre(a>n?s:e);return Mg(u,Tg(o,i))}function jre(e,n){return e-1}function Nre(e,n){return n.cols-e}function Ere(e,n,r,i,s,a){return O0(n,i,s,a).length===0?"":Mg(w9(e,n,e,n-Rd(n,s),!1,s).length,Tg("D",a))}function O0(e,n,r,i){let s=e-Rd(e,r),a=n-Rd(n,r),o=Math.abs(s-a)-Tre(e,n,r);return Mg(o,Tg(k9(e,n),i))}function Are(e,n,r,i,s,a){let o;O0(n,i,s,a).length>0?o=i-Rd(i,s):o=n;let l=i,u=Mre(e,n,r,i,s,a);return Mg(w9(e,o,r,l,u==="C",s).length,Tg(u,a))}function Tre(e,n,r){var o;let i=0,s=e-Rd(e,r),a=n-Rd(n,r);for(let l=0;l<Math.abs(s-a);l++){let u=k9(e,n)==="A"?-1:1;(o=r.buffer.lines.get(s+u*l))!=null&&o.isWrapped&&i++}return i}function Rd(e,n){let r=0,i=n.buffer.lines.get(e),s=i==null?void 0:i.isWrapped;for(;s&&e>=0&&e<n.rows;)r++,i=n.buffer.lines.get(--e),s=i==null?void 0:i.isWrapped;return r}function Mre(e,n,r,i,s,a){let o;return O0(r,i,s,a).length>0?o=i-Rd(i,s):o=n,e<r&&o<=i||e>=r&&o<i?"C":"D"}function k9(e,n){return e>n?"A":"B"}function w9(e,n,r,i,s,a){let o=e,l=n,u="";for(;(o!==r||l!==i)&&l>=0&&l<a.buffer.lines.length;)o+=s?1:-1,s&&o>a.cols-1?(u+=a.buffer.translateBufferLineToString(l,!1,e,o),o=0,e=0,l++):!s&&o<0&&(u+=a.buffer.translateBufferLineToString(l,!1,0,e+1),o=a.cols-1,e=o,l--);return u+a.buffer.translateBufferLineToString(l,!1,e,o)}function Tg(e,n){let r=n?"O":"[";return Fe.ESC+r+e}function Mg(e,n){e=Math.floor(e);let r="";for(let i=0;i<e;i++)r+=n;return r}var Rre=class{constructor(e){this._bufferService=e,this.isSelectAllActive=!1,this.selectionStartLength=0}clearSelection(){this.selectionStart=void 0,this.selectionEnd=void 0,this.isSelectAllActive=!1,this.selectionStartLength=0}get finalSelectionStart(){return this.isSelectAllActive?[0,0]:!this.selectionEnd||!this.selectionStart?this.selectionStart:this.areSelectionValuesReversed()?this.selectionEnd:this.selectionStart}get finalSelectionEnd(){if(this.isSelectAllActive)return[this._bufferService.cols,this._bufferService.buffer.ybase+this._bufferService.rows-1];if(this.selectionStart){if(!this.selectionEnd||this.areSelectionValuesReversed()){let e=this.selectionStart[0]+this.selectionStartLength;return e>this._bufferService.cols?e%this._bufferService.cols===0?[this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)-1]:[e%this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)]:[e,this.selectionStart[1]]}if(this.selectionStartLength&&this.selectionEnd[1]===this.selectionStart[1]){let e=this.selectionStart[0]+this.selectionStartLength;return e>this._bufferService.cols?[e%this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)]:[Math.max(e,this.selectionEnd[0]),this.selectionEnd[1]]}return this.selectionEnd}}areSelectionValuesReversed(){let e=this.selectionStart,n=this.selectionEnd;return!e||!n?!1:e[1]>n[1]||e[1]===n[1]&&e[0]>n[0]}handleTrim(e){return this.selectionStart&&(this.selectionStart[1]-=e),this.selectionEnd&&(this.selectionEnd[1]-=e),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)}};function n4(e,n){if(e.start.y>e.end.y)throw new Error(`Buffer range end (${e.end.x}, ${e.end.y}) cannot be before start (${e.start.x}, ${e.start.y})`);return n*(e.end.y-e.start.y)+(e.end.x-e.start.x+1)}var Vw=50,Ore=15,Dre=50,Pre=500,Lre=" ",Ire=new RegExp(Lre,"g"),oj=class extends sn{constructor(e,n,r,i,s,a,o,l,u){super(),this._element=e,this._screenElement=n,this._linkifier=r,this._bufferService=i,this._coreService=s,this._mouseService=a,this._optionsService=o,this._renderService=l,this._coreBrowserService=u,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new Ma,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this._register(new nt),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this._register(new nt),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this._register(new nt),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this._register(new nt),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=d=>this._handleMouseMove(d),this._mouseUpListener=d=>this._handleMouseUp(d),this._coreService.onUserInput(()=>{this.hasSelection&&this.clearSelection()}),this._trimListener=this._bufferService.buffer.lines.onTrim(d=>this._handleTrim(d)),this._register(this._bufferService.buffers.onBufferActivate(d=>this._handleBufferActivate(d))),this.enable(),this._model=new Rre(this._bufferService),this._activeSelectionMode=0,this._register(br(()=>{this._removeMouseDownListeners()})),this._register(this._bufferService.onResize(d=>{d.rowsChanged&&this.clearSelection()}))}reset(){this.clearSelection()}disable(){this.clearSelection(),this._enabled=!1}enable(){this._enabled=!0}get selectionStart(){return this._model.finalSelectionStart}get selectionEnd(){return this._model.finalSelectionEnd}get hasSelection(){let e=this._model.finalSelectionStart,n=this._model.finalSelectionEnd;return!e||!n?!1:e[0]!==n[0]||e[1]!==n[1]}get selectionText(){let e=this._model.finalSelectionStart,n=this._model.finalSelectionEnd;if(!e||!n)return"";let r=this._bufferService.buffer,i=[];if(this._activeSelectionMode===3){if(e[0]===n[0])return"";let s=e[0]<n[0]?e[0]:n[0],a=e[0]<n[0]?n[0]:e[0];for(let o=e[1];o<=n[1];o++){let l=r.translateBufferLineToString(o,!0,s,a);i.push(l)}}else{let s=e[1]===n[1]?n[0]:void 0;i.push(r.translateBufferLineToString(e[1],!0,e[0],s));for(let a=e[1]+1;a<=n[1]-1;a++){let o=r.lines.get(a),l=r.translateBufferLineToString(a,!0);o!=null&&o.isWrapped?i[i.length-1]+=l:i.push(l)}if(e[1]!==n[1]){let a=r.lines.get(n[1]),o=r.translateBufferLineToString(n[1],!0,0,n[0]);a&&a.isWrapped?i[i.length-1]+=o:i.push(o)}}return i.map(s=>s.replace(Ire," ")).join(_9?`\r
`:`
`)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(e){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._refresh())),iA&&e&&this.selectionText.length&&this._onLinuxMouseSelection.fire(this.selectionText)}_refresh(){this._refreshAnimationFrame=void 0,this._onRedrawRequest.fire({start:this._model.finalSelectionStart,end:this._model.finalSelectionEnd,columnSelectMode:this._activeSelectionMode===3})}_isClickInSelection(e){let n=this._getMouseBufferCoords(e),r=this._model.finalSelectionStart,i=this._model.finalSelectionEnd;return!r||!i||!n?!1:this._areCoordsInSelection(n,r,i)}isCellInSelection(e,n){let r=this._model.finalSelectionStart,i=this._model.finalSelectionEnd;return!r||!i?!1:this._areCoordsInSelection([e,n],r,i)}_areCoordsInSelection(e,n,r){return e[1]>n[1]&&e[1]<r[1]||n[1]===r[1]&&e[1]===n[1]&&e[0]>=n[0]&&e[0]<r[0]||n[1]<r[1]&&e[1]===r[1]&&e[0]<r[0]||n[1]<r[1]&&e[1]===n[1]&&e[0]>=n[0]}_selectWordAtCursor(e,n){var s,a;let r=(a=(s=this._linkifier.currentLink)==null?void 0:s.link)==null?void 0:a.range;if(r)return this._model.selectionStart=[r.start.x-1,r.start.y-1],this._model.selectionStartLength=n4(r,this._bufferService.cols),this._model.selectionEnd=void 0,!0;let i=this._getMouseBufferCoords(e);return i?(this._selectWordAt(i,n),this._model.selectionEnd=void 0,!0):!1}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(e,n){this._model.clearSelection(),e=Math.max(e,0),n=Math.min(n,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,e],this._model.selectionEnd=[this._bufferService.cols,n],this.refresh(),this._onSelectionChange.fire()}_handleTrim(e){this._model.handleTrim(e)&&this.refresh()}_getMouseBufferCoords(e){let n=this._mouseService.getCoords(e,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(n)return n[0]--,n[1]--,n[1]+=this._bufferService.buffer.ydisp,n}_getMouseEventScrollAmount(e){let n=rA(this._coreBrowserService.window,e,this._screenElement)[1],r=this._renderService.dimensions.css.canvas.height;return n>=0&&n<=r?0:(n>r&&(n-=r),n=Math.min(Math.max(n,-Vw),Vw),n/=Vw,n/Math.abs(n)+Math.round(n*(Ore-1)))}shouldForceSelection(e){return ab?e.altKey&&this._optionsService.rawOptions.macOptionClickForcesSelection:e.shiftKey}handleMouseDown(e){if(this._mouseDownTimeStamp=e.timeStamp,!(e.button===2&&this.hasSelection)&&e.button===0){if(!this._enabled){if(!this.shouldForceSelection(e))return;e.stopPropagation()}e.preventDefault(),this._dragScrollAmount=0,this._enabled&&e.shiftKey?this._handleIncrementalClick(e):e.detail===1?this._handleSingleClick(e):e.detail===2?this._handleDoubleClick(e):e.detail===3&&this._handleTripleClick(e),this._addMouseDownListeners(),this.refresh(!0)}}_addMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.addEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.addEventListener("mouseup",this._mouseUpListener)),this._dragScrollIntervalTimer=this._coreBrowserService.window.setInterval(()=>this._dragScroll(),Dre)}_removeMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.removeEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.removeEventListener("mouseup",this._mouseUpListener)),this._coreBrowserService.window.clearInterval(this._dragScrollIntervalTimer),this._dragScrollIntervalTimer=void 0}_handleIncrementalClick(e){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(e))}_handleSingleClick(e){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(e)?3:0,this._model.selectionStart=this._getMouseBufferCoords(e),!this._model.selectionStart)return;this._model.selectionEnd=void 0;let n=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);n&&n.length!==this._model.selectionStart[0]&&n.hasWidth(this._model.selectionStart[0])===0&&this._model.selectionStart[0]++}_handleDoubleClick(e){this._selectWordAtCursor(e,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(e){let n=this._getMouseBufferCoords(e);n&&(this._activeSelectionMode=2,this._selectLineAt(n[1]))}shouldColumnSelect(e){return e.altKey&&!(ab&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(e){if(e.stopImmediatePropagation(),!this._model.selectionStart)return;let n=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(e),!this._model.selectionEnd){this.refresh(!0);return}this._activeSelectionMode===2?this._model.selectionEnd[1]<this._model.selectionStart[1]?this._model.selectionEnd[0]=0:this._model.selectionEnd[0]=this._bufferService.cols:this._activeSelectionMode===1&&this._selectToWordAt(this._model.selectionEnd),this._dragScrollAmount=this._getMouseEventScrollAmount(e),this._activeSelectionMode!==3&&(this._dragScrollAmount>0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));let r=this._bufferService.buffer;if(this._model.selectionEnd[1]<r.lines.length){let i=r.lines.get(this._model.selectionEnd[1]);i&&i.hasWidth(this._model.selectionEnd[0])===0&&this._model.selectionEnd[0]<this._bufferService.cols&&this._model.selectionEnd[0]++}(!n||n[0]!==this._model.selectionEnd[0]||n[1]!==this._model.selectionEnd[1])&&this.refresh(!0)}_dragScroll(){if(!(!this._model.selectionEnd||!this._model.selectionStart)&&this._dragScrollAmount){this._onRequestScrollLines.fire({amount:this._dragScrollAmount,suppressScrollEvent:!1});let e=this._bufferService.buffer;this._dragScrollAmount>0?(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(e.ydisp+this._bufferService.rows,e.lines.length-1)):(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=e.ydisp),this.refresh()}}_handleMouseUp(e){let n=e.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&n<Pre&&e.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){let r=this._mouseService.getCoords(e,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(r&&r[0]!==void 0&&r[1]!==void 0){let i=Cre(r[0]-1,r[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(i,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){let e=this._model.finalSelectionStart,n=this._model.finalSelectionEnd,r=!!e&&!!n&&(e[0]!==n[0]||e[1]!==n[1]);if(!r){this._oldHasSelection&&this._fireOnSelectionChange(e,n,r);return}!e||!n||(!this._oldSelectionStart||!this._oldSelectionEnd||e[0]!==this._oldSelectionStart[0]||e[1]!==this._oldSelectionStart[1]||n[0]!==this._oldSelectionEnd[0]||n[1]!==this._oldSelectionEnd[1])&&this._fireOnSelectionChange(e,n,r)}_fireOnSelectionChange(e,n,r){this._oldSelectionStart=e,this._oldSelectionEnd=n,this._oldHasSelection=r,this._onSelectionChange.fire()}_handleBufferActivate(e){this.clearSelection(),this._trimListener.dispose(),this._trimListener=e.activeBuffer.lines.onTrim(n=>this._handleTrim(n))}_convertViewportColToCharacterIndex(e,n){let r=n;for(let i=0;n>=i;i++){let s=e.loadCell(i,this._workCell).getChars().length;this._workCell.getWidth()===0?r--:s>1&&n!==i&&(r+=s-1)}return r}setSelection(e,n,r){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[e,n],this._model.selectionStartLength=r,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(e){this._isClickInSelection(e)||(this._selectWordAtCursor(e,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(e,n,r=!0,i=!0){if(e[0]>=this._bufferService.cols)return;let s=this._bufferService.buffer,a=s.lines.get(e[1]);if(!a)return;let o=s.translateBufferLineToString(e[1],!1),l=this._convertViewportColToCharacterIndex(a,e[0]),u=l,d=e[0]-l,p=0,f=0,g=0,_=0;if(o.charAt(l)===" "){for(;l>0&&o.charAt(l-1)===" ";)l--;for(;u<o.length&&o.charAt(u+1)===" ";)u++}else{let S=e[0],w=e[0];a.getWidth(S)===0&&(p++,S--),a.getWidth(w)===2&&(f++,w++);let j=a.getString(w).length;for(j>1&&(_+=j-1,u+=j-1);S>0&&l>0&&!this._isCharWordSeparator(a.loadCell(S-1,this._workCell));){a.loadCell(S-1,this._workCell);let C=this._workCell.getChars().length;this._workCell.getWidth()===0?(p++,S--):C>1&&(g+=C-1,l-=C-1),l--,S--}for(;w<a.length&&u+1<o.length&&!this._isCharWordSeparator(a.loadCell(w+1,this._workCell));){a.loadCell(w+1,this._workCell);let C=this._workCell.getChars().length;this._workCell.getWidth()===2?(f++,w++):C>1&&(_+=C-1,u+=C-1),u++,w++}}u++;let x=l+d-p+g,v=Math.min(this._bufferService.cols,u-l+p+f-g-_);if(!(!n&&o.slice(l,u).trim()==="")){if(r&&x===0&&a.getCodePoint(0)!==32){let S=s.lines.get(e[1]-1);if(S&&a.isWrapped&&S.getCodePoint(this._bufferService.cols-1)!==32){let w=this._getWordAt([this._bufferService.cols-1,e[1]-1],!1,!0,!1);if(w){let j=this._bufferService.cols-w.start;x-=j,v+=j}}}if(i&&x+v===this._bufferService.cols&&a.getCodePoint(this._bufferService.cols-1)!==32){let S=s.lines.get(e[1]+1);if(S!=null&&S.isWrapped&&S.getCodePoint(0)!==32){let w=this._getWordAt([0,e[1]+1],!1,!1,!0);w&&(v+=w.length)}}return{start:x,length:v}}}_selectWordAt(e,n){let r=this._getWordAt(e,n);if(r){for(;r.start<0;)r.start+=this._bufferService.cols,e[1]--;this._model.selectionStart=[r.start,e[1]],this._model.selectionStartLength=r.length}}_selectToWordAt(e){let n=this._getWordAt(e,!0);if(n){let r=e[1];for(;n.start<0;)n.start+=this._bufferService.cols,r--;if(!this._model.areSelectionValuesReversed())for(;n.start+n.length>this._bufferService.cols;)n.length-=this._bufferService.cols,r++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?n.start:n.start+n.length,r]}}_isCharWordSeparator(e){return e.getWidth()===0?!1:this._optionsService.rawOptions.wordSeparator.indexOf(e.getChars())>=0}_selectLineAt(e){let n=this._bufferService.buffer.getWrappedRangeForLine(e),r={start:{x:0,y:n.first},end:{x:this._bufferService.cols-1,y:n.last}};this._model.selectionStart=[0,n.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=n4(r,this._bufferService.cols)}};oj=Dr([vt(3,cs),vt(4,qd),vt(5,XE),vt(6,us),vt(7,sc),vt(8,ic)],oj);var r4=class{constructor(){this._data={}}set(e,n,r){this._data[e]||(this._data[e]={}),this._data[e][n]=r}get(e,n){return this._data[e]?this._data[e][n]:void 0}clear(){this._data={}}},i4=class{constructor(){this._color=new r4,this._css=new r4}setCss(e,n,r){this._css.set(e,n,r)}getCss(e,n){return this._css.get(e,n)}setColor(e,n,r){this._color.set(e,n,r)}getColor(e,n){return this._color.get(e,n)}clear(){this._color.clear(),this._css.clear()}},ti=Object.freeze((()=>{let e=[Sr.toColor("#2e3436"),Sr.toColor("#cc0000"),Sr.toColor("#4e9a06"),Sr.toColor("#c4a000"),Sr.toColor("#3465a4"),Sr.toColor("#75507b"),Sr.toColor("#06989a"),Sr.toColor("#d3d7cf"),Sr.toColor("#555753"),Sr.toColor("#ef2929"),Sr.toColor("#8ae234"),Sr.toColor("#fce94f"),Sr.toColor("#729fcf"),Sr.toColor("#ad7fa8"),Sr.toColor("#34e2e2"),Sr.toColor("#eeeeec")],n=[0,95,135,175,215,255];for(let r=0;r<216;r++){let i=n[r/36%6|0],s=n[r/6%6|0],a=n[r%6];e.push({css:Yr.toCss(i,s,a),rgba:Yr.toRgba(i,s,a)})}for(let r=0;r<24;r++){let i=8+r*10;e.push({css:Yr.toCss(i,i,i),rgba:Yr.toRgba(i,i,i)})}return e})()),nd=Sr.toColor("#ffffff"),Fm=Sr.toColor("#000000"),s4=Sr.toColor("#ffffff"),a4=Fm,lm={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117},Bre=nd,lj=class extends sn{constructor(e){super(),this._optionsService=e,this._contrastCache=new i4,this._halfContrastCache=new i4,this._onChangeColors=this._register(new nt),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:nd,background:Fm,cursor:s4,cursorAccent:a4,selectionForeground:void 0,selectionBackgroundTransparent:lm,selectionBackgroundOpaque:cr.blend(Fm,lm),selectionInactiveBackgroundTransparent:lm,selectionInactiveBackgroundOpaque:cr.blend(Fm,lm),scrollbarSliderBackground:cr.opacity(nd,.2),scrollbarSliderHoverBackground:cr.opacity(nd,.4),scrollbarSliderActiveBackground:cr.opacity(nd,.5),overviewRulerBorder:nd,ansi:ti.slice(),contrastCache:this._contrastCache,halfContrastCache:this._halfContrastCache},this._updateRestoreColors(),this._setTheme(this._optionsService.rawOptions.theme),this._register(this._optionsService.onSpecificOptionChange("minimumContrastRatio",()=>this._contrastCache.clear())),this._register(this._optionsService.onSpecificOptionChange("theme",()=>this._setTheme(this._optionsService.rawOptions.theme)))}get colors(){return this._colors}_setTheme(e={}){let n=this._colors;if(n.foreground=qn(e.foreground,nd),n.background=qn(e.background,Fm),n.cursor=cr.blend(n.background,qn(e.cursor,s4)),n.cursorAccent=cr.blend(n.background,qn(e.cursorAccent,a4)),n.selectionBackgroundTransparent=qn(e.selectionBackground,lm),n.selectionBackgroundOpaque=cr.blend(n.background,n.selectionBackgroundTransparent),n.selectionInactiveBackgroundTransparent=qn(e.selectionInactiveBackground,n.selectionBackgroundTransparent),n.selectionInactiveBackgroundOpaque=cr.blend(n.background,n.selectionInactiveBackgroundTransparent),n.selectionForeground=e.selectionForeground?qn(e.selectionForeground,JO):void 0,n.selectionForeground===JO&&(n.selectionForeground=void 0),cr.isOpaque(n.selectionBackgroundTransparent)&&(n.selectionBackgroundTransparent=cr.opacity(n.selectionBackgroundTransparent,.3)),cr.isOpaque(n.selectionInactiveBackgroundTransparent)&&(n.selectionInactiveBackgroundTransparent=cr.opacity(n.selectionInactiveBackgroundTransparent,.3)),n.scrollbarSliderBackground=qn(e.scrollbarSliderBackground,cr.opacity(n.foreground,.2)),n.scrollbarSliderHoverBackground=qn(e.scrollbarSliderHoverBackground,cr.opacity(n.foreground,.4)),n.scrollbarSliderActiveBackground=qn(e.scrollbarSliderActiveBackground,cr.opacity(n.foreground,.5)),n.overviewRulerBorder=qn(e.overviewRulerBorder,Bre),n.ansi=ti.slice(),n.ansi[0]=qn(e.black,ti[0]),n.ansi[1]=qn(e.red,ti[1]),n.ansi[2]=qn(e.green,ti[2]),n.ansi[3]=qn(e.yellow,ti[3]),n.ansi[4]=qn(e.blue,ti[4]),n.ansi[5]=qn(e.magenta,ti[5]),n.ansi[6]=qn(e.cyan,ti[6]),n.ansi[7]=qn(e.white,ti[7]),n.ansi[8]=qn(e.brightBlack,ti[8]),n.ansi[9]=qn(e.brightRed,ti[9]),n.ansi[10]=qn(e.brightGreen,ti[10]),n.ansi[11]=qn(e.brightYellow,ti[11]),n.ansi[12]=qn(e.brightBlue,ti[12]),n.ansi[13]=qn(e.brightMagenta,ti[13]),n.ansi[14]=qn(e.brightCyan,ti[14]),n.ansi[15]=qn(e.brightWhite,ti[15]),e.extendedAnsi){let r=Math.min(n.ansi.length-16,e.extendedAnsi.length);for(let i=0;i<r;i++)n.ansi[i+16]=qn(e.extendedAnsi[i],ti[i+16])}this._contrastCache.clear(),this._halfContrastCache.clear(),this._updateRestoreColors(),this._onChangeColors.fire(this.colors)}restoreColor(e){this._restoreColor(e),this._onChangeColors.fire(this.colors)}_restoreColor(e){if(e===void 0){for(let n=0;n<this._restoreColors.ansi.length;++n)this._colors.ansi[n]=this._restoreColors.ansi[n];return}switch(e){case 256:this._colors.foreground=this._restoreColors.foreground;break;case 257:this._colors.background=this._restoreColors.background;break;case 258:this._colors.cursor=this._restoreColors.cursor;break;default:this._colors.ansi[e]=this._restoreColors.ansi[e]}}modifyColors(e){e(this._colors),this._onChangeColors.fire(this.colors)}_updateRestoreColors(){this._restoreColors={foreground:this._colors.foreground,background:this._colors.background,cursor:this._colors.cursor,ansi:this._colors.ansi.slice()}}};lj=Dr([vt(0,us)],lj);function qn(e,n){if(e!==void 0)try{return Sr.toColor(e)}catch{}return n}var zre=class{constructor(...e){this._entries=new Map;for(let[n,r]of e)this.set(n,r)}set(e,n){let r=this._entries.get(e);return this._entries.set(e,n),r}forEach(e){for(let[n,r]of this._entries.entries())e(n,r)}has(e){return this._entries.has(e)}get(e){return this._entries.get(e)}},$re=class{constructor(){this._services=new zre,this._services.set(GE,this)}setService(e,n){this._services.set(e,n)}getService(e){return this._services.get(e)}createInstance(e,...n){let r=Ote(e).sort((a,o)=>a.index-o.index),i=[];for(let a of r){let o=this._services.get(a.id);if(!o)throw new Error(`[createInstance] ${e.name} depends on UNKNOWN service ${a.id._id}.`);i.push(o)}let s=r.length>0?r[0].index:n.length;if(n.length!==s)throw new Error(`[createInstance] First service dependency of ${e.name} at position ${s+1} conflicts with ${n.length} static arguments`);return new e(...n,...i)}},Fre={trace:0,debug:1,info:2,warn:3,error:4,off:5},Hre="xterm.js: ",cj=class extends sn{constructor(e){super(),this._optionsService=e,this._logLevel=5,this._updateLogLevel(),this._register(this._optionsService.onSpecificOptionChange("logLevel",()=>this._updateLogLevel()))}get logLevel(){return this._logLevel}_updateLogLevel(){this._logLevel=Fre[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(e){for(let n=0;n<e.length;n++)typeof e[n]=="function"&&(e[n]=e[n]())}_log(e,n,r){this._evalLazyOptionalParams(r),e.call(console,(this._optionsService.options.logger?"":Hre)+n,...r)}trace(e,...n){var r;this._logLevel<=0&&this._log(((r=this._optionsService.options.logger)==null?void 0:r.trace.bind(this._optionsService.options.logger))??console.log,e,n)}debug(e,...n){var r;this._logLevel<=1&&this._log(((r=this._optionsService.options.logger)==null?void 0:r.debug.bind(this._optionsService.options.logger))??console.log,e,n)}info(e,...n){var r;this._logLevel<=2&&this._log(((r=this._optionsService.options.logger)==null?void 0:r.info.bind(this._optionsService.options.logger))??console.info,e,n)}warn(e,...n){var r;this._logLevel<=3&&this._log(((r=this._optionsService.options.logger)==null?void 0:r.warn.bind(this._optionsService.options.logger))??console.warn,e,n)}error(e,...n){var r;this._logLevel<=4&&this._log(((r=this._optionsService.options.logger)==null?void 0:r.error.bind(this._optionsService.options.logger))??console.error,e,n)}};cj=Dr([vt(0,us)],cj);var o4=class extends sn{constructor(e){super(),this._maxLength=e,this.onDeleteEmitter=this._register(new nt),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this._register(new nt),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this._register(new nt),this.onTrim=this.onTrimEmitter.event,this._array=new Array(this._maxLength),this._startIndex=0,this._length=0}get maxLength(){return this._maxLength}set maxLength(e){if(this._maxLength===e)return;let n=new Array(e);for(let r=0;r<Math.min(e,this.length);r++)n[r]=this._array[this._getCyclicIndex(r)];this._array=n,this._maxLength=e,this._startIndex=0}get length(){return this._length}set length(e){if(e>this._length)for(let n=this._length;n<e;n++)this._array[n]=void 0;this._length=e}get(e){return this._array[this._getCyclicIndex(e)]}set(e,n){this._array[this._getCyclicIndex(e)]=n}push(e){this._array[this._getCyclicIndex(this._length)]=e,this._length===this._maxLength?(this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1)):this._length++}recycle(){if(this._length!==this._maxLength)throw new Error("Can only recycle when the buffer is full");return this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1),this._array[this._getCyclicIndex(this._length-1)]}get isFull(){return this._length===this._maxLength}pop(){return this._array[this._getCyclicIndex(this._length---1)]}splice(e,n,...r){if(n){for(let i=e;i<this._length-n;i++)this._array[this._getCyclicIndex(i)]=this._array[this._getCyclicIndex(i+n)];this._length-=n,this.onDeleteEmitter.fire({index:e,amount:n})}for(let i=this._length-1;i>=e;i--)this._array[this._getCyclicIndex(i+r.length)]=this._array[this._getCyclicIndex(i)];for(let i=0;i<r.length;i++)this._array[this._getCyclicIndex(e+i)]=r[i];if(r.length&&this.onInsertEmitter.fire({index:e,amount:r.length}),this._length+r.length>this._maxLength){let i=this._length+r.length-this._maxLength;this._startIndex+=i,this._length=this._maxLength,this.onTrimEmitter.fire(i)}else this._length+=r.length}trimStart(e){e>this._length&&(e=this._length),this._startIndex+=e,this._length-=e,this.onTrimEmitter.fire(e)}shiftElements(e,n,r){if(!(n<=0)){if(e<0||e>=this._length)throw new Error("start argument out of range");if(e+r<0)throw new Error("Cannot shift elements in list beyond index 0");if(r>0){for(let s=n-1;s>=0;s--)this.set(e+s+r,this.get(e+s));let i=e+n+r-this._length;if(i>0)for(this._length+=i;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let i=0;i<n;i++)this.set(e+i+r,this.get(e+i))}}_getCyclicIndex(e){return(this._startIndex+e)%this._maxLength}},nn=3,Vr=Object.freeze(new Nv),h_=0,Yw=2,Hm=class S9{constructor(n,r,i=!1){this.isWrapped=i,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(n*nn);let s=r||Ma.fromCharData([0,Wz,1,0]);for(let a=0;a<n;++a)this.setCell(a,s);this.length=n}get(n){let r=this._data[n*nn+0],i=r&2097151;return[this._data[n*nn+1],r&2097152?this._combined[n]:i?qc(i):"",r>>22,r&2097152?this._combined[n].charCodeAt(this._combined[n].length-1):i]}set(n,r){this._data[n*nn+1]=r[0],r[1].length>1?(this._combined[n]=r[1],this._data[n*nn+0]=n|2097152|r[2]<<22):this._data[n*nn+0]=r[1].charCodeAt(0)|r[2]<<22}getWidth(n){return this._data[n*nn+0]>>22}hasWidth(n){return this._data[n*nn+0]&12582912}getFg(n){return this._data[n*nn+1]}getBg(n){return this._data[n*nn+2]}hasContent(n){return this._data[n*nn+0]&4194303}getCodePoint(n){let r=this._data[n*nn+0];return r&2097152?this._combined[n].charCodeAt(this._combined[n].length-1):r&2097151}isCombined(n){return this._data[n*nn+0]&2097152}getString(n){let r=this._data[n*nn+0];return r&2097152?this._combined[n]:r&2097151?qc(r&2097151):""}isProtected(n){return this._data[n*nn+2]&536870912}loadCell(n,r){return h_=n*nn,r.content=this._data[h_+0],r.fg=this._data[h_+1],r.bg=this._data[h_+2],r.content&2097152&&(r.combinedData=this._combined[n]),r.bg&268435456&&(r.extended=this._extendedAttrs[n]),r}setCell(n,r){r.content&2097152&&(this._combined[n]=r.combinedData),r.bg&268435456&&(this._extendedAttrs[n]=r.extended),this._data[n*nn+0]=r.content,this._data[n*nn+1]=r.fg,this._data[n*nn+2]=r.bg}setCellFromCodepoint(n,r,i,s){s.bg&268435456&&(this._extendedAttrs[n]=s.extended),this._data[n*nn+0]=r|i<<22,this._data[n*nn+1]=s.fg,this._data[n*nn+2]=s.bg}addCodepointToCell(n,r,i){let s=this._data[n*nn+0];s&2097152?this._combined[n]+=qc(r):s&2097151?(this._combined[n]=qc(s&2097151)+qc(r),s&=-2097152,s|=2097152):s=r|1<<22,i&&(s&=-12582913,s|=i<<22),this._data[n*nn+0]=s}insertCells(n,r,i){if(n%=this.length,n&&this.getWidth(n-1)===2&&this.setCellFromCodepoint(n-1,0,1,i),r<this.length-n){let s=new Ma;for(let a=this.length-n-r-1;a>=0;--a)this.setCell(n+r+a,this.loadCell(n+a,s));for(let a=0;a<r;++a)this.setCell(n+a,i)}else for(let s=n;s<this.length;++s)this.setCell(s,i);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,i)}deleteCells(n,r,i){if(n%=this.length,r<this.length-n){let s=new Ma;for(let a=0;a<this.length-n-r;++a)this.setCell(n+a,this.loadCell(n+r+a,s));for(let a=this.length-r;a<this.length;++a)this.setCell(a,i)}else for(let s=n;s<this.length;++s)this.setCell(s,i);n&&this.getWidth(n-1)===2&&this.setCellFromCodepoint(n-1,0,1,i),this.getWidth(n)===0&&!this.hasContent(n)&&this.setCellFromCodepoint(n,0,1,i)}replaceCells(n,r,i,s=!1){if(s){for(n&&this.getWidth(n-1)===2&&!this.isProtected(n-1)&&this.setCellFromCodepoint(n-1,0,1,i),r<this.length&&this.getWidth(r-1)===2&&!this.isProtected(r)&&this.setCellFromCodepoint(r,0,1,i);n<r&&n<this.length;)this.isProtected(n)||this.setCell(n,i),n++;return}for(n&&this.getWidth(n-1)===2&&this.setCellFromCodepoint(n-1,0,1,i),r<this.length&&this.getWidth(r-1)===2&&this.setCellFromCodepoint(r,0,1,i);n<r&&n<this.length;)this.setCell(n++,i)}resize(n,r){if(n===this.length)return this._data.length*4*Yw<this._data.buffer.byteLength;let i=n*nn;if(n>this.length){if(this._data.buffer.byteLength>=i*4)this._data=new Uint32Array(this._data.buffer,0,i);else{let s=new Uint32Array(i);s.set(this._data),this._data=s}for(let s=this.length;s<n;++s)this.setCell(s,r)}else{this._data=this._data.subarray(0,i);let s=Object.keys(this._combined);for(let o=0;o<s.length;o++){let l=parseInt(s[o],10);l>=n&&delete this._combined[l]}let a=Object.keys(this._extendedAttrs);for(let o=0;o<a.length;o++){let l=parseInt(a[o],10);l>=n&&delete this._extendedAttrs[l]}}return this.length=n,i*4*Yw<this._data.buffer.byteLength}cleanupMemory(){if(this._data.length*4*Yw<this._data.buffer.byteLength){let n=new Uint32Array(this._data.length);return n.set(this._data),this._data=n,1}return 0}fill(n,r=!1){if(r){for(let i=0;i<this.length;++i)this.isProtected(i)||this.setCell(i,n);return}this._combined={},this._extendedAttrs={};for(let i=0;i<this.length;++i)this.setCell(i,n)}copyFrom(n){this.length!==n.length?this._data=new Uint32Array(n._data):this._data.set(n._data),this.length=n.length,this._combined={};for(let r in n._combined)this._combined[r]=n._combined[r];this._extendedAttrs={};for(let r in n._extendedAttrs)this._extendedAttrs[r]=n._extendedAttrs[r];this.isWrapped=n.isWrapped}clone(){let n=new S9(0);n._data=new Uint32Array(this._data),n.length=this.length;for(let r in this._combined)n._combined[r]=this._combined[r];for(let r in this._extendedAttrs)n._extendedAttrs[r]=this._extendedAttrs[r];return n.isWrapped=this.isWrapped,n}getTrimmedLength(){for(let n=this.length-1;n>=0;--n)if(this._data[n*nn+0]&4194303)return n+(this._data[n*nn+0]>>22);return 0}getNoBgTrimmedLength(){for(let n=this.length-1;n>=0;--n)if(this._data[n*nn+0]&4194303||this._data[n*nn+2]&50331648)return n+(this._data[n*nn+0]>>22);return 0}copyCellsFrom(n,r,i,s,a){let o=n._data;if(a)for(let u=s-1;u>=0;u--){for(let d=0;d<nn;d++)this._data[(i+u)*nn+d]=o[(r+u)*nn+d];o[(r+u)*nn+2]&268435456&&(this._extendedAttrs[i+u]=n._extendedAttrs[r+u])}else for(let u=0;u<s;u++){for(let d=0;d<nn;d++)this._data[(i+u)*nn+d]=o[(r+u)*nn+d];o[(r+u)*nn+2]&268435456&&(this._extendedAttrs[i+u]=n._extendedAttrs[r+u])}let l=Object.keys(n._combined);for(let u=0;u<l.length;u++){let d=parseInt(l[u],10);d>=r&&(this._combined[d-r+i]=n._combined[d])}}translateToString(n,r,i,s){r=r??0,i=i??this.length,n&&(i=Math.min(i,this.getTrimmedLength())),s&&(s.length=0);let a="";for(;r<i;){let o=this._data[r*nn+0],l=o&2097151,u=o&2097152?this._combined[r]:l?qc(l):Jc;if(a+=u,s)for(let d=0;d<u.length;++d)s.push(r);r+=o>>22||1}return s&&s.push(r),a}};function Wre(e,n,r,i,s,a){let o=[];for(let l=0;l<e.length-1;l++){let u=l,d=e.get(++u);if(!d.isWrapped)continue;let p=[e.get(l)];for(;u<e.length&&d.isWrapped;)p.push(d),d=e.get(++u);if(!a&&i>=l&&i<u){l+=p.length-1;continue}let f=0,g=Rg(p,f,n),_=1,x=0;for(;_<p.length;){let S=Rg(p,_,n),w=S-x,j=r-g,C=Math.min(w,j);p[f].copyCellsFrom(p[_],x,g,C,!1),g+=C,g===r&&(f++,g=0),x+=C,x===S&&(_++,x=0),g===0&&f!==0&&p[f-1].getWidth(r-1)===2&&(p[f].copyCellsFrom(p[f-1],r-1,g++,1,!1),p[f-1].setCell(r-1,s))}p[f].replaceCells(g,r,s);let v=0;for(let S=p.length-1;S>0&&(S>f||p[S].getTrimmedLength()===0);S--)v++;v>0&&(o.push(l+p.length-v),o.push(v)),l+=p.length-1}return o}function qre(e,n){let r=[],i=0,s=n[i],a=0;for(let o=0;o<e.length;o++)if(s===o){let l=n[++i];e.onDeleteEmitter.fire({index:o-a,amount:l}),o+=l-1,a+=l,s=n[++i]}else r.push(o);return{layout:r,countRemoved:a}}function Ure(e,n){let r=[];for(let i=0;i<n.length;i++)r.push(e.get(n[i]));for(let i=0;i<r.length;i++)e.set(i,r[i]);e.length=n.length}function Kre(e,n,r){let i=[],s=e.map((u,d)=>Rg(e,d,n)).reduce((u,d)=>u+d),a=0,o=0,l=0;for(;l<s;){if(s-l<r){i.push(s-l);break}a+=r;let u=Rg(e,o,n);a>u&&(a-=u,o++);let d=e[o].getWidth(a-1)===2;d&&a--;let p=d?r-1:r;i.push(p),l+=p}return i}function Rg(e,n,r){if(n===e.length-1)return e[n].getTrimmedLength();let i=!e[n].hasContent(r-1)&&e[n].getWidth(r-1)===1,s=e[n+1].getWidth(0)===2;return i&&s?r-1:r}var C9=class j9{constructor(n){this.line=n,this.isDisposed=!1,this._disposables=[],this._id=j9._nextId++,this._onDispose=this.register(new nt),this.onDispose=this._onDispose.event}get id(){return this._id}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),Md(this._disposables),this._disposables.length=0)}register(n){return this._disposables.push(n),n}};C9._nextId=1;var Vre=C9,ai={},rd=ai.B;ai[0]={"`":"◆",a:"▒",b:"␉",c:"␌",d:"␍",e:"␊",f:"°",g:"±",h:"␤",i:"␋",j:"┘",k:"┐",l:"┌",m:"└",n:"┼",o:"⎺",p:"⎻",q:"─",r:"⎼",s:"⎽",t:"├",u:"┤",v:"┴",w:"┬",x:"│",y:"≤",z:"≥","{":"π","|":"≠","}":"£","~":"·"};ai.A={"#":"£"};ai.B=void 0;ai[4]={"#":"£","@":"¾","[":"ij","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"};ai.C=ai[5]={"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};ai.R={"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"};ai.Q={"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"};ai.K={"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"};ai.Y={"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"};ai.E=ai[6]={"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"};ai.Z={"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"};ai.H=ai[7]={"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};ai["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"};var l4=4294967295,c4=class{constructor(e,n,r){this._hasScrollback=e,this._optionsService=n,this._bufferService=r,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=Vr.clone(),this.savedCharset=rd,this.markers=[],this._nullCell=Ma.fromCharData([0,Wz,1,0]),this._whitespaceCell=Ma.fromCharData([0,Jc,1,32]),this._isClearing=!1,this._memoryCleanupQueue=new ob,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new o4(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}getNullCell(e){return e?(this._nullCell.fg=e.fg,this._nullCell.bg=e.bg,this._nullCell.extended=e.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new rb),this._nullCell}getWhitespaceCell(e){return e?(this._whitespaceCell.fg=e.fg,this._whitespaceCell.bg=e.bg,this._whitespaceCell.extended=e.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new rb),this._whitespaceCell}getBlankLine(e,n){return new Hm(this._bufferService.cols,this.getNullCell(e),n)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){let e=this.ybase+this.y-this.ydisp;return e>=0&&e<this._rows}_getCorrectBufferLength(e){if(!this._hasScrollback)return e;let n=e+this._optionsService.rawOptions.scrollback;return n>l4?l4:n}fillViewportRows(e){if(this.lines.length===0){e===void 0&&(e=Vr);let n=this._rows;for(;n--;)this.lines.push(this.getBlankLine(e))}}clear(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new o4(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(e,n){let r=this.getNullCell(Vr),i=0,s=this._getCorrectBufferLength(n);if(s>this.lines.maxLength&&(this.lines.maxLength=s),this.lines.length>0){if(this._cols<e)for(let o=0;o<this.lines.length;o++)i+=+this.lines.get(o).resize(e,r);let a=0;if(this._rows<n)for(let o=this._rows;o<n;o++)this.lines.length<n+this.ybase&&(this._optionsService.rawOptions.windowsMode||this._optionsService.rawOptions.windowsPty.backend!==void 0||this._optionsService.rawOptions.windowsPty.buildNumber!==void 0?this.lines.push(new Hm(e,r)):this.ybase>0&&this.lines.length<=this.ybase+this.y+a+1?(this.ybase--,a++,this.ydisp>0&&this.ydisp--):this.lines.push(new Hm(e,r)));else for(let o=this._rows;o>n;o--)this.lines.length>n+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(s<this.lines.maxLength){let o=this.lines.length-s;o>0&&(this.lines.trimStart(o),this.ybase=Math.max(this.ybase-o,0),this.ydisp=Math.max(this.ydisp-o,0),this.savedY=Math.max(this.savedY-o,0)),this.lines.maxLength=s}this.x=Math.min(this.x,e-1),this.y=Math.min(this.y,n-1),a&&(this.y+=a),this.savedX=Math.min(this.savedX,e-1),this.scrollTop=0}if(this.scrollBottom=n-1,this._isReflowEnabled&&(this._reflow(e,n),this._cols>e))for(let a=0;a<this.lines.length;a++)i+=+this.lines.get(a).resize(e,r);this._cols=e,this._rows=n,this._memoryCleanupQueue.clear(),i>.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue(()=>this._batchedMemoryCleanup()))}_batchedMemoryCleanup(){let e=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,e=!1);let n=0;for(;this._memoryCleanupPosition<this.lines.length;)if(n+=this.lines.get(this._memoryCleanupPosition++).cleanupMemory(),n>100)return!0;return e}get _isReflowEnabled(){let e=this._optionsService.rawOptions.windowsPty;return e&&e.buildNumber?this._hasScrollback&&e.backend==="conpty"&&e.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(e,n){this._cols!==e&&(e>this._cols?this._reflowLarger(e,n):this._reflowSmaller(e,n))}_reflowLarger(e,n){let r=this._optionsService.rawOptions.reflowCursorLine,i=Wre(this.lines,this._cols,e,this.ybase+this.y,this.getNullCell(Vr),r);if(i.length>0){let s=qre(this.lines,i);Ure(this.lines,s.layout),this._reflowLargerAdjustViewport(e,n,s.countRemoved)}}_reflowLargerAdjustViewport(e,n,r){let i=this.getNullCell(Vr),s=r;for(;s-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<n&&this.lines.push(new Hm(e,i))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-r,0)}_reflowSmaller(e,n){let r=this._optionsService.rawOptions.reflowCursorLine,i=this.getNullCell(Vr),s=[],a=0;for(let o=this.lines.length-1;o>=0;o--){let l=this.lines.get(o);if(!l||!l.isWrapped&&l.getTrimmedLength()<=e)continue;let u=[l];for(;l.isWrapped&&o>0;)l=this.lines.get(--o),u.unshift(l);if(!r){let C=this.ybase+this.y;if(C>=o&&C<o+u.length)continue}let d=u[u.length-1].getTrimmedLength(),p=Kre(u,this._cols,e),f=p.length-u.length,g;this.ybase===0&&this.y!==this.lines.length-1?g=Math.max(0,this.y-this.lines.maxLength+f):g=Math.max(0,this.lines.length-this.lines.maxLength+f);let _=[];for(let C=0;C<f;C++){let T=this.getBlankLine(Vr,!0);_.push(T)}_.length>0&&(s.push({start:o+u.length+a,newLines:_}),a+=_.length),u.push(..._);let x=p.length-1,v=p[x];v===0&&(x--,v=p[x]);let S=u.length-f-1,w=d;for(;S>=0;){let C=Math.min(w,v);if(u[x]===void 0)break;if(u[x].copyCellsFrom(u[S],w-C,v-C,C,!0),v-=C,v===0&&(x--,v=p[x]),w-=C,w===0){S--;let T=Math.max(S,0);w=Rg(u,T,this._cols)}}for(let C=0;C<u.length;C++)p[C]<e&&u[C].setCell(p[C],i);let j=f-g;for(;j-- >0;)this.ybase===0?this.y<n-1?(this.y++,this.lines.pop()):(this.ybase++,this.ydisp++):this.ybase<Math.min(this.lines.maxLength,this.lines.length+a)-n&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+f,this.ybase+n-1)}if(s.length>0){let o=[],l=[];for(let v=0;v<this.lines.length;v++)l.push(this.lines.get(v));let u=this.lines.length,d=u-1,p=0,f=s[p];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+a);let g=0;for(let v=Math.min(this.lines.maxLength-1,u+a-1);v>=0;v--)if(f&&f.start>d+g){for(let S=f.newLines.length-1;S>=0;S--)this.lines.set(v--,f.newLines[S]);v++,o.push({index:d+1,amount:f.newLines.length}),g+=f.newLines.length,f=s[++p]}else this.lines.set(v,l[d--]);let _=0;for(let v=o.length-1;v>=0;v--)o[v].index+=_,this.lines.onInsertEmitter.fire(o[v]),_+=o[v].amount;let x=Math.max(0,u+a-this.lines.maxLength);x>0&&this.lines.onTrimEmitter.fire(x)}}translateBufferLineToString(e,n,r=0,i){let s=this.lines.get(e);return s?s.translateToString(n,r,i):""}getWrappedRangeForLine(e){let n=e,r=e;for(;n>0&&this.lines.get(n).isWrapped;)n--;for(;r+1<this.lines.length&&this.lines.get(r+1).isWrapped;)r++;return{first:n,last:r}}setupTabStops(e){for(e!=null?this.tabs[e]||(e=this.prevStop(e)):(this.tabs={},e=0);e<this._cols;e+=this._optionsService.rawOptions.tabStopWidth)this.tabs[e]=!0}prevStop(e){for(e==null&&(e=this.x);!this.tabs[--e]&&e>0;);return e>=this._cols?this._cols-1:e<0?0:e}nextStop(e){for(e==null&&(e=this.x);!this.tabs[++e]&&e<this._cols;);return e>=this._cols?this._cols-1:e<0?0:e}clearMarkers(e){this._isClearing=!0;for(let n=0;n<this.markers.length;n++)this.markers[n].line===e&&(this.markers[n].dispose(),this.markers.splice(n--,1));this._isClearing=!1}clearAllMarkers(){this._isClearing=!0;for(let e=0;e<this.markers.length;e++)this.markers[e].dispose();this.markers.length=0,this._isClearing=!1}addMarker(e){let n=new Vre(e);return this.markers.push(n),n.register(this.lines.onTrim(r=>{n.line-=r,n.line<0&&n.dispose()})),n.register(this.lines.onInsert(r=>{n.line>=r.index&&(n.line+=r.amount)})),n.register(this.lines.onDelete(r=>{n.line>=r.index&&n.line<r.index+r.amount&&n.dispose(),n.line>r.index&&(n.line-=r.amount)})),n.register(n.onDispose(()=>this._removeMarker(n))),n}_removeMarker(e){this._isClearing||this.markers.splice(this.markers.indexOf(e),1)}},Yre=class extends sn{constructor(e,n){super(),this._optionsService=e,this._bufferService=n,this._onBufferActivate=this._register(new nt),this.onBufferActivate=this._onBufferActivate.event,this.reset(),this._register(this._optionsService.onSpecificOptionChange("scrollback",()=>this.resize(this._bufferService.cols,this._bufferService.rows))),this._register(this._optionsService.onSpecificOptionChange("tabStopWidth",()=>this.setupTabStops()))}reset(){this._normal=new c4(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new c4(!1,this._optionsService,this._bufferService),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}),this.setupTabStops()}get alt(){return this._alt}get active(){return this._activeBuffer}get normal(){return this._normal}activateNormalBuffer(){this._activeBuffer!==this._normal&&(this._normal.x=this._alt.x,this._normal.y=this._alt.y,this._alt.clearAllMarkers(),this._alt.clear(),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}))}activateAltBuffer(e){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(e),this._alt.x=this._normal.x,this._alt.y=this._normal.y,this._activeBuffer=this._alt,this._onBufferActivate.fire({activeBuffer:this._alt,inactiveBuffer:this._normal}))}resize(e,n){this._normal.resize(e,n),this._alt.resize(e,n),this.setupTabStops(e)}setupTabStops(e){this._normal.setupTabStops(e),this._alt.setupTabStops(e)}},N9=2,E9=1,uj=class extends sn{constructor(e){super(),this.isUserScrolling=!1,this._onResize=this._register(new nt),this.onResize=this._onResize.event,this._onScroll=this._register(new nt),this.onScroll=this._onScroll.event,this.cols=Math.max(e.rawOptions.cols||0,N9),this.rows=Math.max(e.rawOptions.rows||0,E9),this.buffers=this._register(new Yre(e,this)),this._register(this.buffers.onBufferActivate(n=>{this._onScroll.fire(n.activeBuffer.ydisp)}))}get buffer(){return this.buffers.active}resize(e,n){let r=this.cols!==e,i=this.rows!==n;this.cols=e,this.rows=n,this.buffers.resize(e,n),this._onResize.fire({cols:e,rows:n,colsChanged:r,rowsChanged:i})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(e,n=!1){let r=this.buffer,i;i=this._cachedBlankLine,(!i||i.length!==this.cols||i.getFg(0)!==e.fg||i.getBg(0)!==e.bg)&&(i=r.getBlankLine(e,n),this._cachedBlankLine=i),i.isWrapped=n;let s=r.ybase+r.scrollTop,a=r.ybase+r.scrollBottom;if(r.scrollTop===0){let o=r.lines.isFull;a===r.lines.length-1?o?r.lines.recycle().copyFrom(i):r.lines.push(i.clone()):r.lines.splice(a+1,0,i.clone()),o?this.isUserScrolling&&(r.ydisp=Math.max(r.ydisp-1,0)):(r.ybase++,this.isUserScrolling||r.ydisp++)}else{let o=a-s+1;r.lines.shiftElements(s+1,o-1,-1),r.lines.set(a,i.clone())}this.isUserScrolling||(r.ydisp=r.ybase),this._onScroll.fire(r.ydisp)}scrollLines(e,n){let r=this.buffer;if(e<0){if(r.ydisp===0)return;this.isUserScrolling=!0}else e+r.ydisp>=r.ybase&&(this.isUserScrolling=!1);let i=r.ydisp;r.ydisp=Math.max(Math.min(r.ydisp+e,r.ybase),0),i!==r.ydisp&&(n||this._onScroll.fire(r.ydisp))}};uj=Dr([vt(0,us)],uj);var Ah={cols:80,rows:24,cursorBlink:!1,cursorStyle:"block",cursorWidth:1,cursorInactiveStyle:"outline",customGlyphs:!0,drawBoldTextInBrightColors:!0,documentOverride:null,fastScrollModifier:"alt",fastScrollSensitivity:5,fontFamily:"monospace",fontSize:15,fontWeight:"normal",fontWeightBold:"bold",ignoreBracketedPasteMode:!1,lineHeight:1,letterSpacing:0,linkHandler:null,logLevel:"info",logger:null,scrollback:1e3,scrollOnEraseInDisplay:!1,scrollOnUserInput:!0,scrollSensitivity:1,screenReaderMode:!1,smoothScrollDuration:0,macOptionIsMeta:!1,macOptionClickForcesSelection:!1,minimumContrastRatio:1,disableStdin:!1,allowProposedApi:!1,allowTransparency:!1,tabStopWidth:8,theme:{},reflowCursorLine:!1,rescaleOverlappingGlyphs:!1,rightClickSelectsWord:ab,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRuler:{}},Gre=["normal","bold","100","200","300","400","500","600","700","800","900"],Xre=class extends sn{constructor(e){super(),this._onOptionChange=this._register(new nt),this.onOptionChange=this._onOptionChange.event;let n={...Ah};for(let r in e)if(r in n)try{let i=e[r];n[r]=this._sanitizeAndValidateOption(r,i)}catch(i){console.error(i)}this.rawOptions=n,this.options={...n},this._setupOptions(),this._register(br(()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null}))}onSpecificOptionChange(e,n){return this.onOptionChange(r=>{r===e&&n(this.rawOptions[e])})}onMultipleOptionChange(e,n){return this.onOptionChange(r=>{e.indexOf(r)!==-1&&n()})}_setupOptions(){let e=r=>{if(!(r in Ah))throw new Error(`No option with key "${r}"`);return this.rawOptions[r]},n=(r,i)=>{if(!(r in Ah))throw new Error(`No option with key "${r}"`);i=this._sanitizeAndValidateOption(r,i),this.rawOptions[r]!==i&&(this.rawOptions[r]=i,this._onOptionChange.fire(r))};for(let r in this.rawOptions){let i={get:e.bind(this,r),set:n.bind(this,r)};Object.defineProperty(this.options,r,i)}}_sanitizeAndValidateOption(e,n){switch(e){case"cursorStyle":if(n||(n=Ah[e]),!Qre(n))throw new Error(`"${n}" is not a valid value for ${e}`);break;case"wordSeparator":n||(n=Ah[e]);break;case"fontWeight":case"fontWeightBold":if(typeof n=="number"&&1<=n&&n<=1e3)break;n=Gre.includes(n)?n:Ah[e];break;case"cursorWidth":n=Math.floor(n);case"lineHeight":case"tabStopWidth":if(n<1)throw new Error(`${e} cannot be less than 1, value: ${n}`);break;case"minimumContrastRatio":n=Math.max(1,Math.min(21,Math.round(n*10)/10));break;case"scrollback":if(n=Math.min(n,4294967295),n<0)throw new Error(`${e} cannot be less than 0, value: ${n}`);break;case"fastScrollSensitivity":case"scrollSensitivity":if(n<=0)throw new Error(`${e} cannot be less than or equal to 0, value: ${n}`);break;case"rows":case"cols":if(!n&&n!==0)throw new Error(`${e} must be numeric, value: ${n}`);break;case"windowsPty":n=n??{};break}return n}};function Qre(e){return e==="block"||e==="underline"||e==="bar"}function Wm(e,n=5){if(typeof e!="object")return e;let r=Array.isArray(e)?[]:{};for(let i in e)r[i]=n<=1?e[i]:e[i]&&Wm(e[i],n-1);return r}var u4=Object.freeze({insertMode:!1}),d4=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,cursorBlink:void 0,cursorStyle:void 0,origin:!1,reverseWraparound:!1,sendFocus:!1,synchronizedOutput:!1,wraparound:!0}),dj=class extends sn{constructor(e,n,r){super(),this._bufferService=e,this._logService=n,this._optionsService=r,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this._register(new nt),this.onData=this._onData.event,this._onUserInput=this._register(new nt),this.onUserInput=this._onUserInput.event,this._onBinary=this._register(new nt),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this._register(new nt),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=Wm(u4),this.decPrivateModes=Wm(d4)}reset(){this.modes=Wm(u4),this.decPrivateModes=Wm(d4)}triggerDataEvent(e,n=!1){if(this._optionsService.rawOptions.disableStdin)return;let r=this._bufferService.buffer;n&&this._optionsService.rawOptions.scrollOnUserInput&&r.ybase!==r.ydisp&&this._onRequestScrollToBottom.fire(),n&&this._onUserInput.fire(),this._logService.debug(`sending data "${e}"`),this._logService.trace("sending data (codes)",()=>e.split("").map(i=>i.charCodeAt(0))),this._onData.fire(e)}triggerBinaryEvent(e){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${e}"`),this._logService.trace("sending binary (codes)",()=>e.split("").map(n=>n.charCodeAt(0))),this._onBinary.fire(e))}};dj=Dr([vt(0,cs),vt(1,Yz),vt(2,us)],dj);var h4={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:e=>e.button===4||e.action!==1?!1:(e.ctrl=!1,e.alt=!1,e.shift=!1,!0)},VT200:{events:19,restrict:e=>e.action!==32},DRAG:{events:23,restrict:e=>!(e.action===32&&e.button===3)},ANY:{events:31,restrict:e=>!0}};function Gw(e,n){let r=(e.ctrl?16:0)|(e.shift?4:0)|(e.alt?8:0);return e.button===4?(r|=64,r|=e.action):(r|=e.button&3,e.button&4&&(r|=64),e.button&8&&(r|=128),e.action===32?r|=32:e.action===0&&!n&&(r|=3)),r}var Xw=String.fromCharCode,f4={DEFAULT:e=>{let n=[Gw(e,!1)+32,e.col+32,e.row+32];return n[0]>255||n[1]>255||n[2]>255?"":`\x1B[M${Xw(n[0])}${Xw(n[1])}${Xw(n[2])}`},SGR:e=>{let n=e.action===0&&e.button!==4?"m":"M";return`\x1B[<${Gw(e,!0)};${e.col};${e.row}${n}`},SGR_PIXELS:e=>{let n=e.action===0&&e.button!==4?"m":"M";return`\x1B[<${Gw(e,!0)};${e.x};${e.y}${n}`}},hj=class extends sn{constructor(e,n,r){super(),this._bufferService=e,this._coreService=n,this._optionsService=r,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._wheelPartialScroll=0,this._onProtocolChange=this._register(new nt),this.onProtocolChange=this._onProtocolChange.event;for(let i of Object.keys(h4))this.addProtocol(i,h4[i]);for(let i of Object.keys(f4))this.addEncoding(i,f4[i]);this.reset()}addProtocol(e,n){this._protocols[e]=n}addEncoding(e,n){this._encodings[e]=n}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return this._protocols[this._activeProtocol].events!==0}set activeProtocol(e){if(!this._protocols[e])throw new Error(`unknown protocol "${e}"`);this._activeProtocol=e,this._onProtocolChange.fire(this._protocols[e].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(e){if(!this._encodings[e])throw new Error(`unknown encoding "${e}"`);this._activeEncoding=e}reset(){this.activeProtocol="NONE",this.activeEncoding="DEFAULT",this._lastEvent=null,this._wheelPartialScroll=0}consumeWheelEvent(e,n,r){if(e.deltaY===0||e.shiftKey||n===void 0||r===void 0)return 0;let i=n/r,s=this._applyScrollModifier(e.deltaY,e);return e.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(s/=i+0,Math.abs(e.deltaY)<50&&(s*=.3),this._wheelPartialScroll+=s,s=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):e.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(s*=this._bufferService.rows),s}_applyScrollModifier(e,n){return n.altKey||n.ctrlKey||n.shiftKey?e*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:e*this._optionsService.rawOptions.scrollSensitivity}triggerMouseEvent(e){if(e.col<0||e.col>=this._bufferService.cols||e.row<0||e.row>=this._bufferService.rows||e.button===4&&e.action===32||e.button===3&&e.action!==32||e.button!==4&&(e.action===2||e.action===3)||(e.col++,e.row++,e.action===32&&this._lastEvent&&this._equalEvents(this._lastEvent,e,this._activeEncoding==="SGR_PIXELS"))||!this._protocols[this._activeProtocol].restrict(e))return!1;let n=this._encodings[this._activeEncoding](e);return n&&(this._activeEncoding==="DEFAULT"?this._coreService.triggerBinaryEvent(n):this._coreService.triggerDataEvent(n,!0)),this._lastEvent=e,!0}explainEvents(e){return{down:!!(e&1),up:!!(e&2),drag:!!(e&4),move:!!(e&8),wheel:!!(e&16)}}_equalEvents(e,n,r){if(r){if(e.x!==n.x||e.y!==n.y)return!1}else if(e.col!==n.col||e.row!==n.row)return!1;return!(e.button!==n.button||e.action!==n.action||e.ctrl!==n.ctrl||e.alt!==n.alt||e.shift!==n.shift)}};hj=Dr([vt(0,cs),vt(1,qd),vt(2,us)],hj);var Qw=[[768,879],[1155,1158],[1160,1161],[1425,1469],[1471,1471],[1473,1474],[1476,1477],[1479,1479],[1536,1539],[1552,1557],[1611,1630],[1648,1648],[1750,1764],[1767,1768],[1770,1773],[1807,1807],[1809,1809],[1840,1866],[1958,1968],[2027,2035],[2305,2306],[2364,2364],[2369,2376],[2381,2381],[2385,2388],[2402,2403],[2433,2433],[2492,2492],[2497,2500],[2509,2509],[2530,2531],[2561,2562],[2620,2620],[2625,2626],[2631,2632],[2635,2637],[2672,2673],[2689,2690],[2748,2748],[2753,2757],[2759,2760],[2765,2765],[2786,2787],[2817,2817],[2876,2876],[2879,2879],[2881,2883],[2893,2893],[2902,2902],[2946,2946],[3008,3008],[3021,3021],[3134,3136],[3142,3144],[3146,3149],[3157,3158],[3260,3260],[3263,3263],[3270,3270],[3276,3277],[3298,3299],[3393,3395],[3405,3405],[3530,3530],[3538,3540],[3542,3542],[3633,3633],[3636,3642],[3655,3662],[3761,3761],[3764,3769],[3771,3772],[3784,3789],[3864,3865],[3893,3893],[3895,3895],[3897,3897],[3953,3966],[3968,3972],[3974,3975],[3984,3991],[3993,4028],[4038,4038],[4141,4144],[4146,4146],[4150,4151],[4153,4153],[4184,4185],[4448,4607],[4959,4959],[5906,5908],[5938,5940],[5970,5971],[6002,6003],[6068,6069],[6071,6077],[6086,6086],[6089,6099],[6109,6109],[6155,6157],[6313,6313],[6432,6434],[6439,6440],[6450,6450],[6457,6459],[6679,6680],[6912,6915],[6964,6964],[6966,6970],[6972,6972],[6978,6978],[7019,7027],[7616,7626],[7678,7679],[8203,8207],[8234,8238],[8288,8291],[8298,8303],[8400,8431],[12330,12335],[12441,12442],[43014,43014],[43019,43019],[43045,43046],[64286,64286],[65024,65039],[65056,65059],[65279,65279],[65529,65531]],Zre=[[68097,68099],[68101,68102],[68108,68111],[68152,68154],[68159,68159],[119143,119145],[119155,119170],[119173,119179],[119210,119213],[119362,119364],[917505,917505],[917536,917631],[917760,917999]],ni;function Jre(e,n){let r=0,i=n.length-1,s;if(e<n[0][0]||e>n[i][1])return!1;for(;i>=r;)if(s=r+i>>1,e>n[s][1])r=s+1;else if(e<n[s][0])i=s-1;else return!0;return!1}var eie=class{constructor(){if(this.version="6",!ni){ni=new Uint8Array(65536),ni.fill(1),ni[0]=0,ni.fill(0,1,32),ni.fill(0,127,160),ni.fill(2,4352,4448),ni[9001]=2,ni[9002]=2,ni.fill(2,11904,42192),ni[12351]=1,ni.fill(2,44032,55204),ni.fill(2,63744,64256),ni.fill(2,65040,65050),ni.fill(2,65072,65136),ni.fill(2,65280,65377),ni.fill(2,65504,65511);for(let e=0;e<Qw.length;++e)ni.fill(0,Qw[e][0],Qw[e][1]+1)}}wcwidth(e){return e<32?0:e<127?1:e<65536?ni[e]:Jre(e,Zre)?0:e>=131072&&e<=196605||e>=196608&&e<=262141?2:1}charProperties(e,n){let r=this.wcwidth(e),i=r===0&&n!==0;if(i){let s=pd.extractWidth(n);s===0?i=!1:s>r&&(r=s)}return pd.createPropertyValue(0,r,i)}},pd=class Sx{constructor(){this._providers=Object.create(null),this._active="",this._onChange=new nt,this.onChange=this._onChange.event;let n=new eie;this.register(n),this._active=n.version,this._activeProvider=n}static extractShouldJoin(n){return(n&1)!==0}static extractWidth(n){return n>>1&3}static extractCharKind(n){return n>>3}static createPropertyValue(n,r,i=!1){return(n&16777215)<<3|(r&3)<<1|(i?1:0)}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(n){if(!this._providers[n])throw new Error(`unknown Unicode version "${n}"`);this._active=n,this._activeProvider=this._providers[n],this._onChange.fire(n)}register(n){this._providers[n.version]=n}wcwidth(n){return this._activeProvider.wcwidth(n)}getStringCellWidth(n){let r=0,i=0,s=n.length;for(let a=0;a<s;++a){let o=n.charCodeAt(a);if(55296<=o&&o<=56319){if(++a>=s)return r+this.wcwidth(o);let d=n.charCodeAt(a);56320<=d&&d<=57343?o=(o-55296)*1024+d-56320+65536:r+=this.wcwidth(d)}let l=this.charProperties(o,i),u=Sx.extractWidth(l);Sx.extractShouldJoin(l)&&(u-=Sx.extractWidth(i)),r+=u,i=l}return r}charProperties(n,r){return this._activeProvider.charProperties(n,r)}},tie=class{constructor(){this.glevel=0,this._charsets=[]}reset(){this.charset=void 0,this._charsets=[],this.glevel=0}setgLevel(e){this.glevel=e,this.charset=this._charsets[e]}setgCharset(e,n){this._charsets[e]=n,this.glevel===e&&(this.charset=n)}};function p4(e){var i;let n=(i=e.buffer.lines.get(e.buffer.ybase+e.buffer.y-1))==null?void 0:i.get(e.cols-1),r=e.buffer.lines.get(e.buffer.ybase+e.buffer.y);r&&n&&(r.isWrapped=n[3]!==0&&n[3]!==32)}var cm=2147483647,nie=256,A9=class fj{constructor(n=32,r=32){if(this.maxLength=n,this.maxSubParamsLength=r,r>nie)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(n),this.length=0,this._subParams=new Int32Array(r),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(n),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}static fromArray(n){let r=new fj;if(!n.length)return r;for(let i=Array.isArray(n[0])?1:0;i<n.length;++i){let s=n[i];if(Array.isArray(s))for(let a=0;a<s.length;++a)r.addSubParam(s[a]);else r.addParam(s)}return r}clone(){let n=new fj(this.maxLength,this.maxSubParamsLength);return n.params.set(this.params),n.length=this.length,n._subParams.set(this._subParams),n._subParamsLength=this._subParamsLength,n._subParamsIdx.set(this._subParamsIdx),n._rejectDigits=this._rejectDigits,n._rejectSubDigits=this._rejectSubDigits,n._digitIsSub=this._digitIsSub,n}toArray(){let n=[];for(let r=0;r<this.length;++r){n.push(this.params[r]);let i=this._subParamsIdx[r]>>8,s=this._subParamsIdx[r]&255;s-i>0&&n.push(Array.prototype.slice.call(this._subParams,i,s))}return n}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(n){if(this._digitIsSub=!1,this.length>=this.maxLength){this._rejectDigits=!0;return}if(n<-1)throw new Error("values lesser than -1 are not allowed");this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=n>cm?cm:n}addSubParam(n){if(this._digitIsSub=!0,!!this.length){if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength){this._rejectSubDigits=!0;return}if(n<-1)throw new Error("values lesser than -1 are not allowed");this._subParams[this._subParamsLength++]=n>cm?cm:n,this._subParamsIdx[this.length-1]++}}hasSubParams(n){return(this._subParamsIdx[n]&255)-(this._subParamsIdx[n]>>8)>0}getSubParams(n){let r=this._subParamsIdx[n]>>8,i=this._subParamsIdx[n]&255;return i-r>0?this._subParams.subarray(r,i):null}getSubParamsAll(){let n={};for(let r=0;r<this.length;++r){let i=this._subParamsIdx[r]>>8,s=this._subParamsIdx[r]&255;s-i>0&&(n[r]=this._subParams.slice(i,s))}return n}addDigit(n){let r;if(this._rejectDigits||!(r=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;let i=this._digitIsSub?this._subParams:this.params,s=i[r-1];i[r-1]=~s?Math.min(s*10+n,cm):n}},um=[],rie=class{constructor(){this._state=0,this._active=um,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(e,n){this._handlers[e]===void 0&&(this._handlers[e]=[]);let r=this._handlers[e];return r.push(n),{dispose:()=>{let i=r.indexOf(n);i!==-1&&r.splice(i,1)}}}clearHandler(e){this._handlers[e]&&delete this._handlers[e]}setHandlerFallback(e){this._handlerFb=e}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=um}reset(){if(this._state===2)for(let e=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;e>=0;--e)this._active[e].end(!1);this._stack.paused=!1,this._active=um,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||um,!this._active.length)this._handlerFb(this._id,"START");else for(let e=this._active.length-1;e>=0;e--)this._active[e].start()}_put(e,n,r){if(!this._active.length)this._handlerFb(this._id,"PUT",T0(e,n,r));else for(let i=this._active.length-1;i>=0;i--)this._active[i].put(e,n,r)}start(){this.reset(),this._state=1}put(e,n,r){if(this._state!==3){if(this._state===1)for(;n<r;){let i=e[n++];if(i===59){this._state=2,this._start();break}if(i<48||57<i){this._state=3;return}this._id===-1&&(this._id=0),this._id=this._id*10+i-48}this._state===2&&r-n>0&&this._put(e,n,r)}}end(e,n=!0){if(this._state!==0){if(this._state!==3)if(this._state===1&&this._start(),!this._active.length)this._handlerFb(this._id,"END",e);else{let r=!1,i=this._active.length-1,s=!1;if(this._stack.paused&&(i=this._stack.loopPosition-1,r=n,s=this._stack.fallThrough,this._stack.paused=!1),!s&&r===!1){for(;i>=0&&(r=this._active[i].end(e),r!==!0);i--)if(r instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=i,this._stack.fallThrough=!1,r;i--}for(;i>=0;i--)if(r=this._active[i].end(!1),r instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=i,this._stack.fallThrough=!0,r}this._active=um,this._id=-1,this._state=0}}},Vs=class{constructor(n){this._handler=n,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(n,r,i){this._hitLimit||(this._data+=T0(n,r,i),this._data.length>1e7&&(this._data="",this._hitLimit=!0))}end(n){let r=!1;if(this._hitLimit)r=!1;else if(n&&(r=this._handler(this._data),r instanceof Promise))return r.then(i=>(this._data="",this._hitLimit=!1,i));return this._data="",this._hitLimit=!1,r}},dm=[],iie=class{constructor(){this._handlers=Object.create(null),this._active=dm,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=dm}registerHandler(e,n){this._handlers[e]===void 0&&(this._handlers[e]=[]);let r=this._handlers[e];return r.push(n),{dispose:()=>{let i=r.indexOf(n);i!==-1&&r.splice(i,1)}}}clearHandler(e){this._handlers[e]&&delete this._handlers[e]}setHandlerFallback(e){this._handlerFb=e}reset(){if(this._active.length)for(let e=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;e>=0;--e)this._active[e].unhook(!1);this._stack.paused=!1,this._active=dm,this._ident=0}hook(e,n){if(this.reset(),this._ident=e,this._active=this._handlers[e]||dm,!this._active.length)this._handlerFb(this._ident,"HOOK",n);else for(let r=this._active.length-1;r>=0;r--)this._active[r].hook(n)}put(e,n,r){if(!this._active.length)this._handlerFb(this._ident,"PUT",T0(e,n,r));else for(let i=this._active.length-1;i>=0;i--)this._active[i].put(e,n,r)}unhook(e,n=!0){if(!this._active.length)this._handlerFb(this._ident,"UNHOOK",e);else{let r=!1,i=this._active.length-1,s=!1;if(this._stack.paused&&(i=this._stack.loopPosition-1,r=n,s=this._stack.fallThrough,this._stack.paused=!1),!s&&r===!1){for(;i>=0&&(r=this._active[i].unhook(e),r!==!0);i--)if(r instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=i,this._stack.fallThrough=!1,r;i--}for(;i>=0;i--)if(r=this._active[i].unhook(!1),r instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=i,this._stack.fallThrough=!0,r}this._active=dm,this._ident=0}},qm=new A9;qm.addParam(0);var m4=class{constructor(e){this._handler=e,this._data="",this._params=qm,this._hitLimit=!1}hook(e){this._params=e.length>1||e.params[0]?e.clone():qm,this._data="",this._hitLimit=!1}put(e,n,r){this._hitLimit||(this._data+=T0(e,n,r),this._data.length>1e7&&(this._data="",this._hitLimit=!0))}unhook(e){let n=!1;if(this._hitLimit)n=!1;else if(e&&(n=this._handler(this._data,this._params),n instanceof Promise))return n.then(r=>(this._params=qm,this._data="",this._hitLimit=!1,r));return this._params=qm,this._data="",this._hitLimit=!1,n}},sie=class{constructor(e){this.table=new Uint8Array(e)}setDefault(e,n){this.table.fill(e<<4|n)}add(e,n,r,i){this.table[n<<8|e]=r<<4|i}addMany(e,n,r,i){for(let s=0;s<e.length;s++)this.table[n<<8|e[s]]=r<<4|i}},wa=160,aie=(function(){let e=new sie(4095),n=Array.apply(null,Array(256)).map((l,u)=>u),r=(l,u)=>n.slice(l,u),i=r(32,127),s=r(0,24);s.push(25),s.push.apply(s,r(28,32));let a=r(0,14),o;e.setDefault(1,0),e.addMany(i,0,2,0);for(o in a)e.addMany([24,26,153,154],o,3,0),e.addMany(r(128,144),o,3,0),e.addMany(r(144,152),o,3,0),e.add(156,o,0,0),e.add(27,o,11,1),e.add(157,o,4,8),e.addMany([152,158,159],o,0,7),e.add(155,o,11,3),e.add(144,o,11,9);return e.addMany(s,0,3,0),e.addMany(s,1,3,1),e.add(127,1,0,1),e.addMany(s,8,0,8),e.addMany(s,3,3,3),e.add(127,3,0,3),e.addMany(s,4,3,4),e.add(127,4,0,4),e.addMany(s,6,3,6),e.addMany(s,5,3,5),e.add(127,5,0,5),e.addMany(s,2,3,2),e.add(127,2,0,2),e.add(93,1,4,8),e.addMany(i,8,5,8),e.add(127,8,5,8),e.addMany([156,27,24,26,7],8,6,0),e.addMany(r(28,32),8,0,8),e.addMany([88,94,95],1,0,7),e.addMany(i,7,0,7),e.addMany(s,7,0,7),e.add(156,7,0,0),e.add(127,7,0,7),e.add(91,1,11,3),e.addMany(r(64,127),3,7,0),e.addMany(r(48,60),3,8,4),e.addMany([60,61,62,63],3,9,4),e.addMany(r(48,60),4,8,4),e.addMany(r(64,127),4,7,0),e.addMany([60,61,62,63],4,0,6),e.addMany(r(32,64),6,0,6),e.add(127,6,0,6),e.addMany(r(64,127),6,0,0),e.addMany(r(32,48),3,9,5),e.addMany(r(32,48),5,9,5),e.addMany(r(48,64),5,0,6),e.addMany(r(64,127),5,7,0),e.addMany(r(32,48),4,9,5),e.addMany(r(32,48),1,9,2),e.addMany(r(32,48),2,9,2),e.addMany(r(48,127),2,10,0),e.addMany(r(48,80),1,10,0),e.addMany(r(81,88),1,10,0),e.addMany([89,90,92],1,10,0),e.addMany(r(96,127),1,10,0),e.add(80,1,11,9),e.addMany(s,9,0,9),e.add(127,9,0,9),e.addMany(r(28,32),9,0,9),e.addMany(r(32,48),9,9,12),e.addMany(r(48,60),9,8,10),e.addMany([60,61,62,63],9,9,10),e.addMany(s,11,0,11),e.addMany(r(32,128),11,0,11),e.addMany(r(28,32),11,0,11),e.addMany(s,10,0,10),e.add(127,10,0,10),e.addMany(r(28,32),10,0,10),e.addMany(r(48,60),10,8,10),e.addMany([60,61,62,63],10,0,11),e.addMany(r(32,48),10,9,12),e.addMany(s,12,0,12),e.add(127,12,0,12),e.addMany(r(28,32),12,0,12),e.addMany(r(32,48),12,9,12),e.addMany(r(48,64),12,0,11),e.addMany(r(64,127),12,12,13),e.addMany(r(64,127),10,12,13),e.addMany(r(64,127),9,12,13),e.addMany(s,13,13,13),e.addMany(i,13,13,13),e.add(127,13,0,13),e.addMany([27,156,24,26],13,14,0),e.add(wa,0,2,0),e.add(wa,8,5,8),e.add(wa,6,0,6),e.add(wa,11,0,11),e.add(wa,13,13,13),e})(),oie=class extends sn{constructor(e=aie){super(),this._transitions=e,this._parseStack={state:0,handlers:[],handlerPos:0,transition:0,chunkPos:0},this.initialState=0,this.currentState=this.initialState,this._params=new A9,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(n,r,i)=>{},this._executeHandlerFb=n=>{},this._csiHandlerFb=(n,r)=>{},this._escHandlerFb=n=>{},this._errorHandlerFb=n=>n,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this._register(br(()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)})),this._oscParser=this._register(new rie),this._dcsParser=this._register(new iie),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},()=>!0)}_identifier(e,n=[64,126]){let r=0;if(e.prefix){if(e.prefix.length>1)throw new Error("only one byte as prefix supported");if(r=e.prefix.charCodeAt(0),r&&60>r||r>63)throw new Error("prefix must be in range 0x3c .. 0x3f")}if(e.intermediates){if(e.intermediates.length>2)throw new Error("only two bytes as intermediates are supported");for(let s=0;s<e.intermediates.length;++s){let a=e.intermediates.charCodeAt(s);if(32>a||a>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");r<<=8,r|=a}}if(e.final.length!==1)throw new Error("final must be a single byte");let i=e.final.charCodeAt(0);if(n[0]>i||i>n[1])throw new Error(`final must be in range ${n[0]} .. ${n[1]}`);return r<<=8,r|=i,r}identToString(e){let n=[];for(;e;)n.push(String.fromCharCode(e&255)),e>>=8;return n.reverse().join("")}setPrintHandler(e){this._printHandler=e}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(e,n){let r=this._identifier(e,[48,126]);this._escHandlers[r]===void 0&&(this._escHandlers[r]=[]);let i=this._escHandlers[r];return i.push(n),{dispose:()=>{let s=i.indexOf(n);s!==-1&&i.splice(s,1)}}}clearEscHandler(e){this._escHandlers[this._identifier(e,[48,126])]&&delete this._escHandlers[this._identifier(e,[48,126])]}setEscHandlerFallback(e){this._escHandlerFb=e}setExecuteHandler(e,n){this._executeHandlers[e.charCodeAt(0)]=n}clearExecuteHandler(e){this._executeHandlers[e.charCodeAt(0)]&&delete this._executeHandlers[e.charCodeAt(0)]}setExecuteHandlerFallback(e){this._executeHandlerFb=e}registerCsiHandler(e,n){let r=this._identifier(e);this._csiHandlers[r]===void 0&&(this._csiHandlers[r]=[]);let i=this._csiHandlers[r];return i.push(n),{dispose:()=>{let s=i.indexOf(n);s!==-1&&i.splice(s,1)}}}clearCsiHandler(e){this._csiHandlers[this._identifier(e)]&&delete this._csiHandlers[this._identifier(e)]}setCsiHandlerFallback(e){this._csiHandlerFb=e}registerDcsHandler(e,n){return this._dcsParser.registerHandler(this._identifier(e),n)}clearDcsHandler(e){this._dcsParser.clearHandler(this._identifier(e))}setDcsHandlerFallback(e){this._dcsParser.setHandlerFallback(e)}registerOscHandler(e,n){return this._oscParser.registerHandler(e,n)}clearOscHandler(e){this._oscParser.clearHandler(e)}setOscHandlerFallback(e){this._oscParser.setHandlerFallback(e)}setErrorHandler(e){this._errorHandler=e}clearErrorHandler(){this._errorHandler=this._errorHandlerFb}reset(){this.currentState=this.initialState,this._oscParser.reset(),this._dcsParser.reset(),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._parseStack.state!==0&&(this._parseStack.state=2,this._parseStack.handlers=[])}_preserveStack(e,n,r,i,s){this._parseStack.state=e,this._parseStack.handlers=n,this._parseStack.handlerPos=r,this._parseStack.transition=i,this._parseStack.chunkPos=s}parse(e,n,r){let i=0,s=0,a=0,o;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,a=this._parseStack.chunkPos+1;else{if(r===void 0||this._parseStack.state===1)throw this._parseStack.state=1,new Error("improper continuation due to previous async handler, giving up parsing");let l=this._parseStack.handlers,u=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(r===!1&&u>-1){for(;u>=0&&(o=l[u](this._params),o!==!0);u--)if(o instanceof Promise)return this._parseStack.handlerPos=u,o}this._parseStack.handlers=[];break;case 4:if(r===!1&&u>-1){for(;u>=0&&(o=l[u](),o!==!0);u--)if(o instanceof Promise)return this._parseStack.handlerPos=u,o}this._parseStack.handlers=[];break;case 6:if(i=e[this._parseStack.chunkPos],o=this._dcsParser.unhook(i!==24&&i!==26,r),o)return o;i===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(i=e[this._parseStack.chunkPos],o=this._oscParser.end(i!==24&&i!==26,r),o)return o;i===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break}this._parseStack.state=0,a=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=this._parseStack.transition&15}for(let l=a;l<n;++l){switch(i=e[l],s=this._transitions.table[this.currentState<<8|(i<160?i:wa)],s>>4){case 2:for(let g=l+1;;++g){if(g>=n||(i=e[g])<32||i>126&&i<wa){this._printHandler(e,l,g),l=g-1;break}if(++g>=n||(i=e[g])<32||i>126&&i<wa){this._printHandler(e,l,g),l=g-1;break}if(++g>=n||(i=e[g])<32||i>126&&i<wa){this._printHandler(e,l,g),l=g-1;break}if(++g>=n||(i=e[g])<32||i>126&&i<wa){this._printHandler(e,l,g),l=g-1;break}}break;case 3:this._executeHandlers[i]?this._executeHandlers[i]():this._executeHandlerFb(i),this.precedingJoinState=0;break;case 0:break;case 1:if(this._errorHandler({position:l,code:i,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:let u=this._csiHandlers[this._collect<<8|i],d=u?u.length-1:-1;for(;d>=0&&(o=u[d](this._params),o!==!0);d--)if(o instanceof Promise)return this._preserveStack(3,u,d,s,l),o;d<0&&this._csiHandlerFb(this._collect<<8|i,this._params),this.precedingJoinState=0;break;case 8:do switch(i){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(i-48)}while(++l<n&&(i=e[l])>47&&i<60);l--;break;case 9:this._collect<<=8,this._collect|=i;break;case 10:let p=this._escHandlers[this._collect<<8|i],f=p?p.length-1:-1;for(;f>=0&&(o=p[f](),o!==!0);f--)if(o instanceof Promise)return this._preserveStack(4,p,f,s,l),o;f<0&&this._escHandlerFb(this._collect<<8|i),this.precedingJoinState=0;break;case 11:this._params.reset(),this._params.addParam(0),this._collect=0;break;case 12:this._dcsParser.hook(this._collect<<8|i,this._params);break;case 13:for(let g=l+1;;++g)if(g>=n||(i=e[g])===24||i===26||i===27||i>127&&i<wa){this._dcsParser.put(e,l,g),l=g-1;break}break;case 14:if(o=this._dcsParser.unhook(i!==24&&i!==26),o)return this._preserveStack(6,[],0,s,l),o;i===27&&(s|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break;case 4:this._oscParser.start();break;case 5:for(let g=l+1;;g++)if(g>=n||(i=e[g])<32||i>127&&i<wa){this._oscParser.put(e,l,g),l=g-1;break}break;case 6:if(o=this._oscParser.end(i!==24&&i!==26),o)return this._preserveStack(5,[],0,s,l),o;i===27&&(s|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break}this.currentState=s&15}}},lie=/^([\da-f])\/([\da-f])\/([\da-f])$|^([\da-f]{2})\/([\da-f]{2})\/([\da-f]{2})$|^([\da-f]{3})\/([\da-f]{3})\/([\da-f]{3})$|^([\da-f]{4})\/([\da-f]{4})\/([\da-f]{4})$/,cie=/^[\da-f]+$/;function g4(e){if(!e)return;let n=e.toLowerCase();if(n.indexOf("rgb:")===0){n=n.slice(4);let r=lie.exec(n);if(r){let i=r[1]?15:r[4]?255:r[7]?4095:65535;return[Math.round(parseInt(r[1]||r[4]||r[7]||r[10],16)/i*255),Math.round(parseInt(r[2]||r[5]||r[8]||r[11],16)/i*255),Math.round(parseInt(r[3]||r[6]||r[9]||r[12],16)/i*255)]}}else if(n.indexOf("#")===0&&(n=n.slice(1),cie.exec(n)&&[3,6,9,12].includes(n.length))){let r=n.length/3,i=[0,0,0];for(let s=0;s<3;++s){let a=parseInt(n.slice(r*s,r*s+r),16);i[s]=r===1?a<<4:r===2?a:r===3?a>>4:a>>8}return i}}function Zw(e,n){let r=e.toString(16),i=r.length<2?"0"+r:r;switch(n){case 4:return r[0];case 8:return i;case 12:return(i+i).slice(0,3);default:return i+i}}function uie(e,n=16){let[r,i,s]=e;return`rgb:${Zw(r,n)}/${Zw(i,n)}/${Zw(s,n)}`}var die={"(":0,")":1,"*":2,"+":3,"-":1,".":2},Dc=131072,v4=10;function y4(e,n){if(e>24)return n.setWinLines||!1;switch(e){case 1:return!!n.restoreWin;case 2:return!!n.minimizeWin;case 3:return!!n.setWinPosition;case 4:return!!n.setWinSizePixels;case 5:return!!n.raiseWin;case 6:return!!n.lowerWin;case 7:return!!n.refreshWin;case 8:return!!n.setWinSizeChars;case 9:return!!n.maximizeWin;case 10:return!!n.fullscreenWin;case 11:return!!n.getWinState;case 13:return!!n.getWinPosition;case 14:return!!n.getWinSizePixels;case 15:return!!n.getScreenSizePixels;case 16:return!!n.getCellSizePixels;case 18:return!!n.getWinSizeChars;case 19:return!!n.getScreenSizeChars;case 20:return!!n.getIconTitle;case 21:return!!n.getWinTitle;case 22:return!!n.pushTitle;case 23:return!!n.popTitle;case 24:return!!n.setWinLines}return!1}var _4=5e3,x4=0,hie=class extends sn{constructor(e,n,r,i,s,a,o,l,u=new oie){super(),this._bufferService=e,this._charsetService=n,this._coreService=r,this._logService=i,this._optionsService=s,this._oscLinkService=a,this._coreMouseService=o,this._unicodeService=l,this._parser=u,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new Mte,this._utf8Decoder=new Rte,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=Vr.clone(),this._eraseAttrDataInternal=Vr.clone(),this._onRequestBell=this._register(new nt),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this._register(new nt),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this._register(new nt),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this._register(new nt),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this._register(new nt),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this._register(new nt),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this._register(new nt),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this._register(new nt),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this._register(new nt),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this._register(new nt),this.onLineFeed=this._onLineFeed.event,this._onScroll=this._register(new nt),this.onScroll=this._onScroll.event,this._onTitleChange=this._register(new nt),this.onTitleChange=this._onTitleChange.event,this._onColor=this._register(new nt),this.onColor=this._onColor.event,this._parseStack={paused:!1,cursorStartX:0,cursorStartY:0,decodedLength:0,position:0},this._specialColors=[256,257,258],this._register(this._parser),this._dirtyRowTracker=new pj(this._bufferService),this._activeBuffer=this._bufferService.buffer,this._register(this._bufferService.buffers.onBufferActivate(d=>this._activeBuffer=d.activeBuffer)),this._parser.setCsiHandlerFallback((d,p)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(d),params:p.toArray()})}),this._parser.setEscHandlerFallback(d=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(d)})}),this._parser.setExecuteHandlerFallback(d=>{this._logService.debug("Unknown EXECUTE code: ",{code:d})}),this._parser.setOscHandlerFallback((d,p,f)=>{this._logService.debug("Unknown OSC code: ",{identifier:d,action:p,data:f})}),this._parser.setDcsHandlerFallback((d,p,f)=>{p==="HOOK"&&(f=f.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(d),action:p,payload:f})}),this._parser.setPrintHandler((d,p,f)=>this.print(d,p,f)),this._parser.registerCsiHandler({final:"@"},d=>this.insertChars(d)),this._parser.registerCsiHandler({intermediates:" ",final:"@"},d=>this.scrollLeft(d)),this._parser.registerCsiHandler({final:"A"},d=>this.cursorUp(d)),this._parser.registerCsiHandler({intermediates:" ",final:"A"},d=>this.scrollRight(d)),this._parser.registerCsiHandler({final:"B"},d=>this.cursorDown(d)),this._parser.registerCsiHandler({final:"C"},d=>this.cursorForward(d)),this._parser.registerCsiHandler({final:"D"},d=>this.cursorBackward(d)),this._parser.registerCsiHandler({final:"E"},d=>this.cursorNextLine(d)),this._parser.registerCsiHandler({final:"F"},d=>this.cursorPrecedingLine(d)),this._parser.registerCsiHandler({final:"G"},d=>this.cursorCharAbsolute(d)),this._parser.registerCsiHandler({final:"H"},d=>this.cursorPosition(d)),this._parser.registerCsiHandler({final:"I"},d=>this.cursorForwardTab(d)),this._parser.registerCsiHandler({final:"J"},d=>this.eraseInDisplay(d,!1)),this._parser.registerCsiHandler({prefix:"?",final:"J"},d=>this.eraseInDisplay(d,!0)),this._parser.registerCsiHandler({final:"K"},d=>this.eraseInLine(d,!1)),this._parser.registerCsiHandler({prefix:"?",final:"K"},d=>this.eraseInLine(d,!0)),this._parser.registerCsiHandler({final:"L"},d=>this.insertLines(d)),this._parser.registerCsiHandler({final:"M"},d=>this.deleteLines(d)),this._parser.registerCsiHandler({final:"P"},d=>this.deleteChars(d)),this._parser.registerCsiHandler({final:"S"},d=>this.scrollUp(d)),this._parser.registerCsiHandler({final:"T"},d=>this.scrollDown(d)),this._parser.registerCsiHandler({final:"X"},d=>this.eraseChars(d)),this._parser.registerCsiHandler({final:"Z"},d=>this.cursorBackwardTab(d)),this._parser.registerCsiHandler({final:"`"},d=>this.charPosAbsolute(d)),this._parser.registerCsiHandler({final:"a"},d=>this.hPositionRelative(d)),this._parser.registerCsiHandler({final:"b"},d=>this.repeatPrecedingCharacter(d)),this._parser.registerCsiHandler({final:"c"},d=>this.sendDeviceAttributesPrimary(d)),this._parser.registerCsiHandler({prefix:">",final:"c"},d=>this.sendDeviceAttributesSecondary(d)),this._parser.registerCsiHandler({final:"d"},d=>this.linePosAbsolute(d)),this._parser.registerCsiHandler({final:"e"},d=>this.vPositionRelative(d)),this._parser.registerCsiHandler({final:"f"},d=>this.hVPosition(d)),this._parser.registerCsiHandler({final:"g"},d=>this.tabClear(d)),this._parser.registerCsiHandler({final:"h"},d=>this.setMode(d)),this._parser.registerCsiHandler({prefix:"?",final:"h"},d=>this.setModePrivate(d)),this._parser.registerCsiHandler({final:"l"},d=>this.resetMode(d)),this._parser.registerCsiHandler({prefix:"?",final:"l"},d=>this.resetModePrivate(d)),this._parser.registerCsiHandler({final:"m"},d=>this.charAttributes(d)),this._parser.registerCsiHandler({final:"n"},d=>this.deviceStatus(d)),this._parser.registerCsiHandler({prefix:"?",final:"n"},d=>this.deviceStatusPrivate(d)),this._parser.registerCsiHandler({intermediates:"!",final:"p"},d=>this.softReset(d)),this._parser.registerCsiHandler({intermediates:" ",final:"q"},d=>this.setCursorStyle(d)),this._parser.registerCsiHandler({final:"r"},d=>this.setScrollRegion(d)),this._parser.registerCsiHandler({final:"s"},d=>this.saveCursor(d)),this._parser.registerCsiHandler({final:"t"},d=>this.windowOptions(d)),this._parser.registerCsiHandler({final:"u"},d=>this.restoreCursor(d)),this._parser.registerCsiHandler({intermediates:"'",final:"}"},d=>this.insertColumns(d)),this._parser.registerCsiHandler({intermediates:"'",final:"~"},d=>this.deleteColumns(d)),this._parser.registerCsiHandler({intermediates:'"',final:"q"},d=>this.selectProtected(d)),this._parser.registerCsiHandler({intermediates:"$",final:"p"},d=>this.requestMode(d,!0)),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},d=>this.requestMode(d,!1)),this._parser.setExecuteHandler(Fe.BEL,()=>this.bell()),this._parser.setExecuteHandler(Fe.LF,()=>this.lineFeed()),this._parser.setExecuteHandler(Fe.VT,()=>this.lineFeed()),this._parser.setExecuteHandler(Fe.FF,()=>this.lineFeed()),this._parser.setExecuteHandler(Fe.CR,()=>this.carriageReturn()),this._parser.setExecuteHandler(Fe.BS,()=>this.backspace()),this._parser.setExecuteHandler(Fe.HT,()=>this.tab()),this._parser.setExecuteHandler(Fe.SO,()=>this.shiftOut()),this._parser.setExecuteHandler(Fe.SI,()=>this.shiftIn()),this._parser.setExecuteHandler(kx.IND,()=>this.index()),this._parser.setExecuteHandler(kx.NEL,()=>this.nextLine()),this._parser.setExecuteHandler(kx.HTS,()=>this.tabSet()),this._parser.registerOscHandler(0,new Vs(d=>(this.setTitle(d),this.setIconName(d),!0))),this._parser.registerOscHandler(1,new Vs(d=>this.setIconName(d))),this._parser.registerOscHandler(2,new Vs(d=>this.setTitle(d))),this._parser.registerOscHandler(4,new Vs(d=>this.setOrReportIndexedColor(d))),this._parser.registerOscHandler(8,new Vs(d=>this.setHyperlink(d))),this._parser.registerOscHandler(10,new Vs(d=>this.setOrReportFgColor(d))),this._parser.registerOscHandler(11,new Vs(d=>this.setOrReportBgColor(d))),this._parser.registerOscHandler(12,new Vs(d=>this.setOrReportCursorColor(d))),this._parser.registerOscHandler(104,new Vs(d=>this.restoreIndexedColor(d))),this._parser.registerOscHandler(110,new Vs(d=>this.restoreFgColor(d))),this._parser.registerOscHandler(111,new Vs(d=>this.restoreBgColor(d))),this._parser.registerOscHandler(112,new Vs(d=>this.restoreCursorColor(d))),this._parser.registerEscHandler({final:"7"},()=>this.saveCursor()),this._parser.registerEscHandler({final:"8"},()=>this.restoreCursor()),this._parser.registerEscHandler({final:"D"},()=>this.index()),this._parser.registerEscHandler({final:"E"},()=>this.nextLine()),this._parser.registerEscHandler({final:"H"},()=>this.tabSet()),this._parser.registerEscHandler({final:"M"},()=>this.reverseIndex()),this._parser.registerEscHandler({final:"="},()=>this.keypadApplicationMode()),this._parser.registerEscHandler({final:">"},()=>this.keypadNumericMode()),this._parser.registerEscHandler({final:"c"},()=>this.fullReset()),this._parser.registerEscHandler({final:"n"},()=>this.setgLevel(2)),this._parser.registerEscHandler({final:"o"},()=>this.setgLevel(3)),this._parser.registerEscHandler({final:"|"},()=>this.setgLevel(3)),this._parser.registerEscHandler({final:"}"},()=>this.setgLevel(2)),this._parser.registerEscHandler({final:"~"},()=>this.setgLevel(1)),this._parser.registerEscHandler({intermediates:"%",final:"@"},()=>this.selectDefaultCharset()),this._parser.registerEscHandler({intermediates:"%",final:"G"},()=>this.selectDefaultCharset());for(let d in ai)this._parser.registerEscHandler({intermediates:"(",final:d},()=>this.selectCharset("("+d)),this._parser.registerEscHandler({intermediates:")",final:d},()=>this.selectCharset(")"+d)),this._parser.registerEscHandler({intermediates:"*",final:d},()=>this.selectCharset("*"+d)),this._parser.registerEscHandler({intermediates:"+",final:d},()=>this.selectCharset("+"+d)),this._parser.registerEscHandler({intermediates:"-",final:d},()=>this.selectCharset("-"+d)),this._parser.registerEscHandler({intermediates:".",final:d},()=>this.selectCharset("."+d)),this._parser.registerEscHandler({intermediates:"/",final:d},()=>this.selectCharset("/"+d));this._parser.registerEscHandler({intermediates:"#",final:"8"},()=>this.screenAlignmentPattern()),this._parser.setErrorHandler(d=>(this._logService.error("Parsing error: ",d),d)),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new m4((d,p)=>this.requestStatusString(d,p)))}getAttrData(){return this._curAttrData}_preserveStack(e,n,r,i){this._parseStack.paused=!0,this._parseStack.cursorStartX=e,this._parseStack.cursorStartY=n,this._parseStack.decodedLength=r,this._parseStack.position=i}_logSlowResolvingAsync(e){this._logService.logLevel<=3&&Promise.race([e,new Promise((n,r)=>setTimeout(()=>r("#SLOW_TIMEOUT"),_4))]).catch(n=>{if(n!=="#SLOW_TIMEOUT")throw n;console.warn(`async parser handler taking longer than ${_4} ms`)})}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(e,n){let r,i=this._activeBuffer.x,s=this._activeBuffer.y,a=0,o=this._parseStack.paused;if(o){if(r=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,n))return this._logSlowResolvingAsync(r),r;i=this._parseStack.cursorStartX,s=this._parseStack.cursorStartY,this._parseStack.paused=!1,e.length>Dc&&(a=this._parseStack.position+Dc)}if(this._logService.logLevel<=1&&this._logService.debug(`parsing data ${typeof e=="string"?` "${e}"`:` "${Array.prototype.map.call(e,d=>String.fromCharCode(d)).join("")}"`}`),this._logService.logLevel===0&&this._logService.trace("parsing data (codes)",typeof e=="string"?e.split("").map(d=>d.charCodeAt(0)):e),this._parseBuffer.length<e.length&&this._parseBuffer.length<Dc&&(this._parseBuffer=new Uint32Array(Math.min(e.length,Dc))),o||this._dirtyRowTracker.clearRange(),e.length>Dc)for(let d=a;d<e.length;d+=Dc){let p=d+Dc<e.length?d+Dc:e.length,f=typeof e=="string"?this._stringDecoder.decode(e.substring(d,p),this._parseBuffer):this._utf8Decoder.decode(e.subarray(d,p),this._parseBuffer);if(r=this._parser.parse(this._parseBuffer,f))return this._preserveStack(i,s,f,d),this._logSlowResolvingAsync(r),r}else if(!o){let d=typeof e=="string"?this._stringDecoder.decode(e,this._parseBuffer):this._utf8Decoder.decode(e,this._parseBuffer);if(r=this._parser.parse(this._parseBuffer,d))return this._preserveStack(i,s,d,0),this._logSlowResolvingAsync(r),r}(this._activeBuffer.x!==i||this._activeBuffer.y!==s)&&this._onCursorMove.fire();let l=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),u=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);u<this._bufferService.rows&&this._onRequestRefreshRows.fire({start:Math.min(u,this._bufferService.rows-1),end:Math.min(l,this._bufferService.rows-1)})}print(e,n,r){let i,s,a=this._charsetService.charset,o=this._optionsService.rawOptions.screenReaderMode,l=this._bufferService.cols,u=this._coreService.decPrivateModes.wraparound,d=this._coreService.modes.insertMode,p=this._curAttrData,f=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&r-n>0&&f.getWidth(this._activeBuffer.x-1)===2&&f.setCellFromCodepoint(this._activeBuffer.x-1,0,1,p);let g=this._parser.precedingJoinState;for(let _=n;_<r;++_){if(i=e[_],i<127&&a){let w=a[String.fromCharCode(i)];w&&(i=w.charCodeAt(0))}let x=this._unicodeService.charProperties(i,g);s=pd.extractWidth(x);let v=pd.extractShouldJoin(x),S=v?pd.extractWidth(g):0;if(g=x,o&&this._onA11yChar.fire(qc(i)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+s-S>l){if(u){let w=f,j=this._activeBuffer.x-S;for(this._activeBuffer.x=S,this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData(),!0)):(this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!0),f=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),S>0&&f instanceof Hm&&f.copyCellsFrom(w,j,0,S,!1);j<l;)w.setCellFromCodepoint(j++,0,1,p)}else if(this._activeBuffer.x=l-1,s===2)continue}if(v&&this._activeBuffer.x){let w=f.getWidth(this._activeBuffer.x-1)?1:2;f.addCodepointToCell(this._activeBuffer.x-w,i,s);for(let j=s-S;--j>=0;)f.setCellFromCodepoint(this._activeBuffer.x++,0,0,p);continue}if(d&&(f.insertCells(this._activeBuffer.x,s-S,this._activeBuffer.getNullCell(p)),f.getWidth(l-1)===2&&f.setCellFromCodepoint(l-1,0,1,p)),f.setCellFromCodepoint(this._activeBuffer.x++,i,s,p),s>0)for(;--s;)f.setCellFromCodepoint(this._activeBuffer.x++,0,0,p)}this._parser.precedingJoinState=g,this._activeBuffer.x<l&&r-n>0&&f.getWidth(this._activeBuffer.x)===0&&!f.hasContent(this._activeBuffer.x)&&f.setCellFromCodepoint(this._activeBuffer.x,0,1,p),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(e,n){return e.final==="t"&&!e.prefix&&!e.intermediates?this._parser.registerCsiHandler(e,r=>y4(r.params[0],this._optionsService.rawOptions.windowOptions)?n(r):!0):this._parser.registerCsiHandler(e,n)}registerDcsHandler(e,n){return this._parser.registerDcsHandler(e,new m4(n))}registerEscHandler(e,n){return this._parser.registerEscHandler(e,n)}registerOscHandler(e,n){return this._parser.registerOscHandler(e,new Vs(n))}bell(){return this._onRequestBell.fire(),!0}lineFeed(){return this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._optionsService.rawOptions.convertEol&&(this._activeBuffer.x=0),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows?this._activeBuffer.y=this._bufferService.rows-1:this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.x>=this._bufferService.cols&&this._activeBuffer.x--,this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._onLineFeed.fire(),!0}carriageReturn(){return this._activeBuffer.x=0,!0}backspace(){var e;if(!this._coreService.decPrivateModes.reverseWraparound)return this._restrictCursor(),this._activeBuffer.x>0&&this._activeBuffer.x--,!0;if(this._restrictCursor(this._bufferService.cols),this._activeBuffer.x>0)this._activeBuffer.x--;else if(this._activeBuffer.x===0&&this._activeBuffer.y>this._activeBuffer.scrollTop&&this._activeBuffer.y<=this._activeBuffer.scrollBottom&&((e=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y))!=null&&e.isWrapped)){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);n.hasWidth(this._activeBuffer.x)&&!n.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let e=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-e),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(e=this._bufferService.cols-1){this._activeBuffer.x=Math.min(e,Math.max(0,this._activeBuffer.x)),this._activeBuffer.y=this._coreService.decPrivateModes.origin?Math.min(this._activeBuffer.scrollBottom,Math.max(this._activeBuffer.scrollTop,this._activeBuffer.y)):Math.min(this._bufferService.rows-1,Math.max(0,this._activeBuffer.y)),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_setCursor(e,n){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=e,this._activeBuffer.y=this._activeBuffer.scrollTop+n):(this._activeBuffer.x=e,this._activeBuffer.y=n),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(e,n){this._restrictCursor(),this._setCursor(this._activeBuffer.x+e,this._activeBuffer.y+n)}cursorUp(e){let n=this._activeBuffer.y-this._activeBuffer.scrollTop;return n>=0?this._moveCursor(0,-Math.min(n,e.params[0]||1)):this._moveCursor(0,-(e.params[0]||1)),!0}cursorDown(e){let n=this._activeBuffer.scrollBottom-this._activeBuffer.y;return n>=0?this._moveCursor(0,Math.min(n,e.params[0]||1)):this._moveCursor(0,e.params[0]||1),!0}cursorForward(e){return this._moveCursor(e.params[0]||1,0),!0}cursorBackward(e){return this._moveCursor(-(e.params[0]||1),0),!0}cursorNextLine(e){return this.cursorDown(e),this._activeBuffer.x=0,!0}cursorPrecedingLine(e){return this.cursorUp(e),this._activeBuffer.x=0,!0}cursorCharAbsolute(e){return this._setCursor((e.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(e){return this._setCursor(e.length>=2?(e.params[1]||1)-1:0,(e.params[0]||1)-1),!0}charPosAbsolute(e){return this._setCursor((e.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(e){return this._moveCursor(e.params[0]||1,0),!0}linePosAbsolute(e){return this._setCursor(this._activeBuffer.x,(e.params[0]||1)-1),!0}vPositionRelative(e){return this._moveCursor(0,e.params[0]||1),!0}hVPosition(e){return this.cursorPosition(e),!0}tabClear(e){let n=e.params[0];return n===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:n===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(e){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let n=e.params[0]||1;for(;n--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(e){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let n=e.params[0]||1;for(;n--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(e){let n=e.params[0];return n===1&&(this._curAttrData.bg|=536870912),(n===2||n===0)&&(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(e,n,r,i=!1,s=!1){let a=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);a.replaceCells(n,r,this._activeBuffer.getNullCell(this._eraseAttrData()),s),i&&(a.isWrapped=!1)}_resetBufferLine(e,n=!1){let r=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);r&&(r.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),n),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+e),r.isWrapped=!1)}eraseInDisplay(e,n=!1){var i;this._restrictCursor(this._bufferService.cols);let r;switch(e.params[0]){case 0:for(r=this._activeBuffer.y,this._dirtyRowTracker.markDirty(r),this._eraseInBufferLine(r++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,n);r<this._bufferService.rows;r++)this._resetBufferLine(r,n);this._dirtyRowTracker.markDirty(r);break;case 1:for(r=this._activeBuffer.y,this._dirtyRowTracker.markDirty(r),this._eraseInBufferLine(r,0,this._activeBuffer.x+1,!0,n),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(r+1).isWrapped=!1);r--;)this._resetBufferLine(r,n);this._dirtyRowTracker.markDirty(0);break;case 2:if(this._optionsService.rawOptions.scrollOnEraseInDisplay){for(r=this._bufferService.rows,this._dirtyRowTracker.markRangeDirty(0,r-1);r--&&!((i=this._activeBuffer.lines.get(this._activeBuffer.ybase+r))!=null&&i.getTrimmedLength()););for(;r>=0;r--)this._bufferService.scroll(this._eraseAttrData())}else{for(r=this._bufferService.rows,this._dirtyRowTracker.markDirty(r-1);r--;)this._resetBufferLine(r,n);this._dirtyRowTracker.markDirty(0)}break;case 3:let s=this._activeBuffer.lines.length-this._bufferService.rows;s>0&&(this._activeBuffer.lines.trimStart(s),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-s,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-s,0),this._onScroll.fire(0));break}return!0}eraseInLine(e,n=!1){switch(this._restrictCursor(this._bufferService.cols),e.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,n);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,n);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,n);break}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(e){this._restrictCursor();let n=e.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let r=this._activeBuffer.ybase+this._activeBuffer.y,i=this._bufferService.rows-1-this._activeBuffer.scrollBottom,s=this._bufferService.rows-1+this._activeBuffer.ybase-i+1;for(;n--;)this._activeBuffer.lines.splice(s-1,1),this._activeBuffer.lines.splice(r,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}deleteLines(e){this._restrictCursor();let n=e.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let r=this._activeBuffer.ybase+this._activeBuffer.y,i;for(i=this._bufferService.rows-1-this._activeBuffer.scrollBottom,i=this._bufferService.rows-1+this._activeBuffer.ybase-i;n--;)this._activeBuffer.lines.splice(r,1),this._activeBuffer.lines.splice(i,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}insertChars(e){this._restrictCursor();let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return n&&(n.insertCells(this._activeBuffer.x,e.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}deleteChars(e){this._restrictCursor();let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return n&&(n.deleteCells(this._activeBuffer.x,e.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}scrollUp(e){let n=e.params[0]||1;for(;n--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollDown(e){let n=e.params[0]||1;for(;n--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,0,this._activeBuffer.getBlankLine(Vr));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollLeft(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let n=e.params[0]||1;for(let r=this._activeBuffer.scrollTop;r<=this._activeBuffer.scrollBottom;++r){let i=this._activeBuffer.lines.get(this._activeBuffer.ybase+r);i.deleteCells(0,n,this._activeBuffer.getNullCell(this._eraseAttrData())),i.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollRight(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let n=e.params[0]||1;for(let r=this._activeBuffer.scrollTop;r<=this._activeBuffer.scrollBottom;++r){let i=this._activeBuffer.lines.get(this._activeBuffer.ybase+r);i.insertCells(0,n,this._activeBuffer.getNullCell(this._eraseAttrData())),i.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}insertColumns(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let n=e.params[0]||1;for(let r=this._activeBuffer.scrollTop;r<=this._activeBuffer.scrollBottom;++r){let i=this._activeBuffer.lines.get(this._activeBuffer.ybase+r);i.insertCells(this._activeBuffer.x,n,this._activeBuffer.getNullCell(this._eraseAttrData())),i.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}deleteColumns(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let n=e.params[0]||1;for(let r=this._activeBuffer.scrollTop;r<=this._activeBuffer.scrollBottom;++r){let i=this._activeBuffer.lines.get(this._activeBuffer.ybase+r);i.deleteCells(this._activeBuffer.x,n,this._activeBuffer.getNullCell(this._eraseAttrData())),i.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(e){this._restrictCursor();let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return n&&(n.replaceCells(this._activeBuffer.x,this._activeBuffer.x+(e.params[0]||1),this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}repeatPrecedingCharacter(e){let n=this._parser.precedingJoinState;if(!n)return!0;let r=e.params[0]||1,i=pd.extractWidth(n),s=this._activeBuffer.x-i,a=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(s),o=new Uint32Array(a.length*r),l=0;for(let d=0;d<a.length;){let p=a.codePointAt(d)||0;o[l++]=p,d+=p>65535?2:1}let u=l;for(let d=1;d<r;++d)o.copyWithin(u,0,l),u+=l;return this.print(o,0,u),!0}sendDeviceAttributesPrimary(e){return e.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(Fe.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(Fe.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(e){return e.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(Fe.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(Fe.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(e.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(Fe.ESC+"[>83;40003;0c")),!0}_is(e){return(this._optionsService.rawOptions.termName+"").indexOf(e)===0}setMode(e){for(let n=0;n<e.length;n++)switch(e.params[n]){case 4:this._coreService.modes.insertMode=!0;break;case 20:this._optionsService.options.convertEol=!0;break}return!0}setModePrivate(e){for(let n=0;n<e.length;n++)switch(e.params[n]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!0;break;case 2:this._charsetService.setgCharset(0,rd),this._charsetService.setgCharset(1,rd),this._charsetService.setgCharset(2,rd),this._charsetService.setgCharset(3,rd);break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(132,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!0,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!0;break;case 12:this._optionsService.options.cursorBlink=!0;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!0;break;case 66:this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire();break;case 9:this._coreMouseService.activeProtocol="X10";break;case 1e3:this._coreMouseService.activeProtocol="VT200";break;case 1002:this._coreMouseService.activeProtocol="DRAG";break;case 1003:this._coreMouseService.activeProtocol="ANY";break;case 1004:this._coreService.decPrivateModes.sendFocus=!0,this._onRequestSendFocus.fire();break;case 1005:this._logService.debug("DECSET 1005 not supported (see #2507)");break;case 1006:this._coreMouseService.activeEncoding="SGR";break;case 1015:this._logService.debug("DECSET 1015 not supported (see #2507)");break;case 1016:this._coreMouseService.activeEncoding="SGR_PIXELS";break;case 25:this._coreService.isCursorHidden=!1;break;case 1048:this.saveCursor();break;case 1049:this.saveCursor();case 47:case 1047:this._bufferService.buffers.activateAltBuffer(this._eraseAttrData()),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(void 0),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!0;break;case 2026:this._coreService.decPrivateModes.synchronizedOutput=!0;break}return!0}resetMode(e){for(let n=0;n<e.length;n++)switch(e.params[n]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1;break}return!0}resetModePrivate(e){for(let n=0;n<e.length;n++)switch(e.params[n]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!1;break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(80,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!1,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!1;break;case 12:this._optionsService.options.cursorBlink=!1;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!1;break;case 66:this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire();break;case 9:case 1e3:case 1002:case 1003:this._coreMouseService.activeProtocol="NONE";break;case 1004:this._coreService.decPrivateModes.sendFocus=!1;break;case 1005:this._logService.debug("DECRST 1005 not supported (see #2507)");break;case 1006:this._coreMouseService.activeEncoding="DEFAULT";break;case 1015:this._logService.debug("DECRST 1015 not supported (see #2507)");break;case 1016:this._coreMouseService.activeEncoding="DEFAULT";break;case 25:this._coreService.isCursorHidden=!0;break;case 1048:this.restoreCursor();break;case 1049:case 47:case 1047:this._bufferService.buffers.activateNormalBuffer(),e.params[n]===1049&&this.restoreCursor(),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(void 0),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!1;break;case 2026:this._coreService.decPrivateModes.synchronizedOutput=!1,this._onRequestRefreshRows.fire(void 0);break}return!0}requestMode(e,n){(v=>(v[v.NOT_RECOGNIZED=0]="NOT_RECOGNIZED",v[v.SET=1]="SET",v[v.RESET=2]="RESET",v[v.PERMANENTLY_SET=3]="PERMANENTLY_SET",v[v.PERMANENTLY_RESET=4]="PERMANENTLY_RESET"))(void 0||(r={}));let i=this._coreService.decPrivateModes,{activeProtocol:s,activeEncoding:a}=this._coreMouseService,o=this._coreService,{buffers:l,cols:u}=this._bufferService,{active:d,alt:p}=l,f=this._optionsService.rawOptions,g=(v,S)=>(o.triggerDataEvent(`${Fe.ESC}[${n?"":"?"}${v};${S}$y`),!0),_=v=>v?1:2,x=e.params[0];return n?x===2?g(x,4):x===4?g(x,_(o.modes.insertMode)):x===12?g(x,3):x===20?g(x,_(f.convertEol)):g(x,0):x===1?g(x,_(i.applicationCursorKeys)):x===3?g(x,f.windowOptions.setWinLines?u===80?2:u===132?1:0:0):x===6?g(x,_(i.origin)):x===7?g(x,_(i.wraparound)):x===8?g(x,3):x===9?g(x,_(s==="X10")):x===12?g(x,_(f.cursorBlink)):x===25?g(x,_(!o.isCursorHidden)):x===45?g(x,_(i.reverseWraparound)):x===66?g(x,_(i.applicationKeypad)):x===67?g(x,4):x===1e3?g(x,_(s==="VT200")):x===1002?g(x,_(s==="DRAG")):x===1003?g(x,_(s==="ANY")):x===1004?g(x,_(i.sendFocus)):x===1005?g(x,4):x===1006?g(x,_(a==="SGR")):x===1015?g(x,4):x===1016?g(x,_(a==="SGR_PIXELS")):x===1048?g(x,1):x===47||x===1047||x===1049?g(x,_(d===p)):x===2004?g(x,_(i.bracketedPasteMode)):x===2026?g(x,_(i.synchronizedOutput)):g(x,0)}_updateAttrColor(e,n,r,i,s){return n===2?(e|=50331648,e&=-16777216,e|=Nv.fromColorRGB([r,i,s])):n===5&&(e&=-50331904,e|=33554432|r&255),e}_extractColor(e,n,r){let i=[0,0,-1,0,0,0],s=0,a=0;do{if(i[a+s]=e.params[n+a],e.hasSubParams(n+a)){let o=e.getSubParams(n+a),l=0;do i[1]===5&&(s=1),i[a+l+1+s]=o[l];while(++l<o.length&&l+a+1+s<i.length);break}if(i[1]===5&&a+s>=2||i[1]===2&&a+s>=5)break;i[1]&&(s=1)}while(++a+n<e.length&&a+s<i.length);for(let o=2;o<i.length;++o)i[o]===-1&&(i[o]=0);switch(i[0]){case 38:r.fg=this._updateAttrColor(r.fg,i[1],i[3],i[4],i[5]);break;case 48:r.bg=this._updateAttrColor(r.bg,i[1],i[3],i[4],i[5]);break;case 58:r.extended=r.extended.clone(),r.extended.underlineColor=this._updateAttrColor(r.extended.underlineColor,i[1],i[3],i[4],i[5])}return a}_processUnderline(e,n){n.extended=n.extended.clone(),(!~e||e>5)&&(e=1),n.extended.underlineStyle=e,n.fg|=268435456,e===0&&(n.fg&=-268435457),n.updateExtended()}_processSGR0(e){e.fg=Vr.fg,e.bg=Vr.bg,e.extended=e.extended.clone(),e.extended.underlineStyle=0,e.extended.underlineColor&=-67108864,e.updateExtended()}charAttributes(e){if(e.length===1&&e.params[0]===0)return this._processSGR0(this._curAttrData),!0;let n=e.length,r,i=this._curAttrData;for(let s=0;s<n;s++)r=e.params[s],r>=30&&r<=37?(i.fg&=-50331904,i.fg|=16777216|r-30):r>=40&&r<=47?(i.bg&=-50331904,i.bg|=16777216|r-40):r>=90&&r<=97?(i.fg&=-50331904,i.fg|=16777216|r-90|8):r>=100&&r<=107?(i.bg&=-50331904,i.bg|=16777216|r-100|8):r===0?this._processSGR0(i):r===1?i.fg|=134217728:r===3?i.bg|=67108864:r===4?(i.fg|=268435456,this._processUnderline(e.hasSubParams(s)?e.getSubParams(s)[0]:1,i)):r===5?i.fg|=536870912:r===7?i.fg|=67108864:r===8?i.fg|=1073741824:r===9?i.fg|=2147483648:r===2?i.bg|=134217728:r===21?this._processUnderline(2,i):r===22?(i.fg&=-134217729,i.bg&=-134217729):r===23?i.bg&=-67108865:r===24?(i.fg&=-268435457,this._processUnderline(0,i)):r===25?i.fg&=-536870913:r===27?i.fg&=-67108865:r===28?i.fg&=-1073741825:r===29?i.fg&=2147483647:r===39?(i.fg&=-67108864,i.fg|=Vr.fg&16777215):r===49?(i.bg&=-67108864,i.bg|=Vr.bg&16777215):r===38||r===48||r===58?s+=this._extractColor(e,s,i):r===53?i.bg|=1073741824:r===55?i.bg&=-1073741825:r===59?(i.extended=i.extended.clone(),i.extended.underlineColor=-1,i.updateExtended()):r===100?(i.fg&=-67108864,i.fg|=Vr.fg&16777215,i.bg&=-67108864,i.bg|=Vr.bg&16777215):this._logService.debug("Unknown SGR attribute: %d.",r);return!0}deviceStatus(e){switch(e.params[0]){case 5:this._coreService.triggerDataEvent(`${Fe.ESC}[0n`);break;case 6:let n=this._activeBuffer.y+1,r=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${Fe.ESC}[${n};${r}R`);break}return!0}deviceStatusPrivate(e){switch(e.params[0]){case 6:let n=this._activeBuffer.y+1,r=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${Fe.ESC}[?${n};${r}R`);break}return!0}softReset(e){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=Vr.clone(),this._coreService.reset(),this._charsetService.reset(),this._activeBuffer.savedX=0,this._activeBuffer.savedY=this._activeBuffer.ybase,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,this._coreService.decPrivateModes.origin=!1,!0}setCursorStyle(e){let n=e.length===0?1:e.params[0];if(n===0)this._coreService.decPrivateModes.cursorStyle=void 0,this._coreService.decPrivateModes.cursorBlink=void 0;else{switch(n){case 1:case 2:this._coreService.decPrivateModes.cursorStyle="block";break;case 3:case 4:this._coreService.decPrivateModes.cursorStyle="underline";break;case 5:case 6:this._coreService.decPrivateModes.cursorStyle="bar";break}let r=n%2===1;this._coreService.decPrivateModes.cursorBlink=r}return!0}setScrollRegion(e){let n=e.params[0]||1,r;return(e.length<2||(r=e.params[1])>this._bufferService.rows||r===0)&&(r=this._bufferService.rows),r>n&&(this._activeBuffer.scrollTop=n-1,this._activeBuffer.scrollBottom=r-1,this._setCursor(0,0)),!0}windowOptions(e){if(!y4(e.params[0],this._optionsService.rawOptions.windowOptions))return!0;let n=e.length>1?e.params[1]:0;switch(e.params[0]){case 14:n!==2&&this._onRequestWindowsOptionsReport.fire(0);break;case 16:this._onRequestWindowsOptionsReport.fire(1);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`${Fe.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:(n===0||n===2)&&(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>v4&&this._windowTitleStack.shift()),(n===0||n===1)&&(this._iconNameStack.push(this._iconName),this._iconNameStack.length>v4&&this._iconNameStack.shift());break;case 23:(n===0||n===2)&&this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),(n===0||n===1)&&this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop());break}return!0}saveCursor(e){return this._activeBuffer.savedX=this._activeBuffer.x,this._activeBuffer.savedY=this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,!0}restoreCursor(e){return this._activeBuffer.x=this._activeBuffer.savedX||0,this._activeBuffer.y=Math.max(this._activeBuffer.savedY-this._activeBuffer.ybase,0),this._curAttrData.fg=this._activeBuffer.savedCurAttrData.fg,this._curAttrData.bg=this._activeBuffer.savedCurAttrData.bg,this._charsetService.charset=this._savedCharset,this._activeBuffer.savedCharset&&(this._charsetService.charset=this._activeBuffer.savedCharset),this._restrictCursor(),!0}setTitle(e){return this._windowTitle=e,this._onTitleChange.fire(e),!0}setIconName(e){return this._iconName=e,!0}setOrReportIndexedColor(e){let n=[],r=e.split(";");for(;r.length>1;){let i=r.shift(),s=r.shift();if(/^\d+$/.exec(i)){let a=parseInt(i);if(b4(a))if(s==="?")n.push({type:0,index:a});else{let o=g4(s);o&&n.push({type:1,index:a,color:o})}}}return n.length&&this._onColor.fire(n),!0}setHyperlink(e){let n=e.indexOf(";");if(n===-1)return!0;let r=e.slice(0,n).trim(),i=e.slice(n+1);return i?this._createHyperlink(r,i):r.trim()?!1:this._finishHyperlink()}_createHyperlink(e,n){this._getCurrentLinkId()&&this._finishHyperlink();let r=e.split(":"),i,s=r.findIndex(a=>a.startsWith("id="));return s!==-1&&(i=r[s].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:i,uri:n}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(e,n){let r=e.split(";");for(let i=0;i<r.length&&!(n>=this._specialColors.length);++i,++n)if(r[i]==="?")this._onColor.fire([{type:0,index:this._specialColors[n]}]);else{let s=g4(r[i]);s&&this._onColor.fire([{type:1,index:this._specialColors[n],color:s}])}return!0}setOrReportFgColor(e){return this._setOrReportSpecialColor(e,0)}setOrReportBgColor(e){return this._setOrReportSpecialColor(e,1)}setOrReportCursorColor(e){return this._setOrReportSpecialColor(e,2)}restoreIndexedColor(e){if(!e)return this._onColor.fire([{type:2}]),!0;let n=[],r=e.split(";");for(let i=0;i<r.length;++i)if(/^\d+$/.exec(r[i])){let s=parseInt(r[i]);b4(s)&&n.push({type:2,index:s})}return n.length&&this._onColor.fire(n),!0}restoreFgColor(e){return this._onColor.fire([{type:2,index:256}]),!0}restoreBgColor(e){return this._onColor.fire([{type:2,index:257}]),!0}restoreCursorColor(e){return this._onColor.fire([{type:2,index:258}]),!0}nextLine(){return this._activeBuffer.x=0,this.index(),!0}keypadApplicationMode(){return this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire(),!0}keypadNumericMode(){return this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire(),!0}selectDefaultCharset(){return this._charsetService.setgLevel(0),this._charsetService.setgCharset(0,rd),!0}selectCharset(e){return e.length!==2?(this.selectDefaultCharset(),!0):(e[0]==="/"||this._charsetService.setgCharset(die[e[0]],ai[e[1]]||rd),!0)}index(){return this._restrictCursor(),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._restrictCursor(),!0}tabSet(){return this._activeBuffer.tabs[this._activeBuffer.x]=!0,!0}reverseIndex(){if(this._restrictCursor(),this._activeBuffer.y===this._activeBuffer.scrollTop){let e=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,e,1),this._activeBuffer.lines.set(this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.getBlankLine(this._eraseAttrData())),this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom)}else this._activeBuffer.y--,this._restrictCursor();return!0}fullReset(){return this._parser.reset(),this._onRequestReset.fire(),!0}reset(){this._curAttrData=Vr.clone(),this._eraseAttrDataInternal=Vr.clone()}_eraseAttrData(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=this._curAttrData.bg&67108863,this._eraseAttrDataInternal}setgLevel(e){return this._charsetService.setgLevel(e),!0}screenAlignmentPattern(){let e=new Ma;e.content=1<<22|69,e.fg=this._curAttrData.fg,e.bg=this._curAttrData.bg,this._setCursor(0,0);for(let n=0;n<this._bufferService.rows;++n){let r=this._activeBuffer.ybase+this._activeBuffer.y+n,i=this._activeBuffer.lines.get(r);i&&(i.fill(e),i.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(e,n){let r=o=>(this._coreService.triggerDataEvent(`${Fe.ESC}${o}${Fe.ESC}\\`),!0),i=this._bufferService.buffer,s=this._optionsService.rawOptions;return r(e==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:e==='"p'?'P1$r61;1"p':e==="r"?`P1$r${i.scrollTop+1};${i.scrollBottom+1}r`:e==="m"?"P1$r0m":e===" q"?`P1$r${{block:2,underline:4,bar:6}[s.cursorStyle]-(s.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(e,n){this._dirtyRowTracker.markRangeDirty(e,n)}},pj=class{constructor(e){this._bufferService=e,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty(e){e<this.start?this.start=e:e>this.end&&(this.end=e)}markRangeDirty(e,n){e>n&&(x4=e,e=n,n=x4),e<this.start&&(this.start=e),n>this.end&&(this.end=n)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};pj=Dr([vt(0,cs)],pj);function b4(e){return 0<=e&&e<256}var fie=5e7,k4=12,pie=50,mie=class extends sn{constructor(e){super(),this._action=e,this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0,this._isSyncWriting=!1,this._syncCalls=0,this._didUserInput=!1,this._onWriteParsed=this._register(new nt),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(e,n){if(n!==void 0&&this._syncCalls>n){this._syncCalls=0;return}if(this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;this._isSyncWriting=!0;let r;for(;r=this._writeBuffer.shift();){this._action(r);let i=this._callbacks.shift();i&&i()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(e,n){if(this._pendingData>fie)throw new Error("write data discarded, use flow control to avoid losing data");if(!this._writeBuffer.length){if(this._bufferOffset=0,this._didUserInput){this._didUserInput=!1,this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(n),this._innerWrite();return}setTimeout(()=>this._innerWrite())}this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(n)}_innerWrite(e=0,n=!0){let r=e||performance.now();for(;this._writeBuffer.length>this._bufferOffset;){let i=this._writeBuffer[this._bufferOffset],s=this._action(i,n);if(s){let o=l=>performance.now()-r>=k4?setTimeout(()=>this._innerWrite(0,l)):this._innerWrite(r,l);s.catch(l=>(queueMicrotask(()=>{throw l}),Promise.resolve(!1))).then(o);return}let a=this._callbacks[this._bufferOffset];if(a&&a(),this._bufferOffset++,this._pendingData-=i.length,performance.now()-r>=k4)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>pie&&(this._writeBuffer=this._writeBuffer.slice(this._bufferOffset),this._callbacks=this._callbacks.slice(this._bufferOffset),this._bufferOffset=0),setTimeout(()=>this._innerWrite())):(this._writeBuffer.length=0,this._callbacks.length=0,this._pendingData=0,this._bufferOffset=0),this._onWriteParsed.fire()}},mj=class{constructor(e){this._bufferService=e,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(e){let n=this._bufferService.buffer;if(e.id===void 0){let l=n.addMarker(n.ybase+n.y),u={data:e,id:this._nextId++,lines:[l]};return l.onDispose(()=>this._removeMarkerFromLink(u,l)),this._dataByLinkId.set(u.id,u),u.id}let r=e,i=this._getEntryIdKey(r),s=this._entriesWithId.get(i);if(s)return this.addLineToLink(s.id,n.ybase+n.y),s.id;let a=n.addMarker(n.ybase+n.y),o={id:this._nextId++,key:this._getEntryIdKey(r),data:r,lines:[a]};return a.onDispose(()=>this._removeMarkerFromLink(o,a)),this._entriesWithId.set(o.key,o),this._dataByLinkId.set(o.id,o),o.id}addLineToLink(e,n){let r=this._dataByLinkId.get(e);if(r&&r.lines.every(i=>i.line!==n)){let i=this._bufferService.buffer.addMarker(n);r.lines.push(i),i.onDispose(()=>this._removeMarkerFromLink(r,i))}}getLinkData(e){var n;return(n=this._dataByLinkId.get(e))==null?void 0:n.data}_getEntryIdKey(e){return`${e.id};;${e.uri}`}_removeMarkerFromLink(e,n){let r=e.lines.indexOf(n);r!==-1&&(e.lines.splice(r,1),e.lines.length===0&&(e.data.id!==void 0&&this._entriesWithId.delete(e.key),this._dataByLinkId.delete(e.id)))}};mj=Dr([vt(0,cs)],mj);var w4=!1,gie=class extends sn{constructor(e){super(),this._windowsWrappingHeuristics=this._register(new Pf),this._onBinary=this._register(new nt),this.onBinary=this._onBinary.event,this._onData=this._register(new nt),this.onData=this._onData.event,this._onLineFeed=this._register(new nt),this.onLineFeed=this._onLineFeed.event,this._onResize=this._register(new nt),this.onResize=this._onResize.event,this._onWriteParsed=this._register(new nt),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this._register(new nt),this._instantiationService=new $re,this.optionsService=this._register(new Xre(e)),this._instantiationService.setService(us,this.optionsService),this._bufferService=this._register(this._instantiationService.createInstance(uj)),this._instantiationService.setService(cs,this._bufferService),this._logService=this._register(this._instantiationService.createInstance(cj)),this._instantiationService.setService(Yz,this._logService),this.coreService=this._register(this._instantiationService.createInstance(dj)),this._instantiationService.setService(qd,this.coreService),this.coreMouseService=this._register(this._instantiationService.createInstance(hj)),this._instantiationService.setService(Vz,this.coreMouseService),this.unicodeService=this._register(this._instantiationService.createInstance(pd)),this._instantiationService.setService(Lte,this.unicodeService),this._charsetService=this._instantiationService.createInstance(tie),this._instantiationService.setService(Pte,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(mj),this._instantiationService.setService(Gz,this._oscLinkService),this._inputHandler=this._register(new hie(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this._register(Ti.forward(this._inputHandler.onLineFeed,this._onLineFeed)),this._register(this._inputHandler),this._register(Ti.forward(this._bufferService.onResize,this._onResize)),this._register(Ti.forward(this.coreService.onData,this._onData)),this._register(Ti.forward(this.coreService.onBinary,this._onBinary)),this._register(this.coreService.onRequestScrollToBottom(()=>this.scrollToBottom(!0))),this._register(this.coreService.onUserInput(()=>this._writeBuffer.handleUserInput())),this._register(this.optionsService.onMultipleOptionChange(["windowsMode","windowsPty"],()=>this._handleWindowsPtyOptionChange())),this._register(this._bufferService.onScroll(()=>{this._onScroll.fire({position:this._bufferService.buffer.ydisp}),this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop,this._bufferService.buffer.scrollBottom)})),this._writeBuffer=this._register(new mie((n,r)=>this._inputHandler.parse(n,r))),this._register(Ti.forward(this._writeBuffer.onWriteParsed,this._onWriteParsed))}get onScroll(){return this._onScrollApi||(this._onScrollApi=this._register(new nt),this._onScroll.event(e=>{var n;(n=this._onScrollApi)==null||n.fire(e.position)})),this._onScrollApi.event}get cols(){return this._bufferService.cols}get rows(){return this._bufferService.rows}get buffers(){return this._bufferService.buffers}get options(){return this.optionsService.options}set options(e){for(let n in e)this.optionsService.options[n]=e[n]}write(e,n){this._writeBuffer.write(e,n)}writeSync(e,n){this._logService.logLevel<=3&&!w4&&(this._logService.warn("writeSync is unreliable and will be removed soon."),w4=!0),this._writeBuffer.writeSync(e,n)}input(e,n=!0){this.coreService.triggerDataEvent(e,n)}resize(e,n){isNaN(e)||isNaN(n)||(e=Math.max(e,N9),n=Math.max(n,E9),this._bufferService.resize(e,n))}scroll(e,n=!1){this._bufferService.scroll(e,n)}scrollLines(e,n){this._bufferService.scrollLines(e,n)}scrollPages(e){this.scrollLines(e*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(e){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(e){let n=e-this._bufferService.buffer.ydisp;n!==0&&this.scrollLines(n)}registerEscHandler(e,n){return this._inputHandler.registerEscHandler(e,n)}registerDcsHandler(e,n){return this._inputHandler.registerDcsHandler(e,n)}registerCsiHandler(e,n){return this._inputHandler.registerCsiHandler(e,n)}registerOscHandler(e,n){return this._inputHandler.registerOscHandler(e,n)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let e=!1,n=this.optionsService.rawOptions.windowsPty;n&&n.buildNumber!==void 0&&n.buildNumber!==void 0?e=n.backend==="conpty"&&n.buildNumber<21376:this.optionsService.rawOptions.windowsMode&&(e=!0),e?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){let e=[];e.push(this.onLineFeed(p4.bind(null,this._bufferService))),e.push(this.registerCsiHandler({final:"H"},()=>(p4(this._bufferService),!1))),this._windowsWrappingHeuristics.value=br(()=>{for(let n of e)n.dispose()})}}},vie={48:["0",")"],49:["1","!"],50:["2","@"],51:["3","#"],52:["4","$"],53:["5","%"],54:["6","^"],55:["7","&"],56:["8","*"],57:["9","("],186:[";",":"],187:["=","+"],188:[",","<"],189:["-","_"],190:[".",">"],191:["/","?"],192:["`","~"],219:["[","{"],220:["\\","|"],221:["]","}"],222:["'",'"']};function yie(e,n,r,i){var o;let s={type:0,cancel:!1,key:void 0},a=(e.shiftKey?1:0)|(e.altKey?2:0)|(e.ctrlKey?4:0)|(e.metaKey?8:0);switch(e.keyCode){case 0:e.key==="UIKeyInputUpArrow"?n?s.key=Fe.ESC+"OA":s.key=Fe.ESC+"[A":e.key==="UIKeyInputLeftArrow"?n?s.key=Fe.ESC+"OD":s.key=Fe.ESC+"[D":e.key==="UIKeyInputRightArrow"?n?s.key=Fe.ESC+"OC":s.key=Fe.ESC+"[C":e.key==="UIKeyInputDownArrow"&&(n?s.key=Fe.ESC+"OB":s.key=Fe.ESC+"[B");break;case 8:s.key=e.ctrlKey?"\b":Fe.DEL,e.altKey&&(s.key=Fe.ESC+s.key);break;case 9:if(e.shiftKey){s.key=Fe.ESC+"[Z";break}s.key=Fe.HT,s.cancel=!0;break;case 13:s.key=e.altKey?Fe.ESC+Fe.CR:Fe.CR,s.cancel=!0;break;case 27:s.key=Fe.ESC,e.altKey&&(s.key=Fe.ESC+Fe.ESC),s.cancel=!0;break;case 37:if(e.metaKey)break;a?s.key=Fe.ESC+"[1;"+(a+1)+"D":n?s.key=Fe.ESC+"OD":s.key=Fe.ESC+"[D";break;case 39:if(e.metaKey)break;a?s.key=Fe.ESC+"[1;"+(a+1)+"C":n?s.key=Fe.ESC+"OC":s.key=Fe.ESC+"[C";break;case 38:if(e.metaKey)break;a?s.key=Fe.ESC+"[1;"+(a+1)+"A":n?s.key=Fe.ESC+"OA":s.key=Fe.ESC+"[A";break;case 40:if(e.metaKey)break;a?s.key=Fe.ESC+"[1;"+(a+1)+"B":n?s.key=Fe.ESC+"OB":s.key=Fe.ESC+"[B";break;case 45:!e.shiftKey&&!e.ctrlKey&&(s.key=Fe.ESC+"[2~");break;case 46:a?s.key=Fe.ESC+"[3;"+(a+1)+"~":s.key=Fe.ESC+"[3~";break;case 36:a?s.key=Fe.ESC+"[1;"+(a+1)+"H":n?s.key=Fe.ESC+"OH":s.key=Fe.ESC+"[H";break;case 35:a?s.key=Fe.ESC+"[1;"+(a+1)+"F":n?s.key=Fe.ESC+"OF":s.key=Fe.ESC+"[F";break;case 33:e.shiftKey?s.type=2:e.ctrlKey?s.key=Fe.ESC+"[5;"+(a+1)+"~":s.key=Fe.ESC+"[5~";break;case 34:e.shiftKey?s.type=3:e.ctrlKey?s.key=Fe.ESC+"[6;"+(a+1)+"~":s.key=Fe.ESC+"[6~";break;case 112:a?s.key=Fe.ESC+"[1;"+(a+1)+"P":s.key=Fe.ESC+"OP";break;case 113:a?s.key=Fe.ESC+"[1;"+(a+1)+"Q":s.key=Fe.ESC+"OQ";break;case 114:a?s.key=Fe.ESC+"[1;"+(a+1)+"R":s.key=Fe.ESC+"OR";break;case 115:a?s.key=Fe.ESC+"[1;"+(a+1)+"S":s.key=Fe.ESC+"OS";break;case 116:a?s.key=Fe.ESC+"[15;"+(a+1)+"~":s.key=Fe.ESC+"[15~";break;case 117:a?s.key=Fe.ESC+"[17;"+(a+1)+"~":s.key=Fe.ESC+"[17~";break;case 118:a?s.key=Fe.ESC+"[18;"+(a+1)+"~":s.key=Fe.ESC+"[18~";break;case 119:a?s.key=Fe.ESC+"[19;"+(a+1)+"~":s.key=Fe.ESC+"[19~";break;case 120:a?s.key=Fe.ESC+"[20;"+(a+1)+"~":s.key=Fe.ESC+"[20~";break;case 121:a?s.key=Fe.ESC+"[21;"+(a+1)+"~":s.key=Fe.ESC+"[21~";break;case 122:a?s.key=Fe.ESC+"[23;"+(a+1)+"~":s.key=Fe.ESC+"[23~";break;case 123:a?s.key=Fe.ESC+"[24;"+(a+1)+"~":s.key=Fe.ESC+"[24~";break;default:if(e.ctrlKey&&!e.shiftKey&&!e.altKey&&!e.metaKey)e.keyCode>=65&&e.keyCode<=90?s.key=String.fromCharCode(e.keyCode-64):e.keyCode===32?s.key=Fe.NUL:e.keyCode>=51&&e.keyCode<=55?s.key=String.fromCharCode(e.keyCode-51+27):e.keyCode===56?s.key=Fe.DEL:e.keyCode===219?s.key=Fe.ESC:e.keyCode===220?s.key=Fe.FS:e.keyCode===221&&(s.key=Fe.GS);else if((!r||i)&&e.altKey&&!e.metaKey){let l=(o=vie[e.keyCode])==null?void 0:o[e.shiftKey?1:0];if(l)s.key=Fe.ESC+l;else if(e.keyCode>=65&&e.keyCode<=90){let u=e.ctrlKey?e.keyCode-64:e.keyCode+32,d=String.fromCharCode(u);e.shiftKey&&(d=d.toUpperCase()),s.key=Fe.ESC+d}else if(e.keyCode===32)s.key=Fe.ESC+(e.ctrlKey?Fe.NUL:" ");else if(e.key==="Dead"&&e.code.startsWith("Key")){let u=e.code.slice(3,4);e.shiftKey||(u=u.toLowerCase()),s.key=Fe.ESC+u,s.cancel=!0}}else r&&!e.altKey&&!e.ctrlKey&&!e.shiftKey&&e.metaKey?e.keyCode===65&&(s.type=1):e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.keyCode>=48&&e.key.length===1?s.key=e.key:e.key&&e.ctrlKey&&(e.key==="_"&&(s.key=Fe.US),e.key==="@"&&(s.key=Fe.NUL));break}return s}var Ir=0,_ie=class{constructor(e){this._getKey=e,this._array=[],this._insertedValues=[],this._flushInsertedTask=new ob,this._isFlushingInserted=!1,this._deletedIndices=[],this._flushDeletedTask=new ob,this._isFlushingDeleted=!1}clear(){this._array.length=0,this._insertedValues.length=0,this._flushInsertedTask.clear(),this._isFlushingInserted=!1,this._deletedIndices.length=0,this._flushDeletedTask.clear(),this._isFlushingDeleted=!1}insert(e){this._flushCleanupDeleted(),this._insertedValues.length===0&&this._flushInsertedTask.enqueue(()=>this._flushInserted()),this._insertedValues.push(e)}_flushInserted(){let e=this._insertedValues.sort((s,a)=>this._getKey(s)-this._getKey(a)),n=0,r=0,i=new Array(this._array.length+this._insertedValues.length);for(let s=0;s<i.length;s++)r>=this._array.length||this._getKey(e[n])<=this._getKey(this._array[r])?(i[s]=e[n],n++):i[s]=this._array[r++];this._array=i,this._insertedValues.length=0}_flushCleanupInserted(){!this._isFlushingInserted&&this._insertedValues.length>0&&this._flushInsertedTask.flush()}delete(e){if(this._flushCleanupInserted(),this._array.length===0)return!1;let n=this._getKey(e);if(n===void 0||(Ir=this._search(n),Ir===-1)||this._getKey(this._array[Ir])!==n)return!1;do if(this._array[Ir]===e)return this._deletedIndices.length===0&&this._flushDeletedTask.enqueue(()=>this._flushDeleted()),this._deletedIndices.push(Ir),!0;while(++Ir<this._array.length&&this._getKey(this._array[Ir])===n);return!1}_flushDeleted(){this._isFlushingDeleted=!0;let e=this._deletedIndices.sort((s,a)=>s-a),n=0,r=new Array(this._array.length-e.length),i=0;for(let s=0;s<this._array.length;s++)e[n]===s?n++:r[i++]=this._array[s];this._array=r,this._deletedIndices.length=0,this._isFlushingDeleted=!1}_flushCleanupDeleted(){!this._isFlushingDeleted&&this._deletedIndices.length>0&&this._flushDeletedTask.flush()}*getKeyIterator(e){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(Ir=this._search(e),!(Ir<0||Ir>=this._array.length)&&this._getKey(this._array[Ir])===e))do yield this._array[Ir];while(++Ir<this._array.length&&this._getKey(this._array[Ir])===e)}forEachByKey(e,n){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(Ir=this._search(e),!(Ir<0||Ir>=this._array.length)&&this._getKey(this._array[Ir])===e))do n(this._array[Ir]);while(++Ir<this._array.length&&this._getKey(this._array[Ir])===e)}values(){return this._flushCleanupInserted(),this._flushCleanupDeleted(),[...this._array].values()}_search(e){let n=0,r=this._array.length-1;for(;r>=n;){let i=n+r>>1,s=this._getKey(this._array[i]);if(s>e)r=i-1;else if(s<e)n=i+1;else{for(;i>0&&this._getKey(this._array[i-1])===e;)i--;return i}}return n}},Jw=0,S4=0,xie=class extends sn{constructor(){super(),this._decorations=new _ie(e=>e==null?void 0:e.marker.line),this._onDecorationRegistered=this._register(new nt),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this._register(new nt),this.onDecorationRemoved=this._onDecorationRemoved.event,this._register(br(()=>this.reset()))}get decorations(){return this._decorations.values()}registerDecoration(e){if(e.marker.isDisposed)return;let n=new bie(e);if(n){let r=n.marker.onDispose(()=>n.dispose()),i=n.onDispose(()=>{i.dispose(),n&&(this._decorations.delete(n)&&this._onDecorationRemoved.fire(n),r.dispose())});this._decorations.insert(n),this._onDecorationRegistered.fire(n)}return n}reset(){for(let e of this._decorations.values())e.dispose();this._decorations.clear()}*getDecorationsAtCell(e,n,r){let i=0,s=0;for(let a of this._decorations.getKeyIterator(n))i=a.options.x??0,s=i+(a.options.width??1),e>=i&&e<s&&(!r||(a.options.layer??"bottom")===r)&&(yield a)}forEachDecorationAtCell(e,n,r,i){this._decorations.forEachByKey(n,s=>{Jw=s.options.x??0,S4=Jw+(s.options.width??1),e>=Jw&&e<S4&&(!r||(s.options.layer??"bottom")===r)&&i(s)})}},bie=class extends iu{constructor(e){super(),this.options=e,this.onRenderEmitter=this.add(new nt),this.onRender=this.onRenderEmitter.event,this._onDispose=this.add(new nt),this.onDispose=this._onDispose.event,this._cachedBg=null,this._cachedFg=null,this.marker=e.marker,this.options.overviewRulerOptions&&!this.options.overviewRulerOptions.position&&(this.options.overviewRulerOptions.position="full")}get backgroundColorRGB(){return this._cachedBg===null&&(this.options.backgroundColor?this._cachedBg=Sr.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this.options.foregroundColor?this._cachedFg=Sr.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}dispose(){this._onDispose.fire(),super.dispose()}},kie=1e3,wie=class{constructor(e,n=kie){this._renderCallback=e,this._debounceThresholdMS=n,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(e,n,r){this._rowCount=r,e=e!==void 0?e:0,n=n!==void 0?n:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,e):e,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,n):n;let i=performance.now();if(i-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=i,this._innerRefresh();else if(!this._additionalRefreshRequested){let s=i-this._lastRefreshMs,a=this._debounceThresholdMS-s;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout(()=>{this._lastRefreshMs=performance.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0},a)}}_innerRefresh(){if(this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return;let e=Math.max(this._rowStart,0),n=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(e,n)}},C4=20,lb=class extends sn{constructor(e,n,r,i){super(),this._terminal=e,this._coreBrowserService=r,this._renderService=i,this._rowColumns=new WeakMap,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce="";let s=this._coreBrowserService.mainDocument;this._accessibilityContainer=s.createElement("div"),this._accessibilityContainer.classList.add("xterm-accessibility"),this._rowContainer=s.createElement("div"),this._rowContainer.setAttribute("role","list"),this._rowContainer.classList.add("xterm-accessibility-tree"),this._rowElements=[];for(let a=0;a<this._terminal.rows;a++)this._rowElements[a]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[a]);if(this._topBoundaryFocusListener=a=>this._handleBoundaryFocus(a,0),this._bottomBoundaryFocusListener=a=>this._handleBoundaryFocus(a,1),this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._accessibilityContainer.appendChild(this._rowContainer),this._liveRegion=s.createElement("div"),this._liveRegion.classList.add("live-region"),this._liveRegion.setAttribute("aria-live","assertive"),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this._register(new wie(this._renderRows.bind(this))),!this._terminal.element)throw new Error("Cannot enable accessibility before Terminal.open");this._terminal.element.insertAdjacentElement("afterbegin",this._accessibilityContainer),this._register(this._terminal.onResize(a=>this._handleResize(a.rows))),this._register(this._terminal.onRender(a=>this._refreshRows(a.start,a.end))),this._register(this._terminal.onScroll(()=>this._refreshRows())),this._register(this._terminal.onA11yChar(a=>this._handleChar(a))),this._register(this._terminal.onLineFeed(()=>this._handleChar(`
`))),this._register(this._terminal.onA11yTab(a=>this._handleTab(a))),this._register(this._terminal.onKey(a=>this._handleKey(a.key))),this._register(this._terminal.onBlur(()=>this._clearLiveRegion())),this._register(this._renderService.onDimensionsChange(()=>this._refreshRowsDimensions())),this._register(Ut(s,"selectionchange",()=>this._handleSelectionChange())),this._register(this._coreBrowserService.onDprChange(()=>this._refreshRowsDimensions())),this._refreshRowsDimensions(),this._refreshRows(),this._register(br(()=>{this._accessibilityContainer.remove(),this._rowElements.length=0}))}_handleTab(e){for(let n=0;n<e;n++)this._handleChar(" ")}_handleChar(e){this._liveRegionLineCount<C4+1&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==e&&(this._charsToAnnounce+=e):this._charsToAnnounce+=e,e===`
`&&(this._liveRegionLineCount++,this._liveRegionLineCount===C4+1&&(this._liveRegion.textContent+=PC.get())))}_clearLiveRegion(){this._liveRegion.textContent="",this._liveRegionLineCount=0}_handleKey(e){this._clearLiveRegion(),new RegExp("\\p{Control}","u").test(e)||this._charsToConsume.push(e)}_refreshRows(e,n){this._liveRegionDebouncer.refresh(e,n,this._terminal.rows)}_renderRows(e,n){let r=this._terminal.buffer,i=r.lines.length.toString();for(let s=e;s<=n;s++){let a=r.lines.get(r.ydisp+s),o=[],l=(a==null?void 0:a.translateToString(!0,void 0,void 0,o))||"",u=(r.ydisp+s+1).toString(),d=this._rowElements[s];d&&(l.length===0?(d.textContent=" ",this._rowColumns.set(d,[0,1])):(d.textContent=l,this._rowColumns.set(d,o)),d.setAttribute("aria-posinset",u),d.setAttribute("aria-setsize",i),this._alignRowWidth(d))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(e,n){let r=e.target,i=this._rowElements[n===0?1:this._rowElements.length-2],s=r.getAttribute("aria-posinset"),a=n===0?"1":`${this._terminal.buffer.lines.length}`;if(s===a||e.relatedTarget!==i)return;let o,l;if(n===0?(o=r,l=this._rowElements.pop(),this._rowContainer.removeChild(l)):(o=this._rowElements.shift(),l=r,this._rowContainer.removeChild(o)),o.removeEventListener("focus",this._topBoundaryFocusListener),l.removeEventListener("focus",this._bottomBoundaryFocusListener),n===0){let u=this._createAccessibilityTreeNode();this._rowElements.unshift(u),this._rowContainer.insertAdjacentElement("afterbegin",u)}else{let u=this._createAccessibilityTreeNode();this._rowElements.push(u),this._rowContainer.appendChild(u)}this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._terminal.scrollLines(n===0?-1:1),this._rowElements[n===0?1:this._rowElements.length-2].focus(),e.preventDefault(),e.stopImmediatePropagation()}_handleSelectionChange(){var l;if(this._rowElements.length===0)return;let e=this._coreBrowserService.mainDocument.getSelection();if(!e)return;if(e.isCollapsed){this._rowContainer.contains(e.anchorNode)&&this._terminal.clearSelection();return}if(!e.anchorNode||!e.focusNode){console.error("anchorNode and/or focusNode are null");return}let n={node:e.anchorNode,offset:e.anchorOffset},r={node:e.focusNode,offset:e.focusOffset};if((n.node.compareDocumentPosition(r.node)&Node.DOCUMENT_POSITION_PRECEDING||n.node===r.node&&n.offset>r.offset)&&([n,r]=[r,n]),n.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(n={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(n.node))return;let i=this._rowElements.slice(-1)[0];if(r.node.compareDocumentPosition(i)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(r={node:i,offset:((l=i.textContent)==null?void 0:l.length)??0}),!this._rowContainer.contains(r.node))return;let s=({node:u,offset:d})=>{let p=u instanceof Text?u.parentNode:u,f=parseInt(p==null?void 0:p.getAttribute("aria-posinset"),10)-1;if(isNaN(f))return console.warn("row is invalid. Race condition?"),null;let g=this._rowColumns.get(p);if(!g)return console.warn("columns is null. Race condition?"),null;let _=d<g.length?g[d]:g.slice(-1)[0]+1;return _>=this._terminal.cols&&(++f,_=0),{row:f,column:_}},a=s(n),o=s(r);if(!(!a||!o)){if(a.row>o.row||a.row===o.row&&a.column>=o.column)throw new Error("invalid range");this._terminal.select(a.column,a.row,(o.row-a.row)*this._terminal.cols-a.column+o.column)}}_handleResize(e){this._rowElements[this._rowElements.length-1].removeEventListener("focus",this._bottomBoundaryFocusListener);for(let n=this._rowContainer.children.length;n<this._terminal.rows;n++)this._rowElements[n]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[n]);for(;this._rowElements.length>e;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){let e=this._coreBrowserService.mainDocument.createElement("div");return e.setAttribute("role","listitem"),e.tabIndex=-1,this._refreshRowDimensions(e),e}_refreshRowsDimensions(){if(this._renderService.dimensions.css.cell.height){Object.assign(this._accessibilityContainer.style,{width:`${this._renderService.dimensions.css.canvas.width}px`,fontSize:`${this._terminal.options.fontSize}px`}),this._rowElements.length!==this._terminal.rows&&this._handleResize(this._terminal.rows);for(let e=0;e<this._terminal.rows;e++)this._refreshRowDimensions(this._rowElements[e]),this._alignRowWidth(this._rowElements[e])}}_refreshRowDimensions(e){e.style.height=`${this._renderService.dimensions.css.cell.height}px`}_alignRowWidth(e){var s,a;e.style.transform="";let n=e.getBoundingClientRect().width,r=(a=(s=this._rowColumns.get(e))==null?void 0:s.slice(-1))==null?void 0:a[0];if(!r)return;let i=r*this._renderService.dimensions.css.cell.width;e.style.transform=`scaleX(${i/n})`}};lb=Dr([vt(1,GE),vt(2,ic),vt(3,sc)],lb);var gj=class extends sn{constructor(e,n,r,i,s){super(),this._element=e,this._mouseService=n,this._renderService=r,this._bufferService=i,this._linkProviderService=s,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this._register(new nt),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this._register(new nt),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this._register(br(()=>{var a;Md(this._linkCacheDisposables),this._linkCacheDisposables.length=0,this._lastMouseEvent=void 0,(a=this._activeProviderReplies)==null||a.clear()})),this._register(this._bufferService.onResize(()=>{this._clearCurrentLink(),this._wasResized=!0})),this._register(Ut(this._element,"mouseleave",()=>{this._isMouseOut=!0,this._clearCurrentLink()})),this._register(Ut(this._element,"mousemove",this._handleMouseMove.bind(this))),this._register(Ut(this._element,"mousedown",this._handleMouseDown.bind(this))),this._register(Ut(this._element,"mouseup",this._handleMouseUp.bind(this)))}get currentLink(){return this._currentLink}_handleMouseMove(e){this._lastMouseEvent=e;let n=this._positionFromMouseEvent(e,this._element,this._mouseService);if(!n)return;this._isMouseOut=!1;let r=e.composedPath();for(let i=0;i<r.length;i++){let s=r[i];if(s.classList.contains("xterm"))break;if(s.classList.contains("xterm-hover"))return}(!this._lastBufferCell||n.x!==this._lastBufferCell.x||n.y!==this._lastBufferCell.y)&&(this._handleHover(n),this._lastBufferCell=n)}_handleHover(e){if(this._activeLine!==e.y||this._wasResized){this._clearCurrentLink(),this._askForLink(e,!1),this._wasResized=!1;return}this._currentLink&&this._linkAtPosition(this._currentLink.link,e)||(this._clearCurrentLink(),this._askForLink(e,!0))}_askForLink(e,n){var i,s;(!this._activeProviderReplies||!n)&&((i=this._activeProviderReplies)==null||i.forEach(a=>{a==null||a.forEach(o=>{o.link.dispose&&o.link.dispose()})}),this._activeProviderReplies=new Map,this._activeLine=e.y);let r=!1;for(let[a,o]of this._linkProviderService.linkProviders.entries())n?(s=this._activeProviderReplies)!=null&&s.get(a)&&(r=this._checkLinkProviderResult(a,e,r)):o.provideLinks(e.y,l=>{var d,p;if(this._isMouseOut)return;let u=l==null?void 0:l.map(f=>({link:f}));(d=this._activeProviderReplies)==null||d.set(a,u),r=this._checkLinkProviderResult(a,e,r),((p=this._activeProviderReplies)==null?void 0:p.size)===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(e.y,this._activeProviderReplies)})}_removeIntersectingLinks(e,n){let r=new Set;for(let i=0;i<n.size;i++){let s=n.get(i);if(s)for(let a=0;a<s.length;a++){let o=s[a],l=o.link.range.start.y<e?0:o.link.range.start.x,u=o.link.range.end.y>e?this._bufferService.cols:o.link.range.end.x;for(let d=l;d<=u;d++){if(r.has(d)){s.splice(a--,1);break}r.add(d)}}}}_checkLinkProviderResult(e,n,r){var a;if(!this._activeProviderReplies)return r;let i=this._activeProviderReplies.get(e),s=!1;for(let o=0;o<e;o++)(!this._activeProviderReplies.has(o)||this._activeProviderReplies.get(o))&&(s=!0);if(!s&&i){let o=i.find(l=>this._linkAtPosition(l.link,n));o&&(r=!0,this._handleNewLink(o))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!r)for(let o=0;o<this._activeProviderReplies.size;o++){let l=(a=this._activeProviderReplies.get(o))==null?void 0:a.find(u=>this._linkAtPosition(u.link,n));if(l){r=!0,this._handleNewLink(l);break}}return r}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(e){if(!this._currentLink)return;let n=this._positionFromMouseEvent(e,this._element,this._mouseService);n&&this._mouseDownLink&&Sie(this._mouseDownLink.link,this._currentLink.link)&&this._linkAtPosition(this._currentLink.link,n)&&this._currentLink.link.activate(e,this._currentLink.link.text)}_clearCurrentLink(e,n){!this._currentLink||!this._lastMouseEvent||(!e||!n||this._currentLink.link.range.start.y>=e&&this._currentLink.link.range.end.y<=n)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,Md(this._linkCacheDisposables),this._linkCacheDisposables.length=0)}_handleNewLink(e){if(!this._lastMouseEvent)return;let n=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);n&&this._linkAtPosition(e.link,n)&&(this._currentLink=e,this._currentLink.state={decorations:{underline:e.link.decorations===void 0?!0:e.link.decorations.underline,pointerCursor:e.link.decorations===void 0?!0:e.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,e.link,this._lastMouseEvent),e.link.decorations={},Object.defineProperties(e.link.decorations,{pointerCursor:{get:()=>{var r,i;return(i=(r=this._currentLink)==null?void 0:r.state)==null?void 0:i.decorations.pointerCursor},set:r=>{var i;(i=this._currentLink)!=null&&i.state&&this._currentLink.state.decorations.pointerCursor!==r&&(this._currentLink.state.decorations.pointerCursor=r,this._currentLink.state.isHovered&&this._element.classList.toggle("xterm-cursor-pointer",r))}},underline:{get:()=>{var r,i;return(i=(r=this._currentLink)==null?void 0:r.state)==null?void 0:i.decorations.underline},set:r=>{var i,s,a;(i=this._currentLink)!=null&&i.state&&((a=(s=this._currentLink)==null?void 0:s.state)==null?void 0:a.decorations.underline)!==r&&(this._currentLink.state.decorations.underline=r,this._currentLink.state.isHovered&&this._fireUnderlineEvent(e.link,r))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange(r=>{if(!this._currentLink)return;let i=r.start===0?0:r.start+1+this._bufferService.buffer.ydisp,s=this._bufferService.buffer.ydisp+1+r.end;if(this._currentLink.link.range.start.y>=i&&this._currentLink.link.range.end.y<=s&&(this._clearCurrentLink(i,s),this._lastMouseEvent)){let a=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);a&&this._askForLink(a,!1)}})))}_linkHover(e,n,r){var i;(i=this._currentLink)!=null&&i.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(n,!0),this._currentLink.state.decorations.pointerCursor&&e.classList.add("xterm-cursor-pointer")),n.hover&&n.hover(r,n.text)}_fireUnderlineEvent(e,n){let r=e.range,i=this._bufferService.buffer.ydisp,s=this._createLinkUnderlineEvent(r.start.x-1,r.start.y-i-1,r.end.x,r.end.y-i-1,void 0);(n?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(s)}_linkLeave(e,n,r){var i;(i=this._currentLink)!=null&&i.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(n,!1),this._currentLink.state.decorations.pointerCursor&&e.classList.remove("xterm-cursor-pointer")),n.leave&&n.leave(r,n.text)}_linkAtPosition(e,n){let r=e.range.start.y*this._bufferService.cols+e.range.start.x,i=e.range.end.y*this._bufferService.cols+e.range.end.x,s=n.y*this._bufferService.cols+n.x;return r<=s&&s<=i}_positionFromMouseEvent(e,n,r){let i=r.getCoords(e,n,this._bufferService.cols,this._bufferService.rows);if(i)return{x:i[0],y:i[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(e,n,r,i,s){return{x1:e,y1:n,x2:r,y2:i,cols:this._bufferService.cols,fg:s}}};gj=Dr([vt(1,XE),vt(2,sc),vt(3,cs),vt(4,Qz)],gj);function Sie(e,n){return e.text===n.text&&e.range.start.x===n.range.start.x&&e.range.start.y===n.range.start.y&&e.range.end.x===n.range.end.x&&e.range.end.y===n.range.end.y}var Cie=class extends gie{constructor(e={}){super(e),this._linkifier=this._register(new Pf),this.browser=g9,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this._register(new Pf),this._onCursorMove=this._register(new nt),this.onCursorMove=this._onCursorMove.event,this._onKey=this._register(new nt),this.onKey=this._onKey.event,this._onRender=this._register(new nt),this.onRender=this._onRender.event,this._onSelectionChange=this._register(new nt),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this._register(new nt),this.onTitleChange=this._onTitleChange.event,this._onBell=this._register(new nt),this.onBell=this._onBell.event,this._onFocus=this._register(new nt),this._onBlur=this._register(new nt),this._onA11yCharEmitter=this._register(new nt),this._onA11yTabEmitter=this._register(new nt),this._onWillOpen=this._register(new nt),this._setup(),this._decorationService=this._instantiationService.createInstance(xie),this._instantiationService.setService(Ev,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(pre),this._instantiationService.setService(Qz,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(IC)),this._register(this._inputHandler.onRequestBell(()=>this._onBell.fire())),this._register(this._inputHandler.onRequestRefreshRows(n=>this.refresh((n==null?void 0:n.start)??0,(n==null?void 0:n.end)??this.rows-1))),this._register(this._inputHandler.onRequestSendFocus(()=>this._reportFocus())),this._register(this._inputHandler.onRequestReset(()=>this.reset())),this._register(this._inputHandler.onRequestWindowsOptionsReport(n=>this._reportWindowsOptions(n))),this._register(this._inputHandler.onColor(n=>this._handleColorEvent(n))),this._register(Ti.forward(this._inputHandler.onCursorMove,this._onCursorMove)),this._register(Ti.forward(this._inputHandler.onTitleChange,this._onTitleChange)),this._register(Ti.forward(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this._register(Ti.forward(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this._register(this._bufferService.onResize(n=>this._afterResize(n.cols,n.rows))),this._register(br(()=>{var n,r;this._customKeyEventHandler=void 0,(r=(n=this.element)==null?void 0:n.parentNode)==null||r.removeChild(this.element)}))}get linkifier(){return this._linkifier.value}get onFocus(){return this._onFocus.event}get onBlur(){return this._onBlur.event}get onA11yChar(){return this._onA11yCharEmitter.event}get onA11yTab(){return this._onA11yTabEmitter.event}get onWillOpen(){return this._onWillOpen.event}_handleColorEvent(e){if(this._themeService)for(let n of e){let r,i="";switch(n.index){case 256:r="foreground",i="10";break;case 257:r="background",i="11";break;case 258:r="cursor",i="12";break;default:r="ansi",i="4;"+n.index}switch(n.type){case 0:let s=cr.toColorRGB(r==="ansi"?this._themeService.colors.ansi[n.index]:this._themeService.colors[r]);this.coreService.triggerDataEvent(`${Fe.ESC}]${i};${uie(s)}${p9.ST}`);break;case 1:if(r==="ansi")this._themeService.modifyColors(a=>a.ansi[n.index]=Yr.toColor(...n.color));else{let a=r;this._themeService.modifyColors(o=>o[a]=Yr.toColor(...n.color))}break;case 2:this._themeService.restoreColor(n.index);break}}}_setup(){super._setup(),this._customKeyEventHandler=void 0}get buffer(){return this.buffers.active}focus(){this.textarea&&this.textarea.focus({preventScroll:!0})}_handleScreenReaderModeOptionChange(e){e?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance(lb,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(e){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(Fe.ESC+"[I"),this.element.classList.add("focus"),this._showCursor(),this._onFocus.fire()}blur(){var e;return(e=this.textarea)==null?void 0:e.blur()}_handleTextAreaBlur(){this.textarea.value="",this.refresh(this.buffer.y,this.buffer.y),this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(Fe.ESC+"[O"),this.element.classList.remove("focus"),this._onBlur.fire()}_syncTextArea(){if(!this.textarea||!this.buffer.isCursorInViewport||this._compositionHelper.isComposing||!this._renderService)return;let e=this.buffer.ybase+this.buffer.y,n=this.buffer.lines.get(e);if(!n)return;let r=Math.min(this.buffer.x,this.cols-1),i=this._renderService.dimensions.css.cell.height,s=n.getWidth(r),a=this._renderService.dimensions.css.cell.width*s,o=this.buffer.y*this._renderService.dimensions.css.cell.height,l=r*this._renderService.dimensions.css.cell.width;this.textarea.style.left=l+"px",this.textarea.style.top=o+"px",this.textarea.style.width=a+"px",this.textarea.style.height=i+"px",this.textarea.style.lineHeight=i+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this._register(Ut(this.element,"copy",n=>{this.hasSelection()&&Ate(n,this._selectionService)}));let e=n=>Tte(n,this.textarea,this.coreService,this.optionsService);this._register(Ut(this.textarea,"paste",e)),this._register(Ut(this.element,"paste",e)),v9?this._register(Ut(this.element,"mousedown",n=>{n.button===2&&PO(n,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})):this._register(Ut(this.element,"contextmenu",n=>{PO(n,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})),iA&&this._register(Ut(this.element,"auxclick",n=>{n.button===1&&Hz(n,this.textarea,this.screenElement)}))}_bindKeys(){this._register(Ut(this.textarea,"keyup",e=>this._keyUp(e),!0)),this._register(Ut(this.textarea,"keydown",e=>this._keyDown(e),!0)),this._register(Ut(this.textarea,"keypress",e=>this._keyPress(e),!0)),this._register(Ut(this.textarea,"compositionstart",()=>this._compositionHelper.compositionstart())),this._register(Ut(this.textarea,"compositionupdate",e=>this._compositionHelper.compositionupdate(e))),this._register(Ut(this.textarea,"compositionend",()=>this._compositionHelper.compositionend())),this._register(Ut(this.textarea,"input",e=>this._inputEvent(e),!0)),this._register(this.onRender(()=>this._compositionHelper.updateCompositionElements()))}open(e){var s;if(!e)throw new Error("Terminal requires a parent element.");if(e.isConnected||this._logService.debug("Terminal.open was called on an element that was not attached to the DOM"),((s=this.element)==null?void 0:s.ownerDocument.defaultView)&&this._coreBrowserService){this.element.ownerDocument.defaultView!==this._coreBrowserService.window&&(this._coreBrowserService.window=this.element.ownerDocument.defaultView);return}this._document=e.ownerDocument,this.options.documentOverride&&this.options.documentOverride instanceof Document&&(this._document=this.optionsService.rawOptions.documentOverride),this.element=this._document.createElement("div"),this.element.dir="ltr",this.element.classList.add("terminal"),this.element.classList.add("xterm"),e.appendChild(this.element);let n=this._document.createDocumentFragment();this._viewportElement=this._document.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),n.appendChild(this._viewportElement),this.screenElement=this._document.createElement("div"),this.screenElement.classList.add("xterm-screen"),this._register(Ut(this.screenElement,"mousemove",a=>this.updateCursorStyle(a))),this._helperContainer=this._document.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),n.appendChild(this.screenElement);let r=this.textarea=this._document.createElement("textarea");this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",DC.get()),x9||this.textarea.setAttribute("aria-multiline","false"),this.textarea.setAttribute("autocorrect","off"),this.textarea.setAttribute("autocapitalize","off"),this.textarea.setAttribute("spellcheck","false"),this.textarea.tabIndex=0,this._register(this.optionsService.onSpecificOptionChange("disableStdin",()=>r.readOnly=this.optionsService.rawOptions.disableStdin)),this.textarea.readOnly=this.optionsService.rawOptions.disableStdin,this._coreBrowserService=this._register(this._instantiationService.createInstance(hre,this.textarea,e.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(ic,this._coreBrowserService),this._register(Ut(this.textarea,"focus",a=>this._handleTextAreaFocus(a))),this._register(Ut(this.textarea,"blur",()=>this._handleTextAreaBlur())),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(ij,this._document,this._helperContainer),this._instantiationService.setService(M0,this._charSizeService),this._themeService=this._instantiationService.createInstance(lj),this._instantiationService.setService(cp,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(sb),this._instantiationService.setService(Xz,this._characterJoinerService),this._renderService=this._register(this._instantiationService.createInstance(aj,this.rows,this.screenElement)),this._instantiationService.setService(sc,this._renderService),this._register(this._renderService.onRenderedViewportChange(a=>this._onRender.fire(a))),this.onResize(a=>this._renderService.resize(a.cols,a.rows)),this._compositionView=this._document.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(tj,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(sj),this._instantiationService.setService(XE,this._mouseService);let i=this._linkifier.value=this._register(this._instantiationService.createInstance(gj,this.screenElement));this.element.appendChild(n);try{this._onWillOpen.fire(this.element)}catch{}this._renderService.hasRenderer()||this._renderService.setRenderer(this._createRenderer()),this._register(this.onCursorMove(()=>{this._renderService.handleCursorMove(),this._syncTextArea()})),this._register(this.onResize(()=>this._renderService.handleResize(this.cols,this.rows))),this._register(this.onBlur(()=>this._renderService.handleBlur())),this._register(this.onFocus(()=>this._renderService.handleFocus())),this._viewport=this._register(this._instantiationService.createInstance(JC,this.element,this.screenElement)),this._register(this._viewport.onRequestScrollLines(a=>{super.scrollLines(a,!1),this.refresh(0,this.rows-1)})),this._selectionService=this._register(this._instantiationService.createInstance(oj,this.element,this.screenElement,i)),this._instantiationService.setService(Bte,this._selectionService),this._register(this._selectionService.onRequestScrollLines(a=>this.scrollLines(a.amount,a.suppressScrollEvent))),this._register(this._selectionService.onSelectionChange(()=>this._onSelectionChange.fire())),this._register(this._selectionService.onRequestRedraw(a=>this._renderService.handleSelectionChanged(a.start,a.end,a.columnSelectMode))),this._register(this._selectionService.onLinuxMouseSelection(a=>{this.textarea.value=a,this.textarea.focus(),this.textarea.select()})),this._register(Ti.any(this._onScroll.event,this._inputHandler.onScroll)(()=>{var a;this._selectionService.refresh(),(a=this._viewport)==null||a.queueSync()})),this._register(this._instantiationService.createInstance(ej,this.screenElement)),this._register(Ut(this.element,"mousedown",a=>this._selectionService.handleMouseDown(a))),this.coreMouseService.areMouseEventsActive?(this._selectionService.disable(),this.element.classList.add("enable-mouse-events")):this._selectionService.enable(),this.options.screenReaderMode&&(this._accessibilityManager.value=this._instantiationService.createInstance(lb,this)),this._register(this.optionsService.onSpecificOptionChange("screenReaderMode",a=>this._handleScreenReaderModeOptionChange(a))),this.options.overviewRuler.width&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(ib,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRuler",a=>{!this._overviewRulerRenderer&&a&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(ib,this._viewportElement,this.screenElement)))}),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(rj,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){let e=this,n=this.element;function r(a){var d,p,f,g,_;let o=e._mouseService.getMouseReportCoords(a,e.screenElement);if(!o)return!1;let l,u;switch(a.overrideType||a.type){case"mousemove":u=32,a.buttons===void 0?(l=3,a.button!==void 0&&(l=a.button<3?a.button:3)):l=a.buttons&1?0:a.buttons&4?1:a.buttons&2?2:3;break;case"mouseup":u=0,l=a.button<3?a.button:3;break;case"mousedown":u=1,l=a.button<3?a.button:3;break;case"wheel":if(e._customWheelEventHandler&&e._customWheelEventHandler(a)===!1)return!1;let x=a.deltaY;if(x===0||e.coreMouseService.consumeWheelEvent(a,(g=(f=(p=(d=e._renderService)==null?void 0:d.dimensions)==null?void 0:p.device)==null?void 0:f.cell)==null?void 0:g.height,(_=e._coreBrowserService)==null?void 0:_.dpr)===0)return!1;u=x<0?0:1,l=4;break;default:return!1}return u===void 0||l===void 0||l>4?!1:e.coreMouseService.triggerMouseEvent({col:o.col,row:o.row,x:o.x,y:o.y,button:l,action:u,ctrl:a.ctrlKey,alt:a.altKey,shift:a.shiftKey})}let i={mouseup:null,wheel:null,mousedrag:null,mousemove:null},s={mouseup:a=>(r(a),a.buttons||(this._document.removeEventListener("mouseup",i.mouseup),i.mousedrag&&this._document.removeEventListener("mousemove",i.mousedrag)),this.cancel(a)),wheel:a=>(r(a),this.cancel(a,!0)),mousedrag:a=>{a.buttons&&r(a)},mousemove:a=>{a.buttons||r(a)}};this._register(this.coreMouseService.onProtocolChange(a=>{a?(this.optionsService.rawOptions.logLevel==="debug"&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(a)),this.element.classList.add("enable-mouse-events"),this._selectionService.disable()):(this._logService.debug("Unbinding from mouse events."),this.element.classList.remove("enable-mouse-events"),this._selectionService.enable()),a&8?i.mousemove||(n.addEventListener("mousemove",s.mousemove),i.mousemove=s.mousemove):(n.removeEventListener("mousemove",i.mousemove),i.mousemove=null),a&16?i.wheel||(n.addEventListener("wheel",s.wheel,{passive:!1}),i.wheel=s.wheel):(n.removeEventListener("wheel",i.wheel),i.wheel=null),a&2?i.mouseup||(i.mouseup=s.mouseup):(this._document.removeEventListener("mouseup",i.mouseup),i.mouseup=null),a&4?i.mousedrag||(i.mousedrag=s.mousedrag):(this._document.removeEventListener("mousemove",i.mousedrag),i.mousedrag=null)})),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this._register(Ut(n,"mousedown",a=>{if(a.preventDefault(),this.focus(),!(!this.coreMouseService.areMouseEventsActive||this._selectionService.shouldForceSelection(a)))return r(a),i.mouseup&&this._document.addEventListener("mouseup",i.mouseup),i.mousedrag&&this._document.addEventListener("mousemove",i.mousedrag),this.cancel(a)})),this._register(Ut(n,"wheel",a=>{var o,l,u,d,p;if(!i.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(a)===!1)return!1;if(!this.buffer.hasScrollback){if(a.deltaY===0)return!1;if(e.coreMouseService.consumeWheelEvent(a,(d=(u=(l=(o=e._renderService)==null?void 0:o.dimensions)==null?void 0:l.device)==null?void 0:u.cell)==null?void 0:d.height,(p=e._coreBrowserService)==null?void 0:p.dpr)===0)return this.cancel(a,!0);let f=Fe.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(a.deltaY<0?"A":"B");return this.coreService.triggerDataEvent(f,!0),this.cancel(a,!0)}}},{passive:!1}))}refresh(e,n){var r;(r=this._renderService)==null||r.refreshRows(e,n)}updateCursorStyle(e){var n;(n=this._selectionService)!=null&&n.shouldColumnSelect(e)?this.element.classList.add("column-select"):this.element.classList.remove("column-select")}_showCursor(){this.coreService.isCursorInitialized||(this.coreService.isCursorInitialized=!0,this.refresh(this.buffer.y,this.buffer.y))}scrollLines(e,n){this._viewport?this._viewport.scrollLines(e):super.scrollLines(e,n),this.refresh(0,this.rows-1)}scrollPages(e){this.scrollLines(e*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(e){e&&this._viewport?this._viewport.scrollToLine(this.buffer.ybase,!0):this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(e){let n=e-this._bufferService.buffer.ydisp;n!==0&&this.scrollLines(n)}paste(e){Fz(e,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(e){this._customKeyEventHandler=e}attachCustomWheelEventHandler(e){this._customWheelEventHandler=e}registerLinkProvider(e){return this._linkProviderService.registerLinkProvider(e)}registerCharacterJoiner(e){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");let n=this._characterJoinerService.register(e);return this.refresh(0,this.rows-1),n}deregisterCharacterJoiner(e){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");this._characterJoinerService.deregister(e)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(e){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+e)}registerDecoration(e){return this._decorationService.registerDecoration(e)}hasSelection(){return this._selectionService?this._selectionService.hasSelection:!1}select(e,n,r){this._selectionService.setSelection(e,n,r)}getSelection(){return this._selectionService?this._selectionService.selectionText:""}getSelectionPosition(){if(!(!this._selectionService||!this._selectionService.hasSelection))return{start:{x:this._selectionService.selectionStart[0],y:this._selectionService.selectionStart[1]},end:{x:this._selectionService.selectionEnd[0],y:this._selectionService.selectionEnd[1]}}}clearSelection(){var e;(e=this._selectionService)==null||e.clearSelection()}selectAll(){var e;(e=this._selectionService)==null||e.selectAll()}selectLines(e,n){var r;(r=this._selectionService)==null||r.selectLines(e,n)}_keyDown(e){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)return!1;let n=this.browser.isMac&&this.options.macOptionIsMeta&&e.altKey;if(!n&&!this._compositionHelper.keydown(e))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(!0),!1;!n&&(e.key==="Dead"||e.key==="AltGraph")&&(this._unprocessedDeadKey=!0);let r=yie(e,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(e),r.type===3||r.type===2){let i=this.rows-1;return this.scrollLines(r.type===2?-i:i),this.cancel(e,!0)}if(r.type===1&&this.selectAll(),this._isThirdLevelShift(this.browser,e)||(r.cancel&&this.cancel(e,!0),!r.key)||e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.key.length===1&&e.key.charCodeAt(0)>=65&&e.key.charCodeAt(0)<=90)return!0;if(this._unprocessedDeadKey)return this._unprocessedDeadKey=!1,!0;if((r.key===Fe.ETX||r.key===Fe.CR)&&(this.textarea.value=""),this._onKey.fire({key:r.key,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(r.key,!0),!this.optionsService.rawOptions.screenReaderMode||e.altKey||e.ctrlKey)return this.cancel(e,!0);this._keyDownHandled=!0}_isThirdLevelShift(e,n){let r=e.isMac&&!this.options.macOptionIsMeta&&n.altKey&&!n.ctrlKey&&!n.metaKey||e.isWindows&&n.altKey&&n.ctrlKey&&!n.metaKey||e.isWindows&&n.getModifierState("AltGraph");return n.type==="keypress"?r:r&&(!n.keyCode||n.keyCode>47)}_keyUp(e){this._keyDownSeen=!1,!(this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)&&(jie(e)||this.focus(),this.updateCursorStyle(e),this._keyPressHandled=!1)}_keyPress(e){let n;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)return!1;if(this.cancel(e),e.charCode)n=e.charCode;else if(e.which===null||e.which===void 0)n=e.keyCode;else if(e.which!==0&&e.charCode!==0)n=e.which;else return!1;return!n||(e.altKey||e.ctrlKey||e.metaKey)&&!this._isThirdLevelShift(this.browser,e)?!1:(n=String.fromCharCode(n),this._onKey.fire({key:n,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(n,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,!0)}_inputEvent(e){if(e.data&&e.inputType==="insertText"&&(!e.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;let n=e.data;return this.coreService.triggerDataEvent(n,!0),this.cancel(e),!0}return!1}resize(e,n){if(e===this.cols&&n===this.rows){this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure();return}super.resize(e,n)}_afterResize(e,n){var r;(r=this._charSizeService)==null||r.measure()}clear(){if(!(this.buffer.ybase===0&&this.buffer.y===0)){this.buffer.clearAllMarkers(),this.buffer.lines.set(0,this.buffer.lines.get(this.buffer.ybase+this.buffer.y)),this.buffer.lines.length=1,this.buffer.ydisp=0,this.buffer.ybase=0,this.buffer.y=0;for(let e=1;e<this.rows;e++)this.buffer.lines.push(this.buffer.getBlankLine(Vr));this._onScroll.fire({position:this.buffer.ydisp}),this.refresh(0,this.rows-1)}}reset(){var n;this.options.rows=this.rows,this.options.cols=this.cols;let e=this._customKeyEventHandler;this._setup(),super.reset(),(n=this._selectionService)==null||n.reset(),this._decorationService.reset(),this._customKeyEventHandler=e,this.refresh(0,this.rows-1)}clearTextureAtlas(){var e;(e=this._renderService)==null||e.clearTextureAtlas()}_reportFocus(){var e;(e=this.element)!=null&&e.classList.contains("focus")?this.coreService.triggerDataEvent(Fe.ESC+"[I"):this.coreService.triggerDataEvent(Fe.ESC+"[O")}_reportWindowsOptions(e){if(this._renderService)switch(e){case 0:let n=this._renderService.dimensions.css.canvas.width.toFixed(0),r=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${Fe.ESC}[4;${r};${n}t`);break;case 1:let i=this._renderService.dimensions.css.cell.width.toFixed(0),s=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${Fe.ESC}[6;${s};${i}t`);break}}cancel(e,n){if(!(!this.options.cancelEvents&&!n))return e.preventDefault(),e.stopPropagation(),!1}};function jie(e){return e.keyCode===16||e.keyCode===17||e.keyCode===18}var Nie=class{constructor(){this._addons=[]}dispose(){for(let e=this._addons.length-1;e>=0;e--)this._addons[e].instance.dispose()}loadAddon(e,n){let r={instance:n,dispose:n.dispose,isDisposed:!1};this._addons.push(r),n.dispose=()=>this._wrappedAddonDispose(r),n.activate(e)}_wrappedAddonDispose(e){if(e.isDisposed)return;let n=-1;for(let r=0;r<this._addons.length;r++)if(this._addons[r]===e){n=r;break}if(n===-1)throw new Error("Could not dispose an addon that has not been loaded");e.isDisposed=!0,e.dispose.apply(e.instance),this._addons.splice(n,1)}},Eie=class{constructor(e){this._line=e}get isWrapped(){return this._line.isWrapped}get length(){return this._line.length}getCell(e,n){if(!(e<0||e>=this._line.length))return n?(this._line.loadCell(e,n),n):this._line.loadCell(e,new Ma)}translateToString(e,n,r){return this._line.translateToString(e,n,r)}},j4=class{constructor(e,n){this._buffer=e,this.type=n}init(e){return this._buffer=e,this}get cursorY(){return this._buffer.y}get cursorX(){return this._buffer.x}get viewportY(){return this._buffer.ydisp}get baseY(){return this._buffer.ybase}get length(){return this._buffer.lines.length}getLine(e){let n=this._buffer.lines.get(e);if(n)return new Eie(n)}getNullCell(){return new Ma}},Aie=class extends sn{constructor(e){super(),this._core=e,this._onBufferChange=this._register(new nt),this.onBufferChange=this._onBufferChange.event,this._normal=new j4(this._core.buffers.normal,"normal"),this._alternate=new j4(this._core.buffers.alt,"alternate"),this._core.buffers.onBufferActivate(()=>this._onBufferChange.fire(this.active))}get active(){if(this._core.buffers.active===this._core.buffers.normal)return this.normal;if(this._core.buffers.active===this._core.buffers.alt)return this.alternate;throw new Error("Active buffer is neither normal nor alternate")}get normal(){return this._normal.init(this._core.buffers.normal)}get alternate(){return this._alternate.init(this._core.buffers.alt)}},Tie=class{constructor(e){this._core=e}registerCsiHandler(e,n){return this._core.registerCsiHandler(e,r=>n(r.toArray()))}addCsiHandler(e,n){return this.registerCsiHandler(e,n)}registerDcsHandler(e,n){return this._core.registerDcsHandler(e,(r,i)=>n(r,i.toArray()))}addDcsHandler(e,n){return this.registerDcsHandler(e,n)}registerEscHandler(e,n){return this._core.registerEscHandler(e,n)}addEscHandler(e,n){return this.registerEscHandler(e,n)}registerOscHandler(e,n){return this._core.registerOscHandler(e,n)}addOscHandler(e,n){return this.registerOscHandler(e,n)}},Mie=class{constructor(e){this._core=e}register(e){this._core.unicodeService.register(e)}get versions(){return this._core.unicodeService.versions}get activeVersion(){return this._core.unicodeService.activeVersion}set activeVersion(e){this._core.unicodeService.activeVersion=e}},Rie=["cols","rows"],So=0,T9=class extends sn{constructor(e){super(),this._core=this._register(new Cie(e)),this._addonManager=this._register(new Nie),this._publicOptions={...this._core.options};let n=i=>this._core.options[i],r=(i,s)=>{this._checkReadonlyOptions(i),this._core.options[i]=s};for(let i in this._core.options){let s={get:n.bind(this,i),set:r.bind(this,i)};Object.defineProperty(this._publicOptions,i,s)}}_checkReadonlyOptions(e){if(Rie.includes(e))throw new Error(`Option "${e}" can only be set in the constructor`)}_checkProposedApi(){if(!this._core.optionsService.rawOptions.allowProposedApi)throw new Error("You must set the allowProposedApi option to true to use proposed API")}get onBell(){return this._core.onBell}get onBinary(){return this._core.onBinary}get onCursorMove(){return this._core.onCursorMove}get onData(){return this._core.onData}get onKey(){return this._core.onKey}get onLineFeed(){return this._core.onLineFeed}get onRender(){return this._core.onRender}get onResize(){return this._core.onResize}get onScroll(){return this._core.onScroll}get onSelectionChange(){return this._core.onSelectionChange}get onTitleChange(){return this._core.onTitleChange}get onWriteParsed(){return this._core.onWriteParsed}get element(){return this._core.element}get parser(){return this._parser||(this._parser=new Tie(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new Mie(this._core)}get textarea(){return this._core.textarea}get rows(){return this._core.rows}get cols(){return this._core.cols}get buffer(){return this._buffer||(this._buffer=this._register(new Aie(this._core))),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){let e=this._core.coreService.decPrivateModes,n="none";switch(this._core.coreMouseService.activeProtocol){case"X10":n="x10";break;case"VT200":n="vt200";break;case"DRAG":n="drag";break;case"ANY":n="any";break}return{applicationCursorKeysMode:e.applicationCursorKeys,applicationKeypadMode:e.applicationKeypad,bracketedPasteMode:e.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:n,originMode:e.origin,reverseWraparoundMode:e.reverseWraparound,sendFocusMode:e.sendFocus,synchronizedOutputMode:e.synchronizedOutput,wraparoundMode:e.wraparound}}get options(){return this._publicOptions}set options(e){for(let n in e)this._publicOptions[n]=e[n]}blur(){this._core.blur()}focus(){this._core.focus()}input(e,n=!0){this._core.input(e,n)}resize(e,n){this._verifyIntegers(e,n),this._core.resize(e,n)}open(e){this._core.open(e)}attachCustomKeyEventHandler(e){this._core.attachCustomKeyEventHandler(e)}attachCustomWheelEventHandler(e){this._core.attachCustomWheelEventHandler(e)}registerLinkProvider(e){return this._core.registerLinkProvider(e)}registerCharacterJoiner(e){return this._checkProposedApi(),this._core.registerCharacterJoiner(e)}deregisterCharacterJoiner(e){this._checkProposedApi(),this._core.deregisterCharacterJoiner(e)}registerMarker(e=0){return this._verifyIntegers(e),this._core.registerMarker(e)}registerDecoration(e){return this._checkProposedApi(),this._verifyPositiveIntegers(e.x??0,e.width??0,e.height??0),this._core.registerDecoration(e)}hasSelection(){return this._core.hasSelection()}select(e,n,r){this._verifyIntegers(e,n,r),this._core.select(e,n,r)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(e,n){this._verifyIntegers(e,n),this._core.selectLines(e,n)}dispose(){super.dispose()}scrollLines(e){this._verifyIntegers(e),this._core.scrollLines(e)}scrollPages(e){this._verifyIntegers(e),this._core.scrollPages(e)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(e){this._verifyIntegers(e),this._core.scrollToLine(e)}clear(){this._core.clear()}write(e,n){this._core.write(e,n)}writeln(e,n){this._core.write(e),this._core.write(`\r
`,n)}paste(e){this._core.paste(e)}refresh(e,n){this._verifyIntegers(e,n),this._core.refresh(e,n)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(e){this._addonManager.loadAddon(this,e)}static get strings(){return{get promptLabel(){return DC.get()},set promptLabel(e){DC.set(e)},get tooMuchOutput(){return PC.get()},set tooMuchOutput(e){PC.set(e)}}}_verifyIntegers(...e){for(So of e)if(So===1/0||isNaN(So)||So%1!==0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...e){for(So of e)if(So&&(So===1/0||isNaN(So)||So%1!==0||So<0))throw new Error("This API only accepts positive integers")}};/**
 * Copyright (c) 2014-2024 The xterm.js authors. All rights reserved.
 * @license MIT
 *
 * Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)
 * @license MIT
 *
 * Originally forked from (with the author's permission):
 *   Fabrice Bellard's javascript vt100 for jslinux:
 *   http://bellard.org/jslinux/
 *   Copyright (c) 2011 Fabrice Bellard
 */var Oie=2,Die=1,M9=class{activate(n){this._terminal=n}dispose(){}fit(){let n=this.proposeDimensions();if(!n||!this._terminal||isNaN(n.cols)||isNaN(n.rows))return;let r=this._terminal._core;(this._terminal.rows!==n.rows||this._terminal.cols!==n.cols)&&(r._renderService.clear(),this._terminal.resize(n.cols,n.rows))}proposeDimensions(){var g;if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;let n=this._terminal._core._renderService.dimensions;if(n.css.cell.width===0||n.css.cell.height===0)return;let r=this._terminal.options.scrollback===0?0:((g=this._terminal.options.overviewRuler)==null?void 0:g.width)||14,i=window.getComputedStyle(this._terminal.element.parentElement),s=parseInt(i.getPropertyValue("height")),a=Math.max(0,parseInt(i.getPropertyValue("width"))),o=window.getComputedStyle(this._terminal.element),l={top:parseInt(o.getPropertyValue("padding-top")),bottom:parseInt(o.getPropertyValue("padding-bottom")),right:parseInt(o.getPropertyValue("padding-right")),left:parseInt(o.getPropertyValue("padding-left"))},u=l.top+l.bottom,d=l.right+l.left,p=s-u,f=a-d-r;return{cols:Math.max(Oie,Math.floor(f/n.css.cell.width)),rows:Math.max(Die,Math.floor(p/n.css.cell.height))}}};/**
 * Copyright (c) 2014-2024 The xterm.js authors. All rights reserved.
 * @license MIT
 *
 * Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)
 * @license MIT
 *
 * Originally forked from (with the author's permission):
 *   Fabrice Bellard's javascript vt100 for jslinux:
 *   http://bellard.org/jslinux/
 *   Copyright (c) 2011 Fabrice Bellard
 */var Pie=class{constructor(n,r,i,s={}){this._terminal=n,this._regex=r,this._handler=i,this._options=s}provideLinks(n,r){let i=Iie.computeLink(n,this._regex,this._terminal,this._handler);r(this._addCallbacks(i))}_addCallbacks(n){return n.map(r=>(r.leave=this._options.leave,r.hover=(i,s)=>{if(this._options.hover){let{range:a}=r;this._options.hover(i,s,a)}},r))}};function Lie(e){try{let n=new URL(e),r=n.password&&n.username?`${n.protocol}//${n.username}:${n.password}@${n.host}`:n.username?`${n.protocol}//${n.username}@${n.host}`:`${n.protocol}//${n.host}`;return e.toLocaleLowerCase().startsWith(r.toLocaleLowerCase())}catch{return!1}}var Iie=class Cx{static computeLink(n,r,i,s){let a=new RegExp(r.source,(r.flags||"")+"g"),[o,l]=Cx._getWindowedLineStrings(n-1,i),u=o.join(""),d,p=[];for(;d=a.exec(u);){let f=d[0];if(!Lie(f))continue;let[g,_]=Cx._mapStrIdx(i,l,0,d.index),[x,v]=Cx._mapStrIdx(i,g,_,f.length);if(g===-1||_===-1||x===-1||v===-1)continue;let S={start:{x:_+1,y:g+1},end:{x:v,y:x+1}};p.push({range:S,text:f,activate:s})}return p}static _getWindowedLineStrings(n,r){let i,s=n,a=n,o=0,l="",u=[];if(i=r.buffer.active.getLine(n)){let d=i.translateToString(!0);if(i.isWrapped&&d[0]!==" "){for(o=0;(i=r.buffer.active.getLine(--s))&&o<2048&&(l=i.translateToString(!0),o+=l.length,u.push(l),!(!i.isWrapped||l.indexOf(" ")!==-1)););u.reverse()}for(u.push(d),o=0;(i=r.buffer.active.getLine(++a))&&i.isWrapped&&o<2048&&(l=i.translateToString(!0),o+=l.length,u.push(l),l.indexOf(" ")===-1););}return[u,s]}static _mapStrIdx(n,r,i,s){let a=n.buffer.active,o=a.getNullCell(),l=i;for(;s;){let u=a.getLine(r);if(!u)return[-1,-1];for(let d=l;d<u.length;++d){u.getCell(d,o);let p=o.getChars();if(o.getWidth()&&(s-=p.length||1,d===u.length-1&&p==="")){let f=a.getLine(r+1);f&&f.isWrapped&&(f.getCell(0,o),o.getWidth()===2&&(s+=1))}if(s<0)return[r,d]}r++,l=0}return[r,l]}},Bie=/(https?|HTTPS?):[/]{2}[^\s"'!*(){}|\\\^<>`]*[^\s"':,.!?{}|\\\^~\[\]`()<>]/;function zie(e,n){let r=window.open();if(r){try{r.opener=null}catch{}r.location.href=n}else console.warn("Opening link blocked as opener could not be cleared")}var R9=class{constructor(n=zie,r={}){this._handler=n,this._options=r}activate(n){this._terminal=n;let r=this._options,i=r.urlRegex||Bie;this._linkProvider=this._terminal.registerLinkProvider(new Pie(this._terminal,i,this._handler,r))}dispose(){var n;(n=this._linkProvider)==null||n.dispose()}};const $ie={status:"/api/status",cost:"/api/cost",agents:"/api/agents",config:"/api/config",sessions:"/api/sessions",health:"/api/health",integrations:"/api/integrations"},Fie=["","\x1B[36m  Available commands:\x1B[0m","    status        runtime status","    cost          cost summary","    agents        list agents","    config        show config","    sessions      active sessions","    health        health snapshot","    integrations  list integrations","    clear         clear terminal","    help          this message",""].join(`\r
`),Hie=["","\x1B[36m  ╔═══════════════════════════════════════╗\x1B[0m","\x1B[36m  ║\x1B[0m  Revka Terminal v2.0                \x1B[36m║\x1B[0m",'\x1B[36m  ║\x1B[0m  Type \x1B[32m"help"\x1B[0m for available commands   \x1B[36m║\x1B[0m',"\x1B[36m  ╚═══════════════════════════════════════╝\x1B[0m",""].join(`\r
`);function N4(e){return{background:"#0b0d10",foreground:e.primary,cursor:e.cursorColor,cursorAccent:"#0b0d10",selectionBackground:"rgba(111,131,214,0.18)",selectionForeground:"#ffffff",black:"#1a1a1a",red:"#ff6b7a",green:"#2fbf75",yellow:"#ffc857",blue:"#8fa8c8",magenta:"#7c8ddd",cyan:"#8fa8c8",white:"#e6e6e6",brightBlack:"#4a4a4a",brightRed:"#ff8a97",brightGreen:"#55d18f",brightYellow:"#ffd980",brightBlue:"#a4bad6",brightMagenta:"#95a2e6",brightCyan:"#a4bad6",brightWhite:"#ffffff"}}function Wie(e,n,r){let i;lp()&&Oi?i=Oi.replace(/^http/,"ws"):i=`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}`;const s=new URLSearchParams,a=os();return a&&s.set("token",a),s.set("session_id",e),n>0&&s.set("cols",String(n)),r>0&&s.set("rows",String(r)),`${i}${Xr}/ws/terminal?${s.toString()}`}function qie({sessionId:e,config:n,colors:r,visible:i}){const s=b.useRef(null),a=b.useRef(null),o=b.useRef(null),l=b.useRef(null),u=b.useRef(""),[d,p]=b.useState("connecting"),f=b.useRef(d);f.current=d;const g=b.useRef(!1),_=b.useCallback(()=>{var v;(v=a.current)==null||v.write("\x1B[32m❯\x1B[0m ")},[]),x=b.useCallback(async v=>{const S=a.current;if(!S)return;const w=v.trim().toLowerCase();if(!w){_();return}if(w==="clear"){S.clear(),_();return}if(w==="help"){S.write(Fie),_();return}const j=$ie[w];if(!j){S.write(`\x1B[31m  unknown command: ${w}\x1B[0m\r
`),S.write(`  type \x1B[32m"help"\x1B[0m to see available commands\r
`),_();return}g.current=!0,S.write("\x1B[33m  fetching…\x1B[0m");try{const C=await Ye(j),T=JSON.stringify(C,null,2);S.write("\r\x1B[K");const E=T.split(`
`);for(const A of E)S.write(`  \x1B[32m${A}\x1B[0m\r
`)}catch(C){S.write("\r\x1B[K"),S.write(`\x1B[31m  error: ${C instanceof Error?C.message:String(C)}\x1B[0m\r
`)}finally{g.current=!1,_()}},[_]);return b.useEffect(()=>{if(!s.current)return;const v=new T9({cursorBlink:n.cursorBlink,cursorStyle:"bar",fontSize:n.fontSize,fontFamily:"JetBrains Mono, SF Mono, Menlo, Monaco, Consolas, monospace",lineHeight:1.2,scrollback:1e4,allowProposedApi:!0,theme:N4(r)}),S=new M9;v.loadAddon(S),v.loadAddon(new R9),v.open(s.current);try{S.fit()}catch{}a.current=v,o.current=S,v.write(Hie);let w=null,j=!1;try{const T=Wie(e,v.cols,v.rows);w=new WebSocket(T),w.binaryType="arraybuffer",l.current=w;const E=setTimeout(()=>{j=!0,w&&w.readyState!==WebSocket.OPEN&&w.close()},3e3);w.onopen=()=>{if(clearTimeout(E),j)return;p("pty"),v.write(`\x1B[36m  Connected to PTY terminal.\x1B[0m\r
\r
`);const A=JSON.stringify({type:"resize",cols:v.cols,rows:v.rows});w.send(A)},w.onmessage=A=>{typeof A.data=="string"?v.write(A.data):v.write(new Uint8Array(A.data))},w.onerror=()=>{clearTimeout(E),f.current!=="pty"&&(p("api"),v.write(`\x1B[33m  PTY not available — running in API command mode.\x1B[0m\r
\r
`),_())},w.onclose=()=>{clearTimeout(E),f.current==="pty"?(v.write(`\r
\x1B[33m  Terminal session ended.\x1B[0m\r
`),p("api"),_()):f.current==="connecting"&&(p("api"),v.write(`\x1B[33m  PTY not available — running in API command mode.\x1B[0m\r
\r
`),_())}}catch{p("api"),v.write(`\x1B[33m  PTY not available — running in API command mode.\x1B[0m\r
\r
`),_()}v.onData(T=>{var E;if(f.current==="pty"&&((E=l.current)==null?void 0:E.readyState)===WebSocket.OPEN){l.current.send(T);return}if(!(f.current!=="api"||g.current))for(const A of T)if(A==="\r"){v.write(`\r
`);const O=u.current;u.current="",x(O)}else A===""||A==="\b"?u.current.length>0&&(u.current=u.current.slice(0,-1),v.write("\b \b")):A===""?(v.write(`^C\r
`),u.current="",_()):A==="\f"?(v.clear(),_()):A>=" "&&(u.current+=A,v.write(A))}),v.onResize(({cols:T,rows:E})=>{var A;((A=l.current)==null?void 0:A.readyState)===WebSocket.OPEN&&l.current.send(JSON.stringify({type:"resize",cols:T,rows:E}))});const C=new ResizeObserver(()=>{try{S.fit()}catch{}});return C.observe(s.current),()=>{C.disconnect(),w&&(w.onopen=null,w.onmessage=null,w.onclose=null,w.onerror=null,w.close()),v.dispose(),a.current=null,o.current=null,l.current=null}},[e]),b.useEffect(()=>{a.current&&(a.current.options.theme=N4(r))},[r]),b.useEffect(()=>{a.current&&(a.current.options.cursorBlink=n.cursorBlink)},[n.cursorBlink]),b.useEffect(()=>{var v;if(a.current){a.current.options.fontSize=n.fontSize;try{(v=o.current)==null||v.fit()}catch{}}},[n.fontSize]),b.useEffect(()=>{i&&requestAnimationFrame(()=>{var v,S;try{(v=o.current)==null||v.fit()}catch{}(S=a.current)==null||S.focus()})},[i]),c.jsx("div",{ref:s,className:"min-h-0 flex-1",style:{display:i?"block":"none",padding:"4px 0"}})}const O9=[{key:"claude",label:"Claude Code"},{key:"codex",label:"Codex"},{key:"opencode",label:"OpenCode"},{key:"gemini",label:"Gemini CLI"},{key:"operator",label:"Revka Operator"}],D9="revka-code-recent-repos",P9=10;function Og(e){var n;return((n=O9.find(r=>r.key===e))==null?void 0:n.label)??e}function L9(e){if(!e)return"";const n=e.replace(/\/+$/,""),r=n.lastIndexOf("/");return r>=0?n.slice(r+1):n}function vj(){try{const e=localStorage.getItem(D9);if(!e)return[];const n=JSON.parse(e);return Array.isArray(n)?n.filter(r=>typeof r=="string").slice(0,P9):[]}catch{return[]}}function Uie(e){try{const n=vj(),r=[e,...n.filter(i=>i!==e)].slice(0,P9);localStorage.setItem(D9,JSON.stringify(r))}catch{}}function E4(){return null}async function Kie(e){const n={},r=os();r&&(n.Authorization=`Bearer ${r}`);const i=await fetch(`${Xr}/api/mcp/discovery`,{signal:e,headers:n});return i.ok?await i.json():{available:!1,reason:`discovery http ${i.status}`}}function A4(e){return{background:"#0b0d10",foreground:e.primary,cursor:e.cursorColor,cursorAccent:"#0b0d10",selectionBackground:"rgba(111,131,214,0.18)",selectionForeground:"#ffffff",black:"#1a1a1a",red:"#ff6b7a",green:"#2fbf75",yellow:"#ffc857",blue:"#8fa8c8",magenta:"#7c8ddd",cyan:"#8fa8c8",white:"#e6e6e6",brightBlack:"#4a4a4a",brightRed:"#ff8a97",brightGreen:"#55d18f",brightYellow:"#ffd980",brightBlue:"#a4bad6",brightMagenta:"#95a2e6",brightCyan:"#a4bad6",brightWhite:"#ffffff"}}function I9(){return lp()&&Oi?Oi.replace(/^http/,"ws"):`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}`}function Vie(e,n,r){const i=new URLSearchParams,s=os();return s&&i.set("token",s),i.set("tool",e.toolKey),i.set("cwd",e.cwd),i.set("mcp_session",e.sessionId),i.set("mcp_token",e.token),n>0&&i.set("cols",String(n)),r>0&&i.set("rows",String(r)),`${I9()}${Xr}/ws/terminal?${i.toString()}`}function Yie(e){const n=new URLSearchParams,r=os();return r&&n.set("token",r),n.set("session_id",e.sessionId),n.set("mcp_token",e.token),`${I9()}${Xr}/ws/mcp/events?${n.toString()}`}function Gie(e){const n=e.tool&&e.tool.trim()?e.tool:`tool #${e.token}`,r=e.total??null;let i,s=null;r&&r>0?(i=`${e.progress} / ${r}`,s=Math.max(0,Math.min(1,e.progress/r))):e.message&&e.message.trim()?i=e.message:i=`step ${e.progress}`;const a=Date.parse(e.timestamp),o=Number.isFinite(a)?a:Date.now();return{title:n,progressLine:i,ratio:s,timestampMs:o,id:`${e.token}-${o}`}}function Xie(e,n){const r=Math.max(0,Math.floor((n-e)/1e3));if(r<1)return"now";if(r<60)return`${r}s ago`;const i=Math.floor(r/60);return i<60?`${i}m ago`:`${Math.floor(i/60)}h ago`}const T4=30,Qie=2e4,Zie=3;function Jie(e){const[n,r]=b.useState([]),[i,s]=b.useState("connecting"),a=b.useRef(null),o=b.useRef(null),l=b.useRef(0),u=b.useRef(!1);return b.useEffect(()=>{if(!e)return;u.current=!1,l.current=0;const d=()=>{if(u.current)return;s("connecting");let f;try{f=new WebSocket(Yie(e))}catch{p();return}a.current=f,f.onopen=()=>{u.current||(l.current=0,s("open"))},f.onmessage=g=>{if(typeof g.data=="string")try{const _=JSON.parse(g.data);if("error"in _&&_.error){s("offline");return}if(typeof _.token!="number"||typeof _.progress!="number")return;r(x=>{const v=[...x,_];return v.length>T4?v.slice(v.length-T4):v})}catch{}},f.onerror=()=>{},f.onclose=()=>{u.current||p()}},p=()=>{if(u.current)return;if(l.current>=Zie){s("offline");return}const f=l.current;l.current=f+1;const g=500+f*1e3+f*f*500;o.current=window.setTimeout(d,g)};return d(),()=>{u.current=!0,o.current!==null&&(window.clearTimeout(o.current),o.current=null);const f=a.current;if(f){f.onopen=null,f.onmessage=null,f.onerror=null,f.onclose=null;try{f.close()}catch{}}a.current=null}},[e]),{events:n,status:i}}function ese({events:e,status:n,colors:r}){const[i,s]=b.useState(()=>Date.now());b.useEffect(()=>{const l=window.setInterval(()=>s(Date.now()),1e3);return()=>window.clearInterval(l)},[]);const a=b.useMemo(()=>e.map(Gie),[e]),o={borderColor:"var(--revka-border-soft)",background:"color-mix(in srgb, var(--revka-bg-surface) 92%, transparent)",minHeight:64,maxHeight:96};return n==="offline"?c.jsxs("div",{role:"status","aria-live":"polite",className:"flex items-center gap-2 border-b px-3 py-2 text-[11px]",style:o,children:[c.jsx("span",{className:"inline-block h-1.5 w-1.5 rounded-full",style:{background:"var(--revka-text-faint)"}}),c.jsx("span",{style:{color:"var(--revka-text-faint)"},children:"progress stream offline"})]}):a.length===0?c.jsxs("div",{role:"status","aria-live":"polite",className:"flex items-center gap-2 border-b px-3 py-2 text-[11px]",style:o,children:[c.jsx("span",{className:"inline-block h-1.5 w-1.5 rounded-full animate-pulse",style:{background:n==="open"?r.primary:"var(--revka-text-faint)"}}),c.jsx("span",{style:{color:"var(--revka-text-muted)"},children:"waiting for Revka tool activity"})]}):c.jsx("div",{role:"status","aria-live":"polite",className:"flex gap-2 overflow-x-auto border-b px-3 py-2",style:o,children:a.map(l=>{const d=i-l.timestampMs>Qie;return c.jsxs("div",{className:"shrink-0 rounded border px-2 py-1.5",style:{minWidth:150,maxWidth:240,borderColor:d?"var(--revka-border-soft)":"color-mix(in srgb, "+r.primary+" 40%, var(--revka-border-soft))",background:"var(--revka-bg-surface)",opacity:d?.55:1,transition:"opacity 600ms ease"},children:[c.jsx("div",{className:"truncate text-[10px] font-semibold uppercase tracking-[0.1em]",style:{color:d?"var(--revka-text-faint)":r.primary,textShadow:d?"none":r.glow},title:l.title,children:l.title}),c.jsx("div",{className:"truncate text-[11px]",style:{color:d?"var(--revka-text-faint)":"var(--revka-text-primary)"},title:l.progressLine,children:l.progressLine}),l.ratio!==null&&c.jsx("div",{className:"mt-1 h-1 w-full overflow-hidden rounded",style:{background:"var(--revka-border-soft)"},children:c.jsx("div",{className:"h-full",style:{width:`${Math.round(l.ratio*100)}%`,background:d?"var(--revka-text-faint)":r.primary,transition:"width 300ms ease"}})}),c.jsx("div",{className:"mt-1 text-[10px]",style:{color:"var(--revka-text-faint)"},children:Xie(l.timestampMs,i)})]},l.id)})})}function tse({session:e,config:n,colors:r,visible:i}){const s=b.useRef(null),a=b.useRef(null),o=b.useRef(null),l=b.useRef(null);return b.useEffect(()=>{if(!s.current)return;const u=new T9({cursorBlink:n.cursorBlink,cursorStyle:"bar",fontSize:n.fontSize,fontFamily:"JetBrains Mono, SF Mono, Menlo, Monaco, Consolas, monospace",lineHeight:1.2,scrollback:1e4,allowProposedApi:!0,theme:A4(r)}),d=new M9;u.loadAddon(d),u.loadAddon(new R9),u.open(s.current);try{d.fit()}catch{}a.current=u,o.current=d,u.write(`\x1B[36m  Launching ${Og(e.toolKey)} in ${e.cwd}…\x1B[0m\r
\r
`);let p=null;try{p=new WebSocket(Vie(e,u.cols,u.rows)),p.binaryType="arraybuffer",l.current=p,p.onopen=()=>{p.send(JSON.stringify({type:"resize",cols:u.cols,rows:u.rows}))},p.onmessage=g=>{typeof g.data=="string"?u.write(g.data):u.write(new Uint8Array(g.data))},p.onerror=()=>{u.write(`\r
\x1B[31m  WebSocket error.\x1B[0m\r
`)},p.onclose=()=>{u.write(`\r
\x1B[33m  Session ended.\x1B[0m\r
`)}}catch(g){u.write(`\x1B[31m  Failed to open WebSocket: ${g instanceof Error?g.message:String(g)}\x1B[0m\r
`)}u.onData(g=>{var _;((_=l.current)==null?void 0:_.readyState)===WebSocket.OPEN&&l.current.send(g)}),u.onResize(({cols:g,rows:_})=>{var x;((x=l.current)==null?void 0:x.readyState)===WebSocket.OPEN&&l.current.send(JSON.stringify({type:"resize",cols:g,rows:_}))});const f=new ResizeObserver(()=>{try{d.fit()}catch{}});return f.observe(s.current),()=>{f.disconnect(),p&&(p.onopen=null,p.onmessage=null,p.onclose=null,p.onerror=null,p.close()),u.dispose(),a.current=null,o.current=null,l.current=null}},[e.sessionId]),b.useEffect(()=>{a.current&&(a.current.options.theme=A4(r))},[r]),b.useEffect(()=>{a.current&&(a.current.options.cursorBlink=n.cursorBlink)},[n.cursorBlink]),b.useEffect(()=>{var u;if(a.current){a.current.options.fontSize=n.fontSize;try{(u=o.current)==null||u.fit()}catch{}}},[n.fontSize]),b.useEffect(()=>{i&&requestAnimationFrame(()=>{var u,d;try{(u=o.current)==null||u.fit()}catch{}(d=a.current)==null||d.focus()})},[i]),c.jsx("div",{ref:s,className:"min-h-0 flex-1",style:{display:i?"block":"none",padding:"4px 0"}})}function nse({session:e,config:n,colors:r,visible:i,onSessionEnd:s}){const{events:a,status:o}=Jie(e);return c.jsxs("div",{className:"flex min-h-0 flex-1 flex-col",style:{display:i?"flex":"none"},children:[c.jsxs("div",{className:"flex items-center gap-2 border-b px-3 py-1.5 text-[11px]",style:{borderColor:"var(--revka-border-soft)",background:"var(--revka-bg-surface)"},children:[c.jsx("span",{style:{color:r.primary,textShadow:r.glow,fontWeight:600},children:Og(e.toolKey)}),c.jsx("span",{style:{color:"var(--revka-text-faint)"},children:"·"}),c.jsx("span",{className:"truncate",style:{color:"var(--revka-text-muted)",maxWidth:"40ch"},title:e.cwd,children:e.cwd}),c.jsx("div",{className:"flex-1"}),c.jsxs("button",{type:"button",className:"flex items-center gap-1 rounded px-2 py-0.5 text-[10px] font-semibold uppercase tracking-[0.1em] transition-colors hover:bg-white/5",onClick:s,style:{color:"var(--revka-text-secondary)",border:"1px solid var(--revka-border-soft)"},title:"End session",children:[c.jsx(vi,{className:"h-3 w-3"}),"End session"]})]}),c.jsx(ese,{events:a,status:o,colors:r}),c.jsx(tse,{session:e,config:n,colors:r,visible:i})]})}function rse({config:e,colors:n,visible:r,session:i,onSessionStart:s,onSessionEnd:a,onDelegateToChat:o}){const[l,u]=b.useState("claude"),[d,p]=b.useState(""),[f,g]=b.useState(!1),[_,x]=b.useState(null),[v,S]=b.useState(()=>vj()),[w,j]=b.useState("checking"),[C,T]=b.useState(null);b.useEffect(()=>{if(i)return;let F=!1;const L=new AbortController;return(async()=>{try{const $=E4();if($){const B=await fetch(`${$}/health`,{signal:L.signal});if(F)return;j(B.ok?"ready":"missing"),T(B.ok?null:`health http ${B.status}`);return}const z=await Kie(L.signal);if(F)return;z.available?(j("ready"),T(null)):(j("missing"),T(z.reason))}catch{F||(j("missing"),T("discovery request failed"))}})(),()=>{F=!0,L.abort()}},[i]);const E=b.useCallback(async()=>{if(x(null),l==="operator"){o("v2:code:operator","Operator");return}const F=d.trim();if(!F){x("Repository path is required.");return}g(!0);try{const L=E4(),$=L?`${L}/session`:`${Xr}/api/mcp/session`,z={"Content-Type":"application/json"};if(!L){const U=os();U&&(z.Authorization=`Bearer ${U}`)}const B=await fetch($,{method:"POST",headers:z,body:JSON.stringify({cwd:F,label:`${Og(l)} · ${L9(F)}`})});if(!B.ok){const U=await B.text().catch(()=>"");throw new Error(`Session request failed (${B.status})${U?`: ${U}`:""}`)}const H=await B.json(),D={sessionId:H.session_id,token:H.token,cwd:H.cwd||F,toolKey:l};Uie(D.cwd),S(vj()),s(D,Og(l),D.cwd)}catch(L){x(L instanceof Error?L.message:String(L))}finally{g(!1)}},[l,d,s,o]),A=b.useMemo(()=>w==="checking"?"Revka MCP: checking…":w==="ready"?"Revka MCP: ready":`Revka MCP: not running — start revka-mcp first${C?` (${C})`:""}`,[w,C]),O=b.useMemo(()=>w==="ready"?"var(--revka-status-success)":w==="missing"?"var(--revka-status-danger)":"var(--revka-text-faint)",[w]);return i?c.jsx(nse,{session:i,config:e,colors:n,visible:r,onSessionEnd:a}):c.jsx("div",{className:"flex min-h-0 flex-1 flex-col overflow-y-auto p-4",style:{display:r?"flex":"none"},children:c.jsxs("div",{className:"mx-auto w-full max-w-md space-y-4",children:[c.jsxs("div",{children:[c.jsx("h3",{className:"text-xs font-semibold uppercase tracking-[0.14em]",style:{color:n.primary,textShadow:n.glow},children:"Launch Code Session"}),c.jsx("p",{className:"mt-1 text-[11px]",style:{color:"var(--revka-text-muted)"},children:"Start a CLI coding agent in a terminal, wired to the shared Revka MCP daemon."})]}),c.jsxs("div",{className:"flex items-center gap-2 rounded border px-3 py-2 text-[11px]",style:{borderColor:"var(--revka-border-soft)",background:"color-mix(in srgb, var(--revka-bg-surface) 95%, transparent)"},children:[c.jsx("span",{className:"inline-block h-1.5 w-1.5 rounded-full",style:{background:O}}),c.jsx("span",{style:{color:"var(--revka-text-secondary)"},children:A})]}),c.jsxs("div",{children:[c.jsx("label",{className:"mb-1 block font-semibold uppercase tracking-[0.1em]",style:{color:"var(--revka-text-faint)",fontSize:"10px"},children:"Tool"}),c.jsx("select",{value:l,onChange:F=>u(F.target.value),className:"w-full rounded border bg-transparent px-2 py-1.5 text-xs outline-none",style:{borderColor:"var(--revka-border-soft)",color:"var(--revka-text-primary)",background:"var(--revka-bg-surface)"},children:O9.map(F=>c.jsx("option",{value:F.key,style:{background:"var(--revka-bg-panel-strong)"},children:F.label},F.key))})]}),l!=="operator"&&c.jsxs("div",{children:[c.jsx("label",{className:"mb-1 block font-semibold uppercase tracking-[0.1em]",style:{color:"var(--revka-text-faint)",fontSize:"10px"},children:"Repository Root"}),c.jsx("input",{type:"text",value:d,onChange:F=>p(F.target.value),placeholder:"/path/to/repo",className:"w-full rounded border bg-transparent px-2 py-1.5 font-mono text-xs outline-none",style:{borderColor:"var(--revka-border-soft)",color:"var(--revka-text-primary)",background:"var(--revka-bg-surface)"}}),v.length>0&&c.jsxs("div",{className:"mt-2",children:[c.jsx("label",{className:"mb-1 block font-semibold uppercase tracking-[0.1em]",style:{color:"var(--revka-text-faint)",fontSize:"10px"},children:"Recent"}),c.jsxs("select",{value:"",onChange:F=>{F.target.value&&p(F.target.value)},className:"w-full rounded border bg-transparent px-2 py-1.5 font-mono text-xs outline-none",style:{borderColor:"var(--revka-border-soft)",color:"var(--revka-text-primary)",background:"var(--revka-bg-surface)"},children:[c.jsx("option",{value:"",style:{background:"var(--revka-bg-panel-strong)"},children:"Select recent…"}),v.map(F=>c.jsx("option",{value:F,style:{background:"var(--revka-bg-panel-strong)"},children:F},F))]})]})]}),l==="operator"&&c.jsx("p",{className:"text-[11px]",style:{color:"var(--revka-text-muted)"},children:"Revka Operator runs as a chat conversation, not a PTY. Starting it will open a Chat tab with the Operator context."}),_&&c.jsxs("div",{className:"flex items-start gap-2 rounded border px-3 py-2 text-[11px]",style:{borderColor:"rgba(255,107,122,0.3)",background:"rgba(255,107,122,0.06)",color:"var(--revka-status-danger)"},children:[c.jsx(bv,{className:"mt-0.5 h-3 w-3 shrink-0"}),c.jsx("span",{children:_})]}),c.jsxs("button",{type:"button",onClick:E,disabled:f,className:"flex w-full items-center justify-center gap-1.5 rounded px-3 py-2 text-xs font-semibold uppercase tracking-[0.12em] transition-colors disabled:opacity-50",style:{background:n.primary+"22",color:n.primary,textShadow:n.glow,border:`1px solid ${n.primary}`},children:[c.jsx(k0,{className:"h-3 w-3"}),f?"Starting…":"Start Session"]})]})})}function ise(e){const n=e.split(/\r?\n/),r=n.some(a=>a.startsWith("diff --git")||a.startsWith("@@")||a.startsWith("--- ")||a.startsWith("+++ ")||a.startsWith("*** Begin Patch")||a.startsWith("*** Update File:")||a.startsWith("*** Add File:")||a.startsWith("*** Delete File:")),i=n.some(a=>a.startsWith("+")&&!a.startsWith("+++")),s=n.some(a=>a.startsWith("-")&&!a.startsWith("---"));return r||i&&s}function sse({detail:e,fontSize:n}){return c.jsx("div",{className:"overflow-auto rounded-[4px] border font-mono",style:{borderColor:"var(--revka-border-soft)",background:"var(--revka-bg-base)",fontSize:n,lineHeight:1.45,maxHeight:"28rem",textShadow:"none"},children:e.split(/\r?\n/).map((r,i)=>{const s=r.startsWith("+")&&!r.startsWith("+++"),a=r.startsWith("-")&&!r.startsWith("---"),o=r.startsWith("diff --git")||r.startsWith("@@")||r.startsWith("--- ")||r.startsWith("+++ ")||r.startsWith("*** ");return c.jsxs("div",{className:"grid min-w-max grid-cols-[2.5rem_1fr]",style:{background:s?"color-mix(in srgb, var(--revka-status-success) 12%, transparent)":a?"color-mix(in srgb, var(--revka-status-danger) 12%, transparent)":o?"color-mix(in srgb, var(--revka-bg-surface) 75%, transparent)":"transparent",color:s?"var(--revka-status-success)":a?"var(--revka-status-danger)":o?"var(--revka-text-primary)":"var(--revka-text-secondary)"},children:[c.jsx("span",{className:"select-none border-r px-2 text-right",style:{borderColor:"var(--revka-border-soft)",color:"var(--revka-text-faint)"},children:s?"+":a?"-":""}),c.jsx("span",{className:"whitespace-pre px-2",children:r})]},`${i}-${r.slice(0,16)}`)})})}function ase({event:e,accent:n,fontSize:r}){const[i,s]=b.useState(e.kind==="thinking"),[a,o]=b.useState(!1),l=!!e.detail&&e.detail.trim().length>0,u=r?`${r-1}px`:void 0,d=r?`${r-2}px`:"11px",p=async _=>{_.stopPropagation(),e.detail&&await ro(e.detail)&&(o(!0),setTimeout(()=>o(!1),1200))},f=e.kind==="tool_call"?"▸":e.kind==="tool_result"?"▾":e.kind==="thinking"?"…":"•",g=n??"var(--revka-text-faint)";return c.jsxs("div",{className:"my-0.5 rounded-[4px] border-l-2",style:{borderLeftColor:g,background:i?"color-mix(in srgb, var(--revka-bg-surface) 60%, transparent)":"transparent"},children:[c.jsxs("button",{type:"button",onClick:()=>l&&s(_=>!_),disabled:!l,className:"flex w-full items-center gap-2 px-2 py-1 text-left transition-colors",style:{cursor:l?"pointer":"default",color:"var(--revka-text-muted)",fontSize:u},children:[l?c.jsx(du,{className:"h-3 w-3 shrink-0 transition-transform",style:{color:"var(--revka-text-faint)",transform:i?"rotate(90deg)":"rotate(0deg)"}}):c.jsx("span",{className:"inline-block h-3 w-3 shrink-0 text-center",style:{color:"var(--revka-text-faint)"},children:f}),c.jsxs("span",{className:"truncate font-mono",children:[c.jsxs("span",{style:{color:"var(--revka-text-faint)"},children:["sys ",">"," "]}),e.label]})]}),l&&i&&c.jsxs("div",{className:"relative border-t px-3 py-2",style:{borderColor:"var(--revka-border-soft)",background:"var(--revka-bg-base)"},children:[ise(e.detail??"")?c.jsx(sse,{detail:e.detail??"",fontSize:d}):c.jsx("pre",{className:"overflow-x-auto whitespace-pre-wrap break-words font-mono",style:{color:"var(--revka-text-secondary)",fontSize:d,lineHeight:1.5,maxHeight:"20rem",overflowY:"auto"},children:e.detail}),c.jsx("button",{type:"button",onClick:p,"aria-label":a?"Copied":"Copy detail",title:a?"Copied":"Copy",className:"absolute right-1 top-1 inline-flex h-5 w-5 items-center justify-center rounded transition-colors hover:bg-white/5 focus:outline-none focus-visible:ring-1 focus-visible:ring-current",style:{color:"var(--revka-text-faint)"},children:a?c.jsx(no,{className:"h-3 w-3"}):c.jsx(rc,{className:"h-3 w-3"})})]})]})}const cb=b.memo(ase);function ose({attachment:e,onRemove:n,accent:r}){const i=e.mime.startsWith("image/"),s=r??"var(--revka-text-muted)";return c.jsxs("div",{className:"group inline-flex max-w-[220px] items-center gap-1.5 rounded-md border px-1.5 py-1 text-[11px] transition-colors",style:{borderColor:"var(--revka-border-soft)",background:"var(--revka-bg-surface)",color:"var(--revka-text-secondary)"},title:`${e.filename} · ${M4(e.size)} · ${e.mime}`,children:[i&&e.previewUrl?c.jsx("img",{src:e.previewUrl,alt:e.filename,className:"h-6 w-6 shrink-0 rounded-sm object-cover"}):i?c.jsx(qE,{className:"h-3.5 w-3.5 shrink-0",style:{color:s}}):c.jsx(wv,{className:"h-3.5 w-3.5 shrink-0",style:{color:s}}),c.jsx("span",{className:"min-w-0 flex-1 truncate font-mono",children:e.filename}),c.jsx("span",{className:"shrink-0 text-[10px]",style:{color:"var(--revka-text-faint)"},children:M4(e.size)}),c.jsx("button",{type:"button",onClick:()=>n(e.file_id),"aria-label":`Remove ${e.filename}`,title:"Remove",className:"ml-0.5 inline-flex h-4 w-4 shrink-0 items-center justify-center rounded transition-colors hover:bg-white/10 focus:outline-none focus-visible:ring-1 focus-visible:ring-current",style:{color:"var(--revka-text-faint)"},children:c.jsx(vi,{className:"h-2.5 w-2.5"})})]})}function M4(e){return e<1024?`${e} B`:e<1024*1024?`${Math.round(e/1024)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function lse(e,n){const r={};return(e[e.length-1]===""?[...e,""]:e).join((r.padRight?" ":"")+","+(r.padLeft===!1?"":" ")).trim()}const cse=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,use=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,dse={};function R4(e,n){return(dse.jsx?use:cse).test(e)}const hse=/[ \t\n\f\r]/g;function fse(e){return typeof e=="object"?e.type==="text"?O4(e.value):!1:O4(e)}function O4(e){return e.replace(hse,"")===""}let Mv=class{constructor(n,r,i){this.normal=r,this.property=n,i&&(this.space=i)}};Mv.prototype.normal={};Mv.prototype.property={};Mv.prototype.space=void 0;function B9(e,n){const r={},i={};for(const s of e)Object.assign(r,s.property),Object.assign(i,s.normal);return new Mv(r,i,n)}function yj(e){return e.toLowerCase()}class Ds{constructor(n,r){this.attribute=r,this.property=n}}Ds.prototype.attribute="";Ds.prototype.booleanish=!1;Ds.prototype.boolean=!1;Ds.prototype.commaOrSpaceSeparated=!1;Ds.prototype.commaSeparated=!1;Ds.prototype.defined=!1;Ds.prototype.mustUseProperty=!1;Ds.prototype.number=!1;Ds.prototype.overloadedBoolean=!1;Ds.prototype.property="";Ds.prototype.spaceSeparated=!1;Ds.prototype.space=void 0;let pse=0;const Zt=Ud(),Kr=Ud(),_j=Ud(),Ze=Ud(),tr=Ud(),xf=Ud(),Qs=Ud();function Ud(){return 2**++pse}const xj=Object.freeze(Object.defineProperty({__proto__:null,boolean:Zt,booleanish:Kr,commaOrSpaceSeparated:Qs,commaSeparated:xf,number:Ze,overloadedBoolean:_j,spaceSeparated:tr},Symbol.toStringTag,{value:"Module"})),eS=Object.keys(xj);class sA extends Ds{constructor(n,r,i,s){let a=-1;if(super(n,r),D4(this,"space",s),typeof i=="number")for(;++a<eS.length;){const o=eS[a];D4(this,eS[a],(i&xj[o])===xj[o])}}}sA.prototype.defined=!0;function D4(e,n,r){r&&(e[n]=r)}function dp(e){const n={},r={};for(const[i,s]of Object.entries(e.properties)){const a=new sA(i,e.transform(e.attributes||{},i),s,e.space);e.mustUseProperty&&e.mustUseProperty.includes(i)&&(a.mustUseProperty=!0),n[i]=a,r[yj(i)]=i,r[yj(a.attribute)]=i}return new Mv(n,r,e.space)}const z9=dp({properties:{ariaActiveDescendant:null,ariaAtomic:Kr,ariaAutoComplete:null,ariaBusy:Kr,ariaChecked:Kr,ariaColCount:Ze,ariaColIndex:Ze,ariaColSpan:Ze,ariaControls:tr,ariaCurrent:null,ariaDescribedBy:tr,ariaDetails:null,ariaDisabled:Kr,ariaDropEffect:tr,ariaErrorMessage:null,ariaExpanded:Kr,ariaFlowTo:tr,ariaGrabbed:Kr,ariaHasPopup:null,ariaHidden:Kr,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:tr,ariaLevel:Ze,ariaLive:null,ariaModal:Kr,ariaMultiLine:Kr,ariaMultiSelectable:Kr,ariaOrientation:null,ariaOwns:tr,ariaPlaceholder:null,ariaPosInSet:Ze,ariaPressed:Kr,ariaReadOnly:Kr,ariaRelevant:null,ariaRequired:Kr,ariaRoleDescription:tr,ariaRowCount:Ze,ariaRowIndex:Ze,ariaRowSpan:Ze,ariaSelected:Kr,ariaSetSize:Ze,ariaSort:null,ariaValueMax:Ze,ariaValueMin:Ze,ariaValueNow:Ze,ariaValueText:null,role:null},transform(e,n){return n==="role"?n:"aria-"+n.slice(4).toLowerCase()}});function $9(e,n){return n in e?e[n]:n}function F9(e,n){return $9(e,n.toLowerCase())}const mse=dp({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:xf,acceptCharset:tr,accessKey:tr,action:null,allow:null,allowFullScreen:Zt,allowPaymentRequest:Zt,allowUserMedia:Zt,alt:null,as:null,async:Zt,autoCapitalize:null,autoComplete:tr,autoFocus:Zt,autoPlay:Zt,blocking:tr,capture:null,charSet:null,checked:Zt,cite:null,className:tr,cols:Ze,colSpan:null,content:null,contentEditable:Kr,controls:Zt,controlsList:tr,coords:Ze|xf,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Zt,defer:Zt,dir:null,dirName:null,disabled:Zt,download:_j,draggable:Kr,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Zt,formTarget:null,headers:tr,height:Ze,hidden:_j,high:Ze,href:null,hrefLang:null,htmlFor:tr,httpEquiv:tr,id:null,imageSizes:null,imageSrcSet:null,inert:Zt,inputMode:null,integrity:null,is:null,isMap:Zt,itemId:null,itemProp:tr,itemRef:tr,itemScope:Zt,itemType:tr,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Zt,low:Ze,manifest:null,max:null,maxLength:Ze,media:null,method:null,min:null,minLength:Ze,multiple:Zt,muted:Zt,name:null,nonce:null,noModule:Zt,noValidate:Zt,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:Zt,optimum:Ze,pattern:null,ping:tr,placeholder:null,playsInline:Zt,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Zt,referrerPolicy:null,rel:tr,required:Zt,reversed:Zt,rows:Ze,rowSpan:Ze,sandbox:tr,scope:null,scoped:Zt,seamless:Zt,selected:Zt,shadowRootClonable:Zt,shadowRootDelegatesFocus:Zt,shadowRootMode:null,shape:null,size:Ze,sizes:null,slot:null,span:Ze,spellCheck:Kr,src:null,srcDoc:null,srcLang:null,srcSet:null,start:Ze,step:null,style:null,tabIndex:Ze,target:null,title:null,translate:null,type:null,typeMustMatch:Zt,useMap:null,value:Kr,width:Ze,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:tr,axis:null,background:null,bgColor:null,border:Ze,borderColor:null,bottomMargin:Ze,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:Zt,declare:Zt,event:null,face:null,frame:null,frameBorder:null,hSpace:Ze,leftMargin:Ze,link:null,longDesc:null,lowSrc:null,marginHeight:Ze,marginWidth:Ze,noResize:Zt,noHref:Zt,noShade:Zt,noWrap:Zt,object:null,profile:null,prompt:null,rev:null,rightMargin:Ze,rules:null,scheme:null,scrolling:Kr,standby:null,summary:null,text:null,topMargin:Ze,valueType:null,version:null,vAlign:null,vLink:null,vSpace:Ze,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:Zt,disableRemotePlayback:Zt,prefix:null,property:null,results:Ze,security:null,unselectable:null},space:"html",transform:F9}),gse=dp({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:Qs,accentHeight:Ze,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:Ze,amplitude:Ze,arabicForm:null,ascent:Ze,attributeName:null,attributeType:null,azimuth:Ze,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:Ze,by:null,calcMode:null,capHeight:Ze,className:tr,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:Ze,diffuseConstant:Ze,direction:null,display:null,dur:null,divisor:Ze,dominantBaseline:null,download:Zt,dx:null,dy:null,edgeMode:null,editable:null,elevation:Ze,enableBackground:null,end:null,event:null,exponent:Ze,externalResourcesRequired:null,fill:null,fillOpacity:Ze,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:xf,g2:xf,glyphName:xf,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:Ze,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:Ze,horizOriginX:Ze,horizOriginY:Ze,id:null,ideographic:Ze,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:Ze,k:Ze,k1:Ze,k2:Ze,k3:Ze,k4:Ze,kernelMatrix:Qs,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:Ze,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:Ze,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:Ze,overlineThickness:Ze,paintOrder:null,panose1:null,path:null,pathLength:Ze,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:tr,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:Ze,pointsAtY:Ze,pointsAtZ:Ze,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Qs,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Qs,rev:Qs,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Qs,requiredFeatures:Qs,requiredFonts:Qs,requiredFormats:Qs,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:Ze,specularExponent:Ze,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:Ze,strikethroughThickness:Ze,string:null,stroke:null,strokeDashArray:Qs,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:Ze,strokeOpacity:Ze,strokeWidth:null,style:null,surfaceScale:Ze,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Qs,tabIndex:Ze,tableValues:null,target:null,targetX:Ze,targetY:Ze,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Qs,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:Ze,underlineThickness:Ze,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:Ze,values:null,vAlphabetic:Ze,vMathematical:Ze,vectorEffect:null,vHanging:Ze,vIdeographic:Ze,version:null,vertAdvY:Ze,vertOriginX:Ze,vertOriginY:Ze,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:Ze,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:$9}),H9=dp({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(e,n){return"xlink:"+n.slice(5).toLowerCase()}}),W9=dp({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:F9}),q9=dp({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,n){return"xml:"+n.slice(3).toLowerCase()}}),vse={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"},yse=/[A-Z]/g,P4=/-[a-z]/g,_se=/^data[-\w.:]+$/i;function xse(e,n){const r=yj(n);let i=n,s=Ds;if(r in e.normal)return e.property[e.normal[r]];if(r.length>4&&r.slice(0,4)==="data"&&_se.test(n)){if(n.charAt(4)==="-"){const a=n.slice(5).replace(P4,kse);i="data"+a.charAt(0).toUpperCase()+a.slice(1)}else{const a=n.slice(4);if(!P4.test(a)){let o=a.replace(yse,bse);o.charAt(0)!=="-"&&(o="-"+o),n="data"+o}}s=sA}return new s(i,n)}function bse(e){return"-"+e.toLowerCase()}function kse(e){return e.charAt(1).toUpperCase()}const wse=B9([z9,mse,H9,W9,q9],"html"),aA=B9([z9,gse,H9,W9,q9],"svg");function Sse(e){return e.join(" ").trim()}var Th={},tS,L4;function Cse(){if(L4)return tS;L4=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,n=/\n/g,r=/^\s*/,i=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,s=/^:\s*/,a=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,o=/^[;\s]*/,l=/^\s+|\s+$/g,u=`
`,d="/",p="*",f="",g="comment",_="declaration";function x(S,w){if(typeof S!="string")throw new TypeError("First argument must be a string");if(!S)return[];w=w||{};var j=1,C=1;function T(D){var U=D.match(n);U&&(j+=U.length);var I=D.lastIndexOf(u);C=~I?D.length-I:C+D.length}function E(){var D={line:j,column:C};return function(U){return U.position=new A(D),L(),U}}function A(D){this.start=D,this.end={line:j,column:C},this.source=w.source}A.prototype.content=S;function O(D){var U=new Error(w.source+":"+j+":"+C+": "+D);if(U.reason=D,U.filename=w.source,U.line=j,U.column=C,U.source=S,!w.silent)throw U}function F(D){var U=D.exec(S);if(U){var I=U[0];return T(I),S=S.slice(I.length),U}}function L(){F(r)}function $(D){var U;for(D=D||[];U=z();)U!==!1&&D.push(U);return D}function z(){var D=E();if(!(d!=S.charAt(0)||p!=S.charAt(1))){for(var U=2;f!=S.charAt(U)&&(p!=S.charAt(U)||d!=S.charAt(U+1));)++U;if(U+=2,f===S.charAt(U-1))return O("End of comment missing");var I=S.slice(2,U-2);return C+=2,T(I),S=S.slice(U),C+=2,D({type:g,comment:I})}}function B(){var D=E(),U=F(i);if(U){if(z(),!F(s))return O("property missing ':'");var I=F(a),X=D({type:_,property:v(U[0].replace(e,f)),value:I?v(I[0].replace(e,f)):f});return F(o),X}}function H(){var D=[];$(D);for(var U;U=B();)U!==!1&&(D.push(U),$(D));return D}return L(),H()}function v(S){return S?S.replace(l,f):f}return tS=x,tS}var I4;function jse(){if(I4)return Th;I4=1;var e=Th&&Th.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};Object.defineProperty(Th,"__esModule",{value:!0}),Th.default=r;const n=e(Cse());function r(i,s){let a=null;if(!i||typeof i!="string")return a;const o=(0,n.default)(i),l=typeof s=="function";return o.forEach(u=>{if(u.type!=="declaration")return;const{property:d,value:p}=u;l?s(d,p,u):p&&(a=a||{},a[d]=p)}),a}return Th}var hm={},B4;function Nse(){if(B4)return hm;B4=1,Object.defineProperty(hm,"__esModule",{value:!0}),hm.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,n=/-([a-z])/g,r=/^[^-]+$/,i=/^-(webkit|moz|ms|o|khtml)-/,s=/^-(ms)-/,a=function(d){return!d||r.test(d)||e.test(d)},o=function(d,p){return p.toUpperCase()},l=function(d,p){return"".concat(p,"-")},u=function(d,p){return p===void 0&&(p={}),a(d)?d:(d=d.toLowerCase(),p.reactCompat?d=d.replace(s,l):d=d.replace(i,l),d.replace(n,o))};return hm.camelCase=u,hm}var fm,z4;function Ese(){if(z4)return fm;z4=1;var e=fm&&fm.__importDefault||function(s){return s&&s.__esModule?s:{default:s}},n=e(jse()),r=Nse();function i(s,a){var o={};return!s||typeof s!="string"||(0,n.default)(s,function(l,u){l&&u&&(o[(0,r.camelCase)(l,a)]=u)}),o}return i.default=i,fm=i,fm}var Ase=Ese();const Tse=wu(Ase),U9=K9("end"),oA=K9("start");function K9(e){return n;function n(r){const i=r&&r.position&&r.position[e]||{};if(typeof i.line=="number"&&i.line>0&&typeof i.column=="number"&&i.column>0)return{line:i.line,column:i.column,offset:typeof i.offset=="number"&&i.offset>-1?i.offset:void 0}}}function Mse(e){const n=oA(e),r=U9(e);if(n&&r)return{start:n,end:r}}function ag(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?$4(e.position):"start"in e||"end"in e?$4(e):"line"in e||"column"in e?bj(e):""}function bj(e){return F4(e&&e.line)+":"+F4(e&&e.column)}function $4(e){return bj(e&&e.start)+"-"+bj(e&&e.end)}function F4(e){return e&&typeof e=="number"?e:1}class Yi extends Error{constructor(n,r,i){super(),typeof r=="string"&&(i=r,r=void 0);let s="",a={},o=!1;if(r&&("line"in r&&"column"in r?a={place:r}:"start"in r&&"end"in r?a={place:r}:"type"in r?a={ancestors:[r],place:r.position}:a={...r}),typeof n=="string"?s=n:!a.cause&&n&&(o=!0,s=n.message,a.cause=n),!a.ruleId&&!a.source&&typeof i=="string"){const u=i.indexOf(":");u===-1?a.ruleId=i:(a.source=i.slice(0,u),a.ruleId=i.slice(u+1))}if(!a.place&&a.ancestors&&a.ancestors){const u=a.ancestors[a.ancestors.length-1];u&&(a.place=u.position)}const l=a.place&&"start"in a.place?a.place.start:a.place;this.ancestors=a.ancestors||void 0,this.cause=a.cause||void 0,this.column=l?l.column:void 0,this.fatal=void 0,this.file="",this.message=s,this.line=l?l.line:void 0,this.name=ag(a.place)||"1:1",this.place=a.place||void 0,this.reason=this.message,this.ruleId=a.ruleId||void 0,this.source=a.source||void 0,this.stack=o&&a.cause&&typeof a.cause.stack=="string"?a.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}Yi.prototype.file="";Yi.prototype.name="";Yi.prototype.reason="";Yi.prototype.message="";Yi.prototype.stack="";Yi.prototype.column=void 0;Yi.prototype.line=void 0;Yi.prototype.ancestors=void 0;Yi.prototype.cause=void 0;Yi.prototype.fatal=void 0;Yi.prototype.place=void 0;Yi.prototype.ruleId=void 0;Yi.prototype.source=void 0;const lA={}.hasOwnProperty,Rse=new Map,Ose=/[A-Z]/g,Dse=new Set(["table","tbody","thead","tfoot","tr"]),Pse=new Set(["td","th"]),V9="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function Lse(e,n){if(!n||n.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const r=n.filePath||void 0;let i;if(n.development){if(typeof n.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");i=qse(r,n.jsxDEV)}else{if(typeof n.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof n.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");i=Wse(r,n.jsx,n.jsxs)}const s={Fragment:n.Fragment,ancestors:[],components:n.components||{},create:i,elementAttributeNameCase:n.elementAttributeNameCase||"react",evaluater:n.createEvaluater?n.createEvaluater():void 0,filePath:r,ignoreInvalidStyle:n.ignoreInvalidStyle||!1,passKeys:n.passKeys!==!1,passNode:n.passNode||!1,schema:n.space==="svg"?aA:wse,stylePropertyNameCase:n.stylePropertyNameCase||"dom",tableCellAlignToStyle:n.tableCellAlignToStyle!==!1},a=Y9(s,e,void 0);return a&&typeof a!="string"?a:s.create(e,s.Fragment,{children:a||void 0},void 0)}function Y9(e,n,r){if(n.type==="element")return Ise(e,n,r);if(n.type==="mdxFlowExpression"||n.type==="mdxTextExpression")return Bse(e,n);if(n.type==="mdxJsxFlowElement"||n.type==="mdxJsxTextElement")return $se(e,n,r);if(n.type==="mdxjsEsm")return zse(e,n);if(n.type==="root")return Fse(e,n,r);if(n.type==="text")return Hse(e,n)}function Ise(e,n,r){const i=e.schema;let s=i;n.tagName.toLowerCase()==="svg"&&i.space==="html"&&(s=aA,e.schema=s),e.ancestors.push(n);const a=X9(e,n.tagName,!1),o=Use(e,n);let l=uA(e,n);return Dse.has(n.tagName)&&(l=l.filter(function(u){return typeof u=="string"?!fse(u):!0})),G9(e,o,a,n),cA(o,l),e.ancestors.pop(),e.schema=i,e.create(n,a,o,r)}function Bse(e,n){if(n.data&&n.data.estree&&e.evaluater){const i=n.data.estree.body[0];return i.type,e.evaluater.evaluateExpression(i.expression)}Dg(e,n.position)}function zse(e,n){if(n.data&&n.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(n.data.estree);Dg(e,n.position)}function $se(e,n,r){const i=e.schema;let s=i;n.name==="svg"&&i.space==="html"&&(s=aA,e.schema=s),e.ancestors.push(n);const a=n.name===null?e.Fragment:X9(e,n.name,!0),o=Kse(e,n),l=uA(e,n);return G9(e,o,a,n),cA(o,l),e.ancestors.pop(),e.schema=i,e.create(n,a,o,r)}function Fse(e,n,r){const i={};return cA(i,uA(e,n)),e.create(n,e.Fragment,i,r)}function Hse(e,n){return n.value}function G9(e,n,r,i){typeof r!="string"&&r!==e.Fragment&&e.passNode&&(n.node=i)}function cA(e,n){if(n.length>0){const r=n.length>1?n:n[0];r&&(e.children=r)}}function Wse(e,n,r){return i;function i(s,a,o,l){const d=Array.isArray(o.children)?r:n;return l?d(a,o,l):d(a,o)}}function qse(e,n){return r;function r(i,s,a,o){const l=Array.isArray(a.children),u=oA(i);return n(s,a,o,l,{columnNumber:u?u.column-1:void 0,fileName:e,lineNumber:u?u.line:void 0},void 0)}}function Use(e,n){const r={};let i,s;for(s in n.properties)if(s!=="children"&&lA.call(n.properties,s)){const a=Vse(e,s,n.properties[s]);if(a){const[o,l]=a;e.tableCellAlignToStyle&&o==="align"&&typeof l=="string"&&Pse.has(n.tagName)?i=l:r[o]=l}}if(i){const a=r.style||(r.style={});a[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=i}return r}function Kse(e,n){const r={};for(const i of n.attributes)if(i.type==="mdxJsxExpressionAttribute")if(i.data&&i.data.estree&&e.evaluater){const a=i.data.estree.body[0];a.type;const o=a.expression;o.type;const l=o.properties[0];l.type,Object.assign(r,e.evaluater.evaluateExpression(l.argument))}else Dg(e,n.position);else{const s=i.name;let a;if(i.value&&typeof i.value=="object")if(i.value.data&&i.value.data.estree&&e.evaluater){const l=i.value.data.estree.body[0];l.type,a=e.evaluater.evaluateExpression(l.expression)}else Dg(e,n.position);else a=i.value===null?!0:i.value;r[s]=a}return r}function uA(e,n){const r=[];let i=-1;const s=e.passKeys?new Map:Rse;for(;++i<n.children.length;){const a=n.children[i];let o;if(e.passKeys){const u=a.type==="element"?a.tagName:a.type==="mdxJsxFlowElement"||a.type==="mdxJsxTextElement"?a.name:void 0;if(u){const d=s.get(u)||0;o=u+"-"+d,s.set(u,d+1)}}const l=Y9(e,a,o);l!==void 0&&r.push(l)}return r}function Vse(e,n,r){const i=xse(e.schema,n);if(!(r==null||typeof r=="number"&&Number.isNaN(r))){if(Array.isArray(r)&&(r=i.commaSeparated?lse(r):Sse(r)),i.property==="style"){let s=typeof r=="object"?r:Yse(e,String(r));return e.stylePropertyNameCase==="css"&&(s=Gse(s)),["style",s]}return[e.elementAttributeNameCase==="react"&&i.space?vse[i.property]||i.property:i.attribute,r]}}function Yse(e,n){try{return Tse(n,{reactCompat:!0})}catch(r){if(e.ignoreInvalidStyle)return{};const i=r,s=new Yi("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:i,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw s.file=e.filePath||void 0,s.url=V9+"#cannot-parse-style-attribute",s}}function X9(e,n,r){let i;if(!r)i={type:"Literal",value:n};else if(n.includes(".")){const s=n.split(".");let a=-1,o;for(;++a<s.length;){const l=R4(s[a])?{type:"Identifier",name:s[a]}:{type:"Literal",value:s[a]};o=o?{type:"MemberExpression",object:o,property:l,computed:!!(a&&l.type==="Literal"),optional:!1}:l}i=o}else i=R4(n)&&!/^[a-z]/.test(n)?{type:"Identifier",name:n}:{type:"Literal",value:n};if(i.type==="Literal"){const s=i.value;return lA.call(e.components,s)?e.components[s]:s}if(e.evaluater)return e.evaluater.evaluateExpression(i);Dg(e)}function Dg(e,n){const r=new Yi("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:n,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw r.file=e.filePath||void 0,r.url=V9+"#cannot-handle-mdx-estrees-without-createevaluater",r}function Gse(e){const n={};let r;for(r in e)lA.call(e,r)&&(n[Xse(r)]=e[r]);return n}function Xse(e){let n=e.replace(Ose,Qse);return n.slice(0,3)==="ms-"&&(n="-"+n),n}function Qse(e){return"-"+e.toLowerCase()}const nS={action:["form"],cite:["blockquote","del","ins","q"],data:["object"],formAction:["button","input"],href:["a","area","base","link"],icon:["menuitem"],itemId:null,manifest:["html"],ping:["a","area"],poster:["video"],src:["audio","embed","iframe","img","input","script","source","track","video"]},Zse={};function dA(e,n){const r=Zse,i=typeof r.includeImageAlt=="boolean"?r.includeImageAlt:!0,s=typeof r.includeHtml=="boolean"?r.includeHtml:!0;return Q9(e,i,s)}function Q9(e,n,r){if(Jse(e)){if("value"in e)return e.type==="html"&&!r?"":e.value;if(n&&"alt"in e&&e.alt)return e.alt;if("children"in e)return H4(e.children,n,r)}return Array.isArray(e)?H4(e,n,r):""}function H4(e,n,r){const i=[];let s=-1;for(;++s<e.length;)i[s]=Q9(e[s],n,r);return i.join("")}function Jse(e){return!!(e&&typeof e=="object")}const W4=document.createElement("i");function hA(e){const n="&"+e+";";W4.innerHTML=n;const r=W4.textContent;return r.charCodeAt(r.length-1)===59&&e!=="semi"||r===n?!1:r}function ra(e,n,r,i){const s=e.length;let a=0,o;if(n<0?n=-n>s?0:s+n:n=n>s?s:n,r=r>0?r:0,i.length<1e4)o=Array.from(i),o.unshift(n,r),e.splice(...o);else for(r&&e.splice(n,r);a<i.length;)o=i.slice(a,a+1e4),o.unshift(n,0),e.splice(...o),a+=1e4,n+=1e4}function Ca(e,n){return e.length>0?(ra(e,e.length,0,n),e):n}const q4={}.hasOwnProperty;function Z9(e){const n={};let r=-1;for(;++r<e.length;)eae(n,e[r]);return n}function eae(e,n){let r;for(r in n){const s=(q4.call(e,r)?e[r]:void 0)||(e[r]={}),a=n[r];let o;if(a)for(o in a){q4.call(s,o)||(s[o]=[]);const l=a[o];tae(s[o],Array.isArray(l)?l:l?[l]:[])}}}function tae(e,n){let r=-1;const i=[];for(;++r<n.length;)(n[r].add==="after"?e:i).push(n[r]);ra(e,0,0,i)}function J9(e,n){const r=Number.parseInt(e,n);return r<9||r===11||r>13&&r<32||r>126&&r<160||r>55295&&r<57344||r>64975&&r<65008||(r&65535)===65535||(r&65535)===65534||r>1114111?"�":String.fromCodePoint(r)}function to(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const ts=Su(/[A-Za-z]/),Ui=Su(/[\dA-Za-z]/),nae=Su(/[#-'*+\--9=?A-Z^-~]/);function ub(e){return e!==null&&(e<32||e===127)}const kj=Su(/\d/),rae=Su(/[\dA-Fa-f]/),iae=Su(/[!-/:-@[-`{-~]/);function It(e){return e!==null&&e<-2}function er(e){return e!==null&&(e<0||e===32)}function hn(e){return e===-2||e===-1||e===32}const D0=Su(new RegExp("\\p{P}|\\p{S}","u")),Od=Su(/\s/);function Su(e){return n;function n(r){return r!==null&&r>-1&&e.test(String.fromCharCode(r))}}function hp(e){const n=[];let r=-1,i=0,s=0;for(;++r<e.length;){const a=e.charCodeAt(r);let o="";if(a===37&&Ui(e.charCodeAt(r+1))&&Ui(e.charCodeAt(r+2)))s=2;else if(a<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(a))||(o=String.fromCharCode(a));else if(a>55295&&a<57344){const l=e.charCodeAt(r+1);a<56320&&l>56319&&l<57344?(o=String.fromCharCode(a,l),s=1):o="�"}else o=String.fromCharCode(a);o&&(n.push(e.slice(i,r),encodeURIComponent(o)),i=r+s+1,o=""),s&&(r+=s,s=0)}return n.join("")+e.slice(i)}function wn(e,n,r,i){const s=i?i-1:Number.POSITIVE_INFINITY;let a=0;return o;function o(u){return hn(u)?(e.enter(r),l(u)):n(u)}function l(u){return hn(u)&&a++<s?(e.consume(u),l):(e.exit(r),n(u))}}const sae={tokenize:aae};function aae(e){const n=e.attempt(this.parser.constructs.contentInitial,i,s);let r;return n;function i(l){if(l===null){e.consume(l);return}return e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),wn(e,n,"linePrefix")}function s(l){return e.enter("paragraph"),a(l)}function a(l){const u=e.enter("chunkText",{contentType:"text",previous:r});return r&&(r.next=u),r=u,o(l)}function o(l){if(l===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(l);return}return It(l)?(e.consume(l),e.exit("chunkText"),a):(e.consume(l),o)}}const oae={tokenize:lae},U4={tokenize:cae};function lae(e){const n=this,r=[];let i=0,s,a,o;return l;function l(C){if(i<r.length){const T=r[i];return n.containerState=T[1],e.attempt(T[0].continuation,u,d)(C)}return d(C)}function u(C){if(i++,n.containerState._closeFlow){n.containerState._closeFlow=void 0,s&&j();const T=n.events.length;let E=T,A;for(;E--;)if(n.events[E][0]==="exit"&&n.events[E][1].type==="chunkFlow"){A=n.events[E][1].end;break}w(i);let O=T;for(;O<n.events.length;)n.events[O][1].end={...A},O++;return ra(n.events,E+1,0,n.events.slice(T)),n.events.length=O,d(C)}return l(C)}function d(C){if(i===r.length){if(!s)return g(C);if(s.currentConstruct&&s.currentConstruct.concrete)return x(C);n.interrupt=!!(s.currentConstruct&&!s._gfmTableDynamicInterruptHack)}return n.containerState={},e.check(U4,p,f)(C)}function p(C){return s&&j(),w(i),g(C)}function f(C){return n.parser.lazy[n.now().line]=i!==r.length,o=n.now().offset,x(C)}function g(C){return n.containerState={},e.attempt(U4,_,x)(C)}function _(C){return i++,r.push([n.currentConstruct,n.containerState]),g(C)}function x(C){if(C===null){s&&j(),w(0),e.consume(C);return}return s=s||n.parser.flow(n.now()),e.enter("chunkFlow",{_tokenizer:s,contentType:"flow",previous:a}),v(C)}function v(C){if(C===null){S(e.exit("chunkFlow"),!0),w(0),e.consume(C);return}return It(C)?(e.consume(C),S(e.exit("chunkFlow")),i=0,n.interrupt=void 0,l):(e.consume(C),v)}function S(C,T){const E=n.sliceStream(C);if(T&&E.push(null),C.previous=a,a&&(a.next=C),a=C,s.defineSkip(C.start),s.write(E),n.parser.lazy[C.start.line]){let A=s.events.length;for(;A--;)if(s.events[A][1].start.offset<o&&(!s.events[A][1].end||s.events[A][1].end.offset>o))return;const O=n.events.length;let F=O,L,$;for(;F--;)if(n.events[F][0]==="exit"&&n.events[F][1].type==="chunkFlow"){if(L){$=n.events[F][1].end;break}L=!0}for(w(i),A=O;A<n.events.length;)n.events[A][1].end={...$},A++;ra(n.events,F+1,0,n.events.slice(O)),n.events.length=A}}function w(C){let T=r.length;for(;T-- >C;){const E=r[T];n.containerState=E[1],E[0].exit.call(n,e)}r.length=C}function j(){s.write([null]),a=void 0,s=void 0,n.containerState._closeFlow=void 0}}function cae(e,n,r){return wn(e,e.attempt(this.parser.constructs.document,n,r),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Lf(e){if(e===null||er(e)||Od(e))return 1;if(D0(e))return 2}function P0(e,n,r){const i=[];let s=-1;for(;++s<e.length;){const a=e[s].resolveAll;a&&!i.includes(a)&&(n=a(n,r),i.push(a))}return n}const wj={name:"attention",resolveAll:uae,tokenize:dae};function uae(e,n){let r=-1,i,s,a,o,l,u,d,p;for(;++r<e.length;)if(e[r][0]==="enter"&&e[r][1].type==="attentionSequence"&&e[r][1]._close){for(i=r;i--;)if(e[i][0]==="exit"&&e[i][1].type==="attentionSequence"&&e[i][1]._open&&n.sliceSerialize(e[i][1]).charCodeAt(0)===n.sliceSerialize(e[r][1]).charCodeAt(0)){if((e[i][1]._close||e[r][1]._open)&&(e[r][1].end.offset-e[r][1].start.offset)%3&&!((e[i][1].end.offset-e[i][1].start.offset+e[r][1].end.offset-e[r][1].start.offset)%3))continue;u=e[i][1].end.offset-e[i][1].start.offset>1&&e[r][1].end.offset-e[r][1].start.offset>1?2:1;const f={...e[i][1].end},g={...e[r][1].start};K4(f,-u),K4(g,u),o={type:u>1?"strongSequence":"emphasisSequence",start:f,end:{...e[i][1].end}},l={type:u>1?"strongSequence":"emphasisSequence",start:{...e[r][1].start},end:g},a={type:u>1?"strongText":"emphasisText",start:{...e[i][1].end},end:{...e[r][1].start}},s={type:u>1?"strong":"emphasis",start:{...o.start},end:{...l.end}},e[i][1].end={...o.start},e[r][1].start={...l.end},d=[],e[i][1].end.offset-e[i][1].start.offset&&(d=Ca(d,[["enter",e[i][1],n],["exit",e[i][1],n]])),d=Ca(d,[["enter",s,n],["enter",o,n],["exit",o,n],["enter",a,n]]),d=Ca(d,P0(n.parser.constructs.insideSpan.null,e.slice(i+1,r),n)),d=Ca(d,[["exit",a,n],["enter",l,n],["exit",l,n],["exit",s,n]]),e[r][1].end.offset-e[r][1].start.offset?(p=2,d=Ca(d,[["enter",e[r][1],n],["exit",e[r][1],n]])):p=0,ra(e,i-1,r-i+3,d),r=i+d.length-p-2;break}}for(r=-1;++r<e.length;)e[r][1].type==="attentionSequence"&&(e[r][1].type="data");return e}function dae(e,n){const r=this.parser.constructs.attentionMarkers.null,i=this.previous,s=Lf(i);let a;return o;function o(u){return a=u,e.enter("attentionSequence"),l(u)}function l(u){if(u===a)return e.consume(u),l;const d=e.exit("attentionSequence"),p=Lf(u),f=!p||p===2&&s||r.includes(u),g=!s||s===2&&p||r.includes(i);return d._open=!!(a===42?f:f&&(s||!g)),d._close=!!(a===42?g:g&&(p||!f)),n(u)}}function K4(e,n){e.column+=n,e.offset+=n,e._bufferIndex+=n}const hae={name:"autolink",tokenize:fae};function fae(e,n,r){let i=0;return s;function s(_){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(_),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),a}function a(_){return ts(_)?(e.consume(_),o):_===64?r(_):d(_)}function o(_){return _===43||_===45||_===46||Ui(_)?(i=1,l(_)):d(_)}function l(_){return _===58?(e.consume(_),i=0,u):(_===43||_===45||_===46||Ui(_))&&i++<32?(e.consume(_),l):(i=0,d(_))}function u(_){return _===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(_),e.exit("autolinkMarker"),e.exit("autolink"),n):_===null||_===32||_===60||ub(_)?r(_):(e.consume(_),u)}function d(_){return _===64?(e.consume(_),p):nae(_)?(e.consume(_),d):r(_)}function p(_){return Ui(_)?f(_):r(_)}function f(_){return _===46?(e.consume(_),i=0,p):_===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(_),e.exit("autolinkMarker"),e.exit("autolink"),n):g(_)}function g(_){if((_===45||Ui(_))&&i++<63){const x=_===45?g:f;return e.consume(_),x}return r(_)}}const Rv={partial:!0,tokenize:pae};function pae(e,n,r){return i;function i(a){return hn(a)?wn(e,s,"linePrefix")(a):s(a)}function s(a){return a===null||It(a)?n(a):r(a)}}const e$={continuation:{tokenize:gae},exit:vae,name:"blockQuote",tokenize:mae};function mae(e,n,r){const i=this;return s;function s(o){if(o===62){const l=i.containerState;return l.open||(e.enter("blockQuote",{_container:!0}),l.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(o),e.exit("blockQuoteMarker"),a}return r(o)}function a(o){return hn(o)?(e.enter("blockQuotePrefixWhitespace"),e.consume(o),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),n):(e.exit("blockQuotePrefix"),n(o))}}function gae(e,n,r){const i=this;return s;function s(o){return hn(o)?wn(e,a,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(o):a(o)}function a(o){return e.attempt(e$,n,r)(o)}}function vae(e){e.exit("blockQuote")}const t$={name:"characterEscape",tokenize:yae};function yae(e,n,r){return i;function i(a){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(a),e.exit("escapeMarker"),s}function s(a){return iae(a)?(e.enter("characterEscapeValue"),e.consume(a),e.exit("characterEscapeValue"),e.exit("characterEscape"),n):r(a)}}const n$={name:"characterReference",tokenize:_ae};function _ae(e,n,r){const i=this;let s=0,a,o;return l;function l(f){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(f),e.exit("characterReferenceMarker"),u}function u(f){return f===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(f),e.exit("characterReferenceMarkerNumeric"),d):(e.enter("characterReferenceValue"),a=31,o=Ui,p(f))}function d(f){return f===88||f===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(f),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),a=6,o=rae,p):(e.enter("characterReferenceValue"),a=7,o=kj,p(f))}function p(f){if(f===59&&s){const g=e.exit("characterReferenceValue");return o===Ui&&!hA(i.sliceSerialize(g))?r(f):(e.enter("characterReferenceMarker"),e.consume(f),e.exit("characterReferenceMarker"),e.exit("characterReference"),n)}return o(f)&&s++<a?(e.consume(f),p):r(f)}}const V4={partial:!0,tokenize:bae},Y4={concrete:!0,name:"codeFenced",tokenize:xae};function xae(e,n,r){const i=this,s={partial:!0,tokenize:E};let a=0,o=0,l;return u;function u(A){return d(A)}function d(A){const O=i.events[i.events.length-1];return a=O&&O[1].type==="linePrefix"?O[2].sliceSerialize(O[1],!0).length:0,l=A,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),p(A)}function p(A){return A===l?(o++,e.consume(A),p):o<3?r(A):(e.exit("codeFencedFenceSequence"),hn(A)?wn(e,f,"whitespace")(A):f(A))}function f(A){return A===null||It(A)?(e.exit("codeFencedFence"),i.interrupt?n(A):e.check(V4,v,T)(A)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),g(A))}function g(A){return A===null||It(A)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),f(A)):hn(A)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),wn(e,_,"whitespace")(A)):A===96&&A===l?r(A):(e.consume(A),g)}function _(A){return A===null||It(A)?f(A):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),x(A))}function x(A){return A===null||It(A)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),f(A)):A===96&&A===l?r(A):(e.consume(A),x)}function v(A){return e.attempt(s,T,S)(A)}function S(A){return e.enter("lineEnding"),e.consume(A),e.exit("lineEnding"),w}function w(A){return a>0&&hn(A)?wn(e,j,"linePrefix",a+1)(A):j(A)}function j(A){return A===null||It(A)?e.check(V4,v,T)(A):(e.enter("codeFlowValue"),C(A))}function C(A){return A===null||It(A)?(e.exit("codeFlowValue"),j(A)):(e.consume(A),C)}function T(A){return e.exit("codeFenced"),n(A)}function E(A,O,F){let L=0;return $;function $(U){return A.enter("lineEnding"),A.consume(U),A.exit("lineEnding"),z}function z(U){return A.enter("codeFencedFence"),hn(U)?wn(A,B,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(U):B(U)}function B(U){return U===l?(A.enter("codeFencedFenceSequence"),H(U)):F(U)}function H(U){return U===l?(L++,A.consume(U),H):L>=o?(A.exit("codeFencedFenceSequence"),hn(U)?wn(A,D,"whitespace")(U):D(U)):F(U)}function D(U){return U===null||It(U)?(A.exit("codeFencedFence"),O(U)):F(U)}}}function bae(e,n,r){const i=this;return s;function s(o){return o===null?r(o):(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),a)}function a(o){return i.parser.lazy[i.now().line]?r(o):n(o)}}const rS={name:"codeIndented",tokenize:wae},kae={partial:!0,tokenize:Sae};function wae(e,n,r){const i=this;return s;function s(d){return e.enter("codeIndented"),wn(e,a,"linePrefix",5)(d)}function a(d){const p=i.events[i.events.length-1];return p&&p[1].type==="linePrefix"&&p[2].sliceSerialize(p[1],!0).length>=4?o(d):r(d)}function o(d){return d===null?u(d):It(d)?e.attempt(kae,o,u)(d):(e.enter("codeFlowValue"),l(d))}function l(d){return d===null||It(d)?(e.exit("codeFlowValue"),o(d)):(e.consume(d),l)}function u(d){return e.exit("codeIndented"),n(d)}}function Sae(e,n,r){const i=this;return s;function s(o){return i.parser.lazy[i.now().line]?r(o):It(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),s):wn(e,a,"linePrefix",5)(o)}function a(o){const l=i.events[i.events.length-1];return l&&l[1].type==="linePrefix"&&l[2].sliceSerialize(l[1],!0).length>=4?n(o):It(o)?s(o):r(o)}}const Cae={name:"codeText",previous:Nae,resolve:jae,tokenize:Eae};function jae(e){let n=e.length-4,r=3,i,s;if((e[r][1].type==="lineEnding"||e[r][1].type==="space")&&(e[n][1].type==="lineEnding"||e[n][1].type==="space")){for(i=r;++i<n;)if(e[i][1].type==="codeTextData"){e[r][1].type="codeTextPadding",e[n][1].type="codeTextPadding",r+=2,n-=2;break}}for(i=r-1,n++;++i<=n;)s===void 0?i!==n&&e[i][1].type!=="lineEnding"&&(s=i):(i===n||e[i][1].type==="lineEnding")&&(e[s][1].type="codeTextData",i!==s+2&&(e[s][1].end=e[i-1][1].end,e.splice(s+2,i-s-2),n-=i-s-2,i=s+2),s=void 0);return e}function Nae(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function Eae(e,n,r){let i=0,s,a;return o;function o(f){return e.enter("codeText"),e.enter("codeTextSequence"),l(f)}function l(f){return f===96?(e.consume(f),i++,l):(e.exit("codeTextSequence"),u(f))}function u(f){return f===null?r(f):f===32?(e.enter("space"),e.consume(f),e.exit("space"),u):f===96?(a=e.enter("codeTextSequence"),s=0,p(f)):It(f)?(e.enter("lineEnding"),e.consume(f),e.exit("lineEnding"),u):(e.enter("codeTextData"),d(f))}function d(f){return f===null||f===32||f===96||It(f)?(e.exit("codeTextData"),u(f)):(e.consume(f),d)}function p(f){return f===96?(e.consume(f),s++,p):s===i?(e.exit("codeTextSequence"),e.exit("codeText"),n(f)):(a.type="codeTextData",d(f))}}class Aae{constructor(n){this.left=n?[...n]:[],this.right=[]}get(n){if(n<0||n>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+n+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return n<this.left.length?this.left[n]:this.right[this.right.length-n+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(n,r){const i=r??Number.POSITIVE_INFINITY;return i<this.left.length?this.left.slice(n,i):n>this.left.length?this.right.slice(this.right.length-i+this.left.length,this.right.length-n+this.left.length).reverse():this.left.slice(n).concat(this.right.slice(this.right.length-i+this.left.length).reverse())}splice(n,r,i){const s=r||0;this.setCursor(Math.trunc(n));const a=this.right.splice(this.right.length-s,Number.POSITIVE_INFINITY);return i&&pm(this.left,i),a.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(n){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(n)}pushMany(n){this.setCursor(Number.POSITIVE_INFINITY),pm(this.left,n)}unshift(n){this.setCursor(0),this.right.push(n)}unshiftMany(n){this.setCursor(0),pm(this.right,n.reverse())}setCursor(n){if(!(n===this.left.length||n>this.left.length&&this.right.length===0||n<0&&this.left.length===0))if(n<this.left.length){const r=this.left.splice(n,Number.POSITIVE_INFINITY);pm(this.right,r.reverse())}else{const r=this.right.splice(this.left.length+this.right.length-n,Number.POSITIVE_INFINITY);pm(this.left,r.reverse())}}}function pm(e,n){let r=0;if(n.length<1e4)e.push(...n);else for(;r<n.length;)e.push(...n.slice(r,r+1e4)),r+=1e4}function r$(e){const n={};let r=-1,i,s,a,o,l,u,d;const p=new Aae(e);for(;++r<p.length;){for(;r in n;)r=n[r];if(i=p.get(r),r&&i[1].type==="chunkFlow"&&p.get(r-1)[1].type==="listItemPrefix"&&(u=i[1]._tokenizer.events,a=0,a<u.length&&u[a][1].type==="lineEndingBlank"&&(a+=2),a<u.length&&u[a][1].type==="content"))for(;++a<u.length&&u[a][1].type!=="content";)u[a][1].type==="chunkText"&&(u[a][1]._isInFirstContentOfListItem=!0,a++);if(i[0]==="enter")i[1].contentType&&(Object.assign(n,Tae(p,r)),r=n[r],d=!0);else if(i[1]._container){for(a=r,s=void 0;a--;)if(o=p.get(a),o[1].type==="lineEnding"||o[1].type==="lineEndingBlank")o[0]==="enter"&&(s&&(p.get(s)[1].type="lineEndingBlank"),o[1].type="lineEnding",s=a);else if(!(o[1].type==="linePrefix"||o[1].type==="listItemIndent"))break;s&&(i[1].end={...p.get(s)[1].start},l=p.slice(s,r),l.unshift(i),p.splice(s,r-s+1,l))}}return ra(e,0,Number.POSITIVE_INFINITY,p.slice(0)),!d}function Tae(e,n){const r=e.get(n)[1],i=e.get(n)[2];let s=n-1;const a=[];let o=r._tokenizer;o||(o=i.parser[r.contentType](r.start),r._contentTypeTextTrailing&&(o._contentTypeTextTrailing=!0));const l=o.events,u=[],d={};let p,f,g=-1,_=r,x=0,v=0;const S=[v];for(;_;){for(;e.get(++s)[1]!==_;);a.push(s),_._tokenizer||(p=i.sliceStream(_),_.next||p.push(null),f&&o.defineSkip(_.start),_._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=!0),o.write(p),_._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=void 0)),f=_,_=_.next}for(_=r;++g<l.length;)l[g][0]==="exit"&&l[g-1][0]==="enter"&&l[g][1].type===l[g-1][1].type&&l[g][1].start.line!==l[g][1].end.line&&(v=g+1,S.push(v),_._tokenizer=void 0,_.previous=void 0,_=_.next);for(o.events=[],_?(_._tokenizer=void 0,_.previous=void 0):S.pop(),g=S.length;g--;){const w=l.slice(S[g],S[g+1]),j=a.pop();u.push([j,j+w.length-1]),e.splice(j,2,w)}for(u.reverse(),g=-1;++g<u.length;)d[x+u[g][0]]=x+u[g][1],x+=u[g][1]-u[g][0]-1;return d}const Mae={resolve:Oae,tokenize:Dae},Rae={partial:!0,tokenize:Pae};function Oae(e){return r$(e),e}function Dae(e,n){let r;return i;function i(l){return e.enter("content"),r=e.enter("chunkContent",{contentType:"content"}),s(l)}function s(l){return l===null?a(l):It(l)?e.check(Rae,o,a)(l):(e.consume(l),s)}function a(l){return e.exit("chunkContent"),e.exit("content"),n(l)}function o(l){return e.consume(l),e.exit("chunkContent"),r.next=e.enter("chunkContent",{contentType:"content",previous:r}),r=r.next,s}}function Pae(e,n,r){const i=this;return s;function s(o){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),wn(e,a,"linePrefix")}function a(o){if(o===null||It(o))return r(o);const l=i.events[i.events.length-1];return!i.parser.constructs.disable.null.includes("codeIndented")&&l&&l[1].type==="linePrefix"&&l[2].sliceSerialize(l[1],!0).length>=4?n(o):e.interrupt(i.parser.constructs.flow,r,n)(o)}}function i$(e,n,r,i,s,a,o,l,u){const d=u||Number.POSITIVE_INFINITY;let p=0;return f;function f(w){return w===60?(e.enter(i),e.enter(s),e.enter(a),e.consume(w),e.exit(a),g):w===null||w===32||w===41||ub(w)?r(w):(e.enter(i),e.enter(o),e.enter(l),e.enter("chunkString",{contentType:"string"}),v(w))}function g(w){return w===62?(e.enter(a),e.consume(w),e.exit(a),e.exit(s),e.exit(i),n):(e.enter(l),e.enter("chunkString",{contentType:"string"}),_(w))}function _(w){return w===62?(e.exit("chunkString"),e.exit(l),g(w)):w===null||w===60||It(w)?r(w):(e.consume(w),w===92?x:_)}function x(w){return w===60||w===62||w===92?(e.consume(w),_):_(w)}function v(w){return!p&&(w===null||w===41||er(w))?(e.exit("chunkString"),e.exit(l),e.exit(o),e.exit(i),n(w)):p<d&&w===40?(e.consume(w),p++,v):w===41?(e.consume(w),p--,v):w===null||w===32||w===40||ub(w)?r(w):(e.consume(w),w===92?S:v)}function S(w){return w===40||w===41||w===92?(e.consume(w),v):v(w)}}function s$(e,n,r,i,s,a){const o=this;let l=0,u;return d;function d(_){return e.enter(i),e.enter(s),e.consume(_),e.exit(s),e.enter(a),p}function p(_){return l>999||_===null||_===91||_===93&&!u||_===94&&!l&&"_hiddenFootnoteSupport"in o.parser.constructs?r(_):_===93?(e.exit(a),e.enter(s),e.consume(_),e.exit(s),e.exit(i),n):It(_)?(e.enter("lineEnding"),e.consume(_),e.exit("lineEnding"),p):(e.enter("chunkString",{contentType:"string"}),f(_))}function f(_){return _===null||_===91||_===93||It(_)||l++>999?(e.exit("chunkString"),p(_)):(e.consume(_),u||(u=!hn(_)),_===92?g:f)}function g(_){return _===91||_===92||_===93?(e.consume(_),l++,f):f(_)}}function a$(e,n,r,i,s,a){let o;return l;function l(g){return g===34||g===39||g===40?(e.enter(i),e.enter(s),e.consume(g),e.exit(s),o=g===40?41:g,u):r(g)}function u(g){return g===o?(e.enter(s),e.consume(g),e.exit(s),e.exit(i),n):(e.enter(a),d(g))}function d(g){return g===o?(e.exit(a),u(o)):g===null?r(g):It(g)?(e.enter("lineEnding"),e.consume(g),e.exit("lineEnding"),wn(e,d,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),p(g))}function p(g){return g===o||g===null||It(g)?(e.exit("chunkString"),d(g)):(e.consume(g),g===92?f:p)}function f(g){return g===o||g===92?(e.consume(g),p):p(g)}}function og(e,n){let r;return i;function i(s){return It(s)?(e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),r=!0,i):hn(s)?wn(e,i,r?"linePrefix":"lineSuffix")(s):n(s)}}const Lae={name:"definition",tokenize:Bae},Iae={partial:!0,tokenize:zae};function Bae(e,n,r){const i=this;let s;return a;function a(_){return e.enter("definition"),o(_)}function o(_){return s$.call(i,e,l,r,"definitionLabel","definitionLabelMarker","definitionLabelString")(_)}function l(_){return s=to(i.sliceSerialize(i.events[i.events.length-1][1]).slice(1,-1)),_===58?(e.enter("definitionMarker"),e.consume(_),e.exit("definitionMarker"),u):r(_)}function u(_){return er(_)?og(e,d)(_):d(_)}function d(_){return i$(e,p,r,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(_)}function p(_){return e.attempt(Iae,f,f)(_)}function f(_){return hn(_)?wn(e,g,"whitespace")(_):g(_)}function g(_){return _===null||It(_)?(e.exit("definition"),i.parser.defined.push(s),n(_)):r(_)}}function zae(e,n,r){return i;function i(l){return er(l)?og(e,s)(l):r(l)}function s(l){return a$(e,a,r,"definitionTitle","definitionTitleMarker","definitionTitleString")(l)}function a(l){return hn(l)?wn(e,o,"whitespace")(l):o(l)}function o(l){return l===null||It(l)?n(l):r(l)}}const $ae={name:"hardBreakEscape",tokenize:Fae};function Fae(e,n,r){return i;function i(a){return e.enter("hardBreakEscape"),e.consume(a),s}function s(a){return It(a)?(e.exit("hardBreakEscape"),n(a)):r(a)}}const Hae={name:"headingAtx",resolve:Wae,tokenize:qae};function Wae(e,n){let r=e.length-2,i=3,s,a;return e[i][1].type==="whitespace"&&(i+=2),r-2>i&&e[r][1].type==="whitespace"&&(r-=2),e[r][1].type==="atxHeadingSequence"&&(i===r-1||r-4>i&&e[r-2][1].type==="whitespace")&&(r-=i+1===r?2:4),r>i&&(s={type:"atxHeadingText",start:e[i][1].start,end:e[r][1].end},a={type:"chunkText",start:e[i][1].start,end:e[r][1].end,contentType:"text"},ra(e,i,r-i+1,[["enter",s,n],["enter",a,n],["exit",a,n],["exit",s,n]])),e}function qae(e,n,r){let i=0;return s;function s(p){return e.enter("atxHeading"),a(p)}function a(p){return e.enter("atxHeadingSequence"),o(p)}function o(p){return p===35&&i++<6?(e.consume(p),o):p===null||er(p)?(e.exit("atxHeadingSequence"),l(p)):r(p)}function l(p){return p===35?(e.enter("atxHeadingSequence"),u(p)):p===null||It(p)?(e.exit("atxHeading"),n(p)):hn(p)?wn(e,l,"whitespace")(p):(e.enter("atxHeadingText"),d(p))}function u(p){return p===35?(e.consume(p),u):(e.exit("atxHeadingSequence"),l(p))}function d(p){return p===null||p===35||er(p)?(e.exit("atxHeadingText"),l(p)):(e.consume(p),d)}}const Uae=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],G4=["pre","script","style","textarea"],Kae={concrete:!0,name:"htmlFlow",resolveTo:Gae,tokenize:Xae},Vae={partial:!0,tokenize:Zae},Yae={partial:!0,tokenize:Qae};function Gae(e){let n=e.length;for(;n--&&!(e[n][0]==="enter"&&e[n][1].type==="htmlFlow"););return n>1&&e[n-2][1].type==="linePrefix"&&(e[n][1].start=e[n-2][1].start,e[n+1][1].start=e[n-2][1].start,e.splice(n-2,2)),e}function Xae(e,n,r){const i=this;let s,a,o,l,u;return d;function d(W){return p(W)}function p(W){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(W),f}function f(W){return W===33?(e.consume(W),g):W===47?(e.consume(W),a=!0,v):W===63?(e.consume(W),s=3,i.interrupt?n:V):ts(W)?(e.consume(W),o=String.fromCharCode(W),S):r(W)}function g(W){return W===45?(e.consume(W),s=2,_):W===91?(e.consume(W),s=5,l=0,x):ts(W)?(e.consume(W),s=4,i.interrupt?n:V):r(W)}function _(W){return W===45?(e.consume(W),i.interrupt?n:V):r(W)}function x(W){const te="CDATA[";return W===te.charCodeAt(l++)?(e.consume(W),l===te.length?i.interrupt?n:B:x):r(W)}function v(W){return ts(W)?(e.consume(W),o=String.fromCharCode(W),S):r(W)}function S(W){if(W===null||W===47||W===62||er(W)){const te=W===47,J=o.toLowerCase();return!te&&!a&&G4.includes(J)?(s=1,i.interrupt?n(W):B(W)):Uae.includes(o.toLowerCase())?(s=6,te?(e.consume(W),w):i.interrupt?n(W):B(W)):(s=7,i.interrupt&&!i.parser.lazy[i.now().line]?r(W):a?j(W):C(W))}return W===45||Ui(W)?(e.consume(W),o+=String.fromCharCode(W),S):r(W)}function w(W){return W===62?(e.consume(W),i.interrupt?n:B):r(W)}function j(W){return hn(W)?(e.consume(W),j):$(W)}function C(W){return W===47?(e.consume(W),$):W===58||W===95||ts(W)?(e.consume(W),T):hn(W)?(e.consume(W),C):$(W)}function T(W){return W===45||W===46||W===58||W===95||Ui(W)?(e.consume(W),T):E(W)}function E(W){return W===61?(e.consume(W),A):hn(W)?(e.consume(W),E):C(W)}function A(W){return W===null||W===60||W===61||W===62||W===96?r(W):W===34||W===39?(e.consume(W),u=W,O):hn(W)?(e.consume(W),A):F(W)}function O(W){return W===u?(e.consume(W),u=null,L):W===null||It(W)?r(W):(e.consume(W),O)}function F(W){return W===null||W===34||W===39||W===47||W===60||W===61||W===62||W===96||er(W)?E(W):(e.consume(W),F)}function L(W){return W===47||W===62||hn(W)?C(W):r(W)}function $(W){return W===62?(e.consume(W),z):r(W)}function z(W){return W===null||It(W)?B(W):hn(W)?(e.consume(W),z):r(W)}function B(W){return W===45&&s===2?(e.consume(W),I):W===60&&s===1?(e.consume(W),X):W===62&&s===4?(e.consume(W),R):W===63&&s===3?(e.consume(W),V):W===93&&s===5?(e.consume(W),Q):It(W)&&(s===6||s===7)?(e.exit("htmlFlowData"),e.check(Vae,q,H)(W)):W===null||It(W)?(e.exit("htmlFlowData"),H(W)):(e.consume(W),B)}function H(W){return e.check(Yae,D,q)(W)}function D(W){return e.enter("lineEnding"),e.consume(W),e.exit("lineEnding"),U}function U(W){return W===null||It(W)?H(W):(e.enter("htmlFlowData"),B(W))}function I(W){return W===45?(e.consume(W),V):B(W)}function X(W){return W===47?(e.consume(W),o="",K):B(W)}function K(W){if(W===62){const te=o.toLowerCase();return G4.includes(te)?(e.consume(W),R):B(W)}return ts(W)&&o.length<8?(e.consume(W),o+=String.fromCharCode(W),K):B(W)}function Q(W){return W===93?(e.consume(W),V):B(W)}function V(W){return W===62?(e.consume(W),R):W===45&&s===2?(e.consume(W),V):B(W)}function R(W){return W===null||It(W)?(e.exit("htmlFlowData"),q(W)):(e.consume(W),R)}function q(W){return e.exit("htmlFlow"),n(W)}}function Qae(e,n,r){const i=this;return s;function s(o){return It(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),a):r(o)}function a(o){return i.parser.lazy[i.now().line]?r(o):n(o)}}function Zae(e,n,r){return i;function i(s){return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),e.attempt(Rv,n,r)}}const Jae={name:"htmlText",tokenize:eoe};function eoe(e,n,r){const i=this;let s,a,o;return l;function l(V){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(V),u}function u(V){return V===33?(e.consume(V),d):V===47?(e.consume(V),E):V===63?(e.consume(V),C):ts(V)?(e.consume(V),F):r(V)}function d(V){return V===45?(e.consume(V),p):V===91?(e.consume(V),a=0,x):ts(V)?(e.consume(V),j):r(V)}function p(V){return V===45?(e.consume(V),_):r(V)}function f(V){return V===null?r(V):V===45?(e.consume(V),g):It(V)?(o=f,X(V)):(e.consume(V),f)}function g(V){return V===45?(e.consume(V),_):f(V)}function _(V){return V===62?I(V):V===45?g(V):f(V)}function x(V){const R="CDATA[";return V===R.charCodeAt(a++)?(e.consume(V),a===R.length?v:x):r(V)}function v(V){return V===null?r(V):V===93?(e.consume(V),S):It(V)?(o=v,X(V)):(e.consume(V),v)}function S(V){return V===93?(e.consume(V),w):v(V)}function w(V){return V===62?I(V):V===93?(e.consume(V),w):v(V)}function j(V){return V===null||V===62?I(V):It(V)?(o=j,X(V)):(e.consume(V),j)}function C(V){return V===null?r(V):V===63?(e.consume(V),T):It(V)?(o=C,X(V)):(e.consume(V),C)}function T(V){return V===62?I(V):C(V)}function E(V){return ts(V)?(e.consume(V),A):r(V)}function A(V){return V===45||Ui(V)?(e.consume(V),A):O(V)}function O(V){return It(V)?(o=O,X(V)):hn(V)?(e.consume(V),O):I(V)}function F(V){return V===45||Ui(V)?(e.consume(V),F):V===47||V===62||er(V)?L(V):r(V)}function L(V){return V===47?(e.consume(V),I):V===58||V===95||ts(V)?(e.consume(V),$):It(V)?(o=L,X(V)):hn(V)?(e.consume(V),L):I(V)}function $(V){return V===45||V===46||V===58||V===95||Ui(V)?(e.consume(V),$):z(V)}function z(V){return V===61?(e.consume(V),B):It(V)?(o=z,X(V)):hn(V)?(e.consume(V),z):L(V)}function B(V){return V===null||V===60||V===61||V===62||V===96?r(V):V===34||V===39?(e.consume(V),s=V,H):It(V)?(o=B,X(V)):hn(V)?(e.consume(V),B):(e.consume(V),D)}function H(V){return V===s?(e.consume(V),s=void 0,U):V===null?r(V):It(V)?(o=H,X(V)):(e.consume(V),H)}function D(V){return V===null||V===34||V===39||V===60||V===61||V===96?r(V):V===47||V===62||er(V)?L(V):(e.consume(V),D)}function U(V){return V===47||V===62||er(V)?L(V):r(V)}function I(V){return V===62?(e.consume(V),e.exit("htmlTextData"),e.exit("htmlText"),n):r(V)}function X(V){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(V),e.exit("lineEnding"),K}function K(V){return hn(V)?wn(e,Q,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(V):Q(V)}function Q(V){return e.enter("htmlTextData"),o(V)}}const fA={name:"labelEnd",resolveAll:ioe,resolveTo:soe,tokenize:aoe},toe={tokenize:ooe},noe={tokenize:loe},roe={tokenize:coe};function ioe(e){let n=-1;const r=[];for(;++n<e.length;){const i=e[n][1];if(r.push(e[n]),i.type==="labelImage"||i.type==="labelLink"||i.type==="labelEnd"){const s=i.type==="labelImage"?4:2;i.type="data",n+=s}}return e.length!==r.length&&ra(e,0,e.length,r),e}function soe(e,n){let r=e.length,i=0,s,a,o,l;for(;r--;)if(s=e[r][1],a){if(s.type==="link"||s.type==="labelLink"&&s._inactive)break;e[r][0]==="enter"&&s.type==="labelLink"&&(s._inactive=!0)}else if(o){if(e[r][0]==="enter"&&(s.type==="labelImage"||s.type==="labelLink")&&!s._balanced&&(a=r,s.type!=="labelLink")){i=2;break}}else s.type==="labelEnd"&&(o=r);const u={type:e[a][1].type==="labelLink"?"link":"image",start:{...e[a][1].start},end:{...e[e.length-1][1].end}},d={type:"label",start:{...e[a][1].start},end:{...e[o][1].end}},p={type:"labelText",start:{...e[a+i+2][1].end},end:{...e[o-2][1].start}};return l=[["enter",u,n],["enter",d,n]],l=Ca(l,e.slice(a+1,a+i+3)),l=Ca(l,[["enter",p,n]]),l=Ca(l,P0(n.parser.constructs.insideSpan.null,e.slice(a+i+4,o-3),n)),l=Ca(l,[["exit",p,n],e[o-2],e[o-1],["exit",d,n]]),l=Ca(l,e.slice(o+1)),l=Ca(l,[["exit",u,n]]),ra(e,a,e.length,l),e}function aoe(e,n,r){const i=this;let s=i.events.length,a,o;for(;s--;)if((i.events[s][1].type==="labelImage"||i.events[s][1].type==="labelLink")&&!i.events[s][1]._balanced){a=i.events[s][1];break}return l;function l(g){return a?a._inactive?f(g):(o=i.parser.defined.includes(to(i.sliceSerialize({start:a.end,end:i.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(g),e.exit("labelMarker"),e.exit("labelEnd"),u):r(g)}function u(g){return g===40?e.attempt(toe,p,o?p:f)(g):g===91?e.attempt(noe,p,o?d:f)(g):o?p(g):f(g)}function d(g){return e.attempt(roe,p,f)(g)}function p(g){return n(g)}function f(g){return a._balanced=!0,r(g)}}function ooe(e,n,r){return i;function i(f){return e.enter("resource"),e.enter("resourceMarker"),e.consume(f),e.exit("resourceMarker"),s}function s(f){return er(f)?og(e,a)(f):a(f)}function a(f){return f===41?p(f):i$(e,o,l,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(f)}function o(f){return er(f)?og(e,u)(f):p(f)}function l(f){return r(f)}function u(f){return f===34||f===39||f===40?a$(e,d,r,"resourceTitle","resourceTitleMarker","resourceTitleString")(f):p(f)}function d(f){return er(f)?og(e,p)(f):p(f)}function p(f){return f===41?(e.enter("resourceMarker"),e.consume(f),e.exit("resourceMarker"),e.exit("resource"),n):r(f)}}function loe(e,n,r){const i=this;return s;function s(l){return s$.call(i,e,a,o,"reference","referenceMarker","referenceString")(l)}function a(l){return i.parser.defined.includes(to(i.sliceSerialize(i.events[i.events.length-1][1]).slice(1,-1)))?n(l):r(l)}function o(l){return r(l)}}function coe(e,n,r){return i;function i(a){return e.enter("reference"),e.enter("referenceMarker"),e.consume(a),e.exit("referenceMarker"),s}function s(a){return a===93?(e.enter("referenceMarker"),e.consume(a),e.exit("referenceMarker"),e.exit("reference"),n):r(a)}}const uoe={name:"labelStartImage",resolveAll:fA.resolveAll,tokenize:doe};function doe(e,n,r){const i=this;return s;function s(l){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(l),e.exit("labelImageMarker"),a}function a(l){return l===91?(e.enter("labelMarker"),e.consume(l),e.exit("labelMarker"),e.exit("labelImage"),o):r(l)}function o(l){return l===94&&"_hiddenFootnoteSupport"in i.parser.constructs?r(l):n(l)}}const hoe={name:"labelStartLink",resolveAll:fA.resolveAll,tokenize:foe};function foe(e,n,r){const i=this;return s;function s(o){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(o),e.exit("labelMarker"),e.exit("labelLink"),a}function a(o){return o===94&&"_hiddenFootnoteSupport"in i.parser.constructs?r(o):n(o)}}const iS={name:"lineEnding",tokenize:poe};function poe(e,n){return r;function r(i){return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),wn(e,n,"linePrefix")}}const jx={name:"thematicBreak",tokenize:moe};function moe(e,n,r){let i=0,s;return a;function a(d){return e.enter("thematicBreak"),o(d)}function o(d){return s=d,l(d)}function l(d){return d===s?(e.enter("thematicBreakSequence"),u(d)):i>=3&&(d===null||It(d))?(e.exit("thematicBreak"),n(d)):r(d)}function u(d){return d===s?(e.consume(d),i++,u):(e.exit("thematicBreakSequence"),hn(d)?wn(e,l,"whitespace")(d):l(d))}}const xs={continuation:{tokenize:_oe},exit:boe,name:"list",tokenize:yoe},goe={partial:!0,tokenize:koe},voe={partial:!0,tokenize:xoe};function yoe(e,n,r){const i=this,s=i.events[i.events.length-1];let a=s&&s[1].type==="linePrefix"?s[2].sliceSerialize(s[1],!0).length:0,o=0;return l;function l(_){const x=i.containerState.type||(_===42||_===43||_===45?"listUnordered":"listOrdered");if(x==="listUnordered"?!i.containerState.marker||_===i.containerState.marker:kj(_)){if(i.containerState.type||(i.containerState.type=x,e.enter(x,{_container:!0})),x==="listUnordered")return e.enter("listItemPrefix"),_===42||_===45?e.check(jx,r,d)(_):d(_);if(!i.interrupt||_===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),u(_)}return r(_)}function u(_){return kj(_)&&++o<10?(e.consume(_),u):(!i.interrupt||o<2)&&(i.containerState.marker?_===i.containerState.marker:_===41||_===46)?(e.exit("listItemValue"),d(_)):r(_)}function d(_){return e.enter("listItemMarker"),e.consume(_),e.exit("listItemMarker"),i.containerState.marker=i.containerState.marker||_,e.check(Rv,i.interrupt?r:p,e.attempt(goe,g,f))}function p(_){return i.containerState.initialBlankLine=!0,a++,g(_)}function f(_){return hn(_)?(e.enter("listItemPrefixWhitespace"),e.consume(_),e.exit("listItemPrefixWhitespace"),g):r(_)}function g(_){return i.containerState.size=a+i.sliceSerialize(e.exit("listItemPrefix"),!0).length,n(_)}}function _oe(e,n,r){const i=this;return i.containerState._closeFlow=void 0,e.check(Rv,s,a);function s(l){return i.containerState.furtherBlankLines=i.containerState.furtherBlankLines||i.containerState.initialBlankLine,wn(e,n,"listItemIndent",i.containerState.size+1)(l)}function a(l){return i.containerState.furtherBlankLines||!hn(l)?(i.containerState.furtherBlankLines=void 0,i.containerState.initialBlankLine=void 0,o(l)):(i.containerState.furtherBlankLines=void 0,i.containerState.initialBlankLine=void 0,e.attempt(voe,n,o)(l))}function o(l){return i.containerState._closeFlow=!0,i.interrupt=void 0,wn(e,e.attempt(xs,n,r),"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(l)}}function xoe(e,n,r){const i=this;return wn(e,s,"listItemIndent",i.containerState.size+1);function s(a){const o=i.events[i.events.length-1];return o&&o[1].type==="listItemIndent"&&o[2].sliceSerialize(o[1],!0).length===i.containerState.size?n(a):r(a)}}function boe(e){e.exit(this.containerState.type)}function koe(e,n,r){const i=this;return wn(e,s,"listItemPrefixWhitespace",i.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function s(a){const o=i.events[i.events.length-1];return!hn(a)&&o&&o[1].type==="listItemPrefixWhitespace"?n(a):r(a)}}const X4={name:"setextUnderline",resolveTo:woe,tokenize:Soe};function woe(e,n){let r=e.length,i,s,a;for(;r--;)if(e[r][0]==="enter"){if(e[r][1].type==="content"){i=r;break}e[r][1].type==="paragraph"&&(s=r)}else e[r][1].type==="content"&&e.splice(r,1),!a&&e[r][1].type==="definition"&&(a=r);const o={type:"setextHeading",start:{...e[i][1].start},end:{...e[e.length-1][1].end}};return e[s][1].type="setextHeadingText",a?(e.splice(s,0,["enter",o,n]),e.splice(a+1,0,["exit",e[i][1],n]),e[i][1].end={...e[a][1].end}):e[i][1]=o,e.push(["exit",o,n]),e}function Soe(e,n,r){const i=this;let s;return a;function a(d){let p=i.events.length,f;for(;p--;)if(i.events[p][1].type!=="lineEnding"&&i.events[p][1].type!=="linePrefix"&&i.events[p][1].type!=="content"){f=i.events[p][1].type==="paragraph";break}return!i.parser.lazy[i.now().line]&&(i.interrupt||f)?(e.enter("setextHeadingLine"),s=d,o(d)):r(d)}function o(d){return e.enter("setextHeadingLineSequence"),l(d)}function l(d){return d===s?(e.consume(d),l):(e.exit("setextHeadingLineSequence"),hn(d)?wn(e,u,"lineSuffix")(d):u(d))}function u(d){return d===null||It(d)?(e.exit("setextHeadingLine"),n(d)):r(d)}}const Coe={tokenize:joe};function joe(e){const n=this,r=e.attempt(Rv,i,e.attempt(this.parser.constructs.flowInitial,s,wn(e,e.attempt(this.parser.constructs.flow,s,e.attempt(Mae,s)),"linePrefix")));return r;function i(a){if(a===null){e.consume(a);return}return e.enter("lineEndingBlank"),e.consume(a),e.exit("lineEndingBlank"),n.currentConstruct=void 0,r}function s(a){if(a===null){e.consume(a);return}return e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),n.currentConstruct=void 0,r}}const Noe={resolveAll:l$()},Eoe=o$("string"),Aoe=o$("text");function o$(e){return{resolveAll:l$(e==="text"?Toe:void 0),tokenize:n};function n(r){const i=this,s=this.parser.constructs[e],a=r.attempt(s,o,l);return o;function o(p){return d(p)?a(p):l(p)}function l(p){if(p===null){r.consume(p);return}return r.enter("data"),r.consume(p),u}function u(p){return d(p)?(r.exit("data"),a(p)):(r.consume(p),u)}function d(p){if(p===null)return!0;const f=s[p];let g=-1;if(f)for(;++g<f.length;){const _=f[g];if(!_.previous||_.previous.call(i,i.previous))return!0}return!1}}}function l$(e){return n;function n(r,i){let s=-1,a;for(;++s<=r.length;)a===void 0?r[s]&&r[s][1].type==="data"&&(a=s,s++):(!r[s]||r[s][1].type!=="data")&&(s!==a+2&&(r[a][1].end=r[s-1][1].end,r.splice(a+2,s-a-2),s=a+2),a=void 0);return e?e(r,i):r}}function Toe(e,n){let r=0;for(;++r<=e.length;)if((r===e.length||e[r][1].type==="lineEnding")&&e[r-1][1].type==="data"){const i=e[r-1][1],s=n.sliceStream(i);let a=s.length,o=-1,l=0,u;for(;a--;){const d=s[a];if(typeof d=="string"){for(o=d.length;d.charCodeAt(o-1)===32;)l++,o--;if(o)break;o=-1}else if(d===-2)u=!0,l++;else if(d!==-1){a++;break}}if(n._contentTypeTextTrailing&&r===e.length&&(l=0),l){const d={type:r===e.length||u||l<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:a?o:i.start._bufferIndex+o,_index:i.start._index+a,line:i.end.line,column:i.end.column-l,offset:i.end.offset-l},end:{...i.end}};i.end={...d.start},i.start.offset===i.end.offset?Object.assign(i,d):(e.splice(r,0,["enter",d,n],["exit",d,n]),r+=2)}r++}return e}const Moe={42:xs,43:xs,45:xs,48:xs,49:xs,50:xs,51:xs,52:xs,53:xs,54:xs,55:xs,56:xs,57:xs,62:e$},Roe={91:Lae},Ooe={[-2]:rS,[-1]:rS,32:rS},Doe={35:Hae,42:jx,45:[X4,jx],60:Kae,61:X4,95:jx,96:Y4,126:Y4},Poe={38:n$,92:t$},Loe={[-5]:iS,[-4]:iS,[-3]:iS,33:uoe,38:n$,42:wj,60:[hae,Jae],91:hoe,92:[$ae,t$],93:fA,95:wj,96:Cae},Ioe={null:[wj,Noe]},Boe={null:[42,95]},zoe={null:[]},$oe=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:Boe,contentInitial:Roe,disable:zoe,document:Moe,flow:Doe,flowInitial:Ooe,insideSpan:Ioe,string:Poe,text:Loe},Symbol.toStringTag,{value:"Module"}));function Foe(e,n,r){let i={_bufferIndex:-1,_index:0,line:r&&r.line||1,column:r&&r.column||1,offset:r&&r.offset||0};const s={},a=[];let o=[],l=[];const u={attempt:O(E),check:O(A),consume:j,enter:C,exit:T,interrupt:O(A,{interrupt:!0})},d={code:null,containerState:{},defineSkip:v,events:[],now:x,parser:e,previous:null,sliceSerialize:g,sliceStream:_,write:f};let p=n.tokenize.call(d,u);return n.resolveAll&&a.push(n),d;function f(z){return o=Ca(o,z),S(),o[o.length-1]!==null?[]:(F(n,0),d.events=P0(a,d.events,d),d.events)}function g(z,B){return Woe(_(z),B)}function _(z){return Hoe(o,z)}function x(){const{_bufferIndex:z,_index:B,line:H,column:D,offset:U}=i;return{_bufferIndex:z,_index:B,line:H,column:D,offset:U}}function v(z){s[z.line]=z.column,$()}function S(){let z;for(;i._index<o.length;){const B=o[i._index];if(typeof B=="string")for(z=i._index,i._bufferIndex<0&&(i._bufferIndex=0);i._index===z&&i._bufferIndex<B.length;)w(B.charCodeAt(i._bufferIndex));else w(B)}}function w(z){p=p(z)}function j(z){It(z)?(i.line++,i.column=1,i.offset+=z===-3?2:1,$()):z!==-1&&(i.column++,i.offset++),i._bufferIndex<0?i._index++:(i._bufferIndex++,i._bufferIndex===o[i._index].length&&(i._bufferIndex=-1,i._index++)),d.previous=z}function C(z,B){const H=B||{};return H.type=z,H.start=x(),d.events.push(["enter",H,d]),l.push(H),H}function T(z){const B=l.pop();return B.end=x(),d.events.push(["exit",B,d]),B}function E(z,B){F(z,B.from)}function A(z,B){B.restore()}function O(z,B){return H;function H(D,U,I){let X,K,Q,V;return Array.isArray(D)?q(D):"tokenize"in D?q([D]):R(D);function R(G){return re;function re(ne){const le=ne!==null&&G[ne],oe=ne!==null&&G.null,ie=[...Array.isArray(le)?le:le?[le]:[],...Array.isArray(oe)?oe:oe?[oe]:[]];return q(ie)(ne)}}function q(G){return X=G,K=0,G.length===0?I:W(G[K])}function W(G){return re;function re(ne){return V=L(),Q=G,G.partial||(d.currentConstruct=G),G.name&&d.parser.constructs.disable.null.includes(G.name)?J():G.tokenize.call(B?Object.assign(Object.create(d),B):d,u,te,J)(ne)}}function te(G){return z(Q,V),U}function J(G){return V.restore(),++K<X.length?W(X[K]):I}}}function F(z,B){z.resolveAll&&!a.includes(z)&&a.push(z),z.resolve&&ra(d.events,B,d.events.length-B,z.resolve(d.events.slice(B),d)),z.resolveTo&&(d.events=z.resolveTo(d.events,d))}function L(){const z=x(),B=d.previous,H=d.currentConstruct,D=d.events.length,U=Array.from(l);return{from:D,restore:I};function I(){i=z,d.previous=B,d.currentConstruct=H,d.events.length=D,l=U,$()}}function $(){i.line in s&&i.column<2&&(i.column=s[i.line],i.offset+=s[i.line]-1)}}function Hoe(e,n){const r=n.start._index,i=n.start._bufferIndex,s=n.end._index,a=n.end._bufferIndex;let o;if(r===s)o=[e[r].slice(i,a)];else{if(o=e.slice(r,s),i>-1){const l=o[0];typeof l=="string"?o[0]=l.slice(i):o.shift()}a>0&&o.push(e[s].slice(0,a))}return o}function Woe(e,n){let r=-1;const i=[];let s;for(;++r<e.length;){const a=e[r];let o;if(typeof a=="string")o=a;else switch(a){case-5:{o="\r";break}case-4:{o=`
`;break}case-3:{o=`\r
`;break}case-2:{o=n?" ":"	";break}case-1:{if(!n&&s)continue;o=" ";break}default:o=String.fromCharCode(a)}s=a===-2,i.push(o)}return i.join("")}function qoe(e){const i={constructs:Z9([$oe,...(e||{}).extensions||[]]),content:s(sae),defined:[],document:s(oae),flow:s(Coe),lazy:{},string:s(Eoe),text:s(Aoe)};return i;function s(a){return o;function o(l){return Foe(i,a,l)}}}function Uoe(e){for(;!r$(e););return e}const Q4=/[\0\t\n\r]/g;function Koe(){let e=1,n="",r=!0,i;return s;function s(a,o,l){const u=[];let d,p,f,g,_;for(a=n+(typeof a=="string"?a.toString():new TextDecoder(o||void 0).decode(a)),f=0,n="",r&&(a.charCodeAt(0)===65279&&f++,r=void 0);f<a.length;){if(Q4.lastIndex=f,d=Q4.exec(a),g=d&&d.index!==void 0?d.index:a.length,_=a.charCodeAt(g),!d){n=a.slice(f);break}if(_===10&&f===g&&i)u.push(-3),i=void 0;else switch(i&&(u.push(-5),i=void 0),f<g&&(u.push(a.slice(f,g)),e+=g-f),_){case 0:{u.push(65533),e++;break}case 9:{for(p=Math.ceil(e/4)*4,u.push(-2);e++<p;)u.push(-1);break}case 10:{u.push(-4),e=1;break}default:i=!0,e=1}f=g+1}return l&&(i&&u.push(-5),n&&u.push(n),u.push(null)),u}}const Voe=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function Yoe(e){return e.replace(Voe,Goe)}function Goe(e,n,r){if(n)return n;if(r.charCodeAt(0)===35){const s=r.charCodeAt(1),a=s===120||s===88;return J9(r.slice(a?2:1),a?16:10)}return hA(r)||e}const c$={}.hasOwnProperty;function Xoe(e,n,r){return n&&typeof n=="object"&&(r=n,n=void 0),Qoe(r)(Uoe(qoe(r).document().write(Koe()(e,n,!0))))}function Qoe(e){const n={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:a(Le),autolinkProtocol:L,autolinkEmail:L,atxHeading:a(ue),blockQuote:a(oe),characterEscape:L,characterReference:L,codeFenced:a(ie),codeFencedFenceInfo:o,codeFencedFenceMeta:o,codeIndented:a(ie,o),codeText:a(he,o),codeTextData:L,data:L,codeFlowValue:L,definition:a(Z),definitionDestinationString:o,definitionLabelString:o,definitionTitleString:o,emphasis:a(de),hardBreakEscape:a(pe),hardBreakTrailing:a(pe),htmlFlow:a(Oe,o),htmlFlowData:L,htmlText:a(Oe,o),htmlTextData:L,image:a(fe),label:o,link:a(Le),listItem:a(Bt),listItemValue:g,listOrdered:a(Ee,f),listUnordered:a(Ee),paragraph:a(Xe),reference:W,referenceString:o,resourceDestinationString:o,resourceTitleString:o,setextHeading:a(ue),strong:a(St),thematicBreak:a(Rt)},exit:{atxHeading:u(),atxHeadingSequence:E,autolink:u(),autolinkEmail:le,autolinkProtocol:ne,blockQuote:u(),characterEscapeValue:$,characterReferenceMarkerHexadecimal:J,characterReferenceMarkerNumeric:J,characterReferenceValue:G,characterReference:re,codeFenced:u(S),codeFencedFence:v,codeFencedFenceInfo:_,codeFencedFenceMeta:x,codeFlowValue:$,codeIndented:u(w),codeText:u(U),codeTextData:$,data:$,definition:u(),definitionDestinationString:T,definitionLabelString:j,definitionTitleString:C,emphasis:u(),hardBreakEscape:u(B),hardBreakTrailing:u(B),htmlFlow:u(H),htmlFlowData:$,htmlText:u(D),htmlTextData:$,image:u(X),label:Q,labelText:K,lineEnding:z,link:u(I),listItem:u(),listOrdered:u(),listUnordered:u(),paragraph:u(),referenceString:te,resourceDestinationString:V,resourceTitleString:R,resource:q,setextHeading:u(F),setextHeadingLineSequence:O,setextHeadingText:A,strong:u(),thematicBreak:u()}};u$(n,(e||{}).mdastExtensions||[]);const r={};return i;function i(be){let He={type:"root",children:[]};const ht={stack:[He],tokenStack:[],config:n,enter:l,exit:d,buffer:o,resume:p,data:r},ot=[];let $t=-1;for(;++$t<be.length;)if(be[$t][1].type==="listOrdered"||be[$t][1].type==="listUnordered")if(be[$t][0]==="enter")ot.push($t);else{const jn=ot.pop();$t=s(be,jn,$t)}for($t=-1;++$t<be.length;){const jn=n[be[$t][0]];c$.call(jn,be[$t][1].type)&&jn[be[$t][1].type].call(Object.assign({sliceSerialize:be[$t][2].sliceSerialize},ht),be[$t][1])}if(ht.tokenStack.length>0){const jn=ht.tokenStack[ht.tokenStack.length-1];(jn[1]||Z4).call(ht,void 0,jn[0])}for(He.position={start:Pc(be.length>0?be[0][1].start:{line:1,column:1,offset:0}),end:Pc(be.length>0?be[be.length-2][1].end:{line:1,column:1,offset:0})},$t=-1;++$t<n.transforms.length;)He=n.transforms[$t](He)||He;return He}function s(be,He,ht){let ot=He-1,$t=-1,jn=!1,Pn,We,ut,Ct;for(;++ot<=ht;){const Mt=be[ot];switch(Mt[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{Mt[0]==="enter"?$t++:$t--,Ct=void 0;break}case"lineEndingBlank":{Mt[0]==="enter"&&(Pn&&!Ct&&!$t&&!ut&&(ut=ot),Ct=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:Ct=void 0}if(!$t&&Mt[0]==="enter"&&Mt[1].type==="listItemPrefix"||$t===-1&&Mt[0]==="exit"&&(Mt[1].type==="listUnordered"||Mt[1].type==="listOrdered")){if(Pn){let Ge=ot;for(We=void 0;Ge--;){const tt=be[Ge];if(tt[1].type==="lineEnding"||tt[1].type==="lineEndingBlank"){if(tt[0]==="exit")continue;We&&(be[We][1].type="lineEndingBlank",jn=!0),tt[1].type="lineEnding",We=Ge}else if(!(tt[1].type==="linePrefix"||tt[1].type==="blockQuotePrefix"||tt[1].type==="blockQuotePrefixWhitespace"||tt[1].type==="blockQuoteMarker"||tt[1].type==="listItemIndent"))break}ut&&(!We||ut<We)&&(Pn._spread=!0),Pn.end=Object.assign({},We?be[We][1].start:Mt[1].end),be.splice(We||ot,0,["exit",Pn,Mt[2]]),ot++,ht++}if(Mt[1].type==="listItemPrefix"){const Ge={type:"listItem",_spread:!1,start:Object.assign({},Mt[1].start),end:void 0};Pn=Ge,be.splice(ot,0,["enter",Ge,Mt[2]]),ot++,ht++,ut=void 0,Ct=!0}}}return be[He][1]._spread=jn,ht}function a(be,He){return ht;function ht(ot){l.call(this,be(ot),ot),He&&He.call(this,ot)}}function o(){this.stack.push({type:"fragment",children:[]})}function l(be,He,ht){this.stack[this.stack.length-1].children.push(be),this.stack.push(be),this.tokenStack.push([He,ht||void 0]),be.position={start:Pc(He.start),end:void 0}}function u(be){return He;function He(ht){be&&be.call(this,ht),d.call(this,ht)}}function d(be,He){const ht=this.stack.pop(),ot=this.tokenStack.pop();if(ot)ot[0].type!==be.type&&(He?He.call(this,be,ot[0]):(ot[1]||Z4).call(this,be,ot[0]));else throw new Error("Cannot close `"+be.type+"` ("+ag({start:be.start,end:be.end})+"): it’s not open");ht.position.end=Pc(be.end)}function p(){return dA(this.stack.pop())}function f(){this.data.expectingFirstListItemValue=!0}function g(be){if(this.data.expectingFirstListItemValue){const He=this.stack[this.stack.length-2];He.start=Number.parseInt(this.sliceSerialize(be),10),this.data.expectingFirstListItemValue=void 0}}function _(){const be=this.resume(),He=this.stack[this.stack.length-1];He.lang=be}function x(){const be=this.resume(),He=this.stack[this.stack.length-1];He.meta=be}function v(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function S(){const be=this.resume(),He=this.stack[this.stack.length-1];He.value=be.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function w(){const be=this.resume(),He=this.stack[this.stack.length-1];He.value=be.replace(/(\r?\n|\r)$/g,"")}function j(be){const He=this.resume(),ht=this.stack[this.stack.length-1];ht.label=He,ht.identifier=to(this.sliceSerialize(be)).toLowerCase()}function C(){const be=this.resume(),He=this.stack[this.stack.length-1];He.title=be}function T(){const be=this.resume(),He=this.stack[this.stack.length-1];He.url=be}function E(be){const He=this.stack[this.stack.length-1];if(!He.depth){const ht=this.sliceSerialize(be).length;He.depth=ht}}function A(){this.data.setextHeadingSlurpLineEnding=!0}function O(be){const He=this.stack[this.stack.length-1];He.depth=this.sliceSerialize(be).codePointAt(0)===61?1:2}function F(){this.data.setextHeadingSlurpLineEnding=void 0}function L(be){const ht=this.stack[this.stack.length-1].children;let ot=ht[ht.length-1];(!ot||ot.type!=="text")&&(ot=yt(),ot.position={start:Pc(be.start),end:void 0},ht.push(ot)),this.stack.push(ot)}function $(be){const He=this.stack.pop();He.value+=this.sliceSerialize(be),He.position.end=Pc(be.end)}function z(be){const He=this.stack[this.stack.length-1];if(this.data.atHardBreak){const ht=He.children[He.children.length-1];ht.position.end=Pc(be.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&n.canContainEols.includes(He.type)&&(L.call(this,be),$.call(this,be))}function B(){this.data.atHardBreak=!0}function H(){const be=this.resume(),He=this.stack[this.stack.length-1];He.value=be}function D(){const be=this.resume(),He=this.stack[this.stack.length-1];He.value=be}function U(){const be=this.resume(),He=this.stack[this.stack.length-1];He.value=be}function I(){const be=this.stack[this.stack.length-1];if(this.data.inReference){const He=this.data.referenceType||"shortcut";be.type+="Reference",be.referenceType=He,delete be.url,delete be.title}else delete be.identifier,delete be.label;this.data.referenceType=void 0}function X(){const be=this.stack[this.stack.length-1];if(this.data.inReference){const He=this.data.referenceType||"shortcut";be.type+="Reference",be.referenceType=He,delete be.url,delete be.title}else delete be.identifier,delete be.label;this.data.referenceType=void 0}function K(be){const He=this.sliceSerialize(be),ht=this.stack[this.stack.length-2];ht.label=Yoe(He),ht.identifier=to(He).toLowerCase()}function Q(){const be=this.stack[this.stack.length-1],He=this.resume(),ht=this.stack[this.stack.length-1];if(this.data.inReference=!0,ht.type==="link"){const ot=be.children;ht.children=ot}else ht.alt=He}function V(){const be=this.resume(),He=this.stack[this.stack.length-1];He.url=be}function R(){const be=this.resume(),He=this.stack[this.stack.length-1];He.title=be}function q(){this.data.inReference=void 0}function W(){this.data.referenceType="collapsed"}function te(be){const He=this.resume(),ht=this.stack[this.stack.length-1];ht.label=He,ht.identifier=to(this.sliceSerialize(be)).toLowerCase(),this.data.referenceType="full"}function J(be){this.data.characterReferenceType=be.type}function G(be){const He=this.sliceSerialize(be),ht=this.data.characterReferenceType;let ot;ht?(ot=J9(He,ht==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):ot=hA(He);const $t=this.stack[this.stack.length-1];$t.value+=ot}function re(be){const He=this.stack.pop();He.position.end=Pc(be.end)}function ne(be){$.call(this,be);const He=this.stack[this.stack.length-1];He.url=this.sliceSerialize(be)}function le(be){$.call(this,be);const He=this.stack[this.stack.length-1];He.url="mailto:"+this.sliceSerialize(be)}function oe(){return{type:"blockquote",children:[]}}function ie(){return{type:"code",lang:null,meta:null,value:""}}function he(){return{type:"inlineCode",value:""}}function Z(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function de(){return{type:"emphasis",children:[]}}function ue(){return{type:"heading",depth:0,children:[]}}function pe(){return{type:"break"}}function Oe(){return{type:"html",value:""}}function fe(){return{type:"image",title:null,url:"",alt:null}}function Le(){return{type:"link",title:null,url:"",children:[]}}function Ee(be){return{type:"list",ordered:be.type==="listOrdered",start:null,spread:be._spread,children:[]}}function Bt(be){return{type:"listItem",spread:be._spread,checked:null,children:[]}}function Xe(){return{type:"paragraph",children:[]}}function St(){return{type:"strong",children:[]}}function yt(){return{type:"text",value:""}}function Rt(){return{type:"thematicBreak"}}}function Pc(e){return{line:e.line,column:e.column,offset:e.offset}}function u$(e,n){let r=-1;for(;++r<n.length;){const i=n[r];Array.isArray(i)?u$(e,i):Zoe(e,i)}}function Zoe(e,n){let r;for(r in n)if(c$.call(n,r))switch(r){case"canContainEols":{const i=n[r];i&&e[r].push(...i);break}case"transforms":{const i=n[r];i&&e[r].push(...i);break}case"enter":case"exit":{const i=n[r];i&&Object.assign(e[r],i);break}}}function Z4(e,n){throw e?new Error("Cannot close `"+e.type+"` ("+ag({start:e.start,end:e.end})+"): a different token (`"+n.type+"`, "+ag({start:n.start,end:n.end})+") is open"):new Error("Cannot close document, a token (`"+n.type+"`, "+ag({start:n.start,end:n.end})+") is still open")}function Joe(e){const n=this;n.parser=r;function r(i){return Xoe(i,{...n.data("settings"),...e,extensions:n.data("micromarkExtensions")||[],mdastExtensions:n.data("fromMarkdownExtensions")||[]})}}function ele(e,n){const r={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(n),!0)};return e.patch(n,r),e.applyData(n,r)}function tle(e,n){const r={type:"element",tagName:"br",properties:{},children:[]};return e.patch(n,r),[e.applyData(n,r),{type:"text",value:`
`}]}function nle(e,n){const r=n.value?n.value+`
`:"",i={},s=n.lang?n.lang.split(/\s+/):[];s.length>0&&(i.className=["language-"+s[0]]);let a={type:"element",tagName:"code",properties:i,children:[{type:"text",value:r}]};return n.meta&&(a.data={meta:n.meta}),e.patch(n,a),a=e.applyData(n,a),a={type:"element",tagName:"pre",properties:{},children:[a]},e.patch(n,a),a}function rle(e,n){const r={type:"element",tagName:"del",properties:{},children:e.all(n)};return e.patch(n,r),e.applyData(n,r)}function ile(e,n){const r={type:"element",tagName:"em",properties:{},children:e.all(n)};return e.patch(n,r),e.applyData(n,r)}function sle(e,n){const r=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",i=String(n.identifier).toUpperCase(),s=hp(i.toLowerCase()),a=e.footnoteOrder.indexOf(i);let o,l=e.footnoteCounts.get(i);l===void 0?(l=0,e.footnoteOrder.push(i),o=e.footnoteOrder.length):o=a+1,l+=1,e.footnoteCounts.set(i,l);const u={type:"element",tagName:"a",properties:{href:"#"+r+"fn-"+s,id:r+"fnref-"+s+(l>1?"-"+l:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(o)}]};e.patch(n,u);const d={type:"element",tagName:"sup",properties:{},children:[u]};return e.patch(n,d),e.applyData(n,d)}function ale(e,n){const r={type:"element",tagName:"h"+n.depth,properties:{},children:e.all(n)};return e.patch(n,r),e.applyData(n,r)}function ole(e,n){if(e.options.allowDangerousHtml){const r={type:"raw",value:n.value};return e.patch(n,r),e.applyData(n,r)}}function d$(e,n){const r=n.referenceType;let i="]";if(r==="collapsed"?i+="[]":r==="full"&&(i+="["+(n.label||n.identifier)+"]"),n.type==="imageReference")return[{type:"text",value:"!["+n.alt+i}];const s=e.all(n),a=s[0];a&&a.type==="text"?a.value="["+a.value:s.unshift({type:"text",value:"["});const o=s[s.length-1];return o&&o.type==="text"?o.value+=i:s.push({type:"text",value:i}),s}function lle(e,n){const r=String(n.identifier).toUpperCase(),i=e.definitionById.get(r);if(!i)return d$(e,n);const s={src:hp(i.url||""),alt:n.alt};i.title!==null&&i.title!==void 0&&(s.title=i.title);const a={type:"element",tagName:"img",properties:s,children:[]};return e.patch(n,a),e.applyData(n,a)}function cle(e,n){const r={src:hp(n.url)};n.alt!==null&&n.alt!==void 0&&(r.alt=n.alt),n.title!==null&&n.title!==void 0&&(r.title=n.title);const i={type:"element",tagName:"img",properties:r,children:[]};return e.patch(n,i),e.applyData(n,i)}function ule(e,n){const r={type:"text",value:n.value.replace(/\r?\n|\r/g," ")};e.patch(n,r);const i={type:"element",tagName:"code",properties:{},children:[r]};return e.patch(n,i),e.applyData(n,i)}function dle(e,n){const r=String(n.identifier).toUpperCase(),i=e.definitionById.get(r);if(!i)return d$(e,n);const s={href:hp(i.url||"")};i.title!==null&&i.title!==void 0&&(s.title=i.title);const a={type:"element",tagName:"a",properties:s,children:e.all(n)};return e.patch(n,a),e.applyData(n,a)}function hle(e,n){const r={href:hp(n.url)};n.title!==null&&n.title!==void 0&&(r.title=n.title);const i={type:"element",tagName:"a",properties:r,children:e.all(n)};return e.patch(n,i),e.applyData(n,i)}function fle(e,n,r){const i=e.all(n),s=r?ple(r):h$(n),a={},o=[];if(typeof n.checked=="boolean"){const p=i[0];let f;p&&p.type==="element"&&p.tagName==="p"?f=p:(f={type:"element",tagName:"p",properties:{},children:[]},i.unshift(f)),f.children.length>0&&f.children.unshift({type:"text",value:" "}),f.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:n.checked,disabled:!0},children:[]}),a.className=["task-list-item"]}let l=-1;for(;++l<i.length;){const p=i[l];(s||l!==0||p.type!=="element"||p.tagName!=="p")&&o.push({type:"text",value:`
`}),p.type==="element"&&p.tagName==="p"&&!s?o.push(...p.children):o.push(p)}const u=i[i.length-1];u&&(s||u.type!=="element"||u.tagName!=="p")&&o.push({type:"text",value:`
`});const d={type:"element",tagName:"li",properties:a,children:o};return e.patch(n,d),e.applyData(n,d)}function ple(e){let n=!1;if(e.type==="list"){n=e.spread||!1;const r=e.children;let i=-1;for(;!n&&++i<r.length;)n=h$(r[i])}return n}function h$(e){const n=e.spread;return n??e.children.length>1}function mle(e,n){const r={},i=e.all(n);let s=-1;for(typeof n.start=="number"&&n.start!==1&&(r.start=n.start);++s<i.length;){const o=i[s];if(o.type==="element"&&o.tagName==="li"&&o.properties&&Array.isArray(o.properties.className)&&o.properties.className.includes("task-list-item")){r.className=["contains-task-list"];break}}const a={type:"element",tagName:n.ordered?"ol":"ul",properties:r,children:e.wrap(i,!0)};return e.patch(n,a),e.applyData(n,a)}function gle(e,n){const r={type:"element",tagName:"p",properties:{},children:e.all(n)};return e.patch(n,r),e.applyData(n,r)}function vle(e,n){const r={type:"root",children:e.wrap(e.all(n))};return e.patch(n,r),e.applyData(n,r)}function yle(e,n){const r={type:"element",tagName:"strong",properties:{},children:e.all(n)};return e.patch(n,r),e.applyData(n,r)}function _le(e,n){const r=e.all(n),i=r.shift(),s=[];if(i){const o={type:"element",tagName:"thead",properties:{},children:e.wrap([i],!0)};e.patch(n.children[0],o),s.push(o)}if(r.length>0){const o={type:"element",tagName:"tbody",properties:{},children:e.wrap(r,!0)},l=oA(n.children[1]),u=U9(n.children[n.children.length-1]);l&&u&&(o.position={start:l,end:u}),s.push(o)}const a={type:"element",tagName:"table",properties:{},children:e.wrap(s,!0)};return e.patch(n,a),e.applyData(n,a)}function xle(e,n,r){const i=r?r.children:void 0,a=(i?i.indexOf(n):1)===0?"th":"td",o=r&&r.type==="table"?r.align:void 0,l=o?o.length:n.children.length;let u=-1;const d=[];for(;++u<l;){const f=n.children[u],g={},_=o?o[u]:void 0;_&&(g.align=_);let x={type:"element",tagName:a,properties:g,children:[]};f&&(x.children=e.all(f),e.patch(f,x),x=e.applyData(f,x)),d.push(x)}const p={type:"element",tagName:"tr",properties:{},children:e.wrap(d,!0)};return e.patch(n,p),e.applyData(n,p)}function ble(e,n){const r={type:"element",tagName:"td",properties:{},children:e.all(n)};return e.patch(n,r),e.applyData(n,r)}const J4=9,eD=32;function kle(e){const n=String(e),r=/\r?\n|\r/g;let i=r.exec(n),s=0;const a=[];for(;i;)a.push(tD(n.slice(s,i.index),s>0,!0),i[0]),s=i.index+i[0].length,i=r.exec(n);return a.push(tD(n.slice(s),s>0,!1)),a.join("")}function tD(e,n,r){let i=0,s=e.length;if(n){let a=e.codePointAt(i);for(;a===J4||a===eD;)i++,a=e.codePointAt(i)}if(r){let a=e.codePointAt(s-1);for(;a===J4||a===eD;)s--,a=e.codePointAt(s-1)}return s>i?e.slice(i,s):""}function wle(e,n){const r={type:"text",value:kle(String(n.value))};return e.patch(n,r),e.applyData(n,r)}function Sle(e,n){const r={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(n,r),e.applyData(n,r)}const Cle={blockquote:ele,break:tle,code:nle,delete:rle,emphasis:ile,footnoteReference:sle,heading:ale,html:ole,imageReference:lle,image:cle,inlineCode:ule,linkReference:dle,link:hle,listItem:fle,list:mle,paragraph:gle,root:vle,strong:yle,table:_le,tableCell:ble,tableRow:xle,text:wle,thematicBreak:Sle,toml:f_,yaml:f_,definition:f_,footnoteDefinition:f_};function f_(){}const f$=-1,L0=0,lg=1,db=2,pA=3,mA=4,gA=5,vA=6,p$=7,m$=8,nD=typeof self=="object"?self:globalThis,jle=(e,n)=>{const r=(s,a)=>(e.set(a,s),s),i=s=>{if(e.has(s))return e.get(s);const[a,o]=n[s];switch(a){case L0:case f$:return r(o,s);case lg:{const l=r([],s);for(const u of o)l.push(i(u));return l}case db:{const l=r({},s);for(const[u,d]of o)l[i(u)]=i(d);return l}case pA:return r(new Date(o),s);case mA:{const{source:l,flags:u}=o;return r(new RegExp(l,u),s)}case gA:{const l=r(new Map,s);for(const[u,d]of o)l.set(i(u),i(d));return l}case vA:{const l=r(new Set,s);for(const u of o)l.add(i(u));return l}case p$:{const{name:l,message:u}=o;return r(new nD[l](u),s)}case m$:return r(BigInt(o),s);case"BigInt":return r(Object(BigInt(o)),s);case"ArrayBuffer":return r(new Uint8Array(o).buffer,o);case"DataView":{const{buffer:l}=new Uint8Array(o);return r(new DataView(l),o)}}return r(new nD[a](o),s)};return i},rD=e=>jle(new Map,e)(0),Mh="",{toString:Nle}={},{keys:Ele}=Object,mm=e=>{const n=typeof e;if(n!=="object"||!e)return[L0,n];const r=Nle.call(e).slice(8,-1);switch(r){case"Array":return[lg,Mh];case"Object":return[db,Mh];case"Date":return[pA,Mh];case"RegExp":return[mA,Mh];case"Map":return[gA,Mh];case"Set":return[vA,Mh];case"DataView":return[lg,r]}return r.includes("Array")?[lg,r]:r.includes("Error")?[p$,r]:[db,r]},p_=([e,n])=>e===L0&&(n==="function"||n==="symbol"),Ale=(e,n,r,i)=>{const s=(o,l)=>{const u=i.push(o)-1;return r.set(l,u),u},a=o=>{if(r.has(o))return r.get(o);let[l,u]=mm(o);switch(l){case L0:{let p=o;switch(u){case"bigint":l=m$,p=o.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+u);p=null;break;case"undefined":return s([f$],o)}return s([l,p],o)}case lg:{if(u){let g=o;return u==="DataView"?g=new Uint8Array(o.buffer):u==="ArrayBuffer"&&(g=new Uint8Array(o)),s([u,[...g]],o)}const p=[],f=s([l,p],o);for(const g of o)p.push(a(g));return f}case db:{if(u)switch(u){case"BigInt":return s([u,o.toString()],o);case"Boolean":case"Number":case"String":return s([u,o.valueOf()],o)}if(n&&"toJSON"in o)return a(o.toJSON());const p=[],f=s([l,p],o);for(const g of Ele(o))(e||!p_(mm(o[g])))&&p.push([a(g),a(o[g])]);return f}case pA:return s([l,o.toISOString()],o);case mA:{const{source:p,flags:f}=o;return s([l,{source:p,flags:f}],o)}case gA:{const p=[],f=s([l,p],o);for(const[g,_]of o)(e||!(p_(mm(g))||p_(mm(_))))&&p.push([a(g),a(_)]);return f}case vA:{const p=[],f=s([l,p],o);for(const g of o)(e||!p_(mm(g)))&&p.push(a(g));return f}}const{message:d}=o;return s([l,{name:u,message:d}],o)};return a},iD=(e,{json:n,lossy:r}={})=>{const i=[];return Ale(!(n||r),!!n,new Map,i)(e),i},hb=typeof structuredClone=="function"?(e,n)=>n&&("json"in n||"lossy"in n)?rD(iD(e,n)):structuredClone(e):(e,n)=>rD(iD(e,n));function Tle(e,n){const r=[{type:"text",value:"↩"}];return n>1&&r.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(n)}]}),r}function Mle(e,n){return"Back to reference "+(e+1)+(n>1?"-"+n:"")}function Rle(e){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",r=e.options.footnoteBackContent||Tle,i=e.options.footnoteBackLabel||Mle,s=e.options.footnoteLabel||"Footnotes",a=e.options.footnoteLabelTagName||"h2",o=e.options.footnoteLabelProperties||{className:["sr-only"]},l=[];let u=-1;for(;++u<e.footnoteOrder.length;){const d=e.footnoteById.get(e.footnoteOrder[u]);if(!d)continue;const p=e.all(d),f=String(d.identifier).toUpperCase(),g=hp(f.toLowerCase());let _=0;const x=[],v=e.footnoteCounts.get(f);for(;v!==void 0&&++_<=v;){x.length>0&&x.push({type:"text",value:" "});let j=typeof r=="string"?r:r(u,_);typeof j=="string"&&(j={type:"text",value:j}),x.push({type:"element",tagName:"a",properties:{href:"#"+n+"fnref-"+g+(_>1?"-"+_:""),dataFootnoteBackref:"",ariaLabel:typeof i=="string"?i:i(u,_),className:["data-footnote-backref"]},children:Array.isArray(j)?j:[j]})}const S=p[p.length-1];if(S&&S.type==="element"&&S.tagName==="p"){const j=S.children[S.children.length-1];j&&j.type==="text"?j.value+=" ":S.children.push({type:"text",value:" "}),S.children.push(...x)}else p.push(...x);const w={type:"element",tagName:"li",properties:{id:n+"fn-"+g},children:e.wrap(p,!0)};e.patch(d,w),l.push(w)}if(l.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:a,properties:{...hb(o),id:"footnote-label"},children:[{type:"text",value:s}]},{type:"text",value:`
`},{type:"element",tagName:"ol",properties:{},children:e.wrap(l,!0)},{type:"text",value:`
`}]}}const I0=(function(e){if(e==null)return Lle;if(typeof e=="function")return B0(e);if(typeof e=="object")return Array.isArray(e)?Ole(e):Dle(e);if(typeof e=="string")return Ple(e);throw new Error("Expected function, string, or object as test")});function Ole(e){const n=[];let r=-1;for(;++r<e.length;)n[r]=I0(e[r]);return B0(i);function i(...s){let a=-1;for(;++a<n.length;)if(n[a].apply(this,s))return!0;return!1}}function Dle(e){const n=e;return B0(r);function r(i){const s=i;let a;for(a in e)if(s[a]!==n[a])return!1;return!0}}function Ple(e){return B0(n);function n(r){return r&&r.type===e}}function B0(e){return n;function n(r,i,s){return!!(Ile(r)&&e.call(this,r,typeof i=="number"?i:void 0,s||void 0))}}function Lle(){return!0}function Ile(e){return e!==null&&typeof e=="object"&&"type"in e}const g$=[],Ble=!0,Sj=!1,zle="skip";function v$(e,n,r,i){let s;typeof n=="function"&&typeof r!="function"?(i=r,r=n):s=n;const a=I0(s),o=i?-1:1;l(e,void 0,[])();function l(u,d,p){const f=u&&typeof u=="object"?u:{};if(typeof f.type=="string"){const _=typeof f.tagName=="string"?f.tagName:typeof f.name=="string"?f.name:void 0;Object.defineProperty(g,"name",{value:"node ("+(u.type+(_?"<"+_+">":""))+")"})}return g;function g(){let _=g$,x,v,S;if((!n||a(u,d,p[p.length-1]||void 0))&&(_=$le(r(u,p)),_[0]===Sj))return _;if("children"in u&&u.children){const w=u;if(w.children&&_[0]!==zle)for(v=(i?w.children.length:-1)+o,S=p.concat(w);v>-1&&v<w.children.length;){const j=w.children[v];if(x=l(j,v,S)(),x[0]===Sj)return x;v=typeof x[1]=="number"?x[1]:v+o}}return _}}}function $le(e){return Array.isArray(e)?e:typeof e=="number"?[Ble,e]:e==null?g$:[e]}function yA(e,n,r,i){let s,a,o;typeof n=="function"&&typeof r!="function"?(a=void 0,o=n,s=r):(a=n,o=r,s=i),v$(e,a,l,s);function l(u,d){const p=d[d.length-1],f=p?p.children.indexOf(u):void 0;return o(u,f,p)}}const Cj={}.hasOwnProperty,Fle={};function Hle(e,n){const r=n||Fle,i=new Map,s=new Map,a=new Map,o={...Cle,...r.handlers},l={all:d,applyData:qle,definitionById:i,footnoteById:s,footnoteCounts:a,footnoteOrder:[],handlers:o,one:u,options:r,patch:Wle,wrap:Kle};return yA(e,function(p){if(p.type==="definition"||p.type==="footnoteDefinition"){const f=p.type==="definition"?i:s,g=String(p.identifier).toUpperCase();f.has(g)||f.set(g,p)}}),l;function u(p,f){const g=p.type,_=l.handlers[g];if(Cj.call(l.handlers,g)&&_)return _(l,p,f);if(l.options.passThrough&&l.options.passThrough.includes(g)){if("children"in p){const{children:v,...S}=p,w=hb(S);return w.children=l.all(p),w}return hb(p)}return(l.options.unknownHandler||Ule)(l,p,f)}function d(p){const f=[];if("children"in p){const g=p.children;let _=-1;for(;++_<g.length;){const x=l.one(g[_],p);if(x){if(_&&g[_-1].type==="break"&&(!Array.isArray(x)&&x.type==="text"&&(x.value=sD(x.value)),!Array.isArray(x)&&x.type==="element")){const v=x.children[0];v&&v.type==="text"&&(v.value=sD(v.value))}Array.isArray(x)?f.push(...x):f.push(x)}}}return f}}function Wle(e,n){e.position&&(n.position=Mse(e))}function qle(e,n){let r=n;if(e&&e.data){const i=e.data.hName,s=e.data.hChildren,a=e.data.hProperties;if(typeof i=="string")if(r.type==="element")r.tagName=i;else{const o="children"in r?r.children:[r];r={type:"element",tagName:i,properties:{},children:o}}r.type==="element"&&a&&Object.assign(r.properties,hb(a)),"children"in r&&r.children&&s!==null&&s!==void 0&&(r.children=s)}return r}function Ule(e,n){const r=n.data||{},i="value"in n&&!(Cj.call(r,"hProperties")||Cj.call(r,"hChildren"))?{type:"text",value:n.value}:{type:"element",tagName:"div",properties:{},children:e.all(n)};return e.patch(n,i),e.applyData(n,i)}function Kle(e,n){const r=[];let i=-1;for(n&&r.push({type:"text",value:`
`});++i<e.length;)i&&r.push({type:"text",value:`
`}),r.push(e[i]);return n&&e.length>0&&r.push({type:"text",value:`
`}),r}function sD(e){let n=0,r=e.charCodeAt(n);for(;r===9||r===32;)n++,r=e.charCodeAt(n);return e.slice(n)}function aD(e,n){const r=Hle(e,n),i=r.one(e,void 0),s=Rle(r),a=Array.isArray(i)?{type:"root",children:i}:i||{type:"root",children:[]};return s&&a.children.push({type:"text",value:`
`},s),a}function Vle(e,n){return e&&"run"in e?async function(r,i){const s=aD(r,{file:i,...n});await e.run(s,i)}:function(r,i){return aD(r,{file:i,...e||n})}}function oD(e){if(e)throw e}var sS,lD;function Yle(){if(lD)return sS;lD=1;var e=Object.prototype.hasOwnProperty,n=Object.prototype.toString,r=Object.defineProperty,i=Object.getOwnPropertyDescriptor,s=function(d){return typeof Array.isArray=="function"?Array.isArray(d):n.call(d)==="[object Array]"},a=function(d){if(!d||n.call(d)!=="[object Object]")return!1;var p=e.call(d,"constructor"),f=d.constructor&&d.constructor.prototype&&e.call(d.constructor.prototype,"isPrototypeOf");if(d.constructor&&!p&&!f)return!1;var g;for(g in d);return typeof g>"u"||e.call(d,g)},o=function(d,p){r&&p.name==="__proto__"?r(d,p.name,{enumerable:!0,configurable:!0,value:p.newValue,writable:!0}):d[p.name]=p.newValue},l=function(d,p){if(p==="__proto__")if(e.call(d,p)){if(i)return i(d,p).value}else return;return d[p]};return sS=function u(){var d,p,f,g,_,x,v=arguments[0],S=1,w=arguments.length,j=!1;for(typeof v=="boolean"&&(j=v,v=arguments[1]||{},S=2),(v==null||typeof v!="object"&&typeof v!="function")&&(v={});S<w;++S)if(d=arguments[S],d!=null)for(p in d)f=l(v,p),g=l(d,p),v!==g&&(j&&g&&(a(g)||(_=s(g)))?(_?(_=!1,x=f&&s(f)?f:[]):x=f&&a(f)?f:{},o(v,{name:p,newValue:u(j,x,g)})):typeof g<"u"&&o(v,{name:p,newValue:g}));return v},sS}var Gle=Yle();const aS=wu(Gle);function jj(e){if(typeof e!="object"||e===null)return!1;const n=Object.getPrototypeOf(e);return(n===null||n===Object.prototype||Object.getPrototypeOf(n)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function Xle(){const e=[],n={run:r,use:i};return n;function r(...s){let a=-1;const o=s.pop();if(typeof o!="function")throw new TypeError("Expected function as last argument, not "+o);l(null,...s);function l(u,...d){const p=e[++a];let f=-1;if(u){o(u);return}for(;++f<s.length;)(d[f]===null||d[f]===void 0)&&(d[f]=s[f]);s=d,p?Qle(p,l)(...d):o(null,...d)}}function i(s){if(typeof s!="function")throw new TypeError("Expected `middelware` to be a function, not "+s);return e.push(s),n}}function Qle(e,n){let r;return i;function i(...o){const l=e.length>o.length;let u;l&&o.push(s);try{u=e.apply(this,o)}catch(d){const p=d;if(l&&r)throw p;return s(p)}l||(u&&u.then&&typeof u.then=="function"?u.then(a,s):u instanceof Error?s(u):a(u))}function s(o,...l){r||(r=!0,n(o,...l))}function a(o){s(null,o)}}const Oo={basename:Zle,dirname:Jle,extname:ece,join:tce,sep:"/"};function Zle(e,n){if(n!==void 0&&typeof n!="string")throw new TypeError('"ext" argument must be a string');Ov(e);let r=0,i=-1,s=e.length,a;if(n===void 0||n.length===0||n.length>e.length){for(;s--;)if(e.codePointAt(s)===47){if(a){r=s+1;break}}else i<0&&(a=!0,i=s+1);return i<0?"":e.slice(r,i)}if(n===e)return"";let o=-1,l=n.length-1;for(;s--;)if(e.codePointAt(s)===47){if(a){r=s+1;break}}else o<0&&(a=!0,o=s+1),l>-1&&(e.codePointAt(s)===n.codePointAt(l--)?l<0&&(i=s):(l=-1,i=o));return r===i?i=o:i<0&&(i=e.length),e.slice(r,i)}function Jle(e){if(Ov(e),e.length===0)return".";let n=-1,r=e.length,i;for(;--r;)if(e.codePointAt(r)===47){if(i){n=r;break}}else i||(i=!0);return n<0?e.codePointAt(0)===47?"/":".":n===1&&e.codePointAt(0)===47?"//":e.slice(0,n)}function ece(e){Ov(e);let n=e.length,r=-1,i=0,s=-1,a=0,o;for(;n--;){const l=e.codePointAt(n);if(l===47){if(o){i=n+1;break}continue}r<0&&(o=!0,r=n+1),l===46?s<0?s=n:a!==1&&(a=1):s>-1&&(a=-1)}return s<0||r<0||a===0||a===1&&s===r-1&&s===i+1?"":e.slice(s,r)}function tce(...e){let n=-1,r;for(;++n<e.length;)Ov(e[n]),e[n]&&(r=r===void 0?e[n]:r+"/"+e[n]);return r===void 0?".":nce(r)}function nce(e){Ov(e);const n=e.codePointAt(0)===47;let r=rce(e,!n);return r.length===0&&!n&&(r="."),r.length>0&&e.codePointAt(e.length-1)===47&&(r+="/"),n?"/"+r:r}function rce(e,n){let r="",i=0,s=-1,a=0,o=-1,l,u;for(;++o<=e.length;){if(o<e.length)l=e.codePointAt(o);else{if(l===47)break;l=47}if(l===47){if(!(s===o-1||a===1))if(s!==o-1&&a===2){if(r.length<2||i!==2||r.codePointAt(r.length-1)!==46||r.codePointAt(r.length-2)!==46){if(r.length>2){if(u=r.lastIndexOf("/"),u!==r.length-1){u<0?(r="",i=0):(r=r.slice(0,u),i=r.length-1-r.lastIndexOf("/")),s=o,a=0;continue}}else if(r.length>0){r="",i=0,s=o,a=0;continue}}n&&(r=r.length>0?r+"/..":"..",i=2)}else r.length>0?r+="/"+e.slice(s+1,o):r=e.slice(s+1,o),i=o-s-1;s=o,a=0}else l===46&&a>-1?a++:a=-1}return r}function Ov(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const ice={cwd:sce};function sce(){return"/"}function Nj(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function ace(e){if(typeof e=="string")e=new URL(e);else if(!Nj(e)){const n=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw n.code="ERR_INVALID_ARG_TYPE",n}if(e.protocol!=="file:"){const n=new TypeError("The URL must be of scheme file");throw n.code="ERR_INVALID_URL_SCHEME",n}return oce(e)}function oce(e){if(e.hostname!==""){const i=new TypeError('File URL host must be "localhost" or empty on darwin');throw i.code="ERR_INVALID_FILE_URL_HOST",i}const n=e.pathname;let r=-1;for(;++r<n.length;)if(n.codePointAt(r)===37&&n.codePointAt(r+1)===50){const i=n.codePointAt(r+2);if(i===70||i===102){const s=new TypeError("File URL path must not include encoded / characters");throw s.code="ERR_INVALID_FILE_URL_PATH",s}}return decodeURIComponent(n)}const oS=["history","path","basename","stem","extname","dirname"];class y${constructor(n){let r;n?Nj(n)?r={path:n}:typeof n=="string"||lce(n)?r={value:n}:r=n:r={},this.cwd="cwd"in r?"":ice.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let i=-1;for(;++i<oS.length;){const a=oS[i];a in r&&r[a]!==void 0&&r[a]!==null&&(this[a]=a==="history"?[...r[a]]:r[a])}let s;for(s in r)oS.includes(s)||(this[s]=r[s])}get basename(){return typeof this.path=="string"?Oo.basename(this.path):void 0}set basename(n){cS(n,"basename"),lS(n,"basename"),this.path=Oo.join(this.dirname||"",n)}get dirname(){return typeof this.path=="string"?Oo.dirname(this.path):void 0}set dirname(n){cD(this.basename,"dirname"),this.path=Oo.join(n||"",this.basename)}get extname(){return typeof this.path=="string"?Oo.extname(this.path):void 0}set extname(n){if(lS(n,"extname"),cD(this.dirname,"extname"),n){if(n.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(n.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=Oo.join(this.dirname,this.stem+(n||""))}get path(){return this.history[this.history.length-1]}set path(n){Nj(n)&&(n=ace(n)),cS(n,"path"),this.path!==n&&this.history.push(n)}get stem(){return typeof this.path=="string"?Oo.basename(this.path,this.extname):void 0}set stem(n){cS(n,"stem"),lS(n,"stem"),this.path=Oo.join(this.dirname||"",n+(this.extname||""))}fail(n,r,i){const s=this.message(n,r,i);throw s.fatal=!0,s}info(n,r,i){const s=this.message(n,r,i);return s.fatal=void 0,s}message(n,r,i){const s=new Yi(n,r,i);return this.path&&(s.name=this.path+":"+s.name,s.file=this.path),s.fatal=!1,this.messages.push(s),s}toString(n){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(n||void 0).decode(this.value)}}function lS(e,n){if(e&&e.includes(Oo.sep))throw new Error("`"+n+"` cannot be a path: did not expect `"+Oo.sep+"`")}function cS(e,n){if(!e)throw new Error("`"+n+"` cannot be empty")}function cD(e,n){if(!e)throw new Error("Setting `"+n+"` requires `path` to be set too")}function lce(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const cce=(function(e){const i=this.constructor.prototype,s=i[e],a=function(){return s.apply(a,arguments)};return Object.setPrototypeOf(a,i),a}),uce={}.hasOwnProperty;class _A extends cce{constructor(){super("copy"),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=Xle()}copy(){const n=new _A;let r=-1;for(;++r<this.attachers.length;){const i=this.attachers[r];n.use(...i)}return n.data(aS(!0,{},this.namespace)),n}data(n,r){return typeof n=="string"?arguments.length===2?(hS("data",this.frozen),this.namespace[n]=r,this):uce.call(this.namespace,n)&&this.namespace[n]||void 0:n?(hS("data",this.frozen),this.namespace=n,this):this.namespace}freeze(){if(this.frozen)return this;const n=this;for(;++this.freezeIndex<this.attachers.length;){const[r,...i]=this.attachers[this.freezeIndex];if(i[0]===!1)continue;i[0]===!0&&(i[0]=void 0);const s=r.call(n,...i);typeof s=="function"&&this.transformers.use(s)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(n){this.freeze();const r=m_(n),i=this.parser||this.Parser;return uS("parse",i),i(String(r),r)}process(n,r){const i=this;return this.freeze(),uS("process",this.parser||this.Parser),dS("process",this.compiler||this.Compiler),r?s(void 0,r):new Promise(s);function s(a,o){const l=m_(n),u=i.parse(l);i.run(u,l,function(p,f,g){if(p||!f||!g)return d(p);const _=f,x=i.stringify(_,g);fce(x)?g.value=x:g.result=x,d(p,g)});function d(p,f){p||!f?o(p):a?a(f):r(void 0,f)}}}processSync(n){let r=!1,i;return this.freeze(),uS("processSync",this.parser||this.Parser),dS("processSync",this.compiler||this.Compiler),this.process(n,s),dD("processSync","process",r),i;function s(a,o){r=!0,oD(a),i=o}}run(n,r,i){uD(n),this.freeze();const s=this.transformers;return!i&&typeof r=="function"&&(i=r,r=void 0),i?a(void 0,i):new Promise(a);function a(o,l){const u=m_(r);s.run(n,u,d);function d(p,f,g){const _=f||n;p?l(p):o?o(_):i(void 0,_,g)}}}runSync(n,r){let i=!1,s;return this.run(n,r,a),dD("runSync","run",i),s;function a(o,l){oD(o),s=l,i=!0}}stringify(n,r){this.freeze();const i=m_(r),s=this.compiler||this.Compiler;return dS("stringify",s),uD(n),s(n,i)}use(n,...r){const i=this.attachers,s=this.namespace;if(hS("use",this.frozen),n!=null)if(typeof n=="function")u(n,r);else if(typeof n=="object")Array.isArray(n)?l(n):o(n);else throw new TypeError("Expected usable value, not `"+n+"`");return this;function a(d){if(typeof d=="function")u(d,[]);else if(typeof d=="object")if(Array.isArray(d)){const[p,...f]=d;u(p,f)}else o(d);else throw new TypeError("Expected usable value, not `"+d+"`")}function o(d){if(!("plugins"in d)&&!("settings"in d))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");l(d.plugins),d.settings&&(s.settings=aS(!0,s.settings,d.settings))}function l(d){let p=-1;if(d!=null)if(Array.isArray(d))for(;++p<d.length;){const f=d[p];a(f)}else throw new TypeError("Expected a list of plugins, not `"+d+"`")}function u(d,p){let f=-1,g=-1;for(;++f<i.length;)if(i[f][0]===d){g=f;break}if(g===-1)i.push([d,...p]);else if(p.length>0){let[_,...x]=p;const v=i[g][1];jj(v)&&jj(_)&&(_=aS(!0,v,_)),i[g]=[d,_,...x]}}}}const dce=new _A().freeze();function uS(e,n){if(typeof n!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function dS(e,n){if(typeof n!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function hS(e,n){if(n)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function uD(e){if(!jj(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function dD(e,n,r){if(!r)throw new Error("`"+e+"` finished async. Use `"+n+"` instead")}function m_(e){return hce(e)?e:new y$(e)}function hce(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function fce(e){return typeof e=="string"||pce(e)}function pce(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const mce="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",hD=[],fD={allowDangerousHtml:!0},gce=/^(https?|ircs?|mailto|xmpp)$/i,vce=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"className",id:"remove-classname"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function xA(e){const n=yce(e),r=_ce(e);return xce(n.runSync(n.parse(r),r),e)}function yce(e){const n=e.rehypePlugins||hD,r=e.remarkPlugins||hD,i=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...fD}:fD;return dce().use(Joe).use(r).use(Vle,i).use(n)}function _ce(e){const n=e.children||"",r=new y$;return typeof n=="string"&&(r.value=n),r}function xce(e,n){const r=n.allowedElements,i=n.allowElement,s=n.components,a=n.disallowedElements,o=n.skipHtml,l=n.unwrapDisallowed,u=n.urlTransform||bce;for(const p of vce)Object.hasOwn(n,p.from)&&(""+p.from+(p.to?"use `"+p.to+"` instead":"remove it")+mce+p.id,void 0);return yA(e,d),Lse(e,{Fragment:c.Fragment,components:s,ignoreInvalidStyle:!0,jsx:c.jsx,jsxs:c.jsxs,passKeys:!0,passNode:!0});function d(p,f,g){if(p.type==="raw"&&g&&typeof f=="number")return o?g.children.splice(f,1):g.children[f]={type:"text",value:p.value},f;if(p.type==="element"){let _;for(_ in nS)if(Object.hasOwn(nS,_)&&Object.hasOwn(p.properties,_)){const x=p.properties[_],v=nS[_];(v===null||v.includes(p.tagName))&&(p.properties[_]=u(String(x||""),_,p))}}if(p.type==="element"){let _=r?!r.includes(p.tagName):a?a.includes(p.tagName):!1;if(!_&&i&&typeof f=="number"&&(_=!i(p,f,g)),_&&g&&typeof f=="number")return l&&p.children?g.children.splice(f,1,...p.children):g.children.splice(f,1),f}}}function bce(e){const n=e.indexOf(":"),r=e.indexOf("?"),i=e.indexOf("#"),s=e.indexOf("/");return n===-1||s!==-1&&n>s||r!==-1&&n>r||i!==-1&&n>i||gce.test(e.slice(0,n))?e:""}function pD(e,n){const r=String(e);if(typeof n!="string")throw new TypeError("Expected character");let i=0,s=r.indexOf(n);for(;s!==-1;)i++,s=r.indexOf(n,s+n.length);return i}function kce(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function wce(e,n,r){const s=I0((r||{}).ignore||[]),a=Sce(n);let o=-1;for(;++o<a.length;)v$(e,"text",l);function l(d,p){let f=-1,g;for(;++f<p.length;){const _=p[f],x=g?g.children:void 0;if(s(_,x?x.indexOf(_):void 0,g))return;g=_}if(g)return u(d,p)}function u(d,p){const f=p[p.length-1],g=a[o][0],_=a[o][1];let x=0;const S=f.children.indexOf(d);let w=!1,j=[];g.lastIndex=0;let C=g.exec(d.value);for(;C;){const T=C.index,E={index:C.index,input:C.input,stack:[...p,d]};let A=_(...C,E);if(typeof A=="string"&&(A=A.length>0?{type:"text",value:A}:void 0),A===!1?g.lastIndex=T+1:(x!==T&&j.push({type:"text",value:d.value.slice(x,T)}),Array.isArray(A)?j.push(...A):A&&j.push(A),x=T+C[0].length,w=!0),!g.global)break;C=g.exec(d.value)}return w?(x<d.value.length&&j.push({type:"text",value:d.value.slice(x)}),f.children.splice(S,1,...j)):j=[d],S+j.length}}function Sce(e){const n=[];if(!Array.isArray(e))throw new TypeError("Expected find and replace tuple or list of tuples");const r=!e[0]||Array.isArray(e[0])?e:[e];let i=-1;for(;++i<r.length;){const s=r[i];n.push([Cce(s[0]),jce(s[1])])}return n}function Cce(e){return typeof e=="string"?new RegExp(kce(e),"g"):e}function jce(e){return typeof e=="function"?e:function(){return e}}const fS="phrasing",pS=["autolink","link","image","label"];function Nce(){return{transforms:[Dce],enter:{literalAutolink:Ace,literalAutolinkEmail:mS,literalAutolinkHttp:mS,literalAutolinkWww:mS},exit:{literalAutolink:Oce,literalAutolinkEmail:Rce,literalAutolinkHttp:Tce,literalAutolinkWww:Mce}}}function Ece(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:fS,notInConstruct:pS},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:fS,notInConstruct:pS},{character:":",before:"[ps]",after:"\\/",inConstruct:fS,notInConstruct:pS}]}}function Ace(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function mS(e){this.config.enter.autolinkProtocol.call(this,e)}function Tce(e){this.config.exit.autolinkProtocol.call(this,e)}function Mce(e){this.config.exit.data.call(this,e);const n=this.stack[this.stack.length-1];n.type,n.url="http://"+this.sliceSerialize(e)}function Rce(e){this.config.exit.autolinkEmail.call(this,e)}function Oce(e){this.exit(e)}function Dce(e){wce(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,Pce],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),Lce]],{ignore:["link","linkReference"]})}function Pce(e,n,r,i,s){let a="";if(!_$(s)||(/^w/i.test(n)&&(r=n+r,n="",a="http://"),!Ice(r)))return!1;const o=Bce(r+i);if(!o[0])return!1;const l={type:"link",title:null,url:a+n+o[0],children:[{type:"text",value:n+o[0]}]};return o[1]?[l,{type:"text",value:o[1]}]:l}function Lce(e,n,r,i){return!_$(i,!0)||/[-\d_]$/.test(r)?!1:{type:"link",title:null,url:"mailto:"+n+"@"+r,children:[{type:"text",value:n+"@"+r}]}}function Ice(e){const n=e.split(".");return!(n.length<2||n[n.length-1]&&(/_/.test(n[n.length-1])||!/[a-zA-Z\d]/.test(n[n.length-1]))||n[n.length-2]&&(/_/.test(n[n.length-2])||!/[a-zA-Z\d]/.test(n[n.length-2])))}function Bce(e){const n=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!n)return[e,void 0];e=e.slice(0,n.index);let r=n[0],i=r.indexOf(")");const s=pD(e,"(");let a=pD(e,")");for(;i!==-1&&s>a;)e+=r.slice(0,i+1),r=r.slice(i+1),i=r.indexOf(")"),a++;return[e,r]}function _$(e,n){const r=e.input.charCodeAt(e.index-1);return(e.index===0||Od(r)||D0(r))&&(!n||r!==47)}x$.peek=Vce;function zce(){this.buffer()}function $ce(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function Fce(){this.buffer()}function Hce(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function Wce(e){const n=this.resume(),r=this.stack[this.stack.length-1];r.type,r.identifier=to(this.sliceSerialize(e)).toLowerCase(),r.label=n}function qce(e){this.exit(e)}function Uce(e){const n=this.resume(),r=this.stack[this.stack.length-1];r.type,r.identifier=to(this.sliceSerialize(e)).toLowerCase(),r.label=n}function Kce(e){this.exit(e)}function Vce(){return"["}function x$(e,n,r,i){const s=r.createTracker(i);let a=s.move("[^");const o=r.enter("footnoteReference"),l=r.enter("reference");return a+=s.move(r.safe(r.associationId(e),{after:"]",before:a})),l(),o(),a+=s.move("]"),a}function Yce(){return{enter:{gfmFootnoteCallString:zce,gfmFootnoteCall:$ce,gfmFootnoteDefinitionLabelString:Fce,gfmFootnoteDefinition:Hce},exit:{gfmFootnoteCallString:Wce,gfmFootnoteCall:qce,gfmFootnoteDefinitionLabelString:Uce,gfmFootnoteDefinition:Kce}}}function Gce(e){let n=!1;return e&&e.firstLineBlank&&(n=!0),{handlers:{footnoteDefinition:r,footnoteReference:x$},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function r(i,s,a,o){const l=a.createTracker(o);let u=l.move("[^");const d=a.enter("footnoteDefinition"),p=a.enter("label");return u+=l.move(a.safe(a.associationId(i),{before:u,after:"]"})),p(),u+=l.move("]:"),i.children&&i.children.length>0&&(l.shift(4),u+=l.move((n?`
`:" ")+a.indentLines(a.containerFlow(i,l.current()),n?b$:Xce))),d(),u}}function Xce(e,n,r){return n===0?e:b$(e,n,r)}function b$(e,n,r){return(r?"":"    ")+e}const Qce=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];k$.peek=nue;function Zce(){return{canContainEols:["delete"],enter:{strikethrough:eue},exit:{strikethrough:tue}}}function Jce(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:Qce}],handlers:{delete:k$}}}function eue(e){this.enter({type:"delete",children:[]},e)}function tue(e){this.exit(e)}function k$(e,n,r,i){const s=r.createTracker(i),a=r.enter("strikethrough");let o=s.move("~~");return o+=r.containerPhrasing(e,{...s.current(),before:o,after:"~"}),o+=s.move("~~"),a(),o}function nue(){return"~"}function rue(e){return e.length}function iue(e,n){const r=n||{},i=(r.align||[]).concat(),s=r.stringLength||rue,a=[],o=[],l=[],u=[];let d=0,p=-1;for(;++p<e.length;){const v=[],S=[];let w=-1;for(e[p].length>d&&(d=e[p].length);++w<e[p].length;){const j=sue(e[p][w]);if(r.alignDelimiters!==!1){const C=s(j);S[w]=C,(u[w]===void 0||C>u[w])&&(u[w]=C)}v.push(j)}o[p]=v,l[p]=S}let f=-1;if(typeof i=="object"&&"length"in i)for(;++f<d;)a[f]=mD(i[f]);else{const v=mD(i);for(;++f<d;)a[f]=v}f=-1;const g=[],_=[];for(;++f<d;){const v=a[f];let S="",w="";v===99?(S=":",w=":"):v===108?S=":":v===114&&(w=":");let j=r.alignDelimiters===!1?1:Math.max(1,u[f]-S.length-w.length);const C=S+"-".repeat(j)+w;r.alignDelimiters!==!1&&(j=S.length+j+w.length,j>u[f]&&(u[f]=j),_[f]=j),g[f]=C}o.splice(1,0,g),l.splice(1,0,_),p=-1;const x=[];for(;++p<o.length;){const v=o[p],S=l[p];f=-1;const w=[];for(;++f<d;){const j=v[f]||"";let C="",T="";if(r.alignDelimiters!==!1){const E=u[f]-(S[f]||0),A=a[f];A===114?C=" ".repeat(E):A===99?E%2?(C=" ".repeat(E/2+.5),T=" ".repeat(E/2-.5)):(C=" ".repeat(E/2),T=C):T=" ".repeat(E)}r.delimiterStart!==!1&&!f&&w.push("|"),r.padding!==!1&&!(r.alignDelimiters===!1&&j==="")&&(r.delimiterStart!==!1||f)&&w.push(" "),r.alignDelimiters!==!1&&w.push(C),w.push(j),r.alignDelimiters!==!1&&w.push(T),r.padding!==!1&&w.push(" "),(r.delimiterEnd!==!1||f!==d-1)&&w.push("|")}x.push(r.delimiterEnd===!1?w.join("").replace(/ +$/,""):w.join(""))}return x.join(`
`)}function sue(e){return e==null?"":String(e)}function mD(e){const n=typeof e=="string"?e.codePointAt(0):0;return n===67||n===99?99:n===76||n===108?108:n===82||n===114?114:0}function aue(e,n,r,i){const s=r.enter("blockquote"),a=r.createTracker(i);a.move("> "),a.shift(2);const o=r.indentLines(r.containerFlow(e,a.current()),oue);return s(),o}function oue(e,n,r){return">"+(r?"":" ")+e}function lue(e,n){return gD(e,n.inConstruct,!0)&&!gD(e,n.notInConstruct,!1)}function gD(e,n,r){if(typeof n=="string"&&(n=[n]),!n||n.length===0)return r;let i=-1;for(;++i<n.length;)if(e.includes(n[i]))return!0;return!1}function vD(e,n,r,i){let s=-1;for(;++s<r.unsafe.length;)if(r.unsafe[s].character===`
`&&lue(r.stack,r.unsafe[s]))return/[ \t]/.test(i.before)?"":" ";return`\\
`}function cue(e,n){const r=String(e);let i=r.indexOf(n),s=i,a=0,o=0;if(typeof n!="string")throw new TypeError("Expected substring");for(;i!==-1;)i===s?++a>o&&(o=a):a=1,s=i+n.length,i=r.indexOf(n,s);return o}function uue(e,n){return!!(n.options.fences===!1&&e.value&&!e.lang&&/[^ \r\n]/.test(e.value)&&!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(e.value))}function due(e){const n=e.options.fence||"`";if(n!=="`"&&n!=="~")throw new Error("Cannot serialize code with `"+n+"` for `options.fence`, expected `` ` `` or `~`");return n}function hue(e,n,r,i){const s=due(r),a=e.value||"",o=s==="`"?"GraveAccent":"Tilde";if(uue(e,r)){const f=r.enter("codeIndented"),g=r.indentLines(a,fue);return f(),g}const l=r.createTracker(i),u=s.repeat(Math.max(cue(a,s)+1,3)),d=r.enter("codeFenced");let p=l.move(u);if(e.lang){const f=r.enter(`codeFencedLang${o}`);p+=l.move(r.safe(e.lang,{before:p,after:" ",encode:["`"],...l.current()})),f()}if(e.lang&&e.meta){const f=r.enter(`codeFencedMeta${o}`);p+=l.move(" "),p+=l.move(r.safe(e.meta,{before:p,after:`
`,encode:["`"],...l.current()})),f()}return p+=l.move(`
`),a&&(p+=l.move(a+`
`)),p+=l.move(u),d(),p}function fue(e,n,r){return(r?"":"    ")+e}function bA(e){const n=e.options.quote||'"';if(n!=='"'&&n!=="'")throw new Error("Cannot serialize title with `"+n+"` for `options.quote`, expected `\"`, or `'`");return n}function pue(e,n,r,i){const s=bA(r),a=s==='"'?"Quote":"Apostrophe",o=r.enter("definition");let l=r.enter("label");const u=r.createTracker(i);let d=u.move("[");return d+=u.move(r.safe(r.associationId(e),{before:d,after:"]",...u.current()})),d+=u.move("]: "),l(),!e.url||/[\0- \u007F]/.test(e.url)?(l=r.enter("destinationLiteral"),d+=u.move("<"),d+=u.move(r.safe(e.url,{before:d,after:">",...u.current()})),d+=u.move(">")):(l=r.enter("destinationRaw"),d+=u.move(r.safe(e.url,{before:d,after:e.title?" ":`
`,...u.current()}))),l(),e.title&&(l=r.enter(`title${a}`),d+=u.move(" "+s),d+=u.move(r.safe(e.title,{before:d,after:s,...u.current()})),d+=u.move(s),l()),o(),d}function mue(e){const n=e.options.emphasis||"*";if(n!=="*"&&n!=="_")throw new Error("Cannot serialize emphasis with `"+n+"` for `options.emphasis`, expected `*`, or `_`");return n}function Pg(e){return"&#x"+e.toString(16).toUpperCase()+";"}function fb(e,n,r){const i=Lf(e),s=Lf(n);return i===void 0?s===void 0?r==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:s===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:i===1?s===void 0?{inside:!1,outside:!1}:s===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:s===void 0?{inside:!1,outside:!1}:s===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}w$.peek=gue;function w$(e,n,r,i){const s=mue(r),a=r.enter("emphasis"),o=r.createTracker(i),l=o.move(s);let u=o.move(r.containerPhrasing(e,{after:s,before:l,...o.current()}));const d=u.charCodeAt(0),p=fb(i.before.charCodeAt(i.before.length-1),d,s);p.inside&&(u=Pg(d)+u.slice(1));const f=u.charCodeAt(u.length-1),g=fb(i.after.charCodeAt(0),f,s);g.inside&&(u=u.slice(0,-1)+Pg(f));const _=o.move(s);return a(),r.attentionEncodeSurroundingInfo={after:g.outside,before:p.outside},l+u+_}function gue(e,n,r){return r.options.emphasis||"*"}function vue(e,n){let r=!1;return yA(e,function(i){if("value"in i&&/\r?\n|\r/.test(i.value)||i.type==="break")return r=!0,Sj}),!!((!e.depth||e.depth<3)&&dA(e)&&(n.options.setext||r))}function yue(e,n,r,i){const s=Math.max(Math.min(6,e.depth||1),1),a=r.createTracker(i);if(vue(e,r)){const p=r.enter("headingSetext"),f=r.enter("phrasing"),g=r.containerPhrasing(e,{...a.current(),before:`
`,after:`
`});return f(),p(),g+`
`+(s===1?"=":"-").repeat(g.length-(Math.max(g.lastIndexOf("\r"),g.lastIndexOf(`
`))+1))}const o="#".repeat(s),l=r.enter("headingAtx"),u=r.enter("phrasing");a.move(o+" ");let d=r.containerPhrasing(e,{before:"# ",after:`
`,...a.current()});return/^[\t ]/.test(d)&&(d=Pg(d.charCodeAt(0))+d.slice(1)),d=d?o+" "+d:o,r.options.closeAtx&&(d+=" "+o),u(),l(),d}S$.peek=_ue;function S$(e){return e.value||""}function _ue(){return"<"}C$.peek=xue;function C$(e,n,r,i){const s=bA(r),a=s==='"'?"Quote":"Apostrophe",o=r.enter("image");let l=r.enter("label");const u=r.createTracker(i);let d=u.move("![");return d+=u.move(r.safe(e.alt,{before:d,after:"]",...u.current()})),d+=u.move("]("),l(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(l=r.enter("destinationLiteral"),d+=u.move("<"),d+=u.move(r.safe(e.url,{before:d,after:">",...u.current()})),d+=u.move(">")):(l=r.enter("destinationRaw"),d+=u.move(r.safe(e.url,{before:d,after:e.title?" ":")",...u.current()}))),l(),e.title&&(l=r.enter(`title${a}`),d+=u.move(" "+s),d+=u.move(r.safe(e.title,{before:d,after:s,...u.current()})),d+=u.move(s),l()),d+=u.move(")"),o(),d}function xue(){return"!"}j$.peek=bue;function j$(e,n,r,i){const s=e.referenceType,a=r.enter("imageReference");let o=r.enter("label");const l=r.createTracker(i);let u=l.move("![");const d=r.safe(e.alt,{before:u,after:"]",...l.current()});u+=l.move(d+"]["),o();const p=r.stack;r.stack=[],o=r.enter("reference");const f=r.safe(r.associationId(e),{before:u,after:"]",...l.current()});return o(),r.stack=p,a(),s==="full"||!d||d!==f?u+=l.move(f+"]"):s==="shortcut"?u=u.slice(0,-1):u+=l.move("]"),u}function bue(){return"!"}N$.peek=kue;function N$(e,n,r){let i=e.value||"",s="`",a=-1;for(;new RegExp("(^|[^`])"+s+"([^`]|$)").test(i);)s+="`";for(/[^ \r\n]/.test(i)&&(/^[ \r\n]/.test(i)&&/[ \r\n]$/.test(i)||/^`|`$/.test(i))&&(i=" "+i+" ");++a<r.unsafe.length;){const o=r.unsafe[a],l=r.compilePattern(o);let u;if(o.atBreak)for(;u=l.exec(i);){let d=u.index;i.charCodeAt(d)===10&&i.charCodeAt(d-1)===13&&d--,i=i.slice(0,d)+" "+i.slice(u.index+1)}}return s+i+s}function kue(){return"`"}function E$(e,n){const r=dA(e);return!!(!n.options.resourceLink&&e.url&&!e.title&&e.children&&e.children.length===1&&e.children[0].type==="text"&&(r===e.url||"mailto:"+r===e.url)&&/^[a-z][a-z+.-]+:/i.test(e.url)&&!/[\0- <>\u007F]/.test(e.url))}A$.peek=wue;function A$(e,n,r,i){const s=bA(r),a=s==='"'?"Quote":"Apostrophe",o=r.createTracker(i);let l,u;if(E$(e,r)){const p=r.stack;r.stack=[],l=r.enter("autolink");let f=o.move("<");return f+=o.move(r.containerPhrasing(e,{before:f,after:">",...o.current()})),f+=o.move(">"),l(),r.stack=p,f}l=r.enter("link"),u=r.enter("label");let d=o.move("[");return d+=o.move(r.containerPhrasing(e,{before:d,after:"](",...o.current()})),d+=o.move("]("),u(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(u=r.enter("destinationLiteral"),d+=o.move("<"),d+=o.move(r.safe(e.url,{before:d,after:">",...o.current()})),d+=o.move(">")):(u=r.enter("destinationRaw"),d+=o.move(r.safe(e.url,{before:d,after:e.title?" ":")",...o.current()}))),u(),e.title&&(u=r.enter(`title${a}`),d+=o.move(" "+s),d+=o.move(r.safe(e.title,{before:d,after:s,...o.current()})),d+=o.move(s),u()),d+=o.move(")"),l(),d}function wue(e,n,r){return E$(e,r)?"<":"["}T$.peek=Sue;function T$(e,n,r,i){const s=e.referenceType,a=r.enter("linkReference");let o=r.enter("label");const l=r.createTracker(i);let u=l.move("[");const d=r.containerPhrasing(e,{before:u,after:"]",...l.current()});u+=l.move(d+"]["),o();const p=r.stack;r.stack=[],o=r.enter("reference");const f=r.safe(r.associationId(e),{before:u,after:"]",...l.current()});return o(),r.stack=p,a(),s==="full"||!d||d!==f?u+=l.move(f+"]"):s==="shortcut"?u=u.slice(0,-1):u+=l.move("]"),u}function Sue(){return"["}function kA(e){const n=e.options.bullet||"*";if(n!=="*"&&n!=="+"&&n!=="-")throw new Error("Cannot serialize items with `"+n+"` for `options.bullet`, expected `*`, `+`, or `-`");return n}function Cue(e){const n=kA(e),r=e.options.bulletOther;if(!r)return n==="*"?"-":"*";if(r!=="*"&&r!=="+"&&r!=="-")throw new Error("Cannot serialize items with `"+r+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(r===n)throw new Error("Expected `bullet` (`"+n+"`) and `bulletOther` (`"+r+"`) to be different");return r}function jue(e){const n=e.options.bulletOrdered||".";if(n!=="."&&n!==")")throw new Error("Cannot serialize items with `"+n+"` for `options.bulletOrdered`, expected `.` or `)`");return n}function M$(e){const n=e.options.rule||"*";if(n!=="*"&&n!=="-"&&n!=="_")throw new Error("Cannot serialize rules with `"+n+"` for `options.rule`, expected `*`, `-`, or `_`");return n}function Nue(e,n,r,i){const s=r.enter("list"),a=r.bulletCurrent;let o=e.ordered?jue(r):kA(r);const l=e.ordered?o==="."?")":".":Cue(r);let u=n&&r.bulletLastUsed?o===r.bulletLastUsed:!1;if(!e.ordered){const p=e.children?e.children[0]:void 0;if((o==="*"||o==="-")&&p&&(!p.children||!p.children[0])&&r.stack[r.stack.length-1]==="list"&&r.stack[r.stack.length-2]==="listItem"&&r.stack[r.stack.length-3]==="list"&&r.stack[r.stack.length-4]==="listItem"&&r.indexStack[r.indexStack.length-1]===0&&r.indexStack[r.indexStack.length-2]===0&&r.indexStack[r.indexStack.length-3]===0&&(u=!0),M$(r)===o&&p){let f=-1;for(;++f<e.children.length;){const g=e.children[f];if(g&&g.type==="listItem"&&g.children&&g.children[0]&&g.children[0].type==="thematicBreak"){u=!0;break}}}}u&&(o=l),r.bulletCurrent=o;const d=r.containerFlow(e,i);return r.bulletLastUsed=o,r.bulletCurrent=a,s(),d}function Eue(e){const n=e.options.listItemIndent||"one";if(n!=="tab"&&n!=="one"&&n!=="mixed")throw new Error("Cannot serialize items with `"+n+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return n}function Aue(e,n,r,i){const s=Eue(r);let a=r.bulletCurrent||kA(r);n&&n.type==="list"&&n.ordered&&(a=(typeof n.start=="number"&&n.start>-1?n.start:1)+(r.options.incrementListMarker===!1?0:n.children.indexOf(e))+a);let o=a.length+1;(s==="tab"||s==="mixed"&&(n&&n.type==="list"&&n.spread||e.spread))&&(o=Math.ceil(o/4)*4);const l=r.createTracker(i);l.move(a+" ".repeat(o-a.length)),l.shift(o);const u=r.enter("listItem"),d=r.indentLines(r.containerFlow(e,l.current()),p);return u(),d;function p(f,g,_){return g?(_?"":" ".repeat(o))+f:(_?a:a+" ".repeat(o-a.length))+f}}function Tue(e,n,r,i){const s=r.enter("paragraph"),a=r.enter("phrasing"),o=r.containerPhrasing(e,i);return a(),s(),o}const Mue=I0(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function Rue(e,n,r,i){return(e.children.some(function(o){return Mue(o)})?r.containerPhrasing:r.containerFlow).call(r,e,i)}function Oue(e){const n=e.options.strong||"*";if(n!=="*"&&n!=="_")throw new Error("Cannot serialize strong with `"+n+"` for `options.strong`, expected `*`, or `_`");return n}R$.peek=Due;function R$(e,n,r,i){const s=Oue(r),a=r.enter("strong"),o=r.createTracker(i),l=o.move(s+s);let u=o.move(r.containerPhrasing(e,{after:s,before:l,...o.current()}));const d=u.charCodeAt(0),p=fb(i.before.charCodeAt(i.before.length-1),d,s);p.inside&&(u=Pg(d)+u.slice(1));const f=u.charCodeAt(u.length-1),g=fb(i.after.charCodeAt(0),f,s);g.inside&&(u=u.slice(0,-1)+Pg(f));const _=o.move(s+s);return a(),r.attentionEncodeSurroundingInfo={after:g.outside,before:p.outside},l+u+_}function Due(e,n,r){return r.options.strong||"*"}function Pue(e,n,r,i){return r.safe(e.value,i)}function Lue(e){const n=e.options.ruleRepetition||3;if(n<3)throw new Error("Cannot serialize rules with repetition `"+n+"` for `options.ruleRepetition`, expected `3` or more");return n}function Iue(e,n,r){const i=(M$(r)+(r.options.ruleSpaces?" ":"")).repeat(Lue(r));return r.options.ruleSpaces?i.slice(0,-1):i}const O$={blockquote:aue,break:vD,code:hue,definition:pue,emphasis:w$,hardBreak:vD,heading:yue,html:S$,image:C$,imageReference:j$,inlineCode:N$,link:A$,linkReference:T$,list:Nue,listItem:Aue,paragraph:Tue,root:Rue,strong:R$,text:Pue,thematicBreak:Iue};function Bue(){return{enter:{table:zue,tableData:yD,tableHeader:yD,tableRow:Fue},exit:{codeText:Hue,table:$ue,tableData:gS,tableHeader:gS,tableRow:gS}}}function zue(e){const n=e._align;this.enter({type:"table",align:n.map(function(r){return r==="none"?null:r}),children:[]},e),this.data.inTable=!0}function $ue(e){this.exit(e),this.data.inTable=void 0}function Fue(e){this.enter({type:"tableRow",children:[]},e)}function gS(e){this.exit(e)}function yD(e){this.enter({type:"tableCell",children:[]},e)}function Hue(e){let n=this.resume();this.data.inTable&&(n=n.replace(/\\([\\|])/g,Wue));const r=this.stack[this.stack.length-1];r.type,r.value=n,this.exit(e)}function Wue(e,n){return n==="|"?n:e}function que(e){const n=e||{},r=n.tableCellPadding,i=n.tablePipeAlign,s=n.stringLength,a=r?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
`,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[	 :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:g,table:o,tableCell:u,tableRow:l}};function o(_,x,v,S){return d(p(_,v,S),_.align)}function l(_,x,v,S){const w=f(_,v,S),j=d([w]);return j.slice(0,j.indexOf(`
`))}function u(_,x,v,S){const w=v.enter("tableCell"),j=v.enter("phrasing"),C=v.containerPhrasing(_,{...S,before:a,after:a});return j(),w(),C}function d(_,x){return iue(_,{align:x,alignDelimiters:i,padding:r,stringLength:s})}function p(_,x,v){const S=_.children;let w=-1;const j=[],C=x.enter("table");for(;++w<S.length;)j[w]=f(S[w],x,v);return C(),j}function f(_,x,v){const S=_.children;let w=-1;const j=[],C=x.enter("tableRow");for(;++w<S.length;)j[w]=u(S[w],_,x,v);return C(),j}function g(_,x,v){let S=O$.inlineCode(_,x,v);return v.stack.includes("tableCell")&&(S=S.replace(/\|/g,"\\$&")),S}}function Uue(){return{exit:{taskListCheckValueChecked:_D,taskListCheckValueUnchecked:_D,paragraph:Vue}}}function Kue(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:Yue}}}function _D(e){const n=this.stack[this.stack.length-2];n.type,n.checked=e.type==="taskListCheckValueChecked"}function Vue(e){const n=this.stack[this.stack.length-2];if(n&&n.type==="listItem"&&typeof n.checked=="boolean"){const r=this.stack[this.stack.length-1];r.type;const i=r.children[0];if(i&&i.type==="text"){const s=n.children;let a=-1,o;for(;++a<s.length;){const l=s[a];if(l.type==="paragraph"){o=l;break}}o===r&&(i.value=i.value.slice(1),i.value.length===0?r.children.shift():r.position&&i.position&&typeof i.position.start.offset=="number"&&(i.position.start.column++,i.position.start.offset++,r.position.start=Object.assign({},i.position.start)))}}this.exit(e)}function Yue(e,n,r,i){const s=e.children[0],a=typeof e.checked=="boolean"&&s&&s.type==="paragraph",o="["+(e.checked?"x":" ")+"] ",l=r.createTracker(i);a&&l.move(o);let u=O$.listItem(e,n,r,{...i,...l.current()});return a&&(u=u.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,d)),u;function d(p){return p+o}}function Gue(){return[Nce(),Yce(),Zce(),Bue(),Uue()]}function Xue(e){return{extensions:[Ece(),Gce(e),Jce(),que(e),Kue()]}}const Que={tokenize:rde,partial:!0},D$={tokenize:ide,partial:!0},P$={tokenize:sde,partial:!0},L$={tokenize:ade,partial:!0},Zue={tokenize:ode,partial:!0},I$={name:"wwwAutolink",tokenize:tde,previous:z$},B$={name:"protocolAutolink",tokenize:nde,previous:$$},ac={name:"emailAutolink",tokenize:ede,previous:F$},il={};function Jue(){return{text:il}}let Gu=48;for(;Gu<123;)il[Gu]=ac,Gu++,Gu===58?Gu=65:Gu===91&&(Gu=97);il[43]=ac;il[45]=ac;il[46]=ac;il[95]=ac;il[72]=[ac,B$];il[104]=[ac,B$];il[87]=[ac,I$];il[119]=[ac,I$];function ede(e,n,r){const i=this;let s,a;return o;function o(f){return!Ej(f)||!F$.call(i,i.previous)||wA(i.events)?r(f):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),l(f))}function l(f){return Ej(f)?(e.consume(f),l):f===64?(e.consume(f),u):r(f)}function u(f){return f===46?e.check(Zue,p,d)(f):f===45||f===95||Ui(f)?(a=!0,e.consume(f),u):p(f)}function d(f){return e.consume(f),s=!0,u}function p(f){return a&&s&&ts(i.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),n(f)):r(f)}}function tde(e,n,r){const i=this;return s;function s(o){return o!==87&&o!==119||!z$.call(i,i.previous)||wA(i.events)?r(o):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(Que,e.attempt(D$,e.attempt(P$,a),r),r)(o))}function a(o){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),n(o)}}function nde(e,n,r){const i=this;let s="",a=!1;return o;function o(f){return(f===72||f===104)&&$$.call(i,i.previous)&&!wA(i.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),s+=String.fromCodePoint(f),e.consume(f),l):r(f)}function l(f){if(ts(f)&&s.length<5)return s+=String.fromCodePoint(f),e.consume(f),l;if(f===58){const g=s.toLowerCase();if(g==="http"||g==="https")return e.consume(f),u}return r(f)}function u(f){return f===47?(e.consume(f),a?d:(a=!0,u)):r(f)}function d(f){return f===null||ub(f)||er(f)||Od(f)||D0(f)?r(f):e.attempt(D$,e.attempt(P$,p),r)(f)}function p(f){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),n(f)}}function rde(e,n,r){let i=0;return s;function s(o){return(o===87||o===119)&&i<3?(i++,e.consume(o),s):o===46&&i===3?(e.consume(o),a):r(o)}function a(o){return o===null?r(o):n(o)}}function ide(e,n,r){let i,s,a;return o;function o(d){return d===46||d===95?e.check(L$,u,l)(d):d===null||er(d)||Od(d)||d!==45&&D0(d)?u(d):(a=!0,e.consume(d),o)}function l(d){return d===95?i=!0:(s=i,i=void 0),e.consume(d),o}function u(d){return s||i||!a?r(d):n(d)}}function sde(e,n){let r=0,i=0;return s;function s(o){return o===40?(r++,e.consume(o),s):o===41&&i<r?a(o):o===33||o===34||o===38||o===39||o===41||o===42||o===44||o===46||o===58||o===59||o===60||o===63||o===93||o===95||o===126?e.check(L$,n,a)(o):o===null||er(o)||Od(o)?n(o):(e.consume(o),s)}function a(o){return o===41&&i++,e.consume(o),s}}function ade(e,n,r){return i;function i(l){return l===33||l===34||l===39||l===41||l===42||l===44||l===46||l===58||l===59||l===63||l===95||l===126?(e.consume(l),i):l===38?(e.consume(l),a):l===93?(e.consume(l),s):l===60||l===null||er(l)||Od(l)?n(l):r(l)}function s(l){return l===null||l===40||l===91||er(l)||Od(l)?n(l):i(l)}function a(l){return ts(l)?o(l):r(l)}function o(l){return l===59?(e.consume(l),i):ts(l)?(e.consume(l),o):r(l)}}function ode(e,n,r){return i;function i(a){return e.consume(a),s}function s(a){return Ui(a)?r(a):n(a)}}function z$(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||er(e)}function $$(e){return!ts(e)}function F$(e){return!(e===47||Ej(e))}function Ej(e){return e===43||e===45||e===46||e===95||Ui(e)}function wA(e){let n=e.length,r=!1;for(;n--;){const i=e[n][1];if((i.type==="labelLink"||i.type==="labelImage")&&!i._balanced){r=!0;break}if(i._gfmAutolinkLiteralWalkedInto){r=!1;break}}return e.length>0&&!r&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),r}const lde={tokenize:gde,partial:!0};function cde(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:fde,continuation:{tokenize:pde},exit:mde}},text:{91:{name:"gfmFootnoteCall",tokenize:hde},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:ude,resolveTo:dde}}}}function ude(e,n,r){const i=this;let s=i.events.length;const a=i.parser.gfmFootnotes||(i.parser.gfmFootnotes=[]);let o;for(;s--;){const u=i.events[s][1];if(u.type==="labelImage"){o=u;break}if(u.type==="gfmFootnoteCall"||u.type==="labelLink"||u.type==="label"||u.type==="image"||u.type==="link")break}return l;function l(u){if(!o||!o._balanced)return r(u);const d=to(i.sliceSerialize({start:o.end,end:i.now()}));return d.codePointAt(0)!==94||!a.includes(d.slice(1))?r(u):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(u),e.exit("gfmFootnoteCallLabelMarker"),n(u))}}function dde(e,n){let r=e.length;for(;r--;)if(e[r][1].type==="labelImage"&&e[r][0]==="enter"){e[r][1];break}e[r+1][1].type="data",e[r+3][1].type="gfmFootnoteCallLabelMarker";const i={type:"gfmFootnoteCall",start:Object.assign({},e[r+3][1].start),end:Object.assign({},e[e.length-1][1].end)},s={type:"gfmFootnoteCallMarker",start:Object.assign({},e[r+3][1].end),end:Object.assign({},e[r+3][1].end)};s.end.column++,s.end.offset++,s.end._bufferIndex++;const a={type:"gfmFootnoteCallString",start:Object.assign({},s.end),end:Object.assign({},e[e.length-1][1].start)},o={type:"chunkString",contentType:"string",start:Object.assign({},a.start),end:Object.assign({},a.end)},l=[e[r+1],e[r+2],["enter",i,n],e[r+3],e[r+4],["enter",s,n],["exit",s,n],["enter",a,n],["enter",o,n],["exit",o,n],["exit",a,n],e[e.length-2],e[e.length-1],["exit",i,n]];return e.splice(r,e.length-r+1,...l),e}function hde(e,n,r){const i=this,s=i.parser.gfmFootnotes||(i.parser.gfmFootnotes=[]);let a=0,o;return l;function l(f){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(f),e.exit("gfmFootnoteCallLabelMarker"),u}function u(f){return f!==94?r(f):(e.enter("gfmFootnoteCallMarker"),e.consume(f),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",d)}function d(f){if(a>999||f===93&&!o||f===null||f===91||er(f))return r(f);if(f===93){e.exit("chunkString");const g=e.exit("gfmFootnoteCallString");return s.includes(to(i.sliceSerialize(g)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(f),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),n):r(f)}return er(f)||(o=!0),a++,e.consume(f),f===92?p:d}function p(f){return f===91||f===92||f===93?(e.consume(f),a++,d):d(f)}}function fde(e,n,r){const i=this,s=i.parser.gfmFootnotes||(i.parser.gfmFootnotes=[]);let a,o=0,l;return u;function u(x){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(x),e.exit("gfmFootnoteDefinitionLabelMarker"),d}function d(x){return x===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(x),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",p):r(x)}function p(x){if(o>999||x===93&&!l||x===null||x===91||er(x))return r(x);if(x===93){e.exit("chunkString");const v=e.exit("gfmFootnoteDefinitionLabelString");return a=to(i.sliceSerialize(v)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(x),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),g}return er(x)||(l=!0),o++,e.consume(x),x===92?f:p}function f(x){return x===91||x===92||x===93?(e.consume(x),o++,p):p(x)}function g(x){return x===58?(e.enter("definitionMarker"),e.consume(x),e.exit("definitionMarker"),s.includes(a)||s.push(a),wn(e,_,"gfmFootnoteDefinitionWhitespace")):r(x)}function _(x){return n(x)}}function pde(e,n,r){return e.check(Rv,n,e.attempt(lde,n,r))}function mde(e){e.exit("gfmFootnoteDefinition")}function gde(e,n,r){const i=this;return wn(e,s,"gfmFootnoteDefinitionIndent",5);function s(a){const o=i.events[i.events.length-1];return o&&o[1].type==="gfmFootnoteDefinitionIndent"&&o[2].sliceSerialize(o[1],!0).length===4?n(a):r(a)}}function vde(e){let r=(e||{}).singleTilde;const i={name:"strikethrough",tokenize:a,resolveAll:s};return r==null&&(r=!0),{text:{126:i},insideSpan:{null:[i]},attentionMarkers:{null:[126]}};function s(o,l){let u=-1;for(;++u<o.length;)if(o[u][0]==="enter"&&o[u][1].type==="strikethroughSequenceTemporary"&&o[u][1]._close){let d=u;for(;d--;)if(o[d][0]==="exit"&&o[d][1].type==="strikethroughSequenceTemporary"&&o[d][1]._open&&o[u][1].end.offset-o[u][1].start.offset===o[d][1].end.offset-o[d][1].start.offset){o[u][1].type="strikethroughSequence",o[d][1].type="strikethroughSequence";const p={type:"strikethrough",start:Object.assign({},o[d][1].start),end:Object.assign({},o[u][1].end)},f={type:"strikethroughText",start:Object.assign({},o[d][1].end),end:Object.assign({},o[u][1].start)},g=[["enter",p,l],["enter",o[d][1],l],["exit",o[d][1],l],["enter",f,l]],_=l.parser.constructs.insideSpan.null;_&&ra(g,g.length,0,P0(_,o.slice(d+1,u),l)),ra(g,g.length,0,[["exit",f,l],["enter",o[u][1],l],["exit",o[u][1],l],["exit",p,l]]),ra(o,d-1,u-d+3,g),u=d+g.length-2;break}}for(u=-1;++u<o.length;)o[u][1].type==="strikethroughSequenceTemporary"&&(o[u][1].type="data");return o}function a(o,l,u){const d=this.previous,p=this.events;let f=0;return g;function g(x){return d===126&&p[p.length-1][1].type!=="characterEscape"?u(x):(o.enter("strikethroughSequenceTemporary"),_(x))}function _(x){const v=Lf(d);if(x===126)return f>1?u(x):(o.consume(x),f++,_);if(f<2&&!r)return u(x);const S=o.exit("strikethroughSequenceTemporary"),w=Lf(x);return S._open=!w||w===2&&!!v,S._close=!v||v===2&&!!w,l(x)}}}class yde{constructor(){this.map=[]}add(n,r,i){_de(this,n,r,i)}consume(n){if(this.map.sort(function(a,o){return a[0]-o[0]}),this.map.length===0)return;let r=this.map.length;const i=[];for(;r>0;)r-=1,i.push(n.slice(this.map[r][0]+this.map[r][1]),this.map[r][2]),n.length=this.map[r][0];i.push(n.slice()),n.length=0;let s=i.pop();for(;s;){for(const a of s)n.push(a);s=i.pop()}this.map.length=0}}function _de(e,n,r,i){let s=0;if(!(r===0&&i.length===0)){for(;s<e.map.length;){if(e.map[s][0]===n){e.map[s][1]+=r,e.map[s][2].push(...i);return}s+=1}e.map.push([n,r,i])}}function xde(e,n){let r=!1;const i=[];for(;n<e.length;){const s=e[n];if(r){if(s[0]==="enter")s[1].type==="tableContent"&&i.push(e[n+1][1].type==="tableDelimiterMarker"?"left":"none");else if(s[1].type==="tableContent"){if(e[n-1][1].type==="tableDelimiterMarker"){const a=i.length-1;i[a]=i[a]==="left"?"center":"right"}}else if(s[1].type==="tableDelimiterRow")break}else s[0]==="enter"&&s[1].type==="tableDelimiterRow"&&(r=!0);n+=1}return i}function bde(){return{flow:{null:{name:"table",tokenize:kde,resolveAll:wde}}}}function kde(e,n,r){const i=this;let s=0,a=0,o;return l;function l($){let z=i.events.length-1;for(;z>-1;){const D=i.events[z][1].type;if(D==="lineEnding"||D==="linePrefix")z--;else break}const B=z>-1?i.events[z][1].type:null,H=B==="tableHead"||B==="tableRow"?A:u;return H===A&&i.parser.lazy[i.now().line]?r($):H($)}function u($){return e.enter("tableHead"),e.enter("tableRow"),d($)}function d($){return $===124||(o=!0,a+=1),p($)}function p($){return $===null?r($):It($)?a>1?(a=0,i.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume($),e.exit("lineEnding"),_):r($):hn($)?wn(e,p,"whitespace")($):(a+=1,o&&(o=!1,s+=1),$===124?(e.enter("tableCellDivider"),e.consume($),e.exit("tableCellDivider"),o=!0,p):(e.enter("data"),f($)))}function f($){return $===null||$===124||er($)?(e.exit("data"),p($)):(e.consume($),$===92?g:f)}function g($){return $===92||$===124?(e.consume($),f):f($)}function _($){return i.interrupt=!1,i.parser.lazy[i.now().line]?r($):(e.enter("tableDelimiterRow"),o=!1,hn($)?wn(e,x,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)($):x($))}function x($){return $===45||$===58?S($):$===124?(o=!0,e.enter("tableCellDivider"),e.consume($),e.exit("tableCellDivider"),v):E($)}function v($){return hn($)?wn(e,S,"whitespace")($):S($)}function S($){return $===58?(a+=1,o=!0,e.enter("tableDelimiterMarker"),e.consume($),e.exit("tableDelimiterMarker"),w):$===45?(a+=1,w($)):$===null||It($)?T($):E($)}function w($){return $===45?(e.enter("tableDelimiterFiller"),j($)):E($)}function j($){return $===45?(e.consume($),j):$===58?(o=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume($),e.exit("tableDelimiterMarker"),C):(e.exit("tableDelimiterFiller"),C($))}function C($){return hn($)?wn(e,T,"whitespace")($):T($)}function T($){return $===124?x($):$===null||It($)?!o||s!==a?E($):(e.exit("tableDelimiterRow"),e.exit("tableHead"),n($)):E($)}function E($){return r($)}function A($){return e.enter("tableRow"),O($)}function O($){return $===124?(e.enter("tableCellDivider"),e.consume($),e.exit("tableCellDivider"),O):$===null||It($)?(e.exit("tableRow"),n($)):hn($)?wn(e,O,"whitespace")($):(e.enter("data"),F($))}function F($){return $===null||$===124||er($)?(e.exit("data"),O($)):(e.consume($),$===92?L:F)}function L($){return $===92||$===124?(e.consume($),F):F($)}}function wde(e,n){let r=-1,i=!0,s=0,a=[0,0,0,0],o=[0,0,0,0],l=!1,u=0,d,p,f;const g=new yde;for(;++r<e.length;){const _=e[r],x=_[1];_[0]==="enter"?x.type==="tableHead"?(l=!1,u!==0&&(xD(g,n,u,d,p),p=void 0,u=0),d={type:"table",start:Object.assign({},x.start),end:Object.assign({},x.end)},g.add(r,0,[["enter",d,n]])):x.type==="tableRow"||x.type==="tableDelimiterRow"?(i=!0,f=void 0,a=[0,0,0,0],o=[0,r+1,0,0],l&&(l=!1,p={type:"tableBody",start:Object.assign({},x.start),end:Object.assign({},x.end)},g.add(r,0,[["enter",p,n]])),s=x.type==="tableDelimiterRow"?2:p?3:1):s&&(x.type==="data"||x.type==="tableDelimiterMarker"||x.type==="tableDelimiterFiller")?(i=!1,o[2]===0&&(a[1]!==0&&(o[0]=o[1],f=g_(g,n,a,s,void 0,f),a=[0,0,0,0]),o[2]=r)):x.type==="tableCellDivider"&&(i?i=!1:(a[1]!==0&&(o[0]=o[1],f=g_(g,n,a,s,void 0,f)),a=o,o=[a[1],r,0,0])):x.type==="tableHead"?(l=!0,u=r):x.type==="tableRow"||x.type==="tableDelimiterRow"?(u=r,a[1]!==0?(o[0]=o[1],f=g_(g,n,a,s,r,f)):o[1]!==0&&(f=g_(g,n,o,s,r,f)),s=0):s&&(x.type==="data"||x.type==="tableDelimiterMarker"||x.type==="tableDelimiterFiller")&&(o[3]=r)}for(u!==0&&xD(g,n,u,d,p),g.consume(n.events),r=-1;++r<n.events.length;){const _=n.events[r];_[0]==="enter"&&_[1].type==="table"&&(_[1]._align=xde(n.events,r))}return e}function g_(e,n,r,i,s,a){const o=i===1?"tableHeader":i===2?"tableDelimiter":"tableData",l="tableContent";r[0]!==0&&(a.end=Object.assign({},Yh(n.events,r[0])),e.add(r[0],0,[["exit",a,n]]));const u=Yh(n.events,r[1]);if(a={type:o,start:Object.assign({},u),end:Object.assign({},u)},e.add(r[1],0,[["enter",a,n]]),r[2]!==0){const d=Yh(n.events,r[2]),p=Yh(n.events,r[3]),f={type:l,start:Object.assign({},d),end:Object.assign({},p)};if(e.add(r[2],0,[["enter",f,n]]),i!==2){const g=n.events[r[2]],_=n.events[r[3]];if(g[1].end=Object.assign({},_[1].end),g[1].type="chunkText",g[1].contentType="text",r[3]>r[2]+1){const x=r[2]+1,v=r[3]-r[2]-1;e.add(x,v,[])}}e.add(r[3]+1,0,[["exit",f,n]])}return s!==void 0&&(a.end=Object.assign({},Yh(n.events,s)),e.add(s,0,[["exit",a,n]]),a=void 0),a}function xD(e,n,r,i,s){const a=[],o=Yh(n.events,r);s&&(s.end=Object.assign({},o),a.push(["exit",s,n])),i.end=Object.assign({},o),a.push(["exit",i,n]),e.add(r+1,0,a)}function Yh(e,n){const r=e[n],i=r[0]==="enter"?"start":"end";return r[1][i]}const Sde={name:"tasklistCheck",tokenize:jde};function Cde(){return{text:{91:Sde}}}function jde(e,n,r){const i=this;return s;function s(u){return i.previous!==null||!i._gfmTasklistFirstContentOfListItem?r(u):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(u),e.exit("taskListCheckMarker"),a)}function a(u){return er(u)?(e.enter("taskListCheckValueUnchecked"),e.consume(u),e.exit("taskListCheckValueUnchecked"),o):u===88||u===120?(e.enter("taskListCheckValueChecked"),e.consume(u),e.exit("taskListCheckValueChecked"),o):r(u)}function o(u){return u===93?(e.enter("taskListCheckMarker"),e.consume(u),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),l):r(u)}function l(u){return It(u)?n(u):hn(u)?e.check({tokenize:Nde},n,r)(u):r(u)}}function Nde(e,n,r){return wn(e,i,"whitespace");function i(s){return s===null?r(s):n(s)}}function Ede(e){return Z9([Jue(),cde(),vde(e),bde(),Cde()])}const Ade={};function SA(e){const n=this,r=e||Ade,i=n.data(),s=i.micromarkExtensions||(i.micromarkExtensions=[]),a=i.fromMarkdownExtensions||(i.fromMarkdownExtensions=[]),o=i.toMarkdownExtensions||(i.toMarkdownExtensions=[]);s.push(Ede(r)),a.push(Gue()),o.push(Xue(r))}function H$(e){return typeof e=="string"||typeof e=="number"?String(e):Array.isArray(e)?e.map(H$).join(""):""}function Tde({code:e,language:n}){const[r,i]=b.useState(!1),{t:s}=an(),a=b.useCallback(async()=>{await ro(e)&&(i(!0),setTimeout(()=>i(!1),1200))},[e]);return c.jsxs("div",{className:"group/code relative my-2 overflow-hidden rounded-md border",style:{borderColor:"var(--revka-border-soft)",background:"var(--revka-bg-base)"},children:[c.jsxs("div",{className:"flex items-center justify-between border-b px-2 py-1",style:{borderColor:"var(--revka-border-soft)",color:"var(--revka-text-faint)"},children:[c.jsx("span",{className:"font-mono text-[10px] uppercase",children:n||s("agent.code_language_fallback")}),c.jsxs("button",{type:"button",onClick:a,"aria-label":s(r?"agent.copied_code":"agent.copy_code"),title:s(r?"agent.copied":"agent.copy_code"),className:"inline-flex h-5 items-center gap-1 rounded px-1.5 font-mono text-[10px] transition-colors hover:bg-white/5 focus:outline-none focus-visible:ring-1 focus-visible:ring-current",style:{color:r?"var(--revka-status-success)":"var(--revka-text-muted)"},children:[r?c.jsx(no,{className:"h-3 w-3"}):c.jsx(rc,{className:"h-3 w-3"}),s(r?"agent.copied":"agent.copy")]})]}),c.jsx("pre",{className:"m-0 max-h-[28rem] overflow-auto p-3 font-mono text-[0.86em] leading-6",style:{color:"var(--revka-text-secondary)",textShadow:"none"},children:c.jsx("code",{children:e})})]})}function Mde({content:e,color:n,textShadow:r}){return c.jsx("div",{className:"chat-markdown min-w-0 break-words leading-relaxed",style:{color:n,textShadow:r},children:c.jsx(xA,{remarkPlugins:[SA],components:{pre({children:i}){return c.jsx(c.Fragment,{children:i})},code({children:i,className:s,node:a,...o}){var p;const l=H$(i).replace(/\n$/,""),u=(p=/language-([\w-]+)/.exec(s??""))==null?void 0:p[1];return!!u||l.includes(`
`)?c.jsx(Tde,{code:l,language:u}):c.jsx("code",{...o,className:s,style:{background:"color-mix(in srgb, var(--revka-bg-surface) 75%, transparent)",color:"var(--revka-text-secondary)",textShadow:"none"},children:i})}},children:e})})}const bD=b.memo(Mde);function W$({anchorRef:e,matches:n,selectedIndex:r,onPick:i}){const s=b.useRef(null),[a,o]=b.useState(null);return b.useLayoutEffect(()=>{const l=()=>{var d;const u=(d=e.current)==null?void 0:d.getBoundingClientRect();u&&o({bottom:window.innerHeight-u.top+6,left:u.left,width:u.width})};return l(),window.addEventListener("resize",l),window.addEventListener("scroll",l,!0),()=>{window.removeEventListener("resize",l),window.removeEventListener("scroll",l,!0)}},[e]),b.useEffect(()=>{var u;const l=(u=s.current)==null?void 0:u.querySelector(`[data-slash-index="${r}"]`);l==null||l.scrollIntoView({block:"nearest"})},[r]),n.length===0||!a?null:oa.createPortal(c.jsx("div",{ref:s,className:"fixed z-[200] overflow-y-auto rounded-[8px] border py-1 shadow-lg",style:{bottom:a.bottom,left:a.left,width:a.width,maxHeight:"40vh",background:"var(--revka-bg-panel-strong)",borderColor:"var(--revka-border-strong)"},role:"listbox","aria-label":"Slash commands",children:n.map((l,u)=>{const d=u===r;return c.jsxs("button",{type:"button","data-slash-index":u,role:"option","aria-selected":d,onMouseDown:p=>{p.preventDefault(),i(u)},className:"flex w-full items-center justify-between gap-3 px-3 py-1.5 text-left text-xs transition-colors",style:{background:d?"color-mix(in srgb, var(--revka-signal-live) 12%, transparent)":"transparent",color:d?"var(--revka-text-primary)":"var(--revka-text-secondary)"},children:[c.jsxs("span",{className:"flex min-w-0 items-baseline gap-2",children:[c.jsxs("span",{className:"font-mono font-semibold",style:{color:d?"var(--revka-signal-live)":"var(--revka-text-primary)"},children:["/",l.name]}),l.args?c.jsx("span",{className:"font-mono text-[10px]",style:{color:"var(--revka-text-faint)"},children:l.args}):null,l.aliases&&l.aliases.length>0?c.jsxs("span",{className:"font-mono text-[10px]",style:{color:"var(--revka-text-faint)"},children:["· ",l.aliases.map(p=>`/${p}`).join(" ")]}):null]}),c.jsx("span",{className:"truncate text-[11px]",style:{color:"var(--revka-text-muted)"},children:l.description})]},l.name)})}),document.body)}function q$(e){return e.trim().toLowerCase().replace(/^\//,"")}const CA=[{name:"help",aliases:["?"],description:"List available slash commands",example:"/help",handler:e=>{const n=[];n.push("Available commands:"),n.push("");for(const r of CA){const i=r.args?`/${r.name} ${r.args}`:`/${r.name}`,s=r.aliases&&r.aliases.length>0?`  (aka ${r.aliases.map(a=>`/${a}`).join(", ")})`:"";n.push(`  ${i.padEnd(28)} — ${r.description}${s}`)}n.push(""),n.push("Tip: type / to open the menu and arrow keys to navigate."),e.appendSystemMessage(n.join(`
`))}},{name:"clear",aliases:["cls"],description:"Clear chat scrollback (session stays connected)",example:"/clear",handler:e=>{e.clearMessages()}},{name:"new",description:"Open the new-tab menu",example:"/new",handler:e=>{e.openNewTabMenu()}},{name:"chat",description:"Open a new chat tab",example:"/chat",handler:e=>{e.addTab("chat")}},{name:"terminal",aliases:["term"],description:"Open a new terminal tab",example:"/terminal",handler:e=>{e.addTab("terminal")}},{name:"code",description:"Open a new code tab",example:"/code",handler:e=>{e.addTab("code")}},{name:"attach",aliases:["file"],description:"Pick a file to attach (opens OS file picker)",example:"/attach",handler:e=>{e.openFilePicker()}},{name:"theme",description:"Switch UI theme",args:"<dark|light|oled|system>",example:"/theme dark",handler:(e,n)=>{const r=n.trim().toLowerCase();r==="dark"||r==="light"||r==="system"||r==="oled"?e.setTheme(r):e.appendSystemMessage(`Unknown theme: "${n.trim()}". Expected dark, light, oled, or system.`)}},{name:"lang",aliases:["language"],description:"Switch UI language",args:"<en|zh|tr|ko>",example:"/lang ko",handler:(e,n)=>{const r=n.trim().toLowerCase();if(!r){e.appendSystemMessage("Usage: /lang <en|zh|tr|ko>");return}e.setLang(r)}},{name:"close",description:"Close the active tab",example:"/close",handler:e=>{e.closeActiveTab()}},{name:"architect",description:"Architect — describe a workflow change",args:"<description of the change>",example:"/architect add a python step that prints hello",scopes:["workflow_editor"],handler:(e,n)=>{const r=n.trim();if(!r){e.appendSystemMessage("Usage: /architect <describe the change you want>");return}if(!e.submitMessage){e.appendSystemMessage("The /architect command only works inside the workflow editor (open a workflow and press ⌘J).");return}e.submitMessage(`Please apply this change: ${r}`)||e.appendSystemMessage("Could not send — chat is not connected yet.")}}];function U$(e,n="global"){const r=q$(e),i=a=>!a.scopes||a.scopes.includes(n),s=CA.filter(i);return r===""?s:s.filter(a=>{var o;return!!(a.name.startsWith(r)||(o=a.aliases)!=null&&o.some(l=>l.startsWith(r)))})}function K$(e){const n=e.trimStart();if(!n.startsWith("/")||n.includes(`
`))return null;const r=n.slice(1),i=r.indexOf(" ");return i<0?{name:r,args:""}:{name:r.slice(0,i),args:r.slice(i+1)}}function V$(e){const n=q$(e);return CA.find(r=>{var i;return r.name===n||((i=r.aliases)==null?void 0:i.includes(n))})??null}function Rde(e){return e.replace(/^\//,"")}const Y$="operator-main",G$="revka_assistant_tabs_v1",X$="revka_assistant_archived_session_ids_v1",Q$=12;function vS(){return[{id:"chat-main",type:"chat",title:"Chat",sessionId:Y$},{id:"terminal-main",type:"terminal",title:"Terminal",sessionId:ur()}]}function kD(){return{id:"chat-main",type:"chat",title:"Chat",sessionId:ur()}}function Ode(){var e,n;try{const r=localStorage.getItem(G$);if(!r)return{tabs:vS(),activeTabId:"chat-main"};const i=JSON.parse(r),s=Array.isArray(i.tabs)?i.tabs.filter(f=>!!f&&typeof f.id=="string"&&typeof f.title=="string"&&typeof f.sessionId=="string"&&(f.type==="chat"||f.type==="terminal"||f.type==="code")):[],a=s.some(f=>f.id===i.activeTabId)?i.activeTabId:(e=s[0])==null?void 0:e.id,o=s.filter(f=>f.type==="chat"),l=s.filter(f=>f.type!=="chat"),u=a?o.find(f=>f.id===a):void 0,p=[...[...u?[u]:[],...o.filter(f=>f.id!==(u==null?void 0:u.id))].slice(0,Q$),...l];return p.length===0?{tabs:vS(),activeTabId:"chat-main"}:{tabs:p,activeTabId:p.some(f=>f.id===a)?a:(n=p[0])==null?void 0:n.id}}catch{return{tabs:vS(),activeTabId:"chat-main"}}}function Z$(){try{const e=localStorage.getItem(X$);if(!e)return new Set;const n=JSON.parse(e);return Array.isArray(n)?new Set(n.filter(r=>typeof r=="string"&&r.length>0)):new Set}catch{return new Set}}function Dde(e){try{localStorage.setItem(X$,JSON.stringify([...e]))}catch{}}function Pde(e){const n=Z$();n.add(e),Dde(n)}function Lde(e,n){try{const r=e.map(i=>({id:i.id,type:i.type,title:i.title,sessionId:i.sessionId,codeSession:i.type==="code"?null:void 0,pageContextOverride:i.pageContextOverride}));localStorage.setItem(G$,JSON.stringify({tabs:r,activeTabId:n}))}catch{}}function Ide({config:e,updateConfig:n}){return c.jsx("div",{className:"border-b px-4 py-3",style:{borderColor:"var(--revka-border-soft)",background:"color-mix(in srgb, var(--revka-bg-surface) 95%, transparent)"},children:c.jsxs("div",{className:"grid grid-cols-2 gap-x-6 gap-y-3 text-xs",children:[c.jsxs("div",{children:[c.jsx("label",{className:"mb-1 block font-semibold uppercase tracking-[0.1em]",style:{color:"var(--revka-text-faint)",fontSize:"10px"},children:"Color Scheme"}),c.jsx("div",{className:"flex gap-1.5",children:kte.map(r=>c.jsx("button",{type:"button",onClick:()=>n({colorScheme:r}),className:"rounded px-2 py-1 text-[10px] font-semibold uppercase tracking-wider transition-colors",style:{background:e.colorScheme===r?rg[r].colors.primary:"transparent",color:e.colorScheme===r?"#0c0c0c":"var(--revka-text-secondary)",border:`1px solid ${e.colorScheme===r?rg[r].colors.primary:"var(--revka-border-soft)"}`},children:rg[r].label},r))})]}),c.jsxs("div",{children:[c.jsxs("label",{className:"mb-1 block font-semibold uppercase tracking-[0.1em]",style:{color:"var(--revka-text-faint)",fontSize:"10px"},children:["Font Size — ",e.fontSize,"px"]}),c.jsx("input",{type:"range",min:10,max:20,step:1,value:e.fontSize,onChange:r=>n({fontSize:Number(r.target.value)}),className:"w-full accent-current",style:{color:"var(--revka-signal-live)"}})]}),c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("label",{className:"font-semibold uppercase tracking-[0.1em]",style:{color:"var(--revka-text-faint)",fontSize:"10px"},children:"Cursor Blink"}),c.jsx("button",{type:"button",onClick:()=>n({cursorBlink:!e.cursorBlink}),className:"relative h-5 w-9 rounded-full transition-colors",style:{background:e.cursorBlink?"var(--revka-signal-live)":"var(--revka-border-strong)"},children:c.jsx("span",{className:"absolute top-0.5 block h-4 w-4 rounded-full bg-white shadow transition-transform",style:{transform:e.cursorBlink?"translateX(18px)":"translateX(2px)"}})})]}),c.jsxs("div",{children:[c.jsxs("label",{className:"mb-1 block font-semibold uppercase tracking-[0.1em]",style:{color:"var(--revka-text-faint)",fontSize:"10px"},children:["Panel Height — ",e.panelHeightPercent,"%"]}),c.jsx("input",{type:"range",min:25,max:90,step:5,value:e.panelHeightPercent,onChange:r=>n({panelHeightPercent:Number(r.target.value)}),className:"w-full accent-current",style:{color:"var(--revka-signal-live)"}})]}),c.jsxs("div",{children:[c.jsxs("label",{className:"mb-1 block font-semibold uppercase tracking-[0.1em]",style:{color:"var(--revka-text-faint)",fontSize:"10px"},children:["Panel Opacity — ",Math.round(e.panelOpacity*100),"%"]}),c.jsx("input",{type:"range",min:.5,max:1,step:.05,value:e.panelOpacity,onChange:r=>n({panelOpacity:Number(r.target.value)}),className:"w-full accent-current",style:{color:"var(--revka-signal-live)"}})]})]})})}function Bde(e,n){return e==="user"?n.user:e==="operator"?n.secondary:n.primary}function zde(e,n){return e==="agent"?n.glow:e==="operator"?n.glowSecondary:"none"}const $de=b.memo(function({messages:n,typing:r,activities:i,streamingContent:s,streamingThinking:a,copiedId:o,colors:l,fontSize:u,placeholder:d,copyMessage:p}){return n.length===0&&!r?c.jsxs("div",{className:"flex h-full flex-col items-center justify-center text-center",children:[c.jsx("pre",{className:"text-xs",style:{color:"var(--revka-text-faint)"},children:`┌──────────────────────────────┐
│  session ready · ask away    │
└──────────────────────────────┘`}),c.jsx("p",{className:"mt-3 max-w-xs text-xs leading-5",style:{color:"var(--revka-text-muted)"},children:d})]}):c.jsxs("div",{className:"space-y-3",children:[n.map(f=>{const g=f.role==="user"?"you":f.role==="operator"?"sys":"op",_=Bde(f.role,l),x=zde(f.role,l),v=o===f.id,S=f.role==="user"?"var(--revka-text-secondary)":_;return c.jsxs("div",{className:"group",children:[f.activityLog&&f.activityLog.length>0&&c.jsx("div",{className:"mb-1 space-y-0.5",children:f.activityLog.map(w=>c.jsx(cb,{event:w,accent:w.kind==="tool_result"?"var(--revka-status-success)":l.secondary,fontSize:u},w.id))}),c.jsxs("div",{className:"flex min-w-0 items-start gap-1 break-words",children:[c.jsxs("span",{className:"shrink-0",style:{color:_,textShadow:x,fontWeight:600},children:[g," ",">"," "]}),c.jsx("div",{className:"min-w-0 flex-1",style:{color:S,textShadow:x},children:f.markdown&&f.role!=="user"?c.jsx(bD,{content:f.content,color:S,textShadow:x}):c.jsx("span",{className:"whitespace-pre-wrap break-words",children:f.content})})]}),c.jsxs("div",{className:"mt-0.5 flex items-center justify-end gap-2 text-[10px]",style:{color:"var(--revka-text-faint)"},children:[f.deliveryStatus==="queued"&&c.jsx("span",{className:"mr-auto inline-flex items-center rounded border px-1.5 py-0.5 uppercase tracking-[0.12em]",style:{borderColor:"var(--revka-border-soft)",color:"var(--revka-text-faint)"},children:"queued"}),f.deliveryStatus==="sending"&&c.jsxs("span",{className:"mr-auto inline-flex items-center gap-1 rounded border px-1.5 py-0.5 uppercase tracking-[0.12em]",style:{borderColor:"var(--revka-border-soft)",color:l.primary,textShadow:l.glow},children:[c.jsx(Rr,{className:"h-2.5 w-2.5 animate-spin"}),"sending"]}),c.jsxs("button",{type:"button",onClick:()=>p(f.id,f.content),"aria-label":v?"Copied":"Copy message",title:v?"Copied":"Copy",className:"inline-flex items-center gap-1 rounded px-1.5 py-0.5 opacity-50 transition-all hover:bg-white/5 hover:opacity-100 focus:opacity-100 focus:outline-none focus-visible:ring-1 focus-visible:ring-current group-hover:opacity-80",style:{color:"var(--revka-text-muted)"},children:[v?c.jsx(no,{className:"h-3 w-3"}):c.jsx(rc,{className:"h-3 w-3"}),c.jsx("span",{children:v?"copied":"copy"})]})]})]},f.id)}),r&&i.length>0&&c.jsx("div",{className:"space-y-0.5",children:i.map(f=>c.jsx(cb,{event:f,accent:f.kind==="tool_result"?"var(--revka-status-success)":f.kind==="thinking"?"var(--revka-text-faint)":l.secondary,fontSize:u},f.id))}),r&&(s||a)&&c.jsxs("div",{className:"flex min-w-0 items-start gap-1 break-words",children:[c.jsxs("span",{className:"shrink-0",style:{color:l.primary,textShadow:l.glow,fontWeight:600},children:["op ",">"," "]}),c.jsx("div",{className:"min-w-0 flex-1",children:s?c.jsx(bD,{content:s,color:l.primary,textShadow:l.glow}):c.jsx("span",{style:{color:l.primary,textShadow:l.glow},children:"…"})})]}),r&&!s&&!a&&i.length===0&&c.jsxs("div",{className:"animate-pulse",style:{color:l.primary,textShadow:l.glow},children:["op ",">"," ▊"]})]})});function wD({tabId:e,sessionId:n,sessionName:r,pageContext:i,placeholder:s,config:a,colors:o,visible:l,onAddTab:u,onCloseActiveTab:d,onOpenNewTabMenu:p,onLiveStateChange:f}){const{open:g}=YE(),{setTheme:_}=Pa(),{setLocale:x,t:v}=an(),{activities:S,addAttachment:w,appendSystemMessage:j,attachments:C,clearMessages:T,connected:E,error:A,handleSend:O,handleTextareaChange:F,input:L,inputRef:$,messages:z,removeAttachment:B,setInput:H,streamingContent:D,streamingThinking:U,queuedTurns:I,steerCurrentTurn:X,stopCurrentTurn:K,stopping:Q,typing:V,uploadingCount:R}=Pz({sessionId:n,sessionName:r,draftKey:`revka-assistant:${n}`,pageContext:i}),q=b.useRef(null),W=b.useRef(null),te=b.useRef(null),[J,G]=b.useState(null),[re,ne]=b.useState(!1),[le,oe]=b.useState(0),[ie,he]=b.useState(!1),[Z,de]=b.useState("queue"),[ue,pe]=b.useState(!0),Oe=b.useRef(!0),fe=b.useCallback(async We=>{const ut=Array.from(We);await Promise.all(ut.map(Ct=>w(Ct)))},[w]),Le=b.useCallback(()=>{var We;(We=W.current)==null||We.click()},[]),Ee=b.useMemo(()=>{if(ie)return[];const We=L.trimStart();return We.startsWith("/")?We.includes(" ")||We.includes(`
`)?[]:U$(We):[]},[L,ie]);b.useEffect(()=>{le>=Ee.length&&oe(Ee.length===0?0:Ee.length-1)},[Ee.length,le]),b.useEffect(()=>{ie&&!L.startsWith("/")&&he(!1)},[L,ie]);const Bt=b.useMemo(()=>({clearMessages:T,appendSystemMessage:j,openFilePicker:()=>{var We;return(We=W.current)==null?void 0:We.click()},addTab:u,openNewTabMenu:p,closeActiveTab:d,setLang:We=>{x(We)},setTheme:We=>{_(We)}}),[T,j,u,p,d,x,_]),Xe=b.useCallback(()=>{const We=K$(L);if(!We)return!1;const ut=V$(We.name);if(!ut)return!1;H(""),oe(0),he(!1),$.current&&($.current.style.height="auto");try{ut.handler(Bt,We.args)}catch(Ct){const Mt=Ct instanceof Error?Ct.message:String(Ct);j(`Command "/${ut.name}" failed: ${Mt}`)}return!0},[L,Bt,H,$,j]),St=b.useCallback(We=>{var Ct;const ut=Ee[We];if(ut)if(ut.args)H(`/${ut.name} `),oe(0),(Ct=$.current)==null||Ct.focus();else{H(""),oe(0),$.current&&($.current.style.height="auto");try{ut.handler(Bt,"")}catch(Mt){const Ge=Mt instanceof Error?Mt.message:String(Mt);j(`Command "/${ut.name}" failed: ${Ge}`)}}},[Ee,Bt,H,$,j]),yt=b.useCallback(We=>{var Mt;const Ct=Array.from(((Mt=We.clipboardData)==null?void 0:Mt.items)??[]).filter(Ge=>Ge.kind==="file").map(Ge=>Ge.getAsFile()).filter(Ge=>Ge!==null);Ct.length>0&&(We.preventDefault(),fe(Ct))},[fe]),Rt=b.useCallback(We=>{var ut,Ct;We.preventDefault(),(Ct=(ut=We.dataTransfer)==null?void 0:ut.types)!=null&&Ct.includes("Files")&&ne(!0)},[]),be=b.useCallback(We=>{We.currentTarget===We.target&&ne(!1)},[]),He=b.useCallback(We=>{var Ct;We.preventDefault(),ne(!1);const ut=(Ct=We.dataTransfer)==null?void 0:Ct.files;ut&&ut.length>0&&fe(ut)},[fe]),ht=b.useCallback(async(We,ut)=>{await ro(ut)&&(G(We),setTimeout(()=>G(Ct=>Ct===We?null:Ct),1200))},[]),ot=b.useCallback((We="auto")=>{var ut;(ut=q.current)==null||ut.scrollTo({top:q.current.scrollHeight,behavior:We})},[]),$t=b.useCallback(()=>{const We=q.current;if(!We)return;const ut=We.scrollHeight-We.scrollTop-We.clientHeight<72;Oe.current=ut,pe(ut)},[]);b.useLayoutEffect(()=>{if(!l||!Oe.current)return;const We=requestAnimationFrame(()=>{ot("auto")});return()=>cancelAnimationFrame(We)},[S,z.length,ot,D,U,V,l]),b.useEffect(()=>{if(!g||!l)return;Oe.current=!0,pe(!0);const We=requestAnimationFrame(()=>ot("auto"));return()=>cancelAnimationFrame(We)},[g,ot,l]),b.useEffect(()=>{if(!g||!l)return;const We=setTimeout(()=>{var ut;return(ut=$.current)==null?void 0:ut.focus()},320);return()=>clearTimeout(We)},[g,l,$]);const jn=b.useCallback(()=>{V&&Z==="steer"&&C.length===0&&X()||O()},[C.length,O,Z,X,V]),Pn=V||I.length>0||Q;return b.useEffect(()=>(f==null||f(e,Pn),()=>f==null?void 0:f(e,!1)),[Pn,f,e]),c.jsxs("div",{className:"min-h-0 flex-1 flex-col",style:{display:l?"flex":"none"},children:[V&&c.jsx("div",{className:"h-[2px] overflow-hidden",style:{background:"var(--revka-bg-surface)"},children:c.jsx("div",{className:"h-full",style:{background:o.primary,width:"40%",animation:"revka-assistant-sweep 1.4s ease-in-out infinite alternate"}})}),A&&c.jsx("div",{className:"border-b px-4 py-2 text-xs",style:{borderColor:"rgba(255,107,122,0.2)",background:"rgba(255,107,122,0.06)",color:"var(--revka-status-danger)"},children:c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx(bv,{className:"h-3 w-3 shrink-0"}),c.jsx("span",{children:A})]})}),c.jsxs("div",{className:"relative min-h-0 flex-1",children:[c.jsx("div",{ref:q,onScroll:$t,className:"h-full overflow-y-auto overflow-x-hidden p-4 font-mono leading-6",style:{fontSize:`${a.fontSize}px`},children:c.jsx($de,{messages:z,typing:V,activities:S,streamingContent:D,streamingThinking:U,copiedId:J,colors:o,fontSize:a.fontSize,placeholder:s,copyMessage:ht})}),!ue&&c.jsx("button",{type:"button",onClick:()=>{Oe.current=!0,pe(!0),ot("smooth")},className:"absolute bottom-3 right-4 z-10 rounded border px-2 py-1 font-mono text-[10px] uppercase shadow-lg transition-colors hover:bg-white/5 focus:outline-none focus-visible:ring-1 focus-visible:ring-current",style:{borderColor:"var(--revka-border-soft)",background:"var(--revka-bg-surface)",color:o.primary,textShadow:o.glow},children:v("agent.jump_to_latest")})]}),c.jsxs("div",{ref:te,className:"relative border-t px-4 py-3",style:{borderColor:"var(--revka-border-soft)"},onDragEnter:Rt,onDragOver:We=>{var ut,Ct;We.preventDefault(),(Ct=(ut=We.dataTransfer)==null?void 0:ut.types)!=null&&Ct.includes("Files")&&ne(!0)},onDragLeave:be,onDrop:He,children:[c.jsx("input",{ref:W,type:"file",multiple:!0,className:"hidden",onChange:We=>{const ut=We.target.files;ut&&ut.length>0&&fe(ut),We.target.value=""}}),(C.length>0||R>0)&&c.jsxs("div",{className:"mb-2 flex flex-wrap gap-1.5",children:[C.map(We=>c.jsx(ose,{attachment:We,onRemove:B,accent:o.secondary},We.file_id)),R>0&&c.jsxs("span",{className:"inline-flex items-center gap-1.5 rounded-md border px-2 py-1 text-[10px]",style:{borderColor:"var(--revka-border-soft)",background:"var(--revka-bg-surface)",color:"var(--revka-text-faint)"},children:[c.jsx(Rr,{className:"h-3 w-3 animate-spin"}),"uploading ",R,"…"]})]}),c.jsxs("div",{className:"flex items-end gap-2 rounded-md border px-2 py-1.5 transition-colors",style:{borderColor:re?o.primary:"var(--revka-border-soft)",background:re?"color-mix(in srgb, var(--revka-bg-surface) 85%, transparent)":"transparent",color:o.primary},children:[c.jsx("button",{type:"button",onClick:Le,disabled:!E,"aria-label":"Attach files",title:"Attach files",className:"inline-flex h-7 w-7 shrink-0 items-center justify-center rounded transition-all hover:bg-white/5 focus:outline-none focus-visible:ring-2 focus-visible:ring-current disabled:cursor-not-allowed disabled:opacity-30",style:{color:"var(--revka-text-muted)"},children:c.jsx(Ree,{className:"h-3.5 w-3.5"})}),c.jsxs("span",{className:"shrink-0 pb-[3px] font-mono text-sm font-semibold",style:{color:o.primary,textShadow:o.glow},children:[">",c.jsx("span",{className:a.cursorBlink?"revka-cursor-blink":"",children:"_"})]}),c.jsx("textarea",{ref:$,rows:1,value:L,onChange:F,onKeyDown:We=>{if(Ee.length>0){if(We.key==="ArrowDown"){We.preventDefault(),oe(Ct=>(Ct+1)%Ee.length);return}if(We.key==="ArrowUp"){We.preventDefault(),oe(Ct=>(Ct-1+Ee.length)%Ee.length);return}if(We.key==="Tab"){We.preventDefault(),St(le);return}if(We.key==="Escape"){We.preventDefault(),he(!0);return}if(We.key==="Enter"&&!We.shiftKey){We.preventDefault(),St(le);return}}if(We.key==="Enter"&&!We.shiftKey){if(We.preventDefault(),Xe())return;jn()}},onPaste:yt,placeholder:v(E?V?Z==="steer"?"agent.placeholder_steer_next_step":"agent.placeholder_queue_next":"agent.placeholder_message":"agent.placeholder_connecting"),disabled:!E,className:"min-h-[1.75rem] min-w-0 flex-1 resize-none bg-transparent font-mono outline-none focus:outline-none focus-visible:outline-none disabled:opacity-50",style:{color:"var(--revka-text-primary)",caretColor:o.cursorColor,maxHeight:"6rem",fontSize:`${Math.max(16,a.fontSize)}px`}}),V&&c.jsxs("div",{className:"flex h-7 shrink-0 items-center overflow-hidden rounded border",style:{borderColor:"var(--revka-border-soft)"},"aria-label":v("agent.send_mode"),children:[c.jsxs("button",{type:"button",onClick:()=>de("queue"),title:v("agent.queue_after_current_response"),className:"inline-flex h-full items-center gap-1 px-1.5 font-mono text-[10px] uppercase transition-colors hover:bg-white/5 focus:outline-none focus-visible:ring-1 focus-visible:ring-current",style:{background:Z==="queue"?"color-mix(in srgb, var(--revka-bg-surface) 88%, transparent)":"transparent",color:Z==="queue"?o.secondary:"var(--revka-text-faint)",textShadow:Z==="queue"?o.glowSecondary:"none"},children:[c.jsx(Aee,{className:"h-3 w-3"}),v("agent.send_mode_queue")]}),c.jsxs("button",{type:"button",onClick:()=>de("steer"),title:C.length>0?v("agent.steer_text_only"):v("agent.steer_next_step"),disabled:C.length>0||R>0,className:"inline-flex h-full items-center gap-1 border-l px-1.5 font-mono text-[10px] uppercase transition-colors hover:bg-white/5 focus:outline-none focus-visible:ring-1 focus-visible:ring-current disabled:cursor-not-allowed disabled:opacity-35",style:{borderColor:"var(--revka-border-soft)",background:Z==="steer"?"color-mix(in srgb, var(--revka-bg-surface) 88%, transparent)":"transparent",color:Z==="steer"?o.primary:"var(--revka-text-faint)",textShadow:Z==="steer"?o.glow:"none"},children:[c.jsx(Td,{className:"h-3 w-3"}),v("agent.send_mode_steer")]})]}),V&&c.jsx("button",{type:"button",onClick:K,disabled:!E||Q,"aria-label":Q?"Stopping Operator":"Stop Operator",title:Q?"Stopping…":"Stop current response",className:"inline-flex h-7 w-7 shrink-0 items-center justify-center rounded transition-all hover:bg-white/5 focus:outline-none focus-visible:ring-2 focus-visible:ring-current disabled:cursor-not-allowed disabled:opacity-30",style:{color:Q?"var(--revka-text-faint)":"var(--revka-status-danger)"},children:Q?c.jsx(Rr,{className:"h-3.5 w-3.5 animate-spin"}):c.jsx(Hee,{className:"h-3.5 w-3.5"})}),c.jsx("button",{type:"button",onClick:jn,disabled:!E||!L.trim()&&C.length===0||R>0,"aria-label":V&&Z==="steer"&&C.length===0?v("agent.steer_next_step"):v(V?"agent.queue_message":"agent.send_message"),title:E?V?Z==="steer"&&C.length===0?v("agent.steer_next_step"):v("agent.queue_after_current_response"):v("agent.send_enter"):v("agent.disconnected"),className:"inline-flex h-7 w-7 shrink-0 items-center justify-center rounded transition-all hover:bg-white/5 focus:outline-none focus-visible:ring-2 focus-visible:ring-current disabled:cursor-not-allowed disabled:opacity-30",style:{color:(L.trim()||C.length>0)&&E&&R===0&&!V?o.primary:(L.trim()||C.length>0)&&E&&R===0&&V?o.secondary:"var(--revka-text-faint)",textShadow:(L.trim()||C.length>0)&&E&&R===0&&!V?o.glow:(L.trim()||C.length>0)&&E&&R===0&&V?o.glowSecondary:"none"},children:c.jsx(VE,{className:"h-3.5 w-3.5"})})]}),re&&c.jsx("div",{className:"pointer-events-none absolute inset-2 flex items-center justify-center rounded-md border-2 border-dashed text-xs",style:{borderColor:o.primary,background:"color-mix(in srgb, var(--revka-bg-base) 70%, transparent)",color:o.primary,textShadow:o.glow},children:"drop files to attach"}),c.jsxs("div",{className:"mt-2 flex items-center gap-3",children:[c.jsxs("span",{className:"flex shrink-0 items-center gap-1.5 text-[10px] font-semibold uppercase tracking-[0.12em]",style:{color:"var(--revka-text-faint)"},children:[c.jsx("span",{className:"inline-block h-1.5 w-1.5 rounded-full",style:{background:E?"var(--revka-status-success)":"var(--revka-status-danger)"}}),E?"live":"offline"]}),V&&c.jsxs("span",{className:"flex shrink-0 items-center gap-1.5 text-[10px] font-semibold uppercase tracking-[0.12em]",style:{color:o.primary,textShadow:o.glow},children:[c.jsx(Rr,{className:"h-3 w-3 animate-spin"}),"Operator is responding…"]}),I.length>0&&c.jsxs("span",{className:"flex shrink-0 items-center gap-1.5 text-[10px] font-semibold uppercase tracking-[0.12em]",style:{color:o.secondary,textShadow:o.glowSecondary},children:[I.length," queued"]}),c.jsx("span",{className:"min-w-0 flex-1 truncate text-[10px]",style:{color:"var(--revka-text-faint)"},title:i,children:i})]}),c.jsx(W$,{anchorRef:te,matches:Ee,selectedIndex:le,onPick:St})]})]})}function Fde({anchorRef:e,onSelect:n,onClose:r}){const i=b.useRef(null),[s,a]=b.useState(null);return b.useLayoutEffect(()=>{const o=()=>{var u;const l=(u=e.current)==null?void 0:u.getBoundingClientRect();l&&a({top:l.bottom+4,left:l.left})};return o(),window.addEventListener("resize",o),window.addEventListener("scroll",o,!0),()=>{window.removeEventListener("resize",o),window.removeEventListener("scroll",o,!0)}},[e]),b.useEffect(()=>{const o=l=>{const u=l.target;i.current&&i.current.contains(u)||e.current&&e.current.contains(u)||r()};return document.addEventListener("mousedown",o),()=>document.removeEventListener("mousedown",o)},[e,r]),s?oa.createPortal(c.jsxs("div",{ref:i,className:"fixed z-[200] rounded-[8px] border py-1 shadow-lg",style:{top:s.top,left:s.left,background:"var(--revka-bg-panel-strong)",borderColor:"var(--revka-border-strong)",minWidth:"10rem"},children:[c.jsxs("button",{type:"button",className:"flex w-full items-center gap-2 px-3 py-1.5 text-left text-xs transition-colors hover:bg-white/5",style:{color:"var(--revka-text-secondary)"},onClick:()=>{n("chat"),r()},children:[c.jsx(Ag,{className:"h-3.5 w-3.5"}),"New Chat"]}),c.jsxs("button",{type:"button",className:"flex w-full items-center gap-2 px-3 py-1.5 text-left text-xs transition-colors hover:bg-white/5",style:{color:"var(--revka-text-secondary)"},onClick:()=>{n("terminal"),r()},children:[c.jsx(jv,{className:"h-3.5 w-3.5"}),"New Terminal"]}),c.jsxs("button",{type:"button",className:"flex w-full items-center gap-2 px-3 py-1.5 text-left text-xs transition-colors hover:bg-white/5",style:{color:"var(--revka-text-secondary)"},onClick:()=>{n("code"),r()},children:[c.jsx(pz,{className:"h-3.5 w-3.5"}),"New Code"]})]}),document.body):null}function Hde(){var he;const e=aa(),{open:n,closeAssistant:r,pageContextOverride:i,placeholderOverride:s}=YE(),{config:a,colors:o,updateConfig:l}=Ste(),u=Bz[e.pathname],d=i??`v2:${Rde(e.pathname)||"dashboard"}`,p=s??`Ask about ${((he=u==null?void 0:u.title)==null?void 0:he.toLowerCase())??"this workspace"}.`,f=b.useRef(null);f.current===null&&(f.current=Ode());const[g,_]=b.useState(()=>f.current.tabs),[x,v]=b.useState(()=>f.current.activeTabId??"chat-main"),[S,w]=b.useState(!1),j=b.useRef(null),[C,T]=b.useState(!1),[E,A]=b.useState(n),[O,F]=b.useState(null),[L,$]=b.useState("vertical"),[z,B]=b.useState(()=>new Set),[H,D]=b.useState(null),[U,I]=b.useState("");b.useEffect(()=>{Lde(g,x)},[g,x]),b.useEffect(()=>{var Z;g.length>0&&g.some(de=>de.id===x)||v(((Z=g[0])==null?void 0:Z.id)??"chat-main")},[g,x]),b.useEffect(()=>{let Z=!1;return(async()=>{try{const{sessions:de,archivedSessionIds:ue}=await tz();if(Z)return;const pe=new Set([...ue,...Z$()]),Oe=de.filter(Le=>Le.channel==="dashboard"||Le.channel==="gateway").filter(Le=>!pe.has(Le.id)).filter(Le=>Le.message_count>0).sort((Le,Ee)=>new Date(Ee.last_activity).getTime()-new Date(Le.last_activity).getTime()).slice(0,Q$),fe=new Set(Oe.map(Le=>Le.id));_(Le=>{const Ee=Le.filter(yt=>yt.type!=="chat"||!pe.has(yt.sessionId)&&(yt.id===x||yt.sessionId===Y$||fe.has(yt.sessionId))),Bt=new Set(Ee.filter(yt=>yt.type==="chat").map(yt=>yt.sessionId)),Xe=Oe.filter(yt=>!Bt.has(yt.id)).map((yt,Rt)=>({id:`chat-${yt.id}`,type:"chat",title:yt.name||(Rt===0?"Chat":`Chat ${Rt+1}`),sessionId:yt.id})),St=Xe.length>0?[...Ee,...Xe]:Ee;return St.length>0?St:[kD()]})}catch{}})(),()=>{Z=!0}},[]),b.useEffect(()=>{if(!n)return;const Z=de=>{de.key==="Escape"&&r()};return window.addEventListener("keydown",Z),()=>window.removeEventListener("keydown",Z)},[n,r]),b.useEffect(()=>{n&&A(!0)},[n]);const X=b.useCallback(Z=>{const de=ur();_(ue=>{const pe=ue.filter(Le=>Le.type===Z).length;let Oe;Z==="chat"?Oe=`Chat ${pe+1}`:Z==="terminal"?Oe=`Terminal ${pe+1}`:Oe="Code";const fe={id:de,type:Z,title:Oe,sessionId:ur(),codeSession:Z==="code"?null:void 0};return[...ue,fe]}),v(de)},[]),K=b.useCallback((Z,de)=>{_(ue=>ue.map(pe=>pe.id===Z?{...pe,...de}:pe))},[]),Q=b.useCallback(async Z=>{const de=U.trim();if(D(null),!de||de===Z.title){I("");return}const ue=Z.title;if(K(Z.id,{title:de}),I(""),Z.type==="chat"&&Z.sessionId)try{await zZ(Z.sessionId,de)}catch(pe){K(Z.id,{title:ue}),console.error("Rename failed:",pe)}},[U,K]),V=b.useCallback(()=>{D(null),I("")},[]),R=b.useCallback(Z=>(de,ue,pe)=>{K(Z,{codeSession:de,title:`${Og(de.toolKey)} · ${L9(pe)}`})},[K]),q=b.useCallback(Z=>()=>{K(Z,{codeSession:null,title:"Code"})},[K]),W=b.useCallback(Z=>(de,ue)=>{K(Z,{type:"chat",title:ue,sessionId:ur(),codeSession:void 0,pageContextOverride:de})},[K]),te=b.useCallback(Z=>{const de=g.find(ue=>ue.id===Z);(de==null?void 0:de.type)==="chat"&&(Pde(de.sessionId),BZ(de.sessionId).catch(()=>{})),_(ue=>{const pe=ue.filter(Oe=>Oe.id!==Z);return pe.length===0?[kD()]:pe}),v(ue=>{if(ue!==Z)return ue;const pe=g.findIndex(fe=>fe.id===Z),Oe=g.filter(fe=>fe.id!==Z);return Oe.length===0?"chat-main":Oe[Math.min(pe,Oe.length-1)].id}),F(ue=>ue===Z?null:ue),B(ue=>{if(!ue.has(Z))return ue;const pe=new Set(ue);return pe.delete(Z),pe})},[g]),J=b.useCallback(()=>{if(O){$(de=>de==="vertical"?"horizontal":"vertical");return}const Z=ur();_(de=>{const ue=de.filter(Oe=>Oe.type==="chat").length,pe={id:Z,type:"chat",title:`Chat ${ue+1}`,sessionId:ur()};return[...de,pe]}),F(Z)},[O]),G=b.useCallback(()=>{F(null)},[]),re=b.useCallback((Z,de)=>{B(ue=>{if(ue.has(Z)===de)return ue;const pe=new Set(ue);return de?pe.add(Z):pe.delete(Z),pe})},[]),ne=g.find(Z=>Z.id===x)??null,le=O?g.find(Z=>Z.id===O)??null:null,oe=(ne==null?void 0:ne.type)==="chat"&&(le==null?void 0:le.type)==="chat"&&ne.id!==le.id,ie=`${a.panelHeightPercent}vh`;return c.jsxs(c.Fragment,{children:[n&&c.jsx("div",{className:"absolute inset-0 z-[50]",style:{background:"rgba(0,0,0,0.25)"},onClick:r}),c.jsxs("div",{className:"absolute inset-x-0 top-0 z-[60] flex min-w-0 flex-col overflow-hidden border-b border-l border-r",style:{height:n?ie:"0px",maxHeight:n?"90vh":"0px",opacity:n?a.panelOpacity:0,transform:n?"translateY(0)":"translateY(-0.75rem)",transition:"height 300ms ease-out, max-height 300ms ease-out, opacity 200ms ease-out, transform 300ms ease-out",borderColor:n?"var(--revka-border-strong)":"transparent",background:"var(--revka-bg-base)",boxShadow:n?"var(--revka-shadow-overlay)":"none",pointerEvents:n?"auto":"none",borderRadius:"0 0 14px 14px"},children:[c.jsx("div",{className:"pointer-events-none absolute inset-0 z-[5]",style:{background:"repeating-linear-gradient(0deg, transparent, transparent 2px, rgba(125,255,155,0.012) 2px, rgba(125,255,155,0.012) 4px)",mixBlendMode:"overlay"}}),c.jsxs("div",{className:"relative z-20 flex items-center border-b",style:{borderColor:"var(--revka-border-soft)",background:"var(--revka-bg-surface)"},children:[c.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-0.5 overflow-x-auto px-2 py-1 [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",children:[g.map(Z=>{const de=x===Z.id,ue=H===Z.id;return c.jsxs("button",{type:"button",className:"group flex shrink-0 items-center gap-1.5 px-2.5 py-1.5 font-mono text-[11px] transition-colors",onClick:()=>v(Z.id),onDoubleClick:pe=>{Z.type==="chat"&&(pe.stopPropagation(),D(Z.id),I(Z.title))},title:Z.type==="chat"?"Double-click to rename":void 0,style:{background:de?o.primary+"18":"transparent",color:de?o.primary:"var(--revka-text-muted)",textShadow:de?o.glow:"none",borderBottom:de?`2px solid ${o.primary}`:"2px solid transparent"},children:[Z.type==="terminal"?c.jsx(jv,{className:"h-3 w-3"}):Z.type==="code"?c.jsx(pz,{className:"h-3 w-3"}):c.jsx(Ag,{className:"h-3 w-3"}),ue?c.jsx("input",{value:U,onChange:pe=>I(pe.target.value),onClick:pe=>pe.stopPropagation(),onBlur:()=>Q(Z),onKeyDown:pe=>{pe.key==="Enter"?(pe.preventDefault(),Q(Z)):pe.key==="Escape"&&(pe.preventDefault(),V())},autoFocus:!0,maxLength:64,style:{background:"transparent",border:"none",outline:"none",color:"inherit",font:"inherit",width:"min(180px, 100%)",padding:0}}):c.jsx(c.Fragment,{children:Z.title}),g.length>1&&c.jsx("span",{className:"ml-0.5 p-0.5 opacity-0 transition-opacity hover:bg-white/10 group-hover:opacity-100",onClick:pe=>{pe.stopPropagation(),te(Z.id)},role:"button",tabIndex:-1,children:c.jsx(vi,{className:"h-2.5 w-2.5"})})]},Z.id)}),c.jsxs("div",{className:"shrink-0",children:[c.jsxs("button",{ref:j,type:"button",className:"flex items-center gap-0.5 p-1.5 transition-colors hover:bg-white/5",onClick:()=>w(Z=>!Z),style:{color:"var(--revka-text-faint)"},title:"New tab",children:[c.jsx(ls,{className:"h-3 w-3"}),c.jsx(Yo,{className:"h-2.5 w-2.5"})]}),S&&c.jsx(Fde,{anchorRef:j,onSelect:X,onClose:()=>w(!1)})]})]}),c.jsxs("div",{className:"flex shrink-0 items-center px-1",children:[(ne==null?void 0:ne.type)==="chat"&&c.jsxs(c.Fragment,{children:[c.jsx("button",{type:"button",className:"p-1.5 transition-colors hover:bg-white/5",onClick:J,style:{color:oe?o.primary:"var(--revka-text-faint)"},title:oe?`Switch split: ${L==="vertical"?"side-by-side":"stacked"} → ${L==="vertical"?"stacked":"side-by-side"}`:"Split chat (new chat tab side-by-side)",children:oe?L==="vertical"?c.jsx(gee,{className:"h-3.5 w-3.5"}):c.jsx(Bee,{className:"h-3.5 w-3.5"}):c.jsx(Fee,{className:"h-3.5 w-3.5"})}),oe&&c.jsx("button",{type:"button",className:"p-1.5 transition-colors hover:bg-white/5",onClick:G,style:{color:"var(--revka-text-faint)"},title:"Close split",children:c.jsx(vi,{className:"h-3.5 w-3.5"})})]}),c.jsx("button",{type:"button",className:"p-1.5 transition-colors hover:bg-white/5",onClick:()=>T(Z=>!Z),style:{color:C?o.primary:"var(--revka-text-faint)"},title:"Settings",children:c.jsx(S0,{className:"h-3.5 w-3.5"})}),c.jsx("button",{type:"button",className:"p-1.5 transition-colors hover:bg-white/5",onClick:r,style:{color:"var(--revka-text-faint)"},title:"Dismiss (Esc)",children:c.jsx(lee,{className:"h-3.5 w-3.5"})})]})]}),C&&c.jsx(Ide,{config:a,updateConfig:l}),E&&c.jsxs("div",{className:"relative z-10 flex min-h-0 flex-1 flex-col",children:[g.filter(Z=>Z.type==="terminal").map(Z=>c.jsx(qie,{sessionId:Z.sessionId,config:a,colors:o,visible:x===Z.id},Z.id)),g.filter(Z=>Z.type==="code").map(Z=>c.jsx(rse,{tabId:Z.id,config:a,colors:o,visible:x===Z.id,session:Z.codeSession??null,onSessionStart:R(Z.id),onSessionEnd:q(Z.id),onDelegateToChat:W(Z.id)},Z.id)),oe?c.jsx("div",{className:"flex min-h-0 flex-1",style:{flexDirection:L==="vertical"?"row":"column"},children:g.filter(Z=>Z.type==="chat").map(Z=>{const de=Z.id===x||Z.id===O;return n&&de||z.has(Z.id)?c.jsx("div",{className:"flex min-h-0 min-w-0",style:{flex:de?"1 1 50%":"0 0 0",borderLeft:de&&L==="vertical"&&Z.id===O?"1px solid var(--revka-border-soft)":void 0,borderTop:de&&L==="horizontal"&&Z.id===O?"1px solid var(--revka-border-soft)":void 0},children:c.jsx(wD,{tabId:Z.id,sessionId:Z.sessionId,sessionName:Z.title,pageContext:Z.pageContextOverride??d,placeholder:p,config:a,colors:o,visible:n&&de,onAddTab:X,onCloseActiveTab:()=>te(Z.id),onOpenNewTabMenu:()=>w(!0),onLiveStateChange:re})},Z.id):null})}):g.filter(Z=>Z.type==="chat").map(Z=>{const de=x===Z.id;return n&&de||z.has(Z.id)?c.jsx(wD,{tabId:Z.id,sessionId:Z.sessionId,sessionName:Z.title,pageContext:Z.pageContextOverride??d,placeholder:p,config:a,colors:o,visible:n&&de,onAddTab:X,onCloseActiveTab:()=>te(Z.id),onOpenNewTabMenu:()=>w(!0),onLiveStateChange:re},Z.id):null})]})]}),c.jsx("style",{children:`
        @keyframes revka-assistant-sweep {
          from { transform: translateX(-10%); }
          to   { transform: translateX(160%); }
        }
        @keyframes revka-cursor-blink-anim {
          0%, 49% { opacity: 1; }
          50%, 100% { opacity: 0; }
        }
        .revka-cursor-blink {
          animation: revka-cursor-blink-anim 1s step-end infinite;
        }
      `})]})}const Aj="2026.6.13",Wde=1e3,qde=3e4;class Dv{constructor(n={}){$n(this,"controller",null);$n(this,"reconnectTimer",null);$n(this,"currentDelay");$n(this,"intentionallyClosed",!1);$n(this,"onEvent",null);$n(this,"onError",null);$n(this,"onConnect",null);$n(this,"path");$n(this,"reconnectDelay");$n(this,"maxReconnectDelay");$n(this,"autoReconnect");this.path=n.path??`${Oi}${Xr}/api/events`,this.reconnectDelay=n.reconnectDelay??Wde,this.maxReconnectDelay=n.maxReconnectDelay??qde,this.autoReconnect=n.autoReconnect??!0,this.currentDelay=this.reconnectDelay}connect(){this.intentionallyClosed=!1,this.clearReconnectTimer(),this.controller=new AbortController;const n=os(),r={Accept:"text/event-stream"};n&&(r.Authorization=`Bearer ${n}`),fetch(this.path,{headers:r,signal:this.controller.signal}).then(i=>{var s;if(!i.ok)throw new Error(`SSE connection failed: ${i.status}`);if(!i.body)throw new Error("SSE response has no body");return this.currentDelay=this.reconnectDelay,(s=this.onConnect)==null||s.call(this),this.consumeStream(i.body)}).catch(i=>{var s;i instanceof DOMException&&i.name==="AbortError"||((s=this.onError)==null||s.call(this,i instanceof Error?i:new Error(String(i))),this.scheduleReconnect())})}reconnectNow(){this.clearReconnectTimer(),this.controller&&(this.controller.abort(),this.controller=null),this.currentDelay=this.reconnectDelay,this.connect()}disconnect(){this.intentionallyClosed=!0,this.clearReconnectTimer(),this.controller&&(this.controller.abort(),this.controller=null)}async consumeStream(n){var a;const r=n.getReader(),i=new TextDecoder;let s="";try{for(;;){const{done:o,value:l}=await r.read();if(o)break;s+=i.decode(l,{stream:!0});const u=s.split(`

`);s=u.pop()??"";for(const d of u)this.parseEvent(d)}}catch(o){if(o instanceof DOMException&&o.name==="AbortError")return;(a=this.onError)==null||a.call(this,o instanceof Error?o:new Error(String(o)))}finally{r.releaseLock()}this.scheduleReconnect()}parseEvent(n){var o;let r="message";const i=[];for(const l of n.split(`
`))l.startsWith("event:")?r=l.slice(6).trim():l.startsWith("data:")&&i.push(l.slice(5).trim());if(i.length===0)return;const s=i.join(`
`);let a;try{a=JSON.parse(s),a.type=a.type??r}catch{a={type:r,data:s}}(o=this.onEvent)==null||o.call(this,a)}scheduleReconnect(){this.intentionallyClosed||!this.autoReconnect||(this.reconnectTimer=setTimeout(()=>{this.currentDelay=Math.min(this.currentDelay*2,this.maxReconnectDelay),this.connect()},this.currentDelay))}clearReconnectTimer(){this.reconnectTimer!==null&&(clearTimeout(this.reconnectTimer),this.reconnectTimer=null)}}const J$="revka-pending-approvals-v1",e7=b.createContext({pending:[],toasts:[],dismissToast:()=>{},dismiss:()=>{}}),jA=()=>b.useContext(e7);function Ude(){try{const e=sessionStorage.getItem(J$);if(e){const n=JSON.parse(e);if(Array.isArray(n))return n}}catch{}return[]}function Kde(e){try{sessionStorage.setItem(J$,JSON.stringify(e))}catch{}}function Vde({children:e}){const[n,r]=b.useState(Ude),[i,s]=b.useState([]),a=b.useRef(0);b.useEffect(()=>{Kde(n)},[n]);const o=b.useCallback(d=>{s(p=>p.filter(f=>f.toastId!==d))},[]),l=b.useCallback(d=>{d&&(r(p=>p.filter(f=>f.runId!==d)),s(p=>p.filter(f=>f.runId!==d)))},[]);b.useEffect(()=>{const d=new Dv;return d.onEvent=p=>{if(p.type==="human_approval_request"){const f={runId:String(p.run_id??""),stepId:String(p.step_id??""),workflowName:String(p.workflow_name??""),title:String(p.title??"Human approval needed"),message:String(p.message??""),timestamp:String(p.timestamp??new Date().toISOString())};if(!f.runId)return;r(_=>_.some(x=>x.runId===f.runId&&x.stepId===f.stepId)?_:[..._,f]);const g=++a.current;s(_=>[..._,{...f,toastId:g}]),setTimeout(()=>{s(_=>_.filter(x=>x.toastId!==g))},8e3);return}if(p.type==="human_approval_resolved"){const f=String(p.run_id??"");if(!f)return;r(g=>g.filter(_=>_.runId!==f));return}},d.connect(),()=>d.disconnect()},[]);const u=b.useMemo(()=>({pending:n,toasts:i,dismissToast:o,dismiss:l}),[n,i,o,l]);return c.jsx(e7.Provider,{value:u,children:e})}function SD(){const{pending:e}=jA(),[n,r]=b.useState(!1),i=b.useRef(null);return b.useEffect(()=>{if(!n)return;const s=a=>{i.current&&!i.current.contains(a.target)&&r(!1)};return document.addEventListener("mousedown",s),()=>document.removeEventListener("mousedown",s)},[n]),e.length===0?null:c.jsxs("div",{className:"relative",ref:i,children:[c.jsxs("button",{type:"button",className:"revka-button relative px-2 py-1 text-xs",style:{background:"var(--revka-signal-live-soft)",color:"var(--revka-signal-live)",borderColor:"var(--revka-signal-live)"},onClick:()=>r(s=>!s),"aria-label":`${e.length} pending approval${e.length===1?"":"s"}`,title:`${e.length} pending approval${e.length===1?"":"s"}`,children:[c.jsx(C0,{className:"h-4 w-4"}),c.jsx("span",{className:"ml-1 font-semibold tabular-nums",children:e.length})]}),n?c.jsxs("div",{className:"revka-panel absolute right-0 z-40 mt-2 w-80 p-2 shadow-lg",style:{background:"var(--revka-surface-raised, var(--revka-surface))"},children:[c.jsx("div",{className:"revka-kicker mb-1 px-1 text-[10px]",children:"Pending approvals"}),c.jsx("ul",{className:"max-h-80 space-y-1 overflow-auto",children:e.map(s=>c.jsx("li",{children:c.jsxs(Ss,{to:`/runs?run=${encodeURIComponent(s.runId)}`,className:"flex flex-col rounded px-2 py-1.5 text-xs hover:bg-[var(--revka-surface-hover,rgba(255,255,255,0.04))]",onClick:()=>r(!1),children:[c.jsx("span",{className:"font-medium truncate",children:s.workflowName||s.title||"Workflow"}),c.jsx("span",{className:"truncate",style:{color:"var(--revka-text-secondary)"},children:s.message||`Step ${s.stepId}`})]})},`${s.runId}:${s.stepId}`))})]}):null]})}function Yde(){const{locale:e,setLocale:n}=an();return c.jsxs("label",{className:"revka-status-pill relative cursor-pointer",title:"Language",children:[c.jsx(jee,{className:"h-3.5 w-3.5"}),c.jsx("select",{"aria-label":"Language",value:e,onChange:r=>n(r.target.value),className:"bg-transparent text-xs font-medium focus:outline-none",style:{color:"inherit"},children:Oz.map(r=>c.jsx("option",{value:r.code,style:{color:"#111"},children:r.label},r.code))})]})}function Gde({onOpenMobileNav:e}){const n=aa(),{theme:r,resolvedTheme:i,setTheme:s,activeSkinName:a}=Pa(),{open:o,toggleAssistant:l}=YE(),{t:u}=an(),d=Bz[n.pathname],p=d?u(d.titleKey):"Revka",[f,g]=b.useState(null);return b.useEffect(()=>{let _=!1;const x=()=>{Qx().then(S=>{_||g(S)}).catch(S=>{_||g({verified:!1,error:S instanceof Error?S.message:String(S)})})};x();const v=window.setInterval(x,6e4);return()=>{_=!0,window.clearInterval(v)}},[]),c.jsx("header",{className:"px-4 py-3 lg:px-6 lg:py-4",children:c.jsxs("div",{className:"revka-panel revka-header-panel p-3 lg:p-4",children:[c.jsxs("div",{className:"flex items-center gap-2 lg:hidden",children:[c.jsxs("div",{className:"min-w-0 flex-1",children:[c.jsxs("div",{className:"revka-kicker text-[10px]",children:["Revka v",Aj]}),c.jsx("h1",{className:"revka-title mt-0.5 truncate text-lg",children:p})]}),a?c.jsxs("span",{className:"revka-status-pill max-w-[8rem] truncate px-2 py-1 text-[10px]",title:a,children:[c.jsx(MC,{className:"h-3.5 w-3.5 shrink-0"}),c.jsx("span",{className:"truncate",children:a})]}):null,c.jsx(SD,{}),c.jsx("button",{type:"button",className:"revka-button px-2 py-1 text-xs",onClick:()=>s(r==="dark"?"light":r==="light"?"system":"dark"),"aria-label":`Theme: ${r}. Tap to cycle.`,title:`Theme: ${r==="system"?`system (${i})`:r}`,children:r==="dark"?c.jsx(wO,{className:"h-4 w-4"}):r==="light"?c.jsx(SO,{className:"h-4 w-4"}):c.jsx(kO,{className:"h-4 w-4"})}),c.jsx("button",{type:"button",className:"revka-button px-2 py-1 text-xs",onClick:l,"aria-label":"Toggle operator",style:o?{background:"var(--revka-signal-selected-soft, color-mix(in srgb, var(--revka-signal-selected) 18%, transparent))",color:"var(--revka-signal-selected)",borderColor:"var(--revka-signal-selected)"}:void 0,children:c.jsx(Ag,{className:"h-4 w-4"})}),e?c.jsx("button",{type:"button",className:"revka-sidebar-collapse-btn",onClick:e,"aria-label":"Open navigation",title:"Open navigation",children:c.jsx(Mee,{className:"h-4 w-4"})}):null]}),c.jsxs("div",{className:"hidden flex-col gap-4 lg:flex lg:flex-row lg:items-center lg:justify-between",children:[c.jsxs("div",{className:"min-w-0 flex-1",children:[c.jsxs("div",{className:"revka-kicker text-[10px]",children:["Revka v",Aj]}),c.jsx("h1",{className:"revka-title mt-1 truncate text-2xl",children:p})]}),c.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[c.jsx(SD,{}),a?c.jsxs("span",{className:"revka-status-pill max-w-[14rem]",title:a,children:[c.jsx(MC,{className:"h-3.5 w-3.5 shrink-0"}),c.jsx("span",{className:"truncate",children:a})]}):null,c.jsxs("span",{className:"revka-status-pill",title:f===null?u("header.trust_checking"):f.verified?`${u("header.runtime_healthy")} · ${u("header.trust_verified")}`:f.error??u("header.trust_unverified"),style:f!=null&&f.verified?{color:"var(--revka-status-success)",borderColor:"color-mix(in srgb, var(--revka-status-success) 26%, transparent)",background:"color-mix(in srgb, var(--revka-status-success) 6%, transparent)"}:f&&!f.verified?{color:"var(--revka-status-warning)",borderColor:"color-mix(in srgb, var(--revka-status-warning) 40%, transparent)",background:"color-mix(in srgb, var(--revka-status-warning) 10%, transparent)"}:void 0,children:[c.jsx("span",{className:"revka-dot",style:{background:(f==null?void 0:f.verified)===!1?"var(--revka-status-warning)":"var(--revka-status-success)"}}),f===null?c.jsx(Rr,{className:"h-3.5 w-3.5 animate-spin"}):f.verified?c.jsx(Cv,{className:"h-3.5 w-3.5"}):c.jsx(C0,{className:"h-3.5 w-3.5"}),f!=null&&f.verified?u("header.trust_verified"):f&&!f.verified?u("header.trust_unverified"):u("header.trust_checking")]}),c.jsx(Yde,{}),c.jsxs("div",{className:"revka-theme-toggle",role:"group","aria-label":u("theme.mode"),children:[c.jsx("button",{type:"button",className:"revka-theme-toggle-button","data-active":String(r==="dark"),onClick:()=>s("dark"),title:u("theme.dark"),"aria-label":u("theme.dark"),children:c.jsx(wO,{className:"h-4 w-4"})}),c.jsx("button",{type:"button",className:"revka-theme-toggle-button","data-active":String(r==="light"),onClick:()=>s("light"),title:u("theme.light"),"aria-label":u("theme.light"),children:c.jsx(SO,{className:"h-4 w-4"})}),c.jsx("button",{type:"button",className:"revka-theme-toggle-button","data-active":String(r==="system"),onClick:()=>s("system"),title:u("theme.system"),"aria-label":u("theme.system"),children:c.jsx(kO,{className:"h-4 w-4"})})]}),c.jsxs("button",{type:"button",className:"revka-button text-sm",onClick:l,style:o?{background:"var(--revka-signal-selected-soft, color-mix(in srgb, var(--revka-signal-selected) 18%, transparent))",color:"var(--revka-signal-selected)",borderColor:"var(--revka-signal-selected)"}:void 0,children:[c.jsx(Ag,{className:"h-4 w-4"}),u("header.operator")]})]})]})]})})}const yS=fd("revka-icon.png"),t7="revka-sidebar-collapsed";function Xde(){if(typeof window>"u")return!1;try{return window.localStorage.getItem(t7)==="1"}catch{return!1}}function Qde({mobileOpen:e=!1,onCloseMobile:n}){const[r,i]=b.useState(Xde),{t:s}=an(),{getSkinAsset:a}=Pa(),o=a("brandLogo")??yS;b.useEffect(()=>{try{window.localStorage.setItem(t7,r?"1":"0")}catch{}},[r]);const l=r?"4.5rem":"var(--revka-shell-width)";return c.jsxs(c.Fragment,{children:[e?c.jsx("div",{className:"fixed inset-0 z-40 lg:hidden",style:{background:"rgba(0,0,0,0.55)"},onClick:n,"aria-hidden":"true"}):null,c.jsxs("aside",{className:`revka-sidebar fixed inset-y-0 left-0 z-50 flex flex-col overflow-hidden border-r transition-transform duration-200 lg:static lg:z-auto lg:flex lg:h-screen lg:flex-shrink-0 lg:translate-x-0 ${e?"translate-x-0":"-translate-x-full lg:translate-x-0"}`,style:{borderColor:"var(--revka-border-soft)",backgroundColor:"var(--revka-bg-shell)",width:l,padding:r?"1rem 0.5rem":"1rem 0.75rem",transition:"width 0.18s ease, padding 0.18s ease, transform 0.2s ease"},"data-collapsed":String(r),children:[r?c.jsxs("div",{className:"flex flex-col items-center gap-3",children:[c.jsx("img",{src:o,alt:"Revka",title:"Revka",className:"revka-brand-logo h-11 w-11 rounded-[14px] object-contain",draggable:!1,onError:u=>{u.currentTarget.src=yS}}),c.jsx("button",{type:"button",className:"revka-sidebar-collapse-btn",onClick:()=>i(!1),"aria-label":"Expand sidebar",title:"Expand sidebar",children:c.jsx(uee,{className:"h-4 w-4"})})]}):c.jsx("div",{className:"revka-panel p-4",children:c.jsxs("div",{className:"flex items-center gap-3",children:[c.jsx("img",{src:o,alt:"Revka",className:"revka-brand-logo h-11 w-11 rounded-[14px] object-contain",draggable:!1,onError:u=>{u.currentTarget.src=yS}}),c.jsxs("div",{className:"min-w-0 flex-1",children:[c.jsx("div",{className:"revka-kicker",children:"Revka"}),c.jsx("div",{className:"truncate text-sm font-semibold",style:{color:"var(--revka-text-primary)"},children:s("sidebar.brand_subtitle")})]}),c.jsx("button",{type:"button",className:"revka-sidebar-collapse-btn",onClick:()=>i(!0),"aria-label":"Collapse sidebar",title:"Collapse sidebar",children:c.jsx(cee,{className:"h-4 w-4"})})]})}),c.jsx("nav",{className:"revka-sidebar-scroll mt-5 min-h-0 flex-1 overflow-y-auto",style:{paddingRight:r?0:"0.25rem"},children:c.jsx("div",{className:r?"space-y-4":"space-y-5",children:Iz.map(u=>c.jsxs("section",{children:[r?c.jsx("div",{className:"mx-auto mb-2 h-px w-6",style:{background:"var(--revka-border-soft)"},"aria-hidden":"true"}):c.jsx("div",{className:"mb-2 px-2 text-[11px] font-semibold uppercase tracking-[0.18em]",style:{color:"var(--revka-text-faint)"},children:s(u.labelKey)}),c.jsx("div",{className:"space-y-1.5",children:u.items.map(d=>{const p=d.icon,f=s(d.labelKey),g=s(d.blurbKey);return c.jsx(WB,{to:d.to,title:r?f:g,children:({isActive:_})=>c.jsxs("div",{className:"revka-sidebar-link w-full","data-active":String(_),"data-collapsed":String(r),children:[c.jsx(p,{className:"h-4 w-4 shrink-0"}),r?null:c.jsxs("div",{className:"min-w-0",children:[c.jsx("div",{className:"text-sm font-medium",children:f}),c.jsx("div",{className:"truncate text-xs",style:{color:_?"var(--revka-text-secondary)":"var(--revka-text-faint)"},children:g})]})]})},d.to)})})]},u.id))})}),r?null:c.jsxs("div",{className:"revka-panel mt-5 p-4","data-variant":"utility",children:[c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx(see,{className:"h-4 w-4",style:{color:"var(--revka-signal-network)"}}),c.jsx("span",{className:"text-sm font-medium",style:{color:"var(--revka-text-primary)"},children:s("sidebar.shell")})]}),c.jsx("p",{className:"mt-2 text-xs leading-5",style:{color:"var(--revka-text-secondary)"},children:s("sidebar.shell_description")}),c.jsxs("div",{className:"mt-3 text-[11px] font-medium",style:{color:"var(--revka-text-faint)"},children:["v",Aj]})]})]})]})}function Zde(){const{theme:e,resolvedTheme:n}=Pa(),r=e==="system"?n:e,[i,s]=b.useState(!1),a=aa();return b.useEffect(()=>{const o=document.documentElement;return o.dataset.theme=r,()=>{o.dataset.theme===r&&delete o.dataset.theme}},[r]),b.useEffect(()=>{s(!1)},[a.pathname]),c.jsx(bte,{children:c.jsxs("div",{className:"revka-shell lg:flex lg:h-screen lg:overflow-hidden",children:[c.jsx(Qde,{mobileOpen:i,onCloseMobile:()=>s(!1)}),c.jsxs("div",{className:"min-w-0 flex-1 lg:flex lg:h-screen lg:flex-col lg:overflow-hidden",children:[c.jsx(Gde,{onOpenMobileNav:()=>s(!0)}),c.jsxs("div",{className:"relative min-h-0 flex-1",children:[c.jsx("main",{className:"h-full overflow-y-auto px-4 pb-6 lg:px-6 lg:pb-8",children:c.jsx(xQ,{})}),c.jsx(Hde,{})]})]})]})})}/*! js-yaml 4.1.1 https://github.com/nodeca/js-yaml @license MIT */function n7(e){return typeof e>"u"||e===null}function Jde(e){return typeof e=="object"&&e!==null}function ehe(e){return Array.isArray(e)?e:n7(e)?[]:[e]}function the(e,n){var r,i,s,a;if(n)for(a=Object.keys(n),r=0,i=a.length;r<i;r+=1)s=a[r],e[s]=n[s];return e}function nhe(e,n){var r="",i;for(i=0;i<n;i+=1)r+=e;return r}function rhe(e){return e===0&&Number.NEGATIVE_INFINITY===1/e}var ihe=n7,she=Jde,ahe=ehe,ohe=nhe,lhe=rhe,che=the,ii={isNothing:ihe,isObject:she,toArray:ahe,repeat:ohe,isNegativeZero:lhe,extend:che};function r7(e,n){var r="",i=e.reason||"(unknown reason)";return e.mark?(e.mark.name&&(r+='in "'+e.mark.name+'" '),r+="("+(e.mark.line+1)+":"+(e.mark.column+1)+")",!n&&e.mark.snippet&&(r+=`

`+e.mark.snippet),i+" "+r):i}function Lg(e,n){Error.call(this),this.name="YAMLException",this.reason=e,this.mark=n,this.message=r7(this,!1),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack||""}Lg.prototype=Object.create(Error.prototype);Lg.prototype.constructor=Lg;Lg.prototype.toString=function(n){return this.name+": "+r7(this,n)};var ns=Lg;function _S(e,n,r,i,s){var a="",o="",l=Math.floor(s/2)-1;return i-n>l&&(a=" ... ",n=i-l+a.length),r-i>l&&(o=" ...",r=i+l-o.length),{str:a+e.slice(n,r).replace(/\t/g,"→")+o,pos:i-n+a.length}}function xS(e,n){return ii.repeat(" ",n-e.length)+e}function uhe(e,n){if(n=Object.create(n||null),!e.buffer)return null;n.maxLength||(n.maxLength=79),typeof n.indent!="number"&&(n.indent=1),typeof n.linesBefore!="number"&&(n.linesBefore=3),typeof n.linesAfter!="number"&&(n.linesAfter=2);for(var r=/\r?\n|\r|\0/g,i=[0],s=[],a,o=-1;a=r.exec(e.buffer);)s.push(a.index),i.push(a.index+a[0].length),e.position<=a.index&&o<0&&(o=i.length-2);o<0&&(o=i.length-1);var l="",u,d,p=Math.min(e.line+n.linesAfter,s.length).toString().length,f=n.maxLength-(n.indent+p+3);for(u=1;u<=n.linesBefore&&!(o-u<0);u++)d=_S(e.buffer,i[o-u],s[o-u],e.position-(i[o]-i[o-u]),f),l=ii.repeat(" ",n.indent)+xS((e.line-u+1).toString(),p)+" | "+d.str+`
`+l;for(d=_S(e.buffer,i[o],s[o],e.position,f),l+=ii.repeat(" ",n.indent)+xS((e.line+1).toString(),p)+" | "+d.str+`
`,l+=ii.repeat("-",n.indent+p+3+d.pos)+`^
`,u=1;u<=n.linesAfter&&!(o+u>=s.length);u++)d=_S(e.buffer,i[o+u],s[o+u],e.position-(i[o]-i[o+u]),f),l+=ii.repeat(" ",n.indent)+xS((e.line+u+1).toString(),p)+" | "+d.str+`
`;return l.replace(/\n$/,"")}var dhe=uhe,hhe=["kind","multi","resolve","construct","instanceOf","predicate","represent","representName","defaultStyle","styleAliases"],fhe=["scalar","sequence","mapping"];function phe(e){var n={};return e!==null&&Object.keys(e).forEach(function(r){e[r].forEach(function(i){n[String(i)]=r})}),n}function mhe(e,n){if(n=n||{},Object.keys(n).forEach(function(r){if(hhe.indexOf(r)===-1)throw new ns('Unknown option "'+r+'" is met in definition of "'+e+'" YAML type.')}),this.options=n,this.tag=e,this.kind=n.kind||null,this.resolve=n.resolve||function(){return!0},this.construct=n.construct||function(r){return r},this.instanceOf=n.instanceOf||null,this.predicate=n.predicate||null,this.represent=n.represent||null,this.representName=n.representName||null,this.defaultStyle=n.defaultStyle||null,this.multi=n.multi||!1,this.styleAliases=phe(n.styleAliases||null),fhe.indexOf(this.kind)===-1)throw new ns('Unknown kind "'+this.kind+'" is specified for "'+e+'" YAML type.')}var Mi=mhe;function CD(e,n){var r=[];return e[n].forEach(function(i){var s=r.length;r.forEach(function(a,o){a.tag===i.tag&&a.kind===i.kind&&a.multi===i.multi&&(s=o)}),r[s]=i}),r}function ghe(){var e={scalar:{},sequence:{},mapping:{},fallback:{},multi:{scalar:[],sequence:[],mapping:[],fallback:[]}},n,r;function i(s){s.multi?(e.multi[s.kind].push(s),e.multi.fallback.push(s)):e[s.kind][s.tag]=e.fallback[s.tag]=s}for(n=0,r=arguments.length;n<r;n+=1)arguments[n].forEach(i);return e}function Tj(e){return this.extend(e)}Tj.prototype.extend=function(n){var r=[],i=[];if(n instanceof Mi)i.push(n);else if(Array.isArray(n))i=i.concat(n);else if(n&&(Array.isArray(n.implicit)||Array.isArray(n.explicit)))n.implicit&&(r=r.concat(n.implicit)),n.explicit&&(i=i.concat(n.explicit));else throw new ns("Schema.extend argument should be a Type, [ Type ], or a schema definition ({ implicit: [...], explicit: [...] })");r.forEach(function(a){if(!(a instanceof Mi))throw new ns("Specified list of YAML types (or a single Type object) contains a non-Type object.");if(a.loadKind&&a.loadKind!=="scalar")throw new ns("There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.");if(a.multi)throw new ns("There is a multi type in the implicit list of a schema. Multi tags can only be listed as explicit.")}),i.forEach(function(a){if(!(a instanceof Mi))throw new ns("Specified list of YAML types (or a single Type object) contains a non-Type object.")});var s=Object.create(Tj.prototype);return s.implicit=(this.implicit||[]).concat(r),s.explicit=(this.explicit||[]).concat(i),s.compiledImplicit=CD(s,"implicit"),s.compiledExplicit=CD(s,"explicit"),s.compiledTypeMap=ghe(s.compiledImplicit,s.compiledExplicit),s};var i7=Tj,s7=new Mi("tag:yaml.org,2002:str",{kind:"scalar",construct:function(e){return e!==null?e:""}}),a7=new Mi("tag:yaml.org,2002:seq",{kind:"sequence",construct:function(e){return e!==null?e:[]}}),o7=new Mi("tag:yaml.org,2002:map",{kind:"mapping",construct:function(e){return e!==null?e:{}}}),l7=new i7({explicit:[s7,a7,o7]});function vhe(e){if(e===null)return!0;var n=e.length;return n===1&&e==="~"||n===4&&(e==="null"||e==="Null"||e==="NULL")}function yhe(){return null}function _he(e){return e===null}var c7=new Mi("tag:yaml.org,2002:null",{kind:"scalar",resolve:vhe,construct:yhe,predicate:_he,represent:{canonical:function(){return"~"},lowercase:function(){return"null"},uppercase:function(){return"NULL"},camelcase:function(){return"Null"},empty:function(){return""}},defaultStyle:"lowercase"});function xhe(e){if(e===null)return!1;var n=e.length;return n===4&&(e==="true"||e==="True"||e==="TRUE")||n===5&&(e==="false"||e==="False"||e==="FALSE")}function bhe(e){return e==="true"||e==="True"||e==="TRUE"}function khe(e){return Object.prototype.toString.call(e)==="[object Boolean]"}var u7=new Mi("tag:yaml.org,2002:bool",{kind:"scalar",resolve:xhe,construct:bhe,predicate:khe,represent:{lowercase:function(e){return e?"true":"false"},uppercase:function(e){return e?"TRUE":"FALSE"},camelcase:function(e){return e?"True":"False"}},defaultStyle:"lowercase"});function whe(e){return 48<=e&&e<=57||65<=e&&e<=70||97<=e&&e<=102}function She(e){return 48<=e&&e<=55}function Che(e){return 48<=e&&e<=57}function jhe(e){if(e===null)return!1;var n=e.length,r=0,i=!1,s;if(!n)return!1;if(s=e[r],(s==="-"||s==="+")&&(s=e[++r]),s==="0"){if(r+1===n)return!0;if(s=e[++r],s==="b"){for(r++;r<n;r++)if(s=e[r],s!=="_"){if(s!=="0"&&s!=="1")return!1;i=!0}return i&&s!=="_"}if(s==="x"){for(r++;r<n;r++)if(s=e[r],s!=="_"){if(!whe(e.charCodeAt(r)))return!1;i=!0}return i&&s!=="_"}if(s==="o"){for(r++;r<n;r++)if(s=e[r],s!=="_"){if(!She(e.charCodeAt(r)))return!1;i=!0}return i&&s!=="_"}}if(s==="_")return!1;for(;r<n;r++)if(s=e[r],s!=="_"){if(!Che(e.charCodeAt(r)))return!1;i=!0}return!(!i||s==="_")}function Nhe(e){var n=e,r=1,i;if(n.indexOf("_")!==-1&&(n=n.replace(/_/g,"")),i=n[0],(i==="-"||i==="+")&&(i==="-"&&(r=-1),n=n.slice(1),i=n[0]),n==="0")return 0;if(i==="0"){if(n[1]==="b")return r*parseInt(n.slice(2),2);if(n[1]==="x")return r*parseInt(n.slice(2),16);if(n[1]==="o")return r*parseInt(n.slice(2),8)}return r*parseInt(n,10)}function Ehe(e){return Object.prototype.toString.call(e)==="[object Number]"&&e%1===0&&!ii.isNegativeZero(e)}var d7=new Mi("tag:yaml.org,2002:int",{kind:"scalar",resolve:jhe,construct:Nhe,predicate:Ehe,represent:{binary:function(e){return e>=0?"0b"+e.toString(2):"-0b"+e.toString(2).slice(1)},octal:function(e){return e>=0?"0o"+e.toString(8):"-0o"+e.toString(8).slice(1)},decimal:function(e){return e.toString(10)},hexadecimal:function(e){return e>=0?"0x"+e.toString(16).toUpperCase():"-0x"+e.toString(16).toUpperCase().slice(1)}},defaultStyle:"decimal",styleAliases:{binary:[2,"bin"],octal:[8,"oct"],decimal:[10,"dec"],hexadecimal:[16,"hex"]}}),Ahe=new RegExp("^(?:[-+]?(?:[0-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");function The(e){return!(e===null||!Ahe.test(e)||e[e.length-1]==="_")}function Mhe(e){var n,r;return n=e.replace(/_/g,"").toLowerCase(),r=n[0]==="-"?-1:1,"+-".indexOf(n[0])>=0&&(n=n.slice(1)),n===".inf"?r===1?Number.POSITIVE_INFINITY:Number.NEGATIVE_INFINITY:n===".nan"?NaN:r*parseFloat(n,10)}var Rhe=/^[-+]?[0-9]+e/;function Ohe(e,n){var r;if(isNaN(e))switch(n){case"lowercase":return".nan";case"uppercase":return".NAN";case"camelcase":return".NaN"}else if(Number.POSITIVE_INFINITY===e)switch(n){case"lowercase":return".inf";case"uppercase":return".INF";case"camelcase":return".Inf"}else if(Number.NEGATIVE_INFINITY===e)switch(n){case"lowercase":return"-.inf";case"uppercase":return"-.INF";case"camelcase":return"-.Inf"}else if(ii.isNegativeZero(e))return"-0.0";return r=e.toString(10),Rhe.test(r)?r.replace("e",".e"):r}function Dhe(e){return Object.prototype.toString.call(e)==="[object Number]"&&(e%1!==0||ii.isNegativeZero(e))}var h7=new Mi("tag:yaml.org,2002:float",{kind:"scalar",resolve:The,construct:Mhe,predicate:Dhe,represent:Ohe,defaultStyle:"lowercase"}),f7=l7.extend({implicit:[c7,u7,d7,h7]}),p7=f7,m7=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"),g7=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9]?)-([0-9][0-9]?)(?:[Tt]|[ \\t]+)([0-9][0-9]?):([0-9][0-9]):([0-9][0-9])(?:\\.([0-9]*))?(?:[ \\t]*(Z|([-+])([0-9][0-9]?)(?::([0-9][0-9]))?))?$");function Phe(e){return e===null?!1:m7.exec(e)!==null||g7.exec(e)!==null}function Lhe(e){var n,r,i,s,a,o,l,u=0,d=null,p,f,g;if(n=m7.exec(e),n===null&&(n=g7.exec(e)),n===null)throw new Error("Date resolve error");if(r=+n[1],i=+n[2]-1,s=+n[3],!n[4])return new Date(Date.UTC(r,i,s));if(a=+n[4],o=+n[5],l=+n[6],n[7]){for(u=n[7].slice(0,3);u.length<3;)u+="0";u=+u}return n[9]&&(p=+n[10],f=+(n[11]||0),d=(p*60+f)*6e4,n[9]==="-"&&(d=-d)),g=new Date(Date.UTC(r,i,s,a,o,l,u)),d&&g.setTime(g.getTime()-d),g}function Ihe(e){return e.toISOString()}var v7=new Mi("tag:yaml.org,2002:timestamp",{kind:"scalar",resolve:Phe,construct:Lhe,instanceOf:Date,represent:Ihe});function Bhe(e){return e==="<<"||e===null}var y7=new Mi("tag:yaml.org,2002:merge",{kind:"scalar",resolve:Bhe}),NA=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=
\r`;function zhe(e){if(e===null)return!1;var n,r,i=0,s=e.length,a=NA;for(r=0;r<s;r++)if(n=a.indexOf(e.charAt(r)),!(n>64)){if(n<0)return!1;i+=6}return i%8===0}function $he(e){var n,r,i=e.replace(/[\r\n=]/g,""),s=i.length,a=NA,o=0,l=[];for(n=0;n<s;n++)n%4===0&&n&&(l.push(o>>16&255),l.push(o>>8&255),l.push(o&255)),o=o<<6|a.indexOf(i.charAt(n));return r=s%4*6,r===0?(l.push(o>>16&255),l.push(o>>8&255),l.push(o&255)):r===18?(l.push(o>>10&255),l.push(o>>2&255)):r===12&&l.push(o>>4&255),new Uint8Array(l)}function Fhe(e){var n="",r=0,i,s,a=e.length,o=NA;for(i=0;i<a;i++)i%3===0&&i&&(n+=o[r>>18&63],n+=o[r>>12&63],n+=o[r>>6&63],n+=o[r&63]),r=(r<<8)+e[i];return s=a%3,s===0?(n+=o[r>>18&63],n+=o[r>>12&63],n+=o[r>>6&63],n+=o[r&63]):s===2?(n+=o[r>>10&63],n+=o[r>>4&63],n+=o[r<<2&63],n+=o[64]):s===1&&(n+=o[r>>2&63],n+=o[r<<4&63],n+=o[64],n+=o[64]),n}function Hhe(e){return Object.prototype.toString.call(e)==="[object Uint8Array]"}var _7=new Mi("tag:yaml.org,2002:binary",{kind:"scalar",resolve:zhe,construct:$he,predicate:Hhe,represent:Fhe}),Whe=Object.prototype.hasOwnProperty,qhe=Object.prototype.toString;function Uhe(e){if(e===null)return!0;var n=[],r,i,s,a,o,l=e;for(r=0,i=l.length;r<i;r+=1){if(s=l[r],o=!1,qhe.call(s)!=="[object Object]")return!1;for(a in s)if(Whe.call(s,a))if(!o)o=!0;else return!1;if(!o)return!1;if(n.indexOf(a)===-1)n.push(a);else return!1}return!0}function Khe(e){return e!==null?e:[]}var x7=new Mi("tag:yaml.org,2002:omap",{kind:"sequence",resolve:Uhe,construct:Khe}),Vhe=Object.prototype.toString;function Yhe(e){if(e===null)return!0;var n,r,i,s,a,o=e;for(a=new Array(o.length),n=0,r=o.length;n<r;n+=1){if(i=o[n],Vhe.call(i)!=="[object Object]"||(s=Object.keys(i),s.length!==1))return!1;a[n]=[s[0],i[s[0]]]}return!0}function Ghe(e){if(e===null)return[];var n,r,i,s,a,o=e;for(a=new Array(o.length),n=0,r=o.length;n<r;n+=1)i=o[n],s=Object.keys(i),a[n]=[s[0],i[s[0]]];return a}var b7=new Mi("tag:yaml.org,2002:pairs",{kind:"sequence",resolve:Yhe,construct:Ghe}),Xhe=Object.prototype.hasOwnProperty;function Qhe(e){if(e===null)return!0;var n,r=e;for(n in r)if(Xhe.call(r,n)&&r[n]!==null)return!1;return!0}function Zhe(e){return e!==null?e:{}}var k7=new Mi("tag:yaml.org,2002:set",{kind:"mapping",resolve:Qhe,construct:Zhe}),EA=p7.extend({implicit:[v7,y7],explicit:[_7,x7,b7,k7]}),fu=Object.prototype.hasOwnProperty,pb=1,w7=2,S7=3,mb=4,bS=1,Jhe=2,jD=3,efe=/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,tfe=/[\x85\u2028\u2029]/,nfe=/[,\[\]\{\}]/,C7=/^(?:!|!!|![a-z\-]+!)$/i,j7=/^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i;function ND(e){return Object.prototype.toString.call(e)}function Xo(e){return e===10||e===13}function wd(e){return e===9||e===32}function js(e){return e===9||e===32||e===10||e===13}function af(e){return e===44||e===91||e===93||e===123||e===125}function rfe(e){var n;return 48<=e&&e<=57?e-48:(n=e|32,97<=n&&n<=102?n-97+10:-1)}function ife(e){return e===120?2:e===117?4:e===85?8:0}function sfe(e){return 48<=e&&e<=57?e-48:-1}function ED(e){return e===48?"\0":e===97?"\x07":e===98?"\b":e===116||e===9?"	":e===110?`
`:e===118?"\v":e===102?"\f":e===114?"\r":e===101?"\x1B":e===32?" ":e===34?'"':e===47?"/":e===92?"\\":e===78?"":e===95?" ":e===76?"\u2028":e===80?"\u2029":""}function afe(e){return e<=65535?String.fromCharCode(e):String.fromCharCode((e-65536>>10)+55296,(e-65536&1023)+56320)}function N7(e,n,r){n==="__proto__"?Object.defineProperty(e,n,{configurable:!0,enumerable:!0,writable:!0,value:r}):e[n]=r}var E7=new Array(256),A7=new Array(256);for(var Rh=0;Rh<256;Rh++)E7[Rh]=ED(Rh)?1:0,A7[Rh]=ED(Rh);function ofe(e,n){this.input=e,this.filename=n.filename||null,this.schema=n.schema||EA,this.onWarning=n.onWarning||null,this.legacy=n.legacy||!1,this.json=n.json||!1,this.listener=n.listener||null,this.implicitTypes=this.schema.compiledImplicit,this.typeMap=this.schema.compiledTypeMap,this.length=e.length,this.position=0,this.line=0,this.lineStart=0,this.lineIndent=0,this.firstTabInLine=-1,this.documents=[]}function T7(e,n){var r={name:e.filename,buffer:e.input.slice(0,-1),position:e.position,line:e.line,column:e.position-e.lineStart};return r.snippet=dhe(r),new ns(n,r)}function At(e,n){throw T7(e,n)}function gb(e,n){e.onWarning&&e.onWarning.call(null,T7(e,n))}var AD={YAML:function(n,r,i){var s,a,o;n.version!==null&&At(n,"duplication of %YAML directive"),i.length!==1&&At(n,"YAML directive accepts exactly one argument"),s=/^([0-9]+)\.([0-9]+)$/.exec(i[0]),s===null&&At(n,"ill-formed argument of the YAML directive"),a=parseInt(s[1],10),o=parseInt(s[2],10),a!==1&&At(n,"unacceptable YAML version of the document"),n.version=i[0],n.checkLineBreaks=o<2,o!==1&&o!==2&&gb(n,"unsupported YAML version of the document")},TAG:function(n,r,i){var s,a;i.length!==2&&At(n,"TAG directive accepts exactly two arguments"),s=i[0],a=i[1],C7.test(s)||At(n,"ill-formed tag handle (first argument) of the TAG directive"),fu.call(n.tagMap,s)&&At(n,'there is a previously declared suffix for "'+s+'" tag handle'),j7.test(a)||At(n,"ill-formed tag prefix (second argument) of the TAG directive");try{a=decodeURIComponent(a)}catch{At(n,"tag prefix is malformed: "+a)}n.tagMap[s]=a}};function su(e,n,r,i){var s,a,o,l;if(n<r){if(l=e.input.slice(n,r),i)for(s=0,a=l.length;s<a;s+=1)o=l.charCodeAt(s),o===9||32<=o&&o<=1114111||At(e,"expected valid JSON character");else efe.test(l)&&At(e,"the stream contains non-printable characters");e.result+=l}}function TD(e,n,r,i){var s,a,o,l;for(ii.isObject(r)||At(e,"cannot merge mappings; the provided source object is unacceptable"),s=Object.keys(r),o=0,l=s.length;o<l;o+=1)a=s[o],fu.call(n,a)||(N7(n,a,r[a]),i[a]=!0)}function of(e,n,r,i,s,a,o,l,u){var d,p;if(Array.isArray(s))for(s=Array.prototype.slice.call(s),d=0,p=s.length;d<p;d+=1)Array.isArray(s[d])&&At(e,"nested arrays are not supported inside keys"),typeof s=="object"&&ND(s[d])==="[object Object]"&&(s[d]="[object Object]");if(typeof s=="object"&&ND(s)==="[object Object]"&&(s="[object Object]"),s=String(s),n===null&&(n={}),i==="tag:yaml.org,2002:merge")if(Array.isArray(a))for(d=0,p=a.length;d<p;d+=1)TD(e,n,a[d],r);else TD(e,n,a,r);else!e.json&&!fu.call(r,s)&&fu.call(n,s)&&(e.line=o||e.line,e.lineStart=l||e.lineStart,e.position=u||e.position,At(e,"duplicated mapping key")),N7(n,s,a),delete r[s];return n}function AA(e){var n;n=e.input.charCodeAt(e.position),n===10?e.position++:n===13?(e.position++,e.input.charCodeAt(e.position)===10&&e.position++):At(e,"a line break is expected"),e.line+=1,e.lineStart=e.position,e.firstTabInLine=-1}function Gr(e,n,r){for(var i=0,s=e.input.charCodeAt(e.position);s!==0;){for(;wd(s);)s===9&&e.firstTabInLine===-1&&(e.firstTabInLine=e.position),s=e.input.charCodeAt(++e.position);if(n&&s===35)do s=e.input.charCodeAt(++e.position);while(s!==10&&s!==13&&s!==0);if(Xo(s))for(AA(e),s=e.input.charCodeAt(e.position),i++,e.lineIndent=0;s===32;)e.lineIndent++,s=e.input.charCodeAt(++e.position);else break}return r!==-1&&i!==0&&e.lineIndent<r&&gb(e,"deficient indentation"),i}function z0(e){var n=e.position,r;return r=e.input.charCodeAt(n),!!((r===45||r===46)&&r===e.input.charCodeAt(n+1)&&r===e.input.charCodeAt(n+2)&&(n+=3,r=e.input.charCodeAt(n),r===0||js(r)))}function TA(e,n){n===1?e.result+=" ":n>1&&(e.result+=ii.repeat(`
`,n-1))}function lfe(e,n,r){var i,s,a,o,l,u,d,p,f=e.kind,g=e.result,_;if(_=e.input.charCodeAt(e.position),js(_)||af(_)||_===35||_===38||_===42||_===33||_===124||_===62||_===39||_===34||_===37||_===64||_===96||(_===63||_===45)&&(s=e.input.charCodeAt(e.position+1),js(s)||r&&af(s)))return!1;for(e.kind="scalar",e.result="",a=o=e.position,l=!1;_!==0;){if(_===58){if(s=e.input.charCodeAt(e.position+1),js(s)||r&&af(s))break}else if(_===35){if(i=e.input.charCodeAt(e.position-1),js(i))break}else{if(e.position===e.lineStart&&z0(e)||r&&af(_))break;if(Xo(_))if(u=e.line,d=e.lineStart,p=e.lineIndent,Gr(e,!1,-1),e.lineIndent>=n){l=!0,_=e.input.charCodeAt(e.position);continue}else{e.position=o,e.line=u,e.lineStart=d,e.lineIndent=p;break}}l&&(su(e,a,o,!1),TA(e,e.line-u),a=o=e.position,l=!1),wd(_)||(o=e.position+1),_=e.input.charCodeAt(++e.position)}return su(e,a,o,!1),e.result?!0:(e.kind=f,e.result=g,!1)}function cfe(e,n){var r,i,s;if(r=e.input.charCodeAt(e.position),r!==39)return!1;for(e.kind="scalar",e.result="",e.position++,i=s=e.position;(r=e.input.charCodeAt(e.position))!==0;)if(r===39)if(su(e,i,e.position,!0),r=e.input.charCodeAt(++e.position),r===39)i=e.position,e.position++,s=e.position;else return!0;else Xo(r)?(su(e,i,s,!0),TA(e,Gr(e,!1,n)),i=s=e.position):e.position===e.lineStart&&z0(e)?At(e,"unexpected end of the document within a single quoted scalar"):(e.position++,s=e.position);At(e,"unexpected end of the stream within a single quoted scalar")}function ufe(e,n){var r,i,s,a,o,l;if(l=e.input.charCodeAt(e.position),l!==34)return!1;for(e.kind="scalar",e.result="",e.position++,r=i=e.position;(l=e.input.charCodeAt(e.position))!==0;){if(l===34)return su(e,r,e.position,!0),e.position++,!0;if(l===92){if(su(e,r,e.position,!0),l=e.input.charCodeAt(++e.position),Xo(l))Gr(e,!1,n);else if(l<256&&E7[l])e.result+=A7[l],e.position++;else if((o=ife(l))>0){for(s=o,a=0;s>0;s--)l=e.input.charCodeAt(++e.position),(o=rfe(l))>=0?a=(a<<4)+o:At(e,"expected hexadecimal character");e.result+=afe(a),e.position++}else At(e,"unknown escape sequence");r=i=e.position}else Xo(l)?(su(e,r,i,!0),TA(e,Gr(e,!1,n)),r=i=e.position):e.position===e.lineStart&&z0(e)?At(e,"unexpected end of the document within a double quoted scalar"):(e.position++,i=e.position)}At(e,"unexpected end of the stream within a double quoted scalar")}function dfe(e,n){var r=!0,i,s,a,o=e.tag,l,u=e.anchor,d,p,f,g,_,x=Object.create(null),v,S,w,j;if(j=e.input.charCodeAt(e.position),j===91)p=93,_=!1,l=[];else if(j===123)p=125,_=!0,l={};else return!1;for(e.anchor!==null&&(e.anchorMap[e.anchor]=l),j=e.input.charCodeAt(++e.position);j!==0;){if(Gr(e,!0,n),j=e.input.charCodeAt(e.position),j===p)return e.position++,e.tag=o,e.anchor=u,e.kind=_?"mapping":"sequence",e.result=l,!0;r?j===44&&At(e,"expected the node content, but found ','"):At(e,"missed comma between flow collection entries"),S=v=w=null,f=g=!1,j===63&&(d=e.input.charCodeAt(e.position+1),js(d)&&(f=g=!0,e.position++,Gr(e,!0,n))),i=e.line,s=e.lineStart,a=e.position,If(e,n,pb,!1,!0),S=e.tag,v=e.result,Gr(e,!0,n),j=e.input.charCodeAt(e.position),(g||e.line===i)&&j===58&&(f=!0,j=e.input.charCodeAt(++e.position),Gr(e,!0,n),If(e,n,pb,!1,!0),w=e.result),_?of(e,l,x,S,v,w,i,s,a):f?l.push(of(e,null,x,S,v,w,i,s,a)):l.push(v),Gr(e,!0,n),j=e.input.charCodeAt(e.position),j===44?(r=!0,j=e.input.charCodeAt(++e.position)):r=!1}At(e,"unexpected end of the stream within a flow collection")}function hfe(e,n){var r,i,s=bS,a=!1,o=!1,l=n,u=0,d=!1,p,f;if(f=e.input.charCodeAt(e.position),f===124)i=!1;else if(f===62)i=!0;else return!1;for(e.kind="scalar",e.result="";f!==0;)if(f=e.input.charCodeAt(++e.position),f===43||f===45)bS===s?s=f===43?jD:Jhe:At(e,"repeat of a chomping mode identifier");else if((p=sfe(f))>=0)p===0?At(e,"bad explicit indentation width of a block scalar; it cannot be less than one"):o?At(e,"repeat of an indentation width identifier"):(l=n+p-1,o=!0);else break;if(wd(f)){do f=e.input.charCodeAt(++e.position);while(wd(f));if(f===35)do f=e.input.charCodeAt(++e.position);while(!Xo(f)&&f!==0)}for(;f!==0;){for(AA(e),e.lineIndent=0,f=e.input.charCodeAt(e.position);(!o||e.lineIndent<l)&&f===32;)e.lineIndent++,f=e.input.charCodeAt(++e.position);if(!o&&e.lineIndent>l&&(l=e.lineIndent),Xo(f)){u++;continue}if(e.lineIndent<l){s===jD?e.result+=ii.repeat(`
`,a?1+u:u):s===bS&&a&&(e.result+=`
`);break}for(i?wd(f)?(d=!0,e.result+=ii.repeat(`
`,a?1+u:u)):d?(d=!1,e.result+=ii.repeat(`
`,u+1)):u===0?a&&(e.result+=" "):e.result+=ii.repeat(`
`,u):e.result+=ii.repeat(`
`,a?1+u:u),a=!0,o=!0,u=0,r=e.position;!Xo(f)&&f!==0;)f=e.input.charCodeAt(++e.position);su(e,r,e.position,!1)}return!0}function MD(e,n){var r,i=e.tag,s=e.anchor,a=[],o,l=!1,u;if(e.firstTabInLine!==-1)return!1;for(e.anchor!==null&&(e.anchorMap[e.anchor]=a),u=e.input.charCodeAt(e.position);u!==0&&(e.firstTabInLine!==-1&&(e.position=e.firstTabInLine,At(e,"tab characters must not be used in indentation")),!(u!==45||(o=e.input.charCodeAt(e.position+1),!js(o))));){if(l=!0,e.position++,Gr(e,!0,-1)&&e.lineIndent<=n){a.push(null),u=e.input.charCodeAt(e.position);continue}if(r=e.line,If(e,n,S7,!1,!0),a.push(e.result),Gr(e,!0,-1),u=e.input.charCodeAt(e.position),(e.line===r||e.lineIndent>n)&&u!==0)At(e,"bad indentation of a sequence entry");else if(e.lineIndent<n)break}return l?(e.tag=i,e.anchor=s,e.kind="sequence",e.result=a,!0):!1}function ffe(e,n,r){var i,s,a,o,l,u,d=e.tag,p=e.anchor,f={},g=Object.create(null),_=null,x=null,v=null,S=!1,w=!1,j;if(e.firstTabInLine!==-1)return!1;for(e.anchor!==null&&(e.anchorMap[e.anchor]=f),j=e.input.charCodeAt(e.position);j!==0;){if(!S&&e.firstTabInLine!==-1&&(e.position=e.firstTabInLine,At(e,"tab characters must not be used in indentation")),i=e.input.charCodeAt(e.position+1),a=e.line,(j===63||j===58)&&js(i))j===63?(S&&(of(e,f,g,_,x,null,o,l,u),_=x=v=null),w=!0,S=!0,s=!0):S?(S=!1,s=!0):At(e,"incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line"),e.position+=1,j=i;else{if(o=e.line,l=e.lineStart,u=e.position,!If(e,r,w7,!1,!0))break;if(e.line===a){for(j=e.input.charCodeAt(e.position);wd(j);)j=e.input.charCodeAt(++e.position);if(j===58)j=e.input.charCodeAt(++e.position),js(j)||At(e,"a whitespace character is expected after the key-value separator within a block mapping"),S&&(of(e,f,g,_,x,null,o,l,u),_=x=v=null),w=!0,S=!1,s=!1,_=e.tag,x=e.result;else if(w)At(e,"can not read an implicit mapping pair; a colon is missed");else return e.tag=d,e.anchor=p,!0}else if(w)At(e,"can not read a block mapping entry; a multiline key may not be an implicit key");else return e.tag=d,e.anchor=p,!0}if((e.line===a||e.lineIndent>n)&&(S&&(o=e.line,l=e.lineStart,u=e.position),If(e,n,mb,!0,s)&&(S?x=e.result:v=e.result),S||(of(e,f,g,_,x,v,o,l,u),_=x=v=null),Gr(e,!0,-1),j=e.input.charCodeAt(e.position)),(e.line===a||e.lineIndent>n)&&j!==0)At(e,"bad indentation of a mapping entry");else if(e.lineIndent<n)break}return S&&of(e,f,g,_,x,null,o,l,u),w&&(e.tag=d,e.anchor=p,e.kind="mapping",e.result=f),w}function pfe(e){var n,r=!1,i=!1,s,a,o;if(o=e.input.charCodeAt(e.position),o!==33)return!1;if(e.tag!==null&&At(e,"duplication of a tag property"),o=e.input.charCodeAt(++e.position),o===60?(r=!0,o=e.input.charCodeAt(++e.position)):o===33?(i=!0,s="!!",o=e.input.charCodeAt(++e.position)):s="!",n=e.position,r){do o=e.input.charCodeAt(++e.position);while(o!==0&&o!==62);e.position<e.length?(a=e.input.slice(n,e.position),o=e.input.charCodeAt(++e.position)):At(e,"unexpected end of the stream within a verbatim tag")}else{for(;o!==0&&!js(o);)o===33&&(i?At(e,"tag suffix cannot contain exclamation marks"):(s=e.input.slice(n-1,e.position+1),C7.test(s)||At(e,"named tag handle cannot contain such characters"),i=!0,n=e.position+1)),o=e.input.charCodeAt(++e.position);a=e.input.slice(n,e.position),nfe.test(a)&&At(e,"tag suffix cannot contain flow indicator characters")}a&&!j7.test(a)&&At(e,"tag name cannot contain such characters: "+a);try{a=decodeURIComponent(a)}catch{At(e,"tag name is malformed: "+a)}return r?e.tag=a:fu.call(e.tagMap,s)?e.tag=e.tagMap[s]+a:s==="!"?e.tag="!"+a:s==="!!"?e.tag="tag:yaml.org,2002:"+a:At(e,'undeclared tag handle "'+s+'"'),!0}function mfe(e){var n,r;if(r=e.input.charCodeAt(e.position),r!==38)return!1;for(e.anchor!==null&&At(e,"duplication of an anchor property"),r=e.input.charCodeAt(++e.position),n=e.position;r!==0&&!js(r)&&!af(r);)r=e.input.charCodeAt(++e.position);return e.position===n&&At(e,"name of an anchor node must contain at least one character"),e.anchor=e.input.slice(n,e.position),!0}function gfe(e){var n,r,i;if(i=e.input.charCodeAt(e.position),i!==42)return!1;for(i=e.input.charCodeAt(++e.position),n=e.position;i!==0&&!js(i)&&!af(i);)i=e.input.charCodeAt(++e.position);return e.position===n&&At(e,"name of an alias node must contain at least one character"),r=e.input.slice(n,e.position),fu.call(e.anchorMap,r)||At(e,'unidentified alias "'+r+'"'),e.result=e.anchorMap[r],Gr(e,!0,-1),!0}function If(e,n,r,i,s){var a,o,l,u=1,d=!1,p=!1,f,g,_,x,v,S;if(e.listener!==null&&e.listener("open",e),e.tag=null,e.anchor=null,e.kind=null,e.result=null,a=o=l=mb===r||S7===r,i&&Gr(e,!0,-1)&&(d=!0,e.lineIndent>n?u=1:e.lineIndent===n?u=0:e.lineIndent<n&&(u=-1)),u===1)for(;pfe(e)||mfe(e);)Gr(e,!0,-1)?(d=!0,l=a,e.lineIndent>n?u=1:e.lineIndent===n?u=0:e.lineIndent<n&&(u=-1)):l=!1;if(l&&(l=d||s),(u===1||mb===r)&&(pb===r||w7===r?v=n:v=n+1,S=e.position-e.lineStart,u===1?l&&(MD(e,S)||ffe(e,S,v))||dfe(e,v)?p=!0:(o&&hfe(e,v)||cfe(e,v)||ufe(e,v)?p=!0:gfe(e)?(p=!0,(e.tag!==null||e.anchor!==null)&&At(e,"alias node should not have any properties")):lfe(e,v,pb===r)&&(p=!0,e.tag===null&&(e.tag="?")),e.anchor!==null&&(e.anchorMap[e.anchor]=e.result)):u===0&&(p=l&&MD(e,S))),e.tag===null)e.anchor!==null&&(e.anchorMap[e.anchor]=e.result);else if(e.tag==="?"){for(e.result!==null&&e.kind!=="scalar"&&At(e,'unacceptable node kind for !<?> tag; it should be "scalar", not "'+e.kind+'"'),f=0,g=e.implicitTypes.length;f<g;f+=1)if(x=e.implicitTypes[f],x.resolve(e.result)){e.result=x.construct(e.result),e.tag=x.tag,e.anchor!==null&&(e.anchorMap[e.anchor]=e.result);break}}else if(e.tag!=="!"){if(fu.call(e.typeMap[e.kind||"fallback"],e.tag))x=e.typeMap[e.kind||"fallback"][e.tag];else for(x=null,_=e.typeMap.multi[e.kind||"fallback"],f=0,g=_.length;f<g;f+=1)if(e.tag.slice(0,_[f].tag.length)===_[f].tag){x=_[f];break}x||At(e,"unknown tag !<"+e.tag+">"),e.result!==null&&x.kind!==e.kind&&At(e,"unacceptable node kind for !<"+e.tag+'> tag; it should be "'+x.kind+'", not "'+e.kind+'"'),x.resolve(e.result,e.tag)?(e.result=x.construct(e.result,e.tag),e.anchor!==null&&(e.anchorMap[e.anchor]=e.result)):At(e,"cannot resolve a node with !<"+e.tag+"> explicit tag")}return e.listener!==null&&e.listener("close",e),e.tag!==null||e.anchor!==null||p}function vfe(e){var n=e.position,r,i,s,a=!1,o;for(e.version=null,e.checkLineBreaks=e.legacy,e.tagMap=Object.create(null),e.anchorMap=Object.create(null);(o=e.input.charCodeAt(e.position))!==0&&(Gr(e,!0,-1),o=e.input.charCodeAt(e.position),!(e.lineIndent>0||o!==37));){for(a=!0,o=e.input.charCodeAt(++e.position),r=e.position;o!==0&&!js(o);)o=e.input.charCodeAt(++e.position);for(i=e.input.slice(r,e.position),s=[],i.length<1&&At(e,"directive name must not be less than one character in length");o!==0;){for(;wd(o);)o=e.input.charCodeAt(++e.position);if(o===35){do o=e.input.charCodeAt(++e.position);while(o!==0&&!Xo(o));break}if(Xo(o))break;for(r=e.position;o!==0&&!js(o);)o=e.input.charCodeAt(++e.position);s.push(e.input.slice(r,e.position))}o!==0&&AA(e),fu.call(AD,i)?AD[i](e,i,s):gb(e,'unknown document directive "'+i+'"')}if(Gr(e,!0,-1),e.lineIndent===0&&e.input.charCodeAt(e.position)===45&&e.input.charCodeAt(e.position+1)===45&&e.input.charCodeAt(e.position+2)===45?(e.position+=3,Gr(e,!0,-1)):a&&At(e,"directives end mark is expected"),If(e,e.lineIndent-1,mb,!1,!0),Gr(e,!0,-1),e.checkLineBreaks&&tfe.test(e.input.slice(n,e.position))&&gb(e,"non-ASCII line breaks are interpreted as content"),e.documents.push(e.result),e.position===e.lineStart&&z0(e)){e.input.charCodeAt(e.position)===46&&(e.position+=3,Gr(e,!0,-1));return}if(e.position<e.length-1)At(e,"end of the stream or a document separator is expected");else return}function M7(e,n){e=String(e),n=n||{},e.length!==0&&(e.charCodeAt(e.length-1)!==10&&e.charCodeAt(e.length-1)!==13&&(e+=`
`),e.charCodeAt(0)===65279&&(e=e.slice(1)));var r=new ofe(e,n),i=e.indexOf("\0");for(i!==-1&&(r.position=i,At(r,"null byte is not allowed in input")),r.input+="\0";r.input.charCodeAt(r.position)===32;)r.lineIndent+=1,r.position+=1;for(;r.position<r.length-1;)vfe(r);return r.documents}function yfe(e,n,r){n!==null&&typeof n=="object"&&typeof r>"u"&&(r=n,n=null);var i=M7(e,r);if(typeof n!="function")return i;for(var s=0,a=i.length;s<a;s+=1)n(i[s])}function _fe(e,n){var r=M7(e,n);if(r.length!==0){if(r.length===1)return r[0];throw new ns("expected a single document in the stream, but found more")}}var xfe=yfe,bfe=_fe,R7={loadAll:xfe,load:bfe},O7=Object.prototype.toString,D7=Object.prototype.hasOwnProperty,MA=65279,kfe=9,Ig=10,wfe=13,Sfe=32,Cfe=33,jfe=34,Mj=35,Nfe=37,Efe=38,Afe=39,Tfe=42,P7=44,Mfe=45,vb=58,Rfe=61,Ofe=62,Dfe=63,Pfe=64,L7=91,I7=93,Lfe=96,B7=123,Ife=124,z7=125,Gi={};Gi[0]="\\0";Gi[7]="\\a";Gi[8]="\\b";Gi[9]="\\t";Gi[10]="\\n";Gi[11]="\\v";Gi[12]="\\f";Gi[13]="\\r";Gi[27]="\\e";Gi[34]='\\"';Gi[92]="\\\\";Gi[133]="\\N";Gi[160]="\\_";Gi[8232]="\\L";Gi[8233]="\\P";var Bfe=["y","Y","yes","Yes","YES","on","On","ON","n","N","no","No","NO","off","Off","OFF"],zfe=/^[-+]?[0-9_]+(?::[0-9_]+)+(?:\.[0-9_]*)?$/;function $fe(e,n){var r,i,s,a,o,l,u;if(n===null)return{};for(r={},i=Object.keys(n),s=0,a=i.length;s<a;s+=1)o=i[s],l=String(n[o]),o.slice(0,2)==="!!"&&(o="tag:yaml.org,2002:"+o.slice(2)),u=e.compiledTypeMap.fallback[o],u&&D7.call(u.styleAliases,l)&&(l=u.styleAliases[l]),r[o]=l;return r}function Ffe(e){var n,r,i;if(n=e.toString(16).toUpperCase(),e<=255)r="x",i=2;else if(e<=65535)r="u",i=4;else if(e<=4294967295)r="U",i=8;else throw new ns("code point within a string may not be greater than 0xFFFFFFFF");return"\\"+r+ii.repeat("0",i-n.length)+n}var Hfe=1,Bg=2;function Wfe(e){this.schema=e.schema||EA,this.indent=Math.max(1,e.indent||2),this.noArrayIndent=e.noArrayIndent||!1,this.skipInvalid=e.skipInvalid||!1,this.flowLevel=ii.isNothing(e.flowLevel)?-1:e.flowLevel,this.styleMap=$fe(this.schema,e.styles||null),this.sortKeys=e.sortKeys||!1,this.lineWidth=e.lineWidth||80,this.noRefs=e.noRefs||!1,this.noCompatMode=e.noCompatMode||!1,this.condenseFlow=e.condenseFlow||!1,this.quotingType=e.quotingType==='"'?Bg:Hfe,this.forceQuotes=e.forceQuotes||!1,this.replacer=typeof e.replacer=="function"?e.replacer:null,this.implicitTypes=this.schema.compiledImplicit,this.explicitTypes=this.schema.compiledExplicit,this.tag=null,this.result="",this.duplicates=[],this.usedDuplicates=null}function RD(e,n){for(var r=ii.repeat(" ",n),i=0,s=-1,a="",o,l=e.length;i<l;)s=e.indexOf(`
`,i),s===-1?(o=e.slice(i),i=l):(o=e.slice(i,s+1),i=s+1),o.length&&o!==`
`&&(a+=r),a+=o;return a}function Rj(e,n){return`
`+ii.repeat(" ",e.indent*n)}function qfe(e,n){var r,i,s;for(r=0,i=e.implicitTypes.length;r<i;r+=1)if(s=e.implicitTypes[r],s.resolve(n))return!0;return!1}function yb(e){return e===Sfe||e===kfe}function zg(e){return 32<=e&&e<=126||161<=e&&e<=55295&&e!==8232&&e!==8233||57344<=e&&e<=65533&&e!==MA||65536<=e&&e<=1114111}function OD(e){return zg(e)&&e!==MA&&e!==wfe&&e!==Ig}function DD(e,n,r){var i=OD(e),s=i&&!yb(e);return(r?i:i&&e!==P7&&e!==L7&&e!==I7&&e!==B7&&e!==z7)&&e!==Mj&&!(n===vb&&!s)||OD(n)&&!yb(n)&&e===Mj||n===vb&&s}function Ufe(e){return zg(e)&&e!==MA&&!yb(e)&&e!==Mfe&&e!==Dfe&&e!==vb&&e!==P7&&e!==L7&&e!==I7&&e!==B7&&e!==z7&&e!==Mj&&e!==Efe&&e!==Tfe&&e!==Cfe&&e!==Ife&&e!==Rfe&&e!==Ofe&&e!==Afe&&e!==jfe&&e!==Nfe&&e!==Pfe&&e!==Lfe}function Kfe(e){return!yb(e)&&e!==vb}function Um(e,n){var r=e.charCodeAt(n),i;return r>=55296&&r<=56319&&n+1<e.length&&(i=e.charCodeAt(n+1),i>=56320&&i<=57343)?(r-55296)*1024+i-56320+65536:r}function $7(e){var n=/^\n* /;return n.test(e)}var F7=1,Oj=2,H7=3,W7=4,Gh=5;function Vfe(e,n,r,i,s,a,o,l){var u,d=0,p=null,f=!1,g=!1,_=i!==-1,x=-1,v=Ufe(Um(e,0))&&Kfe(Um(e,e.length-1));if(n||o)for(u=0;u<e.length;d>=65536?u+=2:u++){if(d=Um(e,u),!zg(d))return Gh;v=v&&DD(d,p,l),p=d}else{for(u=0;u<e.length;d>=65536?u+=2:u++){if(d=Um(e,u),d===Ig)f=!0,_&&(g=g||u-x-1>i&&e[x+1]!==" ",x=u);else if(!zg(d))return Gh;v=v&&DD(d,p,l),p=d}g=g||_&&u-x-1>i&&e[x+1]!==" "}return!f&&!g?v&&!o&&!s(e)?F7:a===Bg?Gh:Oj:r>9&&$7(e)?Gh:o?a===Bg?Gh:Oj:g?W7:H7}function Yfe(e,n,r,i,s){e.dump=(function(){if(n.length===0)return e.quotingType===Bg?'""':"''";if(!e.noCompatMode&&(Bfe.indexOf(n)!==-1||zfe.test(n)))return e.quotingType===Bg?'"'+n+'"':"'"+n+"'";var a=e.indent*Math.max(1,r),o=e.lineWidth===-1?-1:Math.max(Math.min(e.lineWidth,40),e.lineWidth-a),l=i||e.flowLevel>-1&&r>=e.flowLevel;function u(d){return qfe(e,d)}switch(Vfe(n,l,e.indent,o,u,e.quotingType,e.forceQuotes&&!i,s)){case F7:return n;case Oj:return"'"+n.replace(/'/g,"''")+"'";case H7:return"|"+PD(n,e.indent)+LD(RD(n,a));case W7:return">"+PD(n,e.indent)+LD(RD(Gfe(n,o),a));case Gh:return'"'+Xfe(n)+'"';default:throw new ns("impossible error: invalid scalar style")}})()}function PD(e,n){var r=$7(e)?String(n):"",i=e[e.length-1]===`
`,s=i&&(e[e.length-2]===`
`||e===`
`),a=s?"+":i?"":"-";return r+a+`
`}function LD(e){return e[e.length-1]===`
`?e.slice(0,-1):e}function Gfe(e,n){for(var r=/(\n+)([^\n]*)/g,i=(function(){var d=e.indexOf(`
`);return d=d!==-1?d:e.length,r.lastIndex=d,ID(e.slice(0,d),n)})(),s=e[0]===`
`||e[0]===" ",a,o;o=r.exec(e);){var l=o[1],u=o[2];a=u[0]===" ",i+=l+(!s&&!a&&u!==""?`
`:"")+ID(u,n),s=a}return i}function ID(e,n){if(e===""||e[0]===" ")return e;for(var r=/ [^ ]/g,i,s=0,a,o=0,l=0,u="";i=r.exec(e);)l=i.index,l-s>n&&(a=o>s?o:l,u+=`
`+e.slice(s,a),s=a+1),o=l;return u+=`
`,e.length-s>n&&o>s?u+=e.slice(s,o)+`
`+e.slice(o+1):u+=e.slice(s),u.slice(1)}function Xfe(e){for(var n="",r=0,i,s=0;s<e.length;r>=65536?s+=2:s++)r=Um(e,s),i=Gi[r],!i&&zg(r)?(n+=e[s],r>=65536&&(n+=e[s+1])):n+=i||Ffe(r);return n}function Qfe(e,n,r){var i="",s=e.tag,a,o,l;for(a=0,o=r.length;a<o;a+=1)l=r[a],e.replacer&&(l=e.replacer.call(r,String(a),l)),(Zl(e,n,l,!1,!1)||typeof l>"u"&&Zl(e,n,null,!1,!1))&&(i!==""&&(i+=","+(e.condenseFlow?"":" ")),i+=e.dump);e.tag=s,e.dump="["+i+"]"}function BD(e,n,r,i){var s="",a=e.tag,o,l,u;for(o=0,l=r.length;o<l;o+=1)u=r[o],e.replacer&&(u=e.replacer.call(r,String(o),u)),(Zl(e,n+1,u,!0,!0,!1,!0)||typeof u>"u"&&Zl(e,n+1,null,!0,!0,!1,!0))&&((!i||s!=="")&&(s+=Rj(e,n)),e.dump&&Ig===e.dump.charCodeAt(0)?s+="-":s+="- ",s+=e.dump);e.tag=a,e.dump=s||"[]"}function Zfe(e,n,r){var i="",s=e.tag,a=Object.keys(r),o,l,u,d,p;for(o=0,l=a.length;o<l;o+=1)p="",i!==""&&(p+=", "),e.condenseFlow&&(p+='"'),u=a[o],d=r[u],e.replacer&&(d=e.replacer.call(r,u,d)),Zl(e,n,u,!1,!1)&&(e.dump.length>1024&&(p+="? "),p+=e.dump+(e.condenseFlow?'"':"")+":"+(e.condenseFlow?"":" "),Zl(e,n,d,!1,!1)&&(p+=e.dump,i+=p));e.tag=s,e.dump="{"+i+"}"}function Jfe(e,n,r,i){var s="",a=e.tag,o=Object.keys(r),l,u,d,p,f,g;if(e.sortKeys===!0)o.sort();else if(typeof e.sortKeys=="function")o.sort(e.sortKeys);else if(e.sortKeys)throw new ns("sortKeys must be a boolean or a function");for(l=0,u=o.length;l<u;l+=1)g="",(!i||s!=="")&&(g+=Rj(e,n)),d=o[l],p=r[d],e.replacer&&(p=e.replacer.call(r,d,p)),Zl(e,n+1,d,!0,!0,!0)&&(f=e.tag!==null&&e.tag!=="?"||e.dump&&e.dump.length>1024,f&&(e.dump&&Ig===e.dump.charCodeAt(0)?g+="?":g+="? "),g+=e.dump,f&&(g+=Rj(e,n)),Zl(e,n+1,p,!0,f)&&(e.dump&&Ig===e.dump.charCodeAt(0)?g+=":":g+=": ",g+=e.dump,s+=g));e.tag=a,e.dump=s||"{}"}function zD(e,n,r){var i,s,a,o,l,u;for(s=r?e.explicitTypes:e.implicitTypes,a=0,o=s.length;a<o;a+=1)if(l=s[a],(l.instanceOf||l.predicate)&&(!l.instanceOf||typeof n=="object"&&n instanceof l.instanceOf)&&(!l.predicate||l.predicate(n))){if(r?l.multi&&l.representName?e.tag=l.representName(n):e.tag=l.tag:e.tag="?",l.represent){if(u=e.styleMap[l.tag]||l.defaultStyle,O7.call(l.represent)==="[object Function]")i=l.represent(n,u);else if(D7.call(l.represent,u))i=l.represent[u](n,u);else throw new ns("!<"+l.tag+'> tag resolver accepts not "'+u+'" style');e.dump=i}return!0}return!1}function Zl(e,n,r,i,s,a,o){e.tag=null,e.dump=r,zD(e,r,!1)||zD(e,r,!0);var l=O7.call(e.dump),u=i,d;i&&(i=e.flowLevel<0||e.flowLevel>n);var p=l==="[object Object]"||l==="[object Array]",f,g;if(p&&(f=e.duplicates.indexOf(r),g=f!==-1),(e.tag!==null&&e.tag!=="?"||g||e.indent!==2&&n>0)&&(s=!1),g&&e.usedDuplicates[f])e.dump="*ref_"+f;else{if(p&&g&&!e.usedDuplicates[f]&&(e.usedDuplicates[f]=!0),l==="[object Object]")i&&Object.keys(e.dump).length!==0?(Jfe(e,n,e.dump,s),g&&(e.dump="&ref_"+f+e.dump)):(Zfe(e,n,e.dump),g&&(e.dump="&ref_"+f+" "+e.dump));else if(l==="[object Array]")i&&e.dump.length!==0?(e.noArrayIndent&&!o&&n>0?BD(e,n-1,e.dump,s):BD(e,n,e.dump,s),g&&(e.dump="&ref_"+f+e.dump)):(Qfe(e,n,e.dump),g&&(e.dump="&ref_"+f+" "+e.dump));else if(l==="[object String]")e.tag!=="?"&&Yfe(e,e.dump,n,a,u);else{if(l==="[object Undefined]")return!1;if(e.skipInvalid)return!1;throw new ns("unacceptable kind of an object to dump "+l)}e.tag!==null&&e.tag!=="?"&&(d=encodeURI(e.tag[0]==="!"?e.tag.slice(1):e.tag).replace(/!/g,"%21"),e.tag[0]==="!"?d="!"+d:d.slice(0,18)==="tag:yaml.org,2002:"?d="!!"+d.slice(18):d="!<"+d+">",e.dump=d+" "+e.dump)}return!0}function epe(e,n){var r=[],i=[],s,a;for(Dj(e,r,i),s=0,a=i.length;s<a;s+=1)n.duplicates.push(r[i[s]]);n.usedDuplicates=new Array(a)}function Dj(e,n,r){var i,s,a;if(e!==null&&typeof e=="object")if(s=n.indexOf(e),s!==-1)r.indexOf(s)===-1&&r.push(s);else if(n.push(e),Array.isArray(e))for(s=0,a=e.length;s<a;s+=1)Dj(e[s],n,r);else for(i=Object.keys(e),s=0,a=i.length;s<a;s+=1)Dj(e[i[s]],n,r)}function tpe(e,n){n=n||{};var r=new Wfe(n);r.noRefs||epe(e,r);var i=e;return r.replacer&&(i=r.replacer.call({"":i},"",i)),Zl(r,0,i,!0,!0)?r.dump+`
`:""}var npe=tpe,rpe={dump:npe};function RA(e,n){return function(){throw new Error("Function yaml."+e+" is removed in js-yaml 4. Use yaml."+n+" instead, which is now safe by default.")}}var ipe=Mi,spe=i7,ape=l7,ope=f7,lpe=p7,cpe=EA,upe=R7.load,dpe=R7.loadAll,hpe=rpe.dump,fpe=ns,ppe={binary:_7,float:h7,map:o7,null:c7,pairs:b7,set:k7,timestamp:v7,bool:u7,int:d7,merge:y7,omap:x7,seq:a7,str:s7},mpe=RA("safeLoad","load"),gpe=RA("safeLoadAll","loadAll"),vpe=RA("safeDump","dump"),q7={Type:ipe,Schema:spe,FAILSAFE_SCHEMA:ape,JSON_SCHEMA:ope,CORE_SCHEMA:lpe,DEFAULT_SCHEMA:cpe,load:upe,loadAll:dpe,dump:hpe,YAMLException:fpe,types:ppe,safeLoad:mpe,safeLoadAll:gpe,safeDump:vpe};const ype=new Set(["template_name","agent_type","role","managed_agent_id","sidecar_id","artifact_path","exit_code","stderr_tail","skills","structured_output_missing"]),$D=/(^|[^A-Za-z0-9_.-])([A-Za-z0-9_-]+)\.output_data\.([A-Za-z_][A-Za-z0-9_]*)/g;function _pe(e){const n=[];if(!e)return n;$D.lastIndex=0;let r;for(;(r=$D.exec(e))!==null;){const i=r[2],s=r[3];!i||!s||n.push({stepId:i,field:s})}return n}function Pj(e,n){if(typeof e=="string"){n.push(e);return}if(Array.isArray(e)){for(const r of e)Pj(r,n);return}if(e&&typeof e=="object")for(const r of Object.values(e))Pj(r,n)}function xpe(e){const n=new Map,r=new Set(e.map(s=>s.id)),i=new Map;for(const s of e){n.set(s.id,s);const a=s.id.replace(/-/g,"_");a!==s.id&&i.set(a,(i.get(a)??0)+1)}for(const s of e){const a=s.id.replace(/-/g,"_");a!==s.id&&!r.has(a)&&i.get(a)===1&&n.set(a,s)}return n}function bpe(e){const n=[],r=xpe(e),i=new Set;for(const s of e){const a=[];Pj(s,a);for(const o of a)for(const l of _pe(o)){const u=r.get(l.stepId);if(!u||u.type!=="agent"||ype.has(l.field)||(u.agent_output_fields??[]).includes(l.field))continue;const d=`${s.id}|${u.id}|${l.field}`;i.has(d)||(i.add(d),n.push({consumerStepId:s.id,sourceStepId:u.id,field:l.field,message:`${u.id}.output_data.${l.field} is referenced by ${s.id}, but ${u.id} does not declare ${l.field} as a required structured output field.`}))}}return n}const kpe={research:"agent",code:"agent",review:"agent",deploy:"agent",test:"agent",build:"agent",notify:"notify",summarize:"agent",task:"agent",approve:"human_approval",gate:"conditional",human_input:"human_input",agent:"agent",parallel:"parallel",shell:"shell",goto:"goto",output:"output",conditional:"conditional",group_chat:"group_chat",supervisor:"supervisor",map_reduce:"map_reduce",handoff:"handoff",a2a:"a2a",resolve:"resolve",for_each:"for_each",kumiho_context:"kumiho_context",kumiho_bundle_update:"kumiho_bundle_update",kumiho_patch_apply:"kumiho_patch_apply",human_approval:"human_approval",python:"python",compute:"compute",email:"email",tag:"tag",deprecate:"deprecate",manus:"manus"};function wpe(e){return kpe[e]??e}const wt=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),Se=e=>{if(e!=null){if(typeof e=="string")return e;if(typeof e=="number"||typeof e=="boolean")return String(e)}},kn=e=>{if(typeof e=="number")return e;if(typeof e=="string"&&e.trim()!==""){const n=Number(e);return Number.isFinite(n)?n:void 0}},Sn=e=>{if(typeof e=="boolean")return e;if(typeof e=="string"){const n=e.toLowerCase();if(n==="true")return!0;if(n==="false")return!1}},Cn=e=>Array.isArray(e)?e.map(r=>Se(r)).filter(r=>!!r&&r.length>0):void 0,U7=e=>{if(wt(e))try{return JSON.parse(JSON.stringify(e))}catch{return{...e}}},_a=(e,n)=>{const r=e==null?void 0:e[n];return wt(r)?r:void 0},Spe=e=>{if(!wt(e))return;const n=kn(e.x),r=kn(e.y);if(!(n===void 0||r===void 0)&&!(!Number.isFinite(n)||!Number.isFinite(r)))return{x:n,y:r}},_b=e=>{if(!Number.isFinite(e))return 0;const n=Math.round(e*100)/100;return Object.is(n,-0)?0:n},Cpe=e=>({x:_b((e==null?void 0:e.x)??0),y:_b((e==null?void 0:e.y)??0)});function cg(e){var i;const n=e.goto.trim();return{condition:e.condition.trim()||(n?"default":""),goto:n,value:((i=e.value)==null?void 0:i.trim())||void 0}}function OA(e){return e.some(n=>n.position!==void 0)}function Ho(e){const n=q7.load(e);if(!wt(n))return[];const r=n.steps;if(!Array.isArray(r))return[];const i=[];for(const s of r){if(!wt(s))continue;const a=jpe(s);a&&i.push(a)}return i}function jpe(e){const n=Se(e.id);if(!n)return null;const r=Se(e.type)??Se(e.action)??Se(e.task)??"agent",i=wpe(r);let s=[];const a=e.depends_on??e.dependsOn??e.after;if(Array.isArray(a))s=Cn(a)??[];else{const R=Se(a);R&&(s=[R])}const o=e.agent_hints??e.agentHints;let l=[];if(Array.isArray(o))l=Cn(o)??[];else{const R=Se(o);R&&(l=[R])}let u=[];if(Array.isArray(e.skills))u=Cn(e.skills)??[];else{const R=Se(e.skills);R&&(u=[R])}let d;if(Array.isArray(e.channels))d=Cn(e.channels);else{const R=Se(e.channels);R&&(d=[R])}let p=0;const f=e.params??e.parameters??e.config;wt(f)&&(p=Object.keys(f).length);const g={id:n,name:Se(e.name)??n,description:Se(e.description)??Se(e.desc)??"",type:i,agent_hints:l,skills:u,depends_on:s,position:Spe(e.position),params:p>0?{_count:String(p)}:void 0,assign:Se(e.assign),disabled:Sn(e.disabled),compression:Sn(e.compression),retry:kn(e.retry),retry_delay:kn(e.retry_delay)??kn(e.retryDelay),channel:Se(e.channel),channels:d,condition:Se(e.condition),on_true:Se(e.on_true)??Se(e.onTrue),on_false:Se(e.on_false)??Se(e.onFalse),on_true_value:Se(e.on_true_value)??Se(e.onTrueValue),on_false_value:Se(e.on_false_value)??Se(e.onFalseValue)},_=wt(e.agent)?e.agent:void 0;if(_){g.agent_type=Se(_.agent_type),g.role=Se(_.role),g.template=Se(_.template),g.prompt=Se(_.prompt),g.timeout=kn(_.timeout),g.model=Se(_.model),g.agent_max_turns=kn(_.max_turns);const R=Se(_.tools);(R==="all"||R==="memory"||R==="google_agentops"||R==="none")&&(g.agent_tools=R),g.agent_required_tools=Cn(_.required_tools),g.agent_output_fields=Cn(_.output_fields);const q=wt(_.quality_check)?_.quality_check:void 0;q&&(g.agent_quality_enabled=Sn(q.enabled),g.agent_quality_threshold=kn(q.threshold),g.agent_quality_criteria=Cn(q.criteria),g.agent_quality_model=Se(q.model)),Se(_.auth)&&(g.auth=Se(_.auth))}const x=wt(e.parallel)?e.parallel:void 0;if(x){const R=Cn(x.steps);R&&R.length&&(g.parallel_steps=R),g.parallel_join=Se(x.join),g.parallel_max_concurrency=kn(x.max_concurrency)}const v=wt(e.goto)?e.goto:void 0;v&&(g.goto_target=Se(v.target),g.goto_max_iterations=kn(v.max_iterations),g.goto_condition=Se(v.condition));const S=wt(e.group_chat)?e.group_chat:void 0;S&&(g.group_chat_topic=Se(S.topic),g.group_chat_max_rounds=kn(S.max_rounds),g.group_chat_participants=Cn(S.participants),g.group_chat_moderator=Se(S.moderator),g.group_chat_strategy=Se(S.strategy),g.group_chat_timeout=kn(S.timeout));const w=wt(e.supervisor)?e.supervisor:void 0;w&&(g.supervisor_task=Se(w.task),g.supervisor_max_iterations=kn(w.max_iterations),g.supervisor_type=Se(w.supervisor_type),g.supervisor_templates=Cn(w.templates),g.supervisor_timeout=kn(w.timeout));const j=wt(e.shell)?e.shell:void 0;j&&(g.shell_command=Se(j.command),g.shell_timeout=kn(j.timeout),g.shell_allow_failure=Sn(j.allow_failure),Se(j.auth)&&(g.auth=Se(j.auth)));const C=wt(e.python)?e.python:void 0;if(C){g.python_script=Se(C.script),g.python_code=Se(C.code);const R=C.args;if(typeof R=="string")g.python_args=R;else if(R!=null)try{g.python_args=JSON.stringify(R)}catch{}g.python_interpreter=Se(C.python),g.python_timeout=kn(C.timeout),g.python_allow_failure=Sn(C.allow_failure),Se(C.auth)&&(g.auth=Se(C.auth))}const T=wt(e.compute)?e.compute:void 0;if(T&&wt(T.outputs)){const R={};for(const[q,W]of Object.entries(T.outputs)){const te=Se(W);te!==void 0&&(R[q]=te)}Object.keys(R).length>0&&(g.compute_outputs=R)}const E=wt(e.email)?e.email:void 0;if(E){g.email_to=Se(E.to),g.email_subject=Se(E.subject),g.email_body=Se(E.body),g.email_body_html=Se(E.body_html),g.email_from=Se(E.from_address);const R=Cn(E.cc);if(R)g.email_cc=R.join(", ");else{const W=Se(E.cc);W&&(g.email_cc=W)}const q=Cn(E.bcc);if(q)g.email_bcc=q.join(", ");else{const W=Se(E.bcc);W&&(g.email_bcc=W)}g.email_reply_to=Se(E.reply_to),g.email_track_clicks=Sn(E.track_clicks),g.email_track_kref=Se(E.track_kref),g.email_track_secret_env=Se(E.track_secret_env),g.email_track_base_url=Se(E.track_base_url),g.email_smtp_host=Se(E.smtp_host),g.email_smtp_port=kn(E.smtp_port),g.email_smtp_tls=Sn(E.smtp_tls),g.email_smtp_username=Se(E.smtp_username),g.email_smtp_password_env=Se(E.smtp_password_env),g.email_dry_run=Sn(E.dry_run),g.email_timeout=kn(E.timeout),Se(E.auth)&&(g.auth=Se(E.auth))}const A=wt(e.image)?e.image:void 0;if(A){g.image_prompt=Se(A.prompt),g.image_count=kn(A.count);const R=A.canvas;typeof R=="boolean"?g.image_canvas=R:typeof R=="string"&&(g.image_canvas=R,g.image_canvas_target=R),g.image_register_artifact=Sn(A.register_artifact),g.image_space=Se(A.space),g.image_item_name=Se(A.item_name),g.image_output_path=Se(A.output_path),g.image_output_pattern=Se(A.output_pattern);const q=Cn(A.input_images);if(q)g.image_input_images=q;else{const W=Se(A.input_images);W&&(g.image_input_images=[W])}g.image_sandbox=Se(A.sandbox),g.image_cwd=Se(A.cwd),g.image_timeout=kn(A.timeout)}const O=wt(e.output)?e.output:void 0;if(O&&(g.output_format=Se(O.format),g.output_template=Se(O.template),g.entity_name=Se(O.entity_name),g.entity_kind=Se(O.entity_kind),g.entity_tag=Se(O.entity_tag),g.entity_space=Se(O.entity_space),g.metadata_target=Se(O.metadata_target),g.artifact_summary_model=Se(O.artifact_summary_model),wt(O.entity_metadata))){const R={};for(const[q,W]of Object.entries(O.entity_metadata)){const te=Se(W);te!==void 0&&(R[q]=te)}Object.keys(R).length&&(g.entity_metadata=R)}const F=wt(e.notify)?e.notify:void 0;if(F){const R=Cn(F.channels);R&&R.length&&(g.channels=DA(R)),g.notify_channel_id=Se(F.channel_id),g.notify_message=Se(F.message),g.notify_title=Se(F.title)}const L=wt(e.handoff)?e.handoff:void 0;L&&(g.handoff_from=Se(L.from_step),g.handoff_to=Se(L.to_agent_type),g.handoff_reason=Se(L.reason),g.handoff_task=Se(L.task),g.handoff_timeout=kn(L.timeout));const $=wt(e.human_input)?e.human_input:void 0;$&&(g.human_input_message=Se($.message),g.human_input_timeout=kn($.timeout),Se($.channel)&&(g.channel=Se($.channel)));const z=wt(e.human_approval)?e.human_approval:void 0;z&&(g.human_approval_message=Se(z.message),g.human_approval_timeout=kn(z.timeout),g.human_approval_channel=Se(z.channel),g.human_approval_channel_id=Se(z.channel_id),g.human_approval_on_reject_goto=Se(z.on_reject_goto),g.human_approval_on_reject_max=kn(z.on_reject_max),g.human_approval_approve_keywords=Cn(z.approve_keywords),g.human_approval_reject_keywords=Cn(z.reject_keywords));const B=wt(e.a2a)?e.a2a:void 0;B&&(g.a2a_url=Se(B.url),g.a2a_skill_id=Se(B.skill_id),g.a2a_message=Se(B.message),g.a2a_timeout=kn(B.timeout),Se(B.cloud_run_auth)==="gcloud"&&(g.a2a_cloud_run_auth="gcloud"),g.a2a_cloud_run_config=Se(B.cloud_run_config),g.a2a_cloud_run_audience=Se(B.cloud_run_audience),g.a2a_cloud_run_auth_timeout=kn(B.cloud_run_auth_timeout),Se(B.auth)&&(g.auth=Se(B.auth)));const H=wt(e.map_reduce)?e.map_reduce:void 0;H&&(g.map_reduce_task=Se(H.task),g.map_reduce_mapper=Se(H.mapper),g.map_reduce_reducer=Se(H.reducer),g.map_reduce_concurrency=kn(H.concurrency),g.map_reduce_timeout=kn(H.timeout),g.map_reduce_splits=Cn(H.splits));const D=wt(e.for_each)?e.for_each:void 0;D&&(g.for_each_steps=Cn(D.steps),g.for_each_range=Se(D.range),g.for_each_items=Cn(D.items),g.for_each_variable=Se(D.variable),g.for_each_carry_forward=Sn(D.carry_forward),g.for_each_fail_fast=Sn(D.fail_fast),g.for_each_max_iterations=kn(D.max_iterations));const U=wt(e.resolve)?e.resolve:void 0;U&&(g.resolve_kind=Se(U.kind),g.resolve_tag=Se(U.tag),g.resolve_name_pattern=Se(U.name_pattern),g.resolve_space=Se(U.space),g.resolve_artifact_name=Se(U.artifact_name),g.resolve_mode=Se(U.mode),g.resolve_fields=Cn(U.fields),g.resolve_metadata_source=Se(U.metadata_source),g.resolve_fail_if_missing=Sn(U.fail_if_missing));const I=wt(e.kumiho)?e.kumiho:void 0;if(I){g.kumiho_config=U7(I),g.kumiho_project=Se(I.project),g.kumiho_mode=Se(I.mode);const R=_a(I,"seed");R&&(g.kumiho_seed_bundles=Cn(R.bundles),g.kumiho_seed_krefs=Cn(R.krefs),g.kumiho_seed_queries=Cn(R.queries),Array.isArray(R.items)&&(g.kumiho_seed_items=R.items));const q=_a(I,"traversal");q&&(g.kumiho_traversal_max_depth=kn(q.max_depth),g.kumiho_traversal_direction=Se(q.direction),g.kumiho_traversal_edge_types=Cn(q.edge_types));const W=_a(I,"filters");W&&(g.kumiho_filters_include_kinds=Cn(W.include_kinds),g.kumiho_filters_exclude_tags=Cn(W.exclude_tags),g.kumiho_filters_max_items=kn(W.max_items));const te=_a(I,"ranking");te&&(g.kumiho_ranking_method=Se(te.method),g.kumiho_ranking_semantic_query=Se(te.semantic_query));const J=_a(I,"lock");J&&(g.kumiho_lock_tag_preference=Cn(J.tag_preference));const G=_a(I,"output");G&&(g.kumiho_output_format=Se(G.format),g.kumiho_output_include_artifact_summaries=Sn(G.include_artifact_summaries),g.kumiho_output_include_artifact_content=Sn(G.include_artifact_content),g.kumiho_output_max_artifact_chars_per_item=kn(G.max_artifact_chars_per_item),g.kumiho_output_include_edge_map=Sn(G.include_edge_map),g.kumiho_output_include_conflict_warnings=Sn(G.include_conflict_warnings),g.kumiho_output_include_missing_context=Sn(G.include_missing_context)),g.kumiho_create_if_missing=Sn(I.create_if_missing),g.kumiho_idempotent=Sn(I.idempotent),g.kumiho_fail_if_missing_bundle=Sn(I.fail_if_missing_bundle),g.kumiho_fail_if_missing_item=Sn(I.fail_if_missing_item),g.kumiho_allow_protected=Sn(I.allow_protected),Array.isArray(I.updates)&&(g.kumiho_updates=I.updates),g.kumiho_patch_kref=Se(I.patch_kref),g.kumiho_dry_run=Sn(I.dry_run),g.kumiho_allow_auto_apply=Sn(I.allow_auto_apply);const re=_a(I,"approval");re&&(g.kumiho_approval_required=Sn(re.required),g.kumiho_approval_approved=typeof re.approved=="boolean"?re.approved:Se(re.approved),g.kumiho_approval_approved_by=Se(re.approved_by),g.kumiho_approval_note=Se(re.approval_note));const ne=_a(I,"apply");ne&&(g.kumiho_apply_create_revisions=Sn(ne.create_revisions),g.kumiho_apply_create_edges=Sn(ne.create_edges),g.kumiho_apply_update_tags=Sn(ne.update_tags),g.kumiho_apply_untag_previous_current=Sn(ne.untag_previous_current),g.kumiho_apply_update_bundles=Sn(ne.update_bundles),g.kumiho_apply_save_apply_report=Sn(ne.save_apply_report));const le=_a(I,"tag_policy");if(le){g.kumiho_new_revision_tags=Cn(le.new_revision_tags);const he=_a(le,"patch_tags");he&&(g.kumiho_patch_tags_remove=Cn(he.remove),g.kumiho_patch_tags_add=Cn(he.add))}const oe=_a(I,"bundle_policy");oe&&(g.kumiho_pending_patch_bundle=Se(oe.pending_patch_bundle),g.kumiho_applied_patch_bundle=Se(oe.applied_patch_bundle),g.kumiho_current_state_bundle=Se(oe.current_state_bundle),g.kumiho_active_storyline_bundle=Se(oe.active_storyline_bundle),g.kumiho_active_foreshadow_bundle=Se(oe.active_foreshadow_bundle),g.kumiho_timeline_bundle=Se(oe.timeline_bundle));const ie=_a(I,"evidence");ie&&(g.kumiho_require_evidence_locator=Sn(ie.require_evidence_locator),g.kumiho_source_episode_kref=Se(ie.source_episode_kref),g.kumiho_source_context_pack_kref=Se(ie.source_context_pack_kref))}const X=wt(e.tag_step)?e.tag_step:void 0;X&&(g.tag_item_kref=Se(X.item_kref),g.tag_value=Se(X.tag),g.tag_untag=Se(X.untag));const K=wt(e.deprecate_step)?e.deprecate_step:void 0;K&&(g.deprecate_item_kref=Se(K.item_kref),g.deprecate_reason=Se(K.reason));const Q=wt(e.manus)?e.manus:void 0;if(Q){if(g.manus_prompt=Se(Q.prompt),Q.structured_output_schema!==void 0&&Q.structured_output_schema!==null)try{g.manus_structured_output_schema=JSON.stringify(Q.structured_output_schema,null,2)}catch{}g.manus_connectors=Cn(Q.connectors),g.manus_enable_skills=Cn(Q.enable_skills),g.manus_force_skills=Cn(Q.force_skills),g.manus_agent_profile=Se(Q.agent_profile),g.manus_locale=Se(Q.locale),g.manus_project_id=Se(Q.project_id),g.manus_title=Se(Q.title),g.manus_timeout_seconds=kn(Q.timeout_seconds),g.manus_poll_interval_seconds=kn(Q.poll_interval_seconds),g.manus_allow_failure=Sn(Q.allow_failure),g.manus_credentials_ref=Se(Q.credentials_ref);const R=wt(Q.register_output)?Q.register_output:void 0;if(R){g.manus_register_enabled=!0,g.manus_register_entity_name=Se(R.entity_name),g.manus_register_entity_kind=Se(R.entity_kind);const q=Se(R.entity_tag);q&&(g.manus_register_entity_tag=q);const W=Se(R.entity_space);W&&(g.manus_register_entity_space=W),R.register_attachments===!1?g.manus_register_attachments=!1:R.register_attachments===!0&&(g.manus_register_attachments=!0);const te=Se(R.content_source);(te==="structured"||te==="message")&&(g.manus_register_content_source=te)}}const V=wt(e.conditional)?e.conditional:void 0;if(V&&Array.isArray(V.branches)){const R=[];for(const q of V.branches){if(!wt(q))continue;const W=Se(q.condition),te=Se(q.goto),J=Se(q.value);te&&R.push(cg({condition:W??"",goto:te,value:J||void 0}))}R.length>0&&(g.conditional_branches=R,Object.assign(g,K7(R)))}if(!g.auth){const R=Se(e.auth);R&&(g.auth=R)}return g}function lf(e){const n={name:"",version:"1.0",description:"",tags:[],triggers:[],inputs:[],outputs:[],defaultCwd:"",defaultTimeout:300,maxTotalTime:3600,checkpoint:!0},r=e.split(`
`);let i=0;for(;i<r.length;){const a=r[i].trim();if(/^steps\s*:/.test(a))break;const o=a.match(/^(\w[\w_]*):\s*(.*)/);if(o){const l=o[1],u=(o[2]??"").trim().replace(/^["']|["']$/g,"");if(l==="name")n.name=u;else if(l==="version")n.version=u;else if(l==="description")if(u.startsWith(">")||u.startsWith("|")){let d="";for(i++;i<r.length&&r[i].match(/^\s+\S/);)d+=(d?" ":"")+r[i].trim(),i++;n.description=d;continue}else n.description=u;else if(l==="tags")u.startsWith("[")&&(n.tags=u.slice(1,-1).split(",").map(d=>d.trim().replace(/["']/g,"")).filter(Boolean));else if(l==="default_cwd")n.defaultCwd=u;else if(l==="default_timeout")n.defaultTimeout=parseFloat(u)||300;else if(l==="max_total_time")n.maxTotalTime=parseFloat(u)||3600;else if(l==="checkpoint")n.checkpoint=u!=="false";else if(l==="triggers"){for(i++;i<r.length;){const d=r[i],p=d.trim();if(p.startsWith("- on_kind:")||p.startsWith("- cron:")){const f={onKind:"",onTag:"ready",onNamePattern:"",onSpace:"",inputMap:{}};for(p.startsWith("- on_kind:")?f.onKind=p.replace(/^-\s*on_kind:\s*/,"").replace(/["']/g,"").trim():p.startsWith("- cron:")&&(f.inputMap.__cron=p.replace(/^-\s*cron:\s*/,"").replace(/["']/g,"").trim()),i++;i<r.length;){const g=r[i].trim();if(!g||g.startsWith("- ")||!r[i].match(/^\s/))break;if(g.startsWith("#")){i++;continue}const _=g.match(/^(\w[\w_]*):\s*(.*)/);if(_){const x=_[1],v=(_[2]??"").trim().replace(/^["']|["']$/g,"");if(x==="on_tag")f.onTag=v;else if(x==="on_name_pattern")f.onNamePattern=v;else if(x==="on_space")f.onSpace=v;else if(x==="on_kind")f.onKind=v;else if(x==="cron")f.inputMap.__cron=v;else if(x==="input_map"){for(i++;i<r.length;){const S=r[i].trim();if(!S||!r[i].match(/^\s{4,}/))break;if(S.startsWith("#")){i++;continue}const w=S.match(/^(\w[\w_]*):\s*(.*)/);w&&(f.inputMap[w[1]]=(w[2]??"").trim().replace(/^["']|["']$/g,"")),i++}continue}}i++}n.triggers.push(f);continue}if(p&&!d.match(/^\s/)&&!p.startsWith("#"))break;if(!p){i++;continue}i++}continue}else if(l==="inputs"){for(i++;i<r.length;){const d=r[i],p=d.trim();if(p.startsWith("- name:")){const f={name:p.replace(/^-\s*name:\s*/,"").replace(/["']/g,"").trim(),type:"string",required:!0,default:"",description:""};for(i++;i<r.length;){const g=r[i].trim();if(!g||g.startsWith("- ")||!r[i].match(/^\s/))break;if(g.startsWith("#")){i++;continue}const _=g.match(/^(\w[\w_]*):\s*(.*)/);if(_){const x=_[1],v=(_[2]??"").trim().replace(/^["']|["']$/g,"");x==="type"?f.type=v:x==="required"?f.required=v!=="false":x==="default"?f.default=v:x==="description"&&(f.description=v)}i++}f.name&&n.inputs.push(f);continue}if(p&&!d.match(/^\s/)&&!p.startsWith("#"))break;i++}continue}else if(l==="outputs"){for(i++;i<r.length;){const d=r[i],p=d.trim();if(p.startsWith("- name:")){const f={name:p.replace(/^-\s*name:\s*/,"").replace(/["']/g,"").trim(),source:"",description:""};for(i++;i<r.length;){const g=r[i].trim();if(!g||g.startsWith("- ")||!r[i].match(/^\s/))break;if(g.startsWith("#")){i++;continue}const _=g.match(/^(\w[\w_]*):\s*(.*)/);if(_){const x=_[1],v=(_[2]??"").trim().replace(/^["']|["']$/g,"");x==="source"?f.source=v:x==="description"&&(f.description=v)}i++}n.outputs.push(f);continue}if(p&&!d.match(/^\s/)&&!p.startsWith("#"))break;i++}continue}}i++}return n}function DA(e){const n=new Set,r=[];for(const i of e){const s=i.toLowerCase();n.has(s)||(n.add(s),r.push(i))}return r}const pi={true:{stroke:"var(--revka-status-success)",strokeWidth:2},false:{stroke:"var(--revka-status-danger)",strokeWidth:2},default:{stroke:"var(--revka-signal-selected)",strokeWidth:2}};function au(e){return`branch-${e}`}function Pv(e){if(!e)return null;if(e==="true")return 0;if(e==="false")return 1;const n=/^branch-(\d+)$/.exec(e);return n?Number(n[1]):null}function cf(e){return e==="true"||e==="false"||Pv(e)!==null}function $0(e,n){return e.condition.trim()==="default"?"default":n===0?"true":`case ${n+1}`}function Bf(e,n){return e.condition.trim()==="default"?pi.false:n===0?pi.true:pi.default}function kS(e){return e==="true"?pi.true:e==="false"?pi.false:(Pv(e)!==null,pi.default)}function Nx(e){if(e.conditional_branches&&e.conditional_branches.length>0)return e.conditional_branches.map(cg).filter(r=>r.goto);const n=[];return e.condition&&e.on_true&&n.push(cg({condition:e.condition,goto:e.on_true,value:e.on_true_value||void 0})),e.on_false&&n.push(cg({condition:"default",goto:e.on_false,value:e.on_false_value||void 0})),n}function K7(e){const n=e.find(i=>i.condition!=="default"),r=e.find(i=>i.condition==="default")??e.find(i=>i!==n);return{condition:n==null?void 0:n.condition,on_true:n==null?void 0:n.goto,on_false:r==null?void 0:r.goto,on_true_value:n==null?void 0:n.value,on_false_value:r==null?void 0:r.value}}function md(e){const n=p=>p.type==="conditional",r=e.map((p,f)=>({id:p.id,type:n(p)?"gateNode":"taskNode",position:p.position??{x:0,y:f*150},width:n(p)?220:280,height:n(p)?Math.max(96,86+Nx(p).length*24):140,data:{label:p.name||p.id,taskId:p.id,name:p.name||p.id,description:p.description,type:p.type,agentHints:p.agent_hints,skills:p.skills,disabled:p.disabled??!1,compression:p.compression??!1,assign:p.assign||"",template:p.template||"",paramCount:p.params?Object.keys(p.params).length:0,dependencyCount:p.depends_on.length,condition:p.condition||"",onTrueValue:p.on_true_value||"",onFalseValue:p.on_false_value||"",conditionalBranches:Nx(p),channel:p.channel||"",channels:p.channels||[],agentType:p.agent_type||"",role:p.role||"",prompt:p.prompt||"",timeout:p.timeout||300,agentMaxTurns:p.agent_max_turns??3,agentTools:p.agent_tools??"none",agentRequiredTools:p.agent_required_tools||[],agentOutputFields:p.agent_output_fields||[],agentQualityEnabled:p.agent_quality_enabled??!1,agentQualityThreshold:p.agent_quality_threshold??.7,agentQualityCriteria:p.agent_quality_criteria||[],agentQualityModel:p.agent_quality_model||"claude-haiku-4-5-20251001",parallelJoin:p.parallel_join||"all",gotoTarget:p.goto_target||"",gotoMaxIterations:p.goto_max_iterations||3,groupChatTopic:p.group_chat_topic||"",groupChatParticipants:p.group_chat_participants||[],groupChatMaxRounds:p.group_chat_max_rounds||8,supervisorTask:p.supervisor_task||"",supervisorMaxIterations:p.supervisor_max_iterations||5,supervisorTemplates:p.supervisor_templates||[],shellCommand:p.shell_command||"",outputFormat:p.output_format||"markdown",entityName:p.entity_name||"",entityKind:p.entity_kind||"",entityTag:p.entity_tag||"",entitySpace:p.entity_space||"",entityMetadata:p.entity_metadata||{},entityMetadataTarget:p.metadata_target||"item",artifactSummaryModel:p.artifact_summary_model||"",handoffFrom:p.handoff_from||"",handoffTo:p.handoff_to||"",handoffReason:p.handoff_reason||"",retry:p.retry||0,retryDelay:p.retry_delay||5,model:p.model||"",shellTimeout:p.shell_timeout||60,shellAllowFailure:p.shell_allow_failure||!1,gotoCondition:p.goto_condition||"",parallelMaxConcurrency:p.parallel_max_concurrency||5,humanInputMessage:p.human_input_message||"",humanInputTimeout:p.human_input_timeout||3600,humanApprovalMessage:p.human_approval_message||"",humanApprovalTimeout:p.human_approval_timeout||3600,humanApprovalChannel:p.human_approval_channel||"dashboard",humanApprovalChannelId:p.human_approval_channel_id||"",humanApprovalOnRejectGoto:p.human_approval_on_reject_goto||"",humanApprovalOnRejectMax:p.human_approval_on_reject_max||3,humanApprovalApproveKeywords:p.human_approval_approve_keywords||["approve","approved","yes","lgtm"],humanApprovalRejectKeywords:p.human_approval_reject_keywords||["reject","rejected","no"],outputTemplate:p.output_template||"",a2aUrl:p.a2a_url||"",a2aSkillId:p.a2a_skill_id||"",a2aMessage:p.a2a_message||"",a2aTimeout:p.a2a_timeout||300,a2aCloudRunAuth:p.a2a_cloud_run_auth||"",a2aCloudRunConfig:p.a2a_cloud_run_config||"",a2aCloudRunAudience:p.a2a_cloud_run_audience||"",a2aCloudRunAuthTimeout:p.a2a_cloud_run_auth_timeout||20,mapReduceTask:p.map_reduce_task||"",mapReduceSplits:p.map_reduce_splits||[],mapReduceMapper:p.map_reduce_mapper||"claude",mapReduceReducer:p.map_reduce_reducer||"claude",mapReduceConcurrency:p.map_reduce_concurrency||3,mapReduceTimeout:p.map_reduce_timeout||300,supervisorType:p.supervisor_type||"claude",supervisorTimeout:p.supervisor_timeout||300,groupChatModerator:p.group_chat_moderator||"claude",groupChatStrategy:p.group_chat_strategy||"moderator_selected",groupChatTimeout:p.group_chat_timeout||120,handoffTask:p.handoff_task||"",handoffTimeout:p.handoff_timeout||300,resolveKind:p.resolve_kind??"",resolveTag:p.resolve_tag??"published",resolveNamePattern:p.resolve_name_pattern??"",resolveSpace:p.resolve_space??"",resolveArtifactName:p.resolve_artifact_name??"",resolveMode:p.resolve_mode??"latest",resolveFields:p.resolve_fields??[],resolveMetadataSource:p.resolve_metadata_source??"revision",resolveFailIfMissing:p.resolve_fail_if_missing??!0,kumihoConfig:p.kumiho_config??{},kumihoProject:p.kumiho_project??"",kumihoMode:p.kumiho_mode??(p.type==="kumiho_bundle_update"?"add_members":"graph_augmented_context"),kumihoSeedBundles:p.kumiho_seed_bundles??[],kumihoSeedKrefs:p.kumiho_seed_krefs??[],kumihoSeedQueries:p.kumiho_seed_queries??[],kumihoSeedItems:p.kumiho_seed_items??[],kumihoTraversalMaxDepth:p.kumiho_traversal_max_depth??2,kumihoTraversalDirection:p.kumiho_traversal_direction??"both",kumihoTraversalEdgeTypes:p.kumiho_traversal_edge_types??["DEPENDS_ON","REFERENCES","ADVANCES","UPDATES","CONTRADICTS"],kumihoFiltersIncludeKinds:p.kumiho_filters_include_kinds??[],kumihoFiltersExcludeTags:p.kumiho_filters_exclude_tags??["deprecated"],kumihoFiltersMaxItems:p.kumiho_filters_max_items??50,kumihoRankingMethod:p.kumiho_ranking_method??"hybrid",kumihoRankingSemanticQuery:p.kumiho_ranking_semantic_query??"",kumihoLockTagPreference:p.kumiho_lock_tag_preference??["current","active","production-ready","ready","published","latest"],kumihoOutputFormat:p.kumiho_output_format??"context_pack",kumihoOutputIncludeArtifactSummaries:p.kumiho_output_include_artifact_summaries??!0,kumihoOutputIncludeArtifactContent:p.kumiho_output_include_artifact_content??!1,kumihoOutputMaxArtifactCharsPerItem:p.kumiho_output_max_artifact_chars_per_item??3e3,kumihoOutputIncludeEdgeMap:p.kumiho_output_include_edge_map??!0,kumihoOutputIncludeConflictWarnings:p.kumiho_output_include_conflict_warnings??!0,kumihoOutputIncludeMissingContext:p.kumiho_output_include_missing_context??!0,kumihoCreateIfMissing:p.kumiho_create_if_missing??!1,kumihoIdempotent:p.kumiho_idempotent??!0,kumihoFailIfMissingBundle:p.kumiho_fail_if_missing_bundle??!0,kumihoFailIfMissingItem:p.kumiho_fail_if_missing_item??!0,kumihoAllowProtected:p.kumiho_allow_protected??!1,kumihoUpdates:p.kumiho_updates??[],kumihoPatchKref:p.kumiho_patch_kref??"",kumihoDryRun:p.kumiho_dry_run??!0,kumihoAllowAutoApply:p.kumiho_allow_auto_apply??!1,kumihoApprovalRequired:p.kumiho_approval_required??!0,kumihoApprovalApproved:p.kumiho_approval_approved??!1,kumihoApprovalApprovedBy:p.kumiho_approval_approved_by??"",kumihoApprovalNote:p.kumiho_approval_note??"",kumihoApplyCreateRevisions:p.kumiho_apply_create_revisions??!0,kumihoApplyCreateEdges:p.kumiho_apply_create_edges??!0,kumihoApplyUpdateTags:p.kumiho_apply_update_tags??!0,kumihoApplyUntagPreviousCurrent:p.kumiho_apply_untag_previous_current??!0,kumihoApplyUpdateBundles:p.kumiho_apply_update_bundles??!0,kumihoApplySaveApplyReport:p.kumiho_apply_save_apply_report??!0,kumihoNewRevisionTags:p.kumiho_new_revision_tags??["current","approved"],kumihoPatchTagsRemove:p.kumiho_patch_tags_remove??["candidate"],kumihoPatchTagsAdd:p.kumiho_patch_tags_add??["applied"],kumihoPendingPatchBundle:p.kumiho_pending_patch_bundle??"",kumihoAppliedPatchBundle:p.kumiho_applied_patch_bundle??"",kumihoCurrentStateBundle:p.kumiho_current_state_bundle??"",kumihoActiveStorylineBundle:p.kumiho_active_storyline_bundle??"",kumihoActiveForeshadowBundle:p.kumiho_active_foreshadow_bundle??"",kumihoTimelineBundle:p.kumiho_timeline_bundle??"",kumihoRequireEvidenceLocator:p.kumiho_require_evidence_locator??!0,kumihoSourceEpisodeKref:p.kumiho_source_episode_kref??"",kumihoSourceContextPackKref:p.kumiho_source_context_pack_kref??"",forEachSteps:p.for_each_steps||[],forEachRange:p.for_each_range||"",forEachItems:p.for_each_items||[],forEachVariable:p.for_each_variable||"item",forEachCarryForward:p.for_each_carry_forward??!0,forEachFailFast:p.for_each_fail_fast??!0,forEachMaxIterations:p.for_each_max_iterations||20,notifyMessage:p.notify_message||"",notifyTitle:p.notify_title||"",notifyChannelId:p.notify_channel_id||"",pythonScript:p.python_script||"",pythonCode:p.python_code||"",pythonArgs:p.python_args||"",pythonInterpreter:p.python_interpreter||"",pythonTimeout:p.python_timeout||60,pythonAllowFailure:p.python_allow_failure||!1,computeOutputs:p.compute_outputs||{},emailTo:p.email_to||"",emailSubject:p.email_subject||"",emailBody:p.email_body||"",emailBodyHtml:p.email_body_html||"",emailFrom:p.email_from||"",emailCc:p.email_cc||"",emailBcc:p.email_bcc||"",emailReplyTo:p.email_reply_to||"",emailTrackClicks:p.email_track_clicks||!1,emailTrackKref:p.email_track_kref||"",emailTrackSecretEnv:p.email_track_secret_env||"",emailTrackBaseUrl:p.email_track_base_url||"",emailSmtpHost:p.email_smtp_host||"",emailSmtpPort:p.email_smtp_port||0,emailSmtpTls:p.email_smtp_tls??!0,emailSmtpUsername:p.email_smtp_username||"",emailSmtpPasswordEnv:p.email_smtp_password_env||"",emailDryRun:p.email_dry_run||!1,emailTimeout:p.email_timeout||30,imagePrompt:p.image_prompt||"",imageCount:p.image_count??1,imageCanvas:p.image_canvas!==!1,imageCanvasTarget:p.image_canvas_target||(typeof p.image_canvas=="string"?p.image_canvas:""),imageRegisterArtifact:p.image_register_artifact!==!1,imageSpace:p.image_space||"",imageItemName:p.image_item_name||"",imageOutputPath:p.image_output_path||"",imageOutputPattern:p.image_output_pattern||"",imageInputImages:p.image_input_images||[],imageSandbox:p.image_sandbox||"",imageCwd:p.image_cwd||"",imageTimeout:p.image_timeout||1200,tagItemKref:p.tag_item_kref||"",tagValue:p.tag_value||"",tagUntag:p.tag_untag||"",deprecateItemKref:p.deprecate_item_kref||"",deprecateReason:p.deprecate_reason||"",manusPrompt:p.manus_prompt||"",manusStructuredOutputSchema:p.manus_structured_output_schema||"",manusConnectors:p.manus_connectors||[],manusEnableSkills:p.manus_enable_skills||[],manusForceSkills:p.manus_force_skills||[],manusAgentProfile:p.manus_agent_profile||"",manusLocale:p.manus_locale||"",manusProjectId:p.manus_project_id||"",manusTitle:p.manus_title||"",manusTimeoutSeconds:p.manus_timeout_seconds??600,manusPollIntervalSeconds:p.manus_poll_interval_seconds??5,manusAllowFailure:p.manus_allow_failure||!1,manusCredentialsRef:p.manus_credentials_ref||"",manusRegisterEnabled:p.manus_register_enabled===!0,manusRegisterEntityName:p.manus_register_entity_name||"",manusRegisterEntityKind:p.manus_register_entity_kind||"",manusRegisterEntityTag:p.manus_register_entity_tag||"",manusRegisterEntitySpace:p.manus_register_entity_space||"",manusRegisterAttachments:p.manus_register_attachments!==!1,manusRegisterContentSource:p.manus_register_content_source||"message",auth:p.auth||""}})),i=[],s=new Set(e.map(p=>p.id)),a=new Set,o=p=>{const f=`${p.source}:${p.sourceHandle??""}->${p.target}`;a.has(f)||(a.add(f),i.push(p))},l=new Map;for(const p of e)if(p.parallel_steps&&p.parallel_steps.length>0){const f=p.parallel_steps.filter(g=>s.has(g));f.length>0&&l.set(p.id,f)}const u=new Map,d=new Map;for(const p of e)if(p.for_each_steps&&p.for_each_steps.length>0){const f=p.for_each_steps.filter(g=>s.has(g));if(f.length>0){u.set(p.id,f);for(const g of f)d.set(g,p.id)}}for(const p of e)for(const f of p.depends_on){if(d.get(p.id)===f)continue;const g=l.get(f);if(g)for(const _ of g)o({id:`${_}->${p.id}`,source:_,target:p.id,type:"default",animated:!1,selectable:!0,interactionWidth:20,style:pi.default});else if(u.has(f)){const _=u.get(f),x=_[_.length-1];o({id:`${x}->${p.id}`,source:x,target:p.id,type:"default",animated:!1,selectable:!0,interactionWidth:20,style:pi.default})}else s.has(f)&&o({id:`${f}->${p.id}`,source:f,target:p.id,type:"default",animated:!1,selectable:!0,interactionWidth:20,style:pi.default})}for(const[p,f]of l)for(const g of f)o({id:`par:${p}->${g}`,source:p,target:g,type:"default",animated:!1,selectable:!0,interactionWidth:20,style:pi.default,data:{synthetic:!0}});for(const[p,f]of u)for(let g=0;g<f.length;g++){const _=f[g];if(g===0)o({id:`fe:${p}->${_}`,source:p,target:_,type:"default",animated:!1,selectable:!0,interactionWidth:20,style:{stroke:"var(--revka-signal-live)",strokeWidth:2},data:{synthetic:!0}});else{const x=f[g-1];o({id:`fe:${x}->${_}`,source:x,target:_,type:"default",animated:!1,selectable:!0,interactionWidth:20,style:{stroke:"var(--revka-signal-live)",strokeWidth:2},data:{synthetic:!0}})}}for(const p of e){if(!n(p))continue;Nx(p).forEach((g,_)=>{if(!s.has(g.goto))return;const x=au(_),v=Bf(g,_),S=$0(g,_);o({id:`${p.id}->${x}->${g.goto}`,source:p.id,sourceHandle:x,target:g.goto,type:"default",animated:!1,selectable:!0,interactionWidth:20,style:v,label:S,labelStyle:{fill:v.stroke,fontSize:10,fontWeight:600}})})}for(const p of e){const f=Rpe(p,s);for(const g of f)g!==p.id&&d.get(p.id)!==g&&o({id:`ref:${g}->${p.id}`,source:g,target:p.id,type:"default",animated:!1,selectable:!0,interactionWidth:20,style:pi.default,data:{inferred:"interpolation"}})}return{nodes:r,edges:i}}function Npe(e,n="kumiho_context"){var d;const r=wt(e.kumihoConfig)?U7(e.kumihoConfig)??{}:{};if(n==="kumiho_bundle_update")return{...r,project:e.kumihoProject||"",mode:e.kumihoMode||"add_members",create_if_missing:e.kumihoCreateIfMissing??!1,idempotent:e.kumihoIdempotent??!0,fail_if_missing_bundle:e.kumihoFailIfMissingBundle??!0,fail_if_missing_item:e.kumihoFailIfMissingItem??!0,allow_protected:e.kumihoAllowProtected??!1,updates:e.kumihoUpdates||[]};if(n==="kumiho_patch_apply"){const p=wt(r.approval)?{...r.approval}:{},f=wt(r.apply)?{...r.apply}:{},g=wt(r.tag_policy)?{...r.tag_policy}:{},_=wt(g.patch_tags)?{...g.patch_tags}:{},x=wt(r.bundle_policy)?{...r.bundle_policy}:{},v=wt(r.evidence)?{...r.evidence}:{};return p.required=e.kumihoApprovalRequired??!0,p.approved=e.kumihoApprovalApproved??!1,p.approved_by=e.kumihoApprovalApprovedBy||"",p.approval_note=e.kumihoApprovalNote||"",f.create_revisions=e.kumihoApplyCreateRevisions??!0,f.create_edges=e.kumihoApplyCreateEdges??!0,f.update_tags=e.kumihoApplyUpdateTags??!0,f.untag_previous_current=e.kumihoApplyUntagPreviousCurrent??!0,f.update_bundles=e.kumihoApplyUpdateBundles??!0,f.save_apply_report=e.kumihoApplySaveApplyReport??!0,g.new_revision_tags=e.kumihoNewRevisionTags||["current","approved"],_.remove=e.kumihoPatchTagsRemove||["candidate"],_.add=e.kumihoPatchTagsAdd||["applied"],g.patch_tags=_,x.pending_patch_bundle=e.kumihoPendingPatchBundle||"",x.applied_patch_bundle=e.kumihoAppliedPatchBundle||"",x.current_state_bundle=e.kumihoCurrentStateBundle||"",x.active_storyline_bundle=e.kumihoActiveStorylineBundle||"",x.active_foreshadow_bundle=e.kumihoActiveForeshadowBundle||"",x.timeline_bundle=e.kumihoTimelineBundle||"",v.require_evidence_locator=e.kumihoRequireEvidenceLocator??!0,v.source_episode_kref=e.kumihoSourceEpisodeKref||"",v.source_context_pack_kref=e.kumihoSourceContextPackKref||"",{...r,project:e.kumihoProject||"",patch_kref:e.kumihoPatchKref||"",dry_run:e.kumihoDryRun??!0,allow_auto_apply:e.kumihoAllowAutoApply??!1,approval:p,apply:f,tag_policy:g,bundle_policy:x,evidence:v}}const i=wt(r.seed)?{...r.seed}:{},s=wt(r.traversal)?{...r.traversal}:{},a=wt(r.filters)?{...r.filters}:{},o=wt(r.ranking)?{...r.ranking}:{},l=wt(r.lock)?{...r.lock}:{},u=wt(r.output)?{...r.output}:{};return i.bundles=e.kumihoSeedBundles||[],i.krefs=e.kumihoSeedKrefs||[],i.queries=e.kumihoSeedQueries||[],(d=e.kumihoSeedItems)!=null&&d.length&&(i.items=e.kumihoSeedItems),s.max_depth=e.kumihoTraversalMaxDepth??2,s.direction=e.kumihoTraversalDirection||"both",s.edge_types=e.kumihoTraversalEdgeTypes||[],a.include_kinds=e.kumihoFiltersIncludeKinds||[],a.exclude_tags=e.kumihoFiltersExcludeTags||["deprecated"],a.max_items=e.kumihoFiltersMaxItems??50,o.method=e.kumihoRankingMethod||"hybrid",o.semantic_query=e.kumihoRankingSemanticQuery||"",o.prefer_recent=o.prefer_recent??!0,o.prefer_current_tags=o.prefer_current_tags??!0,l.revisions=l.revisions??!0,l.tag_preference=e.kumihoLockTagPreference||[],u.format=e.kumihoOutputFormat||"context_pack",u.include_artifact_summaries=e.kumihoOutputIncludeArtifactSummaries??!0,u.include_artifact_content=e.kumihoOutputIncludeArtifactContent??!1,u.max_artifact_chars_per_item=e.kumihoOutputMaxArtifactCharsPerItem??3e3,u.include_edge_map=e.kumihoOutputIncludeEdgeMap??!0,u.include_conflict_warnings=e.kumihoOutputIncludeConflictWarnings??!0,u.include_missing_context=e.kumihoOutputIncludeMissingContext??!0,{...r,project:e.kumihoProject||"",mode:e.kumihoMode||"graph_augmented_context",seed:i,traversal:s,filters:a,ranking:o,lock:l,output:u}}const Epe=["prompt","shell_command","python_code","python_args","python_script","email_body","email_body_html","email_subject","email_to","email_cc","email_bcc","image_prompt","output_template","entity_name","entity_kind","entity_tag","entity_space","resolve_kind","resolve_tag","resolve_name_pattern","resolve_space","resolve_artifact_name","condition","goto_condition","human_input_message","human_approval_message","notify_message","notify_title","group_chat_topic","supervisor_task","a2a_url","a2a_message","a2a_cloud_run_config","a2a_cloud_run_audience","map_reduce_task","handoff_reason","manus_prompt","manus_title"],FD=new Set(["input","inputs","trigger","env","outputs","context","loop","for_each","previous","rejection","run_id"]),HD=/\$\{(?!\{)([a-zA-Z_][a-zA-Z0-9_-]*)(?:\.[a-zA-Z_][a-zA-Z0-9_.-]*)?\}/g,WD=/\$\{\{\s*([\s\S]*?)\s*\}\}/g;function Ape(e){return/[A-Za-z_]/.test(e)}function Tpe(e){return/[A-Za-z0-9_-]/.test(e)}function Mpe(e){const n=new Set;let r=null;for(let i=0;i<e.length;){const s=e[i];if(r){if(s==="\\"){i+=2;continue}s===r&&(r=null),i+=1;continue}if(s==='"'||s==="'"){r=s,i+=1;continue}if(!Ape(s)){i+=1;continue}const a=i;for(i+=1;i<e.length&&Tpe(e[i]);)i+=1;const o=e.slice(a,i),l=a>0?e[a-1]:"";if(l&&/[A-Za-z0-9_.]/.test(l))continue;let u=i;for(;u<e.length&&/\s/.test(e[u]);)u+=1;e[u]==="."&&n.add(o)}return[...n]}function v_(e,n,r,i){HD.lastIndex=0;let s;for(;(s=HD.exec(e))!==null;){const o=s[1],l=i.get(o)??o;FD.has(o)||n.has(l)&&r.add(l)}WD.lastIndex=0;let a;for(;(a=WD.exec(e))!==null;){const o=a[1]??"";for(const l of Mpe(o)){const u=i.get(l)??l;FD.has(l)||n.has(u)&&r.add(u)}}}function Rpe(e,n){const r=new Set,i=new Map;for(const s of n){const a=s.replace(/-/g,"_");a!==s&&!n.has(a)&&i.set(a,s)}for(const s of Epe){const a=e[s];typeof a!="string"||!a||v_(a,n,r,i)}if(e.compute_outputs)for(const s of Object.values(e.compute_outputs))typeof s=="string"&&s&&v_(s,n,r,i);if(e.entity_metadata)for(const s of Object.values(e.entity_metadata))typeof s=="string"&&s&&v_(s,n,r,i);if(e.kumiho_config){const s=a=>{typeof a=="string"&&a?v_(a,n,r,i):Array.isArray(a)?a.forEach(s):wt(a)&&Object.values(a).forEach(s)};s(e.kumiho_config)}return r}function Ope(e,n){const r=new Map(e.map(u=>[u.id,u]));if(!r.has(n))return[];const i=new Map;for(const u of e){if(u.type==="parallel"&&u.parallel_steps)for(const d of u.parallel_steps)i.has(d)||i.set(d,new Set),i.get(d).add(u.id);if(u.type==="for_each"&&u.for_each_steps)for(const d of u.for_each_steps)i.has(d)||i.set(d,new Set),i.get(d).add(u.id)}const s=new Set,a=new Set,o=[n];for(;o.length>0;){const u=o.pop();if(a.has(u))continue;a.add(u);const d=r.get(u);if(!d)continue;for(const f of d.depends_on){const g=r.get(f);g&&(g.type==="parallel"||g.type==="for_each")&&s.add(f),!a.has(f)&&r.has(f)&&o.push(f)}const p=i.get(u);if(p)for(const f of p)a.has(f)||o.push(f)}const l=[];for(const u of s){const d=r.get(u);if(d){if(d.type==="parallel"&&d.parallel_steps)for(const p of d.parallel_steps)a.has(p)||l.push(p);if(d.type==="for_each"&&d.for_each_steps)for(const p of d.for_each_steps)a.has(p)||l.push(p)}}for(;l.length>0;){const u=l.pop();if(a.has(u))continue;a.add(u);const d=r.get(u);if(!d)continue;for(const f of d.depends_on){const g=r.get(f);if(g&&(g.type==="parallel"||g.type==="for_each")&&!s.has(f)){if(s.add(f),g.type==="parallel"&&g.parallel_steps)for(const _ of g.parallel_steps)a.has(_)||l.push(_);if(g.type==="for_each"&&g.for_each_steps)for(const _ of g.for_each_steps)a.has(_)||l.push(_)}!a.has(f)&&r.has(f)&&l.push(f)}const p=i.get(u);if(p)for(const f of p)a.has(f)||l.push(f)}return e.filter(u=>a.has(u.id)).map(u=>u.id)}function To(e,n){const r=new Map,i=new Map,s=new Map,a=new Map,o=new Map,l=new Set(e.filter(p=>p.data.type==="parallel").map(p=>p.id)),u=new Map(e.map(p=>[p.id,p.data.taskId])),d=new Map;for(const p of e)if(p.data.type==="for_each")for(const f of p.data.forEachSteps??[])d.set(f,p.id);for(const p of n){const f=p.data;if((f==null?void 0:f.inferred)==="interpolation")continue;if(l.has(p.source)){const _=u.get(p.target);if(_){const x=o.get(p.source)||[];x.includes(_)||x.push(_),o.set(p.source,x)}continue}if(f!=null&&f.synthetic)continue;const g=Pv(p.sourceHandle);if(g!==null){const _=a.get(p.source)??new Map;_.set(g,p.target),a.set(p.source,_)}else if(p.sourceHandle==="true")i.set(p.source,p.target);else if(p.sourceHandle==="false")s.set(p.source,p.target);else{const _=u.get(p.target)??p.target;if(d.get(_)===p.source)continue;const x=r.get(p.target)||[];x.push(p.source),r.set(p.target,x)}}return e.map(p=>{var S,w,j,C,T,E,A,O,F,L;const f=p.data,g=f.type||"agent",_=g==="conditional"?(()=>{const $=(f.conditionalBranches&&f.conditionalBranches.length>0?f.conditionalBranches:[...f.condition?[{condition:f.condition,goto:"",value:f.onTrueValue||void 0}]:[],...f.onFalseValue?[{condition:"default",goto:"",value:f.onFalseValue}]:[]]).map(D=>({...D})),z=a.get(p.id);if(z)for(const[D,U]of z)$[D]&&($[D]={...$[D],goto:U});const B=i.get(p.id);if(B){const D=$.findIndex(U=>U.condition!=="default");D>=0?$[D]={...$[D],goto:B}:$.unshift({condition:f.condition||"true",goto:B,value:f.onTrueValue||void 0})}const H=s.get(p.id);if(H){const D=$.findIndex(U=>U.condition==="default");D>=0?$[D]={...$[D],goto:H}:$.push({condition:"default",goto:H,value:f.onFalseValue||void 0})}return $.map(cg).filter(D=>D.goto)})():[],x=K7(_),v={id:f.taskId,name:f.name,description:f.description,type:g,agent_hints:f.agentHints,skills:f.skills,depends_on:r.get(p.id)||[],position:Cpe(p.position),condition:g==="conditional"?x.condition:void 0,on_true:g==="conditional"?x.on_true:void 0,on_false:g==="conditional"?x.on_false:void 0,conditional_branches:g==="conditional"&&_.length>0?_:void 0,on_true_value:g==="conditional"?x.on_true_value:void 0,on_false_value:g==="conditional"?x.on_false_value:void 0,channel:g==="human_input"&&f.channel?f.channel:void 0,channels:g==="notify"&&f.channels.length>0?DA(f.channels):void 0,notify_message:g==="notify"&&f.notifyMessage?f.notifyMessage:void 0,notify_title:g==="notify"&&f.notifyTitle?f.notifyTitle:void 0,notify_channel_id:g==="notify"&&f.notifyChannelId?f.notifyChannelId:void 0,retry:f.retry>0?f.retry:void 0,retry_delay:f.retryDelay!==5?f.retryDelay:void 0,disabled:f.disabled===!0?!0:void 0,compression:f.compression===!0?!0:void 0,auth:["agent","shell","python","email","a2a"].includes(g)&&f.auth?f.auth:void 0};if(g==="agent"&&(f.agentType&&(v.agent_type=f.agentType),f.role&&(v.role=f.role),f.prompt&&(v.prompt=f.prompt),f.timeout&&f.timeout!==300&&(v.timeout=f.timeout),f.assign&&(v.assign=f.assign),f.template&&(v.template=f.template),f.model&&(v.model=f.model),f.agentMaxTurns&&f.agentMaxTurns!==3&&(v.agent_max_turns=f.agentMaxTurns),f.agentTools&&f.agentTools!=="none"&&(v.agent_tools=f.agentTools),(S=f.agentRequiredTools)!=null&&S.length&&(v.agent_required_tools=f.agentRequiredTools),(w=f.agentOutputFields)!=null&&w.length&&(v.agent_output_fields=f.agentOutputFields),f.agentQualityEnabled&&(v.agent_quality_enabled=!0,v.agent_quality_threshold=f.agentQualityThreshold||.7,(j=f.agentQualityCriteria)!=null&&j.length&&(v.agent_quality_criteria=f.agentQualityCriteria),f.agentQualityModel&&(v.agent_quality_model=f.agentQualityModel))),g==="parallel"){v.parallel_join=f.parallelJoin||"all",v.parallel_max_concurrency=f.parallelMaxConcurrency||5;const $=o.get(p.id);$&&$.length>0&&(v.parallel_steps=$)}return g==="goto"&&(f.gotoTarget&&(v.goto_target=f.gotoTarget),f.gotoMaxIterations&&(v.goto_max_iterations=f.gotoMaxIterations),f.gotoCondition&&(v.goto_condition=f.gotoCondition)),g==="group_chat"&&(f.groupChatTopic&&(v.group_chat_topic=f.groupChatTopic),f.groupChatParticipants.length>0&&(v.group_chat_participants=f.groupChatParticipants),f.groupChatMaxRounds&&(v.group_chat_max_rounds=f.groupChatMaxRounds),f.groupChatModerator!=="claude"&&(v.group_chat_moderator=f.groupChatModerator),f.groupChatStrategy!=="moderator_selected"&&(v.group_chat_strategy=f.groupChatStrategy),f.groupChatTimeout!==120&&(v.group_chat_timeout=f.groupChatTimeout)),g==="supervisor"&&(f.supervisorTask&&(v.supervisor_task=f.supervisorTask),f.supervisorMaxIterations&&(v.supervisor_max_iterations=f.supervisorMaxIterations),f.supervisorType!=="claude"&&(v.supervisor_type=f.supervisorType),(C=f.supervisorTemplates)!=null&&C.length&&(v.supervisor_templates=f.supervisorTemplates),f.supervisorTimeout!==300&&(v.supervisor_timeout=f.supervisorTimeout)),g==="shell"&&(f.shellCommand&&(v.shell_command=f.shellCommand),f.shellTimeout&&f.shellTimeout!==60&&(v.shell_timeout=f.shellTimeout),f.shellAllowFailure&&(v.shell_allow_failure=!0)),g==="python"&&(f.pythonScript&&(v.python_script=f.pythonScript),f.pythonCode&&(v.python_code=f.pythonCode),f.pythonArgs&&(v.python_args=f.pythonArgs),f.pythonInterpreter&&(v.python_interpreter=f.pythonInterpreter),f.pythonTimeout&&f.pythonTimeout!==60&&(v.python_timeout=f.pythonTimeout),f.pythonAllowFailure&&(v.python_allow_failure=!0)),g==="compute"&&Object.keys(f.computeOutputs).length>0&&(v.compute_outputs=f.computeOutputs),g==="email"&&(f.emailTo&&(v.email_to=f.emailTo),f.emailSubject&&(v.email_subject=f.emailSubject),f.emailBody&&(v.email_body=f.emailBody),f.emailBodyHtml&&(v.email_body_html=f.emailBodyHtml),f.emailFrom&&(v.email_from=f.emailFrom),f.emailCc&&(v.email_cc=f.emailCc),f.emailBcc&&(v.email_bcc=f.emailBcc),f.emailReplyTo&&(v.email_reply_to=f.emailReplyTo),f.emailTrackClicks&&(v.email_track_clicks=!0),f.emailTrackKref&&(v.email_track_kref=f.emailTrackKref),f.emailTrackSecretEnv&&(v.email_track_secret_env=f.emailTrackSecretEnv),f.emailTrackBaseUrl&&(v.email_track_base_url=f.emailTrackBaseUrl),f.emailSmtpHost&&(v.email_smtp_host=f.emailSmtpHost),f.emailSmtpPort&&(v.email_smtp_port=f.emailSmtpPort),f.emailSmtpTls===!1&&(v.email_smtp_tls=!1),f.emailSmtpUsername&&(v.email_smtp_username=f.emailSmtpUsername),f.emailSmtpPasswordEnv&&(v.email_smtp_password_env=f.emailSmtpPasswordEnv),f.emailDryRun&&(v.email_dry_run=!0),f.emailTimeout&&f.emailTimeout!==30&&(v.email_timeout=f.emailTimeout)),g==="image"&&(f.imagePrompt&&(v.image_prompt=f.imagePrompt),f.imageCount&&f.imageCount!==1&&(v.image_count=f.imageCount),f.imageCanvasTarget&&(v.image_canvas=f.imageCanvasTarget),f.imageCanvas===!1&&(v.image_canvas=!1),f.imageRegisterArtifact===!1&&(v.image_register_artifact=!1),f.imageSpace&&(v.image_space=f.imageSpace),f.imageItemName&&(v.image_item_name=f.imageItemName),f.imageOutputPath&&(v.image_output_path=f.imageOutputPath),f.imageOutputPattern&&(v.image_output_pattern=f.imageOutputPattern),Array.isArray(f.imageInputImages)&&f.imageInputImages.length>0&&(v.image_input_images=f.imageInputImages),f.imageSandbox&&(v.image_sandbox=f.imageSandbox),f.imageCwd&&(v.image_cwd=f.imageCwd),f.imageTimeout&&f.imageTimeout!==1200&&(v.image_timeout=f.imageTimeout)),g==="output"&&(f.outputFormat&&(v.output_format=f.outputFormat),f.outputTemplate&&(v.output_template=f.outputTemplate),f.entityName&&(v.entity_name=f.entityName),f.entityKind&&(v.entity_kind=f.entityKind),f.entityTag&&(v.entity_tag=f.entityTag),f.entitySpace&&(v.entity_space=f.entitySpace),Object.keys(f.entityMetadata).length>0&&(v.entity_metadata=f.entityMetadata),f.entityMetadataTarget&&f.entityMetadataTarget!=="item"&&(v.metadata_target=f.entityMetadataTarget),f.artifactSummaryModel&&(v.artifact_summary_model=f.artifactSummaryModel)),g==="handoff"&&(f.handoffFrom&&(v.handoff_from=f.handoffFrom),f.handoffTo&&(v.handoff_to=f.handoffTo),f.handoffReason&&(v.handoff_reason=f.handoffReason),f.handoffTask&&(v.handoff_task=f.handoffTask),f.handoffTimeout!==300&&(v.handoff_timeout=f.handoffTimeout)),g==="human_input"&&(f.humanInputMessage&&(v.human_input_message=f.humanInputMessage),f.humanInputTimeout&&f.humanInputTimeout!==3600&&(v.human_input_timeout=f.humanInputTimeout)),g==="human_approval"&&(f.humanApprovalMessage&&(v.human_approval_message=f.humanApprovalMessage),f.humanApprovalTimeout&&f.humanApprovalTimeout!==3600&&(v.human_approval_timeout=f.humanApprovalTimeout),f.humanApprovalChannel&&f.humanApprovalChannel!=="dashboard"&&(v.human_approval_channel=f.humanApprovalChannel),f.humanApprovalChannelId&&(v.human_approval_channel_id=f.humanApprovalChannelId),f.humanApprovalOnRejectGoto&&(v.human_approval_on_reject_goto=f.humanApprovalOnRejectGoto),f.humanApprovalOnRejectMax&&f.humanApprovalOnRejectMax!==3&&(v.human_approval_on_reject_max=f.humanApprovalOnRejectMax),(T=f.humanApprovalApproveKeywords)!=null&&T.length&&(v.human_approval_approve_keywords=f.humanApprovalApproveKeywords),(E=f.humanApprovalRejectKeywords)!=null&&E.length&&(v.human_approval_reject_keywords=f.humanApprovalRejectKeywords)),g==="a2a"&&(f.a2aUrl&&(v.a2a_url=f.a2aUrl),f.a2aSkillId&&(v.a2a_skill_id=f.a2aSkillId),f.a2aMessage&&(v.a2a_message=f.a2aMessage),f.a2aTimeout&&f.a2aTimeout!==300&&(v.a2a_timeout=f.a2aTimeout),f.a2aCloudRunAuth==="gcloud"&&(v.a2a_cloud_run_auth="gcloud"),f.a2aCloudRunConfig&&(v.a2a_cloud_run_config=f.a2aCloudRunConfig),f.a2aCloudRunAudience&&(v.a2a_cloud_run_audience=f.a2aCloudRunAudience),f.a2aCloudRunAuthTimeout&&f.a2aCloudRunAuthTimeout!==20&&(v.a2a_cloud_run_auth_timeout=f.a2aCloudRunAuthTimeout)),g==="map_reduce"&&(f.mapReduceTask&&(v.map_reduce_task=f.mapReduceTask),f.mapReduceSplits.length>0&&(v.map_reduce_splits=f.mapReduceSplits),f.mapReduceMapper!=="claude"&&(v.map_reduce_mapper=f.mapReduceMapper),f.mapReduceReducer!=="claude"&&(v.map_reduce_reducer=f.mapReduceReducer),f.mapReduceConcurrency!==3&&(v.map_reduce_concurrency=f.mapReduceConcurrency),f.mapReduceTimeout!==300&&(v.map_reduce_timeout=f.mapReduceTimeout)),g==="resolve"&&(f.resolveKind&&(v.resolve_kind=f.resolveKind),f.resolveTag&&(v.resolve_tag=f.resolveTag),f.resolveNamePattern&&(v.resolve_name_pattern=f.resolveNamePattern),f.resolveSpace&&(v.resolve_space=f.resolveSpace),f.resolveArtifactName&&(v.resolve_artifact_name=f.resolveArtifactName),f.resolveMode&&(v.resolve_mode=f.resolveMode),(A=f.resolveFields)!=null&&A.length&&(v.resolve_fields=f.resolveFields),f.resolveMetadataSource&&f.resolveMetadataSource!=="revision"&&(v.resolve_metadata_source=f.resolveMetadataSource),f.resolveFailIfMissing===!1&&(v.resolve_fail_if_missing=!1)),(g==="kumiho_context"||g==="kumiho_bundle_update"||g==="kumiho_patch_apply")&&(v.kumiho_config=Npe(f,g),v.kumiho_project=f.kumihoProject,v.kumiho_mode=f.kumihoMode,v.kumiho_seed_bundles=f.kumihoSeedBundles,v.kumiho_seed_krefs=f.kumihoSeedKrefs,v.kumiho_seed_queries=f.kumihoSeedQueries,v.kumiho_seed_items=f.kumihoSeedItems,v.kumiho_traversal_max_depth=f.kumihoTraversalMaxDepth,v.kumiho_traversal_direction=f.kumihoTraversalDirection,v.kumiho_traversal_edge_types=f.kumihoTraversalEdgeTypes,v.kumiho_filters_include_kinds=f.kumihoFiltersIncludeKinds,v.kumiho_filters_exclude_tags=f.kumihoFiltersExcludeTags,v.kumiho_filters_max_items=f.kumihoFiltersMaxItems,v.kumiho_ranking_method=f.kumihoRankingMethod,v.kumiho_ranking_semantic_query=f.kumihoRankingSemanticQuery,v.kumiho_lock_tag_preference=f.kumihoLockTagPreference,v.kumiho_output_format=f.kumihoOutputFormat,v.kumiho_output_include_artifact_summaries=f.kumihoOutputIncludeArtifactSummaries,v.kumiho_output_include_artifact_content=f.kumihoOutputIncludeArtifactContent,v.kumiho_output_max_artifact_chars_per_item=f.kumihoOutputMaxArtifactCharsPerItem,v.kumiho_output_include_edge_map=f.kumihoOutputIncludeEdgeMap,v.kumiho_output_include_conflict_warnings=f.kumihoOutputIncludeConflictWarnings,v.kumiho_output_include_missing_context=f.kumihoOutputIncludeMissingContext,v.kumiho_create_if_missing=f.kumihoCreateIfMissing,v.kumiho_idempotent=f.kumihoIdempotent,v.kumiho_fail_if_missing_bundle=f.kumihoFailIfMissingBundle,v.kumiho_fail_if_missing_item=f.kumihoFailIfMissingItem,v.kumiho_allow_protected=f.kumihoAllowProtected,v.kumiho_updates=f.kumihoUpdates,v.kumiho_patch_kref=f.kumihoPatchKref,v.kumiho_dry_run=f.kumihoDryRun,v.kumiho_allow_auto_apply=f.kumihoAllowAutoApply,v.kumiho_approval_required=f.kumihoApprovalRequired,v.kumiho_approval_approved=f.kumihoApprovalApproved,v.kumiho_approval_approved_by=f.kumihoApprovalApprovedBy,v.kumiho_approval_note=f.kumihoApprovalNote,v.kumiho_apply_create_revisions=f.kumihoApplyCreateRevisions,v.kumiho_apply_create_edges=f.kumihoApplyCreateEdges,v.kumiho_apply_update_tags=f.kumihoApplyUpdateTags,v.kumiho_apply_untag_previous_current=f.kumihoApplyUntagPreviousCurrent,v.kumiho_apply_update_bundles=f.kumihoApplyUpdateBundles,v.kumiho_apply_save_apply_report=f.kumihoApplySaveApplyReport,v.kumiho_new_revision_tags=f.kumihoNewRevisionTags,v.kumiho_patch_tags_remove=f.kumihoPatchTagsRemove,v.kumiho_patch_tags_add=f.kumihoPatchTagsAdd,v.kumiho_pending_patch_bundle=f.kumihoPendingPatchBundle,v.kumiho_applied_patch_bundle=f.kumihoAppliedPatchBundle,v.kumiho_current_state_bundle=f.kumihoCurrentStateBundle,v.kumiho_active_storyline_bundle=f.kumihoActiveStorylineBundle,v.kumiho_active_foreshadow_bundle=f.kumihoActiveForeshadowBundle,v.kumiho_timeline_bundle=f.kumihoTimelineBundle,v.kumiho_require_evidence_locator=f.kumihoRequireEvidenceLocator,v.kumiho_source_episode_kref=f.kumihoSourceEpisodeKref,v.kumiho_source_context_pack_kref=f.kumihoSourceContextPackKref),g==="for_each"&&(f.forEachSteps.length>0&&(v.for_each_steps=f.forEachSteps),f.forEachRange&&(v.for_each_range=f.forEachRange),f.forEachItems.length>0&&(v.for_each_items=f.forEachItems),f.forEachVariable&&f.forEachVariable!=="item"&&(v.for_each_variable=f.forEachVariable),f.forEachCarryForward||(v.for_each_carry_forward=!1),f.forEachFailFast||(v.for_each_fail_fast=!1),f.forEachMaxIterations&&f.forEachMaxIterations!==20&&(v.for_each_max_iterations=f.forEachMaxIterations)),g==="tag"&&(f.tagItemKref&&(v.tag_item_kref=f.tagItemKref),f.tagValue&&(v.tag_value=f.tagValue),f.tagUntag&&(v.tag_untag=f.tagUntag)),g==="deprecate"&&(f.deprecateItemKref&&(v.deprecate_item_kref=f.deprecateItemKref),f.deprecateReason&&(v.deprecate_reason=f.deprecateReason)),g==="manus"&&(f.manusPrompt&&(v.manus_prompt=f.manusPrompt),f.manusStructuredOutputSchema&&(v.manus_structured_output_schema=f.manusStructuredOutputSchema),(O=f.manusConnectors)!=null&&O.length&&(v.manus_connectors=f.manusConnectors),(F=f.manusEnableSkills)!=null&&F.length&&(v.manus_enable_skills=f.manusEnableSkills),(L=f.manusForceSkills)!=null&&L.length&&(v.manus_force_skills=f.manusForceSkills),f.manusAgentProfile&&(v.manus_agent_profile=f.manusAgentProfile),f.manusLocale&&(v.manus_locale=f.manusLocale),f.manusProjectId&&(v.manus_project_id=f.manusProjectId),f.manusTitle&&(v.manus_title=f.manusTitle),f.manusTimeoutSeconds&&f.manusTimeoutSeconds!==600&&(v.manus_timeout_seconds=f.manusTimeoutSeconds),f.manusPollIntervalSeconds&&f.manusPollIntervalSeconds!==5&&(v.manus_poll_interval_seconds=f.manusPollIntervalSeconds),f.manusAllowFailure&&(v.manus_allow_failure=!0),f.manusCredentialsRef&&(v.manus_credentials_ref=f.manusCredentialsRef),f.manusRegisterEnabled===!0&&(v.manus_register_enabled=!0,v.manus_register_entity_name=f.manusRegisterEntityName||"",v.manus_register_entity_kind=f.manusRegisterEntityKind||"",f.manusRegisterEntityTag&&f.manusRegisterEntityTag!=="published"&&(v.manus_register_entity_tag=f.manusRegisterEntityTag),f.manusRegisterEntitySpace&&(v.manus_register_entity_space=f.manusRegisterEntitySpace),f.manusRegisterAttachments===!1&&(v.manus_register_attachments=!1),f.manusRegisterContentSource&&f.manusRegisterContentSource!=="message"&&(v.manus_register_content_source=f.manusRegisterContentSource))),v})}function Dpe(e){var r;const n=e.kumiho_config?{...e.kumiho_config}:{};if(e.type==="kumiho_bundle_update")return{...n,project:e.kumiho_project||String(n.project||""),mode:e.kumiho_mode||String(n.mode||"add_members"),create_if_missing:e.kumiho_create_if_missing??!1,idempotent:e.kumiho_idempotent??!0,fail_if_missing_bundle:e.kumiho_fail_if_missing_bundle??!0,fail_if_missing_item:e.kumiho_fail_if_missing_item??!0,allow_protected:e.kumiho_allow_protected??!1,updates:e.kumiho_updates||[]};if(e.type==="kumiho_patch_apply"){const i=wt(n.approval)?{...n.approval}:{},s=wt(n.apply)?{...n.apply}:{},a=wt(n.tag_policy)?{...n.tag_policy}:{},o=wt(a.patch_tags)?{...a.patch_tags}:{},l=wt(n.bundle_policy)?{...n.bundle_policy}:{},u=wt(n.evidence)?{...n.evidence}:{};return i.required=e.kumiho_approval_required??!0,i.approved=e.kumiho_approval_approved??!1,i.approved_by=e.kumiho_approval_approved_by||"",i.approval_note=e.kumiho_approval_note||"",s.create_revisions=e.kumiho_apply_create_revisions??!0,s.create_edges=e.kumiho_apply_create_edges??!0,s.update_tags=e.kumiho_apply_update_tags??!0,s.untag_previous_current=e.kumiho_apply_untag_previous_current??!0,s.update_bundles=e.kumiho_apply_update_bundles??!0,s.save_apply_report=e.kumiho_apply_save_apply_report??!0,a.new_revision_tags=e.kumiho_new_revision_tags||["current","approved"],o.remove=e.kumiho_patch_tags_remove||["candidate"],o.add=e.kumiho_patch_tags_add||["applied"],a.patch_tags=o,l.pending_patch_bundle=e.kumiho_pending_patch_bundle||"",l.applied_patch_bundle=e.kumiho_applied_patch_bundle||"",l.current_state_bundle=e.kumiho_current_state_bundle||"",l.active_storyline_bundle=e.kumiho_active_storyline_bundle||"",l.active_foreshadow_bundle=e.kumiho_active_foreshadow_bundle||"",l.timeline_bundle=e.kumiho_timeline_bundle||"",u.require_evidence_locator=e.kumiho_require_evidence_locator??!0,u.source_episode_kref=e.kumiho_source_episode_kref||"",u.source_context_pack_kref=e.kumiho_source_context_pack_kref||"",{...n,project:e.kumiho_project||String(n.project||""),patch_kref:e.kumiho_patch_kref||String(n.patch_kref||""),dry_run:e.kumiho_dry_run??!0,allow_auto_apply:e.kumiho_allow_auto_apply??!1,approval:i,apply:s,tag_policy:a,bundle_policy:l,evidence:u}}return{...n,project:e.kumiho_project||String(n.project||""),mode:e.kumiho_mode||String(n.mode||"graph_augmented_context"),seed:{...wt(n.seed)?n.seed:{},bundles:e.kumiho_seed_bundles||[],krefs:e.kumiho_seed_krefs||[],queries:e.kumiho_seed_queries||[],...(r=e.kumiho_seed_items)!=null&&r.length?{items:e.kumiho_seed_items}:{}},traversal:{...wt(n.traversal)?n.traversal:{},max_depth:e.kumiho_traversal_max_depth??2,direction:e.kumiho_traversal_direction||"both",edge_types:e.kumiho_traversal_edge_types||[]},filters:{...wt(n.filters)?n.filters:{},include_kinds:e.kumiho_filters_include_kinds||[],exclude_tags:e.kumiho_filters_exclude_tags||["deprecated"],max_items:e.kumiho_filters_max_items??50},ranking:{...wt(n.ranking)?n.ranking:{},method:e.kumiho_ranking_method||"hybrid",semantic_query:e.kumiho_ranking_semantic_query||""},lock:{...wt(n.lock)?n.lock:{},revisions:!0,tag_preference:e.kumiho_lock_tag_preference||[]},output:{...wt(n.output)?n.output:{},format:e.kumiho_output_format||"context_pack",include_artifact_summaries:e.kumiho_output_include_artifact_summaries??!0,include_artifact_content:e.kumiho_output_include_artifact_content??!1,max_artifact_chars_per_item:e.kumiho_output_max_artifact_chars_per_item??3e3,include_edge_map:e.kumiho_output_include_edge_map??!0,include_conflict_warnings:e.kumiho_output_include_conflict_warnings??!0,include_missing_context:e.kumiho_output_include_missing_context??!0}}}function Ppe(e,n,r){const i=q7.dump(r,{noRefs:!0,lineWidth:-1,sortKeys:!1}).trimEnd(),s=" ".repeat(n);for(const a of i.split(`
`))e.push(`${s}${a}`)}function id(e,n){var s,a,o,l,u,d,p,f,g,_,x;const r=[];if(n!=null&&n.name&&r.push(`name: ${n.name}`),n!=null&&n.version&&r.push(`version: "${n.version}"`),n!=null&&n.description&&r.push(`description: ${Ke(n.description)}`),n!=null&&n.tags&&n.tags.length>0&&r.push(`tags: [${n.tags.join(", ")}]`),n!=null&&n.triggers&&n.triggers.length>0){r.push(""),r.push("triggers:");for(const v of n.triggers){v.inputMap.__cron?r.push(`  - cron: ${Ke(v.inputMap.__cron)}`):r.push(`  - on_kind: ${Ke(v.onKind)}`),v.onTag&&v.onTag!=="ready"&&r.push(`    on_tag: ${Ke(v.onTag)}`),v.onNamePattern&&r.push(`    on_name_pattern: ${Ke(v.onNamePattern)}`),v.onSpace&&r.push(`    on_space: ${Ke(v.onSpace)}`);const S=Object.entries(v.inputMap).filter(([w])=>w!=="__cron");if(S.length>0){r.push("    input_map:");for(const[w,j]of S)r.push(`      ${w}: ${Ke(j)}`)}}}const i=((n==null?void 0:n.inputs)??[]).filter(v=>v.name.trim());if(i.length>0){r.push(""),r.push("inputs:");for(const v of i)r.push(`  - name: ${v.name.trim()}`),v.type!=="string"&&r.push(`    type: ${v.type}`),v.required||r.push("    required: false"),v.default&&r.push(`    default: ${Ke(v.default)}`),v.description&&r.push(`    description: ${Ke(v.description)}`)}if(n!=null&&n.outputs&&n.outputs.length>0){r.push(""),r.push("outputs:");for(const v of n.outputs)r.push(`  - name: ${v.name}`),r.push(`    source: ${Ke(v.source)}`),v.description&&r.push(`    description: ${Ke(v.description)}`)}n!=null&&n.defaultCwd&&r.push(`default_cwd: ${Ke(n.defaultCwd)}`),n!=null&&n.defaultTimeout&&n.defaultTimeout!==300&&r.push(`default_timeout: ${n.defaultTimeout}`),n!=null&&n.maxTotalTime&&n.maxTotalTime!==3600&&r.push(`max_total_time: ${n.maxTotalTime}`),(n==null?void 0:n.checkpoint)===!1&&r.push("checkpoint: false"),r.length>0&&r.push(""),r.push("steps:");for(const v of e){r.push(`  - id: ${v.id}`),v.name&&v.name!==v.id&&r.push(`    name: ${Ke(v.name)}`);const S=v.type||"agent";if(r.push(`    type: ${S}`),v.position&&(r.push("    position:"),r.push(`      x: ${_b(v.position.x)}`),r.push(`      y: ${_b(v.position.y)}`)),v.description&&r.push(`    description: ${Ke(v.description)}`),v.retry&&v.retry>0&&r.push(`    retry: ${v.retry}`),v.retry_delay&&v.retry_delay!==5&&r.push(`    retry_delay: ${v.retry_delay}`),v.disabled===!0&&r.push("    disabled: true"),v.compression===!0&&r.push("    compression: true"),S==="conditional"){const w=[];for(const j of Nx(v))!j.condition||!j.goto||(w.push(`      - condition: ${Ke(j.condition)}`),w.push(`        goto: ${j.goto}`),j.value&&w.push(`        value: ${Ke(j.value)}`));w.length>0&&(r.push("    conditional:"),r.push("      branches:"),r.push(...w))}if(S==="human_input"&&v.channel&&r.push(`    channel: ${v.channel}`),S==="notify"&&(v.channels&&v.channels.length>0||v.notify_message||v.notify_title||v.notify_channel_id)){r.push("    notify:"),r.push(`      channels: [${DA(v.channels||["dashboard"]).join(", ")}]`);const w=v.notify_message||"";if(w)if(w.includes(`
`)){r.push("      message: |");for(const C of w.split(`
`))r.push(`        ${C}`)}else r.push(`      message: ${Ke(w)}`);const j=v.notify_title||"";j&&r.push(`      title: ${Ke(j)}`),v.notify_channel_id&&r.push(`      channel_id: ${Ke(v.notify_channel_id)}`)}if(S==="agent"&&(v.agent_type||v.role||v.prompt||v.template||v.auth||(s=v.agent_required_tools)!=null&&s.length)){if(r.push("    agent:"),v.agent_type&&r.push(`      agent_type: ${v.agent_type}`),v.role&&r.push(`      role: ${v.role}`),v.template&&r.push(`      template: ${v.template}`),v.prompt)if(v.prompt.includes(`
`)){r.push("      prompt: |");for(const w of v.prompt.split(`
`))r.push(`        ${w}`)}else r.push(`      prompt: ${Ke(v.prompt)}`);v.timeout&&v.timeout!==300&&r.push(`      timeout: ${v.timeout}`),v.model&&r.push(`      model: ${v.model}`),v.agent_max_turns&&v.agent_max_turns!==3&&r.push(`      max_turns: ${v.agent_max_turns}`),v.agent_tools&&v.agent_tools!=="none"&&r.push(`      tools: ${v.agent_tools}`),(a=v.agent_required_tools)!=null&&a.length&&r.push(`      required_tools: [${v.agent_required_tools.map(Ke).join(", ")}]`),(o=v.agent_output_fields)!=null&&o.length&&r.push(`      output_fields: [${v.agent_output_fields.map(Ke).join(", ")}]`),v.agent_quality_enabled&&(r.push("      quality_check:"),r.push("        enabled: true"),v.agent_quality_threshold!==void 0&&v.agent_quality_threshold!==.7&&r.push(`        threshold: ${v.agent_quality_threshold}`),(l=v.agent_quality_criteria)!=null&&l.length&&r.push(`        criteria: [${v.agent_quality_criteria.map(Ke).join(", ")}]`),v.agent_quality_model&&r.push(`        model: ${v.agent_quality_model}`)),v.auth&&r.push(`      auth: ${Ke(v.auth)}`)}if(S==="parallel"&&(r.push("    parallel:"),v.parallel_steps&&v.parallel_steps.length>0&&r.push(`      steps: [${v.parallel_steps.join(", ")}]`),r.push(`      join: ${v.parallel_join||"all"}`),r.push(`      max_concurrency: ${v.parallel_max_concurrency||5}`)),S==="goto"&&(r.push("    goto:"),v.goto_target&&r.push(`      target: ${v.goto_target}`),v.goto_max_iterations&&r.push(`      max_iterations: ${v.goto_max_iterations}`),v.goto_condition&&r.push(`      condition: ${Ke(v.goto_condition)}`)),S==="group_chat"&&(r.push("    group_chat:"),v.group_chat_topic&&r.push(`      topic: ${Ke(v.group_chat_topic)}`),v.group_chat_participants&&v.group_chat_participants.length>0&&r.push(`      participants: [${v.group_chat_participants.join(", ")}]`),v.group_chat_max_rounds&&r.push(`      max_rounds: ${v.group_chat_max_rounds}`),v.group_chat_moderator&&v.group_chat_moderator!=="claude"&&r.push(`      moderator: ${v.group_chat_moderator}`),v.group_chat_strategy&&v.group_chat_strategy!=="moderator_selected"&&r.push(`      strategy: ${v.group_chat_strategy}`),v.group_chat_timeout&&v.group_chat_timeout!==120&&r.push(`      timeout: ${v.group_chat_timeout}`)),S==="supervisor"&&(r.push("    supervisor:"),v.supervisor_task&&r.push(`      task: ${Ke(v.supervisor_task)}`),v.supervisor_max_iterations&&r.push(`      max_iterations: ${v.supervisor_max_iterations}`),v.supervisor_type&&v.supervisor_type!=="claude"&&r.push(`      supervisor_type: ${v.supervisor_type}`),(u=v.supervisor_templates)!=null&&u.length&&r.push(`      templates: [${v.supervisor_templates.map(Ke).join(", ")}]`),v.supervisor_timeout&&v.supervisor_timeout!==300&&r.push(`      timeout: ${v.supervisor_timeout}`)),S==="shell"&&(r.push("    shell:"),v.shell_command&&r.push(`      command: ${Ke(v.shell_command)}`),v.shell_timeout&&v.shell_timeout!==60&&r.push(`      timeout: ${v.shell_timeout}`),v.shell_allow_failure&&r.push("      allow_failure: true"),v.auth&&r.push(`      auth: ${Ke(v.auth)}`)),S==="python"){if(r.push("    python:"),v.python_script&&r.push(`      script: ${Ke(v.python_script)}`),v.python_code)if(v.python_code.includes(`
`)){r.push("      code: |");for(const w of v.python_code.split(`
`))r.push(`        ${w}`)}else r.push(`      code: ${Ke(v.python_code)}`);v.python_args&&r.push(`      args: ${v.python_args}`),v.python_interpreter&&r.push(`      python: ${Ke(v.python_interpreter)}`),v.python_timeout&&v.python_timeout!==60&&r.push(`      timeout: ${v.python_timeout}`),v.python_allow_failure&&r.push("      allow_failure: true"),v.auth&&r.push(`      auth: ${Ke(v.auth)}`)}if(S==="compute"){r.push("    compute:"),r.push("      outputs:");for(const[w,j]of Object.entries(v.compute_outputs||{}))r.push(`        ${w}: ${Ke(String(j))}`)}if(S==="email"){if(r.push("    email:"),v.email_to&&r.push(`      to: ${Ke(v.email_to)}`),v.email_subject&&r.push(`      subject: ${Ke(v.email_subject)}`),v.email_body)if(v.email_body.includes(`
`)){r.push("      body: |");for(const w of v.email_body.split(`
`))r.push(`        ${w}`)}else r.push(`      body: ${Ke(v.email_body)}`);if(v.email_body_html)if(v.email_body_html.includes(`
`)){r.push("      body_html: |");for(const w of v.email_body_html.split(`
`))r.push(`        ${w}`)}else r.push(`      body_html: ${Ke(v.email_body_html)}`);if(v.email_from&&r.push(`      from_address: ${Ke(v.email_from)}`),v.email_cc){const w=v.email_cc.split(",").map(j=>j.trim()).filter(Boolean);w.length>0&&r.push(`      cc: [${w.map(Ke).join(", ")}]`)}if(v.email_bcc){const w=v.email_bcc.split(",").map(j=>j.trim()).filter(Boolean);w.length>0&&r.push(`      bcc: [${w.map(Ke).join(", ")}]`)}v.email_reply_to&&r.push(`      reply_to: ${Ke(v.email_reply_to)}`),v.email_track_clicks&&r.push("      track_clicks: true"),v.email_track_kref&&r.push(`      track_kref: ${Ke(v.email_track_kref)}`),v.email_track_secret_env&&r.push(`      track_secret_env: ${Ke(v.email_track_secret_env)}`),v.email_track_base_url&&r.push(`      track_base_url: ${Ke(v.email_track_base_url)}`),v.email_smtp_host&&r.push(`      smtp_host: ${Ke(v.email_smtp_host)}`),v.email_smtp_port&&r.push(`      smtp_port: ${v.email_smtp_port}`),v.email_smtp_tls===!1&&r.push("      smtp_tls: false"),v.email_smtp_username&&r.push(`      smtp_username: ${Ke(v.email_smtp_username)}`),v.email_smtp_password_env&&r.push(`      smtp_password_env: ${Ke(v.email_smtp_password_env)}`),v.email_dry_run&&r.push("      dry_run: true"),v.email_timeout&&v.email_timeout!==30&&r.push(`      timeout: ${v.email_timeout}`),v.auth&&r.push(`      auth: ${Ke(v.auth)}`)}if(S==="image"){if(r.push("    image:"),v.image_prompt)if(v.image_prompt.includes(`
`)){r.push("      prompt: |");for(const w of v.image_prompt.split(`
`))r.push(`        ${w}`)}else r.push(`      prompt: ${Ke(v.image_prompt)}`);v.image_count&&v.image_count!==1&&r.push(`      count: ${v.image_count}`),typeof v.image_canvas=="string"&&v.image_canvas?r.push(`      canvas: ${Ke(v.image_canvas)}`):v.image_canvas_target?r.push(`      canvas: ${Ke(v.image_canvas_target)}`):v.image_canvas===!1&&r.push("      canvas: false"),v.image_register_artifact===!1&&r.push("      register_artifact: false"),v.image_space&&r.push(`      space: ${Ke(v.image_space)}`),v.image_item_name&&r.push(`      item_name: ${Ke(v.image_item_name)}`),v.image_output_path&&r.push(`      output_path: ${Ke(v.image_output_path)}`),v.image_output_pattern&&r.push(`      output_pattern: ${Ke(v.image_output_pattern)}`),v.image_input_images&&v.image_input_images.length>0&&r.push(`      input_images: [${v.image_input_images.map(Ke).join(", ")}]`),v.image_sandbox&&r.push(`      sandbox: ${v.image_sandbox}`),v.image_cwd&&r.push(`      cwd: ${Ke(v.image_cwd)}`),v.image_timeout&&v.image_timeout!==1200&&r.push(`      timeout: ${v.image_timeout}`)}if(S==="output"){if(r.push("    output:"),v.output_format&&r.push(`      format: ${v.output_format}`),v.output_template)if(v.output_template.includes(`
`)){r.push("      template: |");for(const w of v.output_template.split(`
`))r.push(`        ${w}`)}else r.push(`      template: ${Ke(v.output_template)}`);if(v.entity_name&&r.push(`      entity_name: ${Ke(v.entity_name)}`),v.entity_kind&&r.push(`      entity_kind: ${Ke(v.entity_kind)}`),v.entity_tag&&r.push(`      entity_tag: ${Ke(v.entity_tag)}`),v.entity_space&&r.push(`      entity_space: ${Ke(v.entity_space)}`),v.artifact_summary_model&&r.push(`      artifact_summary_model: ${Ke(v.artifact_summary_model)}`),v.metadata_target&&v.metadata_target!=="item"&&r.push(`      metadata_target: ${Ke(v.metadata_target)}`),v.entity_metadata&&Object.keys(v.entity_metadata).length>0){r.push("      entity_metadata:");for(const[w,j]of Object.entries(v.entity_metadata))r.push(`        ${w}: "${String(j).replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`)}}if(S==="handoff"&&(r.push("    handoff:"),v.handoff_from&&r.push(`      from_step: ${v.handoff_from}`),v.handoff_to&&r.push(`      to_agent_type: ${v.handoff_to}`),v.handoff_reason&&r.push(`      reason: ${Ke(v.handoff_reason)}`),v.handoff_task&&r.push(`      task: ${Ke(v.handoff_task)}`),v.handoff_timeout&&v.handoff_timeout!==300&&r.push(`      timeout: ${v.handoff_timeout}`)),S==="human_input"){if(r.push("    human_input:"),v.human_input_message)if(v.human_input_message.includes(`
`)){r.push("      message: |");for(const w of v.human_input_message.split(`
`))r.push(`        ${w}`)}else r.push(`      message: ${Ke(v.human_input_message)}`);v.channel&&r.push(`      channel: ${v.channel}`),v.human_input_timeout&&v.human_input_timeout!==3600&&r.push(`      timeout: ${v.human_input_timeout}`)}if(S==="human_approval"){if(r.push("    human_approval:"),v.human_approval_channel&&v.human_approval_channel!=="dashboard"&&r.push(`      channel: ${v.human_approval_channel}`),v.human_approval_channel_id&&r.push(`      channel_id: "${v.human_approval_channel_id}"`),v.human_approval_message)if(v.human_approval_message.includes(`
`)){r.push("      message: |");for(const w of v.human_approval_message.split(`
`))r.push(`        ${w}`)}else r.push(`      message: ${Ke(v.human_approval_message)}`);v.human_approval_timeout&&v.human_approval_timeout!==3600&&r.push(`      timeout: ${v.human_approval_timeout}`),v.human_approval_on_reject_goto&&r.push(`      on_reject_goto: ${v.human_approval_on_reject_goto}`),v.human_approval_on_reject_max&&v.human_approval_on_reject_max!==3&&r.push(`      on_reject_max: ${v.human_approval_on_reject_max}`),(d=v.human_approval_approve_keywords)!=null&&d.length&&r.push(`      approve_keywords: [${v.human_approval_approve_keywords.map(Ke).join(", ")}]`),(p=v.human_approval_reject_keywords)!=null&&p.length&&r.push(`      reject_keywords: [${v.human_approval_reject_keywords.map(Ke).join(", ")}]`)}if(S==="a2a"&&(r.push("    a2a:"),v.a2a_url&&r.push(`      url: ${v.a2a_url}`),v.a2a_skill_id&&r.push(`      skill_id: ${v.a2a_skill_id}`),v.a2a_message&&r.push(`      message: ${Ke(v.a2a_message)}`),v.a2a_timeout&&v.a2a_timeout!==300&&r.push(`      timeout: ${v.a2a_timeout}`),v.auth&&r.push(`      auth: ${Ke(v.auth)}`),v.a2a_cloud_run_auth&&r.push(`      cloud_run_auth: ${v.a2a_cloud_run_auth}`),v.a2a_cloud_run_config&&r.push(`      cloud_run_config: ${Ke(v.a2a_cloud_run_config)}`),v.a2a_cloud_run_audience&&r.push(`      cloud_run_audience: ${Ke(v.a2a_cloud_run_audience)}`),v.a2a_cloud_run_auth_timeout&&v.a2a_cloud_run_auth_timeout!==20&&r.push(`      cloud_run_auth_timeout: ${v.a2a_cloud_run_auth_timeout}`)),S==="map_reduce"&&(r.push("    map_reduce:"),v.map_reduce_task&&r.push(`      task: ${Ke(v.map_reduce_task)}`),v.map_reduce_splits&&v.map_reduce_splits.length>0&&r.push(`      splits: [${v.map_reduce_splits.map(w=>Ke(w)).join(", ")}]`),v.map_reduce_mapper&&v.map_reduce_mapper!=="claude"&&r.push(`      mapper: ${v.map_reduce_mapper}`),v.map_reduce_reducer&&v.map_reduce_reducer!=="claude"&&r.push(`      reducer: ${v.map_reduce_reducer}`),v.map_reduce_concurrency&&v.map_reduce_concurrency!==3&&r.push(`      concurrency: ${v.map_reduce_concurrency}`),v.map_reduce_timeout&&v.map_reduce_timeout!==300&&r.push(`      timeout: ${v.map_reduce_timeout}`)),S==="resolve"&&(r.push("    resolve:"),r.push(`      kind: "${v.resolve_kind||""}"`),r.push(`      tag: "${v.resolve_tag||"published"}"`),r.push(`      name_pattern: "${v.resolve_name_pattern||""}"`),r.push(`      space: "${v.resolve_space||""}"`),v.resolve_artifact_name&&r.push(`      artifact_name: ${Ke(v.resolve_artifact_name)}`),r.push(`      mode: "${v.resolve_mode||"latest"}"`),v.resolve_metadata_source&&v.resolve_metadata_source!=="revision"&&r.push(`      metadata_source: ${Ke(v.resolve_metadata_source)}`),(f=v.resolve_fields)!=null&&f.length?r.push(`      fields: [${v.resolve_fields.map(w=>`"${w}"`).join(", ")}]`):r.push("      fields: []"),r.push(`      fail_if_missing: ${v.resolve_fail_if_missing!==!1?"true":"false"}`)),(S==="kumiho_context"||S==="kumiho_bundle_update"||S==="kumiho_patch_apply")&&(r.push("    kumiho:"),Ppe(r,6,Dpe(v))),S==="for_each"&&v.for_each_steps&&v.for_each_steps.length>0&&(r.push("    for_each:"),v.for_each_range&&r.push(`      range: "${v.for_each_range}"`),v.for_each_items&&v.for_each_items.length>0&&r.push(`      items: [${v.for_each_items.map(w=>`"${w}"`).join(", ")}]`),v.for_each_variable&&v.for_each_variable!=="item"&&r.push(`      variable: ${v.for_each_variable}`),r.push(`      steps: [${v.for_each_steps.join(", ")}]`),v.for_each_carry_forward===!1&&r.push("      carry_forward: false"),v.for_each_fail_fast===!1&&r.push("      fail_fast: false"),v.for_each_max_iterations&&v.for_each_max_iterations!==20&&r.push(`      max_iterations: ${v.for_each_max_iterations}`)),S==="tag"&&(r.push("    tag_step:"),v.tag_item_kref&&r.push(`      item_kref: ${Ke(v.tag_item_kref)}`),v.tag_value&&r.push(`      tag: ${Ke(v.tag_value)}`),v.tag_untag&&r.push(`      untag: ${Ke(v.tag_untag)}`)),S==="deprecate"&&(r.push("    deprecate_step:"),v.deprecate_item_kref&&r.push(`      item_kref: ${Ke(v.deprecate_item_kref)}`),v.deprecate_reason&&r.push(`      reason: ${Ke(v.deprecate_reason)}`)),S==="manus"){if(r.push("    manus:"),v.manus_prompt)if(v.manus_prompt.includes(`
`)){r.push("      prompt: |");for(const w of v.manus_prompt.split(`
`))r.push(`        ${w}`)}else r.push(`      prompt: ${Ke(v.manus_prompt)}`);if(v.manus_structured_output_schema)try{const w=JSON.parse(v.manus_structured_output_schema);r.push(`      structured_output_schema: ${JSON.stringify(w)}`)}catch{r.push(`      structured_output_schema: ${Ke(v.manus_structured_output_schema)}`)}(g=v.manus_connectors)!=null&&g.length&&r.push(`      connectors: [${v.manus_connectors.map(Ke).join(", ")}]`),(_=v.manus_enable_skills)!=null&&_.length&&r.push(`      enable_skills: [${v.manus_enable_skills.map(Ke).join(", ")}]`),(x=v.manus_force_skills)!=null&&x.length&&r.push(`      force_skills: [${v.manus_force_skills.map(Ke).join(", ")}]`),v.manus_agent_profile&&r.push(`      agent_profile: ${Ke(v.manus_agent_profile)}`),v.manus_locale&&r.push(`      locale: ${Ke(v.manus_locale)}`),v.manus_project_id&&r.push(`      project_id: ${Ke(v.manus_project_id)}`),v.manus_title&&r.push(`      title: ${Ke(v.manus_title)}`),v.manus_timeout_seconds&&v.manus_timeout_seconds!==600&&r.push(`      timeout_seconds: ${v.manus_timeout_seconds}`),v.manus_poll_interval_seconds&&v.manus_poll_interval_seconds!==5&&r.push(`      poll_interval_seconds: ${v.manus_poll_interval_seconds}`),v.manus_allow_failure&&r.push("      allow_failure: true"),v.manus_credentials_ref&&r.push(`      credentials_ref: ${Ke(v.manus_credentials_ref)}`),v.manus_register_enabled===!0&&(r.push("      register_output:"),r.push(`        entity_name: ${Ke(v.manus_register_entity_name||"")}`),r.push(`        entity_kind: ${Ke(v.manus_register_entity_kind||"")}`),v.manus_register_entity_tag&&v.manus_register_entity_tag!=="published"&&r.push(`        entity_tag: ${Ke(v.manus_register_entity_tag)}`),v.manus_register_entity_space&&r.push(`        entity_space: ${Ke(v.manus_register_entity_space)}`),v.manus_register_attachments===!1&&r.push("        register_attachments: false"),v.manus_register_content_source&&v.manus_register_content_source!=="message"&&r.push(`        content_source: ${Ke(v.manus_register_content_source)}`))}v.agent_hints.length>0&&r.push(`    agent_hints: [${v.agent_hints.join(", ")}]`),v.skills.length>0&&r.push(`    skills: [${v.skills.join(", ")}]`),v.assign&&r.push(`    assign: ${v.assign}`),v.depends_on.length>0&&r.push(`    depends_on: [${v.depends_on.join(", ")}]`)}return r.join(`
`)+`
`}function Ke(e){return/[:#\[\]{}&*!|>'"%@`]/.test(e)||e.includes(`
`)?`"${e.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`:e}function qe({children:e,className:n="",variant:r="primary",skinSlot:i}){return c.jsx("section",{className:`revka-panel ${n}`.trim(),"data-variant":r,"data-skin-slot":i,children:e})}function Ua({status:e}){const{getSkinAsset:n}=Pa(),r=e.toLowerCase(),i=(()=>{switch(r){case"running":return{icon:dee,color:"var(--revka-signal-live)",bg:"var(--revka-signal-live-soft)",assetSlot:"statusRunningBadge"};case"completed":case"success":return{icon:Zx,color:"var(--revka-status-success)",bg:"color-mix(in srgb, var(--revka-status-success) 8%, transparent)",assetSlot:"statusSuccessBadge"};case"failed":return{icon:ru,color:"var(--revka-status-danger)",bg:"color-mix(in srgb, var(--revka-status-danger) 12%, transparent)",assetSlot:"statusFailedBadge"};case"paused":case"blocked":case"pending":return{icon:xO,color:"var(--revka-status-warning)",bg:"color-mix(in srgb, var(--revka-status-warning) 12%, transparent)",assetSlot:"statusPendingBadge"};case"skipped":return{icon:xO,color:"var(--revka-status-idle)",bg:"color-mix(in srgb, var(--revka-status-idle) 12%, transparent)",assetSlot:"statusSkippedBadge"};case"stale":return{icon:HE,color:"var(--revka-status-idle)",bg:"color-mix(in srgb, var(--revka-status-idle) 14%, transparent)",assetSlot:"statusSkippedBadge"};default:return{icon:As,color:"var(--revka-text-muted)",bg:"color-mix(in srgb, var(--revka-text-muted) 10%, transparent)",assetSlot:"statusPendingBadge"}}})(),s=i.icon,a=n(i.assetSlot);return c.jsxs("span",{className:"revka-status-pill",style:{color:i.color,background:i.bg,borderColor:"transparent"},children:[a?c.jsx("img",{src:a,alt:"",className:"revka-status-asset",draggable:!1}):c.jsx(s,{className:"h-3.5 w-3.5"}),e]})}function Lpe({definitionsCount:e,activeRuns:n,totalRuns:r,error:i}){return i?c.jsxs("p",{className:"mt-4 text-sm",style:{color:"var(--revka-status-danger)"},children:["Failed to load workflow dashboard: ",i]}):c.jsxs("div",{className:"mt-5 grid gap-4 md:grid-cols-3",children:[c.jsx(wS,{label:"Definitions",value:e??"..."}),c.jsx(wS,{label:"Active Runs",value:n??"..."}),c.jsx(wS,{label:"Total Runs",value:r??"..."})]})}function wS({label:e,value:n}){return c.jsxs("div",{className:"revka-dashboard-stat",children:[c.jsx("div",{className:"revka-kicker",children:e}),c.jsx("div",{className:"revka-metric-value mt-2",children:n})]})}function Ipe({selectedRunStatus:e,audit:n,provider:r,model:i}){return c.jsxs(qe,{className:"p-4",skinSlot:"commandBand",children:[c.jsx("div",{className:"revka-kicker",children:"Command Band"}),c.jsxs("div",{className:"mt-3 grid gap-2 text-sm",children:[c.jsx(Ua,{status:e??"running"}),c.jsxs("span",{className:"revka-status-pill",children:[c.jsx(Cv,{className:"h-3.5 w-3.5"}),n!=null&&n.verified?"Trust verified":"Trust check pending"]}),c.jsxs("div",{className:"rounded-[8px] border p-3",style:{borderColor:"var(--revka-border-soft)"},children:[c.jsx("div",{className:"revka-kicker",children:"Runtime"}),c.jsx("div",{className:"mt-2 text-sm font-semibold",style:{color:"var(--revka-text-primary)"},children:r??"Unknown provider"}),c.jsx("div",{className:"mt-1 text-xs",style:{color:"var(--revka-text-secondary)"},children:i||"No model reported"})]})]})]})}function Bpe({sessions:e,channels:n,activeSessionCount:r,activeChannelCount:i}){return c.jsxs(qe,{className:"p-4",variant:"secondary",skinSlot:"agentRail",children:[c.jsx("div",{className:"revka-kicker",children:"Agent Rail"}),c.jsxs("div",{className:"mt-3 space-y-3",children:[c.jsx(ug,{icon:c.jsx(j0,{className:"h-4 w-4",style:{color:"var(--revka-signal-live)"}}),label:"Sessions",value:r,detail:`${e.length} tracked conversations`}),c.jsx(ug,{icon:c.jsx(eb,{className:"h-4 w-4",style:{color:"var(--revka-signal-network)"}}),label:"Channels",value:i,detail:`${n.length} integrated surfaces`}),c.jsxs(qe,{className:"p-3",variant:"utility",children:[c.jsx("div",{className:"revka-kicker",children:"Recent session activity"}),c.jsxs("div",{className:"mt-2 space-y-2",children:[e.slice(0,3).map(s=>c.jsxs("div",{className:"flex items-center justify-between gap-2 text-xs",children:[c.jsx("span",{className:"truncate",style:{color:"var(--revka-text-primary)"},children:s.channel}),c.jsx(Ua,{status:s.status})]},s.id)),e.length===0?c.jsx("div",{className:"text-sm",style:{color:"var(--revka-text-faint)"},children:"No active sessions."}):null]})]})]})]})}function zpe({audit:e,cost:n,degradedComponentCount:r}){var i,s;return c.jsxs(qe,{className:"p-4",variant:"secondary",skinSlot:"riskRail",children:[c.jsx("div",{className:"revka-kicker",children:"Risk Rail"}),c.jsxs("div",{className:"mt-3 space-y-3",children:[c.jsx(ug,{icon:c.jsx(Cv,{className:"h-4 w-4",style:{color:e!=null&&e.verified?"var(--revka-status-success)":"var(--revka-status-warning)"}}),label:"Audit chain",value:e!=null&&e.verified?"Verified":"Pending verification"}),c.jsx(ug,{icon:c.jsx(BE,{className:"h-4 w-4",style:{color:"var(--revka-signal-network)"}}),label:"Spend",value:`$${((i=n==null?void 0:n.daily_cost_usd)==null?void 0:i.toFixed(2))??"..."}`,detail:`daily / $${((s=n==null?void 0:n.monthly_cost_usd)==null?void 0:s.toFixed(2))??"..."} monthly`}),c.jsx(ug,{icon:c.jsx(xv,{className:"h-4 w-4",style:{color:r>0?"var(--revka-status-warning)":"var(--revka-status-success)"}}),label:"Component health",value:r>0?`${r} degraded`:"All healthy"})]})]})}function $pe({runs:e,onSelectRun:n,selectedRunId:r,footer:i}){return c.jsxs(qe,{className:"p-4",variant:"utility",skinSlot:"recentRuns",children:[c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx(xv,{className:"h-4 w-4",style:{color:"var(--revka-signal-network)"}}),c.jsx("span",{className:"text-sm font-medium",children:"Recent runs"})]}),c.jsxs("div",{className:"mt-3 max-h-[24rem] space-y-2 overflow-y-auto pr-1",children:[e.slice(0,4).map(s=>c.jsxs("button",{type:"button",onClick:()=>n(s.run_id),"data-active":s.run_id===r,className:"revka-run-selection-card",children:[c.jsxs("div",{className:"flex items-center justify-between gap-2",children:[c.jsx("span",{className:"truncate text-sm font-medium",children:s.workflow_name}),c.jsx(Ua,{status:s.status})]}),s.run_id===r?c.jsx("div",{className:"mt-2 text-[10px] font-semibold uppercase tracking-[0.14em]",style:{color:"var(--revka-signal-selected)"},children:"Active selection"}):null,c.jsx("div",{className:"mt-2 text-xs font-mono",style:{color:"var(--revka-text-faint)"},children:s.run_id.slice(0,8)})]},s.run_id)),e.length===0?c.jsx("div",{className:"text-sm",style:{color:"var(--revka-text-faint)"},children:"Loading recent runs…"}):null]}),i?c.jsx("div",{className:"mt-4",children:i}):null]})}function ug({icon:e,label:n,value:r,detail:i}){return c.jsxs("div",{className:"revka-mini-metric-card rounded-[8px] border p-3",style:{borderColor:"var(--revka-border-soft)"},children:[c.jsxs("div",{className:"flex items-center gap-2",children:[e,c.jsx("span",{className:"text-sm font-medium",style:{color:"var(--revka-text-primary)"},children:n})]}),c.jsx("div",{className:"mt-2 text-2xl font-semibold",style:{color:"var(--revka-text-primary)"},children:r}),i?c.jsx("div",{className:"mt-1 text-xs",style:{color:"var(--revka-text-secondary)"},children:i}):null]})}function Fpe({avatarUrl:e,message:n,speaker:r,tone:i="steady"}){return c.jsxs("aside",{className:"revka-dashboard-dialogue","data-tone":i,"aria-live":"polite",children:[c.jsx("div",{className:"revka-dashboard-dialogue-portrait","aria-hidden":!e,children:e?c.jsx("img",{src:e,alt:"",draggable:!1}):c.jsx("span",{children:"OP"})}),c.jsxs("div",{className:"revka-dashboard-dialogue-box",children:[c.jsx("div",{className:"revka-dashboard-dialogue-nameplate",children:r}),c.jsxs("p",{children:[c.jsx("span",{"aria-hidden":"true",className:"revka-dashboard-dialogue-mark",children:"“"}),n]}),c.jsx("span",{"aria-hidden":"true",className:"revka-dashboard-dialogue-cue"})]})]})}function Qc({title:e,children:n}){return c.jsxs("div",{className:"revka-operator-card",children:[c.jsx("div",{className:"mb-2 text-[10px] font-semibold uppercase tracking-[0.14em]",style:{color:"var(--revka-text-faint)"},children:e}),n]})}function xb({label:e,hint:n,onClick:r}){return c.jsxs("button",{type:"button",onClick:r,className:"revka-signal-chip inline-flex items-center gap-2 font-semibold transition-colors",style:{borderColor:"var(--revka-border-soft)",background:"color-mix(in srgb, var(--revka-bg-panel-strong) 92%, transparent)",color:"var(--revka-text-primary)"},children:[c.jsx("span",{children:e}),c.jsx("span",{className:"revka-kbd",children:n})]})}function bf({label:e,tone:n,onClick:r}){return c.jsx("button",{type:"button",onClick:r,className:"revka-signal-chip text-left",style:{borderColor:`color-mix(in srgb, ${n} 28%, transparent)`,background:"color-mix(in srgb, var(--revka-bg-panel-strong) 92%, transparent)",color:n},children:e})}function Lo({label:e,value:n,tone:r,compact:i=!1,assetSlot:s}){const{getSkinAsset:a}=Pa(),o=s?a(s):null;return c.jsxs("div",{className:i?"rounded-[8px] border px-3 py-2":"revka-signal-chip",style:{borderColor:`color-mix(in srgb, ${r} 30%, var(--revka-border-soft))`,background:"color-mix(in srgb, var(--revka-bg-panel-strong) 92%, transparent)",backdropFilter:i?void 0:"blur(10px)"},children:[c.jsxs("div",{className:"flex items-center justify-between gap-2",children:[c.jsx("div",{className:"text-[10px] font-semibold uppercase tracking-[0.12em]",style:{color:"var(--revka-text-faint)"},children:e}),o?c.jsx("img",{src:o,alt:"",className:"revka-status-asset",draggable:!1}):null]}),c.jsx("div",{className:i?"mt-1 text-lg font-semibold":"mt-1 text-base font-semibold",style:{color:r},children:n})]})}function gm({label:e,tone:n}){return c.jsxs("span",{className:"inline-flex items-center gap-2 rounded-[999px] border px-2.5 py-1 text-[10px] font-semibold uppercase tracking-[0.12em]",style:{borderColor:`color-mix(in srgb, ${n} 25%, var(--revka-border-soft))`,background:"color-mix(in srgb, var(--revka-bg-panel-strong) 94%, transparent)",color:"var(--revka-text-secondary)"},children:[c.jsx("span",{className:"h-2 w-2 rounded-full",style:{background:n}}),e]})}function qD(e){if(e==null||e==="")return null;const n=Number(e);return Number.isFinite(n)?n:null}function PA(e){const n=qD(e.expanded_steps_completed);if(n===null)return null;const r=qD(e.steps_completed)??0;return n>r?n:null}function LA(e,n){const r=e.current_iteration??"",i=e.current_step_instance??"";if(!r||!i)return null;const s=e.current_loop_total??"";return s?n("runs.stats.loop_fraction",{iteration:r,total:s,step:i}):n("runs.stats.loop_iteration",{iteration:r,step:i})}function Ts({src:e,alt:n="Agent",size:r=28,radius:i=8,iconSize:s,kind:a="agent",className:o,style:l}){const[u,d]=b.useState(!1);b.useEffect(()=>{d(!1)},[e]);const p={width:r,height:r,minWidth:r,borderRadius:i,border:"1px solid var(--revka-border-soft)",boxShadow:"inset 0 1px 0 rgba(255,255,255,0.06)",...l};if(e&&!u)return c.jsx("img",{className:o,src:e,alt:n,onError:()=>d(!0),style:{...p,display:"block",objectFit:"cover",background:"var(--revka-bg-elevated)"}});const f=a==="team"?j0:Ul;return c.jsx("span",{className:o,"aria-hidden":"true",style:{...p,display:"inline-flex",alignItems:"center",justifyContent:"center",background:"color-mix(in srgb, var(--revka-signal-network-soft) 72%, var(--revka-bg-elevated))",color:"var(--revka-signal-network)"},children:c.jsx(f,{size:s??Math.max(12,Math.round(r*.5))})})}function zf(e){if(!e)return"";const n=new Date(e);return Number.isNaN(n.getTime())?e:n.toLocaleString()}function Hpe({workflow:e}){const n=e?lf(e.definition):null;return c.jsxs(qe,{className:"p-4",variant:"utility",children:[c.jsx("div",{className:"revka-kicker",children:"Workflow Metadata"}),e?c.jsxs("div",{className:"mt-3 space-y-2 text-sm",children:[c.jsxs("div",{children:[c.jsx("span",{style:{color:"var(--revka-text-faint)"},children:"Version"}),": ",c.jsx("span",{style:{color:"var(--revka-text-primary)"},children:e.version})]}),c.jsxs("div",{children:[c.jsx("span",{style:{color:"var(--revka-text-faint)"},children:"Steps"}),": ",c.jsx("span",{style:{color:"var(--revka-text-primary)"},children:e.steps})]}),c.jsxs("div",{children:[c.jsx("span",{style:{color:"var(--revka-text-faint)"},children:"Tags"}),": ",c.jsx("span",{style:{color:"var(--revka-text-primary)"},children:e.tags.join(", ")||"None"})]}),c.jsxs("div",{children:[c.jsx("span",{style:{color:"var(--revka-text-faint)"},children:"Triggers"}),": ",c.jsx("span",{style:{color:"var(--revka-text-primary)"},children:(n==null?void 0:n.triggers.length)??0})]})]}):c.jsx("div",{className:"mt-3 text-sm",style:{color:"var(--revka-text-faint)"},children:"No workflow selected."})]})}function Wpe(e){if(!e||typeof e!="object")return!1;const n=e;return typeof n.speaker=="string"&&typeof n.content=="string"&&(typeof n.round=="number"||typeof n.round=="string")}function qpe(e){return Array.isArray(e)?e.filter(Wpe).map(n=>({speaker:n.speaker,content:n.content,round:Number(n.round)||0})):[]}function Upe(e){var r;if(!e)return[];if((r=e.transcript)!=null&&r.length)return e.transcript;const n=e.output_data;return qpe((n==null?void 0:n.transcript)??(n==null?void 0:n.chat_events))}function V7({task:e,step:n,title:r="Selected Node",emptyText:i,footer:s,onViewArtifact:a}){var u;const{t:o}=an(),l=Upe(n);return c.jsxs(qe,{className:"p-4",variant:"secondary",skinSlot:"stepCard",children:[c.jsx("div",{className:"revka-kicker",children:r}),e?c.jsxs("div",{className:"mt-3 space-y-2",children:[c.jsxs("div",{className:"flex items-center justify-between gap-2",children:[c.jsx("div",{className:"text-sm font-semibold",style:{color:"var(--revka-text-primary)"},children:e.name||e.id}),n?c.jsx(Ua,{status:n.status}):null]}),c.jsx("div",{className:"text-xs uppercase tracking-[0.12em]",style:{color:"var(--revka-text-faint)"},children:e.type}),c.jsx("p",{className:"text-sm leading-6",style:{color:"var(--revka-text-secondary)"},children:e.description||"No description provided."}),n?null:c.jsxs("div",{className:"text-xs",style:{color:"var(--revka-text-secondary)"},children:["Depends on: ",e.depends_on.join(", ")||"none"]}),n!=null&&n.output_preview?c.jsxs("div",{className:"rounded-[8px] border p-3 text-xs leading-6",style:{borderColor:"var(--revka-border-soft)",color:"var(--revka-text-secondary)"},children:[c.jsxs("div",{className:"mb-2 flex items-center justify-between gap-2",children:[c.jsx("div",{className:"text-[10px] font-semibold uppercase tracking-[0.12em]",style:{color:"var(--revka-text-faint)"},children:"Output preview"}),n.artifact_path&&a?c.jsxs("button",{type:"button",onClick:()=>a(n),className:"inline-flex items-center gap-1 rounded-[6px] px-2 py-0.5 text-[10px] font-medium uppercase tracking-wider transition",style:{background:"var(--revka-bg-elevated)",color:"var(--revka-text-secondary)",border:"1px solid var(--revka-border-strong)"},children:[c.jsx(kv,{className:"h-3 w-3"}),"View full"]}):null]}),c.jsx("pre",{className:"whitespace-pre-wrap",style:{fontFamily:"var(--pc-font-mono)"},children:n.output_preview})]}):null,l.length?c.jsxs("div",{className:"rounded-[8px] border p-3",style:{borderColor:"var(--revka-border-soft)"},children:[c.jsxs("div",{className:"mb-2 flex items-center gap-2 text-[10px] font-semibold uppercase tracking-[0.12em]",style:{color:"var(--revka-text-faint)"},children:[c.jsx(TC,{className:"h-3 w-3"}),o("runs.tab.transcript")]}),c.jsx("div",{className:"max-h-72 space-y-2 overflow-y-auto pr-1",children:l.map((d,p)=>c.jsxs("div",{className:"rounded-[8px] border p-2",style:{borderColor:"var(--revka-border-soft)"},children:[c.jsxs("div",{className:"flex items-center justify-between gap-2 text-[10px] font-semibold uppercase tracking-[0.12em]",style:{color:"var(--revka-text-faint)"},children:[c.jsx("span",{className:"truncate",children:d.speaker}),c.jsxs("span",{children:["R",d.round]})]}),c.jsx("pre",{className:"mt-1 whitespace-pre-wrap text-xs leading-6",style:{color:"var(--revka-text-secondary)",fontFamily:"var(--pc-font-mono)"},children:d.content})]},`${d.round}-${d.speaker}-${p}`))})]}):null,n?c.jsxs("div",{className:"text-xs",style:{color:"var(--revka-text-secondary)"},children:["Agent: ",n.agent_type||"n/a"," ",n.role?`/ ${n.role}`:""]}):null,(u=n==null?void 0:n.skills)!=null&&u.length?c.jsxs("div",{className:"text-xs",style:{color:"var(--revka-text-secondary)"},children:["Skills: ",n.skills.join(", ")]}):null,n!=null&&n.agent_id?c.jsxs("div",{className:"text-xs font-mono",style:{color:"var(--revka-text-faint)"},children:["Agent ID: ",n.agent_id]}):null,s?c.jsx("div",{className:"pt-1",children:s}):null]}):c.jsx("div",{className:"mt-3 text-sm",style:{color:"var(--revka-text-faint)"},children:i})]})}function Kpe({run:e,workflowHref:n}){const{tpl:r}=an(),i=e?PA(e):null,s=e?LA(e,r):null;return c.jsxs(qe,{className:"p-4",variant:"utility",skinSlot:"runCard",children:[c.jsx("div",{className:"revka-kicker",children:"Run Summary"}),e?c.jsxs("div",{className:"mt-3 space-y-2 text-sm",children:[c.jsxs("div",{className:"flex items-center justify-between gap-2",children:[c.jsx("span",{style:{color:"var(--revka-text-faint)"},children:"Status"}),c.jsx(Ua,{status:e.status})]}),c.jsxs("div",{children:[c.jsx("span",{style:{color:"var(--revka-text-faint)"},children:"Started"}),": ",c.jsx("span",{style:{color:"var(--revka-text-primary)"},children:zf(e.started_at)||"-"})]}),c.jsxs("div",{children:[c.jsx("span",{style:{color:"var(--revka-text-faint)"},children:"Completed"}),": ",c.jsx("span",{style:{color:"var(--revka-text-primary)"},children:zf(e.completed_at)||"-"})]}),c.jsxs("div",{children:[c.jsx("span",{style:{color:"var(--revka-text-faint)"},children:"Steps"}),": ",c.jsxs("span",{style:{color:"var(--revka-text-primary)"},children:[e.steps_completed||"0"," / ",e.steps_total||"?"]})]}),i!==null?c.jsxs("div",{children:[c.jsx("span",{style:{color:"var(--revka-text-faint)"},children:"Expanded"}),": ",c.jsx("span",{style:{color:"var(--revka-text-primary)"},children:i})]}):null,s?c.jsxs("div",{children:[c.jsx("span",{style:{color:"var(--revka-text-faint)"},children:"Loop"}),": ",c.jsx("span",{className:"font-mono",style:{color:"var(--revka-text-primary)"},children:s})]}):null,e.error?c.jsx("div",{className:"rounded-[8px] border p-3 text-xs",style:{borderColor:"color-mix(in srgb, var(--revka-status-danger) 28%, transparent)",color:"var(--revka-status-danger)"},children:e.error}):null,n?c.jsx(Ss,{to:n,className:"inline-flex items-center gap-2 text-sm",style:{color:"var(--revka-signal-network)"},children:"Open workflow definition"}):null]}):c.jsx("div",{className:"mt-3 text-sm",style:{color:"var(--revka-text-faint)"},children:"No run selected."})]})}function Vpe({team:e}){return c.jsxs(qe,{className:"p-4",variant:"utility",children:[c.jsx("div",{className:"revka-kicker",children:"Team Summary"}),e?c.jsxs("div",{className:"mt-3 space-y-2 text-sm",children:[c.jsxs("div",{className:"flex items-center gap-3",children:[c.jsx(Ts,{src:e.avatar_url,alt:e.name,size:44,radius:12,kind:"team"}),c.jsx("div",{className:"min-w-0 text-sm font-semibold",style:{color:"var(--revka-text-primary)"},children:e.name})]}),c.jsxs("div",{children:[c.jsx("span",{style:{color:"var(--revka-text-faint)"},children:"Members"}),": ",c.jsx("span",{style:{color:"var(--revka-text-primary)"},children:e.members.length||e.member_count||0})]}),c.jsxs("div",{children:[c.jsx("span",{style:{color:"var(--revka-text-faint)"},children:"Edges"}),": ",c.jsx("span",{style:{color:"var(--revka-text-primary)"},children:e.edges.length||e.edge_count||0})]}),c.jsx("p",{style:{color:"var(--revka-text-secondary)"},children:e.description||"No description."})]}):c.jsx("div",{className:"mt-3 text-sm",style:{color:"var(--revka-text-faint)"},children:"No team selected."})]})}function Ype({member:e,footer:n}){return c.jsxs(qe,{className:"p-4",variant:"secondary",children:[c.jsx("div",{className:"revka-kicker",children:"Selected Member"}),e?c.jsxs("div",{className:"mt-3 space-y-2",children:[c.jsxs("div",{className:"flex items-center gap-3",children:[c.jsx(Ts,{src:e.avatar_url,alt:e.name,size:40,radius:10}),c.jsx("div",{className:"min-w-0 text-sm font-semibold",style:{color:"var(--revka-text-primary)"},children:e.name})]}),c.jsxs("div",{className:"text-xs uppercase tracking-[0.12em]",style:{color:"var(--revka-text-faint)"},children:[e.role," / ",e.agent_type]}),c.jsx("p",{className:"text-sm leading-6",style:{color:"var(--revka-text-secondary)"},children:e.identity}),c.jsxs("div",{className:"text-xs",style:{color:"var(--revka-text-secondary)"},children:["Expertise: ",e.expertise.join(", ")||"None"]}),n?c.jsx("div",{className:"pt-1",children:n}):null]}):c.jsx("div",{className:"mt-3 text-sm",style:{color:"var(--revka-text-faint)"},children:"Select a team member in the topology graph to inspect details."})]})}function Y7({run:e,active:n=!1,label:r="Selected Run"}){const{tpl:i}=an();if(!e)return null;const s=PA(e),a=LA(e,i);return c.jsx("div",{className:`revka-run-focus-banner ${n?"is-active":""}`,"aria-live":"polite",children:c.jsxs("div",{className:"flex items-start justify-between gap-3",children:[c.jsxs("div",{className:"min-w-0",children:[c.jsx("div",{className:"revka-kicker",children:r}),c.jsxs("div",{className:"mt-2 flex flex-wrap items-center gap-2",children:[c.jsxs("div",{className:"inline-flex items-center gap-2 text-sm font-semibold",style:{color:"var(--revka-text-primary)"},children:[c.jsx(xv,{className:"h-4 w-4",style:{color:"var(--revka-signal-network)"}}),c.jsx("span",{className:"truncate",children:e.workflow_name})]}),c.jsx("span",{className:"text-xs font-mono",style:{color:"var(--revka-text-faint)"},children:e.run_id.slice(0,8)})]}),c.jsxs("div",{className:"mt-2 flex flex-wrap items-center gap-2 text-xs",style:{color:"var(--revka-text-secondary)"},children:[c.jsxs("span",{children:[e.steps_completed||"0"," / ",e.steps_total||"?"," steps"]}),s!==null?c.jsxs(c.Fragment,{children:[c.jsx("span",{"aria-hidden":"true",children:"•"}),c.jsx("span",{children:i("runs.stats.expanded_steps",{count:s})})]}):null,a?c.jsxs(c.Fragment,{children:[c.jsx("span",{"aria-hidden":"true",children:"•"}),c.jsx("span",{className:"font-mono",children:a})]}):null,c.jsx("span",{"aria-hidden":"true",children:"•"}),c.jsx("span",{children:zf(e.started_at)||"start time unavailable"}),n?c.jsxs(c.Fragment,{children:[c.jsx("span",{"aria-hidden":"true",children:"•"}),c.jsxs("span",{className:"inline-flex items-center gap-1 font-semibold",style:{color:"var(--revka-signal-live)"},children:[c.jsx(eee,{className:"h-3.5 w-3.5"}),"Workspace updated below"]})]}):null]})]}),c.jsx(Ua,{status:e.status})]})})}function oi({kicker:e,description:n,actions:r}){return!e&&!n&&!r?null:c.jsxs("div",{className:"flex flex-col gap-3 lg:flex-row lg:items-end lg:justify-between",children:[c.jsxs("div",{children:[e?c.jsx("div",{className:"revka-kicker",children:e}):null,n?c.jsx("p",{className:"mt-2 max-w-3xl text-sm",style:{color:"var(--revka-text-secondary)"},children:n}):null]}),r?c.jsx("div",{className:"flex flex-wrap items-center gap-2",children:r}):null]})}const Gpe={REPORTS_TO:{stroke:"#a855f7"},SUPPORTS:{stroke:"#22c55e",strokeDasharray:"5 5"},DEPENDS_ON:{stroke:"#f97316",animated:!0}},Xpe={stroke:"#6b7280"},Qpe=e=>Gpe[e]??Xpe,Zpe={REPORTS_TO:"Reports To",SUPPORTS:"Supports",DEPENDS_ON:"Depends On"},Jpe=e=>Zpe[e]??e.replace(/_/g," ");function eme(e){return e==="coder"?"var(--pc-accent)":e==="reviewer"?"#a855f7":"#22c55e"}function G7(e,n){var g,_;if(e.length===0)return e;const r=new Map,i=new Map;for(const x of e)r.set(x.id,[]),i.set(x.id,[]);for(const x of n)(g=r.get(x.source))==null||g.push(x.target),(_=i.get(x.target))==null||_.push(x.source);const s=e.filter(x=>(i.get(x.id)??[]).length===0);if(s.length===0)return e.map((x,v)=>({...x,position:{x:v*250,y:0}}));const a=new Map,o=new Set,l=[];for(const x of s)a.set(x.id,0),l.push(x.id),o.add(x.id);for(;l.length>0;){const x=l.shift(),v=a.get(x)??0;for(const S of r.get(x)??[])o.has(S)||(o.add(S),a.set(S,v+1),l.push(S))}for(const x of e)a.has(x.id)||a.set(x.id,0);const u=new Map;for(const[x,v]of a)u.has(v)||u.set(v,[]),u.get(v).push(x);const d=340,p=260,f=new Map;for(const[x,v]of[...u.entries()].sort((S,w)=>S[0]-w[0])){const S=d,j=-((v.length-1)*S)/2;v.forEach((C,T)=>{f.set(C,{x:j+T*S,y:x*p})})}return e.map(x=>({...x,position:f.get(x.id)??{x:0,y:0}}))}function Qr(e){if(typeof e=="string"||typeof e=="number")return""+e;let n="";if(Array.isArray(e))for(let r=0,i;r<e.length;r++)(i=Qr(e[r]))!==""&&(n+=(n&&" ")+i);else for(let r in e)e[r]&&(n+=(n&&" ")+r);return n}var tme={value:()=>{}};function Lv(){for(var e=0,n=arguments.length,r={},i;e<n;++e){if(!(i=arguments[e]+"")||i in r||/[\s.]/.test(i))throw new Error("illegal type: "+i);r[i]=[]}return new Ex(r)}function Ex(e){this._=e}function nme(e,n){return e.trim().split(/^|\s+/).map(function(r){var i="",s=r.indexOf(".");if(s>=0&&(i=r.slice(s+1),r=r.slice(0,s)),r&&!n.hasOwnProperty(r))throw new Error("unknown type: "+r);return{type:r,name:i}})}Ex.prototype=Lv.prototype={constructor:Ex,on:function(e,n){var r=this._,i=nme(e+"",r),s,a=-1,o=i.length;if(arguments.length<2){for(;++a<o;)if((s=(e=i[a]).type)&&(s=rme(r[s],e.name)))return s;return}if(n!=null&&typeof n!="function")throw new Error("invalid callback: "+n);for(;++a<o;)if(s=(e=i[a]).type)r[s]=UD(r[s],e.name,n);else if(n==null)for(s in r)r[s]=UD(r[s],e.name,null);return this},copy:function(){var e={},n=this._;for(var r in n)e[r]=n[r].slice();return new Ex(e)},call:function(e,n){if((s=arguments.length-2)>0)for(var r=new Array(s),i=0,s,a;i<s;++i)r[i]=arguments[i+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(a=this._[e],i=0,s=a.length;i<s;++i)a[i].value.apply(n,r)},apply:function(e,n,r){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var i=this._[e],s=0,a=i.length;s<a;++s)i[s].value.apply(n,r)}};function rme(e,n){for(var r=0,i=e.length,s;r<i;++r)if((s=e[r]).name===n)return s.value}function UD(e,n,r){for(var i=0,s=e.length;i<s;++i)if(e[i].name===n){e[i]=tme,e=e.slice(0,i).concat(e.slice(i+1));break}return r!=null&&e.push({name:n,value:r}),e}var Lj="http://www.w3.org/1999/xhtml";const KD={svg:"http://www.w3.org/2000/svg",xhtml:Lj,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function F0(e){var n=e+="",r=n.indexOf(":");return r>=0&&(n=e.slice(0,r))!=="xmlns"&&(e=e.slice(r+1)),KD.hasOwnProperty(n)?{space:KD[n],local:e}:e}function ime(e){return function(){var n=this.ownerDocument,r=this.namespaceURI;return r===Lj&&n.documentElement.namespaceURI===Lj?n.createElement(e):n.createElementNS(r,e)}}function sme(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function X7(e){var n=F0(e);return(n.local?sme:ime)(n)}function ame(){}function IA(e){return e==null?ame:function(){return this.querySelector(e)}}function ome(e){typeof e!="function"&&(e=IA(e));for(var n=this._groups,r=n.length,i=new Array(r),s=0;s<r;++s)for(var a=n[s],o=a.length,l=i[s]=new Array(o),u,d,p=0;p<o;++p)(u=a[p])&&(d=e.call(u,u.__data__,p,a))&&("__data__"in u&&(d.__data__=u.__data__),l[p]=d);return new ia(i,this._parents)}function lme(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function cme(){return[]}function Q7(e){return e==null?cme:function(){return this.querySelectorAll(e)}}function ume(e){return function(){return lme(e.apply(this,arguments))}}function dme(e){typeof e=="function"?e=ume(e):e=Q7(e);for(var n=this._groups,r=n.length,i=[],s=[],a=0;a<r;++a)for(var o=n[a],l=o.length,u,d=0;d<l;++d)(u=o[d])&&(i.push(e.call(u,u.__data__,d,o)),s.push(u));return new ia(i,s)}function Z7(e){return function(){return this.matches(e)}}function J7(e){return function(n){return n.matches(e)}}var hme=Array.prototype.find;function fme(e){return function(){return hme.call(this.children,e)}}function pme(){return this.firstElementChild}function mme(e){return this.select(e==null?pme:fme(typeof e=="function"?e:J7(e)))}var gme=Array.prototype.filter;function vme(){return Array.from(this.children)}function yme(e){return function(){return gme.call(this.children,e)}}function _me(e){return this.selectAll(e==null?vme:yme(typeof e=="function"?e:J7(e)))}function xme(e){typeof e!="function"&&(e=Z7(e));for(var n=this._groups,r=n.length,i=new Array(r),s=0;s<r;++s)for(var a=n[s],o=a.length,l=i[s]=[],u,d=0;d<o;++d)(u=a[d])&&e.call(u,u.__data__,d,a)&&l.push(u);return new ia(i,this._parents)}function eF(e){return new Array(e.length)}function bme(){return new ia(this._enter||this._groups.map(eF),this._parents)}function bb(e,n){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=n}bb.prototype={constructor:bb,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,n){return this._parent.insertBefore(e,n)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}};function kme(e){return function(){return e}}function wme(e,n,r,i,s,a){for(var o=0,l,u=n.length,d=a.length;o<d;++o)(l=n[o])?(l.__data__=a[o],i[o]=l):r[o]=new bb(e,a[o]);for(;o<u;++o)(l=n[o])&&(s[o]=l)}function Sme(e,n,r,i,s,a,o){var l,u,d=new Map,p=n.length,f=a.length,g=new Array(p),_;for(l=0;l<p;++l)(u=n[l])&&(g[l]=_=o.call(u,u.__data__,l,n)+"",d.has(_)?s[l]=u:d.set(_,u));for(l=0;l<f;++l)_=o.call(e,a[l],l,a)+"",(u=d.get(_))?(i[l]=u,u.__data__=a[l],d.delete(_)):r[l]=new bb(e,a[l]);for(l=0;l<p;++l)(u=n[l])&&d.get(g[l])===u&&(s[l]=u)}function Cme(e){return e.__data__}function jme(e,n){if(!arguments.length)return Array.from(this,Cme);var r=n?Sme:wme,i=this._parents,s=this._groups;typeof e!="function"&&(e=kme(e));for(var a=s.length,o=new Array(a),l=new Array(a),u=new Array(a),d=0;d<a;++d){var p=i[d],f=s[d],g=f.length,_=Nme(e.call(p,p&&p.__data__,d,i)),x=_.length,v=l[d]=new Array(x),S=o[d]=new Array(x),w=u[d]=new Array(g);r(p,f,v,S,w,_,n);for(var j=0,C=0,T,E;j<x;++j)if(T=v[j]){for(j>=C&&(C=j+1);!(E=S[C])&&++C<x;);T._next=E||null}}return o=new ia(o,i),o._enter=l,o._exit=u,o}function Nme(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function Eme(){return new ia(this._exit||this._groups.map(eF),this._parents)}function Ame(e,n,r){var i=this.enter(),s=this,a=this.exit();return typeof e=="function"?(i=e(i),i&&(i=i.selection())):i=i.append(e+""),n!=null&&(s=n(s),s&&(s=s.selection())),r==null?a.remove():r(a),i&&s?i.merge(s).order():s}function Tme(e){for(var n=e.selection?e.selection():e,r=this._groups,i=n._groups,s=r.length,a=i.length,o=Math.min(s,a),l=new Array(s),u=0;u<o;++u)for(var d=r[u],p=i[u],f=d.length,g=l[u]=new Array(f),_,x=0;x<f;++x)(_=d[x]||p[x])&&(g[x]=_);for(;u<s;++u)l[u]=r[u];return new ia(l,this._parents)}function Mme(){for(var e=this._groups,n=-1,r=e.length;++n<r;)for(var i=e[n],s=i.length-1,a=i[s],o;--s>=0;)(o=i[s])&&(a&&o.compareDocumentPosition(a)^4&&a.parentNode.insertBefore(o,a),a=o);return this}function Rme(e){e||(e=Ome);function n(f,g){return f&&g?e(f.__data__,g.__data__):!f-!g}for(var r=this._groups,i=r.length,s=new Array(i),a=0;a<i;++a){for(var o=r[a],l=o.length,u=s[a]=new Array(l),d,p=0;p<l;++p)(d=o[p])&&(u[p]=d);u.sort(n)}return new ia(s,this._parents).order()}function Ome(e,n){return e<n?-1:e>n?1:e>=n?0:NaN}function Dme(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function Pme(){return Array.from(this)}function Lme(){for(var e=this._groups,n=0,r=e.length;n<r;++n)for(var i=e[n],s=0,a=i.length;s<a;++s){var o=i[s];if(o)return o}return null}function Ime(){let e=0;for(const n of this)++e;return e}function Bme(){return!this.node()}function zme(e){for(var n=this._groups,r=0,i=n.length;r<i;++r)for(var s=n[r],a=0,o=s.length,l;a<o;++a)(l=s[a])&&e.call(l,l.__data__,a,s);return this}function $me(e){return function(){this.removeAttribute(e)}}function Fme(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Hme(e,n){return function(){this.setAttribute(e,n)}}function Wme(e,n){return function(){this.setAttributeNS(e.space,e.local,n)}}function qme(e,n){return function(){var r=n.apply(this,arguments);r==null?this.removeAttribute(e):this.setAttribute(e,r)}}function Ume(e,n){return function(){var r=n.apply(this,arguments);r==null?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,r)}}function Kme(e,n){var r=F0(e);if(arguments.length<2){var i=this.node();return r.local?i.getAttributeNS(r.space,r.local):i.getAttribute(r)}return this.each((n==null?r.local?Fme:$me:typeof n=="function"?r.local?Ume:qme:r.local?Wme:Hme)(r,n))}function tF(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function Vme(e){return function(){this.style.removeProperty(e)}}function Yme(e,n,r){return function(){this.style.setProperty(e,n,r)}}function Gme(e,n,r){return function(){var i=n.apply(this,arguments);i==null?this.style.removeProperty(e):this.style.setProperty(e,i,r)}}function Xme(e,n,r){return arguments.length>1?this.each((n==null?Vme:typeof n=="function"?Gme:Yme)(e,n,r??"")):$f(this.node(),e)}function $f(e,n){return e.style.getPropertyValue(n)||tF(e).getComputedStyle(e,null).getPropertyValue(n)}function Qme(e){return function(){delete this[e]}}function Zme(e,n){return function(){this[e]=n}}function Jme(e,n){return function(){var r=n.apply(this,arguments);r==null?delete this[e]:this[e]=r}}function ege(e,n){return arguments.length>1?this.each((n==null?Qme:typeof n=="function"?Jme:Zme)(e,n)):this.node()[e]}function nF(e){return e.trim().split(/^|\s+/)}function BA(e){return e.classList||new rF(e)}function rF(e){this._node=e,this._names=nF(e.getAttribute("class")||"")}rF.prototype={add:function(e){var n=this._names.indexOf(e);n<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var n=this._names.indexOf(e);n>=0&&(this._names.splice(n,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};function iF(e,n){for(var r=BA(e),i=-1,s=n.length;++i<s;)r.add(n[i])}function sF(e,n){for(var r=BA(e),i=-1,s=n.length;++i<s;)r.remove(n[i])}function tge(e){return function(){iF(this,e)}}function nge(e){return function(){sF(this,e)}}function rge(e,n){return function(){(n.apply(this,arguments)?iF:sF)(this,e)}}function ige(e,n){var r=nF(e+"");if(arguments.length<2){for(var i=BA(this.node()),s=-1,a=r.length;++s<a;)if(!i.contains(r[s]))return!1;return!0}return this.each((typeof n=="function"?rge:n?tge:nge)(r,n))}function sge(){this.textContent=""}function age(e){return function(){this.textContent=e}}function oge(e){return function(){var n=e.apply(this,arguments);this.textContent=n??""}}function lge(e){return arguments.length?this.each(e==null?sge:(typeof e=="function"?oge:age)(e)):this.node().textContent}function cge(){this.innerHTML=""}function uge(e){return function(){this.innerHTML=e}}function dge(e){return function(){var n=e.apply(this,arguments);this.innerHTML=n??""}}function hge(e){return arguments.length?this.each(e==null?cge:(typeof e=="function"?dge:uge)(e)):this.node().innerHTML}function fge(){this.nextSibling&&this.parentNode.appendChild(this)}function pge(){return this.each(fge)}function mge(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function gge(){return this.each(mge)}function vge(e){var n=typeof e=="function"?e:X7(e);return this.select(function(){return this.appendChild(n.apply(this,arguments))})}function yge(){return null}function _ge(e,n){var r=typeof e=="function"?e:X7(e),i=n==null?yge:typeof n=="function"?n:IA(n);return this.select(function(){return this.insertBefore(r.apply(this,arguments),i.apply(this,arguments)||null)})}function xge(){var e=this.parentNode;e&&e.removeChild(this)}function bge(){return this.each(xge)}function kge(){var e=this.cloneNode(!1),n=this.parentNode;return n?n.insertBefore(e,this.nextSibling):e}function wge(){var e=this.cloneNode(!0),n=this.parentNode;return n?n.insertBefore(e,this.nextSibling):e}function Sge(e){return this.select(e?wge:kge)}function Cge(e){return arguments.length?this.property("__data__",e):this.node().__data__}function jge(e){return function(n){e.call(this,n,this.__data__)}}function Nge(e){return e.trim().split(/^|\s+/).map(function(n){var r="",i=n.indexOf(".");return i>=0&&(r=n.slice(i+1),n=n.slice(0,i)),{type:n,name:r}})}function Ege(e){return function(){var n=this.__on;if(n){for(var r=0,i=-1,s=n.length,a;r<s;++r)a=n[r],(!e.type||a.type===e.type)&&a.name===e.name?this.removeEventListener(a.type,a.listener,a.options):n[++i]=a;++i?n.length=i:delete this.__on}}}function Age(e,n,r){return function(){var i=this.__on,s,a=jge(n);if(i){for(var o=0,l=i.length;o<l;++o)if((s=i[o]).type===e.type&&s.name===e.name){this.removeEventListener(s.type,s.listener,s.options),this.addEventListener(s.type,s.listener=a,s.options=r),s.value=n;return}}this.addEventListener(e.type,a,r),s={type:e.type,name:e.name,value:n,listener:a,options:r},i?i.push(s):this.__on=[s]}}function Tge(e,n,r){var i=Nge(e+""),s,a=i.length,o;if(arguments.length<2){var l=this.node().__on;if(l){for(var u=0,d=l.length,p;u<d;++u)for(s=0,p=l[u];s<a;++s)if((o=i[s]).type===p.type&&o.name===p.name)return p.value}return}for(l=n?Age:Ege,s=0;s<a;++s)this.each(l(i[s],n,r));return this}function aF(e,n,r){var i=tF(e),s=i.CustomEvent;typeof s=="function"?s=new s(n,r):(s=i.document.createEvent("Event"),r?(s.initEvent(n,r.bubbles,r.cancelable),s.detail=r.detail):s.initEvent(n,!1,!1)),e.dispatchEvent(s)}function Mge(e,n){return function(){return aF(this,e,n)}}function Rge(e,n){return function(){return aF(this,e,n.apply(this,arguments))}}function Oge(e,n){return this.each((typeof n=="function"?Rge:Mge)(e,n))}function*Dge(){for(var e=this._groups,n=0,r=e.length;n<r;++n)for(var i=e[n],s=0,a=i.length,o;s<a;++s)(o=i[s])&&(yield o)}var oF=[null];function ia(e,n){this._groups=e,this._parents=n}function Iv(){return new ia([[document.documentElement]],oF)}function Pge(){return this}ia.prototype=Iv.prototype={constructor:ia,select:ome,selectAll:dme,selectChild:mme,selectChildren:_me,filter:xme,data:jme,enter:bme,exit:Eme,join:Ame,merge:Tme,selection:Pge,order:Mme,sort:Rme,call:Dme,nodes:Pme,node:Lme,size:Ime,empty:Bme,each:zme,attr:Kme,style:Xme,property:ege,classed:ige,text:lge,html:hge,raise:pge,lower:gge,append:vge,insert:_ge,remove:bge,clone:Sge,datum:Cge,on:Tge,dispatch:Oge,[Symbol.iterator]:Dge};function qi(e){return typeof e=="string"?new ia([[document.querySelector(e)]],[document.documentElement]):new ia([[e]],oF)}function Lge(e){let n;for(;n=e.sourceEvent;)e=n;return e}function Sa(e,n){if(e=Lge(e),n===void 0&&(n=e.currentTarget),n){var r=n.ownerSVGElement||n;if(r.createSVGPoint){var i=r.createSVGPoint();return i.x=e.clientX,i.y=e.clientY,i=i.matrixTransform(n.getScreenCTM().inverse()),[i.x,i.y]}if(n.getBoundingClientRect){var s=n.getBoundingClientRect();return[e.clientX-s.left-n.clientLeft,e.clientY-s.top-n.clientTop]}}return[e.pageX,e.pageY]}const Ige={passive:!1},$g={capture:!0,passive:!1};function SS(e){e.stopImmediatePropagation()}function kf(e){e.preventDefault(),e.stopImmediatePropagation()}function lF(e){var n=e.document.documentElement,r=qi(e).on("dragstart.drag",kf,$g);"onselectstart"in n?r.on("selectstart.drag",kf,$g):(n.__noselect=n.style.MozUserSelect,n.style.MozUserSelect="none")}function cF(e,n){var r=e.document.documentElement,i=qi(e).on("dragstart.drag",null);n&&(i.on("click.drag",kf,$g),setTimeout(function(){i.on("click.drag",null)},0)),"onselectstart"in r?i.on("selectstart.drag",null):(r.style.MozUserSelect=r.__noselect,delete r.__noselect)}const y_=e=>()=>e;function Ij(e,{sourceEvent:n,subject:r,target:i,identifier:s,active:a,x:o,y:l,dx:u,dy:d,dispatch:p}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:n,enumerable:!0,configurable:!0},subject:{value:r,enumerable:!0,configurable:!0},target:{value:i,enumerable:!0,configurable:!0},identifier:{value:s,enumerable:!0,configurable:!0},active:{value:a,enumerable:!0,configurable:!0},x:{value:o,enumerable:!0,configurable:!0},y:{value:l,enumerable:!0,configurable:!0},dx:{value:u,enumerable:!0,configurable:!0},dy:{value:d,enumerable:!0,configurable:!0},_:{value:p}})}Ij.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function Bge(e){return!e.ctrlKey&&!e.button}function zge(){return this.parentNode}function $ge(e,n){return n??{x:e.x,y:e.y}}function Fge(){return navigator.maxTouchPoints||"ontouchstart"in this}function zA(){var e=Bge,n=zge,r=$ge,i=Fge,s={},a=Lv("start","drag","end"),o=0,l,u,d,p,f=0;function g(T){T.on("mousedown.drag",_).filter(i).on("touchstart.drag",S).on("touchmove.drag",w,Ige).on("touchend.drag touchcancel.drag",j).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function _(T,E){if(!(p||!e.call(this,T,E))){var A=C(this,n.call(this,T,E),T,E,"mouse");A&&(qi(T.view).on("mousemove.drag",x,$g).on("mouseup.drag",v,$g),lF(T.view),SS(T),d=!1,l=T.clientX,u=T.clientY,A("start",T))}}function x(T){if(kf(T),!d){var E=T.clientX-l,A=T.clientY-u;d=E*E+A*A>f}s.mouse("drag",T)}function v(T){qi(T.view).on("mousemove.drag mouseup.drag",null),cF(T.view,d),kf(T),s.mouse("end",T)}function S(T,E){if(e.call(this,T,E)){var A=T.changedTouches,O=n.call(this,T,E),F=A.length,L,$;for(L=0;L<F;++L)($=C(this,O,T,E,A[L].identifier,A[L]))&&(SS(T),$("start",T,A[L]))}}function w(T){var E=T.changedTouches,A=E.length,O,F;for(O=0;O<A;++O)(F=s[E[O].identifier])&&(kf(T),F("drag",T,E[O]))}function j(T){var E=T.changedTouches,A=E.length,O,F;for(p&&clearTimeout(p),p=setTimeout(function(){p=null},500),O=0;O<A;++O)(F=s[E[O].identifier])&&(SS(T),F("end",T,E[O]))}function C(T,E,A,O,F,L){var $=a.copy(),z=Sa(L||A,E),B,H,D;if((D=r.call(T,new Ij("beforestart",{sourceEvent:A,target:g,identifier:F,active:o,x:z[0],y:z[1],dx:0,dy:0,dispatch:$}),O))!=null)return B=D.x-z[0]||0,H=D.y-z[1]||0,function U(I,X,K){var Q=z,V;switch(I){case"start":s[F]=U,V=o++;break;case"end":delete s[F],--o;case"drag":z=Sa(K||X,E),V=o;break}$.call(I,T,new Ij(I,{sourceEvent:X,subject:D,target:g,identifier:F,active:V,x:z[0]+B,y:z[1]+H,dx:z[0]-Q[0],dy:z[1]-Q[1],dispatch:$}),O)}}return g.filter=function(T){return arguments.length?(e=typeof T=="function"?T:y_(!!T),g):e},g.container=function(T){return arguments.length?(n=typeof T=="function"?T:y_(T),g):n},g.subject=function(T){return arguments.length?(r=typeof T=="function"?T:y_(T),g):r},g.touchable=function(T){return arguments.length?(i=typeof T=="function"?T:y_(!!T),g):i},g.on=function(){var T=a.on.apply(a,arguments);return T===a?g:T},g.clickDistance=function(T){return arguments.length?(f=(T=+T)*T,g):Math.sqrt(f)},g}function $A(e,n,r){e.prototype=n.prototype=r,r.constructor=e}function uF(e,n){var r=Object.create(e.prototype);for(var i in n)r[i]=n[i];return r}function Bv(){}var Fg=.7,kb=1/Fg,wf="\\s*([+-]?\\d+)\\s*",Hg="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Qo="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",Hge=/^#([0-9a-f]{3,8})$/,Wge=new RegExp(`^rgb\\(${wf},${wf},${wf}\\)$`),qge=new RegExp(`^rgb\\(${Qo},${Qo},${Qo}\\)$`),Uge=new RegExp(`^rgba\\(${wf},${wf},${wf},${Hg}\\)$`),Kge=new RegExp(`^rgba\\(${Qo},${Qo},${Qo},${Hg}\\)$`),Vge=new RegExp(`^hsl\\(${Hg},${Qo},${Qo}\\)$`),Yge=new RegExp(`^hsla\\(${Hg},${Qo},${Qo},${Hg}\\)$`),VD={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};$A(Bv,Dd,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:YD,formatHex:YD,formatHex8:Gge,formatHsl:Xge,formatRgb:GD,toString:GD});function YD(){return this.rgb().formatHex()}function Gge(){return this.rgb().formatHex8()}function Xge(){return dF(this).formatHsl()}function GD(){return this.rgb().formatRgb()}function Dd(e){var n,r;return e=(e+"").trim().toLowerCase(),(n=Hge.exec(e))?(r=n[1].length,n=parseInt(n[1],16),r===6?XD(n):r===3?new Ns(n>>8&15|n>>4&240,n>>4&15|n&240,(n&15)<<4|n&15,1):r===8?__(n>>24&255,n>>16&255,n>>8&255,(n&255)/255):r===4?__(n>>12&15|n>>8&240,n>>8&15|n>>4&240,n>>4&15|n&240,((n&15)<<4|n&15)/255):null):(n=Wge.exec(e))?new Ns(n[1],n[2],n[3],1):(n=qge.exec(e))?new Ns(n[1]*255/100,n[2]*255/100,n[3]*255/100,1):(n=Uge.exec(e))?__(n[1],n[2],n[3],n[4]):(n=Kge.exec(e))?__(n[1]*255/100,n[2]*255/100,n[3]*255/100,n[4]):(n=Vge.exec(e))?JD(n[1],n[2]/100,n[3]/100,1):(n=Yge.exec(e))?JD(n[1],n[2]/100,n[3]/100,n[4]):VD.hasOwnProperty(e)?XD(VD[e]):e==="transparent"?new Ns(NaN,NaN,NaN,0):null}function XD(e){return new Ns(e>>16&255,e>>8&255,e&255,1)}function __(e,n,r,i){return i<=0&&(e=n=r=NaN),new Ns(e,n,r,i)}function Qge(e){return e instanceof Bv||(e=Dd(e)),e?(e=e.rgb(),new Ns(e.r,e.g,e.b,e.opacity)):new Ns}function Bj(e,n,r,i){return arguments.length===1?Qge(e):new Ns(e,n,r,i??1)}function Ns(e,n,r,i){this.r=+e,this.g=+n,this.b=+r,this.opacity=+i}$A(Ns,Bj,uF(Bv,{brighter(e){return e=e==null?kb:Math.pow(kb,e),new Ns(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?Fg:Math.pow(Fg,e),new Ns(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new Ns(Sd(this.r),Sd(this.g),Sd(this.b),wb(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:QD,formatHex:QD,formatHex8:Zge,formatRgb:ZD,toString:ZD}));function QD(){return`#${gd(this.r)}${gd(this.g)}${gd(this.b)}`}function Zge(){return`#${gd(this.r)}${gd(this.g)}${gd(this.b)}${gd((isNaN(this.opacity)?1:this.opacity)*255)}`}function ZD(){const e=wb(this.opacity);return`${e===1?"rgb(":"rgba("}${Sd(this.r)}, ${Sd(this.g)}, ${Sd(this.b)}${e===1?")":`, ${e})`}`}function wb(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Sd(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function gd(e){return e=Sd(e),(e<16?"0":"")+e.toString(16)}function JD(e,n,r,i){return i<=0?e=n=r=NaN:r<=0||r>=1?e=n=NaN:n<=0&&(e=NaN),new Ka(e,n,r,i)}function dF(e){if(e instanceof Ka)return new Ka(e.h,e.s,e.l,e.opacity);if(e instanceof Bv||(e=Dd(e)),!e)return new Ka;if(e instanceof Ka)return e;e=e.rgb();var n=e.r/255,r=e.g/255,i=e.b/255,s=Math.min(n,r,i),a=Math.max(n,r,i),o=NaN,l=a-s,u=(a+s)/2;return l?(n===a?o=(r-i)/l+(r<i)*6:r===a?o=(i-n)/l+2:o=(n-r)/l+4,l/=u<.5?a+s:2-a-s,o*=60):l=u>0&&u<1?0:o,new Ka(o,l,u,e.opacity)}function Jge(e,n,r,i){return arguments.length===1?dF(e):new Ka(e,n,r,i??1)}function Ka(e,n,r,i){this.h=+e,this.s=+n,this.l=+r,this.opacity=+i}$A(Ka,Jge,uF(Bv,{brighter(e){return e=e==null?kb:Math.pow(kb,e),new Ka(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?Fg:Math.pow(Fg,e),new Ka(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,n=isNaN(e)||isNaN(this.s)?0:this.s,r=this.l,i=r+(r<.5?r:1-r)*n,s=2*r-i;return new Ns(CS(e>=240?e-240:e+120,s,i),CS(e,s,i),CS(e<120?e+240:e-120,s,i),this.opacity)},clamp(){return new Ka(eP(this.h),x_(this.s),x_(this.l),wb(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const e=wb(this.opacity);return`${e===1?"hsl(":"hsla("}${eP(this.h)}, ${x_(this.s)*100}%, ${x_(this.l)*100}%${e===1?")":`, ${e})`}`}}));function eP(e){return e=(e||0)%360,e<0?e+360:e}function x_(e){return Math.max(0,Math.min(1,e||0))}function CS(e,n,r){return(e<60?n+(r-n)*e/60:e<180?r:e<240?n+(r-n)*(240-e)/60:n)*255}const FA=e=>()=>e;function eve(e,n){return function(r){return e+r*n}}function tve(e,n,r){return e=Math.pow(e,r),n=Math.pow(n,r)-e,r=1/r,function(i){return Math.pow(e+i*n,r)}}function nve(e){return(e=+e)==1?hF:function(n,r){return r-n?tve(n,r,e):FA(isNaN(n)?r:n)}}function hF(e,n){var r=n-e;return r?eve(e,r):FA(isNaN(e)?n:e)}const Sb=(function e(n){var r=nve(n);function i(s,a){var o=r((s=Bj(s)).r,(a=Bj(a)).r),l=r(s.g,a.g),u=r(s.b,a.b),d=hF(s.opacity,a.opacity);return function(p){return s.r=o(p),s.g=l(p),s.b=u(p),s.opacity=d(p),s+""}}return i.gamma=e,i})(1);function rve(e,n){n||(n=[]);var r=e?Math.min(n.length,e.length):0,i=n.slice(),s;return function(a){for(s=0;s<r;++s)i[s]=e[s]*(1-a)+n[s]*a;return i}}function ive(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function sve(e,n){var r=n?n.length:0,i=e?Math.min(r,e.length):0,s=new Array(i),a=new Array(r),o;for(o=0;o<i;++o)s[o]=dg(e[o],n[o]);for(;o<r;++o)a[o]=n[o];return function(l){for(o=0;o<i;++o)a[o]=s[o](l);return a}}function ave(e,n){var r=new Date;return e=+e,n=+n,function(i){return r.setTime(e*(1-i)+n*i),r}}function Po(e,n){return e=+e,n=+n,function(r){return e*(1-r)+n*r}}function ove(e,n){var r={},i={},s;(e===null||typeof e!="object")&&(e={}),(n===null||typeof n!="object")&&(n={});for(s in n)s in e?r[s]=dg(e[s],n[s]):i[s]=n[s];return function(a){for(s in r)i[s]=r[s](a);return i}}var zj=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,jS=new RegExp(zj.source,"g");function lve(e){return function(){return e}}function cve(e){return function(n){return e(n)+""}}function fF(e,n){var r=zj.lastIndex=jS.lastIndex=0,i,s,a,o=-1,l=[],u=[];for(e=e+"",n=n+"";(i=zj.exec(e))&&(s=jS.exec(n));)(a=s.index)>r&&(a=n.slice(r,a),l[o]?l[o]+=a:l[++o]=a),(i=i[0])===(s=s[0])?l[o]?l[o]+=s:l[++o]=s:(l[++o]=null,u.push({i:o,x:Po(i,s)})),r=jS.lastIndex;return r<n.length&&(a=n.slice(r),l[o]?l[o]+=a:l[++o]=a),l.length<2?u[0]?cve(u[0].x):lve(n):(n=u.length,function(d){for(var p=0,f;p<n;++p)l[(f=u[p]).i]=f.x(d);return l.join("")})}function dg(e,n){var r=typeof n,i;return n==null||r==="boolean"?FA(n):(r==="number"?Po:r==="string"?(i=Dd(n))?(n=i,Sb):fF:n instanceof Dd?Sb:n instanceof Date?ave:ive(n)?rve:Array.isArray(n)?sve:typeof n.valueOf!="function"&&typeof n.toString!="function"||isNaN(n)?ove:Po)(e,n)}var tP=180/Math.PI,$j={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function pF(e,n,r,i,s,a){var o,l,u;return(o=Math.sqrt(e*e+n*n))&&(e/=o,n/=o),(u=e*r+n*i)&&(r-=e*u,i-=n*u),(l=Math.sqrt(r*r+i*i))&&(r/=l,i/=l,u/=l),e*i<n*r&&(e=-e,n=-n,u=-u,o=-o),{translateX:s,translateY:a,rotate:Math.atan2(n,e)*tP,skewX:Math.atan(u)*tP,scaleX:o,scaleY:l}}var b_;function uve(e){const n=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return n.isIdentity?$j:pF(n.a,n.b,n.c,n.d,n.e,n.f)}function dve(e){return e==null||(b_||(b_=document.createElementNS("http://www.w3.org/2000/svg","g")),b_.setAttribute("transform",e),!(e=b_.transform.baseVal.consolidate()))?$j:(e=e.matrix,pF(e.a,e.b,e.c,e.d,e.e,e.f))}function mF(e,n,r,i){function s(d){return d.length?d.pop()+" ":""}function a(d,p,f,g,_,x){if(d!==f||p!==g){var v=_.push("translate(",null,n,null,r);x.push({i:v-4,x:Po(d,f)},{i:v-2,x:Po(p,g)})}else(f||g)&&_.push("translate("+f+n+g+r)}function o(d,p,f,g){d!==p?(d-p>180?p+=360:p-d>180&&(d+=360),g.push({i:f.push(s(f)+"rotate(",null,i)-2,x:Po(d,p)})):p&&f.push(s(f)+"rotate("+p+i)}function l(d,p,f,g){d!==p?g.push({i:f.push(s(f)+"skewX(",null,i)-2,x:Po(d,p)}):p&&f.push(s(f)+"skewX("+p+i)}function u(d,p,f,g,_,x){if(d!==f||p!==g){var v=_.push(s(_)+"scale(",null,",",null,")");x.push({i:v-4,x:Po(d,f)},{i:v-2,x:Po(p,g)})}else(f!==1||g!==1)&&_.push(s(_)+"scale("+f+","+g+")")}return function(d,p){var f=[],g=[];return d=e(d),p=e(p),a(d.translateX,d.translateY,p.translateX,p.translateY,f,g),o(d.rotate,p.rotate,f,g),l(d.skewX,p.skewX,f,g),u(d.scaleX,d.scaleY,p.scaleX,p.scaleY,f,g),d=p=null,function(_){for(var x=-1,v=g.length,S;++x<v;)f[(S=g[x]).i]=S.x(_);return f.join("")}}}var hve=mF(uve,"px, ","px)","deg)"),fve=mF(dve,", ",")",")"),pve=1e-12;function nP(e){return((e=Math.exp(e))+1/e)/2}function mve(e){return((e=Math.exp(e))-1/e)/2}function gve(e){return((e=Math.exp(2*e))-1)/(e+1)}const Ax=(function e(n,r,i){function s(a,o){var l=a[0],u=a[1],d=a[2],p=o[0],f=o[1],g=o[2],_=p-l,x=f-u,v=_*_+x*x,S,w;if(v<pve)w=Math.log(g/d)/n,S=function(O){return[l+O*_,u+O*x,d*Math.exp(n*O*w)]};else{var j=Math.sqrt(v),C=(g*g-d*d+i*v)/(2*d*r*j),T=(g*g-d*d-i*v)/(2*g*r*j),E=Math.log(Math.sqrt(C*C+1)-C),A=Math.log(Math.sqrt(T*T+1)-T);w=(A-E)/n,S=function(O){var F=O*w,L=nP(E),$=d/(r*j)*(L*gve(n*F+E)-mve(E));return[l+$*_,u+$*x,d*L/nP(n*F+E)]}}return S.duration=w*1e3*n/Math.SQRT2,S}return s.rho=function(a){var o=Math.max(.001,+a),l=o*o,u=l*l;return e(o,l,u)},s})(Math.SQRT2,2,4);var Ff=0,Km=0,vm=0,gF=1e3,Cb,Vm,jb=0,Pd=0,H0=0,Wg=typeof performance=="object"&&performance.now?performance:Date,vF=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function HA(){return Pd||(vF(vve),Pd=Wg.now()+H0)}function vve(){Pd=0}function Nb(){this._call=this._time=this._next=null}Nb.prototype=WA.prototype={constructor:Nb,restart:function(e,n,r){if(typeof e!="function")throw new TypeError("callback is not a function");r=(r==null?HA():+r)+(n==null?0:+n),!this._next&&Vm!==this&&(Vm?Vm._next=this:Cb=this,Vm=this),this._call=e,this._time=r,Fj()},stop:function(){this._call&&(this._call=null,this._time=1/0,Fj())}};function WA(e,n,r){var i=new Nb;return i.restart(e,n,r),i}function yve(){HA(),++Ff;for(var e=Cb,n;e;)(n=Pd-e._time)>=0&&e._call.call(void 0,n),e=e._next;--Ff}function rP(){Pd=(jb=Wg.now())+H0,Ff=Km=0;try{yve()}finally{Ff=0,xve(),Pd=0}}function _ve(){var e=Wg.now(),n=e-jb;n>gF&&(H0-=n,jb=e)}function xve(){for(var e,n=Cb,r,i=1/0;n;)n._call?(i>n._time&&(i=n._time),e=n,n=n._next):(r=n._next,n._next=null,n=e?e._next=r:Cb=r);Vm=e,Fj(i)}function Fj(e){if(!Ff){Km&&(Km=clearTimeout(Km));var n=e-Pd;n>24?(e<1/0&&(Km=setTimeout(rP,e-Wg.now()-H0)),vm&&(vm=clearInterval(vm))):(vm||(jb=Wg.now(),vm=setInterval(_ve,gF)),Ff=1,vF(rP))}}function iP(e,n,r){var i=new Nb;return n=n==null?0:+n,i.restart(s=>{i.stop(),e(s+n)},n,r),i}var bve=Lv("start","end","cancel","interrupt"),kve=[],yF=0,sP=1,Hj=2,Tx=3,aP=4,Wj=5,Mx=6;function W0(e,n,r,i,s,a){var o=e.__transition;if(!o)e.__transition={};else if(r in o)return;wve(e,r,{name:n,index:i,group:s,on:bve,tween:kve,time:a.time,delay:a.delay,duration:a.duration,ease:a.ease,timer:null,state:yF})}function qA(e,n){var r=ao(e,n);if(r.state>yF)throw new Error("too late; already scheduled");return r}function sl(e,n){var r=ao(e,n);if(r.state>Tx)throw new Error("too late; already running");return r}function ao(e,n){var r=e.__transition;if(!r||!(r=r[n]))throw new Error("transition not found");return r}function wve(e,n,r){var i=e.__transition,s;i[n]=r,r.timer=WA(a,0,r.time);function a(d){r.state=sP,r.timer.restart(o,r.delay,r.time),r.delay<=d&&o(d-r.delay)}function o(d){var p,f,g,_;if(r.state!==sP)return u();for(p in i)if(_=i[p],_.name===r.name){if(_.state===Tx)return iP(o);_.state===aP?(_.state=Mx,_.timer.stop(),_.on.call("interrupt",e,e.__data__,_.index,_.group),delete i[p]):+p<n&&(_.state=Mx,_.timer.stop(),_.on.call("cancel",e,e.__data__,_.index,_.group),delete i[p])}if(iP(function(){r.state===Tx&&(r.state=aP,r.timer.restart(l,r.delay,r.time),l(d))}),r.state=Hj,r.on.call("start",e,e.__data__,r.index,r.group),r.state===Hj){for(r.state=Tx,s=new Array(g=r.tween.length),p=0,f=-1;p<g;++p)(_=r.tween[p].value.call(e,e.__data__,r.index,r.group))&&(s[++f]=_);s.length=f+1}}function l(d){for(var p=d<r.duration?r.ease.call(null,d/r.duration):(r.timer.restart(u),r.state=Wj,1),f=-1,g=s.length;++f<g;)s[f].call(e,p);r.state===Wj&&(r.on.call("end",e,e.__data__,r.index,r.group),u())}function u(){r.state=Mx,r.timer.stop(),delete i[n];for(var d in i)return;delete e.__transition}}function Rx(e,n){var r=e.__transition,i,s,a=!0,o;if(r){n=n==null?null:n+"";for(o in r){if((i=r[o]).name!==n){a=!1;continue}s=i.state>Hj&&i.state<Wj,i.state=Mx,i.timer.stop(),i.on.call(s?"interrupt":"cancel",e,e.__data__,i.index,i.group),delete r[o]}a&&delete e.__transition}}function Sve(e){return this.each(function(){Rx(this,e)})}function Cve(e,n){var r,i;return function(){var s=sl(this,e),a=s.tween;if(a!==r){i=r=a;for(var o=0,l=i.length;o<l;++o)if(i[o].name===n){i=i.slice(),i.splice(o,1);break}}s.tween=i}}function jve(e,n,r){var i,s;if(typeof r!="function")throw new Error;return function(){var a=sl(this,e),o=a.tween;if(o!==i){s=(i=o).slice();for(var l={name:n,value:r},u=0,d=s.length;u<d;++u)if(s[u].name===n){s[u]=l;break}u===d&&s.push(l)}a.tween=s}}function Nve(e,n){var r=this._id;if(e+="",arguments.length<2){for(var i=ao(this.node(),r).tween,s=0,a=i.length,o;s<a;++s)if((o=i[s]).name===e)return o.value;return null}return this.each((n==null?Cve:jve)(r,e,n))}function UA(e,n,r){var i=e._id;return e.each(function(){var s=sl(this,i);(s.value||(s.value={}))[n]=r.apply(this,arguments)}),function(s){return ao(s,i).value[n]}}function _F(e,n){var r;return(typeof n=="number"?Po:n instanceof Dd?Sb:(r=Dd(n))?(n=r,Sb):fF)(e,n)}function Eve(e){return function(){this.removeAttribute(e)}}function Ave(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Tve(e,n,r){var i,s=r+"",a;return function(){var o=this.getAttribute(e);return o===s?null:o===i?a:a=n(i=o,r)}}function Mve(e,n,r){var i,s=r+"",a;return function(){var o=this.getAttributeNS(e.space,e.local);return o===s?null:o===i?a:a=n(i=o,r)}}function Rve(e,n,r){var i,s,a;return function(){var o,l=r(this),u;return l==null?void this.removeAttribute(e):(o=this.getAttribute(e),u=l+"",o===u?null:o===i&&u===s?a:(s=u,a=n(i=o,l)))}}function Ove(e,n,r){var i,s,a;return function(){var o,l=r(this),u;return l==null?void this.removeAttributeNS(e.space,e.local):(o=this.getAttributeNS(e.space,e.local),u=l+"",o===u?null:o===i&&u===s?a:(s=u,a=n(i=o,l)))}}function Dve(e,n){var r=F0(e),i=r==="transform"?fve:_F;return this.attrTween(e,typeof n=="function"?(r.local?Ove:Rve)(r,i,UA(this,"attr."+e,n)):n==null?(r.local?Ave:Eve)(r):(r.local?Mve:Tve)(r,i,n))}function Pve(e,n){return function(r){this.setAttribute(e,n.call(this,r))}}function Lve(e,n){return function(r){this.setAttributeNS(e.space,e.local,n.call(this,r))}}function Ive(e,n){var r,i;function s(){var a=n.apply(this,arguments);return a!==i&&(r=(i=a)&&Lve(e,a)),r}return s._value=n,s}function Bve(e,n){var r,i;function s(){var a=n.apply(this,arguments);return a!==i&&(r=(i=a)&&Pve(e,a)),r}return s._value=n,s}function zve(e,n){var r="attr."+e;if(arguments.length<2)return(r=this.tween(r))&&r._value;if(n==null)return this.tween(r,null);if(typeof n!="function")throw new Error;var i=F0(e);return this.tween(r,(i.local?Ive:Bve)(i,n))}function $ve(e,n){return function(){qA(this,e).delay=+n.apply(this,arguments)}}function Fve(e,n){return n=+n,function(){qA(this,e).delay=n}}function Hve(e){var n=this._id;return arguments.length?this.each((typeof e=="function"?$ve:Fve)(n,e)):ao(this.node(),n).delay}function Wve(e,n){return function(){sl(this,e).duration=+n.apply(this,arguments)}}function qve(e,n){return n=+n,function(){sl(this,e).duration=n}}function Uve(e){var n=this._id;return arguments.length?this.each((typeof e=="function"?Wve:qve)(n,e)):ao(this.node(),n).duration}function Kve(e,n){if(typeof n!="function")throw new Error;return function(){sl(this,e).ease=n}}function Vve(e){var n=this._id;return arguments.length?this.each(Kve(n,e)):ao(this.node(),n).ease}function Yve(e,n){return function(){var r=n.apply(this,arguments);if(typeof r!="function")throw new Error;sl(this,e).ease=r}}function Gve(e){if(typeof e!="function")throw new Error;return this.each(Yve(this._id,e))}function Xve(e){typeof e!="function"&&(e=Z7(e));for(var n=this._groups,r=n.length,i=new Array(r),s=0;s<r;++s)for(var a=n[s],o=a.length,l=i[s]=[],u,d=0;d<o;++d)(u=a[d])&&e.call(u,u.__data__,d,a)&&l.push(u);return new Jl(i,this._parents,this._name,this._id)}function Qve(e){if(e._id!==this._id)throw new Error;for(var n=this._groups,r=e._groups,i=n.length,s=r.length,a=Math.min(i,s),o=new Array(i),l=0;l<a;++l)for(var u=n[l],d=r[l],p=u.length,f=o[l]=new Array(p),g,_=0;_<p;++_)(g=u[_]||d[_])&&(f[_]=g);for(;l<i;++l)o[l]=n[l];return new Jl(o,this._parents,this._name,this._id)}function Zve(e){return(e+"").trim().split(/^|\s+/).every(function(n){var r=n.indexOf(".");return r>=0&&(n=n.slice(0,r)),!n||n==="start"})}function Jve(e,n,r){var i,s,a=Zve(n)?qA:sl;return function(){var o=a(this,e),l=o.on;l!==i&&(s=(i=l).copy()).on(n,r),o.on=s}}function eye(e,n){var r=this._id;return arguments.length<2?ao(this.node(),r).on.on(e):this.each(Jve(r,e,n))}function tye(e){return function(){var n=this.parentNode;for(var r in this.__transition)if(+r!==e)return;n&&n.removeChild(this)}}function nye(){return this.on("end.remove",tye(this._id))}function rye(e){var n=this._name,r=this._id;typeof e!="function"&&(e=IA(e));for(var i=this._groups,s=i.length,a=new Array(s),o=0;o<s;++o)for(var l=i[o],u=l.length,d=a[o]=new Array(u),p,f,g=0;g<u;++g)(p=l[g])&&(f=e.call(p,p.__data__,g,l))&&("__data__"in p&&(f.__data__=p.__data__),d[g]=f,W0(d[g],n,r,g,d,ao(p,r)));return new Jl(a,this._parents,n,r)}function iye(e){var n=this._name,r=this._id;typeof e!="function"&&(e=Q7(e));for(var i=this._groups,s=i.length,a=[],o=[],l=0;l<s;++l)for(var u=i[l],d=u.length,p,f=0;f<d;++f)if(p=u[f]){for(var g=e.call(p,p.__data__,f,u),_,x=ao(p,r),v=0,S=g.length;v<S;++v)(_=g[v])&&W0(_,n,r,v,g,x);a.push(g),o.push(p)}return new Jl(a,o,n,r)}var sye=Iv.prototype.constructor;function aye(){return new sye(this._groups,this._parents)}function oye(e,n){var r,i,s;return function(){var a=$f(this,e),o=(this.style.removeProperty(e),$f(this,e));return a===o?null:a===r&&o===i?s:s=n(r=a,i=o)}}function xF(e){return function(){this.style.removeProperty(e)}}function lye(e,n,r){var i,s=r+"",a;return function(){var o=$f(this,e);return o===s?null:o===i?a:a=n(i=o,r)}}function cye(e,n,r){var i,s,a;return function(){var o=$f(this,e),l=r(this),u=l+"";return l==null&&(u=l=(this.style.removeProperty(e),$f(this,e))),o===u?null:o===i&&u===s?a:(s=u,a=n(i=o,l))}}function uye(e,n){var r,i,s,a="style."+n,o="end."+a,l;return function(){var u=sl(this,e),d=u.on,p=u.value[a]==null?l||(l=xF(n)):void 0;(d!==r||s!==p)&&(i=(r=d).copy()).on(o,s=p),u.on=i}}function dye(e,n,r){var i=(e+="")=="transform"?hve:_F;return n==null?this.styleTween(e,oye(e,i)).on("end.style."+e,xF(e)):typeof n=="function"?this.styleTween(e,cye(e,i,UA(this,"style."+e,n))).each(uye(this._id,e)):this.styleTween(e,lye(e,i,n),r).on("end.style."+e,null)}function hye(e,n,r){return function(i){this.style.setProperty(e,n.call(this,i),r)}}function fye(e,n,r){var i,s;function a(){var o=n.apply(this,arguments);return o!==s&&(i=(s=o)&&hye(e,o,r)),i}return a._value=n,a}function pye(e,n,r){var i="style."+(e+="");if(arguments.length<2)return(i=this.tween(i))&&i._value;if(n==null)return this.tween(i,null);if(typeof n!="function")throw new Error;return this.tween(i,fye(e,n,r??""))}function mye(e){return function(){this.textContent=e}}function gye(e){return function(){var n=e(this);this.textContent=n??""}}function vye(e){return this.tween("text",typeof e=="function"?gye(UA(this,"text",e)):mye(e==null?"":e+""))}function yye(e){return function(n){this.textContent=e.call(this,n)}}function _ye(e){var n,r;function i(){var s=e.apply(this,arguments);return s!==r&&(n=(r=s)&&yye(s)),n}return i._value=e,i}function xye(e){var n="text";if(arguments.length<1)return(n=this.tween(n))&&n._value;if(e==null)return this.tween(n,null);if(typeof e!="function")throw new Error;return this.tween(n,_ye(e))}function bye(){for(var e=this._name,n=this._id,r=bF(),i=this._groups,s=i.length,a=0;a<s;++a)for(var o=i[a],l=o.length,u,d=0;d<l;++d)if(u=o[d]){var p=ao(u,n);W0(u,e,r,d,o,{time:p.time+p.delay+p.duration,delay:0,duration:p.duration,ease:p.ease})}return new Jl(i,this._parents,e,r)}function kye(){var e,n,r=this,i=r._id,s=r.size();return new Promise(function(a,o){var l={value:o},u={value:function(){--s===0&&a()}};r.each(function(){var d=sl(this,i),p=d.on;p!==e&&(n=(e=p).copy(),n._.cancel.push(l),n._.interrupt.push(l),n._.end.push(u)),d.on=n}),s===0&&a()})}var wye=0;function Jl(e,n,r,i){this._groups=e,this._parents=n,this._name=r,this._id=i}function bF(){return++wye}var El=Iv.prototype;Jl.prototype={constructor:Jl,select:rye,selectAll:iye,selectChild:El.selectChild,selectChildren:El.selectChildren,filter:Xve,merge:Qve,selection:aye,transition:bye,call:El.call,nodes:El.nodes,node:El.node,size:El.size,empty:El.empty,each:El.each,on:eye,attr:Dve,attrTween:zve,style:dye,styleTween:pye,text:vye,textTween:xye,remove:nye,tween:Nve,delay:Hve,duration:Uve,ease:Vve,easeVarying:Gve,end:kye,[Symbol.iterator]:El[Symbol.iterator]};function Sye(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var Cye={time:null,delay:0,duration:250,ease:Sye};function jye(e,n){for(var r;!(r=e.__transition)||!(r=r[n]);)if(!(e=e.parentNode))throw new Error(`transition ${n} not found`);return r}function Nye(e){var n,r;e instanceof Jl?(n=e._id,e=e._name):(n=bF(),(r=Cye).time=HA(),e=e==null?null:e+"");for(var i=this._groups,s=i.length,a=0;a<s;++a)for(var o=i[a],l=o.length,u,d=0;d<l;++d)(u=o[d])&&W0(u,e,n,d,o,r||jye(u,n));return new Jl(i,this._parents,e,n)}Iv.prototype.interrupt=Sve;Iv.prototype.transition=Nye;const k_=e=>()=>e;function Eye(e,{sourceEvent:n,target:r,transform:i,dispatch:s}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:n,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},transform:{value:i,enumerable:!0,configurable:!0},_:{value:s}})}function Hl(e,n,r){this.k=e,this.x=n,this.y=r}Hl.prototype={constructor:Hl,scale:function(e){return e===1?this:new Hl(this.k*e,this.x,this.y)},translate:function(e,n){return e===0&n===0?this:new Hl(this.k,this.x+this.k*e,this.y+this.k*n)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var q0=new Hl(1,0,0);Wa.prototype=Hl.prototype;function Wa(e){for(;!e.__zoom;)if(!(e=e.parentNode))return q0;return e.__zoom}function NS(e){e.stopImmediatePropagation()}function ym(e){e.preventDefault(),e.stopImmediatePropagation()}function Aye(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function Tye(){var e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e,e.hasAttribute("viewBox")?(e=e.viewBox.baseVal,[[e.x,e.y],[e.x+e.width,e.y+e.height]]):[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]):[[0,0],[e.clientWidth,e.clientHeight]]}function oP(){return this.__zoom||q0}function Mye(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function Rye(){return navigator.maxTouchPoints||"ontouchstart"in this}function Oye(e,n,r){var i=e.invertX(n[0][0])-r[0][0],s=e.invertX(n[1][0])-r[1][0],a=e.invertY(n[0][1])-r[0][1],o=e.invertY(n[1][1])-r[1][1];return e.translate(s>i?(i+s)/2:Math.min(0,i)||Math.max(0,s),o>a?(a+o)/2:Math.min(0,a)||Math.max(0,o))}function KA(){var e=Aye,n=Tye,r=Oye,i=Mye,s=Rye,a=[0,1/0],o=[[-1/0,-1/0],[1/0,1/0]],l=250,u=Ax,d=Lv("start","zoom","end"),p,f,g,_=500,x=150,v=0,S=10;function w(D){D.property("__zoom",oP).on("wheel.zoom",F,{passive:!1}).on("mousedown.zoom",L).on("dblclick.zoom",$).filter(s).on("touchstart.zoom",z).on("touchmove.zoom",B).on("touchend.zoom touchcancel.zoom",H).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}w.transform=function(D,U,I,X){var K=D.selection?D.selection():D;K.property("__zoom",oP),D!==K?E(D,U,I,X):K.interrupt().each(function(){A(this,arguments).event(X).start().zoom(null,typeof U=="function"?U.apply(this,arguments):U).end()})},w.scaleBy=function(D,U,I,X){w.scaleTo(D,function(){var K=this.__zoom.k,Q=typeof U=="function"?U.apply(this,arguments):U;return K*Q},I,X)},w.scaleTo=function(D,U,I,X){w.transform(D,function(){var K=n.apply(this,arguments),Q=this.__zoom,V=I==null?T(K):typeof I=="function"?I.apply(this,arguments):I,R=Q.invert(V),q=typeof U=="function"?U.apply(this,arguments):U;return r(C(j(Q,q),V,R),K,o)},I,X)},w.translateBy=function(D,U,I,X){w.transform(D,function(){return r(this.__zoom.translate(typeof U=="function"?U.apply(this,arguments):U,typeof I=="function"?I.apply(this,arguments):I),n.apply(this,arguments),o)},null,X)},w.translateTo=function(D,U,I,X,K){w.transform(D,function(){var Q=n.apply(this,arguments),V=this.__zoom,R=X==null?T(Q):typeof X=="function"?X.apply(this,arguments):X;return r(q0.translate(R[0],R[1]).scale(V.k).translate(typeof U=="function"?-U.apply(this,arguments):-U,typeof I=="function"?-I.apply(this,arguments):-I),Q,o)},X,K)};function j(D,U){return U=Math.max(a[0],Math.min(a[1],U)),U===D.k?D:new Hl(U,D.x,D.y)}function C(D,U,I){var X=U[0]-I[0]*D.k,K=U[1]-I[1]*D.k;return X===D.x&&K===D.y?D:new Hl(D.k,X,K)}function T(D){return[(+D[0][0]+ +D[1][0])/2,(+D[0][1]+ +D[1][1])/2]}function E(D,U,I,X){D.on("start.zoom",function(){A(this,arguments).event(X).start()}).on("interrupt.zoom end.zoom",function(){A(this,arguments).event(X).end()}).tween("zoom",function(){var K=this,Q=arguments,V=A(K,Q).event(X),R=n.apply(K,Q),q=I==null?T(R):typeof I=="function"?I.apply(K,Q):I,W=Math.max(R[1][0]-R[0][0],R[1][1]-R[0][1]),te=K.__zoom,J=typeof U=="function"?U.apply(K,Q):U,G=u(te.invert(q).concat(W/te.k),J.invert(q).concat(W/J.k));return function(re){if(re===1)re=J;else{var ne=G(re),le=W/ne[2];re=new Hl(le,q[0]-ne[0]*le,q[1]-ne[1]*le)}V.zoom(null,re)}})}function A(D,U,I){return!I&&D.__zooming||new O(D,U)}function O(D,U){this.that=D,this.args=U,this.active=0,this.sourceEvent=null,this.extent=n.apply(D,U),this.taps=0}O.prototype={event:function(D){return D&&(this.sourceEvent=D),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(D,U){return this.mouse&&D!=="mouse"&&(this.mouse[1]=U.invert(this.mouse[0])),this.touch0&&D!=="touch"&&(this.touch0[1]=U.invert(this.touch0[0])),this.touch1&&D!=="touch"&&(this.touch1[1]=U.invert(this.touch1[0])),this.that.__zoom=U,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(D){var U=qi(this.that).datum();d.call(D,this.that,new Eye(D,{sourceEvent:this.sourceEvent,target:w,transform:this.that.__zoom,dispatch:d}),U)}};function F(D,...U){if(!e.apply(this,arguments))return;var I=A(this,U).event(D),X=this.__zoom,K=Math.max(a[0],Math.min(a[1],X.k*Math.pow(2,i.apply(this,arguments)))),Q=Sa(D);if(I.wheel)(I.mouse[0][0]!==Q[0]||I.mouse[0][1]!==Q[1])&&(I.mouse[1]=X.invert(I.mouse[0]=Q)),clearTimeout(I.wheel);else{if(X.k===K)return;I.mouse=[Q,X.invert(Q)],Rx(this),I.start()}ym(D),I.wheel=setTimeout(V,x),I.zoom("mouse",r(C(j(X,K),I.mouse[0],I.mouse[1]),I.extent,o));function V(){I.wheel=null,I.end()}}function L(D,...U){if(g||!e.apply(this,arguments))return;var I=D.currentTarget,X=A(this,U,!0).event(D),K=qi(D.view).on("mousemove.zoom",q,!0).on("mouseup.zoom",W,!0),Q=Sa(D,I),V=D.clientX,R=D.clientY;lF(D.view),NS(D),X.mouse=[Q,this.__zoom.invert(Q)],Rx(this),X.start();function q(te){if(ym(te),!X.moved){var J=te.clientX-V,G=te.clientY-R;X.moved=J*J+G*G>v}X.event(te).zoom("mouse",r(C(X.that.__zoom,X.mouse[0]=Sa(te,I),X.mouse[1]),X.extent,o))}function W(te){K.on("mousemove.zoom mouseup.zoom",null),cF(te.view,X.moved),ym(te),X.event(te).end()}}function $(D,...U){if(e.apply(this,arguments)){var I=this.__zoom,X=Sa(D.changedTouches?D.changedTouches[0]:D,this),K=I.invert(X),Q=I.k*(D.shiftKey?.5:2),V=r(C(j(I,Q),X,K),n.apply(this,U),o);ym(D),l>0?qi(this).transition().duration(l).call(E,V,X,D):qi(this).call(w.transform,V,X,D)}}function z(D,...U){if(e.apply(this,arguments)){var I=D.touches,X=I.length,K=A(this,U,D.changedTouches.length===X).event(D),Q,V,R,q;for(NS(D),V=0;V<X;++V)R=I[V],q=Sa(R,this),q=[q,this.__zoom.invert(q),R.identifier],K.touch0?!K.touch1&&K.touch0[2]!==q[2]&&(K.touch1=q,K.taps=0):(K.touch0=q,Q=!0,K.taps=1+!!p);p&&(p=clearTimeout(p)),Q&&(K.taps<2&&(f=q[0],p=setTimeout(function(){p=null},_)),Rx(this),K.start())}}function B(D,...U){if(this.__zooming){var I=A(this,U).event(D),X=D.changedTouches,K=X.length,Q,V,R,q;for(ym(D),Q=0;Q<K;++Q)V=X[Q],R=Sa(V,this),I.touch0&&I.touch0[2]===V.identifier?I.touch0[0]=R:I.touch1&&I.touch1[2]===V.identifier&&(I.touch1[0]=R);if(V=I.that.__zoom,I.touch1){var W=I.touch0[0],te=I.touch0[1],J=I.touch1[0],G=I.touch1[1],re=(re=J[0]-W[0])*re+(re=J[1]-W[1])*re,ne=(ne=G[0]-te[0])*ne+(ne=G[1]-te[1])*ne;V=j(V,Math.sqrt(re/ne)),R=[(W[0]+J[0])/2,(W[1]+J[1])/2],q=[(te[0]+G[0])/2,(te[1]+G[1])/2]}else if(I.touch0)R=I.touch0[0],q=I.touch0[1];else return;I.zoom("touch",r(C(V,R,q),I.extent,o))}}function H(D,...U){if(this.__zooming){var I=A(this,U).event(D),X=D.changedTouches,K=X.length,Q,V;for(NS(D),g&&clearTimeout(g),g=setTimeout(function(){g=null},_),Q=0;Q<K;++Q)V=X[Q],I.touch0&&I.touch0[2]===V.identifier?delete I.touch0:I.touch1&&I.touch1[2]===V.identifier&&delete I.touch1;if(I.touch1&&!I.touch0&&(I.touch0=I.touch1,delete I.touch1),I.touch0)I.touch0[1]=this.__zoom.invert(I.touch0[0]);else if(I.end(),I.taps===2&&(V=Sa(V,this),Math.hypot(f[0]-V[0],f[1]-V[1])<S)){var R=qi(this).on("dblclick.zoom");R&&R.apply(this,arguments)}}}return w.wheelDelta=function(D){return arguments.length?(i=typeof D=="function"?D:k_(+D),w):i},w.filter=function(D){return arguments.length?(e=typeof D=="function"?D:k_(!!D),w):e},w.touchable=function(D){return arguments.length?(s=typeof D=="function"?D:k_(!!D),w):s},w.extent=function(D){return arguments.length?(n=typeof D=="function"?D:k_([[+D[0][0],+D[0][1]],[+D[1][0],+D[1][1]]]),w):n},w.scaleExtent=function(D){return arguments.length?(a[0]=+D[0],a[1]=+D[1],w):[a[0],a[1]]},w.translateExtent=function(D){return arguments.length?(o[0][0]=+D[0][0],o[1][0]=+D[1][0],o[0][1]=+D[0][1],o[1][1]=+D[1][1],w):[[o[0][0],o[0][1]],[o[1][0],o[1][1]]]},w.constrain=function(D){return arguments.length?(r=D,w):r},w.duration=function(D){return arguments.length?(l=+D,w):l},w.interpolate=function(D){return arguments.length?(u=D,w):u},w.on=function(){var D=d.on.apply(d,arguments);return D===d?w:D},w.clickDistance=function(D){return arguments.length?(v=(D=+D)*D,w):Math.sqrt(v)},w.tapDistance=function(D){return arguments.length?(S=+D,w):S},w}const el={error001:()=>"[React Flow]: Seems like you have not used zustand provider as an ancestor. Help: https://reactflow.dev/error#001",error002:()=>"It looks like you've created a new nodeTypes or edgeTypes object. If this wasn't on purpose please define the nodeTypes/edgeTypes outside of the component or memoize them.",error003:e=>`Node type "${e}" not found. Using fallback type "default".`,error004:()=>"The React Flow parent container needs a width and a height to render the graph.",error005:()=>"Only child nodes can use a parent extent.",error006:()=>"Can't create edge. An edge needs a source and a target.",error007:e=>`The old edge with id=${e} does not exist.`,error009:e=>`Marker type "${e}" doesn't exist.`,error008:(e,{id:n,sourceHandle:r,targetHandle:i})=>`Couldn't create edge for ${e} handle id: "${e==="source"?r:i}", edge id: ${n}.`,error010:()=>"Handle: No node id found. Make sure to only use a Handle inside a custom Node.",error011:e=>`Edge type "${e}" not found. Using fallback type "default".`,error012:e=>`Node with id "${e}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`,error013:(e="react")=>`It seems that you haven't loaded the styles. Please import '@xyflow/${e}/dist/style.css' or base.css to make sure everything is working properly.`,error014:()=>"useNodeConnections: No node ID found. Call useNodeConnections inside a custom Node or provide a node ID.",error015:()=>"It seems that you are trying to drag a node that is not initialized. Please use onNodesChange as explained in the docs."},qg=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],kF=["Enter"," ","Escape"],wF={"node.a11yDescription.default":"Press enter or space to select a node. Press delete to remove it and escape to cancel.","node.a11yDescription.keyboardDisabled":"Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.","node.a11yDescription.ariaLiveMessage":({direction:e,x:n,y:r})=>`Moved selected node ${e}. New position, x: ${n}, y: ${r}`,"edge.a11yDescription.default":"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.","controls.ariaLabel":"Control Panel","controls.zoomIn.ariaLabel":"Zoom In","controls.zoomOut.ariaLabel":"Zoom Out","controls.fitView.ariaLabel":"Fit View","controls.interactive.ariaLabel":"Toggle Interactivity","minimap.ariaLabel":"Mini Map","handle.ariaLabel":"Handle"};var Hf;(function(e){e.Strict="strict",e.Loose="loose"})(Hf||(Hf={}));var Cd;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(Cd||(Cd={}));var Ug;(function(e){e.Partial="partial",e.Full="full"})(Ug||(Ug={}));const SF={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null};var Va;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(Va||(Va={}));var qa;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(qa||(qa={}));var xt;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(xt||(xt={}));const lP={[xt.Left]:xt.Right,[xt.Right]:xt.Left,[xt.Top]:xt.Bottom,[xt.Bottom]:xt.Top};function CF(e){return e===null?null:e?"valid":"invalid"}const jF=e=>"id"in e&&"source"in e&&"target"in e,Dye=e=>"id"in e&&"position"in e&&!("source"in e)&&!("target"in e),VA=e=>"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e),zv=(e,n=[0,0])=>{const{width:r,height:i}=oc(e),s=e.origin??n,a=r*s[0],o=i*s[1];return{x:e.position.x-a,y:e.position.y-o}},Pye=(e,n={nodeOrigin:[0,0]})=>{if(e.length===0)return{x:0,y:0,width:0,height:0};const r=e.reduce((i,s)=>{const a=typeof s=="string";let o=!n.nodeLookup&&!a?s:void 0;n.nodeLookup&&(o=a?n.nodeLookup.get(s):VA(s)?s:n.nodeLookup.get(s.id));const l=o?Eb(o,n.nodeOrigin):{x:0,y:0,x2:0,y2:0};return U0(i,l)},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return K0(r)},$v=(e,n={})=>{let r={x:1/0,y:1/0,x2:-1/0,y2:-1/0},i=!1;return e.forEach(s=>{(n.filter===void 0||n.filter(s))&&(r=U0(r,Eb(s)),i=!0)}),i?K0(r):{x:0,y:0,width:0,height:0}},YA=(e,n,[r,i,s]=[0,0,1],a=!1,o=!1)=>{const l={...Hv(n,[r,i,s]),width:n.width/s,height:n.height/s},u=[];for(const d of e.values()){const{measured:p,selectable:f=!0,hidden:g=!1}=d;if(o&&!f||g)continue;const _=p.width??d.width??d.initialWidth??null,x=p.height??d.height??d.initialHeight??null,v=Kg(l,qf(d)),S=(_??0)*(x??0),w=a&&v>0;(!d.internals.handleBounds||w||v>=S||d.dragging)&&u.push(d)}return u},Lye=(e,n)=>{const r=new Set;return e.forEach(i=>{r.add(i.id)}),n.filter(i=>r.has(i.source)||r.has(i.target))};function Iye(e,n){const r=new Map,i=n!=null&&n.nodes?new Set(n.nodes.map(s=>s.id)):null;return e.forEach(s=>{s.measured.width&&s.measured.height&&((n==null?void 0:n.includeHiddenNodes)||!s.hidden)&&(!i||i.has(s.id))&&r.set(s.id,s)}),r}async function Bye({nodes:e,width:n,height:r,panZoom:i,minZoom:s,maxZoom:a},o){if(e.size===0)return Promise.resolve(!0);const l=Iye(e,o),u=$v(l),d=GA(u,n,r,(o==null?void 0:o.minZoom)??s,(o==null?void 0:o.maxZoom)??a,(o==null?void 0:o.padding)??.1);return await i.setViewport(d,{duration:o==null?void 0:o.duration,ease:o==null?void 0:o.ease,interpolate:o==null?void 0:o.interpolate}),Promise.resolve(!0)}function NF({nodeId:e,nextPosition:n,nodeLookup:r,nodeOrigin:i=[0,0],nodeExtent:s,onError:a}){const o=r.get(e),l=o.parentId?r.get(o.parentId):void 0,{x:u,y:d}=l?l.internals.positionAbsolute:{x:0,y:0},p=o.origin??i;let f=o.extent||s;if(o.extent==="parent"&&!o.expandParent)if(!l)a==null||a("005",el.error005());else{const _=l.measured.width,x=l.measured.height;_&&x&&(f=[[u,d],[u+_,d+x]])}else l&&Uf(o.extent)&&(f=[[o.extent[0][0]+u,o.extent[0][1]+d],[o.extent[1][0]+u,o.extent[1][1]+d]]);const g=Uf(f)?Ld(n,f,o.measured):n;return(o.measured.width===void 0||o.measured.height===void 0)&&(a==null||a("015",el.error015())),{position:{x:g.x-u+(o.measured.width??0)*p[0],y:g.y-d+(o.measured.height??0)*p[1]},positionAbsolute:g}}async function zye({nodesToRemove:e=[],edgesToRemove:n=[],nodes:r,edges:i,onBeforeDelete:s}){const a=new Set(e.map(g=>g.id)),o=[];for(const g of r){if(g.deletable===!1)continue;const _=a.has(g.id),x=!_&&g.parentId&&o.find(v=>v.id===g.parentId);(_||x)&&o.push(g)}const l=new Set(n.map(g=>g.id)),u=i.filter(g=>g.deletable!==!1),p=Lye(o,u);for(const g of u)l.has(g.id)&&!p.find(x=>x.id===g.id)&&p.push(g);if(!s)return{edges:p,nodes:o};const f=await s({nodes:o,edges:p});return typeof f=="boolean"?f?{edges:p,nodes:o}:{edges:[],nodes:[]}:f}const Wf=(e,n=0,r=1)=>Math.min(Math.max(e,n),r),Ld=(e={x:0,y:0},n,r)=>({x:Wf(e.x,n[0][0],n[1][0]-((r==null?void 0:r.width)??0)),y:Wf(e.y,n[0][1],n[1][1]-((r==null?void 0:r.height)??0))});function EF(e,n,r){const{width:i,height:s}=oc(r),{x:a,y:o}=r.internals.positionAbsolute;return Ld(e,[[a,o],[a+i,o+s]],n)}const cP=(e,n,r)=>e<n?Wf(Math.abs(e-n),1,n)/n:e>r?-Wf(Math.abs(e-r),1,n)/n:0,AF=(e,n,r=15,i=40)=>{const s=cP(e.x,i,n.width-i)*r,a=cP(e.y,i,n.height-i)*r;return[s,a]},U0=(e,n)=>({x:Math.min(e.x,n.x),y:Math.min(e.y,n.y),x2:Math.max(e.x2,n.x2),y2:Math.max(e.y2,n.y2)}),qj=({x:e,y:n,width:r,height:i})=>({x:e,y:n,x2:e+r,y2:n+i}),K0=({x:e,y:n,x2:r,y2:i})=>({x:e,y:n,width:r-e,height:i-n}),qf=(e,n=[0,0])=>{var s,a;const{x:r,y:i}=VA(e)?e.internals.positionAbsolute:zv(e,n);return{x:r,y:i,width:((s=e.measured)==null?void 0:s.width)??e.width??e.initialWidth??0,height:((a=e.measured)==null?void 0:a.height)??e.height??e.initialHeight??0}},Eb=(e,n=[0,0])=>{var s,a;const{x:r,y:i}=VA(e)?e.internals.positionAbsolute:zv(e,n);return{x:r,y:i,x2:r+(((s=e.measured)==null?void 0:s.width)??e.width??e.initialWidth??0),y2:i+(((a=e.measured)==null?void 0:a.height)??e.height??e.initialHeight??0)}},TF=(e,n)=>K0(U0(qj(e),qj(n))),Kg=(e,n)=>{const r=Math.max(0,Math.min(e.x+e.width,n.x+n.width)-Math.max(e.x,n.x)),i=Math.max(0,Math.min(e.y+e.height,n.y+n.height)-Math.max(e.y,n.y));return Math.ceil(r*i)},uP=e=>Xa(e.width)&&Xa(e.height)&&Xa(e.x)&&Xa(e.y),Xa=e=>!isNaN(e)&&isFinite(e),$ye=(e,n)=>{},Fv=(e,n=[1,1])=>({x:n[0]*Math.round(e.x/n[0]),y:n[1]*Math.round(e.y/n[1])}),Hv=({x:e,y:n},[r,i,s],a=!1,o=[1,1])=>{const l={x:(e-r)/s,y:(n-i)/s};return a?Fv(l,o):l},Ab=({x:e,y:n},[r,i,s])=>({x:e*s+r,y:n*s+i});function Oh(e,n){if(typeof e=="number")return Math.floor((n-n/(1+e))*.5);if(typeof e=="string"&&e.endsWith("px")){const r=parseFloat(e);if(!Number.isNaN(r))return Math.floor(r)}if(typeof e=="string"&&e.endsWith("%")){const r=parseFloat(e);if(!Number.isNaN(r))return Math.floor(n*r*.01)}return console.error(`[React Flow] The padding value "${e}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}function Fye(e,n,r){if(typeof e=="string"||typeof e=="number"){const i=Oh(e,r),s=Oh(e,n);return{top:i,right:s,bottom:i,left:s,x:s*2,y:i*2}}if(typeof e=="object"){const i=Oh(e.top??e.y??0,r),s=Oh(e.bottom??e.y??0,r),a=Oh(e.left??e.x??0,n),o=Oh(e.right??e.x??0,n);return{top:i,right:o,bottom:s,left:a,x:a+o,y:i+s}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function Hye(e,n,r,i,s,a){const{x:o,y:l}=Ab(e,[n,r,i]),{x:u,y:d}=Ab({x:e.x+e.width,y:e.y+e.height},[n,r,i]),p=s-u,f=a-d;return{left:Math.floor(o),top:Math.floor(l),right:Math.floor(p),bottom:Math.floor(f)}}const GA=(e,n,r,i,s,a)=>{const o=Fye(a,n,r),l=(n-o.x)/e.width,u=(r-o.y)/e.height,d=Math.min(l,u),p=Wf(d,i,s),f=e.x+e.width/2,g=e.y+e.height/2,_=n/2-f*p,x=r/2-g*p,v=Hye(e,_,x,p,n,r),S={left:Math.min(v.left-o.left,0),top:Math.min(v.top-o.top,0),right:Math.min(v.right-o.right,0),bottom:Math.min(v.bottom-o.bottom,0)};return{x:_-S.left+S.right,y:x-S.top+S.bottom,zoom:p}},Vg=()=>{var e;return typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)==null?void 0:e.indexOf("Mac"))>=0};function Uf(e){return e!=null&&e!=="parent"}function oc(e){var n,r;return{width:((n=e.measured)==null?void 0:n.width)??e.width??e.initialWidth??0,height:((r=e.measured)==null?void 0:r.height)??e.height??e.initialHeight??0}}function MF(e){var n,r;return(((n=e.measured)==null?void 0:n.width)??e.width??e.initialWidth)!==void 0&&(((r=e.measured)==null?void 0:r.height)??e.height??e.initialHeight)!==void 0}function RF(e,n={width:0,height:0},r,i,s){const a={...e},o=i.get(r);if(o){const l=o.origin||s;a.x+=o.internals.positionAbsolute.x-(n.width??0)*l[0],a.y+=o.internals.positionAbsolute.y-(n.height??0)*l[1]}return a}function dP(e,n){if(e.size!==n.size)return!1;for(const r of e)if(!n.has(r))return!1;return!0}function Wye(){let e,n;return{promise:new Promise((i,s)=>{e=i,n=s}),resolve:e,reject:n}}function qye(e){return{...wF,...e||{}}}function hg(e,{snapGrid:n=[0,0],snapToGrid:r=!1,transform:i,containerBounds:s}){const{x:a,y:o}=Qa(e),l=Hv({x:a-((s==null?void 0:s.left)??0),y:o-((s==null?void 0:s.top)??0)},i),{x:u,y:d}=r?Fv(l,n):l;return{xSnapped:u,ySnapped:d,...l}}const XA=e=>({width:e.offsetWidth,height:e.offsetHeight}),OF=e=>{var n;return((n=e==null?void 0:e.getRootNode)==null?void 0:n.call(e))||(window==null?void 0:window.document)},Uye=["INPUT","SELECT","TEXTAREA"];function DF(e){var i,s;const n=((s=(i=e.composedPath)==null?void 0:i.call(e))==null?void 0:s[0])||e.target;return(n==null?void 0:n.nodeType)!==1?!1:Uye.includes(n.nodeName)||n.hasAttribute("contenteditable")||!!n.closest(".nokey")}const PF=e=>"clientX"in e,Qa=(e,n)=>{var a,o;const r=PF(e),i=r?e.clientX:(a=e.touches)==null?void 0:a[0].clientX,s=r?e.clientY:(o=e.touches)==null?void 0:o[0].clientY;return{x:i-((n==null?void 0:n.left)??0),y:s-((n==null?void 0:n.top)??0)}},hP=(e,n,r,i,s)=>{const a=n.querySelectorAll(`.${e}`);return!a||!a.length?null:Array.from(a).map(o=>{const l=o.getBoundingClientRect();return{id:o.getAttribute("data-handleid"),type:e,nodeId:s,position:o.getAttribute("data-handlepos"),x:(l.left-r.left)/i,y:(l.top-r.top)/i,...XA(o)}})};function LF({sourceX:e,sourceY:n,targetX:r,targetY:i,sourceControlX:s,sourceControlY:a,targetControlX:o,targetControlY:l}){const u=e*.125+s*.375+o*.375+r*.125,d=n*.125+a*.375+l*.375+i*.125,p=Math.abs(u-e),f=Math.abs(d-n);return[u,d,p,f]}function w_(e,n){return e>=0?.5*e:n*25*Math.sqrt(-e)}function fP({pos:e,x1:n,y1:r,x2:i,y2:s,c:a}){switch(e){case xt.Left:return[n-w_(n-i,a),r];case xt.Right:return[n+w_(i-n,a),r];case xt.Top:return[n,r-w_(r-s,a)];case xt.Bottom:return[n,r+w_(s-r,a)]}}function QA({sourceX:e,sourceY:n,sourcePosition:r=xt.Bottom,targetX:i,targetY:s,targetPosition:a=xt.Top,curvature:o=.25}){const[l,u]=fP({pos:r,x1:e,y1:n,x2:i,y2:s,c:o}),[d,p]=fP({pos:a,x1:i,y1:s,x2:e,y2:n,c:o}),[f,g,_,x]=LF({sourceX:e,sourceY:n,targetX:i,targetY:s,sourceControlX:l,sourceControlY:u,targetControlX:d,targetControlY:p});return[`M${e},${n} C${l},${u} ${d},${p} ${i},${s}`,f,g,_,x]}function IF({sourceX:e,sourceY:n,targetX:r,targetY:i}){const s=Math.abs(r-e)/2,a=r<e?r+s:r-s,o=Math.abs(i-n)/2,l=i<n?i+o:i-o;return[a,l,s,o]}function Kye({sourceNode:e,targetNode:n,selected:r=!1,zIndex:i=0,elevateOnSelect:s=!1,zIndexMode:a="basic"}){if(a==="manual")return i;const o=s&&r?i+1e3:i,l=Math.max(e.parentId||s&&e.selected?e.internals.z:0,n.parentId||s&&n.selected?n.internals.z:0);return o+l}function Vye({sourceNode:e,targetNode:n,width:r,height:i,transform:s}){const a=U0(Eb(e),Eb(n));a.x===a.x2&&(a.x2+=1),a.y===a.y2&&(a.y2+=1);const o={x:-s[0]/s[2],y:-s[1]/s[2],width:r/s[2],height:i/s[2]};return Kg(o,K0(a))>0}const Yye=({source:e,sourceHandle:n,target:r,targetHandle:i})=>`xy-edge__${e}${n||""}-${r}${i||""}`,Gye=(e,n)=>n.some(r=>r.source===e.source&&r.target===e.target&&(r.sourceHandle===e.sourceHandle||!r.sourceHandle&&!e.sourceHandle)&&(r.targetHandle===e.targetHandle||!r.targetHandle&&!e.targetHandle)),Xye=(e,n,r={})=>{if(!e.source||!e.target)return n;const i=r.getEdgeId||Yye;let s;return jF(e)?s={...e}:s={...e,id:i(e)},Gye(s,n)?n:(s.sourceHandle===null&&delete s.sourceHandle,s.targetHandle===null&&delete s.targetHandle,n.concat(s))};function BF({sourceX:e,sourceY:n,targetX:r,targetY:i}){const[s,a,o,l]=IF({sourceX:e,sourceY:n,targetX:r,targetY:i});return[`M ${e},${n}L ${r},${i}`,s,a,o,l]}const pP={[xt.Left]:{x:-1,y:0},[xt.Right]:{x:1,y:0},[xt.Top]:{x:0,y:-1},[xt.Bottom]:{x:0,y:1}},Qye=({source:e,sourcePosition:n=xt.Bottom,target:r})=>n===xt.Left||n===xt.Right?e.x<r.x?{x:1,y:0}:{x:-1,y:0}:e.y<r.y?{x:0,y:1}:{x:0,y:-1},mP=(e,n)=>Math.sqrt(Math.pow(n.x-e.x,2)+Math.pow(n.y-e.y,2));function Zye({source:e,sourcePosition:n=xt.Bottom,target:r,targetPosition:i=xt.Top,center:s,offset:a,stepPosition:o}){const l=pP[n],u=pP[i],d={x:e.x+l.x*a,y:e.y+l.y*a},p={x:r.x+u.x*a,y:r.y+u.y*a},f=Qye({source:d,sourcePosition:n,target:p}),g=f.x!==0?"x":"y",_=f[g];let x=[],v,S;const w={x:0,y:0},j={x:0,y:0},[,,C,T]=IF({sourceX:e.x,sourceY:e.y,targetX:r.x,targetY:r.y});if(l[g]*u[g]===-1){g==="x"?(v=s.x??d.x+(p.x-d.x)*o,S=s.y??(d.y+p.y)/2):(v=s.x??(d.x+p.x)/2,S=s.y??d.y+(p.y-d.y)*o);const F=[{x:v,y:d.y},{x:v,y:p.y}],L=[{x:d.x,y:S},{x:p.x,y:S}];l[g]===_?x=g==="x"?F:L:x=g==="x"?L:F}else{const F=[{x:d.x,y:p.y}],L=[{x:p.x,y:d.y}];if(g==="x"?x=l.x===_?L:F:x=l.y===_?F:L,n===i){const D=Math.abs(e[g]-r[g]);if(D<=a){const U=Math.min(a-1,a-D);l[g]===_?w[g]=(d[g]>e[g]?-1:1)*U:j[g]=(p[g]>r[g]?-1:1)*U}}if(n!==i){const D=g==="x"?"y":"x",U=l[g]===u[D],I=d[D]>p[D],X=d[D]<p[D];(l[g]===1&&(!U&&I||U&&X)||l[g]!==1&&(!U&&X||U&&I))&&(x=g==="x"?F:L)}const $={x:d.x+w.x,y:d.y+w.y},z={x:p.x+j.x,y:p.y+j.y},B=Math.max(Math.abs($.x-x[0].x),Math.abs(z.x-x[0].x)),H=Math.max(Math.abs($.y-x[0].y),Math.abs(z.y-x[0].y));B>=H?(v=($.x+z.x)/2,S=x[0].y):(v=x[0].x,S=($.y+z.y)/2)}const E={x:d.x+w.x,y:d.y+w.y},A={x:p.x+j.x,y:p.y+j.y};return[[e,...E.x!==x[0].x||E.y!==x[0].y?[E]:[],...x,...A.x!==x[x.length-1].x||A.y!==x[x.length-1].y?[A]:[],r],v,S,C,T]}function Jye(e,n,r,i){const s=Math.min(mP(e,n)/2,mP(n,r)/2,i),{x:a,y:o}=n;if(e.x===a&&a===r.x||e.y===o&&o===r.y)return`L${a} ${o}`;if(e.y===o){const d=e.x<r.x?-1:1,p=e.y<r.y?1:-1;return`L ${a+s*d},${o}Q ${a},${o} ${a},${o+s*p}`}const l=e.x<r.x?1:-1,u=e.y<r.y?-1:1;return`L ${a},${o+s*u}Q ${a},${o} ${a+s*l},${o}`}function Uj({sourceX:e,sourceY:n,sourcePosition:r=xt.Bottom,targetX:i,targetY:s,targetPosition:a=xt.Top,borderRadius:o=5,centerX:l,centerY:u,offset:d=20,stepPosition:p=.5}){const[f,g,_,x,v]=Zye({source:{x:e,y:n},sourcePosition:r,target:{x:i,y:s},targetPosition:a,center:{x:l,y:u},offset:d,stepPosition:p});let S=`M${f[0].x} ${f[0].y}`;for(let w=1;w<f.length-1;w++)S+=Jye(f[w-1],f[w],f[w+1],o);return S+=`L${f[f.length-1].x} ${f[f.length-1].y}`,[S,g,_,x,v]}function gP(e){var n;return e&&!!(e.internals.handleBounds||(n=e.handles)!=null&&n.length)&&!!(e.measured.width||e.width||e.initialWidth)}function e_e(e){var f;const{sourceNode:n,targetNode:r}=e;if(!gP(n)||!gP(r))return null;const i=n.internals.handleBounds||vP(n.handles),s=r.internals.handleBounds||vP(r.handles),a=yP((i==null?void 0:i.source)??[],e.sourceHandle),o=yP(e.connectionMode===Hf.Strict?(s==null?void 0:s.target)??[]:((s==null?void 0:s.target)??[]).concat((s==null?void 0:s.source)??[]),e.targetHandle);if(!a||!o)return(f=e.onError)==null||f.call(e,"008",el.error008(a?"target":"source",{id:e.id,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle})),null;const l=(a==null?void 0:a.position)||xt.Bottom,u=(o==null?void 0:o.position)||xt.Top,d=Id(n,a,l),p=Id(r,o,u);return{sourceX:d.x,sourceY:d.y,targetX:p.x,targetY:p.y,sourcePosition:l,targetPosition:u}}function vP(e){if(!e)return null;const n=[],r=[];for(const i of e)i.width=i.width??1,i.height=i.height??1,i.type==="source"?n.push(i):i.type==="target"&&r.push(i);return{source:n,target:r}}function Id(e,n,r=xt.Left,i=!1){const s=((n==null?void 0:n.x)??0)+e.internals.positionAbsolute.x,a=((n==null?void 0:n.y)??0)+e.internals.positionAbsolute.y,{width:o,height:l}=n??oc(e);if(i)return{x:s+o/2,y:a+l/2};switch((n==null?void 0:n.position)??r){case xt.Top:return{x:s+o/2,y:a};case xt.Right:return{x:s+o,y:a+l/2};case xt.Bottom:return{x:s+o/2,y:a+l};case xt.Left:return{x:s,y:a+l/2}}}function yP(e,n){return e&&(n?e.find(r=>r.id===n):e[0])||null}function Kj(e,n){return e?typeof e=="string"?e:`${n?`${n}__`:""}${Object.keys(e).sort().map(i=>`${i}=${e[i]}`).join("&")}`:""}function t_e(e,{id:n,defaultColor:r,defaultMarkerStart:i,defaultMarkerEnd:s}){const a=new Set;return e.reduce((o,l)=>([l.markerStart||i,l.markerEnd||s].forEach(u=>{if(u&&typeof u=="object"){const d=Kj(u,n);a.has(d)||(o.push({id:d,color:u.color||r,...u}),a.add(d))}}),o),[]).sort((o,l)=>o.id.localeCompare(l.id))}const zF=1e3,n_e=10,ZA={nodeOrigin:[0,0],nodeExtent:qg,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},r_e={...ZA,checkEquality:!0};function JA(e,n){const r={...e};for(const i in n)n[i]!==void 0&&(r[i]=n[i]);return r}function i_e(e,n,r){const i=JA(ZA,r);for(const s of e.values())if(s.parentId)tT(s,e,n,i);else{const a=zv(s,i.nodeOrigin),o=Uf(s.extent)?s.extent:i.nodeExtent,l=Ld(a,o,oc(s));s.internals.positionAbsolute=l}}function s_e(e,n){if(!e.handles)return e.measured?n==null?void 0:n.internals.handleBounds:void 0;const r=[],i=[];for(const s of e.handles){const a={id:s.id,width:s.width??1,height:s.height??1,nodeId:e.id,x:s.x,y:s.y,position:s.position,type:s.type};s.type==="source"?r.push(a):s.type==="target"&&i.push(a)}return{source:r,target:i}}function eT(e){return e==="manual"}function Vj(e,n,r,i={}){var p,f;const s=JA(r_e,i),a={i:0},o=new Map(n),l=s!=null&&s.elevateNodesOnSelect&&!eT(s.zIndexMode)?zF:0;let u=e.length>0,d=!1;n.clear(),r.clear();for(const g of e){let _=o.get(g.id);if(s.checkEquality&&g===(_==null?void 0:_.internals.userNode))n.set(g.id,_);else{const x=zv(g,s.nodeOrigin),v=Uf(g.extent)?g.extent:s.nodeExtent,S=Ld(x,v,oc(g));_={...s.defaults,...g,measured:{width:(p=g.measured)==null?void 0:p.width,height:(f=g.measured)==null?void 0:f.height},internals:{positionAbsolute:S,handleBounds:s_e(g,_),z:$F(g,l,s.zIndexMode),userNode:g}},n.set(g.id,_)}(_.measured===void 0||_.measured.width===void 0||_.measured.height===void 0)&&!_.hidden&&(u=!1),g.parentId&&tT(_,n,r,i,a),d||(d=g.selected??!1)}return{nodesInitialized:u,hasSelectedNodes:d}}function a_e(e,n){if(!e.parentId)return;const r=n.get(e.parentId);r?r.set(e.id,e):n.set(e.parentId,new Map([[e.id,e]]))}function tT(e,n,r,i,s){const{elevateNodesOnSelect:a,nodeOrigin:o,nodeExtent:l,zIndexMode:u}=JA(ZA,i),d=e.parentId,p=n.get(d);if(!p){console.warn(`Parent node ${d} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);return}a_e(e,r),s&&!p.parentId&&p.internals.rootParentIndex===void 0&&u==="auto"&&(p.internals.rootParentIndex=++s.i,p.internals.z=p.internals.z+s.i*n_e),s&&p.internals.rootParentIndex!==void 0&&(s.i=p.internals.rootParentIndex);const f=a&&!eT(u)?zF:0,{x:g,y:_,z:x}=o_e(e,p,o,l,f,u),{positionAbsolute:v}=e.internals,S=g!==v.x||_!==v.y;(S||x!==e.internals.z)&&n.set(e.id,{...e,internals:{...e.internals,positionAbsolute:S?{x:g,y:_}:v,z:x}})}function $F(e,n,r){const i=Xa(e.zIndex)?e.zIndex:0;return eT(r)?i:i+(e.selected?n:0)}function o_e(e,n,r,i,s,a){const{x:o,y:l}=n.internals.positionAbsolute,u=oc(e),d=zv(e,r),p=Uf(e.extent)?Ld(d,e.extent,u):d;let f=Ld({x:o+p.x,y:l+p.y},i,u);e.extent==="parent"&&(f=EF(f,u,n));const g=$F(e,s,a),_=n.internals.z??0;return{x:f.x,y:f.y,z:_>=g?_+1:g}}function nT(e,n,r,i=[0,0]){var o;const s=[],a=new Map;for(const l of e){const u=n.get(l.parentId);if(!u)continue;const d=((o=a.get(l.parentId))==null?void 0:o.expandedRect)??qf(u),p=TF(d,l.rect);a.set(l.parentId,{expandedRect:p,parent:u})}return a.size>0&&a.forEach(({expandedRect:l,parent:u},d)=>{var C;const p=u.internals.positionAbsolute,f=oc(u),g=u.origin??i,_=l.x<p.x?Math.round(Math.abs(p.x-l.x)):0,x=l.y<p.y?Math.round(Math.abs(p.y-l.y)):0,v=Math.max(f.width,Math.round(l.width)),S=Math.max(f.height,Math.round(l.height)),w=(v-f.width)*g[0],j=(S-f.height)*g[1];(_>0||x>0||w||j)&&(s.push({id:d,type:"position",position:{x:u.position.x-_+w,y:u.position.y-x+j}}),(C=r.get(d))==null||C.forEach(T=>{e.some(E=>E.id===T.id)||s.push({id:T.id,type:"position",position:{x:T.position.x+_,y:T.position.y+x}})})),(f.width<l.width||f.height<l.height||_||x)&&s.push({id:d,type:"dimensions",setAttributes:!0,dimensions:{width:v+(_?g[0]*_-w:0),height:S+(x?g[1]*x-j:0)}})}),s}function l_e(e,n,r,i,s,a,o){const l=i==null?void 0:i.querySelector(".xyflow__viewport");let u=!1;if(!l)return{changes:[],updatedInternals:u};const d=[],p=window.getComputedStyle(l),{m22:f}=new window.DOMMatrixReadOnly(p.transform),g=[];for(const _ of e.values()){const x=n.get(_.id);if(!x)continue;if(x.hidden){n.set(x.id,{...x,internals:{...x.internals,handleBounds:void 0}}),u=!0;continue}const v=XA(_.nodeElement),S=x.measured.width!==v.width||x.measured.height!==v.height;if(!!(v.width&&v.height&&(S||!x.internals.handleBounds||_.force))){const j=_.nodeElement.getBoundingClientRect(),C=Uf(x.extent)?x.extent:a;let{positionAbsolute:T}=x.internals;x.parentId&&x.extent==="parent"?T=EF(T,v,n.get(x.parentId)):C&&(T=Ld(T,C,v));const E={...x,measured:v,internals:{...x.internals,positionAbsolute:T,handleBounds:{source:hP("source",_.nodeElement,j,f,x.id),target:hP("target",_.nodeElement,j,f,x.id)}}};n.set(x.id,E),x.parentId&&tT(E,n,r,{nodeOrigin:s,zIndexMode:o}),u=!0,S&&(d.push({id:x.id,type:"dimensions",dimensions:v}),x.expandParent&&x.parentId&&g.push({id:x.id,parentId:x.parentId,rect:qf(E,s)}))}}if(g.length>0){const _=nT(g,n,r,s);d.push(..._)}return{changes:d,updatedInternals:u}}async function c_e({delta:e,panZoom:n,transform:r,translateExtent:i,width:s,height:a}){if(!n||!e.x&&!e.y)return Promise.resolve(!1);const o=await n.setViewportConstrained({x:r[0]+e.x,y:r[1]+e.y,zoom:r[2]},[[0,0],[s,a]],i),l=!!o&&(o.x!==r[0]||o.y!==r[1]||o.k!==r[2]);return Promise.resolve(l)}function _P(e,n,r,i,s,a){let o=s;const l=i.get(o)||new Map;i.set(o,l.set(r,n)),o=`${s}-${e}`;const u=i.get(o)||new Map;if(i.set(o,u.set(r,n)),a){o=`${s}-${e}-${a}`;const d=i.get(o)||new Map;i.set(o,d.set(r,n))}}function FF(e,n,r){e.clear(),n.clear();for(const i of r){const{source:s,target:a,sourceHandle:o=null,targetHandle:l=null}=i,u={edgeId:i.id,source:s,target:a,sourceHandle:o,targetHandle:l},d=`${s}-${o}--${a}-${l}`,p=`${a}-${l}--${s}-${o}`;_P("source",u,p,e,s,o),_P("target",u,d,e,a,l),n.set(i.id,i)}}function HF(e,n){if(!e.parentId)return!1;const r=n.get(e.parentId);return r?r.selected?!0:HF(r,n):!1}function xP(e,n,r){var s;let i=e;do{if((s=i==null?void 0:i.matches)!=null&&s.call(i,n))return!0;if(i===r)return!1;i=i==null?void 0:i.parentElement}while(i);return!1}function u_e(e,n,r,i){const s=new Map;for(const[a,o]of e)if((o.selected||o.id===i)&&(!o.parentId||!HF(o,e))&&(o.draggable||n&&typeof o.draggable>"u")){const l=e.get(a);l&&s.set(a,{id:a,position:l.position||{x:0,y:0},distance:{x:r.x-l.internals.positionAbsolute.x,y:r.y-l.internals.positionAbsolute.y},extent:l.extent,parentId:l.parentId,origin:l.origin,expandParent:l.expandParent,internals:{positionAbsolute:l.internals.positionAbsolute||{x:0,y:0}},measured:{width:l.measured.width??0,height:l.measured.height??0}})}return s}function ES({nodeId:e,dragItems:n,nodeLookup:r,dragging:i=!0}){var o,l,u;const s=[];for(const[d,p]of n){const f=(o=r.get(d))==null?void 0:o.internals.userNode;f&&s.push({...f,position:p.position,dragging:i})}if(!e)return[s[0],s];const a=(l=r.get(e))==null?void 0:l.internals.userNode;return[a?{...a,position:((u=n.get(e))==null?void 0:u.position)||a.position,dragging:i}:s[0],s]}function d_e({dragItems:e,snapGrid:n,x:r,y:i}){const s=e.values().next().value;if(!s)return null;const a={x:r-s.distance.x,y:i-s.distance.y},o=Fv(a,n);return{x:o.x-a.x,y:o.y-a.y}}function h_e({onNodeMouseDown:e,getStoreItems:n,onDragStart:r,onDrag:i,onDragStop:s}){let a={x:null,y:null},o=0,l=new Map,u=!1,d={x:0,y:0},p=null,f=!1,g=null,_=!1,x=!1,v=null;function S({noDragClassName:j,handleSelector:C,domNode:T,isSelectable:E,nodeId:A,nodeClickDistance:O=0}){g=qi(T);function F({x:B,y:H}){const{nodeLookup:D,nodeExtent:U,snapGrid:I,snapToGrid:X,nodeOrigin:K,onNodeDrag:Q,onSelectionDrag:V,onError:R,updateNodePositions:q}=n();a={x:B,y:H};let W=!1;const te=l.size>1,J=te&&U?qj($v(l)):null,G=te&&X?d_e({dragItems:l,snapGrid:I,x:B,y:H}):null;for(const[re,ne]of l){if(!D.has(re))continue;let le={x:B-ne.distance.x,y:H-ne.distance.y};X&&(le=G?{x:Math.round(le.x+G.x),y:Math.round(le.y+G.y)}:Fv(le,I));let oe=null;if(te&&U&&!ne.extent&&J){const{positionAbsolute:Z}=ne.internals,de=Z.x-J.x+U[0][0],ue=Z.x+ne.measured.width-J.x2+U[1][0],pe=Z.y-J.y+U[0][1],Oe=Z.y+ne.measured.height-J.y2+U[1][1];oe=[[de,pe],[ue,Oe]]}const{position:ie,positionAbsolute:he}=NF({nodeId:re,nextPosition:le,nodeLookup:D,nodeExtent:oe||U,nodeOrigin:K,onError:R});W=W||ne.position.x!==ie.x||ne.position.y!==ie.y,ne.position=ie,ne.internals.positionAbsolute=he}if(x=x||W,!!W&&(q(l,!0),v&&(i||Q||!A&&V))){const[re,ne]=ES({nodeId:A,dragItems:l,nodeLookup:D});i==null||i(v,l,re,ne),Q==null||Q(v,re,ne),A||V==null||V(v,ne)}}async function L(){if(!p)return;const{transform:B,panBy:H,autoPanSpeed:D,autoPanOnNodeDrag:U}=n();if(!U){u=!1,cancelAnimationFrame(o);return}const[I,X]=AF(d,p,D);(I!==0||X!==0)&&(a.x=(a.x??0)-I/B[2],a.y=(a.y??0)-X/B[2],await H({x:I,y:X})&&F(a)),o=requestAnimationFrame(L)}function $(B){var te;const{nodeLookup:H,multiSelectionActive:D,nodesDraggable:U,transform:I,snapGrid:X,snapToGrid:K,selectNodesOnDrag:Q,onNodeDragStart:V,onSelectionDragStart:R,unselectNodesAndEdges:q}=n();f=!0,(!Q||!E)&&!D&&A&&((te=H.get(A))!=null&&te.selected||q()),E&&Q&&A&&(e==null||e(A));const W=hg(B.sourceEvent,{transform:I,snapGrid:X,snapToGrid:K,containerBounds:p});if(a=W,l=u_e(H,U,W,A),l.size>0&&(r||V||!A&&R)){const[J,G]=ES({nodeId:A,dragItems:l,nodeLookup:H});r==null||r(B.sourceEvent,l,J,G),V==null||V(B.sourceEvent,J,G),A||R==null||R(B.sourceEvent,G)}}const z=zA().clickDistance(O).on("start",B=>{const{domNode:H,nodeDragThreshold:D,transform:U,snapGrid:I,snapToGrid:X}=n();p=(H==null?void 0:H.getBoundingClientRect())||null,_=!1,x=!1,v=B.sourceEvent,D===0&&$(B),a=hg(B.sourceEvent,{transform:U,snapGrid:I,snapToGrid:X,containerBounds:p}),d=Qa(B.sourceEvent,p)}).on("drag",B=>{const{autoPanOnNodeDrag:H,transform:D,snapGrid:U,snapToGrid:I,nodeDragThreshold:X,nodeLookup:K}=n(),Q=hg(B.sourceEvent,{transform:D,snapGrid:U,snapToGrid:I,containerBounds:p});if(v=B.sourceEvent,(B.sourceEvent.type==="touchmove"&&B.sourceEvent.touches.length>1||A&&!K.has(A))&&(_=!0),!_){if(!u&&H&&f&&(u=!0,L()),!f){const V=Qa(B.sourceEvent,p),R=V.x-d.x,q=V.y-d.y;Math.sqrt(R*R+q*q)>X&&$(B)}(a.x!==Q.xSnapped||a.y!==Q.ySnapped)&&l&&f&&(d=Qa(B.sourceEvent,p),F(Q))}}).on("end",B=>{if(!(!f||_)&&(u=!1,f=!1,cancelAnimationFrame(o),l.size>0)){const{nodeLookup:H,updateNodePositions:D,onNodeDragStop:U,onSelectionDragStop:I}=n();if(x&&(D(l,!1),x=!1),s||U||!A&&I){const[X,K]=ES({nodeId:A,dragItems:l,nodeLookup:H,dragging:!1});s==null||s(B.sourceEvent,l,X,K),U==null||U(B.sourceEvent,X,K),A||I==null||I(B.sourceEvent,K)}}}).filter(B=>{const H=B.target;return!B.button&&(!j||!xP(H,`.${j}`,T))&&(!C||xP(H,C,T))});g.call(z)}function w(){g==null||g.on(".drag",null)}return{update:S,destroy:w}}function f_e(e,n,r){const i=[],s={x:e.x-r,y:e.y-r,width:r*2,height:r*2};for(const a of n.values())Kg(s,qf(a))>0&&i.push(a);return i}const p_e=250;function m_e(e,n,r,i){var l,u;let s=[],a=1/0;const o=f_e(e,r,n+p_e);for(const d of o){const p=[...((l=d.internals.handleBounds)==null?void 0:l.source)??[],...((u=d.internals.handleBounds)==null?void 0:u.target)??[]];for(const f of p){if(i.nodeId===f.nodeId&&i.type===f.type&&i.id===f.id)continue;const{x:g,y:_}=Id(d,f,f.position,!0),x=Math.sqrt(Math.pow(g-e.x,2)+Math.pow(_-e.y,2));x>n||(x<a?(s=[{...f,x:g,y:_}],a=x):x===a&&s.push({...f,x:g,y:_}))}}if(!s.length)return null;if(s.length>1){const d=i.type==="source"?"target":"source";return s.find(p=>p.type===d)??s[0]}return s[0]}function WF(e,n,r,i,s,a=!1){var d,p,f;const o=i.get(e);if(!o)return null;const l=s==="strict"?(d=o.internals.handleBounds)==null?void 0:d[n]:[...((p=o.internals.handleBounds)==null?void 0:p.source)??[],...((f=o.internals.handleBounds)==null?void 0:f.target)??[]],u=(r?l==null?void 0:l.find(g=>g.id===r):l==null?void 0:l[0])??null;return u&&a?{...u,...Id(o,u,u.position,!0)}:u}function qF(e,n){return e||(n!=null&&n.classList.contains("target")?"target":n!=null&&n.classList.contains("source")?"source":null)}function g_e(e,n){let r=null;return n?r=!0:e&&!n&&(r=!1),r}const UF=()=>!0;function v_e(e,{connectionMode:n,connectionRadius:r,handleId:i,nodeId:s,edgeUpdaterType:a,isTarget:o,domNode:l,nodeLookup:u,lib:d,autoPanOnConnect:p,flowId:f,panBy:g,cancelConnection:_,onConnectStart:x,onConnect:v,onConnectEnd:S,isValidConnection:w=UF,onReconnectEnd:j,updateConnection:C,getTransform:T,getFromHandle:E,autoPanSpeed:A,dragThreshold:O=1,handleDomNode:F}){const L=OF(e.target);let $=0,z;const{x:B,y:H}=Qa(e),D=qF(a,F),U=l==null?void 0:l.getBoundingClientRect();let I=!1;if(!U||!D)return;const X=WF(s,D,i,u,n);if(!X)return;let K=Qa(e,U),Q=!1,V=null,R=!1,q=null;function W(){if(!p||!U)return;const[ie,he]=AF(K,U,A);g({x:ie,y:he}),$=requestAnimationFrame(W)}const te={...X,nodeId:s,type:D,position:X.position},J=u.get(s);let re={inProgress:!0,isValid:null,from:Id(J,te,xt.Left,!0),fromHandle:te,fromPosition:te.position,fromNode:J,to:K,toHandle:null,toPosition:lP[te.position],toNode:null,pointer:K};function ne(){I=!0,C(re),x==null||x(e,{nodeId:s,handleId:i,handleType:D})}O===0&&ne();function le(ie){if(!I){const{x:Oe,y:fe}=Qa(ie),Le=Oe-B,Ee=fe-H;if(!(Le*Le+Ee*Ee>O*O))return;ne()}if(!E()||!te){oe(ie);return}const he=T();K=Qa(ie,U),z=m_e(Hv(K,he,!1,[1,1]),r,u,te),Q||(W(),Q=!0);const Z=KF(ie,{handle:z,connectionMode:n,fromNodeId:s,fromHandleId:i,fromType:o?"target":"source",isValidConnection:w,doc:L,lib:d,flowId:f,nodeLookup:u});q=Z.handleDomNode,V=Z.connection,R=g_e(!!z,Z.isValid);const de=u.get(s),ue=de?Id(de,te,xt.Left,!0):re.from,pe={...re,from:ue,isValid:R,to:Z.toHandle&&R?Ab({x:Z.toHandle.x,y:Z.toHandle.y},he):K,toHandle:Z.toHandle,toPosition:R&&Z.toHandle?Z.toHandle.position:lP[te.position],toNode:Z.toHandle?u.get(Z.toHandle.nodeId):null,pointer:K};C(pe),re=pe}function oe(ie){if(!("touches"in ie&&ie.touches.length>0)){if(I){(z||q)&&V&&R&&(v==null||v(V));const{inProgress:he,...Z}=re,de={...Z,toPosition:re.toHandle?re.toPosition:null};S==null||S(ie,de),a&&(j==null||j(ie,de))}_(),cancelAnimationFrame($),Q=!1,R=!1,V=null,q=null,L.removeEventListener("mousemove",le),L.removeEventListener("mouseup",oe),L.removeEventListener("touchmove",le),L.removeEventListener("touchend",oe)}}L.addEventListener("mousemove",le),L.addEventListener("mouseup",oe),L.addEventListener("touchmove",le),L.addEventListener("touchend",oe)}function KF(e,{handle:n,connectionMode:r,fromNodeId:i,fromHandleId:s,fromType:a,doc:o,lib:l,flowId:u,isValidConnection:d=UF,nodeLookup:p}){const f=a==="target",g=n?o.querySelector(`.${l}-flow__handle[data-id="${u}-${n==null?void 0:n.nodeId}-${n==null?void 0:n.id}-${n==null?void 0:n.type}"]`):null,{x:_,y:x}=Qa(e),v=o.elementFromPoint(_,x),S=v!=null&&v.classList.contains(`${l}-flow__handle`)?v:g,w={handleDomNode:S,isValid:!1,connection:null,toHandle:null};if(S){const j=qF(void 0,S),C=S.getAttribute("data-nodeid"),T=S.getAttribute("data-handleid"),E=S.classList.contains("connectable"),A=S.classList.contains("connectableend");if(!C||!j)return w;const O={source:f?C:i,sourceHandle:f?T:s,target:f?i:C,targetHandle:f?s:T};w.connection=O;const L=E&&A&&(r===Hf.Strict?f&&j==="source"||!f&&j==="target":C!==i||T!==s);w.isValid=L&&d(O),w.toHandle=WF(C,j,T,p,r,!0)}return w}const Yj={onPointerDown:v_e,isValid:KF};function y_e({domNode:e,panZoom:n,getTransform:r,getViewScale:i}){const s=qi(e);function a({translateExtent:l,width:u,height:d,zoomStep:p=1,pannable:f=!0,zoomable:g=!0,inversePan:_=!1}){const x=C=>{if(C.sourceEvent.type!=="wheel"||!n)return;const T=r(),E=C.sourceEvent.ctrlKey&&Vg()?10:1,A=-C.sourceEvent.deltaY*(C.sourceEvent.deltaMode===1?.05:C.sourceEvent.deltaMode?1:.002)*p,O=T[2]*Math.pow(2,A*E);n.scaleTo(O)};let v=[0,0];const S=C=>{(C.sourceEvent.type==="mousedown"||C.sourceEvent.type==="touchstart")&&(v=[C.sourceEvent.clientX??C.sourceEvent.touches[0].clientX,C.sourceEvent.clientY??C.sourceEvent.touches[0].clientY])},w=C=>{const T=r();if(C.sourceEvent.type!=="mousemove"&&C.sourceEvent.type!=="touchmove"||!n)return;const E=[C.sourceEvent.clientX??C.sourceEvent.touches[0].clientX,C.sourceEvent.clientY??C.sourceEvent.touches[0].clientY],A=[E[0]-v[0],E[1]-v[1]];v=E;const O=i()*Math.max(T[2],Math.log(T[2]))*(_?-1:1),F={x:T[0]-A[0]*O,y:T[1]-A[1]*O},L=[[0,0],[u,d]];n.setViewportConstrained({x:F.x,y:F.y,zoom:T[2]},L,l)},j=KA().on("start",S).on("zoom",f?w:null).on("zoom.wheel",g?x:null);s.call(j,{})}function o(){s.on("zoom",null)}return{update:a,destroy:o,pointer:Sa}}const V0=e=>({x:e.x,y:e.y,zoom:e.k}),AS=({x:e,y:n,zoom:r})=>q0.translate(e,n).scale(r),uf=(e,n)=>e.target.closest(`.${n}`),VF=(e,n)=>n===2&&Array.isArray(e)&&e.includes(2),__e=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,TS=(e,n=0,r=__e,i=()=>{})=>{const s=typeof n=="number"&&n>0;return s||i(),s?e.transition().duration(n).ease(r).on("end",i):e},YF=e=>{const n=e.ctrlKey&&Vg()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*n};function x_e({zoomPanValues:e,noWheelClassName:n,d3Selection:r,d3Zoom:i,panOnScrollMode:s,panOnScrollSpeed:a,zoomOnPinch:o,onPanZoomStart:l,onPanZoom:u,onPanZoomEnd:d}){return p=>{if(uf(p,n))return p.ctrlKey&&p.preventDefault(),!1;p.preventDefault(),p.stopImmediatePropagation();const f=r.property("__zoom").k||1;if(p.ctrlKey&&o){const S=Sa(p),w=YF(p),j=f*Math.pow(2,w);i.scaleTo(r,j,S,p);return}const g=p.deltaMode===1?20:1;let _=s===Cd.Vertical?0:p.deltaX*g,x=s===Cd.Horizontal?0:p.deltaY*g;!Vg()&&p.shiftKey&&s!==Cd.Vertical&&(_=p.deltaY*g,x=0),i.translateBy(r,-(_/f)*a,-(x/f)*a,{internal:!0});const v=V0(r.property("__zoom"));clearTimeout(e.panScrollTimeout),e.isPanScrolling?(u==null||u(p,v),e.panScrollTimeout=setTimeout(()=>{d==null||d(p,v),e.isPanScrolling=!1},150)):(e.isPanScrolling=!0,l==null||l(p,v))}}function b_e({noWheelClassName:e,preventScrolling:n,d3ZoomHandler:r}){return function(i,s){const a=i.type==="wheel",o=!n&&a&&!i.ctrlKey,l=uf(i,e);if(i.ctrlKey&&a&&l&&i.preventDefault(),o||l)return null;i.preventDefault(),r.call(this,i,s)}}function k_e({zoomPanValues:e,onDraggingChange:n,onPanZoomStart:r}){return i=>{var a,o,l;if((a=i.sourceEvent)!=null&&a.internal)return;const s=V0(i.transform);e.mouseButton=((o=i.sourceEvent)==null?void 0:o.button)||0,e.isZoomingOrPanning=!0,e.prevViewport=s,((l=i.sourceEvent)==null?void 0:l.type)==="mousedown"&&n(!0),r&&(r==null||r(i.sourceEvent,s))}}function w_e({zoomPanValues:e,panOnDrag:n,onPaneContextMenu:r,onTransformChange:i,onPanZoom:s}){return a=>{var o,l;e.usedRightMouseButton=!!(r&&VF(n,e.mouseButton??0)),(o=a.sourceEvent)!=null&&o.sync||i([a.transform.x,a.transform.y,a.transform.k]),s&&!((l=a.sourceEvent)!=null&&l.internal)&&(s==null||s(a.sourceEvent,V0(a.transform)))}}function S_e({zoomPanValues:e,panOnDrag:n,panOnScroll:r,onDraggingChange:i,onPanZoomEnd:s,onPaneContextMenu:a}){return o=>{var l;if(!((l=o.sourceEvent)!=null&&l.internal)&&(e.isZoomingOrPanning=!1,a&&VF(n,e.mouseButton??0)&&!e.usedRightMouseButton&&o.sourceEvent&&a(o.sourceEvent),e.usedRightMouseButton=!1,i(!1),s)){const u=V0(o.transform);e.prevViewport=u,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{s==null||s(o.sourceEvent,u)},r?150:0)}}}function C_e({zoomActivationKeyPressed:e,zoomOnScroll:n,zoomOnPinch:r,panOnDrag:i,panOnScroll:s,zoomOnDoubleClick:a,userSelectionActive:o,noWheelClassName:l,noPanClassName:u,lib:d,connectionInProgress:p}){return f=>{var S;const g=e||n,_=r&&f.ctrlKey,x=f.type==="wheel";if(f.button===1&&f.type==="mousedown"&&(uf(f,`${d}-flow__node`)||uf(f,`${d}-flow__edge`)))return!0;if(!i&&!g&&!s&&!a&&!r||o||p&&!x||uf(f,l)&&x||uf(f,u)&&(!x||s&&x&&!e)||!r&&f.ctrlKey&&x)return!1;if(!r&&f.type==="touchstart"&&((S=f.touches)==null?void 0:S.length)>1)return f.preventDefault(),!1;if(!g&&!s&&!_&&x||!i&&(f.type==="mousedown"||f.type==="touchstart")||Array.isArray(i)&&!i.includes(f.button)&&f.type==="mousedown")return!1;const v=Array.isArray(i)&&i.includes(f.button)||!f.button||f.button<=1;return(!f.ctrlKey||x)&&v}}function j_e({domNode:e,minZoom:n,maxZoom:r,translateExtent:i,viewport:s,onPanZoom:a,onPanZoomStart:o,onPanZoomEnd:l,onDraggingChange:u}){const d={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},p=e.getBoundingClientRect(),f=KA().scaleExtent([n,r]).translateExtent(i),g=qi(e).call(f);j({x:s.x,y:s.y,zoom:Wf(s.zoom,n,r)},[[0,0],[p.width,p.height]],i);const _=g.on("wheel.zoom"),x=g.on("dblclick.zoom");f.wheelDelta(YF);function v(z,B){return g?new Promise(H=>{f==null||f.interpolate((B==null?void 0:B.interpolate)==="linear"?dg:Ax).transform(TS(g,B==null?void 0:B.duration,B==null?void 0:B.ease,()=>H(!0)),z)}):Promise.resolve(!1)}function S({noWheelClassName:z,noPanClassName:B,onPaneContextMenu:H,userSelectionActive:D,panOnScroll:U,panOnDrag:I,panOnScrollMode:X,panOnScrollSpeed:K,preventScrolling:Q,zoomOnPinch:V,zoomOnScroll:R,zoomOnDoubleClick:q,zoomActivationKeyPressed:W,lib:te,onTransformChange:J,connectionInProgress:G,paneClickDistance:re,selectionOnDrag:ne}){D&&!d.isZoomingOrPanning&&w();const le=U&&!W&&!D;f.clickDistance(ne?1/0:!Xa(re)||re<0?0:re);const oe=le?x_e({zoomPanValues:d,noWheelClassName:z,d3Selection:g,d3Zoom:f,panOnScrollMode:X,panOnScrollSpeed:K,zoomOnPinch:V,onPanZoomStart:o,onPanZoom:a,onPanZoomEnd:l}):b_e({noWheelClassName:z,preventScrolling:Q,d3ZoomHandler:_});if(g.on("wheel.zoom",oe,{passive:!1}),!D){const he=k_e({zoomPanValues:d,onDraggingChange:u,onPanZoomStart:o});f.on("start",he);const Z=w_e({zoomPanValues:d,panOnDrag:I,onPaneContextMenu:!!H,onPanZoom:a,onTransformChange:J});f.on("zoom",Z);const de=S_e({zoomPanValues:d,panOnDrag:I,panOnScroll:U,onPaneContextMenu:H,onPanZoomEnd:l,onDraggingChange:u});f.on("end",de)}const ie=C_e({zoomActivationKeyPressed:W,panOnDrag:I,zoomOnScroll:R,panOnScroll:U,zoomOnDoubleClick:q,zoomOnPinch:V,userSelectionActive:D,noPanClassName:B,noWheelClassName:z,lib:te,connectionInProgress:G});f.filter(ie),q?g.on("dblclick.zoom",x):g.on("dblclick.zoom",null)}function w(){f.on("zoom",null)}async function j(z,B,H){const D=AS(z),U=f==null?void 0:f.constrain()(D,B,H);return U&&await v(U),new Promise(I=>I(U))}async function C(z,B){const H=AS(z);return await v(H,B),new Promise(D=>D(H))}function T(z){if(g){const B=AS(z),H=g.property("__zoom");(H.k!==z.zoom||H.x!==z.x||H.y!==z.y)&&(f==null||f.transform(g,B,null,{sync:!0}))}}function E(){const z=g?Wa(g.node()):{x:0,y:0,k:1};return{x:z.x,y:z.y,zoom:z.k}}function A(z,B){return g?new Promise(H=>{f==null||f.interpolate((B==null?void 0:B.interpolate)==="linear"?dg:Ax).scaleTo(TS(g,B==null?void 0:B.duration,B==null?void 0:B.ease,()=>H(!0)),z)}):Promise.resolve(!1)}function O(z,B){return g?new Promise(H=>{f==null||f.interpolate((B==null?void 0:B.interpolate)==="linear"?dg:Ax).scaleBy(TS(g,B==null?void 0:B.duration,B==null?void 0:B.ease,()=>H(!0)),z)}):Promise.resolve(!1)}function F(z){f==null||f.scaleExtent(z)}function L(z){f==null||f.translateExtent(z)}function $(z){const B=!Xa(z)||z<0?0:z;f==null||f.clickDistance(B)}return{update:S,destroy:w,setViewport:C,setViewportConstrained:j,getViewport:E,scaleTo:A,scaleBy:O,setScaleExtent:F,setTranslateExtent:L,syncViewport:T,setClickDistance:$}}var Kf;(function(e){e.Line="line",e.Handle="handle"})(Kf||(Kf={}));function N_e({width:e,prevWidth:n,height:r,prevHeight:i,affectsX:s,affectsY:a}){const o=e-n,l=r-i,u=[o>0?1:o<0?-1:0,l>0?1:l<0?-1:0];return o&&s&&(u[0]=u[0]*-1),l&&a&&(u[1]=u[1]*-1),u}function bP(e){const n=e.includes("right")||e.includes("left"),r=e.includes("bottom")||e.includes("top"),i=e.includes("left"),s=e.includes("top");return{isHorizontal:n,isVertical:r,affectsX:i,affectsY:s}}function Lc(e,n){return Math.max(0,n-e)}function Ic(e,n){return Math.max(0,e-n)}function S_(e,n,r){return Math.max(0,n-e,e-r)}function kP(e,n){return e?!n:n}function E_e(e,n,r,i,s,a,o,l){let{affectsX:u,affectsY:d}=n;const{isHorizontal:p,isVertical:f}=n,g=p&&f,{xSnapped:_,ySnapped:x}=r,{minWidth:v,maxWidth:S,minHeight:w,maxHeight:j}=i,{x:C,y:T,width:E,height:A,aspectRatio:O}=e;let F=Math.floor(p?_-e.pointerX:0),L=Math.floor(f?x-e.pointerY:0);const $=E+(u?-F:F),z=A+(d?-L:L),B=-a[0]*E,H=-a[1]*A;let D=S_($,v,S),U=S_(z,w,j);if(o){let K=0,Q=0;u&&F<0?K=Lc(C+F+B,o[0][0]):!u&&F>0&&(K=Ic(C+$+B,o[1][0])),d&&L<0?Q=Lc(T+L+H,o[0][1]):!d&&L>0&&(Q=Ic(T+z+H,o[1][1])),D=Math.max(D,K),U=Math.max(U,Q)}if(l){let K=0,Q=0;u&&F>0?K=Ic(C+F,l[0][0]):!u&&F<0&&(K=Lc(C+$,l[1][0])),d&&L>0?Q=Ic(T+L,l[0][1]):!d&&L<0&&(Q=Lc(T+z,l[1][1])),D=Math.max(D,K),U=Math.max(U,Q)}if(s){if(p){const K=S_($/O,w,j)*O;if(D=Math.max(D,K),o){let Q=0;!u&&!d||u&&!d&&g?Q=Ic(T+H+$/O,o[1][1])*O:Q=Lc(T+H+(u?F:-F)/O,o[0][1])*O,D=Math.max(D,Q)}if(l){let Q=0;!u&&!d||u&&!d&&g?Q=Lc(T+$/O,l[1][1])*O:Q=Ic(T+(u?F:-F)/O,l[0][1])*O,D=Math.max(D,Q)}}if(f){const K=S_(z*O,v,S)/O;if(U=Math.max(U,K),o){let Q=0;!u&&!d||d&&!u&&g?Q=Ic(C+z*O+B,o[1][0])/O:Q=Lc(C+(d?L:-L)*O+B,o[0][0])/O,U=Math.max(U,Q)}if(l){let Q=0;!u&&!d||d&&!u&&g?Q=Lc(C+z*O,l[1][0])/O:Q=Ic(C+(d?L:-L)*O,l[0][0])/O,U=Math.max(U,Q)}}}L=L+(L<0?U:-U),F=F+(F<0?D:-D),s&&(g?$>z*O?L=(kP(u,d)?-F:F)/O:F=(kP(u,d)?-L:L)*O:p?(L=F/O,d=u):(F=L*O,u=d));const I=u?C+F:C,X=d?T+L:T;return{width:E+(u?-F:F),height:A+(d?-L:L),x:a[0]*F*(u?-1:1)+I,y:a[1]*L*(d?-1:1)+X}}const GF={width:0,height:0,x:0,y:0},A_e={...GF,pointerX:0,pointerY:0,aspectRatio:1};function T_e(e){return[[0,0],[e.measured.width,e.measured.height]]}function M_e(e,n,r){const i=n.position.x+e.position.x,s=n.position.y+e.position.y,a=e.measured.width??0,o=e.measured.height??0,l=r[0]*a,u=r[1]*o;return[[i-l,s-u],[i+a-l,s+o-u]]}function R_e({domNode:e,nodeId:n,getStoreItems:r,onChange:i,onEnd:s}){const a=qi(e);let o={controlDirection:bP("bottom-right"),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};function l({controlPosition:d,boundaries:p,keepAspectRatio:f,resizeDirection:g,onResizeStart:_,onResize:x,onResizeEnd:v,shouldResize:S}){let w={...GF},j={...A_e};o={boundaries:p,resizeDirection:g,keepAspectRatio:f,controlDirection:bP(d)};let C,T=null,E=[],A,O,F,L=!1;const $=zA().on("start",z=>{const{nodeLookup:B,transform:H,snapGrid:D,snapToGrid:U,nodeOrigin:I,paneDomNode:X}=r();if(C=B.get(n),!C)return;T=(X==null?void 0:X.getBoundingClientRect())??null;const{xSnapped:K,ySnapped:Q}=hg(z.sourceEvent,{transform:H,snapGrid:D,snapToGrid:U,containerBounds:T});w={width:C.measured.width??0,height:C.measured.height??0,x:C.position.x??0,y:C.position.y??0},j={...w,pointerX:K,pointerY:Q,aspectRatio:w.width/w.height},A=void 0,C.parentId&&(C.extent==="parent"||C.expandParent)&&(A=B.get(C.parentId),O=A&&C.extent==="parent"?T_e(A):void 0),E=[],F=void 0;for(const[V,R]of B)if(R.parentId===n&&(E.push({id:V,position:{...R.position},extent:R.extent}),R.extent==="parent"||R.expandParent)){const q=M_e(R,C,R.origin??I);F?F=[[Math.min(q[0][0],F[0][0]),Math.min(q[0][1],F[0][1])],[Math.max(q[1][0],F[1][0]),Math.max(q[1][1],F[1][1])]]:F=q}_==null||_(z,{...w})}).on("drag",z=>{const{transform:B,snapGrid:H,snapToGrid:D,nodeOrigin:U}=r(),I=hg(z.sourceEvent,{transform:B,snapGrid:H,snapToGrid:D,containerBounds:T}),X=[];if(!C)return;const{x:K,y:Q,width:V,height:R}=w,q={},W=C.origin??U,{width:te,height:J,x:G,y:re}=E_e(j,o.controlDirection,I,o.boundaries,o.keepAspectRatio,W,O,F),ne=te!==V,le=J!==R,oe=G!==K&&ne,ie=re!==Q&&le;if(!oe&&!ie&&!ne&&!le)return;if((oe||ie||W[0]===1||W[1]===1)&&(q.x=oe?G:w.x,q.y=ie?re:w.y,w.x=q.x,w.y=q.y,E.length>0)){const ue=G-K,pe=re-Q;for(const Oe of E)Oe.position={x:Oe.position.x-ue+W[0]*(te-V),y:Oe.position.y-pe+W[1]*(J-R)},X.push(Oe)}if((ne||le)&&(q.width=ne&&(!o.resizeDirection||o.resizeDirection==="horizontal")?te:w.width,q.height=le&&(!o.resizeDirection||o.resizeDirection==="vertical")?J:w.height,w.width=q.width,w.height=q.height),A&&C.expandParent){const ue=W[0]*(q.width??0);q.x&&q.x<ue&&(w.x=ue,j.x=j.x-(q.x-ue));const pe=W[1]*(q.height??0);q.y&&q.y<pe&&(w.y=pe,j.y=j.y-(q.y-pe))}const he=N_e({width:w.width,prevWidth:V,height:w.height,prevHeight:R,affectsX:o.controlDirection.affectsX,affectsY:o.controlDirection.affectsY}),Z={...w,direction:he};(S==null?void 0:S(z,Z))!==!1&&(L=!0,x==null||x(z,Z),i(q,X))}).on("end",z=>{L&&(v==null||v(z,{...w}),s==null||s({...w}),L=!1)});a.call($)}function u(){a.on(".drag",null)}return{update:l,destroy:u}}var MS={exports:{}},RS={},OS={exports:{}},DS={};/**
 * @license React
 * use-sync-external-store-shim.production.js
 *
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */var wP;function O_e(){if(wP)return DS;wP=1;var e=mv();function n(f,g){return f===g&&(f!==0||1/f===1/g)||f!==f&&g!==g}var r=typeof Object.is=="function"?Object.is:n,i=e.useState,s=e.useEffect,a=e.useLayoutEffect,o=e.useDebugValue;function l(f,g){var _=g(),x=i({inst:{value:_,getSnapshot:g}}),v=x[0].inst,S=x[1];return a(function(){v.value=_,v.getSnapshot=g,u(v)&&S({inst:v})},[f,_,g]),s(function(){return u(v)&&S({inst:v}),f(function(){u(v)&&S({inst:v})})},[f]),o(_),_}function u(f){var g=f.getSnapshot;f=f.value;try{var _=g();return!r(f,_)}catch{return!0}}function d(f,g){return g()}var p=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?d:l;return DS.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:p,DS}var SP;function D_e(){return SP||(SP=1,OS.exports=O_e()),OS.exports}/**
 * @license React
 * use-sync-external-store-shim/with-selector.production.js
 *
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */var CP;function P_e(){if(CP)return RS;CP=1;var e=mv(),n=D_e();function r(d,p){return d===p&&(d!==0||1/d===1/p)||d!==d&&p!==p}var i=typeof Object.is=="function"?Object.is:r,s=n.useSyncExternalStore,a=e.useRef,o=e.useEffect,l=e.useMemo,u=e.useDebugValue;return RS.useSyncExternalStoreWithSelector=function(d,p,f,g,_){var x=a(null);if(x.current===null){var v={hasValue:!1,value:null};x.current=v}else v=x.current;x=l(function(){function w(A){if(!j){if(j=!0,C=A,A=g(A),_!==void 0&&v.hasValue){var O=v.value;if(_(O,A))return T=O}return T=A}if(O=T,i(C,A))return O;var F=g(A);return _!==void 0&&_(O,F)?(C=A,O):(C=A,T=F)}var j=!1,C,T,E=f===void 0?null:f;return[function(){return w(p())},E===null?void 0:function(){return w(E())}]},[p,f,g,_]);var S=s(d,x[0],x[1]);return o(function(){v.hasValue=!0,v.value=S},[S]),u(S),S},RS}var jP;function L_e(){return jP||(jP=1,MS.exports=P_e()),MS.exports}var I_e=L_e();const B_e=wu(I_e),z_e={},NP=e=>{let n;const r=new Set,i=(p,f)=>{const g=typeof p=="function"?p(n):p;if(!Object.is(g,n)){const _=n;n=f??(typeof g!="object"||g===null)?g:Object.assign({},n,g),r.forEach(x=>x(n,_))}},s=()=>n,u={setState:i,getState:s,getInitialState:()=>d,subscribe:p=>(r.add(p),()=>r.delete(p)),destroy:()=>{(z_e?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),r.clear()}},d=n=e(i,s,u);return u},$_e=e=>e?NP(e):NP,{useDebugValue:F_e}=ip,{useSyncExternalStoreWithSelector:H_e}=B_e,W_e=e=>e;function XF(e,n=W_e,r){const i=H_e(e.subscribe,e.getState,e.getServerState||e.getInitialState,n,r);return F_e(i),i}const EP=(e,n)=>{const r=$_e(e),i=(s,a=n)=>XF(r,s,a);return Object.assign(i,r),i},q_e=(e,n)=>e?EP(e,n):EP;function kr(e,n){if(Object.is(e,n))return!0;if(typeof e!="object"||e===null||typeof n!="object"||n===null)return!1;if(e instanceof Map&&n instanceof Map){if(e.size!==n.size)return!1;for(const[i,s]of e)if(!Object.is(s,n.get(i)))return!1;return!0}if(e instanceof Set&&n instanceof Set){if(e.size!==n.size)return!1;for(const i of e)if(!n.has(i))return!1;return!0}const r=Object.keys(e);if(r.length!==Object.keys(n).length)return!1;for(const i of r)if(!Object.prototype.hasOwnProperty.call(n,i)||!Object.is(e[i],n[i]))return!1;return!0}const Y0=b.createContext(null),U_e=Y0.Provider,QF=el.error001();function _n(e,n){const r=b.useContext(Y0);if(r===null)throw new Error(QF);return XF(r,e,n)}function dr(){const e=b.useContext(Y0);if(e===null)throw new Error(QF);return b.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}const AP={display:"none"},K_e={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},ZF="react-flow__node-desc",JF="react-flow__edge-desc",V_e="react-flow__aria-live",Y_e=e=>e.ariaLiveMessage,G_e=e=>e.ariaLabelConfig;function X_e({rfId:e}){const n=_n(Y_e);return c.jsx("div",{id:`${V_e}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:K_e,children:n})}function Q_e({rfId:e,disableKeyboardA11y:n}){const r=_n(G_e);return c.jsxs(c.Fragment,{children:[c.jsx("div",{id:`${ZF}-${e}`,style:AP,children:n?r["node.a11yDescription.default"]:r["node.a11yDescription.keyboardDisabled"]}),c.jsx("div",{id:`${JF}-${e}`,style:AP,children:r["edge.a11yDescription.default"]}),!n&&c.jsx(X_e,{rfId:e})]})}const G0=b.forwardRef(({position:e="top-left",children:n,className:r,style:i,...s},a)=>{const o=`${e}`.split("-");return c.jsx("div",{className:Qr(["react-flow__panel",r,...o]),style:i,ref:a,...s,children:n})});G0.displayName="Panel";function Z_e({proOptions:e,position:n="bottom-right"}){return e!=null&&e.hideAttribution?null:c.jsx(G0,{position:n,className:"react-flow__attribution","data-message":"Please only hide this attribution when you are subscribed to React Flow Pro: https://pro.reactflow.dev",children:c.jsx("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution",children:"React Flow"})})}const J_e=e=>{const n=[],r=[];for(const[,i]of e.nodeLookup)i.selected&&n.push(i.internals.userNode);for(const[,i]of e.edgeLookup)i.selected&&r.push(i);return{selectedNodes:n,selectedEdges:r}},C_=e=>e.id;function exe(e,n){return kr(e.selectedNodes.map(C_),n.selectedNodes.map(C_))&&kr(e.selectedEdges.map(C_),n.selectedEdges.map(C_))}function txe({onSelectionChange:e}){const n=dr(),{selectedNodes:r,selectedEdges:i}=_n(J_e,exe);return b.useEffect(()=>{const s={nodes:r,edges:i};e==null||e(s),n.getState().onSelectionChangeHandlers.forEach(a=>a(s))},[r,i,e]),null}const nxe=e=>!!e.onSelectionChangeHandlers;function rxe({onSelectionChange:e}){const n=_n(nxe);return e||n?c.jsx(txe,{onSelectionChange:e}):null}const Gj=typeof window<"u"?b.useLayoutEffect:b.useEffect,eH=[0,0],ixe={x:0,y:0,zoom:1},sxe=["nodes","edges","defaultNodes","defaultEdges","onConnect","onConnectStart","onConnectEnd","onClickConnectStart","onClickConnectEnd","nodesDraggable","autoPanOnNodeFocus","nodesConnectable","nodesFocusable","edgesFocusable","edgesReconnectable","elevateNodesOnSelect","elevateEdgesOnSelect","minZoom","maxZoom","nodeExtent","onNodesChange","onEdgesChange","elementsSelectable","connectionMode","snapGrid","snapToGrid","translateExtent","connectOnClick","defaultEdgeOptions","fitView","fitViewOptions","onNodesDelete","onEdgesDelete","onDelete","onNodeDrag","onNodeDragStart","onNodeDragStop","onSelectionDrag","onSelectionDragStart","onSelectionDragStop","onMoveStart","onMove","onMoveEnd","noPanClassName","nodeOrigin","autoPanOnConnect","autoPanOnNodeDrag","onError","connectionRadius","isValidConnection","selectNodesOnDrag","nodeDragThreshold","connectionDragThreshold","onBeforeDelete","debug","autoPanSpeed","ariaLabelConfig","zIndexMode"],TP=[...sxe,"rfId"],axe=e=>({setNodes:e.setNodes,setEdges:e.setEdges,setMinZoom:e.setMinZoom,setMaxZoom:e.setMaxZoom,setTranslateExtent:e.setTranslateExtent,setNodeExtent:e.setNodeExtent,reset:e.reset,setDefaultNodesAndEdges:e.setDefaultNodesAndEdges}),MP={translateExtent:qg,nodeOrigin:eH,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1"};function oxe(e){const{setNodes:n,setEdges:r,setMinZoom:i,setMaxZoom:s,setTranslateExtent:a,setNodeExtent:o,reset:l,setDefaultNodesAndEdges:u}=_n(axe,kr),d=dr();Gj(()=>(u(e.defaultNodes,e.defaultEdges),()=>{p.current=MP,l()}),[]);const p=b.useRef(MP);return Gj(()=>{for(const f of TP){const g=e[f],_=p.current[f];g!==_&&(typeof e[f]>"u"||(f==="nodes"?n(g):f==="edges"?r(g):f==="minZoom"?i(g):f==="maxZoom"?s(g):f==="translateExtent"?a(g):f==="nodeExtent"?o(g):f==="ariaLabelConfig"?d.setState({ariaLabelConfig:qye(g)}):f==="fitView"?d.setState({fitViewQueued:g}):f==="fitViewOptions"?d.setState({fitViewOptions:g}):d.setState({[f]:g})))}p.current=e},TP.map(f=>e[f])),null}function RP(){return typeof window>"u"||!window.matchMedia?null:window.matchMedia("(prefers-color-scheme: dark)")}function lxe(e){var i;const[n,r]=b.useState(e==="system"?null:e);return b.useEffect(()=>{if(e!=="system"){r(e);return}const s=RP(),a=()=>r(s!=null&&s.matches?"dark":"light");return a(),s==null||s.addEventListener("change",a),()=>{s==null||s.removeEventListener("change",a)}},[e]),n!==null?n:(i=RP())!=null&&i.matches?"dark":"light"}const OP=typeof document<"u"?document:null;function Yg(e=null,n={target:OP,actInsideInputWithModifier:!0}){const[r,i]=b.useState(!1),s=b.useRef(!1),a=b.useRef(new Set([])),[o,l]=b.useMemo(()=>{if(e!==null){const d=(Array.isArray(e)?e:[e]).filter(f=>typeof f=="string").map(f=>f.replace("+",`
`).replace(`

`,`
+`).split(`
`)),p=d.reduce((f,g)=>f.concat(...g),[]);return[d,p]}return[[],[]]},[e]);return b.useEffect(()=>{const u=(n==null?void 0:n.target)??OP,d=(n==null?void 0:n.actInsideInputWithModifier)??!0;if(e!==null){const p=_=>{var S,w;if(s.current=_.ctrlKey||_.metaKey||_.shiftKey||_.altKey,(!s.current||s.current&&!d)&&DF(_))return!1;const v=PP(_.code,l);if(a.current.add(_[v]),DP(o,a.current,!1)){const j=((w=(S=_.composedPath)==null?void 0:S.call(_))==null?void 0:w[0])||_.target,C=(j==null?void 0:j.nodeName)==="BUTTON"||(j==null?void 0:j.nodeName)==="A";n.preventDefault!==!1&&(s.current||!C)&&_.preventDefault(),i(!0)}},f=_=>{const x=PP(_.code,l);DP(o,a.current,!0)?(i(!1),a.current.clear()):a.current.delete(_[x]),_.key==="Meta"&&a.current.clear(),s.current=!1},g=()=>{a.current.clear(),i(!1)};return u==null||u.addEventListener("keydown",p),u==null||u.addEventListener("keyup",f),window.addEventListener("blur",g),window.addEventListener("contextmenu",g),()=>{u==null||u.removeEventListener("keydown",p),u==null||u.removeEventListener("keyup",f),window.removeEventListener("blur",g),window.removeEventListener("contextmenu",g)}}},[e,i]),r}function DP(e,n,r){return e.filter(i=>r||i.length===n.size).some(i=>i.every(s=>n.has(s)))}function PP(e,n){return n.includes(e)?"code":"key"}const cxe=()=>{const e=dr();return b.useMemo(()=>({zoomIn:n=>{const{panZoom:r}=e.getState();return r?r.scaleBy(1.2,n):Promise.resolve(!1)},zoomOut:n=>{const{panZoom:r}=e.getState();return r?r.scaleBy(1/1.2,n):Promise.resolve(!1)},zoomTo:(n,r)=>{const{panZoom:i}=e.getState();return i?i.scaleTo(n,r):Promise.resolve(!1)},getZoom:()=>e.getState().transform[2],setViewport:async(n,r)=>{const{transform:[i,s,a],panZoom:o}=e.getState();return o?(await o.setViewport({x:n.x??i,y:n.y??s,zoom:n.zoom??a},r),Promise.resolve(!0)):Promise.resolve(!1)},getViewport:()=>{const[n,r,i]=e.getState().transform;return{x:n,y:r,zoom:i}},setCenter:async(n,r,i)=>e.getState().setCenter(n,r,i),fitBounds:async(n,r)=>{const{width:i,height:s,minZoom:a,maxZoom:o,panZoom:l}=e.getState(),u=GA(n,i,s,a,o,(r==null?void 0:r.padding)??.1);return l?(await l.setViewport(u,{duration:r==null?void 0:r.duration,ease:r==null?void 0:r.ease,interpolate:r==null?void 0:r.interpolate}),Promise.resolve(!0)):Promise.resolve(!1)},screenToFlowPosition:(n,r={})=>{const{transform:i,snapGrid:s,snapToGrid:a,domNode:o}=e.getState();if(!o)return n;const{x:l,y:u}=o.getBoundingClientRect(),d={x:n.x-l,y:n.y-u},p=r.snapGrid??s,f=r.snapToGrid??a;return Hv(d,i,f,p)},flowToScreenPosition:n=>{const{transform:r,domNode:i}=e.getState();if(!i)return n;const{x:s,y:a}=i.getBoundingClientRect(),o=Ab(n,r);return{x:o.x+s,y:o.y+a}}}),[])};function tH(e,n){const r=[],i=new Map,s=[];for(const a of e)if(a.type==="add"){s.push(a);continue}else if(a.type==="remove"||a.type==="replace")i.set(a.id,[a]);else{const o=i.get(a.id);o?o.push(a):i.set(a.id,[a])}for(const a of n){const o=i.get(a.id);if(!o){r.push(a);continue}if(o[0].type==="remove")continue;if(o[0].type==="replace"){r.push({...o[0].item});continue}const l={...a};for(const u of o)uxe(u,l);r.push(l)}return s.length&&s.forEach(a=>{a.index!==void 0?r.splice(a.index,0,{...a.item}):r.push({...a.item})}),r}function uxe(e,n){switch(e.type){case"select":{n.selected=e.selected;break}case"position":{typeof e.position<"u"&&(n.position=e.position),typeof e.dragging<"u"&&(n.dragging=e.dragging);break}case"dimensions":{typeof e.dimensions<"u"&&(n.measured={...e.dimensions},e.setAttributes&&((e.setAttributes===!0||e.setAttributes==="width")&&(n.width=e.dimensions.width),(e.setAttributes===!0||e.setAttributes==="height")&&(n.height=e.dimensions.height))),typeof e.resizing=="boolean"&&(n.resizing=e.resizing);break}}}function nH(e,n){return tH(e,n)}function rH(e,n){return tH(e,n)}function sd(e,n){return{id:e,type:"select",selected:n}}function df(e,n=new Set,r=!1){const i=[];for(const[s,a]of e){const o=n.has(s);!(a.selected===void 0&&!o)&&a.selected!==o&&(r&&(a.selected=o),i.push(sd(a.id,o)))}return i}function LP({items:e=[],lookup:n}){var s;const r=[],i=new Map(e.map(a=>[a.id,a]));for(const[a,o]of e.entries()){const l=n.get(o.id),u=((s=l==null?void 0:l.internals)==null?void 0:s.userNode)??l;u!==void 0&&u!==o&&r.push({id:o.id,item:o,type:"replace"}),u===void 0&&r.push({item:o,type:"add",index:a})}for(const[a]of n)i.get(a)===void 0&&r.push({id:a,type:"remove"});return r}function IP(e){return{id:e.id,type:"remove"}}const BP=e=>Dye(e),dxe=e=>jF(e);function iH(e){return b.forwardRef(e)}function zP(e){const[n,r]=b.useState(BigInt(0)),[i]=b.useState(()=>hxe(()=>r(s=>s+BigInt(1))));return Gj(()=>{const s=i.get();s.length&&(e(s),i.reset())},[n]),i}function hxe(e){let n=[];return{get:()=>n,reset:()=>{n=[]},push:r=>{n.push(r),e()}}}const sH=b.createContext(null);function fxe({children:e}){const n=dr(),r=b.useCallback(l=>{const{nodes:u=[],setNodes:d,hasDefaultNodes:p,onNodesChange:f,nodeLookup:g,fitViewQueued:_,onNodesChangeMiddlewareMap:x}=n.getState();let v=u;for(const w of l)v=typeof w=="function"?w(v):w;let S=LP({items:v,lookup:g});for(const w of x.values())S=w(S);p&&d(v),S.length>0?f==null||f(S):_&&window.requestAnimationFrame(()=>{const{fitViewQueued:w,nodes:j,setNodes:C}=n.getState();w&&C(j)})},[]),i=zP(r),s=b.useCallback(l=>{const{edges:u=[],setEdges:d,hasDefaultEdges:p,onEdgesChange:f,edgeLookup:g}=n.getState();let _=u;for(const x of l)_=typeof x=="function"?x(_):x;p?d(_):f&&f(LP({items:_,lookup:g}))},[]),a=zP(s),o=b.useMemo(()=>({nodeQueue:i,edgeQueue:a}),[]);return c.jsx(sH.Provider,{value:o,children:e})}function pxe(){const e=b.useContext(sH);if(!e)throw new Error("useBatchContext must be used within a BatchProvider");return e}const mxe=e=>!!e.panZoom;function X0(){const e=cxe(),n=dr(),r=pxe(),i=_n(mxe),s=b.useMemo(()=>{const a=f=>n.getState().nodeLookup.get(f),o=f=>{r.nodeQueue.push(f)},l=f=>{r.edgeQueue.push(f)},u=f=>{var w,j;const{nodeLookup:g,nodeOrigin:_}=n.getState(),x=BP(f)?f:g.get(f.id),v=x.parentId?RF(x.position,x.measured,x.parentId,g,_):x.position,S={...x,position:v,width:((w=x.measured)==null?void 0:w.width)??x.width,height:((j=x.measured)==null?void 0:j.height)??x.height};return qf(S)},d=(f,g,_={replace:!1})=>{o(x=>x.map(v=>{if(v.id===f){const S=typeof g=="function"?g(v):g;return _.replace&&BP(S)?S:{...v,...S}}return v}))},p=(f,g,_={replace:!1})=>{l(x=>x.map(v=>{if(v.id===f){const S=typeof g=="function"?g(v):g;return _.replace&&dxe(S)?S:{...v,...S}}return v}))};return{getNodes:()=>n.getState().nodes.map(f=>({...f})),getNode:f=>{var g;return(g=a(f))==null?void 0:g.internals.userNode},getInternalNode:a,getEdges:()=>{const{edges:f=[]}=n.getState();return f.map(g=>({...g}))},getEdge:f=>n.getState().edgeLookup.get(f),setNodes:o,setEdges:l,addNodes:f=>{const g=Array.isArray(f)?f:[f];r.nodeQueue.push(_=>[..._,...g])},addEdges:f=>{const g=Array.isArray(f)?f:[f];r.edgeQueue.push(_=>[..._,...g])},toObject:()=>{const{nodes:f=[],edges:g=[],transform:_}=n.getState(),[x,v,S]=_;return{nodes:f.map(w=>({...w})),edges:g.map(w=>({...w})),viewport:{x,y:v,zoom:S}}},deleteElements:async({nodes:f=[],edges:g=[]})=>{const{nodes:_,edges:x,onNodesDelete:v,onEdgesDelete:S,triggerNodeChanges:w,triggerEdgeChanges:j,onDelete:C,onBeforeDelete:T}=n.getState(),{nodes:E,edges:A}=await zye({nodesToRemove:f,edgesToRemove:g,nodes:_,edges:x,onBeforeDelete:T}),O=A.length>0,F=E.length>0;if(O){const L=A.map(IP);S==null||S(A),j(L)}if(F){const L=E.map(IP);v==null||v(E),w(L)}return(F||O)&&(C==null||C({nodes:E,edges:A})),{deletedNodes:E,deletedEdges:A}},getIntersectingNodes:(f,g=!0,_)=>{const x=uP(f),v=x?f:u(f),S=_!==void 0;return v?(_||n.getState().nodes).filter(w=>{const j=n.getState().nodeLookup.get(w.id);if(j&&!x&&(w.id===f.id||!j.internals.positionAbsolute))return!1;const C=qf(S?w:j),T=Kg(C,v);return g&&T>0||T>=C.width*C.height||T>=v.width*v.height}):[]},isNodeIntersecting:(f,g,_=!0)=>{const v=uP(f)?f:u(f);if(!v)return!1;const S=Kg(v,g);return _&&S>0||S>=g.width*g.height||S>=v.width*v.height},updateNode:d,updateNodeData:(f,g,_={replace:!1})=>{d(f,x=>{const v=typeof g=="function"?g(x):g;return _.replace?{...x,data:v}:{...x,data:{...x.data,...v}}},_)},updateEdge:p,updateEdgeData:(f,g,_={replace:!1})=>{p(f,x=>{const v=typeof g=="function"?g(x):g;return _.replace?{...x,data:v}:{...x,data:{...x.data,...v}}},_)},getNodesBounds:f=>{const{nodeLookup:g,nodeOrigin:_}=n.getState();return Pye(f,{nodeLookup:g,nodeOrigin:_})},getHandleConnections:({type:f,id:g,nodeId:_})=>{var x;return Array.from(((x=n.getState().connectionLookup.get(`${_}-${f}${g?`-${g}`:""}`))==null?void 0:x.values())??[])},getNodeConnections:({type:f,handleId:g,nodeId:_})=>{var x;return Array.from(((x=n.getState().connectionLookup.get(`${_}${f?g?`-${f}-${g}`:`-${f}`:""}`))==null?void 0:x.values())??[])},fitView:async f=>{const g=n.getState().fitViewResolver??Wye();return n.setState({fitViewQueued:!0,fitViewOptions:f,fitViewResolver:g}),r.nodeQueue.push(_=>[..._]),g.promise}}},[]);return b.useMemo(()=>({...s,...e,viewportInitialized:i}),[i])}const $P=e=>e.selected,gxe=typeof window<"u"?window:void 0;function vxe({deleteKeyCode:e,multiSelectionKeyCode:n}){const r=dr(),{deleteElements:i}=X0(),s=Yg(e,{actInsideInputWithModifier:!1}),a=Yg(n,{target:gxe});b.useEffect(()=>{if(s){const{edges:o,nodes:l}=r.getState();i({nodes:l.filter($P),edges:o.filter($P)}),r.setState({nodesSelectionActive:!1})}},[s]),b.useEffect(()=>{r.setState({multiSelectionActive:a})},[a])}function yxe(e){const n=dr();b.useEffect(()=>{const r=()=>{var s,a,o,l;if(!e.current||!(((a=(s=e.current).checkVisibility)==null?void 0:a.call(s))??!0))return!1;const i=XA(e.current);(i.height===0||i.width===0)&&((l=(o=n.getState()).onError)==null||l.call(o,"004",el.error004())),n.setState({width:i.width||500,height:i.height||500})};if(e.current){r(),window.addEventListener("resize",r);const i=new ResizeObserver(()=>r());return i.observe(e.current),()=>{window.removeEventListener("resize",r),i&&e.current&&i.unobserve(e.current)}}},[])}const Q0={position:"absolute",width:"100%",height:"100%",top:0,left:0},_xe=e=>({userSelectionActive:e.userSelectionActive,lib:e.lib,connectionInProgress:e.connection.inProgress});function xxe({onPaneContextMenu:e,zoomOnScroll:n=!0,zoomOnPinch:r=!0,panOnScroll:i=!1,panOnScrollSpeed:s=.5,panOnScrollMode:a=Cd.Free,zoomOnDoubleClick:o=!0,panOnDrag:l=!0,defaultViewport:u,translateExtent:d,minZoom:p,maxZoom:f,zoomActivationKeyCode:g,preventScrolling:_=!0,children:x,noWheelClassName:v,noPanClassName:S,onViewportChange:w,isControlledViewport:j,paneClickDistance:C,selectionOnDrag:T}){const E=dr(),A=b.useRef(null),{userSelectionActive:O,lib:F,connectionInProgress:L}=_n(_xe,kr),$=Yg(g),z=b.useRef();yxe(A);const B=b.useCallback(H=>{w==null||w({x:H[0],y:H[1],zoom:H[2]}),j||E.setState({transform:H})},[w,j]);return b.useEffect(()=>{if(A.current){z.current=j_e({domNode:A.current,minZoom:p,maxZoom:f,translateExtent:d,viewport:u,onDraggingChange:I=>E.setState(X=>X.paneDragging===I?X:{paneDragging:I}),onPanZoomStart:(I,X)=>{const{onViewportChangeStart:K,onMoveStart:Q}=E.getState();Q==null||Q(I,X),K==null||K(X)},onPanZoom:(I,X)=>{const{onViewportChange:K,onMove:Q}=E.getState();Q==null||Q(I,X),K==null||K(X)},onPanZoomEnd:(I,X)=>{const{onViewportChangeEnd:K,onMoveEnd:Q}=E.getState();Q==null||Q(I,X),K==null||K(X)}});const{x:H,y:D,zoom:U}=z.current.getViewport();return E.setState({panZoom:z.current,transform:[H,D,U],domNode:A.current.closest(".react-flow")}),()=>{var I;(I=z.current)==null||I.destroy()}}},[]),b.useEffect(()=>{var H;(H=z.current)==null||H.update({onPaneContextMenu:e,zoomOnScroll:n,zoomOnPinch:r,panOnScroll:i,panOnScrollSpeed:s,panOnScrollMode:a,zoomOnDoubleClick:o,panOnDrag:l,zoomActivationKeyPressed:$,preventScrolling:_,noPanClassName:S,userSelectionActive:O,noWheelClassName:v,lib:F,onTransformChange:B,connectionInProgress:L,selectionOnDrag:T,paneClickDistance:C})},[e,n,r,i,s,a,o,l,$,_,S,O,v,F,B,L,T,C]),c.jsx("div",{className:"react-flow__renderer",ref:A,style:Q0,children:x})}const bxe=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function kxe(){const{userSelectionActive:e,userSelectionRect:n}=_n(bxe,kr);return e&&n?c.jsx("div",{className:"react-flow__selection react-flow__container",style:{width:n.width,height:n.height,transform:`translate(${n.x}px, ${n.y}px)`}}):null}const PS=(e,n)=>r=>{r.target===n.current&&(e==null||e(r))},wxe=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,connectionInProgress:e.connection.inProgress,dragging:e.paneDragging});function Sxe({isSelecting:e,selectionKeyPressed:n,selectionMode:r=Ug.Full,panOnDrag:i,paneClickDistance:s,selectionOnDrag:a,onSelectionStart:o,onSelectionEnd:l,onPaneClick:u,onPaneContextMenu:d,onPaneScroll:p,onPaneMouseEnter:f,onPaneMouseMove:g,onPaneMouseLeave:_,children:x}){const v=dr(),{userSelectionActive:S,elementsSelectable:w,dragging:j,connectionInProgress:C}=_n(wxe,kr),T=w&&(e||S),E=b.useRef(null),A=b.useRef(),O=b.useRef(new Set),F=b.useRef(new Set),L=b.useRef(!1),$=K=>{if(L.current||C){L.current=!1;return}u==null||u(K),v.getState().resetSelectedElements(),v.setState({nodesSelectionActive:!1})},z=K=>{if(Array.isArray(i)&&(i!=null&&i.includes(2))){K.preventDefault();return}d==null||d(K)},B=p?K=>p(K):void 0,H=K=>{L.current&&(K.stopPropagation(),L.current=!1)},D=K=>{var J,G;const{domNode:Q}=v.getState();if(A.current=Q==null?void 0:Q.getBoundingClientRect(),!A.current)return;const V=K.target===E.current;if(!V&&!!K.target.closest(".nokey")||!e||!(a&&V||n)||K.button!==0||!K.isPrimary)return;(G=(J=K.target)==null?void 0:J.setPointerCapture)==null||G.call(J,K.pointerId),L.current=!1;const{x:W,y:te}=Qa(K.nativeEvent,A.current);v.setState({userSelectionRect:{width:0,height:0,startX:W,startY:te,x:W,y:te}}),V||(K.stopPropagation(),K.preventDefault())},U=K=>{const{userSelectionRect:Q,transform:V,nodeLookup:R,edgeLookup:q,connectionLookup:W,triggerNodeChanges:te,triggerEdgeChanges:J,defaultEdgeOptions:G,resetSelectedElements:re}=v.getState();if(!A.current||!Q)return;const{x:ne,y:le}=Qa(K.nativeEvent,A.current),{startX:oe,startY:ie}=Q;if(!L.current){const pe=n?0:s;if(Math.hypot(ne-oe,le-ie)<=pe)return;re(),o==null||o(K)}L.current=!0;const he={startX:oe,startY:ie,x:ne<oe?ne:oe,y:le<ie?le:ie,width:Math.abs(ne-oe),height:Math.abs(le-ie)},Z=O.current,de=F.current;O.current=new Set(YA(R,he,V,r===Ug.Partial,!0).map(pe=>pe.id)),F.current=new Set;const ue=(G==null?void 0:G.selectable)??!0;for(const pe of O.current){const Oe=W.get(pe);if(Oe)for(const{edgeId:fe}of Oe.values()){const Le=q.get(fe);Le&&(Le.selectable??ue)&&F.current.add(fe)}}if(!dP(Z,O.current)){const pe=df(R,O.current,!0);te(pe)}if(!dP(de,F.current)){const pe=df(q,F.current);J(pe)}v.setState({userSelectionRect:he,userSelectionActive:!0,nodesSelectionActive:!1})},I=K=>{var Q,V;K.button===0&&((V=(Q=K.target)==null?void 0:Q.releasePointerCapture)==null||V.call(Q,K.pointerId),!S&&K.target===E.current&&v.getState().userSelectionRect&&($==null||$(K)),v.setState({userSelectionActive:!1,userSelectionRect:null}),L.current&&(l==null||l(K),v.setState({nodesSelectionActive:O.current.size>0})))},X=i===!0||Array.isArray(i)&&i.includes(0);return c.jsxs("div",{className:Qr(["react-flow__pane",{draggable:X,dragging:j,selection:e}]),onClick:T?void 0:PS($,E),onContextMenu:PS(z,E),onWheel:PS(B,E),onPointerEnter:T?void 0:f,onPointerMove:T?U:g,onPointerUp:T?I:void 0,onPointerDownCapture:T?D:void 0,onClickCapture:T?H:void 0,onPointerLeave:_,ref:E,style:Q0,children:[x,c.jsx(kxe,{})]})}function Xj({id:e,store:n,unselect:r=!1,nodeRef:i}){const{addSelectedNodes:s,unselectNodesAndEdges:a,multiSelectionActive:o,nodeLookup:l,onError:u}=n.getState(),d=l.get(e);if(!d){u==null||u("012",el.error012(e));return}n.setState({nodesSelectionActive:!1}),d.selected?(r||d.selected&&o)&&(a({nodes:[d],edges:[]}),requestAnimationFrame(()=>{var p;return(p=i==null?void 0:i.current)==null?void 0:p.blur()})):s([e])}function aH({nodeRef:e,disabled:n=!1,noDragClassName:r,handleSelector:i,nodeId:s,isSelectable:a,nodeClickDistance:o}){const l=dr(),[u,d]=b.useState(!1),p=b.useRef();return b.useEffect(()=>{p.current=h_e({getStoreItems:()=>l.getState(),onNodeMouseDown:f=>{Xj({id:f,store:l,nodeRef:e})},onDragStart:()=>{d(!0)},onDragStop:()=>{d(!1)}})},[]),b.useEffect(()=>{if(!(n||!e.current||!p.current))return p.current.update({noDragClassName:r,handleSelector:i,domNode:e.current,isSelectable:a,nodeId:s,nodeClickDistance:o}),()=>{var f;(f=p.current)==null||f.destroy()}},[r,i,n,a,e,s,o]),u}const Cxe=e=>n=>n.selected&&(n.draggable||e&&typeof n.draggable>"u");function oH(){const e=dr();return b.useCallback(r=>{const{nodeExtent:i,snapToGrid:s,snapGrid:a,nodesDraggable:o,onError:l,updateNodePositions:u,nodeLookup:d,nodeOrigin:p}=e.getState(),f=new Map,g=Cxe(o),_=s?a[0]:5,x=s?a[1]:5,v=r.direction.x*_*r.factor,S=r.direction.y*x*r.factor;for(const[,w]of d){if(!g(w))continue;let j={x:w.internals.positionAbsolute.x+v,y:w.internals.positionAbsolute.y+S};s&&(j=Fv(j,a));const{position:C,positionAbsolute:T}=NF({nodeId:w.id,nextPosition:j,nodeLookup:d,nodeExtent:i,nodeOrigin:p,onError:l});w.position=C,w.internals.positionAbsolute=T,f.set(w.id,w)}u(f)},[])}const rT=b.createContext(null),jxe=rT.Provider;rT.Consumer;const lH=()=>b.useContext(rT),Nxe=e=>({connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName,rfId:e.rfId}),Exe=(e,n,r)=>i=>{const{connectionClickStartHandle:s,connectionMode:a,connection:o}=i,{fromHandle:l,toHandle:u,isValid:d}=o,p=(u==null?void 0:u.nodeId)===e&&(u==null?void 0:u.id)===n&&(u==null?void 0:u.type)===r;return{connectingFrom:(l==null?void 0:l.nodeId)===e&&(l==null?void 0:l.id)===n&&(l==null?void 0:l.type)===r,connectingTo:p,clickConnecting:(s==null?void 0:s.nodeId)===e&&(s==null?void 0:s.id)===n&&(s==null?void 0:s.type)===r,isPossibleEndHandle:a===Hf.Strict?(l==null?void 0:l.type)!==r:e!==(l==null?void 0:l.nodeId)||n!==(l==null?void 0:l.id),connectionInProcess:!!l,clickConnectionInProcess:!!s,valid:p&&d}};function Axe({type:e="source",position:n=xt.Top,isValidConnection:r,isConnectable:i=!0,isConnectableStart:s=!0,isConnectableEnd:a=!0,id:o,onConnect:l,children:u,className:d,onMouseDown:p,onTouchStart:f,...g},_){var U,I;const x=o||null,v=e==="target",S=dr(),w=lH(),{connectOnClick:j,noPanClassName:C,rfId:T}=_n(Nxe,kr),{connectingFrom:E,connectingTo:A,clickConnecting:O,isPossibleEndHandle:F,connectionInProcess:L,clickConnectionInProcess:$,valid:z}=_n(Exe(w,x,e),kr);w||(I=(U=S.getState()).onError)==null||I.call(U,"010",el.error010());const B=X=>{const{defaultEdgeOptions:K,onConnect:Q,hasDefaultEdges:V}=S.getState(),R={...K,...X};if(V){const{edges:q,setEdges:W}=S.getState();W(Xye(R,q))}Q==null||Q(R),l==null||l(R)},H=X=>{if(!w)return;const K=PF(X.nativeEvent);if(s&&(K&&X.button===0||!K)){const Q=S.getState();Yj.onPointerDown(X.nativeEvent,{handleDomNode:X.currentTarget,autoPanOnConnect:Q.autoPanOnConnect,connectionMode:Q.connectionMode,connectionRadius:Q.connectionRadius,domNode:Q.domNode,nodeLookup:Q.nodeLookup,lib:Q.lib,isTarget:v,handleId:x,nodeId:w,flowId:Q.rfId,panBy:Q.panBy,cancelConnection:Q.cancelConnection,onConnectStart:Q.onConnectStart,onConnectEnd:(...V)=>{var R,q;return(q=(R=S.getState()).onConnectEnd)==null?void 0:q.call(R,...V)},updateConnection:Q.updateConnection,onConnect:B,isValidConnection:r||((...V)=>{var R,q;return((q=(R=S.getState()).isValidConnection)==null?void 0:q.call(R,...V))??!0}),getTransform:()=>S.getState().transform,getFromHandle:()=>S.getState().connection.fromHandle,autoPanSpeed:Q.autoPanSpeed,dragThreshold:Q.connectionDragThreshold})}K?p==null||p(X):f==null||f(X)},D=X=>{const{onClickConnectStart:K,onClickConnectEnd:Q,connectionClickStartHandle:V,connectionMode:R,isValidConnection:q,lib:W,rfId:te,nodeLookup:J,connection:G}=S.getState();if(!w||!V&&!s)return;if(!V){K==null||K(X.nativeEvent,{nodeId:w,handleId:x,handleType:e}),S.setState({connectionClickStartHandle:{nodeId:w,type:e,id:x}});return}const re=OF(X.target),ne=r||q,{connection:le,isValid:oe}=Yj.isValid(X.nativeEvent,{handle:{nodeId:w,id:x,type:e},connectionMode:R,fromNodeId:V.nodeId,fromHandleId:V.id||null,fromType:V.type,isValidConnection:ne,flowId:te,doc:re,lib:W,nodeLookup:J});oe&&le&&B(le);const ie=structuredClone(G);delete ie.inProgress,ie.toPosition=ie.toHandle?ie.toHandle.position:null,Q==null||Q(X,ie),S.setState({connectionClickStartHandle:null})};return c.jsx("div",{"data-handleid":x,"data-nodeid":w,"data-handlepos":n,"data-id":`${T}-${w}-${x}-${e}`,className:Qr(["react-flow__handle",`react-flow__handle-${n}`,"nodrag",C,d,{source:!v,target:v,connectable:i,connectablestart:s,connectableend:a,clickconnecting:O,connectingfrom:E,connectingto:A,valid:z,connectionindicator:i&&(!L||F)&&(L||$?a:s)}]),onMouseDown:H,onTouchStart:H,onClick:j?D:void 0,ref:_,...g,children:u})}const Ms=b.memo(iH(Axe));function Txe({data:e,isConnectable:n,sourcePosition:r=xt.Bottom}){return c.jsxs(c.Fragment,{children:[e==null?void 0:e.label,c.jsx(Ms,{type:"source",position:r,isConnectable:n})]})}function Mxe({data:e,isConnectable:n,targetPosition:r=xt.Top,sourcePosition:i=xt.Bottom}){return c.jsxs(c.Fragment,{children:[c.jsx(Ms,{type:"target",position:r,isConnectable:n}),e==null?void 0:e.label,c.jsx(Ms,{type:"source",position:i,isConnectable:n})]})}function Rxe(){return null}function Oxe({data:e,isConnectable:n,targetPosition:r=xt.Top}){return c.jsxs(c.Fragment,{children:[c.jsx(Ms,{type:"target",position:r,isConnectable:n}),e==null?void 0:e.label]})}const Tb={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},FP={input:Txe,default:Mxe,output:Oxe,group:Rxe};function Dxe(e){var n,r,i,s;return e.internals.handleBounds===void 0?{width:e.width??e.initialWidth??((n=e.style)==null?void 0:n.width),height:e.height??e.initialHeight??((r=e.style)==null?void 0:r.height)}:{width:e.width??((i=e.style)==null?void 0:i.width),height:e.height??((s=e.style)==null?void 0:s.height)}}const Pxe=e=>{const{width:n,height:r,x:i,y:s}=$v(e.nodeLookup,{filter:a=>!!a.selected});return{width:Xa(n)?n:null,height:Xa(r)?r:null,userSelectionActive:e.userSelectionActive,transformString:`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]}) translate(${i}px,${s}px)`}};function Lxe({onSelectionContextMenu:e,noPanClassName:n,disableKeyboardA11y:r}){const i=dr(),{width:s,height:a,transformString:o,userSelectionActive:l}=_n(Pxe,kr),u=oH(),d=b.useRef(null);b.useEffect(()=>{var _;r||(_=d.current)==null||_.focus({preventScroll:!0})},[r]);const p=!l&&s!==null&&a!==null;if(aH({nodeRef:d,disabled:!p}),!p)return null;const f=e?_=>{const x=i.getState().nodes.filter(v=>v.selected);e(_,x)}:void 0,g=_=>{Object.prototype.hasOwnProperty.call(Tb,_.key)&&(_.preventDefault(),u({direction:Tb[_.key],factor:_.shiftKey?4:1}))};return c.jsx("div",{className:Qr(["react-flow__nodesselection","react-flow__container",n]),style:{transform:o},children:c.jsx("div",{ref:d,className:"react-flow__nodesselection-rect",onContextMenu:f,tabIndex:r?void 0:-1,onKeyDown:r?void 0:g,style:{width:s,height:a}})})}const HP=typeof window<"u"?window:void 0,Ixe=e=>({nodesSelectionActive:e.nodesSelectionActive,userSelectionActive:e.userSelectionActive});function cH({children:e,onPaneClick:n,onPaneMouseEnter:r,onPaneMouseMove:i,onPaneMouseLeave:s,onPaneContextMenu:a,onPaneScroll:o,paneClickDistance:l,deleteKeyCode:u,selectionKeyCode:d,selectionOnDrag:p,selectionMode:f,onSelectionStart:g,onSelectionEnd:_,multiSelectionKeyCode:x,panActivationKeyCode:v,zoomActivationKeyCode:S,elementsSelectable:w,zoomOnScroll:j,zoomOnPinch:C,panOnScroll:T,panOnScrollSpeed:E,panOnScrollMode:A,zoomOnDoubleClick:O,panOnDrag:F,defaultViewport:L,translateExtent:$,minZoom:z,maxZoom:B,preventScrolling:H,onSelectionContextMenu:D,noWheelClassName:U,noPanClassName:I,disableKeyboardA11y:X,onViewportChange:K,isControlledViewport:Q}){const{nodesSelectionActive:V,userSelectionActive:R}=_n(Ixe,kr),q=Yg(d,{target:HP}),W=Yg(v,{target:HP}),te=W||F,J=W||T,G=p&&te!==!0,re=q||R||G;return vxe({deleteKeyCode:u,multiSelectionKeyCode:x}),c.jsx(xxe,{onPaneContextMenu:a,elementsSelectable:w,zoomOnScroll:j,zoomOnPinch:C,panOnScroll:J,panOnScrollSpeed:E,panOnScrollMode:A,zoomOnDoubleClick:O,panOnDrag:!q&&te,defaultViewport:L,translateExtent:$,minZoom:z,maxZoom:B,zoomActivationKeyCode:S,preventScrolling:H,noWheelClassName:U,noPanClassName:I,onViewportChange:K,isControlledViewport:Q,paneClickDistance:l,selectionOnDrag:G,children:c.jsxs(Sxe,{onSelectionStart:g,onSelectionEnd:_,onPaneClick:n,onPaneMouseEnter:r,onPaneMouseMove:i,onPaneMouseLeave:s,onPaneContextMenu:a,onPaneScroll:o,panOnDrag:te,isSelecting:!!re,selectionMode:f,selectionKeyPressed:q,paneClickDistance:l,selectionOnDrag:G,children:[e,V&&c.jsx(Lxe,{onSelectionContextMenu:D,noPanClassName:I,disableKeyboardA11y:X})]})})}cH.displayName="FlowRenderer";const Bxe=b.memo(cH),zxe=e=>n=>e?YA(n.nodeLookup,{x:0,y:0,width:n.width,height:n.height},n.transform,!0).map(r=>r.id):Array.from(n.nodeLookup.keys());function $xe(e){return _n(b.useCallback(zxe(e),[e]),kr)}const Fxe=e=>e.updateNodeInternals;function Hxe(){const e=_n(Fxe),[n]=b.useState(()=>typeof ResizeObserver>"u"?null:new ResizeObserver(r=>{const i=new Map;r.forEach(s=>{const a=s.target.getAttribute("data-id");i.set(a,{id:a,nodeElement:s.target,force:!0})}),e(i)}));return b.useEffect(()=>()=>{n==null||n.disconnect()},[n]),n}function Wxe({node:e,nodeType:n,hasDimensions:r,resizeObserver:i}){const s=dr(),a=b.useRef(null),o=b.useRef(null),l=b.useRef(e.sourcePosition),u=b.useRef(e.targetPosition),d=b.useRef(n),p=r&&!!e.internals.handleBounds;return b.useEffect(()=>{a.current&&!e.hidden&&(!p||o.current!==a.current)&&(o.current&&(i==null||i.unobserve(o.current)),i==null||i.observe(a.current),o.current=a.current)},[p,e.hidden]),b.useEffect(()=>()=>{o.current&&(i==null||i.unobserve(o.current),o.current=null)},[]),b.useEffect(()=>{if(a.current){const f=d.current!==n,g=l.current!==e.sourcePosition,_=u.current!==e.targetPosition;(f||g||_)&&(d.current=n,l.current=e.sourcePosition,u.current=e.targetPosition,s.getState().updateNodeInternals(new Map([[e.id,{id:e.id,nodeElement:a.current,force:!0}]])))}},[e.id,n,e.sourcePosition,e.targetPosition]),a}function qxe({id:e,onClick:n,onMouseEnter:r,onMouseMove:i,onMouseLeave:s,onContextMenu:a,onDoubleClick:o,nodesDraggable:l,elementsSelectable:u,nodesConnectable:d,nodesFocusable:p,resizeObserver:f,noDragClassName:g,noPanClassName:_,disableKeyboardA11y:x,rfId:v,nodeTypes:S,nodeClickDistance:w,onError:j}){const{node:C,internals:T,isParent:E}=_n(ne=>{const le=ne.nodeLookup.get(e),oe=ne.parentLookup.has(e);return{node:le,internals:le.internals,isParent:oe}},kr);let A=C.type||"default",O=(S==null?void 0:S[A])||FP[A];O===void 0&&(j==null||j("003",el.error003(A)),A="default",O=(S==null?void 0:S.default)||FP.default);const F=!!(C.draggable||l&&typeof C.draggable>"u"),L=!!(C.selectable||u&&typeof C.selectable>"u"),$=!!(C.connectable||d&&typeof C.connectable>"u"),z=!!(C.focusable||p&&typeof C.focusable>"u"),B=dr(),H=MF(C),D=Wxe({node:C,nodeType:A,hasDimensions:H,resizeObserver:f}),U=aH({nodeRef:D,disabled:C.hidden||!F,noDragClassName:g,handleSelector:C.dragHandle,nodeId:e,isSelectable:L,nodeClickDistance:w}),I=oH();if(C.hidden)return null;const X=oc(C),K=Dxe(C),Q=L||F||n||r||i||s,V=r?ne=>r(ne,{...T.userNode}):void 0,R=i?ne=>i(ne,{...T.userNode}):void 0,q=s?ne=>s(ne,{...T.userNode}):void 0,W=a?ne=>a(ne,{...T.userNode}):void 0,te=o?ne=>o(ne,{...T.userNode}):void 0,J=ne=>{const{selectNodesOnDrag:le,nodeDragThreshold:oe}=B.getState();L&&(!le||!F||oe>0)&&Xj({id:e,store:B,nodeRef:D}),n&&n(ne,{...T.userNode})},G=ne=>{if(!(DF(ne.nativeEvent)||x)){if(kF.includes(ne.key)&&L){const le=ne.key==="Escape";Xj({id:e,store:B,unselect:le,nodeRef:D})}else if(F&&C.selected&&Object.prototype.hasOwnProperty.call(Tb,ne.key)){ne.preventDefault();const{ariaLabelConfig:le}=B.getState();B.setState({ariaLiveMessage:le["node.a11yDescription.ariaLiveMessage"]({direction:ne.key.replace("Arrow","").toLowerCase(),x:~~T.positionAbsolute.x,y:~~T.positionAbsolute.y})}),I({direction:Tb[ne.key],factor:ne.shiftKey?4:1})}}},re=()=>{var de;if(x||!((de=D.current)!=null&&de.matches(":focus-visible")))return;const{transform:ne,width:le,height:oe,autoPanOnNodeFocus:ie,setCenter:he}=B.getState();if(!ie)return;YA(new Map([[e,C]]),{x:0,y:0,width:le,height:oe},ne,!0).length>0||he(C.position.x+X.width/2,C.position.y+X.height/2,{zoom:ne[2]})};return c.jsx("div",{className:Qr(["react-flow__node",`react-flow__node-${A}`,{[_]:F},C.className,{selected:C.selected,selectable:L,parent:E,draggable:F,dragging:U}]),ref:D,style:{zIndex:T.z,transform:`translate(${T.positionAbsolute.x}px,${T.positionAbsolute.y}px)`,pointerEvents:Q?"all":"none",visibility:H?"visible":"hidden",...C.style,...K},"data-id":e,"data-testid":`rf__node-${e}`,onMouseEnter:V,onMouseMove:R,onMouseLeave:q,onContextMenu:W,onClick:J,onDoubleClick:te,onKeyDown:z?G:void 0,tabIndex:z?0:void 0,onFocus:z?re:void 0,role:C.ariaRole??(z?"group":void 0),"aria-roledescription":"node","aria-describedby":x?void 0:`${ZF}-${v}`,"aria-label":C.ariaLabel,...C.domAttributes,children:c.jsx(jxe,{value:e,children:c.jsx(O,{id:e,data:C.data,type:A,positionAbsoluteX:T.positionAbsolute.x,positionAbsoluteY:T.positionAbsolute.y,selected:C.selected??!1,selectable:L,draggable:F,deletable:C.deletable??!0,isConnectable:$,sourcePosition:C.sourcePosition,targetPosition:C.targetPosition,dragging:U,dragHandle:C.dragHandle,zIndex:T.z,parentId:C.parentId,...X})})})}var Uxe=b.memo(qxe);const Kxe=e=>({nodesDraggable:e.nodesDraggable,nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,onError:e.onError});function uH(e){const{nodesDraggable:n,nodesConnectable:r,nodesFocusable:i,elementsSelectable:s,onError:a}=_n(Kxe,kr),o=$xe(e.onlyRenderVisibleElements),l=Hxe();return c.jsx("div",{className:"react-flow__nodes",style:Q0,children:o.map(u=>c.jsx(Uxe,{id:u,nodeTypes:e.nodeTypes,nodeExtent:e.nodeExtent,onClick:e.onNodeClick,onMouseEnter:e.onNodeMouseEnter,onMouseMove:e.onNodeMouseMove,onMouseLeave:e.onNodeMouseLeave,onContextMenu:e.onNodeContextMenu,onDoubleClick:e.onNodeDoubleClick,noDragClassName:e.noDragClassName,noPanClassName:e.noPanClassName,rfId:e.rfId,disableKeyboardA11y:e.disableKeyboardA11y,resizeObserver:l,nodesDraggable:n,nodesConnectable:r,nodesFocusable:i,elementsSelectable:s,nodeClickDistance:e.nodeClickDistance,onError:a},u))})}uH.displayName="NodeRenderer";const Vxe=b.memo(uH);function Yxe(e){return _n(b.useCallback(r=>{if(!e)return r.edges.map(s=>s.id);const i=[];if(r.width&&r.height)for(const s of r.edges){const a=r.nodeLookup.get(s.source),o=r.nodeLookup.get(s.target);a&&o&&Vye({sourceNode:a,targetNode:o,width:r.width,height:r.height,transform:r.transform})&&i.push(s.id)}return i},[e]),kr)}const Gxe=({color:e="none",strokeWidth:n=1})=>{const r={strokeWidth:n,...e&&{stroke:e}};return c.jsx("polyline",{className:"arrow",style:r,strokeLinecap:"round",fill:"none",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4"})},Xxe=({color:e="none",strokeWidth:n=1})=>{const r={strokeWidth:n,...e&&{stroke:e,fill:e}};return c.jsx("polyline",{className:"arrowclosed",style:r,strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"})},WP={[qa.Arrow]:Gxe,[qa.ArrowClosed]:Xxe};function Qxe(e){const n=dr();return b.useMemo(()=>{var s,a;return Object.prototype.hasOwnProperty.call(WP,e)?WP[e]:((a=(s=n.getState()).onError)==null||a.call(s,"009",el.error009(e)),null)},[e])}const Zxe=({id:e,type:n,color:r,width:i=12.5,height:s=12.5,markerUnits:a="strokeWidth",strokeWidth:o,orient:l="auto-start-reverse"})=>{const u=Qxe(n);return u?c.jsx("marker",{className:"react-flow__arrowhead",id:e,markerWidth:`${i}`,markerHeight:`${s}`,viewBox:"-10 -10 20 20",markerUnits:a,orient:l,refX:"0",refY:"0",children:c.jsx(u,{color:r,strokeWidth:o})}):null},dH=({defaultColor:e,rfId:n})=>{const r=_n(a=>a.edges),i=_n(a=>a.defaultEdgeOptions),s=b.useMemo(()=>t_e(r,{id:n,defaultColor:e,defaultMarkerStart:i==null?void 0:i.markerStart,defaultMarkerEnd:i==null?void 0:i.markerEnd}),[r,i,n,e]);return s.length?c.jsx("svg",{className:"react-flow__marker","aria-hidden":"true",children:c.jsx("defs",{children:s.map(a=>c.jsx(Zxe,{id:a.id,type:a.type,color:a.color,width:a.width,height:a.height,markerUnits:a.markerUnits,strokeWidth:a.strokeWidth,orient:a.orient},a.id))})}):null};dH.displayName="MarkerDefinitions";var Jxe=b.memo(dH);function hH({x:e,y:n,label:r,labelStyle:i,labelShowBg:s=!0,labelBgStyle:a,labelBgPadding:o=[2,4],labelBgBorderRadius:l=2,children:u,className:d,...p}){const[f,g]=b.useState({x:1,y:0,width:0,height:0}),_=Qr(["react-flow__edge-textwrapper",d]),x=b.useRef(null);return b.useEffect(()=>{if(x.current){const v=x.current.getBBox();g({x:v.x,y:v.y,width:v.width,height:v.height})}},[r]),r?c.jsxs("g",{transform:`translate(${e-f.width/2} ${n-f.height/2})`,className:_,visibility:f.width?"visible":"hidden",...p,children:[s&&c.jsx("rect",{width:f.width+2*o[0],x:-o[0],y:-o[1],height:f.height+2*o[1],className:"react-flow__edge-textbg",style:a,rx:l,ry:l}),c.jsx("text",{className:"react-flow__edge-text",y:f.height/2,dy:"0.3em",ref:x,style:i,children:r}),u]}):null}hH.displayName="EdgeText";const ebe=b.memo(hH);function Vf({path:e,labelX:n,labelY:r,label:i,labelStyle:s,labelShowBg:a,labelBgStyle:o,labelBgPadding:l,labelBgBorderRadius:u,interactionWidth:d=20,...p}){return c.jsxs(c.Fragment,{children:[c.jsx("path",{...p,d:e,fill:"none",className:Qr(["react-flow__edge-path",p.className])}),d?c.jsx("path",{d:e,fill:"none",strokeOpacity:0,strokeWidth:d,className:"react-flow__edge-interaction"}):null,i&&Xa(n)&&Xa(r)?c.jsx(ebe,{x:n,y:r,label:i,labelStyle:s,labelShowBg:a,labelBgStyle:o,labelBgPadding:l,labelBgBorderRadius:u}):null]})}function qP({pos:e,x1:n,y1:r,x2:i,y2:s}){return e===xt.Left||e===xt.Right?[.5*(n+i),r]:[n,.5*(r+s)]}function fH({sourceX:e,sourceY:n,sourcePosition:r=xt.Bottom,targetX:i,targetY:s,targetPosition:a=xt.Top}){const[o,l]=qP({pos:r,x1:e,y1:n,x2:i,y2:s}),[u,d]=qP({pos:a,x1:i,y1:s,x2:e,y2:n}),[p,f,g,_]=LF({sourceX:e,sourceY:n,targetX:i,targetY:s,sourceControlX:o,sourceControlY:l,targetControlX:u,targetControlY:d});return[`M${e},${n} C${o},${l} ${u},${d} ${i},${s}`,p,f,g,_]}function pH(e){return b.memo(({id:n,sourceX:r,sourceY:i,targetX:s,targetY:a,sourcePosition:o,targetPosition:l,label:u,labelStyle:d,labelShowBg:p,labelBgStyle:f,labelBgPadding:g,labelBgBorderRadius:_,style:x,markerEnd:v,markerStart:S,interactionWidth:w})=>{const[j,C,T]=fH({sourceX:r,sourceY:i,sourcePosition:o,targetX:s,targetY:a,targetPosition:l}),E=e.isInternal?void 0:n;return c.jsx(Vf,{id:E,path:j,labelX:C,labelY:T,label:u,labelStyle:d,labelShowBg:p,labelBgStyle:f,labelBgPadding:g,labelBgBorderRadius:_,style:x,markerEnd:v,markerStart:S,interactionWidth:w})})}const tbe=pH({isInternal:!1}),mH=pH({isInternal:!0});tbe.displayName="SimpleBezierEdge";mH.displayName="SimpleBezierEdgeInternal";function gH(e){return b.memo(({id:n,sourceX:r,sourceY:i,targetX:s,targetY:a,label:o,labelStyle:l,labelShowBg:u,labelBgStyle:d,labelBgPadding:p,labelBgBorderRadius:f,style:g,sourcePosition:_=xt.Bottom,targetPosition:x=xt.Top,markerEnd:v,markerStart:S,pathOptions:w,interactionWidth:j})=>{const[C,T,E]=Uj({sourceX:r,sourceY:i,sourcePosition:_,targetX:s,targetY:a,targetPosition:x,borderRadius:w==null?void 0:w.borderRadius,offset:w==null?void 0:w.offset,stepPosition:w==null?void 0:w.stepPosition}),A=e.isInternal?void 0:n;return c.jsx(Vf,{id:A,path:C,labelX:T,labelY:E,label:o,labelStyle:l,labelShowBg:u,labelBgStyle:d,labelBgPadding:p,labelBgBorderRadius:f,style:g,markerEnd:v,markerStart:S,interactionWidth:j})})}const vH=gH({isInternal:!1}),yH=gH({isInternal:!0});vH.displayName="SmoothStepEdge";yH.displayName="SmoothStepEdgeInternal";function _H(e){return b.memo(({id:n,...r})=>{var s;const i=e.isInternal?void 0:n;return c.jsx(vH,{...r,id:i,pathOptions:b.useMemo(()=>{var a;return{borderRadius:0,offset:(a=r.pathOptions)==null?void 0:a.offset}},[(s=r.pathOptions)==null?void 0:s.offset])})})}const nbe=_H({isInternal:!1}),xH=_H({isInternal:!0});nbe.displayName="StepEdge";xH.displayName="StepEdgeInternal";function bH(e){return b.memo(({id:n,sourceX:r,sourceY:i,targetX:s,targetY:a,label:o,labelStyle:l,labelShowBg:u,labelBgStyle:d,labelBgPadding:p,labelBgBorderRadius:f,style:g,markerEnd:_,markerStart:x,interactionWidth:v})=>{const[S,w,j]=BF({sourceX:r,sourceY:i,targetX:s,targetY:a}),C=e.isInternal?void 0:n;return c.jsx(Vf,{id:C,path:S,labelX:w,labelY:j,label:o,labelStyle:l,labelShowBg:u,labelBgStyle:d,labelBgPadding:p,labelBgBorderRadius:f,style:g,markerEnd:_,markerStart:x,interactionWidth:v})})}const rbe=bH({isInternal:!1}),kH=bH({isInternal:!0});rbe.displayName="StraightEdge";kH.displayName="StraightEdgeInternal";function wH(e){return b.memo(({id:n,sourceX:r,sourceY:i,targetX:s,targetY:a,sourcePosition:o=xt.Bottom,targetPosition:l=xt.Top,label:u,labelStyle:d,labelShowBg:p,labelBgStyle:f,labelBgPadding:g,labelBgBorderRadius:_,style:x,markerEnd:v,markerStart:S,pathOptions:w,interactionWidth:j})=>{const[C,T,E]=QA({sourceX:r,sourceY:i,sourcePosition:o,targetX:s,targetY:a,targetPosition:l,curvature:w==null?void 0:w.curvature}),A=e.isInternal?void 0:n;return c.jsx(Vf,{id:A,path:C,labelX:T,labelY:E,label:u,labelStyle:d,labelShowBg:p,labelBgStyle:f,labelBgPadding:g,labelBgBorderRadius:_,style:x,markerEnd:v,markerStart:S,interactionWidth:j})})}const ibe=wH({isInternal:!1}),SH=wH({isInternal:!0});ibe.displayName="BezierEdge";SH.displayName="BezierEdgeInternal";const UP={default:SH,straight:kH,step:xH,smoothstep:yH,simplebezier:mH},KP={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null},sbe=(e,n,r)=>r===xt.Left?e-n:r===xt.Right?e+n:e,abe=(e,n,r)=>r===xt.Top?e-n:r===xt.Bottom?e+n:e,VP="react-flow__edgeupdater";function YP({position:e,centerX:n,centerY:r,radius:i=10,onMouseDown:s,onMouseEnter:a,onMouseOut:o,type:l}){return c.jsx("circle",{onMouseDown:s,onMouseEnter:a,onMouseOut:o,className:Qr([VP,`${VP}-${l}`]),cx:sbe(n,i,e),cy:abe(r,i,e),r:i,stroke:"transparent",fill:"transparent"})}function obe({isReconnectable:e,reconnectRadius:n,edge:r,sourceX:i,sourceY:s,targetX:a,targetY:o,sourcePosition:l,targetPosition:u,onReconnect:d,onReconnectStart:p,onReconnectEnd:f,setReconnecting:g,setUpdateHover:_}){const x=dr(),v=(T,E)=>{if(T.button!==0)return;const{autoPanOnConnect:A,domNode:O,connectionMode:F,connectionRadius:L,lib:$,onConnectStart:z,cancelConnection:B,nodeLookup:H,rfId:D,panBy:U,updateConnection:I}=x.getState(),X=E.type==="target",K=(R,q)=>{g(!1),f==null||f(R,r,E.type,q)},Q=R=>d==null?void 0:d(r,R),V=(R,q)=>{g(!0),p==null||p(T,r,E.type),z==null||z(R,q)};Yj.onPointerDown(T.nativeEvent,{autoPanOnConnect:A,connectionMode:F,connectionRadius:L,domNode:O,handleId:E.id,nodeId:E.nodeId,nodeLookup:H,isTarget:X,edgeUpdaterType:E.type,lib:$,flowId:D,cancelConnection:B,panBy:U,isValidConnection:(...R)=>{var q,W;return((W=(q=x.getState()).isValidConnection)==null?void 0:W.call(q,...R))??!0},onConnect:Q,onConnectStart:V,onConnectEnd:(...R)=>{var q,W;return(W=(q=x.getState()).onConnectEnd)==null?void 0:W.call(q,...R)},onReconnectEnd:K,updateConnection:I,getTransform:()=>x.getState().transform,getFromHandle:()=>x.getState().connection.fromHandle,dragThreshold:x.getState().connectionDragThreshold,handleDomNode:T.currentTarget})},S=T=>v(T,{nodeId:r.target,id:r.targetHandle??null,type:"target"}),w=T=>v(T,{nodeId:r.source,id:r.sourceHandle??null,type:"source"}),j=()=>_(!0),C=()=>_(!1);return c.jsxs(c.Fragment,{children:[(e===!0||e==="source")&&c.jsx(YP,{position:l,centerX:i,centerY:s,radius:n,onMouseDown:S,onMouseEnter:j,onMouseOut:C,type:"source"}),(e===!0||e==="target")&&c.jsx(YP,{position:u,centerX:a,centerY:o,radius:n,onMouseDown:w,onMouseEnter:j,onMouseOut:C,type:"target"})]})}function lbe({id:e,edgesFocusable:n,edgesReconnectable:r,elementsSelectable:i,onClick:s,onDoubleClick:a,onContextMenu:o,onMouseEnter:l,onMouseMove:u,onMouseLeave:d,reconnectRadius:p,onReconnect:f,onReconnectStart:g,onReconnectEnd:_,rfId:x,edgeTypes:v,noPanClassName:S,onError:w,disableKeyboardA11y:j}){let C=_n(he=>he.edgeLookup.get(e));const T=_n(he=>he.defaultEdgeOptions);C=T?{...T,...C}:C;let E=C.type||"default",A=(v==null?void 0:v[E])||UP[E];A===void 0&&(w==null||w("011",el.error011(E)),E="default",A=(v==null?void 0:v.default)||UP.default);const O=!!(C.focusable||n&&typeof C.focusable>"u"),F=typeof f<"u"&&(C.reconnectable||r&&typeof C.reconnectable>"u"),L=!!(C.selectable||i&&typeof C.selectable>"u"),$=b.useRef(null),[z,B]=b.useState(!1),[H,D]=b.useState(!1),U=dr(),{zIndex:I,sourceX:X,sourceY:K,targetX:Q,targetY:V,sourcePosition:R,targetPosition:q}=_n(b.useCallback(he=>{const Z=he.nodeLookup.get(C.source),de=he.nodeLookup.get(C.target);if(!Z||!de)return{zIndex:C.zIndex,...KP};const ue=e_e({id:e,sourceNode:Z,targetNode:de,sourceHandle:C.sourceHandle||null,targetHandle:C.targetHandle||null,connectionMode:he.connectionMode,onError:w});return{zIndex:Kye({selected:C.selected,zIndex:C.zIndex,sourceNode:Z,targetNode:de,elevateOnSelect:he.elevateEdgesOnSelect,zIndexMode:he.zIndexMode}),...ue||KP}},[C.source,C.target,C.sourceHandle,C.targetHandle,C.selected,C.zIndex]),kr),W=b.useMemo(()=>C.markerStart?`url('#${Kj(C.markerStart,x)}')`:void 0,[C.markerStart,x]),te=b.useMemo(()=>C.markerEnd?`url('#${Kj(C.markerEnd,x)}')`:void 0,[C.markerEnd,x]);if(C.hidden||X===null||K===null||Q===null||V===null)return null;const J=he=>{var pe;const{addSelectedEdges:Z,unselectNodesAndEdges:de,multiSelectionActive:ue}=U.getState();L&&(U.setState({nodesSelectionActive:!1}),C.selected&&ue?(de({nodes:[],edges:[C]}),(pe=$.current)==null||pe.blur()):Z([e])),s&&s(he,C)},G=a?he=>{a(he,{...C})}:void 0,re=o?he=>{o(he,{...C})}:void 0,ne=l?he=>{l(he,{...C})}:void 0,le=u?he=>{u(he,{...C})}:void 0,oe=d?he=>{d(he,{...C})}:void 0,ie=he=>{var Z;if(!j&&kF.includes(he.key)&&L){const{unselectNodesAndEdges:de,addSelectedEdges:ue}=U.getState();he.key==="Escape"?((Z=$.current)==null||Z.blur(),de({edges:[C]})):ue([e])}};return c.jsx("svg",{style:{zIndex:I},children:c.jsxs("g",{className:Qr(["react-flow__edge",`react-flow__edge-${E}`,C.className,S,{selected:C.selected,animated:C.animated,inactive:!L&&!s,updating:z,selectable:L}]),onClick:J,onDoubleClick:G,onContextMenu:re,onMouseEnter:ne,onMouseMove:le,onMouseLeave:oe,onKeyDown:O?ie:void 0,tabIndex:O?0:void 0,role:C.ariaRole??(O?"group":"img"),"aria-roledescription":"edge","data-id":e,"data-testid":`rf__edge-${e}`,"aria-label":C.ariaLabel===null?void 0:C.ariaLabel||`Edge from ${C.source} to ${C.target}`,"aria-describedby":O?`${JF}-${x}`:void 0,ref:$,...C.domAttributes,children:[!H&&c.jsx(A,{id:e,source:C.source,target:C.target,type:C.type,selected:C.selected,animated:C.animated,selectable:L,deletable:C.deletable??!0,label:C.label,labelStyle:C.labelStyle,labelShowBg:C.labelShowBg,labelBgStyle:C.labelBgStyle,labelBgPadding:C.labelBgPadding,labelBgBorderRadius:C.labelBgBorderRadius,sourceX:X,sourceY:K,targetX:Q,targetY:V,sourcePosition:R,targetPosition:q,data:C.data,style:C.style,sourceHandleId:C.sourceHandle,targetHandleId:C.targetHandle,markerStart:W,markerEnd:te,pathOptions:"pathOptions"in C?C.pathOptions:void 0,interactionWidth:C.interactionWidth}),F&&c.jsx(obe,{edge:C,isReconnectable:F,reconnectRadius:p,onReconnect:f,onReconnectStart:g,onReconnectEnd:_,sourceX:X,sourceY:K,targetX:Q,targetY:V,sourcePosition:R,targetPosition:q,setUpdateHover:B,setReconnecting:D})]})})}var cbe=b.memo(lbe);const ube=e=>({edgesFocusable:e.edgesFocusable,edgesReconnectable:e.edgesReconnectable,elementsSelectable:e.elementsSelectable,connectionMode:e.connectionMode,onError:e.onError});function CH({defaultMarkerColor:e,onlyRenderVisibleElements:n,rfId:r,edgeTypes:i,noPanClassName:s,onReconnect:a,onEdgeContextMenu:o,onEdgeMouseEnter:l,onEdgeMouseMove:u,onEdgeMouseLeave:d,onEdgeClick:p,reconnectRadius:f,onEdgeDoubleClick:g,onReconnectStart:_,onReconnectEnd:x,disableKeyboardA11y:v}){const{edgesFocusable:S,edgesReconnectable:w,elementsSelectable:j,onError:C}=_n(ube,kr),T=Yxe(n);return c.jsxs("div",{className:"react-flow__edges",children:[c.jsx(Jxe,{defaultColor:e,rfId:r}),T.map(E=>c.jsx(cbe,{id:E,edgesFocusable:S,edgesReconnectable:w,elementsSelectable:j,noPanClassName:s,onReconnect:a,onContextMenu:o,onMouseEnter:l,onMouseMove:u,onMouseLeave:d,onClick:p,reconnectRadius:f,onDoubleClick:g,onReconnectStart:_,onReconnectEnd:x,rfId:r,onError:C,edgeTypes:i,disableKeyboardA11y:v},E))]})}CH.displayName="EdgeRenderer";const dbe=b.memo(CH),hbe=e=>`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`;function fbe({children:e}){const n=_n(hbe);return c.jsx("div",{className:"react-flow__viewport xyflow__viewport react-flow__container",style:{transform:n},children:e})}function pbe(e){const n=X0(),r=b.useRef(!1);b.useEffect(()=>{!r.current&&n.viewportInitialized&&e&&(setTimeout(()=>e(n),1),r.current=!0)},[e,n.viewportInitialized])}const mbe=e=>{var n;return(n=e.panZoom)==null?void 0:n.syncViewport};function gbe(e){const n=_n(mbe),r=dr();return b.useEffect(()=>{e&&(n==null||n(e),r.setState({transform:[e.x,e.y,e.zoom]}))},[e,n]),null}function vbe(e){return e.connection.inProgress?{...e.connection,to:Hv(e.connection.to,e.transform)}:{...e.connection}}function ybe(e){return vbe}function _be(e){const n=ybe();return _n(n,kr)}const xbe=e=>({nodesConnectable:e.nodesConnectable,isValid:e.connection.isValid,inProgress:e.connection.inProgress,width:e.width,height:e.height});function bbe({containerStyle:e,style:n,type:r,component:i}){const{nodesConnectable:s,width:a,height:o,isValid:l,inProgress:u}=_n(xbe,kr);return!(a&&s&&u)?null:c.jsx("svg",{style:e,width:a,height:o,className:"react-flow__connectionline react-flow__container",children:c.jsx("g",{className:Qr(["react-flow__connection",CF(l)]),children:c.jsx(jH,{style:n,type:r,CustomComponent:i,isValid:l})})})}const jH=({style:e,type:n=Va.Bezier,CustomComponent:r,isValid:i})=>{const{inProgress:s,from:a,fromNode:o,fromHandle:l,fromPosition:u,to:d,toNode:p,toHandle:f,toPosition:g,pointer:_}=_be();if(!s)return;if(r)return c.jsx(r,{connectionLineType:n,connectionLineStyle:e,fromNode:o,fromHandle:l,fromX:a.x,fromY:a.y,toX:d.x,toY:d.y,fromPosition:u,toPosition:g,connectionStatus:CF(i),toNode:p,toHandle:f,pointer:_});let x="";const v={sourceX:a.x,sourceY:a.y,sourcePosition:u,targetX:d.x,targetY:d.y,targetPosition:g};switch(n){case Va.Bezier:[x]=QA(v);break;case Va.SimpleBezier:[x]=fH(v);break;case Va.Step:[x]=Uj({...v,borderRadius:0});break;case Va.SmoothStep:[x]=Uj(v);break;default:[x]=BF(v)}return c.jsx("path",{d:x,fill:"none",className:"react-flow__connection-path",style:e})};jH.displayName="ConnectionLine";const kbe={};function GP(e=kbe){b.useRef(e),dr(),b.useEffect(()=>{},[e])}function wbe(){dr(),b.useRef(!1),b.useEffect(()=>{},[])}function NH({nodeTypes:e,edgeTypes:n,onInit:r,onNodeClick:i,onEdgeClick:s,onNodeDoubleClick:a,onEdgeDoubleClick:o,onNodeMouseEnter:l,onNodeMouseMove:u,onNodeMouseLeave:d,onNodeContextMenu:p,onSelectionContextMenu:f,onSelectionStart:g,onSelectionEnd:_,connectionLineType:x,connectionLineStyle:v,connectionLineComponent:S,connectionLineContainerStyle:w,selectionKeyCode:j,selectionOnDrag:C,selectionMode:T,multiSelectionKeyCode:E,panActivationKeyCode:A,zoomActivationKeyCode:O,deleteKeyCode:F,onlyRenderVisibleElements:L,elementsSelectable:$,defaultViewport:z,translateExtent:B,minZoom:H,maxZoom:D,preventScrolling:U,defaultMarkerColor:I,zoomOnScroll:X,zoomOnPinch:K,panOnScroll:Q,panOnScrollSpeed:V,panOnScrollMode:R,zoomOnDoubleClick:q,panOnDrag:W,onPaneClick:te,onPaneMouseEnter:J,onPaneMouseMove:G,onPaneMouseLeave:re,onPaneScroll:ne,onPaneContextMenu:le,paneClickDistance:oe,nodeClickDistance:ie,onEdgeContextMenu:he,onEdgeMouseEnter:Z,onEdgeMouseMove:de,onEdgeMouseLeave:ue,reconnectRadius:pe,onReconnect:Oe,onReconnectStart:fe,onReconnectEnd:Le,noDragClassName:Ee,noWheelClassName:Bt,noPanClassName:Xe,disableKeyboardA11y:St,nodeExtent:yt,rfId:Rt,viewport:be,onViewportChange:He}){return GP(e),GP(n),wbe(),pbe(r),gbe(be),c.jsx(Bxe,{onPaneClick:te,onPaneMouseEnter:J,onPaneMouseMove:G,onPaneMouseLeave:re,onPaneContextMenu:le,onPaneScroll:ne,paneClickDistance:oe,deleteKeyCode:F,selectionKeyCode:j,selectionOnDrag:C,selectionMode:T,onSelectionStart:g,onSelectionEnd:_,multiSelectionKeyCode:E,panActivationKeyCode:A,zoomActivationKeyCode:O,elementsSelectable:$,zoomOnScroll:X,zoomOnPinch:K,zoomOnDoubleClick:q,panOnScroll:Q,panOnScrollSpeed:V,panOnScrollMode:R,panOnDrag:W,defaultViewport:z,translateExtent:B,minZoom:H,maxZoom:D,onSelectionContextMenu:f,preventScrolling:U,noDragClassName:Ee,noWheelClassName:Bt,noPanClassName:Xe,disableKeyboardA11y:St,onViewportChange:He,isControlledViewport:!!be,children:c.jsxs(fbe,{children:[c.jsx(dbe,{edgeTypes:n,onEdgeClick:s,onEdgeDoubleClick:o,onReconnect:Oe,onReconnectStart:fe,onReconnectEnd:Le,onlyRenderVisibleElements:L,onEdgeContextMenu:he,onEdgeMouseEnter:Z,onEdgeMouseMove:de,onEdgeMouseLeave:ue,reconnectRadius:pe,defaultMarkerColor:I,noPanClassName:Xe,disableKeyboardA11y:St,rfId:Rt}),c.jsx(bbe,{style:v,type:x,component:S,containerStyle:w}),c.jsx("div",{className:"react-flow__edgelabel-renderer"}),c.jsx(Vxe,{nodeTypes:e,onNodeClick:i,onNodeDoubleClick:a,onNodeMouseEnter:l,onNodeMouseMove:u,onNodeMouseLeave:d,onNodeContextMenu:p,nodeClickDistance:ie,onlyRenderVisibleElements:L,noPanClassName:Xe,noDragClassName:Ee,disableKeyboardA11y:St,nodeExtent:yt,rfId:Rt}),c.jsx("div",{className:"react-flow__viewport-portal"})]})})}NH.displayName="GraphView";const Sbe=b.memo(NH),XP=({nodes:e,edges:n,defaultNodes:r,defaultEdges:i,width:s,height:a,fitView:o,fitViewOptions:l,minZoom:u=.5,maxZoom:d=2,nodeOrigin:p,nodeExtent:f,zIndexMode:g="basic"}={})=>{const _=new Map,x=new Map,v=new Map,S=new Map,w=i??n??[],j=r??e??[],C=p??[0,0],T=f??qg;FF(v,S,w);const{nodesInitialized:E}=Vj(j,_,x,{nodeOrigin:C,nodeExtent:T,zIndexMode:g});let A=[0,0,1];if(o&&s&&a){const O=$v(_,{filter:z=>!!((z.width||z.initialWidth)&&(z.height||z.initialHeight))}),{x:F,y:L,zoom:$}=GA(O,s,a,u,d,(l==null?void 0:l.padding)??.1);A=[F,L,$]}return{rfId:"1",width:s??0,height:a??0,transform:A,nodes:j,nodesInitialized:E,nodeLookup:_,parentLookup:x,edges:w,edgeLookup:S,connectionLookup:v,onNodesChange:null,onEdgesChange:null,hasDefaultNodes:r!==void 0,hasDefaultEdges:i!==void 0,panZoom:null,minZoom:u,maxZoom:d,translateExtent:qg,nodeExtent:T,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionMode:Hf.Strict,domNode:null,paneDragging:!1,noPanClassName:"nopan",nodeOrigin:C,nodeDragThreshold:1,connectionDragThreshold:1,snapGrid:[15,15],snapToGrid:!1,nodesDraggable:!0,nodesConnectable:!0,nodesFocusable:!0,edgesFocusable:!0,edgesReconnectable:!0,elementsSelectable:!0,elevateNodesOnSelect:!0,elevateEdgesOnSelect:!0,selectNodesOnDrag:!0,multiSelectionActive:!1,fitViewQueued:o??!1,fitViewOptions:l,fitViewResolver:null,connection:{...SF},connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,autoPanOnNodeFocus:!0,autoPanSpeed:15,connectionRadius:20,onError:$ye,isValidConnection:void 0,onSelectionChangeHandlers:[],lib:"react",debug:!1,ariaLabelConfig:wF,zIndexMode:g,onNodesChangeMiddlewareMap:new Map,onEdgesChangeMiddlewareMap:new Map}},Cbe=({nodes:e,edges:n,defaultNodes:r,defaultEdges:i,width:s,height:a,fitView:o,fitViewOptions:l,minZoom:u,maxZoom:d,nodeOrigin:p,nodeExtent:f,zIndexMode:g})=>q_e((_,x)=>{async function v(){const{nodeLookup:S,panZoom:w,fitViewOptions:j,fitViewResolver:C,width:T,height:E,minZoom:A,maxZoom:O}=x();w&&(await Bye({nodes:S,width:T,height:E,panZoom:w,minZoom:A,maxZoom:O},j),C==null||C.resolve(!0),_({fitViewResolver:null}))}return{...XP({nodes:e,edges:n,width:s,height:a,fitView:o,fitViewOptions:l,minZoom:u,maxZoom:d,nodeOrigin:p,nodeExtent:f,defaultNodes:r,defaultEdges:i,zIndexMode:g}),setNodes:S=>{const{nodeLookup:w,parentLookup:j,nodeOrigin:C,elevateNodesOnSelect:T,fitViewQueued:E,zIndexMode:A,nodesSelectionActive:O}=x(),{nodesInitialized:F,hasSelectedNodes:L}=Vj(S,w,j,{nodeOrigin:C,nodeExtent:f,elevateNodesOnSelect:T,checkEquality:!0,zIndexMode:A}),$=O&&L;E&&F?(v(),_({nodes:S,nodesInitialized:F,fitViewQueued:!1,fitViewOptions:void 0,nodesSelectionActive:$})):_({nodes:S,nodesInitialized:F,nodesSelectionActive:$})},setEdges:S=>{const{connectionLookup:w,edgeLookup:j}=x();FF(w,j,S),_({edges:S})},setDefaultNodesAndEdges:(S,w)=>{if(S){const{setNodes:j}=x();j(S),_({hasDefaultNodes:!0})}if(w){const{setEdges:j}=x();j(w),_({hasDefaultEdges:!0})}},updateNodeInternals:S=>{const{triggerNodeChanges:w,nodeLookup:j,parentLookup:C,domNode:T,nodeOrigin:E,nodeExtent:A,debug:O,fitViewQueued:F,zIndexMode:L}=x(),{changes:$,updatedInternals:z}=l_e(S,j,C,T,E,A,L);z&&(i_e(j,C,{nodeOrigin:E,nodeExtent:A,zIndexMode:L}),F?(v(),_({fitViewQueued:!1,fitViewOptions:void 0})):_({}),($==null?void 0:$.length)>0&&(O&&console.log("React Flow: trigger node changes",$),w==null||w($)))},updateNodePositions:(S,w=!1)=>{const j=[];let C=[];const{nodeLookup:T,triggerNodeChanges:E,connection:A,updateConnection:O,onNodesChangeMiddlewareMap:F}=x();for(const[L,$]of S){const z=T.get(L),B=!!(z!=null&&z.expandParent&&(z!=null&&z.parentId)&&($!=null&&$.position)),H={id:L,type:"position",position:B?{x:Math.max(0,$.position.x),y:Math.max(0,$.position.y)}:$.position,dragging:w};if(z&&A.inProgress&&A.fromNode.id===z.id){const D=Id(z,A.fromHandle,xt.Left,!0);O({...A,from:D})}B&&z.parentId&&j.push({id:L,parentId:z.parentId,rect:{...$.internals.positionAbsolute,width:$.measured.width??0,height:$.measured.height??0}}),C.push(H)}if(j.length>0){const{parentLookup:L,nodeOrigin:$}=x(),z=nT(j,T,L,$);C.push(...z)}for(const L of F.values())C=L(C);E(C)},triggerNodeChanges:S=>{const{onNodesChange:w,setNodes:j,nodes:C,hasDefaultNodes:T,debug:E}=x();if(S!=null&&S.length){if(T){const A=nH(S,C);j(A)}E&&console.log("React Flow: trigger node changes",S),w==null||w(S)}},triggerEdgeChanges:S=>{const{onEdgesChange:w,setEdges:j,edges:C,hasDefaultEdges:T,debug:E}=x();if(S!=null&&S.length){if(T){const A=rH(S,C);j(A)}E&&console.log("React Flow: trigger edge changes",S),w==null||w(S)}},addSelectedNodes:S=>{const{multiSelectionActive:w,edgeLookup:j,nodeLookup:C,triggerNodeChanges:T,triggerEdgeChanges:E}=x();if(w){const A=S.map(O=>sd(O,!0));T(A);return}T(df(C,new Set([...S]),!0)),E(df(j))},addSelectedEdges:S=>{const{multiSelectionActive:w,edgeLookup:j,nodeLookup:C,triggerNodeChanges:T,triggerEdgeChanges:E}=x();if(w){const A=S.map(O=>sd(O,!0));E(A);return}E(df(j,new Set([...S]))),T(df(C,new Set,!0))},unselectNodesAndEdges:({nodes:S,edges:w}={})=>{const{edges:j,nodes:C,nodeLookup:T,triggerNodeChanges:E,triggerEdgeChanges:A}=x(),O=S||C,F=w||j,L=[];for(const z of O){if(!z.selected)continue;const B=T.get(z.id);B&&(B.selected=!1),L.push(sd(z.id,!1))}const $=[];for(const z of F)z.selected&&$.push(sd(z.id,!1));E(L),A($)},setMinZoom:S=>{const{panZoom:w,maxZoom:j}=x();w==null||w.setScaleExtent([S,j]),_({minZoom:S})},setMaxZoom:S=>{const{panZoom:w,minZoom:j}=x();w==null||w.setScaleExtent([j,S]),_({maxZoom:S})},setTranslateExtent:S=>{var w;(w=x().panZoom)==null||w.setTranslateExtent(S),_({translateExtent:S})},resetSelectedElements:()=>{const{edges:S,nodes:w,triggerNodeChanges:j,triggerEdgeChanges:C,elementsSelectable:T}=x();if(!T)return;const E=w.reduce((O,F)=>F.selected?[...O,sd(F.id,!1)]:O,[]),A=S.reduce((O,F)=>F.selected?[...O,sd(F.id,!1)]:O,[]);j(E),C(A)},setNodeExtent:S=>{const{nodes:w,nodeLookup:j,parentLookup:C,nodeOrigin:T,elevateNodesOnSelect:E,nodeExtent:A,zIndexMode:O}=x();S[0][0]===A[0][0]&&S[0][1]===A[0][1]&&S[1][0]===A[1][0]&&S[1][1]===A[1][1]||(Vj(w,j,C,{nodeOrigin:T,nodeExtent:S,elevateNodesOnSelect:E,checkEquality:!1,zIndexMode:O}),_({nodeExtent:S}))},panBy:S=>{const{transform:w,width:j,height:C,panZoom:T,translateExtent:E}=x();return c_e({delta:S,panZoom:T,transform:w,translateExtent:E,width:j,height:C})},setCenter:async(S,w,j)=>{const{width:C,height:T,maxZoom:E,panZoom:A}=x();if(!A)return Promise.resolve(!1);const O=typeof(j==null?void 0:j.zoom)<"u"?j.zoom:E;return await A.setViewport({x:C/2-S*O,y:T/2-w*O,zoom:O},{duration:j==null?void 0:j.duration,ease:j==null?void 0:j.ease,interpolate:j==null?void 0:j.interpolate}),Promise.resolve(!0)},cancelConnection:()=>{_({connection:{...SF}})},updateConnection:S=>{_({connection:S})},reset:()=>_({...XP()})}},Object.is);function iT({initialNodes:e,initialEdges:n,defaultNodes:r,defaultEdges:i,initialWidth:s,initialHeight:a,initialMinZoom:o,initialMaxZoom:l,initialFitViewOptions:u,fitView:d,nodeOrigin:p,nodeExtent:f,zIndexMode:g,children:_}){const[x]=b.useState(()=>Cbe({nodes:e,edges:n,defaultNodes:r,defaultEdges:i,width:s,height:a,fitView:d,minZoom:o,maxZoom:l,fitViewOptions:u,nodeOrigin:p,nodeExtent:f,zIndexMode:g}));return c.jsx(U_e,{value:x,children:c.jsx(fxe,{children:_})})}function jbe({children:e,nodes:n,edges:r,defaultNodes:i,defaultEdges:s,width:a,height:o,fitView:l,fitViewOptions:u,minZoom:d,maxZoom:p,nodeOrigin:f,nodeExtent:g,zIndexMode:_}){return b.useContext(Y0)?c.jsx(c.Fragment,{children:e}):c.jsx(iT,{initialNodes:n,initialEdges:r,defaultNodes:i,defaultEdges:s,initialWidth:a,initialHeight:o,fitView:l,initialFitViewOptions:u,initialMinZoom:d,initialMaxZoom:p,nodeOrigin:f,nodeExtent:g,zIndexMode:_,children:e})}const Nbe={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0};function Ebe({nodes:e,edges:n,defaultNodes:r,defaultEdges:i,className:s,nodeTypes:a,edgeTypes:o,onNodeClick:l,onEdgeClick:u,onInit:d,onMove:p,onMoveStart:f,onMoveEnd:g,onConnect:_,onConnectStart:x,onConnectEnd:v,onClickConnectStart:S,onClickConnectEnd:w,onNodeMouseEnter:j,onNodeMouseMove:C,onNodeMouseLeave:T,onNodeContextMenu:E,onNodeDoubleClick:A,onNodeDragStart:O,onNodeDrag:F,onNodeDragStop:L,onNodesDelete:$,onEdgesDelete:z,onDelete:B,onSelectionChange:H,onSelectionDragStart:D,onSelectionDrag:U,onSelectionDragStop:I,onSelectionContextMenu:X,onSelectionStart:K,onSelectionEnd:Q,onBeforeDelete:V,connectionMode:R,connectionLineType:q=Va.Bezier,connectionLineStyle:W,connectionLineComponent:te,connectionLineContainerStyle:J,deleteKeyCode:G="Backspace",selectionKeyCode:re="Shift",selectionOnDrag:ne=!1,selectionMode:le=Ug.Full,panActivationKeyCode:oe="Space",multiSelectionKeyCode:ie=Vg()?"Meta":"Control",zoomActivationKeyCode:he=Vg()?"Meta":"Control",snapToGrid:Z,snapGrid:de,onlyRenderVisibleElements:ue=!1,selectNodesOnDrag:pe,nodesDraggable:Oe,autoPanOnNodeFocus:fe,nodesConnectable:Le,nodesFocusable:Ee,nodeOrigin:Bt=eH,edgesFocusable:Xe,edgesReconnectable:St,elementsSelectable:yt=!0,defaultViewport:Rt=ixe,minZoom:be=.5,maxZoom:He=2,translateExtent:ht=qg,preventScrolling:ot=!0,nodeExtent:$t,defaultMarkerColor:jn="#b1b1b7",zoomOnScroll:Pn=!0,zoomOnPinch:We=!0,panOnScroll:ut=!1,panOnScrollSpeed:Ct=.5,panOnScrollMode:Mt=Cd.Free,zoomOnDoubleClick:Ge=!0,panOnDrag:tt=!0,onPaneClick:bt,onPaneMouseEnter:Nt,onPaneMouseMove:it,onPaneMouseLeave:dt,onPaneScroll:Vt,onPaneContextMenu:jt,paneClickDistance:Ht=1,nodeClickDistance:rr=0,children:Wt,onReconnect:Mn,onReconnectStart:ge,onReconnectEnd:Re,onEdgeContextMenu:et,onEdgeDoubleClick:tn,onEdgeMouseEnter:Jt,onEdgeMouseMove:Ft,onEdgeMouseLeave:ir,reconnectRadius:xi=10,onNodesChange:on,onEdgesChange:qt,noDragClassName:P="nodrag",noWheelClassName:Ie="nowheel",noPanClassName:st="nopan",fitView:Kt,fitViewOptions:jr,connectOnClick:Zr,attributionPosition:ho,proOptions:hs,defaultEdgeOptions:ll,elevateNodesOnSelect:fs=!0,elevateEdgesOnSelect:Pi=!1,disableKeyboardA11y:Qi=!1,autoPanOnConnect:Fr,autoPanOnNodeDrag:Vn,autoPanSpeed:cl,connectionRadius:lc,isValidConnection:Ls,onError:la,style:Eu,id:ul,nodeDragThreshold:Is,connectionDragThreshold:dl,viewport:hr,onViewportChange:Bs,width:Jr,height:li,colorMode:fo="light",debug:Au,onScroll:bi,ariaLabelConfig:po,zIndexMode:ae="basic",...Ce},at){const Ot=ul||"1",Yn=lxe(fo),Li=b.useCallback(Ii=>{Ii.currentTarget.scrollTo({top:0,left:0,behavior:"instant"}),bi==null||bi(Ii)},[bi]);return c.jsx("div",{"data-testid":"rf__wrapper",...Ce,onScroll:Li,style:{...Eu,...Nbe},ref:at,className:Qr(["react-flow",s,Yn]),id:ul,role:"application",children:c.jsxs(jbe,{nodes:e,edges:n,width:Jr,height:li,fitView:Kt,fitViewOptions:jr,minZoom:be,maxZoom:He,nodeOrigin:Bt,nodeExtent:$t,zIndexMode:ae,children:[c.jsx(oxe,{nodes:e,edges:n,defaultNodes:r,defaultEdges:i,onConnect:_,onConnectStart:x,onConnectEnd:v,onClickConnectStart:S,onClickConnectEnd:w,nodesDraggable:Oe,autoPanOnNodeFocus:fe,nodesConnectable:Le,nodesFocusable:Ee,edgesFocusable:Xe,edgesReconnectable:St,elementsSelectable:yt,elevateNodesOnSelect:fs,elevateEdgesOnSelect:Pi,minZoom:be,maxZoom:He,nodeExtent:$t,onNodesChange:on,onEdgesChange:qt,snapToGrid:Z,snapGrid:de,connectionMode:R,translateExtent:ht,connectOnClick:Zr,defaultEdgeOptions:ll,fitView:Kt,fitViewOptions:jr,onNodesDelete:$,onEdgesDelete:z,onDelete:B,onNodeDragStart:O,onNodeDrag:F,onNodeDragStop:L,onSelectionDrag:U,onSelectionDragStart:D,onSelectionDragStop:I,onMove:p,onMoveStart:f,onMoveEnd:g,noPanClassName:st,nodeOrigin:Bt,rfId:Ot,autoPanOnConnect:Fr,autoPanOnNodeDrag:Vn,autoPanSpeed:cl,onError:la,connectionRadius:lc,isValidConnection:Ls,selectNodesOnDrag:pe,nodeDragThreshold:Is,connectionDragThreshold:dl,onBeforeDelete:V,debug:Au,ariaLabelConfig:po,zIndexMode:ae}),c.jsx(Sbe,{onInit:d,onNodeClick:l,onEdgeClick:u,onNodeMouseEnter:j,onNodeMouseMove:C,onNodeMouseLeave:T,onNodeContextMenu:E,onNodeDoubleClick:A,nodeTypes:a,edgeTypes:o,connectionLineType:q,connectionLineStyle:W,connectionLineComponent:te,connectionLineContainerStyle:J,selectionKeyCode:re,selectionOnDrag:ne,selectionMode:le,deleteKeyCode:G,multiSelectionKeyCode:ie,panActivationKeyCode:oe,zoomActivationKeyCode:he,onlyRenderVisibleElements:ue,defaultViewport:Rt,translateExtent:ht,minZoom:be,maxZoom:He,preventScrolling:ot,zoomOnScroll:Pn,zoomOnPinch:We,zoomOnDoubleClick:Ge,panOnScroll:ut,panOnScrollSpeed:Ct,panOnScrollMode:Mt,panOnDrag:tt,onPaneClick:bt,onPaneMouseEnter:Nt,onPaneMouseMove:it,onPaneMouseLeave:dt,onPaneScroll:Vt,onPaneContextMenu:jt,paneClickDistance:Ht,nodeClickDistance:rr,onSelectionContextMenu:X,onSelectionStart:K,onSelectionEnd:Q,onReconnect:Mn,onReconnectStart:ge,onReconnectEnd:Re,onEdgeContextMenu:et,onEdgeDoubleClick:tn,onEdgeMouseEnter:Jt,onEdgeMouseMove:Ft,onEdgeMouseLeave:ir,reconnectRadius:xi,defaultMarkerColor:jn,noDragClassName:P,noWheelClassName:Ie,noPanClassName:st,rfId:Ot,disableKeyboardA11y:Qi,nodeExtent:$t,viewport:hr,onViewportChange:Bs}),c.jsx(rxe,{onSelectionChange:H}),Wt,c.jsx(Z_e,{proOptions:hs,position:ho}),c.jsx(Q_e,{rfId:Ot,disableKeyboardA11y:Qi})]})})}var EH=iH(Ebe);const Abe=e=>{var n;return(n=e.domNode)==null?void 0:n.querySelector(".react-flow__edgelabel-renderer")};function Tbe({children:e}){const n=_n(Abe);return n?oa.createPortal(e,n):null}function Mbe(){const e=dr();return b.useCallback(n=>{const{domNode:r,updateNodeInternals:i}=e.getState(),s=Array.isArray(n)?n:[n],a=new Map;s.forEach(o=>{const l=r==null?void 0:r.querySelector(`.react-flow__node[data-id="${o}"]`);l&&a.set(o,{id:o,nodeElement:l,force:!0})}),requestAnimationFrame(()=>i(a,{triggerFitView:!1}))},[])}function Rbe(e){const[n,r]=b.useState(e),i=b.useCallback(s=>r(a=>nH(s,a)),[]);return[n,r,i]}function Obe(e){const[n,r]=b.useState(e),i=b.useCallback(s=>r(a=>rH(s,a)),[]);return[n,r,i]}function Dbe({dimensions:e,lineWidth:n,variant:r,className:i}){return c.jsx("path",{strokeWidth:n,d:`M${e[0]/2} 0 V${e[1]} M0 ${e[1]/2} H${e[0]}`,className:Qr(["react-flow__background-pattern",r,i])})}function Pbe({radius:e,className:n}){return c.jsx("circle",{cx:e,cy:e,r:e,className:Qr(["react-flow__background-pattern","dots",n])})}var ou;(function(e){e.Lines="lines",e.Dots="dots",e.Cross="cross"})(ou||(ou={}));const Lbe={[ou.Dots]:1,[ou.Lines]:1,[ou.Cross]:6},Ibe=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function AH({id:e,variant:n=ou.Dots,gap:r=20,size:i,lineWidth:s=1,offset:a=0,color:o,bgColor:l,style:u,className:d,patternClassName:p}){const f=b.useRef(null),{transform:g,patternId:_}=_n(Ibe,kr),x=i||Lbe[n],v=n===ou.Dots,S=n===ou.Cross,w=Array.isArray(r)?r:[r,r],j=[w[0]*g[2]||1,w[1]*g[2]||1],C=x*g[2],T=Array.isArray(a)?a:[a,a],E=S?[C,C]:j,A=[T[0]*g[2]||1+E[0]/2,T[1]*g[2]||1+E[1]/2],O=`${_}${e||""}`;return c.jsxs("svg",{className:Qr(["react-flow__background",d]),style:{...u,...Q0,"--xy-background-color-props":l,"--xy-background-pattern-color-props":o},ref:f,"data-testid":"rf__background",children:[c.jsx("pattern",{id:O,x:g[0]%j[0],y:g[1]%j[1],width:j[0],height:j[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${A[0]},-${A[1]})`,children:v?c.jsx(Pbe,{radius:C/2,className:p}):c.jsx(Dbe,{dimensions:E,lineWidth:s,variant:n,className:p})}),c.jsx("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${O})`})]})}AH.displayName="Background";const TH=b.memo(AH);function Bbe(){return c.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32",children:c.jsx("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"})})}function zbe(){return c.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5",children:c.jsx("path",{d:"M0 0h32v4.2H0z"})})}function $be(){return c.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30",children:c.jsx("path",{d:"M3.692 4.63c0-.53.4-.938.939-.938h5.215V0H4.708C2.13 0 0 2.054 0 4.63v5.216h3.692V4.631zM27.354 0h-5.2v3.692h5.17c.53 0 .984.4.984.939v5.215H32V4.631A4.624 4.624 0 0027.354 0zm.954 24.83c0 .532-.4.94-.939.94h-5.215v3.768h5.215c2.577 0 4.631-2.13 4.631-4.707v-5.139h-3.692v5.139zm-23.677.94c-.531 0-.939-.4-.939-.94v-5.138H0v5.139c0 2.577 2.13 4.707 4.708 4.707h5.138V25.77H4.631z"})})}function Fbe(){return c.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:c.jsx("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0 8 0 4.571 3.429 4.571 7.619v3.048H3.048A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047zm4.724-13.866H7.467V7.619c0-2.59 2.133-4.724 4.723-4.724 2.591 0 4.724 2.133 4.724 4.724v3.048z"})})}function Hbe(){return c.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:c.jsx("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0c-4.114 1.828-1.37 2.133.305 2.438 1.676.305 4.42 2.59 4.42 5.181v3.048H3.047A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047z"})})}function j_({children:e,className:n,...r}){return c.jsx("button",{type:"button",className:Qr(["react-flow__controls-button",n]),...r,children:e})}const Wbe=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom,ariaLabelConfig:e.ariaLabelConfig});function MH({style:e,showZoom:n=!0,showFitView:r=!0,showInteractive:i=!0,fitViewOptions:s,onZoomIn:a,onZoomOut:o,onFitView:l,onInteractiveChange:u,className:d,children:p,position:f="bottom-left",orientation:g="vertical","aria-label":_}){const x=dr(),{isInteractive:v,minZoomReached:S,maxZoomReached:w,ariaLabelConfig:j}=_n(Wbe,kr),{zoomIn:C,zoomOut:T,fitView:E}=X0(),A=()=>{C(),a==null||a()},O=()=>{T(),o==null||o()},F=()=>{E(s),l==null||l()},L=()=>{x.setState({nodesDraggable:!v,nodesConnectable:!v,elementsSelectable:!v}),u==null||u(!v)},$=g==="horizontal"?"horizontal":"vertical";return c.jsxs(G0,{className:Qr(["react-flow__controls",$,d]),position:f,style:e,"data-testid":"rf__controls","aria-label":_??j["controls.ariaLabel"],children:[n&&c.jsxs(c.Fragment,{children:[c.jsx(j_,{onClick:A,className:"react-flow__controls-zoomin",title:j["controls.zoomIn.ariaLabel"],"aria-label":j["controls.zoomIn.ariaLabel"],disabled:w,children:c.jsx(Bbe,{})}),c.jsx(j_,{onClick:O,className:"react-flow__controls-zoomout",title:j["controls.zoomOut.ariaLabel"],"aria-label":j["controls.zoomOut.ariaLabel"],disabled:S,children:c.jsx(zbe,{})})]}),r&&c.jsx(j_,{className:"react-flow__controls-fitview",onClick:F,title:j["controls.fitView.ariaLabel"],"aria-label":j["controls.fitView.ariaLabel"],children:c.jsx($be,{})}),i&&c.jsx(j_,{className:"react-flow__controls-interactive",onClick:L,title:j["controls.interactive.ariaLabel"],"aria-label":j["controls.interactive.ariaLabel"],children:v?c.jsx(Hbe,{}):c.jsx(Fbe,{})}),p]})}MH.displayName="Controls";const RH=b.memo(MH);function qbe({id:e,x:n,y:r,width:i,height:s,style:a,color:o,strokeColor:l,strokeWidth:u,className:d,borderRadius:p,shapeRendering:f,selected:g,onClick:_}){const{background:x,backgroundColor:v}=a||{},S=o||x||v;return c.jsx("rect",{className:Qr(["react-flow__minimap-node",{selected:g},d]),x:n,y:r,rx:p,ry:p,width:i,height:s,style:{fill:S,stroke:l,strokeWidth:u},shapeRendering:f,onClick:_?w=>_(w,e):void 0})}const Ube=b.memo(qbe),Kbe=e=>e.nodes.map(n=>n.id),LS=e=>e instanceof Function?e:()=>e;function Vbe({nodeStrokeColor:e,nodeColor:n,nodeClassName:r="",nodeBorderRadius:i=5,nodeStrokeWidth:s,nodeComponent:a=Ube,onClick:o}){const l=_n(Kbe,kr),u=LS(n),d=LS(e),p=LS(r),f=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision";return c.jsx(c.Fragment,{children:l.map(g=>c.jsx(Gbe,{id:g,nodeColorFunc:u,nodeStrokeColorFunc:d,nodeClassNameFunc:p,nodeBorderRadius:i,nodeStrokeWidth:s,NodeComponent:a,onClick:o,shapeRendering:f},g))})}function Ybe({id:e,nodeColorFunc:n,nodeStrokeColorFunc:r,nodeClassNameFunc:i,nodeBorderRadius:s,nodeStrokeWidth:a,shapeRendering:o,NodeComponent:l,onClick:u}){const{node:d,x:p,y:f,width:g,height:_}=_n(x=>{const v=x.nodeLookup.get(e);if(!v)return{node:void 0,x:0,y:0,width:0,height:0};const S=v.internals.userNode,{x:w,y:j}=v.internals.positionAbsolute,{width:C,height:T}=oc(S);return{node:S,x:w,y:j,width:C,height:T}},kr);return!d||d.hidden||!MF(d)?null:c.jsx(l,{x:p,y:f,width:g,height:_,style:d.style,selected:!!d.selected,className:i(d),color:n(d),borderRadius:s,strokeColor:r(d),strokeWidth:a,shapeRendering:o,onClick:u,id:d.id})}const Gbe=b.memo(Ybe);var Xbe=b.memo(Vbe);const Qbe=200,Zbe=150,Jbe=e=>!e.hidden,e0e=e=>{const n={x:-e.transform[0]/e.transform[2],y:-e.transform[1]/e.transform[2],width:e.width/e.transform[2],height:e.height/e.transform[2]};return{viewBB:n,boundingRect:e.nodeLookup.size>0?TF($v(e.nodeLookup,{filter:Jbe}),n):n,rfId:e.rfId,panZoom:e.panZoom,translateExtent:e.translateExtent,flowWidth:e.width,flowHeight:e.height,ariaLabelConfig:e.ariaLabelConfig}},t0e="react-flow__minimap-desc";function OH({style:e,className:n,nodeStrokeColor:r,nodeColor:i,nodeClassName:s="",nodeBorderRadius:a=5,nodeStrokeWidth:o,nodeComponent:l,bgColor:u,maskColor:d,maskStrokeColor:p,maskStrokeWidth:f,position:g="bottom-right",onClick:_,onNodeClick:x,pannable:v=!1,zoomable:S=!1,ariaLabel:w,inversePan:j,zoomStep:C=1,offsetScale:T=5}){const E=dr(),A=b.useRef(null),{boundingRect:O,viewBB:F,rfId:L,panZoom:$,translateExtent:z,flowWidth:B,flowHeight:H,ariaLabelConfig:D}=_n(e0e,kr),U=(e==null?void 0:e.width)??Qbe,I=(e==null?void 0:e.height)??Zbe,X=O.width/U,K=O.height/I,Q=Math.max(X,K),V=Q*U,R=Q*I,q=T*Q,W=O.x-(V-O.width)/2-q,te=O.y-(R-O.height)/2-q,J=V+q*2,G=R+q*2,re=`${t0e}-${L}`,ne=b.useRef(0),le=b.useRef();ne.current=Q,b.useEffect(()=>{if(A.current&&$)return le.current=y_e({domNode:A.current,panZoom:$,getTransform:()=>E.getState().transform,getViewScale:()=>ne.current}),()=>{var Z;(Z=le.current)==null||Z.destroy()}},[$]),b.useEffect(()=>{var Z;(Z=le.current)==null||Z.update({translateExtent:z,width:B,height:H,inversePan:j,pannable:v,zoomStep:C,zoomable:S})},[v,S,j,C,z,B,H]);const oe=_?Z=>{var pe;const[de,ue]=((pe=le.current)==null?void 0:pe.pointer(Z))||[0,0];_(Z,{x:de,y:ue})}:void 0,ie=x?b.useCallback((Z,de)=>{const ue=E.getState().nodeLookup.get(de).internals.userNode;x(Z,ue)},[]):void 0,he=w??D["minimap.ariaLabel"];return c.jsx(G0,{position:g,style:{...e,"--xy-minimap-background-color-props":typeof u=="string"?u:void 0,"--xy-minimap-mask-background-color-props":typeof d=="string"?d:void 0,"--xy-minimap-mask-stroke-color-props":typeof p=="string"?p:void 0,"--xy-minimap-mask-stroke-width-props":typeof f=="number"?f*Q:void 0,"--xy-minimap-node-background-color-props":typeof i=="string"?i:void 0,"--xy-minimap-node-stroke-color-props":typeof r=="string"?r:void 0,"--xy-minimap-node-stroke-width-props":typeof o=="number"?o:void 0},className:Qr(["react-flow__minimap",n]),"data-testid":"rf__minimap",children:c.jsxs("svg",{width:U,height:I,viewBox:`${W} ${te} ${J} ${G}`,className:"react-flow__minimap-svg",role:"img","aria-labelledby":re,ref:A,onClick:oe,children:[he&&c.jsx("title",{id:re,children:he}),c.jsx(Xbe,{onClick:ie,nodeColor:i,nodeStrokeColor:r,nodeBorderRadius:a,nodeClassName:s,nodeStrokeWidth:o,nodeComponent:l}),c.jsx("path",{className:"react-flow__minimap-mask",d:`M${W-q},${te-q}h${J+q*2}v${G+q*2}h${-J-q*2}z
        M${F.x},${F.y}h${F.width}v${F.height}h${-F.width}z`,fillRule:"evenodd",pointerEvents:"none"})]})})}OH.displayName="MiniMap";const DH=b.memo(OH),n0e=e=>n=>e?`${Math.max(1/n.transform[2],1)}`:void 0,r0e={[Kf.Line]:"right",[Kf.Handle]:"bottom-right"};function i0e({nodeId:e,position:n,variant:r=Kf.Handle,className:i,style:s=void 0,children:a,color:o,minWidth:l=10,minHeight:u=10,maxWidth:d=Number.MAX_VALUE,maxHeight:p=Number.MAX_VALUE,keepAspectRatio:f=!1,resizeDirection:g,autoScale:_=!0,shouldResize:x,onResizeStart:v,onResize:S,onResizeEnd:w}){const j=lH(),C=typeof e=="string"?e:j,T=dr(),E=b.useRef(null),A=r===Kf.Handle,O=_n(b.useCallback(n0e(A&&_),[A,_]),kr),F=b.useRef(null),L=n??r0e[r];b.useEffect(()=>{if(!(!E.current||!C))return F.current||(F.current=R_e({domNode:E.current,nodeId:C,getStoreItems:()=>{const{nodeLookup:z,transform:B,snapGrid:H,snapToGrid:D,nodeOrigin:U,domNode:I}=T.getState();return{nodeLookup:z,transform:B,snapGrid:H,snapToGrid:D,nodeOrigin:U,paneDomNode:I}},onChange:(z,B)=>{const{triggerNodeChanges:H,nodeLookup:D,parentLookup:U,nodeOrigin:I}=T.getState(),X=[],K={x:z.x,y:z.y},Q=D.get(C);if(Q&&Q.expandParent&&Q.parentId){const V=Q.origin??I,R=z.width??Q.measured.width??0,q=z.height??Q.measured.height??0,W={id:Q.id,parentId:Q.parentId,rect:{width:R,height:q,...RF({x:z.x??Q.position.x,y:z.y??Q.position.y},{width:R,height:q},Q.parentId,D,V)}},te=nT([W],D,U,I);X.push(...te),K.x=z.x?Math.max(V[0]*R,z.x):void 0,K.y=z.y?Math.max(V[1]*q,z.y):void 0}if(K.x!==void 0&&K.y!==void 0){const V={id:C,type:"position",position:{...K}};X.push(V)}if(z.width!==void 0&&z.height!==void 0){const R={id:C,type:"dimensions",resizing:!0,setAttributes:g?g==="horizontal"?"width":"height":!0,dimensions:{width:z.width,height:z.height}};X.push(R)}for(const V of B){const R={...V,type:"position"};X.push(R)}H(X)},onEnd:({width:z,height:B})=>{const H={id:C,type:"dimensions",resizing:!1,dimensions:{width:z,height:B}};T.getState().triggerNodeChanges([H])}})),F.current.update({controlPosition:L,boundaries:{minWidth:l,minHeight:u,maxWidth:d,maxHeight:p},keepAspectRatio:f,resizeDirection:g,onResizeStart:v,onResize:S,onResizeEnd:w,shouldResize:x}),()=>{var z;(z=F.current)==null||z.destroy()}},[L,l,u,d,p,f,v,S,w,x]);const $=L.split("-");return c.jsx("div",{className:Qr(["react-flow__resize-control","nodrag",...$,r,i]),ref:E,style:{...s,scale:O,...o&&{[A?"backgroundColor":"borderColor"]:o}},children:a})}b.memo(i0e);function s0e({nodes:e,edges:n,nodeTypes:r,edgeTypes:i,onNodeClick:s,minimapColor:a,height:o="30rem",fill:l,onlyRenderVisibleElements:u=!1,showMiniMap:d=!0,emptyState:p="No graph data available.",overlay:f}){const g=l?{flex:"1 1 auto",minHeight:0,width:"100%",height:"100%"}:{width:"100%",height:o};return e.length===0?c.jsx("div",{className:"revka-graph revka-graph-empty flex items-center justify-center rounded-[8px] border border-dashed p-6 text-sm",style:{...g,minHeight:l?0:o,borderColor:"var(--revka-border-strong)",color:"var(--revka-text-secondary)"},children:p}):c.jsxs("div",{className:"revka-graph overflow-hidden rounded-[8px] border",style:{...g,borderColor:"var(--revka-border-soft)"},children:[f?c.jsx("div",{className:"revka-graph-overlay",children:f}):null,c.jsxs(EH,{nodes:e,edges:n,nodeTypes:r,edgeTypes:i,fitView:!0,fitViewOptions:{padding:.2},onNodeClick:s,nodesDraggable:!1,nodesConnectable:!1,panOnDrag:!0,elementsSelectable:!0,onlyRenderVisibleElements:u,minZoom:.35,maxZoom:2,proOptions:{hideAttribution:!0},style:{background:"transparent"},children:[c.jsx(TH,{gap:24,size:1,color:"var(--revka-grid-line)"}),c.jsx(RH,{showInteractive:!1,style:{background:"var(--revka-bg-panel-strong)",borderColor:"var(--revka-border-soft)",borderRadius:"8px"}}),d?c.jsx(DH,{position:"bottom-right",pannable:!0,zoomable:!0,nodeColor:a,style:{background:"var(--revka-bg-panel-strong)",border:"1px solid var(--revka-border-soft)",borderRadius:"8px",width:220,height:150},maskColor:"color-mix(in srgb, var(--revka-bg-base) 54%, transparent)"}):null]})]})}function PH(e){return c.jsx(iT,{children:c.jsx(s0e,{...e})})}function a0e({id:e,sourceX:n,sourceY:r,targetX:i,targetY:s,sourcePosition:a,targetPosition:o,style:l,label:u,labelStyle:d}){const[p,f,g]=QA({sourceX:n,sourceY:r,targetX:i,targetY:s,sourcePosition:a,targetPosition:o});return c.jsxs(c.Fragment,{children:[c.jsx(Vf,{id:`${e}-track`,path:p,style:{stroke:"var(--revka-border-soft)",strokeWidth:4,opacity:.42,fill:"none"}}),c.jsx(Vf,{id:e,path:p,style:l}),u?c.jsx(Tbe,{children:c.jsx("div",{className:"nodrag nopan absolute -translate-x-1/2 -translate-y-1/2 rounded-md border px-1.5 py-0.5 text-[10px] font-semibold tracking-[0.08em]",style:{transform:`translate(-50%, -50%) translate(${f}px, ${g}px)`,borderColor:"var(--revka-border-strong)",background:"color-mix(in srgb, var(--revka-bg-panel-strong) 96%, transparent)",color:"var(--revka-text-primary)",boxShadow:"0 8px 18px rgba(0, 0, 0, 0.10)",...d??{}},children:u})}):null]})}const o0e={default:a0e};function l0e(e){switch(e){case"success":return"completed";case"error":return"failed";case"queued":case"waiting":case"blocked":case"approval_required":case"paused":return"pending";case"retrying":return"running";case"cancelled":return"skipped";default:return e??"pending"}}function ea(e){return{status:l0e(e.status),agent_id:e.agent_id,agent_type:e.agent_type,role:e.role,template_name:e.template_name,skills:e.skills,transcript:e.transcript,error:e.error,output_preview:e.output_preview,input_data:e.input_data,output_data:e.output_data}}const Dh="var(--revka-signal-live)",Bc="var(--revka-signal-network)",N_="var(--revka-signal-selected)",Ph="var(--revka-status-warning)",QP="var(--revka-status-idle)",IS={code:Dh,build:Dh,test:Dh,research:Dh,for_each:Dh,shell:Dh,agent:Bc,deploy:Bc,notify:Bc,a2a:Bc,handoff:Bc,group_chat:Bc,map_reduce:Bc,supervisor:Bc,review:N_,summarize:N_,resolve:N_,output:N_,human_input:Ph,human_approval:Ph,approve:Ph,gate:Ph,conditional:Ph,goto:Ph,parallel:QP,task:QP};function LH(e){if(typeof window>"u")return e;const n=e.match(/^var\((--[\w-]+)\)$/),r=n==null?void 0:n[1];return r&&getComputedStyle(document.documentElement).getPropertyValue(r).trim()||e}function IH(e){const n=e.toLowerCase();if(IS[n])return IS[n];for(const[r,i]of Object.entries(IS))if(n.includes(r))return i;return"var(--revka-status-idle)"}function BH(e){switch(e){case"running":return"var(--revka-signal-live)";case"completed":return"var(--revka-signal-selected)";case"failed":return"var(--revka-status-danger)";case"skipped":return"var(--revka-status-idle)";case"pending":default:return"var(--revka-text-faint)"}}function zH(e){const n=new Map(e.map(i=>[i.id,i])),r=new Map;for(const i of md(e).edges){if(!n.has(i.source)||!n.has(i.target))continue;const s=r.get(i.target)??[];s.includes(i.source)||s.push(i.source),r.set(i.target,s)}return r}function c0e({edge:e,tasksById:n,stepResults:r,selectedTaskId:i}){var p,f,g;const s=(p=r==null?void 0:r[e.source])==null?void 0:p.status,a=(f=r==null?void 0:r[e.target])==null?void 0:f.status,o=BH(a??s),l=r?o:"var(--revka-text-faint)",u=i&&(e.source===i||e.target===i),d=e.sourceHandle==="true"?"TRUE":e.sourceHandle==="false"?"FALSE":typeof e.label=="string"?e.label:void 0;return{animated:s==="running"||a==="running",label:d,labelStyle:d?{...e.labelStyle??{},fill:e.sourceHandle==="false"?"var(--revka-status-danger)":((g=e.labelStyle)==null?void 0:g.fill)??"var(--revka-status-success)",fontSize:10,fontWeight:700}:void 0,style:{stroke:u?l:`color-mix(in srgb, ${l} ${r?"62%":"42%"}, var(--revka-border-soft))`,strokeWidth:a==="failed"?2.6:u?2.4:1.55,strokeDasharray:a==="skipped"?"5 4":void 0,opacity:a==="failed"?1:u?.96:.68,filter:a==="failed"?`drop-shadow(0 0 6px color-mix(in srgb, ${l} 28%, transparent))`:void 0}}}function $H({tasks:e,stepResults:n}){var o;const r=new Set,i=zH(e),s=new Set(Object.entries(n).filter(([,l])=>l.status==="failed").map(([l])=>l));let a=!0;for(;a;){a=!1;for(const l of e){if(r.has(l.id)||s.has(l.id)||((o=n[l.id])==null?void 0:o.status)!=="pending")continue;(i.get(l.id)??[]).some(p=>s.has(p)||r.has(p))&&(r.add(l.id),a=!0)}}return[...r]}function ZP({startTaskIds:e,tasks:n}){const r=zH(n),i=new Set,s=[...e];for(;s.length>0;){const a=s.pop();if(!(!a||i.has(a))){i.add(a);for(const o of r.get(a)??[])s.push(o)}}return[...i]}function u0e(e){return`url("${e.replace(/"/g,"%22")}")`}function FH(e){const n=Mbe(),r=b.useRef(null);return b.useEffect(()=>{const i=r.current;if(!i)return;const s=new ResizeObserver(()=>n(e));return s.observe(i),()=>s.disconnect()},[e,n]),r}function fg(e){return e&&typeof e=="object"&&!Array.isArray(e)?e:{}}function Xh(e){if(e==null)return"";if(typeof e=="string")return e;if(typeof e=="number"||typeof e=="boolean")return String(e);try{return JSON.stringify(e)}catch{return String(e)}}function HH(e,n=110){const r=e.replace(/\s+/g," ").trim();return r.length>n?`${r.slice(0,n-1)}…`:r}function d0e(e){if(!e||e.status!=="failed")return"";const n=fg(e.output_data),r=fg(e.input_data),i=[e.error,n.error,n.entity_error,n.entity_artifact_error,n.entity_tag_error,n.register_output_error,n.structured_output_error,fg(n.error_message).content,n.stderr,n.stderr_preview,r.command?`command: ${r.command}`:""];for(const s of i){const a=HH(Xh(s));if(a)return a}return""}function h0e(e){if(!e||e.status!=="completed")return"";const n=fg(e.input_data),r=fg(e.output_data),i=Xh(r.matched_branch_index??n.matched_branch_index),s=Xh(r.matched_goto),a=Xh(r.matched_condition??n.matched_condition),o=Xh(r.matched_output??e.output_preview),l=[],u=Number(i),d=Xh(r.matched_branch_label);return d?l.push(d):Number.isFinite(u)&&u>=0&&l.push(`branch ${u+1}`),s&&l.push(`to ${s}`),a&&l.push(`if ${a}`),o&&l.push(`out ${o}`),HH(l.join(" · "),120)}function f0e({id:e,data:n,selected:r}){var v,S,w,j,C,T,E,A,O,F,L;const i=FH(e),s=n.runInfo?BH(n.runInfo.status):IH(n.type),a=n.failing?"var(--revka-status-danger)":n.blocked?"var(--revka-status-warning)":n.running?"var(--revka-signal-live)":s,o=d0e(n.runInfo),l=n.type==="conditional"?h0e(n.runInfo):"",u=((v=n.runInfo)==null?void 0:v.template_name)||n.assign||n.template,d=n.failing?"danger":n.blocked?"warning":n.running?"running":((S=n.runInfo)==null?void 0:S.status)??"idle",p=r?`linear-gradient(135deg, color-mix(in srgb, ${a} var(--revka-node-accent-selected), transparent), transparent 78%)`:`linear-gradient(180deg, color-mix(in srgb, ${a} var(--revka-node-accent-idle), transparent), transparent 42%)`,f=!!n.agentAvatarUrl,g=f?["linear-gradient(90deg, var(--revka-bg-panel-strong) 0%, color-mix(in srgb, var(--revka-bg-panel-strong) 88%, transparent) 50%, color-mix(in srgb, var(--revka-bg-panel-strong) 32%, transparent) 100%)",p,u0e(n.agentAvatarUrl)].join(", "):p,_={"--revka-node-accent":a,width:"100%",minHeight:140,minWidth:220,maxWidth:280,borderColor:r?a:"color-mix(in srgb, var(--revka-border-soft) 82%, transparent)",backgroundColor:"var(--revka-bg-panel-strong)",backgroundImage:g,backgroundRepeat:"no-repeat",backgroundPosition:f?"0 0, 0 0, right -22px center":void 0,backgroundSize:f?"100% 100%, 100% 100%, 56% auto":void 0,boxShadow:r?`0 0 0 1px color-mix(in srgb, ${a} 70%, var(--revka-border-strong)), 0 16px 32px color-mix(in srgb, ${a} 12%, transparent)`:n.failing?"0 14px 28px color-mix(in srgb, var(--revka-status-danger) 10%, transparent)":n.blocked?"0 14px 26px color-mix(in srgb, var(--revka-status-warning) 8%, transparent)":"var(--revka-shadow-panel)"},x={width:10,height:10,zIndex:2};return c.jsxs("div",{ref:i,className:"revka-workflow-node rounded-[8px] border px-4 py-3 shadow-sm flex flex-col","data-selected":r?"true":"false","data-state":d,title:[n.name||n.taskId,`Type: ${n.type}`,(w=n.runInfo)!=null&&w.status?`Status: ${n.runInfo.status}`:null,(j=n.runInfo)!=null&&j.agent_type?`Agent: ${n.runInfo.agent_type}${n.runInfo.role?` / ${n.runInfo.role}`:""}`:null,l?`Resolved: ${l}`:null,o?`Failure: ${o}`:null,n.blocked?"Blocked by upstream failure":null,n.failing?"On failure path":null,(T=(C=n.runInfo)==null?void 0:C.skills)!=null&&T.length?`Skills: ${n.runInfo.skills.join(", ")}`:null].filter(Boolean).join(`
`),style:_,children:[c.jsx(Ms,{className:"revka-workflow-handle",type:"target",position:xt.Top,style:x}),c.jsxs("div",{className:"relative z-[1] flex min-h-full flex-col",children:[c.jsxs("div",{className:"flex items-start justify-between gap-2",children:[c.jsxs("div",{className:"min-w-0",children:[c.jsx("div",{className:"truncate text-sm font-semibold",style:{color:"var(--revka-text-primary)"},children:n.name||n.taskId}),c.jsxs("div",{className:"mt-1 flex flex-wrap gap-1.5",children:[c.jsx("span",{className:"rounded-md px-1.5 py-0.5 text-[10px] font-semibold uppercase tracking-[0.12em]",style:{background:"color-mix(in srgb, var(--revka-bg-elevated) 80%, transparent)",color:a},children:n.type}),n.runInfo?c.jsx("span",{className:"rounded-md px-1.5 py-0.5 text-[10px] font-semibold uppercase tracking-[0.12em]",style:{background:"color-mix(in srgb, var(--revka-bg-elevated) 80%, transparent)",color:a},children:n.runInfo.status}):null,n.failing?c.jsx("span",{className:"rounded-md px-1.5 py-0.5 text-[10px] font-semibold uppercase tracking-[0.12em]",style:{background:"color-mix(in srgb, var(--revka-status-danger) 12%, transparent)",color:"var(--revka-status-danger)"},children:"failure path"}):null,n.blocked?c.jsx("span",{className:"rounded-md px-1.5 py-0.5 text-[10px] font-semibold uppercase tracking-[0.12em]",style:{background:"color-mix(in srgb, var(--revka-status-warning) 12%, transparent)",color:"var(--revka-status-warning)"},children:"blocked"}):null]})]}),u?c.jsxs("span",{className:"inline-flex max-w-[116px] items-center gap-1 rounded-md px-1.5 py-0.5 text-[10px] font-medium",style:{background:"var(--revka-signal-network-soft)",color:"var(--revka-signal-network)"},title:n.agentDisplayName||u,children:[c.jsx(Ts,{src:n.agentAvatarUrl,alt:n.agentDisplayName||u,size:16,radius:4,iconSize:10}),c.jsx("span",{className:"truncate",children:u})]}):(E=n.runInfo)!=null&&E.agent_type?c.jsx("span",{className:"rounded-md px-1.5 py-0.5 text-[10px] font-medium",style:{background:"var(--revka-signal-network-soft)",color:"var(--revka-signal-network)"},children:n.runInfo.agent_type}):null]}),n.description?c.jsx("p",{className:"mt-2 line-clamp-2 text-[11px] leading-5",style:{color:"var(--revka-text-secondary)"},children:n.description}):null,c.jsxs("div",{className:"mt-3 flex flex-wrap gap-1.5",children:[n.agentHints.slice(0,2).map($=>c.jsx("span",{className:"rounded-md px-1.5 py-0.5 text-[10px] font-medium",style:{background:"var(--revka-bg-elevated)",color:"var(--revka-text-secondary)"},children:$},$)),n.skills.slice(0,2).map($=>c.jsx("span",{className:"rounded-md px-1.5 py-0.5 text-[10px] font-medium",style:{background:"var(--revka-signal-live-soft)",color:"var(--revka-signal-selected)"},children:$.replace(/^kref:\/\/.*\//,"").replace(/\.skilldef$/,"")},$)),(O=(A=n.runInfo)==null?void 0:A.transcript)!=null&&O.length?c.jsxs("span",{className:"rounded-md px-1.5 py-0.5 text-[10px] font-medium",style:{background:"var(--revka-signal-network-soft)",color:"var(--revka-signal-network)"},children:[n.runInfo.transcript.length," rounds"]}):null,(L=(F=n.runInfo)==null?void 0:F.skills)!=null&&L.length?c.jsxs("span",{className:"rounded-md px-1.5 py-0.5 text-[10px] font-medium",style:{background:"color-mix(in srgb, var(--revka-status-warning) 14%, transparent)",color:"var(--revka-status-warning)"},children:[n.runInfo.skills.length," skills"]}):null]}),l?c.jsx("div",{className:"mt-2 rounded-md px-2 py-1 text-[10px] leading-4",style:{background:"color-mix(in srgb, var(--revka-status-success) 10%, transparent)",color:"var(--revka-text-secondary)"},children:l}):null,o?c.jsx("div",{className:"mt-2 rounded-md px-2 py-1 text-[10px] leading-4",style:{background:"color-mix(in srgb, var(--revka-status-danger) 10%, transparent)",color:"var(--revka-status-danger)"},children:o}):null]}),c.jsx(Ms,{className:"revka-workflow-handle",type:"source",position:xt.Bottom,style:x})]})}function p0e(e){var r;if(((r=e.conditionalBranches)==null?void 0:r.length)>0)return e.conditionalBranches;const n=[];return(e.condition||e.onTrueValue)&&n.push({condition:e.condition||"",goto:"",value:e.onTrueValue||void 0}),e.onFalseValue&&n.push({condition:"default",goto:"",value:e.onFalseValue||void 0}),n.length>0?n:[{condition:e.condition||"",goto:"",value:e.onTrueValue||void 0},{condition:"default",goto:"",value:e.onFalseValue||void 0}]}function m0e({id:e,data:n,selected:r}){var d;const i="var(--revka-status-warning)",s=FH(e),a=p0e(n),o=(d=a.find(p=>p.condition.trim()!=="default"))==null?void 0:d.condition,l={"--revka-node-accent":i,width:"100%",minHeight:96,minWidth:200,maxWidth:250,borderColor:r?i:"color-mix(in srgb, var(--revka-border-soft) 82%, transparent)",background:r?`linear-gradient(135deg, color-mix(in srgb, ${i} var(--revka-node-accent-selected), transparent), transparent 78%), var(--revka-bg-panel-strong)`:`linear-gradient(180deg, color-mix(in srgb, ${i} var(--revka-node-accent-idle), transparent), transparent 42%), var(--revka-bg-panel-strong)`,boxShadow:r?`0 0 0 1px color-mix(in srgb, ${i} 70%, var(--revka-border-strong)), 0 16px 30px color-mix(in srgb, ${i} 12%, transparent)`:"var(--revka-shadow-panel)"},u={width:10,height:10,zIndex:2};return c.jsxs("div",{ref:s,className:"revka-workflow-node rounded-[8px] border px-4 py-3 shadow-sm flex flex-col","data-selected":r?"true":"false","data-state":"gate",style:l,children:[c.jsx(Ms,{className:"revka-workflow-handle",type:"target",position:xt.Top,style:u}),c.jsxs("div",{className:"relative z-[1] flex min-h-full flex-col",children:[c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("div",{className:"h-4 w-4 rotate-45 border",style:{borderColor:i,background:"color-mix(in srgb, var(--revka-bg-panel-strong) 82%, transparent)"}}),c.jsxs("div",{className:"min-w-0",children:[c.jsx("div",{className:"truncate text-sm font-semibold",style:{color:"var(--revka-text-primary)"},children:n.name||n.taskId}),c.jsx("div",{className:"mt-1 text-[11px] font-mono",style:{color:"var(--revka-text-secondary)"},children:o||n.condition||"No condition set"})]})]}),c.jsx("div",{className:"mt-3 flex flex-col gap-1.5 text-[10px] font-semibold uppercase tracking-[0.12em]",children:a.map((p,f)=>{const g=Bf(p,f);return c.jsxs("div",{className:"flex items-center justify-between gap-2",children:[c.jsx("span",{className:"truncate",style:{color:g.stroke},children:$0(p,f)}),p.value?c.jsx("span",{className:"truncate font-mono normal-case tracking-normal",style:{color:g.stroke},children:p.value}):null]},au(f))})})]}),a.map((p,f)=>{const g=Bf(p,f),_=`${(f+1)/(a.length+1)*100}%`;return c.jsx(Ms,{className:"revka-workflow-handle",type:"source",position:xt.Bottom,id:au(f),style:{...u,left:_,"--revka-node-accent":g.stroke}},au(f))})]})}const g0e={taskNode:f0e,gateNode:m0e};function WH(e){return(e??"").trim().toLowerCase()}function v0e(e){const n=new Map;for(const r of e){const i={avatarUrl:r.avatar_url,displayName:r.name||r.item_name};for(const s of[r.item_name,r.name,r.kref]){const a=WH(s);a&&!n.has(a)&&n.set(a,i)}}return n}function y0e(e,n){var r;for(const i of[(r=e.runInfo)==null?void 0:r.template_name,e.assign,e.template]){const s=n.get(WH(i));if(s)return s}return null}function qH(e,n){if(n.length===0)return e;const r=v0e(n);return e.map(i=>{const s=y0e(i.data,r),a=(s==null?void 0:s.avatarUrl)??void 0,o=(s==null?void 0:s.displayName)??void 0;return i.data.agentAvatarUrl===a&&i.data.agentDisplayName===o?i:{...i,data:{...i.data,agentAvatarUrl:a,agentDisplayName:o}}})}let Il=null,ad=null;const Qj=new Set;function JP(){Qj.forEach(e=>e())}function eL(){return Il?Promise.resolve(Il):ad||(ad=LE(!1,1,100).then(e=>(Il=e.agents,ad=null,JP(),Il)).catch(e=>{throw ad=null,Il=[],JP(),e}),ad)}function sT(){const[,e]=b.useState(0),[n,r]=b.useState(Il===null);b.useEffect(()=>{const s=()=>e(a=>a+1);return Qj.add(s),Il===null?(r(!0),eL().catch(()=>{}).finally(()=>r(!1))):r(!1),()=>{Qj.delete(s)}},[]);const i=b.useCallback(async()=>{Il=null,ad=null,r(!0);try{await eL()}finally{r(!1)}},[]);return{agents:Il??[],loading:n,refresh:i}}const _0e=40,x0e=60;function aT({definition:e,stepResults:n,onSelectTask:r,selectedTaskId:i,height:s,fill:a,overlay:o,hiddenTaskIds:l,blockedTaskIds:u,failingTaskIds:d,runningTaskIds:p}){const{agents:f}=sT(),{nodes:g,edges:_,tasks:x,largeGraphMode:v}=b.useMemo(()=>{const w=Ho(e),j=md(w),C=j.nodes.length>_0e||j.edges.length>x0e,T=new Map(w.map(z=>[z.id,z])),E=new Set(l??[]),A=new Set(u??[]),O=new Set(d??[]),F=new Set(p??[]);if(n)for(const z of j.nodes){const B=z.data,H=n[B.taskId];H&&(B.runInfo=H),B.blocked=A.has(B.taskId),B.failing=O.has(B.taskId),B.running=F.has(B.taskId)}const $=OA(w)?j.nodes:G7(j.nodes,j.edges);return{tasks:w,nodes:qH($,f).map(z=>({...z,selected:z.id===i,hidden:E.has(z.id)})),edges:j.edges.map(z=>{const B=c0e({edge:z,tasksById:T,stepResults:n,selectedTaskId:i});return{...z,...B,animated:C?!1:B.animated,hidden:E.has(z.source)||E.has(z.target)}}),largeGraphMode:C}},[f,u,e,d,l,p,i,n]),S=(w,j)=>{const C=j.data.taskId;r(x.find(T=>T.id===C)??null)};return c.jsx(PH,{nodes:g,edges:_,nodeTypes:g0e,edgeTypes:o0e,onNodeClick:S,height:s,fill:a,overlay:o,onlyRenderVisibleElements:v,showMiniMap:!v,minimapColor:w=>{const j=w.data;return LH(IH(j.type))},emptyState:"Select a workflow to inspect its DAG."})}function b0e(){const{t:e,tpl:n}=an(),{getSkinAsset:r}=Pa(),i=r("dashboardHero"),s=r("dashboardShowcase"),a=r("operatorAvatar"),o=s??i,[l,u]=_v(),[d,p]=b.useState(null),[f,g]=b.useState(null),[_,x]=b.useState(null),[v,S]=b.useState(null),[w,j]=b.useState([]),[C,T]=b.useState([]),[E,A]=b.useState(null),[O,F]=b.useState(null),[L,$]=b.useState(null),[z,B]=b.useState(null),[H,D]=b.useState(!1),[U,I]=b.useState(!1),X=b.useRef(null),K=()=>(I(!0),Promise.all([fJ(!0),yZ(),ez(),Qx(),LZ(),nz()]).then(([fe,Le,Ee,Bt,Xe,St])=>{var be;p(fe),g(Le),x(Ee),S(Bt),j(Xe),T(St);const Rt=l.get("run")??((be=fe.recent_runs[0])==null?void 0:be.run_id)??null;return Rt?Do(Rt).then(A):null}).catch(fe=>B(fe.message)).finally(()=>I(!1)));b.useEffect(()=>{K()},[]),b.useEffect(()=>{let fe=!1;const Le=()=>{Qx().then(Xe=>{fe||S(Xe)}).catch(Xe=>{fe||S({verified:!1,error:Xe instanceof Error?Xe.message:String(Xe)})})},Ee=window.setInterval(Le,6e4),Bt=()=>Le();return window.addEventListener("focus",Bt),()=>{fe=!0,window.clearInterval(Ee),window.removeEventListener("focus",Bt)}},[]),b.useEffect(()=>{var fe,Le;!H||!E||((fe=X.current)==null||fe.scrollIntoView({behavior:"smooth",block:"start"}),(Le=X.current)==null||Le.focus({preventScroll:!0}),D(!1))},[E,H]),b.useEffect(()=>{if(!(E!=null&&E.workflow_revision_kref)){F(null);return}let fe=!1;return F(null),x0(E.workflow_revision_kref).then(Le=>{fe||F(Le)}).catch(()=>{fe||F(null)}),()=>{fe=!0}},[E==null?void 0:E.workflow_revision_kref]);const Q=b.useMemo(()=>{if(!d||!E)return null;if(O)return O;const fe=E.workflow_name.toLowerCase();return d.definitions.find(Le=>Le.name.toLowerCase()===fe)??null},[d,O,E]),V=b.useMemo(()=>Q?Ho(Q.definition):[],[Q]),R=b.useMemo(()=>E?Object.fromEntries(E.steps.map(fe=>[fe.step_id,ea(fe)])):{},[E]),q=b.useMemo(()=>L&&E?E.steps.find(fe=>fe.step_id===L.id)??null:null,[E,L]),W=b.useMemo(()=>{const fe={pending:0,running:0,completed:0,failed:0,skipped:0};if(!E)return fe;for(const Le of E.steps){const Ee=ea(Le).status;fe[Ee]+=1}return fe},[E]),te=b.useMemo(()=>$H({tasks:V,stepResults:R}),[V,R]),J=b.useMemo(()=>(E==null?void 0:E.steps.filter(fe=>ea(fe).status==="failed"))??[],[E]),G=b.useMemo(()=>(E==null?void 0:E.steps.filter(fe=>ea(fe).status==="running"))??[],[E]),re=b.useMemo(()=>V.filter(fe=>te.includes(fe.id)),[te,V]),ne=b.useMemo(()=>[...J.map(fe=>V.find(Le=>Le.id===fe.step_id)??null).filter(fe=>fe!==null),...G.map(fe=>V.find(Le=>Le.id===fe.step_id)??null).filter(fe=>fe!==null).filter(fe=>!J.some(Le=>Le.step_id===fe.id)),...re.filter(fe=>!J.some(Le=>Le.step_id===fe.id))],[re,J,G,V]);b.useEffect(()=>{E&&u(fe=>{const Le=new URLSearchParams(fe);return Le.set("run",E.run_id),L!=null&&L.id?Le.set("node",L.id):Le.delete("node"),Le},{replace:!0})},[E==null?void 0:E.run_id,L==null?void 0:L.id,u]),b.useEffect(()=>{const fe=l.get("node");if(!fe){$(null);return}$(V.find(Le=>Le.id===fe)??null)},[l,V]);const le=b.useMemo(()=>w.filter(fe=>fe.status==="active").length,[w]),oe=b.useMemo(()=>C.filter(fe=>fe.status==="active").length,[C]),ie=b.useMemo(()=>Object.values((f==null?void 0:f.health.components)??{}).filter(fe=>fe.status!=="healthy"&&fe.status!=="ok").length,[f==null?void 0:f.health.components]),he=b.useMemo(()=>o?{"--revka-dashboard-scene-image":`url("${o.replace(/"/g,"%22")}")`}:void 0,[o]),Z=b.useMemo(()=>{var fe,Le;return z||((fe=E==null?void 0:E.status)==null?void 0:fe.toLowerCase())==="failed"?"danger":ie>0?"warn":((Le=E==null?void 0:E.status)==null?void 0:Le.toLowerCase())==="running"?"live":"steady"},[ie,z,E==null?void 0:E.status]),de=b.useMemo(()=>{if(z)return e("dashboard.scene.error");if(E){const fe=E.steps_total||E.steps.length||"?",Le=E.steps_completed||0,Ee=E.steps.filter(Bt=>ea(Bt).status==="failed").length;return Ee>0?n("dashboard.scene.run_failed",{workflow:E.workflow_name,failed:Ee,completed:Le,total:fe}):n("dashboard.scene.selected_run",{workflow:E.workflow_name,status:E.status,completed:Le,total:fe})}return((d==null?void 0:d.active_runs)??0)>0?n("dashboard.scene.active_overview",{active:(d==null?void 0:d.active_runs)??0,definitions:(d==null?void 0:d.definitions_count)??0}):n("dashboard.scene.idle_overview",{definitions:(d==null?void 0:d.definitions_count)??0,total:(d==null?void 0:d.total_runs)??0})},[d==null?void 0:d.active_runs,d==null?void 0:d.definitions_count,d==null?void 0:d.total_runs,z,E,e,n]);b.useEffect(()=>{const fe=Le=>{if(Le.metaKey||Le.ctrlKey||Le.altKey)return;const Ee=Le.target;if(Ee&&["INPUT","TEXTAREA","SELECT"].includes(Ee.tagName)||ne.length===0)return;const Bt=ne.findIndex(Xe=>Xe.id===(L==null?void 0:L.id));if(Le.key==="j"){Le.preventDefault();const Xe=Bt>=0?(Bt+1)%ne.length:0;$(ne[Xe]??null)}if(Le.key==="k"){Le.preventDefault();const Xe=Bt>=0?(Bt-1+ne.length)%ne.length:ne.length-1;$(ne[Xe]??null)}};return window.addEventListener("keydown",fe),()=>window.removeEventListener("keydown",fe)},[L==null?void 0:L.id,ne]);const ue=fe=>{$(V.find(Le=>Le.id===fe)??null)},pe=()=>{const fe=ne.findIndex(Ee=>Ee.id===(L==null?void 0:L.id)),Le=fe>=0?(fe-1+ne.length)%ne.length:ne.length-1;$(ne[Le]??null)},Oe=()=>{const fe=ne.findIndex(Ee=>Ee.id===(L==null?void 0:L.id)),Le=fe>=0?(fe+1)%ne.length:0;$(ne[Le]??null)};return c.jsxs("div",{className:"flex min-h-[calc(100vh-6rem)] flex-col gap-3 lg:h-[calc(100vh-6rem)]",children:[c.jsx(oi,{kicker:e("dashboard.kicker"),title:e("nav.dashboard"),actions:c.jsxs("button",{type:"button",className:"revka-button",onClick:()=>void K(),disabled:U,children:[c.jsx($r,{className:`h-4 w-4 ${U?"animate-spin":""}`}),e("common.refresh")]})}),o?c.jsx(qe,{className:"revka-dashboard-showcase overflow-hidden p-0",variant:"utility",children:c.jsx("div",{className:"revka-dashboard-scene",style:he,children:c.jsx(Fpe,{avatarUrl:a,message:de,speaker:e("dashboard.scene.operator"),tone:Z})})}):null,c.jsxs("div",{className:"grid gap-4 grid-cols-1 lg:min-h-0 lg:flex-1 lg:grid-cols-[minmax(0,1fr)_24rem] lg:[grid-template-rows:minmax(0,1fr)]",children:[c.jsxs(qe,{className:"flex flex-col p-5 lg:min-h-0",children:[c.jsxs("div",{className:"flex items-center justify-between gap-3",children:[c.jsxs("div",{children:[c.jsx("div",{className:"revka-kicker",children:e("dashboard.live_orchestration_pane")}),c.jsx("h3",{className:"mt-2 text-lg font-semibold",children:E?`${E.workflow_name} / ${E.run_id.slice(0,8)}`:e("dashboard.active_workflow_posture")})]}),c.jsx(N0,{className:"h-5 w-5",style:{color:"var(--revka-signal-network)"}})]}),c.jsx(Lpe,{definitionsCount:d==null?void 0:d.definitions_count,activeRuns:d==null?void 0:d.active_runs,totalRuns:d==null?void 0:d.total_runs,error:z}),Q?c.jsx("div",{className:"mt-3",children:c.jsx(Ss,{to:`/workflows?workflow=${encodeURIComponent(Q.kref)}${L?`&node=${encodeURIComponent(L.id)}`:""}`,className:"inline-flex items-center gap-2 text-sm",style:{color:"var(--revka-signal-network)"},children:e("dashboard.open_workflow_definition")})}):null,c.jsx(Y7,{run:E,active:H,label:e("dashboard.selected_run")}),c.jsxs("div",{ref:X,tabIndex:-1,className:"mt-6 grid gap-4 outline-none lg:min-h-0 lg:flex-1 lg:grid-cols-[minmax(0,1fr)_22rem] lg:[grid-template-rows:minmax(0,1fr)]",children:[c.jsx("div",{className:"flex min-h-0 flex-col",children:c.jsx(aT,{fill:!0,definition:(Q==null?void 0:Q.definition)??"",stepResults:R,onSelectTask:$,selectedTaskId:L==null?void 0:L.id,blockedTaskIds:te,failingTaskIds:J.map(fe=>fe.step_id),runningTaskIds:G.map(fe=>fe.step_id),overlay:E?c.jsxs("div",{className:"space-y-2",children:[c.jsx(Qc,{title:e("dashboard.run_posture"),children:c.jsxs("div",{className:"grid gap-2 sm:grid-cols-2 xl:grid-cols-5",children:[c.jsx(Lo,{label:e("dashboard.count.running"),value:W.running,tone:"var(--revka-signal-live)",compact:!0,assetSlot:"statusRunningBadge"}),c.jsx(Lo,{label:e("dashboard.count.failed"),value:W.failed,tone:"var(--revka-status-danger)",compact:!0,assetSlot:"statusFailedBadge"}),c.jsx(Lo,{label:e("dashboard.count.completed"),value:W.completed,tone:"var(--revka-status-success)",compact:!0,assetSlot:"statusSuccessBadge"}),c.jsx(Lo,{label:e("dashboard.count.pending"),value:W.pending,tone:"var(--revka-text-faint)",compact:!0,assetSlot:"statusPendingBadge"}),c.jsx(Lo,{label:e("dashboard.count.skipped"),value:W.skipped,tone:"var(--revka-status-idle)",compact:!0,assetSlot:"statusSkippedBadge"})]})}),ne.length>0?c.jsx(Qc,{title:e("dashboard.signal_focus"),children:c.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[c.jsx(xb,{label:e("dashboard.prev_signal"),hint:"K",onClick:pe}),c.jsx(xb,{label:e("dashboard.next_signal"),hint:"J",onClick:Oe}),c.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-[0.12em]",style:{color:"var(--revka-text-faint)"},children:n("dashboard.intervention_points",{count:ne.length})})]})}):null,J.length>0||G.length>0||re.length>0?c.jsx(Qc,{title:e("dashboard.hotspots"),children:c.jsxs("div",{className:"flex flex-wrap gap-2",children:[J.slice(0,3).map(fe=>c.jsx(bf,{label:n("dashboard.label.failure",{id:fe.step_id}),tone:"var(--revka-status-danger)",onClick:()=>ue(fe.step_id)},fe.step_id)),G.slice(0,2).map(fe=>c.jsx(bf,{label:n("dashboard.label.running",{id:fe.step_id}),tone:"var(--revka-signal-live)",onClick:()=>ue(fe.step_id)},fe.step_id)),re.slice(0,3).map(fe=>c.jsx(bf,{label:n("dashboard.label.blocked",{id:fe.id}),tone:"var(--revka-status-warning)",onClick:()=>ue(fe.id)},fe.id))]})}):null]}):void 0})}),c.jsxs("div",{className:"space-y-4 lg:min-h-0 lg:overflow-y-auto lg:pr-1",children:[c.jsx(Kpe,{run:E,workflowHref:Q?`/workflows?workflow=${encodeURIComponent(Q.kref)}${L?`&node=${encodeURIComponent(L.id)}`:""}`:void 0}),E?c.jsx("div",{className:"px-1",children:c.jsx(Ss,{to:`/runs?run=${encodeURIComponent(E.run_id)}&workflow=${encodeURIComponent(E.workflow_name)}${L?`&node=${encodeURIComponent(L.id)}`:""}`,className:"inline-flex items-center gap-2 text-sm",style:{color:"var(--revka-signal-network)"},children:e("dashboard.open_full_run_workspace")})}):null,c.jsx(V7,{title:e("dashboard.selected_step"),task:L,step:q,footer:L&&E?c.jsxs("div",{className:"flex flex-wrap gap-3 text-xs",children:[c.jsx(Ss,{to:`/runs?run=${encodeURIComponent(E.run_id)}&workflow=${encodeURIComponent(E.workflow_name)}&node=${encodeURIComponent(L.id)}`,style:{color:"var(--revka-signal-network)"},children:e("dashboard.inspect_node_in_runs")}),Q?c.jsx(Ss,{to:`/workflows?workflow=${encodeURIComponent(Q.kref)}&node=${encodeURIComponent(L.id)}`,style:{color:"var(--revka-signal-network)"},children:e("dashboard.open_definition_node")}):null]}):void 0,emptyText:e("dashboard.select_dag_node")}),c.jsxs(qe,{className:"p-4",variant:"utility",skinSlot:"timeline",children:[c.jsx("div",{className:"revka-kicker",children:e("dashboard.priority_timeline")}),c.jsx("div",{className:"mt-3 space-y-2",children:(E==null?void 0:E.steps.map(fe=>c.jsxs("button",{type:"button",onClick:()=>ue(fe.step_id),className:"block w-full rounded-[8px] border p-3 text-left",style:{borderColor:(L==null?void 0:L.id)===fe.step_id?"var(--revka-border-strong)":"var(--revka-border-soft)"},children:[c.jsxs("div",{className:"flex items-center justify-between gap-2",children:[c.jsx("span",{className:"truncate text-sm font-medium",style:{color:"var(--revka-text-primary)"},children:fe.step_id}),c.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-[0.14em]",style:{color:ea(fe).status==="failed"?"var(--revka-status-danger)":ea(fe).status==="running"?"var(--revka-signal-live)":te.includes(fe.step_id)?"var(--revka-status-warning)":"var(--revka-text-faint)"},children:te.includes(fe.step_id)&&ea(fe).status==="pending"?e("dashboard.status.blocked"):ea(fe).status})]}),fe.output_preview?c.jsx("div",{className:"mt-2 line-clamp-2 text-xs",style:{color:"var(--revka-text-secondary)"},children:fe.output_preview}):null]},fe.step_id)))??c.jsx("div",{className:"text-sm",style:{color:"var(--revka-text-faint)"},children:e("dashboard.no_run_selected")})})]})]})]})]}),c.jsxs("div",{className:"flex flex-col gap-4 lg:max-h-[calc(100vh-9rem)] lg:min-h-0 lg:overflow-y-auto lg:pr-1 [&>*]:shrink-0",children:[c.jsx(zpe,{audit:v,cost:_,degradedComponentCount:ie}),c.jsx(Bpe,{sessions:w,channels:C,activeSessionCount:le,activeChannelCount:oe}),c.jsx(Ipe,{selectedRunStatus:E==null?void 0:E.status,audit:v,provider:f==null?void 0:f.provider,model:f==null?void 0:f.model}),c.jsx($pe,{runs:(d==null?void 0:d.recent_runs)??[],selectedRunId:E==null?void 0:E.run_id,onSelectRun:fe=>{$(null),D(!0),Do(fe).then(A).catch(Le=>B(Le.message))},footer:c.jsx(Ss,{to:"/runs",className:"inline-flex items-center gap-2 text-sm",style:{color:"var(--revka-signal-network)"},children:e("dashboard.open_all_runs")})})]})]})]})}function Zj(){return Zj=Object.assign?Object.assign.bind():function(e){for(var n=1;n<arguments.length;n++){var r=arguments[n];for(var i in r)({}).hasOwnProperty.call(r,i)&&(e[i]=r[i])}return e},Zj.apply(null,arguments)}function k0e(e,n){if(e==null)return{};var r={};for(var i in e)if({}.hasOwnProperty.call(e,i)){if(n.indexOf(i)!==-1)continue;r[i]=e[i]}return r}let Jj=[],UH=[];(()=>{let e="lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,3b,f,,w,1j,,,,4,8,4,,3,7,a,2,t,,1m,,,,2,4,8,,9,,a,2,q,,2,2,1l,,4,2,4,2,2,3,3,,u,2,3,,b,2,1l,,4,5,,2,4,,k,2,m,6,,,1m,,,2,,4,8,,7,3,a,2,u,,1n,,,,c,,9,,14,,3,,1l,3,5,3,,4,7,2,b,2,t,,1m,,2,,2,,3,,5,2,7,2,b,2,s,2,1l,2,,,2,4,8,,9,,a,2,t,,20,,4,,2,3,,,8,,29,,2,7,c,8,2q,,2,9,b,6,22,2,r,,,,,,1j,e,,5,,2,5,b,,10,9,,2u,4,,6,,2,2,2,p,2,4,3,g,4,d,,2,2,6,,f,,jj,3,qa,3,t,3,t,2,u,2,1s,2,,7,8,,2,b,9,,19,3,3b,2,y,,3a,3,4,2,9,,6,3,63,2,2,,1m,,,7,,,,,2,8,6,a,2,,1c,h,1r,4,1c,7,,,5,,14,9,c,2,w,4,2,2,,3,1k,,,2,3,,,3,1m,8,2,2,48,3,,d,,7,4,,6,,3,2,5i,1m,,5,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,p,2,5,,47,2,q,i,d,,12,8,p,b,1a,3,1c,,2,4,2,2,13,,1v,6,2,2,2,2,c,,8,,1b,,1f,,,3,2,2,5,2,,,16,2,8,,6m,,2,,4,,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,ar,2,49,b,4w,,1i,f,1k,3,1d,4,2,2,1x,3,10,5,,8,1q,,c,2,1g,9,a,4,2,,2n,3,2,,,2,6,,4g,,3,8,l,2,1l,2,,,,,m,,e,7,3,5,5f,8,2,3,,,n,,29,,2,6,,,2,,,2,,2,6j,,2,4,6,2,,2,r,2,2d,8,2,,,2,2y,,,,2,6,,,2t,3,2,4,,5,77,9,,2,6t,,a,2,,,4,,40,4,2,2,4,,w,a,14,6,2,4,8,,9,6,2,3,1a,d,,2,ba,7,,6,,,2a,m,2,7,,2,,2,3e,6,3,,,2,,7,,,20,2,3,,,,9n,2,f0b,5,1n,7,t4,,1r,4,29,,f5k,2,43q,,,3,4,5,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,79,7,c5,4,15s,7,31,7,240,5,gx7k,2o,3k,6o".split(",").map(n=>n?parseInt(n,36):1);for(let n=0,r=0;n<e.length;n++)(n%2?UH:Jj).push(r=r+e[n])})();function w0e(e){if(e<768)return!1;for(let n=0,r=Jj.length;;){let i=n+r>>1;if(e<Jj[i])r=i;else if(e>=UH[i])n=i+1;else return!0;if(n==r)return!1}}function tL(e){return e>=127462&&e<=127487}const nL=8205;function S0e(e,n,r=!0,i=!0){return(r?KH:C0e)(e,n,i)}function KH(e,n,r){if(n==e.length)return n;n&&VH(e.charCodeAt(n))&&YH(e.charCodeAt(n-1))&&n--;let i=BS(e,n);for(n+=rL(i);n<e.length;){let s=BS(e,n);if(i==nL||s==nL||r&&w0e(s))n+=rL(s),i=s;else if(tL(s)){let a=0,o=n-2;for(;o>=0&&tL(BS(e,o));)a++,o-=2;if(a%2==0)break;n+=2}else break}return n}function C0e(e,n,r){for(;n>0;){let i=KH(e,n-2,r);if(i<n)return i;n--}return 0}function BS(e,n){let r=e.charCodeAt(n);if(!YH(r)||n+1==e.length)return r;let i=e.charCodeAt(n+1);return VH(i)?(r-55296<<10)+(i-56320)+65536:r}function VH(e){return e>=56320&&e<57344}function YH(e){return e>=55296&&e<56320}function rL(e){return e<65536?1:2}let Dn=class GH{lineAt(n){if(n<0||n>this.length)throw new RangeError(`Invalid position ${n} in document of length ${this.length}`);return this.lineInner(n,!1,1,0)}line(n){if(n<1||n>this.lines)throw new RangeError(`Invalid line number ${n} in ${this.lines}-line document`);return this.lineInner(n,!0,1,0)}replace(n,r,i){[n,r]=Yf(this,n,r);let s=[];return this.decompose(0,n,s,2),i.length&&i.decompose(0,i.length,s,3),this.decompose(r,this.length,s,1),Io.from(s,this.length-(r-n)+i.length)}append(n){return this.replace(this.length,this.length,n)}slice(n,r=this.length){[n,r]=Yf(this,n,r);let i=[];return this.decompose(n,r,i,0),Io.from(i,r-n)}eq(n){if(n==this)return!0;if(n.length!=this.length||n.lines!=this.lines)return!1;let r=this.scanIdentical(n,1),i=this.length-this.scanIdentical(n,-1),s=new pg(this),a=new pg(n);for(let o=r,l=r;;){if(s.next(o),a.next(o),o=0,s.lineBreak!=a.lineBreak||s.done!=a.done||s.value!=a.value)return!1;if(l+=s.value.length,s.done||l>=i)return!0}}iter(n=1){return new pg(this,n)}iterRange(n,r=this.length){return new XH(this,n,r)}iterLines(n,r){let i;if(n==null)i=this.iter();else{r==null&&(r=this.lines+1);let s=this.line(n).from;i=this.iterRange(s,Math.max(s,r==this.lines+1?this.length:r<=1?0:this.line(r-1).to))}return new QH(i)}toString(){return this.sliceString(0)}toJSON(){let n=[];return this.flatten(n),n}constructor(){}static of(n){if(n.length==0)throw new RangeError("A document must have at least one line");return n.length==1&&!n[0]?GH.empty:n.length<=32?new Br(n):Io.from(Br.split(n,[]))}};class Br extends Dn{constructor(n,r=j0e(n)){super(),this.text=n,this.length=r}get lines(){return this.text.length}get children(){return null}lineInner(n,r,i,s){for(let a=0;;a++){let o=this.text[a],l=s+o.length;if((r?i:l)>=n)return new N0e(s,l,i,o);s=l+1,i++}}decompose(n,r,i,s){let a=n<=0&&r>=this.length?this:new Br(iL(this.text,n,r),Math.min(r,this.length)-Math.max(0,n));if(s&1){let o=i.pop(),l=Ox(a.text,o.text.slice(),0,a.length);if(l.length<=32)i.push(new Br(l,o.length+a.length));else{let u=l.length>>1;i.push(new Br(l.slice(0,u)),new Br(l.slice(u)))}}else i.push(a)}replace(n,r,i){if(!(i instanceof Br))return super.replace(n,r,i);[n,r]=Yf(this,n,r);let s=Ox(this.text,Ox(i.text,iL(this.text,0,n)),r),a=this.length+i.length-(r-n);return s.length<=32?new Br(s,a):Io.from(Br.split(s,[]),a)}sliceString(n,r=this.length,i=`
`){[n,r]=Yf(this,n,r);let s="";for(let a=0,o=0;a<=r&&o<this.text.length;o++){let l=this.text[o],u=a+l.length;a>n&&o&&(s+=i),n<u&&r>a&&(s+=l.slice(Math.max(0,n-a),r-a)),a=u+1}return s}flatten(n){for(let r of this.text)n.push(r)}scanIdentical(){return 0}static split(n,r){let i=[],s=-1;for(let a of n)i.push(a),s+=a.length+1,i.length==32&&(r.push(new Br(i,s)),i=[],s=-1);return s>-1&&r.push(new Br(i,s)),r}}class Io extends Dn{constructor(n,r){super(),this.children=n,this.length=r,this.lines=0;for(let i of n)this.lines+=i.lines}lineInner(n,r,i,s){for(let a=0;;a++){let o=this.children[a],l=s+o.length,u=i+o.lines-1;if((r?u:l)>=n)return o.lineInner(n,r,i,s);s=l+1,i=u+1}}decompose(n,r,i,s){for(let a=0,o=0;o<=r&&a<this.children.length;a++){let l=this.children[a],u=o+l.length;if(n<=u&&r>=o){let d=s&((o<=n?1:0)|(u>=r?2:0));o>=n&&u<=r&&!d?i.push(l):l.decompose(n-o,r-o,i,d)}o=u+1}}replace(n,r,i){if([n,r]=Yf(this,n,r),i.lines<this.lines)for(let s=0,a=0;s<this.children.length;s++){let o=this.children[s],l=a+o.length;if(n>=a&&r<=l){let u=o.replace(n-a,r-a,i),d=this.lines-o.lines+u.lines;if(u.lines<d>>4&&u.lines>d>>6){let p=this.children.slice();return p[s]=u,new Io(p,this.length-(r-n)+i.length)}return super.replace(a,l,u)}a=l+1}return super.replace(n,r,i)}sliceString(n,r=this.length,i=`
`){[n,r]=Yf(this,n,r);let s="";for(let a=0,o=0;a<this.children.length&&o<=r;a++){let l=this.children[a],u=o+l.length;o>n&&a&&(s+=i),n<u&&r>o&&(s+=l.sliceString(n-o,r-o,i)),o=u+1}return s}flatten(n){for(let r of this.children)r.flatten(n)}scanIdentical(n,r){if(!(n instanceof Io))return 0;let i=0,[s,a,o,l]=r>0?[0,0,this.children.length,n.children.length]:[this.children.length-1,n.children.length-1,-1,-1];for(;;s+=r,a+=r){if(s==o||a==l)return i;let u=this.children[s],d=n.children[a];if(u!=d)return i+u.scanIdentical(d,r);i+=u.length+1}}static from(n,r=n.reduce((i,s)=>i+s.length+1,-1)){let i=0;for(let _ of n)i+=_.lines;if(i<32){let _=[];for(let x of n)x.flatten(_);return new Br(_,r)}let s=Math.max(32,i>>5),a=s<<1,o=s>>1,l=[],u=0,d=-1,p=[];function f(_){let x;if(_.lines>a&&_ instanceof Io)for(let v of _.children)f(v);else _.lines>o&&(u>o||!u)?(g(),l.push(_)):_ instanceof Br&&u&&(x=p[p.length-1])instanceof Br&&_.lines+x.lines<=32?(u+=_.lines,d+=_.length+1,p[p.length-1]=new Br(x.text.concat(_.text),x.length+1+_.length)):(u+_.lines>s&&g(),u+=_.lines,d+=_.length+1,p.push(_))}function g(){u!=0&&(l.push(p.length==1?p[0]:Io.from(p,d)),d=-1,u=p.length=0)}for(let _ of n)f(_);return g(),l.length==1?l[0]:new Io(l,r)}}Dn.empty=new Br([""],0);function j0e(e){let n=-1;for(let r of e)n+=r.length+1;return n}function Ox(e,n,r=0,i=1e9){for(let s=0,a=0,o=!0;a<e.length&&s<=i;a++){let l=e[a],u=s+l.length;u>=r&&(u>i&&(l=l.slice(0,i-s)),s<r&&(l=l.slice(r-s)),o?(n[n.length-1]+=l,o=!1):n.push(l)),s=u+1}return n}function iL(e,n,r){return Ox(e,[""],n,r)}class pg{constructor(n,r=1){this.dir=r,this.done=!1,this.lineBreak=!1,this.value="",this.nodes=[n],this.offsets=[r>0?1:(n instanceof Br?n.text.length:n.children.length)<<1]}nextInner(n,r){for(this.done=this.lineBreak=!1;;){let i=this.nodes.length-1,s=this.nodes[i],a=this.offsets[i],o=a>>1,l=s instanceof Br?s.text.length:s.children.length;if(o==(r>0?l:0)){if(i==0)return this.done=!0,this.value="",this;r>0&&this.offsets[i-1]++,this.nodes.pop(),this.offsets.pop()}else if((a&1)==(r>0?0:1)){if(this.offsets[i]+=r,n==0)return this.lineBreak=!0,this.value=`
`,this;n--}else if(s instanceof Br){let u=s.text[o+(r<0?-1:0)];if(this.offsets[i]+=r,u.length>Math.max(0,n))return this.value=n==0?u:r>0?u.slice(n):u.slice(0,u.length-n),this;n-=u.length}else{let u=s.children[o+(r<0?-1:0)];n>u.length?(n-=u.length,this.offsets[i]+=r):(r<0&&this.offsets[i]--,this.nodes.push(u),this.offsets.push(r>0?1:(u instanceof Br?u.text.length:u.children.length)<<1))}}}next(n=0){return n<0&&(this.nextInner(-n,-this.dir),n=this.value.length),this.nextInner(n,this.dir)}}class XH{constructor(n,r,i){this.value="",this.done=!1,this.cursor=new pg(n,r>i?-1:1),this.pos=r>i?n.length:0,this.from=Math.min(r,i),this.to=Math.max(r,i)}nextInner(n,r){if(r<0?this.pos<=this.from:this.pos>=this.to)return this.value="",this.done=!0,this;n+=Math.max(0,r<0?this.pos-this.to:this.from-this.pos);let i=r<0?this.pos-this.from:this.to-this.pos;n>i&&(n=i),i-=n;let{value:s}=this.cursor.next(n);return this.pos+=(s.length+n)*r,this.value=s.length<=i?s:r<0?s.slice(s.length-i):s.slice(0,i),this.done=!this.value,this}next(n=0){return n<0?n=Math.max(n,this.from-this.pos):n>0&&(n=Math.min(n,this.to-this.pos)),this.nextInner(n,this.cursor.dir)}get lineBreak(){return this.cursor.lineBreak&&this.value!=""}}class QH{constructor(n){this.inner=n,this.afterBreak=!0,this.value="",this.done=!1}next(n=0){let{done:r,lineBreak:i,value:s}=this.inner.next(n);return r&&this.afterBreak?(this.value="",this.afterBreak=!1):r?(this.done=!0,this.value=""):i?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=s,this.afterBreak=!1),this}get lineBreak(){return!1}}typeof Symbol<"u"&&(Dn.prototype[Symbol.iterator]=function(){return this.iter()},pg.prototype[Symbol.iterator]=XH.prototype[Symbol.iterator]=QH.prototype[Symbol.iterator]=function(){return this});class N0e{constructor(n,r,i,s){this.from=n,this.to=r,this.number=i,this.text=s}get length(){return this.to-this.from}}function Yf(e,n,r){return n=Math.max(0,Math.min(e.length,n)),[n,Math.max(n,Math.min(e.length,r))]}function gi(e,n,r=!0,i=!0){return S0e(e,n,r,i)}function E0e(e){return e>=56320&&e<57344}function A0e(e){return e>=55296&&e<56320}function ks(e,n){let r=e.charCodeAt(n);if(!A0e(r)||n+1==e.length)return r;let i=e.charCodeAt(n+1);return E0e(i)?(r-55296<<10)+(i-56320)+65536:r}function oT(e){return e<=65535?String.fromCharCode(e):(e-=65536,String.fromCharCode((e>>10)+55296,(e&1023)+56320))}function Bo(e){return e<65536?1:2}const eN=/\r\n?|\n/;var rs=(function(e){return e[e.Simple=0]="Simple",e[e.TrackDel=1]="TrackDel",e[e.TrackBefore=2]="TrackBefore",e[e.TrackAfter=3]="TrackAfter",e})(rs||(rs={}));class Zo{constructor(n){this.sections=n}get length(){let n=0;for(let r=0;r<this.sections.length;r+=2)n+=this.sections[r];return n}get newLength(){let n=0;for(let r=0;r<this.sections.length;r+=2){let i=this.sections[r+1];n+=i<0?this.sections[r]:i}return n}get empty(){return this.sections.length==0||this.sections.length==2&&this.sections[1]<0}iterGaps(n){for(let r=0,i=0,s=0;r<this.sections.length;){let a=this.sections[r++],o=this.sections[r++];o<0?(n(i,s,a),s+=a):s+=o,i+=a}}iterChangedRanges(n,r=!1){tN(this,n,r)}get invertedDesc(){let n=[];for(let r=0;r<this.sections.length;){let i=this.sections[r++],s=this.sections[r++];s<0?n.push(i,s):n.push(s,i)}return new Zo(n)}composeDesc(n){return this.empty?n:n.empty?this:ZH(this,n)}mapDesc(n,r=!1){return n.empty?this:nN(this,n,r)}mapPos(n,r=-1,i=rs.Simple){let s=0,a=0;for(let o=0;o<this.sections.length;){let l=this.sections[o++],u=this.sections[o++],d=s+l;if(u<0){if(d>n)return a+(n-s);a+=l}else{if(i!=rs.Simple&&d>=n&&(i==rs.TrackDel&&s<n&&d>n||i==rs.TrackBefore&&s<n||i==rs.TrackAfter&&d>n))return null;if(d>n||d==n&&r<0&&!l)return n==s||r<0?a:a+u;a+=u}s=d}if(n>s)throw new RangeError(`Position ${n} is out of range for changeset of length ${s}`);return a}touchesRange(n,r=n){for(let i=0,s=0;i<this.sections.length&&s<=r;){let a=this.sections[i++],o=this.sections[i++],l=s+a;if(o>=0&&s<=r&&l>=n)return s<n&&l>r?"cover":!0;s=l}return!1}toString(){let n="";for(let r=0;r<this.sections.length;){let i=this.sections[r++],s=this.sections[r++];n+=(n?" ":"")+i+(s>=0?":"+s:"")}return n}toJSON(){return this.sections}static fromJSON(n){if(!Array.isArray(n)||n.length%2||n.some(r=>typeof r!="number"))throw new RangeError("Invalid JSON representation of ChangeDesc");return new Zo(n)}static create(n){return new Zo(n)}}class ri extends Zo{constructor(n,r){super(n),this.inserted=r}apply(n){if(this.length!=n.length)throw new RangeError("Applying change set to a document with the wrong length");return tN(this,(r,i,s,a,o)=>n=n.replace(s,s+(i-r),o),!1),n}mapDesc(n,r=!1){return nN(this,n,r,!0)}invert(n){let r=this.sections.slice(),i=[];for(let s=0,a=0;s<r.length;s+=2){let o=r[s],l=r[s+1];if(l>=0){r[s]=l,r[s+1]=o;let u=s>>1;for(;i.length<u;)i.push(Dn.empty);i.push(o?n.slice(a,a+o):Dn.empty)}a+=o}return new ri(r,i)}compose(n){return this.empty?n:n.empty?this:ZH(this,n,!0)}map(n,r=!1){return n.empty?this:nN(this,n,r,!0)}iterChanges(n,r=!1){tN(this,n,r)}get desc(){return Zo.create(this.sections)}filter(n){let r=[],i=[],s=[],a=new Gg(this);e:for(let o=0,l=0;;){let u=o==n.length?1e9:n[o++];for(;l<u||l==u&&a.len==0;){if(a.done)break e;let p=Math.min(a.len,u-l);Wi(s,p,-1);let f=a.ins==-1?-1:a.off==0?a.ins:0;Wi(r,p,f),f>0&&eu(i,r,a.text),a.forward(p),l+=p}let d=n[o++];for(;l<d;){if(a.done)break e;let p=Math.min(a.len,d-l);Wi(r,p,-1),Wi(s,p,a.ins==-1?-1:a.off==0?a.ins:0),a.forward(p),l+=p}}return{changes:new ri(r,i),filtered:Zo.create(s)}}toJSON(){let n=[];for(let r=0;r<this.sections.length;r+=2){let i=this.sections[r],s=this.sections[r+1];s<0?n.push(i):s==0?n.push([i]):n.push([i].concat(this.inserted[r>>1].toJSON()))}return n}static of(n,r,i){let s=[],a=[],o=0,l=null;function u(p=!1){if(!p&&!s.length)return;o<r&&Wi(s,r-o,-1);let f=new ri(s,a);l=l?l.compose(f.map(l)):f,s=[],a=[],o=0}function d(p){if(Array.isArray(p))for(let f of p)d(f);else if(p instanceof ri){if(p.length!=r)throw new RangeError(`Mismatched change set length (got ${p.length}, expected ${r})`);u(),l=l?l.compose(p.map(l)):p}else{let{from:f,to:g=f,insert:_}=p;if(f>g||f<0||g>r)throw new RangeError(`Invalid change range ${f} to ${g} (in doc of length ${r})`);let x=_?typeof _=="string"?Dn.of(_.split(i||eN)):_:Dn.empty,v=x.length;if(f==g&&v==0)return;f<o&&u(),f>o&&Wi(s,f-o,-1),Wi(s,g-f,v),eu(a,s,x),o=g}}return d(n),u(!l),l}static empty(n){return new ri(n?[n,-1]:[],[])}static fromJSON(n){if(!Array.isArray(n))throw new RangeError("Invalid JSON representation of ChangeSet");let r=[],i=[];for(let s=0;s<n.length;s++){let a=n[s];if(typeof a=="number")r.push(a,-1);else{if(!Array.isArray(a)||typeof a[0]!="number"||a.some((o,l)=>l&&typeof o!="string"))throw new RangeError("Invalid JSON representation of ChangeSet");if(a.length==1)r.push(a[0],0);else{for(;i.length<s;)i.push(Dn.empty);i[s]=Dn.of(a.slice(1)),r.push(a[0],i[s].length)}}}return new ri(r,i)}static createSet(n,r){return new ri(n,r)}}function Wi(e,n,r,i=!1){if(n==0&&r<=0)return;let s=e.length-2;s>=0&&r<=0&&r==e[s+1]?e[s]+=n:s>=0&&n==0&&e[s]==0?e[s+1]+=r:i?(e[s]+=n,e[s+1]+=r):e.push(n,r)}function eu(e,n,r){if(r.length==0)return;let i=n.length-2>>1;if(i<e.length)e[e.length-1]=e[e.length-1].append(r);else{for(;e.length<i;)e.push(Dn.empty);e.push(r)}}function tN(e,n,r){let i=e.inserted;for(let s=0,a=0,o=0;o<e.sections.length;){let l=e.sections[o++],u=e.sections[o++];if(u<0)s+=l,a+=l;else{let d=s,p=a,f=Dn.empty;for(;d+=l,p+=u,u&&i&&(f=f.append(i[o-2>>1])),!(r||o==e.sections.length||e.sections[o+1]<0);)l=e.sections[o++],u=e.sections[o++];n(s,d,a,p,f),s=d,a=p}}}function nN(e,n,r,i=!1){let s=[],a=i?[]:null,o=new Gg(e),l=new Gg(n);for(let u=-1;;){if(o.done&&l.len||l.done&&o.len)throw new Error("Mismatched change set lengths");if(o.ins==-1&&l.ins==-1){let d=Math.min(o.len,l.len);Wi(s,d,-1),o.forward(d),l.forward(d)}else if(l.ins>=0&&(o.ins<0||u==o.i||o.off==0&&(l.len<o.len||l.len==o.len&&!r))){let d=l.len;for(Wi(s,l.ins,-1);d;){let p=Math.min(o.len,d);o.ins>=0&&u<o.i&&o.len<=p&&(Wi(s,0,o.ins),a&&eu(a,s,o.text),u=o.i),o.forward(p),d-=p}l.next()}else if(o.ins>=0){let d=0,p=o.len;for(;p;)if(l.ins==-1){let f=Math.min(p,l.len);d+=f,p-=f,l.forward(f)}else if(l.ins==0&&l.len<p)p-=l.len,l.next();else break;Wi(s,d,u<o.i?o.ins:0),a&&u<o.i&&eu(a,s,o.text),u=o.i,o.forward(o.len-p)}else{if(o.done&&l.done)return a?ri.createSet(s,a):Zo.create(s);throw new Error("Mismatched change set lengths")}}}function ZH(e,n,r=!1){let i=[],s=r?[]:null,a=new Gg(e),o=new Gg(n);for(let l=!1;;){if(a.done&&o.done)return s?ri.createSet(i,s):Zo.create(i);if(a.ins==0)Wi(i,a.len,0,l),a.next();else if(o.len==0&&!o.done)Wi(i,0,o.ins,l),s&&eu(s,i,o.text),o.next();else{if(a.done||o.done)throw new Error("Mismatched change set lengths");{let u=Math.min(a.len2,o.len),d=i.length;if(a.ins==-1){let p=o.ins==-1?-1:o.off?0:o.ins;Wi(i,u,p,l),s&&p&&eu(s,i,o.text)}else o.ins==-1?(Wi(i,a.off?0:a.len,u,l),s&&eu(s,i,a.textBit(u))):(Wi(i,a.off?0:a.len,o.off?0:o.ins,l),s&&!o.off&&eu(s,i,o.text));l=(a.ins>u||o.ins>=0&&o.len>u)&&(l||i.length>d),a.forward2(u),o.forward(u)}}}}class Gg{constructor(n){this.set=n,this.i=0,this.next()}next(){let{sections:n}=this.set;this.i<n.length?(this.len=n[this.i++],this.ins=n[this.i++]):(this.len=0,this.ins=-2),this.off=0}get done(){return this.ins==-2}get len2(){return this.ins<0?this.len:this.ins}get text(){let{inserted:n}=this.set,r=this.i-2>>1;return r>=n.length?Dn.empty:n[r]}textBit(n){let{inserted:r}=this.set,i=this.i-2>>1;return i>=r.length&&!n?Dn.empty:r[i].slice(this.off,n==null?void 0:this.off+n)}forward(n){n==this.len?this.next():(this.len-=n,this.off+=n)}forward2(n){this.ins==-1?this.forward(n):n==this.ins?this.next():(this.ins-=n,this.off+=n)}}class vd{constructor(n,r,i){this.from=n,this.to=r,this.flags=i}get anchor(){return this.flags&32?this.to:this.from}get head(){return this.flags&32?this.from:this.to}get empty(){return this.from==this.to}get assoc(){return this.flags&8?-1:this.flags&16?1:0}get bidiLevel(){let n=this.flags&7;return n==7?null:n}get goalColumn(){let n=this.flags>>6;return n==16777215?void 0:n}map(n,r=-1){let i,s;return this.empty?i=s=n.mapPos(this.from,r):(i=n.mapPos(this.from,1),s=n.mapPos(this.to,-1)),i==this.from&&s==this.to?this:new vd(i,s,this.flags)}extend(n,r=n,i=0){if(n<=this.anchor&&r>=this.anchor)return Be.range(n,r,void 0,void 0,i);let s=Math.abs(n-this.anchor)>Math.abs(r-this.anchor)?n:r;return Be.range(this.anchor,s,void 0,void 0,i)}eq(n,r=!1){return this.anchor==n.anchor&&this.head==n.head&&this.goalColumn==n.goalColumn&&(!r||!this.empty||this.assoc==n.assoc)}toJSON(){return{anchor:this.anchor,head:this.head}}static fromJSON(n){if(!n||typeof n.anchor!="number"||typeof n.head!="number")throw new RangeError("Invalid JSON representation for SelectionRange");return Be.range(n.anchor,n.head)}static create(n,r,i){return new vd(n,r,i)}}class Be{constructor(n,r){this.ranges=n,this.mainIndex=r}map(n,r=-1){return n.empty?this:Be.create(this.ranges.map(i=>i.map(n,r)),this.mainIndex)}eq(n,r=!1){if(this.ranges.length!=n.ranges.length||this.mainIndex!=n.mainIndex)return!1;for(let i=0;i<this.ranges.length;i++)if(!this.ranges[i].eq(n.ranges[i],r))return!1;return!0}get main(){return this.ranges[this.mainIndex]}asSingle(){return this.ranges.length==1?this:new Be([this.main],0)}addRange(n,r=!0){return Be.create([n].concat(this.ranges),r?0:this.mainIndex+1)}replaceRange(n,r=this.mainIndex){let i=this.ranges.slice();return i[r]=n,Be.create(i,this.mainIndex)}toJSON(){return{ranges:this.ranges.map(n=>n.toJSON()),main:this.mainIndex}}static fromJSON(n){if(!n||!Array.isArray(n.ranges)||typeof n.main!="number"||n.main>=n.ranges.length)throw new RangeError("Invalid JSON representation for EditorSelection");return new Be(n.ranges.map(r=>vd.fromJSON(r)),n.main)}static single(n,r=n){return new Be([Be.range(n,r)],0)}static create(n,r=0){if(n.length==0)throw new RangeError("A selection needs at least one range");for(let i=0,s=0;s<n.length;s++){let a=n[s];if(a.empty?a.from<=i:a.from<i)return Be.normalized(n.slice(),r);i=a.to}return new Be(n,r)}static cursor(n,r=0,i,s){return vd.create(n,n,(r==0?0:r<0?8:16)|(i==null?7:Math.min(6,i))|(s??16777215)<<6)}static range(n,r,i,s,a){let o=(i??16777215)<<6|(s==null?7:Math.min(6,s));return!a&&n!=r&&(a=r<n?1:-1),r<n?vd.create(r,n,48|o):vd.create(n,r,(a?a<0?8:16:0)|o)}static normalized(n,r=0){let i=n[r];n.sort((s,a)=>s.from-a.from),r=n.indexOf(i);for(let s=1;s<n.length;s++){let a=n[s],o=n[s-1];if(a.empty?a.from<=o.to:a.from<o.to){let l=o.from,u=Math.max(a.to,o.to);s<=r&&r--,n.splice(--s,2,a.anchor>a.head?Be.range(u,l):Be.range(l,u))}}return new Be(n,r)}}function JH(e,n){for(let r of e.ranges)if(r.to>n)throw new RangeError("Selection points outside of document")}let lT=0;class pt{constructor(n,r,i,s,a){this.combine=n,this.compareInput=r,this.compare=i,this.isStatic=s,this.id=lT++,this.default=n([]),this.extensions=typeof a=="function"?a(this):a}get reader(){return this}static define(n={}){return new pt(n.combine||(r=>r),n.compareInput||((r,i)=>r===i),n.compare||(n.combine?(r,i)=>r===i:cT),!!n.static,n.enables)}of(n){return new Dx([],this,0,n)}compute(n,r){if(this.isStatic)throw new Error("Can't compute a static facet");return new Dx(n,this,1,r)}computeN(n,r){if(this.isStatic)throw new Error("Can't compute a static facet");return new Dx(n,this,2,r)}from(n,r){return r||(r=i=>i),this.compute([n],i=>r(i.field(n)))}}function cT(e,n){return e==n||e.length==n.length&&e.every((r,i)=>r===n[i])}class Dx{constructor(n,r,i,s){this.dependencies=n,this.facet=r,this.type=i,this.value=s,this.id=lT++}dynamicSlot(n){var r;let i=this.value,s=this.facet.compareInput,a=this.id,o=n[a]>>1,l=this.type==2,u=!1,d=!1,p=[];for(let f of this.dependencies)f=="doc"?u=!0:f=="selection"?d=!0:(((r=n[f.id])!==null&&r!==void 0?r:1)&1)==0&&p.push(n[f.id]);return{create(f){return f.values[o]=i(f),1},update(f,g){if(u&&g.docChanged||d&&(g.docChanged||g.selection)||rN(f,p)){let _=i(f);if(l?!sL(_,f.values[o],s):!s(_,f.values[o]))return f.values[o]=_,1}return 0},reconfigure:(f,g)=>{let _,x=g.config.address[a];if(x!=null){let v=Rb(g,x);if(this.dependencies.every(S=>S instanceof pt?g.facet(S)===f.facet(S):S instanceof _i?g.field(S,!1)==f.field(S,!1):!0)||(l?sL(_=i(f),v,s):s(_=i(f),v)))return f.values[o]=v,0}else _=i(f);return f.values[o]=_,1}}}}function sL(e,n,r){if(e.length!=n.length)return!1;for(let i=0;i<e.length;i++)if(!r(e[i],n[i]))return!1;return!0}function rN(e,n){let r=!1;for(let i of n)mg(e,i)&1&&(r=!0);return r}function T0e(e,n,r){let i=r.map(u=>e[u.id]),s=r.map(u=>u.type),a=i.filter(u=>!(u&1)),o=e[n.id]>>1;function l(u){let d=[];for(let p=0;p<i.length;p++){let f=Rb(u,i[p]);if(s[p]==2)for(let g of f)d.push(g);else d.push(f)}return n.combine(d)}return{create(u){for(let d of i)mg(u,d);return u.values[o]=l(u),1},update(u,d){if(!rN(u,a))return 0;let p=l(u);return n.compare(p,u.values[o])?0:(u.values[o]=p,1)},reconfigure(u,d){let p=rN(u,i),f=d.config.facets[n.id],g=d.facet(n);if(f&&!p&&cT(r,f))return u.values[o]=g,0;let _=l(u);return n.compare(_,g)?(u.values[o]=g,0):(u.values[o]=_,1)}}}const E_=pt.define({static:!0});class _i{constructor(n,r,i,s,a){this.id=n,this.createF=r,this.updateF=i,this.compareF=s,this.spec=a,this.provides=void 0}static define(n){let r=new _i(lT++,n.create,n.update,n.compare||((i,s)=>i===s),n);return n.provide&&(r.provides=n.provide(r)),r}create(n){let r=n.facet(E_).find(i=>i.field==this);return((r==null?void 0:r.create)||this.createF)(n)}slot(n){let r=n[this.id]>>1;return{create:i=>(i.values[r]=this.create(i),1),update:(i,s)=>{let a=i.values[r],o=this.updateF(a,s);return this.compareF(a,o)?0:(i.values[r]=o,1)},reconfigure:(i,s)=>{let a=i.facet(E_),o=s.facet(E_),l;return(l=a.find(u=>u.field==this))&&l!=o.find(u=>u.field==this)?(i.values[r]=l.create(i),1):s.config.address[this.id]!=null?(i.values[r]=s.field(this),0):(i.values[r]=this.create(i),1)}}}init(n){return[this,E_.of({field:this,create:n})]}get extension(){return this}}const ud={lowest:4,low:3,default:2,high:1,highest:0};function _m(e){return n=>new eW(n,e)}const Kd={highest:_m(ud.highest),high:_m(ud.high),default:_m(ud.default),low:_m(ud.low),lowest:_m(ud.lowest)};class eW{constructor(n,r){this.inner=n,this.prec=r}}class Z0{of(n){return new iN(this,n)}reconfigure(n){return Z0.reconfigure.of({compartment:this,extension:n})}get(n){return n.config.compartments.get(this)}}class iN{constructor(n,r){this.compartment=n,this.inner=r}}class Mb{constructor(n,r,i,s,a,o){for(this.base=n,this.compartments=r,this.dynamicSlots=i,this.address=s,this.staticValues=a,this.facets=o,this.statusTemplate=[];this.statusTemplate.length<i.length;)this.statusTemplate.push(0)}staticFacet(n){let r=this.address[n.id];return r==null?n.default:this.staticValues[r>>1]}static resolve(n,r,i){let s=[],a=Object.create(null),o=new Map;for(let g of M0e(n,r,o))g instanceof _i?s.push(g):(a[g.facet.id]||(a[g.facet.id]=[])).push(g);let l=Object.create(null),u=[],d=[];for(let g of s)l[g.id]=d.length<<1,d.push(_=>g.slot(_));let p=i==null?void 0:i.config.facets;for(let g in a){let _=a[g],x=_[0].facet,v=p&&p[g]||[];if(_.every(S=>S.type==0))if(l[x.id]=u.length<<1|1,cT(v,_))u.push(i.facet(x));else{let S=x.combine(_.map(w=>w.value));u.push(i&&x.compare(S,i.facet(x))?i.facet(x):S)}else{for(let S of _)S.type==0?(l[S.id]=u.length<<1|1,u.push(S.value)):(l[S.id]=d.length<<1,d.push(w=>S.dynamicSlot(w)));l[x.id]=d.length<<1,d.push(S=>T0e(S,x,_))}}let f=d.map(g=>g(l));return new Mb(n,o,f,l,u,a)}}function M0e(e,n,r){let i=[[],[],[],[],[]],s=new Map;function a(o,l){let u=s.get(o);if(u!=null){if(u<=l)return;let d=i[u].indexOf(o);d>-1&&i[u].splice(d,1),o instanceof iN&&r.delete(o.compartment)}if(s.set(o,l),Array.isArray(o))for(let d of o)a(d,l);else if(o instanceof iN){if(r.has(o.compartment))throw new RangeError("Duplicate use of compartment in extensions");let d=n.get(o.compartment)||o.inner;r.set(o.compartment,d),a(d,l)}else if(o instanceof eW)a(o.inner,o.prec);else if(o instanceof _i)i[l].push(o),o.provides&&a(o.provides,l);else if(o instanceof Dx)i[l].push(o),o.facet.extensions&&a(o.facet.extensions,ud.default);else{let d=o.extension;if(!d)throw new Error(`Unrecognized extension value in extension set (${o}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);a(d,l)}}return a(e,ud.default),i.reduce((o,l)=>o.concat(l))}function mg(e,n){if(n&1)return 2;let r=n>>1,i=e.status[r];if(i==4)throw new Error("Cyclic dependency between fields and/or facets");if(i&2)return i;e.status[r]=4;let s=e.computeSlot(e,e.config.dynamicSlots[r]);return e.status[r]=2|s}function Rb(e,n){return n&1?e.config.staticValues[n>>1]:e.values[n>>1]}const tW=pt.define(),sN=pt.define({combine:e=>e.some(n=>n),static:!0}),nW=pt.define({combine:e=>e.length?e[0]:void 0,static:!0}),rW=pt.define(),iW=pt.define(),sW=pt.define(),aW=pt.define({combine:e=>e.length?e[0]:!1});class al{constructor(n,r){this.type=n,this.value=r}static define(){return new R0e}}class R0e{of(n){return new al(this,n)}}class O0e{constructor(n){this.map=n}of(n){return new Gt(this,n)}}class Gt{constructor(n,r){this.type=n,this.value=r}map(n){let r=this.type.map(this.value,n);return r===void 0?void 0:r==this.value?this:new Gt(this.type,r)}is(n){return this.type==n}static define(n={}){return new O0e(n.map||(r=>r))}static mapEffects(n,r){if(!n.length)return n;let i=[];for(let s of n){let a=s.map(r);a&&i.push(a)}return i}}Gt.reconfigure=Gt.define();Gt.appendConfig=Gt.define();class si{constructor(n,r,i,s,a,o){this.startState=n,this.changes=r,this.selection=i,this.effects=s,this.annotations=a,this.scrollIntoView=o,this._doc=null,this._state=null,i&&JH(i,r.newLength),a.some(l=>l.type==si.time)||(this.annotations=a.concat(si.time.of(Date.now())))}static create(n,r,i,s,a,o){return new si(n,r,i,s,a,o)}get newDoc(){return this._doc||(this._doc=this.changes.apply(this.startState.doc))}get newSelection(){return this.selection||this.startState.selection.map(this.changes)}get state(){return this._state||this.startState.applyTransaction(this),this._state}annotation(n){for(let r of this.annotations)if(r.type==n)return r.value}get docChanged(){return!this.changes.empty}get reconfigured(){return this.startState.config!=this.state.config}isUserEvent(n){let r=this.annotation(si.userEvent);return!!(r&&(r==n||r.length>n.length&&r.slice(0,n.length)==n&&r[n.length]=="."))}}si.time=al.define();si.userEvent=al.define();si.addToHistory=al.define();si.remote=al.define();function D0e(e,n){let r=[];for(let i=0,s=0;;){let a,o;if(i<e.length&&(s==n.length||n[s]>=e[i]))a=e[i++],o=e[i++];else if(s<n.length)a=n[s++],o=n[s++];else return r;!r.length||r[r.length-1]<a?r.push(a,o):r[r.length-1]<o&&(r[r.length-1]=o)}}function oW(e,n,r){var i;let s,a,o;return r?(s=n.changes,a=ri.empty(n.changes.length),o=e.changes.compose(n.changes)):(s=n.changes.map(e.changes),a=e.changes.mapDesc(n.changes,!0),o=e.changes.compose(s)),{changes:o,selection:n.selection?n.selection.map(a):(i=e.selection)===null||i===void 0?void 0:i.map(s),effects:Gt.mapEffects(e.effects,s).concat(Gt.mapEffects(n.effects,a)),annotations:e.annotations.length?e.annotations.concat(n.annotations):n.annotations,scrollIntoView:e.scrollIntoView||n.scrollIntoView}}function aN(e,n,r){let i=n.selection,s=Sf(n.annotations);return n.userEvent&&(s=s.concat(si.userEvent.of(n.userEvent))),{changes:n.changes instanceof ri?n.changes:ri.of(n.changes||[],r,e.facet(nW)),selection:i&&(i instanceof Be?i:Be.single(i.anchor,i.head)),effects:Sf(n.effects),annotations:s,scrollIntoView:!!n.scrollIntoView}}function lW(e,n,r){let i=aN(e,n.length?n[0]:{},e.doc.length);n.length&&n[0].filter===!1&&(r=!1);for(let a=1;a<n.length;a++){n[a].filter===!1&&(r=!1);let o=!!n[a].sequential;i=oW(i,aN(e,n[a],o?i.changes.newLength:e.doc.length),o)}let s=si.create(e,i.changes,i.selection,i.effects,i.annotations,i.scrollIntoView);return L0e(r?P0e(s):s)}function P0e(e){let n=e.startState,r=!0;for(let s of n.facet(rW)){let a=s(e);if(a===!1){r=!1;break}Array.isArray(a)&&(r=r===!0?a:D0e(r,a))}if(r!==!0){let s,a;if(r===!1)a=e.changes.invertedDesc,s=ri.empty(n.doc.length);else{let o=e.changes.filter(r);s=o.changes,a=o.filtered.mapDesc(o.changes).invertedDesc}e=si.create(n,s,e.selection&&e.selection.map(a),Gt.mapEffects(e.effects,a),e.annotations,e.scrollIntoView)}let i=n.facet(iW);for(let s=i.length-1;s>=0;s--){let a=i[s](e);a instanceof si?e=a:Array.isArray(a)&&a.length==1&&a[0]instanceof si?e=a[0]:e=lW(n,Sf(a),!1)}return e}function L0e(e){let n=e.startState,r=n.facet(sW),i=e;for(let s=r.length-1;s>=0;s--){let a=r[s](e);a&&Object.keys(a).length&&(i=oW(i,aN(n,a,e.changes.newLength),!0))}return i==e?e:si.create(n,e.changes,e.selection,i.effects,i.annotations,i.scrollIntoView)}const I0e=[];function Sf(e){return e==null?I0e:Array.isArray(e)?e:[e]}var yr=(function(e){return e[e.Word=0]="Word",e[e.Space=1]="Space",e[e.Other=2]="Other",e})(yr||(yr={}));const B0e=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;let oN;try{oN=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch{}function z0e(e){if(oN)return oN.test(e);for(let n=0;n<e.length;n++){let r=e[n];if(/\w/.test(r)||r>""&&(r.toUpperCase()!=r.toLowerCase()||B0e.test(r)))return!0}return!1}function $0e(e){return n=>{if(!/\S/.test(n))return yr.Space;if(z0e(n))return yr.Word;for(let r=0;r<e.length;r++)if(n.indexOf(e[r])>-1)return yr.Word;return yr.Other}}class yn{constructor(n,r,i,s,a,o){this.config=n,this.doc=r,this.selection=i,this.values=s,this.status=n.statusTemplate.slice(),this.computeSlot=a,o&&(o._state=this);for(let l=0;l<this.config.dynamicSlots.length;l++)mg(this,l<<1);this.computeSlot=null}field(n,r=!0){let i=this.config.address[n.id];if(i==null){if(r)throw new RangeError("Field is not present in this state");return}return mg(this,i),Rb(this,i)}update(...n){return lW(this,n,!0)}applyTransaction(n){let r=this.config,{base:i,compartments:s}=r;for(let l of n.effects)l.is(Z0.reconfigure)?(r&&(s=new Map,r.compartments.forEach((u,d)=>s.set(d,u)),r=null),s.set(l.value.compartment,l.value.extension)):l.is(Gt.reconfigure)?(r=null,i=l.value):l.is(Gt.appendConfig)&&(r=null,i=Sf(i).concat(l.value));let a;r?a=n.startState.values.slice():(r=Mb.resolve(i,s,this),a=new yn(r,this.doc,this.selection,r.dynamicSlots.map(()=>null),(u,d)=>d.reconfigure(u,this),null).values);let o=n.startState.facet(sN)?n.newSelection:n.newSelection.asSingle();new yn(r,n.newDoc,o,a,(l,u)=>u.update(l,n),n)}replaceSelection(n){return typeof n=="string"&&(n=this.toText(n)),this.changeByRange(r=>({changes:{from:r.from,to:r.to,insert:n},range:Be.cursor(r.from+n.length)}))}changeByRange(n){let r=this.selection,i=n(r.ranges[0]),s=this.changes(i.changes),a=[i.range],o=Sf(i.effects);for(let l=1;l<r.ranges.length;l++){let u=n(r.ranges[l]),d=this.changes(u.changes),p=d.map(s);for(let g=0;g<l;g++)a[g]=a[g].map(p);let f=s.mapDesc(d,!0);a.push(u.range.map(f)),s=s.compose(p),o=Gt.mapEffects(o,p).concat(Gt.mapEffects(Sf(u.effects),f))}return{changes:s,selection:Be.create(a,r.mainIndex),effects:o}}changes(n=[]){return n instanceof ri?n:ri.of(n,this.doc.length,this.facet(yn.lineSeparator))}toText(n){return Dn.of(n.split(this.facet(yn.lineSeparator)||eN))}sliceDoc(n=0,r=this.doc.length){return this.doc.sliceString(n,r,this.lineBreak)}facet(n){let r=this.config.address[n.id];return r==null?n.default:(mg(this,r),Rb(this,r))}toJSON(n){let r={doc:this.sliceDoc(),selection:this.selection.toJSON()};if(n)for(let i in n){let s=n[i];s instanceof _i&&this.config.address[s.id]!=null&&(r[i]=s.spec.toJSON(this.field(n[i]),this))}return r}static fromJSON(n,r={},i){if(!n||typeof n.doc!="string")throw new RangeError("Invalid JSON representation for EditorState");let s=[];if(i){for(let a in i)if(Object.prototype.hasOwnProperty.call(n,a)){let o=i[a],l=n[a];s.push(o.init(u=>o.spec.fromJSON(l,u)))}}return yn.create({doc:n.doc,selection:Be.fromJSON(n.selection),extensions:r.extensions?s.concat([r.extensions]):s})}static create(n={}){let r=Mb.resolve(n.extensions||[],new Map),i=n.doc instanceof Dn?n.doc:Dn.of((n.doc||"").split(r.staticFacet(yn.lineSeparator)||eN)),s=n.selection?n.selection instanceof Be?n.selection:Be.single(n.selection.anchor,n.selection.head):Be.single(0);return JH(s,i.length),r.staticFacet(sN)||(s=s.asSingle()),new yn(r,i,s,r.dynamicSlots.map(()=>null),(a,o)=>o.create(a),null)}get tabSize(){return this.facet(yn.tabSize)}get lineBreak(){return this.facet(yn.lineSeparator)||`
`}get readOnly(){return this.facet(aW)}phrase(n,...r){for(let i of this.facet(yn.phrases))if(Object.prototype.hasOwnProperty.call(i,n)){n=i[n];break}return r.length&&(n=n.replace(/\$(\$|\d*)/g,(i,s)=>{if(s=="$")return"$";let a=+(s||1);return!a||a>r.length?i:r[a-1]})),n}languageDataAt(n,r,i=-1){let s=[];for(let a of this.facet(tW))for(let o of a(this,r,i))Object.prototype.hasOwnProperty.call(o,n)&&s.push(o[n]);return s}charCategorizer(n){let r=this.languageDataAt("wordChars",n);return $0e(r.length?r[0]:"")}wordAt(n){let{text:r,from:i,length:s}=this.doc.lineAt(n),a=this.charCategorizer(n),o=n-i,l=n-i;for(;o>0;){let u=gi(r,o,!1);if(a(r.slice(u,o))!=yr.Word)break;o=u}for(;l<s;){let u=gi(r,l);if(a(r.slice(l,u))!=yr.Word)break;l=u}return o==l?null:Be.range(o+i,l+i)}}yn.allowMultipleSelections=sN;yn.tabSize=pt.define({combine:e=>e.length?e[0]:4});yn.lineSeparator=nW;yn.readOnly=aW;yn.phrases=pt.define({compare(e,n){let r=Object.keys(e),i=Object.keys(n);return r.length==i.length&&r.every(s=>e[s]==n[s])}});yn.languageData=tW;yn.changeFilter=rW;yn.transactionFilter=iW;yn.transactionExtender=sW;Z0.reconfigure=Gt.define();function oo(e,n,r={}){let i={};for(let s of e)for(let a of Object.keys(s)){let o=s[a],l=i[a];if(l===void 0)i[a]=o;else if(!(l===o||o===void 0))if(Object.hasOwnProperty.call(r,a))i[a]=r[a](l,o);else throw new Error("Config merge conflict for field "+a)}for(let s in n)i[s]===void 0&&(i[s]=n[s]);return i}class pu{eq(n){return this==n}range(n,r=n){return lN.create(n,r,this)}}pu.prototype.startSide=pu.prototype.endSide=0;pu.prototype.point=!1;pu.prototype.mapMode=rs.TrackDel;function uT(e,n){return e==n||e.constructor==n.constructor&&e.eq(n)}let lN=class cW{constructor(n,r,i){this.from=n,this.to=r,this.value=i}static create(n,r,i){return new cW(n,r,i)}};function cN(e,n){return e.from-n.from||e.value.startSide-n.value.startSide}class dT{constructor(n,r,i,s){this.from=n,this.to=r,this.value=i,this.maxPoint=s}get length(){return this.to[this.to.length-1]}findIndex(n,r,i,s=0){let a=i?this.to:this.from;for(let o=s,l=a.length;;){if(o==l)return o;let u=o+l>>1,d=a[u]-n||(i?this.value[u].endSide:this.value[u].startSide)-r;if(u==o)return d>=0?o:l;d>=0?l=u:o=u+1}}between(n,r,i,s){for(let a=this.findIndex(r,-1e9,!0),o=this.findIndex(i,1e9,!1,a);a<o;a++)if(s(this.from[a]+n,this.to[a]+n,this.value[a])===!1)return!1}map(n,r){let i=[],s=[],a=[],o=-1,l=-1;for(let u=0;u<this.value.length;u++){let d=this.value[u],p=this.from[u]+n,f=this.to[u]+n,g,_;if(p==f){let x=r.mapPos(p,d.startSide,d.mapMode);if(x==null||(g=_=x,d.startSide!=d.endSide&&(_=r.mapPos(p,d.endSide),_<g)))continue}else if(g=r.mapPos(p,d.startSide),_=r.mapPos(f,d.endSide),g>_||g==_&&d.startSide>0&&d.endSide<=0)continue;(_-g||d.endSide-d.startSide)<0||(o<0&&(o=g),d.point&&(l=Math.max(l,_-g)),i.push(d),s.push(g-o),a.push(_-o))}return{mapped:i.length?new dT(s,a,i,l):null,pos:o}}}class rn{constructor(n,r,i,s){this.chunkPos=n,this.chunk=r,this.nextLayer=i,this.maxPoint=s}static create(n,r,i,s){return new rn(n,r,i,s)}get length(){let n=this.chunk.length-1;return n<0?0:Math.max(this.chunkEnd(n),this.nextLayer.length)}get size(){if(this.isEmpty)return 0;let n=this.nextLayer.size;for(let r of this.chunk)n+=r.value.length;return n}chunkEnd(n){return this.chunkPos[n]+this.chunk[n].length}update(n){let{add:r=[],sort:i=!1,filterFrom:s=0,filterTo:a=this.length}=n,o=n.filter;if(r.length==0&&!o)return this;if(i&&(r=r.slice().sort(cN)),this.isEmpty)return r.length?rn.of(r):this;let l=new uW(this,null,-1).goto(0),u=0,d=[],p=new ec;for(;l.value||u<r.length;)if(u<r.length&&(l.from-r[u].from||l.startSide-r[u].value.startSide)>=0){let f=r[u++];p.addInner(f.from,f.to,f.value)||d.push(f)}else l.rangeIndex==1&&l.chunkIndex<this.chunk.length&&(u==r.length||this.chunkEnd(l.chunkIndex)<r[u].from)&&(!o||s>this.chunkEnd(l.chunkIndex)||a<this.chunkPos[l.chunkIndex])&&p.addChunk(this.chunkPos[l.chunkIndex],this.chunk[l.chunkIndex])?l.nextChunk():((!o||s>l.to||a<l.from||o(l.from,l.to,l.value))&&(p.addInner(l.from,l.to,l.value)||d.push(lN.create(l.from,l.to,l.value))),l.next());return p.finishInner(this.nextLayer.isEmpty&&!d.length?rn.empty:this.nextLayer.update({add:d,filter:o,filterFrom:s,filterTo:a}))}map(n){if(n.empty||this.isEmpty)return this;let r=[],i=[],s=-1;for(let o=0;o<this.chunk.length;o++){let l=this.chunkPos[o],u=this.chunk[o],d=n.touchesRange(l,l+u.length);if(d===!1)s=Math.max(s,u.maxPoint),r.push(u),i.push(n.mapPos(l));else if(d===!0){let{mapped:p,pos:f}=u.map(l,n);p&&(s=Math.max(s,p.maxPoint),r.push(p),i.push(f))}}let a=this.nextLayer.map(n);return r.length==0?a:new rn(i,r,a||rn.empty,s)}between(n,r,i){if(!this.isEmpty){for(let s=0;s<this.chunk.length;s++){let a=this.chunkPos[s],o=this.chunk[s];if(r>=a&&n<=a+o.length&&o.between(a,n-a,r-a,i)===!1)return}this.nextLayer.between(n,r,i)}}iter(n=0){return Xg.from([this]).goto(n)}get isEmpty(){return this.nextLayer==this}static iter(n,r=0){return Xg.from(n).goto(r)}static compare(n,r,i,s,a=-1){let o=n.filter(f=>f.maxPoint>0||!f.isEmpty&&f.maxPoint>=a),l=r.filter(f=>f.maxPoint>0||!f.isEmpty&&f.maxPoint>=a),u=aL(o,l,i),d=new xm(o,u,a),p=new xm(l,u,a);i.iterGaps((f,g,_)=>oL(d,f,p,g,_,s)),i.empty&&i.length==0&&oL(d,0,p,0,0,s)}static eq(n,r,i=0,s){s==null&&(s=999999999);let a=n.filter(p=>!p.isEmpty&&r.indexOf(p)<0),o=r.filter(p=>!p.isEmpty&&n.indexOf(p)<0);if(a.length!=o.length)return!1;if(!a.length)return!0;let l=aL(a,o),u=new xm(a,l,0).goto(i),d=new xm(o,l,0).goto(i);for(;;){if(u.to!=d.to||!uN(u.active,d.active)||u.point&&(!d.point||!uT(u.point,d.point)))return!1;if(u.to>s)return!0;u.next(),d.next()}}static spans(n,r,i,s,a=-1){let o=new xm(n,null,a).goto(r),l=r,u=o.openStart;for(;;){let d=Math.min(o.to,i);if(o.point){let p=o.activeForPoint(o.to),f=o.pointFrom<r?p.length+1:o.point.startSide<0?p.length:Math.min(p.length,u);s.point(l,d,o.point,p,f,o.pointRank),u=Math.min(o.openEnd(d),p.length)}else d>l&&(s.span(l,d,o.active,u),u=o.openEnd(d));if(o.to>i)return u+(o.point&&o.to>i?1:0);l=o.to,o.next()}}static of(n,r=!1){let i=new ec;for(let s of n instanceof lN?[n]:r?F0e(n):n)i.add(s.from,s.to,s.value);return i.finish()}static join(n){if(!n.length)return rn.empty;let r=n[n.length-1];for(let i=n.length-2;i>=0;i--)for(let s=n[i];s!=rn.empty;s=s.nextLayer)r=new rn(s.chunkPos,s.chunk,r,Math.max(s.maxPoint,r.maxPoint));return r}}rn.empty=new rn([],[],null,-1);function F0e(e){if(e.length>1)for(let n=e[0],r=1;r<e.length;r++){let i=e[r];if(cN(n,i)>0)return e.slice().sort(cN);n=i}return e}rn.empty.nextLayer=rn.empty;class ec{finishChunk(n){this.chunks.push(new dT(this.from,this.to,this.value,this.maxPoint)),this.chunkPos.push(this.chunkStart),this.chunkStart=-1,this.setMaxPoint=Math.max(this.setMaxPoint,this.maxPoint),this.maxPoint=-1,n&&(this.from=[],this.to=[],this.value=[])}constructor(){this.chunks=[],this.chunkPos=[],this.chunkStart=-1,this.last=null,this.lastFrom=-1e9,this.lastTo=-1e9,this.from=[],this.to=[],this.value=[],this.maxPoint=-1,this.setMaxPoint=-1,this.nextLayer=null}add(n,r,i){this.addInner(n,r,i)||(this.nextLayer||(this.nextLayer=new ec)).add(n,r,i)}addInner(n,r,i){let s=n-this.lastTo||i.startSide-this.last.endSide;if(s<=0&&(n-this.lastFrom||i.startSide-this.last.startSide)<0)throw new Error("Ranges must be added sorted by `from` position and `startSide`");return s<0?!1:(this.from.length==250&&this.finishChunk(!0),this.chunkStart<0&&(this.chunkStart=n),this.from.push(n-this.chunkStart),this.to.push(r-this.chunkStart),this.last=i,this.lastFrom=n,this.lastTo=r,this.value.push(i),i.point&&(this.maxPoint=Math.max(this.maxPoint,r-n)),!0)}addChunk(n,r){if((n-this.lastTo||r.value[0].startSide-this.last.endSide)<0)return!1;this.from.length&&this.finishChunk(!0),this.setMaxPoint=Math.max(this.setMaxPoint,r.maxPoint),this.chunks.push(r),this.chunkPos.push(n);let i=r.value.length-1;return this.last=r.value[i],this.lastFrom=r.from[i]+n,this.lastTo=r.to[i]+n,!0}finish(){return this.finishInner(rn.empty)}finishInner(n){if(this.from.length&&this.finishChunk(!1),this.chunks.length==0)return n;let r=rn.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(n):n,this.setMaxPoint);return this.from=null,r}}function aL(e,n,r){let i=new Map;for(let a of e)for(let o=0;o<a.chunk.length;o++)a.chunk[o].maxPoint<=0&&i.set(a.chunk[o],a.chunkPos[o]);let s=new Set;for(let a of n)for(let o=0;o<a.chunk.length;o++){let l=i.get(a.chunk[o]);l!=null&&(r?r.mapPos(l):l)==a.chunkPos[o]&&!(r!=null&&r.touchesRange(l,l+a.chunk[o].length))&&s.add(a.chunk[o])}return s}class uW{constructor(n,r,i,s=0){this.layer=n,this.skip=r,this.minPoint=i,this.rank=s}get startSide(){return this.value?this.value.startSide:0}get endSide(){return this.value?this.value.endSide:0}goto(n,r=-1e9){return this.chunkIndex=this.rangeIndex=0,this.gotoInner(n,r,!1),this}gotoInner(n,r,i){for(;this.chunkIndex<this.layer.chunk.length;){let s=this.layer.chunk[this.chunkIndex];if(!(this.skip&&this.skip.has(s)||this.layer.chunkEnd(this.chunkIndex)<n||s.maxPoint<this.minPoint))break;this.chunkIndex++,i=!1}if(this.chunkIndex<this.layer.chunk.length){let s=this.layer.chunk[this.chunkIndex].findIndex(n-this.layer.chunkPos[this.chunkIndex],r,!0);(!i||this.rangeIndex<s)&&this.setRangeIndex(s)}this.next()}forward(n,r){(this.to-n||this.endSide-r)<0&&this.gotoInner(n,r,!0)}next(){for(;;)if(this.chunkIndex==this.layer.chunk.length){this.from=this.to=1e9,this.value=null;break}else{let n=this.layer.chunkPos[this.chunkIndex],r=this.layer.chunk[this.chunkIndex],i=n+r.from[this.rangeIndex];if(this.from=i,this.to=n+r.to[this.rangeIndex],this.value=r.value[this.rangeIndex],this.setRangeIndex(this.rangeIndex+1),this.minPoint<0||this.value.point&&this.to-this.from>=this.minPoint)break}}setRangeIndex(n){if(n==this.layer.chunk[this.chunkIndex].value.length){if(this.chunkIndex++,this.skip)for(;this.chunkIndex<this.layer.chunk.length&&this.skip.has(this.layer.chunk[this.chunkIndex]);)this.chunkIndex++;this.rangeIndex=0}else this.rangeIndex=n}nextChunk(){this.chunkIndex++,this.rangeIndex=0,this.next()}compare(n){return this.from-n.from||this.startSide-n.startSide||this.rank-n.rank||this.to-n.to||this.endSide-n.endSide}}class Xg{constructor(n){this.heap=n}static from(n,r=null,i=-1){let s=[];for(let a=0;a<n.length;a++)for(let o=n[a];!o.isEmpty;o=o.nextLayer)o.maxPoint>=i&&s.push(new uW(o,r,i,a));return s.length==1?s[0]:new Xg(s)}get startSide(){return this.value?this.value.startSide:0}goto(n,r=-1e9){for(let i of this.heap)i.goto(n,r);for(let i=this.heap.length>>1;i>=0;i--)zS(this.heap,i);return this.next(),this}forward(n,r){for(let i of this.heap)i.forward(n,r);for(let i=this.heap.length>>1;i>=0;i--)zS(this.heap,i);(this.to-n||this.value.endSide-r)<0&&this.next()}next(){if(this.heap.length==0)this.from=this.to=1e9,this.value=null,this.rank=-1;else{let n=this.heap[0];this.from=n.from,this.to=n.to,this.value=n.value,this.rank=n.rank,n.value&&n.next(),zS(this.heap,0)}}}function zS(e,n){for(let r=e[n];;){let i=(n<<1)+1;if(i>=e.length)break;let s=e[i];if(i+1<e.length&&s.compare(e[i+1])>=0&&(s=e[i+1],i++),r.compare(s)<0)break;e[i]=r,e[n]=s,n=i}}class xm{constructor(n,r,i){this.minPoint=i,this.active=[],this.activeTo=[],this.activeRank=[],this.minActive=-1,this.point=null,this.pointFrom=0,this.pointRank=0,this.to=-1e9,this.endSide=0,this.openStart=-1,this.cursor=Xg.from(n,r,i)}goto(n,r=-1e9){return this.cursor.goto(n,r),this.active.length=this.activeTo.length=this.activeRank.length=0,this.minActive=-1,this.to=n,this.endSide=r,this.openStart=-1,this.next(),this}forward(n,r){for(;this.minActive>-1&&(this.activeTo[this.minActive]-n||this.active[this.minActive].endSide-r)<0;)this.removeActive(this.minActive);this.cursor.forward(n,r)}removeActive(n){A_(this.active,n),A_(this.activeTo,n),A_(this.activeRank,n),this.minActive=lL(this.active,this.activeTo)}addActive(n){let r=0,{value:i,to:s,rank:a}=this.cursor;for(;r<this.activeRank.length&&(a-this.activeRank[r]||s-this.activeTo[r])>0;)r++;T_(this.active,r,i),T_(this.activeTo,r,s),T_(this.activeRank,r,a),n&&T_(n,r,this.cursor.from),this.minActive=lL(this.active,this.activeTo)}next(){let n=this.to,r=this.point;this.point=null;let i=this.openStart<0?[]:null;for(;;){let s=this.minActive;if(s>-1&&(this.activeTo[s]-this.cursor.from||this.active[s].endSide-this.cursor.startSide)<0){if(this.activeTo[s]>n){this.to=this.activeTo[s],this.endSide=this.active[s].endSide;break}this.removeActive(s),i&&A_(i,s)}else if(this.cursor.value)if(this.cursor.from>n){this.to=this.cursor.from,this.endSide=this.cursor.startSide;break}else{let a=this.cursor.value;if(!a.point)this.addActive(i),this.cursor.next();else if(r&&this.cursor.to==this.to&&this.cursor.from<this.cursor.to)this.cursor.next();else{this.point=a,this.pointFrom=this.cursor.from,this.pointRank=this.cursor.rank,this.to=this.cursor.to,this.endSide=a.endSide,this.cursor.next(),this.forward(this.to,this.endSide);break}}else{this.to=this.endSide=1e9;break}}if(i){this.openStart=0;for(let s=i.length-1;s>=0&&i[s]<n;s--)this.openStart++}}activeForPoint(n){if(!this.active.length)return this.active;let r=[];for(let i=this.active.length-1;i>=0&&!(this.activeRank[i]<this.pointRank);i--)(this.activeTo[i]>n||this.activeTo[i]==n&&this.active[i].endSide>=this.point.endSide)&&r.push(this.active[i]);return r.reverse()}openEnd(n){let r=0;for(let i=this.activeTo.length-1;i>=0&&this.activeTo[i]>n;i--)r++;return r}}function oL(e,n,r,i,s,a){e.goto(n),r.goto(i);let o=i+s,l=i,u=i-n,d=!!a.boundChange;for(let p=!1;;){let f=e.to+u-r.to,g=f||e.endSide-r.endSide,_=g<0?e.to+u:r.to,x=Math.min(_,o);if(e.point||r.point?(e.point&&r.point&&uT(e.point,r.point)&&uN(e.activeForPoint(e.to),r.activeForPoint(r.to))||a.comparePoint(l,x,e.point,r.point),p=!1):(p&&a.boundChange(l),x>l&&!uN(e.active,r.active)&&a.compareRange(l,x,e.active,r.active),d&&x<o&&(f||e.openEnd(_)!=r.openEnd(_))&&(p=!0)),_>o)break;l=_,g<=0&&e.next(),g>=0&&r.next()}}function uN(e,n){if(e.length!=n.length)return!1;for(let r=0;r<e.length;r++)if(e[r]!=n[r]&&!uT(e[r],n[r]))return!1;return!0}function A_(e,n){for(let r=n,i=e.length-1;r<i;r++)e[r]=e[r+1];e.pop()}function T_(e,n,r){for(let i=e.length-1;i>=n;i--)e[i+1]=e[i];e[n]=r}function lL(e,n){let r=-1,i=1e9;for(let s=0;s<n.length;s++)(n[s]-i||e[s].endSide-e[r].endSide)<0&&(r=s,i=n[s]);return r}function fp(e,n,r=e.length){let i=0;for(let s=0;s<r&&s<e.length;)e.charCodeAt(s)==9?(i+=n-i%n,s++):(i++,s=gi(e,s));return i}function dN(e,n,r,i){for(let s=0,a=0;;){if(a>=n)return s;if(s==e.length)break;a+=e.charCodeAt(s)==9?r-a%r:1,s=gi(e,s)}return i===!0?-1:e.length}const hN="ͼ",cL=typeof Symbol>"u"?"__"+hN:Symbol.for(hN),fN=typeof Symbol>"u"?"__styleSet"+Math.floor(Math.random()*1e8):Symbol("styleSet"),uL=typeof globalThis<"u"?globalThis:typeof window<"u"?window:{};class mu{constructor(n,r){this.rules=[];let{finish:i}=r||{};function s(o){return/^@/.test(o)?[o]:o.split(/,\s*/)}function a(o,l,u,d){let p=[],f=/^@(\w+)\b/.exec(o[0]),g=f&&f[1]=="keyframes";if(f&&l==null)return u.push(o[0]+";");for(let _ in l){let x=l[_];if(/&/.test(_))a(_.split(/,\s*/).map(v=>o.map(S=>v.replace(/&/,S))).reduce((v,S)=>v.concat(S)),x,u);else if(x&&typeof x=="object"){if(!f)throw new RangeError("The value of a property ("+_+") should be a primitive value.");a(s(_),x,p,g)}else x!=null&&p.push(_.replace(/_.*/,"").replace(/[A-Z]/g,v=>"-"+v.toLowerCase())+": "+x+";")}(p.length||g)&&u.push((i&&!f&&!d?o.map(i):o).join(", ")+" {"+p.join(" ")+"}")}for(let o in n)a(s(o),n[o],this.rules)}getRules(){return this.rules.join(`
`)}static newName(){let n=uL[cL]||1;return uL[cL]=n+1,hN+n.toString(36)}static mount(n,r,i){let s=n[fN],a=i&&i.nonce;s?a&&s.setNonce(a):s=new H0e(n,a),s.mount(Array.isArray(r)?r:[r],n)}}let dL=new Map;class H0e{constructor(n,r){let i=n.ownerDocument||n,s=i.defaultView;if(!n.head&&n.adoptedStyleSheets&&s.CSSStyleSheet){let a=dL.get(i);if(a)return n[fN]=a;this.sheet=new s.CSSStyleSheet,dL.set(i,this)}else this.styleTag=i.createElement("style"),r&&this.styleTag.setAttribute("nonce",r);this.modules=[],n[fN]=this}mount(n,r){let i=this.sheet,s=0,a=0;for(let o=0;o<n.length;o++){let l=n[o],u=this.modules.indexOf(l);if(u<a&&u>-1&&(this.modules.splice(u,1),a--,u=-1),u==-1){if(this.modules.splice(a++,0,l),i)for(let d=0;d<l.rules.length;d++)i.insertRule(l.rules[d],s++)}else{for(;a<u;)s+=this.modules[a++].rules.length;s+=l.rules.length,a++}}if(i)r.adoptedStyleSheets.indexOf(this.sheet)<0&&(r.adoptedStyleSheets=[this.sheet,...r.adoptedStyleSheets]);else{let o="";for(let u=0;u<this.modules.length;u++)o+=this.modules[u].getRules()+`
`;this.styleTag.textContent=o;let l=r.head||r;this.styleTag.parentNode!=l&&l.insertBefore(this.styleTag,l.firstChild)}}setNonce(n){this.styleTag&&this.styleTag.getAttribute("nonce")!=n&&this.styleTag.setAttribute("nonce",n)}}var gu={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},Qg={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},W0e=typeof navigator<"u"&&/Mac/.test(navigator.platform),q0e=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var Ai=0;Ai<10;Ai++)gu[48+Ai]=gu[96+Ai]=String(Ai);for(var Ai=1;Ai<=24;Ai++)gu[Ai+111]="F"+Ai;for(var Ai=65;Ai<=90;Ai++)gu[Ai]=String.fromCharCode(Ai+32),Qg[Ai]=String.fromCharCode(Ai);for(var $S in gu)Qg.hasOwnProperty($S)||(Qg[$S]=gu[$S]);function U0e(e){var n=W0e&&e.metaKey&&e.shiftKey&&!e.ctrlKey&&!e.altKey||q0e&&e.shiftKey&&e.key&&e.key.length==1||e.key=="Unidentified",r=!n&&e.key||(e.shiftKey?Qg:gu)[e.keyCode]||e.key||"Unidentified";return r=="Esc"&&(r="Escape"),r=="Del"&&(r="Delete"),r=="Left"&&(r="ArrowLeft"),r=="Up"&&(r="ArrowUp"),r=="Right"&&(r="ArrowRight"),r=="Down"&&(r="ArrowDown"),r}function Kn(){var e=arguments[0];typeof e=="string"&&(e=document.createElement(e));var n=1,r=arguments[1];if(r&&typeof r=="object"&&r.nodeType==null&&!Array.isArray(r)){for(var i in r)if(Object.prototype.hasOwnProperty.call(r,i)){var s=r[i];typeof s=="string"?e.setAttribute(i,s):s!=null&&(e[i]=s)}n++}for(;n<arguments.length;n++)dW(e,arguments[n]);return e}function dW(e,n){if(typeof n=="string")e.appendChild(document.createTextNode(n));else if(n!=null)if(n.nodeType!=null)e.appendChild(n);else if(Array.isArray(n))for(var r=0;r<n.length;r++)dW(e,n[r]);else throw new RangeError("Unsupported child node: "+n)}let es=typeof navigator<"u"?navigator:{userAgent:"",vendor:"",platform:""},pN=typeof document<"u"?document:{documentElement:{style:{}}};const mN=/Edge\/(\d+)/.exec(es.userAgent),hW=/MSIE \d/.test(es.userAgent),gN=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(es.userAgent),J0=!!(hW||gN||mN),hL=!J0&&/gecko\/(\d+)/i.test(es.userAgent),FS=!J0&&/Chrome\/(\d+)/.exec(es.userAgent),fL="webkitFontSmoothing"in pN.documentElement.style,vN=!J0&&/Apple Computer/.test(es.vendor),pL=vN&&(/Mobile\/\w+/.test(es.userAgent)||es.maxTouchPoints>2);var gt={mac:pL||/Mac/.test(es.platform),windows:/Win/.test(es.platform),linux:/Linux|X11/.test(es.platform),ie:J0,ie_version:hW?pN.documentMode||6:gN?+gN[1]:mN?+mN[1]:0,gecko:hL,gecko_version:hL?+(/Firefox\/(\d+)/.exec(es.userAgent)||[0,0])[1]:0,chrome:!!FS,chrome_version:FS?+FS[1]:0,ios:pL,android:/Android\b/.test(es.userAgent),webkit:fL,webkit_version:fL?+(/\bAppleWebKit\/(\d+)/.exec(es.userAgent)||[0,0])[1]:0,safari:vN,safari_version:vN?+(/\bVersion\/(\d+(\.\d+)?)/.exec(es.userAgent)||[0,0])[1]:0,tabSize:pN.documentElement.style.tabSize!=null?"tab-size":"-moz-tab-size"};function hT(e,n){for(let r in e)r=="class"&&n.class?n.class+=" "+e.class:r=="style"&&n.style?n.style+=";"+e.style:n[r]=e[r];return n}const Ob=Object.create(null);function fT(e,n,r){if(e==n)return!0;e||(e=Ob),n||(n=Ob);let i=Object.keys(e),s=Object.keys(n);if(i.length-0!=s.length-0)return!1;for(let a of i)if(a!=r&&(s.indexOf(a)==-1||e[a]!==n[a]))return!1;return!0}function K0e(e,n){for(let r=e.attributes.length-1;r>=0;r--){let i=e.attributes[r].name;n[i]==null&&e.removeAttribute(i)}for(let r in n){let i=n[r];r=="style"?e.style.cssText=i:e.getAttribute(r)!=i&&e.setAttribute(r,i)}}function mL(e,n,r){let i=!1;if(n)for(let s in n)r&&s in r||(i=!0,s=="style"?e.style.cssText="":e.removeAttribute(s));if(r)for(let s in r)n&&n[s]==r[s]||(i=!0,s=="style"?e.style.cssText=r[s]:e.setAttribute(s,r[s]));return i}function V0e(e){let n=Object.create(null);for(let r=0;r<e.attributes.length;r++){let i=e.attributes[r];n[i.name]=i.value}return n}class ol{eq(n){return!1}updateDOM(n,r,i){return!1}compare(n){return this==n||this.constructor==n.constructor&&this.eq(n)}get estimatedHeight(){return-1}get lineBreaks(){return 0}ignoreEvent(n){return!0}coordsAt(n,r,i){return null}get isHidden(){return!1}get editable(){return!1}destroy(n){}}var Ri=(function(e){return e[e.Text=0]="Text",e[e.WidgetBefore=1]="WidgetBefore",e[e.WidgetAfter=2]="WidgetAfter",e[e.WidgetRange=3]="WidgetRange",e})(Ri||(Ri={}));class Pt extends pu{constructor(n,r,i,s){super(),this.startSide=n,this.endSide=r,this.widget=i,this.spec=s}get heightRelevant(){return!1}static mark(n){return new Wv(n)}static widget(n){let r=Math.max(-1e4,Math.min(1e4,n.side||0)),i=!!n.block;return r+=i&&!n.inlineOrder?r>0?3e8:-4e8:r>0?1e8:-1e8,new Bd(n,r,r,i,n.widget||null,!1)}static replace(n){let r=!!n.block,i,s;if(n.isBlockGap)i=-5e8,s=4e8;else{let{start:a,end:o}=fW(n,r);i=(a?r?-3e8:-1:5e8)-1,s=(o?r?2e8:1:-6e8)+1}return new Bd(n,i,s,r,n.widget||null,!0)}static line(n){return new qv(n)}static set(n,r=!1){return rn.of(n,r)}hasHeight(){return this.widget?this.widget.estimatedHeight>-1:!1}}Pt.none=rn.empty;class Wv extends Pt{constructor(n){let{start:r,end:i}=fW(n);super(r?-1:5e8,i?1:-6e8,null,n),this.tagName=n.tagName||"span",this.attrs=n.class&&n.attributes?hT(n.attributes,{class:n.class}):n.class?{class:n.class}:n.attributes||Ob}eq(n){return this==n||n instanceof Wv&&this.tagName==n.tagName&&fT(this.attrs,n.attrs)}range(n,r=n){if(n>=r)throw new RangeError("Mark decorations may not be empty");return super.range(n,r)}}Wv.prototype.point=!1;class qv extends Pt{constructor(n){super(-2e8,-2e8,null,n)}eq(n){return n instanceof qv&&this.spec.class==n.spec.class&&fT(this.spec.attributes,n.spec.attributes)}range(n,r=n){if(r!=n)throw new RangeError("Line decoration ranges must be zero-length");return super.range(n,r)}}qv.prototype.mapMode=rs.TrackBefore;qv.prototype.point=!0;class Bd extends Pt{constructor(n,r,i,s,a,o){super(r,i,a,n),this.block=s,this.isReplace=o,this.mapMode=s?r<=0?rs.TrackBefore:rs.TrackAfter:rs.TrackDel}get type(){return this.startSide!=this.endSide?Ri.WidgetRange:this.startSide<=0?Ri.WidgetBefore:Ri.WidgetAfter}get heightRelevant(){return this.block||!!this.widget&&(this.widget.estimatedHeight>=5||this.widget.lineBreaks>0)}eq(n){return n instanceof Bd&&Y0e(this.widget,n.widget)&&this.block==n.block&&this.startSide==n.startSide&&this.endSide==n.endSide}range(n,r=n){if(this.isReplace&&(n>r||n==r&&this.startSide>0&&this.endSide<=0))throw new RangeError("Invalid range for replacement decoration");if(!this.isReplace&&r!=n)throw new RangeError("Widget decorations can only have zero-length ranges");return super.range(n,r)}}Bd.prototype.point=!0;function fW(e,n=!1){let{inclusiveStart:r,inclusiveEnd:i}=e;return r==null&&(r=e.inclusive),i==null&&(i=e.inclusive),{start:r??n,end:i??n}}function Y0e(e,n){return e==n||!!(e&&n&&e.compare(n))}function Cf(e,n,r,i=0){let s=r.length-1;s>=0&&r[s]+i>=e?r[s]=Math.max(r[s],n):r.push(e,n)}class Zg extends pu{constructor(n,r){super(),this.tagName=n,this.attributes=r}eq(n){return n==this||n instanceof Zg&&this.tagName==n.tagName&&fT(this.attributes,n.attributes)}static create(n){return new Zg(n.tagName,n.attributes||Ob)}static set(n,r=!1){return rn.of(n,r)}}Zg.prototype.startSide=Zg.prototype.endSide=-1;function Jg(e){let n;return e.nodeType==11?n=e.getSelection?e:e.ownerDocument:n=e,n.getSelection()}function yN(e,n){return n?e==n||e.contains(n.nodeType!=1?n.parentNode:n):!1}function gg(e,n){if(!n.anchorNode)return!1;try{return yN(e,n.anchorNode)}catch{return!1}}function vg(e){return e.nodeType==3?tv(e,0,e.nodeValue.length).getClientRects():e.nodeType==1?e.getClientRects():[]}function yg(e,n,r,i){return r?gL(e,n,r,i,-1)||gL(e,n,r,i,1):!1}function vu(e){for(var n=0;;n++)if(e=e.previousSibling,!e)return n}function Db(e){return e.nodeType==1&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(e.nodeName)}function gL(e,n,r,i,s){for(;;){if(e==r&&n==i)return!0;if(n==(s<0?0:tc(e))){if(e.nodeName=="DIV")return!1;let a=e.parentNode;if(!a||a.nodeType!=1)return!1;n=vu(e)+(s<0?0:1),e=a}else if(e.nodeType==1){if(e=e.childNodes[n+(s<0?-1:0)],e.nodeType==1&&e.contentEditable=="false")return!1;n=s<0?tc(e):0}else return!1}}function tc(e){return e.nodeType==3?e.nodeValue.length:e.childNodes.length}function ev(e,n){let r=n?e.left:e.right;return{left:r,right:r,top:e.top,bottom:e.bottom}}function G0e(e){let n=e.visualViewport;return n?{left:0,right:n.width,top:0,bottom:n.height}:{left:0,right:e.innerWidth,top:0,bottom:e.innerHeight}}function pW(e,n){let r=n.width/e.offsetWidth,i=n.height/e.offsetHeight;return(r>.995&&r<1.005||!isFinite(r)||Math.abs(n.width-e.offsetWidth)<1)&&(r=1),(i>.995&&i<1.005||!isFinite(i)||Math.abs(n.height-e.offsetHeight)<1)&&(i=1),{scaleX:r,scaleY:i}}function X0e(e,n,r,i,s,a,o,l){let u=e.ownerDocument,d=u.defaultView||window;for(let p=e,f=!1;p&&!f;)if(p.nodeType==1){let g,_=p==u.body,x=1,v=1;if(_)g=G0e(d);else{if(/^(fixed|sticky)$/.test(getComputedStyle(p).position)&&(f=!0),p.scrollHeight<=p.clientHeight&&p.scrollWidth<=p.clientWidth){p=p.assignedSlot||p.parentNode;continue}let j=p.getBoundingClientRect();({scaleX:x,scaleY:v}=pW(p,j)),g={left:j.left,right:j.left+p.clientWidth*x,top:j.top,bottom:j.top+p.clientHeight*v}}let S=0,w=0;if(s=="nearest")n.top<g.top+o?(w=n.top-(g.top+o),r>0&&n.bottom>g.bottom+w&&(w=n.bottom-g.bottom+o)):n.bottom>g.bottom-o&&(w=n.bottom-g.bottom+o,r<0&&n.top-w<g.top&&(w=n.top-(g.top+o)));else{let j=n.bottom-n.top,C=g.bottom-g.top;w=(s=="center"&&j<=C?n.top+j/2-C/2:s=="start"||s=="center"&&r<0?n.top-o:n.bottom-C+o)-g.top}if(i=="nearest"?n.left<g.left+a?(S=n.left-(g.left+a),r>0&&n.right>g.right+S&&(S=n.right-g.right+a)):n.right>g.right-a&&(S=n.right-g.right+a,r<0&&n.left<g.left+S&&(S=n.left-(g.left+a))):S=(i=="center"?n.left+(n.right-n.left)/2-(g.right-g.left)/2:i=="start"==l?n.left-a:n.right-(g.right-g.left)+a)-g.left,S||w)if(_)d.scrollBy(S,w);else{let j=0,C=0;if(w){let T=p.scrollTop;p.scrollTop+=w/v,C=(p.scrollTop-T)*v}if(S){let T=p.scrollLeft;p.scrollLeft+=S/x,j=(p.scrollLeft-T)*x}n={left:n.left-j,top:n.top-C,right:n.right-j,bottom:n.bottom-C},j&&Math.abs(j-S)<1&&(i="nearest"),C&&Math.abs(C-w)<1&&(s="nearest")}if(_)break;(n.top<g.top||n.bottom>g.bottom||n.left<g.left||n.right>g.right)&&(n={left:Math.max(n.left,g.left),right:Math.min(n.right,g.right),top:Math.max(n.top,g.top),bottom:Math.min(n.bottom,g.bottom)}),p=p.assignedSlot||p.parentNode}else if(p.nodeType==11)p=p.host;else break}function mW(e,n=!0){let r=e.ownerDocument,i=null,s=null;for(let a=e.parentNode;a&&!(a==r.body||(!n||i)&&s);)if(a.nodeType==1)!s&&a.scrollHeight>a.clientHeight&&(s=a),n&&!i&&a.scrollWidth>a.clientWidth&&(i=a),a=a.assignedSlot||a.parentNode;else if(a.nodeType==11)a=a.host;else break;return{x:i,y:s}}class Q0e{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}eq(n){return this.anchorNode==n.anchorNode&&this.anchorOffset==n.anchorOffset&&this.focusNode==n.focusNode&&this.focusOffset==n.focusOffset}setRange(n){let{anchorNode:r,focusNode:i}=n;this.set(r,Math.min(n.anchorOffset,r?tc(r):0),i,Math.min(n.focusOffset,i?tc(i):0))}set(n,r,i,s){this.anchorNode=n,this.anchorOffset=r,this.focusNode=i,this.focusOffset=s}}let od=null;gt.safari&&gt.safari_version>=26&&(od=!1);function gW(e){if(e.setActive)return e.setActive();if(od)return e.focus(od);let n=[];for(let r=e;r&&(n.push(r,r.scrollTop,r.scrollLeft),r!=r.ownerDocument);r=r.parentNode);if(e.focus(od==null?{get preventScroll(){return od={preventScroll:!0},!0}}:void 0),!od){od=!1;for(let r=0;r<n.length;){let i=n[r++],s=n[r++],a=n[r++];i.scrollTop!=s&&(i.scrollTop=s),i.scrollLeft!=a&&(i.scrollLeft=a)}}}let vL;function tv(e,n,r=n){let i=vL||(vL=document.createRange());return i.setEnd(e,r),i.setStart(e,n),i}function jf(e,n,r,i){let s={key:n,code:n,keyCode:r,which:r,cancelable:!0};i&&({altKey:s.altKey,ctrlKey:s.ctrlKey,shiftKey:s.shiftKey,metaKey:s.metaKey}=i);let a=new KeyboardEvent("keydown",s);a.synthetic=!0,e.dispatchEvent(a);let o=new KeyboardEvent("keyup",s);return o.synthetic=!0,e.dispatchEvent(o),a.defaultPrevented||o.defaultPrevented}function Z0e(e){for(;e;){if(e&&(e.nodeType==9||e.nodeType==11&&e.host))return e;e=e.assignedSlot||e.parentNode}return null}function J0e(e,n){let r=n.focusNode,i=n.focusOffset;if(!r||n.anchorNode!=r||n.anchorOffset!=i)return!1;for(i=Math.min(i,tc(r));;)if(i){if(r.nodeType!=1)return!1;let s=r.childNodes[i-1];s.contentEditable=="false"?i--:(r=s,i=tc(r))}else{if(r==e)return!0;i=vu(r),r=r.parentNode}}function vW(e){return e instanceof Window?e.pageYOffset>Math.max(0,e.document.documentElement.scrollHeight-e.innerHeight-4):e.scrollTop>Math.max(1,e.scrollHeight-e.clientHeight-4)}function yW(e,n){for(let r=e,i=n;;){if(r.nodeType==3&&i>0)return{node:r,offset:i};if(r.nodeType==1&&i>0){if(r.contentEditable=="false")return null;r=r.childNodes[i-1],i=tc(r)}else if(r.parentNode&&!Db(r))i=vu(r),r=r.parentNode;else return null}}function _W(e,n){for(let r=e,i=n;;){if(r.nodeType==3&&i<r.nodeValue.length)return{node:r,offset:i};if(r.nodeType==1&&i<r.childNodes.length){if(r.contentEditable=="false")return null;r=r.childNodes[i],i=0}else if(r.parentNode&&!Db(r))i=vu(r)+1,r=r.parentNode;else return null}}class Za{constructor(n,r,i=!0){this.node=n,this.offset=r,this.precise=i}static before(n,r){return new Za(n.parentNode,vu(n),r)}static after(n,r){return new Za(n.parentNode,vu(n)+1,r)}}var Jn=(function(e){return e[e.LTR=0]="LTR",e[e.RTL=1]="RTL",e})(Jn||(Jn={}));const zd=Jn.LTR,pT=Jn.RTL;function xW(e){let n=[];for(let r=0;r<e.length;r++)n.push(1<<+e[r]);return n}const eke=xW("88888888888888888888888888888888888666888888787833333333337888888000000000000000000000000008888880000000000000000000000000088888888888888888888888888888888888887866668888088888663380888308888800000000000000000000000800000000000000000000000000000008"),tke=xW("4444448826627288999999999992222222222222222222222222222222222222222222222229999999999999999999994444444444644222822222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222999999949999999229989999223333333333"),_N=Object.create(null),Co=[];for(let e of["()","[]","{}"]){let n=e.charCodeAt(0),r=e.charCodeAt(1);_N[n]=r,_N[r]=-n}function bW(e){return e<=247?eke[e]:1424<=e&&e<=1524?2:1536<=e&&e<=1785?tke[e-1536]:1774<=e&&e<=2220?4:8192<=e&&e<=8204?256:64336<=e&&e<=65023?4:1}const nke=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac\ufb50-\ufdff]/;class Wo{get dir(){return this.level%2?pT:zd}constructor(n,r,i){this.from=n,this.to=r,this.level=i}side(n,r){return this.dir==r==n?this.to:this.from}forward(n,r){return n==(this.dir==r)}static find(n,r,i,s){let a=-1;for(let o=0;o<n.length;o++){let l=n[o];if(l.from<=r&&l.to>=r){if(l.level==i)return o;(a<0||(s!=0?s<0?l.from<r:l.to>r:n[a].level>l.level))&&(a=o)}}if(a<0)throw new RangeError("Index out of range");return a}}function kW(e,n){if(e.length!=n.length)return!1;for(let r=0;r<e.length;r++){let i=e[r],s=n[r];if(i.from!=s.from||i.to!=s.to||i.direction!=s.direction||!kW(i.inner,s.inner))return!1}return!0}const Qn=[];function rke(e,n,r,i,s){for(let a=0;a<=i.length;a++){let o=a?i[a-1].to:n,l=a<i.length?i[a].from:r,u=a?256:s;for(let d=o,p=u,f=u;d<l;d++){let g=bW(e.charCodeAt(d));g==512?g=p:g==8&&f==4&&(g=16),Qn[d]=g==4?2:g,g&7&&(f=g),p=g}for(let d=o,p=u,f=u;d<l;d++){let g=Qn[d];if(g==128)d<l-1&&p==Qn[d+1]&&p&24?g=Qn[d]=p:Qn[d]=256;else if(g==64){let _=d+1;for(;_<l&&Qn[_]==64;)_++;let x=d&&p==8||_<r&&Qn[_]==8?f==1?1:8:256;for(let v=d;v<_;v++)Qn[v]=x;d=_-1}else g==8&&f==1&&(Qn[d]=1);p=g,g&7&&(f=g)}}}function ike(e,n,r,i,s){let a=s==1?2:1;for(let o=0,l=0,u=0;o<=i.length;o++){let d=o?i[o-1].to:n,p=o<i.length?i[o].from:r;for(let f=d,g,_,x;f<p;f++)if(_=_N[g=e.charCodeAt(f)])if(_<0){for(let v=l-3;v>=0;v-=3)if(Co[v+1]==-_){let S=Co[v+2],w=S&2?s:S&4?S&1?a:s:0;w&&(Qn[f]=Qn[Co[v]]=w),l=v;break}}else{if(Co.length==189)break;Co[l++]=f,Co[l++]=g,Co[l++]=u}else if((x=Qn[f])==2||x==1){let v=x==s;u=v?0:1;for(let S=l-3;S>=0;S-=3){let w=Co[S+2];if(w&2)break;if(v)Co[S+2]|=2;else{if(w&4)break;Co[S+2]|=4}}}}}function ske(e,n,r,i){for(let s=0,a=i;s<=r.length;s++){let o=s?r[s-1].to:e,l=s<r.length?r[s].from:n;for(let u=o;u<l;){let d=Qn[u];if(d==256){let p=u+1;for(;;)if(p==l){if(s==r.length)break;p=r[s++].to,l=s<r.length?r[s].from:n}else if(Qn[p]==256)p++;else break;let f=a==1,g=(p<n?Qn[p]:i)==1,_=f==g?f?1:2:i;for(let x=p,v=s,S=v?r[v-1].to:e;x>u;)x==S&&(x=r[--v].from,S=v?r[v-1].to:e),Qn[--x]=_;u=p}else a=d,u++}}}function xN(e,n,r,i,s,a,o){let l=i%2?2:1;if(i%2==s%2)for(let u=n,d=0;u<r;){let p=!0,f=!1;if(d==a.length||u<a[d].from){let v=Qn[u];v!=l&&(p=!1,f=v==16)}let g=!p&&l==1?[]:null,_=p?i:i+1,x=u;e:for(;;)if(d<a.length&&x==a[d].from){if(f)break e;let v=a[d];if(!p)for(let S=v.to,w=d+1;;){if(S==r)break e;if(w<a.length&&a[w].from==S)S=a[w++].to;else{if(Qn[S]==l)break e;break}}if(d++,g)g.push(v);else{v.from>u&&o.push(new Wo(u,v.from,_));let S=v.direction==zd!=!(_%2);bN(e,S?i+1:i,s,v.inner,v.from,v.to,o),u=v.to}x=v.to}else{if(x==r||(p?Qn[x]!=l:Qn[x]==l))break;x++}g?xN(e,u,x,i+1,s,g,o):u<x&&o.push(new Wo(u,x,_)),u=x}else for(let u=r,d=a.length;u>n;){let p=!0,f=!1;if(!d||u>a[d-1].to){let v=Qn[u-1];v!=l&&(p=!1,f=v==16)}let g=!p&&l==1?[]:null,_=p?i:i+1,x=u;e:for(;;)if(d&&x==a[d-1].to){if(f)break e;let v=a[--d];if(!p)for(let S=v.from,w=d;;){if(S==n)break e;if(w&&a[w-1].to==S)S=a[--w].from;else{if(Qn[S-1]==l)break e;break}}if(g)g.push(v);else{v.to<u&&o.push(new Wo(v.to,u,_));let S=v.direction==zd!=!(_%2);bN(e,S?i+1:i,s,v.inner,v.from,v.to,o),u=v.from}x=v.from}else{if(x==n||(p?Qn[x-1]!=l:Qn[x-1]==l))break;x--}g?xN(e,x,u,i+1,s,g,o):x<u&&o.push(new Wo(x,u,_)),u=x}}function bN(e,n,r,i,s,a,o){let l=n%2?2:1;rke(e,s,a,i,l),ike(e,s,a,i,l),ske(s,a,i,l),xN(e,s,a,n,r,i,o)}function ake(e,n,r){if(!e)return[new Wo(0,0,n==pT?1:0)];if(n==zd&&!r.length&&!nke.test(e))return wW(e.length);if(r.length)for(;e.length>Qn.length;)Qn[Qn.length]=256;let i=[],s=n==zd?0:1;return bN(e,s,s,r,0,e.length,i),i}function wW(e){return[new Wo(0,e,0)]}let SW="";function oke(e,n,r,i,s){var a;let o=i.head-e.from,l=Wo.find(n,o,(a=i.bidiLevel)!==null&&a!==void 0?a:-1,i.assoc),u=n[l],d=u.side(s,r);if(o==d){let g=l+=s?1:-1;if(g<0||g>=n.length)return null;u=n[l=g],o=u.side(!s,r),d=u.side(s,r)}let p=gi(e.text,o,u.forward(s,r));(p<u.from||p>u.to)&&(p=d),SW=e.text.slice(Math.min(o,p),Math.max(o,p));let f=l==(s?n.length-1:0)?null:n[l+(s?1:-1)];return f&&p==d&&f.level+(s?0:1)<u.level?Be.cursor(f.side(!s,r)+e.from,f.forward(s,r)?1:-1,f.level):Be.cursor(p+e.from,u.forward(s,r)?-1:1,u.level)}function lke(e,n,r){for(let i=n;i<r;i++){let s=bW(e.charCodeAt(i));if(s==1)return zd;if(s==2||s==4)return pT}return zd}const CW=pt.define(),jW=pt.define(),NW=pt.define(),EW=pt.define(),kN=pt.define(),AW=pt.define(),TW=pt.define(),mT=pt.define(),gT=pt.define(),MW=pt.define({combine:e=>e.some(n=>n)}),RW=pt.define({combine:e=>e.some(n=>n)}),OW=pt.define();class Nf{constructor(n,r,i,s,a,o=!1){this.range=n,this.y=r,this.x=i,this.yMargin=s,this.xMargin=a,this.isSnapshot=o}map(n){return n.empty?this:new Nf(this.range.map(n),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}clip(n){return this.range.to<=n.doc.length?this:new Nf(Be.cursor(n.doc.length),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}}const M_=Gt.define({map:(e,n)=>e.map(n)}),DW=Gt.define();function ss(e,n,r){let i=e.facet(EW);i.length?i[0](n):window.onerror&&window.onerror(String(n),r,void 0,void 0,n)||(r?console.error(r+":",n):console.error(n))}const Bl=pt.define({combine:e=>e.length?e[0]:!0});let cke=0;const hf=pt.define({combine(e){return e.filter((n,r)=>{for(let i=0;i<r;i++)if(e[i].plugin==n.plugin)return!1;return!0})}});class Cr{constructor(n,r,i,s,a){this.id=n,this.create=r,this.domEventHandlers=i,this.domEventObservers=s,this.baseExtensions=a(this),this.extension=this.baseExtensions.concat(hf.of({plugin:this,arg:void 0}))}of(n){return this.baseExtensions.concat(hf.of({plugin:this,arg:n}))}static define(n,r){const{eventHandlers:i,eventObservers:s,provide:a,decorations:o}=r||{};return new Cr(cke++,n,i,s,l=>{let u=[];return o&&u.push(ek.of(d=>{let p=d.plugin(l);return p?o(p):Pt.none})),a&&u.push(a(l)),u})}static fromClass(n,r){return Cr.define((i,s)=>new n(i,s),r)}}class HS{constructor(n){this.spec=n,this.mustUpdate=null,this.value=null}get plugin(){return this.spec&&this.spec.plugin}update(n){if(this.value){if(this.mustUpdate){let r=this.mustUpdate;if(this.mustUpdate=null,this.value.update)try{this.value.update(r)}catch(i){if(ss(r.state,i,"CodeMirror plugin crashed"),this.value.destroy)try{this.value.destroy()}catch{}this.deactivate()}}}else if(this.spec)try{this.value=this.spec.plugin.create(n,this.spec.arg)}catch(r){ss(n.state,r,"CodeMirror plugin crashed"),this.deactivate()}return this}destroy(n){var r;if(!((r=this.value)===null||r===void 0)&&r.destroy)try{this.value.destroy()}catch(i){ss(n.state,i,"CodeMirror plugin crashed")}}deactivate(){this.spec=this.value=null}}const PW=pt.define(),vT=pt.define(),ek=pt.define(),LW=pt.define(),yT=pt.define(),Uv=pt.define(),IW=pt.define();function yL(e,n){let r=e.state.facet(IW);if(!r.length)return r;let i=r.map(a=>a instanceof Function?a(e):a),s=[];return rn.spans(i,n.from,n.to,{point(){},span(a,o,l,u){let d=a-n.from,p=o-n.from,f=s;for(let g=l.length-1;g>=0;g--,u--){let _=l[g].spec.bidiIsolate,x;if(_==null&&(_=lke(n.text,d,p)),u>0&&f.length&&(x=f[f.length-1]).to==d&&x.direction==_)x.to=p,f=x.inner;else{let v={from:d,to:p,direction:_,inner:[]};f.push(v),f=v.inner}}}}),s}const BW=pt.define();function _T(e){let n=0,r=0,i=0,s=0;for(let a of e.state.facet(BW)){let o=a(e);o&&(o.left!=null&&(n=Math.max(n,o.left)),o.right!=null&&(r=Math.max(r,o.right)),o.top!=null&&(i=Math.max(i,o.top)),o.bottom!=null&&(s=Math.max(s,o.bottom)))}return{left:n,right:r,top:i,bottom:s}}const Ym=pt.define();class Ea{constructor(n,r,i,s){this.fromA=n,this.toA=r,this.fromB=i,this.toB=s}join(n){return new Ea(Math.min(this.fromA,n.fromA),Math.max(this.toA,n.toA),Math.min(this.fromB,n.fromB),Math.max(this.toB,n.toB))}addToSet(n){let r=n.length,i=this;for(;r>0;r--){let s=n[r-1];if(!(s.fromA>i.toA)){if(s.toA<i.fromA)break;i=i.join(s),n.splice(r-1,1)}}return n.splice(r,0,i),n}static extendWithRanges(n,r){if(r.length==0)return n;let i=[];for(let s=0,a=0,o=0;;){let l=s<n.length?n[s].fromB:1e9,u=a<r.length?r[a]:1e9,d=Math.min(l,u);if(d==1e9)break;let p=d+o,f=d,g=p;for(;;)if(a<r.length&&r[a]<=f){let _=r[a+1];a+=2,f=Math.max(f,_);for(let x=s;x<n.length&&n[x].fromB<=f;x++)o=n[x].toA-n[x].toB;g=Math.max(g,_+o)}else if(s<n.length&&n[s].fromB<=f){let _=n[s++];f=Math.max(f,_.toB),g=Math.max(g,_.toA),o=_.toA-_.toB}else break;i.push(new Ea(p,g,d,f))}return i}}class Pb{constructor(n,r,i){this.view=n,this.state=r,this.transactions=i,this.flags=0,this.startState=n.state,this.changes=ri.empty(this.startState.doc.length);for(let a of i)this.changes=this.changes.compose(a.changes);let s=[];this.changes.iterChangedRanges((a,o,l,u)=>s.push(new Ea(a,o,l,u))),this.changedRanges=s}static create(n,r,i){return new Pb(n,r,i)}get viewportChanged(){return(this.flags&4)>0}get viewportMoved(){return(this.flags&8)>0}get heightChanged(){return(this.flags&2)>0}get geometryChanged(){return this.docChanged||(this.flags&18)>0}get focusChanged(){return(this.flags&1)>0}get docChanged(){return!this.changes.empty}get selectionSet(){return this.transactions.some(n=>n.selection)}get empty(){return this.flags==0&&this.transactions.length==0}}const uke=[];class Or{constructor(n,r,i=0){this.dom=n,this.length=r,this.flags=i,this.parent=null,n.cmTile=this}get breakAfter(){return this.flags&1}get children(){return uke}isWidget(){return!1}get isHidden(){return!1}isComposite(){return!1}isLine(){return!1}isText(){return!1}isBlock(){return!1}get domAttrs(){return null}sync(n){if(this.flags|=2,this.flags&4){this.flags&=-5;let r=this.domAttrs;r&&K0e(this.dom,r)}}toString(){return this.constructor.name+(this.children.length?`(${this.children})`:"")+(this.breakAfter?"#":"")}destroy(){this.parent=null}setDOM(n){this.dom=n,n.cmTile=this}get posAtStart(){return this.parent?this.parent.posBefore(this):0}get posAtEnd(){return this.posAtStart+this.length}posBefore(n,r=this.posAtStart){let i=r;for(let s of this.children){if(s==n)return i;i+=s.length+s.breakAfter}throw new RangeError("Invalid child in posBefore")}posAfter(n){return this.posBefore(n)+n.length}covers(n){return!0}coordsIn(n,r){return null}domPosFor(n,r){let i=vu(this.dom),s=this.length?n>0:r>0;return new Za(this.parent.dom,i+(s?1:0),n==0||n==this.length)}markDirty(n){this.flags&=-3,n&&(this.flags|=4),this.parent&&this.parent.flags&2&&this.parent.markDirty(!1)}get overrideDOMText(){return null}get root(){for(let n=this;n;n=n.parent)if(n instanceof nk)return n;return null}static get(n){return n.cmTile}}class tk extends Or{constructor(n){super(n,0),this._children=[]}isComposite(){return!0}get children(){return this._children}get lastChild(){return this.children.length?this.children[this.children.length-1]:null}append(n){this.children.push(n),n.parent=this}sync(n){if(this.flags&2)return;super.sync(n);let r=this.dom,i=null,s,a=(n==null?void 0:n.node)==r?n:null,o=0;for(let l of this.children){if(l.sync(n),o+=l.length+l.breakAfter,s=i?i.nextSibling:r.firstChild,a&&s!=l.dom&&(a.written=!0),l.dom.parentNode==r)for(;s&&s!=l.dom;)s=_L(s);else r.insertBefore(l.dom,s);i=l.dom}for(s=i?i.nextSibling:r.firstChild,a&&s&&(a.written=!0);s;)s=_L(s);this.length=o}}function _L(e){let n=e.nextSibling;return e.parentNode.removeChild(e),n}class nk extends tk{constructor(n,r){super(r),this.view=n}owns(n){for(;n;n=n.parent)if(n==this)return!0;return!1}isBlock(){return!0}nearest(n){for(;;){if(!n)return null;let r=Or.get(n);if(r&&this.owns(r))return r;n=n.parentNode}}blockTiles(n){for(let r=[],i=this,s=0,a=0;;)if(s==i.children.length){if(!r.length)return;i=i.parent,i.breakAfter&&a++,s=r.pop()}else{let o=i.children[s++];if(o instanceof Kl)r.push(s),i=o,s=0;else{let l=a+o.length,u=n(o,a);if(u!==void 0)return u;a=l+o.breakAfter}}}resolveBlock(n,r){let i,s=-1,a,o=-1;if(this.blockTiles((l,u)=>{let d=u+l.length;if(n>=u&&n<=d){if(l.isWidget()&&r>=-1&&r<=1){if(l.flags&32)return!0;l.flags&16&&(i=void 0)}(u<n||n==d&&(r<-1?l.length:l.covers(1)))&&(!i||!l.isWidget()&&i.isWidget())&&(i=l,s=n-u),(d>n||n==u&&(r>1?l.length:l.covers(-1)))&&(!a||!l.isWidget()&&a.isWidget())&&(a=l,o=n-u)}}),!i&&!a)throw new Error("No tile at position "+n);return i&&r<0||!a?{tile:i,offset:s}:{tile:a,offset:o}}}class Kl extends tk{constructor(n,r){super(n),this.wrapper=r}isBlock(){return!0}covers(n){return this.children.length?n<0?this.children[0].covers(-1):this.lastChild.covers(1):!1}get domAttrs(){return this.wrapper.attributes}static of(n,r){let i=new Kl(r||document.createElement(n.tagName),n);return r||(i.flags|=4),i}}class Gf extends tk{constructor(n,r){super(n),this.attrs=r}isLine(){return!0}static start(n,r,i){let s=new Gf(r||document.createElement("div"),n);return(!r||!i)&&(s.flags|=4),s}get domAttrs(){return this.attrs}resolveInline(n,r,i){let s=null,a=-1,o=null,l=-1;function u(p,f){for(let g=0,_=0;g<p.children.length&&_<=f;g++){let x=p.children[g],v=_+x.length;v>=f&&(x.isComposite()?u(x,f-_):(!o||o.isHidden&&(r>0||i&&hke(o,x)))&&(v>f||x.flags&32)?(o=x,l=f-_):(_<f||x.flags&16&&!x.isHidden)&&(s=x,a=f-_)),_=v}}u(this,n);let d=(r<0?s:o)||s||o;return d?{tile:d,offset:d==s?a:l}:null}coordsIn(n,r){let i=this.resolveInline(n,r,!0);return i?i.tile.coordsIn(Math.max(0,i.offset),r):dke(this)}domIn(n,r){let i=this.resolveInline(n,r);if(i){let{tile:s,offset:a}=i;if(this.dom.contains(s.dom))return s.isText()?new Za(s.dom,Math.min(s.dom.nodeValue.length,a)):s.domPosFor(a,s.flags&16?1:s.flags&32?-1:r);let o=i.tile.parent,l=!1;for(let u of o.children){if(l)return new Za(u.dom,0);u==i.tile&&(l=!0)}}return new Za(this.dom,0)}}function dke(e){let n=e.dom.lastChild;if(!n)return e.dom.getBoundingClientRect();let r=vg(n);return r[r.length-1]||null}function hke(e,n){let r=e.coordsIn(0,1),i=n.coordsIn(0,1);return r&&i&&i.top<r.bottom}class Cs extends tk{constructor(n,r){super(n),this.mark=r}get domAttrs(){return this.mark.attrs}static of(n,r){let i=new Cs(r||document.createElement(n.tagName),n);return r||(i.flags|=4),i}}class yd extends Or{constructor(n,r){super(n,r.length),this.text=r}sync(n){this.flags&2||(super.sync(n),this.dom.nodeValue!=this.text&&(n&&n.node==this.dom&&(n.written=!0),this.dom.nodeValue=this.text))}isText(){return!0}toString(){return JSON.stringify(this.text)}coordsIn(n,r){let i=this.dom.nodeValue.length;n>i&&(n=i);let s=n,a=n,o=0;n==0&&r<0||n==i&&r>=0?gt.chrome||gt.gecko||(n?(s--,o=1):a<i&&(a++,o=-1)):r<0?s--:a<i&&a++;let l=tv(this.dom,s,a).getClientRects();if(!l.length)return null;let u=l[(o?o<0:r>=0)?0:l.length-1];return gt.safari&&!o&&u.width==0&&(u=Array.prototype.find.call(l,d=>d.width)||u),o?ev(u,o<0):u||null}static of(n,r){let i=new yd(r||document.createTextNode(n),n);return r||(i.flags|=2),i}}class $d extends Or{constructor(n,r,i,s){super(n,r,s),this.widget=i}isWidget(){return!0}get isHidden(){return this.widget.isHidden}covers(n){return this.flags&48?!1:(this.flags&(n<0?64:128))>0}coordsIn(n,r){return this.coordsInWidget(n,r,!1)}coordsInWidget(n,r,i){let s=this.widget.coordsAt(this.dom,n,r);if(s)return s;if(i)return ev(this.dom.getBoundingClientRect(),this.length?n==0:r<=0);{let a=this.dom.getClientRects(),o=null;if(!a.length)return null;let l=this.flags&16?!0:this.flags&32?!1:n>0;for(let u=l?a.length-1:0;o=a[u],!(n>0?u==0:u==a.length-1||o.top<o.bottom);u+=l?-1:1);return ev(o,!l)}}get overrideDOMText(){if(!this.length)return Dn.empty;let{root:n}=this;if(!n)return Dn.empty;let r=this.posAtStart;return n.view.state.doc.slice(r,r+this.length)}destroy(){super.destroy(),this.widget.destroy(this.dom)}static of(n,r,i,s,a){return a||(a=n.toDOM(r),n.editable||(a.contentEditable="false")),new $d(a,i,n,s)}}class Lb extends Or{constructor(n){let r=document.createElement("img");r.className="cm-widgetBuffer",r.setAttribute("aria-hidden","true"),super(r,0,n)}get isHidden(){return!0}get overrideDOMText(){return Dn.empty}coordsIn(n){return this.dom.getBoundingClientRect()}}class fke{constructor(n){this.index=0,this.beforeBreak=!1,this.parents=[],this.tile=n}advance(n,r,i){let{tile:s,index:a,beforeBreak:o,parents:l}=this;for(;n||r>0;)if(s.isComposite())if(o){if(!n)break;i&&i.break(),n--,o=!1}else if(a==s.children.length){if(!n&&!l.length)break;i&&i.leave(s),o=!!s.breakAfter,{tile:s,index:a}=l.pop(),a++}else{let u=s.children[a],d=u.breakAfter;(r>0?u.length<=n:u.length<n)&&(!i||i.skip(u,0,u.length)!==!1||!u.isComposite)?(o=!!d,a++,n-=u.length):(l.push({tile:s,index:a}),s=u,a=0,i&&u.isComposite()&&i.enter(u))}else if(a==s.length)o=!!s.breakAfter,{tile:s,index:a}=l.pop(),a++;else if(n){let u=Math.min(n,s.length-a);i&&i.skip(s,a,a+u),n-=u,a+=u}else break;return this.tile=s,this.index=a,this.beforeBreak=o,this}get root(){return this.parents.length?this.parents[0].tile:this.tile}}class pke{constructor(n,r,i,s){this.from=n,this.to=r,this.wrapper=i,this.rank=s}}class mke{constructor(n,r,i){this.cache=n,this.root=r,this.blockWrappers=i,this.curLine=null,this.lastBlock=null,this.afterWidget=null,this.pos=0,this.wrappers=[],this.wrapperPos=0}addText(n,r,i,s){var a;this.flushBuffer();let o=this.ensureMarks(r,i),l=o.lastChild;if(l&&l.isText()&&!(l.flags&8)&&l.length+n.length<512){this.cache.reused.set(l,2);let u=o.children[o.children.length-1]=new yd(l.dom,l.text+n);u.parent=o}else o.append(s||yd.of(n,(a=this.cache.find(yd))===null||a===void 0?void 0:a.dom));this.pos+=n.length,this.afterWidget=null}addComposition(n,r){let i=this.curLine;i.dom!=r.line.dom&&(i.setDOM(this.cache.reused.has(r.line)?WS(r.line.dom):r.line.dom),this.cache.reused.set(r.line,2));let s=i;for(let l=r.marks.length-1;l>=0;l--){let u=r.marks[l],d=s.lastChild;if(d instanceof Cs&&d.mark.eq(u.mark))d.dom!=u.dom&&d.setDOM(WS(u.dom)),s=d;else{if(this.cache.reused.get(u)){let f=Or.get(u.dom);f&&f.setDOM(WS(u.dom))}let p=Cs.of(u.mark,u.dom);s.append(p),s=p}this.cache.reused.set(u,2)}let a=Or.get(n.text);a&&this.cache.reused.set(a,2);let o=new yd(n.text,n.text.nodeValue);o.flags|=8,s.append(o)}addInlineWidget(n,r,i){let s=this.afterWidget&&n.flags&48&&(this.afterWidget.flags&48)==(n.flags&48);s||this.flushBuffer();let a=this.ensureMarks(r,i);!s&&!(n.flags&16)&&a.append(this.getBuffer(1)),a.append(n),this.pos+=n.length,this.afterWidget=n}addMark(n,r,i){this.flushBuffer(),this.ensureMarks(r,i).append(n),this.pos+=n.length,this.afterWidget=null}addBlockWidget(n){this.getBlockPos().append(n),this.pos+=n.length,this.lastBlock=n,this.endLine()}continueWidget(n){let r=this.afterWidget||this.lastBlock;r.length+=n,this.pos+=n}addLineStart(n,r){var i;n||(n=zW);let s=Gf.start(n,r||((i=this.cache.find(Gf))===null||i===void 0?void 0:i.dom),!!r);this.getBlockPos().append(this.lastBlock=this.curLine=s)}addLine(n){this.getBlockPos().append(n),this.pos+=n.length,this.lastBlock=n,this.endLine()}addBreak(){this.lastBlock.flags|=1,this.endLine(),this.pos++}addLineStartIfNotCovered(n){this.blockPosCovered()||this.addLineStart(n)}ensureLine(n){this.curLine||this.addLineStart(n)}ensureMarks(n,r){var i;let s=this.curLine;for(let a=n.length-1;a>=0;a--){let o=n[a],l;if(r>0&&(l=s.lastChild)&&l instanceof Cs&&l.mark.eq(o))s=l,r--;else{let u=Cs.of(o,(i=this.cache.find(Cs,d=>d.mark.eq(o)))===null||i===void 0?void 0:i.dom);s.append(u),s=u,r=0}}return s}endLine(){if(this.curLine){this.flushBuffer();let n=this.curLine.lastChild;(!n||!xL(this.curLine,!1)||n.dom.nodeName!="BR"&&n.isWidget()&&!(gt.ios&&xL(this.curLine,!0)))&&this.curLine.append(this.cache.findWidget(qS,0,32)||new $d(qS.toDOM(),0,qS,32)),this.curLine=this.afterWidget=null}}updateBlockWrappers(){this.wrapperPos>this.pos+1e4&&(this.blockWrappers.goto(this.pos),this.wrappers.length=0);for(let n=this.wrappers.length-1;n>=0;n--)this.wrappers[n].to<this.pos&&this.wrappers.splice(n,1);for(let n=this.blockWrappers;n.value&&n.from<=this.pos;n.next())if(n.to>=this.pos){let r=new pke(n.from,n.to,n.value,n.rank),i=this.wrappers.length;for(;i>0&&(this.wrappers[i-1].rank-r.rank||this.wrappers[i-1].to-r.to)<0;)i--;this.wrappers.splice(i,0,r)}this.wrapperPos=this.pos}getBlockPos(){var n;this.updateBlockWrappers();let r=this.root;for(let i of this.wrappers){let s=r.lastChild;if(i.from<this.pos&&s instanceof Kl&&s.wrapper.eq(i.wrapper))r=s;else{let a=Kl.of(i.wrapper,(n=this.cache.find(Kl,o=>o.wrapper.eq(i.wrapper)))===null||n===void 0?void 0:n.dom);r.append(a),r=a}}return r}blockPosCovered(){let n=this.lastBlock;return n!=null&&!n.breakAfter&&(!n.isWidget()||(n.flags&160)>0)}getBuffer(n){let r=2|(n<0?16:32),i=this.cache.find(Lb,void 0,1);return i&&(i.flags=r),i||new Lb(r)}flushBuffer(){this.afterWidget&&!(this.afterWidget.flags&32)&&(this.afterWidget.parent.append(this.getBuffer(-1)),this.afterWidget=null)}}class gke{constructor(n){this.skipCount=0,this.text="",this.textOff=0,this.cursor=n.iter()}skip(n){this.textOff+n<=this.text.length?this.textOff+=n:(this.skipCount+=n-(this.text.length-this.textOff),this.text="",this.textOff=0)}next(n){if(this.textOff==this.text.length){let{value:s,lineBreak:a,done:o}=this.cursor.next(this.skipCount);if(this.skipCount=0,o)throw new Error("Ran out of text content when drawing inline views");this.text=s;let l=this.textOff=Math.min(n,s.length);return a?null:s.slice(0,l)}let r=Math.min(this.text.length,this.textOff+n),i=this.text.slice(this.textOff,r);return this.textOff=r,i}}const Ib=[$d,Gf,yd,Cs,Lb,Kl,nk];for(let e=0;e<Ib.length;e++)Ib[e].bucket=e;class vke{constructor(n){this.view=n,this.buckets=Ib.map(()=>[]),this.index=Ib.map(()=>0),this.reused=new Map}add(n){let r=n.constructor.bucket,i=this.buckets[r];i.length<6?i.push(n):i[this.index[r]=(this.index[r]+1)%6]=n}find(n,r,i=2){let s=n.bucket,a=this.buckets[s],o=this.index[s];for(let l=a.length-1;l>=0;l--){let u=(l+o)%a.length,d=a[u];if((!r||r(d))&&!this.reused.has(d))return a.splice(u,1),u<o&&this.index[s]--,this.reused.set(d,i),d}return null}findWidget(n,r,i){let s=this.buckets[0];if(s.length)for(let a=0,o=0;;a++){if(a==s.length){if(o)return null;o=1,a=0}let l=s[a];if(!this.reused.has(l)&&(o==0?l.widget.compare(n):l.widget.constructor==n.constructor&&n.updateDOM(l.dom,this.view,l.widget)))return s.splice(a,1),a<this.index[0]&&this.index[0]--,l.widget==n&&l.length==r&&(l.flags&497)==i?(this.reused.set(l,1),l):(this.reused.set(l,2),new $d(l.dom,r,n,l.flags&-498|i))}}reuse(n){return this.reused.set(n,1),n}maybeReuse(n,r=2){if(!this.reused.has(n))return this.reused.set(n,r),n.dom}clear(){for(let n=0;n<this.buckets.length;n++)this.buckets[n].length=this.index[n]=0}}class yke{constructor(n,r,i,s,a){this.view=n,this.decorations=s,this.disallowBlockEffectsFor=a,this.openWidget=!1,this.openMarks=0,this.cache=new vke(n),this.text=new gke(n.state.doc),this.builder=new mke(this.cache,new nk(n,n.contentDOM),rn.iter(i)),this.cache.reused.set(r,2),this.old=new fke(r),this.reuseWalker={skip:(o,l,u)=>{if(this.cache.add(o),o.isComposite())return!1},enter:o=>this.cache.add(o),leave:()=>{},break:()=>{}}}run(n,r){let i=r&&this.getCompositionContext(r.text);for(let s=0,a=0,o=0;;){let l=o<n.length?n[o++]:null,u=l?l.fromA:this.old.root.length;if(u>s){let d=u-s;this.preserve(d,!o,!l),s=u,a+=d}if(!l)break;r&&l.fromA<=r.range.fromA&&l.toA>=r.range.toA?(this.forward(l.fromA,r.range.fromA,r.range.fromA<r.range.toA?1:-1),this.emit(a,r.range.fromB),this.cache.clear(),this.builder.addComposition(r,i),this.text.skip(r.range.toB-r.range.fromB),this.forward(r.range.fromA,l.toA),this.emit(r.range.toB,l.toB)):(this.forward(l.fromA,l.toA),this.emit(a,l.toB)),a=l.toB,s=l.toA}return this.builder.curLine&&this.builder.endLine(),this.builder.root}preserve(n,r,i){let s=bke(this.old),a=this.openMarks;this.old.advance(n,i?1:-1,{skip:(o,l,u)=>{if(o.isWidget())if(this.openWidget)this.builder.continueWidget(u-l);else{let d=u>0||l<o.length?$d.of(o.widget,this.view,u-l,o.flags&496,this.cache.maybeReuse(o)):this.cache.reuse(o);d.flags&256?(d.flags&=-2,this.builder.addBlockWidget(d)):(this.builder.ensureLine(null),this.builder.addInlineWidget(d,s,a),a=s.length)}else if(o.isText())this.builder.ensureLine(null),!l&&u==o.length&&!this.cache.reused.has(o)?this.builder.addText(o.text,s,a,this.cache.reuse(o)):(this.cache.add(o),this.builder.addText(o.text.slice(l,u),s,a)),a=s.length;else if(o.isLine())o.flags&=-2,this.cache.reused.set(o,1),this.builder.addLine(o);else if(o instanceof Lb)this.cache.add(o);else if(o instanceof Cs)this.builder.ensureLine(null),this.builder.addMark(o,s,a),this.cache.reused.set(o,1),a=s.length;else return!1;this.openWidget=!1},enter:o=>{o.isLine()?this.builder.addLineStart(o.attrs,this.cache.maybeReuse(o)):(this.cache.add(o),o instanceof Cs&&s.unshift(o.mark)),this.openWidget=!1},leave:o=>{o.isLine()?s.length&&(s.length=a=0):o instanceof Cs&&(s.shift(),a=Math.min(a,s.length))},break:()=>{this.builder.addBreak(),this.openWidget=!1}}),this.text.skip(n)}emit(n,r){let i=null,s=this.builder,a=0,o=rn.spans(this.decorations,n,r,{point:(l,u,d,p,f,g)=>{if(d instanceof Bd){if(this.disallowBlockEffectsFor[g]){if(d.block)throw new RangeError("Block decorations may not be specified via plugins");if(u>this.view.state.doc.lineAt(l).to)throw new RangeError("Decorations that replace line breaks may not be specified via plugins")}if(a=p.length,f>p.length)s.continueWidget(u-l);else{let _=d.widget||(d.block?Xf.block:Xf.inline),x=_ke(d),v=this.cache.findWidget(_,u-l,x)||$d.of(_,this.view,u-l,x);d.block?(d.startSide>0&&s.addLineStartIfNotCovered(i),s.addBlockWidget(v)):(s.ensureLine(i),s.addInlineWidget(v,p,f))}i=null}else i=xke(i,d);u>l&&this.text.skip(u-l)},span:(l,u,d,p)=>{for(let f=l;f<u;){let g=this.text.next(Math.min(512,u-f));g==null?(s.addLineStartIfNotCovered(i),s.addBreak(),f++):(s.ensureLine(i),s.addText(g,d,f==l?p:d.length),f+=g.length),i=null}}});s.addLineStartIfNotCovered(i),this.openWidget=o>a,this.openMarks=o}forward(n,r,i=1){r-n<=10?this.old.advance(r-n,i,this.reuseWalker):(this.old.advance(5,-1,this.reuseWalker),this.old.advance(r-n-10,-1),this.old.advance(5,i,this.reuseWalker))}getCompositionContext(n){let r=[],i=null;for(let s=n.parentNode;;s=s.parentNode){let a=Or.get(s);if(s==this.view.contentDOM)break;a instanceof Cs?r.push(a):a!=null&&a.isLine()?i=a:a instanceof Kl||(s.nodeName=="DIV"&&!i&&s!=this.view.contentDOM?i=new Gf(s,zW):i||r.push(Cs.of(new Wv({tagName:s.nodeName.toLowerCase(),attributes:V0e(s)}),s)))}return{line:i,marks:r}}}function xL(e,n){let r=i=>{for(let s of i.children)if((n?s.isText():s.length)||r(s))return!0;return!1};return r(e)}function _ke(e){let n=e.isReplace?(e.startSide<0?64:0)|(e.endSide>0?128:0):e.startSide>0?32:16;return e.block&&(n|=256),n}const zW={class:"cm-line"};function xke(e,n){let r=n.spec.attributes,i=n.spec.class;return!r&&!i||(e||(e={class:"cm-line"}),r&&hT(r,e),i&&(e.class+=" "+i)),e}function bke(e){let n=[];for(let r=e.parents.length;r>1;r--){let i=r==e.parents.length?e.tile:e.parents[r].tile;i instanceof Cs&&n.push(i.mark)}return n}function WS(e){let n=Or.get(e);return n&&n.setDOM(e.cloneNode()),e}class Xf extends ol{constructor(n){super(),this.tag=n}eq(n){return n.tag==this.tag}toDOM(){return document.createElement(this.tag)}updateDOM(n){return n.nodeName.toLowerCase()==this.tag}get isHidden(){return!0}}Xf.inline=new Xf("span");Xf.block=new Xf("div");const qS=new class extends ol{toDOM(){return document.createElement("br")}get isHidden(){return!0}get editable(){return!0}};class bL{constructor(n){this.view=n,this.decorations=[],this.blockWrappers=[],this.dynamicDecorationMap=[!1],this.domChanged=null,this.hasComposition=null,this.editContextFormatting=Pt.none,this.lastCompositionAfterCursor=!1,this.minWidth=0,this.minWidthFrom=0,this.minWidthTo=0,this.impreciseAnchor=null,this.impreciseHead=null,this.forceSelection=!1,this.lastUpdate=Date.now(),this.updateDeco(),this.tile=new nk(n,n.contentDOM),this.updateInner([new Ea(0,0,0,n.state.doc.length)],null)}update(n){var r;let i=n.changedRanges;this.minWidth>0&&i.length&&(i.every(({fromA:p,toA:f})=>f<this.minWidthFrom||p>this.minWidthTo)?(this.minWidthFrom=n.changes.mapPos(this.minWidthFrom,1),this.minWidthTo=n.changes.mapPos(this.minWidthTo,1)):this.minWidth=this.minWidthFrom=this.minWidthTo=0),this.updateEditContextFormatting(n);let s=-1;this.view.inputState.composing>=0&&!this.view.observer.editContext&&(!((r=this.domChanged)===null||r===void 0)&&r.newSel?s=this.domChanged.newSel.head:!Tke(n.changes,this.hasComposition)&&!n.selectionSet&&(s=n.state.selection.main.head));let a=s>-1?wke(this.view,n.changes,s):null;if(this.domChanged=null,this.hasComposition){let{from:p,to:f}=this.hasComposition;i=new Ea(p,f,n.changes.mapPos(p,-1),n.changes.mapPos(f,1)).addToSet(i.slice())}this.hasComposition=a?{from:a.range.fromB,to:a.range.toB}:null,(gt.ie||gt.chrome)&&!a&&n&&n.state.doc.lines!=n.startState.doc.lines&&(this.forceSelection=!0);let o=this.decorations,l=this.blockWrappers;this.updateDeco();let u=jke(o,this.decorations,n.changes);u.length&&(i=Ea.extendWithRanges(i,u));let d=Eke(l,this.blockWrappers,n.changes);return d.length&&(i=Ea.extendWithRanges(i,d)),a&&!i.some(p=>p.fromA<=a.range.fromA&&p.toA>=a.range.toA)&&(i=a.range.addToSet(i.slice())),this.tile.flags&2&&i.length==0?!1:(this.updateInner(i,a),n.transactions.length&&(this.lastUpdate=Date.now()),!0)}updateInner(n,r){this.view.viewState.mustMeasureContent=!0;let{observer:i}=this.view;i.ignore(()=>{if(r||n.length){let o=this.tile,l=new yke(this.view,o,this.blockWrappers,this.decorations,this.dynamicDecorationMap);r&&Or.get(r.text)&&l.cache.reused.set(Or.get(r.text),2),this.tile=l.run(n,r),wN(o,l.cache.reused)}this.tile.dom.style.height=this.view.viewState.contentHeight/this.view.scaleY+"px",this.tile.dom.style.flexBasis=this.minWidth?this.minWidth+"px":"";let a=gt.chrome||gt.ios?{node:i.selectionRange.focusNode,written:!1}:void 0;this.tile.sync(a),a&&(a.written||i.selectionRange.focusNode!=a.node||!this.tile.dom.contains(a.node))&&(this.forceSelection=!0),this.tile.dom.style.height=""});let s=[];if(this.view.viewport.from||this.view.viewport.to<this.view.state.doc.length)for(let a of this.tile.children)a.isWidget()&&a.widget instanceof US&&s.push(a.dom);i.updateGaps(s)}updateEditContextFormatting(n){this.editContextFormatting=this.editContextFormatting.map(n.changes);for(let r of n.transactions)for(let i of r.effects)i.is(DW)&&(this.editContextFormatting=i.value)}updateSelection(n=!1,r=!1){(n||!this.view.observer.selectionRange.focusNode)&&this.view.observer.readSelectionRange();let{dom:i}=this.tile,s=this.view.root.activeElement,a=s==i,o=!a&&!(this.view.state.facet(Bl)||i.tabIndex>-1)&&gg(i,this.view.observer.selectionRange)&&!(s&&i.contains(s));if(!(a||r||o))return;let l=this.forceSelection;this.forceSelection=!1;let u=this.view.state.selection.main,d,p;if(u.empty?p=d=this.inlineDOMNearPos(u.anchor,u.assoc||1):(p=this.inlineDOMNearPos(u.head,u.head==u.from?1:-1),d=this.inlineDOMNearPos(u.anchor,u.anchor==u.from?1:-1)),gt.gecko&&u.empty&&!this.hasComposition&&kke(d)){let g=document.createTextNode("");this.view.observer.ignore(()=>d.node.insertBefore(g,d.node.childNodes[d.offset]||null)),d=p=new Za(g,0),l=!0}let f=this.view.observer.selectionRange;(l||!f.focusNode||(!yg(d.node,d.offset,f.anchorNode,f.anchorOffset)||!yg(p.node,p.offset,f.focusNode,f.focusOffset))&&!this.suppressWidgetCursorChange(f,u))&&(this.view.observer.ignore(()=>{gt.android&&gt.chrome&&i.contains(f.focusNode)&&Ake(f.focusNode,i)&&(i.blur(),i.focus({preventScroll:!0}));let g=Jg(this.view.root);if(g)if(u.empty){if(gt.gecko){let _=Ske(d.node,d.offset);if(_&&_!=3){let x=(_==1?yW:_W)(d.node,d.offset);x&&(d=new Za(x.node,x.offset))}}g.collapse(d.node,d.offset),u.bidiLevel!=null&&g.caretBidiLevel!==void 0&&(g.caretBidiLevel=u.bidiLevel)}else if(g.extend){g.collapse(d.node,d.offset);try{g.extend(p.node,p.offset)}catch{}}else{let _=document.createRange();u.anchor>u.head&&([d,p]=[p,d]),_.setEnd(p.node,p.offset),_.setStart(d.node,d.offset),g.removeAllRanges(),g.addRange(_)}o&&this.view.root.activeElement==i&&(i.blur(),s&&s.focus())}),this.view.observer.setSelectionRange(d,p)),this.impreciseAnchor=d.precise?null:new Za(f.anchorNode,f.anchorOffset),this.impreciseHead=p.precise?null:new Za(f.focusNode,f.focusOffset)}suppressWidgetCursorChange(n,r){return this.hasComposition&&r.empty&&yg(n.focusNode,n.focusOffset,n.anchorNode,n.anchorOffset)&&this.posFromDOM(n.focusNode,n.focusOffset)==r.head}enforceCursorAssoc(){if(this.hasComposition)return;let{view:n}=this,r=n.state.selection.main,i=Jg(n.root),{anchorNode:s,anchorOffset:a}=n.observer.selectionRange;if(!i||!r.empty||!r.assoc||!i.modify)return;let o=this.lineAt(r.head,r.assoc);if(!o)return;let l=o.posAtStart;if(r.head==l||r.head==l+o.length)return;let u=this.coordsAt(r.head,-1),d=this.coordsAt(r.head,1);if(!u||!d||u.bottom>d.top)return;let p=this.domAtPos(r.head+r.assoc,r.assoc);i.collapse(p.node,p.offset),i.modify("move",r.assoc<0?"forward":"backward","lineboundary"),n.observer.readSelectionRange();let f=n.observer.selectionRange;n.docView.posFromDOM(f.anchorNode,f.anchorOffset)!=r.from&&i.collapse(s,a)}posFromDOM(n,r){let i=this.tile.nearest(n);if(!i)return this.tile.dom.compareDocumentPosition(n)&2?0:this.view.state.doc.length;let s=i.posAtStart;if(i.isComposite()){let a;if(n==i.dom)a=i.dom.childNodes[r];else{let o=tc(n)==0?0:r==0?-1:1;for(;;){let l=n.parentNode;if(l==i.dom)break;o==0&&l.firstChild!=l.lastChild&&(n==l.firstChild?o=-1:o=1),n=l}o<0?a=n:a=n.nextSibling}if(a==i.dom.firstChild)return s;for(;a&&!Or.get(a);)a=a.nextSibling;if(!a)return s+i.length;for(let o=0,l=s;;o++){let u=i.children[o];if(u.dom==a)return l;l+=u.length+u.breakAfter}}else return i.isText()?n==i.dom?s+r:s+(r?i.length:0):s}domAtPos(n,r){let{tile:i,offset:s}=this.tile.resolveBlock(n,r);return i.isWidget()?i.domPosFor(n,r):i.domIn(s,r)}inlineDOMNearPos(n,r){let i,s=-1,a=!1,o,l=-1,u=!1;return this.tile.blockTiles((d,p)=>{if(d.isWidget()){if(d.flags&32&&p>=n)return!0;d.flags&16&&(a=!0)}else{let f=p+d.length;if(p<=n&&(i=d,s=n-p,a=f<n),f>=n&&!o&&(o=d,l=n-p,u=p>n),p>n&&o)return!0}}),!i&&!o?this.domAtPos(n,r):(a&&o?i=null:u&&i&&(o=null),i&&r<0||!o?i.domIn(s,r):o.domIn(l,r))}coordsAt(n,r){let{tile:i,offset:s}=this.tile.resolveBlock(n,r);return i.isWidget()?i.widget instanceof US?null:i.coordsInWidget(s,r,!0):i.coordsIn(s,r)}lineAt(n,r){let{tile:i}=this.tile.resolveBlock(n,r);return i.isLine()?i:null}coordsForChar(n){let{tile:r,offset:i}=this.tile.resolveBlock(n,1);if(!r.isLine())return null;function s(a,o){if(a.isComposite())for(let l of a.children){if(l.length>=o){let u=s(l,o);if(u)return u}if(o-=l.length,o<0)break}else if(a.isText()&&o<a.length){let l=gi(a.text,o);if(l==o)return null;let u=tv(a.dom,o,l).getClientRects();for(let d=0;d<u.length;d++){let p=u[d];if(d==u.length-1||p.top<p.bottom&&p.left<p.right)return p}}return null}return s(r,i)}measureVisibleLineHeights(n){let r=[],{from:i,to:s}=n,a=this.view.contentDOM.clientWidth,o=a>Math.max(this.view.scrollDOM.clientWidth,this.minWidth)+1,l=-1,u=this.view.textDirection==Jn.LTR,d=0,p=(f,g,_)=>{for(let x=0;x<f.children.length&&!(g>s);x++){let v=f.children[x],S=g+v.length,w=v.dom.getBoundingClientRect(),{height:j}=w;if(_&&!x&&(d+=w.top-_.top),v instanceof Kl)S>i&&p(v,g,w);else if(g>=i&&(d>0&&r.push(-d),r.push(j+d),d=0,o)){let C=v.dom.lastChild,T=C?vg(C):[];if(T.length){let E=T[T.length-1],A=u?E.right-w.left:w.right-E.left;A>l&&(l=A,this.minWidth=a,this.minWidthFrom=g,this.minWidthTo=S)}}_&&x==f.children.length-1&&(d+=_.bottom-w.bottom),g=S+v.breakAfter}};return p(this.tile,0,null),r}textDirectionAt(n){let{tile:r}=this.tile.resolveBlock(n,1);return getComputedStyle(r.dom).direction=="rtl"?Jn.RTL:Jn.LTR}measureTextSize(){let n=this.tile.blockTiles(o=>{if(o.isLine()&&o.children.length&&o.length<=20){let l=0,u;for(let d of o.children){if(!d.isText()||/[^ -~]/.test(d.text))return;let p=vg(d.dom);if(p.length!=1)return;l+=p[0].width,u=p[0].height}if(l)return{lineHeight:o.dom.getBoundingClientRect().height,charWidth:l/o.length,textHeight:u}}});if(n)return n;let r=document.createElement("div"),i,s,a;return r.className="cm-line",r.style.width="99999px",r.style.position="absolute",r.textContent="abc def ghi jkl mno pqr stu",this.view.observer.ignore(()=>{this.tile.dom.appendChild(r);let o=vg(r.firstChild)[0];i=r.getBoundingClientRect().height,s=o&&o.width?o.width/27:7,a=o&&o.height?o.height:i,r.remove()}),{lineHeight:i,charWidth:s,textHeight:a}}computeBlockGapDeco(){let n=[],r=this.view.viewState;for(let i=0,s=0;;s++){let a=s==r.viewports.length?null:r.viewports[s],o=a?a.from-1:this.view.state.doc.length;if(o>i){let l=(r.lineBlockAt(o).bottom-r.lineBlockAt(i).top)/this.view.scaleY;n.push(Pt.replace({widget:new US(l),block:!0,inclusive:!0,isBlockGap:!0}).range(i,o))}if(!a)break;i=a.to+1}return Pt.set(n)}updateDeco(){let n=1,r=this.view.state.facet(ek).map(a=>(this.dynamicDecorationMap[n++]=typeof a=="function")?a(this.view):a),i=!1,s=this.view.state.facet(yT).map((a,o)=>{let l=typeof a=="function";return l&&(i=!0),l?a(this.view):a});for(s.length&&(this.dynamicDecorationMap[n++]=i,r.push(rn.join(s))),this.decorations=[this.editContextFormatting,...r,this.computeBlockGapDeco(),this.view.viewState.lineGapDeco];n<this.decorations.length;)this.dynamicDecorationMap[n++]=!1;this.blockWrappers=this.view.state.facet(LW).map(a=>typeof a=="function"?a(this.view):a)}scrollIntoView(n){var r;if(n.isSnapshot){let p=this.view.viewState.lineBlockAt(n.range.head);this.view.scrollDOM.scrollTop=p.top-n.yMargin,this.view.scrollDOM.scrollLeft=n.xMargin;return}for(let p of this.view.state.facet(OW))try{if(p(this.view,n.range,n))return!0}catch(f){ss(this.view.state,f,"scroll handler")}let{range:i}=n,s=this.coordsAt(i.head,(r=i.assoc)!==null&&r!==void 0?r:i.empty?0:i.head>i.anchor?-1:1),a;if(!s)return;!i.empty&&(a=this.coordsAt(i.anchor,i.anchor>i.head?-1:1))&&(s={left:Math.min(s.left,a.left),top:Math.min(s.top,a.top),right:Math.max(s.right,a.right),bottom:Math.max(s.bottom,a.bottom)});let o=_T(this.view),l={left:s.left-o.left,top:s.top-o.top,right:s.right+o.right,bottom:s.bottom+o.bottom},{offsetWidth:u,offsetHeight:d}=this.view.scrollDOM;if(X0e(this.view.scrollDOM,l,i.head<i.anchor?-1:1,n.x,n.y,Math.max(Math.min(n.xMargin,u),-u),Math.max(Math.min(n.yMargin,d),-d),this.view.textDirection==Jn.LTR),window.visualViewport&&window.innerHeight-window.visualViewport.height>1&&(s.top>window.pageYOffset+window.visualViewport.offsetTop+window.visualViewport.height||s.bottom<window.pageYOffset+window.visualViewport.offsetTop)){let p=this.view.docView.lineAt(i.head,1);p&&p.dom.scrollIntoView({block:"nearest"})}}lineHasWidget(n){let r=i=>i.isWidget()||i.children.some(r);return r(this.tile.resolveBlock(n,1).tile)}destroy(){wN(this.tile)}}function wN(e,n){let r=n==null?void 0:n.get(e);if(r!=1){r==null&&e.destroy();for(let i of e.children)wN(i,n)}}function kke(e){return e.node.nodeType==1&&e.node.firstChild&&(e.offset==0||e.node.childNodes[e.offset-1].contentEditable=="false")&&(e.offset==e.node.childNodes.length||e.node.childNodes[e.offset].contentEditable=="false")}function $W(e,n){let r=e.observer.selectionRange;if(!r.focusNode)return null;let i=yW(r.focusNode,r.focusOffset),s=_W(r.focusNode,r.focusOffset),a=i||s;if(s&&i&&s.node!=i.node){let l=Or.get(s.node);if(!l||l.isText()&&l.text!=s.node.nodeValue)a=s;else if(e.docView.lastCompositionAfterCursor){let u=Or.get(i.node);!u||u.isText()&&u.text!=i.node.nodeValue||(a=s)}}if(e.docView.lastCompositionAfterCursor=a!=i,!a)return null;let o=n-a.offset;return{from:o,to:o+a.node.nodeValue.length,node:a.node}}function wke(e,n,r){let i=$W(e,r);if(!i)return null;let{node:s,from:a,to:o}=i,l=s.nodeValue;if(/[\n\r]/.test(l)||e.state.doc.sliceString(i.from,i.to)!=l)return null;let u=n.invertedDesc;return{range:new Ea(u.mapPos(a),u.mapPos(o),a,o),text:s}}function Ske(e,n){return e.nodeType!=1?0:(n&&e.childNodes[n-1].contentEditable=="false"?1:0)|(n<e.childNodes.length&&e.childNodes[n].contentEditable=="false"?2:0)}let Cke=class{constructor(){this.changes=[]}compareRange(n,r){Cf(n,r,this.changes)}comparePoint(n,r){Cf(n,r,this.changes)}boundChange(n){Cf(n,n,this.changes)}};function jke(e,n,r){let i=new Cke;return rn.compare(e,n,r,i),i.changes}class Nke{constructor(){this.changes=[]}compareRange(n,r){Cf(n,r,this.changes)}comparePoint(){}boundChange(n){Cf(n,n,this.changes)}}function Eke(e,n,r){let i=new Nke;return rn.compare(e,n,r,i),i.changes}function Ake(e,n){for(let r=e;r&&r!=n;r=r.assignedSlot||r.parentNode)if(r.nodeType==1&&r.contentEditable=="false")return!0;return!1}function Tke(e,n){let r=!1;return n&&e.iterChangedRanges((i,s)=>{i<n.to&&s>n.from&&(r=!0)}),r}class US extends ol{constructor(n){super(),this.height=n}toDOM(){let n=document.createElement("div");return n.className="cm-gap",this.updateDOM(n),n}eq(n){return n.height==this.height}updateDOM(n){return n.style.height=this.height+"px",!0}get editable(){return!0}get estimatedHeight(){return this.height}ignoreEvent(){return!1}}function Mke(e,n,r=1){let i=e.charCategorizer(n),s=e.doc.lineAt(n),a=n-s.from;if(s.length==0)return Be.cursor(n);a==0?r=1:a==s.length&&(r=-1);let o=a,l=a;r<0?o=gi(s.text,a,!1):l=gi(s.text,a);let u=i(s.text.slice(o,l));for(;o>0;){let d=gi(s.text,o,!1);if(i(s.text.slice(d,o))!=u)break;o=d}for(;l<s.length;){let d=gi(s.text,l);if(i(s.text.slice(l,d))!=u)break;l=d}return Be.range(o+s.from,l+s.from)}function Rke(e,n,r,i,s){let a=Math.round((i-n.left)*e.defaultCharacterWidth);if(e.lineWrapping&&r.height>e.defaultLineHeight*1.5){let l=e.viewState.heightOracle.textHeight,u=Math.floor((s-r.top-(e.defaultLineHeight-l)*.5)/l);a+=u*e.viewState.heightOracle.lineLength}let o=e.state.sliceDoc(r.from,r.to);return r.from+dN(o,a,e.state.tabSize)}function SN(e,n,r){let i=e.lineBlockAt(n);if(Array.isArray(i.type)){let s;for(let a of i.type){if(a.from>n)break;if(!(a.to<n)){if(a.from<n&&a.to>n)return a;(!s||a.type==Ri.Text&&(s.type!=a.type||(r<0?a.from<n:a.to>n)))&&(s=a)}}return s||i}return i}function Oke(e,n,r,i){let s=SN(e,n.head,n.assoc||-1),a=!i||s.type!=Ri.Text||!(e.lineWrapping||s.widgetLineBreaks)?null:e.coordsAtPos(n.assoc<0&&n.head>s.from?n.head-1:n.head);if(a){let o=e.dom.getBoundingClientRect(),l=e.textDirectionAt(s.from),u=e.posAtCoords({x:r==(l==Jn.LTR)?o.right-1:o.left+1,y:(a.top+a.bottom)/2});if(u!=null)return Be.cursor(u,r?-1:1)}return Be.cursor(r?s.to:s.from,r?-1:1)}function kL(e,n,r,i){let s=e.state.doc.lineAt(n.head),a=e.bidiSpans(s),o=e.textDirectionAt(s.from);for(let l=n,u=null;;){let d=oke(s,a,o,l,r),p=SW;if(!d){if(s.number==(r?e.state.doc.lines:1))return l;p=`
`,s=e.state.doc.line(s.number+(r?1:-1)),a=e.bidiSpans(s),d=e.visualLineSide(s,!r)}if(u){if(!u(p))return l}else{if(!i)return d;u=i(p)}l=d}}function Dke(e,n,r){let i=e.state.charCategorizer(n),s=i(r);return a=>{let o=i(a);return s==yr.Space&&(s=o),s==o}}function Pke(e,n,r,i){let s=n.head,a=r?1:-1;if(s==(r?e.state.doc.length:0))return Be.cursor(s,n.assoc);let o=n.goalColumn,l,u=e.contentDOM.getBoundingClientRect(),d=e.coordsAtPos(s,n.assoc||((n.empty?r:n.head==n.from)?1:-1)),p=e.documentTop;if(d)o==null&&(o=d.left-u.left),l=a<0?d.top:d.bottom;else{let x=e.viewState.lineBlockAt(s);o==null&&(o=Math.min(u.right-u.left,e.defaultCharacterWidth*(s-x.from))),l=(a<0?x.top:x.bottom)+p}let f=u.left+o,g=e.viewState.heightOracle.textHeight>>1,_=i??g;for(let x=0;;x+=g){let v=l+(_+x)*a,S=CN(e,{x:f,y:v},!1,a);if(r?v>u.bottom:v<u.top)return Be.cursor(S.pos,S.assoc);let w=e.coordsAtPos(S.pos,S.assoc),j=w?(w.top+w.bottom)/2:0;if(!w||(r?j>l:j<l))return Be.cursor(S.pos,S.assoc,void 0,o)}}function _g(e,n,r){for(;;){let i=0;for(let s of e)s.between(n-1,n+1,(a,o,l)=>{if(n>a&&n<o){let u=i||r||(n-a<o-n?-1:1);n=u<0?a:o,i=u}});if(!i)return n}}function FW(e,n){let r=null;for(let i=0;i<n.ranges.length;i++){let s=n.ranges[i],a=null;if(s.empty){let o=_g(e,s.from,0);o!=s.from&&(a=Be.cursor(o,-1))}else{let o=_g(e,s.from,-1),l=_g(e,s.to,1);(o!=s.from||l!=s.to)&&(a=Be.range(s.from==s.anchor?o:l,s.from==s.head?o:l))}a&&(r||(r=n.ranges.slice()),r[i]=a)}return r?Be.create(r,n.mainIndex):n}function KS(e,n,r){let i=_g(e.state.facet(Uv).map(s=>s(e)),r.from,n.head>r.from?-1:1);return i==r.from?r:Be.cursor(i,i<r.from?1:-1)}class zo{constructor(n,r){this.pos=n,this.assoc=r}}function CN(e,n,r,i){let s=e.contentDOM.getBoundingClientRect(),a=s.top+e.viewState.paddingTop,{x:o,y:l}=n,u=l-a,d;for(;;){if(u<0)return new zo(0,1);if(u>e.viewState.docHeight)return new zo(e.state.doc.length,-1);if(d=e.elementAtHeight(u),i==null)break;if(d.type==Ri.Text){if(i<0?d.to<e.viewport.from:d.from>e.viewport.to)break;let g=e.docView.coordsAt(i<0?d.from:d.to,i>0?-1:1);if(g&&(i<0?g.top<=u+a:g.bottom>=u+a))break}let f=e.viewState.heightOracle.textHeight/2;u=i>0?d.bottom+f:d.top-f}if(e.viewport.from>=d.to||e.viewport.to<=d.from){if(r)return null;if(d.type==Ri.Text){let f=Rke(e,s,d,o,l);return new zo(f,f==d.from?1:-1)}}if(d.type!=Ri.Text)return u<(d.top+d.bottom)/2?new zo(d.from,1):new zo(d.to,-1);let p=e.docView.lineAt(d.from,2);return(!p||p.length!=d.length)&&(p=e.docView.lineAt(d.from,-2)),new Lke(e,o,l,e.textDirectionAt(d.from)).scanTile(p,d.from)}class Lke{constructor(n,r,i,s){this.view=n,this.x=r,this.y=i,this.baseDir=s,this.line=null,this.spans=null}bidiSpansAt(n){return(!this.line||this.line.from>n||this.line.to<n)&&(this.line=this.view.state.doc.lineAt(n),this.spans=this.view.bidiSpans(this.line)),this}baseDirAt(n,r){let{line:i,spans:s}=this.bidiSpansAt(n);return s[Wo.find(s,n-i.from,-1,r)].level==this.baseDir}dirAt(n,r){let{line:i,spans:s}=this.bidiSpansAt(n);return s[Wo.find(s,n-i.from,-1,r)].dir}bidiIn(n,r){let{spans:i,line:s}=this.bidiSpansAt(n);return i.length>1||i.length&&(i[0].level!=this.baseDir||i[0].to+s.from<r)}scan(n,r){let i=0,s=n.length-1,a=new Set,o=this.bidiIn(n[0],n[s]),l,u,d=-1,p=1e9,f;e:for(;i<s;){let _=s-i,x=i+s>>1;t:if(a.has(x)){let S=i+Math.floor(Math.random()*_);for(let w=0;w<_;w++){if(!a.has(S)){x=S;break t}S++,S==s&&(S=i)}break e}a.add(x);let v=r(x);if(v)for(let S=0;S<v.length;S++){let w=v[S],j=0;if(!(w.width==0&&v.length>1)){if(w.bottom<this.y)(!l||l.bottom<w.bottom)&&(l=w),j=1;else if(w.top>this.y)(!u||u.top>w.top)&&(u=w),j=-1;else{let C=w.left>this.x?this.x-w.left:w.right<this.x?this.x-w.right:0,T=Math.abs(C);T<p&&(d=x,p=T,f=w),C&&(j=C<0==(this.baseDir==Jn.LTR)?-1:1)}j==-1&&(!o||this.baseDirAt(n[x],1))?s=x:j==1&&(!o||this.baseDirAt(n[x+1],-1))&&(i=x+1)}}}if(!f){let _=l&&(!u||this.y-l.bottom<u.top-this.y)?l:u;return this.y=(_.top+_.bottom)/2,this.scan(n,r)}if(p){if(l&&l.bottom>f.top)return this.y=l.bottom-1,this.scan(n,r);if(u&&u.top<f.bottom)return this.y=u.top+1,this.scan(n,r)}let g=(o?this.dirAt(n[d],1):this.baseDir)==Jn.LTR;return{i:d,after:this.x>(f.left+f.right)/2==g}}scanText(n,r){let i=[];for(let a=0;a<n.length;a=gi(n.text,a))i.push(r+a);i.push(r+n.length);let s=this.scan(i,a=>{let o=i[a]-r,l=i[a+1]-r;return tv(n.dom,o,l).getClientRects()});return s.after?new zo(i[s.i+1],-1):new zo(i[s.i],1)}scanTile(n,r){if(!n.length)return new zo(r,1);if(n.children.length==1){let l=n.children[0];if(l.isText())return this.scanText(l,r);if(l.isComposite())return this.scanTile(l,r)}let i=[r];for(let l=0,u=r;l<n.children.length;l++)i.push(u+=n.children[l].length);let s=this.scan(i,l=>{let u=n.children[l];return u.flags&48?null:(u.dom.nodeType==1?u.dom:tv(u.dom,0,u.length)).getClientRects()}),a=n.children[s.i],o=i[s.i];return a.isText()?this.scanText(a,o):a.isComposite()?this.scanTile(a,o):s.after?new zo(i[s.i+1],-1):new zo(o,1)}}const Qh="";class Ike{constructor(n,r){this.points=n,this.view=r,this.text="",this.lineSeparator=r.state.facet(yn.lineSeparator)}append(n){this.text+=n}lineBreak(){this.text+=Qh}readRange(n,r){if(!n)return this;let i=n.parentNode;for(let s=n;;){this.findPointBefore(i,s);let a=this.text.length;this.readNode(s);let o=Or.get(s),l=s.nextSibling;if(l==r){o!=null&&o.breakAfter&&!l&&i!=this.view.contentDOM&&this.lineBreak();break}let u=Or.get(l);(o&&u?o.breakAfter:(o?o.breakAfter:Db(s))||Db(l)&&(s.nodeName!="BR"||o!=null&&o.isWidget())&&this.text.length>a)&&!zke(l,r)&&this.lineBreak(),s=l}return this.findPointBefore(i,r),this}readTextNode(n){let r=n.nodeValue;for(let i of this.points)i.node==n&&(i.pos=this.text.length+Math.min(i.offset,r.length));for(let i=0,s=this.lineSeparator?null:/\r\n?|\n/g;;){let a=-1,o=1,l;if(this.lineSeparator?(a=r.indexOf(this.lineSeparator,i),o=this.lineSeparator.length):(l=s.exec(r))&&(a=l.index,o=l[0].length),this.append(r.slice(i,a<0?r.length:a)),a<0)break;if(this.lineBreak(),o>1)for(let u of this.points)u.node==n&&u.pos>this.text.length&&(u.pos-=o-1);i=a+o}}readNode(n){let r=Or.get(n),i=r&&r.overrideDOMText;if(i!=null){this.findPointInside(n,i.length);for(let s=i.iter();!s.next().done;)s.lineBreak?this.lineBreak():this.append(s.value)}else n.nodeType==3?this.readTextNode(n):n.nodeName=="BR"?n.nextSibling&&this.lineBreak():n.nodeType==1&&this.readRange(n.firstChild,null)}findPointBefore(n,r){for(let i of this.points)i.node==n&&n.childNodes[i.offset]==r&&(i.pos=this.text.length)}findPointInside(n,r){for(let i of this.points)(n.nodeType==3?i.node==n:n.contains(i.node))&&(i.pos=this.text.length+(Bke(n,i.node,i.offset)?r:0))}}function Bke(e,n,r){for(;;){if(!n||r<tc(n))return!1;if(n==e)return!0;r=vu(n)+1,n=n.parentNode}}function zke(e,n){let r;for(;!(e==n||!e);e=e.nextSibling){let i=Or.get(e);if(!(i!=null&&i.isWidget()))return!1;i&&(r||(r=[])).push(i)}if(r)for(let i of r){let s=i.overrideDOMText;if(s!=null&&s.length)return!1}return!0}class wL{constructor(n,r){this.node=n,this.offset=r,this.pos=-1}}class $ke{constructor(n,r,i,s){this.typeOver=s,this.bounds=null,this.text="",this.domChanged=r>-1;let{impreciseHead:a,impreciseAnchor:o}=n.docView,l=n.state.selection;if(n.state.readOnly&&r>-1)this.newSel=null;else if(r>-1&&(this.bounds=HW(n.docView.tile,r,i,0))){let u=a||o?[]:Hke(n),d=new Ike(u,n);d.readRange(this.bounds.startDOM,this.bounds.endDOM),this.text=d.text,this.newSel=Wke(u,this.bounds.from)}else{let u=n.observer.selectionRange,d=a&&a.node==u.focusNode&&a.offset==u.focusOffset||!yN(n.contentDOM,u.focusNode)?l.main.head:n.docView.posFromDOM(u.focusNode,u.focusOffset),p=o&&o.node==u.anchorNode&&o.offset==u.anchorOffset||!yN(n.contentDOM,u.anchorNode)?l.main.anchor:n.docView.posFromDOM(u.anchorNode,u.anchorOffset),f=n.viewport;if((gt.ios||gt.chrome)&&l.main.empty&&d!=p&&(f.from>0||f.to<n.state.doc.length)){let g=Math.min(d,p),_=Math.max(d,p),x=f.from-g,v=f.to-_;(x==0||x==1||g==0)&&(v==0||v==-1||_==n.state.doc.length)&&(d=0,p=n.state.doc.length)}if(n.inputState.composing>-1&&l.ranges.length>1)this.newSel=l.replaceRange(Be.range(p,d));else if(n.lineWrapping&&p==d&&!(l.main.empty&&l.main.head==d)&&n.inputState.lastTouchTime>Date.now()-100){let g=n.coordsAtPos(d,-1),_=0;g&&(_=n.inputState.lastTouchY<=g.bottom?-1:1),this.newSel=Be.create([Be.cursor(d,_)])}else this.newSel=Be.single(p,d)}}}function HW(e,n,r,i){if(e.isComposite()){let s=-1,a=-1,o=-1,l=-1;for(let u=0,d=i,p=i;u<e.children.length;u++){let f=e.children[u],g=d+f.length;if(d<n&&g>r)return HW(f,n,r,d);if(g>=n&&s==-1&&(s=u,a=d),d>r&&f.dom.parentNode==e.dom){o=u,l=p;break}p=g,d=g+f.breakAfter}return{from:a,to:l<0?i+e.length:l,startDOM:(s?e.children[s-1].dom.nextSibling:null)||e.dom.firstChild,endDOM:o<e.children.length&&o>=0?e.children[o].dom:null}}else return e.isText()?{from:i,to:i+e.length,startDOM:e.dom,endDOM:e.dom.nextSibling}:null}function WW(e,n){let r,{newSel:i}=n,{state:s}=e,a=s.selection.main,o=e.inputState.lastKeyTime>Date.now()-100?e.inputState.lastKeyCode:-1;if(n.bounds){let{from:l,to:u}=n.bounds,d=a.from,p=null;(o===8||gt.android&&n.text.length<u-l)&&(d=a.to,p="end");let f=s.doc.sliceString(l,u,Qh),g,_;!a.empty&&a.from>=l&&a.to<=u&&(n.typeOver||f!=n.text)&&f.slice(0,a.from-l)==n.text.slice(0,a.from-l)&&f.slice(a.to-l)==n.text.slice(g=n.text.length-(f.length-(a.to-l)))?r={from:a.from,to:a.to,insert:Dn.of(n.text.slice(a.from-l,g).split(Qh))}:(_=qW(f,n.text,d-l,p))&&(gt.chrome&&o==13&&_.toB==_.from+2&&n.text.slice(_.from,_.toB)==Qh+Qh&&_.toB--,r={from:l+_.from,to:l+_.toA,insert:Dn.of(n.text.slice(_.from,_.toB).split(Qh))})}else i&&(!e.hasFocus&&s.facet(Bl)||Bb(i,a))&&(i=null);if(!r&&!i)return!1;if((gt.mac||gt.android)&&r&&r.from==r.to&&r.from==a.head-1&&/^\. ?$/.test(r.insert.toString())&&e.contentDOM.getAttribute("autocorrect")=="off"?(i&&r.insert.length==2&&(i=Be.single(i.main.anchor-1,i.main.head-1)),r={from:r.from,to:r.to,insert:Dn.of([r.insert.toString().replace("."," ")])}):s.doc.lineAt(a.from).to<a.to&&e.docView.lineHasWidget(a.to)&&e.inputState.insertingTextAt>Date.now()-50?r={from:a.from,to:a.to,insert:s.toText(e.inputState.insertingText)}:gt.chrome&&r&&r.from==r.to&&r.from==a.head&&r.insert.toString()==`
 `&&e.lineWrapping&&(i&&(i=Be.single(i.main.anchor-1,i.main.head-1)),r={from:a.from,to:a.to,insert:Dn.of([" "])}),r)return xT(e,r,i,o);if(i&&!Bb(i,a)){let l=!1,u="select";return e.inputState.lastSelectionTime>Date.now()-50&&(e.inputState.lastSelectionOrigin=="select"&&(l=!0),u=e.inputState.lastSelectionOrigin,u=="select.pointer"&&(i=FW(s.facet(Uv).map(d=>d(e)),i))),e.dispatch({selection:i,scrollIntoView:l,userEvent:u}),!0}else return!1}function xT(e,n,r,i=-1){if(gt.ios&&e.inputState.flushIOSKey(n))return!0;let s=e.state.selection.main;if(gt.android&&(n.to==s.to&&(n.from==s.from||n.from==s.from-1&&e.state.sliceDoc(n.from,s.from)==" ")&&n.insert.length==1&&n.insert.lines==2&&jf(e.contentDOM,"Enter",13)||(n.from==s.from-1&&n.to==s.to&&n.insert.length==0||i==8&&n.insert.length<n.to-n.from&&n.to>s.head)&&jf(e.contentDOM,"Backspace",8)||n.from==s.from&&n.to==s.to+1&&n.insert.length==0&&jf(e.contentDOM,"Delete",46)))return!0;let a=n.insert.toString();e.inputState.composing>=0&&e.inputState.composing++;let o,l=()=>o||(o=Fke(e,n,r));return e.state.facet(AW).some(u=>u(e,n.from,n.to,a,l))||e.dispatch(l()),!0}function Fke(e,n,r){let i,s=e.state,a=s.selection.main,o=-1;if(n.from==n.to&&n.from<a.from||n.from>a.to){let u=n.from<a.from?-1:1,d=u<0?a.from:a.to,p=_g(s.facet(Uv).map(f=>f(e)),d,u);n.from==p&&(o=p)}if(o>-1)i={changes:n,selection:Be.cursor(n.from+n.insert.length,-1)};else if(n.from>=a.from&&n.to<=a.to&&n.to-n.from>=(a.to-a.from)/3&&(!r||r.main.empty&&r.main.from==n.from+n.insert.length)&&e.inputState.composing<0){let u=a.from<n.from?s.sliceDoc(a.from,n.from):"",d=a.to>n.to?s.sliceDoc(n.to,a.to):"";i=s.replaceSelection(e.state.toText(u+n.insert.sliceString(0,void 0,e.state.lineBreak)+d))}else{let u=s.changes(n),d=r&&r.main.to<=u.newLength?r.main:void 0;if(s.selection.ranges.length>1&&(e.inputState.composing>=0||e.inputState.compositionPendingChange)&&n.to<=a.to+10&&n.to>=a.to-10){let p=e.state.sliceDoc(n.from,n.to),f,g=r&&$W(e,r.main.head);if(g){let x=n.insert.length-(n.to-n.from);f={from:g.from,to:g.to-x}}else f=e.state.doc.lineAt(a.head);let _=a.to-n.to;i=s.changeByRange(x=>{if(x.from==a.from&&x.to==a.to)return{changes:u,range:d||x.map(u)};let v=x.to-_,S=v-p.length;if(e.state.sliceDoc(S,v)!=p||v>=f.from&&S<=f.to)return{range:x};let w=s.changes({from:S,to:v,insert:n.insert}),j=x.to-a.to;return{changes:w,range:d?Be.range(Math.max(0,d.anchor+j),Math.max(0,d.head+j)):x.map(w)}})}else i={changes:u,selection:d&&s.selection.replaceRange(d)}}let l="input.type";return(e.composing||e.inputState.compositionPendingChange&&e.inputState.compositionEndedAt>Date.now()-50)&&(e.inputState.compositionPendingChange=!1,l+=".compose",e.inputState.compositionFirstChange&&(l+=".start",e.inputState.compositionFirstChange=!1)),s.update(i,{userEvent:l,scrollIntoView:!0})}function qW(e,n,r,i){let s=Math.min(e.length,n.length),a=0;for(;a<s&&e.charCodeAt(a)==n.charCodeAt(a);)a++;if(a==s&&e.length==n.length)return null;let o=e.length,l=n.length;for(;o>0&&l>0&&e.charCodeAt(o-1)==n.charCodeAt(l-1);)o--,l--;if(i=="end"){let u=Math.max(0,a-Math.min(o,l));r-=o+u-a}if(o<a&&e.length<n.length){let u=r<=a&&r>=o?a-r:0;a-=u,l=a+(l-o),o=a}else if(l<a){let u=r<=a&&r>=l?a-r:0;a-=u,o=a+(o-l),l=a}return{from:a,toA:o,toB:l}}function Hke(e){let n=[];if(e.root.activeElement!=e.contentDOM)return n;let{anchorNode:r,anchorOffset:i,focusNode:s,focusOffset:a}=e.observer.selectionRange;return r&&(n.push(new wL(r,i)),(s!=r||a!=i)&&n.push(new wL(s,a))),n}function Wke(e,n){if(e.length==0)return null;let r=e[0].pos,i=e.length==2?e[1].pos:r;return r>-1&&i>-1?Be.single(r+n,i+n):null}function Bb(e,n){return n.head==e.main.head&&n.anchor==e.main.anchor}class qke{setSelectionOrigin(n){this.lastSelectionOrigin=n,this.lastSelectionTime=Date.now()}constructor(n){this.view=n,this.lastKeyCode=0,this.lastKeyTime=0,this.lastTouchTime=0,this.lastTouchX=0,this.lastTouchY=0,this.lastFocusTime=0,this.lastScrollTop=0,this.lastScrollLeft=0,this.lastWheelEvent=0,this.pendingIOSKey=void 0,this.tabFocusMode=-1,this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastContextMenu=0,this.scrollHandlers=[],this.handlers=Object.create(null),this.composing=-1,this.compositionFirstChange=null,this.compositionEndedAt=0,this.compositionPendingKey=!1,this.compositionPendingChange=!1,this.insertingText="",this.insertingTextAt=0,this.mouseSelection=null,this.draggedContent=null,this.handleEvent=this.handleEvent.bind(this),this.notifiedFocused=n.hasFocus,gt.safari&&n.contentDOM.addEventListener("input",()=>null),gt.gecko&&s1e(n.contentDOM.ownerDocument)}handleEvent(n){!Zke(this.view,n)||this.ignoreDuringComposition(n)||n.type=="keydown"&&this.keydown(n)||(this.view.updateState!=0?Promise.resolve().then(()=>this.runHandlers(n.type,n)):this.runHandlers(n.type,n))}runHandlers(n,r){let i=this.handlers[n];if(i){for(let s of i.observers)s(this.view,r);for(let s of i.handlers){if(r.defaultPrevented)break;if(s(this.view,r)){r.preventDefault();break}}}}ensureHandlers(n){let r=Uke(n),i=this.handlers,s=this.view.contentDOM;for(let a in r)if(a!="scroll"){let o=!r[a].handlers.length,l=i[a];l&&o!=!l.handlers.length&&(s.removeEventListener(a,this.handleEvent),l=null),l||s.addEventListener(a,this.handleEvent,{passive:o})}for(let a in i)a!="scroll"&&!r[a]&&s.removeEventListener(a,this.handleEvent);this.handlers=r}keydown(n){if(this.lastKeyCode=n.keyCode,this.lastKeyTime=Date.now(),n.keyCode==9&&this.tabFocusMode>-1&&(!this.tabFocusMode||Date.now()<=this.tabFocusMode))return!0;if(this.tabFocusMode>0&&n.keyCode!=27&&KW.indexOf(n.keyCode)<0&&(this.tabFocusMode=-1),gt.android&&gt.chrome&&!n.synthetic&&(n.keyCode==13||n.keyCode==8))return this.view.observer.delayAndroidKey(n.key,n.keyCode),!0;let r;return gt.ios&&!n.synthetic&&!n.altKey&&!n.metaKey&&!n.shiftKey&&((r=UW.find(i=>i.keyCode==n.keyCode))&&!n.ctrlKey||Kke.indexOf(n.key)>-1&&n.ctrlKey)?(this.pendingIOSKey=r||n,setTimeout(()=>this.flushIOSKey(),250),!0):(n.keyCode!=229&&this.view.observer.forceFlush(),!1)}flushIOSKey(n){let r=this.pendingIOSKey;return!r||r.key=="Enter"&&n&&n.from<n.to&&/^\S+$/.test(n.insert.toString())?!1:(this.pendingIOSKey=void 0,jf(this.view.contentDOM,r.key,r.keyCode,r instanceof KeyboardEvent?r:void 0))}ignoreDuringComposition(n){return!/^key/.test(n.type)||n.synthetic?!1:this.composing>0?!0:gt.safari&&!gt.ios&&this.compositionPendingKey&&Date.now()-this.compositionEndedAt<100?(this.compositionPendingKey=!1,!0):!1}startMouseSelection(n){this.mouseSelection&&this.mouseSelection.destroy(),this.mouseSelection=n}update(n){this.view.observer.update(n),this.mouseSelection&&this.mouseSelection.update(n),this.draggedContent&&n.docChanged&&(this.draggedContent=this.draggedContent.map(n.changes)),n.transactions.length&&(this.lastKeyCode=this.lastSelectionTime=0)}destroy(){this.mouseSelection&&this.mouseSelection.destroy()}}function SL(e,n){return(r,i)=>{try{return n.call(e,i,r)}catch(s){ss(r.state,s)}}}function Uke(e){let n=Object.create(null);function r(i){return n[i]||(n[i]={observers:[],handlers:[]})}for(let i of e){let s=i.spec,a=s&&s.plugin.domEventHandlers,o=s&&s.plugin.domEventObservers;if(a)for(let l in a){let u=a[l];u&&r(l).handlers.push(SL(i.value,u))}if(o)for(let l in o){let u=o[l];u&&r(l).observers.push(SL(i.value,u))}}for(let i in io)r(i).handlers.push(io[i]);for(let i in Rs)r(i).observers.push(Rs[i]);return n}const UW=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Enter",keyCode:13,inputType:"insertLineBreak"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],Kke="dthko",KW=[16,17,18,20,91,92,224,225],R_=6;function O_(e){return Math.max(0,e)*.7+8}function Vke(e,n){return Math.max(Math.abs(e.clientX-n.clientX),Math.abs(e.clientY-n.clientY))}class Yke{constructor(n,r,i,s){this.view=n,this.startEvent=r,this.style=i,this.mustSelect=s,this.scrollSpeed={x:0,y:0},this.scrolling=-1,this.lastEvent=r,this.scrollParents=mW(n.contentDOM),this.atoms=n.state.facet(Uv).map(o=>o(n));let a=n.contentDOM.ownerDocument;a.addEventListener("mousemove",this.move=this.move.bind(this)),a.addEventListener("mouseup",this.up=this.up.bind(this)),this.extend=r.shiftKey,this.multiple=n.state.facet(yn.allowMultipleSelections)&&Gke(n,r),this.dragging=Qke(n,r)&&GW(r)==1?null:!1}start(n){this.dragging===!1&&this.select(n)}move(n){if(n.buttons==0)return this.destroy();if(this.dragging||this.dragging==null&&Vke(this.startEvent,n)<10)return;this.select(this.lastEvent=n);let r=0,i=0,s=0,a=0,o=this.view.win.innerWidth,l=this.view.win.innerHeight;this.scrollParents.x&&({left:s,right:o}=this.scrollParents.x.getBoundingClientRect()),this.scrollParents.y&&({top:a,bottom:l}=this.scrollParents.y.getBoundingClientRect());let u=_T(this.view);n.clientX-u.left<=s+R_?r=-O_(s-n.clientX):n.clientX+u.right>=o-R_&&(r=O_(n.clientX-o)),n.clientY-u.top<=a+R_?i=-O_(a-n.clientY):n.clientY+u.bottom>=l-R_&&(i=O_(n.clientY-l)),this.setScrollSpeed(r,i)}up(n){this.dragging==null&&this.select(this.lastEvent),this.dragging||n.preventDefault(),this.destroy()}destroy(){this.setScrollSpeed(0,0);let n=this.view.contentDOM.ownerDocument;n.removeEventListener("mousemove",this.move),n.removeEventListener("mouseup",this.up),this.view.inputState.mouseSelection=this.view.inputState.draggedContent=null}setScrollSpeed(n,r){this.scrollSpeed={x:n,y:r},n||r?this.scrolling<0&&(this.scrolling=setInterval(()=>this.scroll(),50)):this.scrolling>-1&&(clearInterval(this.scrolling),this.scrolling=-1)}scroll(){let{x:n,y:r}=this.scrollSpeed;n&&this.scrollParents.x&&(this.scrollParents.x.scrollLeft+=n,n=0),r&&this.scrollParents.y&&(this.scrollParents.y.scrollTop+=r,r=0),(n||r)&&this.view.win.scrollBy(n,r),this.dragging===!1&&this.select(this.lastEvent)}select(n){let{view:r}=this,i=FW(this.atoms,this.style.get(n,this.extend,this.multiple));(this.mustSelect||!i.eq(r.state.selection,this.dragging===!1))&&this.view.dispatch({selection:i,userEvent:"select.pointer"}),this.mustSelect=!1}update(n){n.transactions.some(r=>r.isUserEvent("input.type"))?this.destroy():this.style.update(n)&&setTimeout(()=>this.select(this.lastEvent),20)}}function Gke(e,n){let r=e.state.facet(CW);return r.length?r[0](n):gt.mac?n.metaKey:n.ctrlKey}function Xke(e,n){let r=e.state.facet(jW);return r.length?r[0](n):gt.mac?!n.altKey:!n.ctrlKey}function Qke(e,n){let{main:r}=e.state.selection;if(r.empty)return!1;let i=Jg(e.root);if(!i||i.rangeCount==0)return!0;let s=i.getRangeAt(0).getClientRects();for(let a=0;a<s.length;a++){let o=s[a];if(o.left<=n.clientX&&o.right>=n.clientX&&o.top<=n.clientY&&o.bottom>=n.clientY)return!0}return!1}function Zke(e,n){if(!n.bubbles)return!0;if(n.defaultPrevented)return!1;for(let r=n.target,i;r!=e.contentDOM;r=r.parentNode)if(!r||r.nodeType==11||(i=Or.get(r))&&i.isWidget()&&!i.isHidden&&i.widget.ignoreEvent(n))return!1;return!0}const io=Object.create(null),Rs=Object.create(null),VW=gt.ie&&gt.ie_version<15||gt.ios&&gt.webkit_version<604;function Jke(e){let n=e.dom.parentNode;if(!n)return;let r=n.appendChild(document.createElement("textarea"));r.style.cssText="position: fixed; left: -10000px; top: 10px",r.focus(),setTimeout(()=>{e.focus(),r.remove(),YW(e,r.value)},50)}function rk(e,n,r){for(let i of e.facet(n))r=i(r,e);return r}function YW(e,n){n=rk(e.state,mT,n);let{state:r}=e,i,s=1,a=r.toText(n),o=a.lines==r.selection.ranges.length;if(jN!=null&&r.selection.ranges.every(u=>u.empty)&&jN==a.toString()){let u=-1;i=r.changeByRange(d=>{let p=r.doc.lineAt(d.from);if(p.from==u)return{range:d};u=p.from;let f=r.toText((o?a.line(s++).text:n)+r.lineBreak);return{changes:{from:p.from,insert:f},range:Be.cursor(d.from+f.length)}})}else o?i=r.changeByRange(u=>{let d=a.line(s++);return{changes:{from:u.from,to:u.to,insert:d.text},range:Be.cursor(u.from+d.length)}}):i=r.replaceSelection(a);e.dispatch(i,{userEvent:"input.paste",scrollIntoView:!0})}Rs.scroll=e=>{e.inputState.lastScrollTop=e.scrollDOM.scrollTop,e.inputState.lastScrollLeft=e.scrollDOM.scrollLeft};Rs.wheel=Rs.mousewheel=e=>{e.inputState.lastWheelEvent=Date.now()};io.keydown=(e,n)=>(e.inputState.setSelectionOrigin("select"),n.keyCode==27&&e.inputState.tabFocusMode!=0&&(e.inputState.tabFocusMode=Date.now()+2e3),!1);Rs.touchstart=(e,n)=>{let r=e.inputState,i=n.targetTouches[0];r.lastTouchTime=Date.now(),i&&(r.lastTouchX=i.clientX,r.lastTouchY=i.clientY),r.setSelectionOrigin("select.pointer")};Rs.touchmove=e=>{e.inputState.setSelectionOrigin("select.pointer")};io.mousedown=(e,n)=>{if(e.observer.flush(),e.inputState.lastTouchTime>Date.now()-2e3)return!1;let r=null;for(let i of e.state.facet(NW))if(r=i(e,n),r)break;if(!r&&n.button==0&&(r=t1e(e,n)),r){let i=!e.hasFocus;e.inputState.startMouseSelection(new Yke(e,n,r,i)),i&&e.observer.ignore(()=>{gW(e.contentDOM);let a=e.root.activeElement;a&&!a.contains(e.contentDOM)&&a.blur()});let s=e.inputState.mouseSelection;if(s)return s.start(n),s.dragging===!1}else e.inputState.setSelectionOrigin("select.pointer");return!1};function CL(e,n,r,i){if(i==1)return Be.cursor(n,r);if(i==2)return Mke(e.state,n,r);{let s=e.docView.lineAt(n,r),a=e.state.doc.lineAt(s?s.posAtEnd:n),o=s?s.posAtStart:a.from,l=s?s.posAtEnd:a.to;return l<e.state.doc.length&&l==a.to&&l++,Be.range(o,l)}}const e1e=gt.ie&&gt.ie_version<=11;let jL=null,NL=0,EL=0;function GW(e){if(!e1e)return e.detail;let n=jL,r=EL;return jL=e,EL=Date.now(),NL=!n||r>Date.now()-400&&Math.abs(n.clientX-e.clientX)<2&&Math.abs(n.clientY-e.clientY)<2?(NL+1)%3:1}function t1e(e,n){let r=e.posAndSideAtCoords({x:n.clientX,y:n.clientY},!1),i=GW(n),s=e.state.selection;return{update(a){a.docChanged&&(r.pos=a.changes.mapPos(r.pos),s=s.map(a.changes))},get(a,o,l){let u=e.posAndSideAtCoords({x:a.clientX,y:a.clientY},!1),d,p=CL(e,u.pos,u.assoc,i);if(r.pos!=u.pos&&!o){let f=CL(e,r.pos,r.assoc,i),g=Math.min(f.from,p.from),_=Math.max(f.to,p.to);p=g<p.from?Be.range(g,_,p.assoc):Be.range(_,g,p.assoc)}return o?s.replaceRange(s.main.extend(p.from,p.to,p.assoc)):l&&i==1&&s.ranges.length>1&&(d=n1e(s,u.pos))?d:l?s.addRange(p):Be.create([p])}}}function n1e(e,n){for(let r=0;r<e.ranges.length;r++){let{from:i,to:s}=e.ranges[r];if(i<=n&&s>=n)return Be.create(e.ranges.slice(0,r).concat(e.ranges.slice(r+1)),e.mainIndex==r?0:e.mainIndex-(e.mainIndex>r?1:0))}return null}io.dragstart=(e,n)=>{let{selection:{main:r}}=e.state;if(n.target.draggable){let s=e.docView.tile.nearest(n.target);if(s&&s.isWidget()){let a=s.posAtStart,o=a+s.length;(a>=r.to||o<=r.from)&&(r=Be.range(a,o))}}let{inputState:i}=e;return i.mouseSelection&&(i.mouseSelection.dragging=!0),i.draggedContent=r,n.dataTransfer&&(n.dataTransfer.setData("Text",rk(e.state,gT,e.state.sliceDoc(r.from,r.to))),n.dataTransfer.effectAllowed="copyMove"),!1};io.dragend=e=>(e.inputState.draggedContent=null,!1);function AL(e,n,r,i){if(r=rk(e.state,mT,r),!r)return;let s=e.posAtCoords({x:n.clientX,y:n.clientY},!1),{draggedContent:a}=e.inputState,o=i&&a&&Xke(e,n)?{from:a.from,to:a.to}:null,l={from:s,insert:r},u=e.state.changes(o?[o,l]:l);e.focus(),e.dispatch({changes:u,selection:{anchor:u.mapPos(s,-1),head:u.mapPos(s,1)},userEvent:o?"move.drop":"input.drop"}),e.inputState.draggedContent=null}io.drop=(e,n)=>{if(!n.dataTransfer)return!1;if(e.state.readOnly)return!0;let r=n.dataTransfer.files;if(r&&r.length){let i=Array(r.length),s=0,a=()=>{++s==r.length&&AL(e,n,i.filter(o=>o!=null).join(e.state.lineBreak),!1)};for(let o=0;o<r.length;o++){let l=new FileReader;l.onerror=a,l.onload=()=>{/[\x00-\x08\x0e-\x1f]{2}/.test(l.result)||(i[o]=l.result),a()},l.readAsText(r[o])}return!0}else{let i=n.dataTransfer.getData("Text");if(i)return AL(e,n,i,!0),!0}return!1};io.paste=(e,n)=>{if(e.state.readOnly)return!0;e.observer.flush();let r=VW?null:n.clipboardData;return r?(YW(e,r.getData("text/plain")||r.getData("text/uri-list")),!0):(Jke(e),!1)};function r1e(e,n){let r=e.dom.parentNode;if(!r)return;let i=r.appendChild(document.createElement("textarea"));i.style.cssText="position: fixed; left: -10000px; top: 10px",i.value=n,i.focus(),i.selectionEnd=n.length,i.selectionStart=0,setTimeout(()=>{i.remove(),e.focus()},50)}function i1e(e){let n=[],r=[],i=!1;for(let s of e.selection.ranges)s.empty||(n.push(e.sliceDoc(s.from,s.to)),r.push(s));if(!n.length){let s=-1;for(let{from:a}of e.selection.ranges){let o=e.doc.lineAt(a);o.number>s&&(n.push(o.text),r.push({from:o.from,to:Math.min(e.doc.length,o.to+1)})),s=o.number}i=!0}return{text:rk(e,gT,n.join(e.lineBreak)),ranges:r,linewise:i}}let jN=null;io.copy=io.cut=(e,n)=>{if(!gg(e.contentDOM,e.observer.selectionRange))return!1;let{text:r,ranges:i,linewise:s}=i1e(e.state);if(!r&&!s)return!1;jN=s?r:null,n.type=="cut"&&!e.state.readOnly&&e.dispatch({changes:i,scrollIntoView:!0,userEvent:"delete.cut"});let a=VW?null:n.clipboardData;return a?(a.clearData(),a.setData("text/plain",r),!0):(r1e(e,r),!1)};const XW=al.define();function QW(e,n){let r=[];for(let i of e.facet(TW)){let s=i(e,n);s&&r.push(s)}return r.length?e.update({effects:r,annotations:XW.of(!0)}):null}function ZW(e){setTimeout(()=>{let n=e.hasFocus;if(n!=e.inputState.notifiedFocused){let r=QW(e.state,n);r?e.dispatch(r):e.update([])}},10)}Rs.focus=e=>{e.inputState.lastFocusTime=Date.now(),!e.scrollDOM.scrollTop&&(e.inputState.lastScrollTop||e.inputState.lastScrollLeft)&&(e.scrollDOM.scrollTop=e.inputState.lastScrollTop,e.scrollDOM.scrollLeft=e.inputState.lastScrollLeft),ZW(e)};Rs.blur=e=>{e.observer.clearSelectionRange(),ZW(e)};Rs.compositionstart=Rs.compositionupdate=e=>{e.observer.editContext||(e.inputState.compositionFirstChange==null&&(e.inputState.compositionFirstChange=!0),e.inputState.composing<0&&(e.inputState.composing=0))};Rs.compositionend=e=>{e.observer.editContext||(e.inputState.composing=-1,e.inputState.compositionEndedAt=Date.now(),e.inputState.compositionPendingKey=!0,e.inputState.compositionPendingChange=e.observer.pendingRecords().length>0,e.inputState.compositionFirstChange=null,gt.chrome&&gt.android?e.observer.flushSoon():e.inputState.compositionPendingChange?Promise.resolve().then(()=>e.observer.flush()):setTimeout(()=>{e.inputState.composing<0&&e.docView.hasComposition&&e.update([])},50))};Rs.contextmenu=e=>{e.inputState.lastContextMenu=Date.now()};io.beforeinput=(e,n)=>{var r,i;if((n.inputType=="insertText"||n.inputType=="insertCompositionText")&&(e.inputState.insertingText=n.data,e.inputState.insertingTextAt=Date.now()),n.inputType=="insertReplacementText"&&e.observer.editContext){let a=(r=n.dataTransfer)===null||r===void 0?void 0:r.getData("text/plain"),o=n.getTargetRanges();if(a&&o.length){let l=o[0],u=e.posAtDOM(l.startContainer,l.startOffset),d=e.posAtDOM(l.endContainer,l.endOffset);return xT(e,{from:u,to:d,insert:e.state.toText(a)},null),!0}}let s;if(gt.chrome&&gt.android&&(s=UW.find(a=>a.inputType==n.inputType))&&(e.observer.delayAndroidKey(s.key,s.keyCode),s.key=="Backspace"||s.key=="Delete")){let a=((i=window.visualViewport)===null||i===void 0?void 0:i.height)||0;setTimeout(()=>{var o;(((o=window.visualViewport)===null||o===void 0?void 0:o.height)||0)>a+10&&e.hasFocus&&(e.contentDOM.blur(),e.focus())},100)}return gt.ios&&n.inputType=="deleteContentForward"&&e.observer.flushSoon(),gt.safari&&n.inputType=="insertText"&&e.inputState.composing>=0&&setTimeout(()=>Rs.compositionend(e,n),20),!1};const TL=new Set;function s1e(e){TL.has(e)||(TL.add(e),e.addEventListener("copy",()=>{}),e.addEventListener("cut",()=>{}))}const ML=["pre-wrap","normal","pre-line","break-spaces"];let Qf=!1;function RL(){Qf=!1}class a1e{constructor(n){this.lineWrapping=n,this.doc=Dn.empty,this.heightSamples={},this.lineHeight=14,this.charWidth=7,this.textHeight=14,this.lineLength=30}heightForGap(n,r){let i=this.doc.lineAt(r).number-this.doc.lineAt(n).number+1;return this.lineWrapping&&(i+=Math.max(0,Math.ceil((r-n-i*this.lineLength*.5)/this.lineLength))),this.lineHeight*i}heightForLine(n){return this.lineWrapping?(1+Math.max(0,Math.ceil((n-this.lineLength)/Math.max(1,this.lineLength-5))))*this.lineHeight:this.lineHeight}setDoc(n){return this.doc=n,this}mustRefreshForWrapping(n){return ML.indexOf(n)>-1!=this.lineWrapping}mustRefreshForHeights(n){let r=!1;for(let i=0;i<n.length;i++){let s=n[i];s<0?i++:this.heightSamples[Math.floor(s*10)]||(r=!0,this.heightSamples[Math.floor(s*10)]=!0)}return r}refresh(n,r,i,s,a,o){let l=ML.indexOf(n)>-1,u=Math.abs(r-this.lineHeight)>.3||this.lineWrapping!=l||Math.abs(i-this.charWidth)>.1;if(this.lineWrapping=l,this.lineHeight=r,this.charWidth=i,this.textHeight=s,this.lineLength=a,u){this.heightSamples={};for(let d=0;d<o.length;d++){let p=o[d];p<0?d++:this.heightSamples[Math.floor(p*10)]=!0}}return u}}class o1e{constructor(n,r){this.from=n,this.heights=r,this.index=0}get more(){return this.index<this.heights.length}}class Ya{constructor(n,r,i,s,a){this.from=n,this.length=r,this.top=i,this.height=s,this._content=a}get type(){return typeof this._content=="number"?Ri.Text:Array.isArray(this._content)?this._content:this._content.type}get to(){return this.from+this.length}get bottom(){return this.top+this.height}get widget(){return this._content instanceof Bd?this._content.widget:null}get widgetLineBreaks(){return typeof this._content=="number"?this._content:0}join(n){let r=(Array.isArray(this._content)?this._content:[this]).concat(Array.isArray(n._content)?n._content:[n]);return new Ya(this.from,this.length+n.length,this.top,this.height+n.height,r)}}var nr=(function(e){return e[e.ByPos=0]="ByPos",e[e.ByHeight=1]="ByHeight",e[e.ByPosNoHeight=2]="ByPosNoHeight",e})(nr||(nr={}));const Px=.001;class as{constructor(n,r,i=2){this.length=n,this.height=r,this.flags=i}get outdated(){return(this.flags&2)>0}set outdated(n){this.flags=(n?2:0)|this.flags&-3}setHeight(n){this.height!=n&&(Math.abs(this.height-n)>Px&&(Qf=!0),this.height=n)}replace(n,r,i){return as.of(i)}decomposeLeft(n,r){r.push(this)}decomposeRight(n,r){r.push(this)}applyChanges(n,r,i,s){let a=this,o=i.doc;for(let l=s.length-1;l>=0;l--){let{fromA:u,toA:d,fromB:p,toB:f}=s[l],g=a.lineAt(u,nr.ByPosNoHeight,i.setDoc(r),0,0),_=g.to>=d?g:a.lineAt(d,nr.ByPosNoHeight,i,0,0);for(f+=_.to-d,d=_.to;l>0&&g.from<=s[l-1].toA;)u=s[l-1].fromA,p=s[l-1].fromB,l--,u<g.from&&(g=a.lineAt(u,nr.ByPosNoHeight,i,0,0));p+=g.from-u,u=g.from;let x=bT.build(i.setDoc(o),n,p,f);a=zb(a,a.replace(u,d,x))}return a.updateHeight(i,0)}static empty(){return new ta(0,0,0)}static of(n){if(n.length==1)return n[0];let r=0,i=n.length,s=0,a=0;for(;;)if(r==i)if(s>a*2){let l=n[r-1];l.break?n.splice(--r,1,l.left,null,l.right):n.splice(--r,1,l.left,l.right),i+=1+l.break,s-=l.size}else if(a>s*2){let l=n[i];l.break?n.splice(i,1,l.left,null,l.right):n.splice(i,1,l.left,l.right),i+=2+l.break,a-=l.size}else break;else if(s<a){let l=n[r++];l&&(s+=l.size)}else{let l=n[--i];l&&(a+=l.size)}let o=0;return n[r-1]==null?(o=1,r--):n[r]==null&&(o=1,i++),new c1e(as.of(n.slice(0,r)),o,as.of(n.slice(i)))}}function zb(e,n){return e==n?e:(e.constructor!=n.constructor&&(Qf=!0),n)}as.prototype.size=1;const l1e=Pt.replace({});class JW extends as{constructor(n,r,i){super(n,r),this.deco=i,this.spaceAbove=0}mainBlock(n,r){return new Ya(r,this.length,n+this.spaceAbove,this.height-this.spaceAbove,this.deco||0)}blockAt(n,r,i,s){return this.spaceAbove&&n<i+this.spaceAbove?new Ya(s,0,i,this.spaceAbove,l1e):this.mainBlock(i,s)}lineAt(n,r,i,s,a){let o=this.mainBlock(s,a);return this.spaceAbove?this.blockAt(0,i,s,a).join(o):o}forEachLine(n,r,i,s,a,o){n<=a+this.length&&r>=a&&o(this.lineAt(0,nr.ByPos,i,s,a))}setMeasuredHeight(n){let r=n.heights[n.index++];r<0?(this.spaceAbove=-r,r=n.heights[n.index++]):this.spaceAbove=0,this.setHeight(r)}updateHeight(n,r=0,i=!1,s){return s&&s.from<=r&&s.more&&this.setMeasuredHeight(s),this.outdated=!1,this}toString(){return`block(${this.length})`}}class ta extends JW{constructor(n,r,i){super(n,r,null),this.collapsed=0,this.widgetHeight=0,this.breaks=0,this.spaceAbove=i}mainBlock(n,r){return new Ya(r,this.length,n+this.spaceAbove,this.height-this.spaceAbove,this.breaks)}replace(n,r,i){let s=i[0];return i.length==1&&(s instanceof ta||s instanceof Ni&&s.flags&4)&&Math.abs(this.length-s.length)<10?(s instanceof Ni?s=new ta(s.length,this.height,this.spaceAbove):s.height=this.height,this.outdated||(s.outdated=!1),s):as.of(i)}updateHeight(n,r=0,i=!1,s){return s&&s.from<=r&&s.more?this.setMeasuredHeight(s):(i||this.outdated)&&(this.spaceAbove=0,this.setHeight(Math.max(this.widgetHeight,n.heightForLine(this.length-this.collapsed))+this.breaks*n.lineHeight)),this.outdated=!1,this}toString(){return`line(${this.length}${this.collapsed?-this.collapsed:""}${this.widgetHeight?":"+this.widgetHeight:""})`}}class Ni extends as{constructor(n){super(n,0)}heightMetrics(n,r){let i=n.doc.lineAt(r).number,s=n.doc.lineAt(r+this.length).number,a=s-i+1,o,l=0;if(n.lineWrapping){let u=Math.min(this.height,n.lineHeight*a);o=u/a,this.length>a+1&&(l=(this.height-u)/(this.length-a-1))}else o=this.height/a;return{firstLine:i,lastLine:s,perLine:o,perChar:l}}blockAt(n,r,i,s){let{firstLine:a,lastLine:o,perLine:l,perChar:u}=this.heightMetrics(r,s);if(r.lineWrapping){let d=s+(n<r.lineHeight?0:Math.round(Math.max(0,Math.min(1,(n-i)/this.height))*this.length)),p=r.doc.lineAt(d),f=l+p.length*u,g=Math.max(i,n-f/2);return new Ya(p.from,p.length,g,f,0)}else{let d=Math.max(0,Math.min(o-a,Math.floor((n-i)/l))),{from:p,length:f}=r.doc.line(a+d);return new Ya(p,f,i+l*d,l,0)}}lineAt(n,r,i,s,a){if(r==nr.ByHeight)return this.blockAt(n,i,s,a);if(r==nr.ByPosNoHeight){let{from:_,to:x}=i.doc.lineAt(n);return new Ya(_,x-_,0,0,0)}let{firstLine:o,perLine:l,perChar:u}=this.heightMetrics(i,a),d=i.doc.lineAt(n),p=l+d.length*u,f=d.number-o,g=s+l*f+u*(d.from-a-f);return new Ya(d.from,d.length,Math.max(s,Math.min(g,s+this.height-p)),p,0)}forEachLine(n,r,i,s,a,o){n=Math.max(n,a),r=Math.min(r,a+this.length);let{firstLine:l,perLine:u,perChar:d}=this.heightMetrics(i,a);for(let p=n,f=s;p<=r;){let g=i.doc.lineAt(p);if(p==n){let x=g.number-l;f+=u*x+d*(n-a-x)}let _=u+d*g.length;o(new Ya(g.from,g.length,f,_,0)),f+=_,p=g.to+1}}replace(n,r,i){let s=this.length-r;if(s>0){let a=i[i.length-1];a instanceof Ni?i[i.length-1]=new Ni(a.length+s):i.push(null,new Ni(s-1))}if(n>0){let a=i[0];a instanceof Ni?i[0]=new Ni(n+a.length):i.unshift(new Ni(n-1),null)}return as.of(i)}decomposeLeft(n,r){r.push(new Ni(n-1),null)}decomposeRight(n,r){r.push(null,new Ni(this.length-n-1))}updateHeight(n,r=0,i=!1,s){let a=r+this.length;if(s&&s.from<=r+this.length&&s.more){let o=[],l=Math.max(r,s.from),u=-1;for(s.from>r&&o.push(new Ni(s.from-r-1).updateHeight(n,r));l<=a&&s.more;){let p=n.doc.lineAt(l).length;o.length&&o.push(null);let f=s.heights[s.index++],g=0;f<0&&(g=-f,f=s.heights[s.index++]),u==-1?u=f:Math.abs(f-u)>=Px&&(u=-2);let _=new ta(p,f,g);_.outdated=!1,o.push(_),l+=p+1}l<=a&&o.push(null,new Ni(a-l).updateHeight(n,l));let d=as.of(o);return(u<0||Math.abs(d.height-this.height)>=Px||Math.abs(u-this.heightMetrics(n,r).perLine)>=Px)&&(Qf=!0),zb(this,d)}else(i||this.outdated)&&(this.setHeight(n.heightForGap(r,r+this.length)),this.outdated=!1);return this}toString(){return`gap(${this.length})`}}class c1e extends as{constructor(n,r,i){super(n.length+r+i.length,n.height+i.height,r|(n.outdated||i.outdated?2:0)),this.left=n,this.right=i,this.size=n.size+i.size}get break(){return this.flags&1}blockAt(n,r,i,s){let a=i+this.left.height;return n<a?this.left.blockAt(n,r,i,s):this.right.blockAt(n,r,a,s+this.left.length+this.break)}lineAt(n,r,i,s,a){let o=s+this.left.height,l=a+this.left.length+this.break,u=r==nr.ByHeight?n<o:n<l,d=u?this.left.lineAt(n,r,i,s,a):this.right.lineAt(n,r,i,o,l);if(this.break||(u?d.to<l:d.from>l))return d;let p=r==nr.ByPosNoHeight?nr.ByPosNoHeight:nr.ByPos;return u?d.join(this.right.lineAt(l,p,i,o,l)):this.left.lineAt(l,p,i,s,a).join(d)}forEachLine(n,r,i,s,a,o){let l=s+this.left.height,u=a+this.left.length+this.break;if(this.break)n<u&&this.left.forEachLine(n,r,i,s,a,o),r>=u&&this.right.forEachLine(n,r,i,l,u,o);else{let d=this.lineAt(u,nr.ByPos,i,s,a);n<d.from&&this.left.forEachLine(n,d.from-1,i,s,a,o),d.to>=n&&d.from<=r&&o(d),r>d.to&&this.right.forEachLine(d.to+1,r,i,l,u,o)}}replace(n,r,i){let s=this.left.length+this.break;if(r<s)return this.balanced(this.left.replace(n,r,i),this.right);if(n>this.left.length)return this.balanced(this.left,this.right.replace(n-s,r-s,i));let a=[];n>0&&this.decomposeLeft(n,a);let o=a.length;for(let l of i)a.push(l);if(n>0&&OL(a,o-1),r<this.length){let l=a.length;this.decomposeRight(r,a),OL(a,l)}return as.of(a)}decomposeLeft(n,r){let i=this.left.length;if(n<=i)return this.left.decomposeLeft(n,r);r.push(this.left),this.break&&(i++,n>=i&&r.push(null)),n>i&&this.right.decomposeLeft(n-i,r)}decomposeRight(n,r){let i=this.left.length,s=i+this.break;if(n>=s)return this.right.decomposeRight(n-s,r);n<i&&this.left.decomposeRight(n,r),this.break&&n<s&&r.push(null),r.push(this.right)}balanced(n,r){return n.size>2*r.size||r.size>2*n.size?as.of(this.break?[n,null,r]:[n,r]):(this.left=zb(this.left,n),this.right=zb(this.right,r),this.setHeight(n.height+r.height),this.outdated=n.outdated||r.outdated,this.size=n.size+r.size,this.length=n.length+this.break+r.length,this)}updateHeight(n,r=0,i=!1,s){let{left:a,right:o}=this,l=r+a.length+this.break,u=null;return s&&s.from<=r+a.length&&s.more?u=a=a.updateHeight(n,r,i,s):a.updateHeight(n,r,i),s&&s.from<=l+o.length&&s.more?u=o=o.updateHeight(n,l,i,s):o.updateHeight(n,l,i),u?this.balanced(a,o):(this.height=this.left.height+this.right.height,this.outdated=!1,this)}toString(){return this.left+(this.break?" ":"-")+this.right}}function OL(e,n){let r,i;e[n]==null&&(r=e[n-1])instanceof Ni&&(i=e[n+1])instanceof Ni&&e.splice(n-1,3,new Ni(r.length+1+i.length))}const u1e=5;class bT{constructor(n,r){this.pos=n,this.oracle=r,this.nodes=[],this.lineStart=-1,this.lineEnd=-1,this.covering=null,this.writtenTo=n}get isCovered(){return this.covering&&this.nodes[this.nodes.length-1]==this.covering}span(n,r){if(this.lineStart>-1){let i=Math.min(r,this.lineEnd),s=this.nodes[this.nodes.length-1];s instanceof ta?s.length+=i-this.pos:(i>this.pos||!this.isCovered)&&this.nodes.push(new ta(i-this.pos,-1,0)),this.writtenTo=i,r>i&&(this.nodes.push(null),this.writtenTo++,this.lineStart=-1)}this.pos=r}point(n,r,i){if(n<r||i.heightRelevant){let s=i.widget?i.widget.estimatedHeight:0,a=i.widget?i.widget.lineBreaks:0;s<0&&(s=this.oracle.lineHeight);let o=r-n;i.block?this.addBlock(new JW(o,s,i)):(o||a||s>=u1e)&&this.addLineDeco(s,a,o)}else r>n&&this.span(n,r);this.lineEnd>-1&&this.lineEnd<this.pos&&(this.lineEnd=this.oracle.doc.lineAt(this.pos).to)}enterLine(){if(this.lineStart>-1)return;let{from:n,to:r}=this.oracle.doc.lineAt(this.pos);this.lineStart=n,this.lineEnd=r,this.writtenTo<n&&((this.writtenTo<n-1||this.nodes[this.nodes.length-1]==null)&&this.nodes.push(this.blankContent(this.writtenTo,n-1)),this.nodes.push(null)),this.pos>n&&this.nodes.push(new ta(this.pos-n,-1,0)),this.writtenTo=this.pos}blankContent(n,r){let i=new Ni(r-n);return this.oracle.doc.lineAt(n).to==r&&(i.flags|=4),i}ensureLine(){this.enterLine();let n=this.nodes.length?this.nodes[this.nodes.length-1]:null;if(n instanceof ta)return n;let r=new ta(0,-1,0);return this.nodes.push(r),r}addBlock(n){this.enterLine();let r=n.deco;r&&r.startSide>0&&!this.isCovered&&this.ensureLine(),this.nodes.push(n),this.writtenTo=this.pos=this.pos+n.length,r&&r.endSide>0&&(this.covering=n)}addLineDeco(n,r,i){let s=this.ensureLine();s.length+=i,s.collapsed+=i,s.widgetHeight=Math.max(s.widgetHeight,n),s.breaks+=r,this.writtenTo=this.pos=this.pos+i}finish(n){let r=this.nodes.length==0?null:this.nodes[this.nodes.length-1];this.lineStart>-1&&!(r instanceof ta)&&!this.isCovered?this.nodes.push(new ta(0,-1,0)):(this.writtenTo<this.pos||r==null)&&this.nodes.push(this.blankContent(this.writtenTo,this.pos));let i=n;for(let s of this.nodes)s instanceof ta&&s.updateHeight(this.oracle,i),i+=s?s.length:1;return this.nodes}static build(n,r,i,s){let a=new bT(i,n);return rn.spans(r,i,s,a,0),a.finish(i)}}function d1e(e,n,r){let i=new h1e;return rn.compare(e,n,r,i,0),i.changes}class h1e{constructor(){this.changes=[]}compareRange(){}comparePoint(n,r,i,s){(n<r||i&&i.heightRelevant||s&&s.heightRelevant)&&Cf(n,r,this.changes,5)}}function f1e(e,n){let r=e.getBoundingClientRect(),i=e.ownerDocument,s=i.defaultView||window,a=Math.max(0,r.left),o=Math.min(s.innerWidth,r.right),l=Math.max(0,r.top),u=Math.min(s.innerHeight,r.bottom);for(let d=e.parentNode;d&&d!=i.body;)if(d.nodeType==1){let p=d,f=window.getComputedStyle(p);if((p.scrollHeight>p.clientHeight||p.scrollWidth>p.clientWidth)&&f.overflow!="visible"){let g=p.getBoundingClientRect();a=Math.max(a,g.left),o=Math.min(o,g.right),l=Math.max(l,g.top),u=Math.min(d==e.parentNode?s.innerHeight:u,g.bottom)}d=f.position=="absolute"||f.position=="fixed"?p.offsetParent:p.parentNode}else if(d.nodeType==11)d=d.host;else break;return{left:a-r.left,right:Math.max(a,o)-r.left,top:l-(r.top+n),bottom:Math.max(l,u)-(r.top+n)}}function p1e(e){let n=e.getBoundingClientRect(),r=e.ownerDocument.defaultView||window;return n.left<r.innerWidth&&n.right>0&&n.top<r.innerHeight&&n.bottom>0}function m1e(e,n){let r=e.getBoundingClientRect();return{left:0,right:r.right-r.left,top:n,bottom:r.bottom-(r.top+n)}}class VS{constructor(n,r,i,s){this.from=n,this.to=r,this.size=i,this.displaySize=s}static same(n,r){if(n.length!=r.length)return!1;for(let i=0;i<n.length;i++){let s=n[i],a=r[i];if(s.from!=a.from||s.to!=a.to||s.size!=a.size)return!1}return!0}draw(n,r){return Pt.replace({widget:new g1e(this.displaySize*(r?n.scaleY:n.scaleX),r)}).range(this.from,this.to)}}class g1e extends ol{constructor(n,r){super(),this.size=n,this.vertical=r}eq(n){return n.size==this.size&&n.vertical==this.vertical}toDOM(){let n=document.createElement("div");return this.vertical?n.style.height=this.size+"px":(n.style.width=this.size+"px",n.style.height="2px",n.style.display="inline-block"),n}get estimatedHeight(){return this.vertical?this.size:-1}}class DL{constructor(n,r){this.view=n,this.state=r,this.pixelViewport={left:0,right:window.innerWidth,top:0,bottom:0},this.inView=!0,this.paddingTop=0,this.paddingBottom=0,this.contentDOMWidth=0,this.contentDOMHeight=0,this.editorHeight=0,this.editorWidth=0,this.scaleX=1,this.scaleY=1,this.scrollOffset=0,this.scrolledToBottom=!1,this.scrollAnchorPos=0,this.scrollAnchorHeight=-1,this.scaler=PL,this.scrollTarget=null,this.printing=!1,this.mustMeasureContent=!0,this.defaultTextDirection=Jn.LTR,this.visibleRanges=[],this.mustEnforceCursorAssoc=!1;let i=r.facet(vT).some(s=>typeof s!="function"&&s.class=="cm-lineWrapping");this.heightOracle=new a1e(i),this.stateDeco=LL(r),this.heightMap=as.empty().applyChanges(this.stateDeco,Dn.empty,this.heightOracle.setDoc(r.doc),[new Ea(0,0,0,r.doc.length)]);for(let s=0;s<2&&(this.viewport=this.getViewport(0,null),!!this.updateForViewport());s++);this.updateViewportLines(),this.lineGaps=this.ensureLineGaps([]),this.lineGapDeco=Pt.set(this.lineGaps.map(s=>s.draw(this,!1))),this.scrollParent=n.scrollDOM,this.computeVisibleRanges()}updateForViewport(){let n=[this.viewport],{main:r}=this.state.selection;for(let i=0;i<=1;i++){let s=i?r.head:r.anchor;if(!n.some(({from:a,to:o})=>s>=a&&s<=o)){let{from:a,to:o}=this.lineBlockAt(s);n.push(new D_(a,o))}}return this.viewports=n.sort((i,s)=>i.from-s.from),this.updateScaler()}updateScaler(){let n=this.scaler;return this.scaler=this.heightMap.height<=7e6?PL:new kT(this.heightOracle,this.heightMap,this.viewports),n.eq(this.scaler)?0:2}updateViewportLines(){this.viewportLines=[],this.heightMap.forEachLine(this.viewport.from,this.viewport.to,this.heightOracle.setDoc(this.state.doc),0,0,n=>{this.viewportLines.push(Gm(n,this.scaler))})}update(n,r=null){this.state=n.state;let i=this.stateDeco;this.stateDeco=LL(this.state);let s=n.changedRanges,a=Ea.extendWithRanges(s,d1e(i,this.stateDeco,n?n.changes:ri.empty(this.state.doc.length))),o=this.heightMap.height,l=this.scrolledToBottom?null:this.scrollAnchorAt(this.scrollOffset);RL(),this.heightMap=this.heightMap.applyChanges(this.stateDeco,n.startState.doc,this.heightOracle.setDoc(this.state.doc),a),(this.heightMap.height!=o||Qf)&&(n.flags|=2),l?(this.scrollAnchorPos=n.changes.mapPos(l.from,-1),this.scrollAnchorHeight=l.top):(this.scrollAnchorPos=-1,this.scrollAnchorHeight=o);let u=a.length?this.mapViewport(this.viewport,n.changes):this.viewport;(r&&(r.range.head<u.from||r.range.head>u.to)||!this.viewportIsAppropriate(u))&&(u=this.getViewport(0,r));let d=u.from!=this.viewport.from||u.to!=this.viewport.to;this.viewport=u,n.flags|=this.updateForViewport(),(d||!n.changes.empty||n.flags&2)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(this.mapLineGaps(this.lineGaps,n.changes))),n.flags|=this.computeVisibleRanges(n.changes),r&&(this.scrollTarget=r),!this.mustEnforceCursorAssoc&&(n.selectionSet||n.focusChanged)&&n.view.lineWrapping&&n.state.selection.main.empty&&n.state.selection.main.assoc&&!n.state.facet(RW)&&(this.mustEnforceCursorAssoc=!0)}measure(){let{view:n}=this,r=n.contentDOM,i=window.getComputedStyle(r),s=this.heightOracle,a=i.whiteSpace;this.defaultTextDirection=i.direction=="rtl"?Jn.RTL:Jn.LTR;let o=this.heightOracle.mustRefreshForWrapping(a)||this.mustMeasureContent==="refresh",l=r.getBoundingClientRect(),u=o||this.mustMeasureContent||this.contentDOMHeight!=l.height;this.contentDOMHeight=l.height,this.mustMeasureContent=!1;let d=0,p=0;if(l.width&&l.height){let{scaleX:E,scaleY:A}=pW(r,l);(E>.005&&Math.abs(this.scaleX-E)>.005||A>.005&&Math.abs(this.scaleY-A)>.005)&&(this.scaleX=E,this.scaleY=A,d|=16,o=u=!0)}let f=(parseInt(i.paddingTop)||0)*this.scaleY,g=(parseInt(i.paddingBottom)||0)*this.scaleY;(this.paddingTop!=f||this.paddingBottom!=g)&&(this.paddingTop=f,this.paddingBottom=g,d|=18),this.editorWidth!=n.scrollDOM.clientWidth&&(s.lineWrapping&&(u=!0),this.editorWidth=n.scrollDOM.clientWidth,d|=16);let _=mW(this.view.contentDOM,!1).y;_!=this.scrollParent&&(this.scrollParent=_,this.scrollAnchorHeight=-1,this.scrollOffset=0);let x=this.getScrollOffset();this.scrollOffset!=x&&(this.scrollAnchorHeight=-1,this.scrollOffset=x),this.scrolledToBottom=vW(this.scrollParent||n.win);let v=(this.printing?m1e:f1e)(r,this.paddingTop),S=v.top-this.pixelViewport.top,w=v.bottom-this.pixelViewport.bottom;this.pixelViewport=v;let j=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left;if(j!=this.inView&&(this.inView=j,j&&(u=!0)),!this.inView&&!this.scrollTarget&&!p1e(n.dom))return 0;let C=l.width;if((this.contentDOMWidth!=C||this.editorHeight!=n.scrollDOM.clientHeight)&&(this.contentDOMWidth=l.width,this.editorHeight=n.scrollDOM.clientHeight,d|=16),u){let E=n.docView.measureVisibleLineHeights(this.viewport);if(s.mustRefreshForHeights(E)&&(o=!0),o||s.lineWrapping&&Math.abs(C-this.contentDOMWidth)>s.charWidth){let{lineHeight:A,charWidth:O,textHeight:F}=n.docView.measureTextSize();o=A>0&&s.refresh(a,A,O,F,Math.max(5,C/O),E),o&&(n.docView.minWidth=0,d|=16)}S>0&&w>0?p=Math.max(S,w):S<0&&w<0&&(p=Math.min(S,w)),RL();for(let A of this.viewports){let O=A.from==this.viewport.from?E:n.docView.measureVisibleLineHeights(A);this.heightMap=(o?as.empty().applyChanges(this.stateDeco,Dn.empty,this.heightOracle,[new Ea(0,0,0,n.state.doc.length)]):this.heightMap).updateHeight(s,0,o,new o1e(A.from,O))}Qf&&(d|=2)}let T=!this.viewportIsAppropriate(this.viewport,p)||this.scrollTarget&&(this.scrollTarget.range.head<this.viewport.from||this.scrollTarget.range.head>this.viewport.to);return T&&(d&2&&(d|=this.updateScaler()),this.viewport=this.getViewport(p,this.scrollTarget),d|=this.updateForViewport()),(d&2||T)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(o?[]:this.lineGaps,n)),d|=this.computeVisibleRanges(),this.mustEnforceCursorAssoc&&(this.mustEnforceCursorAssoc=!1,n.docView.enforceCursorAssoc()),d}get visibleTop(){return this.scaler.fromDOM(this.pixelViewport.top)}get visibleBottom(){return this.scaler.fromDOM(this.pixelViewport.bottom)}getViewport(n,r){let i=.5-Math.max(-.5,Math.min(.5,n/1e3/2)),s=this.heightMap,a=this.heightOracle,{visibleTop:o,visibleBottom:l}=this,u=new D_(s.lineAt(o-i*1e3,nr.ByHeight,a,0,0).from,s.lineAt(l+(1-i)*1e3,nr.ByHeight,a,0,0).to);if(r){let{head:d}=r.range;if(d<u.from||d>u.to){let p=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),f=s.lineAt(d,nr.ByPos,a,0,0),g;r.y=="center"?g=(f.top+f.bottom)/2-p/2:r.y=="start"||r.y=="nearest"&&d<u.from?g=f.top:g=f.bottom-p,u=new D_(s.lineAt(g-1e3/2,nr.ByHeight,a,0,0).from,s.lineAt(g+p+1e3/2,nr.ByHeight,a,0,0).to)}}return u}mapViewport(n,r){let i=r.mapPos(n.from,-1),s=r.mapPos(n.to,1);return new D_(this.heightMap.lineAt(i,nr.ByPos,this.heightOracle,0,0).from,this.heightMap.lineAt(s,nr.ByPos,this.heightOracle,0,0).to)}viewportIsAppropriate({from:n,to:r},i=0){if(!this.inView)return!0;let{top:s}=this.heightMap.lineAt(n,nr.ByPos,this.heightOracle,0,0),{bottom:a}=this.heightMap.lineAt(r,nr.ByPos,this.heightOracle,0,0),{visibleTop:o,visibleBottom:l}=this;return(n==0||s<=o-Math.max(10,Math.min(-i,250)))&&(r==this.state.doc.length||a>=l+Math.max(10,Math.min(i,250)))&&s>o-2*1e3&&a<l+2*1e3}mapLineGaps(n,r){if(!n.length||r.empty)return n;let i=[];for(let s of n)r.touchesRange(s.from,s.to)||i.push(new VS(r.mapPos(s.from),r.mapPos(s.to),s.size,s.displaySize));return i}ensureLineGaps(n,r){let i=this.heightOracle.lineWrapping,s=i?1e4:2e3,a=s>>1,o=s<<1;if(this.defaultTextDirection!=Jn.LTR&&!i)return[];let l=[],u=(p,f,g,_)=>{if(f-p<a)return;let x=this.state.selection.main,v=[x.from];x.empty||v.push(x.to);for(let w of v)if(w>p&&w<f){u(p,w-10,g,_),u(w+10,f,g,_);return}let S=y1e(n,w=>w.from>=g.from&&w.to<=g.to&&Math.abs(w.from-p)<a&&Math.abs(w.to-f)<a&&!v.some(j=>w.from<j&&w.to>j));if(!S){if(f<g.to&&r&&i&&r.visibleRanges.some(C=>C.from<=f&&C.to>=f)){let C=r.moveToLineBoundary(Be.cursor(f),!1,!0).head;C>p&&(f=C)}let w=this.gapSize(g,p,f,_),j=i||w<2e6?w:2e6;S=new VS(p,f,w,j)}l.push(S)},d=p=>{if(p.length<o||p.type!=Ri.Text)return;let f=v1e(p.from,p.to,this.stateDeco);if(f.total<o)return;let g=this.scrollTarget?this.scrollTarget.range.head:null,_,x;if(i){let v=s/this.heightOracle.lineLength*this.heightOracle.lineHeight,S,w;if(g!=null){let j=L_(f,g),C=((this.visibleBottom-this.visibleTop)/2+v)/p.height;S=j-C,w=j+C}else S=(this.visibleTop-p.top-v)/p.height,w=(this.visibleBottom-p.top+v)/p.height;_=P_(f,S),x=P_(f,w)}else{let v=f.total*this.heightOracle.charWidth,S=s*this.heightOracle.charWidth,w=0;if(v>2e6)for(let A of n)A.from>=p.from&&A.from<p.to&&A.size!=A.displaySize&&A.from*this.heightOracle.charWidth+w<this.pixelViewport.left&&(w=A.size-A.displaySize);let j=this.pixelViewport.left+w,C=this.pixelViewport.right+w,T,E;if(g!=null){let A=L_(f,g),O=((C-j)/2+S)/v;T=A-O,E=A+O}else T=(j-S)/v,E=(C+S)/v;_=P_(f,T),x=P_(f,E)}_>p.from&&u(p.from,_,p,f),x<p.to&&u(x,p.to,p,f)};for(let p of this.viewportLines)Array.isArray(p.type)?p.type.forEach(d):d(p);return l}gapSize(n,r,i,s){let a=L_(s,i)-L_(s,r);return this.heightOracle.lineWrapping?n.height*a:s.total*this.heightOracle.charWidth*a}updateLineGaps(n){VS.same(n,this.lineGaps)||(this.lineGaps=n,this.lineGapDeco=Pt.set(n.map(r=>r.draw(this,this.heightOracle.lineWrapping))))}computeVisibleRanges(n){let r=this.stateDeco;this.lineGaps.length&&(r=r.concat(this.lineGapDeco));let i=[];rn.spans(r,this.viewport.from,this.viewport.to,{span(a,o){i.push({from:a,to:o})},point(){}},20);let s=0;if(i.length!=this.visibleRanges.length)s=12;else for(let a=0;a<i.length&&!(s&8);a++){let o=this.visibleRanges[a],l=i[a];(o.from!=l.from||o.to!=l.to)&&(s|=4,n&&n.mapPos(o.from,-1)==l.from&&n.mapPos(o.to,1)==l.to||(s|=8))}return this.visibleRanges=i,s}lineBlockAt(n){return n>=this.viewport.from&&n<=this.viewport.to&&this.viewportLines.find(r=>r.from<=n&&r.to>=n)||Gm(this.heightMap.lineAt(n,nr.ByPos,this.heightOracle,0,0),this.scaler)}lineBlockAtHeight(n){return n>=this.viewportLines[0].top&&n<=this.viewportLines[this.viewportLines.length-1].bottom&&this.viewportLines.find(r=>r.top<=n&&r.bottom>=n)||Gm(this.heightMap.lineAt(this.scaler.fromDOM(n),nr.ByHeight,this.heightOracle,0,0),this.scaler)}getScrollOffset(){return(this.scrollParent==this.view.scrollDOM?this.scrollParent.scrollTop:(this.scrollParent?this.scrollParent.getBoundingClientRect().top:0)-this.view.contentDOM.getBoundingClientRect().top)*this.scaleY}scrollAnchorAt(n){let r=this.lineBlockAtHeight(n+8);return r.from>=this.viewport.from||this.viewportLines[0].top-n>200?r:this.viewportLines[0]}elementAtHeight(n){return Gm(this.heightMap.blockAt(this.scaler.fromDOM(n),this.heightOracle,0,0),this.scaler)}get docHeight(){return this.scaler.toDOM(this.heightMap.height)}get contentHeight(){return this.docHeight+this.paddingTop+this.paddingBottom}}class D_{constructor(n,r){this.from=n,this.to=r}}function v1e(e,n,r){let i=[],s=e,a=0;return rn.spans(r,e,n,{span(){},point(o,l){o>s&&(i.push({from:s,to:o}),a+=o-s),s=l}},20),s<n&&(i.push({from:s,to:n}),a+=n-s),{total:a,ranges:i}}function P_({total:e,ranges:n},r){if(r<=0)return n[0].from;if(r>=1)return n[n.length-1].to;let i=Math.floor(e*r);for(let s=0;;s++){let{from:a,to:o}=n[s],l=o-a;if(i<=l)return a+i;i-=l}}function L_(e,n){let r=0;for(let{from:i,to:s}of e.ranges){if(n<=s){r+=n-i;break}r+=s-i}return r/e.total}function y1e(e,n){for(let r of e)if(n(r))return r}const PL={toDOM(e){return e},fromDOM(e){return e},scale:1,eq(e){return e==this}};function LL(e){let n=e.facet(ek).filter(i=>typeof i!="function"),r=e.facet(yT).filter(i=>typeof i!="function");return r.length&&n.push(rn.join(r)),n}class kT{constructor(n,r,i){let s=0,a=0,o=0;this.viewports=i.map(({from:l,to:u})=>{let d=r.lineAt(l,nr.ByPos,n,0,0).top,p=r.lineAt(u,nr.ByPos,n,0,0).bottom;return s+=p-d,{from:l,to:u,top:d,bottom:p,domTop:0,domBottom:0}}),this.scale=(7e6-s)/(r.height-s);for(let l of this.viewports)l.domTop=o+(l.top-a)*this.scale,o=l.domBottom=l.domTop+(l.bottom-l.top),a=l.bottom}toDOM(n){for(let r=0,i=0,s=0;;r++){let a=r<this.viewports.length?this.viewports[r]:null;if(!a||n<a.top)return s+(n-i)*this.scale;if(n<=a.bottom)return a.domTop+(n-a.top);i=a.bottom,s=a.domBottom}}fromDOM(n){for(let r=0,i=0,s=0;;r++){let a=r<this.viewports.length?this.viewports[r]:null;if(!a||n<a.domTop)return i+(n-s)/this.scale;if(n<=a.domBottom)return a.top+(n-a.domTop);i=a.bottom,s=a.domBottom}}eq(n){return n instanceof kT?this.scale==n.scale&&this.viewports.length==n.viewports.length&&this.viewports.every((r,i)=>r.from==n.viewports[i].from&&r.to==n.viewports[i].to):!1}}function Gm(e,n){if(n.scale==1)return e;let r=n.toDOM(e.top),i=n.toDOM(e.bottom);return new Ya(e.from,e.length,r,i-r,Array.isArray(e._content)?e._content.map(s=>Gm(s,n)):e._content)}const I_=pt.define({combine:e=>e.join(" ")}),NN=pt.define({combine:e=>e.indexOf(!0)>-1}),EN=mu.newName(),eq=mu.newName(),tq=mu.newName(),nq={"&light":"."+eq,"&dark":"."+tq};function AN(e,n,r){return new mu(n,{finish(i){return/&/.test(i)?i.replace(/&\w*/,s=>{if(s=="&")return e;if(!r||!r[s])throw new RangeError(`Unsupported selector: ${s}`);return r[s]}):e+" "+i}})}const _1e=AN("."+EN,{"&":{position:"relative !important",boxSizing:"border-box","&.cm-focused":{outline:"1px dotted #212121"},display:"flex !important",flexDirection:"column"},".cm-scroller":{display:"flex !important",alignItems:"flex-start !important",fontFamily:"monospace",lineHeight:1.4,height:"100%",overflowX:"auto",position:"relative",zIndex:0,overflowAnchor:"none"},".cm-content":{margin:0,flexGrow:2,flexShrink:0,display:"block",whiteSpace:"pre",wordWrap:"normal",boxSizing:"border-box",minHeight:"100%",padding:"4px 0",outline:"none","&[contenteditable=true]":{WebkitUserModify:"read-write-plaintext-only"}},".cm-lineWrapping":{whiteSpace_fallback:"pre-wrap",whiteSpace:"break-spaces",wordBreak:"break-word",overflowWrap:"anywhere",flexShrink:1},"&light .cm-content":{caretColor:"black"},"&dark .cm-content":{caretColor:"white"},".cm-line":{display:"block",padding:"0 2px 0 6px"},".cm-layer":{position:"absolute",left:0,top:0,contain:"size style","& > *":{position:"absolute"}},"&light .cm-selectionBackground":{background:"#d9d9d9"},"&dark .cm-selectionBackground":{background:"#222"},"&light.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#d7d4f0"},"&dark.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#233"},".cm-cursorLayer":{pointerEvents:"none"},"&.cm-focused > .cm-scroller > .cm-cursorLayer":{animation:"steps(1) cm-blink 1.2s infinite"},"@keyframes cm-blink":{"0%":{},"50%":{opacity:0},"100%":{}},"@keyframes cm-blink2":{"0%":{},"50%":{opacity:0},"100%":{}},".cm-cursor, .cm-dropCursor":{borderLeft:"1.2px solid black",marginLeft:"-0.6px",pointerEvents:"none"},".cm-cursor":{display:"none"},"&dark .cm-cursor":{borderLeftColor:"#ddd"},".cm-selectionHandle":{backgroundColor:"currentColor",width:"1.5px"},".cm-selectionHandle-start::before, .cm-selectionHandle-end::before":{content:'""',backgroundColor:"inherit",borderRadius:"50%",width:"8px",height:"8px",position:"absolute",left:"-3.25px"},".cm-selectionHandle-start::before":{top:"-8px"},".cm-selectionHandle-end::before":{bottom:"-8px"},".cm-dropCursor":{position:"absolute"},"&.cm-focused > .cm-scroller > .cm-cursorLayer .cm-cursor":{display:"block"},".cm-iso":{unicodeBidi:"isolate"},".cm-announced":{position:"fixed",top:"-10000px"},"@media print":{".cm-announced":{display:"none"}},"&light .cm-activeLine":{backgroundColor:"#cceeff44"},"&dark .cm-activeLine":{backgroundColor:"#99eeff33"},"&light .cm-specialChar":{color:"red"},"&dark .cm-specialChar":{color:"#f78"},".cm-gutters":{flexShrink:0,display:"flex",height:"100%",boxSizing:"border-box",zIndex:200},".cm-gutters-before":{insetInlineStart:0},".cm-gutters-after":{insetInlineEnd:0},"&light .cm-gutters":{backgroundColor:"#f5f5f5",color:"#6c6c6c",border:"0px solid #ddd","&.cm-gutters-before":{borderRightWidth:"1px"},"&.cm-gutters-after":{borderLeftWidth:"1px"}},"&dark .cm-gutters":{backgroundColor:"#333338",color:"#ccc"},".cm-gutter":{display:"flex !important",flexDirection:"column",flexShrink:0,boxSizing:"border-box",minHeight:"100%",overflow:"hidden"},".cm-gutterElement":{boxSizing:"border-box"},".cm-lineNumbers .cm-gutterElement":{padding:"0 3px 0 5px",minWidth:"20px",textAlign:"right",whiteSpace:"nowrap"},"&light .cm-activeLineGutter":{backgroundColor:"#e2f2ff"},"&dark .cm-activeLineGutter":{backgroundColor:"#222227"},".cm-panels":{boxSizing:"border-box",position:"sticky",left:0,right:0,zIndex:300},"&light .cm-panels":{backgroundColor:"#f5f5f5",color:"black"},"&light .cm-panels-top":{borderBottom:"1px solid #ddd"},"&light .cm-panels-bottom":{borderTop:"1px solid #ddd"},"&dark .cm-panels":{backgroundColor:"#333338",color:"white"},".cm-dialog":{padding:"2px 19px 4px 6px",position:"relative","& label":{fontSize:"80%"}},".cm-dialog-close":{position:"absolute",top:"3px",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",fontSize:"14px",padding:"0"},".cm-tab":{display:"inline-block",overflow:"hidden",verticalAlign:"bottom"},".cm-widgetBuffer":{verticalAlign:"text-top",height:"1em",width:0,display:"inline"},".cm-placeholder":{color:"#888",display:"inline-block",verticalAlign:"top",userSelect:"none"},".cm-highlightSpace":{backgroundImage:"radial-gradient(circle at 50% 55%, #aaa 20%, transparent 5%)",backgroundPosition:"center"},".cm-highlightTab":{backgroundImage:`url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="200" height="20"><path stroke="%23888" stroke-width="1" fill="none" d="M1 10H196L190 5M190 15L196 10M197 4L197 16"/></svg>')`,backgroundSize:"auto 100%",backgroundPosition:"right 90%",backgroundRepeat:"no-repeat"},".cm-trailingSpace":{backgroundColor:"#ff332255"},".cm-button":{verticalAlign:"middle",color:"inherit",fontSize:"70%",padding:".2em 1em",borderRadius:"1px"},"&light .cm-button":{backgroundImage:"linear-gradient(#eff1f5, #d9d9df)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#b4b4b4, #d0d3d6)"}},"&dark .cm-button":{backgroundImage:"linear-gradient(#393939, #111)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#111, #333)"}},".cm-textfield":{verticalAlign:"middle",color:"inherit",fontSize:"70%",border:"1px solid silver",padding:".2em .5em"},"&light .cm-textfield":{backgroundColor:"white"},"&dark .cm-textfield":{border:"1px solid #555",backgroundColor:"inherit"}},nq),x1e={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},YS=gt.ie&&gt.ie_version<=11;class b1e{constructor(n){this.view=n,this.active=!1,this.editContext=null,this.selectionRange=new Q0e,this.selectionChanged=!1,this.delayedFlush=-1,this.resizeTimeout=-1,this.queue=[],this.delayedAndroidKey=null,this.flushingAndroidKey=-1,this.lastChange=0,this.scrollTargets=[],this.intersection=null,this.resizeScroll=null,this.intersecting=!1,this.gapIntersection=null,this.gaps=[],this.printQuery=null,this.parentCheck=-1,this.dom=n.contentDOM,this.observer=new MutationObserver(r=>{for(let i of r)this.queue.push(i);(gt.ie&&gt.ie_version<=11||gt.ios&&n.composing)&&r.some(i=>i.type=="childList"&&i.removedNodes.length||i.type=="characterData"&&i.oldValue.length>i.target.nodeValue.length)?this.flushSoon():this.flush()}),window.EditContext&&gt.android&&n.constructor.EDIT_CONTEXT!==!1&&!(gt.chrome&&gt.chrome_version<126)&&(this.editContext=new w1e(n),n.state.facet(Bl)&&(n.contentDOM.editContext=this.editContext.editContext)),YS&&(this.onCharData=r=>{this.queue.push({target:r.target,type:"characterData",oldValue:r.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this),this.onResize=this.onResize.bind(this),this.onPrint=this.onPrint.bind(this),this.onScroll=this.onScroll.bind(this),window.matchMedia&&(this.printQuery=window.matchMedia("print")),typeof ResizeObserver=="function"&&(this.resizeScroll=new ResizeObserver(()=>{var r;((r=this.view.docView)===null||r===void 0?void 0:r.lastUpdate)<Date.now()-75&&this.onResize()}),this.resizeScroll.observe(n.scrollDOM)),this.addWindowListeners(this.win=n.win),this.start(),typeof IntersectionObserver=="function"&&(this.intersection=new IntersectionObserver(r=>{this.parentCheck<0&&(this.parentCheck=setTimeout(this.listenForScroll.bind(this),1e3)),r.length>0&&r[r.length-1].intersectionRatio>0!=this.intersecting&&(this.intersecting=!this.intersecting,this.intersecting!=this.view.inView&&this.onScrollChanged(document.createEvent("Event")))},{threshold:[0,.001]}),this.intersection.observe(this.dom),this.gapIntersection=new IntersectionObserver(r=>{r.length>0&&r[r.length-1].intersectionRatio>0&&this.onScrollChanged(document.createEvent("Event"))},{})),this.listenForScroll(),this.readSelectionRange()}onScrollChanged(n){this.view.inputState.runHandlers("scroll",n),this.intersecting&&this.view.measure()}onScroll(n){this.intersecting&&this.flush(!1),this.editContext&&this.view.requestMeasure(this.editContext.measureReq),this.onScrollChanged(n)}onResize(){this.resizeTimeout<0&&(this.resizeTimeout=setTimeout(()=>{this.resizeTimeout=-1,this.view.requestMeasure()},50))}onPrint(n){(n.type=="change"||!n.type)&&!n.matches||(this.view.viewState.printing=!0,this.view.measure(),setTimeout(()=>{this.view.viewState.printing=!1,this.view.requestMeasure()},500))}updateGaps(n){if(this.gapIntersection&&(n.length!=this.gaps.length||this.gaps.some((r,i)=>r!=n[i]))){this.gapIntersection.disconnect();for(let r of n)this.gapIntersection.observe(r);this.gaps=n}}onSelectionChange(n){let r=this.selectionChanged;if(!this.readSelectionRange()||this.delayedAndroidKey)return;let{view:i}=this,s=this.selectionRange;if(i.state.facet(Bl)?i.root.activeElement!=this.dom:!gg(this.dom,s))return;let a=s.anchorNode&&i.docView.tile.nearest(s.anchorNode);if(a&&a.isWidget()&&a.widget.ignoreEvent(n)){r||(this.selectionChanged=!1);return}(gt.ie&&gt.ie_version<=11||gt.android&&gt.chrome)&&!i.state.selection.main.empty&&s.focusNode&&yg(s.focusNode,s.focusOffset,s.anchorNode,s.anchorOffset)?this.flushSoon():this.flush(!1)}readSelectionRange(){let{view:n}=this,r=Jg(n.root);if(!r)return!1;let i=gt.safari&&n.root.nodeType==11&&n.root.activeElement==this.dom&&k1e(this.view,r)||r;if(!i||this.selectionRange.eq(i))return!1;let s=gg(this.dom,i);return s&&!this.selectionChanged&&n.inputState.lastFocusTime>Date.now()-200&&n.inputState.lastTouchTime<Date.now()-300&&J0e(this.dom,i)?(this.view.inputState.lastFocusTime=0,n.docView.updateSelection(),!1):(this.selectionRange.setRange(i),s&&(this.selectionChanged=!0),!0)}setSelectionRange(n,r){this.selectionRange.set(n.node,n.offset,r.node,r.offset),this.selectionChanged=!1}clearSelectionRange(){this.selectionRange.set(null,0,null,0)}listenForScroll(){this.parentCheck=-1;let n=0,r=null;for(let i=this.dom;i;)if(i.nodeType==1)!r&&n<this.scrollTargets.length&&this.scrollTargets[n]==i?n++:r||(r=this.scrollTargets.slice(0,n)),r&&r.push(i),i=i.assignedSlot||i.parentNode;else if(i.nodeType==11)i=i.host;else break;if(n<this.scrollTargets.length&&!r&&(r=this.scrollTargets.slice(0,n)),r){for(let i of this.scrollTargets)i.removeEventListener("scroll",this.onScroll);for(let i of this.scrollTargets=r)i.addEventListener("scroll",this.onScroll)}}ignore(n){if(!this.active)return n();try{return this.stop(),n()}finally{this.start(),this.clear()}}start(){this.active||(this.observer.observe(this.dom,x1e),YS&&this.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.active=!0)}stop(){this.active&&(this.active=!1,this.observer.disconnect(),YS&&this.dom.removeEventListener("DOMCharacterDataModified",this.onCharData))}clear(){this.processRecords(),this.queue.length=0,this.selectionChanged=!1}delayAndroidKey(n,r){var i;if(!this.delayedAndroidKey){let s=()=>{let a=this.delayedAndroidKey;a&&(this.clearDelayedAndroidKey(),this.view.inputState.lastKeyCode=a.keyCode,this.view.inputState.lastKeyTime=Date.now(),!this.flush()&&a.force&&jf(this.dom,a.key,a.keyCode))};this.flushingAndroidKey=this.view.win.requestAnimationFrame(s)}(!this.delayedAndroidKey||n=="Enter")&&(this.delayedAndroidKey={key:n,keyCode:r,force:this.lastChange<Date.now()-50||!!(!((i=this.delayedAndroidKey)===null||i===void 0)&&i.force)})}clearDelayedAndroidKey(){this.win.cancelAnimationFrame(this.flushingAndroidKey),this.delayedAndroidKey=null,this.flushingAndroidKey=-1}flushSoon(){this.delayedFlush<0&&(this.delayedFlush=this.view.win.requestAnimationFrame(()=>{this.delayedFlush=-1,this.flush()}))}forceFlush(){this.delayedFlush>=0&&(this.view.win.cancelAnimationFrame(this.delayedFlush),this.delayedFlush=-1),this.flush()}pendingRecords(){for(let n of this.observer.takeRecords())this.queue.push(n);return this.queue}processRecords(){let n=this.pendingRecords();n.length&&(this.queue=[]);let r=-1,i=-1,s=!1;for(let a of n){let o=this.readMutation(a);o&&(o.typeOver&&(s=!0),r==-1?{from:r,to:i}=o:(r=Math.min(o.from,r),i=Math.max(o.to,i)))}return{from:r,to:i,typeOver:s}}readChange(){let{from:n,to:r,typeOver:i}=this.processRecords(),s=this.selectionChanged&&gg(this.dom,this.selectionRange);if(n<0&&!s)return null;n>-1&&(this.lastChange=Date.now()),this.view.inputState.lastFocusTime=0,this.selectionChanged=!1;let a=new $ke(this.view,n,r,i);return this.view.docView.domChanged={newSel:a.newSel?a.newSel.main:null},a}flush(n=!0){if(this.delayedFlush>=0||this.delayedAndroidKey)return!1;n&&this.readSelectionRange();let r=this.readChange();if(!r)return this.view.requestMeasure(),!1;let i=this.view.state,s=WW(this.view,r);return this.view.state==i&&(r.domChanged||r.newSel&&!Bb(this.view.state.selection,r.newSel.main))&&this.view.update([]),s}readMutation(n){let r=this.view.docView.tile.nearest(n.target);if(!r||r.isWidget())return null;if(r.markDirty(n.type=="attributes"),n.type=="childList"){let i=IL(r,n.previousSibling||n.target.previousSibling,-1),s=IL(r,n.nextSibling||n.target.nextSibling,1);return{from:i?r.posAfter(i):r.posAtStart,to:s?r.posBefore(s):r.posAtEnd,typeOver:!1}}else return n.type=="characterData"?{from:r.posAtStart,to:r.posAtEnd,typeOver:n.target.nodeValue==n.oldValue}:null}setWindow(n){n!=this.win&&(this.removeWindowListeners(this.win),this.win=n,this.addWindowListeners(this.win))}addWindowListeners(n){n.addEventListener("resize",this.onResize),this.printQuery?this.printQuery.addEventListener?this.printQuery.addEventListener("change",this.onPrint):this.printQuery.addListener(this.onPrint):n.addEventListener("beforeprint",this.onPrint),n.addEventListener("scroll",this.onScroll),n.document.addEventListener("selectionchange",this.onSelectionChange)}removeWindowListeners(n){n.removeEventListener("scroll",this.onScroll),n.removeEventListener("resize",this.onResize),this.printQuery?this.printQuery.removeEventListener?this.printQuery.removeEventListener("change",this.onPrint):this.printQuery.removeListener(this.onPrint):n.removeEventListener("beforeprint",this.onPrint),n.document.removeEventListener("selectionchange",this.onSelectionChange)}update(n){this.editContext&&(this.editContext.update(n),n.startState.facet(Bl)!=n.state.facet(Bl)&&(n.view.contentDOM.editContext=n.state.facet(Bl)?this.editContext.editContext:null))}destroy(){var n,r,i;this.stop(),(n=this.intersection)===null||n===void 0||n.disconnect(),(r=this.gapIntersection)===null||r===void 0||r.disconnect(),(i=this.resizeScroll)===null||i===void 0||i.disconnect();for(let s of this.scrollTargets)s.removeEventListener("scroll",this.onScroll);this.removeWindowListeners(this.win),clearTimeout(this.parentCheck),clearTimeout(this.resizeTimeout),this.win.cancelAnimationFrame(this.delayedFlush),this.win.cancelAnimationFrame(this.flushingAndroidKey),this.editContext&&(this.view.contentDOM.editContext=null,this.editContext.destroy())}}function IL(e,n,r){for(;n;){let i=Or.get(n);if(i&&i.parent==e)return i;let s=n.parentNode;n=s!=e.dom?s:r>0?n.nextSibling:n.previousSibling}return null}function BL(e,n){let r=n.startContainer,i=n.startOffset,s=n.endContainer,a=n.endOffset,o=e.docView.domAtPos(e.state.selection.main.anchor,1);return yg(o.node,o.offset,s,a)&&([r,i,s,a]=[s,a,r,i]),{anchorNode:r,anchorOffset:i,focusNode:s,focusOffset:a}}function k1e(e,n){if(n.getComposedRanges){let s=n.getComposedRanges(e.root)[0];if(s)return BL(e,s)}let r=null;function i(s){s.preventDefault(),s.stopImmediatePropagation(),r=s.getTargetRanges()[0]}return e.contentDOM.addEventListener("beforeinput",i,!0),e.dom.ownerDocument.execCommand("indent"),e.contentDOM.removeEventListener("beforeinput",i,!0),r?BL(e,r):null}class w1e{constructor(n){this.from=0,this.to=0,this.pendingContextChange=null,this.handlers=Object.create(null),this.composing=null,this.resetRange(n.state);let r=this.editContext=new window.EditContext({text:n.state.doc.sliceString(this.from,this.to),selectionStart:this.toContextPos(Math.max(this.from,Math.min(this.to,n.state.selection.main.anchor))),selectionEnd:this.toContextPos(n.state.selection.main.head)});this.handlers.textupdate=i=>{let s=n.state.selection.main,{anchor:a,head:o}=s,l=this.toEditorPos(i.updateRangeStart),u=this.toEditorPos(i.updateRangeEnd);n.inputState.composing>=0&&!this.composing&&(this.composing={contextBase:i.updateRangeStart,editorBase:l,drifted:!1});let d=u-l>i.text.length;l==this.from&&a<this.from?l=a:u==this.to&&a>this.to&&(u=a);let p=qW(n.state.sliceDoc(l,u),i.text,(d?s.from:s.to)-l,d?"end":null);if(!p){let g=Be.single(this.toEditorPos(i.selectionStart),this.toEditorPos(i.selectionEnd));Bb(g,s)||n.dispatch({selection:g,userEvent:"select"});return}let f={from:p.from+l,to:p.toA+l,insert:Dn.of(i.text.slice(p.from,p.toB).split(`
`))};if((gt.mac||gt.android)&&f.from==o-1&&/^\. ?$/.test(i.text)&&n.contentDOM.getAttribute("autocorrect")=="off"&&(f={from:l,to:u,insert:Dn.of([i.text.replace("."," ")])}),this.pendingContextChange=f,!n.state.readOnly){let g=this.to-this.from+(f.to-f.from+f.insert.length);xT(n,f,Be.single(this.toEditorPos(i.selectionStart,g),this.toEditorPos(i.selectionEnd,g)))}this.pendingContextChange&&(this.revertPending(n.state),this.setSelection(n.state)),f.from<f.to&&!f.insert.length&&n.inputState.composing>=0&&!/[\\p{Alphabetic}\\p{Number}_]/.test(r.text.slice(Math.max(0,i.updateRangeStart-1),Math.min(r.text.length,i.updateRangeStart+1)))&&this.handlers.compositionend(i)},this.handlers.characterboundsupdate=i=>{let s=[],a=null;for(let o=this.toEditorPos(i.rangeStart),l=this.toEditorPos(i.rangeEnd);o<l;o++){let u=n.coordsForChar(o);a=u&&new DOMRect(u.left,u.top,u.right-u.left,u.bottom-u.top)||a||new DOMRect,s.push(a)}r.updateCharacterBounds(i.rangeStart,s)},this.handlers.textformatupdate=i=>{let s=[];for(let a of i.getTextFormats()){let o=a.underlineStyle,l=a.underlineThickness;if(!/none/i.test(o)&&!/none/i.test(l)){let u=this.toEditorPos(a.rangeStart),d=this.toEditorPos(a.rangeEnd);if(u<d){let p=`text-decoration: underline ${/^[a-z]/.test(o)?o+" ":o=="Dashed"?"dashed ":o=="Squiggle"?"wavy ":""}${/thin/i.test(l)?1:2}px`;s.push(Pt.mark({attributes:{style:p}}).range(u,d))}}}n.dispatch({effects:DW.of(Pt.set(s))})},this.handlers.compositionstart=()=>{n.inputState.composing<0&&(n.inputState.composing=0,n.inputState.compositionFirstChange=!0)},this.handlers.compositionend=()=>{if(n.inputState.composing=-1,n.inputState.compositionFirstChange=null,this.composing){let{drifted:i}=this.composing;this.composing=null,i&&this.reset(n.state)}};for(let i in this.handlers)r.addEventListener(i,this.handlers[i]);this.measureReq={read:i=>{this.editContext.updateControlBounds(i.contentDOM.getBoundingClientRect());let s=Jg(i.root);s&&s.rangeCount&&this.editContext.updateSelectionBounds(s.getRangeAt(0).getBoundingClientRect())}}}applyEdits(n){let r=0,i=!1,s=this.pendingContextChange;return n.changes.iterChanges((a,o,l,u,d)=>{if(i)return;let p=d.length-(o-a);if(s&&o>=s.to)if(s.from==a&&s.to==o&&s.insert.eq(d)){s=this.pendingContextChange=null,r+=p,this.to+=p;return}else s=null,this.revertPending(n.state);if(a+=r,o+=r,o<=this.from)this.from+=p,this.to+=p;else if(a<this.to){if(a<this.from||o>this.to||this.to-this.from+d.length>3e4){i=!0;return}this.editContext.updateText(this.toContextPos(a),this.toContextPos(o),d.toString()),this.to+=p}r+=p}),s&&!i&&this.revertPending(n.state),!i}update(n){let r=this.pendingContextChange,i=n.startState.selection.main;this.composing&&(this.composing.drifted||!n.changes.touchesRange(i.from,i.to)&&n.transactions.some(s=>!s.isUserEvent("input.type")&&s.changes.touchesRange(this.from,this.to)))?(this.composing.drifted=!0,this.composing.editorBase=n.changes.mapPos(this.composing.editorBase)):!this.applyEdits(n)||!this.rangeIsValid(n.state)?(this.pendingContextChange=null,this.reset(n.state)):(n.docChanged||n.selectionSet||r)&&this.setSelection(n.state),(n.geometryChanged||n.docChanged||n.selectionSet)&&n.view.requestMeasure(this.measureReq)}resetRange(n){let{head:r}=n.selection.main;this.from=Math.max(0,r-1e4),this.to=Math.min(n.doc.length,r+1e4)}reset(n){this.resetRange(n),this.editContext.updateText(0,this.editContext.text.length,n.doc.sliceString(this.from,this.to)),this.setSelection(n)}revertPending(n){let r=this.pendingContextChange;this.pendingContextChange=null,this.editContext.updateText(this.toContextPos(r.from),this.toContextPos(r.from+r.insert.length),n.doc.sliceString(r.from,r.to))}setSelection(n){let{main:r}=n.selection,i=this.toContextPos(Math.max(this.from,Math.min(this.to,r.anchor))),s=this.toContextPos(r.head);(this.editContext.selectionStart!=i||this.editContext.selectionEnd!=s)&&this.editContext.updateSelection(i,s)}rangeIsValid(n){let{head:r}=n.selection.main;return!(this.from>0&&r-this.from<500||this.to<n.doc.length&&this.to-r<500||this.to-this.from>1e4*3)}toEditorPos(n,r=this.to-this.from){n=Math.min(n,r);let i=this.composing;return i&&i.drifted?i.editorBase+(n-i.contextBase):n+this.from}toContextPos(n){let r=this.composing;return r&&r.drifted?r.contextBase+(n-r.editorBase):n-this.from}destroy(){for(let n in this.handlers)this.editContext.removeEventListener(n,this.handlers[n])}}class ct{get state(){return this.viewState.state}get viewport(){return this.viewState.viewport}get visibleRanges(){return this.viewState.visibleRanges}get inView(){return this.viewState.inView}get composing(){return!!this.inputState&&this.inputState.composing>0}get compositionStarted(){return!!this.inputState&&this.inputState.composing>=0}get root(){return this._root}get win(){return this.dom.ownerDocument.defaultView||window}constructor(n={}){var r;this.plugins=[],this.pluginMap=new Map,this.editorAttrs={},this.contentAttrs={},this.bidiCache=[],this.destroyed=!1,this.updateState=2,this.measureScheduled=-1,this.measureRequests=[],this.contentDOM=document.createElement("div"),this.scrollDOM=document.createElement("div"),this.scrollDOM.tabIndex=-1,this.scrollDOM.className="cm-scroller",this.scrollDOM.appendChild(this.contentDOM),this.announceDOM=document.createElement("div"),this.announceDOM.className="cm-announced",this.announceDOM.setAttribute("aria-live","polite"),this.dom=document.createElement("div"),this.dom.appendChild(this.announceDOM),this.dom.appendChild(this.scrollDOM),n.parent&&n.parent.appendChild(this.dom);let{dispatch:i}=n;this.dispatchTransactions=n.dispatchTransactions||i&&(s=>s.forEach(a=>i(a,this)))||(s=>this.update(s)),this.dispatch=this.dispatch.bind(this),this._root=n.root||Z0e(n.parent)||document,this.viewState=new DL(this,n.state||yn.create(n)),n.scrollTo&&n.scrollTo.is(M_)&&(this.viewState.scrollTarget=n.scrollTo.value.clip(this.viewState.state)),this.plugins=this.state.facet(hf).map(s=>new HS(s));for(let s of this.plugins)s.update(this);this.observer=new b1e(this),this.inputState=new qke(this),this.inputState.ensureHandlers(this.plugins),this.docView=new bL(this),this.mountStyles(),this.updateAttrs(),this.updateState=0,this.requestMeasure(),!((r=document.fonts)===null||r===void 0)&&r.ready&&document.fonts.ready.then(()=>{this.viewState.mustMeasureContent="refresh",this.requestMeasure()})}dispatch(...n){let r=n.length==1&&n[0]instanceof si?n:n.length==1&&Array.isArray(n[0])?n[0]:[this.state.update(...n)];this.dispatchTransactions(r,this)}update(n){if(this.updateState!=0)throw new Error("Calls to EditorView.update are not allowed while an update is in progress");let r=!1,i=!1,s,a=this.state;for(let g of n){if(g.startState!=a)throw new RangeError("Trying to update state with a transaction that doesn't start from the previous state.");a=g.state}if(this.destroyed){this.viewState.state=a;return}let o=this.hasFocus,l=0,u=null;n.some(g=>g.annotation(XW))?(this.inputState.notifiedFocused=o,l=1):o!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=o,u=QW(a,o),u||(l=1));let d=this.observer.delayedAndroidKey,p=null;if(d?(this.observer.clearDelayedAndroidKey(),p=this.observer.readChange(),(p&&!this.state.doc.eq(a.doc)||!this.state.selection.eq(a.selection))&&(p=null)):this.observer.clear(),a.facet(yn.phrases)!=this.state.facet(yn.phrases))return this.setState(a);s=Pb.create(this,a,n),s.flags|=l;let f=this.viewState.scrollTarget;try{this.updateState=2;for(let g of n){if(f&&(f=f.map(g.changes)),g.scrollIntoView){let{main:_}=g.state.selection,{x,y:v}=this.state.facet(ct.cursorScrollMargin);f=new Nf(_.empty?_:Be.cursor(_.head,_.head>_.anchor?-1:1),"nearest","nearest",v,x)}for(let _ of g.effects)_.is(M_)&&(f=_.value.clip(this.state))}this.viewState.update(s,f),this.bidiCache=$b.update(this.bidiCache,s.changes),s.empty||(this.updatePlugins(s),this.inputState.update(s)),r=this.docView.update(s),this.state.facet(Ym)!=this.styleModules&&this.mountStyles(),i=this.updateAttrs(),this.showAnnouncements(n),this.docView.updateSelection(r,n.some(g=>g.isUserEvent("select.pointer")))}finally{this.updateState=0}if(s.startState.facet(I_)!=s.state.facet(I_)&&(this.viewState.mustMeasureContent=!0),(r||i||f||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),r&&this.docViewUpdate(),!s.empty)for(let g of this.state.facet(kN))try{g(s)}catch(_){ss(this.state,_,"update listener")}(u||p)&&Promise.resolve().then(()=>{u&&this.state==u.startState&&this.dispatch(u),p&&!WW(this,p)&&d.force&&jf(this.contentDOM,d.key,d.keyCode)})}setState(n){if(this.updateState!=0)throw new Error("Calls to EditorView.setState are not allowed while an update is in progress");if(this.destroyed){this.viewState.state=n;return}this.updateState=2;let r=this.hasFocus;try{for(let i of this.plugins)i.destroy(this);this.viewState=new DL(this,n),this.plugins=n.facet(hf).map(i=>new HS(i)),this.pluginMap.clear();for(let i of this.plugins)i.update(this);this.docView.destroy(),this.docView=new bL(this),this.inputState.ensureHandlers(this.plugins),this.mountStyles(),this.updateAttrs(),this.bidiCache=[]}finally{this.updateState=0}r&&this.focus(),this.requestMeasure()}updatePlugins(n){let r=n.startState.facet(hf),i=n.state.facet(hf);if(r!=i){let s=[];for(let a of i){let o=r.indexOf(a);if(o<0)s.push(new HS(a));else{let l=this.plugins[o];l.mustUpdate=n,s.push(l)}}for(let a of this.plugins)a.mustUpdate!=n&&a.destroy(this);this.plugins=s,this.pluginMap.clear()}else for(let s of this.plugins)s.mustUpdate=n;for(let s=0;s<this.plugins.length;s++)this.plugins[s].update(this);r!=i&&this.inputState.ensureHandlers(this.plugins)}docViewUpdate(){for(let n of this.plugins){let r=n.value;if(r&&r.docViewUpdate)try{r.docViewUpdate(this)}catch(i){ss(this.state,i,"doc view update listener")}}}measure(n=!0){if(this.destroyed)return;if(this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.observer.delayedAndroidKey){this.measureScheduled=-1,this.requestMeasure();return}this.measureScheduled=0,n&&this.observer.forceFlush();let r=null,i=this.viewState.scrollParent,s=this.viewState.getScrollOffset(),{scrollAnchorPos:a,scrollAnchorHeight:o}=this.viewState;Math.abs(s-this.viewState.scrollOffset)>1&&(o=-1),this.viewState.scrollAnchorHeight=-1;try{for(let l=0;;l++){if(o<0)if(vW(i||this.win))a=-1,o=this.viewState.heightMap.height;else{let _=this.viewState.scrollAnchorAt(s);a=_.from,o=_.top}this.updateState=1;let u=this.viewState.measure();if(!u&&!this.measureRequests.length&&this.viewState.scrollTarget==null)break;if(l>5){console.warn(this.measureRequests.length?"Measure loop restarted more than 5 times":"Viewport failed to stabilize");break}let d=[];u&4||([this.measureRequests,d]=[d,this.measureRequests]);let p=d.map(_=>{try{return _.read(this)}catch(x){return ss(this.state,x),zL}}),f=Pb.create(this,this.state,[]),g=!1;f.flags|=u,r?r.flags|=u:r=f,this.updateState=2,f.empty||(this.updatePlugins(f),this.inputState.update(f),this.updateAttrs(),g=this.docView.update(f),g&&this.docViewUpdate());for(let _=0;_<d.length;_++)if(p[_]!=zL)try{let x=d[_];x.write&&x.write(p[_],this)}catch(x){ss(this.state,x)}if(g&&this.docView.updateSelection(!0),!f.viewportChanged&&this.measureRequests.length==0){if(this.viewState.editorHeight)if(this.viewState.scrollTarget){this.docView.scrollIntoView(this.viewState.scrollTarget),this.viewState.scrollTarget=null,o=-1;continue}else{let x=((a<0?this.viewState.heightMap.height:this.viewState.lineBlockAt(a).top)-o)/this.scaleY;if((x>1||x<-1)&&(i==this.scrollDOM||this.hasFocus||Math.max(this.inputState.lastWheelEvent,this.inputState.lastTouchTime)>Date.now()-100)){s=s+x,i?i.scrollTop+=x:this.win.scrollBy(0,x),o=-1;continue}}break}}}finally{this.updateState=0,this.measureScheduled=-1}if(r&&!r.empty)for(let l of this.state.facet(kN))l(r)}get themeClasses(){return EN+" "+(this.state.facet(NN)?tq:eq)+" "+this.state.facet(I_)}updateAttrs(){let n=$L(this,PW,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),r={spellcheck:"false",autocorrect:"off",autocapitalize:"off",writingsuggestions:"false",translate:"no",contenteditable:this.state.facet(Bl)?"true":"false",class:"cm-content",style:`${gt.tabSize}: ${this.state.tabSize}`,role:"textbox","aria-multiline":"true"};this.state.readOnly&&(r["aria-readonly"]="true"),$L(this,vT,r);let i=this.observer.ignore(()=>{let s=mL(this.contentDOM,this.contentAttrs,r),a=mL(this.dom,this.editorAttrs,n);return s||a});return this.editorAttrs=n,this.contentAttrs=r,i}showAnnouncements(n){let r=!0;for(let i of n)for(let s of i.effects)if(s.is(ct.announce)){r&&(this.announceDOM.textContent=""),r=!1;let a=this.announceDOM.appendChild(document.createElement("div"));a.textContent=s.value}}mountStyles(){this.styleModules=this.state.facet(Ym);let n=this.state.facet(ct.cspNonce);mu.mount(this.root,this.styleModules.concat(_1e).reverse(),n?{nonce:n}:void 0)}readMeasured(){if(this.updateState==2)throw new Error("Reading the editor layout isn't allowed during an update");this.updateState==0&&this.measureScheduled>-1&&this.measure(!1)}requestMeasure(n){if(this.measureScheduled<0&&(this.measureScheduled=this.win.requestAnimationFrame(()=>this.measure())),n){if(this.measureRequests.indexOf(n)>-1)return;if(n.key!=null){for(let r=0;r<this.measureRequests.length;r++)if(this.measureRequests[r].key===n.key){this.measureRequests[r]=n;return}}this.measureRequests.push(n)}}plugin(n){let r=this.pluginMap.get(n);return(r===void 0||r&&r.plugin!=n)&&this.pluginMap.set(n,r=this.plugins.find(i=>i.plugin==n)||null),r&&r.update(this).value}get documentTop(){return this.contentDOM.getBoundingClientRect().top+this.viewState.paddingTop}get documentPadding(){return{top:this.viewState.paddingTop,bottom:this.viewState.paddingBottom}}get scaleX(){return this.viewState.scaleX}get scaleY(){return this.viewState.scaleY}elementAtHeight(n){return this.readMeasured(),this.viewState.elementAtHeight(n)}lineBlockAtHeight(n){return this.readMeasured(),this.viewState.lineBlockAtHeight(n)}get viewportLineBlocks(){return this.viewState.viewportLines}lineBlockAt(n){return this.viewState.lineBlockAt(n)}get contentHeight(){return this.viewState.contentHeight}moveByChar(n,r,i){return KS(this,n,kL(this,n,r,i))}moveByGroup(n,r){return KS(this,n,kL(this,n,r,i=>Dke(this,n.head,i)))}visualLineSide(n,r){let i=this.bidiSpans(n),s=this.textDirectionAt(n.from),a=i[r?i.length-1:0];return Be.cursor(a.side(r,s)+n.from,a.forward(!r,s)?1:-1)}moveToLineBoundary(n,r,i=!0){return Oke(this,n,r,i)}moveVertically(n,r,i){return KS(this,n,Pke(this,n,r,i))}domAtPos(n,r=1){return this.docView.domAtPos(n,r)}posAtDOM(n,r=0){return this.docView.posFromDOM(n,r)}posAtCoords(n,r=!0){this.readMeasured();let i=CN(this,n,r);return i&&i.pos}posAndSideAtCoords(n,r=!0){return this.readMeasured(),CN(this,n,r)}coordsAtPos(n,r=1){this.readMeasured();let i=this.docView.coordsAt(n,r);if(!i||i.left==i.right)return i;let s=this.state.doc.lineAt(n),a=this.bidiSpans(s),o=a[Wo.find(a,n-s.from,-1,r)];return ev(i,o.dir==Jn.LTR==r>0)}coordsForChar(n){return this.readMeasured(),this.docView.coordsForChar(n)}get defaultCharacterWidth(){return this.viewState.heightOracle.charWidth}get defaultLineHeight(){return this.viewState.heightOracle.lineHeight}get textDirection(){return this.viewState.defaultTextDirection}textDirectionAt(n){return!this.state.facet(MW)||n<this.viewport.from||n>this.viewport.to?this.textDirection:(this.readMeasured(),this.docView.textDirectionAt(n))}get lineWrapping(){return this.viewState.heightOracle.lineWrapping}bidiSpans(n){if(n.length>S1e)return wW(n.length);let r=this.textDirectionAt(n.from),i;for(let a of this.bidiCache)if(a.from==n.from&&a.dir==r&&(a.fresh||kW(a.isolates,i=yL(this,n))))return a.order;i||(i=yL(this,n));let s=ake(n.text,r,i);return this.bidiCache.push(new $b(n.from,n.to,r,i,!0,s)),s}get hasFocus(){var n;return(this.dom.ownerDocument.hasFocus()||gt.safari&&((n=this.inputState)===null||n===void 0?void 0:n.lastContextMenu)>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore(()=>{gW(this.contentDOM),this.docView.updateSelection()})}setRoot(n){this._root!=n&&(this._root=n,this.observer.setWindow((n.nodeType==9?n:n.ownerDocument).defaultView||window),this.mountStyles())}destroy(){this.root.activeElement==this.contentDOM&&this.contentDOM.blur();for(let n of this.plugins)n.destroy(this);this.plugins=[],this.inputState.destroy(),this.docView.destroy(),this.dom.remove(),this.observer.destroy(),this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.destroyed=!0}static scrollIntoView(n,r={}){var i,s,a,o;return M_.of(new Nf(typeof n=="number"?Be.cursor(n):n,(i=r.y)!==null&&i!==void 0?i:"nearest",(s=r.x)!==null&&s!==void 0?s:"nearest",(a=r.yMargin)!==null&&a!==void 0?a:5,(o=r.xMargin)!==null&&o!==void 0?o:5))}scrollSnapshot(){let{scrollTop:n,scrollLeft:r}=this.scrollDOM,i=this.viewState.scrollAnchorAt(n);return M_.of(new Nf(Be.cursor(i.from),"start","start",i.top-n,r,!0))}setTabFocusMode(n){n==null?this.inputState.tabFocusMode=this.inputState.tabFocusMode<0?0:-1:typeof n=="boolean"?this.inputState.tabFocusMode=n?0:-1:this.inputState.tabFocusMode!=0&&(this.inputState.tabFocusMode=Date.now()+n)}static domEventHandlers(n){return Cr.define(()=>({}),{eventHandlers:n})}static domEventObservers(n){return Cr.define(()=>({}),{eventObservers:n})}static theme(n,r){let i=mu.newName(),s=[I_.of(i),Ym.of(AN(`.${i}`,n))];return r&&r.dark&&s.push(NN.of(!0)),s}static baseTheme(n){return Kd.lowest(Ym.of(AN("."+EN,n,nq)))}static findFromDOM(n){var r;let i=n.querySelector(".cm-content"),s=i&&Or.get(i)||Or.get(n);return((r=s==null?void 0:s.root)===null||r===void 0?void 0:r.view)||null}}ct.styleModule=Ym;ct.inputHandler=AW;ct.clipboardInputFilter=mT;ct.clipboardOutputFilter=gT;ct.scrollHandler=OW;ct.focusChangeEffect=TW;ct.perLineTextDirection=MW;ct.exceptionSink=EW;ct.updateListener=kN;ct.editable=Bl;ct.mouseSelectionStyle=NW;ct.dragMovesSelection=jW;ct.clickAddsSelectionRange=CW;ct.decorations=ek;ct.blockWrappers=LW;ct.outerDecorations=yT;ct.atomicRanges=Uv;ct.bidiIsolatedRanges=IW;ct.cursorScrollMargin=pt.define({combine:e=>{let n=5,r=5;for(let i of e)typeof i=="number"?n=r=i:{x:n,y:r}=i;return{x:n,y:r}}});ct.scrollMargins=BW;ct.darkTheme=NN;ct.cspNonce=pt.define({combine:e=>e.length?e[0]:""});ct.contentAttributes=vT;ct.editorAttributes=PW;ct.lineWrapping=ct.contentAttributes.of({class:"cm-lineWrapping"});ct.announce=Gt.define();const S1e=4096,zL={};class $b{constructor(n,r,i,s,a,o){this.from=n,this.to=r,this.dir=i,this.isolates=s,this.fresh=a,this.order=o}static update(n,r){if(r.empty&&!n.some(a=>a.fresh))return n;let i=[],s=n.length?n[n.length-1].dir:Jn.LTR;for(let a=Math.max(0,n.length-10);a<n.length;a++){let o=n[a];o.dir==s&&!r.touchesRange(o.from,o.to)&&i.push(new $b(r.mapPos(o.from,1),r.mapPos(o.to,-1),o.dir,o.isolates,!1,o.order))}return i}}function $L(e,n,r){for(let i=e.state.facet(n),s=i.length-1;s>=0;s--){let a=i[s],o=typeof a=="function"?a(e):a;o&&hT(o,r)}return r}const C1e=gt.mac?"mac":gt.windows?"win":gt.linux?"linux":"key";function j1e(e,n){const r=e.split(/-(?!$)/);let i=r[r.length-1];i=="Space"&&(i=" ");let s,a,o,l;for(let u=0;u<r.length-1;++u){const d=r[u];if(/^(cmd|meta|m)$/i.test(d))l=!0;else if(/^a(lt)?$/i.test(d))s=!0;else if(/^(c|ctrl|control)$/i.test(d))a=!0;else if(/^s(hift)?$/i.test(d))o=!0;else if(/^mod$/i.test(d))n=="mac"?l=!0:a=!0;else throw new Error("Unrecognized modifier name: "+d)}return s&&(i="Alt-"+i),a&&(i="Ctrl-"+i),l&&(i="Meta-"+i),o&&(i="Shift-"+i),i}function B_(e,n,r){return n.altKey&&(e="Alt-"+e),n.ctrlKey&&(e="Ctrl-"+e),n.metaKey&&(e="Meta-"+e),r!==!1&&n.shiftKey&&(e="Shift-"+e),e}const N1e=Kd.default(ct.domEventHandlers({keydown(e,n){return iq(rq(n.state),e,n,"editor")}})),ik=pt.define({enables:N1e}),FL=new WeakMap;function rq(e){let n=e.facet(ik),r=FL.get(n);return r||FL.set(n,r=T1e(n.reduce((i,s)=>i.concat(s),[]))),r}function E1e(e,n,r){return iq(rq(e.state),n,e,r)}let Zc=null;const A1e=4e3;function T1e(e,n=C1e){let r=Object.create(null),i=Object.create(null),s=(o,l)=>{let u=i[o];if(u==null)i[o]=l;else if(u!=l)throw new Error("Key binding "+o+" is used both as a regular binding and as a multi-stroke prefix")},a=(o,l,u,d,p)=>{var f,g;let _=r[o]||(r[o]=Object.create(null)),x=l.split(/ (?!$)/).map(w=>j1e(w,n));for(let w=1;w<x.length;w++){let j=x.slice(0,w).join(" ");s(j,!0),_[j]||(_[j]={preventDefault:!0,stopPropagation:!1,run:[C=>{let T=Zc={view:C,prefix:j,scope:o};return setTimeout(()=>{Zc==T&&(Zc=null)},A1e),!0}]})}let v=x.join(" ");s(v,!1);let S=_[v]||(_[v]={preventDefault:!1,stopPropagation:!1,run:((g=(f=_._any)===null||f===void 0?void 0:f.run)===null||g===void 0?void 0:g.slice())||[]});u&&S.run.push(u),d&&(S.preventDefault=!0),p&&(S.stopPropagation=!0)};for(let o of e){let l=o.scope?o.scope.split(" "):["editor"];if(o.any)for(let d of l){let p=r[d]||(r[d]=Object.create(null));p._any||(p._any={preventDefault:!1,stopPropagation:!1,run:[]});let{any:f}=o;for(let g in p)p[g].run.push(_=>f(_,TN))}let u=o[n]||o.key;if(u)for(let d of l)a(d,u,o.run,o.preventDefault,o.stopPropagation),o.shift&&a(d,"Shift-"+u,o.shift,o.preventDefault,o.stopPropagation)}return r}let TN=null;function iq(e,n,r,i){TN=n;let s=U0e(n),a=ks(s,0),o=Bo(a)==s.length&&s!=" ",l="",u=!1,d=!1,p=!1;Zc&&Zc.view==r&&Zc.scope==i&&(l=Zc.prefix+" ",KW.indexOf(n.keyCode)<0&&(d=!0,Zc=null));let f=new Set,g=S=>{if(S){for(let w of S.run)if(!f.has(w)&&(f.add(w),w(r)))return S.stopPropagation&&(p=!0),!0;S.preventDefault&&(S.stopPropagation&&(p=!0),d=!0)}return!1},_=e[i],x,v;return _&&(g(_[l+B_(s,n,!o)])?u=!0:o&&(n.altKey||n.metaKey||n.ctrlKey)&&!(gt.windows&&n.ctrlKey&&n.altKey)&&!(gt.mac&&n.altKey&&!(n.ctrlKey||n.metaKey))&&(x=gu[n.keyCode])&&x!=s?(g(_[l+B_(x,n,!0)])||n.shiftKey&&(v=Qg[n.keyCode])!=s&&v!=x&&g(_[l+B_(v,n,!1)]))&&(u=!0):o&&n.shiftKey&&g(_[l+B_(s,n,!0)])&&(u=!0),!u&&g(_._any)&&(u=!0)),d&&(u=!0),u&&p&&n.stopPropagation(),TN=null,u}class jd{constructor(n,r,i,s,a){this.className=n,this.left=r,this.top=i,this.width=s,this.height=a}draw(){let n=document.createElement("div");return n.className=this.className,this.adjust(n),n}update(n,r){return r.className!=this.className?!1:(this.adjust(n),!0)}adjust(n){n.style.left=this.left+"px",n.style.top=this.top+"px",this.width!=null&&(n.style.width=this.width+"px"),n.style.height=this.height+"px"}eq(n){return this.left==n.left&&this.top==n.top&&this.width==n.width&&this.height==n.height&&this.className==n.className}static forRange(n,r,i){if(i.empty){let s=n.coordsAtPos(i.head,i.assoc||1);if(!s)return[];let a=sq(n);return[new jd(r,s.left-a.left,s.top-a.top,null,s.bottom-s.top)]}else return M1e(n,r,i)}}function sq(e){let n=e.scrollDOM.getBoundingClientRect();return{left:(e.textDirection==Jn.LTR?n.left:n.right-e.scrollDOM.clientWidth*e.scaleX)-e.scrollDOM.scrollLeft*e.scaleX,top:n.top-e.scrollDOM.scrollTop*e.scaleY}}function HL(e,n,r,i){let s=e.coordsAtPos(n,r*2);if(!s)return i;let a=e.dom.getBoundingClientRect(),o=(s.top+s.bottom)/2,l=e.posAtCoords({x:a.left+1,y:o}),u=e.posAtCoords({x:a.right-1,y:o});return l==null||u==null?i:{from:Math.max(i.from,Math.min(l,u)),to:Math.min(i.to,Math.max(l,u))}}function M1e(e,n,r){if(r.to<=e.viewport.from||r.from>=e.viewport.to)return[];let i=Math.max(r.from,e.viewport.from),s=Math.min(r.to,e.viewport.to),a=e.textDirection==Jn.LTR,o=e.contentDOM,l=o.getBoundingClientRect(),u=sq(e),d=o.querySelector(".cm-line"),p=d&&window.getComputedStyle(d),f=l.left+(p?parseInt(p.paddingLeft)+Math.min(0,parseInt(p.textIndent)):0),g=l.right-(p?parseInt(p.paddingRight):0),_=SN(e,i,1),x=SN(e,s,-1),v=_.type==Ri.Text?_:null,S=x.type==Ri.Text?x:null;if(v&&(e.lineWrapping||_.widgetLineBreaks)&&(v=HL(e,i,1,v)),S&&(e.lineWrapping||x.widgetLineBreaks)&&(S=HL(e,s,-1,S)),v&&S&&v.from==S.from&&v.to==S.to)return j(C(r.from,r.to,v));{let E=v?C(r.from,null,v):T(_,!1),A=S?C(null,r.to,S):T(x,!0),O=[];return(v||_).to<(S||x).from-(v&&S?1:0)||_.widgetLineBreaks>1&&E.bottom+e.defaultLineHeight/2<A.top?O.push(w(f,E.bottom,g,A.top)):E.bottom<A.top&&e.elementAtHeight((E.bottom+A.top)/2).type==Ri.Text&&(E.bottom=A.top=(E.bottom+A.top)/2),j(E).concat(O).concat(j(A))}function w(E,A,O,F){return new jd(n,E-u.left,A-u.top,Math.max(0,O-E),F-A)}function j({top:E,bottom:A,horizontal:O}){let F=[];for(let L=0;L<O.length;L+=2)F.push(w(O[L],E,O[L+1],A));return F}function C(E,A,O){let F=1e9,L=-1e9,$=[];function z(D,U,I,X,K){let Q=e.coordsAtPos(D,D==O.to?-2:2),V=e.coordsAtPos(I,I==O.from?2:-2);!Q||!V||(F=Math.min(Q.top,V.top,F),L=Math.max(Q.bottom,V.bottom,L),K==Jn.LTR?$.push(a&&U?f:Q.left,a&&X?g:V.right):$.push(!a&&X?f:V.left,!a&&U?g:Q.right))}let B=E??O.from,H=A??O.to;for(let D of e.visibleRanges)if(D.to>B&&D.from<H)for(let U=Math.max(D.from,B),I=Math.min(D.to,H);;){let X=e.state.doc.lineAt(U);for(let K of e.bidiSpans(X)){let Q=K.from+X.from,V=K.to+X.from;if(Q>=I)break;V>U&&z(Math.max(Q,U),E==null&&Q<=B,Math.min(V,I),A==null&&V>=H,K.dir)}if(U=X.to+1,U>=I)break}return $.length==0&&z(B,E==null,H,A==null,e.textDirection),{top:F,bottom:L,horizontal:$}}function T(E,A){let O=l.top+(A?E.top:E.bottom);return{top:O,bottom:O,horizontal:[]}}}function R1e(e,n){return e.constructor==n.constructor&&e.eq(n)}class O1e{constructor(n,r){this.view=n,this.layer=r,this.drawn=[],this.scaleX=1,this.scaleY=1,this.measureReq={read:this.measure.bind(this),write:this.draw.bind(this)},this.dom=n.scrollDOM.appendChild(document.createElement("div")),this.dom.classList.add("cm-layer"),r.above&&this.dom.classList.add("cm-layer-above"),r.class&&this.dom.classList.add(r.class),this.scale(),this.dom.setAttribute("aria-hidden","true"),this.setOrder(n.state),n.requestMeasure(this.measureReq),r.mount&&r.mount(this.dom,n)}update(n){n.startState.facet(Lx)!=n.state.facet(Lx)&&this.setOrder(n.state),(this.layer.update(n,this.dom)||n.geometryChanged)&&(this.scale(),n.view.requestMeasure(this.measureReq))}docViewUpdate(n){this.layer.updateOnDocViewUpdate!==!1&&n.requestMeasure(this.measureReq)}setOrder(n){let r=0,i=n.facet(Lx);for(;r<i.length&&i[r]!=this.layer;)r++;this.dom.style.zIndex=String((this.layer.above?150:-1)-r)}measure(){return this.layer.markers(this.view)}scale(){let{scaleX:n,scaleY:r}=this.view;(n!=this.scaleX||r!=this.scaleY)&&(this.scaleX=n,this.scaleY=r,this.dom.style.transform=`scale(${1/n}, ${1/r})`)}draw(n){if(n.length!=this.drawn.length||n.some((r,i)=>!R1e(r,this.drawn[i]))){let r=this.dom.firstChild,i=0;for(let s of n)s.update&&r&&s.constructor&&this.drawn[i].constructor&&s.update(r,this.drawn[i])?(r=r.nextSibling,i++):this.dom.insertBefore(s.draw(),r);for(;r;){let s=r.nextSibling;r.remove(),r=s}this.drawn=n,gt.webkit&&(this.dom.style.display=this.dom.firstChild?"":"none")}}destroy(){this.layer.destroy&&this.layer.destroy(this.dom,this.view),this.dom.remove()}}const Lx=pt.define();function aq(e){return[Cr.define(n=>new O1e(n,e)),Lx.of(e)]}const Zf=pt.define({combine(e){return oo(e,{cursorBlinkRate:1200,drawRangeCursor:!0,iosSelectionHandles:!0},{cursorBlinkRate:(n,r)=>Math.min(n,r),drawRangeCursor:(n,r)=>n||r})}});function D1e(e={}){return[Zf.of(e),P1e,L1e,I1e,RW.of(!0)]}function oq(e){return e.startState.facet(Zf)!=e.state.facet(Zf)}const P1e=aq({above:!0,markers(e){let{state:n}=e,r=n.facet(Zf),i=[];for(let s of n.selection.ranges){let a=s==n.selection.main;if(s.empty||r.drawRangeCursor&&!(a&&gt.ios&&r.iosSelectionHandles)){let o=a?"cm-cursor cm-cursor-primary":"cm-cursor cm-cursor-secondary",l=s.empty?s:Be.cursor(s.head,s.assoc);for(let u of jd.forRange(e,o,l))i.push(u)}}return i},update(e,n){e.transactions.some(i=>i.selection)&&(n.style.animationName=n.style.animationName=="cm-blink"?"cm-blink2":"cm-blink");let r=oq(e);return r&&WL(e.state,n),e.docChanged||e.selectionSet||r},mount(e,n){WL(n.state,e)},class:"cm-cursorLayer"});function WL(e,n){n.style.animationDuration=e.facet(Zf).cursorBlinkRate+"ms"}const L1e=aq({above:!1,markers(e){let n=[],{main:r,ranges:i}=e.state.selection;for(let s of i)if(!s.empty)for(let a of jd.forRange(e,"cm-selectionBackground",s))n.push(a);if(gt.ios&&!r.empty&&e.state.facet(Zf).iosSelectionHandles){for(let s of jd.forRange(e,"cm-selectionHandle cm-selectionHandle-start",Be.cursor(r.from,1)))n.push(s);for(let s of jd.forRange(e,"cm-selectionHandle cm-selectionHandle-end",Be.cursor(r.to,1)))n.push(s)}return n},update(e,n){return e.docChanged||e.selectionSet||e.viewportChanged||oq(e)},class:"cm-selectionLayer"}),I1e=Kd.highest(ct.theme({".cm-line":{"& ::selection, &::selection":{backgroundColor:"transparent !important"},caretColor:"transparent !important"},".cm-content":{caretColor:"transparent !important","& :focus":{caretColor:"initial !important","&::selection, & ::selection":{backgroundColor:"Highlight !important"}}}})),lq=Gt.define({map(e,n){return e==null?null:n.mapPos(e)}}),Xm=_i.define({create(){return null},update(e,n){return e!=null&&(e=n.changes.mapPos(e)),n.effects.reduce((r,i)=>i.is(lq)?i.value:r,e)}}),B1e=Cr.fromClass(class{constructor(e){this.view=e,this.cursor=null,this.measureReq={read:this.readPos.bind(this),write:this.drawCursor.bind(this)}}update(e){var n;let r=e.state.field(Xm);r==null?this.cursor!=null&&((n=this.cursor)===null||n===void 0||n.remove(),this.cursor=null):(this.cursor||(this.cursor=this.view.scrollDOM.appendChild(document.createElement("div")),this.cursor.className="cm-dropCursor"),(e.startState.field(Xm)!=r||e.docChanged||e.geometryChanged)&&this.view.requestMeasure(this.measureReq))}readPos(){let{view:e}=this,n=e.state.field(Xm),r=n!=null&&e.coordsAtPos(n);if(!r)return null;let i=e.scrollDOM.getBoundingClientRect();return{left:r.left-i.left+e.scrollDOM.scrollLeft*e.scaleX,top:r.top-i.top+e.scrollDOM.scrollTop*e.scaleY,height:r.bottom-r.top}}drawCursor(e){if(this.cursor){let{scaleX:n,scaleY:r}=this.view;e?(this.cursor.style.left=e.left/n+"px",this.cursor.style.top=e.top/r+"px",this.cursor.style.height=e.height/r+"px"):this.cursor.style.left="-100000px"}}destroy(){this.cursor&&this.cursor.remove()}setDropPos(e){this.view.state.field(Xm)!=e&&this.view.dispatch({effects:lq.of(e)})}},{eventObservers:{dragover(e){this.setDropPos(this.view.posAtCoords({x:e.clientX,y:e.clientY}))},dragleave(e){(e.target==this.view.contentDOM||!this.view.contentDOM.contains(e.relatedTarget))&&this.setDropPos(null)},dragend(){this.setDropPos(null)},drop(){this.setDropPos(null)}}});function z1e(){return[Xm,B1e]}function qL(e,n,r,i,s){n.lastIndex=0;for(let a=e.iterRange(r,i),o=r,l;!a.next().done;o+=a.value.length)if(!a.lineBreak)for(;l=n.exec(a.value);)s(o+l.index,l)}function $1e(e,n){let r=e.visibleRanges;if(r.length==1&&r[0].from==e.viewport.from&&r[0].to==e.viewport.to)return r;let i=[];for(let{from:s,to:a}of r)s=Math.max(e.state.doc.lineAt(s).from,s-n),a=Math.min(e.state.doc.lineAt(a).to,a+n),i.length&&i[i.length-1].to>=s?i[i.length-1].to=a:i.push({from:s,to:a});return i}class F1e{constructor(n){const{regexp:r,decoration:i,decorate:s,boundary:a,maxLength:o=1e3}=n;if(!r.global)throw new RangeError("The regular expression given to MatchDecorator should have its 'g' flag set");if(this.regexp=r,s)this.addMatch=(l,u,d,p)=>s(p,d,d+l[0].length,l,u);else if(typeof i=="function")this.addMatch=(l,u,d,p)=>{let f=i(l,u,d);f&&p(d,d+l[0].length,f)};else if(i)this.addMatch=(l,u,d,p)=>p(d,d+l[0].length,i);else throw new RangeError("Either 'decorate' or 'decoration' should be provided to MatchDecorator");this.boundary=a,this.maxLength=o}createDeco(n){let r=new ec,i=r.add.bind(r);for(let{from:s,to:a}of $1e(n,this.maxLength))qL(n.state.doc,this.regexp,s,a,(o,l)=>this.addMatch(l,n,o,i));return r.finish()}updateDeco(n,r){let i=1e9,s=-1;return n.docChanged&&n.changes.iterChanges((a,o,l,u)=>{u>=n.view.viewport.from&&l<=n.view.viewport.to&&(i=Math.min(l,i),s=Math.max(u,s))}),n.viewportMoved||s-i>1e3?this.createDeco(n.view):s>-1?this.updateRange(n.view,r.map(n.changes),i,s):r}updateRange(n,r,i,s){for(let a of n.visibleRanges){let o=Math.max(a.from,i),l=Math.min(a.to,s);if(l>=o){let u=n.state.doc.lineAt(o),d=u.to<l?n.state.doc.lineAt(l):u,p=Math.max(a.from,u.from),f=Math.min(a.to,d.to);if(this.boundary){for(;o>u.from;o--)if(this.boundary.test(u.text[o-1-u.from])){p=o;break}for(;l<d.to;l++)if(this.boundary.test(d.text[l-d.from])){f=l;break}}let g=[],_,x=(v,S,w)=>g.push(w.range(v,S));if(u==d)for(this.regexp.lastIndex=p-u.from;(_=this.regexp.exec(u.text))&&_.index<f-u.from;)this.addMatch(_,n,_.index+u.from,x);else qL(n.state.doc,this.regexp,p,f,(v,S)=>this.addMatch(S,n,v,x));r=r.update({filterFrom:p,filterTo:f,filter:(v,S)=>v<p||S>f,add:g})}}return r}}const MN=/x/.unicode!=null?"gu":"g",H1e=new RegExp(`[\0-\b
--­؜​‎‏\u2028\u2029‭‮⁦⁧⁩\uFEFF￹-￼]`,MN),W1e={0:"null",7:"bell",8:"backspace",10:"newline",11:"vertical tab",13:"carriage return",27:"escape",8203:"zero width space",8204:"zero width non-joiner",8205:"zero width joiner",8206:"left-to-right mark",8207:"right-to-left mark",8232:"line separator",8237:"left-to-right override",8238:"right-to-left override",8294:"left-to-right isolate",8295:"right-to-left isolate",8297:"pop directional isolate",8233:"paragraph separator",65279:"zero width no-break space",65532:"object replacement"};let GS=null;function q1e(){var e;if(GS==null&&typeof document<"u"&&document.body){let n=document.body.style;GS=((e=n.tabSize)!==null&&e!==void 0?e:n.MozTabSize)!=null}return GS||!1}const Ix=pt.define({combine(e){let n=oo(e,{render:null,specialChars:H1e,addSpecialChars:null});return(n.replaceTabs=!q1e())&&(n.specialChars=new RegExp("	|"+n.specialChars.source,MN)),n.addSpecialChars&&(n.specialChars=new RegExp(n.specialChars.source+"|"+n.addSpecialChars.source,MN)),n}});function U1e(e={}){return[Ix.of(e),K1e()]}let UL=null;function K1e(){return UL||(UL=Cr.fromClass(class{constructor(e){this.view=e,this.decorations=Pt.none,this.decorationCache=Object.create(null),this.decorator=this.makeDecorator(e.state.facet(Ix)),this.decorations=this.decorator.createDeco(e)}makeDecorator(e){return new F1e({regexp:e.specialChars,decoration:(n,r,i)=>{let{doc:s}=r.state,a=ks(n[0],0);if(a==9){let o=s.lineAt(i),l=r.state.tabSize,u=fp(o.text,l,i-o.from);return Pt.replace({widget:new X1e((l-u%l)*this.view.defaultCharacterWidth/this.view.scaleX)})}return this.decorationCache[a]||(this.decorationCache[a]=Pt.replace({widget:new G1e(e,a)}))},boundary:e.replaceTabs?void 0:/[^]/})}update(e){let n=e.state.facet(Ix);e.startState.facet(Ix)!=n?(this.decorator=this.makeDecorator(n),this.decorations=this.decorator.createDeco(e.view)):this.decorations=this.decorator.updateDeco(e,this.decorations)}},{decorations:e=>e.decorations}))}const V1e="•";function Y1e(e){return e>=32?V1e:e==10?"␤":String.fromCharCode(9216+e)}class G1e extends ol{constructor(n,r){super(),this.options=n,this.code=r}eq(n){return n.code==this.code}toDOM(n){let r=Y1e(this.code),i=n.state.phrase("Control character")+" "+(W1e[this.code]||"0x"+this.code.toString(16)),s=this.options.render&&this.options.render(this.code,i,r);if(s)return s;let a=document.createElement("span");return a.textContent=r,a.title=i,a.setAttribute("aria-label",i),a.className="cm-specialChar",a}ignoreEvent(){return!1}}class X1e extends ol{constructor(n){super(),this.width=n}eq(n){return n.width==this.width}toDOM(){let n=document.createElement("span");return n.textContent="	",n.className="cm-tab",n.style.width=this.width+"px",n}ignoreEvent(){return!1}}function Q1e(){return J1e}const Z1e=Pt.line({class:"cm-activeLine"}),J1e=Cr.fromClass(class{constructor(e){this.decorations=this.getDeco(e)}update(e){(e.docChanged||e.selectionSet)&&(this.decorations=this.getDeco(e.view))}getDeco(e){let n=-1,r=[];for(let i of e.state.selection.ranges){let s=e.lineBlockAt(i.head);s.from>n&&(r.push(Z1e.range(s.from)),n=s.from)}return Pt.set(r)}},{decorations:e=>e.decorations});class ewe extends ol{constructor(n){super(),this.content=n}toDOM(n){let r=document.createElement("span");return r.className="cm-placeholder",r.style.pointerEvents="none",r.appendChild(typeof this.content=="string"?document.createTextNode(this.content):typeof this.content=="function"?this.content(n):this.content.cloneNode(!0)),r.setAttribute("aria-hidden","true"),r}coordsAt(n){let r=n.firstChild?vg(n.firstChild):[];if(!r.length)return null;let i=window.getComputedStyle(n.parentNode),s=ev(r[0],i.direction!="rtl"),a=parseInt(i.lineHeight);return s.bottom-s.top>a*1.5?{left:s.left,right:s.right,top:s.top,bottom:s.top+a}:s}ignoreEvent(){return!1}}function twe(e){let n=Cr.fromClass(class{constructor(r){this.view=r,this.placeholder=e?Pt.set([Pt.widget({widget:new ewe(e),side:1}).range(0)]):Pt.none}get decorations(){return this.view.state.doc.length?Pt.none:this.placeholder}},{decorations:r=>r.decorations});return typeof e=="string"?[n,ct.contentAttributes.of({"aria-placeholder":e})]:n}const RN=2e3;function nwe(e,n,r){let i=Math.min(n.line,r.line),s=Math.max(n.line,r.line),a=[];if(n.off>RN||r.off>RN||n.col<0||r.col<0){let o=Math.min(n.off,r.off),l=Math.max(n.off,r.off);for(let u=i;u<=s;u++){let d=e.doc.line(u);d.length<=l&&a.push(Be.range(d.from+o,d.to+l))}}else{let o=Math.min(n.col,r.col),l=Math.max(n.col,r.col);for(let u=i;u<=s;u++){let d=e.doc.line(u),p=dN(d.text,o,e.tabSize,!0);if(p<0)a.push(Be.cursor(d.to));else{let f=dN(d.text,l,e.tabSize);a.push(Be.range(d.from+p,d.from+f))}}}return a}function rwe(e,n){let r=e.coordsAtPos(e.viewport.from);return r?Math.round(Math.abs((r.left-n)/e.defaultCharacterWidth)):-1}function KL(e,n){let r=e.posAtCoords({x:n.clientX,y:n.clientY},!1),i=e.state.doc.lineAt(r),s=r-i.from,a=s>RN?-1:s==i.length?rwe(e,n.clientX):fp(i.text,e.state.tabSize,r-i.from);return{line:i.number,col:a,off:s}}function iwe(e,n){let r=KL(e,n),i=e.state.selection;return r?{update(s){if(s.docChanged){let a=s.changes.mapPos(s.startState.doc.line(r.line).from),o=s.state.doc.lineAt(a);r={line:o.number,col:r.col,off:Math.min(r.off,o.length)},i=i.map(s.changes)}},get(s,a,o){let l=KL(e,s);if(!l)return i;let u=nwe(e.state,r,l);return u.length?o?Be.create(u.concat(i.ranges)):Be.create(u):i}}:null}function swe(e){let n=(r=>r.altKey&&r.button==0);return ct.mouseSelectionStyle.of((r,i)=>n(i)?iwe(r,i):null)}const awe={Alt:[18,e=>!!e.altKey],Control:[17,e=>!!e.ctrlKey],Shift:[16,e=>!!e.shiftKey],Meta:[91,e=>!!e.metaKey]},owe={style:"cursor: crosshair"};function lwe(e={}){let[n,r]=awe[e.key||"Alt"],i=Cr.fromClass(class{constructor(s){this.view=s,this.isDown=!1}set(s){this.isDown!=s&&(this.isDown=s,this.view.update([]))}},{eventObservers:{keydown(s){this.set(s.keyCode==n||r(s))},keyup(s){(s.keyCode==n||!r(s))&&this.set(!1)},mousemove(s){this.set(r(s))}}});return[i,ct.contentAttributes.of(s=>{var a;return!((a=s.plugin(i))===null||a===void 0)&&a.isDown?owe:null})]}const z_="-10000px";class cq{constructor(n,r,i,s){this.facet=r,this.createTooltipView=i,this.removeTooltipView=s,this.input=n.state.facet(r),this.tooltips=this.input.filter(o=>o);let a=null;this.tooltipViews=this.tooltips.map(o=>a=i(o,a))}update(n,r){var i;let s=n.state.facet(this.facet),a=s.filter(u=>u);if(s===this.input){for(let u of this.tooltipViews)u.update&&u.update(n);return!1}let o=[],l=r?[]:null;for(let u=0;u<a.length;u++){let d=a[u],p=-1;if(d){for(let f=0;f<this.tooltips.length;f++){let g=this.tooltips[f];g&&g.create==d.create&&(p=f)}if(p<0)o[u]=this.createTooltipView(d,u?o[u-1]:null),l&&(l[u]=!!d.above);else{let f=o[u]=this.tooltipViews[p];l&&(l[u]=r[p]),f.update&&f.update(n)}}}for(let u of this.tooltipViews)o.indexOf(u)<0&&(this.removeTooltipView(u),(i=u.destroy)===null||i===void 0||i.call(u));return r&&(l.forEach((u,d)=>r[d]=u),r.length=l.length),this.input=s,this.tooltips=a,this.tooltipViews=o,!0}}function cwe(e){let n=e.dom.ownerDocument.documentElement;return{top:0,left:0,bottom:n.clientHeight,right:n.clientWidth}}const XS=pt.define({combine:e=>{var n,r,i;return{position:gt.ios?"absolute":((n=e.find(s=>s.position))===null||n===void 0?void 0:n.position)||"fixed",parent:((r=e.find(s=>s.parent))===null||r===void 0?void 0:r.parent)||null,tooltipSpace:((i=e.find(s=>s.tooltipSpace))===null||i===void 0?void 0:i.tooltipSpace)||cwe}}}),VL=new WeakMap,wT=Cr.fromClass(class{constructor(e){this.view=e,this.above=[],this.inView=!0,this.madeAbsolute=!1,this.lastTransaction=0,this.measureTimeout=-1;let n=e.state.facet(XS);this.position=n.position,this.parent=n.parent,this.classes=e.themeClasses,this.createContainer(),this.measureReq={read:this.readMeasure.bind(this),write:this.writeMeasure.bind(this),key:this},this.resizeObserver=typeof ResizeObserver=="function"?new ResizeObserver(()=>this.measureSoon()):null,this.manager=new cq(e,sk,(r,i)=>this.createTooltip(r,i),r=>{this.resizeObserver&&this.resizeObserver.unobserve(r.dom),r.dom.remove()}),this.above=this.manager.tooltips.map(r=>!!r.above),this.intersectionObserver=typeof IntersectionObserver=="function"?new IntersectionObserver(r=>{Date.now()>this.lastTransaction-50&&r.length>0&&r[r.length-1].intersectionRatio<1&&this.measureSoon()},{threshold:[1]}):null,this.observeIntersection(),e.win.addEventListener("resize",this.measureSoon=this.measureSoon.bind(this)),this.maybeMeasure()}createContainer(){this.parent?(this.container=document.createElement("div"),this.container.style.position="relative",this.container.className=this.view.themeClasses,this.parent.appendChild(this.container)):this.container=this.view.dom}observeIntersection(){if(this.intersectionObserver){this.intersectionObserver.disconnect();for(let e of this.manager.tooltipViews)this.intersectionObserver.observe(e.dom)}}measureSoon(){this.measureTimeout<0&&(this.measureTimeout=setTimeout(()=>{this.measureTimeout=-1,this.maybeMeasure()},50))}update(e){e.transactions.length&&(this.lastTransaction=Date.now());let n=this.manager.update(e,this.above);n&&this.observeIntersection();let r=n||e.geometryChanged,i=e.state.facet(XS);if(i.position!=this.position&&!this.madeAbsolute){this.position=i.position;for(let s of this.manager.tooltipViews)s.dom.style.position=this.position;r=!0}if(i.parent!=this.parent){this.parent&&this.container.remove(),this.parent=i.parent,this.createContainer();for(let s of this.manager.tooltipViews)this.container.appendChild(s.dom);r=!0}else this.parent&&this.view.themeClasses!=this.classes&&(this.classes=this.container.className=this.view.themeClasses);r&&this.maybeMeasure()}createTooltip(e,n){let r=e.create(this.view),i=n?n.dom:null;if(r.dom.classList.add("cm-tooltip"),e.arrow&&!r.dom.querySelector(".cm-tooltip > .cm-tooltip-arrow")){let s=document.createElement("div");s.className="cm-tooltip-arrow",r.dom.appendChild(s)}return r.dom.style.position=this.position,r.dom.style.top=z_,r.dom.style.left="0px",this.container.insertBefore(r.dom,i),r.mount&&r.mount(this.view),this.resizeObserver&&this.resizeObserver.observe(r.dom),r}destroy(){var e,n,r;this.view.win.removeEventListener("resize",this.measureSoon);for(let i of this.manager.tooltipViews)i.dom.remove(),(e=i.destroy)===null||e===void 0||e.call(i);this.parent&&this.container.remove(),(n=this.resizeObserver)===null||n===void 0||n.disconnect(),(r=this.intersectionObserver)===null||r===void 0||r.disconnect(),clearTimeout(this.measureTimeout)}readMeasure(){let e=1,n=1,r=!1;if(this.position=="fixed"&&this.manager.tooltipViews.length){let{dom:a}=this.manager.tooltipViews[0];if(gt.safari){let o=a.getBoundingClientRect();r=Math.abs(o.top+1e4)>1||Math.abs(o.left)>1}else r=!!a.offsetParent&&a.offsetParent!=this.container.ownerDocument.body}if(r||this.position=="absolute")if(this.parent){let a=this.parent.getBoundingClientRect();a.width&&a.height&&(e=a.width/this.parent.offsetWidth,n=a.height/this.parent.offsetHeight)}else({scaleX:e,scaleY:n}=this.view.viewState);let i=this.view.scrollDOM.getBoundingClientRect(),s=_T(this.view);return{visible:{left:i.left+s.left,top:i.top+s.top,right:i.right-s.right,bottom:i.bottom-s.bottom},parent:this.parent?this.container.getBoundingClientRect():this.view.dom.getBoundingClientRect(),pos:this.manager.tooltips.map((a,o)=>{let l=this.manager.tooltipViews[o];return l.getCoords?l.getCoords(a.pos):this.view.coordsAtPos(a.pos)}),size:this.manager.tooltipViews.map(({dom:a})=>a.getBoundingClientRect()),space:this.view.state.facet(XS).tooltipSpace(this.view),scaleX:e,scaleY:n,makeAbsolute:r}}writeMeasure(e){var n;if(e.makeAbsolute){this.madeAbsolute=!0,this.position="absolute";for(let l of this.manager.tooltipViews)l.dom.style.position="absolute"}let{visible:r,space:i,scaleX:s,scaleY:a}=e,o=[];for(let l=0;l<this.manager.tooltips.length;l++){let u=this.manager.tooltips[l],d=this.manager.tooltipViews[l],{dom:p}=d,f=e.pos[l],g=e.size[l];if(!f||u.clip!==!1&&(f.bottom<=Math.max(r.top,i.top)||f.top>=Math.min(r.bottom,i.bottom)||f.right<Math.max(r.left,i.left)-.1||f.left>Math.min(r.right,i.right)+.1)){p.style.top=z_;continue}let _=u.arrow?d.dom.querySelector(".cm-tooltip-arrow"):null,x=_?7:0,v=g.right-g.left,S=(n=VL.get(d))!==null&&n!==void 0?n:g.bottom-g.top,w=d.offset||dwe,j=this.view.textDirection==Jn.LTR,C=g.width>i.right-i.left?j?i.left:i.right-g.width:j?Math.max(i.left,Math.min(f.left-(_?14:0)+w.x,i.right-v)):Math.min(Math.max(i.left,f.left-v+(_?14:0)-w.x),i.right-v),T=this.above[l];!u.strictSide&&(T?f.top-S-x-w.y<i.top:f.bottom+S+x+w.y>i.bottom)&&T==i.bottom-f.bottom>f.top-i.top&&(T=this.above[l]=!T);let E=(T?f.top-i.top:i.bottom-f.bottom)-x;if(E<S&&d.resize!==!1){if(E<this.view.defaultLineHeight){p.style.top=z_;continue}VL.set(d,S),p.style.height=(S=E)/a+"px"}else p.style.height&&(p.style.height="");let A=T?f.top-S-x-w.y:f.bottom+x+w.y,O=C+v;if(d.overlap!==!0)for(let F of o)F.left<O&&F.right>C&&F.top<A+S&&F.bottom>A&&(A=T?F.top-S-2-x:F.bottom+x+2);if(this.position=="absolute"?(p.style.top=(A-e.parent.top)/a+"px",YL(p,(C-e.parent.left)/s)):(p.style.top=A/a+"px",YL(p,C/s)),_){let F=f.left+(j?w.x:-w.x)-(C+14-7);_.style.left=F/s+"px"}d.overlap!==!0&&o.push({left:C,top:A,right:O,bottom:A+S}),p.classList.toggle("cm-tooltip-above",T),p.classList.toggle("cm-tooltip-below",!T),d.positioned&&d.positioned(e.space)}}maybeMeasure(){if(this.manager.tooltips.length&&(this.view.inView&&this.view.requestMeasure(this.measureReq),this.inView!=this.view.inView&&(this.inView=this.view.inView,!this.inView)))for(let e of this.manager.tooltipViews)e.dom.style.top=z_}},{eventObservers:{scroll(){this.maybeMeasure()}}});function YL(e,n){let r=parseInt(e.style.left,10);(isNaN(r)||Math.abs(n-r)>1)&&(e.style.left=n+"px")}const uwe=ct.baseTheme({".cm-tooltip":{zIndex:500,boxSizing:"border-box"},"&light .cm-tooltip":{border:"1px solid #bbb",backgroundColor:"#f5f5f5"},"&light .cm-tooltip-section:not(:first-child)":{borderTop:"1px solid #bbb"},"&dark .cm-tooltip":{backgroundColor:"#333338",color:"white"},".cm-tooltip-arrow":{height:"7px",width:"14px",position:"absolute",zIndex:-1,overflow:"hidden","&:before, &:after":{content:"''",position:"absolute",width:0,height:0,borderLeft:"7px solid transparent",borderRight:"7px solid transparent"},".cm-tooltip-above &":{bottom:"-7px","&:before":{borderTop:"7px solid #bbb"},"&:after":{borderTop:"7px solid #f5f5f5",bottom:"1px"}},".cm-tooltip-below &":{top:"-7px","&:before":{borderBottom:"7px solid #bbb"},"&:after":{borderBottom:"7px solid #f5f5f5",top:"1px"}}},"&dark .cm-tooltip .cm-tooltip-arrow":{"&:before":{borderTopColor:"#333338",borderBottomColor:"#333338"},"&:after":{borderTopColor:"transparent",borderBottomColor:"transparent"}}}),dwe={x:0,y:0},sk=pt.define({enables:[wT,uwe]}),Fb=pt.define({combine:e=>e.reduce((n,r)=>n.concat(r),[])});class ak{static create(n){return new ak(n)}constructor(n){this.view=n,this.mounted=!1,this.dom=document.createElement("div"),this.dom.classList.add("cm-tooltip-hover"),this.manager=new cq(n,Fb,(r,i)=>this.createHostedView(r,i),r=>r.dom.remove())}createHostedView(n,r){let i=n.create(this.view);return i.dom.classList.add("cm-tooltip-section"),this.dom.insertBefore(i.dom,r?r.dom.nextSibling:this.dom.firstChild),this.mounted&&i.mount&&i.mount(this.view),i}mount(n){for(let r of this.manager.tooltipViews)r.mount&&r.mount(n);this.mounted=!0}positioned(n){for(let r of this.manager.tooltipViews)r.positioned&&r.positioned(n)}update(n){this.manager.update(n)}destroy(){var n;for(let r of this.manager.tooltipViews)(n=r.destroy)===null||n===void 0||n.call(r)}passProp(n){let r;for(let i of this.manager.tooltipViews){let s=i[n];if(s!==void 0){if(r===void 0)r=s;else if(r!==s)return}}return r}get offset(){return this.passProp("offset")}get getCoords(){return this.passProp("getCoords")}get overlap(){return this.passProp("overlap")}get resize(){return this.passProp("resize")}}const hwe=sk.compute([Fb],e=>{let n=e.facet(Fb);return n.length===0?null:{pos:Math.min(...n.map(r=>r.pos)),end:Math.max(...n.map(r=>{var i;return(i=r.end)!==null&&i!==void 0?i:r.pos})),create:ak.create,above:n[0].above,arrow:n.some(r=>r.arrow)}});class fwe{constructor(n,r,i,s,a){this.view=n,this.source=r,this.field=i,this.setHover=s,this.hoverTime=a,this.hoverTimeout=-1,this.restartTimeout=-1,this.pending=null,this.lastMove={x:0,y:0,target:n.dom,time:0},this.checkHover=this.checkHover.bind(this),n.dom.addEventListener("mouseleave",this.mouseleave=this.mouseleave.bind(this)),n.dom.addEventListener("mousemove",this.mousemove=this.mousemove.bind(this))}update(){this.pending&&(this.pending=null,clearTimeout(this.restartTimeout),this.restartTimeout=setTimeout(()=>this.startHover(),20))}get active(){return this.view.state.field(this.field)}checkHover(){if(this.hoverTimeout=-1,this.active.length)return;let n=Date.now()-this.lastMove.time;n<this.hoverTime?this.hoverTimeout=setTimeout(this.checkHover,this.hoverTime-n):this.startHover()}startHover(){clearTimeout(this.restartTimeout);let{view:n,lastMove:r}=this,i=n.docView.tile.nearest(r.target);if(!i)return;let s,a=1;if(i.isWidget())s=i.posAtStart;else{if(s=n.posAtCoords(r),s==null)return;let l=n.coordsAtPos(s);if(!l||r.y<l.top||r.y>l.bottom||r.x<l.left-n.defaultCharacterWidth||r.x>l.right+n.defaultCharacterWidth)return;let u=n.bidiSpans(n.state.doc.lineAt(s)).find(p=>p.from<=s&&p.to>=s),d=u&&u.dir==Jn.RTL?-1:1;a=r.x<l.left?-d:d}let o=this.source(n,s,a);if(o!=null&&o.then){let l=this.pending={pos:s};o.then(u=>{this.pending==l&&(this.pending=null,u&&!(Array.isArray(u)&&!u.length)&&n.dispatch({effects:this.setHover.of(Array.isArray(u)?u:[u])}))},u=>ss(n.state,u,"hover tooltip"))}else o&&!(Array.isArray(o)&&!o.length)&&n.dispatch({effects:this.setHover.of(Array.isArray(o)?o:[o])})}get tooltip(){let n=this.view.plugin(wT),r=n?n.manager.tooltips.findIndex(i=>i.create==ak.create):-1;return r>-1?n.manager.tooltipViews[r]:null}mousemove(n){var r,i;this.lastMove={x:n.clientX,y:n.clientY,target:n.target,time:Date.now()},this.hoverTimeout<0&&(this.hoverTimeout=setTimeout(this.checkHover,this.hoverTime));let{active:s,tooltip:a}=this;if(s.length&&a&&!pwe(a.dom,n)||this.pending){let{pos:o}=s[0]||this.pending,l=(i=(r=s[0])===null||r===void 0?void 0:r.end)!==null&&i!==void 0?i:o;(o==l?this.view.posAtCoords(this.lastMove)!=o:!mwe(this.view,o,l,n.clientX,n.clientY))&&(this.view.dispatch({effects:this.setHover.of([])}),this.pending=null)}}mouseleave(n){clearTimeout(this.hoverTimeout),this.hoverTimeout=-1;let{active:r}=this;if(r.length){let{tooltip:i}=this;i&&i.dom.contains(n.relatedTarget)?this.watchTooltipLeave(i.dom):this.view.dispatch({effects:this.setHover.of([])})}}watchTooltipLeave(n){let r=i=>{n.removeEventListener("mouseleave",r),this.active.length&&!this.view.dom.contains(i.relatedTarget)&&this.view.dispatch({effects:this.setHover.of([])})};n.addEventListener("mouseleave",r)}destroy(){clearTimeout(this.hoverTimeout),clearTimeout(this.restartTimeout),this.view.dom.removeEventListener("mouseleave",this.mouseleave),this.view.dom.removeEventListener("mousemove",this.mousemove)}}const $_=4;function pwe(e,n){let{left:r,right:i,top:s,bottom:a}=e.getBoundingClientRect(),o;if(o=e.querySelector(".cm-tooltip-arrow")){let l=o.getBoundingClientRect();s=Math.min(l.top,s),a=Math.max(l.bottom,a)}return n.clientX>=r-$_&&n.clientX<=i+$_&&n.clientY>=s-$_&&n.clientY<=a+$_}function mwe(e,n,r,i,s,a){let o=e.scrollDOM.getBoundingClientRect(),l=e.documentTop+e.documentPadding.top+e.contentHeight;if(o.left>i||o.right<i||o.top>s||Math.min(o.bottom,l)<s)return!1;let u=e.posAtCoords({x:i,y:s},!1);return u>=n&&u<=r}function gwe(e,n={}){let r=Gt.define(),i=_i.define({create(){return[]},update(s,a){if(s.length&&(n.hideOnChange&&(a.docChanged||a.selection)?s=[]:n.hideOn&&(s=s.filter(o=>!n.hideOn(a,o))),a.docChanged)){let o=[];for(let l of s){let u=a.changes.mapPos(l.pos,-1,rs.TrackDel);if(u!=null){let d=Object.assign(Object.create(null),l);d.pos=u,d.end!=null&&(d.end=a.changes.mapPos(d.end)),o.push(d)}}s=o}for(let o of a.effects)o.is(r)&&(s=o.value),o.is(vwe)&&(s=[]);return s},provide:s=>Fb.from(s)});return{active:i,extension:[i,Cr.define(s=>new fwe(s,e,i,r,n.hoverTime||300)),hwe]}}function uq(e,n){let r=e.plugin(wT);if(!r)return null;let i=r.manager.tooltips.indexOf(n);return i<0?null:r.manager.tooltipViews[i]}const vwe=Gt.define(),GL=pt.define({combine(e){let n,r;for(let i of e)n=n||i.topContainer,r=r||i.bottomContainer;return{topContainer:n,bottomContainer:r}}});function ST(e,n){let r=e.plugin(dq),i=r?r.specs.indexOf(n):-1;return i>-1?r.panels[i]:null}const dq=Cr.fromClass(class{constructor(e){this.input=e.state.facet(nv),this.specs=this.input.filter(r=>r),this.panels=this.specs.map(r=>r(e));let n=e.state.facet(GL);this.top=new F_(e,!0,n.topContainer),this.bottom=new F_(e,!1,n.bottomContainer),this.top.sync(this.panels.filter(r=>r.top)),this.bottom.sync(this.panels.filter(r=>!r.top));for(let r of this.panels)r.dom.classList.add("cm-panel"),r.mount&&r.mount()}update(e){let n=e.state.facet(GL);this.top.container!=n.topContainer&&(this.top.sync([]),this.top=new F_(e.view,!0,n.topContainer)),this.bottom.container!=n.bottomContainer&&(this.bottom.sync([]),this.bottom=new F_(e.view,!1,n.bottomContainer)),this.top.syncClasses(),this.bottom.syncClasses();let r=e.state.facet(nv);if(r!=this.input){let i=r.filter(u=>u),s=[],a=[],o=[],l=[];for(let u of i){let d=this.specs.indexOf(u),p;d<0?(p=u(e.view),l.push(p)):(p=this.panels[d],p.update&&p.update(e)),s.push(p),(p.top?a:o).push(p)}this.specs=i,this.panels=s,this.top.sync(a),this.bottom.sync(o);for(let u of l)u.dom.classList.add("cm-panel"),u.mount&&u.mount()}else for(let i of this.panels)i.update&&i.update(e)}destroy(){this.top.sync([]),this.bottom.sync([])}},{provide:e=>ct.scrollMargins.of(n=>{let r=n.plugin(e);return r&&{top:r.top.scrollMargin(),bottom:r.bottom.scrollMargin()}})});class F_{constructor(n,r,i){this.view=n,this.top=r,this.container=i,this.dom=void 0,this.classes="",this.panels=[],this.syncClasses()}sync(n){for(let r of this.panels)r.destroy&&n.indexOf(r)<0&&r.destroy();this.panels=n,this.syncDOM()}syncDOM(){if(this.panels.length==0){this.dom&&(this.dom.remove(),this.dom=void 0);return}if(!this.dom){this.dom=document.createElement("div"),this.dom.className=this.top?"cm-panels cm-panels-top":"cm-panels cm-panels-bottom",this.dom.style[this.top?"top":"bottom"]="0";let r=this.container||this.view.dom;r.insertBefore(this.dom,this.top?r.firstChild:null)}let n=this.dom.firstChild;for(let r of this.panels)if(r.dom.parentNode==this.dom){for(;n!=r.dom;)n=XL(n);n=n.nextSibling}else this.dom.insertBefore(r.dom,n);for(;n;)n=XL(n)}scrollMargin(){return!this.dom||this.container?0:Math.max(0,this.top?this.dom.getBoundingClientRect().bottom-Math.max(0,this.view.scrollDOM.getBoundingClientRect().top):Math.min(innerHeight,this.view.scrollDOM.getBoundingClientRect().bottom)-this.dom.getBoundingClientRect().top)}syncClasses(){if(!(!this.container||this.classes==this.view.themeClasses)){for(let n of this.classes.split(" "))n&&this.container.classList.remove(n);for(let n of(this.classes=this.view.themeClasses).split(" "))n&&this.container.classList.add(n)}}}function XL(e){let n=e.nextSibling;return e.remove(),n}const nv=pt.define({enables:dq});function ywe(e,n){let r,i=new Promise(o=>r=o),s=o=>_we(o,n,r);e.state.field(QS,!1)?e.dispatch({effects:hq.of(s)}):e.dispatch({effects:Gt.appendConfig.of(QS.init(()=>[s]))});let a=fq.of(s);return{close:a,result:i.then(o=>((e.win.queueMicrotask||(u=>e.win.setTimeout(u,10)))(()=>{e.state.field(QS).indexOf(s)>-1&&e.dispatch({effects:a})}),o))}}const QS=_i.define({create(){return[]},update(e,n){for(let r of n.effects)r.is(hq)?e=[r.value].concat(e):r.is(fq)&&(e=e.filter(i=>i!=r.value));return e},provide:e=>nv.computeN([e],n=>n.field(e))}),hq=Gt.define(),fq=Gt.define();function _we(e,n,r){let i=n.content?n.content(e,()=>o(null)):null;if(!i){if(i=Kn("form"),n.input){let l=Kn("input",n.input);/^(text|password|number|email|tel|url)$/.test(l.type)&&l.classList.add("cm-textfield"),l.name||(l.name="input"),i.appendChild(Kn("label",(n.label||"")+": ",l))}else i.appendChild(document.createTextNode(n.label||""));i.appendChild(document.createTextNode(" ")),i.appendChild(Kn("button",{class:"cm-button",type:"submit"},n.submitLabel||"OK"))}let s=i.nodeName=="FORM"?[i]:i.querySelectorAll("form");for(let l=0;l<s.length;l++){let u=s[l];u.addEventListener("keydown",d=>{d.keyCode==27?(d.preventDefault(),o(null)):d.keyCode==13&&(d.preventDefault(),o(u))}),u.addEventListener("submit",d=>{d.preventDefault(),o(u)})}let a=Kn("div",i,Kn("button",{onclick:()=>o(null),"aria-label":e.state.phrase("close"),class:"cm-dialog-close",type:"button"},["×"]));n.class&&(a.className=n.class),a.classList.add("cm-dialog");function o(l){a.contains(a.ownerDocument.activeElement)&&e.focus(),r(l)}return{dom:a,top:n.top,mount:()=>{if(n.focus){let l;typeof n.focus=="string"?l=i.querySelector(n.focus):l=i.querySelector("input")||i.querySelector("button"),l&&"select"in l?l.select():l&&"focus"in l&&l.focus()}}}}class tl extends pu{compare(n){return this==n||this.constructor==n.constructor&&this.eq(n)}eq(n){return!1}destroy(n){}}tl.prototype.elementClass="";tl.prototype.toDOM=void 0;tl.prototype.mapMode=rs.TrackBefore;tl.prototype.startSide=tl.prototype.endSide=-1;tl.prototype.point=!0;const Bx=pt.define(),xwe=pt.define(),bwe={class:"",renderEmptyElements:!1,elementStyle:"",markers:()=>rn.empty,lineMarker:()=>null,widgetMarker:()=>null,lineMarkerChange:null,initialSpacer:null,updateSpacer:null,domEventHandlers:{},side:"before"},xg=pt.define();function pq(e){return[mq(),xg.of({...bwe,...e})]}const QL=pt.define({combine:e=>e.some(n=>n)});function mq(e){return[kwe]}const kwe=Cr.fromClass(class{constructor(e){this.view=e,this.domAfter=null,this.prevViewport=e.viewport,this.dom=document.createElement("div"),this.dom.className="cm-gutters cm-gutters-before",this.dom.setAttribute("aria-hidden","true"),this.dom.style.minHeight=this.view.contentHeight/this.view.scaleY+"px",this.gutters=e.state.facet(xg).map(n=>new JL(e,n)),this.fixed=!e.state.facet(QL);for(let n of this.gutters)n.config.side=="after"?this.getDOMAfter().appendChild(n.dom):this.dom.appendChild(n.dom);this.fixed&&(this.dom.style.position="sticky"),this.syncGutters(!1),e.scrollDOM.insertBefore(this.dom,e.contentDOM)}getDOMAfter(){return this.domAfter||(this.domAfter=document.createElement("div"),this.domAfter.className="cm-gutters cm-gutters-after",this.domAfter.setAttribute("aria-hidden","true"),this.domAfter.style.minHeight=this.view.contentHeight/this.view.scaleY+"px",this.domAfter.style.position=this.fixed?"sticky":"",this.view.scrollDOM.appendChild(this.domAfter)),this.domAfter}update(e){if(this.updateGutters(e)){let n=this.prevViewport,r=e.view.viewport,i=Math.min(n.to,r.to)-Math.max(n.from,r.from);this.syncGutters(i<(r.to-r.from)*.8)}if(e.geometryChanged){let n=this.view.contentHeight/this.view.scaleY+"px";this.dom.style.minHeight=n,this.domAfter&&(this.domAfter.style.minHeight=n)}this.view.state.facet(QL)!=!this.fixed&&(this.fixed=!this.fixed,this.dom.style.position=this.fixed?"sticky":"",this.domAfter&&(this.domAfter.style.position=this.fixed?"sticky":"")),this.prevViewport=e.view.viewport}syncGutters(e){let n=this.dom.nextSibling;e&&(this.dom.remove(),this.domAfter&&this.domAfter.remove());let r=rn.iter(this.view.state.facet(Bx),this.view.viewport.from),i=[],s=this.gutters.map(a=>new wwe(a,this.view.viewport,-this.view.documentPadding.top));for(let a of this.view.viewportLineBlocks)if(i.length&&(i=[]),Array.isArray(a.type)){let o=!0;for(let l of a.type)if(l.type==Ri.Text&&o){ON(r,i,l.from);for(let u of s)u.line(this.view,l,i);o=!1}else if(l.widget)for(let u of s)u.widget(this.view,l)}else if(a.type==Ri.Text){ON(r,i,a.from);for(let o of s)o.line(this.view,a,i)}else if(a.widget)for(let o of s)o.widget(this.view,a);for(let a of s)a.finish();e&&(this.view.scrollDOM.insertBefore(this.dom,n),this.domAfter&&this.view.scrollDOM.appendChild(this.domAfter))}updateGutters(e){let n=e.startState.facet(xg),r=e.state.facet(xg),i=e.docChanged||e.heightChanged||e.viewportChanged||!rn.eq(e.startState.facet(Bx),e.state.facet(Bx),e.view.viewport.from,e.view.viewport.to);if(n==r)for(let s of this.gutters)s.update(e)&&(i=!0);else{i=!0;let s=[];for(let a of r){let o=n.indexOf(a);o<0?s.push(new JL(this.view,a)):(this.gutters[o].update(e),s.push(this.gutters[o]))}for(let a of this.gutters)a.dom.remove(),s.indexOf(a)<0&&a.destroy();for(let a of s)a.config.side=="after"?this.getDOMAfter().appendChild(a.dom):this.dom.appendChild(a.dom);this.gutters=s}return i}destroy(){for(let e of this.gutters)e.destroy();this.dom.remove(),this.domAfter&&this.domAfter.remove()}},{provide:e=>ct.scrollMargins.of(n=>{let r=n.plugin(e);if(!r||r.gutters.length==0||!r.fixed)return null;let i=r.dom.offsetWidth*n.scaleX,s=r.domAfter?r.domAfter.offsetWidth*n.scaleX:0;return n.textDirection==Jn.LTR?{left:i,right:s}:{right:i,left:s}})});function ZL(e){return Array.isArray(e)?e:[e]}function ON(e,n,r){for(;e.value&&e.from<=r;)e.from==r&&n.push(e.value),e.next()}class wwe{constructor(n,r,i){this.gutter=n,this.height=i,this.i=0,this.cursor=rn.iter(n.markers,r.from)}addElement(n,r,i){let{gutter:s}=this,a=(r.top-this.height)/n.scaleY,o=r.height/n.scaleY;if(this.i==s.elements.length){let l=new gq(n,o,a,i);s.elements.push(l),s.dom.appendChild(l.dom)}else s.elements[this.i].update(n,o,a,i);this.height=r.bottom,this.i++}line(n,r,i){let s=[];ON(this.cursor,s,r.from),i.length&&(s=s.concat(i));let a=this.gutter.config.lineMarker(n,r,s);a&&s.unshift(a);let o=this.gutter;s.length==0&&!o.config.renderEmptyElements||this.addElement(n,r,s)}widget(n,r){let i=this.gutter.config.widgetMarker(n,r.widget,r),s=i?[i]:null;for(let a of n.state.facet(xwe)){let o=a(n,r.widget,r);o&&(s||(s=[])).push(o)}s&&this.addElement(n,r,s)}finish(){let n=this.gutter;for(;n.elements.length>this.i;){let r=n.elements.pop();n.dom.removeChild(r.dom),r.destroy()}}}class JL{constructor(n,r){this.view=n,this.config=r,this.elements=[],this.spacer=null,this.dom=document.createElement("div"),this.dom.className="cm-gutter"+(this.config.class?" "+this.config.class:"");for(let i in r.domEventHandlers)this.dom.addEventListener(i,s=>{let a=s.target,o;if(a!=this.dom&&this.dom.contains(a)){for(;a.parentNode!=this.dom;)a=a.parentNode;let u=a.getBoundingClientRect();o=(u.top+u.bottom)/2}else o=s.clientY;let l=n.lineBlockAtHeight(o-n.documentTop);r.domEventHandlers[i](n,l,s)&&s.preventDefault()});this.markers=ZL(r.markers(n)),r.initialSpacer&&(this.spacer=new gq(n,0,0,[r.initialSpacer(n)]),this.dom.appendChild(this.spacer.dom),this.spacer.dom.style.cssText+="visibility: hidden; pointer-events: none")}update(n){let r=this.markers;if(this.markers=ZL(this.config.markers(n.view)),this.spacer&&this.config.updateSpacer){let s=this.config.updateSpacer(this.spacer.markers[0],n);s!=this.spacer.markers[0]&&this.spacer.update(n.view,0,0,[s])}let i=n.view.viewport;return!rn.eq(this.markers,r,i.from,i.to)||(this.config.lineMarkerChange?this.config.lineMarkerChange(n):!1)}destroy(){for(let n of this.elements)n.destroy()}}class gq{constructor(n,r,i,s){this.height=-1,this.above=0,this.markers=[],this.dom=document.createElement("div"),this.dom.className="cm-gutterElement",this.update(n,r,i,s)}update(n,r,i,s){this.height!=r&&(this.height=r,this.dom.style.height=r+"px"),this.above!=i&&(this.dom.style.marginTop=(this.above=i)?i+"px":""),Swe(this.markers,s)||this.setMarkers(n,s)}setMarkers(n,r){let i="cm-gutterElement",s=this.dom.firstChild;for(let a=0,o=0;;){let l=o,u=a<r.length?r[a++]:null,d=!1;if(u){let p=u.elementClass;p&&(i+=" "+p);for(let f=o;f<this.markers.length;f++)if(this.markers[f].compare(u)){l=f,d=!0;break}}else l=this.markers.length;for(;o<l;){let p=this.markers[o++];if(p.toDOM){p.destroy(s);let f=s.nextSibling;s.remove(),s=f}}if(!u)break;u.toDOM&&(d?s=s.nextSibling:this.dom.insertBefore(u.toDOM(n),s)),d&&o++}this.dom.className=i,this.markers=r}destroy(){this.setMarkers(null,[])}}function Swe(e,n){if(e.length!=n.length)return!1;for(let r=0;r<e.length;r++)if(!e[r].compare(n[r]))return!1;return!0}const Cwe=pt.define(),jwe=pt.define(),ff=pt.define({combine(e){return oo(e,{formatNumber:String,domEventHandlers:{}},{domEventHandlers(n,r){let i=Object.assign({},n);for(let s in r){let a=i[s],o=r[s];i[s]=a?(l,u,d)=>a(l,u,d)||o(l,u,d):o}return i}})}});class ZS extends tl{constructor(n){super(),this.number=n}eq(n){return this.number==n.number}toDOM(){return document.createTextNode(this.number)}}function JS(e,n){return e.state.facet(ff).formatNumber(n,e.state)}const Nwe=xg.compute([ff],e=>({class:"cm-lineNumbers",renderEmptyElements:!1,markers(n){return n.state.facet(Cwe)},lineMarker(n,r,i){return i.some(s=>s.toDOM)?null:new ZS(JS(n,n.state.doc.lineAt(r.from).number))},widgetMarker:(n,r,i)=>{for(let s of n.state.facet(jwe)){let a=s(n,r,i);if(a)return a}return null},lineMarkerChange:n=>n.startState.facet(ff)!=n.state.facet(ff),initialSpacer(n){return new ZS(JS(n,e6(n.state.doc.lines)))},updateSpacer(n,r){let i=JS(r.view,e6(r.view.state.doc.lines));return i==n.number?n:new ZS(i)},domEventHandlers:e.facet(ff).domEventHandlers,side:"before"}));function Ewe(e={}){return[ff.of(e),mq(),Nwe]}function e6(e){let n=9;for(;n<e;)n=n*10+9;return n}const Awe=new class extends tl{constructor(){super(...arguments),this.elementClass="cm-activeLineGutter"}},Twe=Bx.compute(["selection"],e=>{let n=[],r=-1;for(let i of e.selection.ranges){let s=e.doc.lineAt(i.head).from;s>r&&(r=s,n.push(Awe.range(s)))}return rn.of(n)});function Mwe(){return Twe}const vq=1024;let Rwe=0;class e2{constructor(n,r){this.from=n,this.to=r}}class cn{constructor(n={}){this.id=Rwe++,this.perNode=!!n.perNode,this.deserialize=n.deserialize||(()=>{throw new Error("This node type doesn't define a deserialize function")}),this.combine=n.combine||null}add(n){if(this.perNode)throw new RangeError("Can't add per-node props to node types");return typeof n!="function"&&(n=Os.match(n)),r=>{let i=n(r);return i===void 0?null:[this,i]}}}cn.closedBy=new cn({deserialize:e=>e.split(" ")});cn.openedBy=new cn({deserialize:e=>e.split(" ")});cn.group=new cn({deserialize:e=>e.split(" ")});cn.isolate=new cn({deserialize:e=>{if(e&&e!="rtl"&&e!="ltr"&&e!="auto")throw new RangeError("Invalid value for isolate: "+e);return e||"auto"}});cn.contextHash=new cn({perNode:!0});cn.lookAhead=new cn({perNode:!0});cn.mounted=new cn({perNode:!0});class bg{constructor(n,r,i,s=!1){this.tree=n,this.overlay=r,this.parser=i,this.bracketed=s}static get(n){return n&&n.props&&n.props[cn.mounted.id]}}const Owe=Object.create(null);class Os{constructor(n,r,i,s=0){this.name=n,this.props=r,this.id=i,this.flags=s}static define(n){let r=n.props&&n.props.length?Object.create(null):Owe,i=(n.top?1:0)|(n.skipped?2:0)|(n.error?4:0)|(n.name==null?8:0),s=new Os(n.name||"",r,n.id,i);if(n.props){for(let a of n.props)if(Array.isArray(a)||(a=a(s)),a){if(a[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");r[a[0].id]=a[1]}}return s}prop(n){return this.props[n.id]}get isTop(){return(this.flags&1)>0}get isSkipped(){return(this.flags&2)>0}get isError(){return(this.flags&4)>0}get isAnonymous(){return(this.flags&8)>0}is(n){if(typeof n=="string"){if(this.name==n)return!0;let r=this.prop(cn.group);return r?r.indexOf(n)>-1:!1}return this.id==n}static match(n){let r=Object.create(null);for(let i in n)for(let s of i.split(" "))r[s]=n[i];return i=>{for(let s=i.prop(cn.group),a=-1;a<(s?s.length:0);a++){let o=r[a<0?i.name:s[a]];if(o)return o}}}}Os.none=new Os("",Object.create(null),0,8);class CT{constructor(n){this.types=n;for(let r=0;r<n.length;r++)if(n[r].id!=r)throw new RangeError("Node type ids should correspond to array positions when creating a node set")}extend(...n){let r=[];for(let i of this.types){let s=null;for(let a of n){let o=a(i);if(o){s||(s=Object.assign({},i.props));let l=o[1],u=o[0];u.combine&&u.id in s&&(l=u.combine(s[u.id],l)),s[u.id]=l}}r.push(s?new Os(i.name,s,i.id,i.flags):i)}return new CT(r)}}const H_=new WeakMap,t6=new WeakMap;var Mr;(function(e){e[e.ExcludeBuffers=1]="ExcludeBuffers",e[e.IncludeAnonymous=2]="IncludeAnonymous",e[e.IgnoreMounts=4]="IgnoreMounts",e[e.IgnoreOverlays=8]="IgnoreOverlays",e[e.EnterBracketed=16]="EnterBracketed"})(Mr||(Mr={}));class zr{constructor(n,r,i,s,a){if(this.type=n,this.children=r,this.positions=i,this.length=s,this.props=null,a&&a.length){this.props=Object.create(null);for(let[o,l]of a)this.props[typeof o=="number"?o:o.id]=l}}toString(){let n=bg.get(this);if(n&&!n.overlay)return n.tree.toString();let r="";for(let i of this.children){let s=i.toString();s&&(r&&(r+=","),r+=s)}return this.type.name?(/\W/.test(this.type.name)&&!this.type.isError?JSON.stringify(this.type.name):this.type.name)+(r.length?"("+r+")":""):r}cursor(n=0){return new PN(this.topNode,n)}cursorAt(n,r=0,i=0){let s=H_.get(this)||this.topNode,a=new PN(s);return a.moveTo(n,r),H_.set(this,a._tree),a}get topNode(){return new Ra(this,0,0,null)}resolve(n,r=0){let i=rv(H_.get(this)||this.topNode,n,r,!1);return H_.set(this,i),i}resolveInner(n,r=0){let i=rv(t6.get(this)||this.topNode,n,r,!0);return t6.set(this,i),i}resolveStack(n,r=0){return Lwe(this,n,r)}iterate(n){let{enter:r,leave:i,from:s=0,to:a=this.length}=n,o=n.mode||0,l=(o&Mr.IncludeAnonymous)>0;for(let u=this.cursor(o|Mr.IncludeAnonymous);;){let d=!1;if(u.from<=a&&u.to>=s&&(!l&&u.type.isAnonymous||r(u)!==!1)){if(u.firstChild())continue;d=!0}for(;d&&i&&(l||!u.type.isAnonymous)&&i(u),!u.nextSibling();){if(!u.parent())return;d=!0}}}prop(n){return n.perNode?this.props?this.props[n.id]:void 0:this.type.prop(n)}get propValues(){let n=[];if(this.props)for(let r in this.props)n.push([+r,this.props[r]]);return n}balance(n={}){return this.children.length<=8?this:ET(Os.none,this.children,this.positions,0,this.children.length,0,this.length,(r,i,s)=>new zr(this.type,r,i,s,this.propValues),n.makeTree||((r,i,s)=>new zr(Os.none,r,i,s)))}static build(n){return Iwe(n)}}zr.empty=new zr(Os.none,[],[],0);class jT{constructor(n,r){this.buffer=n,this.index=r}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}get pos(){return this.index}next(){this.index-=4}fork(){return new jT(this.buffer,this.index)}}class yu{constructor(n,r,i){this.buffer=n,this.length=r,this.set=i}get type(){return Os.none}toString(){let n=[];for(let r=0;r<this.buffer.length;)n.push(this.childString(r)),r=this.buffer[r+3];return n.join(",")}childString(n){let r=this.buffer[n],i=this.buffer[n+3],s=this.set.types[r],a=s.name;if(/\W/.test(a)&&!s.isError&&(a=JSON.stringify(a)),n+=4,i==n)return a;let o=[];for(;n<i;)o.push(this.childString(n)),n=this.buffer[n+3];return a+"("+o.join(",")+")"}findChild(n,r,i,s,a){let{buffer:o}=this,l=-1;for(let u=n;u!=r&&!(yq(a,s,o[u+1],o[u+2])&&(l=u,i>0));u=o[u+3]);return l}slice(n,r,i){let s=this.buffer,a=new Uint16Array(r-n),o=0;for(let l=n,u=0;l<r;){a[u++]=s[l++],a[u++]=s[l++]-i;let d=a[u++]=s[l++]-i;a[u++]=s[l++]-n,o=Math.max(o,d)}return new yu(a,o,this.set)}}function yq(e,n,r,i){switch(e){case-2:return r<n;case-1:return i>=n&&r<n;case 0:return r<n&&i>n;case 1:return r<=n&&i>n;case 2:return i>n;case 4:return!0}}function rv(e,n,r,i){for(var s;e.from==e.to||(r<1?e.from>=n:e.from>n)||(r>-1?e.to<=n:e.to<n);){let o=!i&&e instanceof Ra&&e.index<0?null:e.parent;if(!o)return e;e=o}let a=i?0:Mr.IgnoreOverlays;if(i)for(let o=e,l=o.parent;l;o=l,l=o.parent)o instanceof Ra&&o.index<0&&((s=l.enter(n,r,a))===null||s===void 0?void 0:s.from)!=o.from&&(e=l);for(;;){let o=e.enter(n,r,a);if(!o)return e;e=o}}class _q{cursor(n=0){return new PN(this,n)}getChild(n,r=null,i=null){let s=n6(this,n,r,i);return s.length?s[0]:null}getChildren(n,r=null,i=null){return n6(this,n,r,i)}resolve(n,r=0){return rv(this,n,r,!1)}resolveInner(n,r=0){return rv(this,n,r,!0)}matchContext(n){return DN(this.parent,n)}enterUnfinishedNodesBefore(n){let r=this.childBefore(n),i=this;for(;r;){let s=r.lastChild;if(!s||s.to!=r.to)break;s.type.isError&&s.from==s.to?(i=r,r=s.prevSibling):r=s}return i}get node(){return this}get next(){return this.parent}}class Ra extends _q{constructor(n,r,i,s){super(),this._tree=n,this.from=r,this.index=i,this._parent=s}get type(){return this._tree.type}get name(){return this._tree.type.name}get to(){return this.from+this._tree.length}nextChild(n,r,i,s,a=0){for(let o=this;;){for(let{children:l,positions:u}=o._tree,d=r>0?l.length:-1;n!=d;n+=r){let p=l[n],f=u[n]+o.from,g;if(!(!(a&Mr.EnterBracketed&&p instanceof zr&&(g=bg.get(p))&&!g.overlay&&g.bracketed&&i>=f&&i<=f+p.length)&&!yq(s,i,f,f+p.length))){if(p instanceof yu){if(a&Mr.ExcludeBuffers)continue;let _=p.findChild(0,p.buffer.length,r,i-f,s);if(_>-1)return new tu(new Dwe(o,p,n,f),null,_)}else if(a&Mr.IncludeAnonymous||!p.type.isAnonymous||NT(p)){let _;if(!(a&Mr.IgnoreMounts)&&(_=bg.get(p))&&!_.overlay)return new Ra(_.tree,f,n,o);let x=new Ra(p,f,n,o);return a&Mr.IncludeAnonymous||!x.type.isAnonymous?x:x.nextChild(r<0?p.children.length-1:0,r,i,s,a)}}}if(a&Mr.IncludeAnonymous||!o.type.isAnonymous||(o.index>=0?n=o.index+r:n=r<0?-1:o._parent._tree.children.length,o=o._parent,!o))return null}}get firstChild(){return this.nextChild(0,1,0,4)}get lastChild(){return this.nextChild(this._tree.children.length-1,-1,0,4)}childAfter(n){return this.nextChild(0,1,n,2)}childBefore(n){return this.nextChild(this._tree.children.length-1,-1,n,-2)}prop(n){return this._tree.prop(n)}enter(n,r,i=0){let s;if(!(i&Mr.IgnoreOverlays)&&(s=bg.get(this._tree))&&s.overlay){let a=n-this.from,o=i&Mr.EnterBracketed&&s.bracketed;for(let{from:l,to:u}of s.overlay)if((r>0||o?l<=a:l<a)&&(r<0||o?u>=a:u>a))return new Ra(s.tree,s.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,n,r,i)}nextSignificantParent(){let n=this;for(;n.type.isAnonymous&&n._parent;)n=n._parent;return n}get parent(){return this._parent?this._parent.nextSignificantParent():null}get nextSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index+1,1,0,4):null}get prevSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index-1,-1,0,4):null}get tree(){return this._tree}toTree(){return this._tree}toString(){return this._tree.toString()}}function n6(e,n,r,i){let s=e.cursor(),a=[];if(!s.firstChild())return a;if(r!=null){for(let o=!1;!o;)if(o=s.type.is(r),!s.nextSibling())return a}for(;;){if(i!=null&&s.type.is(i))return a;if(s.type.is(n)&&a.push(s.node),!s.nextSibling())return i==null?a:[]}}function DN(e,n,r=n.length-1){for(let i=e;r>=0;i=i.parent){if(!i)return!1;if(!i.type.isAnonymous){if(n[r]&&n[r]!=i.name)return!1;r--}}return!0}class Dwe{constructor(n,r,i,s){this.parent=n,this.buffer=r,this.index=i,this.start=s}}class tu extends _q{get name(){return this.type.name}get from(){return this.context.start+this.context.buffer.buffer[this.index+1]}get to(){return this.context.start+this.context.buffer.buffer[this.index+2]}constructor(n,r,i){super(),this.context=n,this._parent=r,this.index=i,this.type=n.buffer.set.types[n.buffer.buffer[i]]}child(n,r,i){let{buffer:s}=this.context,a=s.findChild(this.index+4,s.buffer[this.index+3],n,r-this.context.start,i);return a<0?null:new tu(this.context,this,a)}get firstChild(){return this.child(1,0,4)}get lastChild(){return this.child(-1,0,4)}childAfter(n){return this.child(1,n,2)}childBefore(n){return this.child(-1,n,-2)}prop(n){return this.type.prop(n)}enter(n,r,i=0){if(i&Mr.ExcludeBuffers)return null;let{buffer:s}=this.context,a=s.findChild(this.index+4,s.buffer[this.index+3],r>0?1:-1,n-this.context.start,r);return a<0?null:new tu(this.context,this,a)}get parent(){return this._parent||this.context.parent.nextSignificantParent()}externalSibling(n){return this._parent?null:this.context.parent.nextChild(this.context.index+n,n,0,4)}get nextSibling(){let{buffer:n}=this.context,r=n.buffer[this.index+3];return r<(this._parent?n.buffer[this._parent.index+3]:n.buffer.length)?new tu(this.context,this._parent,r):this.externalSibling(1)}get prevSibling(){let{buffer:n}=this.context,r=this._parent?this._parent.index+4:0;return this.index==r?this.externalSibling(-1):new tu(this.context,this._parent,n.findChild(r,this.index,-1,0,4))}get tree(){return null}toTree(){let n=[],r=[],{buffer:i}=this.context,s=this.index+4,a=i.buffer[this.index+3];if(a>s){let o=i.buffer[this.index+1];n.push(i.slice(s,a,o)),r.push(0)}return new zr(this.type,n,r,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function xq(e){if(!e.length)return null;let n=0,r=e[0];for(let a=1;a<e.length;a++){let o=e[a];(o.from>r.from||o.to<r.to)&&(r=o,n=a)}let i=r instanceof Ra&&r.index<0?null:r.parent,s=e.slice();return i?s[n]=i:s.splice(n,1),new Pwe(s,r)}class Pwe{constructor(n,r){this.heads=n,this.node=r}get next(){return xq(this.heads)}}function Lwe(e,n,r){let i=e.resolveInner(n,r),s=null;for(let a=i instanceof Ra?i:i.context.parent;a;a=a.parent)if(a.index<0){let o=a.parent;(s||(s=[i])).push(o.resolve(n,r)),a=o}else{let o=bg.get(a.tree);if(o&&o.overlay&&o.overlay[0].from<=n&&o.overlay[o.overlay.length-1].to>=n){let l=new Ra(o.tree,o.overlay[0].from+a.from,-1,a);(s||(s=[i])).push(rv(l,n,r,!1))}}return s?xq(s):i}class PN{get name(){return this.type.name}constructor(n,r=0){if(this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,this.mode=r&~Mr.EnterBracketed,n instanceof Ra)this.yieldNode(n);else{this._tree=n.context.parent,this.buffer=n.context;for(let i=n._parent;i;i=i._parent)this.stack.unshift(i.index);this.bufferNode=n,this.yieldBuf(n.index)}}yieldNode(n){return n?(this._tree=n,this.type=n.type,this.from=n.from,this.to=n.to,!0):!1}yieldBuf(n,r){this.index=n;let{start:i,buffer:s}=this.buffer;return this.type=r||s.set.types[s.buffer[n]],this.from=i+s.buffer[n+1],this.to=i+s.buffer[n+2],!0}yield(n){return n?n instanceof Ra?(this.buffer=null,this.yieldNode(n)):(this.buffer=n.context,this.yieldBuf(n.index,n.type)):!1}toString(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString()}enterChild(n,r,i){if(!this.buffer)return this.yield(this._tree.nextChild(n<0?this._tree._tree.children.length-1:0,n,r,i,this.mode));let{buffer:s}=this.buffer,a=s.findChild(this.index+4,s.buffer[this.index+3],n,r-this.buffer.start,i);return a<0?!1:(this.stack.push(this.index),this.yieldBuf(a))}firstChild(){return this.enterChild(1,0,4)}lastChild(){return this.enterChild(-1,0,4)}childAfter(n){return this.enterChild(1,n,2)}childBefore(n){return this.enterChild(-1,n,-2)}enter(n,r,i=this.mode){return this.buffer?i&Mr.ExcludeBuffers?!1:this.enterChild(1,n,r):this.yield(this._tree.enter(n,r,i))}parent(){if(!this.buffer)return this.yieldNode(this.mode&Mr.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let n=this.mode&Mr.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent();return this.buffer=null,this.yieldNode(n)}sibling(n){if(!this.buffer)return this._tree._parent?this.yield(this._tree.index<0?null:this._tree._parent.nextChild(this._tree.index+n,n,0,4,this.mode)):!1;let{buffer:r}=this.buffer,i=this.stack.length-1;if(n<0){let s=i<0?0:this.stack[i]+4;if(this.index!=s)return this.yieldBuf(r.findChild(s,this.index,-1,0,4))}else{let s=r.buffer[this.index+3];if(s<(i<0?r.buffer.length:r.buffer[this.stack[i]+3]))return this.yieldBuf(s)}return i<0?this.yield(this.buffer.parent.nextChild(this.buffer.index+n,n,0,4,this.mode)):!1}nextSibling(){return this.sibling(1)}prevSibling(){return this.sibling(-1)}atLastNode(n){let r,i,{buffer:s}=this;if(s){if(n>0){if(this.index<s.buffer.buffer.length)return!1}else for(let a=0;a<this.index;a++)if(s.buffer.buffer[a+3]<this.index)return!1;({index:r,parent:i}=s)}else({index:r,_parent:i}=this._tree);for(;i;{index:r,_parent:i}=i)if(r>-1)for(let a=r+n,o=n<0?-1:i._tree.children.length;a!=o;a+=n){let l=i._tree.children[a];if(this.mode&Mr.IncludeAnonymous||l instanceof yu||!l.type.isAnonymous||NT(l))return!1}return!0}move(n,r){if(r&&this.enterChild(n,0,4))return!0;for(;;){if(this.sibling(n))return!0;if(this.atLastNode(n)||!this.parent())return!1}}next(n=!0){return this.move(1,n)}prev(n=!0){return this.move(-1,n)}moveTo(n,r=0){for(;(this.from==this.to||(r<1?this.from>=n:this.from>n)||(r>-1?this.to<=n:this.to<n))&&this.parent(););for(;this.enterChild(1,n,r););return this}get node(){if(!this.buffer)return this._tree;let n=this.bufferNode,r=null,i=0;if(n&&n.context==this.buffer)e:for(let s=this.index,a=this.stack.length;a>=0;){for(let o=n;o;o=o._parent)if(o.index==s){if(s==this.index)return o;r=o,i=a+1;break e}s=this.stack[--a]}for(let s=i;s<this.stack.length;s++)r=new tu(this.buffer,r,this.stack[s]);return this.bufferNode=new tu(this.buffer,r,this.index)}get tree(){return this.buffer?null:this._tree._tree}iterate(n,r){for(let i=0;;){let s=!1;if(this.type.isAnonymous||n(this)!==!1){if(this.firstChild()){i++;continue}this.type.isAnonymous||(s=!0)}for(;;){if(s&&r&&r(this),s=this.type.isAnonymous,!i)return;if(this.nextSibling())break;this.parent(),i--,s=!0}}}matchContext(n){if(!this.buffer)return DN(this.node.parent,n);let{buffer:r}=this.buffer,{types:i}=r.set;for(let s=n.length-1,a=this.stack.length-1;s>=0;a--){if(a<0)return DN(this._tree,n,s);let o=i[r.buffer[this.stack[a]]];if(!o.isAnonymous){if(n[s]&&n[s]!=o.name)return!1;s--}}return!0}}function NT(e){return e.children.some(n=>n instanceof yu||!n.type.isAnonymous||NT(n))}function Iwe(e){var n;let{buffer:r,nodeSet:i,maxBufferLength:s=vq,reused:a=[],minRepeatType:o=i.types.length}=e,l=Array.isArray(r)?new jT(r,r.length):r,u=i.types,d=0,p=0;function f(E,A,O,F,L,$){let{id:z,start:B,end:H,size:D}=l,U=p,I=d;if(D<0)if(l.next(),D==-1){let R=a[z];O.push(R),F.push(B-E);return}else if(D==-3){d=z;return}else if(D==-4){p=z;return}else throw new RangeError(`Unrecognized record size: ${D}`);let X=u[z],K,Q,V=B-E;if(H-B<=s&&(Q=S(l.pos-A,L))){let R=new Uint16Array(Q.size-Q.skip),q=l.pos-Q.size,W=R.length;for(;l.pos>q;)W=w(Q.start,R,W);K=new yu(R,H-Q.start,i),V=Q.start-E}else{let R=l.pos-D;l.next();let q=[],W=[],te=z>=o?z:-1,J=0,G=H;for(;l.pos>R;)te>=0&&l.id==te&&l.size>=0?(l.end<=G-s&&(x(q,W,B,J,l.end,G,te,U,I),J=q.length,G=l.end),l.next()):$>2500?g(B,R,q,W):f(B,R,q,W,te,$+1);if(te>=0&&J>0&&J<q.length&&x(q,W,B,J,B,G,te,U,I),q.reverse(),W.reverse(),te>-1&&J>0){let re=_(X,I);K=ET(X,q,W,0,q.length,0,H-B,re,re)}else K=v(X,q,W,H-B,U-H,I)}O.push(K),F.push(V)}function g(E,A,O,F){let L=[],$=0,z=-1;for(;l.pos>A;){let{id:B,start:H,end:D,size:U}=l;if(U>4)l.next();else{if(z>-1&&H<z)break;z<0&&(z=D-s),L.push(B,H,D),$++,l.next()}}if($){let B=new Uint16Array($*4),H=L[L.length-2];for(let D=L.length-3,U=0;D>=0;D-=3)B[U++]=L[D],B[U++]=L[D+1]-H,B[U++]=L[D+2]-H,B[U++]=U;O.push(new yu(B,L[2]-H,i)),F.push(H-E)}}function _(E,A){return(O,F,L)=>{let $=0,z=O.length-1,B,H;if(z>=0&&(B=O[z])instanceof zr){if(!z&&B.type==E&&B.length==L)return B;(H=B.prop(cn.lookAhead))&&($=F[z]+B.length+H)}return v(E,O,F,L,$,A)}}function x(E,A,O,F,L,$,z,B,H){let D=[],U=[];for(;E.length>F;)D.push(E.pop()),U.push(A.pop()+O-L);E.push(v(i.types[z],D,U,$-L,B-$,H)),A.push(L-O)}function v(E,A,O,F,L,$,z){if($){let B=[cn.contextHash,$];z=z?[B].concat(z):[B]}if(L>25){let B=[cn.lookAhead,L];z=z?[B].concat(z):[B]}return new zr(E,A,O,F,z)}function S(E,A){let O=l.fork(),F=0,L=0,$=0,z=O.end-s,B={size:0,start:0,skip:0};e:for(let H=O.pos-E;O.pos>H;){let D=O.size;if(O.id==A&&D>=0){B.size=F,B.start=L,B.skip=$,$+=4,F+=4,O.next();continue}let U=O.pos-D;if(D<0||U<H||O.start<z)break;let I=O.id>=o?4:0,X=O.start;for(O.next();O.pos>U;){if(O.size<0)if(O.size==-3||O.size==-4)I+=4;else break e;else O.id>=o&&(I+=4);O.next()}L=X,F+=D,$+=I}return(A<0||F==E)&&(B.size=F,B.start=L,B.skip=$),B.size>4?B:void 0}function w(E,A,O){let{id:F,start:L,end:$,size:z}=l;if(l.next(),z>=0&&F<o){let B=O;if(z>4){let H=l.pos-(z-4);for(;l.pos>H;)O=w(E,A,O)}A[--O]=B,A[--O]=$-E,A[--O]=L-E,A[--O]=F}else z==-3?d=F:z==-4&&(p=F);return O}let j=[],C=[];for(;l.pos>0;)f(e.start||0,e.bufferStart||0,j,C,-1,0);let T=(n=e.length)!==null&&n!==void 0?n:j.length?C[0]+j[0].length:0;return new zr(u[e.topID],j.reverse(),C.reverse(),T)}const r6=new WeakMap;function zx(e,n){if(!e.isAnonymous||n instanceof yu||n.type!=e)return 1;let r=r6.get(n);if(r==null){r=1;for(let i of n.children){if(i.type!=e||!(i instanceof zr)){r=1;break}r+=zx(e,i)}r6.set(n,r)}return r}function ET(e,n,r,i,s,a,o,l,u){let d=0;for(let x=i;x<s;x++)d+=zx(e,n[x]);let p=Math.ceil(d*1.5/8),f=[],g=[];function _(x,v,S,w,j){for(let C=S;C<w;){let T=C,E=v[C],A=zx(e,x[C]);for(C++;C<w;C++){let O=zx(e,x[C]);if(A+O>=p)break;A+=O}if(C==T+1){if(A>p){let O=x[T];_(O.children,O.positions,0,O.children.length,v[T]+j);continue}f.push(x[T])}else{let O=v[C-1]+x[C-1].length-E;f.push(ET(e,x,v,T,C,E,O,null,u))}g.push(E+j-a)}}return _(n,r,i,s,0),(l||u)(f,g,o)}class Nd{constructor(n,r,i,s,a=!1,o=!1){this.from=n,this.to=r,this.tree=i,this.offset=s,this.open=(a?1:0)|(o?2:0)}get openStart(){return(this.open&1)>0}get openEnd(){return(this.open&2)>0}static addTree(n,r=[],i=!1){let s=[new Nd(0,n.length,n,0,!1,i)];for(let a of r)a.to>n.length&&s.push(a);return s}static applyChanges(n,r,i=128){if(!r.length)return n;let s=[],a=1,o=n.length?n[0]:null;for(let l=0,u=0,d=0;;l++){let p=l<r.length?r[l]:null,f=p?p.fromA:1e9;if(f-u>=i)for(;o&&o.from<f;){let g=o;if(u>=g.from||f<=g.to||d){let _=Math.max(g.from,u)-d,x=Math.min(g.to,f)-d;g=_>=x?null:new Nd(_,x,g.tree,g.offset+d,l>0,!!p)}if(g&&s.push(g),o.to>f)break;o=a<n.length?n[a++]:null}if(!p)break;u=p.toA,d=p.toA-p.toB}return s}}class bq{startParse(n,r,i){return typeof n=="string"&&(n=new Bwe(n)),i=i?i.length?i.map(s=>new e2(s.from,s.to)):[new e2(0,0)]:[new e2(0,n.length)],this.createParse(n,r||[],i)}parse(n,r,i){let s=this.startParse(n,r,i);for(;;){let a=s.advance();if(a)return a}}}class Bwe{constructor(n){this.string=n}get length(){return this.string.length}chunk(n){return this.string.slice(n)}get lineChunks(){return!1}read(n,r){return this.string.slice(n,r)}}new cn({perNode:!0});let zwe=0,Dl=class LN{constructor(n,r,i,s){this.name=n,this.set=r,this.base=i,this.modified=s,this.id=zwe++}toString(){let{name:n}=this;for(let r of this.modified)r.name&&(n=`${r.name}(${n})`);return n}static define(n,r){let i=typeof n=="string"?n:"?";if(n instanceof LN&&(r=n),r!=null&&r.base)throw new Error("Can not derive from a modified tag");let s=new LN(i,[],null,[]);if(s.set.push(s),r)for(let a of r.set)s.set.push(a);return s}static defineModifier(n){let r=new Hb(n);return i=>i.modified.indexOf(r)>-1?i:Hb.get(i.base||i,i.modified.concat(r).sort((s,a)=>s.id-a.id))}},$we=0;class Hb{constructor(n){this.name=n,this.instances=[],this.id=$we++}static get(n,r){if(!r.length)return n;let i=r[0].instances.find(l=>l.base==n&&Fwe(r,l.modified));if(i)return i;let s=[],a=new Dl(n.name,s,n,r);for(let l of r)l.instances.push(a);let o=Hwe(r);for(let l of n.set)if(!l.modified.length)for(let u of o)s.push(Hb.get(l,u));return a}}function Fwe(e,n){return e.length==n.length&&e.every((r,i)=>r==n[i])}function Hwe(e){let n=[[]];for(let r=0;r<e.length;r++)for(let i=0,s=n.length;i<s;i++)n.push(n[i].concat(e[r]));return n.sort((r,i)=>i.length-r.length)}function kq(e){let n=Object.create(null);for(let r in e){let i=e[r];Array.isArray(i)||(i=[i]);for(let s of r.split(" "))if(s){let a=[],o=2,l=s;for(let f=0;;){if(l=="..."&&f>0&&f+3==s.length){o=1;break}let g=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(l);if(!g)throw new RangeError("Invalid path: "+s);if(a.push(g[0]=="*"?"":g[0][0]=='"'?JSON.parse(g[0]):g[0]),f+=g[0].length,f==s.length)break;let _=s[f++];if(f==s.length&&_=="!"){o=0;break}if(_!="/")throw new RangeError("Invalid path: "+s);l=s.slice(f)}let u=a.length-1,d=a[u];if(!d)throw new RangeError("Invalid path: "+s);let p=new iv(i,o,u>0?a.slice(0,u):null);n[d]=p.sort(n[d])}}return wq.add(n)}const wq=new cn({combine(e,n){let r,i,s;for(;e||n;){if(!e||n&&e.depth>=n.depth?(s=n,n=n.next):(s=e,e=e.next),r&&r.mode==s.mode&&!s.context&&!r.context)continue;let a=new iv(s.tags,s.mode,s.context);r?r.next=a:i=a,r=a}return i}});class iv{constructor(n,r,i,s){this.tags=n,this.mode=r,this.context=i,this.next=s}get opaque(){return this.mode==0}get inherit(){return this.mode==1}sort(n){return!n||n.depth<this.depth?(this.next=n,this):(n.next=this.sort(n.next),n)}get depth(){return this.context?this.context.length:0}}iv.empty=new iv([],2,null);function Sq(e,n){let r=Object.create(null);for(let a of e)if(!Array.isArray(a.tag))r[a.tag.id]=a.class;else for(let o of a.tag)r[o.id]=a.class;let{scope:i,all:s=null}=n||{};return{style:a=>{let o=s;for(let l of a)for(let u of l.set){let d=r[u.id];if(d){o=o?o+" "+d:d;break}}return o},scope:i}}function Wwe(e,n){let r=null;for(let i of e){let s=i.style(n);s&&(r=r?r+" "+s:s)}return r}function qwe(e,n,r,i=0,s=e.length){let a=new Uwe(i,Array.isArray(n)?n:[n],r);a.highlightRange(e.cursor(),i,s,"",a.highlighters),a.flush(s)}class Uwe{constructor(n,r,i){this.at=n,this.highlighters=r,this.span=i,this.class=""}startSpan(n,r){r!=this.class&&(this.flush(n),n>this.at&&(this.at=n),this.class=r)}flush(n){n>this.at&&this.class&&this.span(this.at,n,this.class)}highlightRange(n,r,i,s,a){let{type:o,from:l,to:u}=n;if(l>=i||u<=r)return;o.isTop&&(a=this.highlighters.filter(_=>!_.scope||_.scope(o)));let d=s,p=Kwe(n)||iv.empty,f=Wwe(a,p.tags);if(f&&(d&&(d+=" "),d+=f,p.mode==1&&(s+=(s?" ":"")+f)),this.startSpan(Math.max(r,l),d),p.opaque)return;let g=n.tree&&n.tree.prop(cn.mounted);if(g&&g.overlay){let _=n.node.enter(g.overlay[0].from+l,1),x=this.highlighters.filter(S=>!S.scope||S.scope(g.tree.type)),v=n.firstChild();for(let S=0,w=l;;S++){let j=S<g.overlay.length?g.overlay[S]:null,C=j?j.from+l:u,T=Math.max(r,w),E=Math.min(i,C);if(T<E&&v)for(;n.from<E&&(this.highlightRange(n,T,E,s,a),this.startSpan(Math.min(E,n.to),d),!(n.to>=C||!n.nextSibling())););if(!j||C>i)break;w=j.to+l,w>r&&(this.highlightRange(_.cursor(),Math.max(r,j.from+l),Math.min(i,w),"",x),this.startSpan(Math.min(i,w),d))}v&&n.parent()}else if(n.firstChild()){g&&(s="");do if(!(n.to<=r)){if(n.from>=i)break;this.highlightRange(n,r,i,s,a),this.startSpan(Math.min(i,n.to),d)}while(n.nextSibling());n.parent()}}}function Kwe(e){let n=e.type.prop(wq);for(;n&&n.context&&!e.matchContext(n.context);)n=n.next;return n||null}const lt=Dl.define,W_=lt(),Uc=lt(),i6=lt(Uc),s6=lt(Uc),Kc=lt(),q_=lt(Kc),t2=lt(Kc),Mo=lt(),Xu=lt(Mo),jo=lt(),No=lt(),IN=lt(),bm=lt(IN),U_=lt(),Te={comment:W_,lineComment:lt(W_),blockComment:lt(W_),docComment:lt(W_),name:Uc,variableName:lt(Uc),typeName:i6,tagName:lt(i6),propertyName:s6,attributeName:lt(s6),className:lt(Uc),labelName:lt(Uc),namespace:lt(Uc),macroName:lt(Uc),literal:Kc,string:q_,docString:lt(q_),character:lt(q_),attributeValue:lt(q_),number:t2,integer:lt(t2),float:lt(t2),bool:lt(Kc),regexp:lt(Kc),escape:lt(Kc),color:lt(Kc),url:lt(Kc),keyword:jo,self:lt(jo),null:lt(jo),atom:lt(jo),unit:lt(jo),modifier:lt(jo),operatorKeyword:lt(jo),controlKeyword:lt(jo),definitionKeyword:lt(jo),moduleKeyword:lt(jo),operator:No,derefOperator:lt(No),arithmeticOperator:lt(No),logicOperator:lt(No),bitwiseOperator:lt(No),compareOperator:lt(No),updateOperator:lt(No),definitionOperator:lt(No),typeOperator:lt(No),controlOperator:lt(No),punctuation:IN,separator:lt(IN),bracket:bm,angleBracket:lt(bm),squareBracket:lt(bm),paren:lt(bm),brace:lt(bm),content:Mo,heading:Xu,heading1:lt(Xu),heading2:lt(Xu),heading3:lt(Xu),heading4:lt(Xu),heading5:lt(Xu),heading6:lt(Xu),contentSeparator:lt(Mo),list:lt(Mo),quote:lt(Mo),emphasis:lt(Mo),strong:lt(Mo),link:lt(Mo),monospace:lt(Mo),strikethrough:lt(Mo),inserted:lt(),deleted:lt(),changed:lt(),invalid:lt(),meta:U_,documentMeta:lt(U_),annotation:lt(U_),processingInstruction:lt(U_),definition:Dl.defineModifier("definition"),constant:Dl.defineModifier("constant"),function:Dl.defineModifier("function"),standard:Dl.defineModifier("standard"),local:Dl.defineModifier("local"),special:Dl.defineModifier("special")};for(let e in Te){let n=Te[e];n instanceof Dl&&(n.name=e)}Sq([{tag:Te.link,class:"tok-link"},{tag:Te.heading,class:"tok-heading"},{tag:Te.emphasis,class:"tok-emphasis"},{tag:Te.strong,class:"tok-strong"},{tag:Te.keyword,class:"tok-keyword"},{tag:Te.atom,class:"tok-atom"},{tag:Te.bool,class:"tok-bool"},{tag:Te.url,class:"tok-url"},{tag:Te.labelName,class:"tok-labelName"},{tag:Te.inserted,class:"tok-inserted"},{tag:Te.deleted,class:"tok-deleted"},{tag:Te.literal,class:"tok-literal"},{tag:Te.string,class:"tok-string"},{tag:Te.number,class:"tok-number"},{tag:[Te.regexp,Te.escape,Te.special(Te.string)],class:"tok-string2"},{tag:Te.variableName,class:"tok-variableName"},{tag:Te.local(Te.variableName),class:"tok-variableName tok-local"},{tag:Te.definition(Te.variableName),class:"tok-variableName tok-definition"},{tag:Te.special(Te.variableName),class:"tok-variableName2"},{tag:Te.definition(Te.propertyName),class:"tok-propertyName tok-definition"},{tag:Te.typeName,class:"tok-typeName"},{tag:Te.namespace,class:"tok-namespace"},{tag:Te.className,class:"tok-className"},{tag:Te.macroName,class:"tok-macroName"},{tag:Te.propertyName,class:"tok-propertyName"},{tag:Te.operator,class:"tok-operator"},{tag:Te.comment,class:"tok-comment"},{tag:Te.meta,class:"tok-meta"},{tag:Te.invalid,class:"tok-invalid"},{tag:Te.punctuation,class:"tok-punctuation"}]);var n2;const pf=new cn;function Vwe(e){return pt.define({combine:e?n=>n.concat(e):void 0})}const Ywe=new cn;class Ja{constructor(n,r,i=[],s=""){this.data=n,this.name=s,yn.prototype.hasOwnProperty("tree")||Object.defineProperty(yn.prototype,"tree",{get(){return Vi(this)}}),this.parser=r,this.extension=[_u.of(this),yn.languageData.of((a,o,l)=>{let u=a6(a,o,l),d=u.type.prop(pf);if(!d)return[];let p=a.facet(d),f=u.type.prop(Ywe);if(f){let g=u.resolve(o-u.from,l);for(let _ of f)if(_.test(g,a)){let x=a.facet(_.facet);return _.type=="replace"?x:x.concat(p)}}return p})].concat(i)}isActiveAt(n,r,i=-1){return a6(n,r,i).type.prop(pf)==this.data}findRegions(n){let r=n.facet(_u);if((r==null?void 0:r.data)==this.data)return[{from:0,to:n.doc.length}];if(!r||!r.allowsNesting)return[];let i=[],s=(a,o)=>{if(a.prop(pf)==this.data){i.push({from:o,to:o+a.length});return}let l=a.prop(cn.mounted);if(l){if(l.tree.prop(pf)==this.data){if(l.overlay)for(let u of l.overlay)i.push({from:u.from+o,to:u.to+o});else i.push({from:o,to:o+a.length});return}else if(l.overlay){let u=i.length;if(s(l.tree,l.overlay[0].from+o),i.length>u)return}}for(let u=0;u<a.children.length;u++){let d=a.children[u];d instanceof zr&&s(d,a.positions[u]+o)}};return s(Vi(n),0),i}get allowsNesting(){return!0}}Ja.setState=Gt.define();function a6(e,n,r){let i=e.facet(_u),s=Vi(e).topNode;if(!i||i.allowsNesting)for(let a=s;a;a=a.enter(n,r,Mr.ExcludeBuffers|Mr.EnterBracketed))a.type.isTop&&(s=a);return s}class Wb extends Ja{constructor(n,r,i){super(n,r,[],i),this.parser=r}static define(n){let r=Vwe(n.languageData);return new Wb(r,n.parser.configure({props:[pf.add(i=>i.isTop?r:void 0)]}),n.name)}configure(n,r){return new Wb(this.data,this.parser.configure(n),r||this.name)}get allowsNesting(){return this.parser.hasWrappers()}}function Vi(e){let n=e.field(Ja.state,!1);return n?n.tree:zr.empty}class Gwe{constructor(n){this.doc=n,this.cursorPos=0,this.string="",this.cursor=n.iter()}get length(){return this.doc.length}syncTo(n){return this.string=this.cursor.next(n-this.cursorPos).value,this.cursorPos=n+this.string.length,this.cursorPos-this.string.length}chunk(n){return this.syncTo(n),this.string}get lineChunks(){return!0}read(n,r){let i=this.cursorPos-this.string.length;return n<i||r>=this.cursorPos?this.doc.sliceString(n,r):this.string.slice(n-i,r-i)}}let km=null;class qb{constructor(n,r,i=[],s,a,o,l,u){this.parser=n,this.state=r,this.fragments=i,this.tree=s,this.treeLen=a,this.viewport=o,this.skipped=l,this.scheduleOn=u,this.parse=null,this.tempSkipped=[]}static create(n,r,i){return new qb(n,r,[],zr.empty,0,i,[],null)}startParse(){return this.parser.startParse(new Gwe(this.state.doc),this.fragments)}work(n,r){return r!=null&&r>=this.state.doc.length&&(r=void 0),this.tree!=zr.empty&&this.isDone(r??this.state.doc.length)?(this.takeTree(),!0):this.withContext(()=>{var i;if(typeof n=="number"){let s=Date.now()+n;n=()=>Date.now()>s}for(this.parse||(this.parse=this.startParse()),r!=null&&(this.parse.stoppedAt==null||this.parse.stoppedAt>r)&&r<this.state.doc.length&&this.parse.stopAt(r);;){let s=this.parse.advance();if(s)if(this.fragments=this.withoutTempSkipped(Nd.addTree(s,this.fragments,this.parse.stoppedAt!=null)),this.treeLen=(i=this.parse.stoppedAt)!==null&&i!==void 0?i:this.state.doc.length,this.tree=s,this.parse=null,this.treeLen<(r??this.state.doc.length))this.parse=this.startParse();else return!0;if(n())return!1}})}takeTree(){let n,r;this.parse&&(n=this.parse.parsedPos)>=this.treeLen&&((this.parse.stoppedAt==null||this.parse.stoppedAt>n)&&this.parse.stopAt(n),this.withContext(()=>{for(;!(r=this.parse.advance()););}),this.treeLen=n,this.tree=r,this.fragments=this.withoutTempSkipped(Nd.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(n){let r=km;km=this;try{return n()}finally{km=r}}withoutTempSkipped(n){for(let r;r=this.tempSkipped.pop();)n=o6(n,r.from,r.to);return n}changes(n,r){let{fragments:i,tree:s,treeLen:a,viewport:o,skipped:l}=this;if(this.takeTree(),!n.empty){let u=[];if(n.iterChangedRanges((d,p,f,g)=>u.push({fromA:d,toA:p,fromB:f,toB:g})),i=Nd.applyChanges(i,u),s=zr.empty,a=0,o={from:n.mapPos(o.from,-1),to:n.mapPos(o.to,1)},this.skipped.length){l=[];for(let d of this.skipped){let p=n.mapPos(d.from,1),f=n.mapPos(d.to,-1);p<f&&l.push({from:p,to:f})}}}return new qb(this.parser,r,i,s,a,o,l,this.scheduleOn)}updateViewport(n){if(this.viewport.from==n.from&&this.viewport.to==n.to)return!1;this.viewport=n;let r=this.skipped.length;for(let i=0;i<this.skipped.length;i++){let{from:s,to:a}=this.skipped[i];s<n.to&&a>n.from&&(this.fragments=o6(this.fragments,s,a),this.skipped.splice(i--,1))}return this.skipped.length>=r?!1:(this.reset(),!0)}reset(){this.parse&&(this.takeTree(),this.parse=null)}skipUntilInView(n,r){this.skipped.push({from:n,to:r})}static getSkippingParser(n){return new class extends bq{createParse(r,i,s){let a=s[0].from,o=s[s.length-1].to;return{parsedPos:a,advance(){let u=km;if(u){for(let d of s)u.tempSkipped.push(d);n&&(u.scheduleOn=u.scheduleOn?Promise.all([u.scheduleOn,n]):n)}return this.parsedPos=o,new zr(Os.none,[],[],o-a)},stoppedAt:null,stopAt(){}}}}}isDone(n){n=Math.min(n,this.state.doc.length);let r=this.fragments;return this.treeLen>=n&&r.length&&r[0].from==0&&r[0].to>=n}static get(){return km}}function o6(e,n,r){return Nd.applyChanges(e,[{fromA:n,toA:r,fromB:n,toB:r}])}class Jf{constructor(n){this.context=n,this.tree=n.tree}apply(n){if(!n.docChanged&&this.tree==this.context.tree)return this;let r=this.context.changes(n.changes,n.state),i=this.context.treeLen==n.startState.doc.length?void 0:Math.max(n.changes.mapPos(this.context.treeLen),r.viewport.to);return r.work(20,i)||r.takeTree(),new Jf(r)}static init(n){let r=Math.min(3e3,n.doc.length),i=qb.create(n.facet(_u).parser,n,{from:0,to:r});return i.work(20,r)||i.takeTree(),new Jf(i)}}Ja.state=_i.define({create:Jf.init,update(e,n){for(let r of n.effects)if(r.is(Ja.setState))return r.value;return n.startState.facet(_u)!=n.state.facet(_u)?Jf.init(n.state):e.apply(n)}});let Cq=e=>{let n=setTimeout(()=>e(),500);return()=>clearTimeout(n)};typeof requestIdleCallback<"u"&&(Cq=e=>{let n=-1,r=setTimeout(()=>{n=requestIdleCallback(e,{timeout:400})},100);return()=>n<0?clearTimeout(r):cancelIdleCallback(n)});const r2=typeof navigator<"u"&&(!((n2=navigator.scheduling)===null||n2===void 0)&&n2.isInputPending)?()=>navigator.scheduling.isInputPending():null,Xwe=Cr.fromClass(class{constructor(n){this.view=n,this.working=null,this.workScheduled=0,this.chunkEnd=-1,this.chunkBudget=-1,this.work=this.work.bind(this),this.scheduleWork()}update(n){let r=this.view.state.field(Ja.state).context;(r.updateViewport(n.view.viewport)||this.view.viewport.to>r.treeLen)&&this.scheduleWork(),(n.docChanged||n.selectionSet)&&(this.view.hasFocus&&(this.chunkBudget+=50),this.scheduleWork()),this.checkAsyncSchedule(r)}scheduleWork(){if(this.working)return;let{state:n}=this.view,r=n.field(Ja.state);(r.tree!=r.context.tree||!r.context.isDone(n.doc.length))&&(this.working=Cq(this.work))}work(n){this.working=null;let r=Date.now();if(this.chunkEnd<r&&(this.chunkEnd<0||this.view.hasFocus)&&(this.chunkEnd=r+3e4,this.chunkBudget=3e3),this.chunkBudget<=0)return;let{state:i,viewport:{to:s}}=this.view,a=i.field(Ja.state);if(a.tree==a.context.tree&&a.context.isDone(s+1e5))return;let o=Date.now()+Math.min(this.chunkBudget,100,n&&!r2?Math.max(25,n.timeRemaining()-5):1e9),l=a.context.treeLen<s&&i.doc.length>s+1e3,u=a.context.work(()=>r2&&r2()||Date.now()>o,s+(l?0:1e5));this.chunkBudget-=Date.now()-r,(u||this.chunkBudget<=0)&&(a.context.takeTree(),this.view.dispatch({effects:Ja.setState.of(new Jf(a.context))})),this.chunkBudget>0&&!(u&&!l)&&this.scheduleWork(),this.checkAsyncSchedule(a.context)}checkAsyncSchedule(n){n.scheduleOn&&(this.workScheduled++,n.scheduleOn.then(()=>this.scheduleWork()).catch(r=>ss(this.view.state,r)).then(()=>this.workScheduled--),n.scheduleOn=null)}destroy(){this.working&&this.working()}isWorking(){return!!(this.working||this.workScheduled>0)}},{eventHandlers:{focus(){this.scheduleWork()}}}),_u=pt.define({combine(e){return e.length?e[0]:null},enables:e=>[Ja.state,Xwe,ct.contentAttributes.compute([e],n=>{let r=n.facet(e);return r&&r.name?{"data-language":r.name}:{}})]});class Qwe{constructor(n,r=[]){this.language=n,this.support=r,this.extension=[n,r]}}const Zwe=pt.define(),ok=pt.define({combine:e=>{if(!e.length)return"  ";let n=e[0];if(!n||/\S/.test(n)||Array.from(n).some(r=>r!=n[0]))throw new Error("Invalid indent unit: "+JSON.stringify(e[0]));return n}});function Ub(e){let n=e.facet(ok);return n.charCodeAt(0)==9?e.tabSize*n.length:n.length}function sv(e,n){let r="",i=e.tabSize,s=e.facet(ok)[0];if(s=="	"){for(;n>=i;)r+="	",n-=i;s=" "}for(let a=0;a<n;a++)r+=s;return r}function AT(e,n){e instanceof yn&&(e=new lk(e));for(let i of e.state.facet(Zwe)){let s=i(e,n);if(s!==void 0)return s}let r=Vi(e.state);return r.length>=n?Jwe(e,r,n):null}class lk{constructor(n,r={}){this.state=n,this.options=r,this.unit=Ub(n)}lineAt(n,r=1){let i=this.state.doc.lineAt(n),{simulateBreak:s,simulateDoubleBreak:a}=this.options;return s!=null&&s>=i.from&&s<=i.to?a&&s==n?{text:"",from:n}:(r<0?s<n:s<=n)?{text:i.text.slice(s-i.from),from:s}:{text:i.text.slice(0,s-i.from),from:i.from}:i}textAfterPos(n,r=1){if(this.options.simulateDoubleBreak&&n==this.options.simulateBreak)return"";let{text:i,from:s}=this.lineAt(n,r);return i.slice(n-s,Math.min(i.length,n+100-s))}column(n,r=1){let{text:i,from:s}=this.lineAt(n,r),a=this.countColumn(i,n-s),o=this.options.overrideIndentation?this.options.overrideIndentation(s):-1;return o>-1&&(a+=o-this.countColumn(i,i.search(/\S|$/))),a}countColumn(n,r=n.length){return fp(n,this.state.tabSize,r)}lineIndent(n,r=1){let{text:i,from:s}=this.lineAt(n,r),a=this.options.overrideIndentation;if(a){let o=a(s);if(o>-1)return o}return this.countColumn(i,i.search(/\S|$/))}get simulatedBreak(){return this.options.simulateBreak||null}}const jq=new cn;function Jwe(e,n,r){let i=n.resolveStack(r),s=n.resolveInner(r,-1).resolve(r,0).enterUnfinishedNodesBefore(r);if(s!=i.node){let a=[];for(let o=s;o&&!(o.from<i.node.from||o.to>i.node.to||o.from==i.node.from&&o.type==i.node.type);o=o.parent)a.push(o);for(let o=a.length-1;o>=0;o--)i={node:a[o],next:i}}return Nq(i,e,r)}function Nq(e,n,r){for(let i=e;i;i=i.next){let s=tSe(i.node);if(s)return s(TT.create(n,r,i))}return 0}function eSe(e){return e.pos==e.options.simulateBreak&&e.options.simulateDoubleBreak}function tSe(e){let n=e.type.prop(jq);if(n)return n;let r=e.firstChild,i;if(r&&(i=r.type.prop(cn.closedBy))){let s=e.lastChild,a=s&&i.indexOf(s.name)>-1;return o=>Eq(o,!0,1,void 0,a&&!eSe(o)?s.from:void 0)}return e.parent==null?nSe:null}function nSe(){return 0}class TT extends lk{constructor(n,r,i){super(n.state,n.options),this.base=n,this.pos=r,this.context=i}get node(){return this.context.node}static create(n,r,i){return new TT(n,r,i)}get textAfter(){return this.textAfterPos(this.pos)}get baseIndent(){return this.baseIndentFor(this.node)}baseIndentFor(n){let r=this.state.doc.lineAt(n.from);for(;;){let i=n.resolve(r.from);for(;i.parent&&i.parent.from==i.from;)i=i.parent;if(rSe(i,n))break;r=this.state.doc.lineAt(i.from)}return this.lineIndent(r.from)}continue(){return Nq(this.context.next,this.base,this.pos)}}function rSe(e,n){for(let r=n;r;r=r.parent)if(e==r)return!0;return!1}function iSe(e){let n=e.node,r=n.childAfter(n.from),i=n.lastChild;if(!r)return null;let s=e.options.simulateBreak,a=e.state.doc.lineAt(r.from),o=s==null||s<=a.from?a.to:Math.min(a.to,s);for(let l=r.to;;){let u=n.childAfter(l);if(!u||u==i)return null;if(!u.type.isSkipped){if(u.from>=o)return null;let d=/^ */.exec(a.text.slice(r.to-a.from))[0].length;return{from:r.from,to:r.to+d}}l=u.to}}function l6({closing:e,align:n=!0,units:r=1}){return i=>Eq(i,n,r,e)}function Eq(e,n,r,i,s){let a=e.textAfter,o=a.match(/^\s*/)[0].length,l=i&&a.slice(o,o+i.length)==i||s==e.pos+o,u=n?iSe(e):null;return u?l?e.column(u.from):e.column(u.to):e.baseIndent+(l?0:e.unit*r)}const sSe=200;function aSe(){return yn.transactionFilter.of(e=>{if(!e.docChanged||!e.isUserEvent("input.type")&&!e.isUserEvent("input.complete"))return e;let n=e.startState.languageDataAt("indentOnInput",e.startState.selection.main.head);if(!n.length)return e;let r=e.newDoc,{head:i}=e.newSelection.main,s=r.lineAt(i);if(i>s.from+sSe)return e;let a=r.sliceString(s.from,i);if(!n.some(d=>d.test(a)))return e;let{state:o}=e,l=-1,u=[];for(let{head:d}of o.selection.ranges){let p=o.doc.lineAt(d);if(p.from==l)continue;l=p.from;let f=AT(o,p.from);if(f==null)continue;let g=/^\s*/.exec(p.text)[0],_=sv(o,f);g!=_&&u.push({from:p.from,to:p.from+g.length,insert:_})}return u.length?[e,{changes:u,sequential:!0}]:e})}const oSe=pt.define(),Aq=new cn;function lSe(e){let n=e.firstChild,r=e.lastChild;return n&&n.to<r.from?{from:n.to,to:r.type.isError?e.to:r.from}:null}function cSe(e,n,r){let i=Vi(e);if(i.length<r)return null;let s=i.resolveStack(r,1),a=null;for(let o=s;o;o=o.next){let l=o.node;if(l.to<=r||l.from>r)continue;if(a&&l.from<n)break;let u=l.type.prop(Aq);if(u&&(l.to<i.length-50||i.length==e.doc.length||!uSe(l))){let d=u(l,e);d&&d.from<=r&&d.from>=n&&d.to>r&&(a=d)}}return a}function uSe(e){let n=e.lastChild;return n&&n.to==e.to&&n.type.isError}function Kb(e,n,r){for(let i of e.facet(oSe)){let s=i(e,n,r);if(s)return s}return cSe(e,n,r)}function Tq(e,n){let r=n.mapPos(e.from,1),i=n.mapPos(e.to,-1);return r>=i?void 0:{from:r,to:i}}const ck=Gt.define({map:Tq}),Kv=Gt.define({map:Tq});function Mq(e){let n=[];for(let{head:r}of e.state.selection.ranges)n.some(i=>i.from<=r&&i.to>=r)||n.push(e.lineBlockAt(r));return n}const Fd=_i.define({create(){return Pt.none},update(e,n){n.isUserEvent("delete")&&n.changes.iterChangedRanges((r,i)=>e=c6(e,r,i)),e=e.map(n.changes);for(let r of n.effects)if(r.is(ck)&&!dSe(e,r.value.from,r.value.to)){let{preparePlaceholder:i}=n.state.facet(Dq),s=i?Pt.replace({widget:new ySe(i(n.state,r.value))}):u6;e=e.update({add:[s.range(r.value.from,r.value.to)]})}else r.is(Kv)&&(e=e.update({filter:(i,s)=>r.value.from!=i||r.value.to!=s,filterFrom:r.value.from,filterTo:r.value.to}));return n.selection&&(e=c6(e,n.selection.main.head)),e},provide:e=>ct.decorations.from(e),toJSON(e,n){let r=[];return e.between(0,n.doc.length,(i,s)=>{r.push(i,s)}),r},fromJSON(e){if(!Array.isArray(e)||e.length%2)throw new RangeError("Invalid JSON for fold state");let n=[];for(let r=0;r<e.length;){let i=e[r++],s=e[r++];if(typeof i!="number"||typeof s!="number")throw new RangeError("Invalid JSON for fold state");n.push(u6.range(i,s))}return Pt.set(n,!0)}});function c6(e,n,r=n){let i=!1;return e.between(n,r,(s,a)=>{s<r&&a>n&&(i=!0)}),i?e.update({filterFrom:n,filterTo:r,filter:(s,a)=>s>=r||a<=n}):e}function Vb(e,n,r){var i;let s=null;return(i=e.field(Fd,!1))===null||i===void 0||i.between(n,r,(a,o)=>{(!s||s.from>a)&&(s={from:a,to:o})}),s}function dSe(e,n,r){let i=!1;return e.between(n,n,(s,a)=>{s==n&&a==r&&(i=!0)}),i}function Rq(e,n){return e.field(Fd,!1)?n:n.concat(Gt.appendConfig.of(Pq()))}const hSe=e=>{for(let n of Mq(e)){let r=Kb(e.state,n.from,n.to);if(r)return e.dispatch({effects:Rq(e.state,[ck.of(r),Oq(e,r)])}),!0}return!1},fSe=e=>{if(!e.state.field(Fd,!1))return!1;let n=[];for(let r of Mq(e)){let i=Vb(e.state,r.from,r.to);i&&n.push(Kv.of(i),Oq(e,i,!1))}return n.length&&e.dispatch({effects:n}),n.length>0};function Oq(e,n,r=!0){let i=e.state.doc.lineAt(n.from).number,s=e.state.doc.lineAt(n.to).number;return ct.announce.of(`${e.state.phrase(r?"Folded lines":"Unfolded lines")} ${i} ${e.state.phrase("to")} ${s}.`)}const pSe=e=>{let{state:n}=e,r=[];for(let i=0;i<n.doc.length;){let s=e.lineBlockAt(i),a=Kb(n,s.from,s.to);a&&r.push(ck.of(a)),i=(a?e.lineBlockAt(a.to):s).to+1}return r.length&&e.dispatch({effects:Rq(e.state,r)}),!!r.length},mSe=e=>{let n=e.state.field(Fd,!1);if(!n||!n.size)return!1;let r=[];return n.between(0,e.state.doc.length,(i,s)=>{r.push(Kv.of({from:i,to:s}))}),e.dispatch({effects:r}),!0},gSe=[{key:"Ctrl-Shift-[",mac:"Cmd-Alt-[",run:hSe},{key:"Ctrl-Shift-]",mac:"Cmd-Alt-]",run:fSe},{key:"Ctrl-Alt-[",run:pSe},{key:"Ctrl-Alt-]",run:mSe}],vSe={placeholderDOM:null,preparePlaceholder:null,placeholderText:"…"},Dq=pt.define({combine(e){return oo(e,vSe)}});function Pq(e){return[Fd,bSe]}function Lq(e,n){let{state:r}=e,i=r.facet(Dq),s=o=>{let l=e.lineBlockAt(e.posAtDOM(o.target)),u=Vb(e.state,l.from,l.to);u&&e.dispatch({effects:Kv.of(u)}),o.preventDefault()};if(i.placeholderDOM)return i.placeholderDOM(e,s,n);let a=document.createElement("span");return a.textContent=i.placeholderText,a.setAttribute("aria-label",r.phrase("folded code")),a.title=r.phrase("unfold"),a.className="cm-foldPlaceholder",a.onclick=s,a}const u6=Pt.replace({widget:new class extends ol{toDOM(e){return Lq(e,null)}}});class ySe extends ol{constructor(n){super(),this.value=n}eq(n){return this.value==n.value}toDOM(n){return Lq(n,this.value)}}const _Se={openText:"⌄",closedText:"›",markerDOM:null,domEventHandlers:{},foldingChanged:()=>!1};class i2 extends tl{constructor(n,r){super(),this.config=n,this.open=r}eq(n){return this.config==n.config&&this.open==n.open}toDOM(n){if(this.config.markerDOM)return this.config.markerDOM(this.open);let r=document.createElement("span");return r.textContent=this.open?this.config.openText:this.config.closedText,r.title=n.state.phrase(this.open?"Fold line":"Unfold line"),r}}function xSe(e={}){let n={..._Se,...e},r=new i2(n,!0),i=new i2(n,!1),s=Cr.fromClass(class{constructor(o){this.from=o.viewport.from,this.markers=this.buildMarkers(o)}update(o){(o.docChanged||o.viewportChanged||o.startState.facet(_u)!=o.state.facet(_u)||o.startState.field(Fd,!1)!=o.state.field(Fd,!1)||Vi(o.startState)!=Vi(o.state)||n.foldingChanged(o))&&(this.markers=this.buildMarkers(o.view))}buildMarkers(o){let l=new ec;for(let u of o.viewportLineBlocks){let d=Vb(o.state,u.from,u.to)?i:Kb(o.state,u.from,u.to)?r:null;d&&l.add(u.from,u.from,d)}return l.finish()}}),{domEventHandlers:a}=n;return[s,pq({class:"cm-foldGutter",markers(o){var l;return((l=o.plugin(s))===null||l===void 0?void 0:l.markers)||rn.empty},initialSpacer(){return new i2(n,!1)},domEventHandlers:{...a,click:(o,l,u)=>{if(a.click&&a.click(o,l,u))return!0;let d=Vb(o.state,l.from,l.to);if(d)return o.dispatch({effects:Kv.of(d)}),!0;let p=Kb(o.state,l.from,l.to);return p?(o.dispatch({effects:ck.of(p)}),!0):!1}}}),Pq()]}const bSe=ct.baseTheme({".cm-foldPlaceholder":{backgroundColor:"#eee",border:"1px solid #ddd",color:"#888",borderRadius:".2em",margin:"0 1px",padding:"0 1px",cursor:"pointer"},".cm-foldGutter span":{padding:"0 1px",cursor:"pointer"}});class Vv{constructor(n,r){this.specs=n;let i;function s(l){let u=mu.newName();return(i||(i=Object.create(null)))["."+u]=l,u}const a=typeof r.all=="string"?r.all:r.all?s(r.all):void 0,o=r.scope;this.scope=o instanceof Ja?l=>l.prop(pf)==o.data:o?l=>l==o:void 0,this.style=Sq(n.map(l=>({tag:l.tag,class:l.class||s(Object.assign({},l,{tag:null}))})),{all:a}).style,this.module=i?new mu(i):null,this.themeType=r.themeType}static define(n,r){return new Vv(n,r||{})}}const BN=pt.define(),Iq=pt.define({combine(e){return e.length?[e[0]]:null}});function s2(e){let n=e.facet(BN);return n.length?n:e.facet(Iq)}function Bq(e,n){let r=[wSe],i;return e instanceof Vv&&(e.module&&r.push(ct.styleModule.of(e.module)),i=e.themeType),n!=null&&n.fallback?r.push(Iq.of(e)):i?r.push(BN.computeN([ct.darkTheme],s=>s.facet(ct.darkTheme)==(i=="dark")?[e]:[])):r.push(BN.of(e)),r}class kSe{constructor(n){this.markCache=Object.create(null),this.tree=Vi(n.state),this.decorations=this.buildDeco(n,s2(n.state)),this.decoratedTo=n.viewport.to}update(n){let r=Vi(n.state),i=s2(n.state),s=i!=s2(n.startState),{viewport:a}=n.view,o=n.changes.mapPos(this.decoratedTo,1);r.length<a.to&&!s&&r.type==this.tree.type&&o>=a.to?(this.decorations=this.decorations.map(n.changes),this.decoratedTo=o):(r!=this.tree||n.viewportChanged||s)&&(this.tree=r,this.decorations=this.buildDeco(n.view,i),this.decoratedTo=a.to)}buildDeco(n,r){if(!r||!this.tree.length)return Pt.none;let i=new ec;for(let{from:s,to:a}of n.visibleRanges)qwe(this.tree,r,(o,l,u)=>{i.add(o,l,this.markCache[u]||(this.markCache[u]=Pt.mark({class:u})))},s,a);return i.finish()}}const wSe=Kd.high(Cr.fromClass(kSe,{decorations:e=>e.decorations})),SSe=Vv.define([{tag:Te.meta,color:"#404740"},{tag:Te.link,textDecoration:"underline"},{tag:Te.heading,textDecoration:"underline",fontWeight:"bold"},{tag:Te.emphasis,fontStyle:"italic"},{tag:Te.strong,fontWeight:"bold"},{tag:Te.strikethrough,textDecoration:"line-through"},{tag:Te.keyword,color:"#708"},{tag:[Te.atom,Te.bool,Te.url,Te.contentSeparator,Te.labelName],color:"#219"},{tag:[Te.literal,Te.inserted],color:"#164"},{tag:[Te.string,Te.deleted],color:"#a11"},{tag:[Te.regexp,Te.escape,Te.special(Te.string)],color:"#e40"},{tag:Te.definition(Te.variableName),color:"#00f"},{tag:Te.local(Te.variableName),color:"#30a"},{tag:[Te.typeName,Te.namespace],color:"#085"},{tag:Te.className,color:"#167"},{tag:[Te.special(Te.variableName),Te.macroName],color:"#256"},{tag:Te.definition(Te.propertyName),color:"#00c"},{tag:Te.comment,color:"#940"},{tag:Te.invalid,color:"#f00"}]),CSe=ct.baseTheme({"&.cm-focused .cm-matchingBracket":{backgroundColor:"#328c8252"},"&.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bb555544"}}),zq=1e4,$q="()[]{}",Fq=pt.define({combine(e){return oo(e,{afterCursor:!0,brackets:$q,maxScanDistance:zq,renderMatch:ESe})}}),jSe=Pt.mark({class:"cm-matchingBracket"}),NSe=Pt.mark({class:"cm-nonmatchingBracket"});function ESe(e){let n=[],r=e.matched?jSe:NSe;return n.push(r.range(e.start.from,e.start.to)),e.end&&n.push(r.range(e.end.from,e.end.to)),n}function d6(e){let n=[],r=e.facet(Fq);for(let i of e.selection.ranges){if(!i.empty)continue;let s=qo(e,i.head,-1,r)||i.head>0&&qo(e,i.head-1,1,r)||r.afterCursor&&(qo(e,i.head,1,r)||i.head<e.doc.length&&qo(e,i.head+1,-1,r));s&&(n=n.concat(r.renderMatch(s,e)))}return Pt.set(n,!0)}const ASe=Cr.fromClass(class{constructor(e){this.paused=!1,this.decorations=d6(e.state)}update(e){(e.docChanged||e.selectionSet||this.paused)&&(e.view.composing?(this.decorations=this.decorations.map(e.changes),this.paused=!0):(this.decorations=d6(e.state),this.paused=!1))}},{decorations:e=>e.decorations}),TSe=[ASe,CSe];function MSe(e={}){return[Fq.of(e),TSe]}const RSe=new cn;function zN(e,n,r){let i=e.prop(n<0?cn.openedBy:cn.closedBy);if(i)return i;if(e.name.length==1){let s=r.indexOf(e.name);if(s>-1&&s%2==(n<0?1:0))return[r[s+n]]}return null}function $N(e){let n=e.type.prop(RSe);return n?n(e.node):e}function qo(e,n,r,i={}){let s=i.maxScanDistance||zq,a=i.brackets||$q,o=Vi(e),l=o.resolveInner(n,r);for(let u=l;u;u=u.parent){let d=zN(u.type,r,a);if(d&&u.from<u.to){let p=$N(u);if(p&&(r>0?n>=p.from&&n<p.to:n>p.from&&n<=p.to))return OSe(e,n,r,u,p,d,a)}}return DSe(e,n,r,o,l.type,s,a)}function OSe(e,n,r,i,s,a,o){let l=i.parent,u={from:s.from,to:s.to},d=0,p=l==null?void 0:l.cursor();if(p&&(r<0?p.childBefore(i.from):p.childAfter(i.to)))do if(r<0?p.to<=i.from:p.from>=i.to){if(d==0&&a.indexOf(p.type.name)>-1&&p.from<p.to){let f=$N(p);return{start:u,end:f?{from:f.from,to:f.to}:void 0,matched:!0}}else if(zN(p.type,r,o))d++;else if(zN(p.type,-r,o)){if(d==0){let f=$N(p);return{start:u,end:f&&f.from<f.to?{from:f.from,to:f.to}:void 0,matched:!1}}d--}}while(r<0?p.prevSibling():p.nextSibling());return{start:u,matched:!1}}function DSe(e,n,r,i,s,a,o){if(r<0?!n:n==e.doc.length)return null;let l=r<0?e.sliceDoc(n-1,n):e.sliceDoc(n,n+1),u=o.indexOf(l);if(u<0||u%2==0!=r>0)return null;let d={from:r<0?n-1:n,to:r>0?n+1:n},p=e.doc.iterRange(n,r>0?e.doc.length:0),f=0;for(let g=0;!p.next().done&&g<=a;){let _=p.value;r<0&&(g+=_.length);let x=n+g*r;for(let v=r>0?0:_.length-1,S=r>0?_.length:-1;v!=S;v+=r){let w=o.indexOf(_[v]);if(!(w<0||i.resolveInner(x+v,1).type!=s))if(w%2==0==r>0)f++;else{if(f==1)return{start:d,end:{from:x+v,to:x+v+1},matched:w>>1==u>>1};f--}}r>0&&(g+=_.length)}return p.done?{start:d,matched:!1}:null}const PSe=Object.create(null),h6=[Os.none],f6=[],p6=Object.create(null),LSe=Object.create(null);for(let[e,n]of[["variable","variableName"],["variable-2","variableName.special"],["string-2","string.special"],["def","variableName.definition"],["tag","tagName"],["attribute","attributeName"],["type","typeName"],["builtin","variableName.standard"],["qualifier","modifier"],["error","invalid"],["header","heading"],["property","propertyName"]])LSe[e]=ISe(PSe,n);function a2(e,n){f6.indexOf(e)>-1||(f6.push(e),console.warn(n))}function ISe(e,n){let r=[];for(let l of n.split(" ")){let u=[];for(let d of l.split(".")){let p=e[d]||Te[d];p?typeof p=="function"?u.length?u=u.map(p):a2(d,`Modifier ${d} used at start of tag`):u.length?a2(d,`Tag ${d} used as modifier`):u=Array.isArray(p)?p:[p]:a2(d,`Unknown highlighting tag ${d}`)}for(let d of u)r.push(d)}if(!r.length)return 0;let i=n.replace(/ /g,"_"),s=i+" "+r.map(l=>l.id),a=p6[s];if(a)return a.id;let o=p6[s]=Os.define({id:h6.length,name:i,props:[kq({[i]:r})]});return h6.push(o),o.id}Jn.RTL,Jn.LTR;const BSe=e=>{let{state:n}=e,r=n.doc.lineAt(n.selection.main.from),i=RT(e.state,r.from);return i.line?zSe(e):i.block?FSe(e):!1};function MT(e,n){return({state:r,dispatch:i})=>{if(r.readOnly)return!1;let s=e(n,r);return s?(i(r.update(s)),!0):!1}}const zSe=MT(qSe,0),$Se=MT(Hq,0),FSe=MT((e,n)=>Hq(e,n,WSe(n)),0);function RT(e,n){let r=e.languageDataAt("commentTokens",n,1);return r.length?r[0]:{}}const wm=50;function HSe(e,{open:n,close:r},i,s){let a=e.sliceDoc(i-wm,i),o=e.sliceDoc(s,s+wm),l=/\s*$/.exec(a)[0].length,u=/^\s*/.exec(o)[0].length,d=a.length-l;if(a.slice(d-n.length,d)==n&&o.slice(u,u+r.length)==r)return{open:{pos:i-l,margin:l&&1},close:{pos:s+u,margin:u&&1}};let p,f;s-i<=2*wm?p=f=e.sliceDoc(i,s):(p=e.sliceDoc(i,i+wm),f=e.sliceDoc(s-wm,s));let g=/^\s*/.exec(p)[0].length,_=/\s*$/.exec(f)[0].length,x=f.length-_-r.length;return p.slice(g,g+n.length)==n&&f.slice(x,x+r.length)==r?{open:{pos:i+g+n.length,margin:/\s/.test(p.charAt(g+n.length))?1:0},close:{pos:s-_-r.length,margin:/\s/.test(f.charAt(x-1))?1:0}}:null}function WSe(e){let n=[];for(let r of e.selection.ranges){let i=e.doc.lineAt(r.from),s=r.to<=i.to?i:e.doc.lineAt(r.to);s.from>i.from&&s.from==r.to&&(s=r.to==i.to+1?i:e.doc.lineAt(r.to-1));let a=n.length-1;a>=0&&n[a].to>i.from?n[a].to=s.to:n.push({from:i.from+/^\s*/.exec(i.text)[0].length,to:s.to})}return n}function Hq(e,n,r=n.selection.ranges){let i=r.map(a=>RT(n,a.from).block);if(!i.every(a=>a))return null;let s=r.map((a,o)=>HSe(n,i[o],a.from,a.to));if(e!=2&&!s.every(a=>a))return{changes:n.changes(r.map((a,o)=>s[o]?[]:[{from:a.from,insert:i[o].open+" "},{from:a.to,insert:" "+i[o].close}]))};if(e!=1&&s.some(a=>a)){let a=[];for(let o=0,l;o<s.length;o++)if(l=s[o]){let u=i[o],{open:d,close:p}=l;a.push({from:d.pos-u.open.length,to:d.pos+d.margin},{from:p.pos-p.margin,to:p.pos+u.close.length})}return{changes:a}}return null}function qSe(e,n,r=n.selection.ranges){let i=[],s=-1;e:for(let{from:a,to:o}of r){let l=i.length,u=1e9,d;for(let p=a;p<=o;){let f=n.doc.lineAt(p);if(d==null&&(d=RT(n,f.from).line,!d))continue e;if(f.from>s&&(a==o||o>f.from)){s=f.from;let g=/^\s*/.exec(f.text)[0].length,_=g==f.length,x=f.text.slice(g,g+d.length)==d?g:-1;g<f.text.length&&g<u&&(u=g),i.push({line:f,comment:x,token:d,indent:g,empty:_,single:!1})}p=f.to+1}if(u<1e9)for(let p=l;p<i.length;p++)i[p].indent<i[p].line.text.length&&(i[p].indent=u);i.length==l+1&&(i[l].single=!0)}if(e!=2&&i.some(a=>a.comment<0&&(!a.empty||a.single))){let a=[];for(let{line:l,token:u,indent:d,empty:p,single:f}of i)(f||!p)&&a.push({from:l.from+d,insert:u+" "});let o=n.changes(a);return{changes:o,selection:n.selection.map(o,1)}}else if(e!=1&&i.some(a=>a.comment>=0)){let a=[];for(let{line:o,comment:l,token:u}of i)if(l>=0){let d=o.from+l,p=d+u.length;o.text[p-o.from]==" "&&p++,a.push({from:d,to:p})}return{changes:a}}return null}const FN=al.define(),USe=al.define(),KSe=pt.define(),Wq=pt.define({combine(e){return oo(e,{minDepth:100,newGroupDelay:500,joinToEvent:(n,r)=>r},{minDepth:Math.max,newGroupDelay:Math.min,joinToEvent:(n,r)=>(i,s)=>n(i,s)||r(i,s)})}}),qq=_i.define({create(){return Uo.empty},update(e,n){let r=n.state.facet(Wq),i=n.annotation(FN);if(i){let u=Es.fromTransaction(n,i.selection),d=i.side,p=d==0?e.undone:e.done;return u?p=Yb(p,p.length,r.minDepth,u):p=Vq(p,n.startState.selection),new Uo(d==0?i.rest:p,d==0?p:i.rest)}let s=n.annotation(USe);if((s=="full"||s=="before")&&(e=e.isolate()),n.annotation(si.addToHistory)===!1)return n.changes.empty?e:e.addMapping(n.changes.desc);let a=Es.fromTransaction(n),o=n.annotation(si.time),l=n.annotation(si.userEvent);return a?e=e.addChanges(a,o,l,r,n):n.selection&&(e=e.addSelection(n.startState.selection,o,l,r.newGroupDelay)),(s=="full"||s=="after")&&(e=e.isolate()),e},toJSON(e){return{done:e.done.map(n=>n.toJSON()),undone:e.undone.map(n=>n.toJSON())}},fromJSON(e){return new Uo(e.done.map(Es.fromJSON),e.undone.map(Es.fromJSON))}});function VSe(e={}){return[qq,Wq.of(e),ct.domEventHandlers({beforeinput(n,r){let i=n.inputType=="historyUndo"?Uq:n.inputType=="historyRedo"?HN:null;return i?(n.preventDefault(),i(r)):!1}})]}function uk(e,n){return function({state:r,dispatch:i}){if(!n&&r.readOnly)return!1;let s=r.field(qq,!1);if(!s)return!1;let a=s.pop(e,r,n);return a?(i(a),!0):!1}}const Uq=uk(0,!1),HN=uk(1,!1),YSe=uk(0,!0),GSe=uk(1,!0);class Es{constructor(n,r,i,s,a){this.changes=n,this.effects=r,this.mapped=i,this.startSelection=s,this.selectionsAfter=a}setSelAfter(n){return new Es(this.changes,this.effects,this.mapped,this.startSelection,n)}toJSON(){var n,r,i;return{changes:(n=this.changes)===null||n===void 0?void 0:n.toJSON(),mapped:(r=this.mapped)===null||r===void 0?void 0:r.toJSON(),startSelection:(i=this.startSelection)===null||i===void 0?void 0:i.toJSON(),selectionsAfter:this.selectionsAfter.map(s=>s.toJSON())}}static fromJSON(n){return new Es(n.changes&&ri.fromJSON(n.changes),[],n.mapped&&Zo.fromJSON(n.mapped),n.startSelection&&Be.fromJSON(n.startSelection),n.selectionsAfter.map(Be.fromJSON))}static fromTransaction(n,r){let i=Aa;for(let s of n.startState.facet(KSe)){let a=s(n);a.length&&(i=i.concat(a))}return!i.length&&n.changes.empty?null:new Es(n.changes.invert(n.startState.doc),i,void 0,r||n.startState.selection,Aa)}static selection(n){return new Es(void 0,Aa,void 0,void 0,n)}}function Yb(e,n,r,i){let s=n+1>r+20?n-r-1:0,a=e.slice(s,n);return a.push(i),a}function XSe(e,n){let r=[],i=!1;return e.iterChangedRanges((s,a)=>r.push(s,a)),n.iterChangedRanges((s,a,o,l)=>{for(let u=0;u<r.length;){let d=r[u++],p=r[u++];l>=d&&o<=p&&(i=!0)}}),i}function QSe(e,n){return e.ranges.length==n.ranges.length&&e.ranges.filter((r,i)=>r.empty!=n.ranges[i].empty).length===0}function Kq(e,n){return e.length?n.length?e.concat(n):e:n}const Aa=[],ZSe=200;function Vq(e,n){if(e.length){let r=e[e.length-1],i=r.selectionsAfter.slice(Math.max(0,r.selectionsAfter.length-ZSe));return i.length&&i[i.length-1].eq(n)?e:(i.push(n),Yb(e,e.length-1,1e9,r.setSelAfter(i)))}else return[Es.selection([n])]}function JSe(e){let n=e[e.length-1],r=e.slice();return r[e.length-1]=n.setSelAfter(n.selectionsAfter.slice(0,n.selectionsAfter.length-1)),r}function o2(e,n){if(!e.length)return e;let r=e.length,i=Aa;for(;r;){let s=e2e(e[r-1],n,i);if(s.changes&&!s.changes.empty||s.effects.length){let a=e.slice(0,r);return a[r-1]=s,a}else n=s.mapped,r--,i=s.selectionsAfter}return i.length?[Es.selection(i)]:Aa}function e2e(e,n,r){let i=Kq(e.selectionsAfter.length?e.selectionsAfter.map(l=>l.map(n)):Aa,r);if(!e.changes)return Es.selection(i);let s=e.changes.map(n),a=n.mapDesc(e.changes,!0),o=e.mapped?e.mapped.composeDesc(a):a;return new Es(s,Gt.mapEffects(e.effects,n),o,e.startSelection.map(a),i)}const t2e=/^(input\.type|delete)($|\.)/;class Uo{constructor(n,r,i=0,s=void 0){this.done=n,this.undone=r,this.prevTime=i,this.prevUserEvent=s}isolate(){return this.prevTime?new Uo(this.done,this.undone):this}addChanges(n,r,i,s,a){let o=this.done,l=o[o.length-1];return l&&l.changes&&!l.changes.empty&&n.changes&&(!i||t2e.test(i))&&(!l.selectionsAfter.length&&r-this.prevTime<s.newGroupDelay&&s.joinToEvent(a,XSe(l.changes,n.changes))||i=="input.type.compose")?o=Yb(o,o.length-1,s.minDepth,new Es(n.changes.compose(l.changes),Kq(Gt.mapEffects(n.effects,l.changes),l.effects),l.mapped,l.startSelection,Aa)):o=Yb(o,o.length,s.minDepth,n),new Uo(o,Aa,r,i)}addSelection(n,r,i,s){let a=this.done.length?this.done[this.done.length-1].selectionsAfter:Aa;return a.length>0&&r-this.prevTime<s&&i==this.prevUserEvent&&i&&/^select($|\.)/.test(i)&&QSe(a[a.length-1],n)?this:new Uo(Vq(this.done,n),this.undone,r,i)}addMapping(n){return new Uo(o2(this.done,n),o2(this.undone,n),this.prevTime,this.prevUserEvent)}pop(n,r,i){let s=n==0?this.done:this.undone;if(s.length==0)return null;let a=s[s.length-1],o=a.selectionsAfter[0]||(a.startSelection?a.startSelection.map(a.changes.invertedDesc,1):r.selection);if(i&&a.selectionsAfter.length)return r.update({selection:a.selectionsAfter[a.selectionsAfter.length-1],annotations:FN.of({side:n,rest:JSe(s),selection:o}),userEvent:n==0?"select.undo":"select.redo",scrollIntoView:!0});if(a.changes){let l=s.length==1?Aa:s.slice(0,s.length-1);return a.mapped&&(l=o2(l,a.mapped)),r.update({changes:a.changes,selection:a.startSelection,effects:a.effects,annotations:FN.of({side:n,rest:l,selection:o}),filter:!1,userEvent:n==0?"undo":"redo",scrollIntoView:!0})}else return null}}Uo.empty=new Uo(Aa,Aa);const n2e=[{key:"Mod-z",run:Uq,preventDefault:!0},{key:"Mod-y",mac:"Mod-Shift-z",run:HN,preventDefault:!0},{linux:"Ctrl-Shift-z",run:HN,preventDefault:!0},{key:"Mod-u",run:YSe,preventDefault:!0},{key:"Alt-u",mac:"Mod-Shift-u",run:GSe,preventDefault:!0}];function pp(e,n){return Be.create(e.ranges.map(n),e.mainIndex)}function lo(e,n){return e.update({selection:n,scrollIntoView:!0,userEvent:"select"})}function co({state:e,dispatch:n},r){let i=pp(e.selection,r);return i.eq(e.selection,!0)?!1:(n(lo(e,i)),!0)}function dk(e,n){return Be.cursor(n?e.to:e.from)}function Yq(e,n){return co(e,r=>r.empty?e.moveByChar(r,n):dk(r,n))}function Xi(e){return e.textDirectionAt(e.state.selection.main.head)==Jn.LTR}const Gq=e=>Yq(e,!Xi(e)),Xq=e=>Yq(e,Xi(e));function Qq(e,n){return co(e,r=>r.empty?e.moveByGroup(r,n):dk(r,n))}const r2e=e=>Qq(e,!Xi(e)),i2e=e=>Qq(e,Xi(e));function s2e(e,n,r){if(n.type.prop(r))return!0;let i=n.to-n.from;return i&&(i>2||/[^\s,.;:]/.test(e.sliceDoc(n.from,n.to)))||n.firstChild}function hk(e,n,r){let i=Vi(e).resolveInner(n.head),s=r?cn.closedBy:cn.openedBy;for(let u=n.head;;){let d=r?i.childAfter(u):i.childBefore(u);if(!d)break;s2e(e,d,s)?i=d:u=r?d.to:d.from}let a=i.type.prop(s),o,l;return a&&(o=r?qo(e,i.from,1):qo(e,i.to,-1))&&o.matched?l=r?o.end.to:o.end.from:l=r?i.to:i.from,Be.cursor(l,r?-1:1)}const a2e=e=>co(e,n=>hk(e.state,n,!Xi(e))),o2e=e=>co(e,n=>hk(e.state,n,Xi(e)));function Zq(e,n){return co(e,r=>{if(!r.empty)return dk(r,n);let i=e.moveVertically(r,n);return i.head!=r.head?i:e.moveToLineBoundary(r,n)})}const Jq=e=>Zq(e,!1),eU=e=>Zq(e,!0);function tU(e){let n=e.scrollDOM.clientHeight<e.scrollDOM.scrollHeight-2,r=0,i=0,s;if(n){for(let a of e.state.facet(ct.scrollMargins)){let o=a(e);o!=null&&o.top&&(r=Math.max(o==null?void 0:o.top,r)),o!=null&&o.bottom&&(i=Math.max(o==null?void 0:o.bottom,i))}s=e.scrollDOM.clientHeight-r-i}else s=(e.dom.ownerDocument.defaultView||window).innerHeight;return{marginTop:r,marginBottom:i,selfScroll:n,height:Math.max(e.defaultLineHeight,s-5)}}function nU(e,n){let r=tU(e),{state:i}=e,s=pp(i.selection,o=>o.empty?e.moveVertically(o,n,r.height):dk(o,n));if(s.eq(i.selection))return!1;let a;if(r.selfScroll){let o=e.coordsAtPos(i.selection.main.head),l=e.scrollDOM.getBoundingClientRect(),u=l.top+r.marginTop,d=l.bottom-r.marginBottom;o&&o.top>u&&o.bottom<d&&(a=ct.scrollIntoView(s.main.head,{y:"start",yMargin:o.top-u}))}return e.dispatch(lo(i,s),{effects:a}),!0}const m6=e=>nU(e,!1),WN=e=>nU(e,!0);function Cu(e,n,r){let i=e.lineBlockAt(n.head),s=e.moveToLineBoundary(n,r);if(s.head==n.head&&s.head!=(r?i.to:i.from)&&(s=e.moveToLineBoundary(n,r,!1)),!r&&s.head==i.from&&i.length){let a=/^\s*/.exec(e.state.sliceDoc(i.from,Math.min(i.from+100,i.to)))[0].length;a&&n.head!=i.from+a&&(s=Be.cursor(i.from+a))}return s}const l2e=e=>co(e,n=>Cu(e,n,!0)),c2e=e=>co(e,n=>Cu(e,n,!1)),u2e=e=>co(e,n=>Cu(e,n,!Xi(e))),d2e=e=>co(e,n=>Cu(e,n,Xi(e))),h2e=e=>co(e,n=>Be.cursor(e.lineBlockAt(n.head).from,1)),f2e=e=>co(e,n=>Be.cursor(e.lineBlockAt(n.head).to,-1));function p2e(e,n,r){let i=!1,s=pp(e.selection,a=>{let o=qo(e,a.head,-1)||qo(e,a.head,1)||a.head>0&&qo(e,a.head-1,1)||a.head<e.doc.length&&qo(e,a.head+1,-1);if(!o||!o.end)return a;i=!0;let l=o.start.from==a.head?o.end.to:o.end.from;return Be.cursor(l)});return i?(n(lo(e,s)),!0):!1}const m2e=({state:e,dispatch:n})=>p2e(e,n);function La(e,n){let r=pp(e.state.selection,i=>{let s=n(i);return Be.range(i.anchor,s.head,s.goalColumn,s.bidiLevel||void 0,s.assoc)});return r.eq(e.state.selection)?!1:(e.dispatch(lo(e.state,r)),!0)}function rU(e,n){return La(e,r=>e.moveByChar(r,n))}const iU=e=>rU(e,!Xi(e)),sU=e=>rU(e,Xi(e));function aU(e,n){return La(e,r=>e.moveByGroup(r,n))}const g2e=e=>aU(e,!Xi(e)),v2e=e=>aU(e,Xi(e)),y2e=e=>La(e,n=>hk(e.state,n,!Xi(e))),_2e=e=>La(e,n=>hk(e.state,n,Xi(e)));function oU(e,n){return La(e,r=>e.moveVertically(r,n))}const lU=e=>oU(e,!1),cU=e=>oU(e,!0);function uU(e,n){return La(e,r=>e.moveVertically(r,n,tU(e).height))}const g6=e=>uU(e,!1),v6=e=>uU(e,!0),x2e=e=>La(e,n=>Cu(e,n,!0)),b2e=e=>La(e,n=>Cu(e,n,!1)),k2e=e=>La(e,n=>Cu(e,n,!Xi(e))),w2e=e=>La(e,n=>Cu(e,n,Xi(e))),S2e=e=>La(e,n=>Be.cursor(e.lineBlockAt(n.head).from)),C2e=e=>La(e,n=>Be.cursor(e.lineBlockAt(n.head).to)),y6=({state:e,dispatch:n})=>(n(lo(e,{anchor:0})),!0),_6=({state:e,dispatch:n})=>(n(lo(e,{anchor:e.doc.length})),!0),x6=({state:e,dispatch:n})=>(n(lo(e,{anchor:e.selection.main.anchor,head:0})),!0),b6=({state:e,dispatch:n})=>(n(lo(e,{anchor:e.selection.main.anchor,head:e.doc.length})),!0),j2e=({state:e,dispatch:n})=>(n(e.update({selection:{anchor:0,head:e.doc.length},userEvent:"select"})),!0),N2e=({state:e,dispatch:n})=>{let r=fk(e).map(({from:i,to:s})=>Be.range(i,Math.min(s+1,e.doc.length)));return n(e.update({selection:Be.create(r),userEvent:"select"})),!0},E2e=({state:e,dispatch:n})=>{let r=pp(e.selection,i=>{let s=Vi(e),a=s.resolveStack(i.from,1);if(i.empty){let o=s.resolveStack(i.from,-1);o.node.from>=a.node.from&&o.node.to<=a.node.to&&(a=o)}for(let o=a;o;o=o.next){let{node:l}=o;if((l.from<i.from&&l.to>=i.to||l.to>i.to&&l.from<=i.from)&&o.next)return Be.range(l.to,l.from)}return i});return r.eq(e.selection)?!1:(n(lo(e,r)),!0)};function dU(e,n){let{state:r}=e,i=r.selection,s=r.selection.ranges.slice();for(let a of r.selection.ranges){let o=r.doc.lineAt(a.head);if(n?o.to<e.state.doc.length:o.from>0)for(let l=a;;){let u=e.moveVertically(l,n);if(u.head<o.from||u.head>o.to){s.some(d=>d.head==u.head)||s.push(u);break}else{if(u.head==l.head)break;l=u}}}return s.length==i.ranges.length?!1:(e.dispatch(lo(r,Be.create(s,s.length-1))),!0)}const A2e=e=>dU(e,!1),T2e=e=>dU(e,!0),M2e=({state:e,dispatch:n})=>{let r=e.selection,i=null;return r.ranges.length>1?i=Be.create([r.main]):r.main.empty||(i=Be.create([Be.cursor(r.main.head)])),i?(n(lo(e,i)),!0):!1};function Yv(e,n){if(e.state.readOnly)return!1;let r="delete.selection",{state:i}=e,s=i.changeByRange(a=>{let{from:o,to:l}=a;if(o==l){let u=n(a);u<o?(r="delete.backward",u=K_(e,u,!1)):u>o&&(r="delete.forward",u=K_(e,u,!0)),o=Math.min(o,u),l=Math.max(l,u)}else o=K_(e,o,!1),l=K_(e,l,!0);return o==l?{range:a}:{changes:{from:o,to:l},range:Be.cursor(o,o<a.head?-1:1)}});return s.changes.empty?!1:(e.dispatch(i.update(s,{scrollIntoView:!0,userEvent:r,effects:r=="delete.selection"?ct.announce.of(i.phrase("Selection deleted")):void 0})),!0)}function K_(e,n,r){if(e instanceof ct)for(let i of e.state.facet(ct.atomicRanges).map(s=>s(e)))i.between(n,n,(s,a)=>{s<n&&a>n&&(n=r?a:s)});return n}const hU=(e,n,r)=>Yv(e,i=>{let s=i.from,{state:a}=e,o=a.doc.lineAt(s),l,u;if(r&&!n&&s>o.from&&s<o.from+200&&!/[^ \t]/.test(l=o.text.slice(0,s-o.from))){if(l[l.length-1]=="	")return s-1;let d=fp(l,a.tabSize),p=d%Ub(a)||Ub(a);for(let f=0;f<p&&l[l.length-1-f]==" ";f++)s--;u=s}else u=gi(o.text,s-o.from,n,n)+o.from,u==s&&o.number!=(n?a.doc.lines:1)?u+=n?1:-1:!n&&/[\ufe00-\ufe0f]/.test(o.text.slice(u-o.from,s-o.from))&&(u=gi(o.text,u-o.from,!1,!1)+o.from);return u}),qN=e=>hU(e,!1,!0),fU=e=>hU(e,!0,!1),pU=(e,n)=>Yv(e,r=>{let i=r.head,{state:s}=e,a=s.doc.lineAt(i),o=s.charCategorizer(i);for(let l=null;;){if(i==(n?a.to:a.from)){i==r.head&&a.number!=(n?s.doc.lines:1)&&(i+=n?1:-1);break}let u=gi(a.text,i-a.from,n)+a.from,d=a.text.slice(Math.min(i,u)-a.from,Math.max(i,u)-a.from),p=o(d);if(l!=null&&p!=l)break;(d!=" "||i!=r.head)&&(l=p),i=u}return i}),mU=e=>pU(e,!1),R2e=e=>pU(e,!0),O2e=e=>Yv(e,n=>{let r=e.lineBlockAt(n.head).to;return n.head<r?r:Math.min(e.state.doc.length,n.head+1)}),D2e=e=>Yv(e,n=>{let r=e.moveToLineBoundary(n,!1).head;return n.head>r?r:Math.max(0,n.head-1)}),P2e=e=>Yv(e,n=>{let r=e.moveToLineBoundary(n,!0).head;return n.head<r?r:Math.min(e.state.doc.length,n.head+1)}),L2e=({state:e,dispatch:n})=>{if(e.readOnly)return!1;let r=e.changeByRange(i=>({changes:{from:i.from,to:i.to,insert:Dn.of(["",""])},range:Be.cursor(i.from)}));return n(e.update(r,{scrollIntoView:!0,userEvent:"input"})),!0},I2e=({state:e,dispatch:n})=>{if(e.readOnly)return!1;let r=e.changeByRange(i=>{if(!i.empty||i.from==0||i.from==e.doc.length)return{range:i};let s=i.from,a=e.doc.lineAt(s),o=s==a.from?s-1:gi(a.text,s-a.from,!1)+a.from,l=s==a.to?s+1:gi(a.text,s-a.from,!0)+a.from;return{changes:{from:o,to:l,insert:e.doc.slice(s,l).append(e.doc.slice(o,s))},range:Be.cursor(l)}});return r.changes.empty?!1:(n(e.update(r,{scrollIntoView:!0,userEvent:"move.character"})),!0)};function fk(e){let n=[],r=-1;for(let i of e.selection.ranges){let s=e.doc.lineAt(i.from),a=e.doc.lineAt(i.to);if(!i.empty&&i.to==a.from&&(a=e.doc.lineAt(i.to-1)),r>=s.number){let o=n[n.length-1];o.to=a.to,o.ranges.push(i)}else n.push({from:s.from,to:a.to,ranges:[i]});r=a.number+1}return n}function gU(e,n,r){if(e.readOnly)return!1;let i=[],s=[];for(let a of fk(e)){if(r?a.to==e.doc.length:a.from==0)continue;let o=e.doc.lineAt(r?a.to+1:a.from-1),l=o.length+1;if(r){i.push({from:a.to,to:o.to},{from:a.from,insert:o.text+e.lineBreak});for(let u of a.ranges)s.push(Be.range(Math.min(e.doc.length,u.anchor+l),Math.min(e.doc.length,u.head+l)))}else{i.push({from:o.from,to:a.from},{from:a.to,insert:e.lineBreak+o.text});for(let u of a.ranges)s.push(Be.range(u.anchor-l,u.head-l))}}return i.length?(n(e.update({changes:i,scrollIntoView:!0,selection:Be.create(s,e.selection.mainIndex),userEvent:"move.line"})),!0):!1}const B2e=({state:e,dispatch:n})=>gU(e,n,!1),z2e=({state:e,dispatch:n})=>gU(e,n,!0);function vU(e,n,r){if(e.readOnly)return!1;let i=[];for(let a of fk(e))r?i.push({from:a.from,insert:e.doc.slice(a.from,a.to)+e.lineBreak}):i.push({from:a.to,insert:e.lineBreak+e.doc.slice(a.from,a.to)});let s=e.changes(i);return n(e.update({changes:s,selection:e.selection.map(s,r?1:-1),scrollIntoView:!0,userEvent:"input.copyline"})),!0}const $2e=({state:e,dispatch:n})=>vU(e,n,!1),F2e=({state:e,dispatch:n})=>vU(e,n,!0),H2e=e=>{if(e.state.readOnly)return!1;let{state:n}=e,r=n.changes(fk(n).map(({from:s,to:a})=>(s>0?s--:a<n.doc.length&&a++,{from:s,to:a}))),i=pp(n.selection,s=>{let a;if(e.lineWrapping){let o=e.lineBlockAt(s.head),l=e.coordsAtPos(s.head,s.assoc||1);l&&(a=o.bottom+e.documentTop-l.bottom+e.defaultLineHeight/2)}return e.moveVertically(s,!0,a)}).map(r);return e.dispatch({changes:r,selection:i,scrollIntoView:!0,userEvent:"delete.line"}),!0};function W2e(e,n){if(/\(\)|\[\]|\{\}/.test(e.sliceDoc(n-1,n+1)))return{from:n,to:n};let r=Vi(e).resolveInner(n),i=r.childBefore(n),s=r.childAfter(n),a;return i&&s&&i.to<=n&&s.from>=n&&(a=i.type.prop(cn.closedBy))&&a.indexOf(s.name)>-1&&e.doc.lineAt(i.to).from==e.doc.lineAt(s.from).from&&!/\S/.test(e.sliceDoc(i.to,s.from))?{from:i.to,to:s.from}:null}const k6=yU(!1),q2e=yU(!0);function yU(e){return({state:n,dispatch:r})=>{if(n.readOnly)return!1;let i=n.changeByRange(s=>{let{from:a,to:o}=s,l=n.doc.lineAt(a),u=!e&&a==o&&W2e(n,a);e&&(a=o=(o<=l.to?l:n.doc.lineAt(o)).to);let d=new lk(n,{simulateBreak:a,simulateDoubleBreak:!!u}),p=AT(d,a);for(p==null&&(p=fp(/^\s*/.exec(n.doc.lineAt(a).text)[0],n.tabSize));o<l.to&&/\s/.test(l.text[o-l.from]);)o++;u?{from:a,to:o}=u:a>l.from&&a<l.from+100&&!/\S/.test(l.text.slice(0,a))&&(a=l.from);let f=["",sv(n,p)];return u&&f.push(sv(n,d.lineIndent(l.from,-1))),{changes:{from:a,to:o,insert:Dn.of(f)},range:Be.cursor(a+1+f[1].length)}});return r(n.update(i,{scrollIntoView:!0,userEvent:"input"})),!0}}function OT(e,n){let r=-1;return e.changeByRange(i=>{let s=[];for(let o=i.from;o<=i.to;){let l=e.doc.lineAt(o);l.number>r&&(i.empty||i.to>l.from)&&(n(l,s,i),r=l.number),o=l.to+1}let a=e.changes(s);return{changes:s,range:Be.range(a.mapPos(i.anchor,1),a.mapPos(i.head,1))}})}const U2e=({state:e,dispatch:n})=>{if(e.readOnly)return!1;let r=Object.create(null),i=new lk(e,{overrideIndentation:a=>{let o=r[a];return o??-1}}),s=OT(e,(a,o,l)=>{let u=AT(i,a.from);if(u==null)return;/\S/.test(a.text)||(u=0);let d=/^\s*/.exec(a.text)[0],p=sv(e,u);(d!=p||l.from<a.from+d.length)&&(r[a.from]=u,o.push({from:a.from,to:a.from+d.length,insert:p}))});return s.changes.empty||n(e.update(s,{userEvent:"indent"})),!0},_U=({state:e,dispatch:n})=>e.readOnly?!1:(n(e.update(OT(e,(r,i)=>{i.push({from:r.from,insert:e.facet(ok)})}),{userEvent:"input.indent"})),!0),xU=({state:e,dispatch:n})=>e.readOnly?!1:(n(e.update(OT(e,(r,i)=>{let s=/^\s*/.exec(r.text)[0];if(!s)return;let a=fp(s,e.tabSize),o=0,l=sv(e,Math.max(0,a-Ub(e)));for(;o<s.length&&o<l.length&&s.charCodeAt(o)==l.charCodeAt(o);)o++;i.push({from:r.from+o,to:r.from+s.length,insert:l.slice(o)})}),{userEvent:"delete.dedent"})),!0),K2e=e=>(e.setTabFocusMode(),!0),V2e=[{key:"Ctrl-b",run:Gq,shift:iU,preventDefault:!0},{key:"Ctrl-f",run:Xq,shift:sU},{key:"Ctrl-p",run:Jq,shift:lU},{key:"Ctrl-n",run:eU,shift:cU},{key:"Ctrl-a",run:h2e,shift:S2e},{key:"Ctrl-e",run:f2e,shift:C2e},{key:"Ctrl-d",run:fU},{key:"Ctrl-h",run:qN},{key:"Ctrl-k",run:O2e},{key:"Ctrl-Alt-h",run:mU},{key:"Ctrl-o",run:L2e},{key:"Ctrl-t",run:I2e},{key:"Ctrl-v",run:WN}],Y2e=[{key:"ArrowLeft",run:Gq,shift:iU,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:r2e,shift:g2e,preventDefault:!0},{mac:"Cmd-ArrowLeft",run:u2e,shift:k2e,preventDefault:!0},{key:"ArrowRight",run:Xq,shift:sU,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:i2e,shift:v2e,preventDefault:!0},{mac:"Cmd-ArrowRight",run:d2e,shift:w2e,preventDefault:!0},{key:"ArrowUp",run:Jq,shift:lU,preventDefault:!0},{mac:"Cmd-ArrowUp",run:y6,shift:x6},{mac:"Ctrl-ArrowUp",run:m6,shift:g6},{key:"ArrowDown",run:eU,shift:cU,preventDefault:!0},{mac:"Cmd-ArrowDown",run:_6,shift:b6},{mac:"Ctrl-ArrowDown",run:WN,shift:v6},{key:"PageUp",run:m6,shift:g6},{key:"PageDown",run:WN,shift:v6},{key:"Home",run:c2e,shift:b2e,preventDefault:!0},{key:"Mod-Home",run:y6,shift:x6},{key:"End",run:l2e,shift:x2e,preventDefault:!0},{key:"Mod-End",run:_6,shift:b6},{key:"Enter",run:k6,shift:k6},{key:"Mod-a",run:j2e},{key:"Backspace",run:qN,shift:qN,preventDefault:!0},{key:"Delete",run:fU,preventDefault:!0},{key:"Mod-Backspace",mac:"Alt-Backspace",run:mU,preventDefault:!0},{key:"Mod-Delete",mac:"Alt-Delete",run:R2e,preventDefault:!0},{mac:"Mod-Backspace",run:D2e,preventDefault:!0},{mac:"Mod-Delete",run:P2e,preventDefault:!0}].concat(V2e.map(e=>({mac:e.key,run:e.run,shift:e.shift}))),G2e=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:a2e,shift:y2e},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:o2e,shift:_2e},{key:"Alt-ArrowUp",run:B2e},{key:"Shift-Alt-ArrowUp",run:$2e},{key:"Alt-ArrowDown",run:z2e},{key:"Shift-Alt-ArrowDown",run:F2e},{key:"Mod-Alt-ArrowUp",run:A2e},{key:"Mod-Alt-ArrowDown",run:T2e},{key:"Escape",run:M2e},{key:"Mod-Enter",run:q2e},{key:"Alt-l",mac:"Ctrl-l",run:N2e},{key:"Mod-i",run:E2e,preventDefault:!0},{key:"Mod-[",run:xU},{key:"Mod-]",run:_U},{key:"Mod-Alt-\\",run:U2e},{key:"Shift-Mod-k",run:H2e},{key:"Shift-Mod-\\",run:m2e},{key:"Mod-/",run:BSe},{key:"Alt-A",run:$Se},{key:"Ctrl-m",mac:"Shift-Alt-m",run:K2e}].concat(Y2e),X2e={key:"Tab",run:_U,shift:xU},w6=typeof String.prototype.normalize=="function"?e=>e.normalize("NFKD"):e=>e;class ep{constructor(n,r,i=0,s=n.length,a,o){this.test=o,this.value={from:0,to:0},this.done=!1,this.matches=[],this.buffer="",this.bufferPos=0,this.iter=n.iterRange(i,s),this.bufferStart=i,this.normalize=a?l=>a(w6(l)):w6,this.query=this.normalize(r)}peek(){if(this.bufferPos==this.buffer.length){if(this.bufferStart+=this.buffer.length,this.iter.next(),this.iter.done)return-1;this.bufferPos=0,this.buffer=this.iter.value}return ks(this.buffer,this.bufferPos)}next(){for(;this.matches.length;)this.matches.pop();return this.nextOverlapping()}nextOverlapping(){for(;;){let n=this.peek();if(n<0)return this.done=!0,this;let r=oT(n),i=this.bufferStart+this.bufferPos;this.bufferPos+=Bo(n);let s=this.normalize(r);if(s.length)for(let a=0,o=i;;a++){let l=s.charCodeAt(a),u=this.match(l,o,this.bufferPos+this.bufferStart);if(a==s.length-1){if(u)return this.value=u,this;break}o==i&&a<r.length&&r.charCodeAt(a)==l&&o++}}}match(n,r,i){let s=null;for(let a=0;a<this.matches.length;a+=2){let o=this.matches[a],l=!1;this.query.charCodeAt(o)==n&&(o==this.query.length-1?s={from:this.matches[a+1],to:i}:(this.matches[a]++,l=!0)),l||(this.matches.splice(a,2),a-=2)}return this.query.charCodeAt(0)==n&&(this.query.length==1?s={from:r,to:i}:this.matches.push(1,r)),s&&this.test&&!this.test(s.from,s.to,this.buffer,this.bufferStart)&&(s=null),s}}typeof Symbol<"u"&&(ep.prototype[Symbol.iterator]=function(){return this});const bU={from:-1,to:-1,match:/.*/.exec("")},DT="gm"+(/x/.unicode==null?"":"u");class kU{constructor(n,r,i,s=0,a=n.length){if(this.text=n,this.to=a,this.curLine="",this.done=!1,this.value=bU,/\\[sWDnr]|\n|\r|\[\^/.test(r))return new wU(n,r,i,s,a);this.re=new RegExp(r,DT+(i!=null&&i.ignoreCase?"i":"")),this.test=i==null?void 0:i.test,this.iter=n.iter();let o=n.lineAt(s);this.curLineStart=o.from,this.matchPos=Gb(n,s),this.getLine(this.curLineStart)}getLine(n){this.iter.next(n),this.iter.lineBreak?this.curLine="":(this.curLine=this.iter.value,this.curLineStart+this.curLine.length>this.to&&(this.curLine=this.curLine.slice(0,this.to-this.curLineStart)),this.iter.next())}nextLine(){this.curLineStart=this.curLineStart+this.curLine.length+1,this.curLineStart>this.to?this.curLine="":this.getLine(0)}next(){for(let n=this.matchPos-this.curLineStart;;){this.re.lastIndex=n;let r=this.matchPos<=this.to&&this.re.exec(this.curLine);if(r){let i=this.curLineStart+r.index,s=i+r[0].length;if(this.matchPos=Gb(this.text,s+(i==s?1:0)),i==this.curLineStart+this.curLine.length&&this.nextLine(),(i<s||i>this.value.to)&&(!this.test||this.test(i,s,r)))return this.value={from:i,to:s,match:r},this;n=this.matchPos-this.curLineStart}else if(this.curLineStart+this.curLine.length<this.to)this.nextLine(),n=0;else return this.done=!0,this}}}const l2=new WeakMap;class Ef{constructor(n,r){this.from=n,this.text=r}get to(){return this.from+this.text.length}static get(n,r,i){let s=l2.get(n);if(!s||s.from>=i||s.to<=r){let l=new Ef(r,n.sliceString(r,i));return l2.set(n,l),l}if(s.from==r&&s.to==i)return s;let{text:a,from:o}=s;return o>r&&(a=n.sliceString(r,o)+a,o=r),s.to<i&&(a+=n.sliceString(s.to,i)),l2.set(n,new Ef(o,a)),new Ef(r,a.slice(r-o,i-o))}}class wU{constructor(n,r,i,s,a){this.text=n,this.to=a,this.done=!1,this.value=bU,this.matchPos=Gb(n,s),this.re=new RegExp(r,DT+(i!=null&&i.ignoreCase?"i":"")),this.test=i==null?void 0:i.test,this.flat=Ef.get(n,s,this.chunkEnd(s+5e3))}chunkEnd(n){return n>=this.to?this.to:this.text.lineAt(n).to}next(){for(;;){let n=this.re.lastIndex=this.matchPos-this.flat.from,r=this.re.exec(this.flat.text);if(r&&!r[0]&&r.index==n&&(this.re.lastIndex=n+1,r=this.re.exec(this.flat.text)),r){let i=this.flat.from+r.index,s=i+r[0].length;if((this.flat.to>=this.to||r.index+r[0].length<=this.flat.text.length-10)&&(!this.test||this.test(i,s,r)))return this.value={from:i,to:s,match:r},this.matchPos=Gb(this.text,s+(i==s?1:0)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=Ef.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+this.flat.text.length*2))}}}typeof Symbol<"u"&&(kU.prototype[Symbol.iterator]=wU.prototype[Symbol.iterator]=function(){return this});function Q2e(e){try{return new RegExp(e,DT),!0}catch{return!1}}function Gb(e,n){if(n>=e.length)return n;let r=e.lineAt(n),i;for(;n<r.to&&(i=r.text.charCodeAt(n-r.from))>=56320&&i<57344;)n++;return n}const Z2e=e=>{let{state:n}=e,r=String(n.doc.lineAt(e.state.selection.main.head).number),{close:i,result:s}=ywe(e,{label:n.phrase("Go to line"),input:{type:"text",name:"line",value:r},focus:!0,submitLabel:n.phrase("go")});return s.then(a=>{let o=a&&/^([+-])?(\d+)?(:\d+)?(%)?$/.exec(a.elements.line.value);if(!o){e.dispatch({effects:i});return}let l=n.doc.lineAt(n.selection.main.head),[,u,d,p,f]=o,g=p?+p.slice(1):0,_=d?+d:l.number;if(d&&f){let S=_/100;u&&(S=S*(u=="-"?-1:1)+l.number/n.doc.lines),_=Math.round(n.doc.lines*S)}else d&&u&&(_=_*(u=="-"?-1:1)+l.number);let x=n.doc.line(Math.max(1,Math.min(n.doc.lines,_))),v=Be.cursor(x.from+Math.max(0,Math.min(g,x.length)));e.dispatch({effects:[i,ct.scrollIntoView(v.from,{y:"center"})],selection:v})}),!0},J2e={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},eCe=pt.define({combine(e){return oo(e,J2e,{highlightWordAroundCursor:(n,r)=>n||r,minSelectionLength:Math.min,maxMatches:Math.min})}});function tCe(e){return[aCe,sCe]}const nCe=Pt.mark({class:"cm-selectionMatch"}),rCe=Pt.mark({class:"cm-selectionMatch cm-selectionMatch-main"});function S6(e,n,r,i){return(r==0||e(n.sliceDoc(r-1,r))!=yr.Word)&&(i==n.doc.length||e(n.sliceDoc(i,i+1))!=yr.Word)}function iCe(e,n,r,i){return e(n.sliceDoc(r,r+1))==yr.Word&&e(n.sliceDoc(i-1,i))==yr.Word}const sCe=Cr.fromClass(class{constructor(e){this.decorations=this.getDeco(e)}update(e){(e.selectionSet||e.docChanged||e.viewportChanged)&&(this.decorations=this.getDeco(e.view))}getDeco(e){let n=e.state.facet(eCe),{state:r}=e,i=r.selection;if(i.ranges.length>1)return Pt.none;let s=i.main,a,o=null;if(s.empty){if(!n.highlightWordAroundCursor)return Pt.none;let u=r.wordAt(s.head);if(!u)return Pt.none;o=r.charCategorizer(s.head),a=r.sliceDoc(u.from,u.to)}else{let u=s.to-s.from;if(u<n.minSelectionLength||u>200)return Pt.none;if(n.wholeWords){if(a=r.sliceDoc(s.from,s.to),o=r.charCategorizer(s.head),!(S6(o,r,s.from,s.to)&&iCe(o,r,s.from,s.to)))return Pt.none}else if(a=r.sliceDoc(s.from,s.to),!a)return Pt.none}let l=[];for(let u of e.visibleRanges){let d=new ep(r.doc,a,u.from,u.to);for(;!d.next().done;){let{from:p,to:f}=d.value;if((!o||S6(o,r,p,f))&&(s.empty&&p<=s.from&&f>=s.to?l.push(rCe.range(p,f)):(p>=s.to||f<=s.from)&&l.push(nCe.range(p,f)),l.length>n.maxMatches))return Pt.none}}return Pt.set(l)}},{decorations:e=>e.decorations}),aCe=ct.baseTheme({".cm-selectionMatch":{backgroundColor:"#99ff7780"},".cm-searchMatch .cm-selectionMatch":{backgroundColor:"transparent"}}),oCe=({state:e,dispatch:n})=>{let{selection:r}=e,i=Be.create(r.ranges.map(s=>e.wordAt(s.head)||Be.cursor(s.head)),r.mainIndex);return i.eq(r)?!1:(n(e.update({selection:i})),!0)};function lCe(e,n){let{main:r,ranges:i}=e.selection,s=e.wordAt(r.head),a=s&&s.from==r.from&&s.to==r.to;for(let o=!1,l=new ep(e.doc,n,i[i.length-1].to);;)if(l.next(),l.done){if(o)return null;l=new ep(e.doc,n,0,Math.max(0,i[i.length-1].from-1)),o=!0}else{if(o&&i.some(u=>u.from==l.value.from))continue;if(a){let u=e.wordAt(l.value.from);if(!u||u.from!=l.value.from||u.to!=l.value.to)continue}return l.value}}const cCe=({state:e,dispatch:n})=>{let{ranges:r}=e.selection;if(r.some(a=>a.from===a.to))return oCe({state:e,dispatch:n});let i=e.sliceDoc(r[0].from,r[0].to);if(e.selection.ranges.some(a=>e.sliceDoc(a.from,a.to)!=i))return!1;let s=lCe(e,i);return s?(n(e.update({selection:e.selection.addRange(Be.range(s.from,s.to),!1),effects:ct.scrollIntoView(s.to)})),!0):!1},mp=pt.define({combine(e){return oo(e,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:n=>new wCe(n),scrollToMatch:n=>ct.scrollIntoView(n)})}});class SU{constructor(n){this.search=n.search,this.caseSensitive=!!n.caseSensitive,this.literal=!!n.literal,this.regexp=!!n.regexp,this.replace=n.replace||"",this.valid=!!this.search&&(!this.regexp||Q2e(this.search)),this.unquoted=this.unquote(this.search),this.wholeWord=!!n.wholeWord,this.test=n.test}unquote(n){return this.literal?n:n.replace(/\\([nrt\\])/g,(r,i)=>i=="n"?`
`:i=="r"?"\r":i=="t"?"	":"\\")}eq(n){return this.search==n.search&&this.replace==n.replace&&this.caseSensitive==n.caseSensitive&&this.regexp==n.regexp&&this.wholeWord==n.wholeWord&&this.test==n.test}create(){return this.regexp?new mCe(this):new hCe(this)}getCursor(n,r=0,i){let s=n.doc?n:yn.create({doc:n});return i==null&&(i=s.doc.length),this.regexp?Jh(this,s,r,i):Zh(this,s,r,i)}}class CU{constructor(n){this.spec=n}}function uCe(e,n,r){return(i,s,a,o)=>{if(r&&!r(i,s,a,o))return!1;let l=i>=o&&s<=o+a.length?a.slice(i-o,s-o):n.doc.sliceString(i,s);return e(l,n,i,s)}}function Zh(e,n,r,i){let s;return e.wholeWord&&(s=dCe(n.doc,n.charCategorizer(n.selection.main.head))),e.test&&(s=uCe(e.test,n,s)),new ep(n.doc,e.unquoted,r,i,e.caseSensitive?void 0:a=>a.toLowerCase(),s)}function dCe(e,n){return(r,i,s,a)=>((a>r||a+s.length<i)&&(a=Math.max(0,r-2),s=e.sliceString(a,Math.min(e.length,i+2))),(n(Xb(s,r-a))!=yr.Word||n(Qb(s,r-a))!=yr.Word)&&(n(Qb(s,i-a))!=yr.Word||n(Xb(s,i-a))!=yr.Word))}class hCe extends CU{constructor(n){super(n)}nextMatch(n,r,i){let s=Zh(this.spec,n,i,n.doc.length).nextOverlapping();if(s.done){let a=Math.min(n.doc.length,r+this.spec.unquoted.length);s=Zh(this.spec,n,0,a).nextOverlapping()}return s.done||s.value.from==r&&s.value.to==i?null:s.value}prevMatchInRange(n,r,i){for(let s=i;;){let a=Math.max(r,s-1e4-this.spec.unquoted.length),o=Zh(this.spec,n,a,s),l=null;for(;!o.nextOverlapping().done;)l=o.value;if(l)return l;if(a==r)return null;s-=1e4}}prevMatch(n,r,i){let s=this.prevMatchInRange(n,0,r);return s||(s=this.prevMatchInRange(n,Math.max(0,i-this.spec.unquoted.length),n.doc.length)),s&&(s.from!=r||s.to!=i)?s:null}getReplacement(n){return this.spec.unquote(this.spec.replace)}matchAll(n,r){let i=Zh(this.spec,n,0,n.doc.length),s=[];for(;!i.next().done;){if(s.length>=r)return null;s.push(i.value)}return s}highlight(n,r,i,s){let a=Zh(this.spec,n,Math.max(0,r-this.spec.unquoted.length),Math.min(i+this.spec.unquoted.length,n.doc.length));for(;!a.next().done;)s(a.value.from,a.value.to)}}function fCe(e,n,r){return(i,s,a)=>(!r||r(i,s,a))&&e(a[0],n,i,s)}function Jh(e,n,r,i){let s;return e.wholeWord&&(s=pCe(n.charCategorizer(n.selection.main.head))),e.test&&(s=fCe(e.test,n,s)),new kU(n.doc,e.search,{ignoreCase:!e.caseSensitive,test:s},r,i)}function Xb(e,n){return e.slice(gi(e,n,!1),n)}function Qb(e,n){return e.slice(n,gi(e,n))}function pCe(e){return(n,r,i)=>!i[0].length||(e(Xb(i.input,i.index))!=yr.Word||e(Qb(i.input,i.index))!=yr.Word)&&(e(Qb(i.input,i.index+i[0].length))!=yr.Word||e(Xb(i.input,i.index+i[0].length))!=yr.Word)}class mCe extends CU{nextMatch(n,r,i){let s=Jh(this.spec,n,i,n.doc.length).next();return s.done&&(s=Jh(this.spec,n,0,r).next()),s.done?null:s.value}prevMatchInRange(n,r,i){for(let s=1;;s++){let a=Math.max(r,i-s*1e4),o=Jh(this.spec,n,a,i),l=null;for(;!o.next().done;)l=o.value;if(l&&(a==r||l.from>a+10))return l;if(a==r)return null}}prevMatch(n,r,i){return this.prevMatchInRange(n,0,r)||this.prevMatchInRange(n,i,n.doc.length)}getReplacement(n){return this.spec.unquote(this.spec.replace).replace(/\$([$&]|\d+)/g,(r,i)=>{if(i=="&")return n.match[0];if(i=="$")return"$";for(let s=i.length;s>0;s--){let a=+i.slice(0,s);if(a>0&&a<n.match.length)return n.match[a]+i.slice(s)}return r})}matchAll(n,r){let i=Jh(this.spec,n,0,n.doc.length),s=[];for(;!i.next().done;){if(s.length>=r)return null;s.push(i.value)}return s}highlight(n,r,i,s){let a=Jh(this.spec,n,Math.max(0,r-250),Math.min(i+250,n.doc.length));for(;!a.next().done;)s(a.value.from,a.value.to)}}const av=Gt.define(),PT=Gt.define(),lu=_i.define({create(e){return new c2(UN(e).create(),null)},update(e,n){for(let r of n.effects)r.is(av)?e=new c2(r.value.create(),e.panel):r.is(PT)&&(e=new c2(e.query,r.value?LT:null));return e},provide:e=>nv.from(e,n=>n.panel)});class c2{constructor(n,r){this.query=n,this.panel=r}}const gCe=Pt.mark({class:"cm-searchMatch"}),vCe=Pt.mark({class:"cm-searchMatch cm-searchMatch-selected"}),yCe=Cr.fromClass(class{constructor(e){this.view=e,this.decorations=this.highlight(e.state.field(lu))}update(e){let n=e.state.field(lu);(n!=e.startState.field(lu)||e.docChanged||e.selectionSet||e.viewportChanged)&&(this.decorations=this.highlight(n))}highlight({query:e,panel:n}){if(!n||!e.spec.valid)return Pt.none;let{view:r}=this,i=new ec;for(let s=0,a=r.visibleRanges,o=a.length;s<o;s++){let{from:l,to:u}=a[s];for(;s<o-1&&u>a[s+1].from-500;)u=a[++s].to;e.highlight(r.state,l,u,(d,p)=>{let f=r.state.selection.ranges.some(g=>g.from==d&&g.to==p);i.add(d,p,f?vCe:gCe)})}return i.finish()}},{decorations:e=>e.decorations});function Gv(e){return n=>{let r=n.state.field(lu,!1);return r&&r.query.spec.valid?e(n,r):EU(n)}}const Zb=Gv((e,{query:n})=>{let{to:r}=e.state.selection.main,i=n.nextMatch(e.state,r,r);if(!i)return!1;let s=Be.single(i.from,i.to),a=e.state.facet(mp);return e.dispatch({selection:s,effects:[IT(e,i),a.scrollToMatch(s.main,e)],userEvent:"select.search"}),NU(e),!0}),Jb=Gv((e,{query:n})=>{let{state:r}=e,{from:i}=r.selection.main,s=n.prevMatch(r,i,i);if(!s)return!1;let a=Be.single(s.from,s.to),o=e.state.facet(mp);return e.dispatch({selection:a,effects:[IT(e,s),o.scrollToMatch(a.main,e)],userEvent:"select.search"}),NU(e),!0}),_Ce=Gv((e,{query:n})=>{let r=n.matchAll(e.state,1e3);return!r||!r.length?!1:(e.dispatch({selection:Be.create(r.map(i=>Be.range(i.from,i.to))),userEvent:"select.search.matches"}),!0)}),xCe=({state:e,dispatch:n})=>{let r=e.selection;if(r.ranges.length>1||r.main.empty)return!1;let{from:i,to:s}=r.main,a=[],o=0;for(let l=new ep(e.doc,e.sliceDoc(i,s));!l.next().done;){if(a.length>1e3)return!1;l.value.from==i&&(o=a.length),a.push(Be.range(l.value.from,l.value.to))}return n(e.update({selection:Be.create(a,o),userEvent:"select.search.matches"})),!0},C6=Gv((e,{query:n})=>{let{state:r}=e,{from:i,to:s}=r.selection.main;if(r.readOnly)return!1;let a=n.nextMatch(r,i,i);if(!a)return!1;let o=a,l=[],u,d,p=[];o.from==i&&o.to==s&&(d=r.toText(n.getReplacement(o)),l.push({from:o.from,to:o.to,insert:d}),o=n.nextMatch(r,o.from,o.to),p.push(ct.announce.of(r.phrase("replaced match on line $",r.doc.lineAt(i).number)+".")));let f=e.state.changes(l);return o&&(u=Be.single(o.from,o.to).map(f),p.push(IT(e,o)),p.push(r.facet(mp).scrollToMatch(u.main,e))),e.dispatch({changes:f,selection:u,effects:p,userEvent:"input.replace"}),!0}),bCe=Gv((e,{query:n})=>{if(e.state.readOnly)return!1;let r=n.matchAll(e.state,1e9).map(s=>{let{from:a,to:o}=s;return{from:a,to:o,insert:n.getReplacement(s)}});if(!r.length)return!1;let i=e.state.phrase("replaced $ matches",r.length)+".";return e.dispatch({changes:r,effects:ct.announce.of(i),userEvent:"input.replace.all"}),!0});function LT(e){return e.state.facet(mp).createPanel(e)}function UN(e,n){var r,i,s,a,o;let l=e.selection.main,u=l.empty||l.to>l.from+100?"":e.sliceDoc(l.from,l.to);if(n&&!u)return n;let d=e.facet(mp);return new SU({search:((r=n==null?void 0:n.literal)!==null&&r!==void 0?r:d.literal)?u:u.replace(/\n/g,"\\n"),caseSensitive:(i=n==null?void 0:n.caseSensitive)!==null&&i!==void 0?i:d.caseSensitive,literal:(s=n==null?void 0:n.literal)!==null&&s!==void 0?s:d.literal,regexp:(a=n==null?void 0:n.regexp)!==null&&a!==void 0?a:d.regexp,wholeWord:(o=n==null?void 0:n.wholeWord)!==null&&o!==void 0?o:d.wholeWord})}function jU(e){let n=ST(e,LT);return n&&n.dom.querySelector("[main-field]")}function NU(e){let n=jU(e);n&&n==e.root.activeElement&&n.select()}const EU=e=>{let n=e.state.field(lu,!1);if(n&&n.panel){let r=jU(e);if(r&&r!=e.root.activeElement){let i=UN(e.state,n.query.spec);i.valid&&e.dispatch({effects:av.of(i)}),r.focus(),r.select()}}else e.dispatch({effects:[PT.of(!0),n?av.of(UN(e.state,n.query.spec)):Gt.appendConfig.of(CCe)]});return!0},AU=e=>{let n=e.state.field(lu,!1);if(!n||!n.panel)return!1;let r=ST(e,LT);return r&&r.dom.contains(e.root.activeElement)&&e.focus(),e.dispatch({effects:PT.of(!1)}),!0},kCe=[{key:"Mod-f",run:EU,scope:"editor search-panel"},{key:"F3",run:Zb,shift:Jb,scope:"editor search-panel",preventDefault:!0},{key:"Mod-g",run:Zb,shift:Jb,scope:"editor search-panel",preventDefault:!0},{key:"Escape",run:AU,scope:"editor search-panel"},{key:"Mod-Shift-l",run:xCe},{key:"Mod-Alt-g",run:Z2e},{key:"Mod-d",run:cCe,preventDefault:!0}];class wCe{constructor(n){this.view=n;let r=this.query=n.state.field(lu).query.spec;this.commit=this.commit.bind(this),this.searchField=Kn("input",{value:r.search,placeholder:Ys(n,"Find"),"aria-label":Ys(n,"Find"),class:"cm-textfield",name:"search",form:"","main-field":"true",onchange:this.commit,onkeyup:this.commit}),this.replaceField=Kn("input",{value:r.replace,placeholder:Ys(n,"Replace"),"aria-label":Ys(n,"Replace"),class:"cm-textfield",name:"replace",form:"",onchange:this.commit,onkeyup:this.commit}),this.caseField=Kn("input",{type:"checkbox",name:"case",form:"",checked:r.caseSensitive,onchange:this.commit}),this.reField=Kn("input",{type:"checkbox",name:"re",form:"",checked:r.regexp,onchange:this.commit}),this.wordField=Kn("input",{type:"checkbox",name:"word",form:"",checked:r.wholeWord,onchange:this.commit});function i(s,a,o){return Kn("button",{class:"cm-button",name:s,onclick:a,type:"button"},o)}this.dom=Kn("div",{onkeydown:s=>this.keydown(s),class:"cm-search"},[this.searchField,i("next",()=>Zb(n),[Ys(n,"next")]),i("prev",()=>Jb(n),[Ys(n,"previous")]),i("select",()=>_Ce(n),[Ys(n,"all")]),Kn("label",null,[this.caseField,Ys(n,"match case")]),Kn("label",null,[this.reField,Ys(n,"regexp")]),Kn("label",null,[this.wordField,Ys(n,"by word")]),...n.state.readOnly?[]:[Kn("br"),this.replaceField,i("replace",()=>C6(n),[Ys(n,"replace")]),i("replaceAll",()=>bCe(n),[Ys(n,"replace all")])],Kn("button",{name:"close",onclick:()=>AU(n),"aria-label":Ys(n,"close"),type:"button"},["×"])])}commit(){let n=new SU({search:this.searchField.value,caseSensitive:this.caseField.checked,regexp:this.reField.checked,wholeWord:this.wordField.checked,replace:this.replaceField.value});n.eq(this.query)||(this.query=n,this.view.dispatch({effects:av.of(n)}))}keydown(n){E1e(this.view,n,"search-panel")?n.preventDefault():n.keyCode==13&&n.target==this.searchField?(n.preventDefault(),(n.shiftKey?Jb:Zb)(this.view)):n.keyCode==13&&n.target==this.replaceField&&(n.preventDefault(),C6(this.view))}update(n){for(let r of n.transactions)for(let i of r.effects)i.is(av)&&!i.value.eq(this.query)&&this.setQuery(i.value)}setQuery(n){this.query=n,this.searchField.value=n.search,this.replaceField.value=n.replace,this.caseField.checked=n.caseSensitive,this.reField.checked=n.regexp,this.wordField.checked=n.wholeWord}mount(){this.searchField.select()}get pos(){return 80}get top(){return this.view.state.facet(mp).top}}function Ys(e,n){return e.state.phrase(n)}const V_=30,Y_=/[\s\.,:;?!]/;function IT(e,{from:n,to:r}){let i=e.state.doc.lineAt(n),s=e.state.doc.lineAt(r).to,a=Math.max(i.from,n-V_),o=Math.min(s,r+V_),l=e.state.sliceDoc(a,o);if(a!=i.from){for(let u=0;u<V_;u++)if(!Y_.test(l[u+1])&&Y_.test(l[u])){l=l.slice(u);break}}if(o!=s){for(let u=l.length-1;u>l.length-V_;u--)if(!Y_.test(l[u-1])&&Y_.test(l[u])){l=l.slice(0,u);break}}return ct.announce.of(`${e.state.phrase("current match")}. ${l} ${e.state.phrase("on line")} ${i.number}.`)}const SCe=ct.baseTheme({".cm-panel.cm-search":{padding:"2px 6px 4px",position:"relative","& [name=close]":{position:"absolute",top:"0",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",padding:0,margin:0},"& input, & button, & label":{margin:".2em .6em .2em 0"},"& input[type=checkbox]":{marginRight:".2em"},"& label":{fontSize:"80%",whiteSpace:"pre"}},"&light .cm-searchMatch":{backgroundColor:"#ffff0054"},"&dark .cm-searchMatch":{backgroundColor:"#00ffff8a"},"&light .cm-searchMatch-selected":{backgroundColor:"#ff6a0054"},"&dark .cm-searchMatch-selected":{backgroundColor:"#ff00ff8a"}}),CCe=[lu,Kd.low(yCe),SCe];class TU{constructor(n,r,i,s){this.state=n,this.pos=r,this.explicit=i,this.view=s,this.abortListeners=[],this.abortOnDocChange=!1}tokenBefore(n){let r=Vi(this.state).resolveInner(this.pos,-1);for(;r&&n.indexOf(r.name)<0;)r=r.parent;return r?{from:r.from,to:this.pos,text:this.state.sliceDoc(r.from,this.pos),type:r.type}:null}matchBefore(n){let r=this.state.doc.lineAt(this.pos),i=Math.max(r.from,this.pos-250),s=r.text.slice(i-r.from,this.pos-r.from),a=s.search(MU(n,!1));return a<0?null:{from:i+a,to:this.pos,text:s.slice(a)}}get aborted(){return this.abortListeners==null}addEventListener(n,r,i){n=="abort"&&this.abortListeners&&(this.abortListeners.push(r),i&&i.onDocChange&&(this.abortOnDocChange=!0))}}function j6(e){let n=Object.keys(e).join(""),r=/\w/.test(n);return r&&(n=n.replace(/\w/g,"")),`[${r?"\\w":""}${n.replace(/[^\w\s]/g,"\\$&")}]`}function jCe(e){let n=Object.create(null),r=Object.create(null);for(let{label:s}of e){n[s[0]]=!0;for(let a=1;a<s.length;a++)r[s[a]]=!0}let i=j6(n)+j6(r)+"*$";return[new RegExp("^"+i),new RegExp(i)]}function NCe(e){let n=e.map(s=>typeof s=="string"?{label:s}:s),[r,i]=n.every(s=>/^\w+$/.test(s.label))?[/\w*$/,/\w+$/]:jCe(n);return s=>{let a=s.matchBefore(i);return a||s.explicit?{from:a?a.from:s.pos,options:n,validFor:r}:null}}class N6{constructor(n,r,i,s){this.completion=n,this.source=r,this.match=i,this.score=s}}function Ed(e){return e.selection.main.from}function MU(e,n){var r;let{source:i}=e,s=n&&i[0]!="^",a=i[i.length-1]!="$";return!s&&!a?e:new RegExp(`${s?"^":""}(?:${i})${a?"$":""}`,(r=e.flags)!==null&&r!==void 0?r:e.ignoreCase?"i":"")}const RU=al.define();function ECe(e,n,r,i){let{main:s}=e.selection,a=r-s.from,o=i-s.from;return{...e.changeByRange(l=>{if(l!=s&&r!=i&&e.sliceDoc(l.from+a,l.from+o)!=e.sliceDoc(r,i))return{range:l};let u=e.toText(n);return{changes:{from:l.from+a,to:i==s.from?l.to:l.from+o,insert:u},range:Be.cursor(l.from+a+u.length)}}),scrollIntoView:!0,userEvent:"input.complete"}}const E6=new WeakMap;function ACe(e){if(!Array.isArray(e))return e;let n=E6.get(e);return n||E6.set(e,n=NCe(e)),n}const e0=Gt.define(),ov=Gt.define();class TCe{constructor(n){this.pattern=n,this.chars=[],this.folded=[],this.any=[],this.precise=[],this.byWord=[],this.score=0,this.matched=[];for(let r=0;r<n.length;){let i=ks(n,r),s=Bo(i);this.chars.push(i);let a=n.slice(r,r+s),o=a.toUpperCase();this.folded.push(ks(o==a?a.toLowerCase():o,0)),r+=s}this.astral=n.length!=this.chars.length}ret(n,r){return this.score=n,this.matched=r,this}match(n){if(this.pattern.length==0)return this.ret(-100,[]);if(n.length<this.pattern.length)return null;let{chars:r,folded:i,any:s,precise:a,byWord:o}=this;if(r.length==1){let j=ks(n,0),C=Bo(j),T=C==n.length?0:-100;if(j!=r[0])if(j==i[0])T+=-200;else return null;return this.ret(T,[0,C])}let l=n.indexOf(this.pattern);if(l==0)return this.ret(n.length==this.pattern.length?0:-100,[0,this.pattern.length]);let u=r.length,d=0;if(l<0){for(let j=0,C=Math.min(n.length,200);j<C&&d<u;){let T=ks(n,j);(T==r[d]||T==i[d])&&(s[d++]=j),j+=Bo(T)}if(d<u)return null}let p=0,f=0,g=!1,_=0,x=-1,v=-1,S=/[a-z]/.test(n),w=!0;for(let j=0,C=Math.min(n.length,200),T=0;j<C&&f<u;){let E=ks(n,j);l<0&&(p<u&&E==r[p]&&(a[p++]=j),_<u&&(E==r[_]||E==i[_]?(_==0&&(x=j),v=j+1,_++):_=0));let A,O=E<255?E>=48&&E<=57||E>=97&&E<=122?2:E>=65&&E<=90?1:0:(A=oT(E))!=A.toLowerCase()?1:A!=A.toUpperCase()?2:0;(!j||O==1&&S||T==0&&O!=0)&&(r[f]==E||i[f]==E&&(g=!0)?o[f++]=j:o.length&&(w=!1)),T=O,j+=Bo(E)}return f==u&&o[0]==0&&w?this.result(-100+(g?-200:0),o,n):_==u&&x==0?this.ret(-200-n.length+(v==n.length?0:-100),[0,v]):l>-1?this.ret(-700-n.length,[l,l+this.pattern.length]):_==u?this.ret(-900-n.length,[x,v]):f==u?this.result(-100+(g?-200:0)+-700+(w?0:-1100),o,n):r.length==2?null:this.result((s[0]?-700:0)+-200+-1100,s,n)}result(n,r,i){let s=[],a=0;for(let o of r){let l=o+(this.astral?Bo(ks(i,o)):1);a&&s[a-1]==o?s[a-1]=l:(s[a++]=o,s[a++]=l)}return this.ret(n-i.length,s)}}class MCe{constructor(n){this.pattern=n,this.matched=[],this.score=0,this.folded=n.toLowerCase()}match(n){if(n.length<this.pattern.length)return null;let r=n.slice(0,this.pattern.length),i=r==this.pattern?0:r.toLowerCase()==this.folded?-200:null;return i==null?null:(this.matched=[0,r.length],this.score=i+(n.length==this.pattern.length?0:-100),this)}}const mi=pt.define({combine(e){return oo(e,{activateOnTyping:!0,activateOnCompletion:()=>!1,activateOnTypingDelay:100,selectOnOpen:!0,override:null,closeOnBlur:!0,maxRenderedOptions:100,defaultKeymap:!0,tooltipClass:()=>"",optionClass:()=>"",aboveCursor:!1,icons:!0,addToOptions:[],positionInfo:RCe,filterStrict:!1,compareCompletions:(n,r)=>(n.sortText||n.label).localeCompare(r.sortText||r.label),interactionDelay:75,updateSyncTime:100},{defaultKeymap:(n,r)=>n&&r,closeOnBlur:(n,r)=>n&&r,icons:(n,r)=>n&&r,tooltipClass:(n,r)=>i=>A6(n(i),r(i)),optionClass:(n,r)=>i=>A6(n(i),r(i)),addToOptions:(n,r)=>n.concat(r),filterStrict:(n,r)=>n||r})}});function A6(e,n){return e?n?e+" "+n:e:n}function RCe(e,n,r,i,s,a){let o=e.textDirection==Jn.RTL,l=o,u=!1,d="top",p,f,g=n.left-s.left,_=s.right-n.right,x=i.right-i.left,v=i.bottom-i.top;if(l&&g<Math.min(x,_)?l=!1:!l&&_<Math.min(x,g)&&(l=!0),x<=(l?g:_))p=Math.max(s.top,Math.min(r.top,s.bottom-v))-n.top,f=Math.min(400,l?g:_);else{u=!0,f=Math.min(400,(o?n.right:s.right-n.left)-30);let j=s.bottom-n.bottom;j>=v||j>n.top?p=r.bottom-n.top:(d="bottom",p=n.bottom-r.top)}let S=(n.bottom-n.top)/a.offsetHeight,w=(n.right-n.left)/a.offsetWidth;return{style:`${d}: ${p/S}px; max-width: ${f/w}px`,class:"cm-completionInfo-"+(u?o?"left-narrow":"right-narrow":l?"left":"right")}}const BT=Gt.define();function OCe(e){let n=e.addToOptions.slice();return e.icons&&n.push({render(r){let i=document.createElement("div");return i.classList.add("cm-completionIcon"),r.type&&i.classList.add(...r.type.split(/\s+/g).map(s=>"cm-completionIcon-"+s)),i.setAttribute("aria-hidden","true"),i},position:20}),n.push({render(r,i,s,a){let o=document.createElement("span");o.className="cm-completionLabel";let l=r.displayLabel||r.label,u=0;for(let d=0;d<a.length;){let p=a[d++],f=a[d++];p>u&&o.appendChild(document.createTextNode(l.slice(u,p)));let g=o.appendChild(document.createElement("span"));g.appendChild(document.createTextNode(l.slice(p,f))),g.className="cm-completionMatchedText",u=f}return u<l.length&&o.appendChild(document.createTextNode(l.slice(u))),o},position:50},{render(r){if(!r.detail)return null;let i=document.createElement("span");return i.className="cm-completionDetail",i.textContent=r.detail,i},position:80}),n.sort((r,i)=>r.position-i.position).map(r=>r.render)}function u2(e,n,r){if(e<=r)return{from:0,to:e};if(n<0&&(n=0),n<=e>>1){let s=Math.floor(n/r);return{from:s*r,to:(s+1)*r}}let i=Math.floor((e-n)/r);return{from:e-(i+1)*r,to:e-i*r}}class DCe{constructor(n,r,i){this.view=n,this.stateField=r,this.applyCompletion=i,this.info=null,this.infoDestroy=null,this.placeInfoReq={read:()=>this.measureInfo(),write:u=>this.placeInfo(u),key:this},this.space=null,this.currentClass="";let s=n.state.field(r),{options:a,selected:o}=s.open,l=n.state.facet(mi);this.optionContent=OCe(l),this.optionClass=l.optionClass,this.tooltipClass=l.tooltipClass,this.range=u2(a.length,o,l.maxRenderedOptions),this.dom=document.createElement("div"),this.dom.className="cm-tooltip-autocomplete",this.updateTooltipClass(n.state),this.dom.addEventListener("mousedown",u=>{let{options:d}=n.state.field(r).open;for(let p=u.target,f;p&&p!=this.dom;p=p.parentNode)if(p.nodeName=="LI"&&(f=/-(\d+)$/.exec(p.id))&&+f[1]<d.length){this.applyCompletion(n,d[+f[1]]),u.preventDefault();return}if(u.target==this.list){let p=this.list.classList.contains("cm-completionListIncompleteTop")&&u.clientY<this.list.firstChild.getBoundingClientRect().top?this.range.from-1:this.list.classList.contains("cm-completionListIncompleteBottom")&&u.clientY>this.list.lastChild.getBoundingClientRect().bottom?this.range.to:null;p!=null&&(n.dispatch({effects:BT.of(p)}),u.preventDefault())}}),this.dom.addEventListener("focusout",u=>{let d=n.state.field(this.stateField,!1);d&&d.tooltip&&n.state.facet(mi).closeOnBlur&&u.relatedTarget!=n.contentDOM&&n.dispatch({effects:ov.of(null)})}),this.showOptions(a,s.id)}mount(){this.updateSel()}showOptions(n,r){this.list&&this.list.remove(),this.list=this.dom.appendChild(this.createListBox(n,r,this.range)),this.list.addEventListener("scroll",()=>{this.info&&this.view.requestMeasure(this.placeInfoReq)})}update(n){var r;let i=n.state.field(this.stateField),s=n.startState.field(this.stateField);if(this.updateTooltipClass(n.state),i!=s){let{options:a,selected:o,disabled:l}=i.open;(!s.open||s.open.options!=a)&&(this.range=u2(a.length,o,n.state.facet(mi).maxRenderedOptions),this.showOptions(a,i.id)),this.updateSel(),l!=((r=s.open)===null||r===void 0?void 0:r.disabled)&&this.dom.classList.toggle("cm-tooltip-autocomplete-disabled",!!l)}}updateTooltipClass(n){let r=this.tooltipClass(n);if(r!=this.currentClass){for(let i of this.currentClass.split(" "))i&&this.dom.classList.remove(i);for(let i of r.split(" "))i&&this.dom.classList.add(i);this.currentClass=r}}positioned(n){this.space=n,this.info&&this.view.requestMeasure(this.placeInfoReq)}updateSel(){let n=this.view.state.field(this.stateField),r=n.open;(r.selected>-1&&r.selected<this.range.from||r.selected>=this.range.to)&&(this.range=u2(r.options.length,r.selected,this.view.state.facet(mi).maxRenderedOptions),this.showOptions(r.options,n.id));let i=this.updateSelectedOption(r.selected);if(i){this.destroyInfo();let{completion:s}=r.options[r.selected],{info:a}=s;if(!a)return;let o=typeof a=="string"?document.createTextNode(a):a(s);if(!o)return;"then"in o?o.then(l=>{l&&this.view.state.field(this.stateField,!1)==n&&this.addInfoPane(l,s)}).catch(l=>ss(this.view.state,l,"completion info")):(this.addInfoPane(o,s),i.setAttribute("aria-describedby",this.info.id))}}addInfoPane(n,r){this.destroyInfo();let i=this.info=document.createElement("div");if(i.className="cm-tooltip cm-completionInfo",i.id="cm-completionInfo-"+Math.floor(Math.random()*65535).toString(16),n.nodeType!=null)i.appendChild(n),this.infoDestroy=null;else{let{dom:s,destroy:a}=n;i.appendChild(s),this.infoDestroy=a||null}this.dom.appendChild(i),this.view.requestMeasure(this.placeInfoReq)}updateSelectedOption(n){let r=null;for(let i=this.list.firstChild,s=this.range.from;i;i=i.nextSibling,s++)i.nodeName!="LI"||!i.id?s--:s==n?i.hasAttribute("aria-selected")||(i.setAttribute("aria-selected","true"),r=i):i.hasAttribute("aria-selected")&&(i.removeAttribute("aria-selected"),i.removeAttribute("aria-describedby"));return r&&LCe(this.list,r),r}measureInfo(){let n=this.dom.querySelector("[aria-selected]");if(!n||!this.info)return null;let r=this.dom.getBoundingClientRect(),i=this.info.getBoundingClientRect(),s=n.getBoundingClientRect(),a=this.space;if(!a){let o=this.dom.ownerDocument.documentElement;a={left:0,top:0,right:o.clientWidth,bottom:o.clientHeight}}return s.top>Math.min(a.bottom,r.bottom)-10||s.bottom<Math.max(a.top,r.top)+10?null:this.view.state.facet(mi).positionInfo(this.view,r,s,i,a,this.dom)}placeInfo(n){this.info&&(n?(n.style&&(this.info.style.cssText=n.style),this.info.className="cm-tooltip cm-completionInfo "+(n.class||"")):this.info.style.cssText="top: -1e6px")}createListBox(n,r,i){const s=document.createElement("ul");s.id=r,s.setAttribute("role","listbox"),s.setAttribute("aria-expanded","true"),s.setAttribute("aria-label",this.view.state.phrase("Completions")),s.addEventListener("mousedown",o=>{o.target==s&&o.preventDefault()});let a=null;for(let o=i.from;o<i.to;o++){let{completion:l,match:u}=n[o],{section:d}=l;if(d){let g=typeof d=="string"?d:d.name;if(g!=a&&(o>i.from||i.from==0))if(a=g,typeof d!="string"&&d.header)s.appendChild(d.header(d));else{let _=s.appendChild(document.createElement("completion-section"));_.textContent=g}}const p=s.appendChild(document.createElement("li"));p.id=r+"-"+o,p.setAttribute("role","option");let f=this.optionClass(l);f&&(p.className=f);for(let g of this.optionContent){let _=g(l,this.view.state,this.view,u);_&&p.appendChild(_)}}return i.from&&s.classList.add("cm-completionListIncompleteTop"),i.to<n.length&&s.classList.add("cm-completionListIncompleteBottom"),s}destroyInfo(){this.info&&(this.infoDestroy&&this.infoDestroy(),this.info.remove(),this.info=null)}destroy(){this.destroyInfo()}}function PCe(e,n){return r=>new DCe(r,e,n)}function LCe(e,n){let r=e.getBoundingClientRect(),i=n.getBoundingClientRect(),s=r.height/e.offsetHeight;i.top<r.top?e.scrollTop-=(r.top-i.top)/s:i.bottom>r.bottom&&(e.scrollTop+=(i.bottom-r.bottom)/s)}function T6(e){return(e.boost||0)*100+(e.apply?10:0)+(e.info?5:0)+(e.type?1:0)}function ICe(e,n){let r=[],i=null,s=null,a=p=>{r.push(p);let{section:f}=p.completion;if(f){i||(i=[]);let g=typeof f=="string"?f:f.name;i.some(_=>_.name==g)||i.push(typeof f=="string"?{name:g}:f)}},o=n.facet(mi);for(let p of e)if(p.hasResult()){let f=p.result.getMatch;if(p.result.filter===!1)for(let g of p.result.options)a(new N6(g,p.source,f?f(g):[],1e9-r.length));else{let g=n.sliceDoc(p.from,p.to),_,x=o.filterStrict?new MCe(g):new TCe(g);for(let v of p.result.options)if(_=x.match(v.label)){let S=v.displayLabel?f?f(v,_.matched):[]:_.matched,w=_.score+(v.boost||0);if(a(new N6(v,p.source,S,w)),typeof v.section=="object"&&v.section.rank==="dynamic"){let{name:j}=v.section;s||(s=Object.create(null)),s[j]=Math.max(w,s[j]||-1e9)}}}}if(i){let p=Object.create(null),f=0,g=(_,x)=>(_.rank==="dynamic"&&x.rank==="dynamic"?s[x.name]-s[_.name]:0)||(typeof _.rank=="number"?_.rank:1e9)-(typeof x.rank=="number"?x.rank:1e9)||(_.name<x.name?-1:1);for(let _ of i.sort(g))f-=1e5,p[_.name]=f;for(let _ of r){let{section:x}=_.completion;x&&(_.score+=p[typeof x=="string"?x:x.name])}}let l=[],u=null,d=o.compareCompletions;for(let p of r.sort((f,g)=>g.score-f.score||d(f.completion,g.completion))){let f=p.completion;!u||u.label!=f.label||u.detail!=f.detail||u.type!=null&&f.type!=null&&u.type!=f.type||u.apply!=f.apply||u.boost!=f.boost?l.push(p):T6(p.completion)>T6(u)&&(l[l.length-1]=p),u=p.completion}return l}class mf{constructor(n,r,i,s,a,o){this.options=n,this.attrs=r,this.tooltip=i,this.timestamp=s,this.selected=a,this.disabled=o}setSelected(n,r){return n==this.selected||n>=this.options.length?this:new mf(this.options,M6(r,n),this.tooltip,this.timestamp,n,this.disabled)}static build(n,r,i,s,a,o){if(s&&!o&&n.some(d=>d.isPending))return s.setDisabled();let l=ICe(n,r);if(!l.length)return s&&n.some(d=>d.isPending)?s.setDisabled():null;let u=r.facet(mi).selectOnOpen?0:-1;if(s&&s.selected!=u&&s.selected!=-1){let d=s.options[s.selected].completion;for(let p=0;p<l.length;p++)if(l[p].completion==d){u=p;break}}return new mf(l,M6(i,u),{pos:n.reduce((d,p)=>p.hasResult()?Math.min(d,p.from):d,1e8),create:WCe,above:a.aboveCursor},s?s.timestamp:Date.now(),u,!1)}map(n){return new mf(this.options,this.attrs,{...this.tooltip,pos:n.mapPos(this.tooltip.pos)},this.timestamp,this.selected,this.disabled)}setDisabled(){return new mf(this.options,this.attrs,this.tooltip,this.timestamp,this.selected,!0)}}class t0{constructor(n,r,i){this.active=n,this.id=r,this.open=i}static start(){return new t0(FCe,"cm-ac-"+Math.floor(Math.random()*2e6).toString(36),null)}update(n){let{state:r}=n,i=r.facet(mi),a=(i.override||r.languageDataAt("autocomplete",Ed(r)).map(ACe)).map(u=>(this.active.find(p=>p.source==u)||new Ta(u,this.active.some(p=>p.state!=0)?1:0)).update(n,i));a.length==this.active.length&&a.every((u,d)=>u==this.active[d])&&(a=this.active);let o=this.open,l=n.effects.some(u=>u.is(zT));o&&n.docChanged&&(o=o.map(n.changes)),n.selection||a.some(u=>u.hasResult()&&n.changes.touchesRange(u.from,u.to))||!BCe(a,this.active)||l?o=mf.build(a,r,this.id,o,i,l):o&&o.disabled&&!a.some(u=>u.isPending)&&(o=null),!o&&a.every(u=>!u.isPending)&&a.some(u=>u.hasResult())&&(a=a.map(u=>u.hasResult()?new Ta(u.source,0):u));for(let u of n.effects)u.is(BT)&&(o=o&&o.setSelected(u.value,this.id));return a==this.active&&o==this.open?this:new t0(a,this.id,o)}get tooltip(){return this.open?this.open.tooltip:null}get attrs(){return this.open?this.open.attrs:this.active.length?zCe:$Ce}}function BCe(e,n){if(e==n)return!0;for(let r=0,i=0;;){for(;r<e.length&&!e[r].hasResult();)r++;for(;i<n.length&&!n[i].hasResult();)i++;let s=r==e.length,a=i==n.length;if(s||a)return s==a;if(e[r++].result!=n[i++].result)return!1}}const zCe={"aria-autocomplete":"list"},$Ce={};function M6(e,n){let r={"aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":e};return n>-1&&(r["aria-activedescendant"]=e+"-"+n),r}const FCe=[];function OU(e,n){if(e.isUserEvent("input.complete")){let i=e.annotation(RU);if(i&&n.activateOnCompletion(i))return 12}let r=e.isUserEvent("input.type");return r&&n.activateOnTyping?5:r?1:e.isUserEvent("delete.backward")?2:e.selection?8:e.docChanged?16:0}class Ta{constructor(n,r,i=!1){this.source=n,this.state=r,this.explicit=i}hasResult(){return!1}get isPending(){return this.state==1}update(n,r){let i=OU(n,r),s=this;(i&8||i&16&&this.touches(n))&&(s=new Ta(s.source,0)),i&4&&s.state==0&&(s=new Ta(this.source,1)),s=s.updateFor(n,i);for(let a of n.effects)if(a.is(e0))s=new Ta(s.source,1,a.value);else if(a.is(ov))s=new Ta(s.source,0);else if(a.is(zT))for(let o of a.value)o.source==s.source&&(s=o);return s}updateFor(n,r){return this.map(n.changes)}map(n){return this}touches(n){return n.changes.touchesRange(Ed(n.state))}}class Af extends Ta{constructor(n,r,i,s,a,o){super(n,3,r),this.limit=i,this.result=s,this.from=a,this.to=o}hasResult(){return!0}updateFor(n,r){var i;if(!(r&3))return this.map(n.changes);let s=this.result;s.map&&!n.changes.empty&&(s=s.map(s,n.changes));let a=n.changes.mapPos(this.from),o=n.changes.mapPos(this.to,1),l=Ed(n.state);if(l>o||!s||r&2&&(Ed(n.startState)==this.from||l<this.limit))return new Ta(this.source,r&4?1:0);let u=n.changes.mapPos(this.limit);return HCe(s.validFor,n.state,a,o)?new Af(this.source,this.explicit,u,s,a,o):s.update&&(s=s.update(s,a,o,new TU(n.state,l,!1)))?new Af(this.source,this.explicit,u,s,s.from,(i=s.to)!==null&&i!==void 0?i:Ed(n.state)):new Ta(this.source,1,this.explicit)}map(n){return n.empty?this:(this.result.map?this.result.map(this.result,n):this.result)?new Af(this.source,this.explicit,n.mapPos(this.limit),this.result,n.mapPos(this.from),n.mapPos(this.to,1)):new Ta(this.source,0)}touches(n){return n.changes.touchesRange(this.from,this.to)}}function HCe(e,n,r,i){if(!e)return!1;let s=n.sliceDoc(r,i);return typeof e=="function"?e(s,r,i,n):MU(e,!0).test(s)}const zT=Gt.define({map(e,n){return e.map(r=>r.map(n))}}),ws=_i.define({create(){return t0.start()},update(e,n){return e.update(n)},provide:e=>[sk.from(e,n=>n.tooltip),ct.contentAttributes.from(e,n=>n.attrs)]});function $T(e,n){const r=n.completion.apply||n.completion.label;let i=e.state.field(ws).active.find(s=>s.source==n.source);return i instanceof Af?(typeof r=="string"?e.dispatch({...ECe(e.state,r,i.from,i.to),annotations:RU.of(n.completion)}):r(e,n.completion,i.from,i.to),!0):!1}const WCe=PCe(ws,$T);function G_(e,n="option"){return r=>{let i=r.state.field(ws,!1);if(!i||!i.open||i.open.disabled||Date.now()-i.open.timestamp<r.state.facet(mi).interactionDelay)return!1;let s=1,a;n=="page"&&(a=uq(r,i.open.tooltip))&&(s=Math.max(2,Math.floor(a.dom.offsetHeight/a.dom.querySelector("li").offsetHeight)-1));let{length:o}=i.open.options,l=i.open.selected>-1?i.open.selected+s*(e?1:-1):e?0:o-1;return l<0?l=n=="page"?0:o-1:l>=o&&(l=n=="page"?o-1:0),r.dispatch({effects:BT.of(l)}),!0}}const qCe=e=>{let n=e.state.field(ws,!1);return e.state.readOnly||!n||!n.open||n.open.selected<0||n.open.disabled||Date.now()-n.open.timestamp<e.state.facet(mi).interactionDelay?!1:$T(e,n.open.options[n.open.selected])},d2=e=>e.state.field(ws,!1)?(e.dispatch({effects:e0.of(!0)}),!0):!1,UCe=e=>{let n=e.state.field(ws,!1);return!n||!n.active.some(r=>r.state!=0)?!1:(e.dispatch({effects:ov.of(null)}),!0)};class KCe{constructor(n,r){this.active=n,this.context=r,this.time=Date.now(),this.updates=[],this.done=void 0}}const VCe=50,YCe=1e3,GCe=Cr.fromClass(class{constructor(e){this.view=e,this.debounceUpdate=-1,this.running=[],this.debounceAccept=-1,this.pendingStart=!1,this.composing=0;for(let n of e.state.field(ws).active)n.isPending&&this.startQuery(n)}update(e){let n=e.state.field(ws),r=e.state.facet(mi);if(!e.selectionSet&&!e.docChanged&&e.startState.field(ws)==n)return;let i=e.transactions.some(a=>{let o=OU(a,r);return o&8||(a.selection||a.docChanged)&&!(o&3)});for(let a=0;a<this.running.length;a++){let o=this.running[a];if(i||o.context.abortOnDocChange&&e.docChanged||o.updates.length+e.transactions.length>VCe&&Date.now()-o.time>YCe){for(let l of o.context.abortListeners)try{l()}catch(u){ss(this.view.state,u)}o.context.abortListeners=null,this.running.splice(a--,1)}else o.updates.push(...e.transactions)}this.debounceUpdate>-1&&clearTimeout(this.debounceUpdate),e.transactions.some(a=>a.effects.some(o=>o.is(e0)))&&(this.pendingStart=!0);let s=this.pendingStart?50:r.activateOnTypingDelay;if(this.debounceUpdate=n.active.some(a=>a.isPending&&!this.running.some(o=>o.active.source==a.source))?setTimeout(()=>this.startUpdate(),s):-1,this.composing!=0)for(let a of e.transactions)a.isUserEvent("input.type")?this.composing=2:this.composing==2&&a.selection&&(this.composing=3)}startUpdate(){this.debounceUpdate=-1,this.pendingStart=!1;let{state:e}=this.view,n=e.field(ws);for(let r of n.active)r.isPending&&!this.running.some(i=>i.active.source==r.source)&&this.startQuery(r);this.running.length&&n.open&&n.open.disabled&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(mi).updateSyncTime))}startQuery(e){let{state:n}=this.view,r=Ed(n),i=new TU(n,r,e.explicit,this.view),s=new KCe(e,i);this.running.push(s),Promise.resolve(e.source(i)).then(a=>{s.context.aborted||(s.done=a||null,this.scheduleAccept())},a=>{this.view.dispatch({effects:ov.of(null)}),ss(this.view.state,a)})}scheduleAccept(){this.running.every(e=>e.done!==void 0)?this.accept():this.debounceAccept<0&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(mi).updateSyncTime))}accept(){var e;this.debounceAccept>-1&&clearTimeout(this.debounceAccept),this.debounceAccept=-1;let n=[],r=this.view.state.facet(mi),i=this.view.state.field(ws);for(let s=0;s<this.running.length;s++){let a=this.running[s];if(a.done===void 0)continue;if(this.running.splice(s--,1),a.done){let l=Ed(a.updates.length?a.updates[0].startState:this.view.state),u=Math.min(l,a.done.from+(a.active.explicit?0:1)),d=new Af(a.active.source,a.active.explicit,u,a.done,a.done.from,(e=a.done.to)!==null&&e!==void 0?e:l);for(let p of a.updates)d=d.update(p,r);if(d.hasResult()){n.push(d);continue}}let o=i.active.find(l=>l.source==a.active.source);if(o&&o.isPending)if(a.done==null){let l=new Ta(a.active.source,0);for(let u of a.updates)l=l.update(u,r);l.isPending||n.push(l)}else this.startQuery(o)}(n.length||i.open&&i.open.disabled)&&this.view.dispatch({effects:zT.of(n)})}},{eventHandlers:{blur(e){let n=this.view.state.field(ws,!1);if(n&&n.tooltip&&this.view.state.facet(mi).closeOnBlur){let r=n.open&&uq(this.view,n.open.tooltip);(!r||!r.dom.contains(e.relatedTarget))&&setTimeout(()=>this.view.dispatch({effects:ov.of(null)}),10)}},compositionstart(){this.composing=1},compositionend(){this.composing==3&&setTimeout(()=>this.view.dispatch({effects:e0.of(!1)}),20),this.composing=0}}}),XCe=typeof navigator=="object"&&/Win/.test(navigator.platform),QCe=Kd.highest(ct.domEventHandlers({keydown(e,n){let r=n.state.field(ws,!1);if(!r||!r.open||r.open.disabled||r.open.selected<0||e.key.length>1||e.ctrlKey&&!(XCe&&e.altKey)||e.metaKey)return!1;let i=r.open.options[r.open.selected],s=r.active.find(o=>o.source==i.source),a=i.completion.commitCharacters||s.result.commitCharacters;return a&&a.indexOf(e.key)>-1&&$T(n,i),!1}})),ZCe=ct.baseTheme({".cm-tooltip.cm-tooltip-autocomplete":{"& > ul":{fontFamily:"monospace",whiteSpace:"nowrap",overflow:"hidden auto",maxWidth_fallback:"700px",maxWidth:"min(700px, 95vw)",minWidth:"250px",maxHeight:"10em",height:"100%",listStyle:"none",margin:0,padding:0,"& > li, & > completion-section":{padding:"1px 3px",lineHeight:1.2},"& > li":{overflowX:"hidden",textOverflow:"ellipsis",cursor:"pointer"},"& > completion-section":{display:"list-item",borderBottom:"1px solid silver",paddingLeft:"0.5em",opacity:.7}}},"&light .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#17c",color:"white"},"&light .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#777"},"&dark .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#347",color:"white"},"&dark .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#444"},".cm-completionListIncompleteTop:before, .cm-completionListIncompleteBottom:after":{content:'"···"',opacity:.5,display:"block",textAlign:"center"},".cm-tooltip.cm-completionInfo":{position:"absolute",padding:"3px 9px",width:"max-content",maxWidth:"400px",boxSizing:"border-box",whiteSpace:"pre-line"},".cm-completionInfo.cm-completionInfo-left":{right:"100%"},".cm-completionInfo.cm-completionInfo-right":{left:"100%"},".cm-completionInfo.cm-completionInfo-left-narrow":{right:"30px"},".cm-completionInfo.cm-completionInfo-right-narrow":{left:"30px"},"&light .cm-snippetField":{backgroundColor:"#00000022"},"&dark .cm-snippetField":{backgroundColor:"#ffffff22"},".cm-snippetFieldPosition":{verticalAlign:"text-top",width:0,height:"1.15em",display:"inline-block",margin:"0 -0.7px -.7em",borderLeft:"1.4px dotted #888"},".cm-completionMatchedText":{textDecoration:"underline"},".cm-completionDetail":{marginLeft:"0.5em",fontStyle:"italic"},".cm-completionIcon":{fontSize:"90%",width:".8em",display:"inline-block",textAlign:"center",paddingRight:".6em",opacity:"0.6",boxSizing:"content-box"},".cm-completionIcon-function, .cm-completionIcon-method":{"&:after":{content:"'ƒ'"}},".cm-completionIcon-class":{"&:after":{content:"'○'"}},".cm-completionIcon-interface":{"&:after":{content:"'◌'"}},".cm-completionIcon-variable":{"&:after":{content:"'𝑥'"}},".cm-completionIcon-constant":{"&:after":{content:"'𝐶'"}},".cm-completionIcon-type":{"&:after":{content:"'𝑡'"}},".cm-completionIcon-enum":{"&:after":{content:"'∪'"}},".cm-completionIcon-property":{"&:after":{content:"'□'"}},".cm-completionIcon-keyword":{"&:after":{content:"'🔑︎'"}},".cm-completionIcon-namespace":{"&:after":{content:"'▢'"}},".cm-completionIcon-text":{"&:after":{content:"'abc'",fontSize:"50%",verticalAlign:"middle"}}}),lv={brackets:["(","[","{","'",'"'],before:")]}:;>",stringPrefixes:[]},_d=Gt.define({map(e,n){let r=n.mapPos(e,-1,rs.TrackAfter);return r??void 0}}),FT=new class extends pu{};FT.startSide=1;FT.endSide=-1;const DU=_i.define({create(){return rn.empty},update(e,n){if(e=e.map(n.changes),n.selection){let r=n.state.doc.lineAt(n.selection.main.head);e=e.update({filter:i=>i>=r.from&&i<=r.to})}for(let r of n.effects)r.is(_d)&&(e=e.update({add:[FT.range(r.value,r.value+1)]}));return e}});function JCe(){return[tje,DU]}const h2="()[]{}<>«»»«［］｛｝";function PU(e){for(let n=0;n<h2.length;n+=2)if(h2.charCodeAt(n)==e)return h2.charAt(n+1);return oT(e<128?e:e+1)}function LU(e,n){return e.languageDataAt("closeBrackets",n)[0]||lv}const eje=typeof navigator=="object"&&/Android\b/.test(navigator.userAgent),tje=ct.inputHandler.of((e,n,r,i)=>{if((eje?e.composing:e.compositionStarted)||e.state.readOnly)return!1;let s=e.state.selection.main;if(i.length>2||i.length==2&&Bo(ks(i,0))==1||n!=s.from||r!=s.to)return!1;let a=ije(e.state,i);return a?(e.dispatch(a),!0):!1}),nje=({state:e,dispatch:n})=>{if(e.readOnly)return!1;let i=LU(e,e.selection.main.head).brackets||lv.brackets,s=null,a=e.changeByRange(o=>{if(o.empty){let l=sje(e.doc,o.head);for(let u of i)if(u==l&&pk(e.doc,o.head)==PU(ks(u,0)))return{changes:{from:o.head-u.length,to:o.head+u.length},range:Be.cursor(o.head-u.length)}}return{range:s=o}});return s||n(e.update(a,{scrollIntoView:!0,userEvent:"delete.backward"})),!s},rje=[{key:"Backspace",run:nje}];function ije(e,n){let r=LU(e,e.selection.main.head),i=r.brackets||lv.brackets;for(let s of i){let a=PU(ks(s,0));if(n==s)return a==s?lje(e,s,i.indexOf(s+s+s)>-1,r):aje(e,s,a,r.before||lv.before);if(n==a&&IU(e,e.selection.main.from))return oje(e,s,a)}return null}function IU(e,n){let r=!1;return e.field(DU).between(0,e.doc.length,i=>{i==n&&(r=!0)}),r}function pk(e,n){let r=e.sliceString(n,n+2);return r.slice(0,Bo(ks(r,0)))}function sje(e,n){let r=e.sliceString(n-2,n);return Bo(ks(r,0))==r.length?r:r.slice(1)}function aje(e,n,r,i){let s=null,a=e.changeByRange(o=>{if(!o.empty)return{changes:[{insert:n,from:o.from},{insert:r,from:o.to}],effects:_d.of(o.to+n.length),range:Be.range(o.anchor+n.length,o.head+n.length)};let l=pk(e.doc,o.head);return!l||/\s/.test(l)||i.indexOf(l)>-1?{changes:{insert:n+r,from:o.head},effects:_d.of(o.head+n.length),range:Be.cursor(o.head+n.length)}:{range:s=o}});return s?null:e.update(a,{scrollIntoView:!0,userEvent:"input.type"})}function oje(e,n,r){let i=null,s=e.changeByRange(a=>a.empty&&pk(e.doc,a.head)==r?{changes:{from:a.head,to:a.head+r.length,insert:r},range:Be.cursor(a.head+r.length)}:i={range:a});return i?null:e.update(s,{scrollIntoView:!0,userEvent:"input.type"})}function lje(e,n,r,i){let s=i.stringPrefixes||lv.stringPrefixes,a=null,o=e.changeByRange(l=>{if(!l.empty)return{changes:[{insert:n,from:l.from},{insert:n,from:l.to}],effects:_d.of(l.to+n.length),range:Be.range(l.anchor+n.length,l.head+n.length)};let u=l.head,d=pk(e.doc,u),p;if(d==n){if(R6(e,u))return{changes:{insert:n+n,from:u},effects:_d.of(u+n.length),range:Be.cursor(u+n.length)};if(IU(e,u)){let g=r&&e.sliceDoc(u,u+n.length*3)==n+n+n?n+n+n:n;return{changes:{from:u,to:u+g.length,insert:g},range:Be.cursor(u+g.length)}}}else{if(r&&e.sliceDoc(u-2*n.length,u)==n+n&&(p=O6(e,u-2*n.length,s))>-1&&R6(e,p))return{changes:{insert:n+n+n+n,from:u},effects:_d.of(u+n.length),range:Be.cursor(u+n.length)};if(e.charCategorizer(u)(d)!=yr.Word&&O6(e,u,s)>-1&&!cje(e,u,n,s))return{changes:{insert:n+n,from:u},effects:_d.of(u+n.length),range:Be.cursor(u+n.length)}}return{range:a=l}});return a?null:e.update(o,{scrollIntoView:!0,userEvent:"input.type"})}function R6(e,n){let r=Vi(e).resolveInner(n+1);return r.parent&&r.from==n}function cje(e,n,r,i){let s=Vi(e).resolveInner(n,-1),a=i.reduce((o,l)=>Math.max(o,l.length),0);for(let o=0;o<5;o++){let l=e.sliceDoc(s.from,Math.min(s.to,s.from+r.length+a)),u=l.indexOf(r);if(!u||u>-1&&i.indexOf(l.slice(0,u))>-1){let p=s.firstChild;for(;p&&p.from==s.from&&p.to-p.from>r.length+u;){if(e.sliceDoc(p.to-r.length,p.to)==r)return!1;p=p.firstChild}return!0}let d=s.to==n&&s.parent;if(!d)break;s=d}return!1}function O6(e,n,r){let i=e.charCategorizer(n);if(i(e.sliceDoc(n-1,n))!=yr.Word)return n;for(let s of r){let a=n-s.length;if(e.sliceDoc(a,n)==s&&i(e.sliceDoc(a-1,a))!=yr.Word)return a}return-1}function uje(e={}){return[QCe,ws,mi.of(e),GCe,dje,ZCe]}const BU=[{key:"Ctrl-Space",run:d2},{mac:"Alt-`",run:d2},{mac:"Alt-i",run:d2},{key:"Escape",run:UCe},{key:"ArrowDown",run:G_(!0)},{key:"ArrowUp",run:G_(!1)},{key:"PageDown",run:G_(!0,"page")},{key:"PageUp",run:G_(!1,"page")},{key:"Enter",run:qCe}],dje=Kd.highest(ik.computeN([mi],e=>e.facet(mi).defaultKeymap?[BU]:[]));class D6{constructor(n,r,i){this.from=n,this.to=r,this.diagnostic=i}}class dd{constructor(n,r,i){this.diagnostics=n,this.panel=r,this.selected=i}static init(n,r,i){let s=i.facet(Ko).markerFilter;s&&(n=s(n,i));let a=n.slice().sort((_,x)=>_.from-x.from||_.to-x.to),o=new ec,l=[],u=0,d=i.doc.iter(),p=0,f=i.doc.length;for(let _=0;;){let x=_==a.length?null:a[_];if(!x&&!l.length)break;let v,S;if(l.length)v=u,S=l.reduce((C,T)=>Math.min(C,T.to),x&&x.from>v?x.from:1e8);else{if(v=x.from,v>f)break;S=x.to,l.push(x),_++}for(;_<a.length;){let C=a[_];if(C.from==v&&(C.to>C.from||C.to==v))l.push(C),_++,S=Math.min(C.to,S);else{S=Math.min(C.from,S);break}}S=Math.min(S,f);let w=!1;if(l.some(C=>C.from==v&&(C.to==S||S==f))&&(w=v==S,!w&&S-v<10)){let C=v-(p+d.value.length);C>0&&(d.next(C),p=v);for(let T=v;;){if(T>=S){w=!0;break}if(!d.lineBreak&&p+d.value.length>T)break;T=p+d.value.length,p+=d.value.length,d.next()}}let j=UU(l);if(w)o.add(v,v,Pt.widget({widget:new bje(j),diagnostics:l.slice()}));else{let C=l.reduce((T,E)=>E.markClass?T+" "+E.markClass:T,"");o.add(v,S,Pt.mark({class:"cm-lintRange cm-lintRange-"+j+C,diagnostics:l.slice(),inclusiveEnd:l.some(T=>T.to>S)}))}if(u=S,u==f)break;for(let C=0;C<l.length;C++)l[C].to<=u&&l.splice(C--,1)}let g=o.finish();return new dd(g,r,xu(g))}}function xu(e,n=null,r=0){let i=null;return e.between(r,1e9,(s,a,{spec:o})=>{if(!(n&&o.diagnostics.indexOf(n)<0))if(!i)i=new D6(s,a,n||o.diagnostics[0]);else{if(o.diagnostics.indexOf(i.diagnostic)<0)return!1;i=new D6(i.from,a,i.diagnostic)}}),i}function zU(e,n){let r=n.pos,i=n.end||r,s=e.state.facet(Ko).hideOn(e,r,i);if(s!=null)return s;let a=e.startState.doc.lineAt(n.pos);return!!(e.effects.some(o=>o.is(mk))||e.changes.touchesRange(a.from,Math.max(a.to,i)))}function $U(e,n){return e.field(na,!1)?n:n.concat(Gt.appendConfig.of(YU))}function hje(e,n){return{effects:$U(e,[mk.of(n)])}}const mk=Gt.define(),HT=Gt.define(),FU=Gt.define(),na=_i.define({create(){return new dd(Pt.none,null,null)},update(e,n){if(n.docChanged&&e.diagnostics.size){let r=e.diagnostics.map(n.changes),i=null,s=e.panel;if(e.selected){let a=n.changes.mapPos(e.selected.from,1);i=xu(r,e.selected.diagnostic,a)||xu(r,null,a)}!r.size&&s&&n.state.facet(Ko).autoPanel&&(s=null),e=new dd(r,s,i)}for(let r of n.effects)if(r.is(mk)){let i=n.state.facet(Ko).autoPanel?r.value.length?cv.open:null:e.panel;e=dd.init(r.value,i,n.state)}else r.is(HT)?e=new dd(e.diagnostics,r.value?cv.open:null,e.selected):r.is(FU)&&(e=new dd(e.diagnostics,e.panel,r.value));return e},provide:e=>[nv.from(e,n=>n.panel),ct.decorations.from(e,n=>n.diagnostics)]}),fje=Pt.mark({class:"cm-lintRange cm-lintRange-active"});function pje(e,n,r){let{diagnostics:i}=e.state.field(na),s,a=-1,o=-1;i.between(n-(r<0?1:0),n+(r>0?1:0),(u,d,{spec:p})=>{if(n>=u&&n<=d&&(u==d||(n>u||r>0)&&(n<d||r<0)))return s=p.diagnostics,a=u,o=d,!1});let l=e.state.facet(Ko).tooltipFilter;return s&&l&&(s=l(s,e.state)),s?{pos:a,end:o,above:e.state.doc.lineAt(a).to<o,create(){return{dom:HU(e,s)}}}:null}function HU(e,n){return Kn("ul",{class:"cm-tooltip-lint"},n.map(r=>qU(e,r,!1)))}const mje=e=>{let n=e.state.field(na,!1);(!n||!n.panel)&&e.dispatch({effects:$U(e.state,[HT.of(!0)])});let r=ST(e,cv.open);return r&&r.dom.querySelector(".cm-panel-lint ul").focus(),!0},P6=e=>{let n=e.state.field(na,!1);return!n||!n.panel?!1:(e.dispatch({effects:HT.of(!1)}),!0)},gje=e=>{let n=e.state.field(na,!1);if(!n)return!1;let r=e.state.selection.main,i=xu(n.diagnostics,null,r.to+1);return!i&&(i=xu(n.diagnostics,null,0),!i||i.from==r.from&&i.to==r.to)?!1:(e.dispatch({selection:{anchor:i.from,head:i.to},scrollIntoView:!0}),!0)},vje=[{key:"Mod-Shift-m",run:mje,preventDefault:!0},{key:"F8",run:gje}],yje=Cr.fromClass(class{constructor(e){this.view=e,this.timeout=-1,this.set=!0;let{delay:n}=e.state.facet(Ko);this.lintTime=Date.now()+n,this.run=this.run.bind(this),this.timeout=setTimeout(this.run,n)}run(){clearTimeout(this.timeout);let e=Date.now();if(e<this.lintTime-10)this.timeout=setTimeout(this.run,this.lintTime-e);else{this.set=!1;let{state:n}=this.view,{sources:r}=n.facet(Ko);r.length&&_je(r.map(i=>Promise.resolve(i(this.view))),i=>{this.view.state.doc==n.doc&&this.view.dispatch(hje(this.view.state,i.reduce((s,a)=>s.concat(a))))},i=>{ss(this.view.state,i)})}}update(e){let n=e.state.facet(Ko);(e.docChanged||n!=e.startState.facet(Ko)||n.needsRefresh&&n.needsRefresh(e))&&(this.lintTime=Date.now()+n.delay,this.set||(this.set=!0,this.timeout=setTimeout(this.run,n.delay)))}force(){this.set&&(this.lintTime=Date.now(),this.run())}destroy(){clearTimeout(this.timeout)}});function _je(e,n,r){let i=[],s=-1;for(let a of e)a.then(o=>{i.push(o),clearTimeout(s),i.length==e.length?n(i):s=setTimeout(()=>n(i),200)},r)}const Ko=pt.define({combine(e){return{sources:e.map(n=>n.source).filter(n=>n!=null),...oo(e.map(n=>n.config),{delay:750,markerFilter:null,tooltipFilter:null,needsRefresh:null,hideOn:()=>null},{delay:Math.max,markerFilter:L6,tooltipFilter:L6,needsRefresh:(n,r)=>n?r?i=>n(i)||r(i):n:r,hideOn:(n,r)=>n?r?(i,s,a)=>n(i,s,a)||r(i,s,a):n:r,autoPanel:(n,r)=>n||r})}}});function L6(e,n){return e?n?(r,i)=>n(e(r,i),i):e:n}function xje(e,n={}){return[Ko.of({source:e,config:n}),yje,YU]}function WU(e){let n=[];if(e)e:for(let{name:r}of e){for(let i=0;i<r.length;i++){let s=r[i];if(/[a-zA-Z]/.test(s)&&!n.some(a=>a.toLowerCase()==s.toLowerCase())){n.push(s);continue e}}n.push("")}return n}function qU(e,n,r){var i;let s=r?WU(n.actions):[];return Kn("li",{class:"cm-diagnostic cm-diagnostic-"+n.severity},Kn("span",{class:"cm-diagnosticText"},n.renderMessage?n.renderMessage(e):n.message),(i=n.actions)===null||i===void 0?void 0:i.map((a,o)=>{let l=!1,u=_=>{if(_.preventDefault(),l)return;l=!0;let x=xu(e.state.field(na).diagnostics,n);x&&a.apply(e,x.from,x.to)},{name:d}=a,p=s[o]?d.indexOf(s[o]):-1,f=p<0?d:[d.slice(0,p),Kn("u",d.slice(p,p+1)),d.slice(p+1)],g=a.markClass?" "+a.markClass:"";return Kn("button",{type:"button",class:"cm-diagnosticAction"+g,onclick:u,onmousedown:u,"aria-label":` Action: ${d}${p<0?"":` (access key "${s[o]})"`}.`},f)}),n.source&&Kn("div",{class:"cm-diagnosticSource"},n.source))}class bje extends ol{constructor(n){super(),this.sev=n}eq(n){return n.sev==this.sev}toDOM(){return Kn("span",{class:"cm-lintPoint cm-lintPoint-"+this.sev})}}class I6{constructor(n,r){this.diagnostic=r,this.id="item_"+Math.floor(Math.random()*4294967295).toString(16),this.dom=qU(n,r,!0),this.dom.id=this.id,this.dom.setAttribute("role","option")}}class cv{constructor(n){this.view=n,this.items=[];let r=s=>{if(!(s.ctrlKey||s.altKey||s.metaKey)){if(s.keyCode==27)P6(this.view),this.view.focus();else if(s.keyCode==38||s.keyCode==33)this.moveSelection((this.selectedIndex-1+this.items.length)%this.items.length);else if(s.keyCode==40||s.keyCode==34)this.moveSelection((this.selectedIndex+1)%this.items.length);else if(s.keyCode==36)this.moveSelection(0);else if(s.keyCode==35)this.moveSelection(this.items.length-1);else if(s.keyCode==13)this.view.focus();else if(s.keyCode>=65&&s.keyCode<=90&&this.selectedIndex>=0){let{diagnostic:a}=this.items[this.selectedIndex],o=WU(a.actions);for(let l=0;l<o.length;l++)if(o[l].toUpperCase().charCodeAt(0)==s.keyCode){let u=xu(this.view.state.field(na).diagnostics,a);u&&a.actions[l].apply(n,u.from,u.to)}}else return;s.preventDefault()}},i=s=>{for(let a=0;a<this.items.length;a++)this.items[a].dom.contains(s.target)&&this.moveSelection(a)};this.list=Kn("ul",{tabIndex:0,role:"listbox","aria-label":this.view.state.phrase("Diagnostics"),onkeydown:r,onclick:i}),this.dom=Kn("div",{class:"cm-panel-lint"},this.list,Kn("button",{type:"button",name:"close","aria-label":this.view.state.phrase("close"),onclick:()=>P6(this.view)},"×")),this.update()}get selectedIndex(){let n=this.view.state.field(na).selected;if(!n)return-1;for(let r=0;r<this.items.length;r++)if(this.items[r].diagnostic==n.diagnostic)return r;return-1}update(){let{diagnostics:n,selected:r}=this.view.state.field(na),i=0,s=!1,a=null,o=new Set;for(n.between(0,this.view.state.doc.length,(l,u,{spec:d})=>{for(let p of d.diagnostics){if(o.has(p))continue;o.add(p);let f=-1,g;for(let _=i;_<this.items.length;_++)if(this.items[_].diagnostic==p){f=_;break}f<0?(g=new I6(this.view,p),this.items.splice(i,0,g),s=!0):(g=this.items[f],f>i&&(this.items.splice(i,f-i),s=!0)),r&&g.diagnostic==r.diagnostic?g.dom.hasAttribute("aria-selected")||(g.dom.setAttribute("aria-selected","true"),a=g):g.dom.hasAttribute("aria-selected")&&g.dom.removeAttribute("aria-selected"),i++}});i<this.items.length&&!(this.items.length==1&&this.items[0].diagnostic.from<0);)s=!0,this.items.pop();this.items.length==0&&(this.items.push(new I6(this.view,{from:-1,to:-1,severity:"info",message:this.view.state.phrase("No diagnostics")})),s=!0),a?(this.list.setAttribute("aria-activedescendant",a.id),this.view.requestMeasure({key:this,read:()=>({sel:a.dom.getBoundingClientRect(),panel:this.list.getBoundingClientRect()}),write:({sel:l,panel:u})=>{let d=u.height/this.list.offsetHeight;l.top<u.top?this.list.scrollTop-=(u.top-l.top)/d:l.bottom>u.bottom&&(this.list.scrollTop+=(l.bottom-u.bottom)/d)}})):this.selectedIndex<0&&this.list.removeAttribute("aria-activedescendant"),s&&this.sync()}sync(){let n=this.list.firstChild;function r(){let i=n;n=i.nextSibling,i.remove()}for(let i of this.items)if(i.dom.parentNode==this.list){for(;n!=i.dom;)r();n=i.dom.nextSibling}else this.list.insertBefore(i.dom,n);for(;n;)r()}moveSelection(n){if(this.selectedIndex<0)return;let r=this.view.state.field(na),i=xu(r.diagnostics,this.items[n].diagnostic);i&&this.view.dispatch({selection:{anchor:i.from,head:i.to},scrollIntoView:!0,effects:FU.of(i)})}static open(n){return new cv(n)}}function $x(e,n='viewBox="0 0 40 40"'){return`url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" ${n}>${encodeURIComponent(e)}</svg>')`}function X_(e){return $x(`<path d="m0 2.5 l2 -1.5 l1 0 l2 1.5 l1 0" stroke="${e}" fill="none" stroke-width=".7"/>`,'width="6" height="3"')}const kje=ct.baseTheme({".cm-diagnostic":{padding:"3px 6px 3px 8px",marginLeft:"-1px",display:"block",whiteSpace:"pre-wrap"},".cm-diagnostic-error":{borderLeft:"5px solid #d11"},".cm-diagnostic-warning":{borderLeft:"5px solid orange"},".cm-diagnostic-info":{borderLeft:"5px solid #999"},".cm-diagnostic-hint":{borderLeft:"5px solid #66d"},".cm-diagnosticAction":{font:"inherit",border:"none",padding:"2px 4px",backgroundColor:"#444",color:"white",borderRadius:"3px",marginLeft:"8px",cursor:"pointer"},".cm-diagnosticSource":{fontSize:"70%",opacity:.7},".cm-lintRange":{backgroundPosition:"left bottom",backgroundRepeat:"repeat-x",paddingBottom:"0.7px"},".cm-lintRange-error":{backgroundImage:X_("#d11")},".cm-lintRange-warning":{backgroundImage:X_("orange")},".cm-lintRange-info":{backgroundImage:X_("#999")},".cm-lintRange-hint":{backgroundImage:X_("#66d")},".cm-lintRange-active":{backgroundColor:"#ffdd9980"},".cm-tooltip-lint":{padding:0,margin:0},".cm-lintPoint":{position:"relative","&:after":{content:'""',position:"absolute",bottom:0,left:"-2px",borderLeft:"3px solid transparent",borderRight:"3px solid transparent",borderBottom:"4px solid #d11"}},".cm-lintPoint-warning":{"&:after":{borderBottomColor:"orange"}},".cm-lintPoint-info":{"&:after":{borderBottomColor:"#999"}},".cm-lintPoint-hint":{"&:after":{borderBottomColor:"#66d"}},".cm-panel.cm-panel-lint":{position:"relative","& ul":{maxHeight:"100px",overflowY:"auto","& [aria-selected]":{backgroundColor:"#ddd","& u":{textDecoration:"underline"}},"&:focus [aria-selected]":{background_fallback:"#bdf",backgroundColor:"Highlight",color_fallback:"white",color:"HighlightText"},"& u":{textDecoration:"none"},padding:0,margin:0},"& [name=close]":{position:"absolute",top:"0",right:"2px",background:"inherit",border:"none",font:"inherit",padding:0,margin:0}},"&dark .cm-lintRange-active":{backgroundColor:"#86714a80"},"&dark .cm-panel.cm-panel-lint ul":{"& [aria-selected]":{backgroundColor:"#2e343e"}}});function wje(e){return e=="error"?4:e=="warning"?3:e=="info"?2:1}function UU(e){let n="hint",r=1;for(let i of e){let s=wje(i.severity);s>r&&(r=s,n=i.severity)}return n}class KU extends tl{constructor(n){super(),this.diagnostics=n,this.severity=UU(n)}toDOM(n){let r=document.createElement("div");r.className="cm-lint-marker cm-lint-marker-"+this.severity;let i=this.diagnostics,s=n.state.facet(gk).tooltipFilter;return s&&(i=s(i,n.state)),i.length&&(r.onmouseover=()=>Cje(n,r,i)),r}}function Sje(e,n){let r=i=>{let s=n.getBoundingClientRect();if(!(i.clientX>s.left-10&&i.clientX<s.right+10&&i.clientY>s.top-10&&i.clientY<s.bottom+10)){for(let a=i.target;a;a=a.parentNode)if(a.nodeType==1&&a.classList.contains("cm-tooltip-lint"))return;window.removeEventListener("mousemove",r),e.state.field(VU)&&e.dispatch({effects:WT.of(null)})}};window.addEventListener("mousemove",r)}function Cje(e,n,r){function i(){let o=e.elementAtHeight(n.getBoundingClientRect().top+5-e.documentTop);e.coordsAtPos(o.from)&&e.dispatch({effects:WT.of({pos:o.from,above:!1,clip:!1,create(){return{dom:HU(e,r),getCoords:()=>n.getBoundingClientRect()}}})}),n.onmouseout=n.onmousemove=null,Sje(e,n)}let{hoverTime:s}=e.state.facet(gk),a=setTimeout(i,s);n.onmouseout=()=>{clearTimeout(a),n.onmouseout=n.onmousemove=null},n.onmousemove=()=>{clearTimeout(a),a=setTimeout(i,s)}}function jje(e,n){let r=Object.create(null);for(let s of n){let a=e.lineAt(s.from);(r[a.from]||(r[a.from]=[])).push(s)}let i=[];for(let s in r)i.push(new KU(r[s]).range(+s));return rn.of(i,!0)}const Nje=pq({class:"cm-gutter-lint",markers:e=>e.state.field(KN),widgetMarker:(e,n,r)=>{let i=[];return e.state.field(KN).between(r.from,r.to,(s,a,o)=>{s>r.from&&s<r.to&&i.push(...o.diagnostics)}),i.length?new KU(i):null}}),KN=_i.define({create(){return rn.empty},update(e,n){e=e.map(n.changes);let r=n.state.facet(gk).markerFilter;for(let i of n.effects)if(i.is(mk)){let s=i.value;r&&(s=r(s||[],n.state)),e=jje(n.state.doc,s.slice(0))}return e}}),WT=Gt.define(),VU=_i.define({create(){return null},update(e,n){return e&&n.docChanged&&(e=zU(n,e)?null:{...e,pos:n.changes.mapPos(e.pos)}),n.effects.reduce((r,i)=>i.is(WT)?i.value:r,e)},provide:e=>sk.from(e)}),Eje=ct.baseTheme({".cm-gutter-lint":{width:"1.4em","& .cm-gutterElement":{padding:".2em"}},".cm-lint-marker":{width:"1em",height:"1em"},".cm-lint-marker-info":{content:$x('<path fill="#aaf" stroke="#77e" stroke-width="6" stroke-linejoin="round" d="M5 5L35 5L35 35L5 35Z"/>')},".cm-lint-marker-warning":{content:$x('<path fill="#fe8" stroke="#fd7" stroke-width="6" stroke-linejoin="round" d="M20 6L37 35L3 35Z"/>')},".cm-lint-marker-error":{content:$x('<circle cx="20" cy="20" r="15" fill="#f87" stroke="#f43" stroke-width="6"/>')}}),YU=[na,ct.decorations.compute([na],e=>{let{selected:n,panel:r}=e.field(na);return!n||!r||n.from==n.to?Pt.none:Pt.set([fje.range(n.from,n.to)])}),gwe(pje,{hideOn:zU}),kje],gk=pt.define({combine(e){return oo(e,{hoverTime:300,markerFilter:null,tooltipFilter:null})}});function Aje(e={}){return[gk.of(e),KN,Nje,Eje,VU]}var B6=function(n){n===void 0&&(n={});var{crosshairCursor:r=!1}=n,i=[];n.closeBracketsKeymap!==!1&&(i=i.concat(rje)),n.defaultKeymap!==!1&&(i=i.concat(G2e)),n.searchKeymap!==!1&&(i=i.concat(kCe)),n.historyKeymap!==!1&&(i=i.concat(n2e)),n.foldKeymap!==!1&&(i=i.concat(gSe)),n.completionKeymap!==!1&&(i=i.concat(BU)),n.lintKeymap!==!1&&(i=i.concat(vje));var s=[];return n.lineNumbers!==!1&&s.push(Ewe()),n.highlightActiveLineGutter!==!1&&s.push(Mwe()),n.highlightSpecialChars!==!1&&s.push(U1e()),n.history!==!1&&s.push(VSe()),n.foldGutter!==!1&&s.push(xSe()),n.drawSelection!==!1&&s.push(D1e()),n.dropCursor!==!1&&s.push(z1e()),n.allowMultipleSelections!==!1&&s.push(yn.allowMultipleSelections.of(!0)),n.indentOnInput!==!1&&s.push(aSe()),n.syntaxHighlighting!==!1&&s.push(Bq(SSe,{fallback:!0})),n.bracketMatching!==!1&&s.push(MSe()),n.closeBrackets!==!1&&s.push(JCe()),n.autocompletion!==!1&&s.push(uje()),n.rectangularSelection!==!1&&s.push(swe()),r!==!1&&s.push(lwe()),n.highlightActiveLine!==!1&&s.push(Q1e()),n.highlightSelectionMatches!==!1&&s.push(tCe()),n.tabSize&&typeof n.tabSize=="number"&&s.push(ok.of(" ".repeat(n.tabSize))),s.concat([ik.of(i.flat())]).filter(Boolean)};const Tje="#e5c07b",z6="#e06c75",Mje="#56b6c2",Rje="#ffffff",Fx="#abb2bf",VN="#7d8799",Oje="#61afef",Dje="#98c379",$6="#d19a66",Pje="#c678dd",Lje="#21252b",F6="#2c313a",H6="#282c34",f2="#353a42",Ije="#3E4451",W6="#528bff",Bje=ct.theme({"&":{color:Fx,backgroundColor:H6},".cm-content":{caretColor:W6},".cm-cursor, .cm-dropCursor":{borderLeftColor:W6},"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection":{backgroundColor:Ije},".cm-panels":{backgroundColor:Lje,color:Fx},".cm-panels.cm-panels-top":{borderBottom:"2px solid black"},".cm-panels.cm-panels-bottom":{borderTop:"2px solid black"},".cm-searchMatch":{backgroundColor:"#72a1ff59",outline:"1px solid #457dff"},".cm-searchMatch.cm-searchMatch-selected":{backgroundColor:"#6199ff2f"},".cm-activeLine":{backgroundColor:"#6699ff0b"},".cm-selectionMatch":{backgroundColor:"#aafe661a"},"&.cm-focused .cm-matchingBracket, &.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bad0f847"},".cm-gutters":{backgroundColor:H6,color:VN,border:"none"},".cm-activeLineGutter":{backgroundColor:F6},".cm-foldPlaceholder":{backgroundColor:"transparent",border:"none",color:"#ddd"},".cm-tooltip":{border:"none",backgroundColor:f2},".cm-tooltip .cm-tooltip-arrow:before":{borderTopColor:"transparent",borderBottomColor:"transparent"},".cm-tooltip .cm-tooltip-arrow:after":{borderTopColor:f2,borderBottomColor:f2},".cm-tooltip-autocomplete":{"& > ul > li[aria-selected]":{backgroundColor:F6,color:Fx}}},{dark:!0}),zje=Vv.define([{tag:Te.keyword,color:Pje},{tag:[Te.name,Te.deleted,Te.character,Te.propertyName,Te.macroName],color:z6},{tag:[Te.function(Te.variableName),Te.labelName],color:Oje},{tag:[Te.color,Te.constant(Te.name),Te.standard(Te.name)],color:$6},{tag:[Te.definition(Te.name),Te.separator],color:Fx},{tag:[Te.typeName,Te.className,Te.number,Te.changed,Te.annotation,Te.modifier,Te.self,Te.namespace],color:Tje},{tag:[Te.operator,Te.operatorKeyword,Te.url,Te.escape,Te.regexp,Te.link,Te.special(Te.string)],color:Mje},{tag:[Te.meta,Te.comment],color:VN},{tag:Te.strong,fontWeight:"bold"},{tag:Te.emphasis,fontStyle:"italic"},{tag:Te.strikethrough,textDecoration:"line-through"},{tag:Te.link,color:VN,textDecoration:"underline"},{tag:Te.heading,fontWeight:"bold",color:z6},{tag:[Te.atom,Te.bool,Te.special(Te.variableName)],color:$6},{tag:[Te.processingInstruction,Te.string,Te.inserted],color:Dje},{tag:Te.invalid,color:Rje}]),$je=[Bje,Bq(zje)];var Fje=ct.theme({"&":{backgroundColor:"#fff"}},{dark:!1}),Hje=function(n){n===void 0&&(n={});var{indentWithTab:r=!0,editable:i=!0,readOnly:s=!1,theme:a="light",placeholder:o="",basicSetup:l=!0}=n,u=[];switch(r&&u.unshift(ik.of([X2e])),l&&(typeof l=="boolean"?u.unshift(B6()):u.unshift(B6(l))),o&&u.unshift(twe(o)),a){case"light":u.push(Fje);break;case"dark":u.push($je);break;case"none":break;default:u.push(a);break}return i===!1&&u.push(ct.editable.of(!1)),s&&u.push(yn.readOnly.of(!0)),[...u]},Wje=e=>({line:e.state.doc.lineAt(e.state.selection.main.from),lineCount:e.state.doc.lines,lineBreak:e.state.lineBreak,length:e.state.doc.length,readOnly:e.state.readOnly,tabSize:e.state.tabSize,selection:e.state.selection,selectionAsSingle:e.state.selection.asSingle().main,ranges:e.state.selection.ranges,selectionCode:e.state.sliceDoc(e.state.selection.main.from,e.state.selection.main.to),selections:e.state.selection.ranges.map(n=>e.state.sliceDoc(n.from,n.to)),selectedText:e.state.selection.ranges.some(n=>!n.empty)});class qje{constructor(n,r){this.timeLeftMS=void 0,this.timeoutMS=void 0,this.isCancelled=!1,this.isTimeExhausted=!1,this.callbacks=[],this.timeLeftMS=r,this.timeoutMS=r,this.callbacks.push(n)}tick(){if(!this.isCancelled&&!this.isTimeExhausted&&(this.timeLeftMS--,this.timeLeftMS<=0)){this.isTimeExhausted=!0;var n=this.callbacks.slice();this.callbacks.length=0,n.forEach(r=>{try{r()}catch(i){console.error("TimeoutLatch callback error:",i)}})}}cancel(){this.isCancelled=!0,this.callbacks.length=0}reset(){this.timeLeftMS=this.timeoutMS,this.isCancelled=!1,this.isTimeExhausted=!1}get isDone(){return this.isCancelled||this.isTimeExhausted}}class q6{constructor(){this.interval=null,this.latches=new Set}add(n){this.latches.add(n),this.start()}remove(n){this.latches.delete(n),this.latches.size===0&&this.stop()}start(){this.interval===null&&(this.interval=setInterval(()=>{this.latches.forEach(n=>{n.tick(),n.isDone&&this.remove(n)})},1))}stop(){this.interval!==null&&(clearInterval(this.interval),this.interval=null)}}var p2=null,Uje=()=>typeof window>"u"?new q6:(p2||(p2=new q6),p2),U6=al.define(),Kje=200,Vje=[];function Yje(e){var{value:n,selection:r,onChange:i,onStatistics:s,onCreateEditor:a,onUpdate:o,extensions:l=Vje,autoFocus:u,theme:d="light",height:p=null,minHeight:f=null,maxHeight:g=null,width:_=null,minWidth:x=null,maxWidth:v=null,placeholder:S="",editable:w=!0,readOnly:j=!1,indentWithTab:C=!0,basicSetup:T=!0,root:E,initialState:A}=e,[O,F]=b.useState(),[L,$]=b.useState(),[z,B]=b.useState(),H=b.useState(()=>({current:null}))[0],D=b.useState(()=>({current:null}))[0],U=ct.theme({"&":{height:p,minHeight:f,maxHeight:g,width:_,minWidth:x,maxWidth:v},"& .cm-scroller":{height:"100% !important"}}),I=ct.updateListener.of(Q=>{if(Q.docChanged&&typeof i=="function"&&!Q.transactions.some(q=>q.annotation(U6))){H.current?H.current.reset():(H.current=new qje(()=>{if(D.current){var q=D.current;D.current=null,q()}H.current=null},Kje),Uje().add(H.current));var V=Q.state.doc,R=V.toString();i(R,Q)}s&&s(Wje(Q))}),X=Hje({theme:d,editable:w,readOnly:j,placeholder:S,indentWithTab:C,basicSetup:T}),K=[I,U,...X];return o&&typeof o=="function"&&K.push(ct.updateListener.of(o)),K=K.concat(l),b.useLayoutEffect(()=>{if(O&&!z){var Q={doc:n,selection:r,extensions:K},V=A?yn.fromJSON(A.json,Q,A.fields):yn.create(Q);if(B(V),!L){var R=new ct({state:V,parent:O,root:E});$(R),a&&a(R,V)}}return()=>{L&&(B(void 0),$(void 0))}},[O,z]),b.useEffect(()=>{e.container&&F(e.container)},[e.container]),b.useEffect(()=>()=>{L&&(L.destroy(),$(void 0)),H.current&&(H.current.cancel(),H.current=null)},[L]),b.useEffect(()=>{u&&L&&L.focus()},[u,L]),b.useEffect(()=>{L&&L.dispatch({effects:Gt.reconfigure.of(K)})},[d,l,p,f,g,_,x,v,S,w,j,C,T,i,o]),b.useEffect(()=>{if(n!==void 0){var Q=L?L.state.doc.toString():"";if(L&&n!==Q){var V=H.current&&!H.current.isDone,R=()=>{L&&n!==L.state.doc.toString()&&L.dispatch({changes:{from:0,to:L.state.doc.toString().length,insert:n||""},annotations:[U6.of(!0)]})};V?D.current=R:R()}}},[n,L]),{state:z,setState:B,view:L,setView:$,container:O,setContainer:F}}var Gje=["className","value","selection","extensions","onChange","onStatistics","onCreateEditor","onUpdate","autoFocus","theme","height","minHeight","maxHeight","width","minWidth","maxWidth","basicSetup","placeholder","indentWithTab","editable","readOnly","root","initialState"],GU=b.forwardRef((e,n)=>{var{className:r,value:i="",selection:s,extensions:a=[],onChange:o,onStatistics:l,onCreateEditor:u,onUpdate:d,autoFocus:p,theme:f="light",height:g,minHeight:_,maxHeight:x,width:v,minWidth:S,maxWidth:w,basicSetup:j,placeholder:C,indentWithTab:T,editable:E,readOnly:A,root:O,initialState:F}=e,L=k0e(e,Gje),$=b.useRef(null),{state:z,view:B,container:H,setContainer:D}=Yje({root:O,value:i,autoFocus:p,theme:f,height:g,minHeight:_,maxHeight:x,width:v,minWidth:S,maxWidth:w,basicSetup:j,placeholder:C,indentWithTab:T,editable:E,readOnly:A,selection:s,onChange:o,onStatistics:l,onCreateEditor:u,onUpdate:d,extensions:a,initialState:F});b.useImperativeHandle(n,()=>({editor:$.current,state:z,view:B}),[$,H,z,B]);var U=b.useCallback(X=>{$.current=X,D(X)},[D]);if(typeof i!="string")throw new Error("value must be typeof string but got "+typeof i);var I=typeof f=="string"?"cm-theme-"+f:"cm-theme";return c.jsx("div",Zj({ref:U,className:""+I+(r?" "+r:"")},L))});GU.displayName="CodeMirror";var K6={};class n0{constructor(n,r,i,s,a,o,l,u,d,p=0,f){this.p=n,this.stack=r,this.state=i,this.reducePos=s,this.pos=a,this.score=o,this.buffer=l,this.bufferBase=u,this.curContext=d,this.lookAhead=p,this.parent=f}toString(){return`[${this.stack.filter((n,r)=>r%3==0).concat(this.state)}]@${this.pos}${this.score?"!"+this.score:""}`}static start(n,r,i=0){let s=n.parser.context;return new n0(n,[],r,i,i,0,[],0,s?new V6(s,s.start):null,0,null)}get context(){return this.curContext?this.curContext.context:null}pushState(n,r){this.stack.push(this.state,r,this.bufferBase+this.buffer.length),this.state=n}reduce(n){var r;let i=n>>19,s=n&65535,{parser:a}=this.p,o=this.reducePos<this.pos-25&&this.setLookAhead(this.pos),l=a.dynamicPrecedence(s);if(l&&(this.score+=l),i==0){s<a.minRepeatTerm&&this.reducePos<this.pos&&(this.reducePos=this.pos),this.pushState(a.getGoto(this.state,s,!0),this.reducePos),s<a.minRepeatTerm&&this.storeNode(s,this.reducePos,this.reducePos,o?8:4,!0),this.reduceContext(s,this.reducePos);return}let u=this.stack.length-(i-1)*3-(n&262144?6:0),d=u?this.stack[u-2]:this.p.ranges[0].from;s<a.minRepeatTerm&&d==this.reducePos&&this.reducePos<this.pos&&(this.reducePos=this.pos);let p=this.reducePos-d;p>=2e3&&!(!((r=this.p.parser.nodeSet.types[s])===null||r===void 0)&&r.isAnonymous)&&(d==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=p):this.p.lastBigReductionSize<p&&(this.p.bigReductionCount=1,this.p.lastBigReductionStart=d,this.p.lastBigReductionSize=p));let f=u?this.stack[u-1]:0,g=this.bufferBase+this.buffer.length-f;if(s<a.minRepeatTerm||n&131072){let _=a.stateFlag(this.state,1)?this.pos:this.reducePos;this.storeNode(s,d,_,g+4,!0)}if(n&262144)this.state=this.stack[u];else{let _=this.stack[u-3];this.state=a.getGoto(_,s,!0)}for(;this.stack.length>u;)this.stack.pop();this.reduceContext(s,d)}storeNode(n,r,i,s=4,a=!1){if(n==0&&(!this.stack.length||this.stack[this.stack.length-1]<this.buffer.length+this.bufferBase)){let o=this,l=this.buffer.length;if(l==0&&o.parent&&(l=o.bufferBase-o.parent.bufferBase,o=o.parent),l>0&&o.buffer[l-4]==0&&o.buffer[l-1]>-1){if(r==i)return;if(o.buffer[l-2]>=r){o.buffer[l-2]=i;return}}}if(!a||this.pos==i)this.buffer.push(n,r,i,s);else{let o=this.buffer.length;if(o>0&&(this.buffer[o-4]!=0||this.buffer[o-1]<0)){let l=!1;for(let u=o;u>0&&this.buffer[u-2]>i;u-=4)if(this.buffer[u-1]>=0){l=!0;break}if(l)for(;o>0&&this.buffer[o-2]>i;)this.buffer[o]=this.buffer[o-4],this.buffer[o+1]=this.buffer[o-3],this.buffer[o+2]=this.buffer[o-2],this.buffer[o+3]=this.buffer[o-1],o-=4,s>4&&(s-=4)}this.buffer[o]=n,this.buffer[o+1]=r,this.buffer[o+2]=i,this.buffer[o+3]=s}}shift(n,r,i,s){if(n&131072)this.pushState(n&65535,this.pos);else if((n&262144)==0){let a=n,{parser:o}=this.p;this.pos=s;let l=o.stateFlag(a,1);!l&&(s>i||r<=o.maxNode)&&(this.reducePos=s),this.pushState(a,l?i:Math.min(i,this.reducePos)),this.shiftContext(r,i),r<=o.maxNode&&this.buffer.push(r,i,s,4)}else this.pos=s,this.shiftContext(r,i),r<=this.p.parser.maxNode&&this.buffer.push(r,i,s,4)}apply(n,r,i,s){n&65536?this.reduce(n):this.shift(n,r,i,s)}useNode(n,r){let i=this.p.reused.length-1;(i<0||this.p.reused[i]!=n)&&(this.p.reused.push(n),i++);let s=this.pos;this.reducePos=this.pos=s+n.length,this.pushState(r,s),this.buffer.push(i,s,this.reducePos,-1),this.curContext&&this.updateContext(this.curContext.tracker.reuse(this.curContext.context,n,this,this.p.stream.reset(this.pos-n.length)))}split(){let n=this,r=n.buffer.length;for(;r>0&&n.buffer[r-2]>n.reducePos;)r-=4;let i=n.buffer.slice(r),s=n.bufferBase+r;for(;n&&s==n.bufferBase;)n=n.parent;return new n0(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,i,s,this.curContext,this.lookAhead,n)}recoverByDelete(n,r){let i=n<=this.p.parser.maxNode;i&&this.storeNode(n,this.pos,r,4),this.storeNode(0,this.pos,r,i?8:4),this.pos=this.reducePos=r,this.score-=190}canShift(n){for(let r=new Xje(this);;){let i=this.p.parser.stateSlot(r.state,4)||this.p.parser.hasAction(r.state,n);if(i==0)return!1;if((i&65536)==0)return!0;r.reduce(i)}}recoverByInsert(n){if(this.stack.length>=300)return[];let r=this.p.parser.nextStates(this.state);if(r.length>8||this.stack.length>=120){let s=[];for(let a=0,o;a<r.length;a+=2)(o=r[a+1])!=this.state&&this.p.parser.hasAction(o,n)&&s.push(r[a],o);if(this.stack.length<120)for(let a=0;s.length<8&&a<r.length;a+=2){let o=r[a+1];s.some((l,u)=>u&1&&l==o)||s.push(r[a],o)}r=s}let i=[];for(let s=0;s<r.length&&i.length<4;s+=2){let a=r[s+1];if(a==this.state)continue;let o=this.split();o.pushState(a,this.pos),o.storeNode(0,o.pos,o.pos,4,!0),o.shiftContext(r[s],this.pos),o.reducePos=this.pos,o.score-=200,i.push(o)}return i}forceReduce(){let{parser:n}=this.p,r=n.stateSlot(this.state,5);if((r&65536)==0)return!1;if(!n.validAction(this.state,r)){let i=r>>19,s=r&65535,a=this.stack.length-i*3;if(a<0||n.getGoto(this.stack[a],s,!1)<0){let o=this.findForcedReduction();if(o==null)return!1;r=o}this.storeNode(0,this.pos,this.pos,4,!0),this.score-=100}return this.reducePos=this.pos,this.reduce(r),!0}findForcedReduction(){let{parser:n}=this.p,r=[],i=(s,a)=>{if(!r.includes(s))return r.push(s),n.allActions(s,o=>{if(!(o&393216))if(o&65536){let l=(o>>19)-a;if(l>1){let u=o&65535,d=this.stack.length-l*3;if(d>=0&&n.getGoto(this.stack[d],u,!1)>=0)return l<<19|65536|u}}else{let l=i(o,a+1);if(l!=null)return l}})};return i(this.state,0)}forceAll(){for(;!this.p.parser.stateFlag(this.state,2);)if(!this.forceReduce()){this.storeNode(0,this.pos,this.pos,4,!0);break}return this}get deadEnd(){if(this.stack.length!=3)return!1;let{parser:n}=this.p;return n.data[n.stateSlot(this.state,1)]==65535&&!n.stateSlot(this.state,4)}restart(){this.storeNode(0,this.pos,this.pos,4,!0),this.state=this.stack[0],this.stack.length=0}sameState(n){if(this.state!=n.state||this.stack.length!=n.stack.length)return!1;for(let r=0;r<this.stack.length;r+=3)if(this.stack[r]!=n.stack[r])return!1;return!0}get parser(){return this.p.parser}dialectEnabled(n){return this.p.parser.dialect.flags[n]}shiftContext(n,r){this.curContext&&this.updateContext(this.curContext.tracker.shift(this.curContext.context,n,this,this.p.stream.reset(r)))}reduceContext(n,r){this.curContext&&this.updateContext(this.curContext.tracker.reduce(this.curContext.context,n,this,this.p.stream.reset(r)))}emitContext(){let n=this.buffer.length-1;(n<0||this.buffer[n]!=-3)&&this.buffer.push(this.curContext.hash,this.pos,this.pos,-3)}emitLookAhead(){let n=this.buffer.length-1;(n<0||this.buffer[n]!=-4)&&this.buffer.push(this.lookAhead,this.pos,this.pos,-4)}updateContext(n){if(n!=this.curContext.context){let r=new V6(this.curContext.tracker,n);r.hash!=this.curContext.hash&&this.emitContext(),this.curContext=r}}setLookAhead(n){return n<=this.lookAhead?!1:(this.emitLookAhead(),this.lookAhead=n,!0)}close(){this.curContext&&this.curContext.tracker.strict&&this.emitContext(),this.lookAhead>0&&this.emitLookAhead()}}class V6{constructor(n,r){this.tracker=n,this.context=r,this.hash=n.strict?n.hash(r):0}}class Xje{constructor(n){this.start=n,this.state=n.state,this.stack=n.stack,this.base=this.stack.length}reduce(n){let r=n&65535,i=n>>19;i==0?(this.stack==this.start.stack&&(this.stack=this.stack.slice()),this.stack.push(this.state,0,0),this.base+=3):this.base-=(i-1)*3;let s=this.start.p.parser.getGoto(this.stack[this.base-3],r,!0);this.state=s}}class r0{constructor(n,r,i){this.stack=n,this.pos=r,this.index=i,this.buffer=n.buffer,this.index==0&&this.maybeNext()}static create(n,r=n.bufferBase+n.buffer.length){return new r0(n,r,r-n.bufferBase)}maybeNext(){let n=this.stack.parent;n!=null&&(this.index=this.stack.bufferBase-n.bufferBase,this.stack=n,this.buffer=n.buffer)}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}next(){this.index-=4,this.pos-=4,this.index==0&&this.maybeNext()}fork(){return new r0(this.stack,this.pos,this.index)}}function Q_(e,n=Uint16Array){if(typeof e!="string")return e;let r=null;for(let i=0,s=0;i<e.length;){let a=0;for(;;){let o=e.charCodeAt(i++),l=!1;if(o==126){a=65535;break}o>=92&&o--,o>=34&&o--;let u=o-32;if(u>=46&&(u-=46,l=!0),a+=u,l)break;a*=46}r?r[s++]=a:r=new n(a)}return r}class Hx{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}}const Y6=new Hx;class Qje{constructor(n,r){this.input=n,this.ranges=r,this.chunk="",this.chunkOff=0,this.chunk2="",this.chunk2Pos=0,this.next=-1,this.token=Y6,this.rangeIndex=0,this.pos=this.chunkPos=r[0].from,this.range=r[0],this.end=r[r.length-1].to,this.readNext()}resolveOffset(n,r){let i=this.range,s=this.rangeIndex,a=this.pos+n;for(;a<i.from;){if(!s)return null;let o=this.ranges[--s];a-=i.from-o.to,i=o}for(;r<0?a>i.to:a>=i.to;){if(s==this.ranges.length-1)return null;let o=this.ranges[++s];a+=o.from-i.to,i=o}return a}clipPos(n){if(n>=this.range.from&&n<this.range.to)return n;for(let r of this.ranges)if(r.to>n)return Math.max(n,r.from);return this.end}peek(n){let r=this.chunkOff+n,i,s;if(r>=0&&r<this.chunk.length)i=this.pos+n,s=this.chunk.charCodeAt(r);else{let a=this.resolveOffset(n,1);if(a==null)return-1;if(i=a,i>=this.chunk2Pos&&i<this.chunk2Pos+this.chunk2.length)s=this.chunk2.charCodeAt(i-this.chunk2Pos);else{let o=this.rangeIndex,l=this.range;for(;l.to<=i;)l=this.ranges[++o];this.chunk2=this.input.chunk(this.chunk2Pos=i),i+this.chunk2.length>l.to&&(this.chunk2=this.chunk2.slice(0,l.to-i)),s=this.chunk2.charCodeAt(0)}}return i>=this.token.lookAhead&&(this.token.lookAhead=i+1),s}acceptToken(n,r=0){let i=r?this.resolveOffset(r,-1):this.pos;if(i==null||i<this.token.start)throw new RangeError("Token end out of bounds");this.token.value=n,this.token.end=i}acceptTokenTo(n,r){this.token.value=n,this.token.end=r}getChunk(){if(this.pos>=this.chunk2Pos&&this.pos<this.chunk2Pos+this.chunk2.length){let{chunk:n,chunkPos:r}=this;this.chunk=this.chunk2,this.chunkPos=this.chunk2Pos,this.chunk2=n,this.chunk2Pos=r,this.chunkOff=this.pos-this.chunkPos}else{this.chunk2=this.chunk,this.chunk2Pos=this.chunkPos;let n=this.input.chunk(this.pos),r=this.pos+n.length;this.chunk=r>this.range.to?n.slice(0,this.range.to-this.pos):n,this.chunkPos=this.pos,this.chunkOff=0}}readNext(){return this.chunkOff>=this.chunk.length&&(this.getChunk(),this.chunkOff==this.chunk.length)?this.next=-1:this.next=this.chunk.charCodeAt(this.chunkOff)}advance(n=1){for(this.chunkOff+=n;this.pos+n>=this.range.to;){if(this.rangeIndex==this.ranges.length-1)return this.setDone();n-=this.range.to-this.pos,this.range=this.ranges[++this.rangeIndex],this.pos=this.range.from}return this.pos+=n,this.pos>=this.token.lookAhead&&(this.token.lookAhead=this.pos+1),this.readNext()}setDone(){return this.pos=this.chunkPos=this.end,this.range=this.ranges[this.rangeIndex=this.ranges.length-1],this.chunk="",this.next=-1}reset(n,r){if(r?(this.token=r,r.start=n,r.lookAhead=n+1,r.value=r.extended=-1):this.token=Y6,this.pos!=n){if(this.pos=n,n==this.end)return this.setDone(),this;for(;n<this.range.from;)this.range=this.ranges[--this.rangeIndex];for(;n>=this.range.to;)this.range=this.ranges[++this.rangeIndex];n>=this.chunkPos&&n<this.chunkPos+this.chunk.length?this.chunkOff=n-this.chunkPos:(this.chunk="",this.chunkOff=0),this.readNext()}return this}read(n,r){if(n>=this.chunkPos&&r<=this.chunkPos+this.chunk.length)return this.chunk.slice(n-this.chunkPos,r-this.chunkPos);if(n>=this.chunk2Pos&&r<=this.chunk2Pos+this.chunk2.length)return this.chunk2.slice(n-this.chunk2Pos,r-this.chunk2Pos);if(n>=this.range.from&&r<=this.range.to)return this.input.read(n,r);let i="";for(let s of this.ranges){if(s.from>=r)break;s.to>n&&(i+=this.input.read(Math.max(s.from,n),Math.min(s.to,r)))}return i}}class Tf{constructor(n,r){this.data=n,this.id=r}token(n,r){let{parser:i}=r.p;Zje(this.data,n,r,this.id,i.data,i.tokenPrecTable)}}Tf.prototype.contextual=Tf.prototype.fallback=Tf.prototype.extend=!1;Tf.prototype.fallback=Tf.prototype.extend=!1;class vk{constructor(n,r={}){this.token=n,this.contextual=!!r.contextual,this.fallback=!!r.fallback,this.extend=!!r.extend}}function Zje(e,n,r,i,s,a){let o=0,l=1<<i,{dialect:u}=r.p.parser;e:for(;(l&e[o])!=0;){let d=e[o+1];for(let _=o+3;_<d;_+=2)if((e[_+1]&l)>0){let x=e[_];if(u.allows(x)&&(n.token.value==-1||n.token.value==x||Jje(x,n.token.value,s,a))){n.acceptToken(x);break}}let p=n.next,f=0,g=e[o+2];if(n.next<0&&g>f&&e[d+g*3-3]==65535){o=e[d+g*3-1];continue e}for(;f<g;){let _=f+g>>1,x=d+_+(_<<1),v=e[x],S=e[x+1]||65536;if(p<v)g=_;else if(p>=S)f=_+1;else{o=e[x+2],n.advance();continue e}}break}}function G6(e,n,r){for(let i=n,s;(s=e[i])!=65535;i++)if(s==r)return i-n;return-1}function Jje(e,n,r,i){let s=G6(r,i,n);return s<0||G6(r,i,e)<s}const Gs=typeof process<"u"&&K6&&/\bparse\b/.test(K6.LOG);let m2=null;function X6(e,n,r){let i=e.cursor(Mr.IncludeAnonymous);for(i.moveTo(n);;)if(!(r<0?i.childBefore(n):i.childAfter(n)))for(;;){if((r<0?i.to<n:i.from>n)&&!i.type.isError)return r<0?Math.max(0,Math.min(i.to-1,n-25)):Math.min(e.length,Math.max(i.from+1,n+25));if(r<0?i.prevSibling():i.nextSibling())break;if(!i.parent())return r<0?0:e.length}}class eNe{constructor(n,r){this.fragments=n,this.nodeSet=r,this.i=0,this.fragment=null,this.safeFrom=-1,this.safeTo=-1,this.trees=[],this.start=[],this.index=[],this.nextFragment()}nextFragment(){let n=this.fragment=this.i==this.fragments.length?null:this.fragments[this.i++];if(n){for(this.safeFrom=n.openStart?X6(n.tree,n.from+n.offset,1)-n.offset:n.from,this.safeTo=n.openEnd?X6(n.tree,n.to+n.offset,-1)-n.offset:n.to;this.trees.length;)this.trees.pop(),this.start.pop(),this.index.pop();this.trees.push(n.tree),this.start.push(-n.offset),this.index.push(0),this.nextStart=this.safeFrom}else this.nextStart=1e9}nodeAt(n){if(n<this.nextStart)return null;for(;this.fragment&&this.safeTo<=n;)this.nextFragment();if(!this.fragment)return null;for(;;){let r=this.trees.length-1;if(r<0)return this.nextFragment(),null;let i=this.trees[r],s=this.index[r];if(s==i.children.length){this.trees.pop(),this.start.pop(),this.index.pop();continue}let a=i.children[s],o=this.start[r]+i.positions[s];if(o>n)return this.nextStart=o,null;if(a instanceof zr){if(o==n){if(o<this.safeFrom)return null;let l=o+a.length;if(l<=this.safeTo){let u=a.prop(cn.lookAhead);if(!u||l+u<this.fragment.to)return a}}this.index[r]++,o+a.length>=Math.max(this.safeFrom,n)&&(this.trees.push(a),this.start.push(o),this.index.push(0))}else this.index[r]++,this.nextStart=o+a.length}}}class tNe{constructor(n,r){this.stream=r,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=n.tokenizers.map(i=>new Hx)}getActions(n){let r=0,i=null,{parser:s}=n.p,{tokenizers:a}=s,o=s.stateSlot(n.state,3),l=n.curContext?n.curContext.hash:0,u=0;for(let d=0;d<a.length;d++){if((1<<d&o)==0)continue;let p=a[d],f=this.tokens[d];if(!(i&&!p.fallback)&&((p.contextual||f.start!=n.pos||f.mask!=o||f.context!=l)&&(this.updateCachedToken(f,p,n),f.mask=o,f.context=l),f.lookAhead>f.end+25&&(u=Math.max(f.lookAhead,u)),f.value!=0)){let g=r;if(f.extended>-1&&(r=this.addActions(n,f.extended,f.end,r)),r=this.addActions(n,f.value,f.end,r),!p.extend&&(i=f,r>g))break}}for(;this.actions.length>r;)this.actions.pop();return u&&n.setLookAhead(u),!i&&n.pos==this.stream.end&&(i=new Hx,i.value=n.p.parser.eofTerm,i.start=i.end=n.pos,r=this.addActions(n,i.value,i.end,r)),this.mainToken=i,this.actions}getMainToken(n){if(this.mainToken)return this.mainToken;let r=new Hx,{pos:i,p:s}=n;return r.start=i,r.end=Math.min(i+1,s.stream.end),r.value=i==s.stream.end?s.parser.eofTerm:0,r}updateCachedToken(n,r,i){let s=this.stream.clipPos(i.pos);if(r.token(this.stream.reset(s,n),i),n.value>-1){let{parser:a}=i.p;for(let o=0;o<a.specialized.length;o++)if(a.specialized[o]==n.value){let l=a.specializers[o](this.stream.read(n.start,n.end),i);if(l>=0&&i.p.parser.dialect.allows(l>>1)){(l&1)==0?n.value=l>>1:n.extended=l>>1;break}}}else n.value=0,n.end=this.stream.clipPos(s+1)}putAction(n,r,i,s){for(let a=0;a<s;a+=3)if(this.actions[a]==n)return s;return this.actions[s++]=n,this.actions[s++]=r,this.actions[s++]=i,s}addActions(n,r,i,s){let{state:a}=n,{parser:o}=n.p,{data:l}=o;for(let u=0;u<2;u++)for(let d=o.stateSlot(a,u?2:1);;d+=3){if(l[d]==65535)if(l[d+1]==1)d=Pl(l,d+2);else{s==0&&l[d+1]==2&&(s=this.putAction(Pl(l,d+2),r,i,s));break}l[d]==r&&(s=this.putAction(Pl(l,d+1),r,i,s))}return s}}class nNe{constructor(n,r,i,s){this.parser=n,this.input=r,this.ranges=s,this.recovering=0,this.nextStackID=9812,this.minStackPos=0,this.reused=[],this.stoppedAt=null,this.lastBigReductionStart=-1,this.lastBigReductionSize=0,this.bigReductionCount=0,this.stream=new Qje(r,s),this.tokens=new tNe(n,this.stream),this.topTerm=n.top[1];let{from:a}=s[0];this.stacks=[n0.start(this,n.top[0],a)],this.fragments=i.length&&this.stream.end-a>n.bufferLength*4?new eNe(i,n.nodeSet):null}get parsedPos(){return this.minStackPos}advance(){let n=this.stacks,r=this.minStackPos,i=this.stacks=[],s,a;if(this.bigReductionCount>300&&n.length==1){let[o]=n;for(;o.forceReduce()&&o.stack.length&&o.stack[o.stack.length-2]>=this.lastBigReductionStart;);this.bigReductionCount=this.lastBigReductionSize=0}for(let o=0;o<n.length;o++){let l=n[o];for(;;){if(this.tokens.mainToken=null,l.pos>r)i.push(l);else{if(this.advanceStack(l,i,n))continue;{s||(s=[],a=[]),s.push(l);let u=this.tokens.getMainToken(l);a.push(u.value,u.end)}}break}}if(!i.length){let o=s&&sNe(s);if(o)return Gs&&console.log("Finish with "+this.stackID(o)),this.stackToTree(o);if(this.parser.strict)throw Gs&&s&&console.log("Stuck with token "+(this.tokens.mainToken?this.parser.getName(this.tokens.mainToken.value):"none")),new SyntaxError("No parse at "+r);this.recovering||(this.recovering=5)}if(this.recovering&&s){let o=this.stoppedAt!=null&&s[0].pos>this.stoppedAt?s[0]:this.runRecovery(s,a,i);if(o)return Gs&&console.log("Force-finish "+this.stackID(o)),this.stackToTree(o.forceAll())}if(this.recovering){let o=this.recovering==1?1:this.recovering*3;if(i.length>o)for(i.sort((l,u)=>u.score-l.score);i.length>o;)i.pop();i.some(l=>l.reducePos>r)&&this.recovering--}else if(i.length>1){e:for(let o=0;o<i.length-1;o++){let l=i[o];for(let u=o+1;u<i.length;u++){let d=i[u];if(l.sameState(d)||l.buffer.length>500&&d.buffer.length>500)if((l.score-d.score||l.buffer.length-d.buffer.length)>0)i.splice(u--,1);else{i.splice(o--,1);continue e}}}i.length>12&&(i.sort((o,l)=>l.score-o.score),i.splice(12,i.length-12))}this.minStackPos=i[0].pos;for(let o=1;o<i.length;o++)i[o].pos<this.minStackPos&&(this.minStackPos=i[o].pos);return null}stopAt(n){if(this.stoppedAt!=null&&this.stoppedAt<n)throw new RangeError("Can't move stoppedAt forward");this.stoppedAt=n}advanceStack(n,r,i){let s=n.pos,{parser:a}=this,o=Gs?this.stackID(n)+" -> ":"";if(this.stoppedAt!=null&&s>this.stoppedAt)return n.forceReduce()?n:null;if(this.fragments){let d=n.curContext&&n.curContext.tracker.strict,p=d?n.curContext.hash:0;for(let f=this.fragments.nodeAt(s);f;){let g=this.parser.nodeSet.types[f.type.id]==f.type?a.getGoto(n.state,f.type.id):-1;if(g>-1&&f.length&&(!d||(f.prop(cn.contextHash)||0)==p))return n.useNode(f,g),Gs&&console.log(o+this.stackID(n)+` (via reuse of ${a.getName(f.type.id)})`),!0;if(!(f instanceof zr)||f.children.length==0||f.positions[0]>0)break;let _=f.children[0];if(_ instanceof zr&&f.positions[0]==0)f=_;else break}}let l=a.stateSlot(n.state,4);if(l>0)return n.reduce(l),Gs&&console.log(o+this.stackID(n)+` (via always-reduce ${a.getName(l&65535)})`),!0;if(n.stack.length>=8400)for(;n.stack.length>6e3&&n.forceReduce(););let u=this.tokens.getActions(n);for(let d=0;d<u.length;){let p=u[d++],f=u[d++],g=u[d++],_=d==u.length||!i,x=_?n:n.split(),v=this.tokens.mainToken;if(x.apply(p,f,v?v.start:x.pos,g),Gs&&console.log(o+this.stackID(x)+` (via ${(p&65536)==0?"shift":`reduce of ${a.getName(p&65535)}`} for ${a.getName(f)} @ ${s}${x==n?"":", split"})`),_)return!0;x.pos>s?r.push(x):i.push(x)}return!1}advanceFully(n,r){let i=n.pos;for(;;){if(!this.advanceStack(n,null,null))return!1;if(n.pos>i)return Q6(n,r),!0}}runRecovery(n,r,i){let s=null,a=!1;for(let o=0;o<n.length;o++){let l=n[o],u=r[o<<1],d=r[(o<<1)+1],p=Gs?this.stackID(l)+" -> ":"";if(l.deadEnd&&(a||(a=!0,l.restart(),Gs&&console.log(p+this.stackID(l)+" (restarted)"),this.advanceFully(l,i))))continue;let f=l.split(),g=p;for(let _=0;_<10&&f.forceReduce()&&(Gs&&console.log(g+this.stackID(f)+" (via force-reduce)"),!this.advanceFully(f,i));_++)Gs&&(g=this.stackID(f)+" -> ");for(let _ of l.recoverByInsert(u))Gs&&console.log(p+this.stackID(_)+" (via recover-insert)"),this.advanceFully(_,i);this.stream.end>l.pos?(d==l.pos&&(d++,u=0),l.recoverByDelete(u,d),Gs&&console.log(p+this.stackID(l)+` (via recover-delete ${this.parser.getName(u)})`),Q6(l,i)):(!s||s.score<f.score)&&(s=f)}return s}stackToTree(n){return n.close(),zr.build({buffer:r0.create(n),nodeSet:this.parser.nodeSet,topID:this.topTerm,maxBufferLength:this.parser.bufferLength,reused:this.reused,start:this.ranges[0].from,length:n.pos-this.ranges[0].from,minRepeatType:this.parser.minRepeatTerm})}stackID(n){let r=(m2||(m2=new WeakMap)).get(n);return r||m2.set(n,r=String.fromCodePoint(this.nextStackID++)),r+n}}function Q6(e,n){for(let r=0;r<n.length;r++){let i=n[r];if(i.pos==e.pos&&i.sameState(e)){n[r].score<e.score&&(n[r]=e);return}}n.push(e)}class rNe{constructor(n,r,i){this.source=n,this.flags=r,this.disabled=i}allows(n){return!this.disabled||this.disabled[n]==0}}const g2=e=>e;class iNe{constructor(n){this.start=n.start,this.shift=n.shift||g2,this.reduce=n.reduce||g2,this.reuse=n.reuse||g2,this.hash=n.hash||(()=>0),this.strict=n.strict!==!1}}class i0 extends bq{constructor(n){if(super(),this.wrappers=[],n.version!=14)throw new RangeError(`Parser version (${n.version}) doesn't match runtime version (14)`);let r=n.nodeNames.split(" ");this.minRepeatTerm=r.length;for(let l=0;l<n.repeatNodeCount;l++)r.push("");let i=Object.keys(n.topRules).map(l=>n.topRules[l][1]),s=[];for(let l=0;l<r.length;l++)s.push([]);function a(l,u,d){s[l].push([u,u.deserialize(String(d))])}if(n.nodeProps)for(let l of n.nodeProps){let u=l[0];typeof u=="string"&&(u=cn[u]);for(let d=1;d<l.length;){let p=l[d++];if(p>=0)a(p,u,l[d++]);else{let f=l[d+-p];for(let g=-p;g>0;g--)a(l[d++],u,f);d++}}}this.nodeSet=new CT(r.map((l,u)=>Os.define({name:u>=this.minRepeatTerm?void 0:l,id:u,props:s[u],top:i.indexOf(u)>-1,error:u==0,skipped:n.skippedNodes&&n.skippedNodes.indexOf(u)>-1}))),n.propSources&&(this.nodeSet=this.nodeSet.extend(...n.propSources)),this.strict=!1,this.bufferLength=vq;let o=Q_(n.tokenData);this.context=n.context,this.specializerSpecs=n.specialized||[],this.specialized=new Uint16Array(this.specializerSpecs.length);for(let l=0;l<this.specializerSpecs.length;l++)this.specialized[l]=this.specializerSpecs[l].term;this.specializers=this.specializerSpecs.map(Z6),this.states=Q_(n.states,Uint32Array),this.data=Q_(n.stateData),this.goto=Q_(n.goto),this.maxTerm=n.maxTerm,this.tokenizers=n.tokenizers.map(l=>typeof l=="number"?new Tf(o,l):l),this.topRules=n.topRules,this.dialects=n.dialects||{},this.dynamicPrecedences=n.dynamicPrecedences||null,this.tokenPrecTable=n.tokenPrec,this.termNames=n.termNames||null,this.maxNode=this.nodeSet.types.length-1,this.dialect=this.parseDialect(),this.top=this.topRules[Object.keys(this.topRules)[0]]}createParse(n,r,i){let s=new nNe(this,n,r,i);for(let a of this.wrappers)s=a(s,n,r,i);return s}getGoto(n,r,i=!1){let s=this.goto;if(r>=s[0])return-1;for(let a=s[r+1];;){let o=s[a++],l=o&1,u=s[a++];if(l&&i)return u;for(let d=a+(o>>1);a<d;a++)if(s[a]==n)return u;if(l)return-1}}hasAction(n,r){let i=this.data;for(let s=0;s<2;s++)for(let a=this.stateSlot(n,s?2:1),o;;a+=3){if((o=i[a])==65535)if(i[a+1]==1)o=i[a=Pl(i,a+2)];else{if(i[a+1]==2)return Pl(i,a+2);break}if(o==r||o==0)return Pl(i,a+1)}return 0}stateSlot(n,r){return this.states[n*6+r]}stateFlag(n,r){return(this.stateSlot(n,0)&r)>0}validAction(n,r){return!!this.allActions(n,i=>i==r?!0:null)}allActions(n,r){let i=this.stateSlot(n,4),s=i?r(i):void 0;for(let a=this.stateSlot(n,1);s==null;a+=3){if(this.data[a]==65535)if(this.data[a+1]==1)a=Pl(this.data,a+2);else break;s=r(Pl(this.data,a+1))}return s}nextStates(n){let r=[];for(let i=this.stateSlot(n,1);;i+=3){if(this.data[i]==65535)if(this.data[i+1]==1)i=Pl(this.data,i+2);else break;if((this.data[i+2]&1)==0){let s=this.data[i+1];r.some((a,o)=>o&1&&a==s)||r.push(this.data[i],s)}}return r}configure(n){let r=Object.assign(Object.create(i0.prototype),this);if(n.props&&(r.nodeSet=this.nodeSet.extend(...n.props)),n.top){let i=this.topRules[n.top];if(!i)throw new RangeError(`Invalid top rule name ${n.top}`);r.top=i}return n.tokenizers&&(r.tokenizers=this.tokenizers.map(i=>{let s=n.tokenizers.find(a=>a.from==i);return s?s.to:i})),n.specializers&&(r.specializers=this.specializers.slice(),r.specializerSpecs=this.specializerSpecs.map((i,s)=>{let a=n.specializers.find(l=>l.from==i.external);if(!a)return i;let o=Object.assign(Object.assign({},i),{external:a.to});return r.specializers[s]=Z6(o),o})),n.contextTracker&&(r.context=n.contextTracker),n.dialect&&(r.dialect=this.parseDialect(n.dialect)),n.strict!=null&&(r.strict=n.strict),n.wrap&&(r.wrappers=r.wrappers.concat(n.wrap)),n.bufferLength!=null&&(r.bufferLength=n.bufferLength),r}hasWrappers(){return this.wrappers.length>0}getName(n){return this.termNames?this.termNames[n]:String(n<=this.maxNode&&this.nodeSet.types[n].name||n)}get eofTerm(){return this.maxNode+1}get topNode(){return this.nodeSet.types[this.top[1]]}dynamicPrecedence(n){let r=this.dynamicPrecedences;return r==null?0:r[n]||0}parseDialect(n){let r=Object.keys(this.dialects),i=r.map(()=>!1);if(n)for(let a of n.split(" ")){let o=r.indexOf(a);o>=0&&(i[o]=!0)}let s=null;for(let a=0;a<r.length;a++)if(!i[a])for(let o=this.dialects[r[a]],l;(l=this.data[o++])!=65535;)(s||(s=new Uint8Array(this.maxTerm+1)))[l]=1;return new rNe(n,i,s)}static deserialize(n){return new i0(n)}}function Pl(e,n){return e[n]|e[n+1]<<16}function sNe(e){let n=null;for(let r of e){let i=r.p.stoppedAt;(r.pos==r.p.stream.end||i!=null&&r.pos>i)&&r.p.parser.stateFlag(r.state,2)&&(!n||n.score<r.score)&&(n=r)}return n}function Z6(e){if(e.external){let n=e.extend?1:0;return(r,i)=>e.external(r,i)<<1|n}return e.get}const ef=63,J6=64,aNe=1,oNe=2,XU=3,lNe=4,QU=5,cNe=6,uNe=7,ZU=65,dNe=66,hNe=8,fNe=9,pNe=10,mNe=11,gNe=12,JU=13,vNe=19,yNe=20,_Ne=29,xNe=33,bNe=34,kNe=47,wNe=0,qT=1,YN=2,uv=3,GN=4;class hd{constructor(n,r,i){this.parent=n,this.depth=r,this.type=i,this.hash=(n?n.hash+n.hash<<8:0)+r+(r<<4)+i}}hd.top=new hd(null,-1,wNe);function kg(e,n){for(let r=0,i=n-e.pos-1;;i--,r++){let s=e.peek(i);if(nc(s)||s==-1)return r}}function XN(e){return e==32||e==9}function nc(e){return e==10||e==13}function eK(e){return XN(e)||nc(e)}function xd(e){return e<0||eK(e)}const SNe=new iNe({start:hd.top,reduce(e,n){return e.type==uv&&(n==yNe||n==bNe)?e.parent:e},shift(e,n,r,i){if(n==XU)return new hd(e,kg(i,i.pos),qT);if(n==ZU||n==QU)return new hd(e,kg(i,i.pos),YN);if(n==ef)return e.parent;if(n==vNe||n==xNe)return new hd(e,0,uv);if(n==JU&&e.type==GN)return e.parent;if(n==kNe){let s=/[1-9]/.exec(i.read(i.pos,r.pos));if(s)return new hd(e,e.depth+ +s[0],GN)}return e},hash(e){return e.hash}});function tp(e,n,r=0){return e.peek(r)==n&&e.peek(r+1)==n&&e.peek(r+2)==n&&xd(e.peek(r+3))}const CNe=new vk((e,n)=>{if(e.next==-1&&n.canShift(J6))return e.acceptToken(J6);let r=e.peek(-1);if((nc(r)||r<0)&&n.context.type!=uv){if(tp(e,45))if(n.canShift(ef))e.acceptToken(ef);else return e.acceptToken(aNe,3);if(tp(e,46))if(n.canShift(ef))e.acceptToken(ef);else return e.acceptToken(oNe,3);let i=0;for(;e.next==32;)i++,e.advance();(i<n.context.depth||i==n.context.depth&&n.context.type==qT&&(e.next!=45||!xd(e.peek(1))))&&e.next!=-1&&!nc(e.next)&&e.next!=35&&e.acceptToken(ef,-i)}},{contextual:!0}),jNe=new vk((e,n)=>{if(n.context.type==uv){e.next==63&&(e.advance(),xd(e.next)&&e.acceptToken(uNe));return}if(e.next==45)e.advance(),xd(e.next)&&e.acceptToken(n.context.type==qT&&n.context.depth==kg(e,e.pos-1)?lNe:XU);else if(e.next==63)e.advance(),xd(e.next)&&e.acceptToken(n.context.type==YN&&n.context.depth==kg(e,e.pos-1)?cNe:QU);else{let r=e.pos;for(;;)if(XN(e.next)){if(e.pos==r)return;e.advance()}else if(e.next==33)tK(e);else if(e.next==38)QN(e);else if(e.next==42){QN(e);break}else if(e.next==39||e.next==34){if(UT(e,!0))break;return}else if(e.next==91||e.next==123){if(!ENe(e))return;break}else{nK(e,!0,!1,0);break}for(;XN(e.next);)e.advance();if(e.next==58){if(e.pos==r&&n.canShift(_Ne))return;let i=e.peek(1);xd(i)&&e.acceptTokenTo(n.context.type==YN&&n.context.depth==kg(e,r)?dNe:ZU,r)}}},{contextual:!0});function NNe(e){return e>32&&e<127&&e!=34&&e!=37&&e!=44&&e!=60&&e!=62&&e!=92&&e!=94&&e!=96&&e!=123&&e!=124&&e!=125}function eI(e){return e>=48&&e<=57||e>=97&&e<=102||e>=65&&e<=70}function tI(e,n){return e.next==37?(e.advance(),eI(e.next)&&e.advance(),eI(e.next)&&e.advance(),!0):NNe(e.next)||n&&e.next==44?(e.advance(),!0):!1}function tK(e){if(e.advance(),e.next==60){for(e.advance();;)if(!tI(e,!0)){e.next==62&&e.advance();break}}else for(;tI(e,!1););}function QN(e){for(e.advance();!xd(e.next)&&s0(e.next)!="f";)e.advance()}function UT(e,n){let r=e.next,i=!1,s=e.pos;for(e.advance();;){let a=e.next;if(a<0)break;if(e.advance(),a==r)if(a==39)if(e.next==39)e.advance();else break;else break;else if(a==92&&r==34)e.next>=0&&e.advance();else if(nc(a)){if(n)return!1;i=!0}else if(n&&e.pos>=s+1024)return!1}return!i}function ENe(e){for(let n=[],r=e.pos+1024;;)if(e.next==91||e.next==123)n.push(e.next),e.advance();else if(e.next==39||e.next==34){if(!UT(e,!0))return!1}else if(e.next==93||e.next==125){if(n[n.length-1]!=e.next-2)return!1;if(n.pop(),e.advance(),!n.length)return!0}else{if(e.next<0||e.pos>r||nc(e.next))return!1;e.advance()}}const ANe="iiisiiissisfissssssssssssisssiiissssssssssssssssssssssssssfsfssissssssssssssssssssssssssssfif";function s0(e){return e<33?"u":e>125?"s":ANe[e-33]}function v2(e,n){let r=s0(e);return r!="u"&&!(n&&r=="f")}function nK(e,n,r,i){if(s0(e.next)=="s"||(e.next==63||e.next==58||e.next==45)&&v2(e.peek(1),r))e.advance();else return!1;let s=e.pos;for(;;){let a=e.next,o=0,l=i+1;for(;eK(a);){if(nc(a)){if(n)return!1;l=0}else l++;a=e.peek(++o)}if(!(a>=0&&(a==58?v2(e.peek(o+1),r):a==35?e.peek(o-1)!=32:v2(a,r)))||!r&&l<=i||l==0&&!r&&(tp(e,45,o)||tp(e,46,o)))break;if(n&&s0(a)=="f")return!1;for(let d=o;d>=0;d--)e.advance();if(n&&e.pos>s+1024)return!1}return!0}const TNe=new vk((e,n)=>{if(e.next==33)tK(e),e.acceptToken(gNe);else if(e.next==38||e.next==42){let r=e.next==38?pNe:mNe;QN(e),e.acceptToken(r)}else e.next==39||e.next==34?(UT(e,!1),e.acceptToken(fNe)):nK(e,!1,n.context.type==uv,n.context.depth)&&e.acceptToken(hNe)}),MNe=new vk((e,n)=>{let r=n.context.type==GN?n.context.depth:-1,i=e.pos;e:for(;;){let s=0,a=e.next;for(;a==32;)a=e.peek(++s);if(!s&&(tp(e,45,s)||tp(e,46,s))||!nc(a)&&(r<0&&(r=Math.max(n.context.depth+1,s)),s<r))break;for(;;){if(e.next<0)break e;let o=nc(e.next);if(e.advance(),o)continue e;i=e.pos}}e.acceptTokenTo(JU,i)}),RNe=kq({DirectiveName:Te.keyword,DirectiveContent:Te.attributeValue,"DirectiveEnd DocEnd":Te.meta,QuotedLiteral:Te.string,BlockLiteralHeader:Te.special(Te.string),BlockLiteralContent:Te.content,Literal:Te.content,"Key/Literal Key/QuotedLiteral":Te.definition(Te.propertyName),"Anchor Alias":Te.labelName,Tag:Te.typeName,Comment:Te.lineComment,": , -":Te.separator,"?":Te.punctuation,"[ ]":Te.squareBracket,"{ }":Te.brace}),ONe=i0.deserialize({version:14,states:"5lQ!ZQgOOO#PQfO'#CpO#uQfO'#DOOOQR'#Dv'#DvO$qQgO'#DRO%gQdO'#DUO%nQgO'#DUO&ROaO'#D[OOQR'#Du'#DuO&{QgO'#D^O'rQgO'#D`OOQR'#Dt'#DtO(iOqO'#DbOOQP'#Dj'#DjO(zQaO'#CmO)YQgO'#CmOOQP'#Cm'#CmQ)jQaOOQ)uQgOOQ]QgOOO*PQdO'#CrO*nQdO'#CtOOQO'#Dw'#DwO+]Q`O'#CxO+hQdO'#CwO+rQ`O'#CwOOQO'#Cv'#CvO+wQdO'#CvOOQO'#Cq'#CqO,UQ`O,59[O,^QfO,59[OOQR,59[,59[OOQO'#Cx'#CxO,eQ`O'#DPO,pQdO'#DPOOQO'#Dx'#DxO,zQdO'#DxO-XQ`O,59jO-aQfO,59jOOQR,59j,59jOOQR'#DS'#DSO-hQcO,59mO-sQgO'#DVO.TQ`O'#DVO.YQcO,59pOOQR'#DX'#DXO#|QfO'#DWO.hQcO'#DWOOQR,59v,59vO.yOWO,59vO/OOaO,59vO/WOaO,59vO/cQgO'#D_OOQR,59x,59xO0VQgO'#DaOOQR,59z,59zOOQP,59|,59|O0yOaO,59|O1ROaO,59|O1aOqO,59|OOQP-E7h-E7hO1oQgO,59XOOQP,59X,59XO2PQaO'#DeO2_QgO'#DeO2oQgO'#DkOOQP'#Dk'#DkQ)jQaOOO3PQdO'#CsOOQO,59^,59^O3kQdO'#CuOOQO,59`,59`OOQO,59c,59cO4VQdO,59cO4aQdO'#CzO4kQ`O'#CzOOQO,59b,59bOOQU,5:Q,5:QOOQR1G.v1G.vO4pQ`O1G.vOOQU-E7d-E7dO4xQdO,59kOOQO,59k,59kO5SQdO'#DQO5^Q`O'#DQOOQO,5:d,5:dOOQU,5:R,5:ROOQR1G/U1G/UO5cQ`O1G/UOOQU-E7e-E7eO5kQgO'#DhO5xQcO1G/XOOQR1G/X1G/XOOQR,59q,59qO6TQgO,59qO6eQdO'#DiO6lQgO'#DiO7PQcO1G/[OOQR1G/[1G/[OOQR,59r,59rO#|QfO,59rOOQR1G/b1G/bO7_OWO1G/bO7dOaO1G/bOOQR,59y,59yOOQR,59{,59{OOQP1G/h1G/hO7lOaO1G/hO7tOaO1G/hO8POaO1G/hOOQP1G.s1G.sO8_QgO,5:POOQP,5:P,5:POOQP,5:V,5:VOOQP-E7i-E7iOOQO,59_,59_OOQO,59a,59aOOQO1G.}1G.}OOQO,59f,59fO8oQdO,59fOOQR7+$b7+$bP,XQ`O'#DfOOQO1G/V1G/VOOQO,59l,59lO8yQdO,59lOOQR7+$p7+$pP9TQ`O'#DgOOQR'#DT'#DTOOQR,5:S,5:SOOQR-E7f-E7fOOQR7+$s7+$sOOQR1G/]1G/]O9YQgO'#DYO9jQ`O'#DYOOQR,5:T,5:TO#|QfO'#DZO9oQcO'#DZOOQR-E7g-E7gOOQR7+$v7+$vOOQR1G/^1G/^OOQR7+$|7+$|O:QOWO7+$|OOQP7+%S7+%SO:VOaO7+%SO:_OaO7+%SOOQP1G/k1G/kOOQO1G/Q1G/QOOQO1G/W1G/WOOQR,59t,59tO:jQgO,59tOOQR,59u,59uO#|QfO,59uOOQR<<Hh<<HhOOQP<<Hn<<HnO:zOaO<<HnOOQR1G/`1G/`OOQR1G/a1G/aOOQPAN>YAN>Y",stateData:";S~O!fOS!gOS^OS~OP_OQbORSOTUOWROXROYYOZZO[XOcPOqQO!PVO!V[O!cTO~O`cO~P]OVkOWROXROYeOZfO[dOcPOmhOqQO~OboO~P!bOVtOWROXROYeOZfO[dOcPOmrOqQO~OpwO~P#WORSOTUOWROXROYYOZZO[XOcPOqQO!PVO!cTO~OSvP!avP!bvP~P#|OWROXROYeOZfO[dOcPOqQO~OmzO~P%OOm!OOUzP!azP!bzP!dzP~P#|O^!SO!b!QO!f!TO!g!RO~ORSOTUOWROXROcPOqQO!PVO!cTO~OY!UOP!QXQ!QX!V!QX!`!QXS!QX!a!QX!b!QXU!QXm!QX!d!QX~P&aO[!WOP!SXQ!SX!V!SX!`!SXS!SX!a!SX!b!SXU!SXm!SX!d!SX~P&aO^!ZO!W![O!b!YO!f!]O!g!YO~OP!_O!V[OQaX!`aX~OPaXQaX!VaX!`aX~P#|OP!bOQ!cO!V[O~OP_O!V[O~P#|OWROXROY!fOcPOqQObfXmfXofXpfX~OWROXRO[!hOcPOqQObhXmhXohXphX~ObeXmlXoeX~ObkXokX~P%OOm!kO~Om!lObnPonP~P%OOb!pOo!oO~Ob!pO~P!bOm!sOosXpsX~OosXpsX~P%OOm!uOotPptP~P%OOo!xOp!yO~Op!yO~P#WOS!|O!a#OO!b#OO~OUyX!ayX!byX!dyX~P#|Om#QO~OU#SO!a#UO!b#UO!d#RO~Om#WOUzX!azX!bzX!dzX~O]#XO~O!b#XO!g#YO~O^#ZO!b#XO!g#YO~OP!RXQ!RX!V!RX!`!RXS!RX!a!RX!b!RXU!RXm!RX!d!RX~P&aOP!TXQ!TX!V!TX!`!TXS!TX!a!TX!b!TXU!TXm!TX!d!TX~P&aO!b#^O!g#^O~O^#_O!b#^O!f#`O!g#^O~O^#_O!W#aO!b#^O!g#^O~OPaaQaa!Vaa!`aa~P#|OP#cO!V[OQ!XX!`!XX~OP!XXQ!XX!V!XX!`!XX~P#|OP_O!V[OQ!_X!`!_X~P#|OWROXROcPOqQObgXmgXogXpgX~OWROXROcPOqQObiXmiXoiXpiX~Obkaoka~P%OObnXonX~P%OOm#kO~Ob#lOo!oO~Oosapsa~P%OOotXptX~P%OOm#pO~Oo!xOp#qO~OSwP!awP!bwP~P#|OS!|O!a#vO!b#vO~OUya!aya!bya!dya~P#|Om#xO~P%OOm#{OU}P!a}P!b}P!d}P~P#|OU#SO!a$OO!b$OO!d#RO~O]$QO~O!b$QO!g$RO~O!b$SO!g$SO~O^$TO!b$SO!g$SO~O^$TO!b$SO!f$UO!g$SO~OP!XaQ!Xa!V!Xa!`!Xa~P#|Obnaona~P%OOotapta~P%OOo!xO~OU|X!a|X!b|X!d|X~P#|Om$ZO~Om$]OU}X!a}X!b}X!d}X~O]$^O~O!b$_O!g$_O~O^$`O!b$_O!g$_O~OU|a!a|a!b|a!d|a~P#|O!b$cO!g$cO~O",goto:",]!mPPPPPPPPPPPPPPPPP!nPP!v#v#|$`#|$c$f$j$nP%VPPP!v%Y%^%a%{&O%a&R&U&X&_&b%aP&e&{&e'O'RPP']'a'g'm's'y(XPPPPPPPP(_)e*X+c,VUaObcR#e!c!{ROPQSTUXY_bcdehknrtvz!O!U!W!_!b!c!f!h!k!l!s!u!|#Q#R#S#W#c#k#p#x#{$Z$]QmPR!qnqfPQThknrtv!k!l!s!u#R#k#pR!gdR!ieTlPnTjPnSiPnSqQvQ{TQ!mkQ!trQ!vtR#y#RR!nkTsQvR!wt!RWOSUXY_bcz!O!U!W!_!b!c!|#Q#S#W#c#x#{$Z$]RySR#t!|R|TR|UQ!PUR#|#SR#z#RR#z#SyZOSU_bcz!O!_!b!c!|#Q#S#W#c#x#{$Z$]R!VXR!XYa]O^abc!a!c!eT!da!eQnPR!rnQvQR!{vQ!}yR#u!}Q#T|R#}#TW^Obc!cS!^^!aT!aa!eQ!eaR#f!eW`Obc!cQxSS}U#SQ!`_Q#PzQ#V!OQ#b!_Q#d!bQ#s!|Q#w#QQ$P#WQ$V#cQ$Y#xQ$[#{Q$a$ZR$b$]xZOSU_bcz!O!_!b!c!|#Q#S#W#c#x#{$Z$]Q!VXQ!XYQ#[!UR#]!W!QWOSUXY_bcz!O!U!W!_!b!c!|#Q#S#W#c#x#{$Z$]pfPQThknrtv!k!l!s!u#R#k#pQ!gdQ!ieQ#g!fR#h!hSgPn^pQTkrtv#RQ!jhQ#i!kQ#j!lQ#n!sQ#o!uQ$W#kR$X#pQuQR!zv",nodeNames:"⚠ DirectiveEnd DocEnd - - ? ? ? Literal QuotedLiteral Anchor Alias Tag BlockLiteralContent Comment Stream BOM Document ] [ FlowSequence Item Tagged Anchored Anchored Tagged FlowMapping Pair Key : Pair , } { FlowMapping Pair Pair BlockSequence Item Item BlockMapping Pair Pair Key Pair Pair BlockLiteral BlockLiteralHeader Tagged Anchored Anchored Tagged Directive DirectiveName DirectiveContent Document",maxTerm:74,context:SNe,nodeProps:[["isolate",-3,8,9,14,""],["openedBy",18,"[",32,"{"],["closedBy",19,"]",33,"}"]],propSources:[RNe],skippedNodes:[0],repeatNodeCount:6,tokenData:"-Y~RnOX#PXY$QYZ$]Z]#P]^$]^p#Ppq$Qqs#Pst$btu#Puv$yv|#P|}&e}![#P![!]'O!]!`#P!`!a'i!a!}#P!}#O*g#O#P#P#P#Q+Q#Q#o#P#o#p+k#p#q'i#q#r,U#r;'S#P;'S;=`#z<%l?HT#P?HT?HU,o?HUO#PQ#UU!WQOY#PZp#Ppq#hq;'S#P;'S;=`#z<%lO#PQ#kTOY#PZs#Pt;'S#P;'S;=`#z<%lO#PQ#}P;=`<%l#P~$VQ!f~XY$Qpq$Q~$bO!g~~$gS^~OY$bZ;'S$b;'S;=`$s<%lO$b~$vP;=`<%l$bR%OX!WQOX%kXY#PZ]%k]^#P^p%kpq#hq;'S%k;'S;=`&_<%lO%kR%rX!WQ!VPOX%kXY#PZ]%k]^#P^p%kpq#hq;'S%k;'S;=`&_<%lO%kR&bP;=`<%l%kR&lUoP!WQOY#PZp#Ppq#hq;'S#P;'S;=`#z<%lO#PR'VUmP!WQOY#PZp#Ppq#hq;'S#P;'S;=`#z<%lO#PR'p[!PP!WQOY#PZp#Ppq#hq{#P{|(f|}#P}!O(f!O!R#P!R![)p![;'S#P;'S;=`#z<%lO#PR(mW!PP!WQOY#PZp#Ppq#hq!R#P!R![)V![;'S#P;'S;=`#z<%lO#PR)^U!PP!WQOY#PZp#Ppq#hq;'S#P;'S;=`#z<%lO#PR)wY!PP!WQOY#PZp#Ppq#hq{#P{|)V|}#P}!O)V!O;'S#P;'S;=`#z<%lO#PR*nUcP!WQOY#PZp#Ppq#hq;'S#P;'S;=`#z<%lO#PR+XUbP!WQOY#PZp#Ppq#hq;'S#P;'S;=`#z<%lO#PR+rUqP!WQOY#PZp#Ppq#hq;'S#P;'S;=`#z<%lO#PR,]UpP!WQOY#PZp#Ppq#hq;'S#P;'S;=`#z<%lO#PR,vU`P!WQOY#PZp#Ppq#hq;'S#P;'S;=`#z<%lO#P",tokenizers:[CNe,jNe,TNe,MNe,0,1],topRules:{Stream:[0,15]},tokenPrec:0}),DNe=Wb.define({name:"yaml",parser:ONe.configure({props:[jq.add({Stream:e=>{for(let n=e.node.resolve(e.pos,-1);n&&n.to>=e.pos;n=n.parent){if(n.name=="BlockLiteralContent"&&n.from<n.to)return e.baseIndentFor(n);if(n.name=="BlockLiteral")return e.baseIndentFor(n)+e.unit;if(n.name=="BlockSequence"||n.name=="BlockMapping")return e.column(n.firstChild.from,1);if(n.name=="QuotedLiteral")return null;if(n.name=="Literal"){let r=e.column(n.from,1);if(r==e.lineIndent(n.from,1))return r;if(n.to>e.pos)return null}}return null},FlowMapping:l6({closing:"}"}),FlowSequence:l6({closing:"]"})}),Aq.add({"FlowMapping FlowSequence":lSe,"Item Pair BlockLiteral":(e,n)=>({from:n.doc.lineAt(e.from).to,to:e.to})})]}),languageData:{commentTokens:{line:"#"},indentOnInput:/^\s*[\]\}]$/}});function PNe(){return new Qwe(DNe)}const ZN="revka:add-step";function LNe(e){window.dispatchEvent(new CustomEvent(ZN,{detail:e}))}const JN="revka:open-agent-picker";function KT(e){window.dispatchEvent(new CustomEvent(JN,{detail:e}))}const INe={code:"accent",review:"network",research:"live",deploy:"warning",test:"network",build:"warning",notify:"network",approve:"network",summarize:"live",greet:"network",human_input:"warning",task:"muted",agent:"network",parallel:"network",shell:"muted",compute:"accent",goto:"warning",output:"live",conditional:"warning",group_chat:"network",supervisor:"warning",map_reduce:"network",handoff:"network",a2a:"live",resolve:"network",for_each:"live"};function BNe(e){const n=e.toLowerCase().replace(/[^a-z]/g,"");for(const[r,i]of Object.entries(INe))if(n.startsWith(r)||n.includes(r))return i;return"muted"}function Sm(e){switch(e){case"live":return"var(--revka-signal-live)";case"network":return"var(--revka-signal-network)";case"warning":return"var(--revka-status-warning)";case"danger":return"var(--revka-status-danger)";case"accent":return"var(--pc-accent)";case"muted":return"var(--revka-status-idle)"}}function Cm(e){switch(e){case"live":return"var(--revka-signal-live-soft)";case"network":return"var(--revka-signal-network-soft)";case"warning":return"color-mix(in srgb, var(--revka-status-warning) 16%, transparent)";case"danger":return"color-mix(in srgb, var(--revka-status-danger) 16%, transparent)";case"accent":return"var(--pc-accent-glow)";case"muted":return"color-mix(in srgb, var(--revka-status-idle) 16%, transparent)"}}const nI={coder:"accent",researcher:"live",reviewer:"network"},zNe={completed:"accent",running:"live",failed:"danger",pending:"muted",skipped:"muted"},$Ne={claude:"network",codex:"warning"};function FNe(e){return`url("${e.replace(/"/g,"%22")}")`}function HNe({id:e,data:n,selected:r}){const i=BNe(n.type),s=Sm(i),a=Cm(i),o=(n.type||"agent")==="agent",l=r?`linear-gradient(135deg, ${a} 0%, ${a} 40%, transparent 100%)`:`linear-gradient(135deg, ${a} 0%, color-mix(in srgb, var(--revka-bg-elevated) 72%, transparent) 50%, transparent 100%)`,u=!!n.agentAvatarUrl,d=u?["linear-gradient(90deg, var(--revka-bg-panel-strong) 0%, color-mix(in srgb, var(--revka-bg-panel-strong) 86%, transparent) 54%, color-mix(in srgb, var(--revka-bg-panel-strong) 32%, transparent) 100%)",l,FNe(n.agentAvatarUrl)].join(", "):l,p=f=>{f.stopPropagation();const g=f.currentTarget.getBoundingClientRect();KT({taskId:e,anchorRect:g})};return c.jsxs("div",{className:`px-4 py-3 rounded-xl shadow-lg transition-all${n.justUpdated?" step-updated-pulse":""}`,style:{position:"relative",backgroundColor:r?"var(--revka-bg-panel-strong)":"var(--revka-bg-surface)",backgroundImage:d,backgroundRepeat:"no-repeat",backgroundPosition:u?"0 0, 0 0, right -18px center":void 0,backgroundSize:u?"100% 100%, 100% 100%, 56% auto":void 0,border:`2px solid ${r?s:"var(--revka-border-strong)"}`,minWidth:220,maxWidth:280,minHeight:142,boxShadow:r?`0 0 20px ${a}, inset 0 1px 0 ${a}`:"0 4px 12px rgba(0, 0, 0, 0.3), inset 0 1px 0 var(--revka-border-soft)"},children:[c.jsx(Ms,{type:"target",position:xt.Top,style:{background:s,width:10,height:10}}),c.jsx("div",{className:"text-sm font-bold truncate",style:{color:r?"var(--revka-signal-selected)":"var(--pc-text-primary)"},children:n.name||n.taskId}),c.jsxs("div",{className:"flex items-center gap-1.5 mt-1.5 flex-wrap",children:[c.jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-semibold uppercase tracking-wider",style:{background:a,color:s},children:n.type}),n.paramCount>0&&c.jsxs("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-medium",style:{background:"var(--pc-hover)",color:"var(--pc-text-secondary)"},children:[n.paramCount," param",n.paramCount!==1?"s":""]})]}),n.description&&c.jsx("div",{className:"text-[11px] mt-1.5 line-clamp-2",style:{color:"var(--pc-text-muted)",lineHeight:"1.3"},children:n.description}),n.assign&&!n.runInfo&&c.jsxs("button",{type:"button",onClick:o?p:void 0,onMouseDown:f=>f.stopPropagation(),className:"mt-1.5 px-2 py-0.5 rounded-md text-[10px] font-semibold truncate inline-flex items-center gap-1",style:{background:"var(--revka-signal-network-soft)",color:"var(--revka-signal-network)",border:"1px solid var(--revka-border-strong)",maxWidth:"100%",cursor:o?"pointer":"default",font:"inherit"},title:`Assigned: ${n.assign}${o?" — click to change":""}`,children:[c.jsx(Ts,{src:n.agentAvatarUrl,alt:n.agentDisplayName||n.assign,size:14,radius:4,iconSize:9}),n.assign]}),!n.assign&&n.template&&o&&!n.runInfo&&c.jsxs("button",{type:"button",onClick:p,onMouseDown:f=>f.stopPropagation(),className:"mt-1.5 px-2 py-0.5 rounded-md text-[10px] font-semibold truncate inline-flex items-center gap-1",style:{background:"transparent",color:"var(--revka-text-secondary)",border:"1px solid var(--revka-border-strong)",maxWidth:"100%",cursor:"pointer",font:"inherit"},title:`Pool persona "${n.template}" — click to change`,children:[c.jsx(Ts,{src:n.agentAvatarUrl,alt:n.agentDisplayName||n.template,size:14,radius:4,iconSize:9}),"Persona · ",n.template]}),!n.assign&&!n.template&&o&&!n.runInfo&&(()=>{const f=n.agentType?n.agentType.charAt(0).toUpperCase()+n.agentType.slice(1):"",g=!!n.agentType;return c.jsxs("button",{type:"button",onClick:p,onMouseDown:_=>_.stopPropagation(),className:"mt-1.5 px-2 py-0.5 rounded-md text-[10px] font-medium truncate inline-flex items-center gap-1",style:{background:g?"transparent":"color-mix(in srgb, var(--revka-status-warning) 16%, transparent)",color:g?"var(--revka-text-muted)":"var(--revka-status-warning)",border:g?"1px solid var(--revka-border-soft)":"1px solid var(--revka-status-warning)",maxWidth:"100%",cursor:"pointer",font:"inherit"},title:g?`Default ${n.agentType} agent — click to assign a specific pool agent`:"No pool agent assigned — click to choose",children:[c.jsx(Ul,{size:10}),g?`Default · ${f}`:"Unassigned"]})})(),n.agentHints.length>0&&c.jsx("div",{className:"flex gap-1 mt-1.5 flex-wrap",children:n.agentHints.map(f=>{const g=nI[f]||"muted";return c.jsx("span",{className:"px-1.5 py-0.5 rounded text-[9px] font-medium",style:{background:Cm(g),color:Sm(g)},children:f},f)})}),n.auth&&c.jsx("div",{className:"flex items-center gap-1 mt-1",title:`Auth: ${n.auth}`,style:{color:"var(--revka-text-faint)"},children:c.jsx(Eg,{size:12})}),n.skills.length>0&&c.jsxs("div",{className:"flex gap-1 mt-1 flex-wrap",children:[n.skills.slice(0,3).map(f=>{const g=f.replace(/^kref:\/\/.*\//,"").replace(/\.skilldef$/,"");return c.jsx("span",{className:"px-1.5 py-0.5 rounded text-[9px] font-medium truncate",style:{background:"var(--pc-accent-glow)",color:"var(--pc-accent-light)",maxWidth:"100%"},title:f,children:g},f)}),n.skills.length>3&&c.jsxs("span",{className:"px-1.5 py-0.5 rounded text-[9px] font-medium",style:{background:"var(--pc-hover)",color:"var(--pc-text-faint)"},children:["+",n.skills.length-3]})]}),n.runInfo&&c.jsxs("div",{className:"mt-2 pt-2",style:{borderTop:"1px solid var(--revka-border-soft)"},children:[c.jsxs("div",{className:"flex items-center gap-1.5 flex-wrap",children:[(()=>{const f=zNe[n.runInfo.status]||"muted";return c.jsx("span",{className:"px-1.5 py-0.5 rounded text-[9px] font-semibold uppercase tracking-wider",style:{background:Cm(f),color:Sm(f)},children:n.runInfo.status})})(),n.runInfo.agent_type&&(()=>{const f=$Ne[n.runInfo.agent_type]||"muted";return c.jsx("span",{className:"px-1.5 py-0.5 rounded text-[9px] font-medium",style:{background:Cm(f),color:Sm(f)},children:n.runInfo.agent_type})})(),n.runInfo.role&&(()=>{const f=nI[n.runInfo.role]||"muted";return c.jsx("span",{className:"px-1.5 py-0.5 rounded text-[9px] font-medium",style:{background:Cm(f),color:Sm(f)},children:n.runInfo.role})})()]}),n.runInfo.template_name&&c.jsxs("div",{className:"mt-1.5 px-2 py-0.5 rounded-md text-[10px] font-semibold truncate inline-flex items-center gap-1",style:{background:"var(--revka-signal-network-soft)",color:"var(--revka-signal-network)",border:"1px solid var(--revka-border-strong)",maxWidth:"100%"},title:`Pool Agent: ${n.runInfo.template_name}`,children:[c.jsx(Ts,{src:n.agentAvatarUrl,alt:n.agentDisplayName||n.runInfo.template_name,size:14,radius:4,iconSize:9}),n.runInfo.template_name]}),n.runInfo.agent_id&&c.jsxs("div",{className:"text-[8px] mt-1 font-mono truncate",style:{color:"var(--pc-text-faint)",letterSpacing:"0.02em"},title:n.runInfo.agent_id,children:["id:",n.runInfo.agent_id.slice(0,12)]}),n.runInfo.skills&&n.runInfo.skills.length>0&&c.jsxs("div",{className:"flex gap-1 mt-1.5 flex-wrap",children:[n.runInfo.skills.slice(0,3).map(f=>c.jsxs("span",{className:"px-1.5 py-0.5 rounded text-[8px] font-medium inline-flex items-center gap-0.5",style:{background:n.runInfo.status==="running"?"var(--revka-signal-network-soft)":n.runInfo.status==="completed"?"var(--revka-signal-selected-soft)":"var(--pc-accent-glow)",color:n.runInfo.status==="running"?"var(--revka-signal-network)":n.runInfo.status==="completed"?"var(--revka-signal-selected)":"var(--pc-accent-light)"},children:[n.runInfo.status==="running"&&c.jsx("span",{className:"inline-block h-1 w-1 rounded-full",style:{background:"var(--revka-signal-network)",animation:"pulse-dot 1.5s ease-in-out infinite"}}),n.runInfo.status==="completed"&&c.jsx("span",{style:{fontSize:"7px"},children:"✓"}),f]},f)),n.runInfo.skills.length>3&&c.jsxs("span",{className:"px-1.5 py-0.5 rounded text-[8px] font-medium",style:{background:"var(--pc-hover)",color:"var(--pc-text-faint)"},children:["+",n.runInfo.skills.length-3]})]}),c.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[n.runInfo.duration_s!=null&&n.runInfo.duration_s>0&&c.jsx("span",{className:"text-[9px]",style:{color:"var(--pc-text-faint)"},children:n.runInfo.duration_s<60?`${n.runInfo.duration_s.toFixed(1)}s`:`${(n.runInfo.duration_s/60).toFixed(1)}m`}),n.runInfo.trust_score!=null&&c.jsxs("span",{className:"text-[9px] font-medium",style:{color:n.runInfo.trust_score>=.8?"var(--revka-status-success)":n.runInfo.trust_score>=.5?"var(--revka-status-warning)":"var(--revka-status-danger)"},children:["trust ",(n.runInfo.trust_score*100).toFixed(0),"%"]})]})]}),c.jsx(Ms,{type:"source",position:xt.Bottom,style:{background:s,width:10,height:10}})]})}const WNe={taskNode:HNe},Z_="var(--revka-status-warning)",Lh="color-mix(in srgb, var(--revka-status-warning) 16%, transparent)";function qNe(e){var r;if(((r=e.conditionalBranches)==null?void 0:r.length)>0)return e.conditionalBranches;const n=[];return(e.condition||e.onTrueValue)&&n.push({condition:e.condition||"",goto:"",value:e.onTrueValue||void 0}),e.onFalseValue&&n.push({condition:"default",goto:"",value:e.onFalseValue}),n.length>0?n:[{condition:e.condition||"",goto:"",value:e.onTrueValue||void 0},{condition:"default",goto:"",value:e.onFalseValue||void 0}]}function UNe({data:e,selected:n}){var s;const r=qNe(e),i=(s=r.find(a=>a.condition.trim()!=="default"))==null?void 0:s.condition;return c.jsxs("div",{className:"px-4 py-3 rounded-xl shadow-lg transition-all",style:{position:"relative",background:n?`linear-gradient(135deg, ${Lh} 0%, ${Lh} 40%, var(--revka-bg-panel-strong) 100%)`:`linear-gradient(135deg, ${Lh} 0%, var(--revka-bg-elevated) 50%, var(--revka-bg-surface) 100%)`,border:`2px solid ${n?Z_:"var(--revka-border-strong)"}`,minWidth:200,maxWidth:260,boxShadow:n?`0 0 20px ${Lh}, inset 0 1px 0 ${Lh}`:"0 4px 12px rgba(0, 0, 0, 0.3), inset 0 1px 0 var(--revka-border-soft)"},children:[c.jsx(Ms,{type:"target",position:xt.Top,style:{background:Z_,width:10,height:10}}),c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("div",{className:"w-5 h-5 flex items-center justify-center flex-shrink-0",style:{color:Z_},children:c.jsx("svg",{viewBox:"0 0 16 16",width:"16",height:"16",fill:"currentColor",children:c.jsx("path",{d:"M8 1L15 8L8 15L1 8Z"})})}),c.jsx("div",{className:"text-sm font-bold truncate",style:{color:n?"var(--revka-signal-selected)":"var(--pc-text-primary)"},children:e.name||e.taskId})]}),c.jsx("div",{className:"flex items-center gap-1.5 mt-1.5",children:c.jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-semibold uppercase tracking-wider",style:{background:Lh,color:Z_},children:r.length>2?`${r.length} branches`:"if / else"})}),i?c.jsx("div",{className:"text-[11px] mt-1.5 font-mono truncate",style:{color:"var(--pc-text-muted)",lineHeight:"1.3"},children:i}):c.jsx("div",{className:"text-[10px] mt-1.5 italic",style:{color:"var(--pc-text-faint)"},children:"no condition set"}),e.description&&c.jsx("div",{className:"text-[10px] mt-1 line-clamp-1",style:{color:"var(--pc-text-faint)"},children:e.description}),c.jsx("div",{className:"flex flex-col gap-1.5 mt-2.5",children:r.map((a,o)=>{const l=Bf(a,o),u=$0(a,o);return c.jsxs("div",{className:"flex items-center justify-between gap-2",children:[c.jsxs("div",{className:"flex items-center gap-1 min-w-0",children:[c.jsx("div",{className:"w-2.5 h-2.5 rounded-full flex-shrink-0",style:{background:l.stroke}}),c.jsx("span",{className:"text-[9px] font-semibold uppercase truncate",style:{color:l.stroke},children:u})]}),a.value&&c.jsxs("span",{className:"text-[9px] font-mono px-1 rounded truncate max-w-[120px]",style:{background:"color-mix(in srgb, var(--revka-status-warning) 14%, transparent)",color:l.stroke},title:`emits: ${a.value}`,children:["= ",a.value]})]},au(o))})}),r.map((a,o)=>{const l=Bf(a,o),u=`${(o+1)/(r.length+1)*100}%`;return c.jsx(Ms,{type:"source",position:xt.Bottom,id:au(o),style:{background:l.stroke,width:10,height:10,left:u}},au(o))})]})}const KNe={gateNode:UNe};function VNe(e,n){var l;const r=new Set(e.map(u=>u.id)),i=new Map,s=new Map;for(const u of r)i.set(u,[]),s.set(u,0);for(const u of n){const d=u.data;d!=null&&d.synthetic||((l=i.get(u.source))==null||l.push(u.target),s.set(u.target,(s.get(u.target)??0)+1))}const a=[];for(const[u,d]of s)d===0&&a.push(u);let o=0;for(;a.length>0;){const u=a.shift();o++;for(const d of i.get(u)??[]){const p=(s.get(d)??1)-1;s.set(d,p),p===0&&a.push(d)}}return o<r.size}function rK(e,n){var g,_;if(e.length===0)return e;const r=new Map,i=new Map;for(const x of e)r.set(x.id,[]),i.set(x.id,[]);for(const x of n)(g=r.get(x.source))==null||g.push(x.target),(_=i.get(x.target))==null||_.push(x.source);const s=e.filter(x=>(i.get(x.id)??[]).length===0);if(s.length===0)return e.map((x,v)=>({...x,position:{x:v*250,y:0}}));const a=new Map,o=new Set,l=[];for(const x of s)a.set(x.id,0),l.push(x.id),o.add(x.id);for(;l.length>0;){const x=l.shift(),v=a.get(x)??0;for(const S of r.get(x)??[])o.has(S)||(o.add(S),a.set(S,v+1),l.push(S))}for(const x of e)a.has(x.id)||a.set(x.id,0);const u=new Map;for(const[x,v]of a)u.has(v)||u.set(v,[]),u.get(v).push(x);const d=340,p=260,f=new Map;for(const[x,v]of[...u.entries()].sort((S,w)=>S[0]-w[0])){const S=d,j=-((v.length-1)*S)/2;v.forEach((C,T)=>{f.set(C,{x:j+T*S,y:x*p})})}return e.map(x=>({...x,position:f.get(x.id)??{x:0,y:0}}))}const YNe=typeof navigator<"u"&&/mac/i.test(navigator.platform);function y2({keys:e}){return c.jsx("span",{style:{display:"inline-flex",alignItems:"center",gap:4},children:e.map(n=>c.jsx("kbd",{style:{display:"inline-flex",alignItems:"center",justifyContent:"center",minWidth:22,height:22,padding:"0 6px",borderRadius:6,border:"1px solid var(--revka-border-soft)",background:"var(--pc-bg-input)",color:"var(--revka-text-secondary)",fontFamily:"var(--pc-font-mono, ui-monospace, monospace)",fontSize:11,fontWeight:600},children:n},n))})}function GNe({onAddStep:e,onImportYaml:n,onGenerate:r,modKey:i}){const s=i??(YNe?"⌘":"Ctrl"),a=!r;return c.jsx("div",{style:{position:"absolute",inset:0,display:"flex",alignItems:"center",justifyContent:"center",pointerEvents:"none"},children:c.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",gap:18,maxWidth:360,padding:"24px 28px",pointerEvents:"auto"},children:[c.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",gap:10},children:[c.jsx("img",{src:fd("revka-icon.png"),alt:"Revka",className:"revka-brand-logo",style:{height:56,width:56,borderRadius:14,objectFit:"contain",opacity:.85},onError:o=>{o.currentTarget.style.display="none"}}),c.jsx("div",{className:"revka-kicker",style:{letterSpacing:"0.24em"},children:"Workflow Editor"})]}),c.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:4,width:"100%"},children:[c.jsxs("button",{type:"button",onClick:e,style:J_(),children:[c.jsx("span",{style:_2(),children:c.jsx(ls,{size:14})}),c.jsx("span",{style:{flex:1,textAlign:"left"},children:"Add Step"}),c.jsx(y2,{keys:[s,"K"]})]}),c.jsxs("button",{type:"button",onClick:n,style:J_(),children:[c.jsx("span",{style:_2(),children:c.jsx(bee,{size:14})}),c.jsx("span",{style:{flex:1,textAlign:"left"},children:"Import YAML"}),c.jsx(y2,{keys:[s,"I"]})]}),c.jsxs("button",{type:"button",onClick:r,disabled:a,title:a?"Coming with Operator copilot (P2)":"Open Architect with a prompt",style:a?{...J_(),opacity:.5,cursor:"not-allowed"}:J_(),children:[c.jsx("span",{style:_2(),children:c.jsx(hu,{size:14})}),c.jsx("span",{style:{flex:1,textAlign:"left"},children:"Generate from prompt"}),a?c.jsx("span",{style:{fontSize:10,color:"var(--revka-text-faint)",letterSpacing:"0.12em",textTransform:"uppercase"},children:"soon"}):c.jsx(y2,{keys:[s,"G"]})]})]}),c.jsx("p",{style:{fontSize:11,color:"var(--revka-text-faint)",textAlign:"center",lineHeight:1.5},children:"Right-click the canvas for more actions, or drag a noodle from a node into empty space to insert and wire a step."})]})})}function J_(){return{display:"flex",alignItems:"center",gap:12,padding:"10px 12px",borderRadius:10,border:"1px solid var(--revka-border-soft)",background:"color-mix(in srgb, var(--revka-bg-panel-strong) 78%, transparent)",color:"var(--revka-text-secondary)",fontSize:13,fontWeight:500,cursor:"pointer",transition:"border-color 0.15s ease, color 0.15s ease, background 0.15s ease"}}function _2(){return{display:"inline-flex",alignItems:"center",justifyContent:"center",width:22,height:22,borderRadius:6,background:"var(--pc-accent-glow)",color:"var(--pc-accent)",flexShrink:0}}const XNe={execution:{label:"Execution",description:"Run agents, code, shells, and emit outputs."},control:{label:"Control",description:"Branch, loop, and orchestrate flow."},coordination:{label:"Coordination",description:"Multi-agent collaboration and delegation."},human:{label:"Human",description:"Pause for input, approval, or notifications."},memory:{label:"Memory",description:"Resolve, compile, tag, and deprecate Kumiho entities."}},tf=[{type:"agent",label:"Agent",category:"execution",icon:Ul,description:"Run an LLM agent (Claude, Codex) with a prompt and skills.",searchTags:["research","code","review","test","build","deploy","summarize","task","llm","claude","codex"]},{type:"shell",label:"Shell",category:"execution",icon:jv,description:"Execute a shell command and capture stdout/stderr.",searchTags:["bash","command","exec","cli"]},{type:"python",label:"Python",category:"execution",icon:_ee,description:"Run a Python script or inline code with JSON in/out.",searchTags:["script","code","py","subprocess"]},{type:"compute",label:"Compute",category:"execution",icon:oee,description:"Evaluate safe expressions into typed output fields.",searchTags:["math","expression","transform","calculate","derive"]},{type:"output",label:"Output",category:"execution",icon:VE,description:"Format and publish a result, optionally as a Kumiho entity.",searchTags:["publish","emit","result","render","template"]},{type:"email",label:"Email",category:"execution",icon:Tee,description:"Send an outbound email via SMTP with optional click tracking.",searchTags:["smtp","send","mail","message","outreach"]},{type:"image",label:"Image",category:"execution",icon:qE,description:"Generate an image via codex and push it to canvas + Kumiho artifact.",searchTags:["codex","png","render","visual","canvas","artwork","illustration"]},{type:"conditional",label:"Conditional",category:"control",icon:Td,description:"Branch on ordered expressions with one handle per route.",searchTags:["if","else","gate","branch","condition"]},{type:"parallel",label:"Parallel",category:"control",icon:$ee,description:"Fan out to multiple branches and join with all/any/majority.",searchTags:["fork","fanout","concurrent","split"]},{type:"for_each",label:"For Each",category:"control",icon:Pee,description:"Loop sub-steps over a range or list, sequentially.",searchTags:["loop","iterate","range","foreach","iteration"]},{type:"goto",label:"Goto",category:"control",icon:Iee,description:"Jump back to an earlier step, optionally guarded by condition.",searchTags:["loop","jump","iterate","rerun"]},{type:"map_reduce",label:"Map / Reduce",category:"control",icon:yz,description:"Split a task across mappers and combine with a reducer.",searchTags:["fan-out","reduce","aggregate","split"]},{type:"supervisor",label:"Supervisor",category:"coordination",icon:vee,description:"Decompose a task and delegate to sub-agents.",searchTags:["orchestrator","manager","delegate"]},{type:"group_chat",label:"Group Chat",category:"coordination",icon:j0,description:"Multiple agents discuss a topic with a moderator.",searchTags:["conversation","discussion","multi-agent","debate"]},{type:"handoff",label:"Handoff",category:"coordination",icon:ree,description:"Transfer execution to a different agent type with context.",searchTags:["transfer","delegate","pass"]},{type:"a2a",label:"A2A Call",category:"coordination",icon:Df,description:"Call a remote agent over the Agent-to-Agent protocol.",searchTags:["remote","protocol","agent","http"]},{type:"manus",label:"Manus",category:"coordination",icon:$E,description:"Delegate web research to a hosted Manus AI task with optional structured output.",searchTags:["manus","web","research","browse","agent","browser","remote"]},{type:"human_input",label:"Human Input",category:"human",icon:Cee,description:"Pause and collect free-text input from a human via channel.",searchTags:["input","prompt","ask","wait"]},{type:"human_approval",label:"Human Approval",category:"human",icon:Of,description:"Pause until a human approves or rejects via dashboard/Slack/Discord.",searchTags:["approve","review","gate","confirm","sign-off"]},{type:"notify",label:"Notify",category:"human",icon:iee,description:"Broadcast a message to one or more channels (no wait).",searchTags:["alert","message","broadcast","send"]},{type:"resolve",label:"Resolve",category:"memory",icon:Da,description:"Look up a Kumiho entity by kind/tag/name and load its fields.",searchTags:["lookup","fetch","find","kumiho","entity"]},{type:"kumiho_context",label:"Kumiho Context",category:"memory",icon:Df,description:"Compile locked graph context from Kumiho bundles, krefs, and queries.",searchTags:["context","graph","canon","bundle","kumiho","memory"]},{type:"kumiho_bundle_update",label:"Bundle Update",category:"memory",icon:Td,description:"Add, remove, or replace Kumiho bundle members idempotently.",searchTags:["bundle","membership","kumiho","mutation","append"]},{type:"kumiho_patch_apply",label:"Patch Apply",category:"memory",icon:Of,description:"Dry-run or apply an approved Kumiho canon patch.",searchTags:["patch","canon","apply","approval","kumiho","mutation"]},{type:"tag",label:"Tag",category:"memory",icon:tb,description:"Apply a tag to a Kumiho entity revision (and optionally untag).",searchTags:["label","mark","kumiho","revision"]},{type:"deprecate",label:"Deprecate",category:"memory",icon:JJ,description:"Mark a Kumiho item as deprecated with an optional reason.",searchTags:["archive","retire","kumiho","remove"]}],QNe=Object.fromEntries(tf.map(e=>[e.type,e])),ZNe={execution:tf.filter(e=>e.category==="execution"),control:tf.filter(e=>e.category==="control"),coordination:tf.filter(e=>e.category==="coordination"),human:tf.filter(e=>e.category==="human"),memory:tf.filter(e=>e.category==="memory")},JNe=["execution","control","coordination","human","memory"];var rI=1,eEe=.9,tEe=.8,nEe=.17,x2=.1,b2=.999,rEe=.9999,iEe=.99,sEe=/[\\\/_+.#"@\[\(\{&]/,aEe=/[\\\/_+.#"@\[\(\{&]/g,oEe=/[\s-]/,iK=/[\s-]/g;function eE(e,n,r,i,s,a,o){if(a===n.length)return s===e.length?rI:iEe;var l=`${s},${a}`;if(o[l]!==void 0)return o[l];for(var u=i.charAt(a),d=r.indexOf(u,s),p=0,f,g,_,x;d>=0;)f=eE(e,n,r,i,d+1,a+1,o),f>p&&(d===s?f*=rI:sEe.test(e.charAt(d-1))?(f*=tEe,_=e.slice(s,d-1).match(aEe),_&&s>0&&(f*=Math.pow(b2,_.length))):oEe.test(e.charAt(d-1))?(f*=eEe,x=e.slice(s,d-1).match(iK),x&&s>0&&(f*=Math.pow(b2,x.length))):(f*=nEe,s>0&&(f*=Math.pow(b2,d-s))),e.charAt(d)!==n.charAt(a)&&(f*=rEe)),(f<x2&&r.charAt(d-1)===i.charAt(a+1)||i.charAt(a+1)===i.charAt(a)&&r.charAt(d-1)!==i.charAt(a))&&(g=eE(e,n,r,i,d+1,a+2,o),g*x2>f&&(f=g*x2)),f>p&&(p=f),d=r.indexOf(u,d+1);return o[l]=p,p}function iI(e){return e.toLowerCase().replace(iK," ")}function lEe(e,n,r){return e=r&&r.length>0?`${e+" "+r.join(" ")}`:e,eE(e,n,iI(e),iI(n),0,0,{})}function cu(e,n,{checkForDefaultPrevented:r=!0}={}){return function(s){if(e==null||e(s),r===!1||!s.defaultPrevented)return n==null?void 0:n(s)}}function sI(e,n){if(typeof e=="function")return e(n);e!=null&&(e.current=n)}function bu(...e){return n=>{let r=!1;const i=e.map(s=>{const a=sI(s,n);return!r&&typeof a=="function"&&(r=!0),a});if(r)return()=>{for(let s=0;s<i.length;s++){const a=i[s];typeof a=="function"?a():sI(e[s],null)}}}}function Vd(...e){return b.useCallback(bu(...e),e)}function cEe(e,n){const r=b.createContext(n),i=a=>{const{children:o,...l}=a,u=b.useMemo(()=>l,Object.values(l));return c.jsx(r.Provider,{value:u,children:o})};i.displayName=e+"Provider";function s(a){const o=b.useContext(r);if(o)return o;if(n!==void 0)return n;throw new Error(`\`${a}\` must be used within \`${e}\``)}return[i,s]}function uEe(e,n=[]){let r=[];function i(a,o){const l=b.createContext(o),u=r.length;r=[...r,o];const d=f=>{var w;const{scope:g,children:_,...x}=f,v=((w=g==null?void 0:g[e])==null?void 0:w[u])||l,S=b.useMemo(()=>x,Object.values(x));return c.jsx(v.Provider,{value:S,children:_})};d.displayName=a+"Provider";function p(f,g){var v;const _=((v=g==null?void 0:g[e])==null?void 0:v[u])||l,x=b.useContext(_);if(x)return x;if(o!==void 0)return o;throw new Error(`\`${f}\` must be used within \`${a}\``)}return[d,p]}const s=()=>{const a=r.map(o=>b.createContext(o));return function(l){const u=(l==null?void 0:l[e])||a;return b.useMemo(()=>({[`__scope${e}`]:{...l,[e]:u}}),[l,u])}};return s.scopeName=e,[i,dEe(s,...n)]}function dEe(...e){const n=e[0];if(e.length===1)return n;const r=()=>{const i=e.map(s=>({useScope:s(),scopeName:s.scopeName}));return function(a){const o=i.reduce((l,{useScope:u,scopeName:d})=>{const f=u(a)[`__scope${d}`];return{...l,...f}},{});return b.useMemo(()=>({[`__scope${n.scopeName}`]:o}),[o])}};return r.scopeName=n.scopeName,r}var dv=globalThis!=null&&globalThis.document?b.useLayoutEffect:()=>{},hEe=jE[" useId ".trim().toString()]||(()=>{}),fEe=0;function Vl(e){const[n,r]=b.useState(hEe());return dv(()=>{r(i=>i??String(fEe++))},[e]),n?`radix-${n}`:""}var pEe=jE[" useInsertionEffect ".trim().toString()]||dv;function mEe({prop:e,defaultProp:n,onChange:r=()=>{},caller:i}){const[s,a,o]=gEe({defaultProp:n,onChange:r}),l=e!==void 0,u=l?e:s;{const p=b.useRef(e!==void 0);b.useEffect(()=>{const f=p.current;f!==l&&console.warn(`${i} is changing from ${f?"controlled":"uncontrolled"} to ${l?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),p.current=l},[l,i])}const d=b.useCallback(p=>{var f;if(l){const g=vEe(p)?p(e):p;g!==e&&((f=o.current)==null||f.call(o,g))}else a(p)},[l,e,a,o]);return[u,d]}function gEe({defaultProp:e,onChange:n}){const[r,i]=b.useState(e),s=b.useRef(r),a=b.useRef(n);return pEe(()=>{a.current=n},[n]),b.useEffect(()=>{var o;s.current!==r&&((o=a.current)==null||o.call(a,r),s.current=r)},[r,s]),[r,i,a]}function vEe(e){return typeof e=="function"}function Xv(e){const n=yEe(e),r=b.forwardRef((i,s)=>{const{children:a,...o}=i,l=b.Children.toArray(a),u=l.find(xEe);if(u){const d=u.props.children,p=l.map(f=>f===u?b.Children.count(d)>1?b.Children.only(null):b.isValidElement(d)?d.props.children:null:f);return c.jsx(n,{...o,ref:s,children:b.isValidElement(d)?b.cloneElement(d,void 0,p):null})}return c.jsx(n,{...o,ref:s,children:a})});return r.displayName=`${e}.Slot`,r}function yEe(e){const n=b.forwardRef((r,i)=>{const{children:s,...a}=r;if(b.isValidElement(s)){const o=kEe(s),l=bEe(a,s.props);return s.type!==b.Fragment&&(l.ref=i?bu(i,o):o),b.cloneElement(s,l)}return b.Children.count(s)>1?b.Children.only(null):null});return n.displayName=`${e}.SlotClone`,n}var _Ee=Symbol("radix.slottable");function xEe(e){return b.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===_Ee}function bEe(e,n){const r={...n};for(const i in n){const s=e[i],a=n[i];/^on[A-Z]/.test(i)?s&&a?r[i]=(...l)=>{const u=a(...l);return s(...l),u}:s&&(r[i]=s):i==="style"?r[i]={...s,...a}:i==="className"&&(r[i]=[s,a].filter(Boolean).join(" "))}return{...e,...r}}function kEe(e){var i,s;let n=(i=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:i.get,r=n&&"isReactWarning"in n&&n.isReactWarning;return r?e.ref:(n=(s=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:s.get,r=n&&"isReactWarning"in n&&n.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}var wEe=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],sK=wEe.reduce((e,n)=>{const r=Xv(`Primitive.${n}`),i=b.forwardRef((s,a)=>{const{asChild:o,...l}=s,u=o?r:n;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),c.jsx(u,{...l,ref:a})});return i.displayName=`Primitive.${n}`,{...e,[n]:i}},{});function SEe(e,n){e&&oa.flushSync(()=>e.dispatchEvent(n))}function hv(e){const n=b.useRef(e);return b.useEffect(()=>{n.current=e}),b.useMemo(()=>(...r)=>{var i;return(i=n.current)==null?void 0:i.call(n,...r)},[])}function CEe(e,n=globalThis==null?void 0:globalThis.document){const r=hv(e);b.useEffect(()=>{const i=s=>{s.key==="Escape"&&r(s)};return n.addEventListener("keydown",i,{capture:!0}),()=>n.removeEventListener("keydown",i,{capture:!0})},[r,n])}var jEe="DismissableLayer",tE="dismissableLayer.update",NEe="dismissableLayer.pointerDownOutside",EEe="dismissableLayer.focusOutside",aI,aK=b.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),oK=b.forwardRef((e,n)=>{const{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:i,onPointerDownOutside:s,onFocusOutside:a,onInteractOutside:o,onDismiss:l,...u}=e,d=b.useContext(aK),[p,f]=b.useState(null),g=(p==null?void 0:p.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,_]=b.useState({}),x=Vd(n,O=>f(O)),v=Array.from(d.layers),[S]=[...d.layersWithOutsidePointerEventsDisabled].slice(-1),w=v.indexOf(S),j=p?v.indexOf(p):-1,C=d.layersWithOutsidePointerEventsDisabled.size>0,T=j>=w,E=MEe(O=>{const F=O.target,L=[...d.branches].some($=>$.contains(F));!T||L||(s==null||s(O),o==null||o(O),O.defaultPrevented||l==null||l())},g),A=REe(O=>{const F=O.target;[...d.branches].some($=>$.contains(F))||(a==null||a(O),o==null||o(O),O.defaultPrevented||l==null||l())},g);return CEe(O=>{j===d.layers.size-1&&(i==null||i(O),!O.defaultPrevented&&l&&(O.preventDefault(),l()))},g),b.useEffect(()=>{if(p)return r&&(d.layersWithOutsidePointerEventsDisabled.size===0&&(aI=g.body.style.pointerEvents,g.body.style.pointerEvents="none"),d.layersWithOutsidePointerEventsDisabled.add(p)),d.layers.add(p),oI(),()=>{r&&d.layersWithOutsidePointerEventsDisabled.size===1&&(g.body.style.pointerEvents=aI)}},[p,g,r,d]),b.useEffect(()=>()=>{p&&(d.layers.delete(p),d.layersWithOutsidePointerEventsDisabled.delete(p),oI())},[p,d]),b.useEffect(()=>{const O=()=>_({});return document.addEventListener(tE,O),()=>document.removeEventListener(tE,O)},[]),c.jsx(sK.div,{...u,ref:x,style:{pointerEvents:C?T?"auto":"none":void 0,...e.style},onFocusCapture:cu(e.onFocusCapture,A.onFocusCapture),onBlurCapture:cu(e.onBlurCapture,A.onBlurCapture),onPointerDownCapture:cu(e.onPointerDownCapture,E.onPointerDownCapture)})});oK.displayName=jEe;var AEe="DismissableLayerBranch",TEe=b.forwardRef((e,n)=>{const r=b.useContext(aK),i=b.useRef(null),s=Vd(n,i);return b.useEffect(()=>{const a=i.current;if(a)return r.branches.add(a),()=>{r.branches.delete(a)}},[r.branches]),c.jsx(sK.div,{...e,ref:s})});TEe.displayName=AEe;function MEe(e,n=globalThis==null?void 0:globalThis.document){const r=hv(e),i=b.useRef(!1),s=b.useRef(()=>{});return b.useEffect(()=>{const a=l=>{if(l.target&&!i.current){let u=function(){lK(NEe,r,d,{discrete:!0})};const d={originalEvent:l};l.pointerType==="touch"?(n.removeEventListener("click",s.current),s.current=u,n.addEventListener("click",s.current,{once:!0})):u()}else n.removeEventListener("click",s.current);i.current=!1},o=window.setTimeout(()=>{n.addEventListener("pointerdown",a)},0);return()=>{window.clearTimeout(o),n.removeEventListener("pointerdown",a),n.removeEventListener("click",s.current)}},[n,r]),{onPointerDownCapture:()=>i.current=!0}}function REe(e,n=globalThis==null?void 0:globalThis.document){const r=hv(e),i=b.useRef(!1);return b.useEffect(()=>{const s=a=>{a.target&&!i.current&&lK(EEe,r,{originalEvent:a},{discrete:!1})};return n.addEventListener("focusin",s),()=>n.removeEventListener("focusin",s)},[n,r]),{onFocusCapture:()=>i.current=!0,onBlurCapture:()=>i.current=!1}}function oI(){const e=new CustomEvent(tE);document.dispatchEvent(e)}function lK(e,n,r,{discrete:i}){const s=r.originalEvent.target,a=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:r});n&&s.addEventListener(e,n,{once:!0}),i?SEe(s,a):s.dispatchEvent(a)}var OEe=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],DEe=OEe.reduce((e,n)=>{const r=Xv(`Primitive.${n}`),i=b.forwardRef((s,a)=>{const{asChild:o,...l}=s,u=o?r:n;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),c.jsx(u,{...l,ref:a})});return i.displayName=`Primitive.${n}`,{...e,[n]:i}},{}),k2="focusScope.autoFocusOnMount",w2="focusScope.autoFocusOnUnmount",lI={bubbles:!1,cancelable:!0},PEe="FocusScope",cK=b.forwardRef((e,n)=>{const{loop:r=!1,trapped:i=!1,onMountAutoFocus:s,onUnmountAutoFocus:a,...o}=e,[l,u]=b.useState(null),d=hv(s),p=hv(a),f=b.useRef(null),g=Vd(n,v=>u(v)),_=b.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;b.useEffect(()=>{if(i){let v=function(C){if(_.paused||!l)return;const T=C.target;l.contains(T)?f.current=T:Wc(f.current,{select:!0})},S=function(C){if(_.paused||!l)return;const T=C.relatedTarget;T!==null&&(l.contains(T)||Wc(f.current,{select:!0}))},w=function(C){if(document.activeElement===document.body)for(const E of C)E.removedNodes.length>0&&Wc(l)};document.addEventListener("focusin",v),document.addEventListener("focusout",S);const j=new MutationObserver(w);return l&&j.observe(l,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",v),document.removeEventListener("focusout",S),j.disconnect()}}},[i,l,_.paused]),b.useEffect(()=>{if(l){uI.add(_);const v=document.activeElement;if(!l.contains(v)){const w=new CustomEvent(k2,lI);l.addEventListener(k2,d),l.dispatchEvent(w),w.defaultPrevented||(LEe(FEe(uK(l)),{select:!0}),document.activeElement===v&&Wc(l))}return()=>{l.removeEventListener(k2,d),setTimeout(()=>{const w=new CustomEvent(w2,lI);l.addEventListener(w2,p),l.dispatchEvent(w),w.defaultPrevented||Wc(v??document.body,{select:!0}),l.removeEventListener(w2,p),uI.remove(_)},0)}}},[l,d,p,_]);const x=b.useCallback(v=>{if(!r&&!i||_.paused)return;const S=v.key==="Tab"&&!v.altKey&&!v.ctrlKey&&!v.metaKey,w=document.activeElement;if(S&&w){const j=v.currentTarget,[C,T]=IEe(j);C&&T?!v.shiftKey&&w===T?(v.preventDefault(),r&&Wc(C,{select:!0})):v.shiftKey&&w===C&&(v.preventDefault(),r&&Wc(T,{select:!0})):w===j&&v.preventDefault()}},[r,i,_.paused]);return c.jsx(DEe.div,{tabIndex:-1,...o,ref:g,onKeyDown:x})});cK.displayName=PEe;function LEe(e,{select:n=!1}={}){const r=document.activeElement;for(const i of e)if(Wc(i,{select:n}),document.activeElement!==r)return}function IEe(e){const n=uK(e),r=cI(n,e),i=cI(n.reverse(),e);return[r,i]}function uK(e){const n=[],r=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:i=>{const s=i.tagName==="INPUT"&&i.type==="hidden";return i.disabled||i.hidden||s?NodeFilter.FILTER_SKIP:i.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;r.nextNode();)n.push(r.currentNode);return n}function cI(e,n){for(const r of e)if(!BEe(r,{upTo:n}))return r}function BEe(e,{upTo:n}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(n!==void 0&&e===n)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function zEe(e){return e instanceof HTMLInputElement&&"select"in e}function Wc(e,{select:n=!1}={}){if(e&&e.focus){const r=document.activeElement;e.focus({preventScroll:!0}),e!==r&&zEe(e)&&n&&e.select()}}var uI=$Ee();function $Ee(){let e=[];return{add(n){const r=e[0];n!==r&&(r==null||r.pause()),e=dI(e,n),e.unshift(n)},remove(n){var r;e=dI(e,n),(r=e[0])==null||r.resume()}}}function dI(e,n){const r=[...e],i=r.indexOf(n);return i!==-1&&r.splice(i,1),r}function FEe(e){return e.filter(n=>n.tagName!=="A")}var HEe=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],WEe=HEe.reduce((e,n)=>{const r=Xv(`Primitive.${n}`),i=b.forwardRef((s,a)=>{const{asChild:o,...l}=s,u=o?r:n;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),c.jsx(u,{...l,ref:a})});return i.displayName=`Primitive.${n}`,{...e,[n]:i}},{}),qEe="Portal",dK=b.forwardRef((e,n)=>{var l;const{container:r,...i}=e,[s,a]=b.useState(!1);dv(()=>a(!0),[]);const o=r||s&&((l=globalThis==null?void 0:globalThis.document)==null?void 0:l.body);return o?tZ.createPortal(c.jsx(WEe.div,{...i,ref:n}),o):null});dK.displayName=qEe;function UEe(e,n){return b.useReducer((r,i)=>n[r][i]??r,e)}var yk=e=>{const{present:n,children:r}=e,i=KEe(n),s=typeof r=="function"?r({present:i.isPresent}):b.Children.only(r),a=Vd(i.ref,VEe(s));return typeof r=="function"||i.isPresent?b.cloneElement(s,{ref:a}):null};yk.displayName="Presence";function KEe(e){const[n,r]=b.useState(),i=b.useRef(null),s=b.useRef(e),a=b.useRef("none"),o=e?"mounted":"unmounted",[l,u]=UEe(o,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return b.useEffect(()=>{const d=ex(i.current);a.current=l==="mounted"?d:"none"},[l]),dv(()=>{const d=i.current,p=s.current;if(p!==e){const g=a.current,_=ex(d);e?u("MOUNT"):_==="none"||(d==null?void 0:d.display)==="none"?u("UNMOUNT"):u(p&&g!==_?"ANIMATION_OUT":"UNMOUNT"),s.current=e}},[e,u]),dv(()=>{if(n){let d;const p=n.ownerDocument.defaultView??window,f=_=>{const v=ex(i.current).includes(CSS.escape(_.animationName));if(_.target===n&&v&&(u("ANIMATION_END"),!s.current)){const S=n.style.animationFillMode;n.style.animationFillMode="forwards",d=p.setTimeout(()=>{n.style.animationFillMode==="forwards"&&(n.style.animationFillMode=S)})}},g=_=>{_.target===n&&(a.current=ex(i.current))};return n.addEventListener("animationstart",g),n.addEventListener("animationcancel",f),n.addEventListener("animationend",f),()=>{p.clearTimeout(d),n.removeEventListener("animationstart",g),n.removeEventListener("animationcancel",f),n.removeEventListener("animationend",f)}}else u("ANIMATION_END")},[n,u]),{isPresent:["mounted","unmountSuspended"].includes(l),ref:b.useCallback(d=>{i.current=d?getComputedStyle(d):null,r(d)},[])}}function ex(e){return(e==null?void 0:e.animationName)||"none"}function VEe(e){var i,s;let n=(i=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:i.get,r=n&&"isReactWarning"in n&&n.isReactWarning;return r?e.ref:(n=(s=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:s.get,r=n&&"isReactWarning"in n&&n.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}var YEe=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Qv=YEe.reduce((e,n)=>{const r=Xv(`Primitive.${n}`),i=b.forwardRef((s,a)=>{const{asChild:o,...l}=s,u=o?r:n;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),c.jsx(u,{...l,ref:a})});return i.displayName=`Primitive.${n}`,{...e,[n]:i}},{}),S2=0;function GEe(){b.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??hI()),document.body.insertAdjacentElement("beforeend",e[1]??hI()),S2++,()=>{S2===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(n=>n.remove()),S2--}},[])}function hI(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var $o=function(){return $o=Object.assign||function(n){for(var r,i=1,s=arguments.length;i<s;i++){r=arguments[i];for(var a in r)Object.prototype.hasOwnProperty.call(r,a)&&(n[a]=r[a])}return n},$o.apply(this,arguments)};function hK(e,n){var r={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&n.indexOf(i)<0&&(r[i]=e[i]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,i=Object.getOwnPropertySymbols(e);s<i.length;s++)n.indexOf(i[s])<0&&Object.prototype.propertyIsEnumerable.call(e,i[s])&&(r[i[s]]=e[i[s]]);return r}function XEe(e,n,r){if(r||arguments.length===2)for(var i=0,s=n.length,a;i<s;i++)(a||!(i in n))&&(a||(a=Array.prototype.slice.call(n,0,i)),a[i]=n[i]);return e.concat(a||Array.prototype.slice.call(n))}var Wx="right-scroll-bar-position",qx="width-before-scroll-bar",QEe="with-scroll-bars-hidden",ZEe="--removed-body-scroll-bar-size";function C2(e,n){return typeof e=="function"?e(n):e&&(e.current=n),e}function JEe(e,n){var r=b.useState(function(){return{value:e,callback:n,facade:{get current(){return r.value},set current(i){var s=r.value;s!==i&&(r.value=i,r.callback(i,s))}}}})[0];return r.callback=n,r.facade}var eAe=typeof window<"u"?b.useLayoutEffect:b.useEffect,fI=new WeakMap;function tAe(e,n){var r=JEe(null,function(i){return e.forEach(function(s){return C2(s,i)})});return eAe(function(){var i=fI.get(r);if(i){var s=new Set(i),a=new Set(e),o=r.current;s.forEach(function(l){a.has(l)||C2(l,null)}),a.forEach(function(l){s.has(l)||C2(l,o)})}fI.set(r,e)},[e]),r}function nAe(e){return e}function rAe(e,n){n===void 0&&(n=nAe);var r=[],i=!1,s={read:function(){if(i)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return r.length?r[r.length-1]:e},useMedium:function(a){var o=n(a,i);return r.push(o),function(){r=r.filter(function(l){return l!==o})}},assignSyncMedium:function(a){for(i=!0;r.length;){var o=r;r=[],o.forEach(a)}r={push:function(l){return a(l)},filter:function(){return r}}},assignMedium:function(a){i=!0;var o=[];if(r.length){var l=r;r=[],l.forEach(a),o=r}var u=function(){var p=o;o=[],p.forEach(a)},d=function(){return Promise.resolve().then(u)};d(),r={push:function(p){o.push(p),d()},filter:function(p){return o=o.filter(p),r}}}};return s}function iAe(e){e===void 0&&(e={});var n=rAe(null);return n.options=$o({async:!0,ssr:!1},e),n}var fK=function(e){var n=e.sideCar,r=hK(e,["sideCar"]);if(!n)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var i=n.read();if(!i)throw new Error("Sidecar medium not found");return b.createElement(i,$o({},r))};fK.isSideCarExport=!0;function sAe(e,n){return e.useMedium(n),fK}var pK=iAe(),j2=function(){},_k=b.forwardRef(function(e,n){var r=b.useRef(null),i=b.useState({onScrollCapture:j2,onWheelCapture:j2,onTouchMoveCapture:j2}),s=i[0],a=i[1],o=e.forwardProps,l=e.children,u=e.className,d=e.removeScrollBar,p=e.enabled,f=e.shards,g=e.sideCar,_=e.noRelative,x=e.noIsolation,v=e.inert,S=e.allowPinchZoom,w=e.as,j=w===void 0?"div":w,C=e.gapMode,T=hK(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),E=g,A=tAe([r,n]),O=$o($o({},T),s);return b.createElement(b.Fragment,null,p&&b.createElement(E,{sideCar:pK,removeScrollBar:d,shards:f,noRelative:_,noIsolation:x,inert:v,setCallbacks:a,allowPinchZoom:!!S,lockRef:r,gapMode:C}),o?b.cloneElement(b.Children.only(l),$o($o({},O),{ref:A})):b.createElement(j,$o({},O,{className:u,ref:A}),l))});_k.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};_k.classNames={fullWidth:qx,zeroRight:Wx};var aAe=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function oAe(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var n=aAe();return n&&e.setAttribute("nonce",n),e}function lAe(e,n){e.styleSheet?e.styleSheet.cssText=n:e.appendChild(document.createTextNode(n))}function cAe(e){var n=document.head||document.getElementsByTagName("head")[0];n.appendChild(e)}var uAe=function(){var e=0,n=null;return{add:function(r){e==0&&(n=oAe())&&(lAe(n,r),cAe(n)),e++},remove:function(){e--,!e&&n&&(n.parentNode&&n.parentNode.removeChild(n),n=null)}}},dAe=function(){var e=uAe();return function(n,r){b.useEffect(function(){return e.add(n),function(){e.remove()}},[n&&r])}},mK=function(){var e=dAe(),n=function(r){var i=r.styles,s=r.dynamic;return e(i,s),null};return n},hAe={left:0,top:0,right:0,gap:0},N2=function(e){return parseInt(e||"",10)||0},fAe=function(e){var n=window.getComputedStyle(document.body),r=n[e==="padding"?"paddingLeft":"marginLeft"],i=n[e==="padding"?"paddingTop":"marginTop"],s=n[e==="padding"?"paddingRight":"marginRight"];return[N2(r),N2(i),N2(s)]},pAe=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return hAe;var n=fAe(e),r=document.documentElement.clientWidth,i=window.innerWidth;return{left:n[0],top:n[1],right:n[2],gap:Math.max(0,i-r+n[2]-n[0])}},mAe=mK(),Mf="data-scroll-locked",gAe=function(e,n,r,i){var s=e.left,a=e.top,o=e.right,l=e.gap;return r===void 0&&(r="margin"),`
  .`.concat(QEe,` {
   overflow: hidden `).concat(i,`;
   padding-right: `).concat(l,"px ").concat(i,`;
  }
  body[`).concat(Mf,`] {
    overflow: hidden `).concat(i,`;
    overscroll-behavior: contain;
    `).concat([n&&"position: relative ".concat(i,";"),r==="margin"&&`
    padding-left: `.concat(s,`px;
    padding-top: `).concat(a,`px;
    padding-right: `).concat(o,`px;
    margin-left:0;
    margin-top:0;
    margin-right: `).concat(l,"px ").concat(i,`;
    `),r==="padding"&&"padding-right: ".concat(l,"px ").concat(i,";")].filter(Boolean).join(""),`
  }
  
  .`).concat(Wx,` {
    right: `).concat(l,"px ").concat(i,`;
  }
  
  .`).concat(qx,` {
    margin-right: `).concat(l,"px ").concat(i,`;
  }
  
  .`).concat(Wx," .").concat(Wx,` {
    right: 0 `).concat(i,`;
  }
  
  .`).concat(qx," .").concat(qx,` {
    margin-right: 0 `).concat(i,`;
  }
  
  body[`).concat(Mf,`] {
    `).concat(ZEe,": ").concat(l,`px;
  }
`)},pI=function(){var e=parseInt(document.body.getAttribute(Mf)||"0",10);return isFinite(e)?e:0},vAe=function(){b.useEffect(function(){return document.body.setAttribute(Mf,(pI()+1).toString()),function(){var e=pI()-1;e<=0?document.body.removeAttribute(Mf):document.body.setAttribute(Mf,e.toString())}},[])},yAe=function(e){var n=e.noRelative,r=e.noImportant,i=e.gapMode,s=i===void 0?"margin":i;vAe();var a=b.useMemo(function(){return pAe(s)},[s]);return b.createElement(mAe,{styles:gAe(a,!n,s,r?"":"!important")})},nE=!1;if(typeof window<"u")try{var tx=Object.defineProperty({},"passive",{get:function(){return nE=!0,!0}});window.addEventListener("test",tx,tx),window.removeEventListener("test",tx,tx)}catch{nE=!1}var Ih=nE?{passive:!1}:!1,_Ae=function(e){return e.tagName==="TEXTAREA"},gK=function(e,n){if(!(e instanceof Element))return!1;var r=window.getComputedStyle(e);return r[n]!=="hidden"&&!(r.overflowY===r.overflowX&&!_Ae(e)&&r[n]==="visible")},xAe=function(e){return gK(e,"overflowY")},bAe=function(e){return gK(e,"overflowX")},mI=function(e,n){var r=n.ownerDocument,i=n;do{typeof ShadowRoot<"u"&&i instanceof ShadowRoot&&(i=i.host);var s=vK(e,i);if(s){var a=yK(e,i),o=a[1],l=a[2];if(o>l)return!0}i=i.parentNode}while(i&&i!==r.body);return!1},kAe=function(e){var n=e.scrollTop,r=e.scrollHeight,i=e.clientHeight;return[n,r,i]},wAe=function(e){var n=e.scrollLeft,r=e.scrollWidth,i=e.clientWidth;return[n,r,i]},vK=function(e,n){return e==="v"?xAe(n):bAe(n)},yK=function(e,n){return e==="v"?kAe(n):wAe(n)},SAe=function(e,n){return e==="h"&&n==="rtl"?-1:1},CAe=function(e,n,r,i,s){var a=SAe(e,window.getComputedStyle(n).direction),o=a*i,l=r.target,u=n.contains(l),d=!1,p=o>0,f=0,g=0;do{if(!l)break;var _=yK(e,l),x=_[0],v=_[1],S=_[2],w=v-S-a*x;(x||w)&&vK(e,l)&&(f+=w,g+=x);var j=l.parentNode;l=j&&j.nodeType===Node.DOCUMENT_FRAGMENT_NODE?j.host:j}while(!u&&l!==document.body||u&&(n.contains(l)||n===l));return(p&&Math.abs(f)<1||!p&&Math.abs(g)<1)&&(d=!0),d},nx=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},gI=function(e){return[e.deltaX,e.deltaY]},vI=function(e){return e&&"current"in e?e.current:e},jAe=function(e,n){return e[0]===n[0]&&e[1]===n[1]},NAe=function(e){return`
  .block-interactivity-`.concat(e,` {pointer-events: none;}
  .allow-interactivity-`).concat(e,` {pointer-events: all;}
`)},EAe=0,Bh=[];function AAe(e){var n=b.useRef([]),r=b.useRef([0,0]),i=b.useRef(),s=b.useState(EAe++)[0],a=b.useState(mK)[0],o=b.useRef(e);b.useEffect(function(){o.current=e},[e]),b.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(s));var v=XEe([e.lockRef.current],(e.shards||[]).map(vI),!0).filter(Boolean);return v.forEach(function(S){return S.classList.add("allow-interactivity-".concat(s))}),function(){document.body.classList.remove("block-interactivity-".concat(s)),v.forEach(function(S){return S.classList.remove("allow-interactivity-".concat(s))})}}},[e.inert,e.lockRef.current,e.shards]);var l=b.useCallback(function(v,S){if("touches"in v&&v.touches.length===2||v.type==="wheel"&&v.ctrlKey)return!o.current.allowPinchZoom;var w=nx(v),j=r.current,C="deltaX"in v?v.deltaX:j[0]-w[0],T="deltaY"in v?v.deltaY:j[1]-w[1],E,A=v.target,O=Math.abs(C)>Math.abs(T)?"h":"v";if("touches"in v&&O==="h"&&A.type==="range")return!1;var F=window.getSelection(),L=F&&F.anchorNode,$=L?L===A||L.contains(A):!1;if($)return!1;var z=mI(O,A);if(!z)return!0;if(z?E=O:(E=O==="v"?"h":"v",z=mI(O,A)),!z)return!1;if(!i.current&&"changedTouches"in v&&(C||T)&&(i.current=E),!E)return!0;var B=i.current||E;return CAe(B,S,v,B==="h"?C:T)},[]),u=b.useCallback(function(v){var S=v;if(!(!Bh.length||Bh[Bh.length-1]!==a)){var w="deltaY"in S?gI(S):nx(S),j=n.current.filter(function(E){return E.name===S.type&&(E.target===S.target||S.target===E.shadowParent)&&jAe(E.delta,w)})[0];if(j&&j.should){S.cancelable&&S.preventDefault();return}if(!j){var C=(o.current.shards||[]).map(vI).filter(Boolean).filter(function(E){return E.contains(S.target)}),T=C.length>0?l(S,C[0]):!o.current.noIsolation;T&&S.cancelable&&S.preventDefault()}}},[]),d=b.useCallback(function(v,S,w,j){var C={name:v,delta:S,target:w,should:j,shadowParent:TAe(w)};n.current.push(C),setTimeout(function(){n.current=n.current.filter(function(T){return T!==C})},1)},[]),p=b.useCallback(function(v){r.current=nx(v),i.current=void 0},[]),f=b.useCallback(function(v){d(v.type,gI(v),v.target,l(v,e.lockRef.current))},[]),g=b.useCallback(function(v){d(v.type,nx(v),v.target,l(v,e.lockRef.current))},[]);b.useEffect(function(){return Bh.push(a),e.setCallbacks({onScrollCapture:f,onWheelCapture:f,onTouchMoveCapture:g}),document.addEventListener("wheel",u,Ih),document.addEventListener("touchmove",u,Ih),document.addEventListener("touchstart",p,Ih),function(){Bh=Bh.filter(function(v){return v!==a}),document.removeEventListener("wheel",u,Ih),document.removeEventListener("touchmove",u,Ih),document.removeEventListener("touchstart",p,Ih)}},[]);var _=e.removeScrollBar,x=e.inert;return b.createElement(b.Fragment,null,x?b.createElement(a,{styles:NAe(s)}):null,_?b.createElement(yAe,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function TAe(e){for(var n=null;e!==null;)e instanceof ShadowRoot&&(n=e.host,e=e.host),e=e.parentNode;return n}const MAe=sAe(pK,AAe);var _K=b.forwardRef(function(e,n){return b.createElement(_k,$o({},e,{ref:n,sideCar:MAe}))});_K.classNames=_k.classNames;var RAe=function(e){if(typeof document>"u")return null;var n=Array.isArray(e)?e[0]:e;return n.ownerDocument.body},zh=new WeakMap,rx=new WeakMap,ix={},E2=0,xK=function(e){return e&&(e.host||xK(e.parentNode))},OAe=function(e,n){return n.map(function(r){if(e.contains(r))return r;var i=xK(r);return i&&e.contains(i)?i:(console.error("aria-hidden",r,"in not contained inside",e,". Doing nothing"),null)}).filter(function(r){return!!r})},DAe=function(e,n,r,i){var s=OAe(n,Array.isArray(e)?e:[e]);ix[r]||(ix[r]=new WeakMap);var a=ix[r],o=[],l=new Set,u=new Set(s),d=function(f){!f||l.has(f)||(l.add(f),d(f.parentNode))};s.forEach(d);var p=function(f){!f||u.has(f)||Array.prototype.forEach.call(f.children,function(g){if(l.has(g))p(g);else try{var _=g.getAttribute(i),x=_!==null&&_!=="false",v=(zh.get(g)||0)+1,S=(a.get(g)||0)+1;zh.set(g,v),a.set(g,S),o.push(g),v===1&&x&&rx.set(g,!0),S===1&&g.setAttribute(r,"true"),x||g.setAttribute(i,"true")}catch(w){console.error("aria-hidden: cannot operate on ",g,w)}})};return p(n),l.clear(),E2++,function(){o.forEach(function(f){var g=zh.get(f)-1,_=a.get(f)-1;zh.set(f,g),a.set(f,_),g||(rx.has(f)||f.removeAttribute(i),rx.delete(f)),_||f.removeAttribute(r)}),E2--,E2||(zh=new WeakMap,zh=new WeakMap,rx=new WeakMap,ix={})}},PAe=function(e,n,r){r===void 0&&(r="data-aria-hidden");var i=Array.from(Array.isArray(e)?e:[e]),s=RAe(e);return s?(i.push.apply(i,Array.from(s.querySelectorAll("[aria-live], script"))),DAe(i,s,r,"aria-hidden")):function(){return null}},xk="Dialog",[bK]=uEe(xk),[LAe,uo]=bK(xk),kK=e=>{const{__scopeDialog:n,children:r,open:i,defaultOpen:s,onOpenChange:a,modal:o=!0}=e,l=b.useRef(null),u=b.useRef(null),[d,p]=mEe({prop:i,defaultProp:s??!1,onChange:a,caller:xk});return c.jsx(LAe,{scope:n,triggerRef:l,contentRef:u,contentId:Vl(),titleId:Vl(),descriptionId:Vl(),open:d,onOpenChange:p,onOpenToggle:b.useCallback(()=>p(f=>!f),[p]),modal:o,children:r})};kK.displayName=xk;var wK="DialogTrigger",IAe=b.forwardRef((e,n)=>{const{__scopeDialog:r,...i}=e,s=uo(wK,r),a=Vd(n,s.triggerRef);return c.jsx(Qv.button,{type:"button","aria-haspopup":"dialog","aria-expanded":s.open,"aria-controls":s.contentId,"data-state":GT(s.open),...i,ref:a,onClick:cu(e.onClick,s.onOpenToggle)})});IAe.displayName=wK;var VT="DialogPortal",[BAe,SK]=bK(VT,{forceMount:void 0}),CK=e=>{const{__scopeDialog:n,forceMount:r,children:i,container:s}=e,a=uo(VT,n);return c.jsx(BAe,{scope:n,forceMount:r,children:b.Children.map(i,o=>c.jsx(yk,{present:r||a.open,children:c.jsx(dK,{asChild:!0,container:s,children:o})}))})};CK.displayName=VT;var a0="DialogOverlay",jK=b.forwardRef((e,n)=>{const r=SK(a0,e.__scopeDialog),{forceMount:i=r.forceMount,...s}=e,a=uo(a0,e.__scopeDialog);return a.modal?c.jsx(yk,{present:i||a.open,children:c.jsx($Ae,{...s,ref:n})}):null});jK.displayName=a0;var zAe=Xv("DialogOverlay.RemoveScroll"),$Ae=b.forwardRef((e,n)=>{const{__scopeDialog:r,...i}=e,s=uo(a0,r);return c.jsx(_K,{as:zAe,allowPinchZoom:!0,shards:[s.contentRef],children:c.jsx(Qv.div,{"data-state":GT(s.open),...i,ref:n,style:{pointerEvents:"auto",...i.style}})})}),Hd="DialogContent",NK=b.forwardRef((e,n)=>{const r=SK(Hd,e.__scopeDialog),{forceMount:i=r.forceMount,...s}=e,a=uo(Hd,e.__scopeDialog);return c.jsx(yk,{present:i||a.open,children:a.modal?c.jsx(FAe,{...s,ref:n}):c.jsx(HAe,{...s,ref:n})})});NK.displayName=Hd;var FAe=b.forwardRef((e,n)=>{const r=uo(Hd,e.__scopeDialog),i=b.useRef(null),s=Vd(n,r.contentRef,i);return b.useEffect(()=>{const a=i.current;if(a)return PAe(a)},[]),c.jsx(EK,{...e,ref:s,trapFocus:r.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:cu(e.onCloseAutoFocus,a=>{var o;a.preventDefault(),(o=r.triggerRef.current)==null||o.focus()}),onPointerDownOutside:cu(e.onPointerDownOutside,a=>{const o=a.detail.originalEvent,l=o.button===0&&o.ctrlKey===!0;(o.button===2||l)&&a.preventDefault()}),onFocusOutside:cu(e.onFocusOutside,a=>a.preventDefault())})}),HAe=b.forwardRef((e,n)=>{const r=uo(Hd,e.__scopeDialog),i=b.useRef(!1),s=b.useRef(!1);return c.jsx(EK,{...e,ref:n,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:a=>{var o,l;(o=e.onCloseAutoFocus)==null||o.call(e,a),a.defaultPrevented||(i.current||(l=r.triggerRef.current)==null||l.focus(),a.preventDefault()),i.current=!1,s.current=!1},onInteractOutside:a=>{var u,d;(u=e.onInteractOutside)==null||u.call(e,a),a.defaultPrevented||(i.current=!0,a.detail.originalEvent.type==="pointerdown"&&(s.current=!0));const o=a.target;((d=r.triggerRef.current)==null?void 0:d.contains(o))&&a.preventDefault(),a.detail.originalEvent.type==="focusin"&&s.current&&a.preventDefault()}})}),EK=b.forwardRef((e,n)=>{const{__scopeDialog:r,trapFocus:i,onOpenAutoFocus:s,onCloseAutoFocus:a,...o}=e,l=uo(Hd,r),u=b.useRef(null),d=Vd(n,u);return GEe(),c.jsxs(c.Fragment,{children:[c.jsx(cK,{asChild:!0,loop:!0,trapped:i,onMountAutoFocus:s,onUnmountAutoFocus:a,children:c.jsx(oK,{role:"dialog",id:l.contentId,"aria-describedby":l.descriptionId,"aria-labelledby":l.titleId,"data-state":GT(l.open),...o,ref:d,onDismiss:()=>l.onOpenChange(!1)})}),c.jsxs(c.Fragment,{children:[c.jsx(KAe,{titleId:l.titleId}),c.jsx(YAe,{contentRef:u,descriptionId:l.descriptionId})]})]})}),YT="DialogTitle",WAe=b.forwardRef((e,n)=>{const{__scopeDialog:r,...i}=e,s=uo(YT,r);return c.jsx(Qv.h2,{id:s.titleId,...i,ref:n})});WAe.displayName=YT;var AK="DialogDescription",qAe=b.forwardRef((e,n)=>{const{__scopeDialog:r,...i}=e,s=uo(AK,r);return c.jsx(Qv.p,{id:s.descriptionId,...i,ref:n})});qAe.displayName=AK;var TK="DialogClose",UAe=b.forwardRef((e,n)=>{const{__scopeDialog:r,...i}=e,s=uo(TK,r);return c.jsx(Qv.button,{type:"button",...i,ref:n,onClick:cu(e.onClick,()=>s.onOpenChange(!1))})});UAe.displayName=TK;function GT(e){return e?"open":"closed"}var MK="DialogTitleWarning",[yLe,RK]=cEe(MK,{contentName:Hd,titleName:YT,docsSlug:"dialog"}),KAe=({titleId:e})=>{const n=RK(MK),r=`\`${n.contentName}\` requires a \`${n.titleName}\` for the component to be accessible for screen reader users.

If you want to hide the \`${n.titleName}\`, you can wrap it with our VisuallyHidden component.

For more information, see https://radix-ui.com/primitives/docs/components/${n.docsSlug}`;return b.useEffect(()=>{e&&(document.getElementById(e)||console.error(r))},[r,e]),null},VAe="DialogDescriptionWarning",YAe=({contentRef:e,descriptionId:n})=>{const i=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${RK(VAe).contentName}}.`;return b.useEffect(()=>{var a;const s=(a=e.current)==null?void 0:a.getAttribute("aria-describedby");n&&s&&(document.getElementById(n)||console.warn(i))},[i,e,n]),null},GAe=kK,XAe=CK,QAe=jK,ZAe=NK,JAe=Symbol.for("react.lazy"),o0=jE[" use ".trim().toString()];function eTe(e){return typeof e=="object"&&e!==null&&"then"in e}function OK(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===JAe&&"_payload"in e&&eTe(e._payload)}function tTe(e){const n=nTe(e),r=b.forwardRef((i,s)=>{let{children:a,...o}=i;OK(a)&&typeof o0=="function"&&(a=o0(a._payload));const l=b.Children.toArray(a),u=l.find(iTe);if(u){const d=u.props.children,p=l.map(f=>f===u?b.Children.count(d)>1?b.Children.only(null):b.isValidElement(d)?d.props.children:null:f);return c.jsx(n,{...o,ref:s,children:b.isValidElement(d)?b.cloneElement(d,void 0,p):null})}return c.jsx(n,{...o,ref:s,children:a})});return r.displayName=`${e}.Slot`,r}function nTe(e){const n=b.forwardRef((r,i)=>{let{children:s,...a}=r;if(OK(s)&&typeof o0=="function"&&(s=o0(s._payload)),b.isValidElement(s)){const o=aTe(s),l=sTe(a,s.props);return s.type!==b.Fragment&&(l.ref=i?bu(i,o):o),b.cloneElement(s,l)}return b.Children.count(s)>1?b.Children.only(null):null});return n.displayName=`${e}.SlotClone`,n}var rTe=Symbol("radix.slottable");function iTe(e){return b.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===rTe}function sTe(e,n){const r={...n};for(const i in n){const s=e[i],a=n[i];/^on[A-Z]/.test(i)?s&&a?r[i]=(...l)=>{const u=a(...l);return s(...l),u}:s&&(r[i]=s):i==="style"?r[i]={...s,...a}:i==="className"&&(r[i]=[s,a].filter(Boolean).join(" "))}return{...e,...r}}function aTe(e){var i,s;let n=(i=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:i.get,r=n&&"isReactWarning"in n&&n.isReactWarning;return r?e.ref:(n=(s=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:s.get,r=n&&"isReactWarning"in n&&n.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}var oTe=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],ju=oTe.reduce((e,n)=>{const r=tTe(`Primitive.${n}`),i=b.forwardRef((s,a)=>{const{asChild:o,...l}=s,u=o?r:n;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),c.jsx(u,{...l,ref:a})});return i.displayName=`Primitive.${n}`,{...e,[n]:i}},{}),jm='[cmdk-group=""]',A2='[cmdk-group-items=""]',lTe='[cmdk-group-heading=""]',DK='[cmdk-item=""]',yI=`${DK}:not([aria-disabled="true"])`,rE="cmdk-item-select",nf="data-value",cTe=(e,n,r)=>lEe(e,n,r),PK=b.createContext(void 0),Zv=()=>b.useContext(PK),LK=b.createContext(void 0),XT=()=>b.useContext(LK),IK=b.createContext(void 0),BK=b.forwardRef((e,n)=>{let r=rf(()=>{var q,W;return{search:"",value:(W=(q=e.value)!=null?q:e.defaultValue)!=null?W:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),i=rf(()=>new Set),s=rf(()=>new Map),a=rf(()=>new Map),o=rf(()=>new Set),l=zK(e),{label:u,children:d,value:p,onValueChange:f,filter:g,shouldFilter:_,loop:x,disablePointerSelection:v=!1,vimBindings:S=!0,...w}=e,j=Vl(),C=Vl(),T=Vl(),E=b.useRef(null),A=xTe();Wd(()=>{if(p!==void 0){let q=p.trim();r.current.value=q,O.emit()}},[p]),Wd(()=>{A(6,H)},[]);let O=b.useMemo(()=>({subscribe:q=>(o.current.add(q),()=>o.current.delete(q)),snapshot:()=>r.current,setState:(q,W,te)=>{var J,G,re,ne;if(!Object.is(r.current[q],W)){if(r.current[q]=W,q==="search")B(),$(),A(1,z);else if(q==="value"){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let le=document.getElementById(T);le?le.focus():(J=document.getElementById(j))==null||J.focus()}if(A(7,()=>{var le;r.current.selectedItemId=(le=D())==null?void 0:le.id,O.emit()}),te||A(5,H),((G=l.current)==null?void 0:G.value)!==void 0){let le=W??"";(ne=(re=l.current).onValueChange)==null||ne.call(re,le);return}}O.emit()}},emit:()=>{o.current.forEach(q=>q())}}),[]),F=b.useMemo(()=>({value:(q,W,te)=>{var J;W!==((J=a.current.get(q))==null?void 0:J.value)&&(a.current.set(q,{value:W,keywords:te}),r.current.filtered.items.set(q,L(W,te)),A(2,()=>{$(),O.emit()}))},item:(q,W)=>(i.current.add(q),W&&(s.current.has(W)?s.current.get(W).add(q):s.current.set(W,new Set([q]))),A(3,()=>{B(),$(),r.current.value||z(),O.emit()}),()=>{a.current.delete(q),i.current.delete(q),r.current.filtered.items.delete(q);let te=D();A(4,()=>{B(),(te==null?void 0:te.getAttribute("id"))===q&&z(),O.emit()})}),group:q=>(s.current.has(q)||s.current.set(q,new Set),()=>{a.current.delete(q),s.current.delete(q)}),filter:()=>l.current.shouldFilter,label:u||e["aria-label"],getDisablePointerSelection:()=>l.current.disablePointerSelection,listId:j,inputId:T,labelId:C,listInnerRef:E}),[]);function L(q,W){var te,J;let G=(J=(te=l.current)==null?void 0:te.filter)!=null?J:cTe;return q?G(q,r.current.search,W):0}function $(){if(!r.current.search||l.current.shouldFilter===!1)return;let q=r.current.filtered.items,W=[];r.current.filtered.groups.forEach(J=>{let G=s.current.get(J),re=0;G.forEach(ne=>{let le=q.get(ne);re=Math.max(le,re)}),W.push([J,re])});let te=E.current;U().sort((J,G)=>{var re,ne;let le=J.getAttribute("id"),oe=G.getAttribute("id");return((re=q.get(oe))!=null?re:0)-((ne=q.get(le))!=null?ne:0)}).forEach(J=>{let G=J.closest(A2);G?G.appendChild(J.parentElement===G?J:J.closest(`${A2} > *`)):te.appendChild(J.parentElement===te?J:J.closest(`${A2} > *`))}),W.sort((J,G)=>G[1]-J[1]).forEach(J=>{var G;let re=(G=E.current)==null?void 0:G.querySelector(`${jm}[${nf}="${encodeURIComponent(J[0])}"]`);re==null||re.parentElement.appendChild(re)})}function z(){let q=U().find(te=>te.getAttribute("aria-disabled")!=="true"),W=q==null?void 0:q.getAttribute(nf);O.setState("value",W||void 0)}function B(){var q,W,te,J;if(!r.current.search||l.current.shouldFilter===!1){r.current.filtered.count=i.current.size;return}r.current.filtered.groups=new Set;let G=0;for(let re of i.current){let ne=(W=(q=a.current.get(re))==null?void 0:q.value)!=null?W:"",le=(J=(te=a.current.get(re))==null?void 0:te.keywords)!=null?J:[],oe=L(ne,le);r.current.filtered.items.set(re,oe),oe>0&&G++}for(let[re,ne]of s.current)for(let le of ne)if(r.current.filtered.items.get(le)>0){r.current.filtered.groups.add(re);break}r.current.filtered.count=G}function H(){var q,W,te;let J=D();J&&(((q=J.parentElement)==null?void 0:q.firstChild)===J&&((te=(W=J.closest(jm))==null?void 0:W.querySelector(lTe))==null||te.scrollIntoView({block:"nearest"})),J.scrollIntoView({block:"nearest"}))}function D(){var q;return(q=E.current)==null?void 0:q.querySelector(`${DK}[aria-selected="true"]`)}function U(){var q;return Array.from(((q=E.current)==null?void 0:q.querySelectorAll(yI))||[])}function I(q){let W=U()[q];W&&O.setState("value",W.getAttribute(nf))}function X(q){var W;let te=D(),J=U(),G=J.findIndex(ne=>ne===te),re=J[G+q];(W=l.current)!=null&&W.loop&&(re=G+q<0?J[J.length-1]:G+q===J.length?J[0]:J[G+q]),re&&O.setState("value",re.getAttribute(nf))}function K(q){let W=D(),te=W==null?void 0:W.closest(jm),J;for(;te&&!J;)te=q>0?yTe(te,jm):_Te(te,jm),J=te==null?void 0:te.querySelector(yI);J?O.setState("value",J.getAttribute(nf)):X(q)}let Q=()=>I(U().length-1),V=q=>{q.preventDefault(),q.metaKey?Q():q.altKey?K(1):X(1)},R=q=>{q.preventDefault(),q.metaKey?I(0):q.altKey?K(-1):X(-1)};return b.createElement(ju.div,{ref:n,tabIndex:-1,...w,"cmdk-root":"",onKeyDown:q=>{var W;(W=w.onKeyDown)==null||W.call(w,q);let te=q.nativeEvent.isComposing||q.keyCode===229;if(!(q.defaultPrevented||te))switch(q.key){case"n":case"j":{S&&q.ctrlKey&&V(q);break}case"ArrowDown":{V(q);break}case"p":case"k":{S&&q.ctrlKey&&R(q);break}case"ArrowUp":{R(q);break}case"Home":{q.preventDefault(),I(0);break}case"End":{q.preventDefault(),Q();break}case"Enter":{q.preventDefault();let J=D();if(J){let G=new Event(rE);J.dispatchEvent(G)}}}}},b.createElement("label",{"cmdk-label":"",htmlFor:F.inputId,id:F.labelId,style:kTe},u),bk(e,q=>b.createElement(LK.Provider,{value:O},b.createElement(PK.Provider,{value:F},q))))}),uTe=b.forwardRef((e,n)=>{var r,i;let s=Vl(),a=b.useRef(null),o=b.useContext(IK),l=Zv(),u=zK(e),d=(i=(r=u.current)==null?void 0:r.forceMount)!=null?i:o==null?void 0:o.forceMount;Wd(()=>{if(!d)return l.item(s,o==null?void 0:o.id)},[d]);let p=$K(s,a,[e.value,e.children,a],e.keywords),f=XT(),g=ku(A=>A.value&&A.value===p.current),_=ku(A=>d||l.filter()===!1?!0:A.search?A.filtered.items.get(s)>0:!0);b.useEffect(()=>{let A=a.current;if(!(!A||e.disabled))return A.addEventListener(rE,x),()=>A.removeEventListener(rE,x)},[_,e.onSelect,e.disabled]);function x(){var A,O;v(),(O=(A=u.current).onSelect)==null||O.call(A,p.current)}function v(){f.setState("value",p.current,!0)}if(!_)return null;let{disabled:S,value:w,onSelect:j,forceMount:C,keywords:T,...E}=e;return b.createElement(ju.div,{ref:bu(a,n),...E,id:s,"cmdk-item":"",role:"option","aria-disabled":!!S,"aria-selected":!!g,"data-disabled":!!S,"data-selected":!!g,onPointerMove:S||l.getDisablePointerSelection()?void 0:v,onClick:S?void 0:x},e.children)}),dTe=b.forwardRef((e,n)=>{let{heading:r,children:i,forceMount:s,...a}=e,o=Vl(),l=b.useRef(null),u=b.useRef(null),d=Vl(),p=Zv(),f=ku(_=>s||p.filter()===!1?!0:_.search?_.filtered.groups.has(o):!0);Wd(()=>p.group(o),[]),$K(o,l,[e.value,e.heading,u]);let g=b.useMemo(()=>({id:o,forceMount:s}),[s]);return b.createElement(ju.div,{ref:bu(l,n),...a,"cmdk-group":"",role:"presentation",hidden:f?void 0:!0},r&&b.createElement("div",{ref:u,"cmdk-group-heading":"","aria-hidden":!0,id:d},r),bk(e,_=>b.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":r?d:void 0},b.createElement(IK.Provider,{value:g},_))))}),hTe=b.forwardRef((e,n)=>{let{alwaysRender:r,...i}=e,s=b.useRef(null),a=ku(o=>!o.search);return!r&&!a?null:b.createElement(ju.div,{ref:bu(s,n),...i,"cmdk-separator":"",role:"separator"})}),fTe=b.forwardRef((e,n)=>{let{onValueChange:r,...i}=e,s=e.value!=null,a=XT(),o=ku(d=>d.search),l=ku(d=>d.selectedItemId),u=Zv();return b.useEffect(()=>{e.value!=null&&a.setState("search",e.value)},[e.value]),b.createElement(ju.input,{ref:n,...i,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":u.listId,"aria-labelledby":u.labelId,"aria-activedescendant":l,id:u.inputId,type:"text",value:s?e.value:o,onChange:d=>{s||a.setState("search",d.target.value),r==null||r(d.target.value)}})}),pTe=b.forwardRef((e,n)=>{let{children:r,label:i="Suggestions",...s}=e,a=b.useRef(null),o=b.useRef(null),l=ku(d=>d.selectedItemId),u=Zv();return b.useEffect(()=>{if(o.current&&a.current){let d=o.current,p=a.current,f,g=new ResizeObserver(()=>{f=requestAnimationFrame(()=>{let _=d.offsetHeight;p.style.setProperty("--cmdk-list-height",_.toFixed(1)+"px")})});return g.observe(d),()=>{cancelAnimationFrame(f),g.unobserve(d)}}},[]),b.createElement(ju.div,{ref:bu(a,n),...s,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":l,"aria-label":i,id:u.listId},bk(e,d=>b.createElement("div",{ref:bu(o,u.listInnerRef),"cmdk-list-sizer":""},d)))}),mTe=b.forwardRef((e,n)=>{let{open:r,onOpenChange:i,overlayClassName:s,contentClassName:a,container:o,...l}=e;return b.createElement(GAe,{open:r,onOpenChange:i},b.createElement(XAe,{container:o},b.createElement(QAe,{"cmdk-overlay":"",className:s}),b.createElement(ZAe,{"aria-label":e.label,"cmdk-dialog":"",className:a},b.createElement(BK,{ref:n,...l}))))}),gTe=b.forwardRef((e,n)=>ku(r=>r.filtered.count===0)?b.createElement(ju.div,{ref:n,...e,"cmdk-empty":"",role:"presentation"}):null),vTe=b.forwardRef((e,n)=>{let{progress:r,children:i,label:s="Loading...",...a}=e;return b.createElement(ju.div,{ref:n,...a,"cmdk-loading":"",role:"progressbar","aria-valuenow":r,"aria-valuemin":0,"aria-valuemax":100,"aria-label":s},bk(e,o=>b.createElement("div",{"aria-hidden":!0},o)))}),ja=Object.assign(BK,{List:pTe,Item:uTe,Input:fTe,Group:dTe,Separator:hTe,Dialog:mTe,Empty:gTe,Loading:vTe});function yTe(e,n){let r=e.nextElementSibling;for(;r;){if(r.matches(n))return r;r=r.nextElementSibling}}function _Te(e,n){let r=e.previousElementSibling;for(;r;){if(r.matches(n))return r;r=r.previousElementSibling}}function zK(e){let n=b.useRef(e);return Wd(()=>{n.current=e}),n}var Wd=typeof window>"u"?b.useEffect:b.useLayoutEffect;function rf(e){let n=b.useRef();return n.current===void 0&&(n.current=e()),n}function ku(e){let n=XT(),r=()=>e(n.snapshot());return b.useSyncExternalStore(n.subscribe,r,r)}function $K(e,n,r,i=[]){let s=b.useRef(),a=Zv();return Wd(()=>{var o;let l=(()=>{var d;for(let p of r){if(typeof p=="string")return p.trim();if(typeof p=="object"&&"current"in p)return p.current?(d=p.current.textContent)==null?void 0:d.trim():s.current}})(),u=i.map(d=>d.trim());a.value(e,l,u),(o=n.current)==null||o.setAttribute(nf,l),s.current=l}),s}var xTe=()=>{let[e,n]=b.useState(),r=rf(()=>new Map);return Wd(()=>{r.current.forEach(i=>i()),r.current=new Map},[e]),(i,s)=>{r.current.set(i,s),n({})}};function bTe(e){let n=e.type;return typeof n=="function"?n(e.props):"render"in n?n.render(e.props):e}function bk({asChild:e,children:n},r){return e&&b.isValidElement(n)?b.cloneElement(bTe(n),{ref:n.ref},r(n.props.children)):r(n)}var kTe={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};let zl=null,ld=null;const iE=new Set;function _I(){iE.forEach(e=>e())}function xI(){return zl?Promise.resolve(zl):ld||(ld=UZ().then(e=>(zl=e,ld=null,_I(),zl)).catch(e=>{throw ld=null,zl=[],_I(),e}),ld)}function FK(){const[,e]=b.useState(0),[n,r]=b.useState(zl===null);b.useEffect(()=>{const s=()=>e(a=>a+1);return iE.add(s),zl===null?(r(!0),xI().catch(()=>{}).finally(()=>r(!1))):r(!1),()=>{iE.delete(s)}},[]);const i=b.useCallback(async()=>{zl=null,ld=null,r(!0);try{await xI()}finally{r(!1)}},[]);return{profiles:zl??[],loading:n,refresh:i}}const HK={"openai-codex":"OpenAI Codex",openai:"OpenAI",anthropic:"Anthropic","claude-code":"Claude Code",gmail:"Gmail",google:"Google",slack:"Slack",discord:"Discord",matrix:"Matrix",notion:"Notion",github:"GitHub",gitlab:"GitLab",linear:"Linear",jira:"Jira",manus:"Manus"};function sE(e){return HK[e]??e}function uu(e,n="item"){return(e??"").normalize("NFKD").replace(/[̀-ͯ]/g,"").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,64).replace(/-+$/g,"")||n}function wTe(e,n){const r=new Set(n);if(!r.has(e))return e;for(let i=2;i<1e3;i++){const s=`${e}-${i}`;if(!r.has(s))return s}return`${e}-${Date.now()}`}const STe=9099,CTe=9100,WK={width:"100%",padding:"8px 10px",borderRadius:8,border:"1px solid var(--pc-border)",background:"var(--pc-bg-input)",color:"var(--pc-text-primary)",fontSize:12.5,outline:"none"},T2={...WK,fontFamily:"var(--pc-font-mono, ui-monospace, monospace)"},Nm={display:"block",fontSize:10.5,fontWeight:600,color:"var(--revka-text-faint)",textTransform:"uppercase",letterSpacing:"0.08em",marginBottom:6};function jTe({open:e,onClose:n,onCreated:r,defaultProvider:i}){const s=b.useRef(null),[a,o]=b.useState(""),[l,u]=b.useState(""),[d,p]=b.useState(!1),[f,g]=b.useState(""),[_,x]=b.useState(""),[v,S]=b.useState(!1),[w,j]=b.useState(!1),[C,T]=b.useState(null);b.useEffect(()=>{e&&(o(i??""),u(""),p(!1),g(""),x(""),S(!1),j(!1),T(null),requestAnimationFrame(()=>{var $;return($=s.current)==null?void 0:$.focus()}))},[e,i]),b.useEffect(()=>{d||a.trim()&&!l&&u("default")},[a,l,d]),b.useEffect(()=>{if(!e)return;const $=z=>{z.key==="Escape"&&(z.preventDefault(),w||n())};return window.addEventListener("keydown",$),()=>window.removeEventListener("keydown",$)},[e,n,w]);const E=b.useMemo(()=>!!(a.trim()&&l.trim()&&f&&!w),[a,l,f,w]),A=b.useMemo(()=>Object.entries(HK),[]);if(!e||typeof document>"u")return null;const O=$=>{$.target===$.currentTarget&&!w&&n()},F=async $=>{if($.preventDefault(),!E)return;j(!0),T(null);const z=uu(a,"provider"),B=uu(l,"default");try{const H=await KZ({provider:z,profile_name:B,token:f,account_id:_.trim()||void 0,kind:"token"});await r(H.id)}catch(H){let D="Failed to create auth profile";H instanceof Xl?H.status===409?D="A profile with that provider+name already exists":D=H.message.replace(/^API \d+: /,"")||D:H instanceof Error&&(D=H.message),T(D),j(!1)}},L=c.jsx("div",{role:"dialog","aria-modal":"true","aria-label":"Create auth profile",onClick:O,style:{position:"fixed",inset:0,zIndex:STe,background:"rgba(0, 0, 0, 0.48)",backdropFilter:"blur(6px)",display:"flex",alignItems:"flex-start",justifyContent:"center",paddingTop:"12vh"},children:c.jsxs("form",{onSubmit:F,className:"revka-panel","data-variant":"primary",style:{width:"min(540px, calc(100vw - 32px))",maxHeight:"calc(100vh - 24vh)",display:"flex",flexDirection:"column",borderRadius:14,borderColor:"var(--revka-border-strong)",boxShadow:"0 32px 80px rgba(0,0,0,0.48)",zIndex:CTe,overflow:"hidden"},onClick:$=>$.stopPropagation(),children:[c.jsxs("div",{style:{padding:"14px 16px",borderBottom:"1px solid var(--revka-border-soft)",display:"flex",alignItems:"center",gap:10},children:[c.jsx("span",{style:{display:"inline-flex",alignItems:"center",justifyContent:"center",width:28,height:28,borderRadius:8,background:"color-mix(in srgb, var(--pc-accent-glow) 60%, transparent)",color:"var(--pc-accent)"},children:c.jsx(Eg,{size:15})}),c.jsxs("div",{style:{flex:1,minWidth:0},children:[c.jsx("div",{style:{fontSize:13,fontWeight:700,color:"var(--revka-text-primary)"},children:"New auth profile"}),c.jsx("div",{style:{fontSize:11,color:"var(--revka-text-faint)"},children:"Static token only — for OAuth providers, use the gateway's /config flow."})]}),c.jsx("button",{type:"button",onClick:()=>{w||n()},disabled:w,"aria-label":"Close",style:{background:"transparent",border:0,padding:4,cursor:w?"not-allowed":"pointer",color:"var(--revka-text-faint)",opacity:w?.5:1},children:c.jsx(vi,{size:16})})]}),c.jsxs("div",{style:{padding:"14px 16px",display:"flex",flexDirection:"column",gap:12,overflowY:"auto"},children:[c.jsxs("div",{children:[c.jsx("label",{style:Nm,htmlFor:"new-auth-provider",children:"Provider *"}),c.jsx("input",{id:"new-auth-provider",ref:s,type:"text",value:a,onChange:$=>o($.target.value),list:"new-auth-provider-options",placeholder:"openai, anthropic, github…",style:T2,disabled:w,autoComplete:"off"}),c.jsx("datalist",{id:"new-auth-provider-options",children:A.map(([$,z])=>c.jsx("option",{value:$,children:z},$))})]}),c.jsxs("div",{children:[c.jsx("label",{style:Nm,htmlFor:"new-auth-profile-name",children:"Profile name *"}),c.jsx("input",{id:"new-auth-profile-name",type:"text",value:l,onChange:$=>{u(uu($.target.value,"default")),p(!0)},placeholder:"default",style:T2,disabled:w,autoComplete:"off"})]}),c.jsxs("div",{children:[c.jsx("label",{style:Nm,children:"Kind"}),c.jsx("div",{style:{padding:"6px 10px",borderRadius:8,border:"1px solid var(--pc-border)",background:"var(--pc-bg-input)",color:"var(--revka-text-secondary)",fontSize:12,display:"inline-flex",alignItems:"center",gap:6},children:"API key / token"})]}),c.jsxs("div",{children:[c.jsx("label",{style:Nm,htmlFor:"new-auth-token",children:"Token *"}),c.jsxs("div",{style:{position:"relative"},children:[c.jsx("input",{id:"new-auth-token",type:v?"text":"password",value:f,onChange:$=>g($.target.value),placeholder:"sk-… / ghp_… / xoxb-…",style:{...T2,paddingRight:36},disabled:w,autoComplete:"off",spellCheck:!1}),c.jsx("button",{type:"button",onClick:()=>S($=>!$),"aria-label":v?"Hide token":"Show token",disabled:w,style:{position:"absolute",top:"50%",right:6,transform:"translateY(-50%)",background:"transparent",border:0,padding:4,cursor:w?"not-allowed":"pointer",color:"var(--revka-text-faint)"},children:v?c.jsx(zE,{size:14}):c.jsx(kv,{size:14})})]})]}),c.jsxs("div",{children:[c.jsx("label",{style:Nm,htmlFor:"new-auth-account-id",children:"Account ID"}),c.jsx("input",{id:"new-auth-account-id",type:"text",value:_,onChange:$=>x($.target.value),placeholder:"email or id, for your reference",style:WK,disabled:w,autoComplete:"off"})]}),C&&c.jsx("div",{role:"alert",style:{padding:"8px 10px",borderRadius:8,background:"color-mix(in srgb, var(--revka-status-danger) 14%, transparent)",border:"1px solid var(--revka-status-danger)",color:"var(--revka-status-danger)",fontSize:11.5},children:C})]}),c.jsxs("div",{style:{padding:"12px 16px",borderTop:"1px solid var(--revka-border-soft)",display:"flex",alignItems:"center",justifyContent:"flex-end",gap:8},children:[c.jsx("button",{type:"button",onClick:()=>{w||n()},disabled:w,className:"revka-button",children:"Cancel"}),c.jsxs("button",{type:"submit",disabled:!E,className:"revka-button","data-variant":"primary",style:{display:"inline-flex",alignItems:"center",gap:6},children:[w&&c.jsx(Rr,{size:13,className:"animate-spin"}),w?"Creating…":"Create profile"]})]})]})});return oa.createPortal(L,document.body)}const qK=360,aE=400,NTe=8,ETe=24,ATe=9e3,TTe=9001;function MTe(e){const n=window.innerWidth,r=window.innerHeight,i=Math.min(e.bottom+NTe,r-aE-8),s=Math.max(8,n-e.right);return{position:"fixed",top:Math.max(8,i),right:s,width:qK,maxHeight:aE}}function RTe(){return{position:"fixed",top:"20vh",left:"50%",transform:"translateX(-50%)",width:qK,maxHeight:aE}}function OTe(e){if(e.kind!=="oauth"||!e.expires_at)return null;const n=Date.parse(e.expires_at);if(isNaN(n))return null;const r=Date.now();return n<=r?{tone:"danger",label:"expired"}:n-r<=ETe*36e5?{tone:"warning",label:"expires soon"}:null}function bI({open:e,onOpenChange:n,value:r,onSelect:i,anchorRect:s,providerFilter:a}){const o=b.useRef(null),{profiles:l,loading:u,refresh:d}=FK(),[p,f]=b.useState(""),[g,_]=b.useState(!1);b.useEffect(()=>{e&&(f(""),requestAnimationFrame(()=>{var C;return(C=o.current)==null?void 0:C.focus()}))},[e]),b.useEffect(()=>{if(!e)return;const C=T=>{T.key==="Escape"&&(T.preventDefault(),n(!1))};return window.addEventListener("keydown",C),()=>window.removeEventListener("keydown",C)},[e,n]);const x=b.useMemo(()=>s?MTe(s):RTe(),[s]),v=b.useMemo(()=>{const C=new Map;for(const T of l){if(a&&T.provider!==a)continue;const E=C.get(T.provider)??[];E.push(T),C.set(T.provider,E)}return Array.from(C.entries()).sort((T,E)=>T[0].localeCompare(E[0]))},[l,a]);if(!e||typeof document>"u")return null;const S=C=>{i(C),n(!1)},w=async C=>{if(window.confirm(`Delete auth profile "${C.provider}:${C.profile_name}"? Workflow steps bound to this profile will fail until rebound.`))try{await VZ(C.id),r===C.id&&i(null),await d()}catch(E){const A=E instanceof Xl?E.message.replace(/^API \d+: /,""):E instanceof Error?E.message:"Delete failed";window.alert(`Failed to delete auth profile: ${A}`)}},j=c.jsxs("div",{role:"dialog","aria-modal":"true","aria-label":"Choose auth profile",onClick:C=>{C.target===C.currentTarget&&n(!1)},style:{position:"fixed",inset:0,zIndex:ATe,background:"transparent"},children:[c.jsx("div",{className:"revka-panel","data-variant":"primary",style:{...x,display:"flex",flexDirection:"column",borderRadius:12,borderColor:"var(--revka-border-strong)",boxShadow:"0 24px 64px rgba(0,0,0,0.36)",overflow:"hidden",zIndex:TTe},onClick:C=>C.stopPropagation(),children:c.jsxs(ja,{label:"Choose auth profile",loop:!0,shouldFilter:!0,children:[c.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,padding:"10px 12px",borderBottom:"1px solid var(--revka-border-soft)"},children:[c.jsx(Da,{size:14,style:{color:"var(--revka-text-faint)"}}),c.jsx(ja.Input,{ref:o,value:p,onValueChange:f,placeholder:"Search auth profiles…",style:{flex:1,background:"transparent",border:0,outline:"none",color:"var(--revka-text-primary)",fontSize:13}}),c.jsx("kbd",{className:"revka-kbd",style:{fontSize:10,padding:"2px 6px",borderRadius:6,color:"var(--revka-text-faint)",background:"var(--pc-bg-input)",border:"1px solid var(--revka-border-soft)"},children:"ESC"})]}),c.jsxs(ja.List,{style:{flex:1,maxHeight:280,overflowY:"auto",padding:"6px"},children:[c.jsx(ja.Empty,{style:{padding:"20px 16px",textAlign:"center",fontSize:12,color:"var(--revka-text-faint)"},children:u?"Loading auth profiles…":"No auth profiles match"}),v.map(([C,T])=>c.jsx(ja.Group,{heading:sE(C),style:{fontSize:10,fontWeight:700,textTransform:"uppercase",letterSpacing:"0.08em",color:"var(--revka-text-faint)"},children:T.map(E=>{const A=r===E.id,O=OTe(E);return c.jsxs("div",{style:{position:"relative"},onPointerEnter:F=>{const L=F.currentTarget.querySelector("[data-auth-row-delete]");L&&(L.style.opacity="1")},onPointerLeave:F=>{const L=F.currentTarget.querySelector("[data-auth-row-delete]");L&&(L.style.opacity="0")},children:[c.jsx(ja.Item,{value:`${E.provider} ${E.profile_name} ${E.id} ${E.account_id??""}`,keywords:[E.kind,E.provider,E.account_id??""],onSelect:()=>S(E.id),asChild:!0,children:c.jsxs("button",{type:"button",style:{display:"flex",alignItems:"center",gap:10,padding:"8px 10px",paddingRight:34,borderRadius:8,cursor:"pointer",color:"var(--revka-text-primary)",width:"100%",textAlign:"left",background:"transparent",border:0,font:"inherit"},children:[c.jsx("span",{style:{display:"inline-flex",alignItems:"center",justifyContent:"center",width:24,height:24,borderRadius:6,background:A?"var(--revka-signal-network-soft)":"color-mix(in srgb, var(--pc-accent-glow) 60%, transparent)",color:A?"var(--revka-signal-network)":"var(--pc-accent)",flexShrink:0},children:c.jsx(Eg,{size:13})}),c.jsxs("span",{style:{display:"flex",flexDirection:"column",minWidth:0,flex:1},children:[c.jsx("span",{style:{fontSize:12.5,fontWeight:600,fontFamily:"var(--pc-font-mono, ui-monospace, monospace)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:E.profile_name}),E.account_id&&c.jsxs("span",{style:{fontSize:10.5,color:"var(--revka-text-faint)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:["as ",E.account_id]})]}),c.jsx("span",{style:{fontFamily:"var(--pc-font-mono, ui-monospace, monospace)",fontSize:9.5,padding:"2px 6px",borderRadius:4,background:"var(--pc-hover)",color:"var(--revka-text-faint)",flexShrink:0,textTransform:"uppercase",letterSpacing:"0.04em"},children:E.kind}),O&&c.jsxs("span",{title:O.tone==="danger"?`Expired at ${E.expires_at}`:`Expires at ${E.expires_at}`,style:{display:"inline-flex",alignItems:"center",gap:3,fontSize:9.5,padding:"2px 6px",borderRadius:4,background:O.tone==="danger"?"color-mix(in srgb, var(--revka-status-danger) 18%, transparent)":"color-mix(in srgb, var(--revka-status-warning) 18%, transparent)",color:O.tone==="danger"?"var(--revka-status-danger)":"var(--revka-status-warning)",flexShrink:0,textTransform:"uppercase",letterSpacing:"0.04em"},children:[c.jsx(As,{size:9}),O.label]})]})}),c.jsx("button",{type:"button","data-auth-row-delete":!0,title:"Delete auth profile","aria-label":`Delete ${E.provider}:${E.profile_name}`,onClick:F=>{F.preventDefault(),F.stopPropagation(),w(E)},style:{position:"absolute",top:"50%",right:8,transform:"translateY(-50%)",opacity:0,transition:"opacity 80ms ease",background:"transparent",border:0,padding:4,borderRadius:6,cursor:"pointer",color:"var(--revka-status-danger)"},children:c.jsx(Ki,{size:12})})]},E.id)})},C))]}),r&&c.jsx("button",{type:"button",onClick:()=>S(null),style:{margin:"0 8px 8px",padding:"6px 10px",fontSize:11,fontWeight:600,borderRadius:6,border:"1px solid var(--revka-status-warning)",background:"color-mix(in srgb, var(--revka-status-warning) 14%, transparent)",color:"var(--revka-status-warning)",cursor:"pointer"},children:"Clear auth profile"}),c.jsxs("div",{style:{padding:"8px 12px",borderTop:"1px solid var(--revka-border-soft)",display:"flex",alignItems:"center",justifyContent:"space-between",fontSize:11,color:"var(--revka-text-faint)"},children:[c.jsxs("span",{children:[l.length," profile",l.length===1?"":"s"]}),c.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:10},children:[c.jsx("a",{href:"/config",target:"_blank",rel:"noreferrer",style:{color:"var(--revka-text-faint)",textDecoration:"none",fontWeight:500},children:"Open config →"}),c.jsx("button",{type:"button",onClick:()=>_(!0),style:{background:"transparent",border:0,padding:0,cursor:"pointer",color:"var(--pc-accent)",fontWeight:600,fontSize:11},children:"+ New auth profile"})]})]})]})}),c.jsx("style",{children:`
        [cmdk-item][data-selected='true'] {
          background: var(--pc-accent-glow);
          box-shadow: inset 2px 0 0 var(--pc-accent);
        }
        [cmdk-item]:hover {
          background: var(--pc-hover);
        }
        [cmdk-group-heading] {
          padding: 6px 10px 4px;
        }
      `})]});return c.jsxs(c.Fragment,{children:[oa.createPortal(j,document.body),c.jsx(jTe,{open:g,onClose:()=>_(!1),defaultProvider:a,onCreated:async C=>{await d(),_(!1),S(C)}})]})}const DTe=9099,PTe=9100,LTe={width:"100%",padding:"8px 10px",borderRadius:8,border:"1px solid var(--pc-border)",background:"var(--pc-bg-input)",color:"var(--pc-text-primary)",fontSize:12.5,outline:"none"},Em={...LTe,fontFamily:"var(--pc-font-mono, ui-monospace, monospace)"},Am={display:"block",fontSize:10.5,fontWeight:600,color:"var(--revka-text-faint)",textTransform:"uppercase",letterSpacing:"0.08em",marginBottom:6};function ITe({open:e,onClose:n,onCreated:r,defaultAccount:i,defaultProject:s,defaultRunRegion:a,defaultComputeRegion:o}){const l=b.useRef(null),[u,d]=b.useState(""),[p,f]=b.useState(""),[g,_]=b.useState(""),[x,v]=b.useState(""),[S,w]=b.useState(""),[j,C]=b.useState(!1),[T,E]=b.useState(null);b.useEffect(()=>{e&&(d("revka-cloud-run"),f(i??""),_(s??""),v(a??""),w(o??a??""),C(!1),E(null),requestAnimationFrame(()=>{var $;return($=l.current)==null?void 0:$.focus()}))},[e,i,s,a,o]),b.useEffect(()=>{if(!e)return;const $=z=>{z.key==="Escape"&&(z.preventDefault(),j||n())};return window.addEventListener("keydown",$),()=>window.removeEventListener("keydown",$)},[e,n,j]);const A=b.useMemo(()=>!!(u.trim()&&g.trim()&&!j),[u,g,j]);if(!e||typeof document>"u")return null;const O=$=>{$.target===$.currentTarget&&!j&&n()},F=async $=>{if($.preventDefault(),!A)return;C(!0),E(null);const z=uu(u,"revka-cloud-run");try{const B=await GZ({name:z,project:g.trim(),account:p.trim()||void 0,run_region:x.trim()||void 0,compute_region:S.trim()||void 0});await r(B.name)}catch(B){let H="Failed to create gcloud config";B instanceof Xl?B.status===409?H="A gcloud configuration with that name already exists":H=B.message.replace(/^API \d+: /,"")||H:B instanceof Error&&(H=B.message),E(H),C(!1)}},L=c.jsx("div",{role:"dialog","aria-modal":"true","aria-label":"Create gcloud config",onClick:O,style:{position:"fixed",inset:0,zIndex:DTe,background:"rgba(0, 0, 0, 0.48)",backdropFilter:"blur(6px)",display:"flex",alignItems:"flex-start",justifyContent:"center",paddingTop:"12vh"},children:c.jsxs("form",{onSubmit:F,className:"revka-panel","data-variant":"primary",style:{width:"min(540px, calc(100vw - 32px))",maxHeight:"calc(100vh - 24vh)",display:"flex",flexDirection:"column",borderRadius:14,borderColor:"var(--revka-border-strong)",boxShadow:"0 32px 80px rgba(0,0,0,0.48)",zIndex:PTe,overflow:"hidden"},onClick:$=>$.stopPropagation(),children:[c.jsxs("div",{style:{padding:"14px 16px",borderBottom:"1px solid var(--revka-border-soft)",display:"flex",alignItems:"center",gap:10},children:[c.jsx("span",{style:{display:"inline-flex",alignItems:"center",justifyContent:"center",width:28,height:28,borderRadius:8,background:"color-mix(in srgb, var(--pc-accent-glow) 60%, transparent)",color:"var(--pc-accent)"},children:c.jsx(pee,{size:15})}),c.jsxs("div",{style:{flex:1,minWidth:0},children:[c.jsx("div",{style:{fontSize:13,fontWeight:700,color:"var(--revka-text-primary)"},children:"New gcloud config"}),c.jsx("div",{style:{fontSize:11,color:"var(--revka-text-faint)"},children:"Uses the local Cloud SDK credential store. No token bytes are saved to the workflow."})]}),c.jsx("button",{type:"button",onClick:()=>{j||n()},disabled:j,"aria-label":"Close",style:{background:"transparent",border:0,padding:4,cursor:j?"not-allowed":"pointer",color:"var(--revka-text-faint)",opacity:j?.5:1},children:c.jsx(vi,{size:16})})]}),c.jsxs("div",{style:{padding:"14px 16px",display:"flex",flexDirection:"column",gap:12,overflowY:"auto"},children:[c.jsxs("div",{children:[c.jsx("label",{style:Am,htmlFor:"new-gcloud-config-name",children:"Config name *"}),c.jsx("input",{id:"new-gcloud-config-name",ref:l,type:"text",value:u,onChange:$=>d(uu($.target.value,"revka-cloud-run")),placeholder:"revka-cloud-run",style:Em,disabled:j,autoComplete:"off"})]}),c.jsxs("div",{children:[c.jsx("label",{style:Am,htmlFor:"new-gcloud-account",children:"Account"}),c.jsx("input",{id:"new-gcloud-account",type:"text",value:p,onChange:$=>f($.target.value),placeholder:"support@example.com",style:Em,disabled:j,autoComplete:"off"})]}),c.jsxs("div",{children:[c.jsx("label",{style:Am,htmlFor:"new-gcloud-project",children:"Project *"}),c.jsx("input",{id:"new-gcloud-project",type:"text",value:g,onChange:$=>_($.target.value),placeholder:"construct-498201",style:Em,disabled:j,autoComplete:"off"})]}),c.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:8},children:[c.jsxs("div",{children:[c.jsx("label",{style:Am,htmlFor:"new-gcloud-run-region",children:"Cloud Run region"}),c.jsx("input",{id:"new-gcloud-run-region",type:"text",value:x,onChange:$=>v($.target.value),placeholder:"us-central1",style:Em,disabled:j,autoComplete:"off"})]}),c.jsxs("div",{children:[c.jsx("label",{style:Am,htmlFor:"new-gcloud-compute-region",children:"Compute region"}),c.jsx("input",{id:"new-gcloud-compute-region",type:"text",value:S,onChange:$=>w($.target.value),placeholder:"us-central1",style:Em,disabled:j,autoComplete:"off"})]})]}),T&&c.jsx("div",{role:"alert",style:{padding:"8px 10px",borderRadius:8,background:"color-mix(in srgb, var(--revka-status-danger) 14%, transparent)",border:"1px solid var(--revka-status-danger)",color:"var(--revka-status-danger)",fontSize:11.5},children:T})]}),c.jsxs("div",{style:{padding:"12px 16px",borderTop:"1px solid var(--revka-border-soft)",display:"flex",alignItems:"center",justifyContent:"flex-end",gap:8},children:[c.jsx("button",{type:"button",onClick:()=>{j||n()},disabled:j,className:"revka-button",children:"Cancel"}),c.jsxs("button",{type:"submit",disabled:!A,className:"revka-button","data-variant":"primary",style:{display:"inline-flex",alignItems:"center",gap:6},children:[j&&c.jsx(Rr,{size:13,className:"animate-spin"}),j?"Creating...":"Create config"]})]})]})});return oa.createPortal(L,document.body)}const BTe=9100,kI=12,zTe=240,UK=360,Ux=280,Tm=8;function $Te(e,n,r){const i=[];for(const s of e)s&&(i.push({insert:`\${${s}}`,label:`\${${s}}`,group:"Steps"}),i.push({insert:`\${${s}.output}`,label:`\${${s}.output}`,group:"Steps"}),i.push({insert:`\${${s}.status}`,label:`\${${s}.status}`,group:"Steps"}),i.push({insert:`\${${s}.error}`,label:`\${${s}.error}`,group:"Steps"}));for(const s of n)s&&i.push({insert:`\${input.${s}}`,label:`\${input.${s}}`,group:"Inputs"});for(const s of r)s&&i.push({insert:`\${trigger.${s}}`,label:`\${trigger.${s}}`,group:"Trigger"});return i.push({insert:"${env.<name>}",label:"${env.<name>}",group:"Env"}),i}function FTe(e,n){if(!n)return e.slice(0,kI);const r=n.toLowerCase();return e.map(s=>{const a=s.label.replace(/^\$\{/,"").toLowerCase();let o=-1;return a.startsWith(r)?o=2:a.includes(r)&&(o=1),{s,score:o}}).filter(s=>s.score>=0).sort((s,a)=>a.score-s.score).slice(0,kI).map(s=>s.s)}const HTe=["boxSizing","width","height","overflowX","overflowY","borderTopWidth","borderRightWidth","borderBottomWidth","borderLeftWidth","borderStyle","paddingTop","paddingRight","paddingBottom","paddingLeft","fontStyle","fontVariant","fontWeight","fontStretch","fontSize","fontSizeAdjust","lineHeight","fontFamily","textAlign","textTransform","textIndent","textDecoration","letterSpacing","wordSpacing","tabSize","whiteSpace","wordBreak","overflowWrap"];function wI(e,n){const r=e.ownerDocument,i=r.createElement("div"),s=window.getComputedStyle(e);for(const g of HTe)i.style[g]=s[g]??"";i.style.position="absolute",i.style.visibility="hidden",i.style.top="0",i.style.left="0",i.style.whiteSpace="pre-wrap",i.style.wordWrap="break-word";const a=e.value.substring(0,n);i.textContent=a;const o=r.createElement("span");o.textContent="​",i.appendChild(o),r.body.appendChild(i);const l=o.getBoundingClientRect(),u=i.getBoundingClientRect();r.body.removeChild(i);const d=e.getBoundingClientRect(),p=l.left-u.left,f=l.bottom-u.top;return{left:d.left+p-e.scrollLeft,bottom:d.top+f-e.scrollTop}}function WTe(e,n){const{width:r,height:i}=n,s=Math.max(Tm,Math.min(e.left,r-UK-Tm)),a=e.bottom+4,l=a+Ux+Tm>i?Math.max(Tm,e.bottom-4-Ux):Math.min(a,i-Ux-Tm);return{left:s,top:l}}function qTe(e,n){for(let r=n-2;r>=0;r--){const i=e[r];if(i==="}")return-1;if(i==="$"&&e[r+1]==="{")return r}return-1}function or({value:e,onChange:n,placeholder:r,rows:i,style:s,stepIds:a,workflowInputs:o=[],triggerFields:l=[]}){const u=b.useRef(null),[d,p]=b.useState(!1),[f,g]=b.useState(""),_=b.useRef(-1),[x,v]=b.useState(0),[S,w]=b.useState({left:0,bottom:0}),[j,C]=b.useState(()=>typeof window<"u"?{width:window.innerWidth,height:window.innerHeight}:{width:0,height:0}),T=b.useMemo(()=>$Te(a,o,l),[a,o,l]),E=b.useMemo(()=>FTe(T,f),[T,f]);b.useEffect(()=>{v(0)},[f,d]);const A=b.useCallback(()=>{const I=u.current;if(!I)return;const X=I.selectionStart??0,K=qTe(I.value,X);if(K<0){_.current=-1,p(!1);return}const Q=I.value.substring(K+2,X);if(/[\s\n\r]/.test(Q)){_.current=-1,p(!1);return}_.current=K,g(Q),w(wI(I,X)),p(!0)},[]),O=b.useCallback(I=>{n(I.target.value),requestAnimationFrame(()=>A())},[n,A]),F=b.useCallback(I=>{const X=u.current;if(!X)return;const K=_.current;if(K<0)return;const Q=X.selectionStart??0,V=X.value.substring(0,K),R=X.value.substring(Q),q=V+I.insert+R,W=V.length+I.insert.length;n(q),requestAnimationFrame(()=>{const te=u.current;te&&(te.setSelectionRange(W,W),te.focus())}),p(!1)},[n]),L=b.useCallback(I=>{if(!(!d||E.length===0))if(I.key==="ArrowDown")I.preventDefault(),v(X=>(X+1)%E.length);else if(I.key==="ArrowUp")I.preventDefault(),v(X=>(X-1+E.length)%E.length);else if(I.key==="Tab"||I.key==="Enter"){I.preventDefault();const X=E[x];X&&F(X)}else I.key==="Escape"?(I.preventDefault(),p(!1)):(I.key==="ArrowLeft"||I.key==="ArrowRight")&&p(!1)},[d,E,x,F]),$=b.useCallback(()=>{A()},[A]),z=b.useCallback(()=>{p(!1)},[]);b.useLayoutEffect(()=>{if(!d)return;const I=()=>{const X=u.current;if(!X)return;const K=X.selectionStart??0;w(wI(X,K)),C({width:window.innerWidth,height:window.innerHeight})};return window.addEventListener("scroll",I,!0),window.addEventListener("resize",I),()=>{window.removeEventListener("scroll",I,!0),window.removeEventListener("resize",I)}},[d]);const B=b.useMemo(()=>WTe(S,j),[S,j]),H=b.useMemo(()=>{const I=["Steps","Inputs","Trigger","Env"],X=new Map;for(const K of E){const Q=X.get(K.group)??[];Q.push(K),X.set(K.group,Q)}return I.map(K=>({group:K,items:X.get(K)??[]})).filter(K=>K.items.length>0)},[E]),D=b.useCallback(I=>E.indexOf(I),[E]),U=d&&E.length>0&&typeof document<"u"?oa.createPortal(c.jsx("div",{onMouseDown:I=>I.preventDefault(),style:{position:"fixed",left:B.left,top:B.top,zIndex:BTe,minWidth:zTe,maxWidth:UK,maxHeight:Ux,overflowY:"auto",background:"var(--pc-bg-elevated)",border:"1px solid var(--pc-border)",borderRadius:10,boxShadow:"0 12px 32px rgba(0,0,0,0.32)",padding:4,fontSize:12,color:"var(--pc-text-primary)"},children:H.map(({group:I,items:X})=>c.jsxs("div",{style:{marginBottom:2},children:[c.jsx("div",{style:{fontSize:9,fontWeight:700,textTransform:"uppercase",letterSpacing:"0.12em",color:"var(--pc-text-faint)",padding:"6px 8px 2px"},children:I}),X.map(K=>{const Q=D(K),V=Q===x;return c.jsx("div",{role:"option","aria-selected":V,onMouseEnter:()=>v(Q),onMouseDown:R=>{R.preventDefault(),F(K)},style:{padding:"6px 8px",borderRadius:6,cursor:"pointer",fontFamily:"var(--pc-font-mono, ui-monospace, monospace)",background:V?"var(--pc-accent-glow)":"transparent",boxShadow:V?"inset 2px 0 0 var(--pc-accent)":"none",color:V?"var(--pc-text-primary)":"var(--pc-text-secondary)"},children:K.label},K.label)})]},I))}),document.body):null;return c.jsxs(c.Fragment,{children:[c.jsx("textarea",{ref:u,value:e,onChange:O,onKeyDown:L,onSelect:$,onClick:$,onBlur:z,placeholder:r,rows:i,style:s}),U]})}let $l=null,oE=!0,lE=null,cd=null;const cE=new Set;function SI(){cE.forEach(e=>e())}function CI(){return $l?Promise.resolve($l):cd||(cd=YZ().then(e=>(oE=e.available,lE=e.error,$l=e.configs??[],cd=null,SI(),$l)).catch(e=>{throw oE=!1,lE=e instanceof Error?e.message:"Failed to load gcloud configs",$l=[],cd=null,SI(),e}),cd)}function UTe(){const[,e]=b.useState(0),[n,r]=b.useState($l===null);b.useEffect(()=>{const s=()=>e(a=>a+1);return cE.add(s),$l===null?(r(!0),CI().catch(()=>{}).finally(()=>r(!1))):r(!1),()=>{cE.delete(s)}},[]);const i=b.useCallback(async()=>{$l=null,cd=null,r(!0);try{await CI()}finally{r(!1)}},[]);return{configs:$l??[],available:oE,error:lE,loading:n,refresh:i}}const kk=["google_agents_cli","a2a_discover","a2a_send_task","a2a_get_remote_task"],KTe=new Set(kk);function l0(e){const n=new Set,r=[];for(const i of e){const s=String(i||"").trim();!s||n.has(s)||(n.add(s),r.push(s))}return r}function M2(e){const n=l0(e);return n.includes("google_agents_cli")?l0([...n,...kk]):n}function VTe(e){const n=new Set(l0(e));return kk.every(r=>n.has(r))}function jI(e){return l0(e).some(n=>KTe.has(n))}const YTe=new Set(["agent","shell","python","email","a2a"]),GTe=["coder","researcher","reviewer"],$h=["claude","codex","agy","agent","opencode"];function Ol(e){return e.split(/\r?\n|,/).map(n=>n.trim()).filter(Boolean)}function $i(e,n){const r=e.join(", "),[i,s]=b.useState(r),[a,o]=b.useState(!1);b.useEffect(()=>{a||s(r)},[a,r]),b.useEffect(()=>{o(!1),s(r)},[n]);const l=b.useCallback(()=>{const u=Ol(i);return s(u.join(", ")),o(!1),u},[i]);return{draft:i,setDraft:s,startEditing:()=>o(!0),commit:l}}function XTe(e){var r;if(((r=e.conditionalBranches)==null?void 0:r.length)>0)return e.conditionalBranches.map(i=>({...i}));const n=[];return(e.condition||e.onTrueValue)&&n.push({condition:e.condition||"",goto:"",value:e.onTrueValue||void 0}),e.onFalseValue&&n.push({condition:"default",goto:"",value:e.onFalseValue}),n.length>0?n:[{condition:"",goto:"",value:void 0},{condition:"default",goto:"",value:void 0}]}function QTe(e){const n=e.map(s=>({condition:s.condition,goto:s.goto,value:s.value||void 0})),r=n.find(s=>s.condition.trim()!=="default"),i=n.find(s=>s.condition.trim()==="default")??n.find(s=>s!==r);return{conditionalBranches:n,condition:(r==null?void 0:r.condition)??"",onTrueValue:(r==null?void 0:r.value)??"",onFalseValue:(i==null?void 0:i.value)??""}}function Mm(e){return uu(e,"step")}function R2(e,n){return wTe(e,n)}const rt={width:"100%",padding:"6px 8px",borderRadius:8,border:"1px solid var(--pc-border)",background:"var(--pc-bg-input)",color:"var(--pc-text-primary)",fontSize:12,outline:"none"},Ve={...rt,fontFamily:"var(--pc-font-mono, ui-monospace, monospace)"},_e={display:"block",fontSize:10,fontWeight:600,textTransform:"uppercase",letterSpacing:"0.08em",color:"var(--pc-text-faint)",marginBottom:4},pr={padding:12,borderRadius:10,border:"1px solid var(--pc-border)",background:"var(--pc-bg-base)",display:"flex",flexDirection:"column",gap:10},Un={fontSize:10,fontWeight:700,textTransform:"uppercase",letterSpacing:"0.12em",color:"var(--pc-text-faint)"};function mr(){return{fontSize:10,color:"var(--pc-text-faint)",marginTop:2}}function ZTe({node:e,existingTaskIds:n,onUpdate:r,onRenameStep:i,onDelete:s,onChangeType:a,dagContext:o,onRunToHere:l,runToHereDisabled:u=!1,runToHereDisabledReason:d,computeRunToHereClosure:p}){const f=(o==null?void 0:o.stepIds)??[],g=(o==null?void 0:o.workflowInputs)??[],_=(o==null?void 0:o.triggerFields)??[],x=e.data,v=x.type??"agent",S=QNe[v],w=b.useMemo(()=>XTe(x),[x]),j=b.useMemo(()=>n.filter(P=>P!==x.taskId),[n,x.taskId]),C=b.useCallback(P=>{r(e.id,QTe(P))},[e.id,r]),[T,E]=b.useState(()=>Mm(x.name||"")===x.taskId);b.useEffect(()=>{E(Mm(x.name||"")===x.taskId)},[e.id]);const A=b.useMemo(()=>n.filter(P=>P!==x.taskId),[n,x.taskId]),O=$i(x.agentRequiredTools||[],e.id),F=$i(x.agentOutputFields||[],e.id),L=$i(x.agentQualityCriteria||[],e.id),$=$i(x.humanApprovalApproveKeywords||[],e.id),z=$i(x.humanApprovalRejectKeywords||[],e.id),B=$i(x.mapReduceSplits||[],e.id),H=$i(x.kumihoSeedBundles||[],e.id),D=$i(x.kumihoSeedKrefs||[],e.id),U=$i(x.kumihoSeedQueries||[],e.id),I=$i(x.kumihoTraversalEdgeTypes||[],e.id),X=$i(x.kumihoFiltersIncludeKinds||[],e.id),K=$i(x.kumihoFiltersExcludeTags||[],e.id),Q=$i(x.kumihoLockTagPreference||[],e.id),V=$i(x.kumihoNewRevisionTags||[],e.id),R=$i(x.kumihoPatchTagsRemove||[],e.id),q=$i(x.kumihoPatchTagsAdd||[],e.id),W=b.useCallback(P=>{r(e.id,{name:P,label:P})},[e.id,r]),te=b.useCallback(P=>{if(T){const Ie=R2(Mm(P),A);Ie!==x.taskId&&i(x.taskId,Ie)}},[T,x.taskId,A,i]),J=b.useCallback(P=>{F.setDraft(P),r(e.id,{agentOutputFields:Ol(P)})},[F,e.id,r]),G=b.useCallback(()=>{r(e.id,{agentOutputFields:F.commit()})},[F,e.id,r]),re=b.useCallback(P=>{const Ie=Ol(P),st=M2(Ie),Kt=st.length===Ie.length&&st.every((jr,Zr)=>jr===Ie[Zr]);O.setDraft(Kt?P:st.join(", ")),r(e.id,{agentRequiredTools:st,...jI(st)&&!["all","google_agentops"].includes(x.agentTools||"none")?{agentTools:"google_agentops"}:{}})},[O,x.agentTools,e.id,r]),ne=b.useCallback(()=>{const P=O.commit(),Ie=M2(P);Ie.join(", ")!==P.join(", ")&&O.setDraft(Ie.join(", ")),r(e.id,{agentRequiredTools:Ie,...jI(Ie)&&!["all","google_agentops"].includes(x.agentTools||"none")?{agentTools:"google_agentops"}:{}})},[O,x.agentTools,e.id,r]),le=b.useCallback(()=>{const P=M2([...x.agentRequiredTools||[],"google_agents_cli"]);O.setDraft(P.join(", ")),r(e.id,{agentRequiredTools:P,agentTools:"google_agentops"})},[O,x.agentRequiredTools,e.id,r]),[oe,ie]=b.useState(x.taskId);b.useEffect(()=>{ie(x.taskId)},[x.taskId]);const he=b.useCallback(P=>{ie(P),E(!1)},[]),Z=b.useCallback(()=>{const P=Mm(oe);if(P===x.taskId){ie(x.taskId);return}const Ie=R2(P,A);i(x.taskId,Ie)},[oe,x.taskId,A,i]),de=b.useCallback(()=>{const P=R2(Mm(x.name||""),A);P!==x.taskId&&i(x.taskId,P),E(!0)},[x.name,x.taskId,A,i]),[ue,pe]=b.useState(""),[Oe,fe]=b.useState(!1),[Le,Ee]=b.useState([]),[Bt,Xe]=b.useState(!1),[St,yt]=b.useState(["dashboard"]),{profiles:Rt}=FK(),{configs:be,loading:He,available:ht,error:ot,refresh:$t}=UTe(),[jn,Pn]=b.useState(!1),[We,ut]=b.useState(null),[Ct,Mt]=b.useState(!1),[Ge,tt]=b.useState(!1),[bt,Nt]=b.useState(null);b.useEffect(()=>{Pn(!1),ut(null),tt(!1),Nt(null),Mt(!1)},[e.id]);const it=YTe.has(v),dt=b.useMemo(()=>Rt.find(P=>P.id===x.auth)??null,[Rt,x.auth]),Vt=b.useMemo(()=>Rt.find(P=>P.id===x.manusCredentialsRef)??null,[Rt,x.manusCredentialsRef]),jt=b.useMemo(()=>be.find(P=>P.name===x.a2aCloudRunConfig)??null,[be,x.a2aCloudRunConfig]),Ht=b.useMemo(()=>jt??be.find(P=>P.is_active)??be[0]??null,[be,jt]);b.useEffect(()=>{v!=="human_input"&&v!=="notify"&&v!=="human_approval"||nz().then(P=>{const Ie=P.filter(st=>st.enabled&&st.status==="active").map(st=>st.name);yt(Array.from(new Set(["dashboard",...Ie])))}).catch(()=>yt(["dashboard"]))},[v]),b.useEffect(()=>{!Oe||Le.length>0||(Xe(!0),iz(!1,1,50).then(P=>Ee(P.skills)).catch(()=>Ee([])).finally(()=>Xe(!1)))},[Oe,Le.length]);const rr=b.useMemo(()=>{const P=new Set(x.skills),Ie=Le.filter(Kt=>!P.has(Kt.name));if(!ue)return Ie;const st=ue.toLowerCase();return Ie.filter(Kt=>Kt.name.toLowerCase().includes(st)||Kt.description&&Kt.description.toLowerCase().includes(st)||Kt.domain&&Kt.domain.toLowerCase().includes(st))},[ue,x.skills,Le]),Wt=b.useCallback(P=>{const Ie=x.agentHints.includes(P)?x.agentHints.filter(st=>st!==P):[...x.agentHints,P];r(e.id,{agentHints:Ie})},[e.id,x.agentHints,r]),Mn=b.useCallback(P=>{x.skills.includes(P)||r(e.id,{skills:[...x.skills,P]})},[e.id,x.skills,r]),ge=b.useCallback(P=>{r(e.id,{skills:x.skills.filter(Ie=>Ie!==P)})},[e.id,x.skills,r]),Re=b.useCallback(P=>{const Ie=x.channels??[],st=Ie.includes(P)?Ie.filter(Kt=>Kt!==P):[...Ie,P];r(e.id,{channels:st})},[e.id,x.channels,r]),et=b.useCallback((P,Ie,st)=>{KT({taskId:e.id,anchorRect:Ie.currentTarget.getBoundingClientRect(),target:P,participantIndex:st})},[e.id]),[tn,Jt]=b.useState(!1),Ft=b.useMemo(()=>tn&&p?p(x.taskId):[],[tn,p,x.taskId]);b.useEffect(()=>{Jt(!1)},[e.id]);const ir=b.useCallback(()=>{l&&(l(x.taskId,Ft),Jt(!1))},[l,x.taskId,Ft]),xi=v!=="conditional"&&v!=="compute"&&v!=="kumiho_context"&&v!=="kumiho_bundle_update"&&v!=="kumiho_patch_apply"&&v!=="human_input"&&v!=="notify"&&v!=="tag"&&v!=="deprecate"?c.jsxs("div",{children:[c.jsx("label",{style:_e,children:"Skills"}),x.skills.length>0&&c.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:4,marginBottom:6},children:x.skills.map(P=>c.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:4,padding:"2px 8px",borderRadius:6,fontSize:10,fontWeight:500,background:"var(--pc-accent-glow)",color:"var(--pc-accent-light)",border:"1px solid var(--pc-accent-dim)"},children:[P,c.jsx("button",{type:"button",onClick:()=>ge(P),style:{background:"transparent",border:0,color:"inherit",cursor:"pointer",padding:0},children:c.jsx(vi,{size:10})})]},P))}),c.jsxs("button",{type:"button",onClick:()=>fe(!Oe),style:{display:"inline-flex",alignItems:"center",gap:4,padding:"4px 10px",borderRadius:8,border:"1px solid var(--pc-accent-dim)",background:Oe?"var(--pc-accent-glow)":"transparent",color:"var(--pc-accent-light)",fontSize:11,fontWeight:500,cursor:"pointer"},children:[c.jsx(hu,{size:12}),Oe?"Hide skill picker":"Add skills"]}),Oe&&c.jsxs("div",{style:{marginTop:8,borderRadius:10,border:"1px solid var(--pc-border)",background:"var(--pc-bg-input)",overflow:"hidden"},children:[c.jsxs("div",{style:{position:"relative",padding:8},children:[c.jsx(Da,{size:12,style:{position:"absolute",left:16,top:"50%",transform:"translateY(-50%)",color:"var(--pc-text-faint)"}}),c.jsx("input",{type:"text",value:ue,onChange:P=>pe(P.target.value),placeholder:"Search skills…",style:{...rt,paddingLeft:26}})]}),c.jsx("div",{style:{maxHeight:144,overflowY:"auto"},children:Bt?c.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",gap:6,padding:12,fontSize:10,color:"var(--pc-text-faint)"},children:[c.jsx(Rr,{size:11,className:"animate-spin"})," Loading skills…"]}):rr.length===0?c.jsx("p",{style:{textAlign:"center",padding:12,fontSize:10,color:"var(--pc-text-faint)"},children:Le.length===0?"No skills available":"No matching skills"}):rr.slice(0,20).map(P=>c.jsxs("button",{type:"button",onClick:()=>Mn(P.name),style:{display:"block",width:"100%",textAlign:"left",padding:"6px 12px",fontSize:11,border:0,background:"transparent",color:"var(--pc-text-secondary)",cursor:"pointer"},onMouseEnter:Ie=>Ie.currentTarget.style.background="var(--pc-hover)",onMouseLeave:Ie=>Ie.currentTarget.style.background="transparent",children:[c.jsx("div",{style:{fontWeight:500,color:"var(--pc-text-primary)"},children:P.name}),P.description&&c.jsx("div",{style:{fontSize:10,color:"var(--pc-text-faint)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:P.description})]},P.kref))})]})]}):null,on=S==null?void 0:S.icon,qt=VTe(x.agentRequiredTools||[]);return c.jsx(qe,{variant:"primary",className:"overflow-hidden",children:c.jsxs("div",{style:{display:"flex",flexDirection:"column",height:"100%"},children:[c.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"14px 16px",borderBottom:"1px solid var(--revka-border-soft)",position:"relative"},children:[c.jsx("div",{className:"revka-kicker",children:"Step Details"}),c.jsxs("div",{style:{display:"inline-flex",alignItems:"center",gap:6},children:[l?c.jsxs("button",{type:"button",onClick:()=>Jt(P=>!P),disabled:u,title:u&&d?d:"Run every ancestor of this step plus the step itself, then stop",style:{display:"inline-flex",alignItems:"center",gap:4,padding:"4px 8px",borderRadius:8,border:"1px solid var(--revka-border-soft)",background:"transparent",color:u?"var(--pc-text-faint)":"var(--revka-signal-selected)",fontSize:11,cursor:u?"not-allowed":"pointer",opacity:u?.6:1},children:[c.jsx(IE,{size:12}),"Run to here"]}):null,c.jsxs("button",{type:"button",onClick:()=>s(e.id),title:"Delete step",style:{display:"inline-flex",alignItems:"center",gap:4,padding:"4px 8px",borderRadius:8,border:"1px solid var(--revka-border-soft)",background:"transparent",color:"var(--revka-status-danger)",fontSize:11,cursor:"pointer"},children:[c.jsx(Ki,{size:12}),"Delete"]})]}),tn&&l?c.jsxs("div",{role:"dialog","aria-label":"Run to here confirmation",style:{position:"absolute",top:"calc(100% + 4px)",right:12,zIndex:50,width:280,padding:12,borderRadius:10,border:"1px solid var(--revka-border-soft)",background:"var(--pc-bg-base)",boxShadow:"0 8px 24px rgba(0, 0, 0, 0.25)",display:"flex",flexDirection:"column",gap:10},children:[c.jsx("div",{style:{fontSize:11,color:"var(--pc-text-primary)"},children:Ft.length<=1?"Just this one step will run.":`This will run ${Ft.length} steps in order:`}),Ft.length>1?c.jsx("ol",{style:{margin:0,padding:"0 0 0 18px",fontSize:11,color:"var(--pc-text-faint)",maxHeight:160,overflowY:"auto",fontFamily:"var(--pc-font-mono, ui-monospace, monospace)"},children:Ft.map(P=>c.jsxs("li",{style:{color:P===x.taskId?"var(--revka-signal-selected)":"var(--pc-text-faint)",fontWeight:P===x.taskId?600:400},children:[P,P===x.taskId?"  ← target":""]},P))}):null,c.jsxs("div",{style:{display:"flex",gap:6,justifyContent:"flex-end"},children:[c.jsx("button",{type:"button",onClick:()=>Jt(!1),style:{padding:"4px 10px",borderRadius:6,border:"1px solid var(--revka-border-soft)",background:"transparent",color:"var(--pc-text-primary)",fontSize:11,cursor:"pointer"},children:"Cancel"}),c.jsx("button",{type:"button",onClick:ir,style:{padding:"4px 10px",borderRadius:6,border:"1px solid var(--revka-signal-selected)",background:"var(--revka-signal-selected)",color:"var(--pc-bg-base)",fontSize:11,fontWeight:600,cursor:"pointer"},children:"Run"})]})]}):null]}),c.jsxs("div",{style:{overflowY:"auto",padding:16,display:"flex",flexDirection:"column",gap:14},children:[c.jsxs("div",{children:[c.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:8,marginBottom:4},children:[c.jsx("label",{style:{..._e,marginBottom:0},children:"Step ID"}),T?c.jsxs("span",{title:"Step ID auto-derives from Name. Edit it manually to break the link.",style:{display:"inline-flex",alignItems:"center",gap:4,padding:"2px 6px",borderRadius:999,fontSize:9.5,fontWeight:600,textTransform:"uppercase",letterSpacing:"0.06em",color:"var(--revka-text-faint)",background:"color-mix(in srgb, var(--revka-text-faint) 12%, transparent)",border:"1px solid var(--revka-border-soft)"},children:[c.jsx(_z,{size:10}),"linked"]}):c.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6},children:[c.jsxs("span",{title:"Step ID was edited manually — Name changes no longer touch it.",style:{display:"inline-flex",alignItems:"center",gap:4,padding:"2px 6px",borderRadius:999,fontSize:9.5,fontWeight:600,textTransform:"uppercase",letterSpacing:"0.06em",color:"var(--revka-status-warning)",background:"color-mix(in srgb, var(--revka-status-warning) 14%, transparent)",border:"1px solid color-mix(in srgb, var(--revka-status-warning) 36%, transparent)"},children:[c.jsx(Eee,{size:10}),"manual"]}),c.jsx("button",{type:"button",onClick:de,title:"Reset Step ID to slugify(Name) and re-link",style:{padding:"2px 8px",fontSize:10,fontWeight:600,borderRadius:6,border:"1px solid var(--pc-accent-dim)",background:"transparent",color:"var(--pc-accent-light)",cursor:"pointer"},children:"Re-link"})]})]}),c.jsx("input",{type:"text",value:oe,onChange:P=>he(P.target.value),onBlur:Z,onKeyDown:P=>{P.key==="Enter"&&(P.preventDefault(),P.currentTarget.blur())},spellCheck:!1,style:Ve})]}),c.jsxs("div",{children:[c.jsx("label",{style:_e,children:"Name"}),c.jsx("input",{type:"text",value:x.name,onChange:P=>W(P.target.value),onBlur:P=>te(P.currentTarget.value),onKeyDown:P=>{P.key==="Enter"&&(P.preventDefault(),P.currentTarget.blur())},style:rt})]}),c.jsxs("div",{children:[c.jsx("label",{style:_e,children:"Type"}),c.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[c.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6,padding:"6px 10px",borderRadius:999,background:"var(--pc-accent-glow)",color:"var(--pc-accent)",border:"1px solid var(--pc-accent-dim)",fontSize:12,fontWeight:600,flex:1,minWidth:0},children:[on?c.jsx(on,{size:12}):null,c.jsx("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:(S==null?void 0:S.label)??v})]}),c.jsx("button",{type:"button",onClick:a,className:"revka-button",style:{padding:"6px 10px",fontSize:11},children:"Change"})]}),c.jsx("p",{style:{fontSize:11,fontStyle:"italic",color:"var(--pc-text-faint)",marginTop:4},children:"What kind of step this is — determines how it runs."})]}),v==="conditional"&&c.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:6},children:[c.jsx("span",{style:{display:"inline-flex",alignSelf:"flex-start",alignItems:"center",gap:6,padding:"4px 10px",borderRadius:999,fontSize:11,fontWeight:600,background:"color-mix(in srgb, var(--revka-status-warning) 18%, transparent)",color:"var(--revka-status-warning)",border:"1px solid color-mix(in srgb, var(--revka-status-warning) 36%, transparent)"},children:"Conditional Gate"}),c.jsx("div",{style:{display:"flex",flexDirection:"column",gap:10},children:w.map((P,Ie)=>c.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:6,padding:10,borderRadius:8,border:"1px solid var(--pc-border)",background:"var(--pc-bg-panel)"},children:[c.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:8},children:[c.jsxs("span",{style:{...Un,color:"var(--pc-text-muted)"},children:["Branch ",Ie+1]}),c.jsx("button",{type:"button",onClick:()=>{if(w.length<=1){C([{condition:"",goto:"",value:void 0}]);return}C(w.filter((st,Kt)=>Kt!==Ie))},className:"revka-icon-button",title:"Remove branch","aria-label":"Remove branch",style:{width:24,height:24},children:c.jsx(Ki,{size:12})})]}),c.jsx("label",{style:_e,children:"Condition"}),c.jsx("textarea",{value:P.condition,onChange:st=>{const Kt=w.map((jr,Zr)=>Zr===Ie?{...jr,condition:st.target.value}:jr);C(Kt)},placeholder:Ie===w.length-1?"default":"e.g. review.status == 'passed'",rows:2,style:Ve}),c.jsx("label",{style:_e,children:"Target Step"}),c.jsxs("select",{value:P.goto,onChange:st=>{const Kt=w.map((jr,Zr)=>Zr===Ie?{...jr,goto:st.target.value}:jr);C(Kt)},style:rt,children:[c.jsx("option",{value:"",children:"Select target..."}),j.map(st=>c.jsx("option",{value:st,children:st},st))]}),c.jsx("label",{style:_e,children:"Output Value (optional)"}),c.jsx("input",{type:"text",value:P.value||"",onChange:st=>{const Kt=w.map((jr,Zr)=>Zr===Ie?{...jr,value:st.target.value||void 0}:jr);C(Kt)},placeholder:"e.g. 'approved' or review.output_data.score",style:Ve})]},`branch-${Ie}`))}),c.jsx("button",{type:"button",className:"revka-button",onClick:()=>C([...w,{condition:"",goto:"",value:void 0}]),style:{justifyContent:"center"},children:"+ Branch"})]}),c.jsxs("div",{children:[c.jsx("label",{style:_e,children:"Description"}),c.jsx("textarea",{value:x.description,onChange:P=>r(e.id,{description:P.target.value}),placeholder:v==="conditional"?"What this gate checks…":"What this step does…",rows:3,style:rt})]}),xi,c.jsxs("div",{style:{display:"flex",gap:8},children:[c.jsxs("div",{style:{flex:1},children:[c.jsx("label",{style:_e,children:"Retry"}),c.jsx("input",{type:"number",min:0,max:5,value:x.retry,onChange:P=>r(e.id,{retry:parseInt(P.target.value)||0}),style:rt})]}),c.jsxs("div",{style:{flex:1},children:[c.jsx("label",{style:_e,children:"Retry Delay (s)"}),c.jsx("input",{type:"number",min:0,step:1,value:x.retryDelay,onChange:P=>r(e.id,{retryDelay:parseFloat(P.target.value)||5}),style:rt})]})]}),v==="agent"&&c.jsxs("div",{style:pr,children:[c.jsx("div",{style:Un,children:"Agent Config"}),c.jsxs("div",{children:[c.jsx("label",{style:_e,children:"Pool Agent"}),c.jsx("button",{type:"button",onClick:P=>{et("assign",P)},style:{...Ve,textAlign:"left",cursor:"pointer",color:x.assign?"var(--pc-text-primary)":"var(--pc-text-faint)"},children:x.assign||"Choose agent…"}),x.assign&&c.jsxs("div",{style:{marginTop:4,padding:"2px 8px",borderRadius:6,fontSize:10,fontWeight:600,display:"inline-flex",alignItems:"center",gap:4,background:"var(--pc-accent-glow)",color:"var(--pc-accent-light)",border:"1px solid var(--pc-accent-dim)"},children:[c.jsx("span",{children:"●"}),x.assign]})]}),c.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:8},children:[c.jsxs("div",{children:[c.jsx("label",{style:_e,children:"Type"}),c.jsxs("select",{value:x.agentType||"claude",onChange:P=>r(e.id,{agentType:P.target.value}),style:rt,children:[c.jsx("option",{value:"claude",children:"claude"}),c.jsx("option",{value:"codex",children:"codex"}),c.jsx("option",{value:"agy",children:"agy (Antigravity)"}),c.jsx("option",{value:"agent",children:"agent (Cursor)"}),c.jsx("option",{value:"opencode",children:"opencode (OpenCode)"})]})]}),c.jsxs("div",{children:[c.jsx("label",{style:_e,children:"Role"}),c.jsx("input",{type:"text",value:x.role||"",onChange:P=>r(e.id,{role:P.target.value}),placeholder:"coder",style:rt})]})]}),c.jsxs("div",{children:[c.jsx("label",{style:_e,children:"Timeout (sec)"}),c.jsx("input",{type:"number",min:10,max:3600,value:x.timeout||300,onChange:P=>r(e.id,{timeout:parseInt(P.target.value)||300}),style:{...rt,width:100}})]}),c.jsxs("div",{children:[c.jsx("label",{style:_e,children:"Model Override"}),c.jsx("input",{type:"text",value:x.model,onChange:P=>r(e.id,{model:P.target.value}),placeholder:"e.g. claude-sonnet-4-5-20250514",style:Ve})]}),c.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:8},children:[c.jsxs("div",{children:[c.jsx("label",{style:_e,children:"Max Turns"}),c.jsx("input",{type:"number",min:1,max:200,value:x.agentMaxTurns??3,onChange:P=>r(e.id,{agentMaxTurns:parseInt(P.target.value)||3}),style:rt})]}),c.jsxs("div",{children:[c.jsx("label",{style:_e,children:"Tools"}),c.jsxs("select",{value:x.agentTools||"none",onChange:P=>r(e.id,{agentTools:P.target.value}),style:rt,children:[c.jsx("option",{value:"none",children:"none"}),c.jsx("option",{value:"memory",children:"memory"}),c.jsx("option",{value:"google_agentops",children:"google_agentops"}),c.jsx("option",{value:"all",children:"all"})]})]})]}),c.jsxs("div",{children:[c.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:8},children:[c.jsx("label",{style:_e,children:"Required Tools"}),c.jsxs("button",{type:"button",onClick:le,title:"Add Google Agents CLI and A2A companion tools",style:{display:"inline-flex",alignItems:"center",gap:4,padding:"3px 8px",borderRadius:8,border:qt?"1px solid var(--revka-signal-selected)":"1px solid var(--pc-accent-dim)",background:qt?"color-mix(in srgb, var(--revka-signal-selected) 18%, transparent)":"transparent",color:qt?"var(--revka-signal-selected)":"var(--pc-accent-light)",fontSize:10,fontWeight:700,cursor:"pointer",whiteSpace:"nowrap"},children:[c.jsx(hu,{size:11}),"Google AgentOps"]})]}),qt&&c.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:4,marginBottom:6},children:kk.map(P=>c.jsx("span",{style:{display:"inline-flex",alignItems:"center",padding:"2px 6px",borderRadius:6,border:"1px solid var(--revka-border-soft)",background:"var(--pc-bg-input)",color:"var(--pc-text-faint)",fontSize:9.5,fontFamily:"var(--pc-font-mono, ui-monospace, monospace)"},children:P},P))}),c.jsx("input",{type:"text",value:O.draft,onFocus:O.startEditing,onChange:P=>re(P.target.value),onBlur:ne,onKeyDown:P=>{P.key==="Enter"&&(P.preventDefault(),P.currentTarget.blur())},placeholder:"capture_skill, tag_revision",style:Ve})]}),c.jsxs("div",{children:[c.jsx("label",{style:_e,children:"Required Structured Output Fields"}),c.jsx("input",{type:"text",value:F.draft,onFocus:F.startEditing,onChange:P=>J(P.target.value),onBlur:G,onKeyDown:P=>{P.key==="Enter"&&(P.preventDefault(),P.currentTarget.blur())},placeholder:"verdict, production_ready",style:Ve}),c.jsx("p",{style:mr(),children:"Revka appends final-output instructions and fails this step if any named field is missing."}),c.jsx("pre",{style:{...mr(),fontFamily:"var(--font-mono)",whiteSpace:"pre-wrap"},children:`FINAL_OUTPUT:
  verdict: ...
  production_ready: ...`})]}),c.jsxs("div",{style:{paddingTop:8,borderTop:"1px solid var(--pc-border)"},children:[c.jsx(bn,{checked:x.agentQualityEnabled||!1,onChange:P=>r(e.id,{agentQualityEnabled:P}),label:"Quality check"}),x.agentQualityEnabled&&c.jsxs("div",{style:{marginTop:8,display:"flex",flexDirection:"column",gap:8},children:[c.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:8},children:[c.jsxs("div",{children:[c.jsx("label",{style:_e,children:"Threshold"}),c.jsx("input",{type:"number",min:0,max:1,step:.05,value:x.agentQualityThreshold??.7,onChange:P=>r(e.id,{agentQualityThreshold:parseFloat(P.target.value)||.7}),style:rt})]}),c.jsxs("div",{children:[c.jsx("label",{style:_e,children:"Validator Model"}),c.jsx("input",{type:"text",value:x.agentQualityModel||"",onChange:P=>r(e.id,{agentQualityModel:P.target.value}),placeholder:"claude-haiku-4-5-20251001",style:Ve})]})]}),c.jsxs("div",{children:[c.jsx("label",{style:_e,children:"Criteria"}),c.jsx("input",{type:"text",value:L.draft,onFocus:L.startEditing,onChange:P=>{L.setDraft(P.target.value),r(e.id,{agentQualityCriteria:Ol(P.target.value)})},onBlur:()=>r(e.id,{agentQualityCriteria:L.commit()}),onKeyDown:P=>{P.key==="Enter"&&(P.preventDefault(),P.currentTarget.blur())},placeholder:"on_mandate, depth, language_ko",style:Ve})]})]})]}),c.jsxs("div",{children:[c.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:8,marginBottom:4},children:[c.jsx("label",{style:{..._e,marginBottom:0},children:"Prompt"}),c.jsx(bn,{checked:x.compression||!1,onChange:P=>r(e.id,{compression:P}),label:"Compress Output Handoff",title:"Compresses this step's completed output before later steps use it. It does not reduce this step's input prompt; artifacts/files stay unchanged."})]}),c.jsx(or,{value:x.prompt,onChange:P=>r(e.id,{prompt:P}),placeholder:"Agent prompt template (prefer ${step_id.output_data.artifact_path} for full upstream output)",rows:6,style:Ve,stepIds:f,workflowInputs:g,triggerFields:_})]})]}),v==="parallel"&&c.jsxs("div",{style:pr,children:[c.jsx("div",{style:Un,children:"Parallel Config"}),c.jsxs("div",{children:[c.jsx("label",{style:_e,children:"Join Strategy"}),c.jsxs("select",{value:x.parallelJoin||"all",onChange:P=>r(e.id,{parallelJoin:P.target.value}),style:rt,children:[c.jsx("option",{value:"all",children:"all — wait for every branch"}),c.jsx("option",{value:"any",children:"any — first success wins"}),c.jsx("option",{value:"majority",children:"majority — >50% must succeed"})]})]}),c.jsxs("div",{children:[c.jsx("label",{style:_e,children:"Max Concurrency"}),c.jsx("input",{type:"number",min:1,max:10,value:x.parallelMaxConcurrency,onChange:P=>r(e.id,{parallelMaxConcurrency:parseInt(P.target.value)||5}),style:rt})]}),c.jsx("p",{style:mr(),children:"Children are wired by connecting nodes on the canvas."})]}),v==="for_each"&&c.jsxs("div",{style:pr,children:[c.jsx("div",{style:{...Un,color:"var(--revka-signal-selected)"},children:"ForEach Config"}),c.jsxs("div",{children:[c.jsx("label",{style:_e,children:"Range"}),c.jsx("input",{type:"text",value:x.forEachRange||"",onChange:P=>r(e.id,{forEachRange:P.target.value}),placeholder:"e.g. 1..8 or ${resolve_arc.output_data.episode_range}",style:Ve}),c.jsx("p",{style:mr(),children:"Numeric range (N..M or N-M). Supports interpolation."})]}),c.jsxs("div",{children:[c.jsx("label",{style:_e,children:"Items (alternative to range)"}),c.jsx("input",{type:"text",defaultValue:(x.forEachItems||[]).join(", "),onBlur:P=>r(e.id,{forEachItems:P.target.value.split(",").map(Ie=>Ie.trim()).filter(Boolean)}),placeholder:"item1, item2, item3",style:Ve}),c.jsx("p",{style:mr(),children:"Comma-separated values. Used when range is empty."})]}),c.jsxs("div",{children:[c.jsx("label",{style:_e,children:"Loop Variable"}),c.jsx("input",{type:"text",value:x.forEachVariable||"item",onChange:P=>r(e.id,{forEachVariable:P.target.value}),placeholder:"item",style:Ve}),c.jsxs("p",{style:mr(),children:["Access via ",`\${for_each.${x.forEachVariable||"item"}}`,", ","${for_each.index}",","," ","${for_each.iteration}","."]})]}),c.jsxs("div",{children:[c.jsx("label",{style:_e,children:"Sub-steps"}),c.jsx("input",{type:"text",defaultValue:(x.forEachSteps||[]).join(", "),onBlur:P=>r(e.id,{forEachSteps:P.target.value.split(",").map(Ie=>Ie.trim()).filter(Boolean)}),placeholder:"step_a, step_b, step_c",style:Ve}),c.jsx("p",{style:mr(),children:"Comma-separated step IDs executed sequentially per iteration."})]}),c.jsxs("div",{children:[c.jsx("label",{style:_e,children:"Max Iterations"}),c.jsx("input",{type:"number",min:1,max:100,value:x.forEachMaxIterations||20,onChange:P=>r(e.id,{forEachMaxIterations:parseInt(P.target.value)||20}),style:{...rt,width:100}})]}),c.jsxs("div",{style:{display:"flex",gap:16},children:[c.jsx(bn,{checked:x.forEachCarryForward??!0,onChange:P=>r(e.id,{forEachCarryForward:P}),label:"Carry forward"}),c.jsx(bn,{checked:x.forEachFailFast??!0,onChange:P=>r(e.id,{forEachFailFast:P}),label:"Fail fast"})]})]}),v==="goto"&&c.jsxs("div",{style:pr,children:[c.jsx("div",{style:Un,children:"Loop Config"}),c.jsxs("div",{children:[c.jsx("label",{style:_e,children:"Target Step"}),c.jsx("input",{type:"text",value:x.gotoTarget||"",onChange:P=>r(e.id,{gotoTarget:P.target.value}),placeholder:"step-id to loop back to",style:Ve})]}),c.jsxs("div",{children:[c.jsx("label",{style:_e,children:"Max Iterations"}),c.jsx("input",{type:"number",min:1,max:20,value:x.gotoMaxIterations||3,onChange:P=>r(e.id,{gotoMaxIterations:parseInt(P.target.value)||3}),style:{...rt,width:100}})]}),c.jsxs("div",{children:[c.jsx("label",{style:_e,children:"Condition Guard"}),c.jsx("input",{type:"text",value:x.gotoCondition,onChange:P=>r(e.id,{gotoCondition:P.target.value}),placeholder:"Optional: only goto if expression is truthy",style:Ve})]})]}),v==="group_chat"&&c.jsxs("div",{style:pr,children:[c.jsx("div",{style:Un,children:"Group Chat Config"}),c.jsxs("div",{children:[c.jsx("label",{style:_e,children:"Topic"}),c.jsx("input",{type:"text",value:x.groupChatTopic||"",onChange:P=>r(e.id,{groupChatTopic:P.target.value}),placeholder:"Discussion topic",style:rt})]}),c.jsxs("div",{children:[c.jsx("label",{style:_e,children:"Participants"}),c.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:6},children:[(x.groupChatParticipants||[]).map((P,Ie)=>c.jsxs("div",{style:{display:"flex",gap:6,alignItems:"center"},children:[c.jsx("button",{type:"button",onClick:st=>et("groupChatParticipant",st,Ie),style:{...Ve,flex:1,textAlign:"left",cursor:"pointer"},title:"Click to replace with a pool agent",children:P}),c.jsx("button",{type:"button",onClick:()=>r(e.id,{groupChatParticipants:(x.groupChatParticipants||[]).filter((st,Kt)=>Kt!==Ie)}),style:{padding:"5px 8px",borderRadius:6,border:"1px solid var(--revka-border-soft)",background:"transparent",color:"var(--revka-status-danger)",cursor:"pointer"},title:"Remove participant",children:"×"})]},`${P}-${Ie}`)),c.jsxs("div",{style:{display:"flex",gap:6,flexWrap:"wrap"},children:[$h.map(P=>c.jsxs("button",{type:"button",onClick:()=>r(e.id,{groupChatParticipants:[...x.groupChatParticipants||[],P]}),style:{padding:"4px 8px",borderRadius:6,border:"1px solid var(--revka-border-soft)",background:"transparent",color:"var(--pc-text-primary)",fontSize:11,cursor:"pointer"},children:["+ ",P]},P)),c.jsx("button",{type:"button",onClick:P=>et("groupChatParticipant",P),style:{padding:"4px 8px",borderRadius:6,border:"1px solid var(--pc-accent-dim)",background:"var(--pc-accent-glow)",color:"var(--pc-accent-light)",fontSize:11,cursor:"pointer"},children:"+ Pool agent"})]})]})]}),c.jsxs("div",{children:[c.jsx("label",{style:_e,children:"Max Rounds"}),c.jsx("input",{type:"number",min:2,max:20,value:x.groupChatMaxRounds||8,onChange:P=>r(e.id,{groupChatMaxRounds:parseInt(P.target.value)||8}),style:{...rt,width:100}})]}),c.jsxs("div",{style:{display:"flex",gap:8},children:[c.jsxs("div",{style:{flex:1},children:[c.jsx("label",{style:_e,children:"Moderator"}),c.jsx("button",{type:"button",onClick:P=>et("groupChatModerator",P),style:{...Ve,textAlign:"left",cursor:"pointer"},title:"Pick a moderator pool agent",children:x.groupChatModerator||"claude"}),c.jsx("div",{style:{display:"flex",gap:6,marginTop:6},children:$h.map(P=>c.jsx("button",{type:"button",onClick:()=>r(e.id,{groupChatModerator:P}),style:{padding:"2px 6px",borderRadius:6,border:"1px solid var(--revka-border-soft)",background:(x.groupChatModerator||"claude")===P?"var(--pc-accent-glow)":"transparent",color:"var(--pc-text-primary)",fontSize:10,cursor:"pointer"},children:P},P))})]}),c.jsxs("div",{style:{flex:1},children:[c.jsx("label",{style:_e,children:"Strategy"}),c.jsxs("select",{value:x.groupChatStrategy,onChange:P=>r(e.id,{groupChatStrategy:P.target.value}),style:rt,children:[c.jsx("option",{value:"moderator_selected",children:"Moderator Selected"}),c.jsx("option",{value:"round_robin",children:"Round Robin"})]})]})]}),c.jsxs("div",{children:[c.jsx("label",{style:_e,children:"Timeout (s)"}),c.jsx("input",{type:"number",min:1,value:x.groupChatTimeout,onChange:P=>r(e.id,{groupChatTimeout:parseInt(P.target.value)||120}),style:rt})]})]}),v==="supervisor"&&c.jsxs("div",{style:pr,children:[c.jsx("div",{style:Un,children:"Supervisor Config"}),c.jsxs("div",{children:[c.jsx("label",{style:_e,children:"Task"}),c.jsx("textarea",{value:x.supervisorTask||"",onChange:P=>r(e.id,{supervisorTask:P.target.value}),placeholder:"Task to decompose and delegate",rows:2,style:rt})]}),c.jsxs("div",{children:[c.jsx("label",{style:_e,children:"Max Iterations"}),c.jsx("input",{type:"number",min:1,max:10,value:x.supervisorMaxIterations||5,onChange:P=>r(e.id,{supervisorMaxIterations:parseInt(P.target.value)||5}),style:{...rt,width:100}})]}),c.jsxs("div",{style:{display:"flex",gap:8},children:[c.jsxs("div",{style:{flex:1},children:[c.jsx("label",{style:_e,children:"Supervisor Agent"}),c.jsx("button",{type:"button",onClick:P=>et("supervisorAgent",P),style:{...Ve,textAlign:"left",cursor:"pointer"},title:"Pick the supervisor controller from the pool",children:x.supervisorType||"claude"}),c.jsx("div",{style:{display:"flex",gap:6,marginTop:6},children:$h.map(P=>c.jsx("button",{type:"button",onClick:()=>r(e.id,{supervisorType:P}),style:{padding:"2px 6px",borderRadius:6,border:"1px solid var(--revka-border-soft)",background:(x.supervisorType||"claude")===P?"var(--pc-accent-glow)":"transparent",color:"var(--pc-text-primary)",fontSize:10,cursor:"pointer"},children:P},P))})]}),c.jsxs("div",{style:{flex:1},children:[c.jsx("label",{style:_e,children:"Timeout (s)"}),c.jsx("input",{type:"number",min:1,value:x.supervisorTimeout,onChange:P=>r(e.id,{supervisorTimeout:parseInt(P.target.value)||300}),style:rt})]})]}),c.jsxs("div",{children:[c.jsx("label",{style:_e,children:"Specialist Pool"}),c.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:6},children:[(x.supervisorTemplates||[]).map((P,Ie)=>c.jsxs("div",{style:{display:"flex",gap:6,alignItems:"center"},children:[c.jsx("input",{type:"text",readOnly:!0,value:P,style:{...Ve,flex:1}}),c.jsx("button",{type:"button",onClick:()=>r(e.id,{supervisorTemplates:(x.supervisorTemplates||[]).filter((st,Kt)=>Kt!==Ie)}),style:{padding:"5px 8px",borderRadius:6,border:"1px solid var(--revka-border-soft)",background:"transparent",color:"var(--revka-status-danger)",cursor:"pointer"},children:"×"})]},`${P}-${Ie}`)),c.jsx("button",{type:"button",onClick:P=>et("supervisorTemplate",P),style:{alignSelf:"flex-start",padding:"4px 8px",borderRadius:6,border:"1px solid var(--pc-accent-dim)",background:"var(--pc-accent-glow)",color:"var(--pc-accent-light)",fontSize:11,cursor:"pointer"},children:"+ Pool agent"})]})]})]}),v==="shell"&&c.jsxs("div",{style:pr,children:[c.jsx("div",{style:Un,children:"Shell Config"}),c.jsxs("div",{children:[c.jsx("label",{style:_e,children:"Command"}),c.jsx("input",{type:"text",value:x.shellCommand||"",onChange:P=>r(e.id,{shellCommand:P.target.value}),placeholder:"e.g. npm run build",style:Ve})]}),c.jsxs("div",{style:{display:"flex",gap:8},children:[c.jsxs("div",{style:{flex:1},children:[c.jsx("label",{style:_e,children:"Timeout (s)"}),c.jsx("input",{type:"number",min:1,value:x.shellTimeout,onChange:P=>r(e.id,{shellTimeout:parseInt(P.target.value)||60}),style:rt})]}),c.jsx("div",{style:{flex:1,display:"flex",alignItems:"flex-end",paddingBottom:4},children:c.jsx(bn,{checked:x.shellAllowFailure,onChange:P=>r(e.id,{shellAllowFailure:P}),label:"Allow failure"})})]})]}),v==="python"&&c.jsxs("div",{style:pr,children:[c.jsx("div",{style:Un,children:"Python Config"}),c.jsxs("div",{children:[c.jsx("label",{style:_e,children:"Script (path or builtin) — XOR with Code"}),c.jsx("input",{type:"text",value:x.pythonScript||"",onChange:P=>r(e.id,{pythonScript:P.target.value}),placeholder:"e.g. kref_encode.py",style:Ve})]}),c.jsxs("div",{children:[c.jsx("label",{style:_e,children:"Code (inline) — XOR with Script"}),c.jsx("textarea",{value:x.pythonCode||"",onChange:P=>r(e.id,{pythonCode:P.target.value}),placeholder:`import json, sys
json.dump({'ok': True}, sys.stdout)`,rows:4,style:Ve})]}),c.jsxs("div",{children:[c.jsx("label",{style:_e,children:"Args (JSON object)"}),c.jsx("input",{type:"text",value:x.pythonArgs||"",onChange:P=>r(e.id,{pythonArgs:P.target.value}),placeholder:'{"op": "encode", "kref": "${trigger.entity_kref}"}',style:Ve})]}),c.jsxs("div",{children:[c.jsx("label",{style:_e,children:"Python Interpreter"}),c.jsx("input",{type:"text",value:x.pythonInterpreter||"",onChange:P=>r(e.id,{pythonInterpreter:P.target.value}),placeholder:"optional: /path/to/.venv/bin/python",style:Ve})]}),c.jsxs("div",{style:{display:"flex",gap:8},children:[c.jsxs("div",{style:{flex:1},children:[c.jsx("label",{style:_e,children:"Timeout (s)"}),c.jsx("input",{type:"number",min:1,value:x.pythonTimeout||60,onChange:P=>r(e.id,{pythonTimeout:parseInt(P.target.value)||60}),style:rt})]}),c.jsx("div",{style:{flex:1,display:"flex",alignItems:"flex-end",paddingBottom:4},children:c.jsx(bn,{checked:x.pythonAllowFailure||!1,onChange:P=>r(e.id,{pythonAllowFailure:P}),label:"Allow failure"})})]})]}),v==="compute"&&c.jsxs("div",{style:pr,children:[c.jsx("div",{style:Un,children:"Compute Outputs"}),Object.entries(x.computeOutputs||{}).map(([P,Ie],st)=>c.jsxs("div",{style:{display:"grid",gridTemplateColumns:"minmax(92px, 0.45fr) minmax(0, 1fr) auto",gap:6,alignItems:"start"},children:[c.jsxs("div",{children:[c.jsx("label",{style:_e,children:"Key"}),c.jsx("input",{type:"text",value:P,onChange:Kt=>{const jr=Kt.target.value.trim(),Zr={...x.computeOutputs||{}};delete Zr[P],jr&&(Zr[jr]=Ie),r(e.id,{computeOutputs:Zr})},placeholder:"start",spellCheck:!1,style:Ve})]}),c.jsxs("div",{children:[c.jsx("label",{style:_e,children:"Value"}),c.jsx(or,{value:Ie,onChange:Kt=>r(e.id,{computeOutputs:{...x.computeOutputs||{},[P]:Kt}}),rows:2,placeholder:"${{ int(inputs.end) + 1 }}",style:Ve,stepIds:f,workflowInputs:g,triggerFields:_})]}),c.jsx("button",{type:"button",className:"revka-icon-button",title:"Remove output","aria-label":"Remove output",onClick:()=>{const Kt={...x.computeOutputs||{}};delete Kt[P],r(e.id,{computeOutputs:Kt})},style:{width:28,height:28,marginTop:18},children:c.jsx(Ki,{size:13})})]},`${P}-${st}`)),c.jsx("button",{type:"button",className:"revka-button",onClick:()=>{const P=x.computeOutputs||{};let Ie="value",st=2;for(;Object.prototype.hasOwnProperty.call(P,Ie);)Ie=`value_${st}`,st+=1;r(e.id,{computeOutputs:{...P,[Ie]:"${{ 1 }}"}})},style:{justifyContent:"center"},children:"+ Output"})]}),v==="email"&&c.jsxs("div",{style:pr,children:[c.jsx("div",{style:Un,children:"Email Config"}),c.jsxs("div",{children:[c.jsx("label",{style:_e,children:"To"}),c.jsx("input",{type:"text",value:x.emailTo||"",onChange:P=>r(e.id,{emailTo:P.target.value}),placeholder:"lead@example.com or ${steps.lead.output_data.email}",style:rt})]}),c.jsxs("div",{children:[c.jsx("label",{style:_e,children:"Subject"}),c.jsx("input",{type:"text",value:x.emailSubject||"",onChange:P=>r(e.id,{emailSubject:P.target.value}),placeholder:"Hi ${steps.lead.output_data.first_name}",style:rt})]}),c.jsxs("div",{children:[c.jsx("label",{style:_e,children:"Body (plain text)"}),c.jsx(or,{value:x.emailBody||"",onChange:P=>r(e.id,{emailBody:P}),rows:5,placeholder:`Hi there,

Saw you're working on…`,style:rt,stepIds:f,workflowInputs:g,triggerFields:_})]}),c.jsxs("div",{children:[c.jsx("label",{style:_e,children:"Body HTML"}),c.jsx(or,{value:x.emailBodyHtml||"",onChange:P=>r(e.id,{emailBodyHtml:P}),rows:5,placeholder:"<p>Optional HTML body</p>",style:Ve,stepIds:f,workflowInputs:g,triggerFields:_})]}),c.jsxs("div",{children:[c.jsx("label",{style:_e,children:"From (override)"}),c.jsx("input",{type:"text",value:x.emailFrom||"",onChange:P=>r(e.id,{emailFrom:P.target.value}),placeholder:"default: from config.toml",style:rt})]}),c.jsxs("div",{children:[c.jsx("label",{style:_e,children:"Reply-To"}),c.jsx("input",{type:"text",value:x.emailReplyTo||"",onChange:P=>r(e.id,{emailReplyTo:P.target.value}),placeholder:"optional reply-to address",style:rt})]}),c.jsxs("div",{style:{display:"flex",gap:8},children:[c.jsxs("div",{style:{flex:1},children:[c.jsx("label",{style:_e,children:"CC"}),c.jsx("input",{type:"text",value:x.emailCc||"",onChange:P=>r(e.id,{emailCc:P.target.value}),style:rt})]}),c.jsxs("div",{style:{flex:1},children:[c.jsx("label",{style:_e,children:"BCC"}),c.jsx("input",{type:"text",value:x.emailBcc||"",onChange:P=>r(e.id,{emailBcc:P.target.value}),style:rt})]})]}),c.jsxs("div",{style:{paddingTop:8,borderTop:"1px solid var(--pc-border)"},children:[c.jsx(bn,{checked:x.emailTrackClicks||!1,onChange:P=>r(e.id,{emailTrackClicks:P}),label:"Track clicks (rewrite URLs)"}),x.emailTrackClicks&&c.jsxs("div",{style:{paddingLeft:24,marginTop:8,display:"flex",flexDirection:"column",gap:8},children:[c.jsxs("div",{children:[c.jsx("label",{style:_e,children:"Track kref (required)"}),c.jsx("input",{type:"text",value:x.emailTrackKref||"",onChange:P=>r(e.id,{emailTrackKref:P.target.value}),placeholder:"${trigger.entity_kref}",style:Ve})]}),c.jsxs("div",{children:[c.jsx("label",{style:_e,children:"Track secret env"}),c.jsx("input",{type:"text",value:x.emailTrackSecretEnv||"",onChange:P=>r(e.id,{emailTrackSecretEnv:P.target.value}),placeholder:"CLICK_TRACKING_SECRET",style:Ve})]}),c.jsxs("div",{children:[c.jsx("label",{style:_e,children:"Track base URL"}),c.jsx("input",{type:"text",value:x.emailTrackBaseUrl||"",onChange:P=>r(e.id,{emailTrackBaseUrl:P.target.value}),placeholder:"https://gateway.example.com",style:Ve})]})]})]}),c.jsxs("div",{style:{paddingTop:8,borderTop:"1px solid var(--pc-border)"},children:[c.jsx("div",{style:{...Un,marginBottom:8},children:"SMTP Overrides"}),c.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:8},children:[c.jsxs("div",{children:[c.jsx("label",{style:_e,children:"SMTP Host"}),c.jsx("input",{type:"text",value:x.emailSmtpHost||"",onChange:P=>r(e.id,{emailSmtpHost:P.target.value}),placeholder:"smtp.example.com",style:Ve})]}),c.jsxs("div",{children:[c.jsx("label",{style:_e,children:"SMTP Port"}),c.jsx("input",{type:"number",min:1,value:x.emailSmtpPort||"",onChange:P=>r(e.id,{emailSmtpPort:parseInt(P.target.value)||0}),placeholder:"465",style:rt})]}),c.jsxs("div",{children:[c.jsx("label",{style:_e,children:"SMTP Username"}),c.jsx("input",{type:"text",value:x.emailSmtpUsername||"",onChange:P=>r(e.id,{emailSmtpUsername:P.target.value}),placeholder:"optional username override",style:rt})]}),c.jsxs("div",{children:[c.jsx("label",{style:_e,children:"Password Env"}),c.jsx("input",{type:"text",value:x.emailSmtpPasswordEnv||"",onChange:P=>r(e.id,{emailSmtpPasswordEnv:P.target.value}),placeholder:"SMTP_PASSWORD",style:Ve})]})]}),c.jsx("div",{style:{marginTop:8},children:c.jsx(bn,{checked:x.emailSmtpTls??!0,onChange:P=>r(e.id,{emailSmtpTls:P}),label:"Use TLS"})})]}),c.jsxs("div",{style:{display:"flex",gap:8,paddingTop:8,borderTop:"1px solid var(--pc-border)"},children:[c.jsxs("div",{style:{flex:1},children:[c.jsx("label",{style:_e,children:"Timeout (s)"}),c.jsx("input",{type:"number",min:1,value:x.emailTimeout||30,onChange:P=>r(e.id,{emailTimeout:parseInt(P.target.value)||30}),style:rt})]}),c.jsx("div",{style:{flex:1,display:"flex",alignItems:"flex-end",paddingBottom:4},children:c.jsx(bn,{checked:x.emailDryRun||!1,onChange:P=>r(e.id,{emailDryRun:P}),label:"Dry run"})})]})]}),v==="image"&&c.jsxs("div",{style:pr,children:[c.jsx("div",{style:Un,children:"Image Config"}),c.jsxs("div",{children:[c.jsx("label",{style:_e,children:"Prompt"}),c.jsx(or,{value:x.imagePrompt||"",onChange:P=>r(e.id,{imagePrompt:P}),rows:5,placeholder:"Architectural panel of Seoul Station 2040, golden hour…",style:rt,stepIds:f,workflowInputs:g,triggerFields:_})]}),c.jsxs("div",{style:{display:"flex",gap:8},children:[c.jsxs("div",{style:{flex:1},children:[c.jsx("label",{style:_e,children:"Count (1–5)"}),c.jsx("input",{type:"number",min:1,max:5,value:x.imageCount??1,onChange:P=>r(e.id,{imageCount:Math.max(1,Math.min(5,parseInt(P.target.value)||1))}),style:rt})]}),c.jsxs("div",{style:{flex:1},children:[c.jsx("label",{style:_e,children:"Timeout (s)"}),c.jsx("input",{type:"number",min:1,value:x.imageTimeout??1200,onChange:P=>r(e.id,{imageTimeout:parseInt(P.target.value)||1200}),style:rt})]})]}),c.jsxs("div",{children:[c.jsx("label",{style:_e,children:"Item name (override)"}),c.jsx("input",{type:"text",value:x.imageItemName||"",onChange:P=>r(e.id,{imageItemName:P.target.value}),placeholder:"default: derived from step id",style:rt})]}),c.jsxs("div",{style:{display:"flex",gap:8},children:[c.jsxs("div",{style:{flex:1},children:[c.jsx("label",{style:_e,children:"Space"}),c.jsx("input",{type:"text",value:x.imageSpace||"",onChange:P=>r(e.id,{imageSpace:P.target.value}),placeholder:"default: Images (under harness)",style:rt})]}),c.jsxs("div",{style:{flex:1},children:[c.jsx("label",{style:_e,children:"Sandbox"}),c.jsxs("select",{value:x.imageSandbox||"",onChange:P=>r(e.id,{imageSandbox:P.target.value}),style:rt,children:[c.jsx("option",{value:"",children:"auto (platform default)"}),c.jsx("option",{value:"read-only",children:"read-only"}),c.jsx("option",{value:"workspace-write",children:"workspace-write"}),c.jsx("option",{value:"danger-full-access",children:"danger-full-access"})]})]})]}),c.jsxs("div",{children:[c.jsx("label",{style:_e,children:"Output filename (override)"}),c.jsx("input",{type:"text",value:x.imageOutputPath||"",onChange:P=>r(e.id,{imageOutputPath:P.target.value}),placeholder:"default: <step_id>.png",style:Ve})]}),c.jsxs("div",{children:[c.jsx("label",{style:_e,children:"Working Directory"}),c.jsx("input",{type:"text",value:x.imageCwd||"",onChange:P=>r(e.id,{imageCwd:P.target.value}),placeholder:"default: ~/.revka/workspace",style:Ve})]}),c.jsxs("div",{children:[c.jsx("label",{style:_e,children:"Output pattern (count > 1)"}),c.jsx("input",{type:"text",value:x.imageOutputPattern||"",onChange:P=>r(e.id,{imageOutputPattern:P.target.value}),placeholder:"e.g. panel-{n}.png",style:Ve})]}),c.jsxs("div",{children:[c.jsx("label",{style:_e,children:"Input image paths"}),c.jsx("textarea",{value:(x.imageInputImages||[]).join(`
`),onChange:P=>r(e.id,{imageInputImages:P.target.value.split(/\r?\n|,/).map(Ie=>Ie.trim()).filter(Boolean)}),placeholder:"/workspace/reference.png",style:{...Ve,minHeight:72,resize:"vertical"}})]}),c.jsxs("div",{style:{display:"flex",gap:16,paddingTop:8,borderTop:"1px solid var(--pc-border)"},children:[c.jsx(bn,{checked:x.imageCanvas!==!1,onChange:P=>r(e.id,{imageCanvas:P}),label:"Push to canvas"}),c.jsx(bn,{checked:x.imageRegisterArtifact!==!1,onChange:P=>r(e.id,{imageRegisterArtifact:P}),label:"Register Kumiho artifact"})]}),x.imageCanvas!==!1&&c.jsxs("div",{children:[c.jsx("label",{style:_e,children:"Canvas ID"}),c.jsx("input",{type:"text",value:x.imageCanvasTarget||"",onChange:P=>r(e.id,{imageCanvasTarget:P.target.value}),placeholder:"optional canvas id; blank uses default",style:Ve})]})]}),v==="output"&&c.jsxs("div",{style:pr,children:[c.jsx("div",{style:Un,children:"Output Config"}),c.jsxs("div",{children:[c.jsx("label",{style:_e,children:"Format"}),c.jsxs("select",{value:x.outputFormat||"markdown",onChange:P=>r(e.id,{outputFormat:P.target.value}),style:rt,children:[c.jsx("option",{value:"markdown",children:"markdown"}),c.jsx("option",{value:"json",children:"json"}),c.jsx("option",{value:"text",children:"text"})]})]}),c.jsxs("div",{children:[c.jsx("label",{style:_e,children:"Template"}),c.jsx(or,{value:x.outputTemplate,onChange:P=>r(e.id,{outputTemplate:P}),placeholder:"Output template with ${step_id.output} interpolation",rows:6,style:Ve,stepIds:f,workflowInputs:g,triggerFields:_})]}),c.jsxs("div",{style:{paddingTop:8,borderTop:"1px solid var(--pc-border)"},children:[c.jsx("div",{style:{...Un,color:"var(--pc-accent-light)",marginBottom:8},children:"Kumiho Entity"}),c.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8},children:[c.jsxs("div",{children:[c.jsx("label",{style:_e,children:"Entity Name"}),c.jsx("input",{type:"text",value:x.entityName||"",onChange:P=>r(e.id,{entityName:P.target.value}),placeholder:"e.g. ep-${inputs.episode}-draft",style:Ve})]}),c.jsxs("div",{style:{display:"flex",gap:8},children:[c.jsxs("div",{style:{flex:1},children:[c.jsx("label",{style:_e,children:"Kind"}),c.jsx("input",{type:"text",value:x.entityKind||"",onChange:P=>r(e.id,{entityKind:P.target.value}),placeholder:"e.g. qs-episode-draft",style:Ve})]}),c.jsxs("div",{style:{width:96},children:[c.jsx("label",{style:_e,children:"Tag"}),c.jsx("input",{type:"text",value:x.entityTag||"",onChange:P=>r(e.id,{entityTag:P.target.value}),placeholder:"ready",style:Ve})]})]}),c.jsxs("div",{children:[c.jsx("label",{style:_e,children:"Space"}),c.jsx("input",{type:"text",value:x.entitySpace||"",onChange:P=>r(e.id,{entitySpace:P.target.value}),placeholder:"CognitiveMemory/creative/...",style:Ve})]}),c.jsxs("div",{children:[c.jsx("label",{style:_e,children:"Metadata Target"}),c.jsxs("select",{value:x.entityMetadataTarget||"item",onChange:P=>r(e.id,{entityMetadataTarget:P.target.value}),style:rt,children:[c.jsx("option",{value:"item",children:"item"}),c.jsx("option",{value:"revision",children:"revision"}),c.jsx("option",{value:"artifact",children:"artifact"})]}),c.jsx("p",{style:mr(),children:"Item keeps trigger auto-mapping; revision is the resolve default."})]}),c.jsxs("div",{children:[c.jsx("label",{style:_e,children:"Artifact Summary Model"}),c.jsx("input",{type:"text",value:x.artifactSummaryModel||"",onChange:P=>r(e.id,{artifactSummaryModel:P.target.value}),placeholder:"claude-haiku-4-5-20251001",style:Ve})]}),c.jsxs("div",{children:[c.jsx("label",{style:_e,children:"Metadata"}),Object.entries(x.entityMetadata||{}).map(([P,Ie])=>c.jsxs("div",{style:{display:"flex",gap:4,alignItems:"center",marginBottom:4},children:[c.jsx("input",{type:"text",readOnly:!0,value:P,style:{...Ve,width:120,opacity:.7}}),c.jsx("span",{style:{fontSize:11,color:"var(--pc-text-faint)"},children:"="}),c.jsx("input",{type:"text",value:String(Ie??""),onChange:st=>r(e.id,{entityMetadata:{...x.entityMetadata,[P]:st.target.value}}),style:{...Ve,flex:1}}),c.jsx("button",{onClick:()=>{const st={...x.entityMetadata};delete st[P],r(e.id,{entityMetadata:st})},style:{background:"transparent",border:0,color:"var(--pc-text-faint)",cursor:"pointer"},children:"×"})]},P)),c.jsx("button",{onClick:()=>{const P=window.prompt("Metadata key:");P&&r(e.id,{entityMetadata:{...x.entityMetadata||{},[P]:""}})},style:{fontSize:10,padding:"4px 8px",borderRadius:6,border:"1px solid var(--pc-accent-dim)",background:"var(--pc-accent-glow)",color:"var(--pc-accent-light)",cursor:"pointer"},children:"+ Add metadata"})]}),c.jsx("p",{style:mr(),children:"Publishes output as a Kumiho entity for downstream triggers."})]})]})]}),v==="handoff"&&c.jsxs("div",{style:pr,children:[c.jsx("div",{style:Un,children:"Handoff Config"}),c.jsxs("div",{children:[c.jsx("label",{style:_e,children:"From Step"}),c.jsx("input",{type:"text",value:x.handoffFrom||"",onChange:P=>r(e.id,{handoffFrom:P.target.value}),placeholder:"step-id",style:Ve})]}),c.jsxs("div",{children:[c.jsx("label",{style:_e,children:"Receiving Agent"}),c.jsx("button",{type:"button",onClick:P=>et("handoffTo",P),style:{...Ve,textAlign:"left",cursor:"pointer"},title:"Pick the receiving agent from the pool",children:x.handoffTo||"codex"}),c.jsx("div",{style:{display:"flex",gap:6,marginTop:6},children:$h.map(P=>c.jsx("button",{type:"button",onClick:()=>r(e.id,{handoffTo:P}),style:{padding:"2px 6px",borderRadius:6,border:"1px solid var(--revka-border-soft)",background:(x.handoffTo||"codex")===P?"var(--pc-accent-glow)":"transparent",color:"var(--pc-text-primary)",fontSize:10,cursor:"pointer"},children:P},P))})]}),c.jsxs("div",{children:[c.jsx("label",{style:_e,children:"Reason"}),c.jsx("input",{type:"text",value:x.handoffReason||"",onChange:P=>r(e.id,{handoffReason:P.target.value}),placeholder:"Continuing the task",style:rt})]}),c.jsxs("div",{children:[c.jsx("label",{style:_e,children:"Task"}),c.jsx("textarea",{value:x.handoffTask,onChange:P=>r(e.id,{handoffTask:P.target.value}),placeholder:"Specific task for the receiving agent",rows:2,style:rt})]}),c.jsxs("div",{children:[c.jsx("label",{style:_e,children:"Timeout (s)"}),c.jsx("input",{type:"number",min:1,value:x.handoffTimeout,onChange:P=>r(e.id,{handoffTimeout:parseInt(P.target.value)||300}),style:rt})]})]}),v==="human_input"&&c.jsxs("div",{style:pr,children:[c.jsx("div",{style:{...Un,color:"var(--revka-status-warning)"},children:"Human Input Config"}),c.jsxs("div",{children:[c.jsx("label",{style:_e,children:"Message"}),c.jsx("textarea",{value:x.humanInputMessage,onChange:P=>r(e.id,{humanInputMessage:P.target.value}),placeholder:"Prompt sent to the channel",rows:4,style:rt})]}),c.jsxs("div",{style:{display:"flex",gap:8},children:[c.jsxs("div",{style:{flex:1},children:[c.jsx("label",{style:_e,children:"Channel"}),c.jsxs("select",{value:x.channel,onChange:P=>r(e.id,{channel:P.target.value}),style:rt,children:[c.jsx("option",{value:"dashboard",children:"Dashboard"}),c.jsx("option",{value:"discord",children:"Discord"}),c.jsx("option",{value:"slack",children:"Slack"})]})]}),c.jsxs("div",{style:{flex:1},children:[c.jsx("label",{style:_e,children:"Timeout (s)"}),c.jsx("input",{type:"number",min:60,value:x.humanInputTimeout,onChange:P=>r(e.id,{humanInputTimeout:parseInt(P.target.value)||3600}),style:rt})]})]})]}),v==="human_approval"&&c.jsxs("div",{style:pr,children:[c.jsx("div",{style:{...Un,color:"var(--revka-status-warning)"},children:"Human Approval Config"}),c.jsxs("div",{children:[c.jsx("label",{style:_e,children:"Channel"}),c.jsx("select",{value:x.humanApprovalChannel,onChange:P=>r(e.id,{humanApprovalChannel:P.target.value}),style:rt,children:St.map(P=>c.jsx("option",{value:P,children:P},P))})]}),c.jsxs("div",{children:[c.jsx("label",{style:_e,children:"Channel ID Override"}),c.jsx("input",{type:"text",value:x.humanApprovalChannelId,onChange:P=>r(e.id,{humanApprovalChannelId:P.target.value}),placeholder:"optional channel/thread override",style:rt})]}),c.jsxs("div",{children:[c.jsx("label",{style:_e,children:"Approval Message"}),c.jsx("textarea",{value:x.humanApprovalMessage,onChange:P=>r(e.id,{humanApprovalMessage:P.target.value}),placeholder:"Message shown when requesting approval",rows:3,style:rt})]}),c.jsxs("div",{children:[c.jsx("label",{style:_e,children:"Timeout (s)"}),c.jsx("input",{type:"number",min:60,value:x.humanApprovalTimeout,onChange:P=>r(e.id,{humanApprovalTimeout:parseInt(P.target.value)||3600}),style:rt})]}),c.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:8},children:[c.jsxs("div",{children:[c.jsx("label",{style:_e,children:"On Reject Goto"}),c.jsx("input",{type:"text",value:x.humanApprovalOnRejectGoto,onChange:P=>r(e.id,{humanApprovalOnRejectGoto:P.target.value}),placeholder:"optional step id",style:Ve})]}),c.jsxs("div",{children:[c.jsx("label",{style:_e,children:"On Reject Max"}),c.jsx("input",{type:"number",min:1,max:10,value:x.humanApprovalOnRejectMax??3,onChange:P=>r(e.id,{humanApprovalOnRejectMax:parseInt(P.target.value)||3}),style:rt})]})]}),c.jsxs("div",{children:[c.jsx("label",{style:_e,children:"Approve Keywords"}),c.jsx("input",{type:"text",value:$.draft,onFocus:$.startEditing,onChange:P=>{$.setDraft(P.target.value),r(e.id,{humanApprovalApproveKeywords:Ol(P.target.value)})},onBlur:()=>r(e.id,{humanApprovalApproveKeywords:$.commit()}),onKeyDown:P=>{P.key==="Enter"&&(P.preventDefault(),P.currentTarget.blur())},placeholder:"approve, approved, yes, lgtm",style:Ve})]}),c.jsxs("div",{children:[c.jsx("label",{style:_e,children:"Reject Keywords"}),c.jsx("input",{type:"text",value:z.draft,onFocus:z.startEditing,onChange:P=>{z.setDraft(P.target.value),r(e.id,{humanApprovalRejectKeywords:Ol(P.target.value)})},onBlur:()=>r(e.id,{humanApprovalRejectKeywords:z.commit()}),onKeyDown:P=>{P.key==="Enter"&&(P.preventDefault(),P.currentTarget.blur())},placeholder:"reject, rejected, no",style:Ve})]})]}),v==="manus"&&c.jsxs("div",{style:pr,children:[c.jsx("div",{style:{...Un,color:"var(--revka-signal-network)"},children:"Manus Config"}),c.jsxs("div",{children:[c.jsx("label",{style:_e,children:"Prompt"}),c.jsx(or,{value:x.manusPrompt||"",onChange:P=>r(e.id,{manusPrompt:P}),rows:5,placeholder:"Research the top 5 startups in Seoul working on robotics — return names + one-line descriptions.",style:rt,stepIds:f,workflowInputs:g,triggerFields:_}),c.jsxs("p",{style:mr(),children:["Free-text task for the Manus web agent. Supports $","${...}"," interpolation."]})]}),c.jsxs("div",{style:{display:"flex",gap:8},children:[c.jsxs("div",{style:{flex:1},children:[c.jsx("label",{style:_e,children:"Agent profile"}),c.jsx("input",{type:"text",value:x.manusAgentProfile||"",onChange:P=>r(e.id,{manusAgentProfile:P.target.value}),placeholder:"manus-1.6",style:rt})]}),c.jsxs("div",{style:{flex:1},children:[c.jsx("label",{style:_e,children:"Locale"}),c.jsx("input",{type:"text",value:x.manusLocale||"",onChange:P=>r(e.id,{manusLocale:P.target.value}),placeholder:"auto",style:rt})]})]}),c.jsxs("div",{children:[c.jsx("label",{style:_e,children:"Connectors"}),c.jsx("input",{type:"text",defaultValue:(x.manusConnectors||[]).join(", "),onBlur:P=>r(e.id,{manusConnectors:P.target.value.split(",").map(Ie=>Ie.trim()).filter(Boolean)}),placeholder:"gmail, drive, slack",style:Ve}),c.jsx("p",{style:mr(),children:"Comma-separated connector ids enabled for this task."})]}),c.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:8},children:[c.jsxs("div",{children:[c.jsx("label",{style:_e,children:"Enable Skills"}),c.jsx("input",{type:"text",defaultValue:(x.manusEnableSkills||[]).join(", "),onBlur:P=>r(e.id,{manusEnableSkills:Ol(P.target.value)}),placeholder:"skill ids",style:Ve})]}),c.jsxs("div",{children:[c.jsx("label",{style:_e,children:"Force Skills"}),c.jsx("input",{type:"text",defaultValue:(x.manusForceSkills||[]).join(", "),onBlur:P=>r(e.id,{manusForceSkills:Ol(P.target.value)}),placeholder:"required skill ids",style:Ve})]})]}),c.jsxs("div",{children:[c.jsx("label",{style:_e,children:"Title (optional)"}),c.jsx("input",{type:"text",value:x.manusTitle||"",onChange:P=>r(e.id,{manusTitle:P.target.value}),placeholder:"Robotics startup scan — Seoul",style:rt})]}),c.jsxs("div",{children:[c.jsx("label",{style:_e,children:"Project ID"}),c.jsx("input",{type:"text",value:x.manusProjectId||"",onChange:P=>r(e.id,{manusProjectId:P.target.value}),placeholder:"optional Manus project id",style:Ve})]}),c.jsxs("div",{style:{display:"flex",gap:8},children:[c.jsxs("div",{style:{flex:1},children:[c.jsx("label",{style:_e,children:"Timeout (s)"}),c.jsx("input",{type:"number",min:30,value:x.manusTimeoutSeconds??600,onChange:P=>r(e.id,{manusTimeoutSeconds:parseInt(P.target.value)||600}),style:rt})]}),c.jsxs("div",{style:{flex:1},children:[c.jsx("label",{style:_e,children:"Poll interval (s)"}),c.jsx("input",{type:"number",min:1,value:x.manusPollIntervalSeconds??5,onChange:P=>r(e.id,{manusPollIntervalSeconds:parseInt(P.target.value)||5}),style:rt})]})]}),c.jsxs("div",{children:[c.jsx("label",{style:_e,children:"Structured output schema (JSON, optional)"}),c.jsx("textarea",{value:x.manusStructuredOutputSchema||"",onChange:P=>r(e.id,{manusStructuredOutputSchema:P.target.value}),rows:5,placeholder:'{"type": "object", "properties": {"companies": {"type": "array"}}}',style:Ve}),c.jsxs("p",{style:mr(),children:["When set, Manus returns a value matching this schema; available as $","${step.output_data.structured_output}","."]})]}),c.jsx("div",{style:{paddingTop:8,borderTop:"1px solid var(--pc-border)"},children:c.jsx(bn,{checked:x.manusAllowFailure||!1,onChange:P=>r(e.id,{manusAllowFailure:P}),label:"Allow failure (continue workflow on Manus error)"})}),c.jsxs("div",{style:{paddingTop:8,borderTop:"1px solid var(--pc-border)"},children:[c.jsx("label",{style:_e,children:"Manus credential"}),c.jsxs("button",{type:"button",onClick:P=>{Nt(P.currentTarget.getBoundingClientRect()),tt(!0)},style:{...rt,display:"flex",alignItems:"center",gap:8,textAlign:"left",cursor:"pointer",color:x.manusCredentialsRef?"var(--pc-text-primary)":"var(--pc-text-faint)"},children:[c.jsx(Eg,{size:12,style:{color:"var(--revka-text-faint)",flexShrink:0}}),c.jsx("span",{style:{flex:1,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:Vt?`${sE(Vt.provider)} · ${Vt.profile_name}`:x.manusCredentialsRef||"None — falls back to MANUS_API_KEY env var"})]}),x.manusCredentialsRef&&c.jsx("button",{type:"button",onClick:()=>r(e.id,{manusCredentialsRef:""}),style:{marginTop:6,padding:"4px 10px",fontSize:11,fontWeight:600,borderRadius:6,border:"1px solid var(--revka-status-warning)",background:"color-mix(in srgb, var(--revka-status-warning) 14%, transparent)",color:"var(--revka-status-warning)",cursor:"pointer"},children:"Clear"}),c.jsx("p",{style:mr(),children:"Optional. Encrypted Manus API key from the auth-profile store. When set, the runtime resolves it at execution time and skips the MANUS_API_KEY env var."}),c.jsx(bI,{open:Ge,onOpenChange:tt,value:x.manusCredentialsRef,anchorRect:bt,providerFilter:"manus",onSelect:P=>r(e.id,{manusCredentialsRef:P??""})})]}),c.jsx("div",{style:{paddingTop:8,borderTop:"1px solid var(--pc-border)"},children:c.jsx(bn,{checked:x.manusRegisterEnabled===!0,onChange:P=>r(e.id,{manusRegisterEnabled:P}),label:"Register output as Kumiho entity"})}),x.manusRegisterEnabled&&c.jsxs("div",{style:{paddingTop:8},children:[c.jsx("div",{style:{...Un,color:"var(--pc-accent-light)",marginBottom:8},children:"Kumiho Entity"}),c.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8},children:[c.jsxs("div",{children:[c.jsx("label",{style:_e,children:"Entity Name"}),c.jsx("input",{type:"text",value:x.manusRegisterEntityName||"",onChange:P=>r(e.id,{manusRegisterEntityName:P.target.value}),placeholder:"e.g. report-${inputs.topic}",style:Ve})]}),c.jsxs("div",{style:{display:"flex",gap:8},children:[c.jsxs("div",{style:{flex:1},children:[c.jsx("label",{style:_e,children:"Kind"}),c.jsx("input",{type:"text",value:x.manusRegisterEntityKind||"",onChange:P=>r(e.id,{manusRegisterEntityKind:P.target.value}),placeholder:"e.g. research-report",style:Ve})]}),c.jsxs("div",{style:{width:96},children:[c.jsx("label",{style:_e,children:"Tag"}),c.jsx("input",{type:"text",value:x.manusRegisterEntityTag||"",onChange:P=>r(e.id,{manusRegisterEntityTag:P.target.value}),placeholder:"published",style:Ve})]})]}),c.jsxs("div",{children:[c.jsx("label",{style:_e,children:"Space"}),c.jsx("input",{type:"text",value:x.manusRegisterEntitySpace||"",onChange:P=>r(e.id,{manusRegisterEntitySpace:P.target.value}),placeholder:"Revka/WorkflowOutputs/Research",style:Ve})]}),c.jsxs("div",{children:[c.jsx("label",{style:_e,children:"Content source"}),c.jsxs("select",{value:x.manusRegisterContentSource||"message",onChange:P=>r(e.id,{manusRegisterContentSource:P.target.value}),style:rt,children:[c.jsx("option",{value:"message",children:"message (assistant text)"}),c.jsx("option",{value:"structured",children:"structured (structured_output JSON)"})]})]}),c.jsx(bn,{checked:x.manusRegisterAttachments??!0,onChange:P=>r(e.id,{manusRegisterAttachments:P}),label:"Download attachments to entity_dir/attachments/"}),c.jsxs("p",{style:mr(),children:["Content is written to",c.jsx("code",{children:" ~/.revka/artifacts/<space>/<kind>/<name>/content.md"}),". Each attachment lands under the same dir's ",c.jsx("code",{children:"attachments/"}),"."]})]})]})]}),v==="a2a"&&c.jsxs("div",{style:pr,children:[c.jsx("div",{style:{...Un,color:"var(--revka-signal-network)"},children:"A2A Config"}),c.jsxs("div",{children:[c.jsx("label",{style:_e,children:"Endpoint URL"}),c.jsx(or,{value:x.a2aUrl,onChange:P=>r(e.id,{a2aUrl:P}),placeholder:"https://agent.example.com/a2a",rows:1,style:Ve,stepIds:f,workflowInputs:g,triggerFields:_})]}),c.jsxs("div",{children:[c.jsx("label",{style:_e,children:"Skill ID"}),c.jsxs("div",{style:{display:"flex",gap:6},children:[c.jsx("input",{type:"text",value:x.a2aSkillId,onChange:P=>r(e.id,{a2aSkillId:P.target.value}),placeholder:"Optional skill ID",style:{...Ve,flex:1}}),c.jsx("button",{type:"button",onClick:P=>et("a2aSkill",P),style:{padding:"6px 8px",borderRadius:8,border:"1px solid var(--pc-accent-dim)",background:"var(--pc-accent-glow)",color:"var(--pc-accent-light)",fontSize:11,cursor:"pointer"},title:"Use a pool-agent template name as the A2A skill id",children:"Pool"})]})]}),c.jsxs("div",{children:[c.jsx("label",{style:_e,children:"Message"}),c.jsx("textarea",{value:x.a2aMessage,onChange:P=>r(e.id,{a2aMessage:P.target.value}),rows:3,style:rt})]}),c.jsxs("div",{children:[c.jsx("label",{style:_e,children:"Timeout (s)"}),c.jsx("input",{type:"number",min:1,value:x.a2aTimeout,onChange:P=>r(e.id,{a2aTimeout:parseInt(P.target.value)||300}),style:rt})]}),c.jsxs("div",{children:[c.jsx("label",{style:_e,children:"Cloud Run IAM"}),c.jsxs("select",{value:x.a2aCloudRunAuth||"",onChange:P=>r(e.id,{a2aCloudRunAuth:P.target.value}),style:rt,children:[c.jsx("option",{value:"",children:"none"}),c.jsx("option",{value:"gcloud",children:"gcloud"})]})]}),x.a2aCloudRunAuth==="gcloud"&&c.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8},children:[c.jsxs("div",{children:[c.jsx("label",{style:_e,children:"Gcloud Config"}),c.jsxs("div",{style:{display:"flex",gap:6},children:[c.jsxs("select",{value:x.a2aCloudRunConfig||"",onChange:P=>r(e.id,{a2aCloudRunConfig:P.target.value}),style:{...rt,flex:1},disabled:!ht,children:[c.jsx("option",{value:"",children:He?"loading...":"active gcloud config"}),be.map(P=>c.jsxs("option",{value:P.name,children:[P.name,P.project?` - ${P.project}`:"",P.is_active?" (active)":""]},P.name))]}),c.jsxs("button",{type:"button",onClick:()=>Mt(!0),title:"Create gcloud config",style:{padding:"6px 8px",borderRadius:8,border:"1px solid var(--pc-accent-dim)",background:"var(--pc-accent-glow)",color:"var(--pc-accent-light)",fontSize:11,cursor:"pointer",display:"inline-flex",alignItems:"center",gap:5},children:[c.jsx(ls,{size:12}),"New"]})]}),c.jsx("p",{style:mr(),children:ot||(jt?`${jt.account||"account unset"} / ${jt.project||"project unset"}`:"Uses the active Cloud SDK config unless a profile is selected.")})]}),c.jsxs("div",{style:{display:"grid",gridTemplateColumns:"minmax(0, 1fr) 112px",gap:8},children:[c.jsxs("div",{children:[c.jsx("label",{style:_e,children:"Cloud Run Audience"}),c.jsx(or,{value:x.a2aCloudRunAudience||"",onChange:P=>r(e.id,{a2aCloudRunAudience:P}),placeholder:"Defaults to endpoint origin",rows:1,style:Ve,stepIds:f,workflowInputs:g,triggerFields:_})]}),c.jsxs("div",{children:[c.jsx("label",{style:_e,children:"Auth Timeout"}),c.jsx("input",{type:"number",min:1,max:120,value:x.a2aCloudRunAuthTimeout||20,onChange:P=>r(e.id,{a2aCloudRunAuthTimeout:parseInt(P.target.value)||20}),style:rt})]})]}),c.jsx(ITe,{open:Ct,onClose:()=>Mt(!1),defaultAccount:Ht==null?void 0:Ht.account,defaultProject:Ht==null?void 0:Ht.project,defaultRunRegion:Ht==null?void 0:Ht.run_region,defaultComputeRegion:Ht==null?void 0:Ht.compute_region,onCreated:async P=>{await $t(),Mt(!1),r(e.id,{a2aCloudRunAuth:"gcloud",a2aCloudRunConfig:P})}})]})]}),v==="resolve"&&c.jsxs("div",{style:pr,children:[c.jsx("div",{style:Un,children:"Resolve Config"}),c.jsxs("div",{children:[c.jsx("label",{style:_e,children:"Entity Kind"}),c.jsx(or,{value:x.resolveKind||"",onChange:P=>r(e.id,{resolveKind:P}),placeholder:"e.g. qs-episode-draft",rows:1,style:Ve,stepIds:f,workflowInputs:g,triggerFields:_})]}),c.jsxs("div",{children:[c.jsx("label",{style:_e,children:"Tag"}),c.jsx(or,{value:x.resolveTag||"published",onChange:P=>r(e.id,{resolveTag:P}),placeholder:"published",rows:1,style:Ve,stepIds:f,workflowInputs:g,triggerFields:_})]}),c.jsxs("div",{children:[c.jsx("label",{style:_e,children:"Name Pattern"}),c.jsx(or,{value:x.resolveNamePattern||"",onChange:P=>r(e.id,{resolveNamePattern:P}),placeholder:"e.g. qs-episode-*",rows:1,style:Ve,stepIds:f,workflowInputs:g,triggerFields:_})]}),c.jsxs("div",{children:[c.jsx("label",{style:_e,children:"Space"}),c.jsx(or,{value:x.resolveSpace||"",onChange:P=>r(e.id,{resolveSpace:P}),placeholder:"e.g. Revka/${inputs.team}/WorkflowOutputs",rows:1,style:Ve,stepIds:f,workflowInputs:g,triggerFields:_})]}),c.jsxs("div",{children:[c.jsx("label",{style:_e,children:"Artifact Name"}),c.jsx(or,{value:x.resolveArtifactName||"",onChange:P=>r(e.id,{resolveArtifactName:P}),placeholder:"SKILL.md",rows:1,style:Ve,stepIds:f,workflowInputs:g,triggerFields:_})]}),c.jsxs("div",{children:[c.jsx("label",{style:_e,children:"Mode"}),c.jsxs("select",{value:x.resolveMode||"latest",onChange:P=>r(e.id,{resolveMode:P.target.value}),style:rt,children:[c.jsx("option",{value:"latest",children:"latest"}),c.jsx("option",{value:"all",children:"all"})]})]}),c.jsxs("div",{children:[c.jsx("label",{style:_e,children:"Metadata Source"}),c.jsxs("select",{value:x.resolveMetadataSource||"revision",onChange:P=>r(e.id,{resolveMetadataSource:P.target.value}),style:rt,children:[c.jsx("option",{value:"revision",children:"revision"}),c.jsx("option",{value:"item",children:"item"}),c.jsx("option",{value:"artifact",children:"artifact"})]})]}),c.jsxs("div",{children:[c.jsx("label",{style:_e,children:"Fields"}),c.jsx("input",{type:"text",defaultValue:(x.resolveFields||[]).join(", "),onBlur:P=>r(e.id,{resolveFields:P.target.value.split(",").map(Ie=>Ie.trim()).filter(Boolean)}),placeholder:"part, episode_number, episode_goal",style:Ve}),c.jsx("p",{style:mr(),children:"Comma-separated metadata fields to extract."})]}),c.jsx(bn,{checked:x.resolveFailIfMissing??!0,onChange:P=>r(e.id,{resolveFailIfMissing:P}),label:"Fail if missing"})]}),v==="kumiho_context"&&c.jsxs("div",{style:pr,children:[c.jsx("div",{style:Un,children:"Kumiho Context Config"}),c.jsxs("div",{children:[c.jsx("label",{style:_e,children:"Project"}),c.jsx(or,{value:x.kumihoProject||"",onChange:P=>r(e.id,{kumihoProject:P}),placeholder:"StoryProject",rows:1,style:Ve,stepIds:f,workflowInputs:g,triggerFields:_})]}),c.jsxs("div",{children:[c.jsx("label",{style:_e,children:"Mode"}),c.jsxs("select",{value:x.kumihoMode||"graph_augmented_context",onChange:P=>r(e.id,{kumihoMode:P.target.value}),style:rt,children:[c.jsx("option",{value:"graph_augmented_context",children:"graph_augmented_context"}),c.jsx("option",{value:"bundle_context",children:"bundle_context"}),c.jsx("option",{value:"semantic_context",children:"semantic_context"})]})]}),c.jsxs("div",{children:[c.jsx("label",{style:_e,children:"Seed Bundles"}),c.jsx("textarea",{value:H.draft,onFocus:H.startEditing,onChange:P=>H.setDraft(P.target.value),onBlur:()=>r(e.id,{kumihoSeedBundles:H.commit()}),placeholder:"series-main-canon, series-active-storylines",rows:2,style:Ve})]}),c.jsxs("div",{children:[c.jsx("label",{style:_e,children:"Seed Krefs"}),c.jsx("textarea",{value:D.draft,onFocus:D.startEditing,onChange:P=>D.setDraft(P.target.value),onBlur:()=>r(e.id,{kumihoSeedKrefs:D.commit()}),placeholder:"${latest-production-episode.output_data.kref}",rows:2,style:Ve})]}),c.jsxs("div",{children:[c.jsx("label",{style:_e,children:"Seed Queries"}),c.jsx("textarea",{value:U.draft,onFocus:U.startEditing,onChange:P=>U.setDraft(P.target.value),onBlur:()=>r(e.id,{kumihoSeedQueries:U.commit()}),placeholder:"${inputs.episode_goal}, ${inputs.must_include}",rows:3,style:Ve})]}),c.jsxs("div",{children:[c.jsx("label",{style:_e,children:"Traversal Depth"}),c.jsx("input",{type:"number",min:0,max:3,value:x.kumihoTraversalMaxDepth??2,onChange:P=>r(e.id,{kumihoTraversalMaxDepth:Math.min(3,Math.max(0,parseInt(P.target.value)||0))}),style:rt})]}),c.jsxs("div",{children:[c.jsx("label",{style:_e,children:"Traversal Direction"}),c.jsxs("select",{value:x.kumihoTraversalDirection||"both",onChange:P=>r(e.id,{kumihoTraversalDirection:P.target.value}),style:rt,children:[c.jsx("option",{value:"both",children:"both"}),c.jsx("option",{value:"out",children:"out"}),c.jsx("option",{value:"in",children:"in"})]})]}),c.jsxs("div",{children:[c.jsx("label",{style:_e,children:"Edge Types"}),c.jsx("input",{type:"text",value:I.draft,onFocus:I.startEditing,onChange:P=>I.setDraft(P.target.value),onBlur:()=>r(e.id,{kumihoTraversalEdgeTypes:I.commit()}),placeholder:"DEPENDS_ON, REFERENCES, ADVANCES, UPDATES, CONTRADICTS",style:Ve})]}),c.jsxs("div",{children:[c.jsx("label",{style:_e,children:"Include Kinds"}),c.jsx("textarea",{value:X.draft,onFocus:X.startEditing,onChange:P=>X.setDraft(P.target.value),onBlur:()=>r(e.id,{kumihoFiltersIncludeKinds:X.commit()}),placeholder:"canon-rule, character-state, storyline, webnovel-episode",rows:2,style:Ve})]}),c.jsxs("div",{children:[c.jsx("label",{style:_e,children:"Exclude Tags"}),c.jsx("input",{type:"text",value:K.draft,onFocus:K.startEditing,onChange:P=>K.setDraft(P.target.value),onBlur:()=>r(e.id,{kumihoFiltersExcludeTags:K.commit()}),placeholder:"deprecated",style:Ve})]}),c.jsxs("div",{children:[c.jsx("label",{style:_e,children:"Max Items"}),c.jsx("input",{type:"number",min:1,max:100,value:x.kumihoFiltersMaxItems??50,onChange:P=>r(e.id,{kumihoFiltersMaxItems:Math.min(100,Math.max(1,parseInt(P.target.value)||50))}),style:rt})]}),c.jsxs("div",{children:[c.jsx("label",{style:_e,children:"Ranking Method"}),c.jsxs("select",{value:x.kumihoRankingMethod||"hybrid",onChange:P=>r(e.id,{kumihoRankingMethod:P.target.value}),style:rt,children:[c.jsx("option",{value:"hybrid",children:"hybrid"}),c.jsx("option",{value:"graph",children:"graph"}),c.jsx("option",{value:"semantic",children:"semantic"}),c.jsx("option",{value:"none",children:"none"})]})]}),c.jsxs("div",{children:[c.jsx("label",{style:_e,children:"Semantic Query"}),c.jsx(or,{value:x.kumihoRankingSemanticQuery||"",onChange:P=>r(e.id,{kumihoRankingSemanticQuery:P}),placeholder:"${inputs.episode_goal} ${inputs.must_include}",rows:2,style:Ve,stepIds:f,workflowInputs:g,triggerFields:_})]}),c.jsxs("div",{children:[c.jsx("label",{style:_e,children:"Tag Preference"}),c.jsx("input",{type:"text",value:Q.draft,onFocus:Q.startEditing,onChange:P=>Q.setDraft(P.target.value),onBlur:()=>r(e.id,{kumihoLockTagPreference:Q.commit()}),placeholder:"current, active, production-ready, ready, published, latest",style:Ve})]}),c.jsxs("div",{children:[c.jsx("label",{style:_e,children:"Output Format"}),c.jsx("input",{type:"text",value:x.kumihoOutputFormat||"context_pack",onChange:P=>r(e.id,{kumihoOutputFormat:P.target.value}),placeholder:"episode_context_pack",style:Ve})]}),c.jsxs("div",{children:[c.jsx("label",{style:_e,children:"Max Artifact Chars"}),c.jsx("input",{type:"number",min:0,value:x.kumihoOutputMaxArtifactCharsPerItem??3e3,onChange:P=>r(e.id,{kumihoOutputMaxArtifactCharsPerItem:Math.max(0,parseInt(P.target.value)||0)}),style:rt})]}),c.jsx(bn,{checked:x.kumihoOutputIncludeArtifactSummaries??!0,onChange:P=>r(e.id,{kumihoOutputIncludeArtifactSummaries:P}),label:"Artifact summaries"}),c.jsx(bn,{checked:x.kumihoOutputIncludeArtifactContent??!1,onChange:P=>r(e.id,{kumihoOutputIncludeArtifactContent:P}),label:"Artifact content"}),c.jsx(bn,{checked:x.kumihoOutputIncludeEdgeMap??!0,onChange:P=>r(e.id,{kumihoOutputIncludeEdgeMap:P}),label:"Edge map"}),c.jsx(bn,{checked:x.kumihoOutputIncludeConflictWarnings??!0,onChange:P=>r(e.id,{kumihoOutputIncludeConflictWarnings:P}),label:"Conflict warnings"}),c.jsx(bn,{checked:x.kumihoOutputIncludeMissingContext??!0,onChange:P=>r(e.id,{kumihoOutputIncludeMissingContext:P}),label:"Missing context"})]}),v==="kumiho_bundle_update"&&c.jsxs("div",{style:pr,children:[c.jsx("div",{style:Un,children:"Kumiho Bundle Update Config"}),c.jsxs("div",{children:[c.jsx("label",{style:_e,children:"Project"}),c.jsx(or,{value:x.kumihoProject||"",onChange:P=>r(e.id,{kumihoProject:P}),placeholder:"StoryProject",rows:1,style:Ve,stepIds:f,workflowInputs:g,triggerFields:_})]}),c.jsxs("div",{children:[c.jsx("label",{style:_e,children:"Mode"}),c.jsxs("select",{value:x.kumihoMode||"add_members",onChange:P=>r(e.id,{kumihoMode:P.target.value}),style:rt,children:[c.jsx("option",{value:"add_members",children:"add_members"}),c.jsx("option",{value:"remove_members",children:"remove_members"}),c.jsx("option",{value:"replace_members",children:"replace_members"}),c.jsx("option",{value:"mixed",children:"mixed"})]})]}),c.jsx(bn,{checked:x.kumihoCreateIfMissing??!1,onChange:P=>r(e.id,{kumihoCreateIfMissing:P}),label:"Create missing bundles"}),c.jsx(bn,{checked:x.kumihoIdempotent??!0,onChange:P=>r(e.id,{kumihoIdempotent:P}),label:"Idempotent"}),c.jsx(bn,{checked:x.kumihoFailIfMissingBundle??!0,onChange:P=>r(e.id,{kumihoFailIfMissingBundle:P}),label:"Fail if bundle missing"}),c.jsx(bn,{checked:x.kumihoFailIfMissingItem??!0,onChange:P=>r(e.id,{kumihoFailIfMissingItem:P}),label:"Fail if item missing"}),c.jsx(bn,{checked:x.kumihoAllowProtected??!1,onChange:P=>r(e.id,{kumihoAllowProtected:P}),label:"Allow protected bundles"}),c.jsxs("div",{children:[c.jsx("label",{style:_e,children:"Updates JSON"}),c.jsx("textarea",{defaultValue:JSON.stringify(x.kumihoUpdates||[],null,2),onBlur:P=>{try{const Ie=JSON.parse(P.target.value||"[]");r(e.id,{kumihoUpdates:Array.isArray(Ie)?Ie:[]})}catch{}},rows:8,style:Ve},`kumiho-updates-${e.id}`),c.jsx("p",{style:mr(),children:"Array of bundle update objects. Advanced YAML fields are preserved through kumiho_config."})]})]}),v==="kumiho_patch_apply"&&c.jsxs("div",{style:pr,children:[c.jsx("div",{style:Un,children:"Kumiho Patch Apply Config"}),c.jsxs("div",{children:[c.jsx("label",{style:_e,children:"Project"}),c.jsx(or,{value:x.kumihoProject||"",onChange:P=>r(e.id,{kumihoProject:P}),placeholder:"StoryProject",rows:1,style:Ve,stepIds:f,workflowInputs:g,triggerFields:_})]}),c.jsxs("div",{children:[c.jsx("label",{style:_e,children:"Patch Kref"}),c.jsx(or,{value:x.kumihoPatchKref||"",onChange:P=>r(e.id,{kumihoPatchKref:P}),placeholder:"${canon-patch-loader.output_data.kref}",rows:1,style:Ve,stepIds:f,workflowInputs:g,triggerFields:_})]}),c.jsx(bn,{checked:x.kumihoDryRun??!0,onChange:P=>r(e.id,{kumihoDryRun:P}),label:"Dry run"}),c.jsx(bn,{checked:x.kumihoApprovalRequired??!0,onChange:P=>r(e.id,{kumihoApprovalRequired:P}),label:"Approval required"}),c.jsxs("div",{children:[c.jsx("label",{style:_e,children:"Approved Expression"}),c.jsx(or,{value:String(x.kumihoApprovalApproved??!1),onChange:P=>r(e.id,{kumihoApprovalApproved:P}),placeholder:"${patch-approval.output_data.approved}",rows:1,style:Ve,stepIds:f,workflowInputs:g,triggerFields:_})]}),c.jsxs("div",{children:[c.jsx("label",{style:_e,children:"Approved By"}),c.jsx(or,{value:x.kumihoApprovalApprovedBy||"",onChange:P=>r(e.id,{kumihoApprovalApprovedBy:P}),placeholder:"${patch-approval.output_data.approved_by}",rows:1,style:Ve,stepIds:f,workflowInputs:g,triggerFields:_})]}),c.jsxs("div",{children:[c.jsx("label",{style:_e,children:"Approval Note"}),c.jsx(or,{value:x.kumihoApprovalNote||"",onChange:P=>r(e.id,{kumihoApprovalNote:P}),placeholder:"${patch-approval.output_data.note}",rows:2,style:Ve,stepIds:f,workflowInputs:g,triggerFields:_})]}),c.jsx(bn,{checked:x.kumihoApplyCreateRevisions??!0,onChange:P=>r(e.id,{kumihoApplyCreateRevisions:P}),label:"Create revisions"}),c.jsx(bn,{checked:x.kumihoApplyCreateEdges??!0,onChange:P=>r(e.id,{kumihoApplyCreateEdges:P}),label:"Create edges"}),c.jsx(bn,{checked:x.kumihoApplyUpdateTags??!0,onChange:P=>r(e.id,{kumihoApplyUpdateTags:P}),label:"Update tags"}),c.jsx(bn,{checked:x.kumihoApplyUntagPreviousCurrent??!0,onChange:P=>r(e.id,{kumihoApplyUntagPreviousCurrent:P}),label:"Untag previous current"}),c.jsx(bn,{checked:x.kumihoApplyUpdateBundles??!0,onChange:P=>r(e.id,{kumihoApplyUpdateBundles:P}),label:"Update bundles"}),c.jsx(bn,{checked:x.kumihoApplySaveApplyReport??!0,onChange:P=>r(e.id,{kumihoApplySaveApplyReport:P}),label:"Save apply report"}),c.jsxs("div",{children:[c.jsx("label",{style:_e,children:"New Revision Tags"}),c.jsx("input",{type:"text",value:V.draft,onFocus:V.startEditing,onChange:P=>V.setDraft(P.target.value),onBlur:()=>r(e.id,{kumihoNewRevisionTags:V.commit()}),placeholder:"current, approved",style:Ve})]}),c.jsxs("div",{children:[c.jsx("label",{style:_e,children:"Patch Tags Remove"}),c.jsx("input",{type:"text",value:R.draft,onFocus:R.startEditing,onChange:P=>R.setDraft(P.target.value),onBlur:()=>r(e.id,{kumihoPatchTagsRemove:R.commit()}),placeholder:"candidate",style:Ve})]}),c.jsxs("div",{children:[c.jsx("label",{style:_e,children:"Patch Tags Add"}),c.jsx("input",{type:"text",value:q.draft,onFocus:q.startEditing,onChange:P=>q.setDraft(P.target.value),onBlur:()=>r(e.id,{kumihoPatchTagsAdd:q.commit()}),placeholder:"applied",style:Ve})]}),[["Pending Patch Bundle","kumihoPendingPatchBundle","pending-canon-patches"],["Applied Patch Bundle","kumihoAppliedPatchBundle","applied-canon-patches"],["Current State Bundle","kumihoCurrentStateBundle","current-character-states"],["Active Storyline Bundle","kumihoActiveStorylineBundle","active-storylines"],["Active Foreshadow Bundle","kumihoActiveForeshadowBundle","active-foreshadow"],["Timeline Bundle","kumihoTimelineBundle","timeline-events"]].map(([P,Ie,st])=>c.jsxs("div",{children:[c.jsx("label",{style:_e,children:P}),c.jsx("input",{type:"text",value:String(x[Ie]||""),onChange:Kt=>r(e.id,{[Ie]:Kt.target.value}),placeholder:st,style:Ve})]},String(Ie))),c.jsx(bn,{checked:x.kumihoRequireEvidenceLocator??!0,onChange:P=>r(e.id,{kumihoRequireEvidenceLocator:P}),label:"Require evidence_locator"}),c.jsxs("div",{children:[c.jsx("label",{style:_e,children:"Source Episode Kref"}),c.jsx(or,{value:x.kumihoSourceEpisodeKref||"",onChange:P=>r(e.id,{kumihoSourceEpisodeKref:P}),placeholder:"${episode-loader.output_data.kref}",rows:1,style:Ve,stepIds:f,workflowInputs:g,triggerFields:_})]}),c.jsxs("div",{children:[c.jsx("label",{style:_e,children:"Source Context Pack Kref"}),c.jsx(or,{value:x.kumihoSourceContextPackKref||"",onChange:P=>r(e.id,{kumihoSourceContextPackKref:P}),placeholder:"${context-pack-loader.output_data.kref}",rows:1,style:Ve,stepIds:f,workflowInputs:g,triggerFields:_})]})]}),v==="map_reduce"&&c.jsxs("div",{style:pr,children:[c.jsx("div",{style:{...Un,color:"var(--pc-accent)"},children:"MapReduce Config"}),c.jsxs("div",{children:[c.jsx("label",{style:_e,children:"Task"}),c.jsx("textarea",{value:x.mapReduceTask,onChange:P=>r(e.id,{mapReduceTask:P.target.value}),placeholder:"Overall task description",rows:2,style:rt})]}),c.jsxs("div",{children:[c.jsx("label",{style:_e,children:"Splits (comma-separated)"}),c.jsx("input",{type:"text",value:B.draft,onFocus:B.startEditing,onChange:P=>{B.setDraft(P.target.value),r(e.id,{mapReduceSplits:Ol(P.target.value)})},onBlur:()=>r(e.id,{mapReduceSplits:B.commit()}),onKeyDown:P=>{P.key==="Enter"&&(P.preventDefault(),P.currentTarget.blur())},placeholder:"segment1, segment2, segment3",style:rt})]}),c.jsxs("div",{style:{display:"flex",gap:8},children:[c.jsxs("div",{style:{flex:1},children:[c.jsx("label",{style:_e,children:"Mapper"}),c.jsx("button",{type:"button",onClick:P=>et("mapReduceMapper",P),style:{...Ve,textAlign:"left",cursor:"pointer"},children:x.mapReduceMapper||"claude"})]}),c.jsxs("div",{style:{flex:1},children:[c.jsx("label",{style:_e,children:"Reducer"}),c.jsx("button",{type:"button",onClick:P=>et("mapReduceReducer",P),style:{...Ve,textAlign:"left",cursor:"pointer"},children:x.mapReduceReducer||"claude"})]})]}),c.jsxs("div",{style:{display:"flex",gap:6},children:[$h.map(P=>c.jsxs("button",{type:"button",onClick:()=>r(e.id,{mapReduceMapper:P}),style:{padding:"2px 6px",borderRadius:6,border:"1px solid var(--revka-border-soft)",background:(x.mapReduceMapper||"claude")===P?"var(--pc-accent-glow)":"transparent",color:"var(--pc-text-primary)",fontSize:10,cursor:"pointer"},children:["mapper ",P]},`mapper-${P}`)),$h.map(P=>c.jsxs("button",{type:"button",onClick:()=>r(e.id,{mapReduceReducer:P}),style:{padding:"2px 6px",borderRadius:6,border:"1px solid var(--revka-border-soft)",background:(x.mapReduceReducer||"claude")===P?"var(--pc-accent-glow)":"transparent",color:"var(--pc-text-primary)",fontSize:10,cursor:"pointer"},children:["reducer ",P]},`reducer-${P}`))]}),c.jsxs("div",{style:{display:"flex",gap:8},children:[c.jsxs("div",{style:{flex:1},children:[c.jsx("label",{style:_e,children:"Concurrency"}),c.jsx("input",{type:"number",min:1,max:10,value:x.mapReduceConcurrency,onChange:P=>r(e.id,{mapReduceConcurrency:parseInt(P.target.value)||3}),style:rt})]}),c.jsxs("div",{style:{flex:1},children:[c.jsx("label",{style:_e,children:"Timeout (s)"}),c.jsx("input",{type:"number",min:1,value:x.mapReduceTimeout,onChange:P=>r(e.id,{mapReduceTimeout:parseInt(P.target.value)||300}),style:rt})]})]})]}),v==="notify"&&c.jsxs(c.Fragment,{children:[c.jsxs("div",{children:[c.jsx("label",{style:_e,children:"Channels"}),c.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:6},children:St.map(P=>{const Ie=(x.channels??[]).includes(P);return c.jsx("button",{type:"button",onClick:()=>Re(P),style:{padding:"4px 10px",borderRadius:8,fontSize:11,fontWeight:600,background:Ie?"var(--pc-accent-glow)":"var(--pc-bg-input)",color:Ie?"var(--pc-accent-light)":"var(--pc-text-muted)",border:`1px solid ${Ie?"var(--pc-accent-dim)":"var(--pc-border)"}`,cursor:"pointer"},children:P},P)})}),c.jsx("p",{style:mr(),children:"Select one or more channels to broadcast to."})]}),c.jsxs("div",{children:[c.jsx("label",{style:_e,children:"Channel ID Override"}),c.jsx("input",{type:"text",value:x.notifyChannelId??"",onChange:P=>r(e.id,{notifyChannelId:P.target.value}),placeholder:"optional channel/thread/chat id",style:Ve})]}),c.jsxs("div",{children:[c.jsx("label",{style:_e,children:"Notify Title"}),c.jsx("input",{type:"text",value:x.notifyTitle??"",onChange:P=>r(e.id,{notifyTitle:P.target.value}),placeholder:"Header shown above the message",style:rt})]}),c.jsxs("div",{children:[c.jsx("label",{style:_e,children:"Notify Message"}),c.jsx(or,{value:x.notifyMessage??"",onChange:P=>r(e.id,{notifyMessage:P}),placeholder:"Body — supports ${step_id.output} templating",rows:6,style:Ve,stepIds:f,workflowInputs:g,triggerFields:_})]})]}),v==="tag"&&c.jsxs("div",{style:pr,children:[c.jsx("div",{style:Un,children:"Tag Config"}),c.jsxs("div",{children:[c.jsx("label",{style:_e,children:"Item kref"}),c.jsx("input",{type:"text",value:x.tagItemKref||"",onChange:P=>r(e.id,{tagItemKref:P.target.value}),placeholder:"${trigger.entity_kref}",style:Ve}),c.jsxs("p",{style:mr(),children:["Supports ","${...}"," interpolation."]})]}),c.jsxs("div",{children:[c.jsx("label",{style:_e,children:"Tag"}),c.jsx("input",{type:"text",value:x.tagValue||"",onChange:P=>r(e.id,{tagValue:P.target.value}),placeholder:"published",style:Ve})]}),c.jsxs("div",{children:[c.jsx("label",{style:_e,children:"Untag (optional)"}),c.jsx("input",{type:"text",value:x.tagUntag||"",onChange:P=>r(e.id,{tagUntag:P.target.value}),placeholder:"draft",style:Ve}),c.jsx("p",{style:mr(),children:"Tag to remove before applying the new one."})]})]}),v==="deprecate"&&c.jsxs("div",{style:pr,children:[c.jsx("div",{style:Un,children:"Deprecate Config"}),c.jsxs("div",{children:[c.jsx("label",{style:_e,children:"Item kref"}),c.jsx("input",{type:"text",value:x.deprecateItemKref||"",onChange:P=>r(e.id,{deprecateItemKref:P.target.value}),placeholder:"${trigger.entity_kref}",style:Ve}),c.jsxs("p",{style:mr(),children:["Supports ","${...}"," interpolation."]})]}),c.jsxs("div",{children:[c.jsx("label",{style:_e,children:"Reason"}),c.jsx("textarea",{value:x.deprecateReason||"",onChange:P=>r(e.id,{deprecateReason:P.target.value}),placeholder:"Why this item is being deprecated",rows:3,style:rt})]})]}),it&&c.jsxs("div",{children:[c.jsx("label",{style:_e,children:"Auth profile"}),c.jsxs("button",{type:"button",onClick:P=>{ut(P.currentTarget.getBoundingClientRect()),Pn(!0)},style:{...rt,display:"flex",alignItems:"center",gap:8,textAlign:"left",cursor:"pointer",color:x.auth?"var(--pc-text-primary)":"var(--pc-text-faint)"},children:[c.jsx(Eg,{size:12,style:{color:"var(--revka-text-faint)",flexShrink:0}}),c.jsx("span",{style:{flex:1,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:dt?`${sE(dt.provider)} · ${dt.profile_name}`:x.auth||"None"})]}),x.auth&&c.jsx("button",{type:"button",onClick:()=>r(e.id,{auth:""}),style:{marginTop:6,padding:"4px 10px",fontSize:11,fontWeight:600,borderRadius:6,border:"1px solid var(--revka-status-warning)",background:"color-mix(in srgb, var(--revka-status-warning) 14%, transparent)",color:"var(--revka-status-warning)",cursor:"pointer"},children:"Clear"}),c.jsx("p",{style:mr(),children:"Optional. Bound credential for external API calls."}),c.jsx(bI,{open:jn,onOpenChange:Pn,value:x.auth,anchorRect:We,onSelect:P=>r(e.id,{auth:P??""})})]}),v!=="conditional"&&v!=="human_input"&&v!=="notify"&&v!=="tag"&&v!=="kumiho_context"&&v!=="kumiho_bundle_update"&&v!=="kumiho_patch_apply"&&v!=="deprecate"&&c.jsxs("div",{children:[c.jsx("label",{style:_e,children:"Agent Hints"}),c.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:6},children:GTe.map(P=>{const Ie=x.agentHints.includes(P);return c.jsx("button",{type:"button",onClick:()=>Wt(P),style:{padding:"4px 10px",borderRadius:8,fontSize:11,fontWeight:600,background:Ie?"var(--pc-accent-glow)":"var(--pc-bg-input)",color:Ie?"var(--pc-accent-light)":"var(--pc-text-muted)",border:`1px solid ${Ie?"var(--pc-accent-dim)":"var(--pc-border)"}`,cursor:"pointer"},children:P},P)})}),c.jsx("p",{style:mr(),children:"Suggestions for the operator — final assignment is automatic."})]}),x.dependencyCount>0&&c.jsxs("div",{children:[c.jsx("label",{style:_e,children:"Dependencies"}),c.jsxs("div",{style:{fontSize:11,color:"var(--pc-text-muted)"},children:[x.dependencyCount," incoming ",x.dependencyCount===1?"dependency":"dependencies"]}),c.jsx("p",{style:mr(),children:"Managed by connecting nodes on the canvas."})]})]})]})})}function bn({checked:e,onChange:n,label:r,title:i}){return c.jsxs("label",{title:i,style:{display:"inline-flex",alignItems:"center",gap:6,cursor:"pointer",userSelect:"none"},children:[c.jsx("input",{type:"checkbox",checked:e,onChange:s=>n(s.target.checked),style:{accentColor:"var(--pc-accent)"}}),c.jsx("span",{style:{fontSize:11,color:"var(--pc-text-muted)"},children:r})]})}const JTe=9e3,eMe=9001;function tMe({open:e,onOpenChange:n,context:r,actionLabel:i,onSelect:s}){const a=b.useRef(null);if(b.useEffect(()=>{e&&requestAnimationFrame(()=>{var u;return(u=a.current)==null?void 0:u.focus()})},[e]),b.useEffect(()=>{if(!e)return;const u=d=>{d.key==="Escape"&&(d.preventDefault(),n(!1))};return window.addEventListener("keydown",u),()=>window.removeEventListener("keydown",u)},[e,n]),!e||typeof document>"u")return null;const o=u=>{s?s(u):LNe({type:u,...r??{}}),n(!1)},l=c.jsxs("div",{role:"dialog","aria-modal":"true","aria-label":i??"Add Step",onClick:u=>{u.target===u.currentTarget&&n(!1)},style:{position:"fixed",inset:0,zIndex:JTe,display:"flex",alignItems:"flex-start",justifyContent:"center",paddingTop:"14vh",background:"color-mix(in srgb, var(--revka-bg-base) 70%, transparent)",backdropFilter:"blur(2px)"},children:[c.jsx("div",{className:"revka-panel","data-variant":"primary",style:{width:"min(640px, 92vw)",maxHeight:"70vh",display:"flex",flexDirection:"column",borderRadius:12,borderColor:"var(--revka-border-strong)",boxShadow:"0 24px 64px rgba(0,0,0,0.36)",overflow:"hidden",zIndex:eMe},children:c.jsxs(ja,{label:i??"Add Step",loop:!0,shouldFilter:!0,children:[c.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,padding:"12px 14px",borderBottom:"1px solid var(--revka-border-soft)"},children:[c.jsx(Da,{size:16,style:{color:"var(--revka-text-faint)"}}),c.jsx(ja.Input,{ref:a,placeholder:"Search steps, skills, channels...",style:{flex:1,background:"transparent",border:0,outline:"none",color:"var(--revka-text-primary)",fontSize:14}}),c.jsx("kbd",{className:"revka-kbd",style:{fontSize:10,padding:"2px 6px",borderRadius:6,color:"var(--revka-text-faint)",background:"var(--pc-bg-input)",border:"1px solid var(--revka-border-soft)"},children:"ESC"})]}),c.jsxs(ja.List,{style:{maxHeight:"54vh",overflowY:"auto",padding:"6px"},children:[c.jsx(ja.Empty,{style:{padding:"24px 16px",textAlign:"center",fontSize:13,color:"var(--revka-text-faint)"},children:"No steps match"}),JNe.map(u=>{const d=XNe[u],p=ZNe[u];return c.jsx(ja.Group,{heading:c.jsx("div",{className:"revka-kicker",style:{padding:"8px 10px 4px",letterSpacing:"0.16em"},children:d.label}),children:p.map(f=>{const g=f.icon;return c.jsx(ja.Item,{value:`${f.label} ${f.type} ${f.description} ${f.searchTags.join(" ")}`,keywords:[f.type,...f.searchTags],onSelect:()=>o(f.type),asChild:!0,children:c.jsxs("button",{type:"button",style:{display:"flex",alignItems:"center",gap:12,padding:"10px 12px",borderRadius:10,cursor:"pointer",color:"var(--revka-text-primary)",width:"100%",textAlign:"left",background:"transparent",border:0,font:"inherit"},children:[c.jsx("span",{style:{display:"inline-flex",alignItems:"center",justifyContent:"center",width:28,height:28,borderRadius:8,background:"color-mix(in srgb, var(--pc-accent-glow) 60%, transparent)",color:"var(--pc-accent)",flexShrink:0},children:c.jsx(g,{size:16})}),c.jsxs("span",{style:{display:"flex",flexDirection:"column",minWidth:0,flex:1},children:[c.jsx("span",{style:{fontSize:13,fontWeight:600},children:f.label}),c.jsx("span",{style:{fontSize:11.5,color:"var(--revka-text-secondary)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:f.description})]}),c.jsx("span",{style:{fontFamily:"var(--pc-font-mono, ui-monospace, monospace)",fontSize:10,color:"var(--revka-text-faint)",flexShrink:0},children:f.type})]})},f.type)})},u)})]})]})}),c.jsx("style",{children:`
        [cmdk-item][data-selected='true'] {
          background: var(--pc-accent-glow);
          box-shadow: inset 2px 0 0 var(--pc-accent);
        }
        [cmdk-item][data-selected='true'] span:first-child {
          background: color-mix(in srgb, var(--pc-accent-glow) 90%, transparent);
        }
        [cmdk-item]:hover {
          background: var(--pc-hover);
        }
        [cmdk-group-heading] {
          padding: 0;
        }
      `})]});return oa.createPortal(l,document.body)}const nMe=9099,rMe=9100,iMe=[{value:"coder",label:"Coder"},{value:"researcher",label:"Researcher"},{value:"reviewer",label:"Reviewer"}],Kx={width:"100%",padding:"8px 10px",borderRadius:8,border:"1px solid var(--pc-border)",background:"var(--pc-bg-input)",color:"var(--pc-text-primary)",fontSize:12.5,outline:"none"},O2={...Kx,fontFamily:"var(--pc-font-mono, ui-monospace, monospace)"},Qu={display:"block",fontSize:10.5,fontWeight:600,color:"var(--revka-text-faint)",textTransform:"uppercase",letterSpacing:"0.08em",marginBottom:6};function sMe({open:e,onClose:n,onCreated:r}){const i=b.useRef(null),[s,a]=b.useState(""),[o,l]=b.useState(!1),[u,d]=b.useState(""),[p,f]=b.useState("claude"),[g,_]=b.useState("coder"),[x,v]=b.useState(""),[S,w]=b.useState(""),[j,C]=b.useState(""),[T,E]=b.useState(null),[A,O]=b.useState(!1),[F,L]=b.useState(null),[$,z]=b.useState(null);b.useEffect(()=>{e&&(a(""),d(""),l(!1),f("claude"),_("coder"),v(""),w(""),C(""),E(null),z(null),O(!1),L(null),requestAnimationFrame(()=>{var I;return(I=i.current)==null?void 0:I.focus()}))},[e]),b.useEffect(()=>{if(!T){z(null);return}const I=URL.createObjectURL(T);return z(I),()=>URL.revokeObjectURL(I)},[T]),b.useEffect(()=>{o||d(s?uu(s,"agent"):"")},[s,o]),b.useEffect(()=>{if(!e)return;const I=X=>{X.key==="Escape"&&(X.preventDefault(),A||n())};return window.addEventListener("keydown",I),()=>window.removeEventListener("keydown",I)},[e,n,A]);const B=b.useMemo(()=>!!(s.trim()&&u.trim()&&g.trim()&&!A),[s,u,g,A]);if(!e||typeof document>"u")return null;const H=I=>{I.target===I.currentTarget&&!A&&n()},D=async I=>{if(I.preventDefault(),!!B){O(!0),L(null);try{const X={name:u.trim(),identity:S.trim()||s.trim(),soul:"",expertise:[],tone:"",role:g.trim(),agent_type:p,model:x.trim()||void 0,system_hint:j.trim()||void 0};let K=await rz(X);T&&(K=await EC(K.kref,T)),await r(K)}catch(X){let K="Failed to create agent";X instanceof Xl?K=X.message.replace(/^API \d+: /,"")||K:X instanceof Error&&(K=X.message),L(K),O(!1)}}},U=c.jsx("div",{role:"dialog","aria-modal":"true","aria-label":"Create pool agent",onClick:H,style:{position:"fixed",inset:0,zIndex:nMe,background:"rgba(0, 0, 0, 0.48)",backdropFilter:"blur(6px)",display:"flex",alignItems:"flex-start",justifyContent:"center",paddingTop:"12vh"},children:c.jsxs("form",{onSubmit:D,className:"revka-panel","data-variant":"primary",style:{width:"min(560px, calc(100vw - 32px))",maxHeight:"calc(100vh - 24vh)",display:"flex",flexDirection:"column",borderRadius:14,borderColor:"var(--revka-border-strong)",boxShadow:"0 32px 80px rgba(0,0,0,0.48)",zIndex:rMe,overflow:"hidden"},onClick:I=>I.stopPropagation(),children:[c.jsxs("div",{style:{padding:"14px 16px",borderBottom:"1px solid var(--revka-border-soft)",display:"flex",alignItems:"center",gap:10},children:[c.jsx("span",{style:{display:"inline-flex",alignItems:"center",justifyContent:"center",width:28,height:28,borderRadius:8,background:"color-mix(in srgb, var(--pc-accent-glow) 60%, transparent)",color:"var(--pc-accent)"},children:c.jsx(Ul,{size:15})}),c.jsxs("div",{style:{flex:1,minWidth:0},children:[c.jsx("div",{style:{fontSize:13,fontWeight:700,color:"var(--revka-text-primary)"},children:"New pool agent"}),c.jsx("div",{style:{fontSize:11,color:"var(--revka-text-faint)"},children:"Create a reusable agent for workflow steps"})]}),c.jsx("button",{type:"button",onClick:()=>{A||n()},disabled:A,"aria-label":"Close",style:{background:"transparent",border:0,padding:4,cursor:A?"not-allowed":"pointer",color:"var(--revka-text-faint)",opacity:A?.5:1},children:c.jsx(vi,{size:16})})]}),c.jsxs("div",{style:{padding:"14px 16px",display:"flex",flexDirection:"column",gap:12,overflowY:"auto"},children:[c.jsxs("div",{children:[c.jsx("label",{style:Qu,htmlFor:"new-agent-name",children:"Name *"}),c.jsx("input",{id:"new-agent-name",ref:i,type:"text",value:s,onChange:I=>a(I.target.value),placeholder:"Senior Rust reviewer",style:Kx,disabled:A})]}),c.jsxs("div",{children:[c.jsx("label",{style:Qu,htmlFor:"new-agent-slug",children:"Item name (slug) *"}),c.jsx("input",{id:"new-agent-slug",type:"text",value:u,onChange:I=>{d(uu(I.target.value,"agent")),l(!0)},placeholder:"senior-rust-reviewer",style:O2,disabled:A})]}),c.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,padding:10,borderRadius:10,border:"1px solid var(--revka-border-soft)",background:"color-mix(in srgb, var(--revka-bg-panel-strong) 78%, transparent)"},children:[c.jsx(Ts,{src:$,alt:s||u||"Agent",size:42,radius:10}),c.jsxs("div",{style:{flex:1,minWidth:0},children:[c.jsx("div",{style:{fontSize:11.5,fontWeight:700,color:"var(--revka-text-primary)"},children:"Profile image"}),c.jsx("div",{style:{marginTop:2,fontSize:10.5,color:"var(--revka-text-faint)"},children:"PNG, JPEG, or WebP"})]}),c.jsxs("label",{className:"revka-button",style:{cursor:A?"not-allowed":"pointer"},children:[c.jsx(WE,{size:13}),"Upload",c.jsx("input",{type:"file",accept:"image/png,image/jpeg,image/webp",disabled:A,className:"sr-only",onChange:I=>{var X;return E(((X=I.target.files)==null?void 0:X[0])??null)}})]})]}),c.jsxs("div",{children:[c.jsx("label",{style:Qu,children:"Agent type"}),c.jsx("div",{role:"radiogroup","aria-label":"Agent type",style:{display:"inline-flex",borderRadius:8,border:"1px solid var(--pc-border)",background:"var(--pc-bg-input)",padding:2},children:["claude","codex","agy","agent","opencode"].map(I=>{const X=p===I;return c.jsx("button",{type:"button",role:"radio","aria-checked":X,onClick:()=>f(I),disabled:A,style:{padding:"5px 14px",fontSize:11.5,fontWeight:600,borderRadius:6,border:0,cursor:A?"not-allowed":"pointer",background:X?"var(--pc-accent-glow)":"transparent",color:X?"var(--pc-accent)":"var(--revka-text-secondary)",textTransform:"capitalize"},children:I},I)})})]}),c.jsxs("div",{children:[c.jsx("label",{style:Qu,htmlFor:"new-agent-role",children:"Role"}),c.jsx("input",{id:"new-agent-role",type:"text",value:g,onChange:I=>_(I.target.value),list:"new-agent-role-options",placeholder:"coder",style:Kx,disabled:A}),c.jsx("datalist",{id:"new-agent-role-options",children:iMe.map(I=>c.jsx("option",{value:I.value,children:I.label},I.value))})]}),c.jsxs("div",{children:[c.jsx("label",{style:Qu,htmlFor:"new-agent-model",children:"Model override"}),c.jsx("input",{id:"new-agent-model",type:"text",value:x,onChange:I=>v(I.target.value),placeholder:"claude-opus-4-7 (optional)",style:O2,disabled:A})]}),c.jsxs("div",{children:[c.jsx("label",{style:Qu,htmlFor:"new-agent-prompt",children:"Prompt template"}),c.jsx("textarea",{id:"new-agent-prompt",value:j,onChange:I=>C(I.target.value),placeholder:"System prompt or guidance for this agent…",rows:5,style:{...O2,resize:"vertical",minHeight:80},disabled:A})]}),c.jsxs("div",{children:[c.jsx("label",{style:Qu,htmlFor:"new-agent-identity",children:"Description / notes"}),c.jsx("textarea",{id:"new-agent-identity",value:S,onChange:I=>w(I.target.value),placeholder:"Senior engineer focused on Rust systems work…",rows:2,style:{...Kx,resize:"vertical",minHeight:50},disabled:A})]}),F&&c.jsx("div",{role:"alert",style:{padding:"8px 10px",borderRadius:8,background:"color-mix(in srgb, var(--revka-status-danger) 14%, transparent)",border:"1px solid var(--revka-status-danger)",color:"var(--revka-status-danger)",fontSize:11.5},children:F})]}),c.jsxs("div",{style:{padding:"12px 16px",borderTop:"1px solid var(--revka-border-soft)",display:"flex",alignItems:"center",justifyContent:"flex-end",gap:8},children:[c.jsx("button",{type:"button",onClick:()=>{A||n()},disabled:A,className:"revka-button",children:"Cancel"}),c.jsxs("button",{type:"submit",disabled:!B,className:"revka-button","data-variant":"primary",style:{display:"inline-flex",alignItems:"center",gap:6},children:[A&&c.jsx(Rr,{size:13,className:"animate-spin"}),A?"Creating…":"Create agent"]})]})]})});return oa.createPortal(U,document.body)}const KK=340,uE=360,aMe=8,oMe=9e3,lMe=9001,cMe=50;function uMe(e){const n=window.innerWidth,r=window.innerHeight,i=Math.min(e.bottom+aMe,r-uE-8),s=Math.max(8,n-e.right);return{position:"fixed",top:Math.max(8,i),right:s,width:KK,maxHeight:uE}}function dMe(){return{position:"fixed",top:"20vh",left:"50%",transform:"translateX(-50%)",width:KK,maxHeight:uE}}function hMe(e,n){return n?[e.item_name,e.name,e.role,e.agent_type,(e.expertise??[]).join(" ")].join(" ").toLowerCase().includes(n.toLowerCase()):!0}function fMe({open:e,onOpenChange:n,value:r,onSelect:i,anchorRect:s}){const a=b.useRef(null),{agents:o,loading:l,refresh:u}=sT(),[d,p]=b.useState(""),[f,g]=b.useState(0),[_,x]=b.useState(!1);b.useEffect(()=>{e&&(p(""),g(0),requestAnimationFrame(()=>{var A;return(A=a.current)==null?void 0:A.focus()}))},[e]);const v=b.useMemo(()=>o.filter(A=>hMe(A,d)).slice(0,cMe),[o,d]);b.useEffect(()=>{f>=v.length&&g(v.length===0?0:v.length-1)},[v.length,f]);const S=b.useMemo(()=>s?uMe(s):dMe(),[s]);if(!e||typeof document>"u")return null;const w=()=>{p(""),g(0),n(!1)},j=A=>{i(A),w()},C=A=>{if(A.key==="ArrowDown"){if(A.preventDefault(),v.length===0)return;g(O=>(O+1)%v.length)}else if(A.key==="ArrowUp"){if(A.preventDefault(),v.length===0)return;g(O=>(O-1+v.length)%v.length)}else if(A.key==="Enter"){A.preventDefault();const O=v[f];O&&j(O.item_name)}else A.key==="Escape"&&(A.preventDefault(),w())},T=l?"Loading agents…":o.length===0?"No pool agents — click + New pool agent":"No agents match",E=c.jsx("div",{role:"dialog","aria-modal":"true","aria-label":"Choose pool agent",onClick:A=>{A.target===A.currentTarget&&w()},style:{position:"fixed",inset:0,zIndex:oMe,background:"transparent"},children:c.jsxs("div",{className:"revka-panel","data-variant":"primary",style:{...S,display:"flex",flexDirection:"column",borderRadius:12,borderColor:"var(--revka-border-strong)",boxShadow:"0 24px 64px rgba(0,0,0,0.36)",overflow:"hidden",zIndex:lMe},onClick:A=>A.stopPropagation(),children:[c.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,padding:"10px 12px",borderBottom:"1px solid var(--revka-border-soft)"},children:[c.jsx(Da,{size:14,style:{color:"var(--revka-text-faint)"}}),c.jsx("input",{ref:a,type:"text",value:d,onChange:A=>{p(A.target.value),g(0)},onKeyDown:C,placeholder:"Search pool agents…",style:{flex:1,background:"transparent",border:0,outline:"none",color:"var(--revka-text-primary)",fontSize:13}}),c.jsx("kbd",{className:"revka-kbd",style:{fontSize:10,padding:"2px 6px",borderRadius:6,color:"var(--revka-text-faint)",background:"var(--pc-bg-input)",border:"1px solid var(--revka-border-soft)"},children:"ESC"})]}),c.jsx("div",{style:{flex:1,maxHeight:240,overflowY:"auto",padding:"6px"},children:v.length===0?c.jsx("div",{style:{padding:"20px 16px",textAlign:"center",fontSize:12,color:"var(--revka-text-faint)"},children:T}):c.jsx("ul",{style:{listStyle:"none",margin:0,padding:0},children:v.map((A,O)=>{const F=r===A.item_name,L=O===f;return c.jsx("li",{style:{margin:0,padding:0},children:c.jsxs("button",{type:"button","data-active":L,onMouseEnter:()=>g(O),onClick:$=>{$.preventDefault(),$.stopPropagation(),j(A.item_name)},style:{display:"flex",alignItems:"center",gap:10,padding:"8px 10px",borderRadius:8,cursor:"pointer",color:"var(--revka-text-primary)",width:"100%",textAlign:"left",background:L?"var(--pc-accent-glow)":"transparent",boxShadow:L?"inset 2px 0 0 var(--pc-accent)":"none",border:0,font:"inherit"},children:[c.jsx(Ts,{src:A.avatar_url,alt:A.name||A.item_name,size:24,radius:6,iconSize:13,style:{background:F?"var(--revka-signal-network-soft)":"color-mix(in srgb, var(--pc-accent-glow) 60%, transparent)",color:F?"var(--revka-signal-network)":"var(--pc-accent)",flexShrink:0}}),c.jsxs("span",{style:{display:"flex",flexDirection:"column",minWidth:0,flex:1},children:[c.jsx("span",{style:{fontSize:12.5,fontWeight:600,fontFamily:"var(--pc-font-mono, ui-monospace, monospace)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:A.item_name}),A.identity&&c.jsx("span",{style:{fontSize:10.5,color:"var(--revka-text-secondary)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:A.identity})]}),c.jsx("span",{style:{fontFamily:"var(--pc-font-mono, ui-monospace, monospace)",fontSize:9.5,padding:"2px 6px",borderRadius:4,background:"var(--pc-hover)",color:"var(--revka-text-faint)",flexShrink:0,textTransform:"uppercase",letterSpacing:"0.04em"},children:A.agent_type})]})},A.kref)})})}),r&&c.jsx("button",{type:"button",onClick:()=>j(null),style:{margin:"0 8px 8px",padding:"6px 10px",fontSize:11,fontWeight:600,borderRadius:6,border:"1px solid var(--revka-status-warning)",background:"color-mix(in srgb, var(--revka-status-warning) 14%, transparent)",color:"var(--revka-status-warning)",cursor:"pointer"},children:"Clear assignment"}),c.jsxs("div",{style:{padding:"8px 12px",borderTop:"1px solid var(--revka-border-soft)",display:"flex",alignItems:"center",justifyContent:"space-between",fontSize:11,color:"var(--revka-text-faint)"},children:[c.jsx("span",{children:v.length===o.length?`${o.length} agent${o.length===1?"":"s"}`:`${v.length} of ${o.length}`}),c.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:10},children:[c.jsx("a",{href:"/agents",target:"_blank",rel:"noreferrer",style:{color:"var(--revka-text-faint)",textDecoration:"none",fontWeight:500},children:"Open agents page →"}),c.jsx("button",{type:"button",onClick:()=>x(!0),style:{background:"transparent",border:0,padding:0,cursor:"pointer",color:"var(--pc-accent)",fontWeight:600,fontSize:11},children:"+ New pool agent"})]})]})]})});return c.jsxs(c.Fragment,{children:[oa.createPortal(E,document.body),c.jsx(sMe,{open:_,onClose:()=>x(!1),onCreated:async A=>{await u(),x(!1),j(A.item_name)}})]})}function pMe(e){const n=e?`revka.architect.session_id:${e}`:"revka.architect.session_id:new";try{const r=sessionStorage.getItem(n);if(r)return r;const i=typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():`arch-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,10)}`;return sessionStorage.setItem(n,i),i}catch{return`arch-${e??"new"}`}}function mMe(e){return["You are the Architect for the Revka workflow editor.","","CRITICAL: The user CANNOT see workflows you write in chat. They only see what you submit via `propose_workflow_yaml`. A YAML code block in your chat reply is invisible to the editor — it does NOT render on the canvas, and the user has no way to save it.","","Your ONE proposal tool: `propose_workflow_yaml(proposed_yaml=<YAML>, intent_summary=<one line>, base_yaml=<editor's current YAML, or empty>)`.","","DO NOT:","- Print the YAML in chat instead of calling propose_workflow_yaml","- Call create_workflow, revise_workflow, register_workflow, save_workflow_yaml, save_workflow_preset (they're not available; the editor handles persistence)","","Process:","1. If the user describes a workflow, design it from available primitives.","2. Optionally call get_workflow_metadata first to check available step types, agents, skills, auth profiles.","3. Revka the complete YAML.","4. **If base_yaml is non-empty, EXTEND it.** Treat existing steps as fixed. Add new steps after them. Do NOT remove or modify existing steps unless the user explicitly asks.","5. Call propose_workflow_yaml(...) with your YAML. The tool validates and the editor receives the proposal.","6. After the call returns, summarize what you proposed in a single short paragraph in chat. The summary is for the user to read — but the actual workflow goes through the tool, not the chat.","","Parallel execution:","- For most cases, you do NOT need a `parallel` wrapper. Sibling steps with no `depends_on` between them run in parallel naturally — the runtime parallelizes by default whenever steps are independent.","- ONLY use a `type: parallel` step when you need to explicitly group children, e.g. for join-strategy semantics or sub-workflow encapsulation. When you do use it, you MUST populate `parallel.steps: [child_id_1, child_id_2, ...]` listing each child step ID.","- Wrong: `type: parallel` with no `parallel.steps` — the step is an orphan and `propose_workflow_yaml` will reject it.","- Right (preferred for simple cases): just declare the steps as siblings without depends_on. They parallelize automatically. Add depends_on on the consumer step (e.g. `combine_report.depends_on: [research_a, research_b]`) so the consumer waits for all of them.","- Whenever a step's prompt/command/template references another step via placeholders such as `STEP_ID.output_data.artifact_path`, `STEP_ID.output`, or `STEP_ID.status`, also list that step ID in `depends_on`. The runtime infers missing deps automatically, but explicit declarations are clearer.","- Chaining steps — concrete example. WRONG (proposal will be REJECTED):",'    prompt: "Combine the two upstream research reports."',"    depends_on: [research_a, research_b]","  RIGHT:",'    prompt: "Combine these two reports.\\n\\nA artifact: ${research_a.output_data.artifact_path}\\n\\nB artifact: ${research_b.output_data.artifact_path}\\n\\nRead both artifacts before synthesizing."',"    depends_on: [research_a, research_b]","  The runtime cannot auto-inject prior results into prompts. If an agent step needs information from another step, prefer `${other_step.output_data.artifact_path}` and tell the agent to read that file for full context. Use `${other_step.output}` only for short inline handoffs. The validator rejects agent steps with depends_on entries that are not referenced in the prompt.","","Persona discovery (do this BEFORE proposing YAML when a step needs a specific role/expertise):","- Call `search_agent_pool` or `list_agent_templates` to find existing personas. If one fits, set `agent.template: <name>` on the step — agent_type/role/model resolve from the template at dispatch.","- If no fit AND the user described a recurring named role, call `save_agent_template` with required fields: `name` (kebab-case), `agent_type` (claude|codex), `role` (one of: coder, reviewer, researcher, tester, architect, planner), `capabilities` (string array of tags), `description`. Optional: `system_hint`, `identity`, `soul`, `tone`, `model`. Then reference the new template via `agent.template`.","- Skip persona creation for one-shot generic steps; bare `agent_type: claude/codex` (no template) is correct there.","- In your post-proposal summary, briefly note which personas were reused vs created.","","If propose_workflow_yaml returns valid: false, read the errors and call it again with a fixed YAML. Don't print the broken YAML in chat — the user can't fix it from there.","","Workflow context:",`- Current name: ${e||"(unnamed)"}`,"- The editor's current YAML state will be in your message context as the editor-state block."].join(`
`)}function gMe(e){const n=/```(?:yaml|yml)\n([\s\S]*?)\n```/g;let r=null,i;for(;(i=n.exec(e))!==null;)r=i[1]??null;return r}function vMe(e,n){const r=n.split(`
`).map(s=>`  ${s}`).join(`
`);return["v2:workflow_editor:architect","<architect-instructions>",mMe(e).split(`
`).map(s=>s.length>0?`  ${s}`:s).join(`
`),"</architect-instructions>","<editor-state>",`  <workflow_name>${e||"(unnamed)"}</workflow_name>`,"  <current_yaml>",r||"    (empty)","  </current_yaml>","</editor-state>"].join(`
`)}function yMe({open:e,onOpenChange:n,workflowKref:r,workflowName:i,currentYaml:s,onYamlProposed:a,initialPrompt:o}){const l=b.useMemo(()=>pMe(r),[r]),u=b.useMemo(()=>vMe(i,s),[i,s]),d=r?`revka-architect:${r}`:"revka-architect:new",{setTheme:p}=Pa(),{setLocale:f}=an(),g=b.useRef(null),_=b.useRef(!1),x=b.useRef(new Set),v=b.useCallback(oe=>{if((oe.name.includes("__")?oe.name.split("__").pop()??oe.name:oe.name)!=="propose_workflow_yaml"||g.current===oe.id)return;g.current=oe.id;let he=null;try{const Z=JSON.parse(oe.output);if(Z&&typeof Z=="object"&&Array.isArray(Z.content)){const ue=Z.content[0];if(ue&&ue.type==="text"&&typeof ue.text=="string")try{he=JSON.parse(ue.text)}catch{he=null}else he=Z}else he=Z}catch{const Z=oe.output.indexOf("{"),de=oe.output.lastIndexOf("}");if(Z>=0&&de>Z)try{he=JSON.parse(oe.output.slice(Z,de+1))}catch{he=null}}he&&he.valid&&typeof he.yaml=="string"&&he.yaml.trim()&&(a(he.yaml,he.summary??""),_.current=!0)},[a]),S=b.useCallback(()=>{_.current=!1},[]),{activities:w,appendSystemMessage:j,clearMessages:C,connected:T,error:E,handleSend:A,handleTextareaChange:O,input:F,inputRef:L,messages:$,setInput:z,streamingContent:B,streamingThinking:H,submitMessage:D,typing:U}=Pz({sessionId:l,draftKey:d,pageContext:u,onToolResult:v,onUserMessage:S});b.useEffect(()=>{if(U||_.current||$.length===0)return;const oe=$[$.length-1];if(!oe||oe.role!=="agent"||x.current.has(oe.id))return;x.current.add(oe.id);const ie=gMe(oe.content);if(!ie||!ie.trim())return;_.current=!0;let he=!1;return(async()=>{let Z=null;try{Z=await hJ({yaml:ie,base_yaml:s,intent_summary:"<chat-fallback>"})}catch(pe){if(he)return;if(pe instanceof Xl)j(`Architect wrote YAML in chat instead of calling propose_workflow_yaml. Fallback validation failed (HTTP ${pe.status}); canvas not updated.`);else{const Oe=pe instanceof Error?pe.message:String(pe);j(`Architect wrote YAML in chat instead of calling propose_workflow_yaml. Fallback validation failed (${Oe}); canvas not updated.`)}return}if(he||!Z)return;if(Z.valid){const pe=typeof Z.yaml=="string"&&Z.yaml.trim()?Z.yaml:ie;a(pe,"<chat-fallback>: extracted from chat content because propose_workflow_yaml was not called"),j("Architect wrote YAML in chat instead of calling propose_workflow_yaml. Validated via fallback and applied. The DAG canvas updated.");return}const ue=(Z.errors??[]).map(pe=>{const Oe=(pe==null?void 0:pe.message)??"validation error",fe=(pe==null?void 0:pe.path)??[pe==null?void 0:pe.step_id,pe==null?void 0:pe.field].filter(Boolean).join(".")??"";return fe?`- ${Oe} (at ${fe})`:`- ${Oe}`}).join(`
`)||"- (no error detail returned)";j(`Architect wrote YAML in chat instead of calling propose_workflow_yaml AND that YAML failed validation. Canvas not updated.

Validator errors:
${ue}`)})(),()=>{he=!0}},[$,U,a,j,s]);const I=b.useRef(null);b.useEffect(()=>{e&&o&&I.current!==l&&(F.trim().length===0&&z(o),I.current=l)},[e,o,l,F,z]);const X=b.useRef(null),[K,Q]=b.useState(0),[V,R]=b.useState(!1),[q,W]=b.useState(null),te=b.useMemo(()=>{if(V)return[];const oe=F.trimStart();return oe.startsWith("/")?oe.includes(" ")||oe.includes(`
`)?[]:U$(oe,"workflow_editor"):[]},[F,V]);b.useEffect(()=>{K>=te.length&&Q(te.length===0?0:te.length-1)},[te.length,K]),b.useEffect(()=>{V&&!F.startsWith("/")&&R(!1)},[F,V]);const J=b.useMemo(()=>({clearMessages:C,appendSystemMessage:j,openFilePicker:()=>{},addTab:()=>{},openNewTabMenu:()=>{},closeActiveTab:()=>n(!1),setLang:oe=>{f(oe)},setTheme:oe=>{p(oe)},submitMessage:D,workflowKref:r??void 0,workflowName:i}),[C,j,n,f,p,D,r,i]),G=b.useCallback(()=>{const oe=K$(F);if(!oe)return!1;const ie=V$(oe.name);if(!ie)return!1;z(""),Q(0),R(!1),L.current&&(L.current.style.height="auto");try{ie.handler(J,oe.args)}catch(he){const Z=he instanceof Error?he.message:String(he);j(`Command "/${ie.name}" failed: ${Z}`)}return!0},[F,J,z,L,j]),re=b.useCallback(oe=>{var he;const ie=te[oe];if(ie)if(ie.args)z(`/${ie.name} `),Q(0),(he=L.current)==null||he.focus();else{z(""),Q(0),L.current&&(L.current.style.height="auto");try{ie.handler(J,"")}catch(Z){const de=Z instanceof Error?Z.message:String(Z);j(`Command "/${ie.name}" failed: ${de}`)}}},[te,J,z,L,j]),ne=b.useRef(null);b.useEffect(()=>{var oe;(oe=ne.current)==null||oe.scrollTo({top:ne.current.scrollHeight,behavior:"smooth"})},[w,$,B,U]),b.useEffect(()=>{if(!e)return;const oe=setTimeout(()=>{var ie;return(ie=L.current)==null?void 0:ie.focus()},220);return()=>clearTimeout(oe)},[e,L]);const le=b.useCallback(async(oe,ie)=>{await ro(ie)&&(W(oe),setTimeout(()=>W(he=>he===oe?null:he),1200))},[]);return c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"flex items-center justify-end border-b px-3 py-1",style:{borderColor:"var(--revka-border-soft)",background:"var(--revka-bg-surface)"},children:c.jsxs("span",{className:"flex shrink-0 items-center gap-1.5 text-[10px] font-semibold uppercase tracking-[0.12em]",style:{color:"var(--revka-text-faint)"},children:[c.jsx("span",{className:"inline-block h-1.5 w-1.5 rounded-full",style:{background:T?"var(--revka-status-success)":"var(--revka-status-danger)"}}),T?"live":"offline"]})}),U&&c.jsx("div",{className:"h-[2px] overflow-hidden",style:{background:"var(--revka-bg-surface)"},children:c.jsx("div",{className:"h-full",style:{background:"var(--revka-signal-network)",width:"40%",animation:"revka-architect-sweep 1.4s ease-in-out infinite alternate"}})}),E&&c.jsx("div",{className:"border-b px-3 py-2 text-xs",style:{borderColor:"color-mix(in srgb, var(--revka-status-danger) 32%, transparent)",background:"color-mix(in srgb, var(--revka-status-danger) 10%, transparent)",color:"var(--revka-status-danger)"},children:E}),c.jsx("div",{ref:ne,className:"min-h-0 flex-1 overflow-y-auto overflow-x-hidden px-3 py-3 font-mono leading-6",style:{fontSize:13},children:$.length===0&&!U?c.jsxs("div",{className:"flex h-full flex-col items-center justify-center text-center",children:[c.jsx("pre",{className:"text-xs",style:{color:"var(--revka-text-faint)"},children:`┌──────────────────────────────┐
│  architect ready · describe  │
│  the workflow you want       │
└──────────────────────────────┘`}),c.jsx("p",{className:"mt-3 max-w-xs text-xs leading-5",style:{color:"var(--revka-text-muted)"},children:"Try /architect add a python step that prints hello"})]}):c.jsxs("div",{className:"space-y-3",children:[$.map(oe=>{const ie=oe.role==="user"?"you":oe.role==="operator"?"sys":"architect",he=oe.role==="user"?"var(--revka-text-secondary)":oe.role==="operator"?"var(--revka-signal-network)":"var(--revka-signal-live)",Z=q===oe.id;return c.jsxs("div",{className:"group",children:[oe.activityLog&&oe.activityLog.length>0&&c.jsx("div",{className:"mb-1 space-y-0.5",children:oe.activityLog.map(de=>c.jsx(cb,{event:de,accent:de.kind==="tool_result"?"var(--revka-status-success)":"var(--revka-signal-network)",fontSize:13},de.id))}),c.jsxs("div",{className:"whitespace-pre-wrap break-words",children:[c.jsxs("span",{style:{color:he,fontWeight:600},children:[ie," ",">"," "]}),c.jsx("span",{style:{color:he},children:oe.content})]}),c.jsx("div",{className:"mt-0.5 flex items-center justify-end gap-2 text-[10px]",style:{color:"var(--revka-text-faint)"},children:c.jsxs("button",{type:"button",onClick:()=>le(oe.id,oe.content),"aria-label":Z?"Copied":"Copy message",title:Z?"Copied":"Copy",className:"inline-flex items-center gap-1 rounded px-1.5 py-0.5 opacity-50 transition-all hover:bg-white/5 hover:opacity-100 group-hover:opacity-80",style:{color:"var(--revka-text-muted)"},children:[Z?c.jsx(no,{className:"h-3 w-3"}):c.jsx(rc,{className:"h-3 w-3"}),c.jsx("span",{children:Z?"copied":"copy"})]})})]},oe.id)}),U&&w.length>0&&c.jsx("div",{className:"space-y-0.5",children:w.map(oe=>c.jsx(cb,{event:oe,accent:oe.kind==="tool_result"?"var(--revka-status-success)":oe.kind==="thinking"?"var(--revka-text-faint)":"var(--revka-signal-network)",fontSize:13},oe.id))}),U&&(B||H)&&c.jsxs("div",{className:"whitespace-pre-wrap break-words",children:[c.jsxs("span",{style:{color:"var(--revka-signal-live)",fontWeight:600},children:["architect ",">"," "]}),c.jsx("span",{style:{color:"var(--revka-signal-live)"},children:B||"…"})]}),U&&!B&&!H&&w.length===0&&c.jsxs("div",{className:"animate-pulse",style:{color:"var(--revka-signal-live)"},children:["architect ",">"," ",c.jsx(Rr,{className:"inline h-3 w-3 animate-spin"})]})]})}),c.jsxs("div",{ref:X,className:"relative border-t px-3 py-2",style:{borderColor:"var(--revka-border-soft)"},children:[c.jsxs("div",{className:"flex items-end gap-2 rounded-md border px-2 py-1.5",style:{borderColor:"var(--revka-border-soft)",color:"var(--revka-signal-network)"},children:[c.jsxs("span",{className:"shrink-0 pb-[3px] font-mono text-sm font-semibold",style:{color:"var(--revka-signal-network)"},children:[">",c.jsx("span",{className:"revka-cursor-blink",children:"_"})]}),c.jsx("textarea",{ref:L,rows:1,value:F,onChange:O,onKeyDown:oe=>{if(te.length>0){if(oe.key==="ArrowDown"){oe.preventDefault(),Q(he=>(he+1)%te.length);return}if(oe.key==="ArrowUp"){oe.preventDefault(),Q(he=>(he-1+te.length)%te.length);return}if(oe.key==="Tab"){oe.preventDefault(),re(K);return}if(oe.key==="Escape"){oe.preventDefault(),R(!0);return}if(oe.key==="Enter"&&!oe.shiftKey){oe.preventDefault(),re(K);return}}if(oe.key==="Enter"&&!oe.shiftKey){if(oe.preventDefault(),G())return;A()}},placeholder:T?"Describe a change… (try /architect)":"connecting…",disabled:!T,className:"min-h-[1.75rem] min-w-0 flex-1 resize-none bg-transparent font-mono outline-none focus:outline-none focus-visible:outline-none disabled:opacity-50",style:{color:"var(--revka-text-primary)",caretColor:"var(--revka-signal-network)",maxHeight:"6rem",fontSize:16}}),c.jsx("button",{type:"button",onClick:()=>A(),disabled:!T||!F.trim(),"aria-label":"Send message",title:T?"Send (Enter)":"Disconnected",className:"inline-flex h-7 w-7 shrink-0 items-center justify-center rounded transition-all hover:bg-white/5 disabled:cursor-not-allowed disabled:opacity-30",style:{color:F.trim()&&T?"var(--revka-signal-network)":"var(--revka-text-faint)"},children:c.jsx(VE,{className:"h-3.5 w-3.5"})})]}),c.jsx(W$,{anchorRef:X,matches:te,selectedIndex:K,onPick:re})]})]})}function _Me({open:e,onOpenChange:n,workflowKref:r,workflowName:i,currentYaml:s,onYamlProposed:a,initialPrompt:o}){b.useEffect(()=>{if(!e)return;const u=d=>{d.key==="Escape"&&n(!1)};return window.addEventListener("keydown",u),()=>window.removeEventListener("keydown",u)},[e,n]);const l=i??"workflow";return c.jsxs(c.Fragment,{children:[e&&c.jsx("div",{className:"fixed inset-0 z-[80]",style:{background:"rgba(0,0,0,0.18)"},onClick:()=>n(!1)}),c.jsxs("aside",{className:"fixed right-0 top-0 z-[90] flex h-full flex-col border-l",style:{width:480,maxWidth:"100vw",transform:e?"translateX(0)":"translateX(100%)",transition:"transform 280ms ease-out",background:"var(--revka-bg-base)",borderColor:"var(--revka-border-strong)",boxShadow:e?"var(--revka-shadow-overlay)":"none",pointerEvents:e?"auto":"none"},"aria-hidden":!e,children:[c.jsxs("div",{className:"flex items-center gap-2 border-b px-3 py-2",style:{borderColor:"var(--revka-border-soft)",background:"var(--revka-bg-surface)"},children:[c.jsx(Tz,{size:14,style:{color:"var(--revka-signal-network)"},"aria-hidden":!0}),c.jsx("span",{className:"text-[12px] font-semibold uppercase tracking-[0.14em]",style:{color:"var(--revka-text-primary)"},children:"Architect"}),c.jsx("span",{className:"ml-1 truncate rounded px-2 py-0.5 text-[11px]",style:{background:"var(--pc-bg-input)",color:"var(--revka-text-muted)",maxWidth:220},title:r?`${l} · ${r}`:l,children:l}),c.jsx("div",{className:"flex-1"}),c.jsx("button",{type:"button",onClick:()=>n(!1),"aria-label":"Close Architect",title:"Close (Esc)",className:"ml-1 rounded p-1 transition-colors hover:bg-white/5",style:{color:"var(--revka-text-faint)"},children:c.jsx(vi,{size:14})})]}),c.jsx(yMe,{open:e,onOpenChange:n,workflowKref:r,workflowName:l,currentYaml:s,onYamlProposed:a,initialPrompt:o}),c.jsx("div",{className:"border-t px-3 py-1.5 text-center text-[10px] uppercase tracking-[0.16em]",style:{borderColor:"var(--revka-border-soft)",color:"var(--pc-text-faint, var(--revka-text-faint))",background:"var(--revka-bg-surface)"},children:"Powered by Operator"})]}),c.jsx("style",{children:`
        @keyframes revka-architect-sweep {
          from { transform: translateX(-10%); }
          to   { transform: translateX(160%); }
        }
      `})]})}function xMe(e,n){if(e.type!=="workflow.revision.published")return!1;const r=e.workflow_kref;return typeof r=="string"&&r===n}function bMe(e,n){if(e.type!=="workflow.revision.republished")return!1;const r=e.revision_kref;if(typeof r!="string")return!1;const i=r.split("?",1)[0],s=n.split("?",1)[0];return i===s}function kMe({workflowKref:e,onChange:n}){const r=b.useRef(n);r.current=n,b.useEffect(()=>{if(!e)return;const i=new Dv;return i.onEvent=s=>{if(xMe(s,e)){r.current(s);return}bMe(s,e)&&r.current(s)},i.connect(),()=>{i.disconnect()}},[e])}const wMe=9099,SMe=9100;function NI(e){return e.tags.includes("published")}function VK(e){var r;const n=(r=e.metadata)==null?void 0:r.rationale;if(typeof n=="string"&&n.trim().length>0)return n.trim();for(const i of e.tags)if(i.startsWith("rationale:")){const s=i.slice(10).trim();return s.length>0?s:null}return null}function CMe(e){if(!e)return"—";const n=Date.parse(e);if(Number.isNaN(n))return"—";const r=Date.now()-n;if(r<0)return"just now";const i=Math.round(r/1e3);if(i<45)return"just now";const s=Math.round(i/60);if(s<60)return`${s}m ago`;const a=Math.round(s/60);if(a<24)return`${a}h ago`;const o=Math.round(a/24);if(o<30)return`${o}d ago`;try{return new Date(n).toLocaleDateString()}catch{return`${o}d ago`}}function jMe(e){if(!e)return"unknown time";const n=Date.parse(e);if(Number.isNaN(n))return e;try{return new Date(n).toLocaleString()}catch{return e}}function NMe({open:e,revision:n,onCancel:r,onConfirm:i,submitting:s,error:a}){if(b.useEffect(()=>{if(!e)return;const d=p=>{p.key==="Escape"&&(p.preventDefault(),s||r())};return window.addEventListener("keydown",d),()=>window.removeEventListener("keydown",d)},[e,s,r]),!e||!n||typeof document>"u")return null;const o=VK(n),l=d=>{d.target===d.currentTarget&&!s&&r()},u=c.jsx("div",{role:"dialog","aria-modal":"true","aria-label":`Revert to revision r${n.number}`,onClick:l,style:{position:"fixed",inset:0,zIndex:wMe,background:"rgba(0, 0, 0, 0.48)",backdropFilter:"blur(6px)",display:"flex",alignItems:"flex-start",justifyContent:"center",paddingTop:"14vh"},children:c.jsxs("div",{className:"revka-panel","data-variant":"primary",onClick:d=>d.stopPropagation(),style:{width:"min(460px, calc(100vw - 32px))",display:"flex",flexDirection:"column",borderRadius:14,borderColor:"var(--revka-border-strong)",boxShadow:"0 32px 80px rgba(0,0,0,0.48)",zIndex:SMe,overflow:"hidden"},children:[c.jsxs("div",{style:{padding:"14px 16px",borderBottom:"1px solid var(--revka-border-soft)",display:"flex",alignItems:"center",gap:10},children:[c.jsx("span",{style:{display:"inline-flex",alignItems:"center",justifyContent:"center",width:28,height:28,borderRadius:8,background:"color-mix(in srgb, var(--revka-status-warning) 28%, transparent)",color:"var(--revka-status-warning)"},children:c.jsx(HE,{size:15})}),c.jsxs("div",{style:{flex:1,minWidth:0},children:[c.jsxs("div",{style:{fontSize:13,fontWeight:700,color:"var(--revka-text-primary)"},children:["Revert to revision r",n.number,"?"]}),o?c.jsx("div",{style:{fontSize:11,color:"var(--revka-text-faint)",marginTop:2,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},title:o,children:o}):null]}),c.jsx("button",{type:"button",onClick:()=>{s||r()},disabled:s,"aria-label":"Close",style:{background:"transparent",border:0,padding:4,cursor:s?"not-allowed":"pointer",color:"var(--revka-text-faint)",opacity:s?.5:1},children:c.jsx(vi,{size:16})})]}),c.jsxs("div",{style:{padding:"14px 16px",display:"flex",flexDirection:"column",gap:10},children:[c.jsxs("p",{style:{fontSize:12.5,lineHeight:1.5,color:"var(--revka-text-secondary)",margin:0},children:["This will create a new published revision with revision r",n.number,"'s content. Other tabs viewing this workflow will auto-update."]}),a?c.jsx("div",{role:"alert",style:{padding:"8px 10px",borderRadius:8,background:"color-mix(in srgb, var(--revka-status-danger) 14%, transparent)",border:"1px solid var(--revka-status-danger)",color:"var(--revka-status-danger)",fontSize:11.5},children:a}):null]}),c.jsxs("div",{style:{padding:"12px 16px",borderTop:"1px solid var(--revka-border-soft)",display:"flex",alignItems:"center",justifyContent:"flex-end",gap:8},children:[c.jsx("button",{type:"button",onClick:()=>{s||r()},disabled:s,className:"revka-button",children:"Cancel"}),c.jsxs("button",{type:"button",onClick:()=>{i()},disabled:s,className:"revka-button","data-variant":"primary",style:{display:"inline-flex",alignItems:"center",gap:6,background:"color-mix(in srgb, var(--revka-status-warning) 80%, transparent)",borderColor:"var(--revka-status-warning)",color:"var(--revka-text-primary)"},children:[s&&c.jsx(Rr,{size:13,className:"animate-spin"}),s?"Reverting…":"Revert"]})]})]})});return oa.createPortal(u,document.body)}function EMe({workflowKref:e,onRepublished:n}){const[r,i]=b.useState([]),[s,a]=b.useState(null),[o,l]=b.useState(null),[u,d]=b.useState(!1),[p,f]=b.useState(null),g=b.useRef(null),_=b.useRef(!1),x=b.useCallback(async()=>{if(g.current)return _.current=!0,g.current;const C=(async()=>{try{const T=await uJ(e);i(T.revisions??[]),a(null)}catch(T){const E=T instanceof Xl?T.message.replace(/^API \d+: /,"")||"Failed to load revisions":T instanceof Error?T.message:"Failed to load revisions";a(E)}})();g.current=C;try{await C}finally{g.current=null,_.current&&(_.current=!1,x())}},[e]);b.useEffect(()=>{i([]),a(null),x()},[x]),kMe({workflowKref:e,onChange:()=>{x()}});const v=b.useCallback(C=>{NI(C)||(f(null),l(C))},[]),S=b.useCallback(()=>{u||(l(null),f(null))},[u]),w=b.useCallback(async()=>{if(o){d(!0),f(null);try{const C=await dJ(o.kref);l(null),x(),n==null||n(C.revision_kref)}catch(C){const T=C instanceof Xl?C.message.replace(/^API \d+: /,"")||"Republish failed":C instanceof Error?C.message:"Republish failed";console.error("[RevisionHistoryStrip] republish failed:",C),f(T)}finally{d(!1)}}},[o,x,n]),j=b.useMemo(()=>{const C=[...r];return C.sort((T,E)=>E.number-T.number),C},[r]);return c.jsxs(c.Fragment,{children:[c.jsxs("div",{role:"region","aria-label":"Workflow revisions",style:{position:"relative",height:36,display:"flex",alignItems:"center",gap:10,padding:"0 12px",borderTop:"1px solid var(--pc-border)",borderBottom:"1px solid var(--pc-border)",background:"var(--pc-bg-elevated)",flexShrink:0},children:[c.jsx("span",{className:"revka-kicker",style:{flexShrink:0},children:"Revisions"}),c.jsx("div",{className:"revka-rev-strip-scroller",style:{flex:1,minWidth:0,display:"flex",alignItems:"center",gap:6,overflowX:"auto",overflowY:"hidden",scrollbarWidth:"none"},children:s?c.jsx("span",{style:{fontSize:11,color:"var(--revka-status-danger)"},title:s,children:s}):j.length===0?c.jsx("span",{style:{fontSize:11,color:"var(--revka-text-faint)",fontStyle:"italic"},children:"No revisions yet"}):j.map(C=>{const T=NI(C),E=VK(C),A=[`r${C.number}`,jMe(C.created_at),E?`— ${E}`:null].filter(Boolean).join(" · ");return c.jsxs("button",{type:"button",onClick:()=>v(C),disabled:T,className:"revka-rev-capsule","data-live":T?"true":"false",title:A,style:{display:"inline-flex",alignItems:"center",gap:6,height:22,padding:"0 8px",borderRadius:999,fontSize:10.5,fontFamily:"var(--pc-font-mono, ui-monospace, monospace)",fontWeight:600,flexShrink:0,cursor:T?"default":"pointer",transition:"transform 120ms ease, background 120ms ease",border:T?"1px solid var(--pc-accent)":"1px solid var(--pc-border)",background:T?"var(--pc-accent-glow)":"transparent",color:T?"var(--pc-accent)":"var(--revka-text-muted)",animation:"revka-rev-capsule-in 240ms ease-out both"},children:[T?c.jsx("span",{"aria-hidden":!0,style:{display:"inline-block",width:6,height:6,borderRadius:999,background:"var(--revka-signal-selected)",boxShadow:"0 0 6px color-mix(in srgb, var(--revka-signal-selected) 60%, transparent)"}}):null,c.jsxs("span",{children:["r",C.number]}),c.jsx("span",{style:{color:T?"var(--pc-accent)":"var(--revka-text-faint)",fontWeight:500},children:CMe(C.created_at)})]},C.kref)})})]}),c.jsx(NMe,{open:o!==null,revision:o,onCancel:S,onConfirm:w,submitting:u,error:p}),c.jsx("style",{children:`
        .revka-rev-strip-scroller::-webkit-scrollbar {
          height: 0;
          background: transparent;
        }
        .revka-rev-strip-scroller:hover {
          scrollbar-width: thin;
        }
        .revka-rev-strip-scroller:hover::-webkit-scrollbar {
          height: 6px;
        }
        .revka-rev-strip-scroller:hover::-webkit-scrollbar-thumb {
          background: var(--pc-border);
          border-radius: 3px;
        }
        .revka-rev-capsule:not(:disabled):hover {
          transform: translateY(-1px);
          background: color-mix(in srgb, var(--pc-accent-glow) 35%, transparent);
          color: var(--revka-text-primary);
        }
        @keyframes revka-rev-capsule-in {
          from { opacity: 0; transform: translateY(2px); }
          to   { opacity: 1; transform: translateY(0); }
        }
      `})]})}function AMe(e){return e==="agent"}function TMe(e,n,r){return n!=="agent"||!AMe(r)?`\${${e}.output}`:[`Dependency handoff from ${e}:`,`- status: \${${e}.status}`,`- artifact_path: \${${e}.output_data.artifact_path}`,`- files_touched: \${${e}.files}`,"Read artifact_path when exact upstream context is needed. The artifact is the full output; this prompt only carries the reference."].join(`
`)}function MMe(e){return e.type==="workflow.revision.published"&&typeof e.workflow_kref=="string"&&typeof e.revision_kref=="string"}function RMe({workflowKref:e,onRevisionPublished:n}){const r=b.useRef(n);r.current=n;const i=b.useRef(e);i.current=e,b.useEffect(()=>{if(!e)return;const s=DE(),a=new Dv;return a.onEvent=o=>{MMe(o)&&o.workflow_kref===i.current&&(o.originating_session&&o.originating_session===s||r.current(o))},a.connect(),()=>{a.disconnect()}},[e])}const OMe={...WNe,...KNe};function DMe(e){return c.jsx(iT,{children:c.jsx(mRe,{...e})})}const PMe={agent:"prompt",shell:"shellCommand",output:"outputTemplate",conditional:"condition",notify:"notifyMessage",email:"emailBody",python:"pythonCode"},YK=["prompt","shellCommand","pythonCode","pythonArgs","pythonScript","emailBody","emailBodyHtml","emailSubject","emailTo","emailCc","emailBcc","imagePrompt","outputTemplate","resolveArtifactName","condition","gotoCondition","humanInputMessage","humanApprovalMessage","notifyMessage","notifyTitle","groupChatTopic","supervisorTask","a2aUrl","a2aMessage","a2aCloudRunConfig","a2aCloudRunAudience","mapReduceTask","handoffReason"],EI=/\$\{([a-zA-Z_][a-zA-Z0-9_-]*)(?:\.[a-zA-Z_][a-zA-Z0-9_.-]*)?\}/g;function LMe(e,n){for(const r of YK){const i=e[r];if(typeof i!="string"||!i)continue;EI.lastIndex=0;let s;for(;(s=EI.exec(i))!==null;)if(s[1]===n)return!0}return!1}function IMe(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function BMe(e,n){if(!e)return e;const r=new RegExp(`\\$\\{${IMe(n)}(?:\\.[a-zA-Z_][a-zA-Z0-9_.-]*)?\\}`,"g");if(!r.test(e))return e;const i=e.includes(`\r
`)?`\r
`:`
`,s=e.split(/\r?\n/),a=[];for(const l of s){if(r.lastIndex=0,!r.test(l)){a.push(l);continue}r.lastIndex=0;const u=l.replace(r,"").replace(/[ \t]+$/g,"");u.trim().length>0&&a.push(u)}let o=a.join(i).replace(/(\r?\n){3,}/g,`${i}${i}`);for(;o.startsWith(i);)o=o.slice(i.length);for(;o.endsWith(i);)o=o.slice(0,-i.length);return o}function zMe(e,n){let r=e;for(const i of YK){const s=r[i];if(typeof s!="string"||!s)continue;const a=BMe(s,n);a!==s&&(r={...r,[i]:a})}return r}function AI(e){const n=Date.parse(e);if(Number.isNaN(n))return e;const r=Math.max(0,Math.round((Date.now()-n)/1e3));if(r<5)return"just now";if(r<60)return`${r}s ago`;const i=Math.round(r/60);return i<60?`${i}m ago`:`${Math.round(i/60)}h ago`}function D2(e){var r;if(!cf(e))return;if(e==="true"||e==="false")return e;const n=Number(((r=/^branch-(\d+)$/.exec(e??""))==null?void 0:r[1])??0);return n===0?"true":`case ${n+1}`}function GK(e){var r;if(((r=e.conditionalBranches)==null?void 0:r.length)>0)return e.conditionalBranches.map(i=>({...i}));const n=[];return(e.condition||e.onTrueValue)&&n.push({condition:e.condition||"",goto:"",value:e.onTrueValue||void 0}),e.onFalseValue&&n.push({condition:"default",goto:"",value:e.onFalseValue}),n.length>0?n:[{condition:e.condition||"",goto:"",value:e.onTrueValue||void 0},{condition:"default",goto:"",value:e.onFalseValue||void 0}]}function Vx(e){const n=e.find(i=>i.condition.trim()!=="default"),r=e.find(i=>i.condition.trim()==="default")??e.find(i=>i!==n);return{conditionalBranches:e,condition:(n==null?void 0:n.condition)??"",onTrueValue:(n==null?void 0:n.value)??"",onFalseValue:(r==null?void 0:r.value)??""}}function $Me(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function FMe(e){return/[A-Za-z_]/.test(e)}function HMe(e){return/[A-Za-z0-9_-]/.test(e)}function WMe(e,n,r){if(!e.includes("${{"))return e;const i=n.replace(/-/g,"_"),s=r.replace(/-/g,"_"),a=new Set([n,i]);if(a.size===1&&a.has(s))return e;const o=l=>{let u="",d=null;for(let p=0;p<l.length;){const f=l[p];if(d){if(u+=f,f==="\\"&&p+1<l.length){u+=l[p+1],p+=2;continue}f===d&&(d=null),p+=1;continue}if(f==='"'||f==="'"){d=f,u+=f,p+=1;continue}if(!FMe(f)){u+=f,p+=1;continue}const g=p;for(p+=1;p<l.length&&HMe(l[p]);)p+=1;const _=l.slice(g,p),x=g>0?l[g-1]:"";let v=p;for(;v<l.length&&/\s/.test(l[v]);)v+=1;const S=(!x||!/[A-Za-z0-9_.]/.test(x))&&l[v]===".";u+=S&&a.has(_)?s:_}return u};return e.replace(/\$\{\{\s*([\s\S]*?)\s*\}\}/g,(l,u)=>{const d=o(u);return d===u?l:"${{ "+d+" }}"})}function dE(e,n,r){if(typeof e=="string"){const i=new RegExp(`\\$\\{${$Me(n)}(?=\\.|\\})`,"g");return WMe(e.replace(i,`\${${r}`),n,r)}if(Array.isArray(e))return e.map(i=>dE(i,n,r));if(e&&typeof e=="object"){const i={};for(const[s,a]of Object.entries(e))i[s]=dE(a,n,r);return i}return e}function XK(e,n,r){return dE(e,n,r)}function TI(e,n,r){const i=Pv(n);if(i===null)return e;const s=GK(e);for(;s.length<=i;)s.push({condition:s.length===1?"default":"",goto:"",value:void 0});return s[i]={...s[i],goto:r},{...e,...Vx(s)}}function MI(e,n){return{label:e,taskId:e,name:e,description:"",type:"agent",agentHints:[],skills:[],compression:!1,assign:"",template:"",paramCount:0,dependencyCount:0,condition:"",onTrueValue:"",onFalseValue:"",conditionalBranches:[],channel:"",channels:[],agentType:"",role:"",prompt:"",timeout:300,agentMaxTurns:3,agentTools:"none",agentRequiredTools:[],agentOutputFields:[],agentQualityEnabled:!1,agentQualityThreshold:.7,agentQualityCriteria:[],agentQualityModel:"claude-haiku-4-5-20251001",parallelJoin:"all",gotoTarget:"",gotoMaxIterations:3,groupChatTopic:"",groupChatParticipants:[],groupChatMaxRounds:8,supervisorTask:"",supervisorMaxIterations:5,supervisorTemplates:[],shellCommand:"",outputFormat:"markdown",entityName:"",entityKind:"",entityTag:"",entitySpace:"",entityMetadata:{},entityMetadataTarget:"item",artifactSummaryModel:"",handoffFrom:"",handoffTo:"",handoffReason:"",retry:0,retryDelay:5,model:"",shellTimeout:60,shellAllowFailure:!1,gotoCondition:"",parallelMaxConcurrency:5,humanInputMessage:"",humanInputTimeout:3600,humanApprovalMessage:"",humanApprovalTimeout:3600,humanApprovalChannel:"dashboard",humanApprovalChannelId:"",humanApprovalOnRejectGoto:"",humanApprovalOnRejectMax:3,humanApprovalApproveKeywords:["approve","approved","yes","lgtm"],humanApprovalRejectKeywords:["reject","rejected","no"],outputTemplate:"",a2aUrl:"",a2aSkillId:"",a2aMessage:"",a2aTimeout:300,a2aCloudRunAuth:"",a2aCloudRunConfig:"",a2aCloudRunAudience:"",a2aCloudRunAuthTimeout:20,resolveKind:"",resolveTag:"published",resolveNamePattern:"",resolveSpace:"",resolveArtifactName:"",resolveMode:"latest",resolveFields:[],resolveMetadataSource:"revision",resolveFailIfMissing:!0,kumihoConfig:{},kumihoProject:"",kumihoMode:"graph_augmented_context",kumihoSeedBundles:[],kumihoSeedKrefs:[],kumihoSeedQueries:[],kumihoSeedItems:[],kumihoTraversalMaxDepth:2,kumihoTraversalDirection:"both",kumihoTraversalEdgeTypes:["DEPENDS_ON","REFERENCES","ADVANCES","UPDATES","CONTRADICTS"],kumihoFiltersIncludeKinds:[],kumihoFiltersExcludeTags:["deprecated"],kumihoFiltersMaxItems:50,kumihoRankingMethod:"hybrid",kumihoRankingSemanticQuery:"",kumihoLockTagPreference:["current","active","production-ready","ready","published","latest"],kumihoOutputFormat:"context_pack",kumihoOutputIncludeArtifactSummaries:!0,kumihoOutputIncludeArtifactContent:!1,kumihoOutputMaxArtifactCharsPerItem:3e3,kumihoOutputIncludeEdgeMap:!0,kumihoOutputIncludeConflictWarnings:!0,kumihoOutputIncludeMissingContext:!0,kumihoCreateIfMissing:!1,kumihoIdempotent:!0,kumihoFailIfMissingBundle:!0,kumihoFailIfMissingItem:!0,kumihoAllowProtected:!1,kumihoUpdates:[],kumihoPatchKref:"",kumihoDryRun:!0,kumihoAllowAutoApply:!1,kumihoApprovalRequired:!0,kumihoApprovalApproved:!1,kumihoApprovalApprovedBy:"",kumihoApprovalNote:"",kumihoApplyCreateRevisions:!0,kumihoApplyCreateEdges:!0,kumihoApplyUpdateTags:!0,kumihoApplyUntagPreviousCurrent:!0,kumihoApplyUpdateBundles:!0,kumihoApplySaveApplyReport:!0,kumihoNewRevisionTags:["current","approved"],kumihoPatchTagsRemove:["candidate"],kumihoPatchTagsAdd:["applied"],kumihoPendingPatchBundle:"",kumihoAppliedPatchBundle:"",kumihoCurrentStateBundle:"",kumihoActiveStorylineBundle:"",kumihoActiveForeshadowBundle:"",kumihoTimelineBundle:"",kumihoRequireEvidenceLocator:!0,kumihoSourceEpisodeKref:"",kumihoSourceContextPackKref:"",mapReduceTask:"",mapReduceSplits:[],mapReduceMapper:"claude",mapReduceReducer:"claude",mapReduceConcurrency:3,mapReduceTimeout:300,supervisorType:"claude",supervisorTimeout:300,groupChatModerator:"claude",groupChatStrategy:"moderator_selected",groupChatTimeout:120,handoffTask:"",handoffTimeout:300,forEachSteps:[],forEachRange:"",forEachItems:[],forEachVariable:"item",forEachCarryForward:!0,forEachFailFast:!0,forEachMaxIterations:20,notifyMessage:"",notifyTitle:"",notifyChannelId:"",pythonScript:"",pythonCode:"",pythonArgs:"",pythonInterpreter:"",pythonTimeout:60,pythonAllowFailure:!1,computeOutputs:{},emailTo:"",emailSubject:"",emailBody:"",emailBodyHtml:"",emailFrom:"",emailCc:"",emailBcc:"",emailReplyTo:"",emailTrackClicks:!1,emailTrackKref:"",emailTrackSecretEnv:"",emailTrackBaseUrl:"",emailSmtpHost:"",emailSmtpPort:0,emailSmtpTls:!0,emailSmtpUsername:"",emailSmtpPasswordEnv:"",emailDryRun:!1,emailTimeout:30,imagePrompt:"",imageCount:1,imageCanvas:!0,imageCanvasTarget:"",imageRegisterArtifact:!0,imageSpace:"",imageItemName:"",imageOutputPath:"",imageOutputPattern:"",imageInputImages:[],imageSandbox:"",imageCwd:"",imageTimeout:1200,tagItemKref:"",tagValue:"",tagUntag:"",deprecateItemKref:"",deprecateReason:"",manusPrompt:"",manusStructuredOutputSchema:"",manusConnectors:[],manusEnableSkills:[],manusForceSkills:[],manusAgentProfile:"",manusLocale:"",manusProjectId:"",manusTitle:"",manusTimeoutSeconds:600,manusPollIntervalSeconds:5,manusAllowFailure:!1,manusCredentialsRef:"",manusRegisterEnabled:!1,manusRegisterEntityName:"",manusRegisterEntityKind:"",manusRegisterEntityTag:"",manusRegisterEntitySpace:"",manusRegisterAttachments:!0,manusRegisterContentSource:"message",...n}}function RI(e){return e==="compute"?{type:e,computeOutputs:{value:"${{ 1 }}"}}:e==="kumiho_bundle_update"?{type:e,kumihoMode:"add_members",kumihoIdempotent:!0}:e==="kumiho_patch_apply"?{type:e,kumihoDryRun:!0,kumihoApprovalRequired:!0}:{type:e}}function qMe({runLog:e,onClose:n,onRefresh:r}){const i=e.detail,s=(i==null?void 0:i.status)||e.status,a=(i==null?void 0:i.steps)??[],o=a.find(p=>p.step_id===e.targetStepId),l=(o==null?void 0:o.output_preview)||pRe(o==null?void 0:o.output_data),u=(o==null?void 0:o.error)||(i==null?void 0:i.error)||e.error,d=!!(e.runId&&!i&&!e.error);return c.jsxs("div",{role:"dialog","aria-label":"Run to here log",style:{position:"fixed",right:20,bottom:20,zIndex:70,width:"min(440px, calc(100vw - 32px))",maxHeight:"min(560px, calc(100vh - 96px))",display:"flex",flexDirection:"column",overflow:"hidden",borderRadius:12,border:"1px solid var(--revka-border-strong)",background:"var(--revka-bg-panel-strong)",boxShadow:"0 18px 48px rgba(0,0,0,0.42)"},children:[c.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,padding:"12px 14px",borderBottom:"1px solid var(--revka-border-soft)"},children:[c.jsx(IE,{size:14,style:{color:"var(--revka-signal-network)"}}),c.jsxs("div",{style:{minWidth:0,flex:1},children:[c.jsx("div",{style:{fontSize:12,fontWeight:700,color:"var(--revka-text-primary)"},children:"Run to here"}),c.jsxs("div",{style:{fontSize:10,color:"var(--revka-text-faint)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:[e.workflowName," · ",e.targetStepId]})]}),c.jsx("span",{style:{flexShrink:0,padding:"3px 8px",borderRadius:999,border:"1px solid color-mix(in srgb, currentColor 38%, transparent)",color:LI(s),fontSize:10,fontWeight:700,textTransform:"uppercase",letterSpacing:"0.08em"},children:s}),c.jsx("button",{type:"button",onClick:()=>void r(),disabled:!e.runId,className:"revka-button",title:"Refresh run log","aria-label":"Refresh run log",style:{width:28,height:28,padding:0,justifyContent:"center",opacity:e.runId?1:.45},children:c.jsx($r,{size:13})}),c.jsx("button",{type:"button",onClick:n,className:"revka-button",title:"Close run log","aria-label":"Close run log",style:{width:28,height:28,padding:0,justifyContent:"center"},children:c.jsx(vi,{size:13})})]}),c.jsxs("div",{style:{overflowY:"auto",padding:14,display:"flex",flexDirection:"column",gap:12},children:[c.jsxs("div",{style:{display:"grid",gridTemplateColumns:"80px minmax(0, 1fr)",rowGap:5,columnGap:10,fontSize:11},children:[c.jsx("span",{style:{color:"var(--revka-text-faint)"},children:"Run ID"}),c.jsx("span",{style:{color:"var(--revka-text-secondary)",fontFamily:"var(--pc-font-mono, ui-monospace, monospace)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e.runId||"Starting..."}),c.jsx("span",{style:{color:"var(--revka-text-faint)"},children:"Started"}),c.jsx("span",{style:{color:"var(--revka-text-secondary)"},children:fRe((i==null?void 0:i.started_at)||e.startedAt)}),c.jsx("span",{style:{color:"var(--revka-text-faint)"},children:"Progress"}),c.jsx("span",{style:{color:"var(--revka-text-secondary)"},children:i?`${i.steps_completed||"0"} / ${i.steps_total||a.length||"?"}`:"Waiting for run details"})]}),u?c.jsx("div",{style:{padding:10,borderRadius:10,border:"1px solid color-mix(in srgb, var(--revka-status-danger) 34%, transparent)",background:"color-mix(in srgb, var(--revka-status-danger) 10%, transparent)",color:"var(--revka-status-danger)",fontSize:11,whiteSpace:"pre-wrap"},children:u}):null,c.jsxs("div",{children:[c.jsx("div",{className:"revka-kicker",style:{marginBottom:8},children:"Target Output"}),l?c.jsx("pre",{style:{margin:0,maxHeight:180,overflow:"auto",padding:10,borderRadius:10,border:"1px solid var(--revka-border-soft)",background:"var(--pc-bg-code)",color:"var(--revka-text-secondary)",fontFamily:"var(--pc-font-mono, ui-monospace, monospace)",fontSize:11,lineHeight:1.55,whiteSpace:"pre-wrap"},children:l}):c.jsx("div",{style:{fontSize:11,color:"var(--revka-text-faint)"},children:d?"Waiting for the run log...":o?"The target step has not produced output yet.":"The target step has not appeared in the run log yet."})]}),c.jsxs("div",{children:[c.jsx("div",{className:"revka-kicker",style:{marginBottom:8},children:"Steps"}),a.length>0?c.jsx("div",{style:{display:"flex",flexDirection:"column",gap:6},children:a.map(p=>c.jsxs("div",{style:{display:"grid",gridTemplateColumns:"minmax(0, 1fr) auto",alignItems:"center",gap:8,padding:"7px 9px",borderRadius:8,border:p.step_id===e.targetStepId?"1px solid color-mix(in srgb, var(--revka-signal-network) 48%, transparent)":"1px solid var(--revka-border-soft)",background:p.step_id===e.targetStepId?"color-mix(in srgb, var(--revka-signal-network) 10%, transparent)":"var(--revka-bg-surface)"},children:[c.jsx("span",{style:{minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",color:"var(--revka-text-primary)",fontSize:11,fontFamily:"var(--pc-font-mono, ui-monospace, monospace)"},children:p.step_id}),c.jsx("span",{style:{color:LI(p.status),fontSize:10,fontWeight:700,textTransform:"uppercase",letterSpacing:"0.08em"},children:p.status||"pending"})]},p.step_id))}):c.jsx("div",{style:{fontSize:11,color:"var(--revka-text-faint)"},children:e.error||"No step log entries yet."})]})]})]})}const QK="revka.workflowEditor.wireStyle",ZK="revka.workflowEditor.yamlPanelWidth",JK="revka.workflowEditor.detailsPanelWidth",UMe=320,KMe=760,P2=440,VMe=300,YMe=620,L2=352,OI=36,GMe=80,XMe=120,eV=[{value:"default",label:"Curved",title:"Curved Bezier wires"},{value:"straight",label:"Straight",title:"Direct straight wires"},{value:"step",label:"Angled",title:"Right-angle stepped wires"}],QMe={default:Va.Bezier,straight:Va.Straight,step:Va.Step};function ZMe(){if(typeof localStorage>"u")return"default";try{const e=localStorage.getItem(QK);return eV.some(n=>n.value===e)?e:"default"}catch{return"default"}}function Yx(e,n){return e.type===n?e:{...e,type:n}}function Fh(e,n){return e.map(r=>Yx(r,n))}function DI(e){return e.type!=="select"&&e.type!=="dimensions"}function JMe(e){if(!e||typeof e!="object")return!1;const n=e;return Number.isFinite(n.x)&&Number.isFinite(n.y)}function eRe(e,n,r){return OA(e)?n:rK(n,r)}function tRe(e,n,r){if(OA(n)||!e||typeof localStorage>"u")return r;try{const i=JSON.parse(localStorage.getItem(`wf-positions:${e}`)||"{}");return Object.keys(i).length===0?r:r.map(s=>{const a=i[s.id];return JMe(a)?{...s,position:{x:a.x,y:a.y}}:s})}catch{return r}}function Qm(e,n,r,i){return tRe(e,n,eRe(n,r,i))}function nRe(e,n,r){const i=Ho(e),s=lf(e),{nodes:a,edges:o}=md(i),l=Qm(r,i,a,o);return id(To(l,o),{...s,...n})}function tV(e){return Math.max(VMe,Math.min(YMe,Math.round(e)))}function nV(e){return Math.max(UMe,Math.min(KMe,Math.round(e)))}function rRe(){if(typeof localStorage>"u")return P2;try{const e=Number(localStorage.getItem(ZK));return Number.isFinite(e)?nV(e):P2}catch{return P2}}function iRe(){if(typeof localStorage>"u")return L2;try{const e=Number(localStorage.getItem(JK));return Number.isFinite(e)?tV(e):L2}catch{return L2}}function sRe(e){return e&&typeof e=="object"?e:{}}function rV(e){var a,o;const n=sRe(e),r=typeof((a=n.mark)==null?void 0:a.line)=="number"?n.mark.line+1:void 0,i=typeof((o=n.mark)==null?void 0:o.column)=="number"?n.mark.column+1:void 0,s=n.reason||n.message||(e instanceof Error?e.message:String(e));return{status:"invalid",message:r?`YAML syntax error at ${r}:${i??1}`:"YAML syntax error",detail:s,line:r,column:i}}function iV(e){if(!e.trim())return{status:"empty",message:"No YAML",detail:"The editor is empty."};try{const n=Ho(e);return n.length===0?{status:"invalid",message:"Valid YAML, but no workflow steps were found",detail:"Add a top-level steps list before applying this YAML to the graph."}:{status:"valid",message:`Valid YAML · ${n.length} ${n.length===1?"step":"steps"}`,taskCount:n.length}}catch(n){return rV(n)}}const aRe=xje(e=>{const n=iV(e.state.doc.toString());if(n.status==="valid"||n.status==="empty")return[];const r=Math.min(Math.max(n.line??1,1),e.state.doc.lines),i=e.state.doc.line(r),s=Math.max((n.column??1)-1,0),a=Math.min(i.to,i.from+s),o=Math.max(a,Math.min(i.to,a+1));return[{from:a,to:o,severity:"error",message:n.detail?`${n.message}: ${n.detail}`:n.message}]}),oRe=[PNe(),Aje(),aRe];function lRe(e){return e.trim().toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")||"step"}function cRe(e,n){const r=new Set(n),i=lRe(`${e}-copy`);if(!r.has(i))return i;let s=2;for(;r.has(`${i}-${s}`);)s+=1;return`${i}-${s}`}function sV(e){return JSON.parse(JSON.stringify(e))}function uRe(e,n){let r=e;for(const[i,s]of n)i!==s&&(r=XK(r,i,s));return r}function dRe(e,n,r=new Map){var o;const i=uRe(sV(e),r),s=(o=e.name)!=null&&o.trim()?`${e.name.trim()} Copy`:n,a=l=>l?r.get(l)??"":"";return{...i,taskId:n,label:s,name:s,dependencyCount:0,conditionalBranches:(i.conditionalBranches||[]).map(l=>({...l,goto:a(l.goto)})),gotoTarget:a(i.gotoTarget),humanApprovalOnRejectGoto:a(i.humanApprovalOnRejectGoto),forEachSteps:(i.forEachSteps||[]).map(l=>r.get(l)).filter(l=>!!l)}}function hRe(e,n){const r=new Map;for(const i of n)cf(i.sourceHandle)||r.set(i.target,(r.get(i.target)||0)+1);return e.map(i=>{const s=r.get(i.id)||0,a=i.data;return a.dependencyCount===s?i:{...i,data:{...a,dependencyCount:s}}})}function PI(e){return e?["completed","failed","cancelled","canceled","error","success"].includes(e.toLowerCase()):!1}function LI(e){const n=(e||"").toLowerCase();return["completed","success"].includes(n)?"var(--revka-signal-selected)":["failed","error","cancelled","canceled"].includes(n)?"var(--revka-status-danger)":["running","starting","queued","pending"].includes(n)?"var(--revka-signal-live)":"var(--revka-text-faint)"}function fRe(e){if(!e)return"";const n=new Date(e);return Number.isNaN(n.getTime())?e:n.toLocaleString()}function pRe(e){if(e==null)return null;try{const n=JSON.stringify(e,null,2);return n.length>1800?`${n.slice(0,1800)}
…`:n}catch{return null}}function mRe({workflow:e,onSave:n,onCancel:r,saving:i,mode:s,containerClassName:a}){const o=s??(e?"edit":"create"),l=typeof navigator<"u"&&/mac/i.test(navigator.platform),[u,d]=b.useState((e==null?void 0:e.name)??""),[p,f]=b.useState((e==null?void 0:e.description)??""),[g,_]=b.useState(e!=null&&e.tags?[...e.tags]:[]),[x,v]=b.useState(""),[S,w]=b.useState(null),[j,C]=b.useState(null),[T,E]=b.useState(!1),[A,O]=b.useState((e==null?void 0:e.definition)??""),[F,L]=b.useState(!1),[$,z]=b.useState(rRe),[B,H]=b.useState(!1),[D,U]=b.useState(ZMe),[I,X]=b.useState(iRe),[K,Q]=b.useState(!1),V=b.useRef(null),R=b.useRef(null),q=b.useRef(null),[W,te]=b.useState(!1),J=b.useRef(0),[G,re]=b.useState(null),ne=b.useMemo(()=>iV(A),[A]),[le,oe]=b.useState({name:"",version:"1.0",description:"",tags:[],triggers:[],inputs:[],outputs:[],defaultCwd:"",defaultTimeout:300,maxTotalTime:3600,checkpoint:!0}),[ie,he]=b.useState(null),[Z,de]=b.useState(!1),[ue,pe]=b.useState(!1),[Oe,fe]=b.useState(void 0),[Le,Ee]=b.useState(void 0),[Bt,Xe]=b.useState(null),[St,yt]=b.useState(null),[Rt,be]=b.useState(null),{agents:He}=sT(),ht=b.useRef(0),ot=b.useRef(null),$t=b.useRef(!1),{screenToFlowPosition:jn,fitView:Pn}=X0(),We=b.useRef(null),ut=b.useRef(null),Ct=b.useRef(null),Mt=b.useRef(null),Ge=b.useRef(""),tt=b.useRef(!0),[bt,Nt]=b.useState(!1),it=b.useCallback(()=>{tt.current||Nt(!0)},[]),{initialNodes:dt,initialEdges:Vt}=b.useMemo(()=>{if(!(e!=null&&e.definition))return{initialNodes:[],initialEdges:[]};const se=Ho(e.definition),ye=lf(e.definition);oe(ye);const{nodes:Ne,edges:Me}=md(se),Ue=Qm(e.name,se,Ne,Me);return ht.current=se.length,{initialNodes:Ue,initialEdges:Fh(Me,D)}},[e]),[jt,Ht,rr]=Rbe(dt),[Wt,Mn,ge]=Obe(Vt),Re=b.useCallback(se=>{it(),Ht(se)},[it,Ht]),et=b.useCallback(se=>{it(),Mn(se)},[it,Mn]),tn=b.useCallback(se=>{se.some(DI)&&it(),rr(se)},[it,rr]),Jt=b.useCallback(se=>{se.some(DI)&&it(),ge(se)},[it,ge]),Ft=b.useMemo(()=>qH(hRe(jt,Wt),He),[jt,Wt,He]),ir=Ft.length>GMe||Wt.length>XMe,xi=b.useMemo(()=>Wt.some(se=>se.animated)?Wt.map(se=>se.animated===!1?se:{...se,animated:!1}):Wt,[Wt]);b.useEffect(()=>{try{localStorage.setItem(QK,D)}catch{}Mn(se=>Fh(se,D))},[D,Mn]);const on=b.useMemo(()=>ie?Ft.find(se=>se.id===ie)??null:null,[ie,Ft]),qt=b.useMemo(()=>{const se=Ft.filter(ye=>ye.selected);return se.length>0?se:on?[on]:[]},[Ft,on]),P=b.useMemo(()=>{const se=Ft.map(Qe=>Qe.data.taskId).filter(Qe=>!!Qe),ye=le.inputs.map(Qe=>Qe.name).filter(Boolean),Ne=["entity_kref","kind","tag","name","metadata"],Me=new Set;for(const Qe of le.triggers)for(const mt of Object.keys(Qe.inputMap||{}))mt&&!mt.startsWith("__")&&Me.add(mt);const Ue=Array.from(new Set([...Ne,...Me]));return{stepIds:se,workflowInputs:ye,triggerFields:Ue}},[Ft,le.inputs,le.triggers]),Ie=b.useCallback(()=>{const se=We.current;if(!se)return{x:200,y:200};const ye=se.getBoundingClientRect();return jn({x:ye.left+ye.width/2,y:ye.top+ye.height/2})},[jn]),st=b.useCallback((se,ye)=>{const Ne=jn({x:se,y:ye});return ut.current=Ne,Ne},[jn]),Kt=b.useCallback((se,ye)=>{Mt.current={clientX:se,clientY:ye},Ct.current===null&&(Ct.current=window.requestAnimationFrame(()=>{Ct.current=null;const Ne=Mt.current;Mt.current=null,Ne&&st(Ne.clientX,Ne.clientY)}))},[st]);b.useEffect(()=>()=>{Ct.current!==null&&(window.cancelAnimationFrame(Ct.current),Ct.current=null)},[]),b.useEffect(()=>{try{localStorage.setItem(ZK,String($))}catch{}},[$]),b.useEffect(()=>{try{localStorage.setItem(JK,String(I))}catch{}},[I]);const jr=b.useCallback(se=>{se.preventDefault(),V.current={startX:se.clientX,startWidth:$},H(!0)},[$]),Zr=b.useCallback(se=>{se.preventDefault(),R.current={startX:se.clientX,startWidth:I},Q(!0)},[I]);b.useEffect(()=>{if(!B)return;const se=Ne=>{const Me=V.current;if(!Me)return;const Ue=Ne.clientX-Me.startX;z(nV(Me.startWidth+Ue))},ye=()=>{V.current=null,H(!1)};return window.addEventListener("mousemove",se),window.addEventListener("mouseup",ye),document.body.style.cursor="col-resize",document.body.style.userSelect="none",()=>{window.removeEventListener("mousemove",se),window.removeEventListener("mouseup",ye),document.body.style.cursor="",document.body.style.userSelect=""}},[B]),b.useEffect(()=>{if(!K)return;const se=Ne=>{const Me=R.current;if(!Me)return;const Ue=Ne.clientX-Me.startX;X(tV(Me.startWidth-Ue))},ye=()=>{R.current=null,Q(!1)};return window.addEventListener("mousemove",se),window.addEventListener("mouseup",ye),document.body.style.cursor="col-resize",document.body.style.userSelect="none",()=>{window.removeEventListener("mousemove",se),window.removeEventListener("mouseup",ye),document.body.style.cursor="",document.body.style.userSelect=""}},[K]);const ho=b.useCallback(()=>{if(qt.length===0)return;const se=new Set(qt.map(Ne=>Ne.id)),ye=qt.reduce((Ne,Me)=>({x:Math.min(Ne.x,Me.position.x),y:Math.min(Ne.y,Me.position.y)}),{x:Number.POSITIVE_INFINITY,y:Number.POSITIVE_INFINITY});q.current={nodes:qt.map(Ne=>({id:Ne.id,data:sV(Ne.data),nodeType:Ne.type,position:{...Ne.position}})),edges:Wt.filter(Ne=>se.has(Ne.source)&&se.has(Ne.target)).map(Ne=>({...Ne})),origin:ye},J.current=0,te(!0)},[Wt,qt]),hs=b.useCallback(se=>{var xn;const ye=q.current;if(!ye||ye.nodes.length===0)return;J.current+=1;const Ne=new Set(Ft.map(Lt=>Lt.data.taskId||Lt.id)),Me=new Map;for(const Lt of ye.nodes){const Rn=Lt.data.taskId||Lt.id||Lt.data.name||"step",mn=cRe(Rn,Ne);Ne.add(mn),Me.set(Lt.id,mn),Lt.data.taskId&&Me.set(Lt.data.taskId,mn)}const Ue=se?null:ut.current,Qe=OI*Math.max(0,J.current-1),mt=OI*J.current,ln=se??(Ue?{x:Ue.x+Qe,y:Ue.y+Qe}:{x:ye.origin.x+mt,y:ye.origin.y+mt}),Nn={x:ln.x-ye.origin.x,y:ln.y-ye.origin.y},en=ye.nodes.map(Lt=>{const Rn=Me.get(Lt.id),mn=dRe(Lt.data,Rn,Me),Nr=mn.type==="conditional"?"gateNode":Lt.nodeType||"taskNode";return{id:Rn,type:Nr,position:{x:Lt.position.x+Nn.x,y:Lt.position.y+Nn.y},data:mn,selected:!0}}),Dt=ye.edges.map(Lt=>{const Rn=Me.get(Lt.source),mn=Me.get(Lt.target);if(!Rn||!mn)return null;const Nr=Lt.sourceHandle??null,Gn=cf(Nr)?kS(Nr):pi.default,ki=Gn.stroke,vo=D2(Nr),yo={...Lt,id:`${Rn}->${Nr?Nr+"->":""}${mn}`,source:Rn,target:mn,type:D,animated:!1,selectable:!0,interactionWidth:20,style:Gn,markerEnd:{type:qa.ArrowClosed,color:ki},...vo?{label:vo,labelStyle:{fill:ki,fontSize:10,fontWeight:600}}:{label:void 0,labelStyle:void 0}};return Yx(yo,D)}).filter(Lt=>Lt!==null);Re(Lt=>[...Lt.map(Rn=>({...Rn,selected:!1})),...en]),Dt.length>0&&et(Lt=>[...Lt,...Dt]),he(((xn=en[en.length-1])==null?void 0:xn.id)??null),yt(null)},[Ft,et,Re,D]),ll=b.useCallback(()=>{const se=`wf-positions:${u}`,ye={};for(const Ne of jt)ye[Ne.id]=Ne.position;try{localStorage.setItem(se,JSON.stringify(ye))}catch{}},[jt,u]),fs=b.useCallback(se=>{var Nn,en;const ye=`step-${++ht.current}`,Ne=se.type==="conditional",Me=se.position??(()=>{const Dt=Ie();return{x:Dt.x-110,y:Dt.y-40}})(),Ue=MI(ye,RI(se.type));se.presetSkill&&!Ue.skills.includes(se.presetSkill)&&(Ue.skills=[...Ue.skills,se.presetSkill]);const Qe={id:ye,type:Ne?"gateNode":"taskNode",position:Me,data:Ue};let mt=null,ln=null;if((Nn=se.source)!=null&&Nn.taskId){const Dt=se.source.handle??null,xn=cf(Dt),Lt=xn?kS(Dt):pi.default,Rn=Lt.stroke,mn=D2(Dt);xn&&(ln=Dt),mt={id:`${se.source.taskId}->${Dt?Dt+"->":""}${ye}`,source:se.source.taskId,target:ye,sourceHandle:Dt,type:D,animated:!1,selectable:!0,interactionWidth:20,style:Lt,markerEnd:{type:qa.ArrowClosed,color:Rn},...mn?{label:mn,labelStyle:{fill:Rn,fontSize:10,fontWeight:600}}:{}}}else if((en=se.target)!=null&&en.taskId){const Dt=pi.default,xn=Dt.stroke;mt={id:`${ye}->${se.target.taskId}`,source:ye,target:se.target.taskId,sourceHandle:null,type:D,animated:!1,selectable:!0,interactionWidth:20,style:Dt,markerEnd:{type:qa.ArrowClosed,color:xn}}}Re(Dt=>[...mt&&ln?Dt.map(Lt=>Lt.id===mt.source?{...Lt,data:TI(Lt.data,ln,ye)}:Lt):Dt,Qe]),mt&&et(Dt=>[...Dt,Yx(mt,D)]),he(ye),se.type==="agent"&&requestAnimationFrame(()=>{const Dt=document.querySelector(`.react-flow__node[data-id="${ye}"] button[title^="No pool agent"], .react-flow__node[data-id="${ye}"] button[title^="Assigned"]`),xn=(Dt==null?void 0:Dt.getBoundingClientRect())??null;xn?KT({taskId:ye,anchorRect:xn}):be({taskId:ye,anchorRect:null,target:"assign"})})},[Ie,Re,et,D]);b.useEffect(()=>{const se=ye=>{const Ne=ye;Ne.detail&&fs(Ne.detail)};return window.addEventListener(ZN,se),()=>window.removeEventListener(ZN,se)},[fs]),b.useEffect(()=>{const se=ye=>{const Ne=ye;Ne.detail&&be({taskId:Ne.detail.taskId,anchorRect:Ne.detail.anchorRect,target:Ne.detail.target??"assign",participantIndex:Ne.detail.participantIndex})};return window.addEventListener(JN,se),()=>window.removeEventListener(JN,se)},[]),b.useEffect(()=>{if(tt.current=!0,Nt(!1),!(e!=null&&e.definition)){Ge.current="";return}try{const se=nRe(e.definition,{name:e.name,description:e.description},e.name);Ge.current=se}catch{Ge.current=e.definition}},[e==null?void 0:e.kref,e==null?void 0:e.definition,e==null?void 0:e.name,e==null?void 0:e.description]),b.useEffect(()=>{if(tt.current){tt.current=!1;return}Nt(!0)},[le,u,p,g]);const[Pi,Qi]=b.useState(null),[Fr,Vn]=b.useState(null);b.useEffect(()=>{if(!Fr)return;const se=Math.max(0,Fr.expiresAt-Date.now()),ye=setTimeout(()=>Vn(null),se);return()=>clearTimeout(ye)},[Fr]);const cl=b.useRef(()=>{});b.useEffect(()=>{const se=ye=>{const Ne=ye.target,Me=Ne&&(Ne.tagName==="INPUT"||Ne.tagName==="TEXTAREA"||Ne.tagName==="SELECT"||Ne.isContentEditable),Ue=l?ye.metaKey:ye.ctrlKey;if(Ue&&ye.key.toLowerCase()==="j"){ye.preventDefault(),pe(mt=>!mt);return}if(!Me){if(Ue&&ye.key.toLowerCase()==="c"&&qt.length>0){ye.preventDefault(),ho();return}if(Ue&&ye.key.toLowerCase()==="v"&&W){ye.preventDefault(),hs();return}Ue&&ye.key.toLowerCase()==="k"?(ye.preventDefault(),Ee(void 0),Xe(null),de(!0)):Ue&&ye.key.toLowerCase()==="i"&&(ye.preventDefault(),cl.current())}};return window.addEventListener("keydown",se),()=>window.removeEventListener("keydown",se)},[l,qt.length,ho,W,hs]);const lc=b.useCallback(se=>{if($t.current=!0,!se.source||!se.target||Wt.some(Dt=>Dt.source===se.source&&Dt.target===se.target&&Dt.sourceHandle===(se.sourceHandle??null)))return;const Ne=se.sourceHandle??null,Me=cf(Ne),Ue=Me?kS(Ne):pi.default,Qe=Ue.stroke,mt=D2(Ne),ln={id:`${se.source}->${Ne?Ne+"->":""}${se.target}`,source:se.source,sourceHandle:se.sourceHandle,target:se.target,type:D,animated:!1,selectable:!0,interactionWidth:20,style:Ue,markerEnd:{type:qa.ArrowClosed,color:Qe},...mt?{label:mt,labelStyle:{fill:Qe,fontSize:10,fontWeight:600}}:{}};et(Dt=>[...Dt,Yx(ln,D)]);const Nn=se.source,en=se.target;Re(Dt=>Dt.map(xn=>{var mn;if(Me&&xn.id===Nn)return{...xn,data:TI(xn.data,Ne,en)};if(xn.id!==en)return xn;const Lt=xn.data;let Rn=Lt;if(Nn!==en&&!Me){const Nr=PMe[Rn.type];if(Nr&&!LMe(Rn,Nn)){const Gn=Dt.find(Mu=>Mu.id===Nn),ki=(mn=Gn==null?void 0:Gn.data)==null?void 0:mn.type,vo=Rn[Nr]??"",yo=TMe(Nn,Rn.type,ki),Tu=vo.length===0?yo:`${vo}

${yo}`;Rn={...Rn,[Nr]:Tu}}}return Rn===Lt?xn:{...xn,data:Rn}}))},[Wt,et,Re,D]),Ls=b.useCallback((se,ye)=>{$t.current=!1,ye.nodeId&&ye.handleType&&(ot.current={nodeId:ye.nodeId,handleType:ye.handleType,handleId:ye.handleId||null})},[]),la=b.useCallback(se=>{var ln;const ye=ot.current;if(ot.current=null,!ye||$t.current)return;const Ne=se.target;if(Ne!=null&&Ne.closest(".react-flow__node")||Ne!=null&&Ne.closest(".react-flow__handle"))return;const Me="changedTouches"in se?(ln=se.changedTouches)==null?void 0:ln[0]:null,Ue=Me?Me.clientX:se.clientX,Qe=Me?Me.clientY:se.clientY,mt=st(Ue,Qe);if(ye.handleType==="source")Ee({position:mt,source:{taskId:ye.nodeId,handle:ye.handleId}});else if(ye.handleType==="target")Ee({position:mt,target:{taskId:ye.nodeId}});else return;Xe(null),de(!0)},[st]),Eu=b.useCallback(se=>{var Ue;const ye=new Map,Ne=new Map,Me=[];for(const Qe of se){const mt=Pv(Qe.sourceHandle);if(mt!==null){const Nn=ye.get(Qe.source)??new Set;Nn.add(mt),ye.set(Qe.source,Nn);continue}if((Ue=Qe.data)!=null&&Ue.synthetic){Me.push({source:Qe.source,target:Qe.target});continue}const ln=Ne.get(Qe.target)??new Set;ln.add(Qe.source),Ne.set(Qe.target,ln)}Re(Qe=>Qe.map(mt=>{const ln=ye.get(mt.id),Nn=Ne.get(mt.id);let en=mt.data;if(ln&&ln.size>0){let Dt=GK(en);Dt=Dt.map((xn,Lt)=>ln.has(Lt)?{...xn,goto:""}:xn),en={...en,...Vx(Dt)}}if(Nn&&Nn.size>0)for(const Dt of Nn)en=zMe(en,Dt);if(Me.length>0&&en.type==="for_each"&&en.forEachSteps.length>0){let Dt=en.forEachSteps;for(const xn of Me){const Lt=Dt.indexOf(xn.target);if(Lt<0)continue;const Rn=xn.source===mt.id&&Lt===0,mn=Lt>0&&Dt[Lt-1]===xn.source;!Rn&&!mn||(Dt=Dt.filter((Nr,Gn)=>Gn!==Lt))}Dt!==en.forEachSteps&&(en={...en,forEachSteps:Dt})}return en===mt.data?mt:{...mt,data:en}}))},[Re]),ul=b.useCallback((se,ye)=>{he(ye.id)},[]),Is=b.useCallback(()=>{he(null),yt(null)},[]),dl=b.useCallback(se=>{se.preventDefault();const ye=se.clientX,Ne=se.clientY,Me=st(ye,Ne);yt({screenX:ye,screenY:Ne,flowX:Me.x,flowY:Me.y})},[st]),hr=b.useCallback((se,ye)=>{Re(Ne=>Ne.map(Me=>Me.id===se?{...Me,data:{...Me.data,...ye}}:Me)),ye.conditionalBranches&&et(Ne=>{const Me=Ne.filter(Qe=>!(Qe.source===se&&cf(Qe.sourceHandle))),Ue=ye.conditionalBranches.map((Qe,mt)=>{if(!Qe.goto)return null;const ln=au(mt),Nn=Bf(Qe,mt),en=$0(Qe,mt);return{id:`${se}->${ln}->${Qe.goto}`,source:se,sourceHandle:ln,target:Qe.goto,type:D,animated:!1,selectable:!0,interactionWidth:20,style:Nn,markerEnd:{type:qa.ArrowClosed,color:Nn.stroke},label:en,labelStyle:{fill:Nn.stroke,fontSize:10,fontWeight:600}}}).filter(Qe=>Qe!==null);return[...Me,...Fh(Ue,D)]})},[Re,et,D]),Bs=b.useCallback((se,ye)=>{se!==ye&&(Re(Ne=>Ne.map(Me=>{var Nn;const Ue=XK(Me.data,se,ye),Qe=Me.id===se?{...Me,id:ye,data:{...Ue,taskId:ye,label:Ue.label===se?ye:Ue.label}}:{...Me,data:Ue},mt=Qe.data;if(!((Nn=mt.conditionalBranches)!=null&&Nn.some(en=>en.goto===se)))return Qe;const ln=mt.conditionalBranches.map(en=>en.goto===se?{...en,goto:ye}:en);return{...Qe,data:{...mt,...Vx(ln)}}})),et(Ne=>Ne.map(Me=>{const Ue={...Me};let Qe=!1;if(Me.source===se&&(Ue.source=ye,Qe=!0),Me.target===se&&(Ue.target=ye,Qe=!0),Qe){const mt=Me.sourceHandle?`${Me.sourceHandle}->`:"";Ue.id=`${Ue.source}->${mt}${Ue.target}`}return Ue})),ie===se&&he(ye))},[Re,et,ie]),Jr=b.useCallback(se=>{Re(ye=>ye.filter(Ne=>Ne.id!==se).map(Ne=>{var Qe;const Me=Ne.data;if(Me.type!=="conditional"||!((Qe=Me.conditionalBranches)!=null&&Qe.some(mt=>mt.goto===se)))return Ne;const Ue=Me.conditionalBranches.map(mt=>mt.goto===se?{...mt,goto:""}:mt);return{...Ne,data:{...Me,...Vx(Ue)}}})),et(ye=>ye.filter(Ne=>Ne.source!==se&&Ne.target!==se)),ie===se&&he(null)},[Re,et,ie]),li=b.useCallback((se,ye)=>{Re(Ne=>Ne.map(Me=>{if(Me.id!==se)return Me;const Ue=Me.data,Qe=MI(Ue.taskId,{...RI(ye),taskId:Ue.taskId,label:Ue.label,name:Ue.name,description:Ue.description,agentHints:Ue.agentHints,skills:Ue.skills,assign:Ue.assign,template:Ue.template,paramCount:Ue.paramCount,dependencyCount:Ue.dependencyCount,retry:Ue.retry,retryDelay:Ue.retryDelay,channels:Ue.channels,channel:Ue.channel});return{...Me,type:ye==="conditional"?"gateNode":"taskNode",data:Qe}}))},[Re]),fo=b.useCallback((se,ye,Ne)=>{var Ue,Qe;const Me=(Ue=jt.find(mt=>mt.id===se))==null?void 0:Ue.data;if(Me)switch(ye){case"assign":return Me.assign||void 0;case"groupChatParticipant":return Ne===void 0?void 0:((Qe=Me.groupChatParticipants)==null?void 0:Qe[Ne])||void 0;case"groupChatModerator":return Me.groupChatModerator||void 0;case"supervisorAgent":return Me.supervisorType||void 0;case"supervisorTemplate":return;case"handoffTo":return Me.handoffTo||void 0;case"a2aSkill":return Me.a2aSkillId||void 0;case"mapReduceMapper":return Me.mapReduceMapper||void 0;case"mapReduceReducer":return Me.mapReduceReducer||void 0}},[jt]),Au=b.useCallback((se,ye)=>{var Ue;const Ne=(Ue=jt.find(Qe=>Qe.id===se.taskId))==null?void 0:Ue.data,Me=ye?He.find(Qe=>Qe.item_name===ye):void 0;if(Ne){if(se.target==="assign"){if(ye===null){hr(se.taskId,{assign:""});return}hr(se.taskId,{assign:ye,agentType:(Me==null?void 0:Me.agent_type)||Ne.agentType||"claude",role:(Me==null?void 0:Me.role)||Ne.role||"coder"});return}if(se.target==="groupChatParticipant"){const Qe=[...Ne.groupChatParticipants||[]];se.participantIndex===void 0?ye&&!Qe.includes(ye)&&Qe.push(ye):ye===null?Qe.splice(se.participantIndex,1):Qe[se.participantIndex]=ye,hr(se.taskId,{groupChatParticipants:Qe.filter(Boolean)});return}if(se.target==="groupChatModerator"){hr(se.taskId,{groupChatModerator:ye??"claude"});return}if(se.target==="supervisorAgent"){hr(se.taskId,{supervisorType:ye??"claude"});return}if(se.target==="supervisorTemplate"){if(!ye)return;const Qe=[...Ne.supervisorTemplates||[]];Qe.includes(ye)||Qe.push(ye),hr(se.taskId,{supervisorTemplates:Qe});return}if(se.target==="handoffTo"){hr(se.taskId,{handoffTo:ye??"codex"});return}if(se.target==="a2aSkill"){hr(se.taskId,{a2aSkillId:ye??""});return}if(se.target==="mapReduceMapper"){hr(se.taskId,{mapReduceMapper:ye??"claude"});return}se.target==="mapReduceReducer"&&hr(se.taskId,{mapReduceReducer:ye??"claude"})}},[hr,jt,He]),bi=b.useCallback(se=>{Ee(se?{position:se}:void 0),Xe(null),de(!0)},[]),po=b.useCallback(()=>{Re(se=>rK([...se],Wt)),requestAnimationFrame(()=>{try{Pn({padding:.2,duration:240})}catch{}})},[Wt,Re,Pn]),ae=b.useCallback(()=>{try{Pn({padding:.2,duration:240})}catch{}},[Pn]),Ce=b.useCallback(()=>{if(ne.status!=="valid"){w(ne.detail?`${ne.message}: ${ne.detail}`:ne.message);return}try{const se=Ho(A);if(se.length===0){w('No tasks found in YAML. Ensure the YAML has a "steps:" section.');return}const ye=lf(A);oe(ye);const{nodes:Ne,edges:Me}=md(se),Ue=ye.name||u,Qe=ye.description||p,mt=Qm(Ue,se,Ne,Me);Re(mt),et(Fh(Me,D)),d(Ue),f(Qe),_(ye.tags),ht.current=se.length,O(id(To(mt,Me),{...ye,name:Ue,description:Qe})),L(!1),E(!1),w(null)}catch(se){const ye=rV(se);w(ye.detail?`${ye.message}: ${ye.detail}`:ye.message)}},[A,ne,u,p,Re,et,D]),at=b.useCallback(()=>{const se=To(jt,Wt);O(id(se,{...le,name:u,description:p})),L(!1),E(!0)},[jt,Wt,le,u,p]);cl.current=at;const Ot=se=>{if(se.key==="Enter"||se.key===","){se.preventDefault();const ye=x.trim().toLowerCase();ye&&!g.includes(ye)&&_(Ne=>[...Ne,ye]),v("")}se.key==="Backspace"&&x===""&&g.length>0&&_(ye=>ye.slice(0,-1))},Yn=b.useMemo(()=>{if(!ue)return Ge.current;const se=To(jt,Wt);return id(se,{...le,name:u,description:p})},[ue,jt,Wt,le,u,p]),Li=b.useMemo(()=>{const se=To(jt,Wt);return bpe(se)},[jt,Wt]),Ii=Li[0],gp=Ii?Li.length===1?Ii.message:`${Ii.message} (+${Li.length-1} more)`:null,Xd=b.useMemo(()=>VNe(jt,Wt),[jt,Wt]),mo=b.useCallback(async se=>{try{const ye=await x0(se.revision_kref),Ne=ye.definition??"",Me=Ho(Ne),Ue=lf(Ne),{nodes:Qe,edges:mt}=md(Me),ln=ye.name??se.name,Nn=ye.description??"",en=Qm(ln,Me,Qe,mt),Dt=To(en,mt),xn=To(Ft,Wt),Lt=new Map(xn.map(Gn=>[Gn.id,JSON.stringify(Gn)])),Rn=new Set;for(const Gn of Dt){const ki=Lt.get(Gn.id);(ki===void 0||ki!==JSON.stringify(Gn))&&Rn.add(Gn.id)}const mn=en.map(Gn=>Rn.has(Gn.id)?{...Gn,data:{...Gn.data,justUpdated:!0}}:Gn),Nr=id(Dt,{...Ue,name:ln,description:Nn});Ge.current=Nr,tt.current=!0,Nt(!1),Ht(mn),Mn(Fh(mt,D)),oe(Ue),d(ln),f(Nn),L(!1),ht.current=Me.length,Qi(null),Vn({publishedAt:se.published_at,expiresAt:Date.now()+4e3}),Rn.size>0&&setTimeout(()=>{Ht(Gn=>Gn.map(ki=>{const vo=ki.data;if(!vo.justUpdated)return ki;const{justUpdated:yo,...Tu}=vo;return{...ki,data:Tu}}))},1200)}catch(ye){C(`Couldn't apply remote update: ${ye instanceof Error?ye.message:String(ye)}`)}},[Ft,Wt,Ht,Mn,D]),ey=b.useRef(bt);ey.current=bt;const vp=b.useRef(mo);vp.current=mo,RMe({workflowKref:(e==null?void 0:e.kref)??null,onRevisionPublished:b.useCallback(se=>{ey.current?Qi(se):vp.current(se)},[])});const ty=b.useCallback((se,ye)=>{try{const Ne=Ho(se),Me=lf(se),{nodes:Ue,edges:Qe}=md(Ne),mt=Me.name||u,ln=Qm(mt,Ne,Ue,Qe);Re(ln),et(Fh(Qe,D)),oe(Me),Me.name&&d(Me.name),Me.description&&f(Me.description),L(!1),ht.current=Ne.length,w(null),Vn({publishedAt:ye||new Date().toISOString(),expiresAt:Date.now()+4e3})}catch(Ne){C(`Couldn't apply Architect proposal: ${Ne instanceof Error?Ne.message:String(Ne)}`)}},[u,Re,et,D]),yp=b.useCallback(async()=>{if(w(null),C(null),!u.trim())return w("Workflow name is required.");if(!p.trim())return w("Workflow description is required.");if(Ft.length===0)return w("Add at least one step to the workflow.");if(Xd)return w("Cannot save: workflow has cycles.");if(F)return w("Apply the YAML changes to the graph before saving.");const se=To(jt,Wt),ye=id(se,{...le,name:u.trim(),description:p.trim()});try{await n({name:u.trim(),description:p.trim(),definition:ye,version:le.version||"",tags:g}),Ge.current=ye,Nt(!1),r()}catch(Ne){const Me=Ne instanceof Error?Ne.message:"Save failed.";w(Me)}},[u,p,g,Ft.length,jt,Wt,le,F,Xd,n,r]);b.useEffect(()=>{if(T&&!F){const se=To(jt,Wt);O(id(se,{...le,name:u,description:p}))}},[T,F,jt,Wt,le,u,p]);const Ek=b.useCallback(se=>{const ye=To(Ft,Wt);return Ope(ye,se)},[Ft,Wt]),Ak=b.useCallback(async se=>{const ye=(e==null?void 0:e.name)??u;if(!ye){w('Save the workflow before using "Run to here".');return}re({open:!0,workflowName:ye,targetStepId:se,status:"starting",startedAt:new Date().toISOString()});try{const Ne=await lz(ye,void 0,void 0,{targetStepId:se});re(Me=>({open:!0,workflowName:Ne.workflow||(Me==null?void 0:Me.workflowName)||ye,targetStepId:se,status:Ne.status||"running",runId:Ne.run_id,startedAt:(Me==null?void 0:Me.startedAt)??new Date().toISOString(),detail:Me==null?void 0:Me.detail}))}catch(Ne){const Me=Ne instanceof Error?Ne.message:"Run-to-here failed.";w(Me),re(Ue=>({open:!0,workflowName:(Ue==null?void 0:Ue.workflowName)||ye,targetStepId:se,status:"failed",startedAt:(Ue==null?void 0:Ue.startedAt)??new Date().toISOString(),error:Me}))}},[e==null?void 0:e.name,u]),Qd=b.useCallback(async()=>{const se=G==null?void 0:G.runId;if(se)try{const ye=await Do(se);re(Ne=>(Ne==null?void 0:Ne.runId)===se?{...Ne,detail:ye,status:ye.status||Ne.status,error:void 0}:Ne)}catch(ye){const Ne=ye instanceof Error?ye.message:"Failed to load run log.";re(Me=>(Me==null?void 0:Me.runId)===se?{...Me,error:Ne}:Me)}},[G==null?void 0:G.runId]),ca=!!(G!=null&&G.detail);b.useEffect(()=>{const se=G==null?void 0:G.runId;if(!(G!=null&&G.open)||!se||PI(G.status)&&ca)return;let ye=!1;const Ne=async()=>{try{const Ue=await Do(se);if(ye)return;re(Qe=>(Qe==null?void 0:Qe.runId)===se?{...Qe,detail:Ue,status:Ue.status||Qe.status,error:void 0}:Qe)}catch(Ue){if(ye)return;const Qe=Ue instanceof Error?Ue.message:"Waiting for run log...";re(mt=>(mt==null?void 0:mt.runId)===se?{...mt,error:Qe}:mt)}};Ne();const Me=window.setInterval(()=>void Ne(),2e3);return()=>{ye=!0,window.clearInterval(Me)}},[G==null?void 0:G.open,G==null?void 0:G.runId,G==null?void 0:G.status,ca]);const _p=Ft.length===0,Zd=!!(G!=null&&G.open&&!PI(G.status)),Ia=ne.status!=="valid",go=ne.status==="valid"?"var(--revka-status-success)":ne.status==="empty"?"var(--revka-status-warning)":"var(--revka-status-danger)";return c.jsxs("div",{className:`editor-chrome ${a??"flex h-[calc(100vh-3.5rem)] flex-col"}`,style:{background:"var(--revka-bg-base, var(--pc-bg-base))"},children:[c.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12,padding:"10px 20px",borderBottom:"1px solid var(--revka-border-soft)",background:"var(--revka-bg-surface)"},children:[c.jsx("button",{type:"button",onClick:r,title:"Back",style:{display:"inline-flex",alignItems:"center",justifyContent:"center",width:32,height:32,borderRadius:8,border:"1px solid var(--revka-border-soft)",background:"transparent",color:"var(--revka-text-secondary)",cursor:"pointer"},children:c.jsx(nee,{size:16})}),c.jsxs("div",{style:{display:"flex",flex:1,minWidth:0,gap:12,alignItems:"center"},children:[c.jsx("input",{type:"text",value:u,onChange:se=>d(se.target.value),placeholder:"Workflow name",disabled:o==="edit",style:{background:"transparent",border:0,outline:"none",fontSize:16,fontWeight:700,color:"var(--revka-text-primary)",minWidth:180,maxWidth:320}}),c.jsx("input",{type:"text",value:p,onChange:se=>f(se.target.value),placeholder:"Description",style:{background:"transparent",border:0,outline:"none",fontSize:13,color:"var(--revka-text-secondary)",flex:1,minWidth:0}}),Fr?c.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6,padding:"3px 8px",borderRadius:999,border:"1px solid var(--revka-border-soft)",background:"var(--revka-signal-network-soft)",color:"var(--revka-signal-network)",fontSize:11,fontWeight:600,whiteSpace:"nowrap"},title:`Updated at ${Fr.publishedAt}`,children:[c.jsx("span",{"aria-hidden":!0,style:{width:6,height:6,borderRadius:"50%",background:"var(--revka-signal-network)"}}),c.jsx(eb,{size:11}),"Operator edited · ",AI(Fr.publishedAt)]}):null]}),c.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[e&&c.jsxs("span",{style:{fontFamily:"var(--pc-font-mono, ui-monospace, monospace)",fontSize:11,padding:"2px 8px",borderRadius:6,color:"var(--revka-text-faint)",background:"var(--pc-bg-input)"},children:["rev ",e.revision_number]}),c.jsxs("div",{style:{display:"flex",alignItems:"center",gap:4,padding:"4px 8px",borderRadius:8,border:"1px solid var(--pc-border)",background:"var(--pc-bg-input)",minWidth:120,maxWidth:240,flexWrap:"wrap"},children:[g.map(se=>c.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:2,padding:"2px 6px",borderRadius:4,fontSize:10,fontWeight:500,background:"var(--pc-accent-glow)",color:"var(--pc-accent-light)"},children:[se,c.jsx("button",{type:"button",onClick:()=>_(ye=>ye.filter(Ne=>Ne!==se)),style:{background:"transparent",border:0,color:"inherit",cursor:"pointer",padding:0},children:c.jsx(vi,{size:9})})]},se)),c.jsx("input",{type:"text",value:x,onChange:se=>v(se.target.value),onKeyDown:Ot,placeholder:g.length===0?"Tags…":"",style:{flex:1,minWidth:40,background:"transparent",border:0,outline:"none",fontSize:11,color:"var(--pc-text-primary)"}})]}),c.jsx("button",{type:"button",onClick:r,className:"revka-button",style:{padding:"6px 12px",fontSize:12},children:"Cancel"}),c.jsx("button",{type:"button",onClick:yp,disabled:i,className:"revka-button","data-variant":"primary",style:{padding:"6px 14px",fontSize:12,fontWeight:600},children:i?"Saving…":o==="edit"?"Update":o==="duplicate"?"Create Copy":"Save"})]})]}),S&&c.jsxs("div",{style:{margin:"8px 20px 0",padding:"8px 12px",borderRadius:10,border:"1px solid color-mix(in srgb, var(--revka-status-danger) 32%, transparent)",background:"color-mix(in srgb, var(--revka-status-danger) 10%, transparent)",color:"var(--revka-status-danger)",fontSize:13,display:"flex",alignItems:"center",justifyContent:"space-between"},children:[c.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6},children:[c.jsx(As,{size:14}),S]}),c.jsx("button",{onClick:()=>w(null),style:{background:"transparent",border:0,color:"inherit",cursor:"pointer"},children:c.jsx(vi,{size:14})})]}),j&&c.jsxs("div",{style:{margin:"8px 20px 0",padding:"8px 12px",borderRadius:10,border:"1px solid color-mix(in srgb, var(--revka-status-warning) 32%, transparent)",background:"color-mix(in srgb, var(--revka-status-warning) 10%, transparent)",color:"var(--revka-status-warning)",fontSize:13},children:[c.jsx(As,{size:14,style:{display:"inline",marginRight:6}}),j]}),gp&&c.jsxs("div",{style:{margin:"8px 20px 0",padding:"8px 12px",borderRadius:10,border:"1px solid color-mix(in srgb, var(--revka-status-warning) 32%, transparent)",background:"color-mix(in srgb, var(--revka-status-warning) 10%, transparent)",color:"var(--revka-status-warning)",fontSize:13},children:[c.jsx(As,{size:14,style:{display:"inline",marginRight:6}}),"Missing output contract: ",gp]}),Pi?c.jsxs("div",{className:"revka-panel","data-variant":"utility",style:{margin:"8px 20px 0",padding:"10px 14px",display:"flex",alignItems:"center",gap:12,flexWrap:"wrap"},children:[c.jsx(eb,{size:14,style:{color:"var(--revka-signal-network)"}}),c.jsxs("span",{style:{flex:1,fontSize:13,color:"var(--revka-text-primary)",minWidth:0},children:["Operator updated this workflow",Pi.published_at?` ${AI(Pi.published_at)}`:""," — your edits aren't saved yet."]}),c.jsx("button",{type:"button",className:"revka-button","data-variant":"primary",onClick:()=>{Pi&&mo(Pi)},style:{padding:"4px 12px",fontSize:12,fontWeight:600},children:"Apply"}),c.jsx("button",{type:"button",className:"revka-button",onClick:()=>Qi(null),style:{padding:"4px 12px",fontSize:12},children:"Keep mine"})]}):null,c.jsxs("div",{style:{display:"grid",gridTemplateColumns:`minmax(0, 1fr) 12px ${I}px`,gap:0,padding:12,flex:1,minHeight:0},children:[c.jsx(qe,{className:"overflow-hidden",children:c.jsxs("div",{style:{display:"flex",flexDirection:"column",height:"100%"},children:[c.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"10px 12px",borderBottom:"1px solid var(--revka-border-soft)"},children:[c.jsx("div",{className:"revka-kicker",children:"Graph"}),c.jsxs("span",{style:{fontSize:11,color:"var(--revka-text-faint)",marginLeft:6},children:[Ft.length," step",Ft.length===1?"":"s"," · ",Wt.length," edge",Wt.length===1?"":"s",Xd?c.jsxs(c.Fragment,{children:[" · ",c.jsx("span",{style:{color:"var(--revka-status-danger)"},children:"cycle detected"})]}):null]}),c.jsx("div",{style:{flex:1}}),c.jsx("div",{role:"group","aria-label":"Wire style",title:"Wire style",style:{display:"inline-flex",alignItems:"center",padding:2,gap:2,borderRadius:8,border:"1px solid var(--revka-border-soft)",background:"var(--revka-bg-panel)"},children:eV.map(se=>c.jsx("button",{type:"button",onClick:()=>U(se.value),className:"revka-button","data-variant":D===se.value?"primary":void 0,title:se.title,"aria-pressed":D===se.value,style:{padding:"4px 8px",fontSize:11,border:0,minWidth:0},children:se.label},se.value))}),c.jsx("button",{type:"button",onClick:ho,disabled:qt.length===0,className:"revka-button","aria-label":"Copy selected steps",title:`Copy selected step${qt.length>1?"s":""} (${l?"⌘":"Ctrl"}+C)`,style:{width:32,height:32,padding:0,justifyContent:"center",opacity:qt.length>0?1:.48,cursor:qt.length>0?"pointer":"not-allowed"},children:c.jsx(rc,{size:14})}),c.jsx("button",{type:"button",onClick:()=>hs(),disabled:!W,className:"revka-button","aria-label":"Paste step",title:`Paste step (${l?"⌘":"Ctrl"}+V)`,style:{width:32,height:32,padding:0,justifyContent:"center",opacity:W?1:.48,cursor:W?"pointer":"not-allowed"},children:c.jsx(hee,{size:14})}),c.jsxs("button",{type:"button",onClick:()=>bi(),className:"revka-button","data-variant":"primary",title:`Add Step (${l?"⌘":"Ctrl"}+K)`,style:{padding:"6px 12px",fontSize:12,fontWeight:600},children:[c.jsx(ls,{size:14}),"Add Step"]}),c.jsx("button",{type:"button",onClick:po,className:"revka-button",title:"Auto-layout",style:{padding:"6px 10px"},children:c.jsx(yz,{size:14})}),c.jsx("button",{type:"button",onClick:ae,className:"revka-button",title:"Fit to view",style:{padding:"6px 10px"},children:c.jsx(IE,{size:14})}),c.jsx("button",{type:"button",onClick:()=>E(se=>!se),className:"revka-button","data-variant":T?"primary":void 0,title:"Toggle YAML",style:{padding:"6px 10px"},children:c.jsx(mee,{size:14})}),c.jsx("button",{type:"button",onClick:()=>pe(se=>!se),className:"revka-button","data-variant":ue?"primary":void 0,title:e!=null&&e.kref?`Architect (${l?"⌘":"Ctrl"}+J)`:"Architect — save the workflow first to start revising",style:{padding:"6px 10px"},children:c.jsx(Tz,{size:14})})]}),e!=null&&e.kref?c.jsx(EMe,{workflowKref:e.kref}):null,c.jsxs("div",{style:{display:"flex",flex:1,minHeight:0},children:[T&&c.jsxs(c.Fragment,{children:[c.jsxs("div",{style:{width:$,flexShrink:0,borderRight:"1px solid var(--revka-border-soft)",display:"flex",flexDirection:"column",minHeight:0,background:"var(--revka-bg-surface)"},children:[c.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:12,padding:"8px 12px",borderBottom:"1px solid var(--revka-border-soft)"},children:[c.jsx("span",{className:"revka-kicker",children:"YAML"}),c.jsxs("button",{type:"button",onClick:Ce,className:"revka-button","data-variant":"primary",disabled:Ia,title:Ia?ne.message:"Apply YAML to graph",style:{padding:"4px 10px",fontSize:11,opacity:Ia?.55:1,cursor:Ia?"not-allowed":"pointer"},children:[c.jsx(A0,{size:12}),"Apply to graph"]})]}),F?c.jsx("div",{className:"border-b px-3 py-2 text-xs",style:{borderColor:"var(--revka-border-soft)",color:"var(--revka-status-warning)",background:"color-mix(in srgb, var(--revka-status-warning) 8%, transparent)"},children:"YAML edits are not saved until applied to the graph."}):null,c.jsxs("div",{style:{borderBottom:"1px solid var(--revka-border-soft)",padding:"8px 12px",background:"color-mix(in srgb, var(--revka-bg-elevated) 70%, transparent)"},children:[c.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,color:go,fontSize:11,fontWeight:600},children:[c.jsx("span",{"aria-hidden":"true",style:{width:7,height:7,borderRadius:999,background:go,boxShadow:`0 0 8px ${go}`,flexShrink:0}}),c.jsx("span",{children:ne.message})]}),ne.detail&&ne.status!=="valid"?c.jsx("div",{style:{marginTop:6,color:"var(--revka-text-secondary)",fontFamily:"var(--pc-font-mono, ui-monospace, monospace)",fontSize:10.5,lineHeight:1.45,overflowWrap:"anywhere"},children:ne.detail}):null]}),c.jsx("div",{style:{flex:1,minHeight:0},children:c.jsx(GU,{value:A,height:"100%",extensions:oRe,basicSetup:{lineNumbers:!0,foldGutter:!0,highlightActiveLine:!0,highlightSelectionMatches:!0,closeBrackets:!0,autocompletion:!0},theme:"dark",className:"workflow-yaml-editor",onChange:se=>{O(se),L(!0)}})})]}),c.jsx("div",{role:"separator","aria-orientation":"vertical","aria-label":"Resize YAML panel",title:"Resize YAML panel",onMouseDown:jr,style:{cursor:"col-resize",display:"flex",alignItems:"stretch",justifyContent:"center",padding:"0 5px",flexShrink:0,borderRight:"1px solid var(--revka-border-soft)",background:"var(--revka-bg-surface)"},children:c.jsx("div",{style:{width:2,borderRadius:999,background:B?"var(--pc-accent)":"var(--revka-border-soft)"}})})]}),c.jsxs("div",{ref:We,className:"revka-graph",style:{flex:1,position:"relative"},onMouseMove:se=>{Kt(se.clientX,se.clientY)},onMouseDown:se=>{st(se.clientX,se.clientY)},onContextMenu:se=>{const ye=se.target;ye.closest(".react-flow__node")||ye.closest(".react-flow__handle")||dl(se)},children:[c.jsxs(EH,{nodes:Ft,edges:xi,onNodesChange:tn,onEdgesChange:Jt,onConnect:lc,onConnectStart:Ls,onConnectEnd:la,onEdgesDelete:Eu,onNodeClick:ul,onSelectionChange:({nodes:se})=>{var ye;se.length===0?he(null):he(((ye=se[se.length-1])==null?void 0:ye.id)??null)},onNodeDragStop:ll,onPaneClick:Is,nodeTypes:OMe,connectionLineType:QMe[D],fitView:!0,onlyRenderVisibleElements:ir,elementsSelectable:!0,edgesFocusable:!0,deleteKeyCode:["Backspace","Delete"],style:{background:"transparent"},defaultEdgeOptions:{type:D,animated:!1,selectable:!0,style:pi.default,markerEnd:{type:qa.ArrowClosed,color:pi.default.stroke},interactionWidth:20},children:[c.jsx(TH,{color:"var(--revka-grid-line, var(--pc-border))",gap:20,size:1}),c.jsx(RH,{showInteractive:!1,style:{background:"var(--revka-bg-panel-strong)",borderColor:"var(--revka-border-soft)",borderRadius:12,overflow:"hidden"}}),Ft.length>0&&Ft.length<=40&&c.jsx(DH,{position:"bottom-right",pannable:!0,zoomable:!0,style:{background:"var(--revka-bg-panel-strong)",border:"1px solid var(--revka-border-soft)",borderRadius:12,width:200,height:140},maskColor:"rgba(0,0,0,0.32)",nodeColor:()=>LH("var(--revka-signal-selected)")})]}),_p&&c.jsx(GNe,{onAddStep:()=>bi(),onImportYaml:at,onGenerate:()=>{fe("Describe the workflow you want to build…"),pe(!0)}}),St&&c.jsx(gRe,{state:St,canPaste:W,onClose:()=>yt(null),onAddStep:()=>{const se=St;yt(null),bi({x:se.flowX,y:se.flowY})},onPaste:()=>{const se=St;hs({x:se.flowX,y:se.flowY})},onAutoLayout:()=>{yt(null),po()},onFitToView:()=>{yt(null),ae()},isMac:l})]})]})]})}),c.jsx("div",{role:"separator","aria-orientation":"vertical","aria-label":"Resize step details panel",title:"Resize step details panel",onMouseDown:Zr,style:{cursor:"col-resize",display:"flex",alignItems:"stretch",justifyContent:"center",padding:"0 5px"},children:c.jsx("div",{style:{width:2,borderRadius:999,background:K?"var(--pc-accent)":"var(--revka-border-soft)"}})}),on?c.jsx(ZTe,{node:on,existingTaskIds:Ft.map(se=>se.data.taskId),onUpdate:hr,onRenameStep:Bs,onDelete:Jr,onChangeType:()=>{Xe(on.id),Ee(void 0),de(!0)},dagContext:P,onRunToHere:Ak,computeRunToHereClosure:Ek,runToHereDisabled:!(e!=null&&e.name)&&!u||bt||Zd,runToHereDisabledReason:bt?"Save your edits first — Run to here uses the saved revision.":Zd?"A Run to here request is already in progress.":void 0}):c.jsx(yRe,{meta:le,setMeta:oe})]}),c.jsx(tMe,{open:Z,onOpenChange:se=>{de(se),se||Xe(null)},context:Le,onSelect:Bt?se=>{li(Bt,se)}:void 0}),c.jsx(_Me,{open:ue,onOpenChange:se=>{pe(se),se||fe(void 0)},workflowKref:(e==null?void 0:e.kref)??null,workflowName:(e==null?void 0:e.name)??u??null,currentYaml:Yn,onYamlProposed:ty,initialPrompt:Oe}),G!=null&&G.open?c.jsx(qMe,{runLog:G,onClose:()=>re(null),onRefresh:Qd}):null,c.jsx(fMe,{open:Rt!==null,onOpenChange:se=>{se||be(null)},value:Rt?fo(Rt.taskId,Rt.target,Rt.participantIndex):void 0,anchorRect:(Rt==null?void 0:Rt.anchorRect)??null,onSelect:se=>{Rt&&Au(Rt,se)}})]})}function gRe({state:e,canPaste:n,onClose:r,onAddStep:i,onPaste:s,onAutoLayout:a,onFitToView:o,isMac:l}){return b.useEffect(()=>{const u=()=>r();return window.addEventListener("mousedown",u),()=>window.removeEventListener("mousedown",u)},[r]),c.jsxs("div",{onMouseDown:u=>u.stopPropagation(),style:{position:"fixed",left:e.screenX,top:e.screenY,zIndex:50,minWidth:200,padding:4,borderRadius:10,border:"1px solid var(--revka-border-strong)",background:"var(--revka-bg-panel-strong)",boxShadow:"0 12px 32px rgba(0,0,0,0.32)"},children:[c.jsx(sx,{onClick:i,label:"Add Step",shortcut:`${l?"⌘":"Ctrl"} K`}),c.jsx(sx,{onClick:s,label:"Paste Step",shortcut:`${l?"⌘":"Ctrl"} V`,disabled:!n}),c.jsx(vRe,{}),c.jsx(sx,{onClick:a,label:"Auto-layout"}),c.jsx(sx,{onClick:o,label:"Fit to View"})]})}function sx({onClick:e,label:n,shortcut:r,disabled:i}){return c.jsxs("button",{type:"button",onClick:i?void 0:e,disabled:i,style:{width:"100%",display:"flex",alignItems:"center",gap:8,padding:"6px 10px",borderRadius:8,border:0,background:"transparent",color:i?"var(--revka-text-faint)":"var(--revka-text-primary)",fontSize:12,textAlign:"left",cursor:i?"not-allowed":"pointer"},onMouseEnter:s=>{i||(s.currentTarget.style.background="var(--pc-hover)")},onMouseLeave:s=>s.currentTarget.style.background="transparent",children:[c.jsx("span",{style:{flex:1},children:n}),r?c.jsx("span",{style:{fontFamily:"var(--pc-font-mono, ui-monospace, monospace)",fontSize:10,color:"var(--revka-text-faint)"},children:r}):null]})}function vRe(){return c.jsx("div",{style:{height:1,margin:"4px 6px",background:"var(--revka-border-soft)"}})}function yRe({meta:e,setMeta:n}){const r={display:"block",fontSize:10,fontWeight:700,textTransform:"uppercase",letterSpacing:"0.08em",color:"var(--pc-text-faint)",marginBottom:4},i={width:"100%",padding:"6px 8px",borderRadius:8,border:"1px solid var(--pc-border)",background:"var(--pc-bg-input)",color:"var(--pc-text-primary)",fontSize:12,outline:"none"};return c.jsx(qe,{variant:"primary",className:"overflow-hidden",children:c.jsxs("div",{style:{display:"flex",flexDirection:"column",height:"100%"},children:[c.jsx("div",{style:{padding:"14px 16px",borderBottom:"1px solid var(--revka-border-soft)"},children:c.jsx("div",{className:"revka-kicker",children:"Workflow Settings"})}),c.jsxs("div",{style:{overflowY:"auto",padding:16,display:"flex",flexDirection:"column",gap:14},children:[c.jsxs("div",{children:[c.jsx("label",{style:r,children:"Version"}),c.jsx("input",{type:"text",value:e.version,onChange:s=>n(a=>({...a,version:s.target.value})),style:i})]}),c.jsxs("div",{style:{display:"flex",gap:8},children:[c.jsxs("div",{style:{flex:1},children:[c.jsx("label",{style:r,children:"Step Timeout (s)"}),c.jsx("input",{type:"number",value:e.defaultTimeout,onChange:s=>n(a=>({...a,defaultTimeout:parseInt(s.target.value)||300})),style:i})]}),c.jsxs("div",{style:{flex:1},children:[c.jsx("label",{style:r,children:"Max Total (s)"}),c.jsx("input",{type:"number",value:e.maxTotalTime,onChange:s=>n(a=>({...a,maxTotalTime:parseInt(s.target.value)||3600})),style:i})]})]}),c.jsxs("label",{style:{display:"inline-flex",alignItems:"center",gap:6,cursor:"pointer"},children:[c.jsx("input",{type:"checkbox",checked:e.checkpoint,onChange:s=>n(a=>({...a,checkpoint:s.target.checked})),style:{accentColor:"var(--pc-accent)"}}),c.jsx("span",{style:{fontSize:12,color:"var(--pc-text-muted)"},children:"Enable checkpoints"})]}),c.jsx(I2,{kicker:"Triggers",count:e.triggers.length,addSlot:c.jsxs("div",{style:{display:"flex",gap:4},children:[c.jsx("button",{type:"button",onClick:()=>n(s=>({...s,triggers:[...s.triggers,{onKind:"",onTag:"",onNamePattern:"",onSpace:"",inputMap:{__cron:""}}]})),className:"revka-button",style:{padding:"2px 8px",fontSize:10},title:"Run on a cron schedule",children:"+ Cron"}),c.jsx("button",{type:"button",onClick:()=>n(s=>({...s,triggers:[...s.triggers,{onKind:"",onTag:"ready",onNamePattern:"",onSpace:"",inputMap:{}}]})),className:"revka-button",style:{padding:"2px 8px",fontSize:10},title:"Run when an entity matches",children:"+ Entity"})]}),children:e.triggers.map((s,a)=>c.jsxs("div",{style:{padding:8,borderRadius:8,border:"1px solid var(--pc-border)",background:"var(--pc-bg-base)",display:"flex",flexDirection:"column",gap:6},children:[c.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[c.jsx("span",{style:{fontSize:10,color:"var(--pc-text-faint)"},children:s.inputMap.__cron?"Cron":"Entity"}),c.jsx("button",{onClick:()=>n(o=>({...o,triggers:o.triggers.filter((l,u)=>u!==a)})),style:{background:"transparent",border:0,color:"var(--revka-status-danger)",fontSize:10,cursor:"pointer"},children:"Remove"})]}),s.inputMap.__cron?c.jsx("input",{type:"text",value:s.inputMap.__cron,onChange:o=>n(l=>{const u=[...l.triggers];return u[a]={...u[a],inputMap:{...u[a].inputMap,__cron:o.target.value}},{...l,triggers:u}}),placeholder:"0 9 * * 1 (cron)",style:{...i,fontFamily:"var(--pc-font-mono, ui-monospace, monospace)"}}):c.jsxs("div",{style:{display:"grid",gridTemplateColumns:"minmax(0, 1fr) 96px",gap:6},children:[c.jsx("input",{type:"text",value:s.onKind,onChange:o=>n(l=>{const u=[...l.triggers];return u[a]={...u[a],onKind:o.target.value},{...l,triggers:u}}),placeholder:"Entity kind",style:{...i,fontFamily:"var(--pc-font-mono, ui-monospace, monospace)"}}),c.jsx("input",{type:"text",value:s.onTag,onChange:o=>n(l=>{const u=[...l.triggers];return u[a]={...u[a],onTag:o.target.value},{...l,triggers:u}}),placeholder:"Tag",style:{...i,fontFamily:"var(--pc-font-mono, ui-monospace, monospace)"}}),c.jsx("input",{type:"text",value:s.onNamePattern,onChange:o=>n(l=>{const u=[...l.triggers];return u[a]={...u[a],onNamePattern:o.target.value},{...l,triggers:u}}),placeholder:"Name pattern",style:{...i,fontFamily:"var(--pc-font-mono, ui-monospace, monospace)"}}),c.jsx("input",{type:"text",value:s.onSpace??"",onChange:o=>n(l=>{const u=[...l.triggers];return u[a]={...u[a],onSpace:o.target.value},{...l,triggers:u}}),placeholder:"Space prefix",style:{...i,fontFamily:"var(--pc-font-mono, ui-monospace, monospace)"}})]})]},a))}),c.jsx(I2,{kicker:"Inputs",count:e.inputs.length,onAdd:()=>n(s=>({...s,inputs:[...s.inputs,{name:"",type:"string",required:!0,default:"",description:""}]})),children:e.inputs.map((s,a)=>c.jsxs("div",{style:{padding:8,borderRadius:8,border:"1px solid var(--pc-border)",background:"var(--pc-bg-base)",display:"flex",flexDirection:"column",gap:6},children:[c.jsxs("div",{style:{display:"flex",gap:6,alignItems:"center"},children:[c.jsx("input",{type:"text",value:s.name,onChange:o=>n(l=>{const u=[...l.inputs];return u[a]={...u[a],name:o.target.value},{...l,inputs:u}}),placeholder:"Param name",style:{...i,flex:1,fontFamily:"var(--pc-font-mono, ui-monospace, monospace)"}}),c.jsxs("select",{value:s.type,onChange:o=>n(l=>{const u=[...l.inputs];return u[a]={...u[a],type:o.target.value},{...l,inputs:u}}),style:{...i,width:90},children:[c.jsx("option",{value:"string",children:"string"}),c.jsx("option",{value:"number",children:"number"}),c.jsx("option",{value:"boolean",children:"boolean"}),c.jsx("option",{value:"list",children:"list"})]}),c.jsx("button",{type:"button",onClick:()=>n(o=>({...o,inputs:o.inputs.filter((l,u)=>u!==a)})),style:{background:"transparent",border:0,color:"var(--revka-status-danger)",cursor:"pointer"},children:"×"})]}),c.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[c.jsxs("label",{style:{display:"inline-flex",alignItems:"center",gap:4,cursor:"pointer"},children:[c.jsx("input",{type:"checkbox",checked:s.required,onChange:o=>n(l=>{const u=[...l.inputs];return u[a]={...u[a],required:o.target.checked},{...l,inputs:u}}),style:{accentColor:"var(--pc-accent)"}}),c.jsx("span",{style:{fontSize:10,color:"var(--pc-text-muted)"},children:"Required"})]}),c.jsx("input",{type:"text",value:s.default,onChange:o=>n(l=>{const u=[...l.inputs];return u[a]={...u[a],default:o.target.value},{...l,inputs:u}}),placeholder:"Default",style:{...i,flex:1}})]}),c.jsx("input",{type:"text",value:s.description,onChange:o=>n(l=>{const u=[...l.inputs];return u[a]={...u[a],description:o.target.value},{...l,inputs:u}}),placeholder:"Description",style:i})]},a))}),c.jsx(I2,{kicker:"Outputs",count:e.outputs.length,onAdd:()=>n(s=>({...s,outputs:[...s.outputs,{name:"",source:"",description:""}]})),children:e.outputs.map((s,a)=>c.jsxs("div",{style:{padding:8,borderRadius:8,border:"1px solid var(--pc-border)",background:"var(--pc-bg-base)",display:"flex",flexDirection:"column",gap:6},children:[c.jsxs("div",{style:{display:"flex",gap:6},children:[c.jsx("input",{type:"text",value:s.name,onChange:o=>n(l=>{const u=[...l.outputs];return u[a]={...u[a],name:o.target.value},{...l,outputs:u}}),placeholder:"Output name",style:{...i,flex:1,fontFamily:"var(--pc-font-mono, ui-monospace, monospace)"}}),c.jsx("button",{onClick:()=>n(o=>({...o,outputs:o.outputs.filter((l,u)=>u!==a)})),style:{background:"transparent",border:0,color:"var(--revka-status-danger)",cursor:"pointer"},children:"×"})]}),c.jsx("input",{type:"text",value:s.source,onChange:o=>n(l=>{const u=[...l.outputs];return u[a]={...u[a],source:o.target.value},{...l,outputs:u}}),placeholder:"${step_id.output}",style:{...i,fontFamily:"var(--pc-font-mono, ui-monospace, monospace)"}})]},a))})]})]})})}function I2({kicker:e,count:n,onAdd:r,addSlot:i,children:s}){return c.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:6},children:[c.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[c.jsxs("span",{className:"revka-kicker",children:[e," (",n,")"]}),i??(r?c.jsx("button",{type:"button",onClick:r,className:"revka-button",style:{padding:"2px 8px",fontSize:10},children:"+ Add"}):null)]}),s]})}function nl({tone:e,message:n,onDismiss:r}){const i=e==="success"?{icon:Zx,color:"var(--revka-status-success)",border:"color-mix(in srgb, var(--revka-status-success) 26%, transparent)"}:e==="error"?{icon:As,color:"var(--revka-status-danger)",border:"color-mix(in srgb, var(--revka-status-danger) 26%, transparent)"}:{icon:See,color:"var(--revka-signal-network)",border:"color-mix(in srgb, var(--revka-signal-network) 26%, transparent)"},s=i.icon;return c.jsxs("div",{className:"revka-panel revka-notice flex items-start justify-between gap-3 p-3",style:{borderColor:i.border,background:"color-mix(in srgb, var(--revka-bg-panel-strong) 94%, transparent)"},children:[c.jsxs("div",{className:"flex items-start gap-3",children:[c.jsx(s,{className:"mt-0.5 h-4 w-4 shrink-0",style:{color:i.color}}),c.jsx("div",{className:"text-sm whitespace-pre-wrap",style:{color:"var(--revka-text-primary)"},children:n})]}),r?c.jsx("button",{type:"button",className:"text-xs font-semibold uppercase tracking-[0.12em]",style:{color:"var(--revka-text-faint)"},onClick:r,children:"Close"}):null]})}function ft({tone:e="empty",title:n,description:r,compact:i=!1,action:s}){const a=(()=>{switch(e){case"loading":return{icon:Rr,iconClassName:"animate-spin",color:"var(--revka-signal-network)",borderColor:"color-mix(in srgb, var(--revka-signal-network) 22%, var(--revka-border-soft))",background:"color-mix(in srgb, var(--revka-signal-network-soft) 38%, transparent)"};case"error":return{icon:As,iconClassName:"",color:"var(--revka-status-danger)",borderColor:"color-mix(in srgb, var(--revka-status-danger) 24%, var(--revka-border-soft))",background:"color-mix(in srgb, var(--revka-status-danger) 8%, transparent)"};default:return{icon:wee,iconClassName:"",color:"var(--revka-signal-selected)",borderColor:"color-mix(in srgb, var(--revka-signal-selected) 22%, var(--revka-border-soft))",background:"linear-gradient(135deg, color-mix(in srgb, var(--revka-signal-selected) 5%, transparent), transparent 58%), color-mix(in srgb, var(--revka-bg-panel-strong) 92%, transparent)"}}})(),o=a.icon;return c.jsx("div",{className:`rounded-[14px] border ${i?"p-3":"p-4"}`,style:{borderColor:a.borderColor,background:a.background},children:c.jsxs("div",{className:"flex items-start gap-3",children:[c.jsx("span",{className:"inline-flex h-9 w-9 shrink-0 items-center justify-center rounded-[12px] border",style:{borderColor:"color-mix(in srgb, currentColor 18%, transparent)",color:a.color,background:"color-mix(in srgb, currentColor 8%, transparent)"},children:c.jsx(o,{className:`h-4 w-4 ${a.iconClassName}`.trim()})}),c.jsxs("div",{className:"min-w-0",children:[c.jsx("div",{className:"text-sm font-semibold",style:{color:"var(--revka-text-primary)"},children:n}),r?c.jsx("p",{className:"mt-1 text-sm leading-6",style:{color:"var(--revka-text-secondary)"},children:r}):null,s?c.jsx("div",{className:"mt-3",children:s}):null]})]})})}function _Re(){var he;const{t:e,tpl:n}=an(),r=vv(),[i,s]=_v(),[a,o]=b.useState([]),[l,u]=b.useState([]),[d,p]=b.useState(null),[f,g]=b.useState(!0),[_,x]=b.useState(!1),[v,S]=b.useState(null),[w,j]=b.useState(null),[C,T]=b.useState(null),[E,A]=b.useState(null),[O,F]=b.useState(!1),[L,$]=b.useState(!1),[z,B]=b.useState(!1),[H,D]=b.useState(null),[U,I]=b.useState(!1),X=b.useRef(null),K=async()=>(g(!0),Promise.all([az(!0,!1),oz(40)]).then(([Z,de])=>{o(Z),u(de);const ue=i.get("workflow"),pe=ue?Z.find(Oe=>Oe.kref===ue||Oe.name.toLowerCase()===ue.toLowerCase()):null;j(Oe=>{var fe;return Oe??(pe==null?void 0:pe.kref)??((fe=Z[0])==null?void 0:fe.kref)??null})}).catch(Z=>p(Z.message)).finally(()=>g(!1))),Q=Z=>{o(de=>{const ue=de.findIndex(Oe=>Oe.kref===Z.kref);if(ue===-1)return[Z,...de];const pe=[...de];return pe[ue]={...pe[ue],...Z},pe})},V=()=>{K()};b.useEffect(()=>{K()},[]),b.useEffect(()=>{if(!U)return;const Z=de=>{X.current&&!X.current.contains(de.target)&&I(!1)};return document.addEventListener("mousedown",Z),()=>document.removeEventListener("mousedown",Z)},[U]);const R=b.useMemo(()=>a.find(Z=>Z.kref===w)??a[0]??null,[a,w]),q=b.useCallback((Z,de)=>{const ue=new URLSearchParams;R!=null&&R.name?ue.set("workflow",R.name):R!=null&&R.kref&&ue.set("workflow",R.kref),Z&&ue.set("run",Z),de&&ue.set("node",de);const pe=i.get("path");(pe==="all"||pe==="failed"||pe==="blocked")&&ue.set("path",pe);const Oe=ue.toString();return Oe?`/runs?${Oe}`:"/runs"},[i,R==null?void 0:R.kref,R==null?void 0:R.name]);b.useEffect(()=>{i.get("tab")!=="runs"||!R||r(q(i.get("run"),i.get("node")??(C==null?void 0:C.id)),{replace:!0})},[q,r,i,C==null?void 0:C.id,R]),b.useEffect(()=>{if(!R||R.definition){x(!1),S(null);return}if(!R.kref.startsWith("kref://")||R.revision_number<=0){x(!1);return}let Z=!1;return x(!0),S(null),x0(`${R.kref}?r=${R.revision_number}`).then(de=>{Z||o(ue=>ue.map(pe=>pe.kref===R.kref?{...pe,...de}:pe))}).catch(de=>{Z||S(de instanceof Error?de.message:String(de))}).finally(()=>{Z||x(!1)}),()=>{Z=!0}},[R==null?void 0:R.definition,R==null?void 0:R.kref,R==null?void 0:R.revision_number]);const W=b.useMemo(()=>R?l.filter(Z=>Z.workflow_name.toLowerCase()===R.name.toLowerCase()).slice(0,20):[],[l,R]),te=(R==null?void 0:R.definition)??"",J=_,G=b.useMemo(()=>R?R.definition?Ho(R.definition):[]:[],[R]);b.useEffect(()=>{const Z=i.get("node");if(!Z){T(null);return}T(G.find(de=>de.id===Z)??null)},[i,G]),b.useEffect(()=>{R!=null&&R.kref&&i.get("tab")!=="runs"&&s(Z=>{const de=new URLSearchParams(Z);return de.set("workflow",R.kref),de.delete("tab"),de.delete("run"),C!=null&&C.id?de.set("node",C.id):de.delete("node"),de},{replace:!0})},[i,C==null?void 0:C.id,R==null?void 0:R.kref,s]);const re=(Z,de)=>{if(Z instanceof Xl&&Z.body&&typeof Z.body=="object"){const ue=Z.body;if(Array.isArray(ue.errors)&&ue.errors.length>0){const pe=ue.errors.slice(0,8).map(fe=>{if(fe&&typeof fe=="object"){const Le=fe;return`• ${Le.step_id?`[${Le.step_id}] `:Le.field?`[${Le.field}] `:""}${Le.message??JSON.stringify(fe)}`}return`• ${String(fe)}`});return[ue.error??"Validation failed",...pe].join(`
`)}if(ue.error)return String(ue.error)}return Z instanceof Error?Z.message:de},ne=async Z=>{F(!0),p(null);try{if(E==="edit"&&R){const de={kref:R.kref,name:Z.name,description:Z.description,version:Z.version,tags:Z.tags,definition:Z.definition},ue=await rJ(de);Q(ue),j(ue.kref),D({tone:"success",message:n("workflows.toast.updated",{name:ue.name})}),V()}else{const de={name:Z.name,description:Z.description,version:Z.version,tags:Z.tags,definition:Z.definition},ue=await nJ(de);Q(ue),j(ue.kref),D({tone:"success",message:n("workflows.toast.created",{name:ue.name})}),V()}A(null)}catch(de){const ue=re(de,e("workflows.save_failure"));throw p(ue),D({tone:"error",message:ue}),new Error(ue)}finally{F(!1)}},le=async()=>{if(!(!R||R.source==="builtin"))try{await iJ(R.kref,!R.deprecated),await K(),D({tone:"success",message:n(R.deprecated?"workflows.toast.reenabled":"workflows.toast.deprecated",{name:R.name})})}catch(Z){p(Z instanceof Error?Z.message:e("workflows.status_failure")),D({tone:"error",message:Z instanceof Error?Z.message:e("workflows.status_failure_dot")})}},oe=async()=>{if(!(!R||z)){B(!0);try{const Z=await lz(R.name);D({tone:"success",message:n("workflows.toast.run_started",{name:R.name,runId:Z.run_id.slice(0,8)})}),r(q(Z.run_id,null))}catch(Z){const de=re(Z,e("workflows.run_failure"));D({tone:"error",message:de})}finally{B(!1)}}},ie=async()=>{if(!(!R||R.source==="builtin")){$(!0);try{const Z=R.name;await sJ(R.kref),T(null),j(null),await K(),D({tone:"success",message:n("workflows.toast.deleted",{name:Z})})}catch(Z){p(Z instanceof Error?Z.message:e("workflows.delete_failure")),D({tone:"error",message:Z instanceof Error?Z.message:e("workflows.delete_failure_dot")})}finally{$(!1)}}};return c.jsxs("div",{className:"flex h-[calc(100vh-6rem)] flex-col gap-3",children:[H?c.jsx(nl,{tone:H.tone,message:H.message,onDismiss:()=>D(null)}):null,c.jsx(oi,{kicker:e("workflows.kicker"),title:e("workflows.title"),actions:c.jsxs(c.Fragment,{children:[c.jsxs("button",{className:"revka-button","data-variant":"primary",onClick:()=>A("create"),children:[c.jsx(ls,{className:"h-4 w-4"})," ",e("workflows.create")]}),c.jsxs("button",{className:"revka-button",onClick:()=>void K(),disabled:f,children:[c.jsx($r,{className:`h-4 w-4 ${f?"animate-spin":""}`})," ",e("common.refresh")]})]})}),d?c.jsx("div",{className:"text-sm",style:{color:"var(--revka-status-danger)"},children:d}):null,R?c.jsxs("div",{className:"flex shrink-0 flex-wrap items-center gap-3",children:[c.jsxs("div",{ref:X,className:"relative",children:[c.jsxs("button",{type:"button",className:"revka-button flex items-center gap-2",onClick:()=>I(Z=>!Z),children:[c.jsx(N0,{className:"h-4 w-4",style:{color:"var(--revka-signal-network)"}}),c.jsx("span",{className:"max-w-[18rem] truncate text-sm font-semibold",style:{color:"var(--revka-text-primary)"},children:R.name}),c.jsx(Yo,{className:"h-3.5 w-3.5",style:{color:"var(--revka-text-faint)"}})]}),U?c.jsx("div",{className:"absolute left-0 top-full z-50 mt-1 max-h-[24rem] w-[22rem] overflow-y-auto rounded-[12px] border shadow-lg",style:{borderColor:"var(--revka-border-strong)",background:"var(--revka-bg-panel-strong)"},children:a.map(Z=>{const de=Z.kref===R.kref;return c.jsxs("button",{type:"button",className:"w-full border-b px-4 py-2.5 text-left transition last:border-b-0",style:{borderColor:"var(--revka-border-soft)",background:de?"color-mix(in srgb, var(--revka-signal-selected) 14%, var(--revka-bg-panel))":"transparent"},onClick:()=>{j(Z.kref),T(null),I(!1)},children:[c.jsxs("div",{className:"flex items-center justify-between gap-2",children:[c.jsx("span",{className:"truncate text-sm font-medium",style:{color:"var(--revka-text-primary)"},children:Z.name}),c.jsx("span",{className:"shrink-0 rounded-full px-2 py-0.5 text-[10px] font-semibold uppercase",style:{background:Z.deprecated?"color-mix(in srgb, var(--revka-status-danger) 12%, transparent)":"var(--revka-signal-selected-soft, color-mix(in srgb, var(--revka-signal-selected) 14%, transparent))",color:Z.deprecated?"var(--revka-status-danger)":"var(--revka-signal-selected)"},children:Z.deprecated?e("workflows.status.off"):e("workflows.status.ready")})]}),c.jsx("div",{className:"mt-0.5 text-xs",style:{color:"var(--revka-text-faint)"},children:n("workflows.workflow_info_short",{version:Z.version,steps:Z.steps})})]},Z.kref)})}):null]}),c.jsx("span",{className:"text-xs",style:{color:"var(--revka-text-faint)"},children:n("workflows.workflow_info",{version:R.version,steps:R.steps,runs:W.length})}),c.jsx("div",{className:"flex-1"}),c.jsx("div",{className:"revka-tab-strip",role:"tablist",children:["definition","runs"].map(Z=>c.jsx("button",{type:"button",className:"revka-tab-button","data-active":String(Z==="definition"),"aria-selected":Z==="definition",onClick:()=>{var de;if(Z==="runs"){r(q(((de=W[0])==null?void 0:de.run_id)??null,C==null?void 0:C.id));return}},children:e(Z==="definition"?"workflows.tab.definition":"workflows.tab.runs")},Z))}),c.jsxs("button",{className:"revka-button","data-variant":"primary",onClick:oe,disabled:z||R.deprecated,title:e("common.execute"),children:[z?c.jsx($r,{className:"h-3.5 w-3.5 animate-spin"}):c.jsx(k0,{className:"h-3.5 w-3.5"}),c.jsx("span",{className:"text-xs",children:e("common.execute")})]}),c.jsx("button",{className:"revka-button",onClick:()=>R&&A(R.source==="builtin"?"duplicate":"edit"),title:R.source==="builtin"?e("common.duplicate"):e("common.edit"),children:c.jsx(Sv,{className:"h-3.5 w-3.5"})}),c.jsx("button",{className:"revka-button",onClick:le,disabled:R.source==="builtin",title:R.deprecated?e("common.reenable"):e("common.deprecate"),children:c.jsx(w0,{className:"h-3.5 w-3.5"})}),c.jsx("button",{className:"revka-button",onClick:ie,disabled:R.source==="builtin"||L,title:e("common.delete"),children:c.jsx(Ki,{className:"h-3.5 w-3.5"})})]}):null,R?c.jsxs("div",{className:"flex min-h-0 flex-1 flex-col gap-4 lg:flex-row",children:[c.jsx("div",{className:"flex min-h-0 min-w-0 flex-1 flex-col",children:te?c.jsx(aT,{definition:te,onSelectTask:T,selectedTaskId:C==null?void 0:C.id,fill:!0}):c.jsx(qe,{className:"flex flex-1 items-center justify-center",variant:"secondary",children:c.jsx(ft,{tone:J?"loading":"empty",title:e(J?"workflows.loading":"workflows.definition_unavailable_title"),description:v??e("workflows.definition_unavailable_desc")})})}),C?c.jsxs("div",{className:"min-h-0 w-full shrink-0 space-y-3 overflow-y-auto lg:w-[22rem]",children:[c.jsx(Hpe,{workflow:R}),c.jsx(V7,{task:C,footer:c.jsx("div",{className:"flex flex-wrap gap-3 text-xs",children:c.jsx(Ss,{to:q(((he=W[0])==null?void 0:he.run_id)??null,C.id),style:{color:"var(--revka-signal-network)"},children:e("workflows.open_node_in_runs")})}),emptyText:e("workflows.select_dag_node")})]}):null]}):c.jsx(qe,{className:"flex min-h-0 flex-1 items-center justify-center p-5",children:c.jsx(ft,{tone:f?"loading":"empty",title:e(f?"workflows.loading":"workflows.empty_title"),description:e("workflows.empty_desc")})}),E?c.jsx("div",{className:"fixed inset-0 z-50",style:{background:"var(--revka-bg-base, var(--pc-bg-base))"},children:c.jsx(DMe,{mode:E,workflow:E==="create"?null:E==="duplicate"&&R?{...R,name:`${R.name} ${e("workflows.copy_suffix")}`}:R,saving:O,onCancel:()=>A(null),onSave:ne,containerClassName:"flex h-screen w-screen flex-col animate-fade-in"})}):null]})}function xRe({runId:e,stepId:n,stepName:r,message:i,approveKeywords:s,rejectKeywords:a,onResolved:o}){const[l,u]=b.useState("idle"),[d,p]=b.useState(""),[f,g]=b.useState(""),_=s&&s.length>0,x=a&&a.length>0;async function v(j,C){u("loading"),g("");try{await oJ(e,j,C||void 0),u(j?"approved":"rejected"),o==null||o()}catch(T){g(T instanceof Error?T.message:String(T)),u("error")}}function S(){v(!0,"")}function w(){v(!1,d)}return l==="approved"?c.jsxs("div",{className:"rounded-xl border-2 px-4 py-3 flex items-center gap-3",style:{borderColor:"#34d399",background:"rgba(52,211,153,0.08)"},children:[c.jsx(Zx,{className:"h-5 w-5 shrink-0",style:{color:"#34d399"}}),c.jsxs("div",{children:[c.jsx("p",{className:"text-sm font-semibold",style:{color:"#34d399"},children:"Approved"}),c.jsx("p",{className:"text-[11px] mt-0.5",style:{color:"var(--pc-text-muted)"},children:"Workflow is resuming."})]})]}):l==="rejected"?c.jsxs("div",{className:"rounded-xl border-2 px-4 py-3 flex items-center gap-3",style:{borderColor:"#f87171",background:"rgba(248,113,113,0.08)"},children:[c.jsx(ru,{className:"h-5 w-5 shrink-0",style:{color:"#f87171"}}),c.jsxs("div",{children:[c.jsx("p",{className:"text-sm font-semibold",style:{color:"#f87171"},children:"Rejected"}),c.jsx("p",{className:"text-[11px] mt-0.5",style:{color:"var(--pc-text-muted)"},children:"The workflow step has been rejected."})]})]}):c.jsxs("div",{className:"rounded-xl border-2 px-4 py-3 flex flex-col gap-3 animate-fade-in",style:{borderColor:"#f59e0b",background:"rgba(245,158,11,0.07)"},children:[c.jsxs("div",{className:"flex items-start gap-2",children:[c.jsx(Jx,{className:"h-4 w-4 shrink-0 mt-0.5",style:{color:"#f59e0b"}}),c.jsxs("div",{className:"min-w-0 flex-1",children:[c.jsx("p",{className:"text-[11px] font-semibold uppercase tracking-wider",style:{color:"#f59e0b"},children:"Awaiting Approval"}),c.jsx("p",{className:"text-sm font-medium mt-0.5 truncate",style:{color:"var(--pc-text-primary)"},children:r})]})]}),i&&c.jsx("p",{className:"text-[12px] leading-relaxed",style:{color:"var(--pc-text-secondary)"},children:i}),(_||x)&&c.jsxs("div",{className:"flex flex-col gap-1",children:[_&&c.jsxs("p",{className:"text-[10px]",style:{color:"var(--pc-text-faint)"},children:[c.jsx("span",{style:{color:"#34d399"},children:"Approve keywords:"})," ",s.join(", ")]}),x&&c.jsxs("p",{className:"text-[10px]",style:{color:"var(--pc-text-faint)"},children:[c.jsx("span",{style:{color:"#f87171"},children:"Reject keywords:"})," ",a.join(", ")]})]}),l==="error"&&f&&c.jsxs("div",{className:"flex items-center gap-2 rounded-lg px-3 py-2",style:{background:"rgba(248,113,113,0.12)"},children:[c.jsx(As,{className:"h-3.5 w-3.5 shrink-0",style:{color:"#f87171"}}),c.jsx("p",{className:"text-[11px]",style:{color:"#f87171"},children:f})]}),l==="confirming_reject"&&c.jsxs("div",{className:"flex flex-col gap-2",children:[c.jsx("label",{className:"text-[11px]",style:{color:"var(--pc-text-muted)"},children:"Rejection feedback (required)"}),c.jsx("textarea",{className:"w-full rounded-lg border px-3 py-2 text-[12px] resize-none focus:outline-none focus:ring-1",style:{borderColor:"var(--pc-border)",background:"var(--pc-bg-base)",color:"var(--pc-text-primary)",minHeight:"72px"},placeholder:"Explain why you're rejecting this step...",value:d,onChange:j=>p(j.target.value),autoFocus:!0})]}),c.jsxs("div",{className:"flex items-center gap-2",children:[l==="loading"?c.jsxs("div",{className:"flex items-center gap-2",style:{color:"var(--pc-text-muted)"},children:[c.jsx(Rr,{className:"h-4 w-4 animate-spin"}),c.jsx("span",{className:"text-[12px]",children:"Processing..."})]}):l==="confirming_reject"?c.jsxs(c.Fragment,{children:[c.jsxs("button",{type:"button",disabled:!d.trim(),onClick:w,className:"flex items-center gap-1.5 px-3 py-1.5 rounded-lg text-[12px] font-medium disabled:opacity-40 disabled:cursor-not-allowed",style:{background:"rgba(248,113,113,0.18)",color:"#f87171"},children:[c.jsx(ru,{className:"h-3.5 w-3.5"}),"Confirm Reject"]}),c.jsx("button",{type:"button",onClick:()=>{u("idle"),p("")},className:"px-3 py-1.5 rounded-lg text-[12px]",style:{color:"var(--pc-text-muted)",background:"var(--pc-bg-elevated)"},children:"Cancel"})]}):c.jsxs(c.Fragment,{children:[c.jsxs("button",{type:"button",onClick:S,className:"flex items-center gap-1.5 px-3 py-1.5 rounded-lg text-[12px] font-medium",style:{background:"rgba(52,211,153,0.18)",color:"#34d399"},children:[c.jsx(Zx,{className:"h-3.5 w-3.5"}),"Approve"]}),c.jsxs("button",{type:"button",onClick:()=>u("confirming_reject"),className:"flex items-center gap-1.5 px-3 py-1.5 rounded-lg text-[12px] font-medium",style:{background:"rgba(248,113,113,0.18)",color:"#f87171"},children:[c.jsx(ru,{className:"h-3.5 w-3.5"}),"Reject"]})]}),c.jsx("span",{className:"ml-auto text-[10px] font-mono",style:{color:"var(--pc-text-faint)"},children:n})]})]})}const bRe={md:"max-w-3xl",lg:"max-w-4xl",xl:"max-w-5xl","2xl":"max-w-6xl"};function Nu({title:e,description:n,children:r,onClose:i,size:s="md"}){return c.jsx("div",{className:"fixed inset-0 z-[120] flex items-center justify-center p-4",style:{background:"rgba(5, 8, 10, 0.64)",backdropFilter:"blur(10px)"},onClick:a=>{a.target===a.currentTarget&&i()},role:"dialog","aria-modal":"true",children:c.jsxs("div",{className:`revka-panel revka-modal-shell w-full ${bRe[s]} p-5`,children:[c.jsxs("div",{className:"mb-4 shrink-0",children:[c.jsx("div",{className:"revka-kicker",children:"Action Surface"}),c.jsx("h3",{className:"mt-2 text-lg font-semibold",style:{color:"var(--revka-text-primary)"},children:e}),n?c.jsx("p",{className:"mt-2 text-sm",style:{color:"var(--revka-text-secondary)"},children:n}):null]}),c.jsx("div",{className:"revka-modal-body",children:r})]})})}const kRe=new Set(["md","markdown","mdx"]),wRe=new Set(["txt","log","json","yaml","yml","toml","ini","csv","tsv","xml","html","css","js","ts","tsx","jsx","py","rs","go","sh","bash","zsh","sql","env"]),SRe=new Set(["png","jpg","jpeg","gif","webp","svg","bmp","ico","avif"]),CRe=new Set(["mp4","webm","mov","m4v","ogv"]);function aV(e){const n=(e.split("?")[0]??"").split("#")[0]??"",r=n.lastIndexOf(".");return r<0?"":n.slice(r+1).toLowerCase()}function jRe(e){const n=aV(e);return kRe.has(n)?"markdown":wRe.has(n)?"text":SRe.has(n)?"image":CRe.has(n)?"video":"binary"}function NRe(e){switch(e){case"markdown":case"text":return wv;case"image":return qE;case"video":return kee;default:return Ql}}function oV(e){const n=encodeURIComponent(e);return`${Oi}${Xr}/api/artifact-body?location=${n}`}async function QT(e){const n=os(),r=new Headers;return n&&r.set("Authorization",`Bearer ${n}`),await fetch(oV(e),{headers:r})}function lV({artifact:e,onClose:n}){const r=b.useMemo(()=>jRe(e.location),[e.location]),i=NRe(r);return c.jsxs(Nu,{title:e.name||"Artifact",description:e.location,onClose:n,size:"2xl",children:[c.jsxs("div",{className:"flex items-center gap-2 mb-3 text-xs",style:{color:"var(--revka-text-faint)"},children:[c.jsx(i,{className:"h-3.5 w-3.5"}),c.jsx("span",{className:"uppercase tracking-wider",children:r}),c.jsx("span",{children:"·"}),c.jsx("span",{className:"font-mono truncate",children:e.kref})]}),c.jsx(ERe,{artifact:e,kind:r}),c.jsx(ORe,{artifact:e})]})}function ERe({artifact:e,kind:n}){return n==="markdown"||n==="text"?c.jsx(ARe,{artifact:e,asMarkdown:n==="markdown"}):n==="image"?c.jsx(TRe,{artifact:e}):n==="video"?c.jsx(MRe,{artifact:e}):c.jsx(RRe,{artifact:e})}function ARe({artifact:e,asMarkdown:n}){const[r,i]=b.useState(null),[s,a]=b.useState(null);return b.useEffect(()=>{let o=!1;return i(null),a(null),QT(e.location).then(async l=>{if(!l.ok){const u=await l.text().catch(()=>"");throw new Error(u||`HTTP ${l.status}`)}return l.text()}).then(l=>{o||i(l)}).catch(l=>{o||a(l instanceof Error?l.message:String(l))}),()=>{o=!0}},[e.location]),s?c.jsx(JT,{message:s}):r===null?c.jsx(ZT,{}):n?c.jsx("div",{className:"rounded-[12px] p-4 overflow-auto max-h-[60vh] text-sm chat-markdown",style:{background:"color-mix(in srgb, var(--revka-bg-elevated) 50%, transparent)",color:"var(--revka-text-primary)"},children:c.jsx(xA,{remarkPlugins:[SA],children:r})}):c.jsx("pre",{className:"rounded-[12px] p-4 overflow-auto max-h-[60vh] text-xs font-mono whitespace-pre-wrap break-words",style:{background:"color-mix(in srgb, var(--revka-bg-elevated) 50%, transparent)",color:"var(--revka-text-primary)"},children:r})}function TRe({artifact:e}){const[n,r]=b.useState(null),[i,s]=b.useState(null);return b.useEffect(()=>{let a=!1,o=null;return r(null),s(null),QT(e.location).then(async l=>{if(!l.ok){const u=await l.text().catch(()=>"");throw new Error(u||`HTTP ${l.status}`)}return l.blob()}).then(l=>{a||(o=URL.createObjectURL(l),r(o))}).catch(l=>{a||s(l instanceof Error?l.message:String(l))}),()=>{a=!0,o&&URL.revokeObjectURL(o)}},[e.location]),i?c.jsx(JT,{message:i}):n?c.jsx("div",{className:"rounded-[12px] p-3 overflow-auto max-h-[60vh] flex items-center justify-center",style:{background:"color-mix(in srgb, var(--revka-bg-elevated) 50%, transparent)"},children:c.jsx("img",{src:n,alt:e.name,className:"max-w-full max-h-[56vh] object-contain",style:{imageRendering:"auto"}})}):c.jsx(ZT,{})}function MRe({artifact:e}){const[n,r]=b.useState(null),[i,s]=b.useState(null),[a,o]=b.useState(!1),l=b.useRef(null);return b.useEffect(()=>{let u=!1,d=null;return r(null),s(null),o(!1),QT(e.location).then(async p=>{if(!p.ok){const f=await p.text().catch(()=>"");throw new Error(f||`HTTP ${p.status}`)}return p.blob()}).then(p=>{u||(d=URL.createObjectURL(p),r(d))}).catch(p=>{u||s(p instanceof Error?p.message:String(p))}),()=>{u=!0,d&&URL.revokeObjectURL(d)}},[e.location]),i?c.jsx(JT,{message:i}):n?a?c.jsxs("div",{className:"space-y-3",children:[c.jsxs("div",{className:"rounded-[12px] p-4 flex items-start gap-3 text-sm",style:{background:"color-mix(in srgb, var(--revka-status-warning) 10%, transparent)",color:"var(--revka-text-primary)",border:"1px solid color-mix(in srgb, var(--revka-status-warning) 30%, transparent)"},children:[c.jsx(bv,{className:"h-4 w-4 shrink-0 mt-0.5",style:{color:"var(--revka-status-warning)"}}),c.jsxs("div",{className:"space-y-1",children:[c.jsx("div",{className:"font-medium",children:"Browser can't decode this video"}),c.jsx("div",{className:"text-xs",style:{color:"var(--revka-text-secondary)"},children:"Web video viewers support MP4 (H.264/H.265), WebM (VP8/VP9/AV1), and Ogg. Other codecs (ProRes, DNxHD, MXF, etc.) need an external player."})]})]}),c.jsx(cV,{artifact:e})]}):c.jsx("div",{className:"rounded-[12px] p-3 overflow-hidden max-h-[60vh] flex items-center justify-center",style:{background:"color-mix(in srgb, var(--revka-bg-elevated) 50%, transparent)"},children:c.jsx("video",{ref:l,src:n,controls:!0,className:"max-w-full max-h-[56vh]",onError:()=>o(!0),children:"Your browser does not support the video tag."})}):c.jsx(ZT,{})}function RRe({artifact:e}){return c.jsxs("div",{className:"space-y-3",children:[c.jsxs("div",{className:"rounded-[12px] p-4 flex items-start gap-3 text-sm",style:{background:"color-mix(in srgb, var(--revka-bg-elevated) 50%, transparent)",color:"var(--revka-text-secondary)"},children:[c.jsx(Ql,{className:"h-4 w-4 shrink-0 mt-0.5",style:{color:"var(--revka-text-faint)"}}),c.jsxs("div",{children:["No inline preview for ",c.jsxs("span",{className:"font-mono",children:[".",aV(e.location)||"bin"]})," files. Open externally or copy the path below."]})]}),c.jsx(cV,{artifact:e})]})}function cV({artifact:e}){const[n,r]=b.useState(!1),i=async()=>{try{await navigator.clipboard.writeText(e.location),r(!0),setTimeout(()=>r(!1),1600)}catch{}},s=()=>{const a=oV(e.location);window.open(a,"_blank","noopener,noreferrer")};return c.jsxs("div",{className:"rounded-[12px] p-3 space-y-2",style:{background:"color-mix(in srgb, var(--revka-bg-elevated) 50%, transparent)"},children:[c.jsx("div",{className:"text-xs font-mono break-all",style:{color:"var(--revka-text-secondary)"},children:e.location}),c.jsxs("div",{className:"flex gap-2",children:[c.jsxs("button",{type:"button",onClick:i,className:"inline-flex items-center gap-1.5 rounded-[8px] px-2.5 py-1.5 text-xs font-medium transition",style:{background:"var(--revka-bg-elevated)",color:"var(--revka-text-primary)",border:"1px solid var(--revka-border-strong)"},children:[n?c.jsx(no,{className:"h-3.5 w-3.5"}):c.jsx(rc,{className:"h-3.5 w-3.5"}),n?"Copied":"Copy path"]}),c.jsxs("button",{type:"button",onClick:s,className:"inline-flex items-center gap-1.5 rounded-[8px] px-2.5 py-1.5 text-xs font-medium transition",style:{background:"var(--revka-bg-elevated)",color:"var(--revka-text-primary)",border:"1px solid var(--revka-border-strong)"},children:[c.jsx(mz,{className:"h-3.5 w-3.5"}),"Open externally"]})]})]})}function ORe({artifact:e}){const n=e.created_at?new Date(e.created_at):null,r=n&&!Number.isNaN(n.getTime())?n.toLocaleString():null;return c.jsxs("div",{className:"mt-4 pt-3 border-t text-xs flex items-center gap-3 flex-wrap",style:{borderColor:"var(--revka-border)",color:"var(--revka-text-faint)"},children:[r?c.jsxs("span",{children:["Created ",r]}):null,e.deprecated?c.jsx("span",{style:{color:"var(--revka-status-warning)"},children:"Deprecated"}):null]})}function ZT(){return c.jsx("div",{className:"rounded-[12px] p-6 text-center text-sm",style:{background:"color-mix(in srgb, var(--revka-bg-elevated) 50%, transparent)",color:"var(--revka-text-faint)"},children:"Loading…"})}function JT({message:e}){return c.jsxs("div",{className:"rounded-[12px] p-4 flex items-start gap-3 text-sm",style:{background:"color-mix(in srgb, var(--revka-status-error) 10%, transparent)",color:"var(--revka-text-primary)",border:"1px solid color-mix(in srgb, var(--revka-status-error) 30%, transparent)"},children:[c.jsx(bv,{className:"h-4 w-4 shrink-0 mt-0.5",style:{color:"var(--revka-status-error)"}}),c.jsx("div",{className:"break-words",children:e})]})}function B2(e){return e instanceof Error&&/\bAPI 404\b/.test(e.message)}function II(e,n){if(!e)return null;const r=e.toLowerCase(),i=n.find(s=>s.kref.toLowerCase()===r||s.name.toLowerCase()===r);return(i==null?void 0:i.name)??e}function Rf(e){return e&&typeof e=="object"&&!Array.isArray(e)?e:{}}function Vc(e){if(e==null)return"";if(typeof e=="string")return e;if(typeof e=="number"||typeof e=="boolean")return String(e);try{return JSON.stringify(e)}catch{return String(e)}}function uV(e,n=220){const r=e.replace(/\s+/g," ").trim();return r.length>n?`${r.slice(0,n-1)}…`:r}function ax(e){const n=Rf(e);return Object.keys(n).length>0}function DRe(e){try{return JSON.stringify(e??{},null,2)}catch{return Vc(e)}}function BI(e){if(!e||e.status!=="failed")return"";const n=Rf(e.input_data),r=Rf(e.output_data),i=[e.error,r.error,r.entity_error,r.entity_artifact_error,r.entity_tag_error,r.register_output_error,r.structured_output_error,r.stderr,r.stderr_preview,Rf(r.error_message).content,n.command?`command: ${n.command}`:"",n.code_preview?`python: ${n.code_preview}`:""];for(const s of i){const a=uV(Vc(s));if(a)return a}return""}function PRe({run:e,className:n=""}){const{tpl:r}=an(),i=PA(e),s=LA(e,r);return c.jsxs("div",{className:n,style:{color:"var(--revka-text-faint)"},children:[c.jsx("span",{children:r("runs.stats.steps_fraction",{completed:e.steps_completed||"0",total:e.steps_total||"?"})}),i!==null?c.jsx("span",{children:r("runs.stats.expanded_steps",{count:i})}):null,s?c.jsx("span",{className:"font-mono",children:s}):null]})}function zI(e){if(!e||e.status!=="completed")return null;const n=Rf(e.input_data),r=Rf(e.output_data),i=r.matched_branch_index??n.matched_branch_index,s=typeof i=="number"?i:Number(Vc(i)),o=Vc(r.matched_branch_label)||(Number.isFinite(s)&&s>=0?`Branch ${s+1}`:"No branch matched"),l=Vc(r.matched_output??e.output_preview);return{label:o,goto:Vc(r.matched_goto),condition:Vc(r.matched_condition??n.matched_condition),valueExpr:Vc(r.matched_value_expr??n.matched_value_expr),output:l}}function LRe(){var dt,Vt,jt,Ht,rr,Wt,Mn;const{t:e,tpl:n}=an(),{dismiss:r}=jA(),[i,s]=_v(),[a,o]=b.useState([]),[l,u]=b.useState([]),[d,p]=b.useState(null),[f,g]=b.useState(null),[_,x]=b.useState(null),[v,S]=b.useState(null),[w,j]=b.useState(null),[C,T]=b.useState(!1),[E,A]=b.useState(!1),[O,F]=b.useState(null),[L,$]=b.useState(!1),[z,B]=b.useState(!1),[H,D]=b.useState(!1),[U,I]=b.useState("all"),[X,K]=b.useState("summary"),[Q,V]=b.useState([]),[R,q]=b.useState(!1),[W,te]=b.useState("formatted"),[J,G]=b.useState(""),[re,ne]=b.useState(null),[le,oe]=b.useState(null),[ie,he]=b.useState(!1),Z=b.useRef(null),de=async()=>(A(!0),Promise.all([oz(25),az(!0,!1)]).then(async([ge,Re])=>{var qt,P;const et=i.get("run"),tn=i.get("workflow");let Jt=ge,Ft=!1;if(et&&!ge.some(Ie=>Ie.run_id===et)){const Ie=await Do(et).catch(st=>{if(B2(st))return r(et),Ft=!0,null;throw st});if(Ie){const{steps:st,...Kt}=Ie;Jt=[Kt,...ge]}}Ft&&s(Ie=>{const st=new URLSearchParams(Ie);return st.delete("run"),st},{replace:!0}),o(Jt),u(Re);const ir=II(tn,Re),xi=ir?Jt.filter(Ie=>Ie.workflow_name.toLowerCase()===ir.toLowerCase()):Jt;p((Ft?null:et)??((qt=xi[0])==null?void 0:qt.run_id)??((P=Jt[0])==null?void 0:P.run_id)??null)}).catch(ge=>F(ge.message)).finally(()=>A(!1)));b.useEffect(()=>{de()},[]);const ue=i.get("run");b.useEffect(()=>{!ue||ue===d||(p(ue),a.some(ge=>ge.run_id===ue)||Do(ue).then(ge=>{const{steps:Re,...et}=ge;o(tn=>tn.some(Jt=>Jt.run_id===ue)?tn:[et,...tn])}).catch(ge=>{B2(ge)&&(r(ue),s(Re=>{const et=new URLSearchParams(Re);return et.delete("run"),et},{replace:!0}))}))},[ue]),b.useEffect(()=>{if(!d)return;const ge=d;x(null);let Re=!1,et=null,tn=null;const Jt=new Set(["completed","failed","cancelled"]),Ft=4e3,ir=on=>{et=setTimeout(xi,on)},xi=()=>{Do(ge).then(on=>{if(Re)return;g(on);const{steps:qt,...P}=on;if(o(Ie=>Ie.map(st=>st.run_id===on.run_id?{...st,...P}:st)),on.workflow_revision_kref&&on.workflow_revision_kref!==tn&&(tn=on.workflow_revision_kref,x0(on.workflow_revision_kref).then(Ie=>{Re||x(Ie)}).catch(()=>{Re||x(null)})),on.status==="running"||on.status==="pending"||on.status==="paused")ir(Ft);else if(!Jt.has(on.status))return}).catch(on=>{if(!Re){if(B2(on)){r(ge),g(null),p(null),s(qt=>{const P=new URLSearchParams(qt);return P.delete("run"),P},{replace:!0});return}F(on instanceof Error?on.message:String(on))}})};return xi(),()=>{Re=!0,et&&clearTimeout(et)}},[d]),b.useEffect(()=>{var ge,Re;!ie||!f||((ge=Z.current)==null||ge.scrollIntoView({behavior:"smooth",block:"start"}),(Re=Z.current)==null||Re.focus({preventScroll:!0}),he(!1))},[f,ie]);const pe=b.useMemo(()=>{if(!f)return null;if(_)return _;const ge=f.workflow_name.toLowerCase();return l.find(Re=>Re.name.toLowerCase()===ge)??null},[l,_,f]),Oe=b.useMemo(()=>{const ge=II(i.get("workflow"),l);if(!ge)return a;const Re=ge.toLowerCase();return a.filter(et=>et.workflow_name.toLowerCase()===Re)},[l,a,i]),fe=b.useMemo(()=>pe?Ho(pe.definition):[],[pe]);b.useEffect(()=>{const ge=i.get("node");if(!ge){S(null);return}S(fe.find(Re=>Re.id===ge)??null)},[i,fe]),b.useEffect(()=>{const ge=i.get("path");(ge==="failed"||ge==="blocked"||ge==="all")&&I(ge)},[i]);const Le=b.useMemo(()=>f?Object.fromEntries(f.steps.map(ge=>[ge.step_id,ea(ge)])):{},[f]),Ee=b.useMemo(()=>v&&f?f.steps.find(ge=>ge.step_id===v.id)??null:null,[f,v]);b.useEffect(()=>{if(!v){K("summary");return}K(Ee!=null&&Ee.agent_id?"jsonl":"summary")},[d,v==null?void 0:v.id,Ee==null?void 0:Ee.agent_id]);const Bt=b.useMemo(()=>BI(Ee),[Ee]),Xe=b.useMemo(()=>(v==null?void 0:v.type)==="conditional"?zI(Ee):null,[Ee,v==null?void 0:v.type]),St=b.useMemo(()=>(f==null?void 0:f.steps.find(ge=>{var Re;return((Re=ge.output_data)==null?void 0:Re.awaiting_approval)===!0}))??null,[f]),yt=b.useMemo(()=>{const ge={pending:0,running:0,completed:0,failed:0,skipped:0};if(!f)return ge;for(const Re of f.steps){const et=ea(Re).status;ge[et]+=1}return ge},[f]),Rt=b.useMemo(()=>$H({tasks:fe,stepResults:Le}),[fe,Le]),be=b.useMemo(()=>(f==null?void 0:f.steps.filter(ge=>ea(ge).status==="failed"))??[],[f]),He=b.useMemo(()=>(f==null?void 0:f.steps.filter(ge=>ea(ge).status==="running"))??[],[f]),ht=b.useMemo(()=>fe.filter(ge=>Rt.includes(ge.id)),[Rt,fe]),ot=b.useMemo(()=>[...be.map(ge=>fe.find(Re=>Re.id===ge.step_id)??null).filter(ge=>ge!==null),...He.map(ge=>fe.find(Re=>Re.id===ge.step_id)??null).filter(ge=>ge!==null).filter(ge=>!be.some(Re=>Re.step_id===ge.id)),...ht.filter(ge=>!be.some(Re=>Re.step_id===ge.id))],[ht,be,He,fe]),$t=b.useMemo(()=>ZP({startTaskIds:be.map(ge=>ge.step_id),tasks:fe}),[be,fe]),jn=b.useMemo(()=>ZP({startTaskIds:Rt,tasks:fe}),[Rt,fe]),Pn=b.useMemo(()=>{if(U==="all")return[];const ge=new Set(U==="failed"?$t:jn);return fe.map(Re=>Re.id).filter(Re=>!ge.has(Re))},[jn,$t,U,fe]),We=b.useMemo(()=>{if(!J)return Q;const ge=J.toLowerCase();return Q.filter(Re=>{try{return JSON.stringify(Re).toLowerCase().includes(ge)}catch{return!1}})},[Q,J]);b.useEffect(()=>{const ge=Ee==null?void 0:Ee.agent_id;if(!ge){j(null),T(!1);return}T(!0),fO(ge,"summary",50).then(Re=>j(Re)).catch(()=>j(null)).finally(()=>T(!1))},[Ee==null?void 0:Ee.agent_id]),b.useEffect(()=>{const ge=Ee==null?void 0:Ee.agent_id;if(!ge||X!=="jsonl"){V([]);return}let Re=!1;return q(!0),fO(ge,"full",150).then(et=>{Re||V(et.entries||[])}).catch(()=>{Re||V([])}).finally(()=>{Re||q(!1)}),()=>{Re=!0}},[Ee==null?void 0:Ee.agent_id,X,f]),b.useEffect(()=>{const ge=Re=>{if(Re.metaKey||Re.ctrlKey||Re.altKey)return;const et=Re.target;if(et&&["INPUT","TEXTAREA","SELECT"].includes(et.tagName)||ot.length===0)return;const tn=ot.findIndex(Jt=>Jt.id===(v==null?void 0:v.id));Re.key==="j"&&(Re.preventDefault(),S(ot[tn>=0?(tn+1)%ot.length:0]??null)),Re.key==="k"&&(Re.preventDefault(),S(ot[tn>=0?(tn-1+ot.length)%ot.length:ot.length-1]??null))};return window.addEventListener("keydown",ge),()=>window.removeEventListener("keydown",ge)},[ot,v==null?void 0:v.id]),b.useEffect(()=>{f&&s(ge=>{const Re=new URLSearchParams(ge);return Re.set("run",d??f.run_id),Re.set("workflow",f.workflow_name),Re.set("path",U),v!=null&&v.id?Re.set("node",v.id):Re.delete("node"),Re},{replace:!0})},[U,d,f==null?void 0:f.run_id,f==null?void 0:f.workflow_name,v==null?void 0:v.id,s]);const ut=async()=>{if(f){B(!0);try{const ge=f.run_id.slice(0,8);await lJ(f.run_id),ne({tone:"success",message:n("runs.toast.retry_started",{id:ge})});const Re=await Do(f.run_id).catch(()=>null);Re&&g(Re),await de()}catch(ge){ne({tone:"error",message:ge instanceof Error?ge.message:e("runs.err.retry")})}finally{B(!1)}}},Ct=async()=>{if(!(!f||H)){D(!0);try{const ge=f.run_id.slice(0,8);await cJ(f.run_id),ne({tone:"success",message:n("runs.toast.stop_requested",{id:ge})});const Re=await Do(f.run_id).catch(()=>null);Re&&g(Re),await de()}catch(ge){ne({tone:"error",message:ge instanceof Error?ge.message:e("runs.err.stop")})}finally{D(!1)}}},Mt=async()=>{if(f){$(!0);try{const ge=f.run_id.slice(0,8);await aJ(f.run_id),S(null),g(null),p(null),await de(),ne({tone:"success",message:n("runs.toast.deleted",{id:ge})})}catch(ge){F(ge instanceof Error?ge.message:e("runs.err.delete")),ne({tone:"error",message:ge instanceof Error?ge.message:e("runs.err.delete")})}finally{$(!1)}}},Ge=ge=>{S(fe.find(Re=>Re.id===ge)??null)},tt=()=>{const ge=ot.findIndex(Re=>Re.id===(v==null?void 0:v.id));S(ot[ge>=0?(ge-1+ot.length)%ot.length:ot.length-1]??null)},bt=()=>{const ge=ot.findIndex(Re=>Re.id===(v==null?void 0:v.id));S(ot[ge>=0?(ge+1)%ot.length:0]??null)},Nt={summary:e("runs.tab.summary"),output:e("runs.tab.output"),tools:e("runs.tab.tools"),transcript:e("runs.tab.transcript"),jsonl:e("runs.tab.jsonl")},it={summary:c.jsx(wv,{className:"h-4 w-4"}),output:c.jsx(yee,{className:"h-4 w-4"}),tools:c.jsx(E0,{className:"h-4 w-4"}),transcript:c.jsx(TC,{className:"h-4 w-4"}),jsonl:c.jsx(aee,{className:"h-4 w-4"})};return c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"flex min-h-[calc(100vh-6rem)] flex-col gap-4",children:[re?c.jsx(nl,{tone:re.tone,message:re.message,onDismiss:()=>ne(null)}):null,c.jsx(oi,{kicker:e("runs.kicker"),title:e("runs.title"),actions:c.jsxs("button",{className:"revka-button",onClick:()=>void de(),disabled:E,children:[c.jsx($r,{className:`h-4 w-4 ${E?"animate-spin":""}`})," ",e("runs.refresh")]})}),c.jsxs("div",{className:"flex min-h-0 flex-1 flex-col gap-4",children:[c.jsxs("div",{ref:Z,tabIndex:-1,className:"flex min-h-0 flex-col gap-3 outline-none lg:h-[clamp(38rem,64vh,52rem)]",children:[f?c.jsxs("div",{className:"flex shrink-0 flex-wrap items-center justify-between gap-3",children:[c.jsxs("div",{className:"flex min-w-0 flex-1 flex-wrap items-center gap-3",children:[c.jsx("select",{className:"revka-input min-h-[2.5rem] w-full max-w-full py-2 text-sm sm:w-[24rem]",value:d??"","aria-label":e("runs.index.title"),onChange:ge=>{const Re=ge.target.value||null;p(Re),S(null),he(!0),s(et=>{const tn=new URLSearchParams(et);return Re?tn.set("run",Re):tn.delete("run"),tn},{replace:!0})},children:Oe.map(ge=>c.jsxs("option",{value:ge.run_id,children:[ge.workflow_name," / ",ge.run_id.slice(0,8)," · ",ge.status," · ",ge.steps_completed||0,"/",ge.steps_total||"?"]},ge.run_id))}),c.jsxs("span",{className:"min-w-0 truncate text-sm font-semibold",style:{color:"var(--revka-text-primary)"},children:[f.workflow_name," / ",f.run_id.slice(0,8)]}),c.jsx(Ua,{status:f.status}),pe?c.jsx(Ss,{to:`/workflows?workflow=${encodeURIComponent(pe.kref)}${v?`&node=${encodeURIComponent(v.id)}`:""}`,className:"text-xs",style:{color:"var(--revka-signal-network)"},children:e("runs.open_definition")}):null]}),c.jsxs("div",{className:"flex items-center gap-2",children:[f.status==="failed"?c.jsxs("button",{className:"revka-button",onClick:ut,disabled:z,title:e("runs.action.retry_tooltip"),style:{background:"var(--revka-signal-selected-soft, color-mix(in srgb, var(--revka-signal-selected) 18%, transparent))",color:"var(--revka-signal-selected)",borderColor:"var(--revka-signal-selected)"},children:[c.jsx(Lee,{className:`h-3.5 w-3.5 ${z?"animate-spin":""}`}),c.jsx("span",{className:"ml-1 text-xs",children:e(z?"runs.action.retrying":"runs.action.retry_failed")})]}):null,f.status==="running"||f.status==="pending"||f.status==="paused"?c.jsxs("button",{className:"revka-button",onClick:Ct,disabled:H,title:e("runs.action.stop_tooltip"),children:[H?c.jsx($r,{className:"h-3.5 w-3.5 animate-spin"}):c.jsx(kz,{className:"h-3.5 w-3.5"}),c.jsx("span",{className:"ml-1 text-xs",children:e(H?"runs.action.stopping":"runs.action.stop")})]}):null,c.jsx("button",{className:"revka-button",onClick:Mt,disabled:L,title:e("runs.action.delete_tooltip"),children:c.jsx(Ki,{className:"h-3.5 w-3.5"})})]})]}):null,c.jsx(Y7,{run:f,active:ie,label:e("runs.banner.label")}),f&&pe?c.jsx("div",{className:"md:hidden",children:c.jsx(Qc,{title:e("runs.overlay.path_mode"),children:c.jsxs("div",{className:"flex flex-wrap gap-2",children:[c.jsx(Hh,{label:e("runs.overlay.path.all"),active:U==="all",onClick:()=>I("all")}),c.jsx(Hh,{label:e("runs.overlay.path.failed"),active:U==="failed",onClick:()=>I("failed")}),c.jsx(Hh,{label:e("runs.overlay.path.blocked"),active:U==="blocked",onClick:()=>I("blocked")})]})})}):null,c.jsx("div",{className:"flex h-[30rem] min-h-0 flex-col lg:h-auto lg:flex-1",children:f&&pe?c.jsx(aT,{definition:pe.definition,stepResults:Le,onSelectTask:S,selectedTaskId:v==null?void 0:v.id,hiddenTaskIds:Pn,blockedTaskIds:Rt,failingTaskIds:be.map(ge=>ge.step_id),runningTaskIds:He.map(ge=>ge.step_id),fill:!0,overlay:c.jsxs("div",{className:"hidden space-y-2 md:block",children:[c.jsxs(Qc,{title:e("runs.overlay.path_mode"),children:[c.jsx(IRe,{}),c.jsxs("div",{className:"flex flex-wrap gap-2",children:[c.jsx(Hh,{label:e("runs.overlay.path.all"),active:U==="all",onClick:()=>I("all")}),c.jsx(Hh,{label:e("runs.overlay.path.failed"),active:U==="failed",onClick:()=>I("failed")}),c.jsx(Hh,{label:e("runs.overlay.path.blocked"),active:U==="blocked",onClick:()=>I("blocked")})]})]}),ot.length>0?c.jsx(Qc,{title:e("runs.overlay.signals"),children:c.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[c.jsx(xb,{label:e("runs.overlay.prev"),hint:"K",onClick:tt}),c.jsx(xb,{label:e("runs.overlay.next"),hint:"J",onClick:bt}),c.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-[0.12em]",style:{color:"var(--revka-text-faint)"},children:n("runs.overlay.signal_count",{count:ot.length})})]})}):null,c.jsx(Qc,{title:e("runs.overlay.posture"),children:c.jsxs("div",{className:"grid gap-2 sm:grid-cols-2 xl:grid-cols-5",children:[c.jsx(Lo,{label:e("runs.overlay.running"),value:yt.running,tone:"var(--revka-signal-live)"}),c.jsx(Lo,{label:e("runs.overlay.failed"),value:yt.failed,tone:"var(--revka-status-danger)"}),c.jsx(Lo,{label:e("runs.overlay.done"),value:yt.completed,tone:"var(--revka-signal-selected)"}),c.jsx(Lo,{label:e("runs.overlay.pending"),value:yt.pending,tone:"var(--revka-text-faint)"}),c.jsx(Lo,{label:e("runs.overlay.skipped"),value:yt.skipped,tone:"var(--revka-status-idle)"})]})}),be.length>0||He.length>0||ht.length>0?c.jsx(Qc,{title:e("runs.overlay.hotspots"),children:c.jsxs("div",{className:"flex flex-wrap gap-2",children:[be.slice(0,3).map(ge=>c.jsx(bf,{label:n("runs.overlay.fail_label",{id:ge.step_id}),tone:"var(--revka-status-danger)",onClick:()=>Ge(ge.step_id)},ge.step_id)),He.slice(0,2).map(ge=>c.jsx(bf,{label:n("runs.overlay.run_label",{id:ge.step_id}),tone:"var(--revka-signal-live)",onClick:()=>Ge(ge.step_id)},ge.step_id)),ht.slice(0,3).map(ge=>c.jsx(bf,{label:n("runs.overlay.block_label",{id:ge.id}),tone:"var(--revka-status-warning)",onClick:()=>Ge(ge.id)},ge.id))]})}):null]})}):c.jsx(qe,{className:"flex h-full items-center justify-center",variant:"secondary",children:c.jsx(ft,{tone:O?"error":Oe.length===0?"empty":void 0,title:O?e("runs.error.title"):Oe.length===0?e("runs.empty.title"):e("runs.none_selected.title"),description:O??(Oe.length===0?e("runs.empty.desc"):e("runs.none_selected.desc"))})})})]}),c.jsxs("div",{className:"grid gap-4 lg:grid-cols-[minmax(14rem,0.24fr)_minmax(0,1fr)]",children:[c.jsxs("div",{className:"min-h-0 max-h-[18rem] space-y-3 overflow-y-auto lg:max-h-[24rem]",children:[f?c.jsxs(qe,{className:"mb-3 p-3",variant:"utility",children:[c.jsxs("div",{className:"flex items-center justify-between gap-2 text-xs",children:[c.jsx(Ua,{status:f.status}),c.jsx(PRe,{className:"flex flex-wrap items-center justify-end gap-2",run:f})]}),f.started_at?c.jsx("div",{className:"mt-2 text-xs",style:{color:"var(--revka-text-faint)"},children:n("runs.started_at",{time:zf(f.started_at)})}):null,f.error?c.jsx("div",{className:"mt-2 rounded-[10px] border p-2 text-xs",style:{borderColor:"color-mix(in srgb, var(--revka-status-danger) 28%, transparent)",color:"var(--revka-status-danger)"},children:f.error}):null]}):null,f&&St?c.jsx("div",{className:"mb-3",children:c.jsx(xRe,{runId:f.run_id,stepId:St.step_id,stepName:St.step_id,message:typeof((dt=St.output_data)==null?void 0:dt.approval_message)=="string"?St.output_data.approval_message:"",approveKeywords:Array.isArray((Vt=St.output_data)==null?void 0:Vt.approve_keywords)?St.output_data.approve_keywords.map(String):void 0,rejectKeywords:Array.isArray((jt=St.output_data)==null?void 0:jt.reject_keywords)?St.output_data.reject_keywords.map(String):void 0,onResolved:()=>{Do(f.run_id).then(g).catch(()=>{}),de()}},St.step_id)}):null,f?c.jsxs(qe,{className:"p-3",variant:"utility",children:[c.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-[0.14em]",style:{color:"var(--revka-text-faint)"},children:n("runs.timeline",{count:f.steps.length})}),c.jsx("div",{className:"mt-2 space-y-1",children:f.steps.map(ge=>{var tn;const Re=BI(ge),et=((tn=fe.find(Jt=>Jt.id===ge.step_id))==null?void 0:tn.type)==="conditional"?zI(ge):null;return c.jsxs("button",{type:"button",onClick:()=>S(fe.find(Jt=>Jt.id===ge.step_id)??null),className:"flex w-full items-center justify-between gap-2 rounded-[10px] px-3 py-2 text-left transition",style:{background:(v==null?void 0:v.id)===ge.step_id?"var(--revka-signal-selected-soft, color-mix(in srgb, var(--revka-signal-selected) 18%, transparent))":"transparent"},children:[c.jsxs("span",{className:"min-w-0 flex-1",children:[c.jsx("span",{className:"block truncate text-sm",style:{color:"var(--revka-text-primary)"},children:ge.step_id}),Re?c.jsx("span",{className:"mt-0.5 block truncate text-[11px]",style:{color:"var(--revka-status-danger)"},children:Re}):et?c.jsxs("span",{className:"mt-0.5 block truncate text-[11px]",style:{color:"var(--revka-text-secondary)"},children:[et.label,et.goto?` -> ${et.goto}`:"",et.output?` · ${uV(et.output,90)}`:""]}):null]}),c.jsx(Ua,{status:ge.status})]},ge.step_id)})})]}):null]}),c.jsxs(qe,{className:"min-w-0 overflow-hidden p-4",variant:"secondary",children:[c.jsxs("div",{className:"flex flex-col gap-3",children:[c.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[c.jsx("span",{className:"min-w-0 truncate text-[11px] font-semibold uppercase tracking-[0.14em]",style:{color:"var(--revka-text-faint)"},children:v?v.name||v.id:e("runs.inspector.title")}),Ee?c.jsx(Ua,{status:Ee.status}):null]}),c.jsx("div",{className:"revka-run-tab-grid",role:"tablist","aria-label":e("runs.inspector.title"),children:["summary","output","tools","transcript","jsonl"].map(ge=>c.jsxs("button",{type:"button",role:"tab","aria-selected":X===ge,className:"revka-run-tab-button","data-active":String(X===ge),onClick:()=>K(ge),children:[it[ge],c.jsx("span",{children:Nt[ge]})]},ge))})]}),c.jsxs("div",{className:"mt-3 min-w-0 overflow-visible pr-1 lg:max-h-[34rem] lg:overflow-y-auto",children:[X==="summary"?v?c.jsxs("div",{className:"space-y-2",children:[c.jsxs("div",{className:"flex items-center justify-between gap-2",children:[c.jsx("span",{className:"text-sm font-semibold",style:{color:"var(--revka-text-primary)"},children:v.name||v.id}),Ee?c.jsx(Ua,{status:Ee.status}):null]}),c.jsx("div",{className:"text-xs uppercase tracking-[0.12em]",style:{color:"var(--revka-text-faint)"},children:v.type}),c.jsx("p",{className:"text-sm leading-6",style:{color:"var(--revka-text-secondary)"},children:v.description||e("runs.detail.no_description")}),c.jsx("div",{className:"text-xs",style:{color:"var(--revka-text-secondary)"},children:n("runs.detail.depends_on",{list:v.depends_on.join(", ")||e("runs.detail.depends_none")})}),Ee?c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"text-xs",style:{color:"var(--revka-text-secondary)"},children:n("runs.detail.agent",{type:Ee.agent_type||e("runs.detail.agent_na"),role:Ee.role?` / ${Ee.role}`:""})}),(Ht=Ee.skills)!=null&&Ht.length?c.jsx("div",{className:"text-xs",style:{color:"var(--revka-text-secondary)"},children:n("runs.detail.skills",{list:Ee.skills.join(", ")})}):null,Ee.output_preview?c.jsx("div",{className:"rounded-[10px] border p-2 text-xs leading-6 break-words",style:{borderColor:"var(--revka-border-soft)",color:"var(--revka-text-secondary)"},children:Ee.output_preview}):null,Xe?c.jsx($I,{title:"Resolved Branch",tone:"success",children:c.jsxs("div",{className:"space-y-1",children:[c.jsxs("div",{children:[Xe.label,Xe.goto?` -> ${Xe.goto}`:""]}),Xe.condition?c.jsxs("div",{children:["Condition: ",Xe.condition]}):null,Xe.valueExpr?c.jsxs("div",{children:["Value: ",Xe.valueExpr]}):null,Xe.output?c.jsxs("div",{children:["Output: ",Xe.output]}):null]})}):null,Bt?c.jsx($I,{title:"Failure Detail",tone:"danger",children:Bt}):null]}):null,pe?c.jsx("div",{className:"flex flex-wrap gap-3 pt-1 text-xs",children:c.jsx(Ss,{to:`/workflows?workflow=${encodeURIComponent(pe.kref)}&node=${encodeURIComponent(v.id)}`,style:{color:"var(--revka-signal-network)"},children:e("runs.detail.definition_link")})}):null]}):c.jsx("div",{className:"text-sm",style:{color:"var(--revka-text-faint)"},children:e("runs.detail.select_node")}):null,X==="output"?Ee?c.jsxs("div",{className:"space-y-3",children:[Ee.input_data&&ax(Ee.input_data)?c.jsx(FI,{title:"Resolved Inputs",value:Ee.input_data}):null,Ee.output_data&&ax(Ee.output_data)?c.jsx(FI,{title:"Structured Output",value:Ee.output_data}):null,Ee.output_preview?c.jsxs("div",{className:"rounded-[10px] border p-3",style:{borderColor:"var(--revka-border-soft)"},children:[c.jsxs("div",{className:"mb-2 flex items-center justify-between gap-2",children:[c.jsx("div",{className:"text-[10px] font-semibold uppercase tracking-[0.12em]",style:{color:"var(--revka-text-faint)"},children:e("runs.detail.step_output")}),Ee.artifact_path?c.jsxs("button",{type:"button",onClick:()=>oe({kref:`step:${Ee.step_id}`,name:Ee.step_id,location:Ee.artifact_path??"",revision_kref:"",item_kref:"",deprecated:!1}),className:"inline-flex items-center gap-1 rounded-[6px] px-2 py-0.5 text-[10px] font-medium uppercase tracking-wider transition",style:{background:"var(--revka-bg-elevated)",color:"var(--revka-text-secondary)",border:"1px solid var(--revka-border-strong)"},children:[c.jsx(kv,{className:"h-3 w-3"}),"View full"]}):null]}),c.jsx("pre",{className:"whitespace-pre-wrap break-words text-xs leading-6",style:{color:"var(--revka-text-secondary)",fontFamily:"var(--pc-font-mono)"},children:Ee.output_preview})]}):null,w!=null&&w.last_message?c.jsxs("div",{className:"rounded-[10px] border p-3",style:{borderColor:"var(--revka-border-soft)"},children:[c.jsxs("div",{className:"mb-2 flex items-center gap-2 text-[10px] font-semibold uppercase tracking-[0.12em]",style:{color:"var(--revka-text-faint)"},children:[c.jsx(TC,{className:"h-3 w-3"})," ",e("runs.detail.agent_output")]}),c.jsx("pre",{className:"whitespace-pre-wrap break-words text-xs leading-6",style:{color:"var(--revka-text-secondary)",fontFamily:"var(--pc-font-mono)"},children:w.last_message})]}):null,!Ee.output_preview&&!(w!=null&&w.last_message)&&!ax(Ee.input_data)&&!ax(Ee.output_data)?c.jsx("div",{className:"text-sm",style:{color:"var(--revka-text-faint)"},children:e("runs.detail.no_output")}):null]}):c.jsx("div",{className:"text-sm",style:{color:"var(--revka-text-faint)"},children:e("runs.detail.select_step")}):null,X==="tools"?Ee?C?c.jsx("div",{className:"text-sm",style:{color:"var(--revka-text-faint)"},children:e("runs.detail.loading")}):w?c.jsxs("div",{className:"space-y-2",children:[c.jsxs("div",{className:"grid gap-2 grid-cols-2 text-xs",children:[c.jsxs("div",{className:"rounded-[10px] border p-2",style:{borderColor:"var(--revka-border-soft)"},children:[c.jsx("div",{className:"text-[10px] uppercase tracking-[0.12em]",style:{color:"var(--revka-text-faint)"},children:e("runs.detail.tools_calls")}),c.jsx("div",{className:"mt-1 text-sm font-semibold",style:{color:"var(--revka-text-primary)"},children:w.tool_call_count??((rr=w.recent_tools)==null?void 0:rr.length)??0})]}),c.jsxs("div",{className:"rounded-[10px] border p-2",style:{borderColor:"var(--revka-border-soft)"},children:[c.jsx("div",{className:"text-[10px] uppercase tracking-[0.12em]",style:{color:"var(--revka-text-faint)"},children:e("runs.detail.tools_errors")}),c.jsx("div",{className:"mt-1 text-sm font-semibold",style:{color:"var(--revka-text-primary)"},children:w.error_count??0})]})]}),(w.recent_tools??[]).slice(0,8).map((ge,Re)=>c.jsx(BRe,{tool:ge},`${ge.name??ge.kind}-${ge.ts??Re}`)),(((Wt=w.recent_tools)==null?void 0:Wt.length)??0)===0?c.jsx("div",{className:"text-sm",style:{color:"var(--revka-text-faint)"},children:e("runs.detail.no_tools")}):null]}):c.jsx("div",{className:"text-sm",style:{color:"var(--revka-text-faint)"},children:e("runs.detail.no_activity")}):c.jsx("div",{className:"text-sm",style:{color:"var(--revka-text-faint)"},children:e("runs.detail.select_step")}):null,X==="transcript"?Ee?(Mn=Ee.transcript)!=null&&Mn.length?c.jsx("div",{className:"space-y-2",children:Ee.transcript.map((ge,Re)=>c.jsxs("div",{className:"rounded-[10px] border p-2",style:{borderColor:"var(--revka-border-soft)"},children:[c.jsxs("div",{className:"flex items-center justify-between gap-2 text-[10px] font-semibold uppercase tracking-[0.12em]",style:{color:"var(--revka-text-faint)"},children:[c.jsx("span",{children:ge.speaker}),c.jsxs("span",{children:["R",ge.round]})]}),c.jsx("pre",{className:"mt-1 whitespace-pre-wrap text-xs leading-6",style:{color:"var(--revka-text-secondary)",fontFamily:"var(--pc-font-mono)"},children:ge.content})]},`${ge.round}-${ge.speaker}-${Re}`))}):c.jsx("div",{className:"text-sm",style:{color:"var(--revka-text-faint)"},children:e("runs.detail.no_transcript")}):c.jsx("div",{className:"text-sm",style:{color:"var(--revka-text-faint)"},children:e("runs.detail.select_step")}):null,X==="jsonl"?Ee?R&&Q.length===0?c.jsx("div",{className:"text-sm",style:{color:"var(--revka-text-faint)"},children:e("runs.detail.loading")}):c.jsxs("div",{className:"space-y-3",children:[c.jsxs("div",{className:"flex flex-col gap-2 rounded-[10px] border p-2.5",style:{borderColor:"var(--revka-border-soft)",background:"color-mix(in srgb, var(--revka-bg-panel-strong) 40%, transparent)"},children:[c.jsxs("div",{className:"flex items-center justify-between gap-2",children:[c.jsxs("span",{className:"text-[10px] font-semibold uppercase tracking-[0.12em]",style:{color:"var(--revka-text-faint)"},children:["JSONL Log Entries (",We.length,")"]}),c.jsxs("div",{className:"flex items-center gap-1.5",children:[c.jsx("button",{type:"button",onClick:()=>te("formatted"),className:"rounded-[6px] px-2 py-0.5 text-[10px] font-medium uppercase tracking-wider transition",style:{background:W==="formatted"?"var(--revka-signal-selected-soft, color-mix(in srgb, var(--revka-signal-selected) 18%, transparent))":"transparent",color:W==="formatted"?"var(--revka-signal-selected)":"var(--revka-text-faint)",border:W==="formatted"?"1px solid var(--revka-signal-selected)":"1px solid transparent"},children:"Formatted"}),c.jsx("button",{type:"button",onClick:()=>te("raw"),className:"rounded-[6px] px-2 py-0.5 text-[10px] font-medium uppercase tracking-wider transition",style:{background:W==="raw"?"var(--revka-signal-selected-soft, color-mix(in srgb, var(--revka-signal-selected) 18%, transparent))":"transparent",color:W==="raw"?"var(--revka-signal-selected)":"var(--revka-text-faint)",border:W==="raw"?"1px solid var(--revka-signal-selected)":"1px solid transparent"},children:"Raw JSONL"})]})]}),c.jsx("input",{type:"text",value:J,onChange:ge=>G(ge.target.value),placeholder:"Filter log entries...",className:"w-full rounded-[8px] border px-2.5 py-1.5 text-xs outline-none transition",style:{background:"var(--revka-bg-input)",borderColor:"var(--revka-border-soft)",color:"var(--revka-text-primary)"}})]}),We.length===0?c.jsx("div",{className:"text-center py-4 text-xs",style:{color:"var(--revka-text-faint)"},children:e(J?"runs.detail.no_jsonl_filter":"runs.detail.no_jsonl")}):W==="raw"?c.jsx("div",{className:"rounded-[10px] border p-2 overflow-x-auto max-h-[28rem]",style:{borderColor:"var(--revka-border-soft)",background:"var(--revka-bg-input)"},children:c.jsx("pre",{className:"text-[11px] leading-5",style:{color:"var(--revka-text-secondary)",fontFamily:"var(--pc-font-mono)"},children:We.map((ge,Re)=>c.jsxs("div",{className:"hover:bg-slate-800/10 dark:hover:bg-slate-200/5 py-0.5 px-1 rounded truncate whitespace-pre",children:[c.jsx("span",{className:"select-none text-slate-500 mr-2 inline-block w-6 text-right",children:Re+1}),JSON.stringify(ge)]},Re))})}):c.jsx("div",{className:"space-y-2 max-h-[32rem] overflow-y-auto pr-1",children:We.map((ge,Re)=>{const et=ge.kind||"unknown",tn=ge.ts?new Date(ge.ts).toLocaleTimeString():"";let Jt="var(--revka-bg-elevated)",Ft="var(--revka-text-muted)",ir="var(--revka-border-soft)";return et==="tool_call"?(Jt="color-mix(in srgb, var(--revka-signal-network) 12%, transparent)",Ft="var(--revka-signal-network)"):et==="message"||et==="user_message"?(Jt="color-mix(in srgb, var(--revka-signal-selected) 12%, transparent)",Ft="var(--revka-signal-selected)"):et==="reasoning"?(Jt="color-mix(in srgb, var(--revka-text-faint) 10%, transparent)",Ft="var(--revka-text-faint)"):et==="error"||et==="turn_failed"?(Jt="color-mix(in srgb, var(--revka-status-danger) 12%, transparent)",Ft="var(--revka-status-danger)",ir="color-mix(in srgb, var(--revka-status-danger) 30%, transparent)"):(et==="turn_started"||et==="turn_completed")&&(Jt="color-mix(in srgb, var(--revka-status-success) 12%, transparent)",Ft="var(--revka-status-success)"),c.jsxs("div",{className:"rounded-[10px] border p-2.5 transition-all text-xs",style:{borderColor:ir,background:"color-mix(in srgb, var(--revka-bg-panel-strong) 94%, transparent)"},children:[c.jsxs("div",{className:"flex items-center justify-between gap-2 mb-1.5",children:[c.jsxs("div",{className:"flex items-center gap-1.5",children:[c.jsx("span",{className:"rounded-[6px] px-1.5 py-0.5 text-[9px] font-bold uppercase tracking-wider",style:{background:Jt,color:Ft},children:et}),ge.name&&c.jsx("span",{className:"font-semibold",style:{color:"var(--revka-text-primary)"},children:ge.name})]}),c.jsx("span",{className:"text-[10px] font-mono",style:{color:"var(--revka-text-faint)"},children:tn})]}),c.jsx("div",{className:"pl-1 leading-5",style:{color:"var(--revka-text-secondary)"},children:et==="message"||et==="user_message"?c.jsx("div",{className:"whitespace-pre-wrap font-sans",style:{color:"var(--revka-text-secondary)"},children:ge.text}):et==="reasoning"?c.jsx("div",{className:"italic font-serif pl-2 border-l-2",style:{color:"var(--revka-text-muted)",borderColor:"var(--revka-border-soft)"},children:ge.text}):et==="tool_call"?c.jsxs("div",{className:"space-y-1 font-mono text-[11px]",children:[c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("span",{style:{color:"var(--revka-text-faint)"},children:"Status:"}),c.jsx("span",{className:"font-bold uppercase text-[9px]",style:{color:ge.status==="completed"?"var(--revka-status-success)":ge.status==="failed"?"var(--revka-status-danger)":"var(--revka-status-warning)"},children:ge.status||"running"})]}),ge.args&&c.jsxs("div",{className:"mt-1",children:[c.jsx("div",{className:"text-[10px] uppercase tracking-wider mb-0.5",style:{color:"var(--revka-text-faint)"},children:"Arguments:"}),c.jsx("pre",{className:"p-1.5 rounded-[6px] overflow-x-auto whitespace-pre-wrap",style:{background:"var(--revka-bg-input)",borderColor:"var(--revka-border-soft)",border:"1px solid"},children:ge.args})]}),ge.result&&c.jsxs("div",{className:"mt-1",children:[c.jsx("div",{className:"text-[10px] uppercase tracking-wider mb-0.5",style:{color:"var(--revka-text-faint)"},children:"Result:"}),c.jsx("pre",{className:"p-1.5 rounded-[6px] overflow-x-auto whitespace-pre-wrap max-h-40",style:{background:"var(--revka-bg-input)",borderColor:"var(--revka-border-soft)",border:"1px solid"},children:ge.result})]}),ge.error&&c.jsx("div",{className:"mt-1 p-1.5 rounded-[6px] border text-[11px]",style:{borderColor:"color-mix(in srgb, var(--revka-status-danger) 28%, transparent)",background:"color-mix(in srgb, var(--revka-status-danger) 6%, transparent)",color:"var(--revka-status-danger)"},children:ge.error})]}):et==="error"?c.jsx("div",{className:"font-mono text-xs text-red-500 whitespace-pre-wrap",children:ge.message}):et==="turn_started"?c.jsxs("div",{className:"font-mono text-[11px]",style:{color:"var(--revka-text-muted)"},children:["Started execution turn ",c.jsx("span",{className:"font-semibold",children:ge.turn_id})]}):et==="turn_completed"?c.jsxs("div",{className:"font-mono text-[11px] space-y-1",style:{color:"var(--revka-text-muted)"},children:[c.jsxs("div",{children:["Completed execution turn ",c.jsx("span",{className:"font-semibold",children:ge.turn_id})]}),ge.usage&&c.jsxs("div",{className:"flex flex-wrap gap-2.5 text-[10px] mt-0.5",style:{color:"var(--revka-text-faint)"},children:[c.jsxs("span",{children:["In: ",ge.usage.inputTokens||0," t"]}),c.jsxs("span",{children:["Out: ",ge.usage.outputTokens||0," t"]}),c.jsxs("span",{children:["Cost: $",Number(ge.usage.totalCostUsd||0).toFixed(5)]})]})]}):c.jsx("pre",{className:"font-mono text-[10px] p-1.5 rounded-[6px] overflow-x-auto",style:{background:"var(--revka-bg-input)",border:"1px solid var(--revka-border-soft)"},children:JSON.stringify(ge,null,2)})})]},Re)})})]}):c.jsx("div",{className:"text-sm",style:{color:"var(--revka-text-faint)"},children:e("runs.detail.select_step")}):null]})]})]})]})]}),le?c.jsx(lV,{artifact:le,onClose:()=>oe(null)}):null]})}function Hh({label:e,active:n,onClick:r}){return c.jsx("button",{type:"button",onClick:r,className:"min-h-[2.75rem] rounded-[12px] border px-3 py-2 text-xs font-semibold transition-colors",style:{borderColor:n?"var(--revka-border-strong)":"var(--revka-border-soft)",background:n?"var(--revka-signal-selected-soft, color-mix(in srgb, var(--revka-signal-selected) 18%, transparent))":"color-mix(in srgb, var(--revka-bg-panel-strong) 92%, transparent)",color:n?"var(--revka-text-primary)":"var(--revka-text-secondary)"},children:e})}function IRe(){const{t:e}=an();return c.jsxs("div",{className:"flex flex-wrap gap-2",children:[c.jsx(gm,{label:e("runs.overlay.legend_running"),tone:"var(--revka-signal-live)"}),c.jsx(gm,{label:e("runs.overlay.legend_failure"),tone:"var(--revka-status-danger)"}),c.jsx(gm,{label:e("runs.overlay.legend_blocked"),tone:"var(--revka-status-warning)"}),c.jsx(gm,{label:e("runs.overlay.legend_skipped"),tone:"var(--revka-status-idle)"}),c.jsx(gm,{label:e("runs.overlay.legend_gate"),tone:"var(--revka-signal-network)"})]})}function $I({title:e,tone:n="neutral",children:r}){const i=n==="danger"?"var(--revka-status-danger)":n==="success"?"var(--revka-signal-selected)":"var(--revka-text-faint)",s=n==="neutral"?"transparent":`color-mix(in srgb, ${i} 10%, transparent)`;return c.jsxs("div",{className:"rounded-[10px] border p-2 text-xs leading-6",style:{borderColor:n==="neutral"?"var(--revka-border-soft)":`color-mix(in srgb, ${i} 34%, transparent)`,background:s,color:n==="danger"?"var(--revka-status-danger)":"var(--revka-text-secondary)"},children:[c.jsx("div",{className:"mb-1 text-[10px] font-semibold uppercase tracking-[0.12em]",style:{color:i},children:e}),r]})}function FI({title:e,value:n}){return c.jsxs("div",{className:"rounded-[10px] border p-3",style:{borderColor:"var(--revka-border-soft)"},children:[c.jsx("div",{className:"mb-2 text-[10px] font-semibold uppercase tracking-[0.12em]",style:{color:"var(--revka-text-faint)"},children:e}),c.jsx("pre",{className:"max-h-72 overflow-auto whitespace-pre-wrap break-words text-xs leading-6",style:{color:"var(--revka-text-secondary)",fontFamily:"var(--pc-font-mono)"},children:DRe(n)})]})}function BRe({tool:e}){const{t:n}=an(),r=(()=>{try{const s=typeof e.args=="string"?JSON.parse(e.args||"{}"):e.args||{};return e.name==="Bash"||e.name==="execute_command"?s.command||e.command||"":e.name==="WebSearch"||e.name==="web_search"?s.query||"":e.name==="WebFetch"||e.name==="web_fetch"?s.url||"":(e.name==="Read"||e.name==="Write"||e.name==="Edit")&&(s.file_path||s.path)||""}catch{return""}})(),i=e.status==="failed"?"var(--revka-status-danger)":e.status==="completed"?"var(--revka-signal-selected)":"var(--revka-status-warning)";return c.jsxs("div",{className:"rounded-[10px] border p-2",style:{borderColor:"var(--revka-border-soft)"},children:[c.jsxs("div",{className:"flex items-center justify-between gap-2",children:[c.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[c.jsx(E0,{className:"h-3 w-3 shrink-0",style:{color:"var(--revka-signal-network)"}}),c.jsx("span",{className:"truncate text-sm",style:{color:"var(--revka-text-primary)"},children:e.name||e.kind||n("runs.detail.tool_default")})]}),c.jsx("span",{className:"text-[10px] font-semibold uppercase",style:{color:i},children:e.status||n("runs.detail.tool_status_ok")})]}),r?c.jsx("div",{className:"mt-1 truncate text-xs",style:{color:"var(--revka-text-secondary)"},children:r}):null,e.error?c.jsx("div",{className:"mt-1 text-xs",style:{color:"var(--revka-status-danger)"},children:e.error}):null]})}function zRe(e){return`url("${e.replace(/"/g,"%22")}")`}function $Re({data:e,selected:n}){const r=eme(e.role),i=n?`linear-gradient(135deg, color-mix(in srgb, ${r} var(--revka-node-accent-selected), transparent), transparent 78%)`:`linear-gradient(180deg, color-mix(in srgb, ${r} var(--revka-node-accent-idle), transparent), transparent 42%)`,s=typeof e.avatarUrl=="string"&&e.avatarUrl?["linear-gradient(90deg, var(--revka-bg-panel-strong) 0%, color-mix(in srgb, var(--revka-bg-panel-strong) 86%, transparent) 52%, color-mix(in srgb, var(--revka-bg-panel-strong) 36%, transparent) 100%)",i,zRe(e.avatarUrl)].join(", "):i;return c.jsxs("div",{className:"rounded-[8px] border px-4 py-3 shadow-sm",style:{minWidth:200,maxWidth:240,minHeight:132,borderColor:n?r:"color-mix(in srgb, var(--revka-border-soft) 75%, transparent)",backgroundColor:"var(--revka-bg-panel-strong)",backgroundImage:s,backgroundRepeat:"no-repeat",backgroundPosition:e.avatarUrl?"0 0, 0 0, right -18px center":void 0,backgroundSize:e.avatarUrl?"100% 100%, 100% 100%, 58% auto":void 0,boxShadow:n?`0 0 0 1px ${r}, 0 0 26px color-mix(in srgb, ${r} 24%, transparent)`:"var(--revka-shadow-panel)"},children:[c.jsx(Ms,{type:"target",position:xt.Top,style:{background:r,width:9,height:9}}),c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx(Ts,{src:e.avatarUrl,alt:e.label,size:28,radius:8}),c.jsx("div",{className:"truncate text-sm font-semibold",style:{color:"var(--revka-text-primary)"},children:e.label})]}),c.jsx("p",{className:"mt-2 line-clamp-2 text-[11px] leading-5",style:{color:"var(--revka-text-secondary)"},children:e.identity}),c.jsxs("div",{className:"mt-3 flex flex-wrap gap-1.5",children:[c.jsx("span",{className:"rounded-md px-1.5 py-0.5 text-[10px] font-medium",style:{background:"color-mix(in srgb, var(--revka-bg-elevated) 85%, transparent)",color:r},children:e.role}),c.jsx("span",{className:"rounded-md px-1.5 py-0.5 text-[10px] font-medium",style:{background:"var(--revka-signal-network-soft)",color:"var(--revka-signal-network)"},children:e.agentType})]}),c.jsx(Ms,{type:"source",position:xt.Bottom,style:{background:r,width:9,height:9}})]})}const FRe={agentNode:$Re};function dV({team:e,onSelectMember:n,selectedMemberKref:r}){const{nodes:i,edges:s}=b.useMemo(()=>{if(!e)return{nodes:[],edges:[]};const o=e.members.map(u=>({id:u.kref,type:"agentNode",position:{x:0,y:0},selected:u.kref===r,data:{label:u.name,role:u.role,agentType:u.agent_type,identity:u.identity,kref:u.kref,avatarUrl:u.avatar_url}})),l=e.edges.map(u=>{const d=Qpe(u.edge_type);return{id:`${u.from_kref}-${u.to_kref}-${u.edge_type}`,source:u.from_kref,target:u.to_kref,label:Jpe(u.edge_type),type:"default",style:{stroke:d.stroke,strokeWidth:2,strokeDasharray:d.strokeDasharray},animated:d.animated??!1,markerEnd:{type:qa.ArrowClosed,color:d.stroke}}});return{nodes:G7(o,l),edges:l}},[r,e]),a=(o,l)=>{n(l.id)};return c.jsx(PH,{nodes:i,edges:s,nodeTypes:FRe,onNodeClick:a,minimapColor:o=>{const l=o.data;return l.role==="reviewer"?"#6575d3":l.role==="coder"?"#2fbf75":"#4f75a8"},emptyState:"Select a team to inspect its topology."})}function HRe(){const{t:e,tpl:n}=an(),[r,i]=_v(),[s,a]=b.useState([]),[o,l]=b.useState(null),[u,d]=b.useState(null),[p,f]=b.useState(null),[g,_]=b.useState(!0),[x,v]=b.useState(!1),[S,w]=b.useState("summary"),[j,C]=b.useState([]),[T,E]=b.useState(!1),[A,O]=b.useState(!1),[F,L]=b.useState(null),$=async()=>(_(!0),pJ(!0,1,50).then(U=>{a(U.teams);const I=r.get("team"),X=U.teams.find(K=>K.kref===I||K.name.toLowerCase()===(I==null?void 0:I.toLowerCase()))??U.teams[0]??null;X&&pO(X.kref).then(l).catch(()=>{})}).catch(U=>f(U.message)).finally(()=>_(!1)));b.useEffect(()=>{$()},[]),b.useEffect(()=>{LE(!0,1,200).then(U=>C(U.agents)).catch(()=>{})},[]);const z=b.useMemo(()=>(o==null?void 0:o.members.find(U=>U.kref===u))??null,[u,o]);b.useEffect(()=>{const U=r.get("member");if(!U){d(null);return}d(U)},[r,o==null?void 0:o.kref]),b.useEffect(()=>{o!=null&&o.kref&&i(U=>{const I=new URLSearchParams(U);return I.set("team",o.kref),u?I.set("member",u):I.delete("member"),I},{replace:!0})},[u,o==null?void 0:o.kref,i]),b.useEffect(()=>{w(u?"member":"summary")},[o==null?void 0:o.kref,u]);const B=async U=>{E(!0),f(null);try{const I=U.avatarFile??null;if(o){const X={kref:o.kref,name:U.name,description:U.description,members:U.memberKrefs,edges:U.edges};let K=await gJ(X);I&&(K=await mO(K.kref,I)),l(K),L({tone:"success",message:n("teams.toast.updated",{name:K.name})})}else{const X={name:U.name,description:U.description,members:U.memberKrefs,edges:U.edges};let K=await mJ(X);I&&(K=await mO(K.kref,I)),l(K),L({tone:"success",message:n("teams.toast.created",{name:K.name})})}await $(),v(!1)}catch(I){f(I instanceof Error?I.message:e("teams.err.save")),L({tone:"error",message:I instanceof Error?I.message:e("teams.err.save")})}finally{E(!1)}},H=async()=>{if(o)try{await vJ(o.kref,!o.deprecated),await $();const U=o.deprecated?"teams.toast.reenabled":"teams.toast.deprecated";L({tone:"success",message:n(U,{name:o.name})})}catch(U){f(U instanceof Error?U.message:e("teams.err.toggle")),L({tone:"error",message:U instanceof Error?U.message:e("teams.err.toggle")})}},D=async()=>{if(o){O(!0);try{const U=o.name;await yJ(o.kref),l(null),d(null),await $(),L({tone:"success",message:n("teams.toast.deleted",{name:U})})}catch(U){f(U instanceof Error?U.message:e("teams.err.delete")),L({tone:"error",message:U instanceof Error?U.message:e("teams.err.delete")})}finally{O(!1)}}};return c.jsxs("div",{className:"flex min-h-[calc(100vh-6rem)] flex-col gap-3 md:h-[calc(100vh-6rem)]",children:[F?c.jsx(nl,{tone:F.tone,message:F.message,onDismiss:()=>L(null)}):null,c.jsx(oi,{kicker:e("teams.kicker"),title:e("teams.title"),actions:c.jsxs(c.Fragment,{children:[c.jsxs("button",{className:"revka-button","data-variant":"primary",onClick:()=>{l(null),v(!0)},children:[c.jsx(ls,{className:"h-4 w-4"}),e("teams.create")]}),c.jsxs("button",{className:"revka-button",onClick:()=>void $(),disabled:g,children:[c.jsx($r,{className:`h-4 w-4 ${g?"animate-spin":""}`}),e("teams.refresh")]})]})}),p?c.jsx("div",{className:"text-sm",style:{color:"var(--revka-status-danger)"},children:p}):null,c.jsxs("div",{className:`grid gap-4 grid-cols-1 md:min-h-0 md:flex-1 ${o?"lg:grid-cols-[20rem_minmax(0,1fr)_24rem]":"md:grid-cols-[20rem_1fr]"}`,children:[c.jsxs(qe,{className:"flex flex-col overflow-hidden p-0",children:[c.jsxs("div",{className:"flex items-center justify-between border-b px-3 py-2",style:{borderColor:"var(--revka-border-soft)"},children:[c.jsx("span",{className:"text-xs font-semibold uppercase tracking-[0.12em]",style:{color:"var(--revka-text-faint)"},children:n("teams.count",{count:s.length})}),c.jsx("span",{className:"text-xs",style:{color:"var(--revka-text-secondary)"},children:n("teams.agent_count",{count:j.length})})]}),c.jsx("div",{className:"flex-1 overflow-y-auto p-2",children:g?c.jsx(ft,{compact:!0,tone:"loading",title:e("teams.loading")}):s.length===0?c.jsx(ft,{compact:!0,title:e("teams.empty_title"),description:e("teams.empty_desc")}):s.map(U=>c.jsxs("button",{type:"button",className:"mb-1 w-full rounded-[12px] border px-3 py-3 text-left transition",style:{borderColor:U.kref===(o==null?void 0:o.kref)?"var(--revka-border-strong)":"var(--revka-border-soft)",background:U.kref===(o==null?void 0:o.kref)?"color-mix(in srgb, var(--revka-signal-selected) 14%, var(--revka-bg-panel-strong))":"transparent"},onClick:()=>{d(null),pO(U.kref).then(l).catch(I=>f(I.message))},children:[c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx(Ts,{src:U.avatar_url,alt:U.name,size:30,radius:8,kind:"team"}),c.jsxs("div",{className:"min-w-0 flex-1",children:[c.jsx("div",{className:"text-sm font-semibold",children:U.name}),c.jsx("div",{className:"mt-0.5 text-[11px]",style:{color:"var(--revka-text-secondary)"},children:n("teams.members_suffix",{members:U.members.length||U.member_count||0,edges:U.edges.length||U.edge_count||0})})]}),c.jsx("span",{className:"shrink-0 rounded-full px-2 py-0.5 text-[10px] font-semibold uppercase tracking-[0.12em]",style:{background:U.deprecated?"color-mix(in srgb, var(--revka-status-danger) 12%, transparent)":"color-mix(in srgb, var(--revka-status-success) 12%, transparent)",color:U.deprecated?"var(--revka-status-danger)":"var(--revka-status-success)"},children:U.deprecated?e("teams.status.off"):e("teams.status.live")})]}),U.description?c.jsx("p",{className:"mt-1.5 line-clamp-2 text-[11px] leading-4",style:{color:"var(--revka-text-faint)"},children:U.description}):null]},U.kref))})]}),c.jsx(qe,{className:"flex flex-col overflow-y-auto p-4",children:o?c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"flex items-center justify-between gap-3",children:[c.jsxs("div",{className:"flex min-w-0 items-center gap-3",children:[c.jsx(Ts,{src:o.avatar_url,alt:o.name,size:48,radius:12,kind:"team"}),c.jsxs("div",{className:"min-w-0",children:[c.jsx("div",{className:"truncate text-sm font-semibold",style:{color:"var(--revka-text-primary)"},children:o.name}),c.jsx("div",{className:"mt-1",children:c.jsx("span",{className:"rounded-full px-2.5 py-1 text-[10px] font-semibold uppercase tracking-[0.12em]",style:{background:o.deprecated?"color-mix(in srgb, var(--revka-status-danger) 12%, transparent)":"color-mix(in srgb, var(--revka-status-success) 12%, transparent)",color:o.deprecated?"var(--revka-status-danger)":"var(--revka-status-success)"},children:o.deprecated?e("teams.status.deprecated"):e("teams.status.active")})})]})]}),c.jsxs("div",{className:"flex items-center gap-1",children:[c.jsx("button",{className:"revka-button",onClick:()=>v(!0),title:e("teams.action.edit"),children:c.jsx(Sv,{className:"h-3.5 w-3.5"})}),c.jsx("button",{className:"revka-button",onClick:H,title:o.deprecated?e("teams.action.reenable"):e("teams.action.deprecate"),children:c.jsx(w0,{className:"h-3.5 w-3.5"})}),c.jsx("button",{className:"revka-button",onClick:D,disabled:A,title:e("teams.action.delete"),children:c.jsx(Ki,{className:"h-3.5 w-3.5"})})]})]}),c.jsxs("div",{className:"mt-3 grid gap-3 grid-cols-3",children:[c.jsxs(qe,{className:"p-3",variant:"utility",children:[c.jsx("div",{className:"revka-kicker",children:e("teams.stats.members")}),c.jsx("div",{className:"mt-1 text-lg font-semibold",style:{color:"var(--revka-text-primary)"},children:o.members.length||o.member_count||0})]}),c.jsxs(qe,{className:"p-3",variant:"utility",children:[c.jsx("div",{className:"revka-kicker",children:e("teams.stats.edges")}),c.jsx("div",{className:"mt-1 text-lg font-semibold",style:{color:"var(--revka-text-primary)"},children:o.edges.length||o.edge_count||0})]}),c.jsxs(qe,{className:"p-3",variant:"utility",children:[c.jsx("div",{className:"revka-kicker",children:e("teams.stats.status")}),c.jsx("div",{className:"mt-1 text-sm font-semibold",style:{color:o.deprecated?"var(--revka-status-danger)":"var(--revka-status-success)"},children:o.deprecated?e("teams.status.deprecated"):e("teams.status.active")})]})]}),c.jsx("div",{className:"mt-4 min-h-0 flex-1",children:c.jsx(dV,{team:o,onSelectMember:d,selectedMemberKref:u})})]}):c.jsx("div",{className:"flex flex-1 items-center justify-center",children:c.jsx(ft,{tone:g?"loading":"empty",title:e(g?"teams.loading_desc":"teams.none_selected_title"),description:e("teams.none_selected_desc")})})}),o?c.jsxs(qe,{className:"flex flex-col overflow-hidden p-0",children:[c.jsx("div",{className:"flex items-center gap-1 border-b px-3 py-2",style:{borderColor:"var(--revka-border-soft)"},children:[["summary",e("teams.tab.summary")],["member",e("teams.tab.member")]].map(([U,I])=>c.jsx("button",{type:"button",className:"revka-tab-button","data-active":String(S===U),"aria-selected":S===U,onClick:()=>w(U),children:I},U))}),c.jsxs("div",{className:"flex-1 overflow-y-auto p-3",children:[S==="summary"?c.jsx(Vpe,{team:o}):null,S==="member"?c.jsx(Ype,{member:z,footer:z?c.jsx(Ss,{to:"/agents",style:{color:"var(--revka-signal-network)"},className:"text-xs",children:e("teams.open_agent_registry")}):void 0}):null]})]}):null]}),x?c.jsx(WRe,{team:o,agents:j,saving:T,onClose:()=>v(!1),onSave:B}):null]})}function WRe({team:e,agents:n,saving:r,onClose:i,onSave:s}){const{t:a}=an(),[o,l]=b.useState((e==null?void 0:e.name)??""),[u,d]=b.useState((e==null?void 0:e.description)??""),[p,f]=b.useState((e==null?void 0:e.members.map(z=>z.kref))??[]),[g,_]=b.useState((e==null?void 0:e.edges)??[]),[x,v]=b.useState(""),[S,w]=b.useState(""),[j,C]=b.useState("REPORTS_TO"),[T,E]=b.useState(null),[A,O]=b.useState((e==null?void 0:e.avatar_url)??null);b.useEffect(()=>{l((e==null?void 0:e.name)??""),d((e==null?void 0:e.description)??""),f((e==null?void 0:e.members.map(z=>z.kref))??[]),_((e==null?void 0:e.edges)??[]),E(null)},[e]),b.useEffect(()=>{if(!T){O((e==null?void 0:e.avatar_url)??null);return}const z=URL.createObjectURL(T);return O(z),()=>URL.revokeObjectURL(z)},[T,e==null?void 0:e.avatar_url]),b.useEffect(()=>{_(z=>z.filter(B=>p.includes(B.from_kref)&&p.includes(B.to_kref))),v(z=>p.includes(z)?z:p[0]??""),w(z=>p.includes(z)?z:p[1]??p[0]??"")},[p]);const F=b.useMemo(()=>n.filter(z=>p.includes(z.kref)),[n,p]),L=b.useMemo(()=>({kref:(e==null?void 0:e.kref)??"draft://team",name:o||a("teams.form.draft_team_name"),description:u,deprecated:!1,created_at:(e==null?void 0:e.created_at)??"",members:F.map(z=>({kref:z.kref,name:z.name,role:z.role,agent_type:z.agent_type,model:z.model,identity:z.identity,expertise:z.expertise,avatar_url:z.avatar_url})),edges:g,member_count:F.length,edge_count:g.length}),[u,g,o,F,e==null?void 0:e.created_at,e==null?void 0:e.kref,a]),$=()=>{!x||!S||x===S||_(z=>z.some(H=>H.from_kref===x&&H.to_kref===S&&H.edge_type===j)?z:[...z,{from_kref:x,to_kref:S,edge_type:j}])};return c.jsxs(Nu,{title:a(e?"teams.modal.edit_title":"teams.modal.create_title"),description:a("teams.modal.description"),onClose:i,children:[c.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[c.jsxs("label",{className:"grid gap-2 text-sm",children:[c.jsx("span",{style:{color:"var(--revka-text-secondary)"},children:a("teams.form.name")}),c.jsx("input",{className:"revka-input",value:o,onChange:z=>l(z.target.value)})]}),c.jsxs("label",{className:"grid gap-2 text-sm",children:[c.jsx("span",{style:{color:"var(--revka-text-secondary)"},children:a("teams.form.description")}),c.jsx("input",{className:"revka-input",value:u,onChange:z=>d(z.target.value)})]})]}),c.jsxs("div",{className:"mt-4 flex items-center gap-3 rounded-[12px] border p-3",style:{borderColor:"var(--revka-border-soft)"},children:[c.jsx(Ts,{src:A,alt:o||(e==null?void 0:e.name)||"Team",size:58,radius:14,kind:"team"}),c.jsxs("div",{className:"min-w-0 flex-1",children:[c.jsx("div",{className:"text-sm font-semibold",style:{color:"var(--revka-text-primary)"},children:"Team profile image"}),c.jsx("div",{className:"mt-1 text-xs",style:{color:"var(--revka-text-faint)"},children:"PNG, JPEG, or WebP"})]}),c.jsxs("label",{className:"revka-button cursor-pointer",children:[c.jsx(WE,{className:"h-4 w-4"}),"Upload",c.jsx("input",{type:"file",accept:"image/png,image/jpeg,image/webp",className:"sr-only",disabled:r,onChange:z=>{var B;return E(((B=z.target.files)==null?void 0:B[0])??null)}})]})]}),c.jsxs("div",{className:"mt-4",children:[c.jsx("div",{className:"revka-kicker",children:a("teams.form.members")}),c.jsx("div",{className:"mt-3 grid max-h-[22rem] gap-2 overflow-auto md:grid-cols-2",children:n.map(z=>{const B=p.includes(z.kref);return c.jsxs("label",{className:"flex items-start gap-3 rounded-[12px] border p-3",style:{borderColor:B?"var(--revka-border-strong)":"var(--revka-border-soft)"},children:[c.jsx("input",{type:"checkbox",checked:B,onChange:H=>{f(D=>H.target.checked?[...D,z.kref]:D.filter(U=>U!==z.kref))}}),c.jsx(Ts,{src:z.avatar_url,alt:z.name,size:34,radius:9}),c.jsxs("div",{className:"min-w-0",children:[c.jsx("div",{className:"text-sm font-medium",style:{color:"var(--revka-text-primary)"},children:z.name}),c.jsxs("div",{className:"text-xs",style:{color:"var(--revka-text-secondary)"},children:[z.role," / ",z.agent_type]}),c.jsx("div",{className:"mt-1 line-clamp-2 text-xs",style:{color:"var(--revka-text-faint)"},children:z.identity})]})]},z.kref)})})]}),c.jsxs("div",{className:"mt-5 grid gap-4 lg:grid-cols-[minmax(0,1fr)_20rem]",children:[c.jsxs("div",{className:"space-y-4",children:[c.jsxs("div",{children:[c.jsx("div",{className:"revka-kicker",children:a("teams.form.topology_preview")}),c.jsx("div",{className:"mt-3",children:c.jsx(dV,{team:L,onSelectMember:()=>{}})})]}),c.jsxs(qe,{className:"p-4",variant:"utility",children:[c.jsx("div",{className:"revka-kicker",children:a("teams.form.edge_authoring")}),c.jsxs("div",{className:"mt-3 grid gap-2 md:grid-cols-[minmax(0,1fr)_minmax(0,1fr)_10rem_auto]",children:[c.jsxs("select",{className:"revka-input",value:x,onChange:z=>v(z.target.value),children:[c.jsx("option",{value:"",children:a("teams.form.from_member")}),F.map(z=>c.jsx("option",{value:z.kref,children:z.name},z.kref))]}),c.jsxs("select",{className:"revka-input",value:S,onChange:z=>w(z.target.value),children:[c.jsx("option",{value:"",children:a("teams.form.to_member")}),F.map(z=>c.jsx("option",{value:z.kref,children:z.name},z.kref))]}),c.jsxs("select",{className:"revka-input",value:j,onChange:z=>C(z.target.value),children:[c.jsx("option",{value:"REPORTS_TO",children:a("teams.form.edge_reports_to")}),c.jsx("option",{value:"SUPPORTS",children:a("teams.form.edge_supports")}),c.jsx("option",{value:"DEPENDS_ON",children:a("teams.form.edge_depends_on")})]}),c.jsx("button",{className:"revka-button",onClick:$,disabled:!x||!S||x===S,children:a("teams.form.add_edge")})]}),c.jsxs("div",{className:"mt-3 space-y-2",children:[g.map(z=>{var D,U;const B=((D=F.find(I=>I.kref===z.from_kref))==null?void 0:D.name)??z.from_kref,H=((U=F.find(I=>I.kref===z.to_kref))==null?void 0:U.name)??z.to_kref;return c.jsxs("div",{className:"flex items-center justify-between gap-2 rounded-[12px] border p-3 text-sm",style:{borderColor:"var(--revka-border-soft)"},children:[c.jsxs("div",{style:{color:"var(--revka-text-primary)"},children:[B," ",c.jsx("span",{style:{color:"var(--revka-text-faint)"},children:z.edge_type})," ",H]}),c.jsx("button",{className:"text-xs",style:{color:"var(--revka-status-danger)"},onClick:()=>_(I=>I.filter(X=>!(X.from_kref===z.from_kref&&X.to_kref===z.to_kref&&X.edge_type===z.edge_type))),children:a("teams.form.remove")})]},`${z.from_kref}-${z.to_kref}-${z.edge_type}`)}),g.length===0?c.jsx("div",{className:"text-sm",style:{color:"var(--revka-text-faint)"},children:a("teams.form.no_edges")}):null]})]})]}),c.jsxs(qe,{className:"p-4",variant:"secondary",children:[c.jsx("div",{className:"revka-kicker",children:a("teams.form.draft_summary")}),c.jsxs("div",{className:"mt-3 space-y-2 text-sm",children:[c.jsxs("div",{children:[c.jsx("span",{style:{color:"var(--revka-text-faint)"},children:a("teams.form.draft_members")}),": ",c.jsx("span",{style:{color:"var(--revka-text-primary)"},children:F.length})]}),c.jsxs("div",{children:[c.jsx("span",{style:{color:"var(--revka-text-faint)"},children:a("teams.form.draft_edges")}),": ",c.jsx("span",{style:{color:"var(--revka-text-primary)"},children:g.length})]}),c.jsx("p",{style:{color:"var(--revka-text-secondary)"},children:a("teams.form.draft_hint")})]})]})]}),c.jsxs("div",{className:"mt-5 flex flex-wrap justify-end gap-2",children:[c.jsx("button",{className:"revka-button",onClick:i,children:a("teams.form.cancel")}),c.jsx("button",{className:"revka-button","data-variant":"primary",disabled:r||!o.trim()||p.length===0,onClick:()=>s({name:o.trim(),description:u.trim(),memberKrefs:p,edges:g,avatarFile:T}),children:a(r?"teams.form.saving":e?"teams.form.save":"teams.modal.create_title")})]})]})}function qRe(){const{t:e,tpl:n}=an(),[r,i]=b.useState("default"),[s,a]=b.useState("default"),[o,l]=b.useState(null),[u,d]=b.useState([]),[p,f]=b.useState(!1),[g,_]=b.useState(!0),[x,v]=b.useState([]),[S,w]=b.useState(!0),j=b.useRef(null),{resolvedTheme:C}=Pa(),T=b.useCallback(H=>{const D=os(),U=D?`?token=${encodeURIComponent(D)}`:"";let I;return lp()&&Oi?I=Oi.replace(/^http/,"ws"):I=`${location.protocol==="https:"?"wss:":"ws:"}//${location.host}`,`${I}${Xr||""}/ws/canvas/${encodeURIComponent(H)}${U}`},[]),E=b.useCallback(H=>{var X;(X=j.current)==null||X.close();const D=os(),U=D?["revka.v1",`bearer.${D}`]:["revka.v1"],I=new WebSocket(T(H),U);I.onopen=()=>f(!0),I.onclose=()=>f(!1),I.onerror=()=>f(!1),I.onmessage=K=>{try{const Q=JSON.parse(K.data);if(Q.type!=="frame"||!Q.frame)return;const V=Q.frame;if(V.content_type==="clear"){l(null),d([]);return}l(V),d(R=>{var q;return R.length>0&&((q=R[R.length-1])==null?void 0:q.frame_id)===V.frame_id?R:[...R.slice(-49),V]})}catch{}},j.current=I},[T]);b.useEffect(()=>(E(r),()=>{var H;(H=j.current)==null||H.close()}),[r,E]),b.useEffect(()=>{const H=async()=>{try{const U=await Ye("/api/canvas");v(U.canvases||[])}catch{v([])}finally{w(!1)}};H();const D=setInterval(H,5e3);return()=>clearInterval(D)},[]);const A=b.useMemo(()=>{if(typeof window>"u")return{bg:C==="light"?"#f9f2f4":"#070607",text:C==="light"?"#261019":"#fff3f5"};const H=getComputedStyle(document.documentElement);return{bg:H.getPropertyValue("--revka-bg-base").trim()||(C==="light"?"#f9f2f4":"#070607"),text:H.getPropertyValue("--revka-text-primary").trim()||(C==="light"?"#261019":"#fff3f5")}},[C]),O=b.useMemo(()=>{if(!o||o.content_type==="eval")return;const H=A.bg,D=A.text;if(o.content_type==="svg")return`<!DOCTYPE html><html><head><style>body{margin:0;display:flex;align-items:center;justify-content:center;min-height:100vh;background:${H};color:${D};}</style></head><body>${o.content}</body></html>`;if(o.content_type==="markdown"){const U=o.content.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;");return`<!DOCTYPE html><html><head><style>body{margin:1rem;font-family:system-ui,sans-serif;color:${D};background:${H};line-height:1.6;}pre{white-space:pre-wrap;word-wrap:break-word;}</style></head><body><pre>${U}</pre></body></html>`}if(o.content_type==="text"){const U=o.content.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;");return`<!DOCTYPE html><html><head><style>body{margin:1rem;font-family:monospace;color:${D};background:${H};white-space:pre-wrap;}</style></head><body>${U}</body></html>`}return o.content},[o,A]),F=()=>{const H=s.trim();H&&(i(H),l(null),d([]))},L=async()=>{try{await Ye(`/api/canvas/${encodeURIComponent(r)}`,{method:"DELETE"}),l(null),d([])}catch{}},$=C==="light"?"linear-gradient(180deg, color-mix(in srgb, var(--revka-bg-surface) 74%, transparent), var(--revka-bg-base))":"linear-gradient(180deg, color-mix(in srgb, var(--revka-bg-surface) 92%, transparent), var(--revka-bg-base))",z="var(--revka-grid-line)",B=o?new Date(o.timestamp).toLocaleString():"--";return c.jsxs("div",{className:"flex min-h-[calc(100vh-6rem)] flex-col gap-3 lg:h-[calc(100vh-6rem)]",children:[c.jsx(oi,{kicker:e("canvas.kicker"),title:e("canvas.title"),actions:c.jsxs("button",{className:"revka-button",onClick:()=>E(r),children:[c.jsx($r,{className:"h-4 w-4"}),e("canvas.reconnect")]})}),c.jsxs("div",{className:"grid gap-4 grid-cols-1 lg:min-h-0 lg:flex-1 lg:grid-cols-[20rem_minmax(0,1fr)_18rem]",children:[c.jsxs("div",{className:"flex flex-col gap-4 lg:overflow-y-auto lg:min-h-0",children:[c.jsxs(qe,{className:"p-4",children:[c.jsx("div",{className:"revka-kicker",children:e("canvas.control")}),c.jsxs("div",{className:"mt-3 flex flex-wrap items-center gap-2",children:[c.jsxs("span",{className:"revka-status-pill",style:{color:p?"var(--revka-signal-selected)":"var(--revka-status-danger)",background:p?"color-mix(in srgb, var(--revka-signal-selected) 12%, transparent)":"color-mix(in srgb, var(--revka-status-danger) 12%, transparent)",borderColor:"transparent"},children:[c.jsx("span",{className:"revka-dot",style:{background:p?"var(--revka-signal-selected)":"var(--revka-status-danger)"}}),e(p?"canvas.connected":"canvas.disconnected")]}),c.jsxs("span",{className:"revka-status-pill",style:{color:"var(--revka-text-secondary)"},children:[c.jsx(bz,{className:"h-3.5 w-3.5"}),r]})]}),c.jsxs("div",{className:"mt-4 space-y-3",children:[c.jsx("input",{type:"text",value:s,onChange:H=>a(H.target.value),onKeyDown:H=>{H.key==="Enter"&&F()},placeholder:e("canvas.canvas_id_placeholder"),className:"revka-input"}),c.jsxs("div",{className:"grid gap-2 sm:grid-cols-2",children:[c.jsx("button",{className:"revka-button","data-variant":"primary",onClick:F,children:e("canvas.switch")}),c.jsxs("button",{className:"revka-button",onClick:L,children:[c.jsx(Ki,{className:"h-4 w-4"}),e("canvas.clear")]})]})]})]}),c.jsxs(qe,{className:"p-4",variant:"secondary",children:[c.jsx("div",{className:"revka-kicker",children:e("canvas.available")}),c.jsx("div",{className:"mt-3 space-y-2",children:S?c.jsx(ft,{tone:"loading",compact:!0,title:e("canvas.loading_list"),description:e("canvas.loading_list_desc")}):x.length===0?c.jsx(ft,{compact:!0,title:e("canvas.no_active_title"),description:e("canvas.no_active_desc")}):x.map(H=>c.jsx("button",{type:"button","data-active":H===r,"data-accent":"workflow",className:"revka-selection-card",onClick:()=>{a(H),i(H),l(null),d([])},children:c.jsxs("div",{className:"flex items-center justify-between gap-2",children:[c.jsx("span",{className:"truncate text-sm font-medium",style:{color:"var(--revka-text-primary)"},children:H}),H===r?c.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-[0.14em]",style:{color:"var(--revka-signal-selected)"},children:e("canvas.active")}):null]})},H))})]})]}),c.jsxs(qe,{className:"p-5 lg:overflow-y-auto",children:[c.jsx("div",{className:"revka-kicker",children:e("canvas.viewport")}),c.jsx("h3",{className:"mt-2 text-lg font-semibold",children:e("canvas.live_output")}),c.jsxs("div",{className:"mt-4 grid gap-3 md:grid-cols-4",children:[c.jsxs(qe,{className:"p-3",variant:"utility",children:[c.jsx("div",{className:"revka-kicker",children:e("canvas.canvas_label")}),c.jsx("div",{className:"mt-2 text-sm font-semibold",style:{color:"var(--revka-text-primary)"},children:r})]}),c.jsxs(qe,{className:"p-3",variant:"utility",children:[c.jsx("div",{className:"revka-kicker",children:e("canvas.connection")}),c.jsx("div",{className:"mt-2 text-sm font-semibold",style:{color:p?"var(--revka-signal-selected)":"var(--revka-status-danger)"},children:e(p?"canvas.live":"canvas.offline")})]}),c.jsxs(qe,{className:"p-3",variant:"utility",children:[c.jsx("div",{className:"revka-kicker",children:e("canvas.frame_type")}),c.jsx("div",{className:"mt-2 text-sm font-semibold",style:{color:"var(--revka-text-primary)"},children:(o==null?void 0:o.content_type)??"--"})]}),c.jsxs(qe,{className:"p-3",variant:"utility",children:[c.jsx("div",{className:"revka-kicker",children:e("canvas.last_update")}),c.jsx("div",{className:"mt-2 text-sm font-semibold",style:{color:"var(--revka-text-primary)"},children:B})]})]}),c.jsxs("div",{className:"mt-5 overflow-hidden rounded-[18px] border",style:{borderColor:"var(--revka-border-soft)",background:$,minHeight:"48rem",position:"relative"},children:[c.jsx("div",{"aria-hidden":"true",style:{position:"absolute",inset:0,pointerEvents:"none",backgroundImage:`linear-gradient(${z} 1px, transparent 1px), linear-gradient(90deg, ${z} 1px, transparent 1px)`,backgroundSize:"24px 24px",maskImage:"linear-gradient(180deg, rgba(255,255,255,0.35), transparent 85%)"}}),c.jsxs("div",{className:"flex items-center justify-between gap-3 border-b px-4 py-3",style:{borderColor:"var(--revka-border-soft)",position:"relative",zIndex:1,background:"color-mix(in srgb, var(--revka-bg-panel-strong) 86%, transparent)"},children:[c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("span",{className:"h-2.5 w-2.5 rounded-full",style:{background:"var(--revka-status-danger)"}}),c.jsx("span",{className:"h-2.5 w-2.5 rounded-full",style:{background:"var(--revka-status-warning)"}}),c.jsx("span",{className:"h-2.5 w-2.5 rounded-full",style:{background:"var(--revka-status-success)"}})]}),c.jsx("div",{className:"text-xs font-semibold uppercase tracking-[0.14em]",style:{color:"var(--revka-text-faint)"},children:o?`${o.content_type} ${e("canvas.frame_suffix")}`:e("canvas.waiting_label")})]}),o?c.jsx("iframe",{sandbox:"allow-scripts",srcDoc:O,className:"h-[calc(48rem-3.25rem)] w-full border-0",title:`Canvas: ${r}`,style:{background:"transparent",position:"relative",zIndex:1}}):c.jsx("div",{className:"flex h-[calc(48rem-3.25rem)] items-center justify-center p-6",style:{position:"relative",zIndex:1},children:c.jsx(ft,{tone:p?"empty":"error",title:p?n("canvas.waiting_for_content",{id:r}):e("canvas.disconnected_title"),description:e(p?"canvas.waiting_for_content_desc":"canvas.disconnected_desc"),action:p?void 0:c.jsxs("button",{className:"revka-button",onClick:()=>E(r),children:[c.jsx($r,{className:"h-4 w-4"}),e("canvas.reconnect_button")]})})})]}),o?c.jsxs("div",{className:"mt-4 grid gap-3 md:grid-cols-2",children:[c.jsxs(qe,{className:"p-3",variant:"utility",children:[c.jsx("div",{className:"revka-kicker",children:e("canvas.frame_id")}),c.jsx("div",{className:"mt-2 text-sm font-mono",style:{color:"var(--revka-text-primary)"},children:o.frame_id})]}),c.jsxs(qe,{className:"p-3",variant:"utility",children:[c.jsx("div",{className:"revka-kicker",children:e("canvas.guidance")}),c.jsx("div",{className:"mt-2 text-sm leading-6",style:{color:"var(--revka-text-secondary)"},children:e("canvas.guidance_desc")})]})]}):null]}),c.jsxs(qe,{className:"p-4 lg:overflow-y-auto",variant:"utility",children:[c.jsxs("div",{className:"flex items-center justify-between gap-2",children:[c.jsx("div",{className:"revka-kicker",children:e("canvas.history")}),c.jsxs("button",{className:"revka-button",onClick:()=>_(H=>!H),children:[c.jsx(HE,{className:"h-4 w-4"}),e(g?"canvas.hide":"canvas.show")]})]}),c.jsx("div",{className:"mt-3 space-y-2",children:g?u.length===0?c.jsx(ft,{compact:!0,title:e("canvas.no_frames_title"),description:e("canvas.no_frames_desc")}):[...u].reverse().map(H=>c.jsxs("button",{type:"button","data-active":(o==null?void 0:o.frame_id)===H.frame_id,"data-accent":"team",className:"revka-selection-card",onClick:()=>l(H),children:[c.jsxs("div",{className:"flex items-center justify-between gap-2",children:[c.jsx("span",{className:"truncate text-xs font-semibold uppercase tracking-[0.12em]",style:{color:"var(--revka-signal-network)"},children:H.content_type}),c.jsx("span",{className:"text-[11px]",style:{color:"var(--revka-text-faint)"},children:new Date(H.timestamp).toLocaleTimeString()})]}),c.jsx("div",{className:"mt-2 text-xs font-mono",style:{color:"var(--revka-text-faint)"},children:H.frame_id.slice(0,8)}),c.jsxs("div",{className:"mt-2 line-clamp-2 text-xs",style:{color:"var(--revka-text-secondary)"},children:[H.content.slice(0,96),H.content.length>96?"…":""]})]},H.frame_id)):c.jsx(ft,{compact:!0,title:e("canvas.history_collapsed_title"),description:e("canvas.history_collapsed_desc")})})]})]})]})}const zc={name:"",identity:"",soul:"",tone:"",role:"coder",agent_type:"claude",model:"",system_hint:""};function HI(e){return e?`url("${e.replace(/"/g,"%22")}")`:"none"}function URe(){const{t:e,tpl:n}=an(),[r,i]=b.useState([]),[s,a]=b.useState(null),[o,l]=b.useState(""),[u,d]=b.useState("all"),[p,f]=b.useState(!0),[g,_]=b.useState(!0),[x,v]=b.useState(!1),[S,w]=b.useState(!1),[j,C]=b.useState(null),[T,E]=b.useState("summary"),[A,O]=b.useState(null),[F,L]=b.useState(null),$=async()=>{_(!0),O(null);try{const K=await LE(!0,1,200);i(K.agents),a(Q=>{var V;return Q??((V=K.agents[0])==null?void 0:V.kref)??null})}catch(K){O(K instanceof Error?K.message:e("agents.err.load"))}finally{_(!1)}};b.useEffect(()=>{$()},[]);const z=b.useMemo(()=>{const K=o.trim().toLowerCase();return r.filter(Q=>!p&&Q.deprecated||u!=="all"&&Q.role!==u?!1:K?Q.name.toLowerCase().includes(K)||Q.identity.toLowerCase().includes(K)||Q.soul.toLowerCase().includes(K)||Q.expertise.some(V=>V.toLowerCase().includes(K)):!0)},[r,u,o,p]),B=b.useMemo(()=>z.find(K=>K.kref===s)??r.find(K=>K.kref===s)??z[0]??r[0]??null,[r,z,s]);b.useEffect(()=>{var K;!B&&z.length>0&&a(((K=z[0])==null?void 0:K.kref)??null)},[z,B]),b.useEffect(()=>{E("summary")},[B==null?void 0:B.kref]);const H=b.useMemo(()=>r.filter(K=>!K.deprecated).length,[r]),D=b.useMemo(()=>r.filter(K=>K.agent_type==="codex").length,[r]),U=async K=>{v(!0);try{const{avatarFile:Q,...V}=K;if(j==="edit"&&B){const R={...V,kref:B.kref,model:K.model||void 0,system_hint:K.system_hint||void 0};let q=await HZ(R);Q&&(q=await EC(q.kref,Q)),i(W=>W.map(te=>te.kref===q.kref?q:te)),a(q.kref),L({tone:"success",message:n("agents.toast.updated",{name:q.name})})}else{const R={...V,model:K.model||void 0,system_hint:K.system_hint||void 0};let q=await rz(R);Q&&(q=await EC(q.kref,Q)),i(W=>[q,...W]),a(q.kref),L({tone:"success",message:n("agents.toast.created",{name:q.name})})}C(null)}catch(Q){L({tone:"error",message:Q instanceof Error?Q.message:e("agents.err.save")})}finally{v(!1)}},I=async()=>{if(B)try{const K=await WZ(B.kref,!B.deprecated);i(V=>V.map(R=>R.kref===K.kref?K:R));const Q=K.deprecated?"agents.toast.deprecated":"agents.toast.reenabled";L({tone:"success",message:n(Q,{name:K.name})})}catch(K){L({tone:"error",message:K instanceof Error?K.message:e("agents.err.toggle")})}},X=async()=>{if(B){w(!0);try{const K=B.name;await qZ(B.kref),i(Q=>Q.filter(V=>V.kref!==B.kref)),a(null),L({tone:"success",message:n("agents.toast.deleted",{name:K})})}catch(K){L({tone:"error",message:K instanceof Error?K.message:e("agents.err.delete")})}finally{w(!1)}}};return c.jsxs("div",{className:"flex min-h-[calc(100vh-6rem)] flex-col gap-3 md:h-[calc(100vh-6rem)]",children:[F?c.jsx(nl,{tone:F.tone,message:F.message,onDismiss:()=>L(null)}):null,c.jsx(oi,{kicker:e("agents.kicker"),title:e("agents.title"),actions:c.jsxs(c.Fragment,{children:[c.jsxs("button",{className:"revka-button","data-variant":"primary",onClick:()=>C("create"),children:[c.jsx(ls,{className:"h-4 w-4"}),e("agents.create")]}),c.jsxs("button",{className:"revka-button",onClick:()=>void $(),disabled:g,children:[c.jsx($r,{className:`h-4 w-4 ${g?"animate-spin":""}`}),e("agents.refresh")]})]})}),c.jsxs("div",{className:"revka-agent-toolbar",children:[c.jsxs("div",{className:"revka-agent-search relative",children:[c.jsx(Da,{className:"pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2",style:{color:"var(--revka-text-faint)"}}),c.jsx("input",{value:o,onChange:K=>l(K.target.value),className:"revka-input revka-agent-search-input pl-10",placeholder:e("agents.search_placeholder")})]}),c.jsxs("select",{className:"revka-input revka-agent-filter-select w-auto",value:u,onChange:K=>d(K.target.value),children:[c.jsx("option",{value:"all",children:e("agents.filter.all_roles")}),c.jsx("option",{value:"coder",children:e("agents.filter.coder")}),c.jsx("option",{value:"reviewer",children:e("agents.filter.reviewer")}),c.jsx("option",{value:"researcher",children:e("agents.filter.researcher")})]}),c.jsxs("button",{type:"button",className:"revka-button revka-agent-filter-button",onClick:()=>f(K=>!K),children:[c.jsx(gz,{className:"h-4 w-4"}),e(p?"agents.filter.hide_disabled":"agents.filter.show_disabled")]})]}),A?c.jsx("div",{className:"text-sm",style:{color:"var(--revka-status-danger)"},children:A}):null,c.jsxs("div",{className:`grid gap-4 grid-cols-1 md:min-h-0 md:flex-1 ${B?"lg:grid-cols-[20rem_minmax(0,1fr)_26rem]":"md:grid-cols-[20rem_1fr]"}`,children:[c.jsxs(qe,{className:"flex flex-col overflow-hidden p-0",children:[c.jsx("div",{className:"flex items-center justify-between border-b px-3 py-2",style:{borderColor:"var(--revka-border-soft)"},children:c.jsx("span",{className:"text-xs font-semibold uppercase tracking-[0.12em]",style:{color:"var(--revka-text-faint)"},children:n("agents.count",{count:z.length})})}),c.jsx("div",{className:"flex-1 overflow-y-auto p-2",children:g?c.jsx(ft,{compact:!0,tone:"loading",title:e("agents.loading")}):z.length===0?c.jsx(ft,{compact:!0,title:e("agents.empty_title"),description:e("agents.empty_desc")}):z.map(K=>c.jsxs("button",{type:"button",className:"revka-agent-list-card mb-1","data-active":String(K.kref===(B==null?void 0:B.kref)),"data-has-avatar":String(!!K.avatar_url),style:{opacity:K.deprecated?.68:1,"--revka-agent-card-avatar":HI(K.avatar_url)},onClick:()=>a(K.kref),children:[c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("span",{className:"revka-agent-list-icon","aria-hidden":"true",children:c.jsx(ng,{className:"h-4 w-4"})}),c.jsxs("div",{className:"min-w-0 flex-1",children:[c.jsx("div",{className:"text-sm font-semibold",children:K.name}),c.jsxs("div",{className:"mt-0.5 flex items-center gap-1.5 text-[11px]",style:{color:"var(--revka-text-secondary)"},children:[c.jsx("span",{children:K.role}),c.jsx("span",{style:{color:"var(--revka-text-faint)"},children:"/"}),c.jsx("span",{children:K.agent_type}),K.model?c.jsxs(c.Fragment,{children:[c.jsx("span",{style:{color:"var(--revka-text-faint)"},children:"/"}),c.jsx("span",{className:"truncate",children:K.model})]}):null]})]})]}),c.jsx("p",{className:"mt-1.5 line-clamp-2 text-[11px] leading-4",style:{color:"var(--revka-text-faint)"},children:K.identity}),K.expertise.length>0?c.jsxs("div",{className:"mt-2 flex flex-wrap gap-1",children:[K.expertise.slice(0,3).map(Q=>c.jsx("span",{className:"rounded-full px-1.5 py-0.5 text-[9px] font-semibold",style:{background:"var(--revka-signal-network-soft)",color:"var(--revka-signal-network)"},children:Q},Q)),K.expertise.length>3?c.jsxs("span",{className:"text-[9px] py-0.5",style:{color:"var(--revka-text-faint)"},children:["+",K.expertise.length-3]}):null]}):null]},K.kref))})]}),c.jsx(qe,{className:"flex flex-col overflow-y-auto p-4",children:B?c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"revka-agent-profile-hero","data-has-avatar":String(!!B.avatar_url),style:{"--revka-agent-profile-image":HI(B.avatar_url)},children:[c.jsx("div",{className:"revka-agent-profile-image","aria-hidden":"true",children:B.avatar_url?c.jsx("img",{src:B.avatar_url,alt:""}):c.jsx(ng,{className:"h-10 w-10"})}),c.jsxs("div",{className:"min-w-0 flex-1",children:[c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("span",{className:"revka-agent-profile-icon","aria-hidden":"true",children:c.jsx(ng,{className:"h-4 w-4"})}),c.jsx("div",{className:"truncate text-sm font-semibold",style:{color:"var(--revka-text-primary)"},children:B.name})]}),c.jsxs("div",{className:"mt-1 text-xs",style:{color:"var(--revka-text-secondary)"},children:[B.role," / ",B.agent_type,B.model?` / ${B.model}`:""]})]}),c.jsx("span",{className:"revka-agent-status-pill","data-status":B.deprecated?"disabled":"active",children:B.deprecated?e("agents.status.disabled"):e("agents.status.active")})]}),c.jsxs("div",{className:"mt-3 grid gap-3 grid-cols-3",children:[c.jsxs(qe,{className:"p-3",variant:"utility",children:[c.jsx("div",{className:"revka-kicker",children:e("agents.stats.registry")}),c.jsx("div",{className:"mt-1 text-lg font-semibold",style:{color:"var(--revka-text-primary)"},children:r.length})]}),c.jsxs(qe,{className:"p-3",variant:"utility",children:[c.jsx("div",{className:"revka-kicker",children:e("agents.stats.active")}),c.jsx("div",{className:"mt-1 text-lg font-semibold",style:{color:"var(--revka-text-primary)"},children:H})]}),c.jsxs(qe,{className:"p-3",variant:"utility",children:[c.jsx("div",{className:"revka-kicker",children:e("agents.stats.codex")}),c.jsx("div",{className:"mt-1 text-lg font-semibold",style:{color:"var(--revka-text-primary)"},children:D})]})]}),c.jsxs("div",{className:"mt-4 grid gap-4 xl:grid-cols-[minmax(0,1.2fr)_minmax(0,0.8fr)]",children:[c.jsxs("div",{className:"space-y-4",children:[c.jsxs("div",{children:[c.jsx("div",{className:"revka-kicker",children:e("agents.section.identity")}),c.jsx("p",{className:"mt-2 text-sm leading-6",style:{color:"var(--revka-text-secondary)"},children:B.identity})]}),c.jsxs("div",{children:[c.jsx("div",{className:"revka-kicker",children:e("agents.section.soul")}),c.jsx("p",{className:"mt-2 text-sm leading-7",style:{color:"var(--revka-text-secondary)"},children:B.soul||e("agents.section.soul_empty")})]}),c.jsxs("div",{children:[c.jsx("div",{className:"revka-kicker",children:e("agents.section.expertise")}),c.jsx("div",{className:"mt-2 flex flex-wrap gap-2",children:B.expertise.length>0?B.expertise.map(K=>c.jsx("span",{className:"rounded-full px-3 py-1 text-xs font-semibold",style:{background:"var(--revka-signal-network-soft)",color:"var(--revka-text-primary)",border:"1px solid var(--revka-border-soft)"},children:K},K)):c.jsx("span",{className:"text-sm",style:{color:"var(--revka-text-faint)"},children:e("agents.section.no_expertise")})})]})]}),c.jsxs("div",{className:"rounded-[16px] border p-4",style:{borderColor:"var(--revka-border-soft)"},children:[c.jsx("div",{className:"revka-kicker",children:e("agents.section.voice")}),c.jsx("div",{className:"mt-2 text-sm font-semibold",style:{color:"var(--revka-text-primary)"},children:B.tone||e("agents.section.voice_empty")}),c.jsxs("div",{className:"mt-4 grid gap-3 text-sm",children:[c.jsxs("div",{children:[c.jsx("div",{style:{color:"var(--revka-text-faint)"},children:e("agents.section.revision")}),c.jsx("div",{className:"mt-1 font-semibold",style:{color:"var(--revka-text-primary)"},children:B.revision_number??B.revision??"--"})]}),c.jsxs("div",{children:[c.jsx("div",{style:{color:"var(--revka-text-faint)"},children:e("agents.section.created")}),c.jsx("div",{className:"mt-1 font-semibold",style:{color:"var(--revka-text-primary)"},children:zf(B.created_at)||"--"})]})]})]})]}),c.jsxs("div",{className:"mt-4 flex gap-2",children:[c.jsxs("button",{className:"revka-button",onClick:()=>C("edit"),children:[c.jsx(Sv,{className:"h-4 w-4"}),e("agents.action.edit")]}),c.jsxs("button",{className:"revka-button",onClick:I,children:[c.jsx(w0,{className:"h-4 w-4"}),B.deprecated?e("agents.action.reenable"):e("agents.action.deprecate")]}),c.jsxs("button",{className:"revka-button",onClick:X,disabled:S,children:[c.jsx(Ki,{className:"h-4 w-4"}),e(S?"agents.action.deleting":"agents.action.delete")]})]})]}):c.jsx("div",{className:"flex flex-1 items-center justify-center",children:c.jsx(ft,{tone:g?"loading":"empty",title:e(g?"agents.loading_desc":"agents.none_selected_title"),description:e("agents.none_selected_desc")})})}),B?c.jsxs(qe,{className:"flex flex-col overflow-hidden p-0",children:[c.jsx("div",{className:"flex items-center gap-1 border-b px-3 py-2",style:{borderColor:"var(--revka-border-soft)"},children:[["summary",e("agents.tab.summary")],["prompt",e("agents.tab.prompt")]].map(([K,Q])=>c.jsx("button",{type:"button",className:"revka-tab-button","data-active":String(T===K),"aria-selected":T===K,onClick:()=>E(K),children:Q},K))}),c.jsxs("div",{className:"flex-1 overflow-y-auto p-3",children:[T==="summary"?c.jsx("div",{className:"space-y-3 text-sm",children:[[e("agents.summary.name"),B.name],[e("agents.summary.role"),B.role],[e("agents.summary.type"),B.agent_type],[e("agents.summary.model"),B.model||e("agents.summary.model_default")],[e("agents.summary.tone"),B.tone||"--"],[e("agents.summary.revision"),String(B.revision_number??B.revision??"--")],[e("agents.summary.created"),zf(B.created_at)||"--"]].map(([K,Q])=>c.jsxs("div",{className:"rounded-[12px] border p-3",style:{borderColor:"var(--revka-border-soft)"},children:[c.jsx("div",{className:"text-[10px] font-semibold uppercase tracking-[0.14em]",style:{color:"var(--revka-text-faint)"},children:K}),c.jsx("div",{className:"mt-1 text-sm font-semibold",style:{color:"var(--revka-text-primary)"},children:Q})]},K))}):null,T==="prompt"?c.jsxs("div",{className:"space-y-4",children:[c.jsxs("div",{children:[c.jsx("div",{className:"revka-kicker",children:e("agents.prompt.system_hint")}),c.jsx("pre",{className:"mt-2 whitespace-pre-wrap text-xs leading-6",style:{color:"var(--revka-text-secondary)",fontFamily:"var(--pc-font-mono)"},children:B.system_hint||e("agents.prompt.system_hint_empty")})]}),c.jsxs("div",{children:[c.jsx("div",{className:"revka-kicker",children:e("agents.prompt.identity_seed")}),c.jsx("pre",{className:"mt-2 whitespace-pre-wrap text-xs leading-6",style:{color:"var(--revka-text-secondary)",fontFamily:"var(--pc-font-mono)"},children:B.identity})]})]}):null]})]}):null]}),j?c.jsx(KRe,{mode:j,agent:j==="edit"?B:null,saving:x,onClose:()=>C(null),onSave:U}):null]})}function KRe({mode:e,agent:n,saving:r,onClose:i,onSave:s}){const{t:a}=an(),[o,l]=b.useState((n==null?void 0:n.name)??""),[u,d]=b.useState((n==null?void 0:n.identity)??""),[p,f]=b.useState((n==null?void 0:n.soul)??""),[g,_]=b.useState((n==null?void 0:n.tone)??""),[x,v]=b.useState((n==null?void 0:n.role)??"coder"),[S,w]=b.useState((n==null?void 0:n.agent_type)??"claude"),[j,C]=b.useState((n==null?void 0:n.model)??""),[T,E]=b.useState((n==null?void 0:n.system_hint)??""),[A,O]=b.useState((n==null?void 0:n.expertise.join(", "))??""),[F,L]=b.useState(null);b.useEffect(()=>{l((n==null?void 0:n.name)??zc.name),d((n==null?void 0:n.identity)??zc.identity),f((n==null?void 0:n.soul)??zc.soul),_((n==null?void 0:n.tone)??zc.tone),v((n==null?void 0:n.role)??zc.role),w((n==null?void 0:n.agent_type)??zc.agent_type),C((n==null?void 0:n.model)??zc.model),E((n==null?void 0:n.system_hint)??zc.system_hint),O((n==null?void 0:n.expertise.join(", "))??""),L(null)},[n]);const[$,z]=b.useState((n==null?void 0:n.avatar_url)??null);b.useEffect(()=>{if(!F){z((n==null?void 0:n.avatar_url)??null);return}const H=URL.createObjectURL(F);return z(H),()=>URL.revokeObjectURL(H)},[n==null?void 0:n.avatar_url,F]);const B=o.trim()&&u.trim()&&p.trim();return c.jsxs(Nu,{title:a(e==="create"?"agents.modal.create_title":"agents.modal.edit_title"),description:a("agents.modal.description"),onClose:i,children:[c.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[c.jsxs("label",{className:"grid gap-2 text-sm",children:[c.jsx("span",{style:{color:"var(--revka-text-secondary)"},children:a("agents.form.name")}),c.jsx("input",{className:"revka-input",value:o,onChange:H=>l(H.target.value)})]}),c.jsxs("label",{className:"grid gap-2 text-sm",children:[c.jsx("span",{style:{color:"var(--revka-text-secondary)"},children:a("agents.form.tone")}),c.jsx("input",{className:"revka-input",value:g,onChange:H=>_(H.target.value),placeholder:a("agents.form.tone_placeholder")})]})]}),c.jsxs("div",{className:"mt-4 flex items-center gap-3 rounded-[12px] border p-3",style:{borderColor:"var(--revka-border-soft)"},children:[c.jsx(Ts,{src:$,alt:o||(n==null?void 0:n.name)||"Agent",size:54,radius:14}),c.jsxs("div",{className:"min-w-0 flex-1",children:[c.jsx("div",{className:"text-sm font-semibold",style:{color:"var(--revka-text-primary)"},children:"Profile image"}),c.jsx("div",{className:"mt-1 text-xs",style:{color:"var(--revka-text-faint)"},children:"PNG, JPEG, or WebP."})]}),c.jsxs("label",{className:"revka-button cursor-pointer",children:[c.jsx(WE,{className:"h-4 w-4"}),"Upload",c.jsx("input",{type:"file",accept:"image/png,image/jpeg,image/webp",className:"sr-only",disabled:r,onChange:H=>{var D;return L(((D=H.target.files)==null?void 0:D[0])??null)}})]})]}),c.jsxs("label",{className:"mt-4 grid gap-2 text-sm",children:[c.jsx("span",{style:{color:"var(--revka-text-secondary)"},children:a("agents.form.identity")}),c.jsx("textarea",{className:"revka-input min-h-[7rem]",value:u,onChange:H=>d(H.target.value)})]}),c.jsxs("label",{className:"mt-4 grid gap-2 text-sm",children:[c.jsx("span",{style:{color:"var(--revka-text-secondary)"},children:a("agents.form.soul")}),c.jsx("textarea",{className:"revka-input min-h-[7rem]",value:p,onChange:H=>f(H.target.value)})]}),c.jsxs("div",{className:"mt-4 grid gap-4 md:grid-cols-2",children:[c.jsxs("label",{className:"grid gap-2 text-sm",children:[c.jsx("span",{style:{color:"var(--revka-text-secondary)"},children:a("agents.form.role")}),c.jsxs("select",{className:"revka-input",value:x,onChange:H=>v(H.target.value),children:[c.jsx("option",{value:"coder",children:a("agents.form.role.coder")}),c.jsx("option",{value:"reviewer",children:a("agents.form.role.reviewer")}),c.jsx("option",{value:"researcher",children:a("agents.form.role.researcher")})]})]}),c.jsxs("label",{className:"grid gap-2 text-sm",children:[c.jsx("span",{style:{color:"var(--revka-text-secondary)"},children:a("agents.form.agent_type")}),c.jsxs("select",{className:"revka-input",value:S,onChange:H=>w(H.target.value),children:[c.jsx("option",{value:"claude",children:"Claude"}),c.jsx("option",{value:"codex",children:"Codex"}),c.jsx("option",{value:"agy",children:"Antigravity (agy)"}),c.jsx("option",{value:"agent",children:"Cursor (agent)"}),c.jsx("option",{value:"opencode",children:"OpenCode (opencode)"})]})]})]}),c.jsxs("div",{className:"mt-4 grid gap-4 md:grid-cols-2",children:[c.jsxs("label",{className:"grid gap-2 text-sm",children:[c.jsx("span",{style:{color:"var(--revka-text-secondary)"},children:a("agents.form.model")}),c.jsx("input",{className:"revka-input",value:j,onChange:H=>C(H.target.value),placeholder:a("agents.form.model_placeholder")})]}),c.jsxs("label",{className:"grid gap-2 text-sm",children:[c.jsx("span",{style:{color:"var(--revka-text-secondary)"},children:a("agents.form.expertise")}),c.jsx("input",{className:"revka-input",value:A,onChange:H=>O(H.target.value),placeholder:a("agents.form.expertise_placeholder")})]})]}),c.jsxs("label",{className:"mt-4 grid gap-2 text-sm",children:[c.jsx("span",{style:{color:"var(--revka-text-secondary)"},children:a("agents.form.system_hint")}),c.jsx("textarea",{className:"revka-input min-h-[8rem]",value:T,onChange:H=>E(H.target.value),style:{fontFamily:"var(--pc-font-mono)"}})]}),c.jsxs("div",{className:"mt-5 flex flex-wrap justify-end gap-2",children:[c.jsx("button",{className:"revka-button",onClick:i,children:a("agents.form.cancel")}),c.jsx("button",{className:"revka-button","data-variant":"primary",disabled:r||!B,onClick:()=>s({name:o.trim(),identity:u.trim(),soul:p.trim(),expertise:A.split(",").map(H=>H.trim()).filter(Boolean),tone:g.trim(),role:x,agent_type:S,model:j.trim(),system_hint:T,avatarFile:F}),children:a(r?"agents.form.saving":e==="create"?"agents.form.save_create":"agents.form.save_edit")})]})]})}function VRe(e,n){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var i,s,a,o,l=[],u=!0,d=!1;try{if(a=(r=r.call(e)).next,n===0){if(Object(r)!==r)return;u=!1}else for(;!(u=(i=a.call(r)).done)&&(l.push(i.value),l.length!==n);u=!0);}catch(p){d=!0,s=p}finally{try{if(!u&&r.return!=null&&(o=r.return(),Object(o)!==o))return}finally{if(d)throw s}}return l}}function YRe(e,n,r){return n=n5e(n),n in e?Object.defineProperty(e,n,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[n]=r,e}function WI(e,n){return QRe(e)||VRe(e,n)||hV(e,n)||e5e()}function GRe(e){return XRe(e)||ZRe(e)||hV(e)||JRe()}function XRe(e){if(Array.isArray(e))return hE(e)}function QRe(e){if(Array.isArray(e))return e}function ZRe(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function hV(e,n){if(e){if(typeof e=="string")return hE(e,n);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return hE(e,n)}}function hE(e,n){(n==null||n>e.length)&&(n=e.length);for(var r=0,i=new Array(n);r<n;r++)i[r]=e[r];return i}function JRe(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function e5e(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function t5e(e,n){if(typeof e!="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var i=r.call(e,n);if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(n==="string"?String:Number)(e)}function n5e(e){var n=t5e(e,"string");return typeof n=="symbol"?n:String(n)}var r5e=function(n,r){var i=new Set(r);return Object.assign.apply(Object,[{}].concat(GRe(Object.entries(n).filter(function(s){var a=WI(s,1),o=a[0];return!i.has(o)}).map(function(s){var a=WI(s,2),o=a[0],l=a[1];return YRe({},o,l)}))))};function fE(e,n){(n==null||n>e.length)&&(n=e.length);for(var r=0,i=Array(n);r<n;r++)i[r]=e[r];return i}function i5e(e){if(Array.isArray(e))return e}function s5e(e){if(Array.isArray(e))return fE(e)}function a5e(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function o5e(e,n){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var i,s,a,o,l=[],u=!0,d=!1;try{if(a=(r=r.call(e)).next,n!==0)for(;!(u=(i=a.call(r)).done)&&(l.push(i.value),l.length!==n);u=!0);}catch(p){d=!0,s=p}finally{try{if(!u&&r.return!=null&&(o=r.return(),Object(o)!==o))return}finally{if(d)throw s}}return l}}function l5e(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function c5e(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function u5e(e,n){return i5e(e)||o5e(e,n)||fV(e,n)||l5e()}function qI(e){return s5e(e)||a5e(e)||fV(e)||c5e()}function fV(e,n){if(e){if(typeof e=="string")return fE(e,n);var r={}.toString.call(e).slice(8,-1);return r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set"?Array.from(e):r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?fE(e,n):void 0}}function d5e(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=n.wrapperElementType,i=r===void 0?"div":r,s=n.nodeMapper,a=s===void 0?function(p){return p}:s,o=n.methodNames,l=o===void 0?[]:o,u=n.initPropNames,d=u===void 0?[]:u;return b.forwardRef(function(p,f){var g=b.useRef(),_=b.useMemo(function(){var S=Object.fromEntries(d.filter(function(w){return p.hasOwnProperty(w)}).map(function(w){return[w,p[w]]}));return e(S)},[]);UI(function(){_(a(g.current))},b.useLayoutEffect),UI(function(){return _._destructor instanceof Function?_._destructor:void 0});var x=b.useCallback(function(S){for(var w=arguments.length,j=new Array(w>1?w-1:0),C=1;C<w;C++)j[C-1]=arguments[C];return _[S]instanceof Function?_[S].apply(_,j):void 0},[_]),v=b.useRef({});return Object.keys(r5e(p,[].concat(qI(l),qI(d)))).filter(function(S){return v.current[S]!==p[S]}).forEach(function(S){return x(S,p[S])}),v.current=p,b.useImperativeHandle(f,function(){return Object.fromEntries(l.map(function(S){return[S,function(){for(var w=arguments.length,j=new Array(w),C=0;C<w;C++)j[C]=arguments[C];return x.apply(void 0,[S].concat(j))}]}))},[x]),ip.createElement(i,{ref:g})})}function UI(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:b.useEffect,r=b.useRef(),i=b.useRef(!1),s=b.useRef(!1),a=b.useState(0),o=u5e(a,2);o[0];var l=o[1];i.current&&(s.current=!0),n(function(){return i.current||(r.current=e(),i.current=!0),l(function(u){return u+1}),function(){s.current&&r.current&&r.current()}},[])}class KI extends Map{constructor(n,r=p5e){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:r}}),n!=null)for(const[i,s]of n)this.set(i,s)}get(n){return super.get(VI(this,n))}has(n){return super.has(VI(this,n))}set(n,r){return super.set(h5e(this,n),r)}delete(n){return super.delete(f5e(this,n))}}function VI({_intern:e,_key:n},r){const i=n(r);return e.has(i)?e.get(i):r}function h5e({_intern:e,_key:n},r){const i=n(r);return e.has(i)?e.get(i):(e.set(i,r),r)}function f5e({_intern:e,_key:n},r){const i=n(r);return e.has(i)&&(r=e.get(i),e.delete(i)),r}function p5e(e){return e!==null&&typeof e=="object"?e.valueOf():e}function YI(e,n){let r;if(n===void 0)for(const i of e)i!=null&&(r<i||r===void 0&&i>=i)&&(r=i);else{let i=-1;for(let s of e)(s=n(s,++i,e))!=null&&(r<s||r===void 0&&s>=s)&&(r=s)}return r}function GI(e,n){let r;if(n===void 0)for(const i of e)i!=null&&(r>i||r===void 0&&i>=i)&&(r=i);else{let i=-1;for(let s of e)(s=n(s,++i,e))!=null&&(r>s||r===void 0&&s>=s)&&(r=s)}return r}function m5e(e,n){let r=0;for(let i of e)(i=+i)&&(r+=i);return r}var g5e=typeof global=="object"&&global&&global.Object===Object&&global,v5e=typeof self=="object"&&self&&self.Object===Object&&self,pV=g5e||v5e||Function("return this")(),c0=pV.Symbol,mV=Object.prototype,y5e=mV.hasOwnProperty,_5e=mV.toString,Rm=c0?c0.toStringTag:void 0;function x5e(e){var n=y5e.call(e,Rm),r=e[Rm];try{e[Rm]=void 0;var i=!0}catch{}var s=_5e.call(e);return i&&(n?e[Rm]=r:delete e[Rm]),s}var b5e=Object.prototype,k5e=b5e.toString;function w5e(e){return k5e.call(e)}var S5e="[object Null]",C5e="[object Undefined]",XI=c0?c0.toStringTag:void 0;function j5e(e){return e==null?e===void 0?C5e:S5e:XI&&XI in Object(e)?x5e(e):w5e(e)}function N5e(e){return e!=null&&typeof e=="object"}var E5e="[object Symbol]";function A5e(e){return typeof e=="symbol"||N5e(e)&&j5e(e)==E5e}var T5e=/\s/;function M5e(e){for(var n=e.length;n--&&T5e.test(e.charAt(n)););return n}var R5e=/^\s+/;function O5e(e){return e&&e.slice(0,M5e(e)+1).replace(R5e,"")}function u0(e){var n=typeof e;return e!=null&&(n=="object"||n=="function")}var QI=NaN,D5e=/^[-+]0x[0-9a-f]+$/i,P5e=/^0b[01]+$/i,L5e=/^0o[0-7]+$/i,I5e=parseInt;function ZI(e){if(typeof e=="number")return e;if(A5e(e))return QI;if(u0(e)){var n=typeof e.valueOf=="function"?e.valueOf():e;e=u0(n)?n+"":n}if(typeof e!="string")return e===0?e:+e;e=O5e(e);var r=P5e.test(e);return r||L5e.test(e)?I5e(e.slice(2),r?2:8):D5e.test(e)?QI:+e}var z2=function(){return pV.Date.now()},B5e="Expected a function",z5e=Math.max,$5e=Math.min;function gV(e,n,r){var i,s,a,o,l,u,d=0,p=!1,f=!1,g=!0;if(typeof e!="function")throw new TypeError(B5e);n=ZI(n)||0,u0(r)&&(p=!!r.leading,f="maxWait"in r,a=f?z5e(ZI(r.maxWait)||0,n):a,g="trailing"in r?!!r.trailing:g);function _(A){var O=i,F=s;return i=s=void 0,d=A,o=e.apply(F,O),o}function x(A){return d=A,l=setTimeout(w,n),p?_(A):o}function v(A){var O=A-u,F=A-d,L=n-O;return f?$5e(L,a-F):L}function S(A){var O=A-u,F=A-d;return u===void 0||O>=n||O<0||f&&F>=a}function w(){var A=z2();if(S(A))return j(A);l=setTimeout(w,v(A))}function j(A){return l=void 0,g&&i?_(A):(i=s=void 0,o)}function C(){l!==void 0&&clearTimeout(l),d=0,i=u=s=l=void 0}function T(){return l===void 0?o:j(z2())}function E(){var A=z2(),O=S(A);if(i=arguments,s=this,u=A,O){if(l===void 0)return x(u);if(f)return clearTimeout(l),l=setTimeout(w,n),_(u)}return l===void 0&&(l=setTimeout(w,n)),o}return E.cancel=C,E.flush=T,E}var F5e="Expected a function";function H5e(e,n,r){var i=!0,s=!0;if(typeof e!="function")throw new TypeError(F5e);return u0(r)&&(i="leading"in r?!!r.leading:i,s="trailing"in r?!!r.trailing:s),gV(e,n,{leading:i,maxWait:n,trailing:s})}var Ad=Object.freeze({Linear:Object.freeze({None:function(e){return e},In:function(e){return e},Out:function(e){return e},InOut:function(e){return e}}),Quadratic:Object.freeze({In:function(e){return e*e},Out:function(e){return e*(2-e)},InOut:function(e){return(e*=2)<1?.5*e*e:-.5*(--e*(e-2)-1)}}),Cubic:Object.freeze({In:function(e){return e*e*e},Out:function(e){return--e*e*e+1},InOut:function(e){return(e*=2)<1?.5*e*e*e:.5*((e-=2)*e*e+2)}}),Quartic:Object.freeze({In:function(e){return e*e*e*e},Out:function(e){return 1- --e*e*e*e},InOut:function(e){return(e*=2)<1?.5*e*e*e*e:-.5*((e-=2)*e*e*e-2)}}),Quintic:Object.freeze({In:function(e){return e*e*e*e*e},Out:function(e){return--e*e*e*e*e+1},InOut:function(e){return(e*=2)<1?.5*e*e*e*e*e:.5*((e-=2)*e*e*e*e+2)}}),Sinusoidal:Object.freeze({In:function(e){return 1-Math.sin((1-e)*Math.PI/2)},Out:function(e){return Math.sin(e*Math.PI/2)},InOut:function(e){return .5*(1-Math.sin(Math.PI*(.5-e)))}}),Exponential:Object.freeze({In:function(e){return e===0?0:Math.pow(1024,e-1)},Out:function(e){return e===1?1:1-Math.pow(2,-10*e)},InOut:function(e){return e===0?0:e===1?1:(e*=2)<1?.5*Math.pow(1024,e-1):.5*(-Math.pow(2,-10*(e-1))+2)}}),Circular:Object.freeze({In:function(e){return 1-Math.sqrt(1-e*e)},Out:function(e){return Math.sqrt(1- --e*e)},InOut:function(e){return(e*=2)<1?-.5*(Math.sqrt(1-e*e)-1):.5*(Math.sqrt(1-(e-=2)*e)+1)}}),Elastic:Object.freeze({In:function(e){return e===0?0:e===1?1:-Math.pow(2,10*(e-1))*Math.sin((e-1.1)*5*Math.PI)},Out:function(e){return e===0?0:e===1?1:Math.pow(2,-10*e)*Math.sin((e-.1)*5*Math.PI)+1},InOut:function(e){return e===0?0:e===1?1:(e*=2,e<1?-.5*Math.pow(2,10*(e-1))*Math.sin((e-1.1)*5*Math.PI):.5*Math.pow(2,-10*(e-1))*Math.sin((e-1.1)*5*Math.PI)+1)}}),Back:Object.freeze({In:function(e){var n=1.70158;return e===1?1:e*e*((n+1)*e-n)},Out:function(e){var n=1.70158;return e===0?0:--e*e*((n+1)*e+n)+1},InOut:function(e){var n=2.5949095;return(e*=2)<1?.5*(e*e*((n+1)*e-n)):.5*((e-=2)*e*((n+1)*e+n)+2)}}),Bounce:Object.freeze({In:function(e){return 1-Ad.Bounce.Out(1-e)},Out:function(e){return e<1/2.75?7.5625*e*e:e<2/2.75?7.5625*(e-=1.5/2.75)*e+.75:e<2.5/2.75?7.5625*(e-=2.25/2.75)*e+.9375:7.5625*(e-=2.625/2.75)*e+.984375},InOut:function(e){return e<.5?Ad.Bounce.In(e*2)*.5:Ad.Bounce.Out(e*2-1)*.5+.5}}),generatePow:function(e){return e===void 0&&(e=4),e=e<Number.EPSILON?Number.EPSILON:e,e=e>1e4?1e4:e,{In:function(n){return Math.pow(n,e)},Out:function(n){return 1-Math.pow(1-n,e)},InOut:function(n){return n<.5?Math.pow(n*2,e)/2:(1-Math.pow(2-n*2,e))/2+.5}}}}),Zm=function(){return performance.now()},vV=(function(){function e(){for(var n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];this._tweens={},this._tweensAddedDuringUpdate={},this.add.apply(this,n)}return e.prototype.getAll=function(){var n=this;return Object.keys(this._tweens).map(function(r){return n._tweens[r]})},e.prototype.removeAll=function(){this._tweens={}},e.prototype.add=function(){for(var n,r=[],i=0;i<arguments.length;i++)r[i]=arguments[i];for(var s=0,a=r;s<a.length;s++){var o=a[s];(n=o._group)===null||n===void 0||n.remove(o),o._group=this,this._tweens[o.getId()]=o,this._tweensAddedDuringUpdate[o.getId()]=o}},e.prototype.remove=function(){for(var n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];for(var i=0,s=n;i<s.length;i++){var a=s[i];a._group=void 0,delete this._tweens[a.getId()],delete this._tweensAddedDuringUpdate[a.getId()]}},e.prototype.allStopped=function(){return this.getAll().every(function(n){return!n.isPlaying()})},e.prototype.update=function(n,r){n===void 0&&(n=Zm()),r===void 0&&(r=!0);var i=Object.keys(this._tweens);if(i.length!==0)for(;i.length>0;){this._tweensAddedDuringUpdate={};for(var s=0;s<i.length;s++){var a=this._tweens[i[s]],o=!r;a&&a.update(n,o)===!1&&!r&&this.remove(a)}i=Object.keys(this._tweensAddedDuringUpdate)}},e})(),pE={Linear:function(e,n){var r=e.length-1,i=r*n,s=Math.floor(i),a=pE.Utils.Linear;return n<0?a(e[0],e[1],i):n>1?a(e[r],e[r-1],r-i):a(e[s],e[s+1>r?r:s+1],i-s)},Utils:{Linear:function(e,n,r){return(n-e)*r+e}}},yV=(function(){function e(){}return e.nextId=function(){return e._nextId++},e._nextId=0,e})(),mE=new vV,JI=(function(){function e(n,r){this._isPaused=!1,this._pauseStart=0,this._valuesStart={},this._valuesEnd={},this._valuesStartRepeat={},this._duration=1e3,this._isDynamic=!1,this._initialRepeat=0,this._repeat=0,this._yoyo=!1,this._isPlaying=!1,this._reversed=!1,this._delayTime=0,this._startTime=0,this._easingFunction=Ad.Linear.None,this._interpolationFunction=pE.Linear,this._chainedTweens=[],this._onStartCallbackFired=!1,this._onEveryStartCallbackFired=!1,this._id=yV.nextId(),this._isChainStopped=!1,this._propertiesAreSetUp=!1,this._goToEnd=!1,this._object=n,typeof r=="object"?(this._group=r,r.add(this)):r===!0&&(this._group=mE,mE.add(this))}return e.prototype.getId=function(){return this._id},e.prototype.isPlaying=function(){return this._isPlaying},e.prototype.isPaused=function(){return this._isPaused},e.prototype.getDuration=function(){return this._duration},e.prototype.to=function(n,r){if(r===void 0&&(r=1e3),this._isPlaying)throw new Error("Can not call Tween.to() while Tween is already started or paused. Stop the Tween first.");return this._valuesEnd=n,this._propertiesAreSetUp=!1,this._duration=r<0?0:r,this},e.prototype.duration=function(n){return n===void 0&&(n=1e3),this._duration=n<0?0:n,this},e.prototype.dynamic=function(n){return n===void 0&&(n=!1),this._isDynamic=n,this},e.prototype.start=function(n,r){if(n===void 0&&(n=Zm()),r===void 0&&(r=!1),this._isPlaying)return this;if(this._repeat=this._initialRepeat,this._reversed){this._reversed=!1;for(var i in this._valuesStartRepeat)this._swapEndStartRepeatValues(i),this._valuesStart[i]=this._valuesStartRepeat[i]}if(this._isPlaying=!0,this._isPaused=!1,this._onStartCallbackFired=!1,this._onEveryStartCallbackFired=!1,this._isChainStopped=!1,this._startTime=n,this._startTime+=this._delayTime,!this._propertiesAreSetUp||r){if(this._propertiesAreSetUp=!0,!this._isDynamic){var s={};for(var a in this._valuesEnd)s[a]=this._valuesEnd[a];this._valuesEnd=s}this._setupProperties(this._object,this._valuesStart,this._valuesEnd,this._valuesStartRepeat,r)}return this},e.prototype.startFromCurrentValues=function(n){return this.start(n,!0)},e.prototype._setupProperties=function(n,r,i,s,a){for(var o in i){var l=n[o],u=Array.isArray(l),d=u?"array":typeof l,p=!u&&Array.isArray(i[o]);if(!(d==="undefined"||d==="function")){if(p){var f=i[o];if(f.length===0)continue;for(var g=[l],_=0,x=f.length;_<x;_+=1){var v=this._handleRelativeValue(l,f[_]);if(isNaN(v)){p=!1,console.warn("Found invalid interpolation list. Skipping.");break}g.push(v)}p&&(i[o]=g)}if((d==="object"||u)&&l&&!p){r[o]=u?[]:{};var S=l;for(var w in S)r[o][w]=S[w];s[o]=u?[]:{};var f=i[o];if(!this._isDynamic){var j={};for(var w in f)j[w]=f[w];i[o]=f=j}this._setupProperties(S,r[o],f,s[o],a)}else(typeof r[o]>"u"||a)&&(r[o]=l),u||(r[o]*=1),p?s[o]=i[o].slice().reverse():s[o]=r[o]||0}}},e.prototype.stop=function(){return this._isChainStopped||(this._isChainStopped=!0,this.stopChainedTweens()),this._isPlaying?(this._isPlaying=!1,this._isPaused=!1,this._onStopCallback&&this._onStopCallback(this._object),this):this},e.prototype.end=function(){return this._goToEnd=!0,this.update(this._startTime+this._duration),this},e.prototype.pause=function(n){return n===void 0&&(n=Zm()),this._isPaused||!this._isPlaying?this:(this._isPaused=!0,this._pauseStart=n,this)},e.prototype.resume=function(n){return n===void 0&&(n=Zm()),!this._isPaused||!this._isPlaying?this:(this._isPaused=!1,this._startTime+=n-this._pauseStart,this._pauseStart=0,this)},e.prototype.stopChainedTweens=function(){for(var n=0,r=this._chainedTweens.length;n<r;n++)this._chainedTweens[n].stop();return this},e.prototype.group=function(n){return n?(n.add(this),this):(console.warn("tween.group() without args has been removed, use group.add(tween) instead."),this)},e.prototype.remove=function(){var n;return(n=this._group)===null||n===void 0||n.remove(this),this},e.prototype.delay=function(n){return n===void 0&&(n=0),this._delayTime=n,this},e.prototype.repeat=function(n){return n===void 0&&(n=0),this._initialRepeat=n,this._repeat=n,this},e.prototype.repeatDelay=function(n){return this._repeatDelayTime=n,this},e.prototype.yoyo=function(n){return n===void 0&&(n=!1),this._yoyo=n,this},e.prototype.easing=function(n){return n===void 0&&(n=Ad.Linear.None),this._easingFunction=n,this},e.prototype.interpolation=function(n){return n===void 0&&(n=pE.Linear),this._interpolationFunction=n,this},e.prototype.chain=function(){for(var n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];return this._chainedTweens=n,this},e.prototype.onStart=function(n){return this._onStartCallback=n,this},e.prototype.onEveryStart=function(n){return this._onEveryStartCallback=n,this},e.prototype.onUpdate=function(n){return this._onUpdateCallback=n,this},e.prototype.onRepeat=function(n){return this._onRepeatCallback=n,this},e.prototype.onComplete=function(n){return this._onCompleteCallback=n,this},e.prototype.onStop=function(n){return this._onStopCallback=n,this},e.prototype.update=function(n,r){var i=this,s;if(n===void 0&&(n=Zm()),r===void 0&&(r=e.autoStartOnUpdate),this._isPaused)return!0;var a;if(!this._goToEnd&&!this._isPlaying)if(r)this.start(n,!0);else return!1;if(this._goToEnd=!1,n<this._startTime)return!0;this._onStartCallbackFired===!1&&(this._onStartCallback&&this._onStartCallback(this._object),this._onStartCallbackFired=!0),this._onEveryStartCallbackFired===!1&&(this._onEveryStartCallback&&this._onEveryStartCallback(this._object),this._onEveryStartCallbackFired=!0);var o=n-this._startTime,l=this._duration+((s=this._repeatDelayTime)!==null&&s!==void 0?s:this._delayTime),u=this._duration+this._repeat*l,d=function(){if(i._duration===0||o>u)return 1;var v=Math.trunc(o/l),S=o-v*l,w=Math.min(S/i._duration,1);return w===0&&o===i._duration?1:w},p=d(),f=this._easingFunction(p);if(this._updateProperties(this._object,this._valuesStart,this._valuesEnd,f),this._onUpdateCallback&&this._onUpdateCallback(this._object,p),this._duration===0||o>=this._duration)if(this._repeat>0){var g=Math.min(Math.trunc((o-this._duration)/l)+1,this._repeat);isFinite(this._repeat)&&(this._repeat-=g);for(a in this._valuesStartRepeat)!this._yoyo&&typeof this._valuesEnd[a]=="string"&&(this._valuesStartRepeat[a]=this._valuesStartRepeat[a]+parseFloat(this._valuesEnd[a])),this._yoyo&&this._swapEndStartRepeatValues(a),this._valuesStart[a]=this._valuesStartRepeat[a];return this._yoyo&&(this._reversed=!this._reversed),this._startTime+=l*g,this._onRepeatCallback&&this._onRepeatCallback(this._object),this._onEveryStartCallbackFired=!1,!0}else{this._onCompleteCallback&&this._onCompleteCallback(this._object);for(var _=0,x=this._chainedTweens.length;_<x;_++)this._chainedTweens[_].start(this._startTime+this._duration,!1);return this._isPlaying=!1,!1}return!0},e.prototype._updateProperties=function(n,r,i,s){for(var a in i)if(r[a]!==void 0){var o=r[a]||0,l=i[a],u=Array.isArray(n[a]),d=Array.isArray(l),p=!u&&d;p?n[a]=this._interpolationFunction(l,s):typeof l=="object"&&l?this._updateProperties(n[a],o,l,s):(l=this._handleRelativeValue(o,l),typeof l=="number"&&(n[a]=o+(l-o)*s))}},e.prototype._handleRelativeValue=function(n,r){return typeof r!="string"?r:r.charAt(0)==="+"||r.charAt(0)==="-"?n+parseFloat(r):parseFloat(r)},e.prototype._swapEndStartRepeatValues=function(n){var r=this._valuesStartRepeat[n],i=this._valuesEnd[n];typeof i=="string"?this._valuesStartRepeat[n]=this._valuesStartRepeat[n]+parseFloat(i):this._valuesStartRepeat[n]=this._valuesEnd[n],this._valuesEnd[n]=r},e.autoStartOnUpdate=!1,e})();yV.nextId;var rl=mE;rl.getAll.bind(rl);rl.removeAll.bind(rl);rl.add.bind(rl);rl.remove.bind(rl);rl.update.bind(rl);function e8(e,n){(n==null||n>e.length)&&(n=e.length);for(var r=0,i=Array(n);r<n;r++)i[r]=e[r];return i}function W5e(e){if(Array.isArray(e))return e}function q5e(e,n){if(!(e instanceof n))throw new TypeError("Cannot call a class as a function")}function U5e(e,n,r){return Object.defineProperty(e,"prototype",{writable:!1}),e}function K5e(e,n){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var i,s,a,o,l=[],u=!0,d=!1;try{if(a=(r=r.call(e)).next,n!==0)for(;!(u=(i=a.call(r)).done)&&(l.push(i.value),l.length!==n);u=!0);}catch(p){d=!0,s=p}finally{try{if(!u&&r.return!=null&&(o=r.return(),Object(o)!==o))return}finally{if(d)throw s}}return l}}function V5e(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Y5e(e,n){return W5e(e)||K5e(e,n)||G5e(e,n)||V5e()}function G5e(e,n){if(e){if(typeof e=="string")return e8(e,n);var r={}.toString.call(e).slice(8,-1);return r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set"?Array.from(e):r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?e8(e,n):void 0}}var X5e=U5e(function e(n,r){var i=r.default,s=i===void 0?null:i,a=r.triggerUpdate,o=a===void 0?!0:a,l=r.onChange,u=l===void 0?function(d,p){}:l;q5e(this,e),this.name=n,this.defaultVal=s,this.triggerUpdate=o,this.onChange=u});function eM(e){var n=e.stateInit,r=n===void 0?function(){return{}}:n,i=e.props,s=i===void 0?{}:i,a=e.methods,o=a===void 0?{}:a,l=e.aliases,u=l===void 0?{}:l,d=e.init,p=d===void 0?function(){}:d,f=e.update,g=f===void 0?function(){}:f,_=Object.keys(s).map(function(x){return new X5e(x,s[x])});return function x(){for(var v=arguments.length,S=new Array(v),w=0;w<v;w++)S[w]=arguments[w];var j=!!(this instanceof x&&this.constructor),C=j?S.shift():void 0,T=S[0],E=T===void 0?{}:T,A=Object.assign({},r instanceof Function?r(E):r,{initialised:!1}),O={};function F(z){return L(z,E),$(),F}var L=function(B,H){p.call(F,B,A,H),A.initialised=!0},$=gV(function(){A.initialised&&(g.call(F,A,O),O={})},1);return _.forEach(function(z){F[z.name]=B(z);function B(H){var D=H.name,U=H.triggerUpdate,I=U===void 0?!1:U,X=H.onChange,K=X===void 0?function(R,q){}:X,Q=H.defaultVal,V=Q===void 0?null:Q;return function(R){var q=A[D];if(!arguments.length)return q;var W=R===void 0?V:R;return A[D]=W,K.call(F,W,A,q),!O.hasOwnProperty(D)&&(O[D]=q),I&&$(),F}}}),Object.keys(o).forEach(function(z){F[z]=function(){for(var B,H=arguments.length,D=new Array(H),U=0;U<H;U++)D[U]=arguments[U];return(B=o[z]).call.apply(B,[F,A].concat(D))}}),Object.entries(u).forEach(function(z){var B=Y5e(z,2),H=B[0],D=B[1];return F[H]=F[D]}),F.resetProps=function(){return _.forEach(function(z){F[z.name](z.defaultVal)}),F},F.resetProps(),A._rerender=$,j&&C&&F(C),F}}var Ln=(function(e){return typeof e=="function"?e:typeof e=="string"?function(n){return n[e]}:function(n){return e}});function d0(e){"@babel/helpers - typeof";return d0=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(n){return typeof n}:function(n){return n&&typeof Symbol=="function"&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n},d0(e)}var Q5e=/^\s+/,Z5e=/\s+$/;function Et(e,n){if(e=e||"",n=n||{},e instanceof Et)return e;if(!(this instanceof Et))return new Et(e,n);var r=J5e(e);this._originalInput=e,this._r=r.r,this._g=r.g,this._b=r.b,this._a=r.a,this._roundA=Math.round(100*this._a)/100,this._format=n.format||r.format,this._gradientType=n.gradientType,this._r<1&&(this._r=Math.round(this._r)),this._g<1&&(this._g=Math.round(this._g)),this._b<1&&(this._b=Math.round(this._b)),this._ok=r.ok}Et.prototype={isDark:function(){return this.getBrightness()<128},isLight:function(){return!this.isDark()},isValid:function(){return this._ok},getOriginalInput:function(){return this._originalInput},getFormat:function(){return this._format},getAlpha:function(){return this._a},getBrightness:function(){var n=this.toRgb();return(n.r*299+n.g*587+n.b*114)/1e3},getLuminance:function(){var n=this.toRgb(),r,i,s,a,o,l;return r=n.r/255,i=n.g/255,s=n.b/255,r<=.03928?a=r/12.92:a=Math.pow((r+.055)/1.055,2.4),i<=.03928?o=i/12.92:o=Math.pow((i+.055)/1.055,2.4),s<=.03928?l=s/12.92:l=Math.pow((s+.055)/1.055,2.4),.2126*a+.7152*o+.0722*l},setAlpha:function(n){return this._a=_V(n),this._roundA=Math.round(100*this._a)/100,this},toHsv:function(){var n=n8(this._r,this._g,this._b);return{h:n.h*360,s:n.s,v:n.v,a:this._a}},toHsvString:function(){var n=n8(this._r,this._g,this._b),r=Math.round(n.h*360),i=Math.round(n.s*100),s=Math.round(n.v*100);return this._a==1?"hsv("+r+", "+i+"%, "+s+"%)":"hsva("+r+", "+i+"%, "+s+"%, "+this._roundA+")"},toHsl:function(){var n=t8(this._r,this._g,this._b);return{h:n.h*360,s:n.s,l:n.l,a:this._a}},toHslString:function(){var n=t8(this._r,this._g,this._b),r=Math.round(n.h*360),i=Math.round(n.s*100),s=Math.round(n.l*100);return this._a==1?"hsl("+r+", "+i+"%, "+s+"%)":"hsla("+r+", "+i+"%, "+s+"%, "+this._roundA+")"},toHex:function(n){return r8(this._r,this._g,this._b,n)},toHexString:function(n){return"#"+this.toHex(n)},toHex8:function(n){return r3e(this._r,this._g,this._b,this._a,n)},toHex8String:function(n){return"#"+this.toHex8(n)},toRgb:function(){return{r:Math.round(this._r),g:Math.round(this._g),b:Math.round(this._b),a:this._a}},toRgbString:function(){return this._a==1?"rgb("+Math.round(this._r)+", "+Math.round(this._g)+", "+Math.round(this._b)+")":"rgba("+Math.round(this._r)+", "+Math.round(this._g)+", "+Math.round(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:Math.round(vr(this._r,255)*100)+"%",g:Math.round(vr(this._g,255)*100)+"%",b:Math.round(vr(this._b,255)*100)+"%",a:this._a}},toPercentageRgbString:function(){return this._a==1?"rgb("+Math.round(vr(this._r,255)*100)+"%, "+Math.round(vr(this._g,255)*100)+"%, "+Math.round(vr(this._b,255)*100)+"%)":"rgba("+Math.round(vr(this._r,255)*100)+"%, "+Math.round(vr(this._g,255)*100)+"%, "+Math.round(vr(this._b,255)*100)+"%, "+this._roundA+")"},toName:function(){return this._a===0?"transparent":this._a<1?!1:m3e[r8(this._r,this._g,this._b,!0)]||!1},toFilter:function(n){var r="#"+i8(this._r,this._g,this._b,this._a),i=r,s=this._gradientType?"GradientType = 1, ":"";if(n){var a=Et(n);i="#"+i8(a._r,a._g,a._b,a._a)}return"progid:DXImageTransform.Microsoft.gradient("+s+"startColorstr="+r+",endColorstr="+i+")"},toString:function(n){var r=!!n;n=n||this._format;var i=!1,s=this._a<1&&this._a>=0,a=!r&&s&&(n==="hex"||n==="hex6"||n==="hex3"||n==="hex4"||n==="hex8"||n==="name");return a?n==="name"&&this._a===0?this.toName():this.toRgbString():(n==="rgb"&&(i=this.toRgbString()),n==="prgb"&&(i=this.toPercentageRgbString()),(n==="hex"||n==="hex6")&&(i=this.toHexString()),n==="hex3"&&(i=this.toHexString(!0)),n==="hex4"&&(i=this.toHex8String(!0)),n==="hex8"&&(i=this.toHex8String()),n==="name"&&(i=this.toName()),n==="hsl"&&(i=this.toHslString()),n==="hsv"&&(i=this.toHsvString()),i||this.toHexString())},clone:function(){return Et(this.toString())},_applyModification:function(n,r){var i=n.apply(null,[this].concat([].slice.call(r)));return this._r=i._r,this._g=i._g,this._b=i._b,this.setAlpha(i._a),this},lighten:function(){return this._applyModification(o3e,arguments)},brighten:function(){return this._applyModification(l3e,arguments)},darken:function(){return this._applyModification(c3e,arguments)},desaturate:function(){return this._applyModification(i3e,arguments)},saturate:function(){return this._applyModification(s3e,arguments)},greyscale:function(){return this._applyModification(a3e,arguments)},spin:function(){return this._applyModification(u3e,arguments)},_applyCombination:function(n,r){return n.apply(null,[this].concat([].slice.call(r)))},analogous:function(){return this._applyCombination(f3e,arguments)},complement:function(){return this._applyCombination(d3e,arguments)},monochromatic:function(){return this._applyCombination(p3e,arguments)},splitcomplement:function(){return this._applyCombination(h3e,arguments)},triad:function(){return this._applyCombination(s8,[3])},tetrad:function(){return this._applyCombination(s8,[4])}};Et.fromRatio=function(e,n){if(d0(e)=="object"){var r={};for(var i in e)e.hasOwnProperty(i)&&(i==="a"?r[i]=e[i]:r[i]=Jm(e[i]));e=r}return Et(e,n)};function J5e(e){var n={r:0,g:0,b:0},r=1,i=null,s=null,a=null,o=!1,l=!1;return typeof e=="string"&&(e=_3e(e)),d0(e)=="object"&&(Al(e.r)&&Al(e.g)&&Al(e.b)?(n=e3e(e.r,e.g,e.b),o=!0,l=String(e.r).substr(-1)==="%"?"prgb":"rgb"):Al(e.h)&&Al(e.s)&&Al(e.v)?(i=Jm(e.s),s=Jm(e.v),n=n3e(e.h,i,s),o=!0,l="hsv"):Al(e.h)&&Al(e.s)&&Al(e.l)&&(i=Jm(e.s),a=Jm(e.l),n=t3e(e.h,i,a),o=!0,l="hsl"),e.hasOwnProperty("a")&&(r=e.a)),r=_V(r),{ok:o,format:e.format||l,r:Math.min(255,Math.max(n.r,0)),g:Math.min(255,Math.max(n.g,0)),b:Math.min(255,Math.max(n.b,0)),a:r}}function e3e(e,n,r){return{r:vr(e,255)*255,g:vr(n,255)*255,b:vr(r,255)*255}}function t8(e,n,r){e=vr(e,255),n=vr(n,255),r=vr(r,255);var i=Math.max(e,n,r),s=Math.min(e,n,r),a,o,l=(i+s)/2;if(i==s)a=o=0;else{var u=i-s;switch(o=l>.5?u/(2-i-s):u/(i+s),i){case e:a=(n-r)/u+(n<r?6:0);break;case n:a=(r-e)/u+2;break;case r:a=(e-n)/u+4;break}a/=6}return{h:a,s:o,l}}function t3e(e,n,r){var i,s,a;e=vr(e,360),n=vr(n,100),r=vr(r,100);function o(d,p,f){return f<0&&(f+=1),f>1&&(f-=1),f<1/6?d+(p-d)*6*f:f<1/2?p:f<2/3?d+(p-d)*(2/3-f)*6:d}if(n===0)i=s=a=r;else{var l=r<.5?r*(1+n):r+n-r*n,u=2*r-l;i=o(u,l,e+1/3),s=o(u,l,e),a=o(u,l,e-1/3)}return{r:i*255,g:s*255,b:a*255}}function n8(e,n,r){e=vr(e,255),n=vr(n,255),r=vr(r,255);var i=Math.max(e,n,r),s=Math.min(e,n,r),a,o,l=i,u=i-s;if(o=i===0?0:u/i,i==s)a=0;else{switch(i){case e:a=(n-r)/u+(n<r?6:0);break;case n:a=(r-e)/u+2;break;case r:a=(e-n)/u+4;break}a/=6}return{h:a,s:o,v:l}}function n3e(e,n,r){e=vr(e,360)*6,n=vr(n,100),r=vr(r,100);var i=Math.floor(e),s=e-i,a=r*(1-n),o=r*(1-s*n),l=r*(1-(1-s)*n),u=i%6,d=[r,o,a,a,l,r][u],p=[l,r,r,o,a,a][u],f=[a,a,l,r,r,o][u];return{r:d*255,g:p*255,b:f*255}}function r8(e,n,r,i){var s=[eo(Math.round(e).toString(16)),eo(Math.round(n).toString(16)),eo(Math.round(r).toString(16))];return i&&s[0].charAt(0)==s[0].charAt(1)&&s[1].charAt(0)==s[1].charAt(1)&&s[2].charAt(0)==s[2].charAt(1)?s[0].charAt(0)+s[1].charAt(0)+s[2].charAt(0):s.join("")}function r3e(e,n,r,i,s){var a=[eo(Math.round(e).toString(16)),eo(Math.round(n).toString(16)),eo(Math.round(r).toString(16)),eo(xV(i))];return s&&a[0].charAt(0)==a[0].charAt(1)&&a[1].charAt(0)==a[1].charAt(1)&&a[2].charAt(0)==a[2].charAt(1)&&a[3].charAt(0)==a[3].charAt(1)?a[0].charAt(0)+a[1].charAt(0)+a[2].charAt(0)+a[3].charAt(0):a.join("")}function i8(e,n,r,i){var s=[eo(xV(i)),eo(Math.round(e).toString(16)),eo(Math.round(n).toString(16)),eo(Math.round(r).toString(16))];return s.join("")}Et.equals=function(e,n){return!e||!n?!1:Et(e).toRgbString()==Et(n).toRgbString()};Et.random=function(){return Et.fromRatio({r:Math.random(),g:Math.random(),b:Math.random()})};function i3e(e,n){n=n===0?0:n||10;var r=Et(e).toHsl();return r.s-=n/100,r.s=wk(r.s),Et(r)}function s3e(e,n){n=n===0?0:n||10;var r=Et(e).toHsl();return r.s+=n/100,r.s=wk(r.s),Et(r)}function a3e(e){return Et(e).desaturate(100)}function o3e(e,n){n=n===0?0:n||10;var r=Et(e).toHsl();return r.l+=n/100,r.l=wk(r.l),Et(r)}function l3e(e,n){n=n===0?0:n||10;var r=Et(e).toRgb();return r.r=Math.max(0,Math.min(255,r.r-Math.round(255*-(n/100)))),r.g=Math.max(0,Math.min(255,r.g-Math.round(255*-(n/100)))),r.b=Math.max(0,Math.min(255,r.b-Math.round(255*-(n/100)))),Et(r)}function c3e(e,n){n=n===0?0:n||10;var r=Et(e).toHsl();return r.l-=n/100,r.l=wk(r.l),Et(r)}function u3e(e,n){var r=Et(e).toHsl(),i=(r.h+n)%360;return r.h=i<0?360+i:i,Et(r)}function d3e(e){var n=Et(e).toHsl();return n.h=(n.h+180)%360,Et(n)}function s8(e,n){if(isNaN(n)||n<=0)throw new Error("Argument to polyad must be a positive number");for(var r=Et(e).toHsl(),i=[Et(e)],s=360/n,a=1;a<n;a++)i.push(Et({h:(r.h+a*s)%360,s:r.s,l:r.l}));return i}function h3e(e){var n=Et(e).toHsl(),r=n.h;return[Et(e),Et({h:(r+72)%360,s:n.s,l:n.l}),Et({h:(r+216)%360,s:n.s,l:n.l})]}function f3e(e,n,r){n=n||6,r=r||30;var i=Et(e).toHsl(),s=360/r,a=[Et(e)];for(i.h=(i.h-(s*n>>1)+720)%360;--n;)i.h=(i.h+s)%360,a.push(Et(i));return a}function p3e(e,n){n=n||6;for(var r=Et(e).toHsv(),i=r.h,s=r.s,a=r.v,o=[],l=1/n;n--;)o.push(Et({h:i,s,v:a})),a=(a+l)%1;return o}Et.mix=function(e,n,r){r=r===0?0:r||50;var i=Et(e).toRgb(),s=Et(n).toRgb(),a=r/100,o={r:(s.r-i.r)*a+i.r,g:(s.g-i.g)*a+i.g,b:(s.b-i.b)*a+i.b,a:(s.a-i.a)*a+i.a};return Et(o)};Et.readability=function(e,n){var r=Et(e),i=Et(n);return(Math.max(r.getLuminance(),i.getLuminance())+.05)/(Math.min(r.getLuminance(),i.getLuminance())+.05)};Et.isReadable=function(e,n,r){var i=Et.readability(e,n),s,a;switch(a=!1,s=x3e(r),s.level+s.size){case"AAsmall":case"AAAlarge":a=i>=4.5;break;case"AAlarge":a=i>=3;break;case"AAAsmall":a=i>=7;break}return a};Et.mostReadable=function(e,n,r){var i=null,s=0,a,o,l,u;r=r||{},o=r.includeFallbackColors,l=r.level,u=r.size;for(var d=0;d<n.length;d++)a=Et.readability(e,n[d]),a>s&&(s=a,i=Et(n[d]));return Et.isReadable(e,i,{level:l,size:u})||!o?i:(r.includeFallbackColors=!1,Et.mostReadable(e,["#fff","#000"],r))};var gE=Et.names={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",burntsienna:"ea7e5d",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"},m3e=Et.hexNames=g3e(gE);function g3e(e){var n={};for(var r in e)e.hasOwnProperty(r)&&(n[e[r]]=r);return n}function _V(e){return e=parseFloat(e),(isNaN(e)||e<0||e>1)&&(e=1),e}function vr(e,n){v3e(e)&&(e="100%");var r=y3e(e);return e=Math.min(n,Math.max(0,parseFloat(e))),r&&(e=parseInt(e*n,10)/100),Math.abs(e-n)<1e-6?1:e%n/parseFloat(n)}function wk(e){return Math.min(1,Math.max(0,e))}function Zs(e){return parseInt(e,16)}function v3e(e){return typeof e=="string"&&e.indexOf(".")!=-1&&parseFloat(e)===1}function y3e(e){return typeof e=="string"&&e.indexOf("%")!=-1}function eo(e){return e.length==1?"0"+e:""+e}function Jm(e){return e<=1&&(e=e*100+"%"),e}function xV(e){return Math.round(parseFloat(e)*255).toString(16)}function a8(e){return Zs(e)/255}var Ha=(function(){var e="[-\\+]?\\d+%?",n="[-\\+]?\\d*\\.\\d+%?",r="(?:"+n+")|(?:"+e+")",i="[\\s|\\(]+("+r+")[,|\\s]+("+r+")[,|\\s]+("+r+")\\s*\\)?",s="[\\s|\\(]+("+r+")[,|\\s]+("+r+")[,|\\s]+("+r+")[,|\\s]+("+r+")\\s*\\)?";return{CSS_UNIT:new RegExp(r),rgb:new RegExp("rgb"+i),rgba:new RegExp("rgba"+s),hsl:new RegExp("hsl"+i),hsla:new RegExp("hsla"+s),hsv:new RegExp("hsv"+i),hsva:new RegExp("hsva"+s),hex3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,hex4:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex8:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/}})();function Al(e){return!!Ha.CSS_UNIT.exec(e)}function _3e(e){e=e.replace(Q5e,"").replace(Z5e,"").toLowerCase();var n=!1;if(gE[e])e=gE[e],n=!0;else if(e=="transparent")return{r:0,g:0,b:0,a:0,format:"name"};var r;return(r=Ha.rgb.exec(e))?{r:r[1],g:r[2],b:r[3]}:(r=Ha.rgba.exec(e))?{r:r[1],g:r[2],b:r[3],a:r[4]}:(r=Ha.hsl.exec(e))?{h:r[1],s:r[2],l:r[3]}:(r=Ha.hsla.exec(e))?{h:r[1],s:r[2],l:r[3],a:r[4]}:(r=Ha.hsv.exec(e))?{h:r[1],s:r[2],v:r[3]}:(r=Ha.hsva.exec(e))?{h:r[1],s:r[2],v:r[3],a:r[4]}:(r=Ha.hex8.exec(e))?{r:Zs(r[1]),g:Zs(r[2]),b:Zs(r[3]),a:a8(r[4]),format:n?"name":"hex8"}:(r=Ha.hex6.exec(e))?{r:Zs(r[1]),g:Zs(r[2]),b:Zs(r[3]),format:n?"name":"hex"}:(r=Ha.hex4.exec(e))?{r:Zs(r[1]+""+r[1]),g:Zs(r[2]+""+r[2]),b:Zs(r[3]+""+r[3]),a:a8(r[4]+""+r[4]),format:n?"name":"hex8"}:(r=Ha.hex3.exec(e))?{r:Zs(r[1]+""+r[1]),g:Zs(r[2]+""+r[2]),b:Zs(r[3]+""+r[3]),format:n?"name":"hex"}:!1}function x3e(e){var n,r;return e=e||{level:"AA",size:"small"},n=(e.level||"AA").toUpperCase(),r=(e.size||"small").toLowerCase(),n!=="AA"&&n!=="AAA"&&(n="AA"),r!=="small"&&r!=="large"&&(r="small"),{level:n,size:r}}function vE(e,n){(n==null||n>e.length)&&(n=e.length);for(var r=0,i=Array(n);r<n;r++)i[r]=e[r];return i}function b3e(e){if(Array.isArray(e))return vE(e)}function bV(e,n,r){if(typeof e=="function"?e===n:e.has(n))return arguments.length<3?n:r;throw new TypeError("Private element is not present on this object")}function k3e(e,n){if(n.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function w3e(e,n){if(!(e instanceof n))throw new TypeError("Cannot call a class as a function")}function xa(e,n){return e.get(bV(e,n))}function o8(e,n,r){k3e(e,n),n.set(e,r)}function l8(e,n,r){return e.set(bV(e,n),r),r}function S3e(e,n){for(var r=0;r<n.length;r++){var i=n[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,T3e(i.key),i)}}function C3e(e,n,r){return n&&S3e(e.prototype,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function j3e(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function N3e(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function E3e(e){return b3e(e)||j3e(e)||M3e(e)||N3e()}function A3e(e,n){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var i=r.call(e,n);if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}function T3e(e){var n=A3e(e,"string");return typeof n=="symbol"?n:n+""}function M3e(e,n){if(e){if(typeof e=="string")return vE(e,n);var r={}.toString.call(e).slice(8,-1);return r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set"?Array.from(e):r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?vE(e,n):void 0}}var R3e=123,O3e=function(n){return"#".concat(Math.min(n,Math.pow(2,24)).toString(16).padStart(6,"0"))},kV=function(n,r,i){return(n<<16)+(r<<8)+i},D3e=function(n){var r=Et(n).toRgb(),i=r.r,s=r.g,a=r.b;return kV(i,s,a)},c8=function(n,r){return n*R3e%Math.pow(2,r)},Zu=new WeakMap,Tl=new WeakMap,P3e=(function(){function e(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:6;w3e(this,e),o8(this,Zu,void 0),o8(this,Tl,void 0),l8(Tl,this,n),this.reset()}return C3e(e,[{key:"reset",value:function(){l8(Zu,this,["__reserved for background__"])}},{key:"register",value:function(r){if(xa(Zu,this).length>=Math.pow(2,24-xa(Tl,this)))return null;var i=xa(Zu,this).length,s=c8(i,xa(Tl,this)),a=O3e(i+(s<<24-xa(Tl,this)));return xa(Zu,this).push(r),a}},{key:"lookup",value:function(r){if(!r)return null;var i=typeof r=="string"?D3e(r):kV.apply(void 0,E3e(r));if(!i)return null;var s=i&Math.pow(2,24-xa(Tl,this))-1,a=i>>24-xa(Tl,this)&Math.pow(2,xa(Tl,this))-1;return c8(s,xa(Tl,this))!==a||s>=xa(Zu,this).length?null:xa(Zu,this)[s]}}])})(),Jv,_r,wV,SV,Yc,u8,CV,jV,NV,tM,yE,_E,h0={},f0=[],L3e=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,Sk=Array.isArray;function Vo(e,n){for(var r in n)e[r]=n[r];return e}function nM(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function I3e(e,n,r){var i,s,a,o={};for(a in n)a=="key"?i=n[a]:a=="ref"?s=n[a]:o[a]=n[a];if(arguments.length>2&&(o.children=arguments.length>3?Jv.call(arguments,2):r),typeof e=="function"&&e.defaultProps!=null)for(a in e.defaultProps)o[a]===void 0&&(o[a]=e.defaultProps[a]);return wg(e,o,i,s,null)}function wg(e,n,r,i,s){var a={type:e,props:n,key:r,ref:i,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:s??++wV,__i:-1,__u:0};return s==null&&_r.vnode!=null&&_r.vnode(a),a}function Ck(e){return e.children}function Gx(e,n){this.props=e,this.context=n}function np(e,n){if(n==null)return e.__?np(e.__,e.__i+1):null;for(var r;n<e.__k.length;n++)if((r=e.__k[n])!=null&&r.__e!=null)return r.__e;return typeof e.type=="function"?np(e):null}function B3e(e){if(e.__P&&e.__d){var n=e.__v,r=n.__e,i=[],s=[],a=Vo({},n);a.__v=n.__v+1,_r.vnode&&_r.vnode(a),rM(e.__P,a,n,e.__n,e.__P.namespaceURI,32&n.__u?[r]:null,i,r??np(n),!!(32&n.__u),s),a.__v=n.__v,a.__.__k[a.__i]=a,MV(i,a,s),n.__e=n.__=null,a.__e!=r&&EV(a)}}function EV(e){if((e=e.__)!=null&&e.__c!=null)return e.__e=e.__c.base=null,e.__k.some(function(n){if(n!=null&&n.__e!=null)return e.__e=e.__c.base=n.__e}),EV(e)}function d8(e){(!e.__d&&(e.__d=!0)&&Yc.push(e)&&!p0.__r++||u8!=_r.debounceRendering)&&((u8=_r.debounceRendering)||CV)(p0)}function p0(){try{for(var e,n=1;Yc.length;)Yc.length>n&&Yc.sort(jV),e=Yc.shift(),n=Yc.length,B3e(e)}finally{Yc.length=p0.__r=0}}function AV(e,n,r,i,s,a,o,l,u,d,p){var f,g,_,x,v,S,w,j=i&&i.__k||f0,C=n.length;for(u=z3e(r,n,j,u,C),f=0;f<C;f++)(_=r.__k[f])!=null&&(g=_.__i!=-1&&j[_.__i]||h0,_.__i=f,S=rM(e,_,g,s,a,o,l,u,d,p),x=_.__e,_.ref&&g.ref!=_.ref&&(g.ref&&iM(g.ref,null,_),p.push(_.ref,_.__c||x,_)),v==null&&x!=null&&(v=x),(w=!!(4&_.__u))||g.__k===_.__k?u=TV(_,u,e,w):typeof _.type=="function"&&S!==void 0?u=S:x&&(u=x.nextSibling),_.__u&=-7);return r.__e=v,u}function z3e(e,n,r,i,s){var a,o,l,u,d,p=r.length,f=p,g=0;for(e.__k=new Array(s),a=0;a<s;a++)(o=n[a])!=null&&typeof o!="boolean"&&typeof o!="function"?(typeof o=="string"||typeof o=="number"||typeof o=="bigint"||o.constructor==String?o=e.__k[a]=wg(null,o,null,null,null):Sk(o)?o=e.__k[a]=wg(Ck,{children:o},null,null,null):o.constructor===void 0&&o.__b>0?o=e.__k[a]=wg(o.type,o.props,o.key,o.ref?o.ref:null,o.__v):e.__k[a]=o,u=a+g,o.__=e,o.__b=e.__b+1,l=null,(d=o.__i=$3e(o,r,u,f))!=-1&&(f--,(l=r[d])&&(l.__u|=2)),l==null||l.__v==null?(d==-1&&(s>p?g--:s<p&&g++),typeof o.type!="function"&&(o.__u|=4)):d!=u&&(d==u-1?g--:d==u+1?g++:(d>u?g--:g++,o.__u|=4))):e.__k[a]=null;if(f)for(a=0;a<p;a++)(l=r[a])!=null&&(2&l.__u)==0&&(l.__e==i&&(i=np(l)),OV(l,l));return i}function TV(e,n,r,i){var s,a;if(typeof e.type=="function"){for(s=e.__k,a=0;s&&a<s.length;a++)s[a]&&(s[a].__=e,n=TV(s[a],n,r,i));return n}e.__e!=n&&(i&&(n&&e.type&&!n.parentNode&&(n=np(e)),r.insertBefore(e.__e,n||null)),n=e.__e);do n=n&&n.nextSibling;while(n!=null&&n.nodeType==8);return n}function $3e(e,n,r,i){var s,a,o,l=e.key,u=e.type,d=n[r],p=d!=null&&(2&d.__u)==0;if(d===null&&l==null||p&&l==d.key&&u==d.type)return r;if(i>(p?1:0)){for(s=r-1,a=r+1;s>=0||a<n.length;)if((d=n[o=s>=0?s--:a++])!=null&&(2&d.__u)==0&&l==d.key&&u==d.type)return o}return-1}function h8(e,n,r){n[0]=="-"?e.setProperty(n,r??""):e[n]=r==null?"":typeof r!="number"||L3e.test(n)?r:r+"px"}function ox(e,n,r,i,s){var a,o;e:if(n=="style")if(typeof r=="string")e.style.cssText=r;else{if(typeof i=="string"&&(e.style.cssText=i=""),i)for(n in i)r&&n in r||h8(e.style,n,"");if(r)for(n in r)i&&r[n]==i[n]||h8(e.style,n,r[n])}else if(n[0]=="o"&&n[1]=="n")a=n!=(n=n.replace(NV,"$1")),o=n.toLowerCase(),n=o in e||n=="onFocusOut"||n=="onFocusIn"?o.slice(2):n.slice(2),e.l||(e.l={}),e.l[n+a]=r,r?i?r.u=i.u:(r.u=tM,e.addEventListener(n,a?_E:yE,a)):e.removeEventListener(n,a?_E:yE,a);else{if(s=="http://www.w3.org/2000/svg")n=n.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(n!="width"&&n!="height"&&n!="href"&&n!="list"&&n!="form"&&n!="tabIndex"&&n!="download"&&n!="rowSpan"&&n!="colSpan"&&n!="role"&&n!="popover"&&n in e)try{e[n]=r??"";break e}catch{}typeof r=="function"||(r==null||r===!1&&n[4]!="-"?e.removeAttribute(n):e.setAttribute(n,n=="popover"&&r==1?"":r))}}function f8(e){return function(n){if(this.l){var r=this.l[n.type+e];if(n.t==null)n.t=tM++;else if(n.t<r.u)return;return r(_r.event?_r.event(n):n)}}}function rM(e,n,r,i,s,a,o,l,u,d){var p,f,g,_,x,v,S,w,j,C,T,E,A,O,F,L=n.type;if(n.constructor!==void 0)return null;128&r.__u&&(u=!!(32&r.__u),a=[l=n.__e=r.__e]),(p=_r.__b)&&p(n);e:if(typeof L=="function")try{if(w=n.props,j=L.prototype&&L.prototype.render,C=(p=L.contextType)&&i[p.__c],T=p?C?C.props.value:p.__:i,r.__c?S=(f=n.__c=r.__c).__=f.__E:(j?n.__c=f=new L(w,T):(n.__c=f=new Gx(w,T),f.constructor=L,f.render=H3e),C&&C.sub(f),f.state||(f.state={}),f.__n=i,g=f.__d=!0,f.__h=[],f._sb=[]),j&&f.__s==null&&(f.__s=f.state),j&&L.getDerivedStateFromProps!=null&&(f.__s==f.state&&(f.__s=Vo({},f.__s)),Vo(f.__s,L.getDerivedStateFromProps(w,f.__s))),_=f.props,x=f.state,f.__v=n,g)j&&L.getDerivedStateFromProps==null&&f.componentWillMount!=null&&f.componentWillMount(),j&&f.componentDidMount!=null&&f.__h.push(f.componentDidMount);else{if(j&&L.getDerivedStateFromProps==null&&w!==_&&f.componentWillReceiveProps!=null&&f.componentWillReceiveProps(w,T),n.__v==r.__v||!f.__e&&f.shouldComponentUpdate!=null&&f.shouldComponentUpdate(w,f.__s,T)===!1){n.__v!=r.__v&&(f.props=w,f.state=f.__s,f.__d=!1),n.__e=r.__e,n.__k=r.__k,n.__k.some(function($){$&&($.__=n)}),f0.push.apply(f.__h,f._sb),f._sb=[],f.__h.length&&o.push(f);break e}f.componentWillUpdate!=null&&f.componentWillUpdate(w,f.__s,T),j&&f.componentDidUpdate!=null&&f.__h.push(function(){f.componentDidUpdate(_,x,v)})}if(f.context=T,f.props=w,f.__P=e,f.__e=!1,E=_r.__r,A=0,j)f.state=f.__s,f.__d=!1,E&&E(n),p=f.render(f.props,f.state,f.context),f0.push.apply(f.__h,f._sb),f._sb=[];else do f.__d=!1,E&&E(n),p=f.render(f.props,f.state,f.context),f.state=f.__s;while(f.__d&&++A<25);f.state=f.__s,f.getChildContext!=null&&(i=Vo(Vo({},i),f.getChildContext())),j&&!g&&f.getSnapshotBeforeUpdate!=null&&(v=f.getSnapshotBeforeUpdate(_,x)),O=p!=null&&p.type===Ck&&p.key==null?RV(p.props.children):p,l=AV(e,Sk(O)?O:[O],n,r,i,s,a,o,l,u,d),f.base=n.__e,n.__u&=-161,f.__h.length&&o.push(f),S&&(f.__E=f.__=null)}catch($){if(n.__v=null,u||a!=null)if($.then){for(n.__u|=u?160:128;l&&l.nodeType==8&&l.nextSibling;)l=l.nextSibling;a[a.indexOf(l)]=null,n.__e=l}else{for(F=a.length;F--;)nM(a[F]);xE(n)}else n.__e=r.__e,n.__k=r.__k,$.then||xE(n);_r.__e($,n,r)}else a==null&&n.__v==r.__v?(n.__k=r.__k,n.__e=r.__e):l=n.__e=F3e(r.__e,n,r,i,s,a,o,u,d);return(p=_r.diffed)&&p(n),128&n.__u?void 0:l}function xE(e){e&&(e.__c&&(e.__c.__e=!0),e.__k&&e.__k.some(xE))}function MV(e,n,r){for(var i=0;i<r.length;i++)iM(r[i],r[++i],r[++i]);_r.__c&&_r.__c(n,e),e.some(function(s){try{e=s.__h,s.__h=[],e.some(function(a){a.call(s)})}catch(a){_r.__e(a,s.__v)}})}function RV(e){return typeof e!="object"||e==null||e.__b>0?e:Sk(e)?e.map(RV):Vo({},e)}function F3e(e,n,r,i,s,a,o,l,u){var d,p,f,g,_,x,v,S=r.props||h0,w=n.props,j=n.type;if(j=="svg"?s="http://www.w3.org/2000/svg":j=="math"?s="http://www.w3.org/1998/Math/MathML":s||(s="http://www.w3.org/1999/xhtml"),a!=null){for(d=0;d<a.length;d++)if((_=a[d])&&"setAttribute"in _==!!j&&(j?_.localName==j:_.nodeType==3)){e=_,a[d]=null;break}}if(e==null){if(j==null)return document.createTextNode(w);e=document.createElementNS(s,j,w.is&&w),l&&(_r.__m&&_r.__m(n,a),l=!1),a=null}if(j==null)S===w||l&&e.data==w||(e.data=w);else{if(a=a&&Jv.call(e.childNodes),!l&&a!=null)for(S={},d=0;d<e.attributes.length;d++)S[(_=e.attributes[d]).name]=_.value;for(d in S)_=S[d],d=="dangerouslySetInnerHTML"?f=_:d=="children"||d in w||d=="value"&&"defaultValue"in w||d=="checked"&&"defaultChecked"in w||ox(e,d,null,_,s);for(d in w)_=w[d],d=="children"?g=_:d=="dangerouslySetInnerHTML"?p=_:d=="value"?x=_:d=="checked"?v=_:l&&typeof _!="function"||S[d]===_||ox(e,d,_,S[d],s);if(p)l||f&&(p.__html==f.__html||p.__html==e.innerHTML)||(e.innerHTML=p.__html),n.__k=[];else if(f&&(e.innerHTML=""),AV(n.type=="template"?e.content:e,Sk(g)?g:[g],n,r,i,j=="foreignObject"?"http://www.w3.org/1999/xhtml":s,a,o,a?a[0]:r.__k&&np(r,0),l,u),a!=null)for(d=a.length;d--;)nM(a[d]);l||(d="value",j=="progress"&&x==null?e.removeAttribute("value"):x!=null&&(x!==e[d]||j=="progress"&&!x||j=="option"&&x!=S[d])&&ox(e,d,x,S[d],s),d="checked",v!=null&&v!=e[d]&&ox(e,d,v,S[d],s))}return e}function iM(e,n,r){try{if(typeof e=="function"){var i=typeof e.__u=="function";i&&e.__u(),i&&n==null||(e.__u=e(n))}else e.current=n}catch(s){_r.__e(s,r)}}function OV(e,n,r){var i,s;if(_r.unmount&&_r.unmount(e),(i=e.ref)&&(i.current&&i.current!=e.__e||iM(i,null,n)),(i=e.__c)!=null){if(i.componentWillUnmount)try{i.componentWillUnmount()}catch(a){_r.__e(a,n)}i.base=i.__P=null}if(i=e.__k)for(s=0;s<i.length;s++)i[s]&&OV(i[s],n,r||typeof e.type!="function");r||nM(e.__e),e.__c=e.__=e.__e=void 0}function H3e(e,n,r){return this.constructor(e,r)}function W3e(e,n,r){var i,s,a,o;n==document&&(n=document.documentElement),_r.__&&_r.__(e,n),s=(i=!1)?null:n.__k,a=[],o=[],rM(n,e=n.__k=I3e(Ck,null,[e]),s||h0,h0,n.namespaceURI,s?null:n.firstChild?Jv.call(n.childNodes):null,a,s?s.__e:n.firstChild,i,o),MV(a,e,o)}function DV(e,n,r){var i,s,a,o,l=Vo({},e.props);for(a in e.type&&e.type.defaultProps&&(o=e.type.defaultProps),n)a=="key"?i=n[a]:a=="ref"?s=n[a]:l[a]=n[a]===void 0&&o!=null?o[a]:n[a];return arguments.length>2&&(l.children=arguments.length>3?Jv.call(arguments,2):r),wg(e.type,l,i||e.key,s||e.ref,null)}Jv=f0.slice,_r={__e:function(e,n,r,i){for(var s,a,o;n=n.__;)if((s=n.__c)&&!s.__)try{if((a=s.constructor)&&a.getDerivedStateFromError!=null&&(s.setState(a.getDerivedStateFromError(e)),o=s.__d),s.componentDidCatch!=null&&(s.componentDidCatch(e,i||{}),o=s.__d),o)return s.__E=s}catch(l){e=l}throw e}},wV=0,SV=function(e){return e!=null&&e.constructor===void 0},Gx.prototype.setState=function(e,n){var r;r=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=Vo({},this.state),typeof e=="function"&&(e=e(Vo({},r),this.props)),e&&Vo(r,e),e!=null&&this.__v&&(n&&this._sb.push(n),d8(this))},Gx.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),d8(this))},Gx.prototype.render=Ck,Yc=[],CV=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,jV=function(e,n){return e.__v.__b-n.__v.__b},p0.__r=0,NV=/(PointerCapture)$|Capture$/i,tM=0,yE=f8(!1),_E=f8(!0);function p8(e,n){(n==null||n>e.length)&&(n=e.length);for(var r=0,i=Array(n);r<n;r++)i[r]=e[r];return i}function q3e(e){if(Array.isArray(e))return e}function U3e(e,n,r){return(n=Q3e(n))in e?Object.defineProperty(e,n,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[n]=r,e}function K3e(e,n){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var i,s,a,o,l=[],u=!0,d=!1;try{if(a=(r=r.call(e)).next,n!==0)for(;!(u=(i=a.call(r)).done)&&(l.push(i.value),l.length!==n);u=!0);}catch(p){d=!0,s=p}finally{try{if(!u&&r.return!=null&&(o=r.return(),Object(o)!==o))return}finally{if(d)throw s}}return l}}function V3e(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function m8(e,n){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),r.push.apply(r,i)}return r}function Y3e(e){for(var n=1;n<arguments.length;n++){var r=arguments[n]!=null?arguments[n]:{};n%2?m8(Object(r),!0).forEach(function(i){U3e(e,i,r[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):m8(Object(r)).forEach(function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(r,i))})}return e}function G3e(e,n){return q3e(e)||K3e(e,n)||Z3e(e,n)||V3e()}function X3e(e,n){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var i=r.call(e,n);if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(n==="string"?String:Number)(e)}function Q3e(e){var n=X3e(e,"string");return typeof n=="symbol"?n:n+""}function m0(e){"@babel/helpers - typeof";return m0=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(n){return typeof n}:function(n){return n&&typeof Symbol=="function"&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n},m0(e)}function Z3e(e,n){if(e){if(typeof e=="string")return p8(e,n);var r={}.toString.call(e).slice(8,-1);return r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set"?Array.from(e):r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?p8(e,n):void 0}}var bE=function(n){if(m0(n)!=="object")return n;var r=DV(n);if(r.props){var i;r.props=Y3e({},r.props),r!=null&&(i=r.props)!==null&&i!==void 0&&i.children&&(r.props.children=Array.isArray(r.props.children)?r.props.children.map(bE):bE(r.props.children))}return r},J3e=function(n){return SV(DV(n))},eOe=function(n,r){delete r.__k,W3e(bE(n),r)};function tOe(e,n){n===void 0&&(n={});var r=n.insertAt;if(!(typeof document>"u")){var i=document.head||document.getElementsByTagName("head")[0],s=document.createElement("style");s.type="text/css",r==="top"&&i.firstChild?i.insertBefore(s,i.firstChild):i.appendChild(s),s.styleSheet?s.styleSheet.cssText=e:s.appendChild(document.createTextNode(e))}}var nOe=`.float-tooltip-kap {
  position: absolute;
  width: max-content; /* prevent shrinking near right edge */
  max-width: max(50%, 150px);
  padding: 3px 5px;
  border-radius: 3px;
  font: 12px sans-serif;
  color: #eee;
  background: rgba(0,0,0,0.6);
  pointer-events: none;
}
`;tOe(nOe);var rOe=eM({props:{content:{default:!1},offsetX:{triggerUpdate:!1},offsetY:{triggerUpdate:!1}},init:function(n,r){var i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},s=i.style,a=s===void 0?{}:s,o=!!n&&m0(n)==="object"&&!!n.node&&typeof n.node=="function",l=qi(o?n.node():n);l.style("position")==="static"&&l.style("position","relative"),r.tooltipEl=l.append("div").attr("class","float-tooltip-kap"),Object.entries(a).forEach(function(d){var p=G3e(d,2),f=p[0],g=p[1];return r.tooltipEl.style(f,g)}),r.tooltipEl.style("left","-10000px").style("display","none");var u="tooltip-".concat(Math.round(Math.random()*1e12));r.mouseInside=!1,l.on("mousemove.".concat(u),function(d){r.mouseInside=!0;var p=Sa(d),f=l.node(),g=f.offsetWidth,_=f.offsetHeight,x=[r.offsetX===null||r.offsetX===void 0?"-".concat(p[0]/g*100,"%"):typeof r.offsetX=="number"?"calc(-50% + ".concat(r.offsetX,"px)"):r.offsetX,r.offsetY===null||r.offsetY===void 0?_>130&&_-p[1]<100?"calc(-100% - 6px)":"21px":typeof r.offsetY=="number"?r.offsetY<0?"calc(-100% - ".concat(Math.abs(r.offsetY),"px)"):"".concat(r.offsetY,"px"):r.offsetY];r.tooltipEl.style("left",p[0]+"px").style("top",p[1]+"px").style("transform","translate(".concat(x.join(","),")")),r.content&&r.tooltipEl.style("display","inline")}),l.on("mouseover.".concat(u),function(){r.mouseInside=!0,r.content&&r.tooltipEl.style("display","inline")}),l.on("mouseout.".concat(u),function(){r.mouseInside=!1,r.tooltipEl.style("display","none")})},update:function(n){n.tooltipEl.style("display",n.content&&n.mouseInside?"inline":"none"),n.content?n.content instanceof HTMLElement?(n.tooltipEl.text(""),n.tooltipEl.append(function(){return n.content})):typeof n.content=="string"?n.tooltipEl.html(n.content):J3e(n.content)?(n.tooltipEl.text(""),eOe(n.content,n.tooltipEl.node())):(n.tooltipEl.style("display","none"),console.warn("Tooltip content is invalid, skipping.",n.content,n.content.toString())):n.tooltipEl.text("")}});function iOe(e,n,r){var i,s=1;e==null&&(e=0),n==null&&(n=0),r==null&&(r=0);function a(){var o,l=i.length,u,d=0,p=0,f=0;for(o=0;o<l;++o)u=i[o],d+=u.x||0,p+=u.y||0,f+=u.z||0;for(d=(d/l-e)*s,p=(p/l-n)*s,f=(f/l-r)*s,o=0;o<l;++o)u=i[o],d&&(u.x-=d),p&&(u.y-=p),f&&(u.z-=f)}return a.initialize=function(o){i=o},a.x=function(o){return arguments.length?(e=+o,a):e},a.y=function(o){return arguments.length?(n=+o,a):n},a.z=function(o){return arguments.length?(r=+o,a):r},a.strength=function(o){return arguments.length?(s=+o,a):s},a}function sOe(e){const n=+this._x.call(null,e);return PV(this.cover(n),n,e)}function PV(e,n,r){if(isNaN(n))return e;var i,s=e._root,a={data:r},o=e._x0,l=e._x1,u,d,p,f,g;if(!s)return e._root=a,e;for(;s.length;)if((p=n>=(u=(o+l)/2))?o=u:l=u,i=s,!(s=s[f=+p]))return i[f]=a,e;if(d=+e._x.call(null,s.data),n===d)return a.next=s,i?i[f]=a:e._root=a,e;do i=i?i[f]=new Array(2):e._root=new Array(2),(p=n>=(u=(o+l)/2))?o=u:l=u;while((f=+p)==(g=+(d>=u)));return i[g]=s,i[f]=a,e}function aOe(e){Array.isArray(e)||(e=Array.from(e));const n=e.length,r=new Float64Array(n);let i=1/0,s=-1/0;for(let a=0,o;a<n;++a)isNaN(o=+this._x.call(null,e[a]))||(r[a]=o,o<i&&(i=o),o>s&&(s=o));if(i>s)return this;this.cover(i).cover(s);for(let a=0;a<n;++a)PV(this,r[a],e[a]);return this}function oOe(e){if(isNaN(e=+e))return this;var n=this._x0,r=this._x1;if(isNaN(n))r=(n=Math.floor(e))+1;else{for(var i=r-n||1,s=this._root,a,o;n>e||e>=r;)switch(o=+(e<n),a=new Array(2),a[o]=s,s=a,i*=2,o){case 0:r=n+i;break;case 1:n=r-i;break}this._root&&this._root.length&&(this._root=s)}return this._x0=n,this._x1=r,this}function lOe(){var e=[];return this.visit(function(n){if(!n.length)do e.push(n.data);while(n=n.next)}),e}function cOe(e){return arguments.length?this.cover(+e[0][0]).cover(+e[1][0]):isNaN(this._x0)?void 0:[[this._x0],[this._x1]]}function Yl(e,n,r){this.node=e,this.x0=n,this.x1=r}function uOe(e,n){var r,i=this._x0,s,a,o=this._x1,l=[],u=this._root,d,p;for(u&&l.push(new Yl(u,i,o)),n==null?n=1/0:(i=e-n,o=e+n);d=l.pop();)if(!(!(u=d.node)||(s=d.x0)>o||(a=d.x1)<i))if(u.length){var f=(s+a)/2;l.push(new Yl(u[1],f,a),new Yl(u[0],s,f)),(p=+(e>=f))&&(d=l[l.length-1],l[l.length-1]=l[l.length-1-p],l[l.length-1-p]=d)}else{var g=Math.abs(e-+this._x.call(null,u.data));g<n&&(n=g,i=e-g,o=e+g,r=u.data)}return r}function dOe(e){if(isNaN(u=+this._x.call(null,e)))return this;var n,r=this._root,i,s,a,o=this._x0,l=this._x1,u,d,p,f,g;if(!r)return this;if(r.length)for(;;){if((p=u>=(d=(o+l)/2))?o=d:l=d,n=r,!(r=r[f=+p]))return this;if(!r.length)break;n[f+1&1]&&(i=n,g=f)}for(;r.data!==e;)if(s=r,!(r=r.next))return this;return(a=r.next)&&delete r.next,s?(a?s.next=a:delete s.next,this):n?(a?n[f]=a:delete n[f],(r=n[0]||n[1])&&r===(n[1]||n[0])&&!r.length&&(i?i[g]=r:this._root=r),this):(this._root=a,this)}function hOe(e){for(var n=0,r=e.length;n<r;++n)this.remove(e[n]);return this}function fOe(){return this._root}function pOe(){var e=0;return this.visit(function(n){if(!n.length)do++e;while(n=n.next)}),e}function mOe(e){var n=[],r,i=this._root,s,a,o;for(i&&n.push(new Yl(i,this._x0,this._x1));r=n.pop();)if(!e(i=r.node,a=r.x0,o=r.x1)&&i.length){var l=(a+o)/2;(s=i[1])&&n.push(new Yl(s,l,o)),(s=i[0])&&n.push(new Yl(s,a,l))}return this}function gOe(e){var n=[],r=[],i;for(this._root&&n.push(new Yl(this._root,this._x0,this._x1));i=n.pop();){var s=i.node;if(s.length){var a,o=i.x0,l=i.x1,u=(o+l)/2;(a=s[0])&&n.push(new Yl(a,o,u)),(a=s[1])&&n.push(new Yl(a,u,l))}r.push(i)}for(;i=r.pop();)e(i.node,i.x0,i.x1);return this}function vOe(e){return e[0]}function yOe(e){return arguments.length?(this._x=e,this):this._x}function LV(e,n){var r=new sM(n??vOe,NaN,NaN);return e==null?r:r.addAll(e)}function sM(e,n,r){this._x=e,this._x0=n,this._x1=r,this._root=void 0}function g8(e){for(var n={data:e.data},r=n;e=e.next;)r=r.next={data:e.data};return n}var Ps=LV.prototype=sM.prototype;Ps.copy=function(){var e=new sM(this._x,this._x0,this._x1),n=this._root,r,i;if(!n)return e;if(!n.length)return e._root=g8(n),e;for(r=[{source:n,target:e._root=new Array(2)}];n=r.pop();)for(var s=0;s<2;++s)(i=n.source[s])&&(i.length?r.push({source:i,target:n.target[s]=new Array(2)}):n.target[s]=g8(i));return e};Ps.add=sOe;Ps.addAll=aOe;Ps.cover=oOe;Ps.data=lOe;Ps.extent=cOe;Ps.find=uOe;Ps.remove=dOe;Ps.removeAll=hOe;Ps.root=fOe;Ps.size=pOe;Ps.visit=mOe;Ps.visitAfter=gOe;Ps.x=yOe;function _Oe(e){const n=+this._x.call(null,e),r=+this._y.call(null,e);return IV(this.cover(n,r),n,r,e)}function IV(e,n,r,i){if(isNaN(n)||isNaN(r))return e;var s,a=e._root,o={data:i},l=e._x0,u=e._y0,d=e._x1,p=e._y1,f,g,_,x,v,S,w,j;if(!a)return e._root=o,e;for(;a.length;)if((v=n>=(f=(l+d)/2))?l=f:d=f,(S=r>=(g=(u+p)/2))?u=g:p=g,s=a,!(a=a[w=S<<1|v]))return s[w]=o,e;if(_=+e._x.call(null,a.data),x=+e._y.call(null,a.data),n===_&&r===x)return o.next=a,s?s[w]=o:e._root=o,e;do s=s?s[w]=new Array(4):e._root=new Array(4),(v=n>=(f=(l+d)/2))?l=f:d=f,(S=r>=(g=(u+p)/2))?u=g:p=g;while((w=S<<1|v)===(j=(x>=g)<<1|_>=f));return s[j]=a,s[w]=o,e}function xOe(e){var n,r,i=e.length,s,a,o=new Array(i),l=new Array(i),u=1/0,d=1/0,p=-1/0,f=-1/0;for(r=0;r<i;++r)isNaN(s=+this._x.call(null,n=e[r]))||isNaN(a=+this._y.call(null,n))||(o[r]=s,l[r]=a,s<u&&(u=s),s>p&&(p=s),a<d&&(d=a),a>f&&(f=a));if(u>p||d>f)return this;for(this.cover(u,d).cover(p,f),r=0;r<i;++r)IV(this,o[r],l[r],e[r]);return this}function bOe(e,n){if(isNaN(e=+e)||isNaN(n=+n))return this;var r=this._x0,i=this._y0,s=this._x1,a=this._y1;if(isNaN(r))s=(r=Math.floor(e))+1,a=(i=Math.floor(n))+1;else{for(var o=s-r||1,l=this._root,u,d;r>e||e>=s||i>n||n>=a;)switch(d=(n<i)<<1|e<r,u=new Array(4),u[d]=l,l=u,o*=2,d){case 0:s=r+o,a=i+o;break;case 1:r=s-o,a=i+o;break;case 2:s=r+o,i=a-o;break;case 3:r=s-o,i=a-o;break}this._root&&this._root.length&&(this._root=l)}return this._x0=r,this._y0=i,this._x1=s,this._y1=a,this}function kOe(){var e=[];return this.visit(function(n){if(!n.length)do e.push(n.data);while(n=n.next)}),e}function wOe(e){return arguments.length?this.cover(+e[0][0],+e[0][1]).cover(+e[1][0],+e[1][1]):isNaN(this._x0)?void 0:[[this._x0,this._y0],[this._x1,this._y1]]}function is(e,n,r,i,s){this.node=e,this.x0=n,this.y0=r,this.x1=i,this.y1=s}function SOe(e,n,r){var i,s=this._x0,a=this._y0,o,l,u,d,p=this._x1,f=this._y1,g=[],_=this._root,x,v;for(_&&g.push(new is(_,s,a,p,f)),r==null?r=1/0:(s=e-r,a=n-r,p=e+r,f=n+r,r*=r);x=g.pop();)if(!(!(_=x.node)||(o=x.x0)>p||(l=x.y0)>f||(u=x.x1)<s||(d=x.y1)<a))if(_.length){var S=(o+u)/2,w=(l+d)/2;g.push(new is(_[3],S,w,u,d),new is(_[2],o,w,S,d),new is(_[1],S,l,u,w),new is(_[0],o,l,S,w)),(v=(n>=w)<<1|e>=S)&&(x=g[g.length-1],g[g.length-1]=g[g.length-1-v],g[g.length-1-v]=x)}else{var j=e-+this._x.call(null,_.data),C=n-+this._y.call(null,_.data),T=j*j+C*C;if(T<r){var E=Math.sqrt(r=T);s=e-E,a=n-E,p=e+E,f=n+E,i=_.data}}return i}function COe(e){if(isNaN(p=+this._x.call(null,e))||isNaN(f=+this._y.call(null,e)))return this;var n,r=this._root,i,s,a,o=this._x0,l=this._y0,u=this._x1,d=this._y1,p,f,g,_,x,v,S,w;if(!r)return this;if(r.length)for(;;){if((x=p>=(g=(o+u)/2))?o=g:u=g,(v=f>=(_=(l+d)/2))?l=_:d=_,n=r,!(r=r[S=v<<1|x]))return this;if(!r.length)break;(n[S+1&3]||n[S+2&3]||n[S+3&3])&&(i=n,w=S)}for(;r.data!==e;)if(s=r,!(r=r.next))return this;return(a=r.next)&&delete r.next,s?(a?s.next=a:delete s.next,this):n?(a?n[S]=a:delete n[S],(r=n[0]||n[1]||n[2]||n[3])&&r===(n[3]||n[2]||n[1]||n[0])&&!r.length&&(i?i[w]=r:this._root=r),this):(this._root=a,this)}function jOe(e){for(var n=0,r=e.length;n<r;++n)this.remove(e[n]);return this}function NOe(){return this._root}function EOe(){var e=0;return this.visit(function(n){if(!n.length)do++e;while(n=n.next)}),e}function AOe(e){var n=[],r,i=this._root,s,a,o,l,u;for(i&&n.push(new is(i,this._x0,this._y0,this._x1,this._y1));r=n.pop();)if(!e(i=r.node,a=r.x0,o=r.y0,l=r.x1,u=r.y1)&&i.length){var d=(a+l)/2,p=(o+u)/2;(s=i[3])&&n.push(new is(s,d,p,l,u)),(s=i[2])&&n.push(new is(s,a,p,d,u)),(s=i[1])&&n.push(new is(s,d,o,l,p)),(s=i[0])&&n.push(new is(s,a,o,d,p))}return this}function TOe(e){var n=[],r=[],i;for(this._root&&n.push(new is(this._root,this._x0,this._y0,this._x1,this._y1));i=n.pop();){var s=i.node;if(s.length){var a,o=i.x0,l=i.y0,u=i.x1,d=i.y1,p=(o+u)/2,f=(l+d)/2;(a=s[0])&&n.push(new is(a,o,l,p,f)),(a=s[1])&&n.push(new is(a,p,l,u,f)),(a=s[2])&&n.push(new is(a,o,f,p,d)),(a=s[3])&&n.push(new is(a,p,f,u,d))}r.push(i)}for(;i=r.pop();)e(i.node,i.x0,i.y0,i.x1,i.y1);return this}function MOe(e){return e[0]}function ROe(e){return arguments.length?(this._x=e,this):this._x}function OOe(e){return e[1]}function DOe(e){return arguments.length?(this._y=e,this):this._y}function BV(e,n,r){var i=new aM(n??MOe,r??OOe,NaN,NaN,NaN,NaN);return e==null?i:i.addAll(e)}function aM(e,n,r,i,s,a){this._x=e,this._y=n,this._x0=r,this._y0=i,this._x1=s,this._y1=a,this._root=void 0}function v8(e){for(var n={data:e.data},r=n;e=e.next;)r=r.next={data:e.data};return n}var ds=BV.prototype=aM.prototype;ds.copy=function(){var e=new aM(this._x,this._y,this._x0,this._y0,this._x1,this._y1),n=this._root,r,i;if(!n)return e;if(!n.length)return e._root=v8(n),e;for(r=[{source:n,target:e._root=new Array(4)}];n=r.pop();)for(var s=0;s<4;++s)(i=n.source[s])&&(i.length?r.push({source:i,target:n.target[s]=new Array(4)}):n.target[s]=v8(i));return e};ds.add=_Oe;ds.addAll=xOe;ds.cover=bOe;ds.data=kOe;ds.extent=wOe;ds.find=SOe;ds.remove=COe;ds.removeAll=jOe;ds.root=NOe;ds.size=EOe;ds.visit=AOe;ds.visitAfter=TOe;ds.x=ROe;ds.y=DOe;function POe(e){const n=+this._x.call(null,e),r=+this._y.call(null,e),i=+this._z.call(null,e);return zV(this.cover(n,r,i),n,r,i,e)}function zV(e,n,r,i,s){if(isNaN(n)||isNaN(r)||isNaN(i))return e;var a,o=e._root,l={data:s},u=e._x0,d=e._y0,p=e._z0,f=e._x1,g=e._y1,_=e._z1,x,v,S,w,j,C,T,E,A,O,F;if(!o)return e._root=l,e;for(;o.length;)if((T=n>=(x=(u+f)/2))?u=x:f=x,(E=r>=(v=(d+g)/2))?d=v:g=v,(A=i>=(S=(p+_)/2))?p=S:_=S,a=o,!(o=o[O=A<<2|E<<1|T]))return a[O]=l,e;if(w=+e._x.call(null,o.data),j=+e._y.call(null,o.data),C=+e._z.call(null,o.data),n===w&&r===j&&i===C)return l.next=o,a?a[O]=l:e._root=l,e;do a=a?a[O]=new Array(8):e._root=new Array(8),(T=n>=(x=(u+f)/2))?u=x:f=x,(E=r>=(v=(d+g)/2))?d=v:g=v,(A=i>=(S=(p+_)/2))?p=S:_=S;while((O=A<<2|E<<1|T)===(F=(C>=S)<<2|(j>=v)<<1|w>=x));return a[F]=o,a[O]=l,e}function LOe(e){Array.isArray(e)||(e=Array.from(e));const n=e.length,r=new Float64Array(n),i=new Float64Array(n),s=new Float64Array(n);let a=1/0,o=1/0,l=1/0,u=-1/0,d=-1/0,p=-1/0;for(let f=0,g,_,x,v;f<n;++f)isNaN(_=+this._x.call(null,g=e[f]))||isNaN(x=+this._y.call(null,g))||isNaN(v=+this._z.call(null,g))||(r[f]=_,i[f]=x,s[f]=v,_<a&&(a=_),_>u&&(u=_),x<o&&(o=x),x>d&&(d=x),v<l&&(l=v),v>p&&(p=v));if(a>u||o>d||l>p)return this;this.cover(a,o,l).cover(u,d,p);for(let f=0;f<n;++f)zV(this,r[f],i[f],s[f],e[f]);return this}function IOe(e,n,r){if(isNaN(e=+e)||isNaN(n=+n)||isNaN(r=+r))return this;var i=this._x0,s=this._y0,a=this._z0,o=this._x1,l=this._y1,u=this._z1;if(isNaN(i))o=(i=Math.floor(e))+1,l=(s=Math.floor(n))+1,u=(a=Math.floor(r))+1;else{for(var d=o-i||1,p=this._root,f,g;i>e||e>=o||s>n||n>=l||a>r||r>=u;)switch(g=(r<a)<<2|(n<s)<<1|e<i,f=new Array(8),f[g]=p,p=f,d*=2,g){case 0:o=i+d,l=s+d,u=a+d;break;case 1:i=o-d,l=s+d,u=a+d;break;case 2:o=i+d,s=l-d,u=a+d;break;case 3:i=o-d,s=l-d,u=a+d;break;case 4:o=i+d,l=s+d,a=u-d;break;case 5:i=o-d,l=s+d,a=u-d;break;case 6:o=i+d,s=l-d,a=u-d;break;case 7:i=o-d,s=l-d,a=u-d;break}this._root&&this._root.length&&(this._root=p)}return this._x0=i,this._y0=s,this._z0=a,this._x1=o,this._y1=l,this._z1=u,this}function BOe(){var e=[];return this.visit(function(n){if(!n.length)do e.push(n.data);while(n=n.next)}),e}function zOe(e){return arguments.length?this.cover(+e[0][0],+e[0][1],+e[0][2]).cover(+e[1][0],+e[1][1],+e[1][2]):isNaN(this._x0)?void 0:[[this._x0,this._y0,this._z0],[this._x1,this._y1,this._z1]]}function Zn(e,n,r,i,s,a,o){this.node=e,this.x0=n,this.y0=r,this.z0=i,this.x1=s,this.y1=a,this.z1=o}function $Oe(e,n,r,i){var s,a=this._x0,o=this._y0,l=this._z0,u,d,p,f,g,_,x=this._x1,v=this._y1,S=this._z1,w=[],j=this._root,C,T;for(j&&w.push(new Zn(j,a,o,l,x,v,S)),i==null?i=1/0:(a=e-i,o=n-i,l=r-i,x=e+i,v=n+i,S=r+i,i*=i);C=w.pop();)if(!(!(j=C.node)||(u=C.x0)>x||(d=C.y0)>v||(p=C.z0)>S||(f=C.x1)<a||(g=C.y1)<o||(_=C.z1)<l))if(j.length){var E=(u+f)/2,A=(d+g)/2,O=(p+_)/2;w.push(new Zn(j[7],E,A,O,f,g,_),new Zn(j[6],u,A,O,E,g,_),new Zn(j[5],E,d,O,f,A,_),new Zn(j[4],u,d,O,E,A,_),new Zn(j[3],E,A,p,f,g,O),new Zn(j[2],u,A,p,E,g,O),new Zn(j[1],E,d,p,f,A,O),new Zn(j[0],u,d,p,E,A,O)),(T=(r>=O)<<2|(n>=A)<<1|e>=E)&&(C=w[w.length-1],w[w.length-1]=w[w.length-1-T],w[w.length-1-T]=C)}else{var F=e-+this._x.call(null,j.data),L=n-+this._y.call(null,j.data),$=r-+this._z.call(null,j.data),z=F*F+L*L+$*$;if(z<i){var B=Math.sqrt(i=z);a=e-B,o=n-B,l=r-B,x=e+B,v=n+B,S=r+B,s=j.data}}return s}const FOe=(e,n,r,i,s,a)=>Math.sqrt((e-i)**2+(n-s)**2+(r-a)**2);function HOe(e,n,r,i){const s=[],a=e-i,o=n-i,l=r-i,u=e+i,d=n+i,p=r+i;return this.visit((f,g,_,x,v,S,w)=>{if(!f.length)do{const j=f.data;FOe(e,n,r,this._x(j),this._y(j),this._z(j))<=i&&s.push(j)}while(f=f.next);return g>u||_>d||x>p||v<a||S<o||w<l}),s}function WOe(e){if(isNaN(g=+this._x.call(null,e))||isNaN(_=+this._y.call(null,e))||isNaN(x=+this._z.call(null,e)))return this;var n,r=this._root,i,s,a,o=this._x0,l=this._y0,u=this._z0,d=this._x1,p=this._y1,f=this._z1,g,_,x,v,S,w,j,C,T,E,A;if(!r)return this;if(r.length)for(;;){if((j=g>=(v=(o+d)/2))?o=v:d=v,(C=_>=(S=(l+p)/2))?l=S:p=S,(T=x>=(w=(u+f)/2))?u=w:f=w,n=r,!(r=r[E=T<<2|C<<1|j]))return this;if(!r.length)break;(n[E+1&7]||n[E+2&7]||n[E+3&7]||n[E+4&7]||n[E+5&7]||n[E+6&7]||n[E+7&7])&&(i=n,A=E)}for(;r.data!==e;)if(s=r,!(r=r.next))return this;return(a=r.next)&&delete r.next,s?(a?s.next=a:delete s.next,this):n?(a?n[E]=a:delete n[E],(r=n[0]||n[1]||n[2]||n[3]||n[4]||n[5]||n[6]||n[7])&&r===(n[7]||n[6]||n[5]||n[4]||n[3]||n[2]||n[1]||n[0])&&!r.length&&(i?i[A]=r:this._root=r),this):(this._root=a,this)}function qOe(e){for(var n=0,r=e.length;n<r;++n)this.remove(e[n]);return this}function UOe(){return this._root}function KOe(){var e=0;return this.visit(function(n){if(!n.length)do++e;while(n=n.next)}),e}function VOe(e){var n=[],r,i=this._root,s,a,o,l,u,d,p;for(i&&n.push(new Zn(i,this._x0,this._y0,this._z0,this._x1,this._y1,this._z1));r=n.pop();)if(!e(i=r.node,a=r.x0,o=r.y0,l=r.z0,u=r.x1,d=r.y1,p=r.z1)&&i.length){var f=(a+u)/2,g=(o+d)/2,_=(l+p)/2;(s=i[7])&&n.push(new Zn(s,f,g,_,u,d,p)),(s=i[6])&&n.push(new Zn(s,a,g,_,f,d,p)),(s=i[5])&&n.push(new Zn(s,f,o,_,u,g,p)),(s=i[4])&&n.push(new Zn(s,a,o,_,f,g,p)),(s=i[3])&&n.push(new Zn(s,f,g,l,u,d,_)),(s=i[2])&&n.push(new Zn(s,a,g,l,f,d,_)),(s=i[1])&&n.push(new Zn(s,f,o,l,u,g,_)),(s=i[0])&&n.push(new Zn(s,a,o,l,f,g,_))}return this}function YOe(e){var n=[],r=[],i;for(this._root&&n.push(new Zn(this._root,this._x0,this._y0,this._z0,this._x1,this._y1,this._z1));i=n.pop();){var s=i.node;if(s.length){var a,o=i.x0,l=i.y0,u=i.z0,d=i.x1,p=i.y1,f=i.z1,g=(o+d)/2,_=(l+p)/2,x=(u+f)/2;(a=s[0])&&n.push(new Zn(a,o,l,u,g,_,x)),(a=s[1])&&n.push(new Zn(a,g,l,u,d,_,x)),(a=s[2])&&n.push(new Zn(a,o,_,u,g,p,x)),(a=s[3])&&n.push(new Zn(a,g,_,u,d,p,x)),(a=s[4])&&n.push(new Zn(a,o,l,x,g,_,f)),(a=s[5])&&n.push(new Zn(a,g,l,x,d,_,f)),(a=s[6])&&n.push(new Zn(a,o,_,x,g,p,f)),(a=s[7])&&n.push(new Zn(a,g,_,x,d,p,f))}r.push(i)}for(;i=r.pop();)e(i.node,i.x0,i.y0,i.z0,i.x1,i.y1,i.z1);return this}function GOe(e){return e[0]}function XOe(e){return arguments.length?(this._x=e,this):this._x}function QOe(e){return e[1]}function ZOe(e){return arguments.length?(this._y=e,this):this._y}function JOe(e){return e[2]}function e4e(e){return arguments.length?(this._z=e,this):this._z}function $V(e,n,r,i){var s=new oM(n??GOe,r??QOe,i??JOe,NaN,NaN,NaN,NaN,NaN,NaN);return e==null?s:s.addAll(e)}function oM(e,n,r,i,s,a,o,l,u){this._x=e,this._y=n,this._z=r,this._x0=i,this._y0=s,this._z0=a,this._x1=o,this._y1=l,this._z1=u,this._root=void 0}function y8(e){for(var n={data:e.data},r=n;e=e.next;)r=r.next={data:e.data};return n}var Di=$V.prototype=oM.prototype;Di.copy=function(){var e=new oM(this._x,this._y,this._z,this._x0,this._y0,this._z0,this._x1,this._y1,this._z1),n=this._root,r,i;if(!n)return e;if(!n.length)return e._root=y8(n),e;for(r=[{source:n,target:e._root=new Array(8)}];n=r.pop();)for(var s=0;s<8;++s)(i=n.source[s])&&(i.length?r.push({source:i,target:n.target[s]=new Array(8)}):n.target[s]=y8(i));return e};Di.add=POe;Di.addAll=LOe;Di.cover=IOe;Di.data=BOe;Di.extent=zOe;Di.find=$Oe;Di.findAllWithinRadius=HOe;Di.remove=WOe;Di.removeAll=qOe;Di.root=UOe;Di.size=KOe;Di.visit=VOe;Di.visitAfter=YOe;Di.x=XOe;Di.y=ZOe;Di.z=e4e;function Wl(e){return function(){return e}}function Ll(e){return(e()-.5)*1e-6}function t4e(e){return e.index}function _8(e,n){var r=e.get(n);if(!r)throw new Error("node not found: "+n);return r}function n4e(e){var n=t4e,r=g,i,s=Wl(30),a,o,l,u,d,p,f=1;e==null&&(e=[]);function g(w){return 1/Math.min(u[w.source.index],u[w.target.index])}function _(w){for(var j=0,C=e.length;j<f;++j)for(var T=0,E,A,O,F=0,L=0,$=0,z,B;T<C;++T)E=e[T],A=E.source,O=E.target,F=O.x+O.vx-A.x-A.vx||Ll(p),l>1&&(L=O.y+O.vy-A.y-A.vy||Ll(p)),l>2&&($=O.z+O.vz-A.z-A.vz||Ll(p)),z=Math.sqrt(F*F+L*L+$*$),z=(z-a[T])/z*w*i[T],F*=z,L*=z,$*=z,O.vx-=F*(B=d[T]),l>1&&(O.vy-=L*B),l>2&&(O.vz-=$*B),A.vx+=F*(B=1-B),l>1&&(A.vy+=L*B),l>2&&(A.vz+=$*B)}function x(){if(o){var w,j=o.length,C=e.length,T=new Map(o.map((A,O)=>[n(A,O,o),A])),E;for(w=0,u=new Array(j);w<C;++w)E=e[w],E.index=w,typeof E.source!="object"&&(E.source=_8(T,E.source)),typeof E.target!="object"&&(E.target=_8(T,E.target)),u[E.source.index]=(u[E.source.index]||0)+1,u[E.target.index]=(u[E.target.index]||0)+1;for(w=0,d=new Array(C);w<C;++w)E=e[w],d[w]=u[E.source.index]/(u[E.source.index]+u[E.target.index]);i=new Array(C),v(),a=new Array(C),S()}}function v(){if(o)for(var w=0,j=e.length;w<j;++w)i[w]=+r(e[w],w,e)}function S(){if(o)for(var w=0,j=e.length;w<j;++w)a[w]=+s(e[w],w,e)}return _.initialize=function(w,...j){o=w,p=j.find(C=>typeof C=="function")||Math.random,l=j.find(C=>[1,2,3].includes(C))||2,x()},_.links=function(w){return arguments.length?(e=w,x(),_):e},_.id=function(w){return arguments.length?(n=w,_):n},_.iterations=function(w){return arguments.length?(f=+w,_):f},_.strength=function(w){return arguments.length?(r=typeof w=="function"?w:Wl(+w),v(),_):r},_.distance=function(w){return arguments.length?(s=typeof w=="function"?w:Wl(+w),S(),_):s},_}const r4e=1664525,i4e=1013904223,x8=4294967296;function s4e(){let e=1;return()=>(e=(r4e*e+i4e)%x8)/x8}var b8=3;function $2(e){return e.x}function k8(e){return e.y}function a4e(e){return e.z}var o4e=10,l4e=Math.PI*(3-Math.sqrt(5)),c4e=Math.PI*20/(9+Math.sqrt(221));function u4e(e,n){n=n||2;var r=Math.min(b8,Math.max(1,Math.round(n))),i,s=1,a=.001,o=1-Math.pow(a,1/300),l=0,u=.6,d=new Map,p=WA(_),f=Lv("tick","end"),g=s4e();e==null&&(e=[]);function _(){x(),f.call("tick",i),s<a&&(p.stop(),f.call("end",i))}function x(w){var j,C=e.length,T;w===void 0&&(w=1);for(var E=0;E<w;++E)for(s+=(l-s)*o,d.forEach(function(A){A(s)}),j=0;j<C;++j)T=e[j],T.fx==null?T.x+=T.vx*=u:(T.x=T.fx,T.vx=0),r>1&&(T.fy==null?T.y+=T.vy*=u:(T.y=T.fy,T.vy=0)),r>2&&(T.fz==null?T.z+=T.vz*=u:(T.z=T.fz,T.vz=0));return i}function v(){for(var w=0,j=e.length,C;w<j;++w){if(C=e[w],C.index=w,C.fx!=null&&(C.x=C.fx),C.fy!=null&&(C.y=C.fy),C.fz!=null&&(C.z=C.fz),isNaN(C.x)||r>1&&isNaN(C.y)||r>2&&isNaN(C.z)){var T=o4e*(r>2?Math.cbrt(.5+w):r>1?Math.sqrt(.5+w):w),E=w*l4e,A=w*c4e;r===1?C.x=T:r===2?(C.x=T*Math.cos(E),C.y=T*Math.sin(E)):(C.x=T*Math.sin(E)*Math.cos(A),C.y=T*Math.cos(E),C.z=T*Math.sin(E)*Math.sin(A))}(isNaN(C.vx)||r>1&&isNaN(C.vy)||r>2&&isNaN(C.vz))&&(C.vx=0,r>1&&(C.vy=0),r>2&&(C.vz=0))}}function S(w){return w.initialize&&w.initialize(e,g,r),w}return v(),i={tick:x,restart:function(){return p.restart(_),i},stop:function(){return p.stop(),i},numDimensions:function(w){return arguments.length?(r=Math.min(b8,Math.max(1,Math.round(w))),d.forEach(S),i):r},nodes:function(w){return arguments.length?(e=w,v(),d.forEach(S),i):e},alpha:function(w){return arguments.length?(s=+w,i):s},alphaMin:function(w){return arguments.length?(a=+w,i):a},alphaDecay:function(w){return arguments.length?(o=+w,i):+o},alphaTarget:function(w){return arguments.length?(l=+w,i):l},velocityDecay:function(w){return arguments.length?(u=1-w,i):1-u},randomSource:function(w){return arguments.length?(g=w,d.forEach(S),i):g},force:function(w,j){return arguments.length>1?(j==null?d.delete(w):d.set(w,S(j)),i):d.get(w)},find:function(){var w=Array.prototype.slice.call(arguments),j=w.shift()||0,C=(r>1?w.shift():null)||0,T=(r>2?w.shift():null)||0,E=w.shift()||1/0,A=0,O=e.length,F,L,$,z,B,H;for(E*=E,A=0;A<O;++A)B=e[A],F=j-B.x,L=C-(B.y||0),$=T-(B.z||0),z=F*F+L*L+$*$,z<E&&(H=B,E=z);return H},on:function(w,j){return arguments.length>1?(f.on(w,j),i):f.on(w)}}}function d4e(){var e,n,r,i,s,a=Wl(-30),o,l=1,u=1/0,d=.81;function p(x){var v,S=e.length,w=(n===1?LV(e,$2):n===2?BV(e,$2,k8):n===3?$V(e,$2,k8,a4e):null).visitAfter(g);for(s=x,v=0;v<S;++v)r=e[v],w.visit(_)}function f(){if(e){var x,v=e.length,S;for(o=new Array(v),x=0;x<v;++x)S=e[x],o[S.index]=+a(S,x,e)}}function g(x){var v=0,S,w,j=0,C,T,E,A,O=x.length;if(O){for(C=T=E=A=0;A<O;++A)(S=x[A])&&(w=Math.abs(S.value))&&(v+=S.value,j+=w,C+=w*(S.x||0),T+=w*(S.y||0),E+=w*(S.z||0));v*=Math.sqrt(4/O),x.x=C/j,n>1&&(x.y=T/j),n>2&&(x.z=E/j)}else{S=x,S.x=S.data.x,n>1&&(S.y=S.data.y),n>2&&(S.z=S.data.z);do v+=o[S.data.index];while(S=S.next)}x.value=v}function _(x,v,S,w,j){if(!x.value)return!0;var C=[S,w,j][n-1],T=x.x-r.x,E=n>1?x.y-r.y:0,A=n>2?x.z-r.z:0,O=C-v,F=T*T+E*E+A*A;if(O*O/d<F)return F<u&&(T===0&&(T=Ll(i),F+=T*T),n>1&&E===0&&(E=Ll(i),F+=E*E),n>2&&A===0&&(A=Ll(i),F+=A*A),F<l&&(F=Math.sqrt(l*F)),r.vx+=T*x.value*s/F,n>1&&(r.vy+=E*x.value*s/F),n>2&&(r.vz+=A*x.value*s/F)),!0;if(x.length||F>=u)return;(x.data!==r||x.next)&&(T===0&&(T=Ll(i),F+=T*T),n>1&&E===0&&(E=Ll(i),F+=E*E),n>2&&A===0&&(A=Ll(i),F+=A*A),F<l&&(F=Math.sqrt(l*F)));do x.data!==r&&(O=o[x.data.index]*s/F,r.vx+=T*O,n>1&&(r.vy+=E*O),n>2&&(r.vz+=A*O));while(x=x.next)}return p.initialize=function(x,...v){e=x,i=v.find(S=>typeof S=="function")||Math.random,n=v.find(S=>[1,2,3].includes(S))||2,f()},p.strength=function(x){return arguments.length?(a=typeof x=="function"?x:Wl(+x),f(),p):a},p.distanceMin=function(x){return arguments.length?(l=x*x,p):Math.sqrt(l)},p.distanceMax=function(x){return arguments.length?(u=x*x,p):Math.sqrt(u)},p.theta=function(x){return arguments.length?(d=x*x,p):Math.sqrt(d)},p}function h4e(e,n,r,i){var s,a,o=Wl(.1),l,u;typeof e!="function"&&(e=Wl(+e)),n==null&&(n=0),r==null&&(r=0),i==null&&(i=0);function d(f){for(var g=0,_=s.length;g<_;++g){var x=s[g],v=x.x-n||1e-6,S=(x.y||0)-r||1e-6,w=(x.z||0)-i||1e-6,j=Math.sqrt(v*v+S*S+w*w),C=(u[g]-j)*l[g]*f/j;x.vx+=v*C,a>1&&(x.vy+=S*C),a>2&&(x.vz+=w*C)}}function p(){if(s){var f,g=s.length;for(l=new Array(g),u=new Array(g),f=0;f<g;++f)u[f]=+e(s[f],f,s),l[f]=isNaN(u[f])?0:+o(s[f],f,s)}}return d.initialize=function(f,...g){s=f,a=g.find(_=>[1,2,3].includes(_))||2,p()},d.strength=function(f){return arguments.length?(o=typeof f=="function"?f:Wl(+f),p(),d):o},d.radius=function(f){return arguments.length?(e=typeof f=="function"?f:Wl(+f),p(),d):e},d.x=function(f){return arguments.length?(n=+f,d):n},d.y=function(f){return arguments.length?(r=+f,d):r},d.z=function(f){return arguments.length?(i=+f,d):i},d}const{abs:Om,cos:Ml,sin:Wh,acos:f4e,atan2:Dm,sqrt:$c,pow:ka}=Math;function Pm(e){return e<0?-ka(-e,1/3):ka(e,1/3)}const FV=Math.PI,lx=2*FV,Fc=FV/2,p4e=1e-6,F2=Number.MAX_SAFE_INTEGER||9007199254740991,H2=Number.MIN_SAFE_INTEGER||-9007199254740991,m4e={x:0,y:0,z:0},Je={Tvalues:[-.06405689286260563,.06405689286260563,-.1911188674736163,.1911188674736163,-.3150426796961634,.3150426796961634,-.4337935076260451,.4337935076260451,-.5454214713888396,.5454214713888396,-.6480936519369755,.6480936519369755,-.7401241915785544,.7401241915785544,-.820001985973903,.820001985973903,-.8864155270044011,.8864155270044011,-.9382745520027328,.9382745520027328,-.9747285559713095,.9747285559713095,-.9951872199970213,.9951872199970213],Cvalues:[.12793819534675216,.12793819534675216,.1258374563468283,.1258374563468283,.12167047292780339,.12167047292780339,.1155056680537256,.1155056680537256,.10744427011596563,.10744427011596563,.09761865210411388,.09761865210411388,.08619016153195327,.08619016153195327,.0733464814110803,.0733464814110803,.05929858491543678,.05929858491543678,.04427743881741981,.04427743881741981,.028531388628933663,.028531388628933663,.0123412297999872,.0123412297999872],arcfn:function(e,n){const r=n(e);let i=r.x*r.x+r.y*r.y;return typeof r.z<"u"&&(i+=r.z*r.z),$c(i)},compute:function(e,n,r){if(e===0)return n[0].t=0,n[0];const i=n.length-1;if(e===1)return n[i].t=1,n[i];const s=1-e;let a=n;if(i===0)return n[0].t=e,n[0];if(i===1){const l={x:s*a[0].x+e*a[1].x,y:s*a[0].y+e*a[1].y,t:e};return r&&(l.z=s*a[0].z+e*a[1].z),l}if(i<4){let l=s*s,u=e*e,d,p,f,g=0;i===2?(a=[a[0],a[1],a[2],m4e],d=l,p=s*e*2,f=u):i===3&&(d=l*s,p=l*e*3,f=s*u*3,g=e*u);const _={x:d*a[0].x+p*a[1].x+f*a[2].x+g*a[3].x,y:d*a[0].y+p*a[1].y+f*a[2].y+g*a[3].y,t:e};return r&&(_.z=d*a[0].z+p*a[1].z+f*a[2].z+g*a[3].z),_}const o=JSON.parse(JSON.stringify(n));for(;o.length>1;){for(let l=0;l<o.length-1;l++)o[l]={x:o[l].x+(o[l+1].x-o[l].x)*e,y:o[l].y+(o[l+1].y-o[l].y)*e},typeof o[l].z<"u"&&(o[l].z=o[l].z+(o[l+1].z-o[l].z)*e);o.splice(o.length-1,1)}return o[0].t=e,o[0]},computeWithRatios:function(e,n,r,i){const s=1-e,a=r,o=n;let l=a[0],u=a[1],d=a[2],p=a[3],f;if(l*=s,u*=e,o.length===2)return f=l+u,{x:(l*o[0].x+u*o[1].x)/f,y:(l*o[0].y+u*o[1].y)/f,z:i?(l*o[0].z+u*o[1].z)/f:!1,t:e};if(l*=s,u*=2*s,d*=e*e,o.length===3)return f=l+u+d,{x:(l*o[0].x+u*o[1].x+d*o[2].x)/f,y:(l*o[0].y+u*o[1].y+d*o[2].y)/f,z:i?(l*o[0].z+u*o[1].z+d*o[2].z)/f:!1,t:e};if(l*=s,u*=1.5*s,d*=3*s,p*=e*e*e,o.length===4)return f=l+u+d+p,{x:(l*o[0].x+u*o[1].x+d*o[2].x+p*o[3].x)/f,y:(l*o[0].y+u*o[1].y+d*o[2].y+p*o[3].y)/f,z:i?(l*o[0].z+u*o[1].z+d*o[2].z+p*o[3].z)/f:!1,t:e}},derive:function(e,n){const r=[];for(let i=e,s=i.length,a=s-1;s>1;s--,a--){const o=[];for(let l=0,u;l<a;l++)u={x:a*(i[l+1].x-i[l].x),y:a*(i[l+1].y-i[l].y)},n&&(u.z=a*(i[l+1].z-i[l].z)),o.push(u);r.push(o),i=o}return r},between:function(e,n,r){return n<=e&&e<=r||Je.approximately(e,n)||Je.approximately(e,r)},approximately:function(e,n,r){return Om(e-n)<=(r||p4e)},length:function(e){const r=Je.Tvalues.length;let i=0;for(let s=0,a;s<r;s++)a=.5*Je.Tvalues[s]+.5,i+=Je.Cvalues[s]*Je.arcfn(a,e);return .5*i},map:function(e,n,r,i,s){const a=r-n,o=s-i,l=e-n,u=l/a;return i+o*u},lerp:function(e,n,r){const i={x:n.x+e*(r.x-n.x),y:n.y+e*(r.y-n.y)};return n.z!==void 0&&r.z!==void 0&&(i.z=n.z+e*(r.z-n.z)),i},pointToString:function(e){let n=e.x+"/"+e.y;return typeof e.z<"u"&&(n+="/"+e.z),n},pointsToString:function(e){return"["+e.map(Je.pointToString).join(", ")+"]"},copy:function(e){return JSON.parse(JSON.stringify(e))},angle:function(e,n,r){const i=n.x-e.x,s=n.y-e.y,a=r.x-e.x,o=r.y-e.y,l=i*o-s*a,u=i*a+s*o;return Dm(l,u)},round:function(e,n){const r=""+e,i=r.indexOf(".");return parseFloat(r.substring(0,i+1+n))},dist:function(e,n){const r=e.x-n.x,i=e.y-n.y;return $c(r*r+i*i)},closest:function(e,n){let r=ka(2,63),i,s;return e.forEach(function(a,o){s=Je.dist(n,a),s<r&&(r=s,i=o)}),{mdist:r,mpos:i}},abcratio:function(e,n){if(n!==2&&n!==3)return!1;if(typeof e>"u")e=.5;else if(e===0||e===1)return e;const r=ka(e,n)+ka(1-e,n),i=r-1;return Om(i/r)},projectionratio:function(e,n){if(n!==2&&n!==3)return!1;if(typeof e>"u")e=.5;else if(e===0||e===1)return e;const r=ka(1-e,n),i=ka(e,n)+r;return r/i},lli8:function(e,n,r,i,s,a,o,l){const u=(e*i-n*r)*(s-o)-(e-r)*(s*l-a*o),d=(e*i-n*r)*(a-l)-(n-i)*(s*l-a*o),p=(e-r)*(a-l)-(n-i)*(s-o);return p==0?!1:{x:u/p,y:d/p}},lli4:function(e,n,r,i){const s=e.x,a=e.y,o=n.x,l=n.y,u=r.x,d=r.y,p=i.x,f=i.y;return Je.lli8(s,a,o,l,u,d,p,f)},lli:function(e,n){return Je.lli4(e,e.c,n,n.c)},makeline:function(e,n){return new lr(e.x,e.y,(e.x+n.x)/2,(e.y+n.y)/2,n.x,n.y)},findbbox:function(e){let n=F2,r=F2,i=H2,s=H2;return e.forEach(function(a){const o=a.bbox();n>o.x.min&&(n=o.x.min),r>o.y.min&&(r=o.y.min),i<o.x.max&&(i=o.x.max),s<o.y.max&&(s=o.y.max)}),{x:{min:n,mid:(n+i)/2,max:i,size:i-n},y:{min:r,mid:(r+s)/2,max:s,size:s-r}}},shapeintersections:function(e,n,r,i,s){if(!Je.bboxoverlap(n,i))return[];const a=[],o=[e.startcap,e.forward,e.back,e.endcap],l=[r.startcap,r.forward,r.back,r.endcap];return o.forEach(function(u){u.virtual||l.forEach(function(d){if(d.virtual)return;const p=u.intersects(d,s);p.length>0&&(p.c1=u,p.c2=d,p.s1=e,p.s2=r,a.push(p))})}),a},makeshape:function(e,n,r){const i=n.points.length,s=e.points.length,a=Je.makeline(n.points[i-1],e.points[0]),o=Je.makeline(e.points[s-1],n.points[0]),l={startcap:a,forward:e,back:n,endcap:o,bbox:Je.findbbox([a,e,n,o])};return l.intersections=function(u){return Je.shapeintersections(l,l.bbox,u,u.bbox,r)},l},getminmax:function(e,n,r){if(!r)return{min:0,max:0};let i=F2,s=H2,a,o;r.indexOf(0)===-1&&(r=[0].concat(r)),r.indexOf(1)===-1&&r.push(1);for(let l=0,u=r.length;l<u;l++)a=r[l],o=e.get(a),o[n]<i&&(i=o[n]),o[n]>s&&(s=o[n]);return{min:i,mid:(i+s)/2,max:s,size:s-i}},align:function(e,n){const r=n.p1.x,i=n.p1.y,s=-Dm(n.p2.y-i,n.p2.x-r),a=function(o){return{x:(o.x-r)*Ml(s)-(o.y-i)*Wh(s),y:(o.x-r)*Wh(s)+(o.y-i)*Ml(s)}};return e.map(a)},roots:function(e,n){n=n||{p1:{x:0,y:0},p2:{x:1,y:0}};const r=e.length-1,i=Je.align(e,n),s=function(O){return 0<=O&&O<=1};if(r===2){const O=i[0].y,F=i[1].y,L=i[2].y,$=O-2*F+L;if($!==0){const z=-$c(F*F-O*L),B=-O+F,H=-(z+B)/$,D=-(-z+B)/$;return[H,D].filter(s)}else if(F!==L&&$===0)return[(2*F-L)/(2*F-2*L)].filter(s);return[]}const a=i[0].y,o=i[1].y,l=i[2].y,u=i[3].y;let d=-a+3*o-3*l+u,p=3*a-6*o+3*l,f=-3*a+3*o,g=a;if(Je.approximately(d,0)){if(Je.approximately(p,0))return Je.approximately(f,0)?[]:[-g/f].filter(s);const O=$c(f*f-4*p*g),F=2*p;return[(O-f)/F,(-f-O)/F].filter(s)}p/=d,f/=d,g/=d;const _=(3*f-p*p)/3,x=_/3,v=(2*p*p*p-9*p*f+27*g)/27,S=v/2,w=S*S+x*x*x;let j,C,T,E,A;if(w<0){const O=-_/3,F=O*O*O,L=$c(F),$=-v/(2*L),z=$<-1?-1:$>1?1:$,B=f4e(z),H=Pm(L),D=2*H;return T=D*Ml(B/3)-p/3,E=D*Ml((B+lx)/3)-p/3,A=D*Ml((B+2*lx)/3)-p/3,[T,E,A].filter(s)}else{if(w===0)return j=S<0?Pm(-S):-Pm(S),T=2*j-p/3,E=-j-p/3,[T,E].filter(s);{const O=$c(w);return j=Pm(-S+O),C=Pm(S+O),[j-C-p/3].filter(s)}}},droots:function(e){if(e.length===3){const n=e[0],r=e[1],i=e[2],s=n-2*r+i;if(s!==0){const a=-$c(r*r-n*i),o=-n+r,l=-(a+o)/s,u=-(-a+o)/s;return[l,u]}else if(r!==i&&s===0)return[(2*r-i)/(2*(r-i))];return[]}if(e.length===2){const n=e[0],r=e[1];return n!==r?[n/(n-r)]:[]}return[]},curvature:function(e,n,r,i,s){let a,o,l,u,d=0,p=0;const f=Je.compute(e,n),g=Je.compute(e,r),_=f.x*f.x+f.y*f.y;if(i?(a=$c(ka(f.y*g.z-g.y*f.z,2)+ka(f.z*g.x-g.z*f.x,2)+ka(f.x*g.y-g.x*f.y,2)),o=ka(_+f.z*f.z,3/2)):(a=f.x*g.y-f.y*g.x,o=ka(_,3/2)),a===0||o===0)return{k:0,r:0};if(d=a/o,p=o/a,!s){const x=Je.curvature(e-.001,n,r,i,!0).k,v=Je.curvature(e+.001,n,r,i,!0).k;u=(v-d+(d-x))/2,l=(Om(v-d)+Om(d-x))/2}return{k:d,r:p,dk:u,adk:l}},inflections:function(e){if(e.length<4)return[];const n=Je.align(e,{p1:e[0],p2:e.slice(-1)[0]}),r=n[2].x*n[1].y,i=n[3].x*n[1].y,s=n[1].x*n[2].y,a=n[3].x*n[2].y,o=18*(-3*r+2*i+3*s-a),l=18*(3*r-i-3*s),u=18*(s-r);if(Je.approximately(o,0)){if(!Je.approximately(l,0)){let g=-u/l;if(0<=g&&g<=1)return[g]}return[]}const d=2*o;if(Je.approximately(d,0))return[];const p=l*l-4*o*u;if(p<0)return[];const f=Math.sqrt(p);return[(f-l)/d,-(l+f)/d].filter(function(g){return 0<=g&&g<=1})},bboxoverlap:function(e,n){const r=["x","y"],i=r.length;for(let s=0,a,o,l,u;s<i;s++)if(a=r[s],o=e[a].mid,l=n[a].mid,u=(e[a].size+n[a].size)/2,Om(o-l)>=u)return!1;return!0},expandbox:function(e,n){n.x.min<e.x.min&&(e.x.min=n.x.min),n.y.min<e.y.min&&(e.y.min=n.y.min),n.z&&n.z.min<e.z.min&&(e.z.min=n.z.min),n.x.max>e.x.max&&(e.x.max=n.x.max),n.y.max>e.y.max&&(e.y.max=n.y.max),n.z&&n.z.max>e.z.max&&(e.z.max=n.z.max),e.x.mid=(e.x.min+e.x.max)/2,e.y.mid=(e.y.min+e.y.max)/2,e.z&&(e.z.mid=(e.z.min+e.z.max)/2),e.x.size=e.x.max-e.x.min,e.y.size=e.y.max-e.y.min,e.z&&(e.z.size=e.z.max-e.z.min)},pairiteration:function(e,n,r){const i=e.bbox(),s=n.bbox(),a=1e5,o=r||.5;if(i.x.size+i.y.size<o&&s.x.size+s.y.size<o)return[(a*(e._t1+e._t2)/2|0)/a+"/"+(a*(n._t1+n._t2)/2|0)/a];let l=e.split(.5),u=n.split(.5),d=[{left:l.left,right:u.left},{left:l.left,right:u.right},{left:l.right,right:u.right},{left:l.right,right:u.left}];d=d.filter(function(f){return Je.bboxoverlap(f.left.bbox(),f.right.bbox())});let p=[];return d.length===0||(d.forEach(function(f){p=p.concat(Je.pairiteration(f.left,f.right,o))}),p=p.filter(function(f,g){return p.indexOf(f)===g})),p},getccenter:function(e,n,r){const i=n.x-e.x,s=n.y-e.y,a=r.x-n.x,o=r.y-n.y,l=i*Ml(Fc)-s*Wh(Fc),u=i*Wh(Fc)+s*Ml(Fc),d=a*Ml(Fc)-o*Wh(Fc),p=a*Wh(Fc)+o*Ml(Fc),f=(e.x+n.x)/2,g=(e.y+n.y)/2,_=(n.x+r.x)/2,x=(n.y+r.y)/2,v=f+l,S=g+u,w=_+d,j=x+p,C=Je.lli8(f,g,v,S,_,x,w,j),T=Je.dist(C,e);let E=Dm(e.y-C.y,e.x-C.x),A=Dm(n.y-C.y,n.x-C.x),O=Dm(r.y-C.y,r.x-C.x),F;return E<O?((E>A||A>O)&&(E+=lx),E>O&&(F=O,O=E,E=F)):O<A&&A<E?(F=O,O=E,E=F):O+=lx,C.s=E,C.e=O,C.r=T,C},numberSort:function(e,n){return e-n}};class Sg{constructor(n){this.curves=[],this._3d=!1,n&&(this.curves=n,this._3d=this.curves[0]._3d)}valueOf(){return this.toString()}toString(){return"["+this.curves.map(function(n){return Je.pointsToString(n.points)}).join(", ")+"]"}addCurve(n){this.curves.push(n),this._3d=this._3d||n._3d}length(){return this.curves.map(function(n){return n.length()}).reduce(function(n,r){return n+r})}curve(n){return this.curves[n]}bbox(){const n=this.curves;for(var r=n[0].bbox(),i=1;i<n.length;i++)Je.expandbox(r,n[i].bbox());return r}offset(n){const r=[];return this.curves.forEach(function(i){r.push(...i.offset(n))}),new Sg(r)}}const{abs:Lm,min:w8,max:S8,cos:g4e,sin:v4e,acos:y4e,sqrt:Im}=Math,_4e=Math.PI;class lr{constructor(n){let r=n&&n.forEach?n:Array.from(arguments).slice(),i=!1;if(typeof r[0]=="object"){i=r.length;const _=[];r.forEach(function(x){["x","y","z"].forEach(function(v){typeof x[v]<"u"&&_.push(x[v])})}),r=_}let s=!1;const a=r.length;if(i){if(i>4){if(arguments.length!==1)throw new Error("Only new Bezier(point[]) is accepted for 4th and higher order curves");s=!0}}else if(a!==6&&a!==8&&a!==9&&a!==12&&arguments.length!==1)throw new Error("Only new Bezier(point[]) is accepted for 4th and higher order curves");const o=this._3d=!s&&(a===9||a===12)||n&&n[0]&&typeof n[0].z<"u",l=this.points=[];for(let _=0,x=o?3:2;_<a;_+=x){var u={x:r[_],y:r[_+1]};o&&(u.z=r[_+2]),l.push(u)}const d=this.order=l.length-1,p=this.dims=["x","y"];o&&p.push("z"),this.dimlen=p.length;const f=Je.align(l,{p1:l[0],p2:l[d]}),g=Je.dist(l[0],l[d]);this._linear=f.reduce((_,x)=>_+Lm(x.y),0)<g/50,this._lut=[],this._t1=0,this._t2=1,this.update()}static quadraticFromPoints(n,r,i,s){if(typeof s>"u"&&(s=.5),s===0)return new lr(r,r,i);if(s===1)return new lr(n,r,r);const a=lr.getABC(2,n,r,i,s);return new lr(n,a.A,i)}static cubicFromPoints(n,r,i,s,a){typeof s>"u"&&(s=.5);const o=lr.getABC(3,n,r,i,s);typeof a>"u"&&(a=Je.dist(r,o.C));const l=a*(1-s)/s,u=Je.dist(n,i),d=(i.x-n.x)/u,p=(i.y-n.y)/u,f=a*d,g=a*p,_=l*d,x=l*p,v={x:r.x-f,y:r.y-g},S={x:r.x+_,y:r.y+x},w=o.A,j={x:w.x+(v.x-w.x)/(1-s),y:w.y+(v.y-w.y)/(1-s)},C={x:w.x+(S.x-w.x)/s,y:w.y+(S.y-w.y)/s},T={x:n.x+(j.x-n.x)/s,y:n.y+(j.y-n.y)/s},E={x:i.x+(C.x-i.x)/(1-s),y:i.y+(C.y-i.y)/(1-s)};return new lr(n,T,E,i)}static getUtils(){return Je}getUtils(){return lr.getUtils()}static get PolyBezier(){return Sg}valueOf(){return this.toString()}toString(){return Je.pointsToString(this.points)}toSVG(){if(this._3d)return!1;const n=this.points,r=n[0].x,i=n[0].y,s=["M",r,i,this.order===2?"Q":"C"];for(let a=1,o=n.length;a<o;a++)s.push(n[a].x),s.push(n[a].y);return s.join(" ")}setRatios(n){if(n.length!==this.points.length)throw new Error("incorrect number of ratio values");this.ratios=n,this._lut=[]}verify(){const n=this.coordDigest();n!==this._print&&(this._print=n,this.update())}coordDigest(){return this.points.map(function(n,r){return""+r+n.x+n.y+(n.z?n.z:0)}).join("")}update(){this._lut=[],this.dpoints=Je.derive(this.points,this._3d),this.computedirection()}computedirection(){const n=this.points,r=Je.angle(n[0],n[this.order],n[1]);this.clockwise=r>0}length(){return Je.length(this.derivative.bind(this))}static getABC(n=2,r,i,s,a=.5){const o=Je.projectionratio(a,n),l=1-o,u={x:o*r.x+l*s.x,y:o*r.y+l*s.y},d=Je.abcratio(a,n);return{A:{x:i.x+(i.x-u.x)/d,y:i.y+(i.y-u.y)/d},B:i,C:u,S:r,E:s}}getABC(n,r){r=r||this.get(n);let i=this.points[0],s=this.points[this.order];return lr.getABC(this.order,i,r,s,n)}getLUT(n){if(this.verify(),n=n||100,this._lut.length===n+1)return this._lut;this._lut=[],n++,this._lut=[];for(let r=0,i,s;r<n;r++)s=r/(n-1),i=this.compute(s),i.t=s,this._lut.push(i);return this._lut}on(n,r){r=r||5;const i=this.getLUT(),s=[];for(let a=0,o,l=0;a<i.length;a++)o=i[a],Je.dist(o,n)<r&&(s.push(o),l+=a/i.length);return s.length?t/=s.length:!1}project(n){const r=this.getLUT(),i=r.length-1,s=Je.closest(r,n),a=s.mpos,o=(a-1)/i,l=(a+1)/i,u=.1/i;let d=s.mdist,p=o,f=p,g;d+=1;for(let _;p<l+u;p+=u)g=this.compute(p),_=Je.dist(n,g),_<d&&(d=_,f=p);return f=f<0?0:f>1?1:f,g=this.compute(f),g.t=f,g.d=d,g}get(n){return this.compute(n)}point(n){return this.points[n]}compute(n){return this.ratios?Je.computeWithRatios(n,this.points,this.ratios,this._3d):Je.compute(n,this.points,this._3d,this.ratios)}raise(){const n=this.points,r=[n[0]],i=n.length;for(let s=1,a,o;s<i;s++)a=n[s],o=n[s-1],r[s]={x:(i-s)/i*a.x+s/i*o.x,y:(i-s)/i*a.y+s/i*o.y};return r[i]=n[i-1],new lr(r)}derivative(n){return Je.compute(n,this.dpoints[0],this._3d)}dderivative(n){return Je.compute(n,this.dpoints[1],this._3d)}align(){let n=this.points;return new lr(Je.align(n,{p1:n[0],p2:n[n.length-1]}))}curvature(n){return Je.curvature(n,this.dpoints[0],this.dpoints[1],this._3d)}inflections(){return Je.inflections(this.points)}normal(n){return this._3d?this.__normal3(n):this.__normal2(n)}__normal2(n){const r=this.derivative(n),i=Im(r.x*r.x+r.y*r.y);return{t:n,x:-r.y/i,y:r.x/i}}__normal3(n){const r=this.derivative(n),i=this.derivative(n+.01),s=Im(r.x*r.x+r.y*r.y+r.z*r.z),a=Im(i.x*i.x+i.y*i.y+i.z*i.z);r.x/=s,r.y/=s,r.z/=s,i.x/=a,i.y/=a,i.z/=a;const o={x:i.y*r.z-i.z*r.y,y:i.z*r.x-i.x*r.z,z:i.x*r.y-i.y*r.x},l=Im(o.x*o.x+o.y*o.y+o.z*o.z);o.x/=l,o.y/=l,o.z/=l;const u=[o.x*o.x,o.x*o.y-o.z,o.x*o.z+o.y,o.x*o.y+o.z,o.y*o.y,o.y*o.z-o.x,o.x*o.z-o.y,o.y*o.z+o.x,o.z*o.z];return{t:n,x:u[0]*r.x+u[1]*r.y+u[2]*r.z,y:u[3]*r.x+u[4]*r.y+u[5]*r.z,z:u[6]*r.x+u[7]*r.y+u[8]*r.z}}hull(n){let r=this.points,i=[],s=[],a=0;for(s[a++]=r[0],s[a++]=r[1],s[a++]=r[2],this.order===3&&(s[a++]=r[3]);r.length>1;){i=[];for(let o=0,l,u=r.length-1;o<u;o++)l=Je.lerp(n,r[o],r[o+1]),s[a++]=l,i.push(l);r=i}return s}split(n,r){if(n===0&&r)return this.split(r).left;if(r===1)return this.split(n).right;const i=this.hull(n),s={left:this.order===2?new lr([i[0],i[3],i[5]]):new lr([i[0],i[4],i[7],i[9]]),right:this.order===2?new lr([i[5],i[4],i[2]]):new lr([i[9],i[8],i[6],i[3]]),span:i};return s.left._t1=Je.map(0,0,1,this._t1,this._t2),s.left._t2=Je.map(n,0,1,this._t1,this._t2),s.right._t1=Je.map(n,0,1,this._t1,this._t2),s.right._t2=Je.map(1,0,1,this._t1,this._t2),r?(r=Je.map(r,n,1,0,1),s.right.split(r).left):s}extrema(){const n={};let r=[];return this.dims.forEach((function(i){let s=function(o){return o[i]},a=this.dpoints[0].map(s);n[i]=Je.droots(a),this.order===3&&(a=this.dpoints[1].map(s),n[i]=n[i].concat(Je.droots(a))),n[i]=n[i].filter(function(o){return o>=0&&o<=1}),r=r.concat(n[i].sort(Je.numberSort))}).bind(this)),n.values=r.sort(Je.numberSort).filter(function(i,s){return r.indexOf(i)===s}),n}bbox(){const n=this.extrema(),r={};return this.dims.forEach((function(i){r[i]=Je.getminmax(this,i,n[i])}).bind(this)),r}overlaps(n){const r=this.bbox(),i=n.bbox();return Je.bboxoverlap(r,i)}offset(n,r){if(typeof r<"u"){const i=this.get(n),s=this.normal(n),a={c:i,n:s,x:i.x+s.x*r,y:i.y+s.y*r};return this._3d&&(a.z=i.z+s.z*r),a}if(this._linear){const i=this.normal(0),s=this.points.map(function(a){const o={x:a.x+n*i.x,y:a.y+n*i.y};return a.z&&i.z&&(o.z=a.z+n*i.z),o});return[new lr(s)]}return this.reduce().map(function(i){return i._linear?i.offset(n)[0]:i.scale(n)})}simple(){if(this.order===3){const s=Je.angle(this.points[0],this.points[3],this.points[1]),a=Je.angle(this.points[0],this.points[3],this.points[2]);if(s>0&&a<0||s<0&&a>0)return!1}const n=this.normal(0),r=this.normal(1);let i=n.x*r.x+n.y*r.y;return this._3d&&(i+=n.z*r.z),Lm(y4e(i))<_4e/3}reduce(){let n,r=0,i=0,s=.01,a,o=[],l=[],u=this.extrema().values;for(u.indexOf(0)===-1&&(u=[0].concat(u)),u.indexOf(1)===-1&&u.push(1),r=u[0],n=1;n<u.length;n++)i=u[n],a=this.split(r,i),a._t1=r,a._t2=i,o.push(a),r=i;return o.forEach(function(d){for(r=0,i=0;i<=1;)for(i=r+s;i<=1+s;i+=s)if(a=d.split(r,i),!a.simple()){if(i-=s,Lm(r-i)<s)return[];a=d.split(r,i),a._t1=Je.map(r,0,1,d._t1,d._t2),a._t2=Je.map(i,0,1,d._t1,d._t2),l.push(a),r=i;break}r<1&&(a=d.split(r,1),a._t1=Je.map(r,0,1,d._t1,d._t2),a._t2=d._t2,l.push(a))}),l}translate(n,r,i){i=typeof i=="number"?i:r;const s=this.order;let a=this.points.map((o,l)=>(1-l/s)*r+l/s*i);return new lr(this.points.map((o,l)=>({x:o.x+n.x*a[l],y:o.y+n.y*a[l]})))}scale(n){const r=this.order;let i=!1;if(typeof n=="function"&&(i=n),i&&r===2)return this.raise().scale(i);const s=this.clockwise,a=this.points;if(this._linear)return this.translate(this.normal(0),i?i(0):n,i?i(1):n);const o=i?i(0):n,l=i?i(1):n,u=[this.offset(0,10),this.offset(1,10)],d=[],p=Je.lli4(u[0],u[0].c,u[1],u[1].c);if(!p)throw new Error("cannot scale this curve. Try reducing it first.");return[0,1].forEach(function(f){const g=d[f*r]=Je.copy(a[f*r]);g.x+=(f?l:o)*u[f].n.x,g.y+=(f?l:o)*u[f].n.y}),i?([0,1].forEach(function(f){if(!(r===2&&f)){var g=a[f+1],_={x:g.x-p.x,y:g.y-p.y},x=i?i((f+1)/r):n;i&&!s&&(x=-x);var v=Im(_.x*_.x+_.y*_.y);_.x/=v,_.y/=v,d[f+1]={x:g.x+x*_.x,y:g.y+x*_.y}}}),new lr(d)):([0,1].forEach(f=>{if(r===2&&f)return;const g=d[f*r],_=this.derivative(f),x={x:g.x+_.x,y:g.y+_.y};d[f+1]=Je.lli4(g,x,p,a[f+1])}),new lr(d))}outline(n,r,i,s){if(r=r===void 0?n:r,this._linear){const E=this.normal(0),A=this.points[0],O=this.points[this.points.length-1];let F,L,$;i===void 0&&(i=n,s=r),F={x:A.x+E.x*n,y:A.y+E.y*n},$={x:O.x+E.x*i,y:O.y+E.y*i},L={x:(F.x+$.x)/2,y:(F.y+$.y)/2};const z=[F,L,$];F={x:A.x-E.x*r,y:A.y-E.y*r},$={x:O.x-E.x*s,y:O.y-E.y*s},L={x:(F.x+$.x)/2,y:(F.y+$.y)/2};const B=[$,L,F],H=Je.makeline(B[2],z[0]),D=Je.makeline(z[2],B[0]),U=[H,new lr(z),D,new lr(B)];return new Sg(U)}const a=this.reduce(),o=a.length,l=[];let u=[],d,p=0,f=this.length();const g=typeof i<"u"&&typeof s<"u";function _(E,A,O,F,L){return function($){const z=F/O,B=(F+L)/O,H=A-E;return Je.map($,0,1,E+z*H,E+B*H)}}a.forEach(function(E){const A=E.length();g?(l.push(E.scale(_(n,i,f,p,A))),u.push(E.scale(_(-r,-s,f,p,A)))):(l.push(E.scale(n)),u.push(E.scale(-r))),p+=A}),u=u.map(function(E){return d=E.points,d[3]?E.points=[d[3],d[2],d[1],d[0]]:E.points=[d[2],d[1],d[0]],E}).reverse();const x=l[0].points[0],v=l[o-1].points[l[o-1].points.length-1],S=u[o-1].points[u[o-1].points.length-1],w=u[0].points[0],j=Je.makeline(S,x),C=Je.makeline(v,w),T=[j].concat(l).concat([C]).concat(u);return new Sg(T)}outlineshapes(n,r,i){r=r||n;const s=this.outline(n,r).curves,a=[];for(let o=1,l=s.length;o<l/2;o++){const u=Je.makeshape(s[o],s[l-o],i);u.startcap.virtual=o>1,u.endcap.virtual=o<l/2-1,a.push(u)}return a}intersects(n,r){return n?n.p1&&n.p2?this.lineIntersects(n):(n instanceof lr&&(n=n.reduce()),this.curveintersects(this.reduce(),n,r)):this.selfintersects(r)}lineIntersects(n){const r=w8(n.p1.x,n.p2.x),i=w8(n.p1.y,n.p2.y),s=S8(n.p1.x,n.p2.x),a=S8(n.p1.y,n.p2.y);return Je.roots(this.points,n).filter(o=>{var l=this.get(o);return Je.between(l.x,r,s)&&Je.between(l.y,i,a)})}selfintersects(n){const r=this.reduce(),i=r.length-2,s=[];for(let a=0,o,l,u;a<i;a++)l=r.slice(a,a+1),u=r.slice(a+2),o=this.curveintersects(l,u,n),s.push(...o);return s}curveintersects(n,r,i){const s=[];n.forEach(function(o){r.forEach(function(l){o.overlaps(l)&&s.push({left:o,right:l})})});let a=[];return s.forEach(function(o){const l=Je.pairiteration(o.left,o.right,i);l.length>0&&(a=a.concat(l))}),a}arcs(n){return n=n||.5,this._iterate(n,[])}_error(n,r,i,s){const a=(s-i)/4,o=this.get(i+a),l=this.get(s-a),u=Je.dist(n,r),d=Je.dist(n,o),p=Je.dist(n,l);return Lm(d-u)+Lm(p-u)}_iterate(n,r){let i=0,s=1,a;do{a=0,s=1;let o=this.get(i),l,u,d,p,f=!1,g=!1,_,x=s,v=1;do if(g=f,p=d,x=(i+s)/2,l=this.get(x),u=this.get(s),d=Je.getccenter(o,l,u),d.interval={start:i,end:s},f=this._error(d,o,i,s)<=n,_=g&&!f,_||(v=s),f){if(s>=1){if(d.interval.end=v=1,p=d,s>1){let w={x:d.x+d.r*g4e(d.e),y:d.y+d.r*v4e(d.e)};d.e+=Je.angle({x:d.x,y:d.y},w,this.get(1))}break}s=s+(s-i)/2}else s=x;while(!_&&a++<100);if(a>=100)break;p=p||d,r.push(p),i=v}while(s<1);return r}}function kE(e,n){(n==null||n>e.length)&&(n=e.length);for(var r=0,i=Array(n);r<n;r++)i[r]=e[r];return i}function x4e(e){if(Array.isArray(e))return e}function b4e(e){if(Array.isArray(e))return kE(e)}function k4e(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function w4e(e,n){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var i,s,a,o,l=[],u=!0,d=!1;try{if(a=(r=r.call(e)).next,n!==0)for(;!(u=(i=a.call(r)).done)&&(l.push(i.value),l.length!==n);u=!0);}catch(p){d=!0,s=p}finally{try{if(!u&&r.return!=null&&(o=r.return(),Object(o)!==o))return}finally{if(d)throw s}}return l}}function S4e(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function C4e(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function j4e(e,n){if(e==null)return{};var r,i,s=N4e(e,n);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i<a.length;i++)r=a[i],n.includes(r)||{}.propertyIsEnumerable.call(e,r)&&(s[r]=e[r])}return s}function N4e(e,n){if(e==null)return{};var r={};for(var i in e)if({}.hasOwnProperty.call(e,i)){if(n.includes(i))continue;r[i]=e[i]}return r}function E4e(e,n){return x4e(e)||w4e(e,n)||HV(e,n)||S4e()}function A4e(e){return b4e(e)||k4e(e)||HV(e)||C4e()}function T4e(e,n){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var i=r.call(e,n);if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}function M4e(e){var n=T4e(e,"string");return typeof n=="symbol"?n:n+""}function HV(e,n){if(e){if(typeof e=="string")return kE(e,n);var r={}.toString.call(e).slice(8,-1);return r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set"?Array.from(e):r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?kE(e,n):void 0}}var R4e=(function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1,s=(n instanceof Array?n.length?n:[void 0]:[n]).map(function(l){return{keyAccessor:l,isProp:!(l instanceof Function)}}),a=e.reduce(function(l,u){var d=l,p=u;return s.forEach(function(f,g){var _=f.keyAccessor,x=f.isProp,v;if(x){var S=p,w=S[_],j=j4e(S,[_].map(M4e));v=w,p=j}else v=_(p,g);g+1<s.length?(d.hasOwnProperty(v)||(d[v]={}),d=d[v]):r?(d.hasOwnProperty(v)||(d[v]=[]),d[v].push(p)):d[v]=p}),l},{});r instanceof Function&&(function l(u){var d=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1;d===s.length?Object.keys(u).forEach(function(p){return u[p]=r(u[p])}):Object.values(u).forEach(function(p){return l(p,d+1)})})(a);var o=a;return i&&(o=[],(function l(u){var d=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[];d.length===s.length?o.push({keys:d,vals:u}):Object.entries(u).forEach(function(p){var f=E4e(p,2),g=f[0],_=f[1];return l(_,[].concat(A4e(d),[g]))})})(a),n instanceof Array&&n.length===0&&o.length===1&&(o[0].keys=[])),o});function O4e(e,n){switch(arguments.length){case 0:break;case 1:this.range(e);break;default:this.range(n).domain(e);break}return this}const C8=Symbol("implicit");function WV(){var e=new KI,n=[],r=[],i=C8;function s(a){let o=e.get(a);if(o===void 0){if(i!==C8)return i;e.set(a,o=n.push(a)-1)}return r[o%r.length]}return s.domain=function(a){if(!arguments.length)return n.slice();n=[],e=new KI;for(const o of a)e.has(o)||e.set(o,n.push(o)-1);return s},s.range=function(a){return arguments.length?(r=Array.from(a),s):r.slice()},s.unknown=function(a){return arguments.length?(i=a,s):i},s.copy=function(){return WV(n,r).unknown(i)},O4e.apply(s,arguments),s}function D4e(e){for(var n=e.length/6|0,r=new Array(n),i=0;i<n;)r[i]="#"+e.slice(i*6,++i*6);return r}const P4e=D4e("a6cee31f78b4b2df8a33a02cfb9a99e31a1cfdbf6fff7f00cab2d66a3d9affff99b15928");function L4e(e,n){n===void 0&&(n={});var r=n.insertAt;if(!(typeof document>"u")){var i=document.head||document.getElementsByTagName("head")[0],s=document.createElement("style");s.type="text/css",r==="top"&&i.firstChild?i.insertBefore(s,i.firstChild):i.appendChild(s),s.styleSheet?s.styleSheet.cssText=e:s.appendChild(document.createTextNode(e))}}var I4e=`.force-graph-container canvas {
  display: block;
  user-select: none;
  outline: none;
  -webkit-tap-highlight-color: transparent;
}

.force-graph-container .clickable {
  cursor: pointer;
}

.force-graph-container .grabbable {
  cursor: move;
  cursor: grab;
  cursor: -moz-grab;
  cursor: -webkit-grab;
}

.force-graph-container .grabbable:active {
  cursor: grabbing;
  cursor: -moz-grabbing;
  cursor: -webkit-grabbing;
}
`;L4e(I4e);function wE(e,n){(n==null||n>e.length)&&(n=e.length);for(var r=0,i=Array(n);r<n;r++)i[r]=e[r];return i}function B4e(e){if(Array.isArray(e))return e}function z4e(e){if(Array.isArray(e))return wE(e)}function j8(e,n,r){if(qV())return Reflect.construct.apply(null,arguments);var i=[null];i.push.apply(i,n);var s=new(e.bind.apply(e,i));return s}function fv(e,n,r){return(n=U4e(n))in e?Object.defineProperty(e,n,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[n]=r,e}function qV(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(qV=function(){return!!e})()}function $4e(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function F4e(e,n){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var i,s,a,o,l=[],u=!0,d=!1;try{if(a=(r=r.call(e)).next,n!==0)for(;!(u=(i=a.call(r)).done)&&(l.push(i.value),l.length!==n);u=!0);}catch(p){d=!0,s=p}finally{try{if(!u&&r.return!=null&&(o=r.return(),Object(o)!==o))return}finally{if(d)throw s}}return l}}function H4e(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function W4e(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function N8(e,n){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),r.push.apply(r,i)}return r}function qh(e){for(var n=1;n<arguments.length;n++){var r=arguments[n]!=null?arguments[n]:{};n%2?N8(Object(r),!0).forEach(function(i){fv(e,i,r[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):N8(Object(r)).forEach(function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(r,i))})}return e}function Cg(e,n){return B4e(e)||F4e(e,n)||UV(e,n)||H4e()}function Na(e){return z4e(e)||$4e(e)||UV(e)||W4e()}function q4e(e,n){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var i=r.call(e,n);if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(n==="string"?String:Number)(e)}function U4e(e){var n=q4e(e,"string");return typeof n=="symbol"?n:n+""}function SE(e){"@babel/helpers - typeof";return SE=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(n){return typeof n}:function(n){return n&&typeof Symbol=="function"&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n},SE(e)}function UV(e,n){if(e){if(typeof e=="string")return wE(e,n);var r={}.toString.call(e).slice(8,-1);return r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set"?Array.from(e):r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?wE(e,n):void 0}}var K4e=WV(P4e);function E8(e,n,r){!n||typeof r!="string"||e.filter(function(i){return!i[r]}).forEach(function(i){i[r]=K4e(n(i))})}function V4e(e,n){var r=e.nodes,i=e.links,s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},a=s.nodeFilter,o=a===void 0?function(){return!0}:a,l=s.onLoopError,u=l===void 0?function(_){throw"Invalid DAG structure! Found cycle in node path: ".concat(_.join(" -> "),".")}:l,d={};r.forEach(function(_){return d[n(_)]={data:_,out:[],depth:-1,skip:!o(_)}}),i.forEach(function(_){var x=_.source,v=_.target,S=T(x),w=T(v);if(!d.hasOwnProperty(S))throw"Missing source node with id: ".concat(S);if(!d.hasOwnProperty(w))throw"Missing target node with id: ".concat(w);var j=d[S],C=d[w];j.out.push(C);function T(E){return SE(E)==="object"?n(E):E}});var p=[];g(Object.values(d));var f=Object.assign.apply(Object,[{}].concat(Na(Object.entries(d).filter(function(_){var x=Cg(_,2),v=x[1];return!v.skip}).map(function(_){var x=Cg(_,2),v=x[0],S=x[1];return fv({},v,S.depth)}))));return f;function g(_){for(var x=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],v=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,S=function(){var T=_[w];if(x.indexOf(T)!==-1){var E=[].concat(Na(x.slice(x.indexOf(T))),[T]).map(function(A){return n(A.data)});return p.some(function(A){return A.length===E.length&&A.every(function(O,F){return O===E[F]})})||(p.push(E),u(E)),1}v>T.depth&&(T.depth=v,g(T.out,[].concat(Na(x),[T]),v+(T.skip?0:1)))},w=0,j=_.length;w<j;w++)S()}}var Y4e=2,Fi=function(n,r){return r.onNeedsRedraw&&r.onNeedsRedraw()},A8=function(n,r){if(!r.isShadow){var i=Ln(r.linkDirectionalParticles);r.graphData.links.forEach(function(s){var a=Math.round(Math.abs(i(s)));a?s.__photons=Na(Array(a)).map(function(){return{}}):delete s.__photons})}},g0=eM({props:{graphData:{default:{nodes:[],links:[]},onChange:function(n,r){r.engineRunning=!1,A8(n,r)}},dagMode:{onChange:function(n,r){!n&&(r.graphData.nodes||[]).forEach(function(i){return i.fx=i.fy=void 0})}},dagLevelDistance:{},dagNodeFilter:{default:function(n){return!0}},onDagError:{triggerUpdate:!1},nodeRelSize:{default:4,triggerUpdate:!1,onChange:Fi},nodeId:{default:"id"},nodeVal:{default:"val",triggerUpdate:!1,onChange:Fi},nodeColor:{default:"color",triggerUpdate:!1,onChange:Fi},nodeAutoColorBy:{},nodeCanvasObject:{triggerUpdate:!1,onChange:Fi},nodeCanvasObjectMode:{default:function(){return"replace"},triggerUpdate:!1,onChange:Fi},nodeVisibility:{default:!0,triggerUpdate:!1,onChange:Fi},linkSource:{default:"source"},linkTarget:{default:"target"},linkVisibility:{default:!0,triggerUpdate:!1,onChange:Fi},linkColor:{default:"color",triggerUpdate:!1,onChange:Fi},linkAutoColorBy:{},linkLineDash:{triggerUpdate:!1,onChange:Fi},linkWidth:{default:1,triggerUpdate:!1,onChange:Fi},linkCurvature:{default:0,triggerUpdate:!1,onChange:Fi},linkCanvasObject:{triggerUpdate:!1,onChange:Fi},linkCanvasObjectMode:{default:function(){return"replace"},triggerUpdate:!1,onChange:Fi},linkDirectionalArrowLength:{default:0,triggerUpdate:!1,onChange:Fi},linkDirectionalArrowColor:{triggerUpdate:!1,onChange:Fi},linkDirectionalArrowRelPos:{default:.5,triggerUpdate:!1,onChange:Fi},linkDirectionalParticles:{default:0,triggerUpdate:!1,onChange:A8},linkDirectionalParticleSpeed:{default:.01,triggerUpdate:!1},linkDirectionalParticleOffset:{default:0,triggerUpdate:!1},linkDirectionalParticleWidth:{default:4,triggerUpdate:!1},linkDirectionalParticleColor:{triggerUpdate:!1},linkDirectionalParticleCanvasObject:{triggerUpdate:!1},globalScale:{default:1,triggerUpdate:!1},d3AlphaMin:{default:0,triggerUpdate:!1},d3AlphaDecay:{default:.0228,triggerUpdate:!1,onChange:function(n,r){r.forceLayout.alphaDecay(n)}},d3AlphaTarget:{default:0,triggerUpdate:!1,onChange:function(n,r){r.forceLayout.alphaTarget(n)}},d3VelocityDecay:{default:.4,triggerUpdate:!1,onChange:function(n,r){r.forceLayout.velocityDecay(n)}},warmupTicks:{default:0,triggerUpdate:!1},cooldownTicks:{default:1/0,triggerUpdate:!1},cooldownTime:{default:15e3,triggerUpdate:!1},onUpdate:{default:function(){},triggerUpdate:!1},onFinishUpdate:{default:function(){},triggerUpdate:!1},onEngineTick:{default:function(){},triggerUpdate:!1},onEngineStop:{default:function(){},triggerUpdate:!1},onNeedsRedraw:{triggerUpdate:!1},isShadow:{default:!1,triggerUpdate:!1}},methods:{d3Force:function(n,r,i){return i===void 0?n.forceLayout.force(r):(n.forceLayout.force(r,i),this)},d3ReheatSimulation:function(n){return n.forceLayout.alpha(1),this.resetCountdown(),this},resetCountdown:function(n){return n.cntTicks=0,n.startTickTime=new Date,n.engineRunning=!0,this},isEngineRunning:function(n){return!!n.engineRunning},tickFrame:function(n){return!n.isShadow&&r(),s(),!n.isShadow&&a(),!n.isShadow&&o(),i(),this;function r(){n.engineRunning&&(++n.cntTicks>n.cooldownTicks||new Date-n.startTickTime>n.cooldownTime||n.d3AlphaMin>0&&n.forceLayout.alpha()<n.d3AlphaMin?(n.engineRunning=!1,n.onEngineStop()):(n.forceLayout.tick(),n.onEngineTick()))}function i(){var l=Ln(n.nodeVisibility),u=Ln(n.nodeVal),d=Ln(n.nodeColor),p=Ln(n.nodeCanvasObjectMode),f=n.ctx,g=n.isShadow/n.globalScale,_=n.graphData.nodes.filter(l);f.save(),_.forEach(function(x){var v=p(x);if(n.nodeCanvasObject&&(v==="before"||v==="replace")&&(n.nodeCanvasObject(x,f,n.globalScale),v==="replace")){f.restore();return}var S=Math.sqrt(Math.max(0,u(x)||1))*n.nodeRelSize+g;f.beginPath(),f.arc(x.x,x.y,S,0,2*Math.PI,!1),f.fillStyle=d(x)||"rgba(31, 120, 180, 0.92)",f.fill(),n.nodeCanvasObject&&v==="after"&&n.nodeCanvasObject(x,n.ctx,n.globalScale)}),f.restore()}function s(){var l=Ln(n.linkVisibility),u=Ln(n.linkColor),d=Ln(n.linkWidth),p=Ln(n.linkLineDash),f=Ln(n.linkCurvature),g=Ln(n.linkCanvasObjectMode),_=n.ctx,x=n.isShadow*2,v=n.graphData.links.filter(l);v.forEach(A);var S=[],w=[],j=v;if(n.linkCanvasObject){var C=[],T=[];v.forEach(function(O){return({before:S,after:w,replace:C}[g(O)]||T).push(O)}),j=[].concat(Na(S),w,T),S=S.concat(C)}_.save(),S.forEach(function(O){return n.linkCanvasObject(O,_,n.globalScale)}),_.restore();var E=R4e(j,[u,d,p]);_.save(),Object.entries(E).forEach(function(O){var F=Cg(O,2),L=F[0],$=F[1],z=!L||L==="undefined"?"rgba(0,0,0,0.15)":L;Object.entries($).forEach(function(B){var H=Cg(B,2),D=H[0],U=H[1],I=(D||1)/n.globalScale+x;Object.entries(U).forEach(function(X){var K=Cg(X,2);K[0];var Q=K[1],V=p(Q[0]);_.beginPath(),Q.forEach(function(R){var q=R.source,W=R.target;if(!(!q||!W||!q.hasOwnProperty("x")||!W.hasOwnProperty("x"))){_.moveTo(q.x,q.y);var te=R.__controlPoints;te?_[te.length===2?"quadraticCurveTo":"bezierCurveTo"].apply(_,Na(te).concat([W.x,W.y])):_.lineTo(W.x,W.y)}}),_.strokeStyle=z,_.lineWidth=I,_.setLineDash(V||[]),_.stroke()})})}),_.restore(),_.save(),w.forEach(function(O){return n.linkCanvasObject(O,_,n.globalScale)}),_.restore();function A(O){var F=f(O);if(!F){O.__controlPoints=null;return}var L=O.source,$=O.target;if(!(!L||!$||!L.hasOwnProperty("x")||!$.hasOwnProperty("x"))){var z=Math.sqrt(Math.pow($.x-L.x,2)+Math.pow($.y-L.y,2));if(z>0){var B=Math.atan2($.y-L.y,$.x-L.x),H=z*F,D={x:(L.x+$.x)/2+H*Math.cos(B-Math.PI/2),y:(L.y+$.y)/2+H*Math.sin(B-Math.PI/2)};O.__controlPoints=[D.x,D.y]}else{var U=F*70;O.__controlPoints=[$.x,$.y-U,$.x+U,$.y]}}}}function a(){var l=1.6,u=.2,d=Ln(n.linkDirectionalArrowLength),p=Ln(n.linkDirectionalArrowRelPos),f=Ln(n.linkVisibility),g=Ln(n.linkDirectionalArrowColor||n.linkColor),_=Ln(n.nodeVal),x=n.ctx;x.save(),n.graphData.links.filter(f).forEach(function(v){var S=d(v);if(!(!S||S<0)){var w=v.source,j=v.target;if(!(!w||!j||!w.hasOwnProperty("x")||!j.hasOwnProperty("x"))){var C=Math.sqrt(Math.max(0,_(w)||1))*n.nodeRelSize,T=Math.sqrt(Math.max(0,_(j)||1))*n.nodeRelSize,E=Math.min(1,Math.max(0,p(v))),A=g(v)||"rgba(0,0,0,0.28)",O=S/l/2,F=v.__controlPoints&&j8(lr,[w.x,w.y].concat(Na(v.__controlPoints),[j.x,j.y])),L=F?function(I){return F.get(I)}:function(I){return{x:w.x+(j.x-w.x)*I||0,y:w.y+(j.y-w.y)*I||0}},$=F?F.length():Math.sqrt(Math.pow(j.x-w.x,2)+Math.pow(j.y-w.y,2)),z=C+S+($-C-T-S)*E,B=L(z/$),H=L((z-S)/$),D=L((z-S*(1-u))/$),U=Math.atan2(B.y-H.y,B.x-H.x)-Math.PI/2;x.beginPath(),x.moveTo(B.x,B.y),x.lineTo(H.x+O*Math.cos(U),H.y+O*Math.sin(U)),x.lineTo(D.x,D.y),x.lineTo(H.x-O*Math.cos(U),H.y-O*Math.sin(U)),x.fillStyle=A,x.fill()}}}),x.restore()}function o(){var l=Ln(n.linkDirectionalParticles),u=Ln(n.linkDirectionalParticleSpeed),d=Ln(n.linkDirectionalParticleOffset),p=Ln(n.linkDirectionalParticleWidth),f=Ln(n.linkVisibility),g=Ln(n.linkDirectionalParticleColor||n.linkColor),_=n.ctx;_.save(),n.graphData.links.filter(f).forEach(function(x){var v=l(x);if(!(!x.hasOwnProperty("__photons")||!x.__photons.length)){var S=x.source,w=x.target;if(!(!S||!w||!S.hasOwnProperty("x")||!w.hasOwnProperty("x"))){var j=u(x),C=Math.abs(d(x)),T=x.__photons||[],E=Math.max(0,p(x)/2)/Math.sqrt(n.globalScale),A=g(x)||"rgba(0,0,0,0.28)";_.fillStyle=A;var O=x.__controlPoints?j8(lr,[S.x,S.y].concat(Na(x.__controlPoints),[w.x,w.y])):null,F=0,L=!1;T.forEach(function($){var z=!!$.__singleHop;if($.hasOwnProperty("__progressRatio")||($.__progressRatio=z?0:(F+C)/v),!z&&F++,$.__progressRatio+=j,$.__progressRatio>=1)if(!z)$.__progressRatio=$.__progressRatio%1;else{L=!0;return}var B=$.__progressRatio,H=O?O.get(B):{x:S.x+(w.x-S.x)*B||0,y:S.y+(w.y-S.y)*B||0};n.linkDirectionalParticleCanvasObject?n.linkDirectionalParticleCanvasObject(H.x,H.y,x,_,n.globalScale):(_.beginPath(),_.arc(H.x,H.y,E,0,2*Math.PI,!1),_.fill())}),L&&(x.__photons=x.__photons.filter(function($){return!$.__singleHop||$.__progressRatio<=1}))}}}),_.restore()}},emitParticle:function(n,r){return r&&(!r.__photons&&(r.__photons=[]),r.__photons.push({__singleHop:!0})),this}},stateInit:function(){return{forceLayout:u4e().force("link",n4e()).force("charge",d4e()).force("center",iOe()).force("dagRadial",null).stop(),engineRunning:!1}},init:function(n,r){r.ctx=n},update:function(n,r){n.engineRunning=!1,n.onUpdate(),n.nodeAutoColorBy!==null&&E8(n.graphData.nodes,Ln(n.nodeAutoColorBy),n.nodeColor),n.linkAutoColorBy!==null&&E8(n.graphData.links,Ln(n.linkAutoColorBy),n.linkColor),n.graphData.links.forEach(function(g){g.source=g[n.linkSource],g.target=g[n.linkTarget]}),n.forceLayout.stop().alpha(1).nodes(n.graphData.nodes);var i=n.forceLayout.force("link");i&&i.id(function(g){return g[n.nodeId]}).links(n.graphData.links);var s=n.dagMode&&V4e(n.graphData,function(g){return g[n.nodeId]},{nodeFilter:n.dagNodeFilter,onLoopError:n.onDagError||void 0}),a=Math.max.apply(Math,Na(Object.values(s||[]))),o=n.dagLevelDistance||n.graphData.nodes.length/(a||1)*Y4e*(["radialin","radialout"].indexOf(n.dagMode)!==-1?.7:1);if(["lr","rl","td","bu"].includes(r.dagMode)){var l=["lr","rl"].includes(r.dagMode)?"fx":"fy";n.graphData.nodes.filter(n.dagNodeFilter).forEach(function(g){return delete g[l]})}if(["lr","rl","td","bu"].includes(n.dagMode)){var u=["rl","bu"].includes(n.dagMode),d=function(_){return(s[_[n.nodeId]]-a/2)*o*(u?-1:1)},p=["lr","rl"].includes(n.dagMode)?"fx":"fy";n.graphData.nodes.filter(n.dagNodeFilter).forEach(function(g){return g[p]=d(g)})}n.forceLayout.force("dagRadial",["radialin","radialout"].indexOf(n.dagMode)!==-1?h4e(function(g){var _=s[g[n.nodeId]]||-1;return(n.dagMode==="radialin"?a-_:_)*o}).strength(function(g){return n.dagNodeFilter(g)?1:0}):null);for(var f=0;f<n.warmupTicks&&!(n.d3AlphaMin>0&&n.forceLayout.alpha()<n.d3AlphaMin);f++)n.forceLayout.tick();this.resetCountdown(),n.onFinishUpdate()}});function KV(e,n){var r=e instanceof Array?e:[e],i=new n;return i._destructor&&i._destructor(),{linkProp:function(a){return{default:i[a](),onChange:function(l,u){r.forEach(function(d){return u[d][a](l)})},triggerUpdate:!1}},linkMethod:function(a){return function(o){for(var l=arguments.length,u=new Array(l>1?l-1:0),d=1;d<l;d++)u[d-1]=arguments[d];var p=[];return r.forEach(function(f){var g=o[f],_=g[a].apply(g,u);_!==g&&p.push(_)}),p.length?p[0]:this}}}}var G4e=800,X4e=4,Q4e=5,VV=KV("forceGraph",g0),Z4e=KV(["forceGraph","shadowGraph"],g0),J4e=Object.assign.apply(Object,Na(["nodeColor","nodeAutoColorBy","nodeCanvasObject","nodeCanvasObjectMode","linkColor","linkAutoColorBy","linkLineDash","linkWidth","linkCanvasObject","linkCanvasObjectMode","linkDirectionalArrowLength","linkDirectionalArrowColor","linkDirectionalArrowRelPos","linkDirectionalParticles","linkDirectionalParticleSpeed","linkDirectionalParticleOffset","linkDirectionalParticleWidth","linkDirectionalParticleColor","linkDirectionalParticleCanvasObject","dagMode","dagLevelDistance","dagNodeFilter","onDagError","d3AlphaMin","d3AlphaDecay","d3VelocityDecay","warmupTicks","cooldownTicks","cooldownTime","onEngineTick","onEngineStop"].map(function(e){return fv({},e,VV.linkProp(e))})).concat(Na(["nodeRelSize","nodeId","nodeVal","nodeVisibility","linkSource","linkTarget","linkVisibility","linkCurvature"].map(function(e){return fv({},e,Z4e.linkProp(e))})))),eDe=Object.assign.apply(Object,Na(["d3Force","d3ReheatSimulation","emitParticle"].map(function(e){return fv({},e,VV.linkMethod(e))})));function W2(e){if(e.canvas){var n=e.canvas.width,r=e.canvas.height;n===300&&r===150&&(n=r=0);var i=window.devicePixelRatio;n/=i,r/=i,[e.canvas,e.shadowCanvas].forEach(function(a){a.style.width="".concat(e.width,"px"),a.style.height="".concat(e.height,"px"),a.width=e.width*i,a.height=e.height*i,!n&&!r&&a.getContext("2d").scale(i,i)});var s=Wa(e.canvas).k;e.zoom.translateBy(e.zoom.__baseElem,(e.width-n)/2/s,(e.height-r)/2/s),e.needsRedraw=!0}}function YV(e){var n=window.devicePixelRatio;e.setTransform(n,0,0,n,0,0)}function T8(e,n,r){e.save(),YV(e),e.clearRect(0,0,n,r),e.restore()}var tDe=eM({props:qh({width:{default:window.innerWidth,onChange:function(n,r){return W2(r)},triggerUpdate:!1},height:{default:window.innerHeight,onChange:function(n,r){return W2(r)},triggerUpdate:!1},graphData:{default:{nodes:[],links:[]},onChange:function(n,r){[n.nodes,n.links].every(function(s){return(s||[]).every(function(a){return!a.hasOwnProperty("__indexColor")})})&&r.colorTracker.reset(),[{type:"Node",objs:n.nodes},{type:"Link",objs:n.links}].forEach(i),r.forceGraph.graphData(n),r.shadowGraph.graphData(n);function i(s){var a=s.type,o=s.objs;o.filter(function(l){if(!l.hasOwnProperty("__indexColor"))return!0;var u=r.colorTracker.lookup(l.__indexColor);return!u||!u.hasOwnProperty("d")||u.d!==l}).forEach(function(l){l.__indexColor=r.colorTracker.register({type:a,d:l})})}},triggerUpdate:!1},backgroundColor:{onChange:function(n,r){r.canvas&&n&&(r.canvas.style.background=n)},triggerUpdate:!1},nodeLabel:{default:"name",triggerUpdate:!1},nodePointerAreaPaint:{onChange:function(n,r){r.shadowGraph.nodeCanvasObject(n?function(i,s,a){return n(i,i.__indexColor,s,a)}:null),r.flushShadowCanvas&&r.flushShadowCanvas()},triggerUpdate:!1},linkPointerAreaPaint:{onChange:function(n,r){r.shadowGraph.linkCanvasObject(n?function(i,s,a){return n(i,i.__indexColor,s,a)}:null),r.flushShadowCanvas&&r.flushShadowCanvas()},triggerUpdate:!1},linkLabel:{default:"name",triggerUpdate:!1},linkHoverPrecision:{default:4,triggerUpdate:!1},minZoom:{default:.01,onChange:function(n,r){r.zoom.scaleExtent([n,r.zoom.scaleExtent()[1]])},triggerUpdate:!1},maxZoom:{default:1e3,onChange:function(n,r){r.zoom.scaleExtent([r.zoom.scaleExtent()[0],n])},triggerUpdate:!1},enableNodeDrag:{default:!0,triggerUpdate:!1},enableZoomInteraction:{default:!0,triggerUpdate:!1},enablePanInteraction:{default:!0,triggerUpdate:!1},enableZoomPanInteraction:{default:!0,triggerUpdate:!1},enablePointerInteraction:{default:!0,onChange:function(n,r){r.hoverObj=null},triggerUpdate:!1},autoPauseRedraw:{default:!0,triggerUpdate:!1},onNodeDrag:{default:function(){},triggerUpdate:!1},onNodeDragEnd:{default:function(){},triggerUpdate:!1},onNodeClick:{triggerUpdate:!1},onNodeRightClick:{triggerUpdate:!1},onNodeHover:{triggerUpdate:!1},onLinkClick:{triggerUpdate:!1},onLinkRightClick:{triggerUpdate:!1},onLinkHover:{triggerUpdate:!1},onBackgroundClick:{triggerUpdate:!1},onBackgroundRightClick:{triggerUpdate:!1},showPointerCursor:{default:!0,triggerUpdate:!1},onZoom:{triggerUpdate:!1},onZoomEnd:{triggerUpdate:!1},onRenderFramePre:{triggerUpdate:!1},onRenderFramePost:{triggerUpdate:!1}},J4e),aliases:{stopAnimation:"pauseAnimation"},methods:qh({graph2ScreenCoords:function(n,r,i){var s=Wa(n.canvas);return{x:r*s.k+s.x,y:i*s.k+s.y}},screen2GraphCoords:function(n,r,i){var s=Wa(n.canvas);return{x:(r-s.x)/s.k,y:(i-s.y)/s.k}},centerAt:function(n,r,i,s){if(!n.canvas)return null;if(r!==void 0||i!==void 0){var a=Object.assign({},r!==void 0?{x:r}:{},i!==void 0?{y:i}:{});return s?n.tweenGroup.add(new JI(o()).to(a,s).easing(Ad.Quadratic.Out).onUpdate(l).onComplete(function(){n.tweenGroup.remove(this)}).start()):l(a),this}return o();function o(){var u=Wa(n.canvas);return{x:(n.width/2-u.x)/u.k,y:(n.height/2-u.y)/u.k}}function l(u){var d=u.x,p=u.y;n.zoom.translateTo(n.zoom.__baseElem,d===void 0?o().x:d,p===void 0?o().y:p),n.needsRedraw=!0}},zoom:function(n,r,i){if(!n.canvas)return null;if(r!==void 0)return i?n.tweenGroup.add(new JI({k:s()}).to({k:r},i).easing(Ad.Quadratic.Out).onUpdate(function(o){var l=o.k;return a(l)}).onComplete(function(){n.tweenGroup.remove(this)}).start()):a(r),this;return s();function s(){return Wa(n.canvas).k}function a(o){n.zoom.scaleTo(n.zoom.__baseElem,o),n.needsRedraw=!0}},zoomToFit:function(n){for(var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:10,s=arguments.length,a=new Array(s>3?s-3:0),o=3;o<s;o++)a[o-3]=arguments[o];var l=this.getGraphBbox.apply(this,a);if(l){var u={x:(l.x[0]+l.x[1])/2,y:(l.y[0]+l.y[1])/2},d=Math.max(1e-12,Math.min(1e12,(n.width-i*2)/(l.x[1]-l.x[0]),(n.height-i*2)/(l.y[1]-l.y[0])));this.centerAt(u.x,u.y,r),this.zoom(d,r)}return this},getGraphBbox:function(n){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:function(){return!0},i=Ln(n.nodeVal),s=function(l){return Math.sqrt(Math.max(0,i(l)||1))*n.nodeRelSize},a=n.graphData.nodes.filter(r).map(function(o){return{x:o.x,y:o.y,r:s(o)}});return a.length?{x:[GI(a,function(o){return o.x-o.r}),YI(a,function(o){return o.x+o.r})],y:[GI(a,function(o){return o.y-o.r}),YI(a,function(o){return o.y+o.r})]}:null},pauseAnimation:function(n){return n.animationFrameRequestId&&(cancelAnimationFrame(n.animationFrameRequestId),n.animationFrameRequestId=null),this},resumeAnimation:function(n){return n.animationFrameRequestId||this._animationCycle(),this},_destructor:function(){this.pauseAnimation(),this.graphData({nodes:[],links:[]})}},eDe),stateInit:function(){return{lastSetZoom:1,zoom:KA(),forceGraph:new g0,shadowGraph:new g0().cooldownTicks(0).nodeColor("__indexColor").linkColor("__indexColor").isShadow(!0),colorTracker:new P3e,tweenGroup:new vV}},init:function(n,r){var i=this;n.innerHTML="";var s=document.createElement("div");s.classList.add("force-graph-container"),s.style.position="relative",n.appendChild(s),r.canvas=document.createElement("canvas"),r.backgroundColor&&(r.canvas.style.background=r.backgroundColor),s.appendChild(r.canvas),r.shadowCanvas=document.createElement("canvas");var a=r.canvas.getContext("2d"),o=r.shadowCanvas.getContext("2d",{willReadFrequently:!0}),l={x:-1e12,y:-1e12},u=function(){var f=null,g=window.devicePixelRatio,_=l.x>0&&l.y>0?o.getImageData(l.x*g,l.y*g,1,1):null;return _&&(f=r.colorTracker.lookup(_.data)),f};qi(r.canvas).call(zA().subject(function(){if(!r.enableNodeDrag)return null;var p=u();return p&&p.type==="Node"?p.d:null}).on("start",function(p){var f=p.subject;f.__initialDragPos={x:f.x,y:f.y,fx:f.fx,fy:f.fy},p.active||(f.fx=f.x,f.fy=f.y),r.canvas.classList.add("grabbable")}).on("drag",function(p){var f=p.subject,g=f.__initialDragPos,_=p,x=Wa(r.canvas).k,v={x:g.x+(_.x-g.x)/x-f.x,y:g.y+(_.y-g.y)/x-f.y};["x","y"].forEach(function(S){return f["f".concat(S)]=f[S]=g[S]+(_[S]-g[S])/x}),!(!f.__dragged&&Q4e>=Math.sqrt(m5e(["x","y"].map(function(S){return Math.pow(p[S]-g[S],2)}))))&&(r.forceGraph.d3AlphaTarget(.3).resetCountdown(),r.isPointerDragging=!0,f.__dragged=!0,r.onNodeDrag(f,v))}).on("end",function(p){var f=p.subject,g=f.__initialDragPos,_={x:f.x-g.x,y:f.y-g.y};g.fx===void 0&&(f.fx=void 0),g.fy===void 0&&(f.fy=void 0),delete f.__initialDragPos,r.forceGraph.d3AlphaTarget()&&r.forceGraph.d3AlphaTarget(0).resetCountdown(),r.canvas.classList.remove("grabbable"),r.isPointerDragging=!1,f.__dragged&&(delete f.__dragged,r.onNodeDragEnd(f,_))})),r.zoom(r.zoom.__baseElem=qi(r.canvas)),r.zoom.__baseElem.on("dblclick.zoom",null),r.zoom.filter(function(p){return!p.button&&r.enableZoomPanInteraction&&(p.type!=="wheel"||Ln(r.enableZoomInteraction)(p))&&(p.type==="wheel"||Ln(r.enablePanInteraction)(p))}).on("zoom",function(p){var f=p.transform;[a,o].forEach(function(g){YV(g),g.translate(f.x,f.y),g.scale(f.k,f.k)}),r.isPointerDragging=!0,r.onZoom&&r.onZoom(qh(qh({},f),i.centerAt())),r.needsRedraw=!0}).on("end",function(p){r.isPointerDragging=!1,r.onZoomEnd&&r.onZoomEnd(qh(qh({},p.transform),i.centerAt()))}),W2(r),r.forceGraph.onNeedsRedraw(function(){return r.needsRedraw=!0}).onFinishUpdate(function(){Wa(r.canvas).k===r.lastSetZoom&&r.graphData.nodes.length&&(r.zoom.scaleTo(r.zoom.__baseElem,r.lastSetZoom=X4e/Math.cbrt(r.graphData.nodes.length)),r.needsRedraw=!0)}),r.tooltip=new rOe(s),["pointermove","pointerdown"].forEach(function(p){return s.addEventListener(p,function(f){p==="pointerdown"&&(r.isPointerPressed=!0,r.pointerDownEvent=f),!r.isPointerDragging&&f.type==="pointermove"&&r.onBackgroundClick&&(f.pressure>0||r.isPointerPressed)&&(f.pointerType==="mouse"||f.movementX===void 0||[f.movementX,f.movementY].some(function(x){return Math.abs(x)>1}))&&(r.isPointerDragging=!0);var g=_(s);l.x=f.pageX-g.left,l.y=f.pageY-g.top;function _(x){var v=x.getBoundingClientRect(),S=window.pageXOffset||document.documentElement.scrollLeft,w=window.pageYOffset||document.documentElement.scrollTop;return{top:v.top+w,left:v.left+S}}},{passive:!0})}),s.addEventListener("pointerup",function(p){if(r.isPointerPressed){if(r.isPointerPressed=!1,r.isPointerDragging){r.isPointerDragging=!1;return}var f=[p,r.pointerDownEvent];requestAnimationFrame(function(){if(p.button===0)if(r.hoverObj){var g=r["on".concat(r.hoverObj.type,"Click")];g&&g.apply(void 0,[r.hoverObj.d].concat(f))}else r.onBackgroundClick&&r.onBackgroundClick.apply(r,f);if(p.button===2)if(r.hoverObj){var _=r["on".concat(r.hoverObj.type,"RightClick")];_&&_.apply(void 0,[r.hoverObj.d].concat(f))}else r.onBackgroundRightClick&&r.onBackgroundRightClick.apply(r,f)})}},{passive:!0}),s.addEventListener("contextmenu",function(p){return!r.onBackgroundRightClick&&!r.onNodeRightClick&&!r.onLinkRightClick?!0:(p.preventDefault(),!1)}),r.forceGraph(a),r.shadowGraph(o);var d=H5e(function(){T8(o,r.width,r.height),r.shadowGraph.linkWidth(function(f){return Ln(r.linkWidth)(f)+r.linkHoverPrecision});var p=Wa(r.canvas);r.shadowGraph.globalScale(p.k).tickFrame()},G4e);r.flushShadowCanvas=d.flush,(this._animationCycle=function p(){var f=!r.autoPauseRedraw||!!r.needsRedraw||r.forceGraph.isEngineRunning()||r.graphData.links.some(function(C){return C.__photons&&C.__photons.length});if(r.needsRedraw=!1,r.enablePointerInteraction){var g=r.isPointerDragging?null:u();if(g!==r.hoverObj){var _=r.hoverObj,x=_?_.type:null,v=g?g.type:null;if(x&&x!==v){var S=r["on".concat(x,"Hover")];S&&S(null,_.d)}if(v){var w=r["on".concat(v,"Hover")];w&&w(g.d,x===v?_.d:null)}r.tooltip.content(g&&Ln(r["".concat(g.type.toLowerCase(),"Label")])(g.d)||null),r.canvas.classList[(g&&r["on".concat(v,"Click")]||!g&&r.onBackgroundClick)&&Ln(r.showPointerCursor)(g==null?void 0:g.d)?"add":"remove"]("clickable"),r.hoverObj=g}f&&d()}if(f){T8(a,r.width,r.height);var j=Wa(r.canvas).k;r.onRenderFramePre&&r.onRenderFramePre(a,j),r.forceGraph.globalScale(j).tickFrame(),r.onRenderFramePost&&r.onRenderFramePost(a,j)}r.tweenGroup.update(),r.animationFrameRequestId=requestAnimationFrame(p)})()},update:function(n){}}),q2={exports:{}},U2,M8;function nDe(){if(M8)return U2;M8=1;var e="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return U2=e,U2}var K2,R8;function rDe(){if(R8)return K2;R8=1;var e=nDe();function n(){}function r(){}return r.resetWarningCache=n,K2=function(){function i(o,l,u,d,p,f){if(f!==e){var g=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw g.name="Invariant Violation",g}}i.isRequired=i;function s(){return i}var a={array:i,bigint:i,bool:i,func:i,number:i,object:i,string:i,symbol:i,any:i,arrayOf:s,element:i,elementType:i,instanceOf:s,node:i,objectOf:s,oneOf:s,oneOfType:s,shape:s,exact:s,checkPropTypes:r,resetWarningCache:n};return a.PropTypes=a,a},K2}var O8;function iDe(){return O8||(O8=1,q2.exports=rDe()()),q2.exports}var sDe=iDe();const ve=wu(sDe),jk={width:ve.number,height:ve.number,graphData:ve.shape({nodes:ve.arrayOf(ve.object).isRequired,links:ve.arrayOf(ve.object).isRequired}),backgroundColor:ve.string,nodeRelSize:ve.number,nodeId:ve.string,nodeLabel:ve.oneOfType([ve.string,ve.func]),nodeVal:ve.oneOfType([ve.number,ve.string,ve.func]),nodeVisibility:ve.oneOfType([ve.bool,ve.string,ve.func]),nodeColor:ve.oneOfType([ve.string,ve.func]),nodeAutoColorBy:ve.oneOfType([ve.string,ve.func]),onNodeHover:ve.func,onNodeClick:ve.func,linkSource:ve.string,linkTarget:ve.string,linkLabel:ve.oneOfType([ve.string,ve.func]),linkVisibility:ve.oneOfType([ve.bool,ve.string,ve.func]),linkColor:ve.oneOfType([ve.string,ve.func]),linkAutoColorBy:ve.oneOfType([ve.string,ve.func]),linkWidth:ve.oneOfType([ve.number,ve.string,ve.func]),linkCurvature:ve.oneOfType([ve.number,ve.string,ve.func]),linkDirectionalArrowLength:ve.oneOfType([ve.number,ve.string,ve.func]),linkDirectionalArrowColor:ve.oneOfType([ve.string,ve.func]),linkDirectionalArrowRelPos:ve.oneOfType([ve.number,ve.string,ve.func]),linkDirectionalParticles:ve.oneOfType([ve.number,ve.string,ve.func]),linkDirectionalParticleSpeed:ve.oneOfType([ve.number,ve.string,ve.func]),linkDirectionalParticleOffset:ve.oneOfType([ve.number,ve.string,ve.func]),linkDirectionalParticleWidth:ve.oneOfType([ve.number,ve.string,ve.func]),linkDirectionalParticleColor:ve.oneOfType([ve.string,ve.func]),onLinkHover:ve.func,onLinkClick:ve.func,dagMode:ve.oneOf(["td","bu","lr","rl","zin","zout","radialin","radialout"]),dagLevelDistance:ve.number,dagNodeFilter:ve.func,onDagError:ve.func,d3AlphaMin:ve.number,d3AlphaDecay:ve.number,d3VelocityDecay:ve.number,warmupTicks:ve.number,cooldownTicks:ve.number,cooldownTime:ve.number,onEngineTick:ve.func,onEngineStop:ve.func,getGraphBbox:ve.func},GV={zoomToFit:ve.func,onNodeRightClick:ve.func,onNodeDrag:ve.func,onNodeDragEnd:ve.func,onLinkRightClick:ve.func,linkHoverPrecision:ve.number,onBackgroundClick:ve.func,onBackgroundRightClick:ve.func,showPointerCursor:ve.oneOfType([ve.bool,ve.func]),enablePointerInteraction:ve.bool,enableNodeDrag:ve.bool},lM={showNavInfo:ve.bool,nodeOpacity:ve.number,nodeResolution:ve.number,nodeThreeObject:ve.oneOfType([ve.object,ve.string,ve.func]),nodeThreeObjectExtend:ve.oneOfType([ve.bool,ve.string,ve.func]),nodePositionUpdate:ve.func,linkOpacity:ve.number,linkResolution:ve.number,linkCurveRotation:ve.oneOfType([ve.number,ve.string,ve.func]),linkMaterial:ve.oneOfType([ve.object,ve.string,ve.func]),linkThreeObject:ve.oneOfType([ve.object,ve.string,ve.func]),linkThreeObjectExtend:ve.oneOfType([ve.bool,ve.string,ve.func]),linkPositionUpdate:ve.func,linkDirectionalArrowResolution:ve.number,linkDirectionalParticleResolution:ve.number,linkDirectionalParticleThreeObject:ve.oneOfType([ve.object,ve.string,ve.func]),forceEngine:ve.oneOf(["d3","ngraph"]),ngraphPhysics:ve.object,numDimensions:ve.oneOf([1,2,3])},aDe=Object.assign({},jk,GV,{linkLineDash:ve.oneOfType([ve.arrayOf(ve.number),ve.string,ve.func]),nodeCanvasObjectMode:ve.oneOfType([ve.string,ve.func]),nodeCanvasObject:ve.func,nodePointerAreaPaint:ve.func,linkCanvasObjectMode:ve.oneOfType([ve.string,ve.func]),linkCanvasObject:ve.func,linkPointerAreaPaint:ve.func,linkDirectionalParticleCanvasObject:ve.func,autoPauseRedraw:ve.bool,minZoom:ve.number,maxZoom:ve.number,enableZoomInteraction:ve.oneOfType([ve.bool,ve.func]),enablePanInteraction:ve.oneOfType([ve.bool,ve.func]),onZoom:ve.func,onZoomEnd:ve.func,onRenderFramePre:ve.func,onRenderFramePost:ve.func});Object.assign({},jk,GV,lM,{enableNavigationControls:ve.bool,controlType:ve.oneOf(["trackball","orbit","fly"]),rendererConfig:ve.object,extraRenderers:ve.arrayOf(ve.shape({render:ve.func.isRequired}))});Object.assign({},jk,lM,{nodeDesc:ve.oneOfType([ve.string,ve.func]),linkDesc:ve.oneOfType([ve.string,ve.func])});Object.assign({},jk,lM,{markerAttrs:ve.object,yOffset:ve.number,glScale:ve.number});const Nk=d5e(tDe,{methodNames:["emitParticle","d3Force","d3ReheatSimulation","stopAnimation","pauseAnimation","resumeAnimation","centerAt","zoom","zoomToFit","getGraphBbox","screen2GraphCoords","graph2ScreenCoords"]});Nk.displayName="ForceGraph2D";Nk.propTypes=aDe;const oDe={agent:{icon:Ul,color:"#22d3ee",bg:"rgba(34, 211, 238, 0.1)",border:"rgba(34, 211, 238, 0.25)"},skill:{icon:hu,color:"#a78bfa",bg:"rgba(167, 139, 250, 0.1)",border:"rgba(167, 139, 250, 0.25)"},conversation:{icon:Ag,color:"#60a5fa",bg:"rgba(96, 165, 250, 0.1)",border:"rgba(96, 165, 250, 0.25)"},decision:{icon:Td,color:"#fbbf24",bg:"rgba(251, 191, 36, 0.1)",border:"rgba(251, 191, 36, 0.25)"},fact:{icon:AC,color:"#34d399",bg:"rgba(52, 211, 153, 0.1)",border:"rgba(52, 211, 153, 0.25)"},bundle:{icon:Ql,color:"#2dd4bf",bg:"rgba(45, 212, 191, 0.1)",border:"rgba(45, 212, 191, 0.25)"},config:{icon:S0,color:"#a1a1aa",bg:"rgba(161, 161, 170, 0.1)",border:"rgba(161, 161, 170, 0.25)"},workflow:{icon:N0,color:"#fb923c",bg:"rgba(251, 146, 60, 0.1)",border:"rgba(251, 146, 60, 0.25)"},character:{icon:Ul,color:"#38bdf8",bg:"rgba(56, 189, 248, 0.1)",border:"rgba(56, 189, 248, 0.25)"},"character-state":{icon:Ul,color:"#2dd4bf",bg:"rgba(45, 212, 191, 0.1)",border:"rgba(45, 212, 191, 0.25)"},storyline:{icon:Td,color:"#f59e0b",bg:"rgba(245, 158, 11, 0.1)",border:"rgba(245, 158, 11, 0.25)"},"foreshadow-thread":{icon:hu,color:"#c084fc",bg:"rgba(192, 132, 252, 0.1)",border:"rgba(192, 132, 252, 0.25)"},"canon-rule":{icon:yx,color:"#f87171",bg:"rgba(248, 113, 113, 0.1)",border:"rgba(248, 113, 113, 0.25)"},"timeline-event":{icon:xz,color:"#60a5fa",bg:"rgba(96, 165, 250, 0.1)",border:"rgba(96, 165, 250, 0.25)"},"webnovel-episode":{icon:AC,color:"#34d399",bg:"rgba(52, 211, 153, 0.1)",border:"rgba(52, 211, 153, 0.25)"},"canon-patch":{icon:wz,color:"#fb7185",bg:"rgba(251, 113, 133, 0.1)",border:"rgba(251, 113, 133, 0.25)"},"context-pack":{icon:Ql,color:"#818cf8",bg:"rgba(129, 140, 248, 0.1)",border:"rgba(129, 140, 248, 0.25)"}},lDe={icon:wv,color:"#a1a1aa",bg:"rgba(161, 161, 170, 0.1)",border:"rgba(161, 161, 170, 0.25)"},cDe=["main-canon","current-character-states","active-storylines","active-foreshadow"],XV=["DEPENDS_ON","DERIVED_FROM","REFERENCES","ADVANCES","FORESHADOWS","PAYOFF_TARGET","UPDATES","CONTRADICTS","BLOCKS","RELATED_TO","RESOLVES"],V2=[1,2,3],uDe=[80,120,160,200],dDe={DEPENDS_ON:{color:"#f59e0b",glow:"rgba(245,158,11,0.18)",label:"depends"},DERIVED_FROM:{color:"#22d3ee",glow:"rgba(34,211,238,0.18)",label:"derived"},REFERENCES:{color:"#60a5fa",glow:"rgba(96,165,250,0.18)",label:"refs"},ADVANCES:{color:"#34d399",glow:"rgba(52,211,153,0.18)",label:"advances"},FORESHADOWS:{color:"#a78bfa",glow:"rgba(167,139,250,0.18)",label:"foreshadows"},PAYOFF_TARGET:{color:"#f472b6",glow:"rgba(244,114,182,0.18)",label:"payoff"},UPDATES:{color:"#2dd4bf",glow:"rgba(45,212,191,0.18)",label:"updates"},CONTRADICTS:{color:"#f87171",glow:"rgba(248,113,113,0.22)",label:"contradicts"},BLOCKS:{color:"#fb7185",glow:"rgba(251,113,133,0.22)",label:"blocks"},RELATED_TO:{color:"#a1a1aa",glow:"rgba(161,161,170,0.14)",label:"related"},RESOLVES:{color:"#84cc16",glow:"rgba(132,204,22,0.18)",label:"resolves"}},hDe={color:"#94a3b8",glow:"rgba(148,163,184,0.14)",label:"edge"},cx={character:["---","character_id:","display_name:","role:","first_seen_episode:","core_traits:","constraints:","---","","## Canon Summary",""].join(`
`),"character-state":["---","character_id:","timeline_position:","current_location:","current_goal:","known_information:","emotional_state:","relationship_state:","open_threads:","last_updated_by_episode:","---","","## Current State",""].join(`
`),storyline:["---","storyline_id:","status: active","current_pressure:","next_pressure:","payoff_target:","---","","## Storyline",""].join(`
`),"foreshadow-thread":["---","thread_id:","status: active","allowed_use:","forbidden_use:","payoff_target:","---","","## Foreshadow Thread",""].join(`
`),"canon-rule":["---","rule_id:","severity: hard","scope:","---","","## Rule",""].join(`
`),"timeline-event":["---","event_id:","timeline_position:","episode:","participants:","---","","## Event",""].join(`
`),"webnovel-episode":["---","episode_number:","volume:","status: draft","source_context_pack:","---","","## Episode",""].join(`
`),"canon-patch":["---","patch_id:","patch_status: candidate","source_episode:","source_context_pack:","---","","## Proposed Revision Updates","","## Proposed Edges",""].join(`
`)};function Gc(e){return oDe[e.toLowerCase()]??lDe}function Ju(e){var n;return!!(e.published||(n=e.tags)!=null&&n.includes("published"))}function fDe(e){if(!e)return"--";try{return new Date(e).toLocaleDateString(void 0,{month:"short",day:"numeric",year:"numeric"})}catch{return e}}function Y2(e){if(!e)return"--";try{return new Date(e).toLocaleDateString(void 0,{month:"short",day:"numeric"})}catch{return e}}function pDe(e){return!!(e&&/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(e))}function D8(e){var r,i,s;return[e.author_display,e.username,(r=e.metadata)==null?void 0:r.username,(i=e.metadata)==null?void 0:i.updated_by,(s=e.metadata)==null?void 0:s.created_by,e.author].find(a=>a&&!pDe(a))??"--"}function ux(e){const n=e!=null&&e.startsWith("asset://")?e.slice(8):e;if(!(n!=null&&n.startsWith("kref://")))return null;const r=n.indexOf("?"),i=r>=0?n.slice(0,r):n,s=r>=0?n.slice(r+1):"",a=new URLSearchParams(s),o=a.has("r")||a.has("t")?n:null,u=i.slice(7).split("/").filter(Boolean);if(u.length<2)return null;const d=u[0]??"";if(!d)return null;const p=u.slice(1,-1),f=`/${[d,...p].join("/")}`;return{project:d,spacePath:f,itemKref:i,revisionKref:o}}function Uh(e){if(!e)return[];const n=e.split("/").filter(Boolean);return n.map((r,i)=>({name:r,path:`/${n.slice(0,i+1).join("/")}`}))}function rp(e){if(!e)return"";const n=e.split("?")[0]??e,r=n.split("/").pop()??n;return r.split(".")[0]||r}function mDe(e,n){return e===n||e.endsWith(`-${n}`)}function cM(e){return cDe.some(n=>mDe(e,n))}function dx(e){return e.item_name||rp(e.kref)||e.kref}function G2(e){return`${e.source_kref}
${e.edge_type}
${e.target_kref}`}function P8(e){return`${e.source_kref}
${e.target_kref}`}function ed(e){return dDe[e]??hDe}function gDe(e,n){return e.length<=n?e:`${e.slice(0,Math.max(0,n-1))}...`}function L8(e,n,r,i,s,a){const o=Math.min(a,i/2,s/2);e.beginPath(),e.moveTo(n+o,r),e.arcTo(n+i,r,n+i,r+s,o),e.arcTo(n+i,r+s,n,r+s,o),e.arcTo(n,r+s,n,r,o),e.arcTo(n,r,n+i,r,o),e.closePath()}function vDe(e,n){return n.some(r=>e.x1<r.x2&&e.x2>r.x1&&e.y1<r.y2&&e.y2>r.y1)}function gf(e){var n;return(e==null?void 0:e.item_name)||(e==null?void 0:e.name)||((n=e==null?void 0:e.kref.split("/").pop())==null?void 0:n.split(".")[0])||"item"}function I8(e){return e?`r${e.number}`:"--"}function yDe(e){const n={},r=e.trim();if(!r)return n;try{const i=JSON.parse(r);if(i&&typeof i=="object"&&!Array.isArray(i)){for(const[s,a]of Object.entries(i))n[s]=typeof a=="string"?a:JSON.stringify(a);return n}}catch{}for(const i of r.split(/\r?\n/)){const s=i.trim();if(!s||s.startsWith("#"))continue;const[a,...o]=s.includes("=")?s.split("="):s.split(":");a!=null&&a.trim()&&(n[a.trim()]=o.join(s.includes("=")?"=":":").trim())}return n}function QV({kref:e}){const{t:n}=an(),[r,i]=b.useState(!1);return c.jsx("button",{type:"button",onClick:async()=>{await ro(e)&&(i(!0),setTimeout(()=>i(!1),1500))},className:"truncate text-left text-xs font-mono",style:{color:r?"var(--revka-status-success)":"var(--revka-text-faint)"},title:n("assets.copy_kref"),children:e})}function Ga({label:e,tone:n}){return c.jsxs("span",{className:"inline-flex items-center gap-1 rounded-full px-2 py-0.5 text-[10px] font-semibold uppercase",style:{color:n,border:`1px solid color-mix(in srgb, ${n} 20%, transparent)`},children:[c.jsx(tb,{className:"h-2.5 w-2.5"}),e]})}const B8=["source_heading","title","summary","role_summary","status","timeline_position","current_location","current_goal","known_information","open_threads","embedding_text","_search_text","updated_by","created_by","tenant_id"];function _De(e){return Object.entries(e??{}).sort(([r],[i])=>{const s=B8.indexOf(r),a=B8.indexOf(i);return s!==-1||a!==-1?(s===-1?Number.MAX_SAFE_INTEGER:s)-(a===-1?Number.MAX_SAFE_INTEGER:a):r.localeCompare(i)})}function xDe(e){return e.replace(/^_+/,"").replace(/_/g," ")}function bDe(e){return e.length>220?`${e.slice(0,217)}...`:e}function hx({label:e,value:n,tone:r}){return c.jsxs("div",{className:"rounded-[8px] border px-3 py-2",style:{borderColor:"var(--revka-border-soft)",background:"rgba(255,255,255,0.025)"},children:[c.jsx("div",{className:"text-[10px] font-semibold uppercase tracking-[0.08em]",style:{color:"var(--revka-text-faint)"},children:e}),c.jsx("div",{className:"mt-1 truncate text-sm font-semibold",style:{color:r??"var(--revka-text-primary)"},children:n})]})}function z8({metadata:e,maxVisible:n=8}){const r=_De(e),i=r.slice(0,n),s=Math.max(0,r.length-i.length);return c.jsxs("section",{className:"space-y-2",children:[c.jsxs("div",{className:"flex items-center justify-between gap-2",children:[c.jsx("div",{className:"text-xs font-semibold uppercase tracking-[0.12em]",style:{color:"var(--revka-text-faint)"},children:"Metadata"}),c.jsxs("span",{className:"rounded-full border px-2 py-0.5 text-[10px] font-semibold",style:{borderColor:"var(--revka-border-soft)",color:"var(--revka-text-muted)"},children:[r.length," keys"]})]}),i.length>0?c.jsxs("div",{className:"space-y-2",children:[i.map(([a,o])=>c.jsxs("div",{className:"rounded-[8px] border p-2.5",style:{borderColor:"var(--revka-border-soft)",background:"rgba(255,255,255,0.025)"},children:[c.jsx("div",{className:"mb-1 truncate text-[10px] font-semibold uppercase tracking-[0.08em]",style:{color:"var(--revka-signal-selected)"},children:xDe(a)}),c.jsx("div",{className:"break-words text-xs leading-5",style:{color:"var(--revka-text-secondary)"},children:bDe(o)})]},a)),s>0?c.jsxs("div",{className:"text-[11px]",style:{color:"var(--revka-text-faint)"},children:["+",s," more metadata keys in raw view"]}):null]}):c.jsx("div",{className:"rounded-[8px] border px-3 py-4 text-xs",style:{borderColor:"var(--revka-border-soft)",color:"var(--revka-text-faint)"},children:"No metadata on this node."}),r.length>0?c.jsxs("details",{className:"rounded-[8px] border",style:{borderColor:"var(--revka-border-soft)"},children:[c.jsx("summary",{className:"cursor-pointer px-3 py-2 text-xs font-semibold",style:{color:"var(--revka-text-muted)"},children:"Raw JSON"}),c.jsx("pre",{className:"max-h-56 overflow-auto border-t p-3 text-[11px] leading-5",style:{borderColor:"var(--revka-border-soft)",background:"var(--revka-bg-elevated)",color:"var(--revka-text-secondary)"},children:JSON.stringify(e??{},null,2)})]}):null]})}function kDe({artifacts:e}){return e.length===0?c.jsx("div",{className:"text-xs",style:{color:"var(--revka-text-faint)"},children:"No artifacts attached."}):c.jsxs("div",{className:"flex flex-wrap gap-1.5",children:[e.slice(0,4).map(n=>c.jsx("span",{className:"max-w-full truncate rounded-full border px-2 py-1 text-[10px] font-semibold",style:{borderColor:"var(--revka-border-soft)",color:"var(--revka-text-secondary)"},title:n.location||n.kref,children:n.name||rp(n.kref)},n.kref)),e.length>4?c.jsxs("span",{className:"rounded-full border px-2 py-1 text-[10px] font-semibold",style:{borderColor:"var(--revka-border-soft)",color:"var(--revka-text-faint)"},children:["+",e.length-4]}):null]})}function X2({label:e,kref:n}){return c.jsxs("div",{className:"rounded-[8px] border p-2.5",style:{borderColor:"var(--revka-border-soft)",background:"rgba(255,255,255,0.025)"},children:[c.jsx("div",{className:"mb-1 text-[10px] font-semibold uppercase tracking-[0.08em]",style:{color:"var(--revka-text-faint)"},children:e}),c.jsx(QV,{kref:n})]})}function fx({title:e,count:n,defaultOpen:r=!1,children:i}){const[s,a]=b.useState(r);return c.jsxs("div",{className:"border-t",style:{borderColor:"var(--revka-border-soft)"},children:[c.jsxs("button",{type:"button",onClick:()=>a(o=>!o),className:"flex w-full items-center justify-between gap-2 py-3 text-left",children:[c.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-[0.14em]",style:{color:"var(--revka-text-secondary)"},children:e}),c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsxs("span",{className:"text-[11px]",style:{color:"var(--revka-text-faint)"},children:["(",n,")"]}),c.jsx(du,{className:"h-3.5 w-3.5 transition-transform",style:{color:"var(--revka-text-faint)",transform:s?"rotate(90deg)":void 0}})]})]}),s?c.jsx("div",{className:"pb-3",children:i}):null]})}function wDe({bundles:e,members:n,childSpaces:r,currentSpacePath:i,selectedBundleKref:s,selectedBundleProtected:a,loadingBundles:o,loadingMembers:l,onNavigateSpace:u,onSelectBundle:d,onOpenMember:p,onCopyKref:f}){return c.jsxs("div",{className:"grid min-h-full grid-cols-[minmax(14rem,0.38fr)_minmax(0,1fr)]",children:[c.jsxs("div",{className:"border-r",style:{borderColor:"var(--revka-border-soft)"},children:[c.jsx("div",{className:"border-b px-4 py-2.5 text-[11px] font-semibold uppercase tracking-[0.12em]",style:{borderColor:"var(--revka-border-soft)",color:"var(--revka-text-faint)"},children:"Spaces"}),r.length===0?c.jsx("div",{className:"border-b px-4 py-3 text-xs",style:{borderColor:"var(--revka-border-soft)",color:"var(--revka-text-faint)"},children:"No child spaces"}):r.map(g=>c.jsxs("button",{type:"button",onClick:()=>u(g),className:"flex w-full items-center gap-2 border-b px-4 py-3 text-left transition hover:brightness-125",style:{borderColor:"var(--revka-border-soft)"},children:[c.jsx(vz,{className:"h-4 w-4 shrink-0",style:{color:"#38bdf8"}}),c.jsx("span",{className:"min-w-0 flex-1 truncate text-sm font-medium",style:{color:"var(--revka-text-primary)"},children:g.name}),c.jsx(du,{className:"h-3.5 w-3.5 shrink-0",style:{color:"var(--revka-text-faint)"}})]},g.path)),c.jsxs("div",{className:"border-b px-4 py-2.5 text-[11px] font-semibold uppercase tracking-[0.12em]",style:{borderColor:"var(--revka-border-soft)",color:"var(--revka-text-faint)"},children:["Bundles in ",i??"selected space"]}),o?c.jsx("div",{className:"p-4",children:c.jsx(ft,{tone:"loading",compact:!0,title:"Loading bundles..."})}):e.length===0?c.jsx("div",{className:"p-4",children:c.jsx(ft,{compact:!0,title:"No bundles",description:"No Kumiho bundle items were found in this space."})}):e.map(g=>{const _=g.kref===s,x=cM(rp(g.kref));return c.jsxs("button",{type:"button",className:"flex w-full items-center gap-2 border-b px-4 py-3 text-left transition",onClick:()=>d(g),style:{borderColor:"var(--revka-border-soft)",background:_?"color-mix(in srgb, var(--revka-signal-selected) 14%, transparent)":"transparent"},children:[c.jsx(Ql,{className:"h-4 w-4 shrink-0",style:{color:"#2dd4bf"}}),c.jsx("span",{className:"min-w-0 flex-1 truncate text-sm font-medium",style:{color:"var(--revka-text-primary)"},children:gf(g)}),x?c.jsx(As,{className:"h-3.5 w-3.5",style:{color:"var(--revka-status-warning)"}}):null]},g.kref)})]}),c.jsx("div",{className:"min-w-0",children:s?c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"border-b px-4 py-3",style:{borderColor:"var(--revka-border-soft)"},children:c.jsxs("div",{className:"flex items-center justify-between gap-2",children:[c.jsxs("div",{className:"min-w-0",children:[c.jsx("div",{className:"text-xs font-semibold uppercase tracking-[0.12em]",style:{color:"var(--revka-text-faint)"},children:"Bundle Members"}),c.jsx("button",{type:"button",className:"mt-1 truncate text-left text-xs font-mono",style:{color:"var(--revka-text-faint)"},onClick:()=>f(s),children:s})]}),a?c.jsxs("span",{className:"inline-flex items-center gap-1 rounded-full px-2 py-1 text-[10px] font-semibold uppercase",style:{color:"var(--revka-status-warning)",border:"1px solid color-mix(in srgb, var(--revka-status-warning) 24%, transparent)"},children:[c.jsx(As,{className:"h-3 w-3"}),"Protected"]}):null]})}),l?c.jsx("div",{className:"p-4",children:c.jsx(ft,{tone:"loading",compact:!0,title:"Loading members..."})}):n.length===0?c.jsx("div",{className:"p-4",children:c.jsx(ft,{compact:!0,title:"No members",description:"This bundle has no item members."})}):c.jsx("div",{children:n.map(g=>{var w;const _=g.item,x=g.latest_revision,v=g.current_revision,S=(w=v==null?void 0:v.tags)!=null&&w.length?v.tags:(x==null?void 0:x.tags)??[];return c.jsxs("button",{type:"button",className:"w-full border-b px-4 py-3 text-left transition hover:brightness-125",onClick:()=>p(g),style:{borderColor:"var(--revka-border-soft)"},children:[c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("span",{className:"truncate text-sm font-semibold",style:{color:"var(--revka-text-primary)"},children:_?gf(_):g.membership.item_kref}),_?c.jsx("span",{className:"rounded-full px-2 py-0.5 text-[10px] font-semibold",style:{color:"#2dd4bf",background:"rgba(45,212,191,0.1)"},children:_.kind}):null,v?c.jsx(Ga,{label:"current",tone:"var(--revka-status-success)"}):null]}),c.jsx("div",{className:"mt-1 truncate text-xs font-mono",style:{color:"var(--revka-text-faint)"},children:g.membership.item_kref}),c.jsxs("div",{className:"mt-2 flex flex-wrap items-center gap-1.5",children:[c.jsxs("span",{className:"text-[10px]",style:{color:"var(--revka-text-faint)"},children:["latest ",x?I8(x):"--"," / current ",v?I8(v):"--"]}),S.slice(0,8).map(j=>c.jsx(Ga,{label:j,tone:"var(--revka-text-faint)"},j))]})]},g.membership.item_kref)})})]}):c.jsx("div",{className:"p-4",children:c.jsx(ft,{compact:!0,title:"Select a bundle",description:"Bundle membership is item-level; locked revision manifests preserve exact reproducibility."})})})]})}function SDe({action:e,project:n,spacePath:r,selectedItem:i,selectedRevision:s,selectedBundle:a,bundleMembers:o,onClose:l,onCreated:u}){const[d,p]=b.useState(!1),[f,g]=b.useState(null),[_,x]=b.useState(""),[v,S]=b.useState((i==null?void 0:i.kind)??"character-state"),[w,j]=b.useState(""),[C,T]=b.useState(e==="context-pack"?"CONTEXT_PACK.md":"content.md"),[E,A]=b.useState(""),[O,F]=b.useState(cx[v]??""),[L,$]=b.useState(["item","artifact","context-pack"].includes(e)),[z,B]=b.useState(!1),[H,D]=b.useState((s==null?void 0:s.kref)??""),[U,I]=b.useState((i==null?void 0:i.kref)??""),[X,K]=b.useState("active"),[Q,V]=b.useState(""),[R,q]=b.useState("REFERENCES"),[W,te]=b.useState(""),[J,G]=b.useState(!1);b.useEffect(()=>{(!O.trim()||Object.values(cx).includes(O))&&F(cx[v]??"")},[v]);const re={project:"Create Project",space:"Create Space",subspace:"Create Subspace",item:"Create Item",bundle:"Create Bundle",revision:"Create Revision",artifact:"Attach or Link Artifact",edge:"Create Edge",tag:"Manage Revision Tags","bundle-member-add":"Add Item to Bundle","bundle-member-remove":"Remove Bundle Member","context-pack":"Create Context Pack from Bundle"}[e],ne=r??(n?`/${n}`:""),le=a?cM(rp(a.kref)):!1,oe=async()=>{p(!0),g(null);try{const ie=yDe(w);if(e==="project"){await xJ({name:_,description:ie.description}),u();return}if(e==="space"||e==="subspace"){await bJ({parent_path:e==="space"&&n?`/${n}`:ne,name:_}),u();return}if(e==="item"){const he=await gO({space_path:ne,item_name:_,kind:v,metadata:ie});let Z;const de=L||!!E.trim();(O.trim()||de)&&(Z=await Iw({item_kref:he.kref,metadata:{created_by:"revka-asset-browser"}}),de&&await Bw({revision_kref:Z.kref,name:C,location:E,content:O,write_file:L,overwrite:z,metadata:{mime:C.endsWith(".md")?"text/markdown":"text/plain"}})),u({item:he,revision:Z});return}if(e==="bundle"){const he=await kJ({space_path:ne,bundle_name:_,metadata:ie});u({bundle:he});return}if(e==="revision"){const he=await Iw({item_kref:U||(i==null?void 0:i.kref)||"",metadata:ie});u({revision:he});return}if(e==="artifact"){await Bw({revision_kref:H||(s==null?void 0:s.kref)||"",name:C,location:E,content:O,write_file:L,overwrite:z,validate_exists:!L,metadata:ie}),u();return}if(e==="edge"){await NJ({source_kref:(s==null?void 0:s.kref)||H,target_kref:W,edge_type:R,metadata:ie}),u();return}if(e==="tag"){let he;X.trim()&&(he=await EJ((s==null?void 0:s.kref)||H,X.trim())),Q.trim()&&(he=await AJ((s==null?void 0:s.kref)||H,Q.trim())),u({revision:he});return}if(e==="bundle-member-add"){await CJ({bundle_kref:(a==null?void 0:a.kref)||"",item_kref:U||(i==null?void 0:i.kref)||"",metadata:ie,allow_protected:J}),u();return}if(e==="bundle-member-remove"){await jJ({bundle_kref:(a==null?void 0:a.kref)||"",item_kref:U||(i==null?void 0:i.kref)||"",allow_protected:J}),u();return}if(e==="context-pack"){const he=_||`${rp(a==null?void 0:a.kref)}-context-pack`,Z=await gO({space_path:ne,item_name:he,kind:"context-pack",metadata:{source_bundle:(a==null?void 0:a.kref)??"",created_by:"revka-asset-browser"}}),de=await Iw({item_kref:Z.kref,metadata:{source_bundle:(a==null?void 0:a.kref)??""}}),ue=[`# Kumiho Context Pack: ${he}`,"","## Source Bundle",(a==null?void 0:a.kref)??"","","## Locked Manifest Candidates",...o.map(pe=>{var Oe,fe;return`- ${((Oe=pe.current_revision)==null?void 0:Oe.kref)??((fe=pe.latest_revision)==null?void 0:fe.kref)??pe.membership.item_kref}`}),"","## Notes","Bundle membership is item-level. Review and lock exact revisions before using this context pack for reproducible generation."].join(`
`);await Bw({revision_kref:de.kref,name:C||"CONTEXT_PACK.md",location:E,content:ue,write_file:L,overwrite:z,metadata:{source_bundle:(a==null?void 0:a.kref)??"",mime:"text/markdown"}}),u({item:Z,revision:de})}}catch(ie){g(ie instanceof Error?ie.message:"Asset creation failed.")}finally{p(!1)}};return c.jsxs(Nu,{title:re,description:"Kumiho-native authoring actions are prefilled from the current Asset Browser context.",onClose:d?()=>{}:l,size:"2xl",children:[c.jsxs("div",{className:"grid gap-3 md:grid-cols-2",children:[e==="project"?c.jsxs("label",{className:"text-xs font-semibold uppercase tracking-[0.1em]",style:{color:"var(--revka-text-faint)"},children:["Project name",c.jsx("input",{className:"revka-input mt-1",value:_,onChange:ie=>x(ie.target.value),autoFocus:!0})]}):null,["space","subspace","item","bundle","context-pack"].includes(e)?c.jsxs("label",{className:"text-xs font-semibold uppercase tracking-[0.1em]",style:{color:"var(--revka-text-faint)"},children:["Name",c.jsx("input",{className:"revka-input mt-1",value:_,onChange:ie=>x(ie.target.value),autoFocus:!0})]}):null,e==="item"?c.jsxs("label",{className:"text-xs font-semibold uppercase tracking-[0.1em]",style:{color:"var(--revka-text-faint)"},children:["Kind",c.jsx("input",{className:"revka-input mt-1",value:v,list:"asset-kind-templates",onChange:ie=>S(ie.target.value)}),c.jsx("datalist",{id:"asset-kind-templates",children:Object.keys(cx).map(ie=>c.jsx("option",{value:ie},ie))})]}):null,["revision","bundle-member-add","bundle-member-remove"].includes(e)?c.jsxs("label",{className:"text-xs font-semibold uppercase tracking-[0.1em]",style:{color:"var(--revka-text-faint)"},children:["Item kref",c.jsx("input",{className:"revka-input mt-1 font-mono text-xs",value:U,onChange:ie=>I(ie.target.value)})]}):null,["artifact","tag"].includes(e)?c.jsxs("label",{className:"text-xs font-semibold uppercase tracking-[0.1em]",style:{color:"var(--revka-text-faint)"},children:["Revision kref",c.jsx("input",{className:"revka-input mt-1 font-mono text-xs",value:H,onChange:ie=>D(ie.target.value)})]}):null,e==="edge"?c.jsxs(c.Fragment,{children:[c.jsxs("label",{className:"text-xs font-semibold uppercase tracking-[0.1em]",style:{color:"var(--revka-text-faint)"},children:["Edge type",c.jsx("input",{className:"revka-input mt-1",value:R,list:"asset-edge-types",onChange:ie=>q(ie.target.value)}),c.jsx("datalist",{id:"asset-edge-types",children:XV.map(ie=>c.jsx("option",{value:ie},ie))})]}),c.jsxs("label",{className:"text-xs font-semibold uppercase tracking-[0.1em]",style:{color:"var(--revka-text-faint)"},children:["Target revision kref",c.jsx("input",{className:"revka-input mt-1 font-mono text-xs",value:W,onChange:ie=>te(ie.target.value)})]})]}):null,e==="tag"?c.jsxs(c.Fragment,{children:[c.jsxs("label",{className:"text-xs font-semibold uppercase tracking-[0.1em]",style:{color:"var(--revka-text-faint)"},children:["Add tag",c.jsx("input",{className:"revka-input mt-1",value:X,onChange:ie=>K(ie.target.value)})]}),c.jsxs("label",{className:"text-xs font-semibold uppercase tracking-[0.1em]",style:{color:"var(--revka-text-faint)"},children:["Remove tag",c.jsx("input",{className:"revka-input mt-1",value:Q,onChange:ie=>V(ie.target.value),placeholder:"current is blocked"})]})]}):null,["artifact","item","context-pack"].includes(e)?c.jsxs(c.Fragment,{children:[c.jsxs("label",{className:"text-xs font-semibold uppercase tracking-[0.1em]",style:{color:"var(--revka-text-faint)"},children:["Artifact name",c.jsx("input",{className:"revka-input mt-1",value:C,onChange:ie=>T(ie.target.value)})]}),c.jsxs("label",{className:"text-xs font-semibold uppercase tracking-[0.1em]",style:{color:"var(--revka-text-faint)"},children:["Location / path reference",c.jsx("input",{className:"revka-input mt-1 font-mono text-xs",value:E,onChange:ie=>A(ie.target.value),placeholder:L?"Auto: Revka workspace/artifacts/kumiho/... when blank":"file:///G:/path/content.md"})]})]}):null]}),["item","artifact","context-pack"].includes(e)?c.jsxs("div",{className:"mt-3 space-y-2",children:[c.jsxs("div",{className:"flex flex-wrap gap-3 text-xs",style:{color:"var(--revka-text-secondary)"},children:[c.jsxs("label",{className:"inline-flex items-center gap-2",children:[c.jsx("input",{type:"checkbox",checked:L,onChange:ie=>$(ie.target.checked)})," Create/write file under Revka workspace when location is blank"]}),c.jsxs("label",{className:"inline-flex items-center gap-2",children:[c.jsx("input",{type:"checkbox",checked:z,onChange:ie=>B(ie.target.checked)})," Overwrite existing file"]})]}),L&&!E.trim()?c.jsxs("div",{className:"rounded-[8px] border px-3 py-2 text-xs",style:{borderColor:"var(--revka-border-soft)",color:"var(--revka-text-faint)"},children:["The gateway will store this artifact under the configured Revka workspace at ",c.jsx("span",{className:"font-mono",children:"artifacts/kumiho/<project>/<space>/<item>/r<revision>/<artifact>"}),"."]}):null,c.jsx("textarea",{className:"revka-input min-h-[14rem] w-full resize-y font-mono text-xs leading-5",value:O,onChange:ie=>F(ie.target.value),spellCheck:!1})]}):null,["item","bundle","revision","artifact","edge","project","bundle-member-add"].includes(e)?c.jsxs("label",{className:"mt-3 block text-xs font-semibold uppercase tracking-[0.1em]",style:{color:"var(--revka-text-faint)"},children:["Metadata JSON or key: value lines",c.jsx("textarea",{className:"revka-input mt-1 min-h-[6rem] w-full resize-y font-mono text-xs leading-5",value:w,onChange:ie=>j(ie.target.value),spellCheck:!1})]}):null,le&&["bundle-member-add","bundle-member-remove"].includes(e)?c.jsxs("label",{className:"mt-3 flex items-center gap-2 rounded-[8px] border px-3 py-2 text-xs",style:{borderColor:"color-mix(in srgb, var(--revka-status-warning) 24%, transparent)",color:"var(--revka-status-warning)"},children:[c.jsx("input",{type:"checkbox",checked:J,onChange:ie=>G(ie.target.checked)}),"Confirm protected canon bundle mutation"]}):null,f?c.jsx("div",{className:"mt-3 text-sm",style:{color:"var(--revka-status-danger)"},children:f}):null,c.jsxs("div",{className:"mt-4 flex justify-end gap-2",children:[c.jsx("button",{type:"button",className:"revka-button",onClick:l,disabled:d,children:"Cancel"}),c.jsxs("button",{type:"button",className:"revka-button revka-button-primary",onClick:oe,disabled:d,children:[d?c.jsx(Rr,{className:"h-4 w-4 animate-spin"}):c.jsx(KE,{className:"h-4 w-4"}),"Apply"]})]})]})}function CDe({revision:e,onClose:n,onOpenKref:r}){const i=b.useRef(null),s=b.useRef([]),a=b.useRef(null),[o,l]=b.useState(null),[u,d]=b.useState(!1),[p,f]=b.useState(null),[g,_]=b.useState("both"),[x,v]=b.useState(2),[S,w]=b.useState(120),[j,C]=b.useState("all"),[T,E]=b.useState(null),[A,O]=b.useState(null),[F,L]=b.useState(null),[$,z]=b.useState(null),[B,H]=b.useState({width:720,height:460}),D=b.useCallback(()=>{d(!0),f(null),TJ({revision_kref:e.kref,direction:g,depth:x,edge_type:j==="all"?void 0:j,node_limit:S}).then(R=>{l(R),E(R.nodes.find(q=>q.kref===R.center_kref)??R.nodes[0]??null),O(null),L(null),z(null)}).catch(R=>f(R instanceof Error?R.message:"Failed to load dependency graph.")).finally(()=>d(!1))},[x,g,j,S,e.kref]);b.useEffect(()=>{D()},[D]),b.useEffect(()=>{const R=a.current;if(!R)return;const q=()=>H({width:Math.max(320,R.clientWidth),height:Math.max(360,R.clientHeight)});q();const W=new ResizeObserver(q);return W.observe(R),()=>W.disconnect()},[]);const U=b.useMemo(()=>{var Z,de;if(!o)return{nodes:[],links:[]};const R=new Set(o.nodes.map(ue=>ue.kref)),q=o.edges.filter(ue=>R.has(ue.source_kref)&&R.has(ue.target_kref)).map(ue=>({source:ue.source_kref,target:ue.target_kref,edge:ue})),W=new Map,te=new Map;for(const ue of o.nodes)W.set(ue.kref,[]),te.set(ue.kref,0);for(const ue of q)(Z=W.get(ue.edge.source_kref))==null||Z.push(ue.edge.target_kref),(de=W.get(ue.edge.target_kref))==null||de.push(ue.edge.source_kref),te.set(ue.edge.source_kref,(te.get(ue.edge.source_kref)??0)+1),te.set(ue.edge.target_kref,(te.get(ue.edge.target_kref)??0)+1);const J=new Map([[o.center_kref,0]]),G=[o.center_kref];for(let ue=0;ue<G.length;ue+=1){const pe=G[ue],Oe=J.get(pe)??0;if(!(Oe>=o.depth))for(const fe of W.get(pe)??[])J.has(fe)||(J.set(fe,Oe+1),G.push(fe))}const re=new Map;for(const ue of o.nodes){const pe=J.get(ue.kref)??o.depth,Oe=re.get(pe)??[];Oe.push(ue.kref),re.set(pe,Oe)}const ne=new Map;for(const ue of re.values())for(const[pe,Oe]of ue.entries())ne.set(Oe,{index:pe,total:Math.max(1,ue.length)});const le=o.nodes.map(ue=>{const pe=J.get(ue.kref)??o.depth,Oe=te.get(ue.kref)??0,fe=ne.get(ue.kref),Le=fe?fe.index/fe.total*Math.PI*2-Math.PI/2:0,Ee=pe===0?0:160+pe*150;return{...ue,id:ue.kref,graphDepth:pe,graphDegree:Oe,val:pe===0?9:Math.min(8,3.5+Oe*.22),x:pe===0?0:Math.cos(Le)*Ee,y:pe===0?0:Math.sin(Le)*Ee}}),oe=new Map;for(const ue of q){const pe=P8(ue.edge);oe.set(pe,(oe.get(pe)??0)+1)}const ie=new Map,he=q.map(ue=>{const pe=P8(ue.edge),Oe=ie.get(pe)??0;ie.set(pe,Oe+1);const fe=oe.get(pe)??1;return{...ue,curveOffset:fe>1?(Oe-(fe-1)/2)*18:0}});return{nodes:le,links:he}},[o]),I=A?G2(A):null,X=b.useMemo(()=>{if(!o)return[];const R=new Map;for(const q of o.edges)R.set(q.edge_type,(R.get(q.edge_type)??0)+1);return Array.from(R.entries()).sort((q,W)=>W[1]-q[1]).slice(0,6)},[o]),K=b.useMemo(()=>{if(!o)return[];const R=new Map;for(const q of o.nodes){const W=q.kind||"unknown";R.set(W,(R.get(W)??0)+1)}return Array.from(R.entries()).sort((q,W)=>W[1]-q[1]).slice(0,6)},[o]);b.useEffect(()=>{var W,te,J,G,re,ne,le,oe,ie,he,Z,de;const R=i.current;if(!R||U.nodes.length===0)return;(J=(te=(W=R.d3Force)==null?void 0:W.call(R,"charge"))==null?void 0:te.strength)==null||J.call(te,-360),(ne=(re=(G=R.d3Force)==null?void 0:G.call(R,"collide"))==null?void 0:re.radius)==null||ne.call(re,ue=>ue.graphDepth===0?34:24),(Z=(he=(ie=(oe=(le=R.d3Force)==null?void 0:le.call(R,"link"))==null?void 0:oe.distance)==null?void 0:ie.call(oe,ue=>{const pe=typeof ue.source=="object"?ue.source:null,Oe=typeof ue.target=="object"?ue.target:null;return 120+Math.max((pe==null?void 0:pe.graphDepth)??1,(Oe==null?void 0:Oe.graphDepth)??1)*50}))==null?void 0:he.strength)==null||Z.call(he,.35),(de=R.d3ReheatSimulation)==null||de.call(R);const q=window.setTimeout(()=>{var ue;return(ue=R.zoomToFit)==null?void 0:ue.call(R,450,96)},650);return()=>window.clearTimeout(q)},[U]);const Q=b.useCallback((R,q,W)=>{const te=R.x??0,J=R.y??0,G=R.kref===e.kref,re=R.kref===(T==null?void 0:T.kref),ne=R.kref===F,le=G?9:Math.max(5,Math.min(8,4+R.graphDegree*.12)),oe=Gc(R.kind??"");(G||re||ne)&&(q.beginPath(),q.arc(te,J,le+(G?10:7),0,2*Math.PI),q.fillStyle=G?"rgba(45,212,191,0.18)":`${oe.color}26`,q.fill(),q.beginPath(),q.arc(te,J,le+(G?4:3),0,2*Math.PI),q.strokeStyle=G?"rgba(45,212,191,0.7)":`${oe.color}80`,q.lineWidth=G?1.8:1.2,q.stroke()),q.beginPath(),q.arc(te,J,le,0,2*Math.PI),q.fillStyle=R.missing?"#f59e0b":oe.color,q.fill(),q.lineWidth=G||re?2:1,q.strokeStyle=G?"#ffffff":re?oe.color:"rgba(255,255,255,0.38)",q.stroke();const ie=G||re||ne;if(!(ie||W>1.16||W>.82&&R.graphDepth<=1&&R.graphDegree>=2))return;const Z=gDe(dx(R),G||re||ne?34:24),de=Math.max(9,Math.min(12,11/W));q.font=`${G||re?"700":"600"} ${de}px Inter, system-ui, sans-serif`;const pe=q.measureText(Z).width+14,Oe=de+8,fe=te+le+8,Le=J-Oe/2,Ee={x1:fe-4,y1:Le-3,x2:fe+pe+4,y2:Le+Oe+3};!ie&&vDe(Ee,s.current)||(s.current.push(Ee),L8(q,fe,Le,pe,Oe,7),q.fillStyle=G||re?"rgba(4, 17, 18, 0.92)":"rgba(7, 16, 18, 0.82)",q.fill(),q.strokeStyle=G||re?`${oe.color}88`:"rgba(148,163,184,0.22)",q.lineWidth=1,q.stroke(),q.fillStyle="rgba(235, 245, 245, 0.94)",q.textAlign="left",q.textBaseline="middle",q.fillText(Z,fe+7,J))},[F,e.kref,T==null?void 0:T.kref]),V=b.useCallback((R,q,W)=>{const te=R.source,J=R.target;if(te.x==null||te.y==null||J.x==null||J.y==null)return;const G=G2(R.edge),re=G===I||G===$,ne=ed(R.edge.edge_type),le=J.x-te.x,oe=J.y-te.y,ie=Math.max(1,Math.hypot(le,oe)),he=-oe/ie,Z=le/ie,de=(te.x+J.x)/2+he*R.curveOffset,ue=(te.y+J.y)/2+Z*R.curveOffset;re&&(q.beginPath(),q.moveTo(te.x,te.y),q.quadraticCurveTo(de,ue,J.x,J.y),q.strokeStyle=ne.glow,q.lineWidth=7,q.stroke()),q.beginPath(),q.moveTo(te.x,te.y),q.quadraticCurveTo(de,ue,J.x,J.y),q.strokeStyle=ne.color,q.globalAlpha=re?.92:.5,q.lineWidth=re?2.3:1.2,q.stroke(),q.globalAlpha=1;const pe=.82,Oe=(1-pe)**2*te.x+2*(1-pe)*pe*de+pe**2*J.x,fe=(1-pe)**2*te.y+2*(1-pe)*pe*ue+pe**2*J.y,Le=2*(1-pe)*(de-te.x)+2*pe*(J.x-de),Ee=2*(1-pe)*(ue-te.y)+2*pe*(J.y-ue),Bt=Math.atan2(Ee,Le),Xe=re?6:4.5;if(q.beginPath(),q.moveTo(Oe,fe),q.lineTo(Oe-Xe*Math.cos(Bt-.55),fe-Xe*Math.sin(Bt-.55)),q.lineTo(Oe-Xe*Math.cos(Bt+.55),fe-Xe*Math.sin(Bt+.55)),q.closePath(),q.fillStyle=ne.color,q.globalAlpha=re?1:.62,q.fill(),q.globalAlpha=1,!(re||W>1.55&&U.links.length<=30))return;const yt=ne.label||R.edge.edge_type.toLowerCase(),Rt=Math.max(8,Math.min(10,9/W));q.font=`700 ${Rt}px Inter, system-ui, sans-serif`;const be=q.measureText(yt).width+12,He=Rt+7,ht=de-be/2,ot=ue-He/2;L8(q,ht,ot,be,He,6),q.fillStyle="rgba(5, 14, 16, 0.88)",q.fill(),q.strokeStyle=`${ne.color}88`,q.lineWidth=1,q.stroke(),q.fillStyle="rgba(235, 245, 245, 0.9)",q.textAlign="center",q.textBaseline="middle",q.fillText(yt,de,ue+.5)},[U.links.length,$,I]);return c.jsxs(Nu,{title:"Dependency Graph",description:"A local revision-centered graph for dependency, provenance, and impact analysis.",onClose:n,size:"2xl",children:[c.jsxs("div",{className:"mb-3 flex flex-wrap items-center gap-2",children:[c.jsxs("select",{className:"revka-input h-9 py-0 text-xs",value:g,onChange:R=>_(R.target.value),children:[c.jsx("option",{value:"outgoing",children:"Dependencies"}),c.jsx("option",{value:"incoming",children:"Dependents"}),c.jsx("option",{value:"both",children:"Both"})]}),c.jsx("div",{className:"inline-flex h-9 overflow-hidden rounded-[8px] border",style:{borderColor:"var(--revka-border-soft)"},children:V2.map(R=>c.jsxs("button",{type:"button",className:"px-3 text-xs font-semibold transition",style:{color:x===R?"var(--revka-text-primary)":"var(--revka-text-muted)",background:x===R?"color-mix(in srgb, var(--revka-signal-selected) 18%, transparent)":"transparent",borderRight:R===V2[V2.length-1]?"none":"1px solid var(--revka-border-soft)"},onClick:()=>v(R),children:["Depth ",R]},R))}),c.jsx("select",{className:"revka-input h-9 py-0 text-xs",value:S,onChange:R=>w(Number(R.target.value)),children:uDe.map(R=>c.jsxs("option",{value:R,children:["Nodes ",R]},R))}),c.jsxs("select",{className:"revka-input h-9 py-0 text-xs",value:j,onChange:R=>C(R.target.value),children:[c.jsx("option",{value:"all",children:"All edge types"}),XV.map(R=>c.jsx("option",{value:R,children:R},R))]}),c.jsxs("button",{type:"button",className:"revka-button h-9 px-3 text-xs",onClick:D,disabled:u,children:[u?c.jsx(Rr,{className:"h-3.5 w-3.5 animate-spin"}):c.jsx(Cz,{className:"h-3.5 w-3.5"}),"Reload graph"]}),c.jsxs("button",{type:"button",className:"revka-button h-9 px-3 text-xs",onClick:()=>ro(e.kref),children:[c.jsx(rc,{className:"h-3.5 w-3.5"}),"Copy center kref"]})]}),c.jsxs("div",{className:"grid min-h-[32rem] gap-4 lg:grid-cols-[minmax(0,1fr)_24rem]",children:[c.jsxs("div",{ref:a,className:"relative min-h-[30rem] overflow-hidden rounded-[12px] border",style:{borderColor:"var(--revka-border-soft)",background:"color-mix(in srgb, var(--revka-bg-panel-strong) 94%, transparent)"},children:[u?c.jsx("div",{className:"absolute inset-0 z-10 flex items-center justify-center",children:c.jsx(ft,{tone:"loading",title:"Loading graph..."})}):null,p?c.jsx("div",{className:"absolute inset-0 z-10 flex items-center justify-center p-6",children:c.jsx(ft,{tone:"error",title:"Graph failed",description:p})}):null,!u&&!p&&U.nodes.length>0?c.jsx(Nk,{ref:i,graphData:U,width:B.width,height:B.height,backgroundColor:"transparent",nodeRelSize:4,nodeVal:R=>R.val,nodeLabel:R=>`${[dx(R),R.kind,`r${R.revision_number??"?"}`].filter(Boolean).join(" · ")}
${R.kref}`,nodeCanvasObject:Q,nodePointerAreaPaint:(R,q,W)=>{const te=R.x??0,J=R.y??0;W.beginPath(),W.arc(te,J,18,0,2*Math.PI),W.fillStyle=q,W.fill()},linkLabel:R=>`${R.edge.edge_type}
${R.edge.source_kref}
-> ${R.edge.target_kref}`,linkCanvasObject:V,linkCanvasObjectMode:()=>"replace",onRenderFramePre:()=>{s.current=[]},onNodeClick:R=>{E(R),O(null)},onLinkClick:R=>{O(R.edge)},onNodeHover:R=>L((R==null?void 0:R.kref)??null),onLinkHover:R=>z(R?G2(R.edge):null),cooldownTicks:160,d3AlphaDecay:.018,d3VelocityDecay:.28,warmupTicks:40}):null,!u&&!p&&o?c.jsxs("div",{className:"pointer-events-none absolute left-3 top-3 z-10 flex flex-wrap items-center gap-2 rounded-[10px] border px-3 py-2 text-[11px] font-medium",style:{borderColor:"var(--revka-border-soft)",background:"color-mix(in srgb, var(--revka-bg-panel-strong) 92%, transparent)",color:"var(--revka-text-secondary)"},children:[c.jsxs("span",{children:[c.jsx("strong",{style:{color:"var(--revka-text-primary)"},children:o.nodes.length})," nodes"]}),c.jsxs("span",{children:[c.jsx("strong",{style:{color:"var(--revka-text-primary)"},children:o.edges.length})," edges"]}),c.jsxs("span",{children:["depth ",o.depth]})]}):null,!u&&!p&&(o!=null&&o.truncated)?c.jsxs("div",{className:"pointer-events-none absolute right-3 top-3 z-10 rounded-[10px] border px-3 py-2 text-[11px] font-semibold",style:{borderColor:"color-mix(in srgb, var(--revka-status-warning) 35%, transparent)",background:"rgba(67, 52, 18, 0.72)",color:"var(--revka-status-warning)"},children:["Truncated at ",o.node_limit]}):null,!u&&!p&&(K.length>0||X.length>0)?c.jsxs("div",{className:"pointer-events-none absolute bottom-3 left-3 z-10 flex max-w-[78%] flex-col gap-2 rounded-[10px] border px-3 py-2",style:{borderColor:"var(--revka-border-soft)",background:"color-mix(in srgb, var(--revka-bg-panel-strong) 92%, transparent)"},children:[K.length>0?c.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[c.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-[0.08em]",style:{color:"var(--revka-text-faint)"},children:"Nodes"}),K.map(([R,q])=>{const W=Gc(R);return c.jsxs("span",{className:"inline-flex items-center gap-1.5 text-[10px] font-semibold uppercase",style:{color:"var(--revka-text-secondary)"},children:[c.jsx("span",{className:"h-2.5 w-2.5 rounded-full",style:{background:W.color,boxShadow:`0 0 10px ${W.color}`}}),R," ",q]},R)})]}):null,X.length>0?c.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[c.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-[0.08em]",style:{color:"var(--revka-text-faint)"},children:"Edges"}),X.map(([R,q])=>{const W=ed(R);return c.jsxs("span",{className:"inline-flex items-center gap-1.5 text-[10px] font-semibold uppercase",style:{color:"var(--revka-text-secondary)"},children:[c.jsx("span",{className:"h-0.5 w-5 rounded-full",style:{background:W.color,boxShadow:`0 0 10px ${W.color}`}}),R," ",q]},R)})]}):null]}):null]}),c.jsx("div",{className:"min-h-0 overflow-y-auto rounded-[12px] border p-4",style:{borderColor:"var(--revka-border-soft)",background:"linear-gradient(180deg, rgba(255,255,255,0.035), rgba(255,255,255,0.015))"},children:A?c.jsxs("div",{className:"space-y-4",children:[c.jsx("div",{className:"rounded-[10px] border p-3",style:{borderColor:`${ed(A.edge_type).color}55`,background:ed(A.edge_type).glow},children:c.jsxs("div",{className:"flex items-center justify-between gap-2",children:[c.jsxs("div",{children:[c.jsx("div",{className:"text-xs font-semibold uppercase tracking-[0.12em]",style:{color:"var(--revka-text-faint)"},children:"Relationship"}),c.jsx("div",{className:"mt-2 text-lg font-semibold",style:{color:"var(--revka-text-primary)"},children:ed(A.edge_type).label})]}),c.jsx(Ga,{label:A.edge_type,tone:ed(A.edge_type).color})]})}),c.jsxs("div",{className:"space-y-2",children:[c.jsx(X2,{label:"Source",kref:A.source_kref}),c.jsx("div",{className:"flex justify-center",children:c.jsx("div",{className:"rounded-full border p-1.5",style:{borderColor:"var(--revka-border-soft)",color:ed(A.edge_type).color},children:c.jsx(_f,{className:"h-4 w-4"})})}),c.jsx(X2,{label:"Target",kref:A.target_kref})]}),c.jsx(z8,{metadata:A.metadata,maxVisible:6})]}):T?c.jsxs("div",{className:"space-y-4",children:[c.jsx("div",{className:"rounded-[10px] border p-3",style:{borderColor:`${Gc(T.kind??"").color}55`,background:Gc(T.kind??"").bg},children:c.jsxs("div",{className:"flex items-start justify-between gap-3",children:[c.jsxs("div",{className:"min-w-0",children:[c.jsx("div",{className:"text-xs font-semibold uppercase tracking-[0.12em]",style:{color:"var(--revka-text-faint)"},children:"Revision Node"}),c.jsx("div",{className:"mt-2 truncate text-lg font-semibold",style:{color:"var(--revka-text-primary)"},title:dx(T),children:dx(T)}),c.jsxs("div",{className:"mt-2 flex flex-wrap gap-1.5",children:[T.kind?c.jsx(Ga,{label:T.kind,tone:Gc(T.kind).color}):null,T.revision_number?c.jsx(Ga,{label:`r${T.revision_number}`,tone:"var(--revka-text-faint)"}):null,T.tags.slice(0,3).map(R=>c.jsx(Ga,{label:R,tone:"var(--revka-text-faint)"},R)),T.tags.length>3?c.jsx(Ga,{label:`+${T.tags.length-3}`,tone:"var(--revka-text-faint)"}):null]})]}),c.jsxs("button",{type:"button",className:"revka-button h-8 px-2 text-xs",onClick:()=>r(T.kref),children:[c.jsx(_f,{className:"h-3.5 w-3.5"}),"Open"]})]})}),c.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[c.jsx(hx,{label:"Artifacts",value:T.artifacts.length,tone:Gc(T.kind??"").color}),c.jsx(hx,{label:"Revision",value:T.revision_number?`r${T.revision_number}`:"--"}),c.jsx(hx,{label:"Incoming",value:T.incoming_edges.length}),c.jsx(hx,{label:"Outgoing",value:T.outgoing_edges.length})]}),c.jsx(X2,{label:"Revision kref",kref:T.kref}),c.jsxs("section",{className:"space-y-2",children:[c.jsx("div",{className:"text-xs font-semibold uppercase tracking-[0.12em]",style:{color:"var(--revka-text-faint)"},children:"Artifacts"}),c.jsx(kDe,{artifacts:T.artifacts})]}),c.jsx(z8,{metadata:T.metadata})]}):c.jsx(ft,{compact:!0,title:"Select a node",description:"Click a node or edge to inspect its Kumiho details."})})]})]})}function jDe(){var po;const{t:e,tpl:n}=an(),[r,i]=_v(),s=ux(r.get("kref")),a=r.get("project")??(s==null?void 0:s.project)??null,o=r.get("space")??(s==null?void 0:s.spacePath)??(a?`/${a}`:null),[l,u]=b.useState([]),[d,p]=b.useState(a),[f,g]=b.useState(!1),[_,x]=b.useState(()=>Uh(o)),[v,S]=b.useState([]),[w,j]=b.useState([]),[C,T]=b.useState(null),[E,A]=b.useState(r.get("item")??(s==null?void 0:s.itemKref)??null),[O,F]=b.useState([]),[L,$]=b.useState(null),[z,B]=b.useState(r.get("revision")??(s==null?void 0:s.revisionKref)??null),[H,D]=b.useState([]),[U,I]=b.useState(null),[X,K]=b.useState(null),[Q,V]=b.useState([]),[R,q]=b.useState(r.get("q")??""),[W,te]=b.useState([]),[J,G]=b.useState(!1),[re,ne]=b.useState(r.get("tab")==="bundles"?"bundles":"items"),[le,oe]=b.useState(r.get("sort")??"name"),[ie,he]=b.useState(Number(r.get("page")??"1")||1),[Z,de]=b.useState([]),[ue,pe]=b.useState(r.get("bundle")),[Oe,fe]=b.useState([]),[Le,Ee]=b.useState(!1),[Bt,Xe]=b.useState(!1),[St,yt]=b.useState(0),[Rt,be]=b.useState(!1),[He,ht]=b.useState(!0),[ot,$t]=b.useState(!1),[jn,Pn]=b.useState(!1),[We,ut]=b.useState(!1),[Ct,Mt]=b.useState(null),[Ge,tt]=b.useState(null),[bt,Nt]=b.useState(null),[it,dt]=b.useState(null),[Vt,jt]=b.useState(""),[Ht,rr]=b.useState(!1),[Wt,Mn]=b.useState(!1),[ge,Re]=b.useState(null),[et,tn]=b.useState(!1),[Jt,Ft]=b.useState(()=>{try{return JSON.parse(sessionStorage.getItem("revka.assetBrowser.expanded")??"[]")}catch{return[]}}),ir=b.useRef(null),xi=b.useRef(null),on=b.useRef(null),qt=((po=_[_.length-1])==null?void 0:po.path)??null;b.useEffect(()=>{function ae(Ce){xi.current&&!xi.current.contains(Ce.target)&&g(!1),on.current&&!on.current.contains(Ce.target)&&Mn(!1)}return document.addEventListener("mousedown",ae),()=>document.removeEventListener("mousedown",ae)},[]),b.useEffect(()=>{ht(!0),Ro("/projects").then(ae=>{const Ce=ae.map(at=>at.name);u(ae),p(at=>at&&Ce.includes(at)?at:a&&Ce.includes(a)?a:Ce[0]??null),Mt(null)}).catch(ae=>{console.error("[Assets] Failed to load projects:",ae),Mt(e("assets.err.load"))}).finally(()=>ht(!1))},[a,St,e]),b.useEffect(()=>()=>{ir.current&&clearTimeout(ir.current)},[]),b.useEffect(()=>{const ae=ux(r.get("kref")),Ce=r.get("project")??(ae==null?void 0:ae.project)??d,at=r.get("space")??(ae==null?void 0:ae.spacePath),Ot=r.get("item")??(ae==null?void 0:ae.itemKref)??null,Yn=r.get("revision")??(ae==null?void 0:ae.revisionKref)??null;Ce&&Ce!==d&&p(Ce),at&&at!==qt&&x(Uh(at)),Ot&&Ot!==E&&A(Ot),Yn&&Yn!==z&&B(Yn);const Li=r.get("bundle");Li!==ue&&pe(Li);const Ii=r.get("tab")==="bundles"?"bundles":"items";Ii!==re&&ne(Ii)},[r]),b.useEffect(()=>{sessionStorage.setItem("revka.assetBrowser.expanded",JSON.stringify(Jt))},[Jt]),b.useEffect(()=>{var ae;d&&(_.length===0||((ae=_[0])==null?void 0:ae.name)!==d)&&x(Uh(`/${d}`))},[_,d]);const P=b.useCallback((ae,Ce)=>{tt({tone:ae,message:Ce}),setTimeout(()=>{tt(at=>(at==null?void 0:at.message)===Ce?null:at)},4500)},[]);b.useEffect(()=>{i(ae=>{const Ce=new URLSearchParams(ae);return Ce.delete("kref"),d?Ce.set("project",d):Ce.delete("project"),qt?Ce.set("space",qt):Ce.delete("space"),C!=null&&C.kref?Ce.set("item",C.kref):Ce.delete("item"),L!=null&&L.kref?Ce.set("revision",L.kref):Ce.delete("revision"),re!=="items"?Ce.set("tab",re):Ce.delete("tab"),R.trim()?Ce.set("q",R):Ce.delete("q"),ue?Ce.set("bundle",ue):Ce.delete("bundle"),le!=="name"?Ce.set("sort",le):Ce.delete("sort"),ie>1?Ce.set("page",String(ie)):Ce.delete("page"),Ce},{replace:!0})},[re,qt,ie,le,R,ue,C==null?void 0:C.kref,d,L==null?void 0:L.kref,i]);const Ie=b.useCallback(async(ae,Ce)=>{ut(!0);try{const[at,Ot]=await Promise.all([Ro("/artifacts",{revision_kref:ae.kref}).catch(()=>[]),Ro("/edges",{kref:ae.kref,direction:"both"}).catch(()=>[])]);D(at),I(at.find(Yn=>Yn.kref===Ce)??at[0]??null),V(Ot)}finally{ut(!1)}},[]);b.useEffect(()=>{qt&&($t(!0),Promise.all([Ro("/spaces",{parent_path:qt,recursive:!1}).catch(()=>[]),Ro("/items",{space_path:qt}).catch(()=>[])]).then(([ae,Ce])=>{S(ae),j(Ce);const at=E?Ce.find(Ot=>Ot.kref===E):null;at?T(at):!E&&C&&!Ce.some(Ot=>Ot.kref===C.kref)&&(T(null),F([]),$(null),D([]),I(null),V([]))}).catch(()=>{S([]),j([]),P("error","Failed to reload the current Asset Browser view.")}).finally(()=>$t(!1)))},[qt,St,E,C==null?void 0:C.kref,P]),b.useEffect(()=>{if(!C){F([]),$(null),D([]),I(null),V([]);return}Pn(!0),$(null),D([]),I(null),V([]),Ro("/revisions",{item_kref:C.kref}).then(async ae=>{let Ce=[...ae].sort((Ot,Yn)=>Yn.number-Ot.number),at=z?Ce.find(Ot=>Ot.kref===z):null;if(!at&&z)try{const Ot=await Ro("/revisions/by-kref",{kref:z});Ot.item_kref===C.kref&&(Ce=[Ot,...Ce.filter(Yn=>Yn.kref!==Ot.kref)].sort((Yn,Li)=>Li.number-Yn.number),at=Ot)}catch{}F(Ce),$(at??Ce[0]??null)}).catch(()=>F([])).finally(()=>Pn(!1))},[St,z,C==null?void 0:C.kref]),b.useEffect(()=>{if(!L){D([]),I(null),V([]);return}I(null),Ie(L).catch(()=>{D([]),I(null),V([]),ut(!1)})},[Ie,St,L==null?void 0:L.kref]),b.useEffect(()=>{if(ir.current&&clearTimeout(ir.current),!R.trim()){te([]),G(!1);return}G(!0),ir.current=setTimeout(async()=>{try{const ae=await Ro("/items/fulltext-search",{query:R,context:d??void 0,include_revision_metadata:!0});te(ae)}catch(ae){console.error("[Assets] Search failed:",ae),te([])}finally{G(!1)}},250)},[St,R,d]),b.useEffect(()=>{if(!d){de([]),pe(null),fe([]);return}Ee(!0),wJ(d,qt??`/${d}`).then(ae=>{de(ae),pe(Ce=>Ce&&ae.some(at=>at.kref===Ce)?Ce:null)}).catch(ae=>{console.error("[Assets] Failed to load bundles:",ae),de([]),pe(null)}).finally(()=>Ee(!1))},[qt,St,d]),b.useEffect(()=>{if(!ue){fe([]);return}Xe(!0),SJ(ue).then(ae=>fe(ae.members)).catch(ae=>{console.error("[Assets] Failed to load bundle members:",ae),fe([])}).finally(()=>Xe(!1))},[St,ue]);const st=b.useCallback(ae=>{Ft(Ce=>Ce.includes(qt??"")?Ce:[...Ce,qt??""].filter(Boolean)),x(Ce=>[...Ce,{name:ae.name,path:ae.path}]),A(null),B(null),T(null),$(null),q(""),te([]),G(!1),pe(null),fe([])},[qt]),Kt=b.useCallback(ae=>{x(Ce=>Ce.slice(0,ae+1)),A(null),B(null),T(null),$(null),q(""),te([]),G(!1),pe(null),fe([])},[]),jr=b.useCallback(ae=>{q(ae),he(1)},[]),Zr=b.useCallback(ae=>{if(ae===d){g(!1);return}ir.current&&clearTimeout(ir.current),g(!1),p(ae),x(Uh(`/${ae}`)),A(null),B(null),T(null),$(null),D([]),I(null),V([]),q(""),te([]),pe(null),ne("items")},[d]),ho=b.useCallback(()=>{x(ae=>ae.length<=1?ae:ae.slice(0,-1)),A(null),B(null),T(null),$(null),q(""),te([]),G(!1),pe(null),fe([])},[]),hs=b.useCallback(ae=>{const Ce=ux(ae.kref);Ce&&(p(Ce.project),x(Uh(Ce.spacePath))),T(ae),A(ae.kref),B(null),ne("items")},[]),ll=b.useCallback(ae=>{$(ae),B(ae.kref)},[]),fs=b.useCallback(async ae=>{const Ce=ux(ae);if(!Ce){P("error","Invalid kref.");return}p(Ce.project),x(Uh(Ce.spacePath)),A(Ce.itemKref),B(Ce.revisionKref),ne("items")},[P]),Pi=b.useCallback(()=>{be(!0),yt(ae=>ae+1),window.setTimeout(()=>be(!1),700)},[]),Qi=b.useCallback(ae=>{j(Ce=>Ce.map(at=>at.kref===ae.kref?ae:at)),te(Ce=>Ce.map(at=>at.item.kref===ae.kref?{...at,item:ae}:at)),T(Ce=>(Ce==null?void 0:Ce.kref)===ae.kref?ae:Ce)},[]),Fr=b.useCallback((ae,Ce=!1)=>{const at={...ae,published:Ju(ae),tags:Ju(ae)&&!ae.tags.includes("published")?[...ae.tags,"published"]:ae.tags};F(Ot=>Ot.map(Yn=>Yn.kref===at.kref?at:Ce?{...Yn,published:!1,tags:Yn.tags.filter(Li=>Li!=="published")}:Yn)),$(Ot=>(Ot==null?void 0:Ot.kref)===at.kref?at:Ot)},[]),Vn=b.useCallback(ae=>{D(Ce=>Ce.map(at=>at.kref===ae.kref?ae:at)),I(Ce=>(Ce==null?void 0:Ce.kref)===ae.kref?ae:Ce)},[]),cl=b.useCallback(async()=>{if(!C)return;const ae=!C.deprecated;Nt("item-deprecate");try{const Ce=await MJ(C.kref,ae);Qi(Ce),P("success",e(ae?"assets.toast.item_deprecated":"assets.toast.item_restored"))}catch(Ce){P("error",Ce instanceof Error?Ce.message:e("assets.err.action"))}finally{Nt(null)}},[Qi,C,P,e]),lc=b.useCallback(async()=>{if(!L)return;const ae=!L.deprecated;Nt("revision-deprecate");try{const Ce=await RJ(L.kref,ae);Fr(Ce),P("success",e(ae?"assets.toast.revision_deprecated":"assets.toast.revision_restored"))}catch(Ce){P("error",Ce instanceof Error?Ce.message:e("assets.err.action"))}finally{Nt(null)}},[Fr,L,P,e]),Ls=b.useCallback(async()=>{if(L){Nt("revision-publish");try{const ae=await OJ(L.kref);Fr(ae,!0),P("success",e("assets.toast.revision_published"))}catch(ae){P("error",ae instanceof Error?ae.message:e("assets.err.action"))}finally{Nt(null)}}},[Fr,L,P,e]),la=b.useCallback(async ae=>{const Ce=!ae.deprecated;Nt(`artifact-deprecate:${ae.kref}`);try{const at=await DJ(ae.kref,Ce);Vn(at),P("success",e(Ce?"assets.toast.artifact_deprecated":"assets.toast.artifact_restored"))}catch(at){P("error",at instanceof Error?at.message:e("assets.err.action"))}finally{Nt(null)}},[Vn,P,e]),Eu=b.useCallback(async ae=>{dt(ae),jt(""),rr(!0);try{const Ce=await LJ(ae.location);jt(Ce)}catch(Ce){P("error",Ce instanceof Error?Ce.message:e("assets.err.load_artifact")),dt(null)}finally{rr(!1)}},[P,e]),ul=b.useCallback(async()=>{if(!(!it||!L)){Nt("artifact-save");try{const ae=await PJ(it.kref,L.kref,Vt);if(ae.created_revision){const Ce={...ae.revision,latest:!0,published:Ju(ae.revision)};F(at=>[Ce,...at.filter(Ot=>Ot.kref!==Ce.kref).map(Ot=>({...Ot,latest:!1,tags:Ot.tags.filter(Yn=>Yn!=="latest")}))].sort((Ot,Yn)=>Yn.number-Ot.number)),$(Ce),await Ie(Ce,ae.artifact.kref),P("success",e("assets.toast.artifact_saved_new_revision"))}else await Ie(L,it.kref),P("success",e("assets.toast.artifact_saved"));dt(null)}catch(ae){P("error",ae instanceof Error?ae.message:e("assets.err.action"))}finally{Nt(null)}}},[Vt,it,Ie,L,P,e]),Is=R.trim().length>0,dl=b.useMemo(()=>[...Is?W.map(Ce=>Ce.item):w].sort((Ce,at)=>le==="kind"?Ce.kind.localeCompare(at.kind)||gf(Ce).localeCompare(gf(at)):le==="created"?String(at.created_at??"").localeCompare(String(Ce.created_at??"")):gf(Ce).localeCompare(gf(at))),[Is,le,w,W]),hr=75,Bs=Math.max(1,Math.ceil(dl.length/hr)),Jr=Math.min(Math.max(1,ie),Bs),li=dl.slice((Jr-1)*hr,Jr*hr),fo=Z.find(ae=>ae.kref===ue)??null,Au=fo?cM(rp(fo.kref)):!1,bi=Object.entries((U==null?void 0:U.metadata)??(L==null?void 0:L.metadata)??(C==null?void 0:C.metadata)??{});return c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"flex h-[calc(100vh-6rem)] flex-col gap-3",children:[c.jsxs("div",{className:"flex items-start justify-between gap-4",children:[c.jsx(oi,{kicker:e("assets.kicker"),title:e("assets.title")}),c.jsxs("div",{className:"relative min-w-[14rem] max-w-[22rem] flex-1",children:[c.jsx(Da,{className:"pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2",style:{color:"var(--revka-text-faint)"}}),c.jsx("input",{type:"text",value:R,onChange:ae=>jr(ae.target.value),placeholder:e("assets.search_placeholder"),className:"revka-input pl-10 pr-10"}),J?c.jsx("div",{className:"absolute right-3 top-1/2 h-4 w-4 -translate-y-1/2 animate-spin rounded-full border-2",style:{borderColor:"var(--revka-border-soft)",borderTopColor:"var(--revka-signal-network)"}}):null]})]}),c.jsxs("div",{className:"flex items-center gap-3",children:[c.jsxs("div",{className:"relative",ref:xi,children:[c.jsxs("button",{type:"button",className:"revka-button justify-between gap-2",onClick:()=>g(ae=>!ae),children:[c.jsx(b0,{className:"h-4 w-4"}),c.jsx("span",{className:"truncate",children:d??e("assets.project")}),c.jsx(Yo,{className:"h-3.5 w-3.5"})]}),f?c.jsx("div",{className:"absolute left-0 top-full z-20 mt-2 min-w-[14rem] rounded-[14px] border p-2",style:{borderColor:"var(--revka-border-soft)",background:"var(--revka-bg-panel-strong)"},children:l.map(ae=>c.jsx("button",{type:"button",className:"w-full rounded-[10px] px-3 py-2 text-left text-sm transition",onClick:()=>Zr(ae.name),style:{color:ae.name===d?"var(--revka-text-primary)":"var(--revka-text-secondary)",background:ae.name===d?"var(--revka-signal-selected-soft, color-mix(in srgb, var(--revka-signal-selected) 18%, transparent))":"transparent"},children:ae.name},ae.name))}):null]}),c.jsx("div",{className:"flex min-w-0 flex-1 items-center gap-1 text-sm",children:_.map((ae,Ce)=>c.jsxs("span",{className:"inline-flex items-center gap-1",children:[Ce>0&&c.jsx(du,{className:"h-3.5 w-3.5 shrink-0",style:{color:"var(--revka-text-faint)"}}),c.jsx("button",{type:"button",onClick:()=>Kt(Ce),className:"rounded px-1.5 py-0.5 hover:underline",style:{color:Ce===_.length-1?"var(--revka-text-primary)":"var(--revka-text-secondary)"},children:ae.name})]},ae.path))}),c.jsxs("button",{type:"button",className:"revka-button",onClick:Pi,disabled:Rt,title:"Reload current Asset Browser view",children:[Rt?c.jsx(Rr,{className:"h-4 w-4 animate-spin"}):c.jsx(Cz,{className:"h-4 w-4"}),"Reload"]}),c.jsxs("div",{className:"relative",ref:on,children:[c.jsxs("button",{type:"button",className:"revka-button revka-button-primary",onClick:()=>Mn(ae=>!ae),children:[c.jsx(ls,{className:"h-4 w-4"}),"Create",c.jsx(Yo,{className:"h-3.5 w-3.5"})]}),Wt?c.jsx("div",{className:"absolute right-0 top-full z-20 mt-2 w-72 rounded-[14px] border p-2",style:{borderColor:"var(--revka-border-soft)",background:"var(--revka-bg-panel-strong)"},children:[["project","Create Project"],["space","Create Space"],["subspace","Create Subspace"],["item","Create Item in this Space"],["bundle","Create Bundle"],["revision","Create Revision"],["artifact","Attach or Link Artifact"],["edge","Create Edge from Revision"],["tag","Tag Revision"],["bundle-member-add","Add Item to Bundle"],["bundle-member-remove","Remove Bundle Member"],["context-pack","Create Context Pack from Bundle"]].map(([ae,Ce])=>c.jsxs("button",{type:"button",className:"flex w-full items-center gap-2 rounded-[10px] px-3 py-2 text-left text-sm transition hover:brightness-125",onClick:()=>{Re(ae),Mn(!1)},style:{color:"var(--revka-text-secondary)"},children:[c.jsx(ls,{className:"h-3.5 w-3.5"}),Ce]},ae))}):null]}),c.jsxs("button",{type:"button",className:"revka-button",onClick:ho,disabled:_.length<=1,children:[c.jsx(_O,{className:"h-4 w-4"}),e("assets.up")]})]}),Ct?c.jsxs("div",{className:"flex items-center gap-2 text-sm",style:{color:"var(--revka-status-danger)"},children:[c.jsx(As,{className:"h-4 w-4 shrink-0"}),Ct]}):null,Ge?c.jsxs("div",{className:"flex items-center gap-2 rounded-[8px] border px-3 py-2 text-sm",style:{borderColor:Ge.tone==="success"?"color-mix(in srgb, var(--revka-status-success) 24%, transparent)":"color-mix(in srgb, var(--revka-status-danger) 24%, transparent)",color:Ge.tone==="success"?"var(--revka-status-success)":"var(--revka-status-danger)",background:Ge.tone==="success"?"color-mix(in srgb, var(--revka-status-success) 8%, transparent)":"color-mix(in srgb, var(--revka-status-danger) 8%, transparent)"},children:[Ge.tone==="success"?c.jsx(no,{className:"h-4 w-4 shrink-0"}):c.jsx(As,{className:"h-4 w-4 shrink-0"}),Ge.message]}):null,c.jsxs("div",{className:"grid min-h-0 flex-1 gap-4",style:{gridTemplateColumns:C?"minmax(0,1fr) 32rem":"1fr"},children:[c.jsxs(qe,{className:"flex flex-col overflow-hidden p-0",children:[c.jsxs("div",{className:"flex shrink-0 items-center justify-between gap-3 border-b px-4 py-3",style:{borderColor:"var(--revka-border-soft)"},children:[c.jsx("div",{className:"inline-flex rounded-[8px] border p-0.5",style:{borderColor:"var(--revka-border-soft)",background:"var(--revka-bg-elevated)"},children:["items","bundles"].map(ae=>c.jsx("button",{type:"button",className:"rounded-[6px] px-3 py-1.5 text-xs font-semibold uppercase tracking-[0.08em]",onClick:()=>ne(ae),style:{background:re===ae?"var(--revka-signal-selected-soft, color-mix(in srgb, var(--revka-signal-selected) 18%, transparent))":"transparent",color:re===ae?"var(--revka-text-primary)":"var(--revka-text-faint)"},children:ae==="items"?"Items":"Bundles"},ae))}),re==="items"?c.jsxs("div",{className:"flex items-center gap-2 text-xs",style:{color:"var(--revka-text-faint)"},children:[c.jsx("span",{children:"Sort"}),c.jsxs("select",{className:"revka-input h-8 py-0 text-xs",value:le,onChange:ae=>oe(ae.target.value),children:[c.jsx("option",{value:"name",children:"Name"}),c.jsx("option",{value:"kind",children:"Kind"}),c.jsx("option",{value:"created",children:"Created"})]})]}):c.jsxs("div",{className:"text-xs",style:{color:"var(--revka-text-faint)"},children:[Z.length," bundles in space"]})]}),re==="items"?c.jsxs("div",{className:"revka-assets-row shrink-0 border-b px-4 py-2.5",style:{borderColor:"var(--revka-border-soft)",color:"var(--revka-text-faint)"},children:[c.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-[0.14em]",children:e("assets.col.name")}),c.jsx("span",{className:"revka-assets-kind hidden text-[11px] font-semibold uppercase tracking-[0.14em] md:inline",children:e("assets.col.kind")}),c.jsx("span",{className:"revka-assets-author hidden text-[11px] font-semibold uppercase tracking-[0.14em] md:inline",children:e("assets.col.author")}),c.jsx("span",{className:"revka-assets-created hidden text-right text-[11px] font-semibold uppercase tracking-[0.14em] md:inline",children:e("assets.col.created")})]}):null,c.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto",children:re==="bundles"?c.jsx(wDe,{bundles:Z,members:Oe,childSpaces:v,currentSpacePath:qt,selectedBundleKref:ue,selectedBundleProtected:Au,loadingBundles:Le,loadingMembers:Bt,onNavigateSpace:st,onSelectBundle:ae=>pe(ae.kref),onOpenMember:ae=>{ae.item&&fs(ae.item.kref)},onCopyKref:ae=>ro(ae)}):He||ot?c.jsx("div",{className:"p-4",children:c.jsx(ft,{tone:"loading",compact:!0,title:e(He?"assets.loading.projects":"assets.loading.space")})}):c.jsxs(c.Fragment,{children:[!Is&&v.map(ae=>c.jsxs("button",{type:"button",onClick:()=>st(ae),className:"revka-assets-row w-full border-b px-4 py-2.5 text-left transition hover:brightness-125",style:{borderColor:"var(--revka-border-soft)",background:"color-mix(in srgb, var(--revka-bg-elevated) 50%, transparent)"},children:[c.jsxs("div",{className:"flex min-w-0 items-center gap-2.5",children:[c.jsx(vz,{className:"h-4 w-4 shrink-0",style:{color:"#fbbf24"}}),c.jsx("span",{className:"truncate text-sm font-medium",style:{color:"var(--revka-text-primary)"},children:ae.name})]}),c.jsx("span",{className:"revka-assets-kind text-xs",style:{color:"var(--revka-text-faint)"},children:e("assets.folder")}),c.jsx("span",{className:"revka-assets-author truncate text-xs",style:{color:"var(--revka-text-faint)"},children:"--"}),c.jsx("span",{className:"revka-assets-created text-right text-xs",style:{color:"var(--revka-text-faint)"},children:Y2(ae.created_at)})]},ae.path)),Is&&W.length>0?c.jsx("div",{className:"border-b px-4 py-2 text-[11px] font-semibold uppercase tracking-[0.12em]",style:{borderColor:"var(--revka-border-soft)",color:"var(--revka-text-faint)"},children:n("assets.search.result_count",{count:W.length,query:R})}):null,li.map(ae=>{const Ce=Gc(ae.kind),at=Ce.icon,Ot=(C==null?void 0:C.kref)===ae.kref;return c.jsxs("button",{type:"button",onClick:()=>hs(ae),className:"revka-assets-row w-full border-b px-4 py-2.5 text-left transition",style:{borderColor:"var(--revka-border-soft)",background:Ot?"color-mix(in srgb, var(--revka-signal-selected) 14%, var(--revka-bg-panel))":"transparent",opacity:ae.deprecated?.6:1},children:[c.jsxs("div",{className:"flex min-w-0 items-center gap-2.5",children:[c.jsx(at,{className:"h-4 w-4 shrink-0",style:{color:Ce.color}}),c.jsx("span",{className:"truncate text-sm font-medium",style:{color:"var(--revka-text-primary)"},children:ae.item_name||ae.name})]}),c.jsx("span",{className:"revka-assets-kind inline-flex items-center justify-center rounded-full px-2 py-0.5 text-[10px] font-semibold capitalize",style:{background:Ce.bg,color:Ce.color,border:`1px solid ${Ce.border}`},children:ae.kind}),c.jsx("span",{className:"revka-assets-author truncate text-xs font-mono",style:{color:"var(--revka-text-faint)"},children:D8(ae)}),c.jsx("span",{className:"revka-assets-created text-right text-xs",style:{color:"var(--revka-text-faint)"},children:Y2(ae.created_at)})]},ae.kref)}),dl.length>hr?c.jsxs("div",{className:"flex items-center justify-between border-b px-4 py-2 text-xs",style:{borderColor:"var(--revka-border-soft)",color:"var(--revka-text-faint)"},children:[c.jsxs("span",{children:["Page ",Jr," / ",Bs]}),c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsxs("button",{type:"button",className:"revka-button h-8 px-2 text-xs",disabled:Jr<=1,onClick:()=>he(ae=>Math.max(1,ae-1)),children:[c.jsx(_O,{className:"h-3.5 w-3.5"}),"Prev"]}),c.jsxs("button",{type:"button",className:"revka-button h-8 px-2 text-xs",disabled:Jr>=Bs,onClick:()=>he(ae=>Math.min(Bs,ae+1)),children:["Next",c.jsx(du,{className:"h-3.5 w-3.5"})]})]})]}):null,!Is&&v.length===0&&w.length===0?c.jsx("div",{className:"p-4",children:c.jsx(ft,{compact:!0,title:e("assets.empty.title"),description:e("assets.empty.desc")})}):null,Is&&W.length===0&&!J?c.jsx("div",{className:"p-4",children:c.jsx(ft,{compact:!0,title:e("assets.search.empty_title"),description:n("assets.search.empty_desc",{query:R})})}):null]})})]}),C?c.jsx("div",{className:"min-h-0 overflow-y-auto",children:c.jsxs(qe,{className:"p-4",children:[c.jsxs("div",{className:"flex items-start justify-between gap-3",children:[c.jsxs("div",{className:"min-w-0",children:[c.jsx("h3",{className:"text-base font-semibold",style:{color:"var(--revka-text-primary)"},children:C.item_name||C.name}),c.jsx("div",{className:"mt-1.5",children:c.jsx(QV,{kref:C.kref})})]}),c.jsx("button",{type:"button",onClick:()=>{T(null),A(null),B(null)},className:"shrink-0 rounded-[10px] p-1.5 transition",style:{color:"var(--revka-text-faint)"},title:e("assets.close_inspector"),children:c.jsx(vi,{className:"h-4 w-4"})})]}),c.jsxs("div",{className:"mt-3 flex flex-wrap items-center gap-2",children:[(()=>{const ae=Gc(C.kind);return c.jsx("span",{className:"inline-flex items-center gap-1.5 rounded-full px-2.5 py-1 text-[11px] font-semibold capitalize",style:{background:ae.bg,color:ae.color,border:`1px solid ${ae.border}`},children:C.kind})})(),c.jsx("span",{className:"inline-flex items-center rounded-full px-2.5 py-1 text-[11px] font-semibold",style:{background:C.deprecated?"rgba(245,158,11,0.12)":"rgba(125,255,155,0.12)",color:C.deprecated?"var(--revka-status-warning)":"var(--revka-status-success)"},children:C.deprecated?e("assets.deprecated"):e("assets.active")}),c.jsx("span",{className:"text-xs",style:{color:"var(--revka-text-faint)"},children:n(O.length===1?"assets.rev_count_one":"assets.rev_count",{count:O.length})}),c.jsxs("button",{type:"button",className:"revka-button ml-auto h-8 px-2 text-xs",onClick:cl,disabled:bt==="item-deprecate",title:C.deprecated?e("assets.action.restore_item"):e("assets.action.deprecate_item"),children:[bt==="item-deprecate"?c.jsx(Rr,{className:"h-3.5 w-3.5 animate-spin"}):c.jsx(yx,{className:"h-3.5 w-3.5"}),C.deprecated?e("assets.action.restore"):e("assets.action.deprecate")]})]}),c.jsxs("div",{className:"mt-3 flex items-center justify-between gap-2 text-xs",style:{color:"var(--revka-text-secondary)"},children:[c.jsx("span",{className:"truncate font-mono",children:n("assets.by",{author:D8(C)})}),c.jsx("span",{className:"shrink-0",children:fDe(C.created_at)})]}),c.jsxs("div",{className:"mt-4",children:[c.jsx(fx,{title:e("assets.section.revisions"),count:O.length,defaultOpen:!0,children:jn?c.jsx(ft,{tone:"loading",compact:!0,title:e("assets.loading.generic")}):O.length===0?c.jsx("div",{className:"text-sm",style:{color:"var(--revka-text-faint)"},children:e("assets.section.revisions_empty")}):c.jsxs("div",{className:"space-y-2",children:[L?c.jsxs("div",{className:"flex flex-wrap gap-2 rounded-[10px] border p-2",style:{borderColor:"var(--revka-border-soft)"},children:[c.jsxs("button",{type:"button",className:"revka-button h-8 px-2 text-xs",onClick:Ls,disabled:Ju(L)||bt==="revision-publish",title:e("assets.action.publish_revision"),children:[bt==="revision-publish"?c.jsx(Rr,{className:"h-3.5 w-3.5 animate-spin"}):c.jsx(tb,{className:"h-3.5 w-3.5"}),Ju(L)?e("assets.action.published"):e("assets.action.publish")]}),c.jsxs("button",{type:"button",className:"revka-button h-8 px-2 text-xs",onClick:lc,disabled:bt==="revision-deprecate",title:L.deprecated?e("assets.action.restore_revision"):e("assets.action.deprecate_revision"),children:[bt==="revision-deprecate"?c.jsx(Rr,{className:"h-3.5 w-3.5 animate-spin"}):c.jsx(yx,{className:"h-3.5 w-3.5"}),L.deprecated?e("assets.action.restore"):e("assets.action.deprecate")]}),c.jsxs("button",{type:"button",className:"revka-button h-8 px-2 text-xs",onClick:()=>Re("tag"),title:"Add or remove non-current revision tags",children:[c.jsx(tb,{className:"h-3.5 w-3.5"}),"Tags"]}),c.jsxs("button",{type:"button",className:"revka-button h-8 px-2 text-xs",onClick:()=>Re("artifact"),title:"Attach artifact to this revision",children:[c.jsx(xee,{className:"h-3.5 w-3.5"}),"Artifact"]}),c.jsxs("button",{type:"button",className:"revka-button h-8 px-2 text-xs",onClick:()=>Re("edge"),title:"Create an edge from this revision",children:[c.jsx(_z,{className:"h-3.5 w-3.5"}),"Edge"]}),c.jsxs("button",{type:"button",className:"revka-button h-8 px-2 text-xs",onClick:()=>tn(!0),title:"View local dependency graph",children:[c.jsx(Df,{className:"h-3.5 w-3.5"}),"Graph"]})]}):null,c.jsx("div",{className:"max-h-[20rem] space-y-1.5 overflow-y-auto",children:O.map(ae=>{const Ce=(L==null?void 0:L.kref)===ae.kref,at=Ju(ae);return c.jsxs("button",{type:"button",onClick:()=>ll(ae),className:"flex w-full items-center justify-between gap-2 rounded-[10px] px-3 py-2 text-left transition",style:{background:Ce?"var(--revka-signal-selected-soft, color-mix(in srgb, var(--revka-signal-selected) 18%, transparent))":"color-mix(in srgb, var(--revka-bg-elevated) 50%, transparent)",borderLeft:Ce?"2px solid var(--revka-signal-selected)":"2px solid transparent"},children:[c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx(FE,{className:"h-3 w-3",style:{color:"var(--revka-text-faint)"}}),c.jsxs("span",{className:"text-sm font-semibold",style:{color:"var(--revka-text-primary)"},children:["r",ae.number]}),c.jsxs("div",{className:"flex gap-1",children:[ae.latest?c.jsx(Ga,{label:e("assets.tag.latest"),tone:"var(--revka-signal-live)"}):null,at?c.jsx(Ga,{label:e("assets.tag.published"),tone:"var(--revka-status-success)"}):null,ae.deprecated?c.jsx(Ga,{label:e("assets.deprecated"),tone:"var(--revka-status-warning)"}):null,ae.tags.filter(Ot=>Ot!=="latest"&&Ot!=="published").map(Ot=>c.jsx(Ga,{label:Ot,tone:"var(--revka-text-faint)"},Ot))]})]}),c.jsx("span",{className:"shrink-0 text-xs",style:{color:"var(--revka-text-faint)"},children:Y2(ae.created_at)})]},ae.kref)})})]})}),c.jsx(fx,{title:e("assets.section.artifacts"),count:H.length,children:We?c.jsx(ft,{tone:"loading",compact:!0,title:e("assets.loading.generic")}):H.length===0?c.jsx("div",{className:"text-sm",style:{color:"var(--revka-text-faint)"},children:e("assets.section.artifacts_empty")}):c.jsx("div",{className:"space-y-1.5",children:H.map(ae=>c.jsxs("div",{role:"button",tabIndex:0,onClick:()=>I(ae),onKeyDown:Ce=>{(Ce.key==="Enter"||Ce.key===" ")&&(Ce.preventDefault(),I(ae))},className:"w-full rounded-[10px] px-3 py-2 text-left transition cursor-pointer",style:{background:(U==null?void 0:U.kref)===ae.kref?"var(--revka-signal-selected-soft, color-mix(in srgb, var(--revka-signal-selected) 18%, transparent))":"color-mix(in srgb, var(--revka-bg-elevated) 50%, transparent)",opacity:ae.deprecated?.62:1},children:[c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx(Ql,{className:"h-3.5 w-3.5 shrink-0",style:{color:"#2dd4bf"}}),c.jsx("span",{className:"truncate text-sm font-medium flex-1 min-w-0",style:{color:"var(--revka-text-primary)"},children:ae.name}),ae.deprecated?c.jsx("span",{className:"rounded-full px-1.5 py-0.5 text-[9px] font-semibold uppercase",style:{color:"var(--revka-status-warning)",background:"rgba(245,158,11,0.12)"},children:e("assets.deprecated")}):null,ae.location?c.jsxs("button",{type:"button",onClick:Ce=>{Ce.stopPropagation(),Eu(ae)},className:"inline-flex items-center gap-1 rounded-[6px] px-1.5 py-0.5 text-[10px] font-medium uppercase tracking-wider shrink-0 transition",style:{background:"var(--revka-bg-elevated)",color:"var(--revka-text-secondary)",border:"1px solid var(--revka-border-strong)"},"aria-label":`${e("assets.action.edit_artifact")} ${ae.name}`,children:[c.jsx(wz,{className:"h-3 w-3"}),e("assets.action.edit")]}):null,ae.location?c.jsxs("button",{type:"button",onClick:Ce=>{Ce.stopPropagation(),K(ae)},className:"inline-flex items-center gap-1 rounded-[6px] px-1.5 py-0.5 text-[10px] font-medium uppercase tracking-wider shrink-0 transition",style:{background:"var(--revka-bg-elevated)",color:"var(--revka-text-secondary)",border:"1px solid var(--revka-border-strong)"},"aria-label":`View ${ae.name}`,children:[c.jsx(kv,{className:"h-3 w-3"}),e("assets.action.view")]}):null,c.jsxs("button",{type:"button",onClick:Ce=>{Ce.stopPropagation(),la(ae)},className:"inline-flex items-center gap-1 rounded-[6px] px-1.5 py-0.5 text-[10px] font-medium uppercase tracking-wider shrink-0 transition",style:{background:"var(--revka-bg-elevated)",color:ae.deprecated?"var(--revka-status-success)":"var(--revka-status-warning)",border:"1px solid var(--revka-border-strong)"},"aria-label":`${ae.deprecated?e("assets.action.restore_artifact"):e("assets.action.deprecate_artifact")} ${ae.name}`,children:[bt===`artifact-deprecate:${ae.kref}`?c.jsx(Rr,{className:"h-3 w-3 animate-spin"}):c.jsx(yx,{className:"h-3 w-3"}),ae.deprecated?e("assets.action.restore"):e("assets.action.deprecate")]})]}),ae.location?c.jsxs("div",{className:"mt-1 truncate pl-5.5 text-xs",style:{color:"var(--revka-text-faint)",paddingLeft:"1.375rem"},children:[c.jsx(xz,{className:"mr-1 inline-block h-3 w-3"}),ae.location]}):null]},ae.kref))})}),c.jsx(fx,{title:e("assets.section.edges"),count:Q.length,children:Q.length===0?c.jsx("div",{className:"text-sm",style:{color:"var(--revka-text-faint)"},children:e("assets.section.edges_empty")}):c.jsx("div",{className:"space-y-1.5",children:Q.map((ae,Ce)=>{var at,Ot;return c.jsx("div",{className:"rounded-[10px] px-3 py-2",style:{background:"color-mix(in srgb, var(--revka-bg-elevated) 50%, transparent)"},children:c.jsxs("div",{className:"flex items-center gap-1.5 text-xs",children:[c.jsx("span",{className:"truncate font-mono",style:{color:"var(--revka-text-faint)"},children:(at=ae.source_kref.split("/").pop())==null?void 0:at.split("?")[0]}),c.jsx("span",{className:"shrink-0 rounded-full px-1.5 py-0.5 text-[9px] font-bold uppercase",style:{background:"rgba(251,146,60,0.1)",color:"#fb923c"},children:ae.edge_type}),c.jsx(_f,{className:"h-3 w-3 shrink-0",style:{color:"var(--revka-text-faint)"}}),c.jsx("span",{className:"truncate font-mono",style:{color:"var(--revka-text-faint)"},children:(Ot=ae.target_kref.split("/").pop())==null?void 0:Ot.split("?")[0]})]})},`${ae.source_kref}-${ae.target_kref}-${ae.edge_type}-${Ce}`)})})}),c.jsx(fx,{title:e("assets.section.metadata"),count:bi.length,defaultOpen:bi.length>0,children:bi.length===0?c.jsx("div",{className:"text-sm",style:{color:"var(--revka-text-faint)"},children:e("assets.section.metadata_empty")}):c.jsx("div",{className:"space-y-1.5",children:bi.map(([ae,Ce])=>c.jsxs("div",{className:"rounded-[10px] px-3 py-2",style:{background:"color-mix(in srgb, var(--revka-bg-elevated) 50%, transparent)"},children:[c.jsx("div",{className:"text-[11px] font-semibold uppercase tracking-[0.1em]",style:{color:"var(--revka-text-faint)"},children:ae}),c.jsx("div",{className:"mt-1 break-all text-sm leading-5",style:{color:"var(--revka-text-primary)"},children:String(Ce)})]},ae))})})]})]})}):null]})]}),it?c.jsxs(Nu,{title:n("assets.editor.title",{name:it.name}),description:L&&Ju(L)?e("assets.editor.published_desc"):e("assets.editor.mutable_desc"),onClose:()=>{bt!=="artifact-save"&&dt(null)},size:"2xl",children:[c.jsxs("div",{className:"mb-3 flex items-center gap-2 text-xs",style:{color:"var(--revka-text-faint)"},children:[c.jsx(wv,{className:"h-3.5 w-3.5"}),c.jsx("span",{className:"truncate font-mono",children:it.kref})]}),Ht?c.jsx(ft,{tone:"loading",compact:!0,title:e("assets.loading.generic")}):c.jsx("textarea",{className:"revka-input min-h-[24rem] w-full resize-y font-mono text-xs leading-5",value:Vt,onChange:ae=>jt(ae.target.value),spellCheck:!1}),c.jsxs("div",{className:"mt-4 flex justify-end gap-2",children:[c.jsx("button",{type:"button",className:"revka-button",onClick:()=>dt(null),disabled:bt==="artifact-save",children:e("common.cancel")}),c.jsxs("button",{type:"button",className:"revka-button revka-button-primary",onClick:ul,disabled:Ht||bt==="artifact-save",children:[bt==="artifact-save"?c.jsx(Rr,{className:"h-4 w-4 animate-spin"}):c.jsx(KE,{className:"h-4 w-4"}),e("assets.action.save_artifact")]})]})]}):null,X?c.jsx(lV,{artifact:X,onClose:()=>K(null)}):null,ge?c.jsx(SDe,{action:ge,project:d,spacePath:qt,selectedItem:C,selectedRevision:L,selectedBundle:fo,bundleMembers:Oe,onClose:()=>Re(null),onCreated:ae=>{Re(null),ae!=null&&ae.item&&(A(ae.item.kref),T(ae.item)),ae!=null&&ae.revision&&(B(ae.revision.kref),$(ae.revision)),ae!=null&&ae.bundle&&(pe(ae.bundle.kref),ne("bundles")),yt(Ce=>Ce+1),P("success","Kumiho asset operation completed.")}}):null,et&&L?c.jsx(CDe,{revision:L,onClose:()=>tn(!1),onOpenKref:ae=>{tn(!1),fs(ae)}}):null]})}const pv={conversation:"var(--revka-signal-network)",decision:"var(--revka-status-warning)",fact:"var(--revka-signal-selected)",preference:"var(--revka-signal-selected)",correction:"var(--revka-status-danger)",skill:"var(--revka-signal-network)",summary:"var(--revka-signal-selected)",bundle:"var(--revka-signal-live)",reflection:"var(--revka-signal-selected)",action:"var(--revka-status-warning)",error:"var(--revka-status-danger)",instruction:"var(--revka-status-warning)",plan:"var(--revka-signal-selected)",implementation:"var(--revka-signal-live)",architecture:"var(--revka-signal-network)",synthesis:"var(--revka-signal-selected)",space:"var(--revka-status-idle)",document:"var(--revka-signal-network)",skilldef:"var(--revka-signal-selected)"},NDe={DEPENDS_ON:"var(--revka-status-warning)",DERIVED_FROM:"var(--revka-signal-selected)",REFERENCED:"var(--revka-signal-network)",CONTAINS:"var(--revka-signal-live)",CREATED_FROM:"var(--revka-signal-selected)",BELONGS_TO:"var(--revka-signal-network)",SUPERSEDES:"var(--revka-status-danger)",MEMBER:"var(--revka-status-warning)",USED_TEMPLATE:"var(--revka-status-warning)"},v0="var(--revka-text-muted)",EDe="var(--revka-text-faint)";function $8(e){if(typeof window>"u")return e;const n=e.match(/^var\((--[^,)]+)/);return n&&getComputedStyle(document.documentElement).getPropertyValue(n[1]).trim()||e}function ADe(e){return e.startsWith("kref://")?e:`kref://${e}`}function TDe(){const{t:e,tpl:n}=an();return b.useCallback(r=>{if(!r)return"";const i=Date.now(),s=new Date(r).getTime(),a=i-s,o=Math.floor(a/1e3);if(o<60)return e("memory.relative.just_now");const l=Math.floor(o/60);if(l<60)return n("memory.relative.minutes",{count:l});const u=Math.floor(l/60);if(u<24)return n("memory.relative.hours",{count:u});const d=Math.floor(u/24);return d<7?n("memory.relative.days",{count:d}):new Date(r).toLocaleDateString()},[e,n])}function MDe({kinds:e,activeKinds:n,onToggle:r}){return c.jsx("div",{className:"flex flex-wrap gap-1.5",children:e.map(i=>{const s=n.size===0||n.has(i),a=pv[i]||v0;return c.jsx("button",{type:"button",onClick:()=>r(i),className:"rounded-full border px-2.5 py-1 text-[10px] font-semibold uppercase tracking-[0.12em]",style:{background:s?`color-mix(in srgb, ${a} 16%, transparent)`:"transparent",color:s?a:"var(--revka-text-faint)",borderColor:s?`color-mix(in srgb, ${a} 30%, transparent)`:"var(--revka-border-soft)",opacity:s?1:.55},children:i},i)})})}function RDe({detail:e,loading:n,onClose:r,onMemberClick:i}){const{t:s}=an(),a=TDe(),[o,l]=b.useState(!1),u=pv[e.kind]||v0,d=async()=>{const p=e.kref.startsWith("kref://")?e.kref:`kref://${e.kref}`;await ro(p)&&(l(!0),setTimeout(()=>l(!1),1500))};return c.jsxs(qe,{className:"p-4",variant:"secondary",children:[c.jsxs("div",{className:"flex items-start justify-between gap-3",children:[c.jsxs("div",{className:"min-w-0 flex-1",children:[c.jsx("div",{className:"revka-kicker",children:s("memory.selected_memory")}),c.jsxs("div",{className:"mt-2 flex items-center gap-2",children:[c.jsx("span",{className:"h-2.5 w-2.5 rounded-full",style:{backgroundColor:u}}),c.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-[0.14em]",style:{color:u},children:e.kind})]}),c.jsx("h3",{className:"mt-2 break-words text-lg font-semibold",style:{color:"var(--revka-text-primary)"},children:e.title||e.name})]}),c.jsx("button",{type:"button",className:"revka-button",onClick:r,children:c.jsx(vi,{className:"h-4 w-4"})})]}),n?c.jsx("div",{className:"mt-4",children:c.jsx(ft,{compact:!0,tone:"loading",title:s("memory.loading_detail")})}):c.jsxs("div",{className:"mt-4 space-y-4",children:[e.summary?c.jsx("p",{className:"text-sm leading-6",style:{color:"var(--revka-text-secondary)"},children:e.summary}):null,c.jsxs("div",{className:"flex flex-wrap gap-2 text-xs",style:{color:"var(--revka-text-faint)"},children:[e.space?c.jsx("span",{className:"rounded-full border px-2 py-1",style:{borderColor:"var(--revka-border-soft)"},children:e.space}):null,e.created_at?c.jsx("span",{children:a(e.created_at)}):null]}),c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("code",{className:"flex-1 truncate rounded-[10px] border px-3 py-2 text-[11px]",style:{borderColor:"var(--revka-border-soft)",color:"var(--revka-text-faint)"},children:e.kref}),c.jsx("button",{type:"button",className:"revka-button",onClick:d,children:o?c.jsx(no,{className:"h-4 w-4"}):c.jsx(rc,{className:"h-4 w-4"})})]}),Object.keys(e.metadata).length>0?c.jsxs("div",{children:[c.jsx("div",{className:"revka-kicker",children:s("memory.detail.metadata")}),c.jsx("div",{className:"mt-2 space-y-2",children:Object.entries(e.metadata).filter(([p])=>p!=="title"&&p!=="summary").map(([p,f])=>c.jsxs("div",{className:"rounded-[12px] border p-3 text-xs",style:{borderColor:"var(--revka-border-soft)"},children:[c.jsx("div",{className:"font-semibold",style:{color:"var(--revka-text-secondary)"},children:p}),c.jsx("div",{className:"mt-1 break-all",style:{color:"var(--revka-text-faint)"},children:f.length>200?`${f.slice(0,200)}...`:f})]},p))})]}):null,e.bundleMembers&&e.bundleMembers.length>0?c.jsxs("div",{children:[c.jsx("div",{className:"revka-kicker",children:s("memory.detail.bundle_members")}),c.jsx("div",{className:"mt-2 space-y-2",children:e.bundleMembers.map(p=>c.jsxs("button",{type:"button",onClick:()=>i(p),className:"block w-full rounded-[12px] border p-3 text-left transition-colors",style:{borderColor:"var(--revka-border-soft)"},children:[c.jsx("div",{className:"text-sm font-semibold",style:{color:"var(--revka-text-primary)"},children:p.name}),c.jsx("div",{className:"mt-1 text-[10px] font-semibold uppercase tracking-[0.14em]",style:{color:pv[p.kind]||v0},children:p.kind}),p.summary?c.jsx("div",{className:"mt-2 line-clamp-2 text-xs",style:{color:"var(--revka-text-secondary)"},children:p.summary}):null]},p.itemKref))})]}):null]})]})}function ODe(){const{t:e,tpl:n}=an(),{resolvedTheme:r}=Pa(),[i,s]=b.useState(null),[a,o]=b.useState(!0),[l,u]=b.useState(null),[d,p]=b.useState(new Set),[f,g]=b.useState(""),[_,x]=b.useState(150),[v,S]=b.useState(150),[w,j]=b.useState(""),[C,T]=b.useState(new Set),E=b.useRef(null),A=b.useRef(null),[O,F]=b.useState({width:0,height:0}),[L,$]=b.useState(null),[z,B]=b.useState(null),[H,D]=b.useState(!1),U=b.useMemo(()=>{if(typeof window>"u")return{primary:"#ffffff",muted:"rgba(255,255,255,0.6)",dim:"rgba(255,255,255,0.1)"};const J=getComputedStyle(document.documentElement),G=J.getPropertyValue("--revka-text-primary").trim()||(r==="light"?"#18181b":"#ffffff"),re=J.getPropertyValue("--revka-text-secondary").trim()||(r==="light"?"#52525b":"rgba(255,255,255,0.6)");return{primary:G,muted:re,dim:r==="light"?"rgba(24,24,27,0.15)":"rgba(255,255,255,0.1)"}},[r]);b.useEffect(()=>{const J=setTimeout(()=>S(_),400);return()=>clearTimeout(J)},[_]);const I=b.useCallback(async()=>{o(!0),u(null);const J=2;for(let G=0;G<=J;G+=1)try{const re={limit:v};d.size>0&&(re.kinds=Array.from(d).join(",")),f&&(re.space=f);const ne=await _J(re);s(ne),o(!1);return}catch(re){const ne=re instanceof Error?re.message:String(re);if(/API (408|502|503|504)/.test(ne)&&G<J){await new Promise(oe=>setTimeout(oe,(G+1)*2e3));continue}u(ne||e("memory.err.load"))}o(!1)},[d,v,f,e]);b.useEffect(()=>{I()},[I]),b.useEffect(()=>{const J=E.current;if(!J)return;const G=()=>F({width:J.clientWidth,height:J.clientHeight});G();const re=new ResizeObserver(G);return re.observe(J),()=>re.disconnect()},[]),b.useEffect(()=>{var re,ne;if(!w.trim()||!i){T(new Set);return}const J=w.toLowerCase(),G=new Set;for(const le of i.nodes)(le.name.toLowerCase().includes(J)||(re=le.title)!=null&&re.toLowerCase().includes(J)||le.kind.toLowerCase().includes(J)||(ne=le.summary)!=null&&ne.toLowerCase().includes(J))&&G.add(le.id);T(G)},[i,w]);const X=b.useMemo(()=>{if(!i)return{nodes:[],links:[]};const J=i.nodes.map(ne=>({...ne,val:C.has(ne.id)?3:1,__highlight:C.has(ne.id)})),G=new Set(J.map(ne=>ne.id)),re=i.edges.filter(ne=>G.has(ne.source)&&G.has(ne.target)).map(ne=>({source:ne.source,target:ne.target,edgeType:ne.edge_type}));return{nodes:J,links:re}},[i,C]),K=b.useMemo(()=>i?Object.keys(i.stats.kinds).sort():[],[i]),Q=b.useCallback(J=>{p(G=>{const re=new Set(G);return re.has(J)?re.delete(J):re.add(J),re})},[]),V=b.useCallback(async J=>{var re,ne;D(!0);const G={name:J.name,kind:J.kind,kref:J.id,space:J.space,created_at:J.created_at,title:J.title,summary:J.summary,metadata:{},bundleMembers:null};try{const le=ADe(J.id),oe=await Ro("/revisions",{item_kref:le}),he=(oe==null?void 0:oe.find(Z=>{var de;return(de=Z.tags)==null?void 0:de.includes("published")}))??(oe==null?void 0:oe.find(Z=>Z.latest))??(oe==null?void 0:oe[0]);if(he&&(G.metadata=he.metadata??{},G.title=((re=he.metadata)==null?void 0:re.title)||G.title,G.summary=((ne=he.metadata)==null?void 0:ne.summary)||G.summary),J.kind==="bundle")try{const Z=await Ro("/bundles/members",{bundle_kref:le});G.bundleMembers=((Z==null?void 0:Z.members)??[]).map(de=>{const Oe=de.item_kref.replace(/^kref:\/\//,"").split("/").pop()||"",fe=Oe.indexOf("."),Le=fe>0?Oe.substring(0,fe):Oe,Ee=fe>0?Oe.substring(fe+1):"unknown";return{itemKref:de.item_kref,name:Le,kind:Ee,summary:null}})}catch{G.bundleMembers=null}}catch{}B(G),D(!1)},[]),R=b.useCallback(J=>{$(J.id),V(J)},[V]),q=b.useCallback(J=>{const G=i==null?void 0:i.nodes.find(re=>re.id===J.itemKref.replace(/^kref:\/\//,""));G&&($(G.id),V(G))},[V,i]),W=b.useCallback((J,G,re)=>{const ne=J.x??0,le=J.y??0,oe=$8(pv[J.kind]||v0),ie=J.id===L,he=!!J.__highlight,Z=J.kind==="space",de=ie?7:he?6:Z?5:4,pe=C.size>0&&!he&&!ie;if(ie&&(G.beginPath(),G.arc(ne,le,de+5,0,2*Math.PI),G.fillStyle=`${oe}20`,G.fill(),G.beginPath(),G.arc(ne,le,de+2.5,0,2*Math.PI),G.strokeStyle=`${oe}50`,G.lineWidth=1.5,G.stroke()),he&&!ie&&(G.beginPath(),G.arc(ne,le,de+3,0,2*Math.PI),G.strokeStyle=U.primary,G.lineWidth=1,G.globalAlpha=.6,G.stroke(),G.globalAlpha=1),G.beginPath(),Z){const Oe=de*1.2;G.moveTo(ne,le-Oe),G.lineTo(ne+Oe,le),G.lineTo(ne,le+Oe),G.lineTo(ne-Oe,le),G.closePath()}else G.arc(ne,le,de,0,2*Math.PI);if(G.fillStyle=oe,G.globalAlpha=pe?.15:1,G.fill(),G.globalAlpha=1,re>.8||ie||he){const Oe=Math.max(10/re,3);G.font=`${ie?"bold ":""}${Oe}px Inter, system-ui, sans-serif`,G.textAlign="center",G.textBaseline="top",G.fillStyle=pe?U.dim:ie?U.primary:U.muted;const fe=J.name.length>22?`${J.name.slice(0,20)}...`:J.name;G.fillText(fe,ne,le+de+2)}},[C,L,U]),te=b.useCallback((J,G)=>{const re=J.source,ne=J.target;if(typeof re!="object"||typeof ne!="object"||re.x==null||re.y==null||ne.x==null||ne.y==null)return;const le=$8(NDe[J.edgeType]||EDe),oe=C.size>0,ie=C.has(re.id)||re.id===L,he=C.has(ne.id)||ne.id===L,Z=oe&&!ie&&!he;G.beginPath(),G.moveTo(re.x,re.y),G.lineTo(ne.x,ne.y),G.strokeStyle=le,G.globalAlpha=Z?.05:.4,G.lineWidth=Z?.5:1.5,G.stroke(),G.globalAlpha=1},[C,L]);return c.jsx("div",{className:"flex h-[calc(100vh-6rem)] flex-col gap-3",children:c.jsxs("div",{className:"grid min-h-0 flex-1 gap-4 md:grid-cols-[16rem_minmax(0,1fr)_minmax(22rem,26rem)]",children:[c.jsxs("div",{className:"flex min-h-0 flex-col gap-4 overflow-y-auto pr-1",children:[c.jsxs(qe,{className:"p-4",children:[c.jsx("div",{className:"revka-kicker",children:e("memory.controls.title")}),c.jsxs("div",{className:"mt-3 space-y-4",children:[c.jsx("div",{children:c.jsxs("div",{className:"relative",children:[c.jsx(Da,{className:"pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2",style:{color:"var(--revka-text-faint)"}}),c.jsx("input",{type:"text",value:w,onChange:J=>j(J.target.value),placeholder:e("memory.controls.search_placeholder"),className:"revka-input pl-10 pr-10"}),w?c.jsx("button",{type:"button",className:"absolute right-2 top-1/2 -translate-y-1/2 revka-button px-2 py-2",onClick:()=>j(""),children:c.jsx(vi,{className:"h-3.5 w-3.5"})}):null]})}),i&&i.spaces.length>1?c.jsxs("div",{className:"relative",children:[c.jsxs("select",{value:f,onChange:J=>g(J.target.value),className:"revka-input appearance-none pr-10",children:[c.jsx("option",{value:"",children:e("memory.controls.all_spaces")}),i.spaces.map(J=>c.jsx("option",{value:`/${J}`,children:J.split("/").pop()},J))]}),c.jsx(Yo,{className:"pointer-events-none absolute right-3 top-1/2 h-4 w-4 -translate-y-1/2",style:{color:"var(--revka-text-faint)"}})]}):null,c.jsxs("div",{children:[c.jsxs("div",{className:"mb-2 inline-flex items-center gap-2 text-sm",style:{color:"var(--revka-text-secondary)"},children:[c.jsx(zee,{className:"h-4 w-4"}),e("memory.controls.node_limit")]}),c.jsx("input",{type:"range",min:25,max:500,step:25,value:_,onChange:J=>x(Number(J.target.value)),className:"w-full accent-[var(--revka-signal-selected)]"}),c.jsx("div",{className:"mt-2 text-xs font-mono",style:{color:"var(--revka-text-faint)"},children:_})]})]})]}),c.jsxs(qe,{className:"p-4",variant:"secondary",children:[c.jsx("div",{className:"revka-kicker",children:e("memory.filters.title")}),c.jsx("div",{className:"mt-3",children:K.length>0?c.jsx(MDe,{kinds:K,activeKinds:d,onToggle:Q}):c.jsx(ft,{compact:!0,title:e("memory.filters.empty_title"),description:e("memory.filters.empty_desc")})})]})]}),c.jsxs(qe,{className:"flex min-h-0 flex-col p-5",children:[c.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[c.jsxs("div",{children:[c.jsx("div",{className:"revka-kicker",children:e("memory.graph.kicker")}),c.jsx("h3",{className:"mt-2 text-lg font-semibold",children:e("memory.graph.heading")})]}),i?c.jsxs("div",{className:"flex flex-wrap items-center gap-3 text-xs",style:{color:"var(--revka-text-faint)"},children:[c.jsxs("span",{children:[c.jsx("strong",{style:{color:"var(--revka-text-primary)"},children:i.stats.total_items})," ",e("memory.graph.items")]}),c.jsxs("span",{children:[c.jsx("strong",{style:{color:"var(--revka-text-primary)"},children:i.stats.total_edges})," ",e("memory.graph.edges")]}),c.jsxs("span",{children:[c.jsx("strong",{style:{color:"var(--revka-text-primary)"},children:X.nodes.length})," ",e("memory.graph.shown")]}),C.size>0?c.jsx("span",{style:{color:"var(--revka-status-warning)"},children:n(C.size===1?"memory.graph.match":"memory.graph.matches",{count:C.size})}):null]}):null]}),c.jsxs("div",{ref:E,className:"relative mt-5 min-h-0 flex-1 overflow-hidden rounded-[18px] border",style:{borderColor:"var(--revka-border-soft)",background:"color-mix(in srgb, var(--revka-bg-panel-strong) 94%, transparent)"},children:[a?c.jsx("div",{className:"absolute inset-0 flex items-center justify-center p-6",children:c.jsx(ft,{tone:"loading",title:e("memory.graph.loading_title"),description:e("memory.graph.loading_desc")})}):null,!a&&l?c.jsx("div",{className:"absolute inset-0 flex items-center justify-center p-6",children:c.jsx(ft,{tone:"error",title:e("memory.graph.error_title"),description:l,action:c.jsx("button",{className:"revka-button",onClick:I,children:e("memory.graph.retry")})})}):null,!a&&!l&&X.nodes.length===0?c.jsx("div",{className:"absolute inset-0 flex items-center justify-center p-6",children:c.jsx(ft,{title:e("memory.graph.empty_title"),description:e("memory.graph.empty_desc")})}):null,!a&&!l&&O.width>0&&O.height>0&&X.nodes.length>0?c.jsx(Nk,{ref:A,graphData:X,width:O.width,height:O.height,backgroundColor:"transparent",nodeRelSize:4,nodeCanvasObject:W,nodePointerAreaPaint:(J,G,re)=>{const ne=J.x??0,le=J.y??0;re.beginPath(),re.arc(ne,le,10,0,2*Math.PI),re.fillStyle=G,re.fill()},linkCanvasObject:te,linkCanvasObjectMode:()=>"replace",onNodeClick:R,cooldownTicks:200,d3AlphaDecay:.015,d3VelocityDecay:.25,warmupTicks:50}):null,!a&&!l&&X.nodes.length>0?c.jsx("div",{className:"absolute bottom-3 left-3 z-10 flex max-w-[70%] flex-wrap items-center gap-x-3 gap-y-1 rounded-[12px] border px-3 py-2",style:{borderColor:"var(--revka-border-soft)",background:"color-mix(in srgb, var(--revka-bg-panel-strong) 94%, transparent)"},children:Object.entries(pv).filter(([J])=>i==null?void 0:i.stats.kinds[J]).map(([J,G])=>c.jsxs("span",{className:"inline-flex items-center gap-1 text-[10px]",style:{color:"var(--revka-text-secondary)"},children:[c.jsx("span",{className:"h-2 w-2 rounded-full",style:{backgroundColor:G}}),J]},J))}):null]})]}),c.jsx("div",{className:"flex min-h-0 flex-col gap-4 overflow-y-auto pr-1",children:z?c.jsx(RDe,{detail:z,loading:H,onClose:()=>{B(null),$(null)},onMemberClick:q}):c.jsx(qe,{className:"p-5",variant:"secondary",children:c.jsx(ft,{title:e("memory.none_selected_title"),description:e("memory.none_selected_desc")})})})]})})}function F8(e){switch(e){case"auth_failure":case"policy_violation":return"var(--revka-status-danger)";case"security_event":return"var(--revka-status-warning)";case"auth_success":return"var(--revka-status-success)";default:return"var(--revka-text-secondary)"}}function DDe(){const{t:e,tpl:n}=an(),[r,i]=b.useState([]),[s,a]=b.useState(!0),[o,l]=b.useState(null),[u,d]=b.useState(!1),[p,f]=b.useState(""),[g,_]=b.useState(!0),x=b.useCallback(j=>{try{const C=Date.now()-new Date(j).getTime(),T=Math.floor(C/1e3);if(T<60)return n("audit.time.seconds_ago",{n:T});const E=Math.floor(T/60);if(E<60)return n("audit.time.minutes_ago",{n:E});const A=Math.floor(E/60);return A<24?n("audit.time.hours_ago",{n:A}):n("audit.time.days_ago",{n:Math.floor(A/24)})}catch{return j}},[n]),v=b.useCallback(j=>{const C=`audit.event.${j}`,T=e(C);return T!==C?T:j.replace(/_/g," ").replace(/\b\w/g,E=>E.toUpperCase())},[e]),S=b.useCallback(()=>{a(!0),PZ({limit:100,event_type:p||void 0}).then(j=>{i(j.events),_(j.audit_enabled)}).catch(()=>i([])).finally(()=>a(!1))},[p]);b.useEffect(()=>{S()},[S]);const w=()=>{d(!0),Qx().then(l).catch(()=>l({verified:!1,error:"Verification request failed"})).finally(()=>d(!1))};return g?c.jsxs("div",{className:"flex min-h-[calc(100vh-6rem)] flex-col gap-3 lg:h-[calc(100vh-6rem)]",children:[c.jsx(oi,{kicker:e("audit.kicker"),title:e("audit.title"),description:e("audit.description"),actions:c.jsxs(c.Fragment,{children:[c.jsxs("button",{className:"revka-button",onClick:S,children:[c.jsx($r,{className:`h-4 w-4 ${s?"animate-spin":""}`}),e("audit.refresh")]}),c.jsxs("button",{className:"revka-button",onClick:w,disabled:u,children:[c.jsx(Cv,{className:`h-4 w-4 ${u?"animate-spin":""}`}),e("audit.verify_chain")]})]})}),c.jsxs("div",{className:"grid gap-4 grid-cols-1 lg:min-h-0 lg:flex-1 lg:grid-cols-[18rem_minmax(0,1fr)]",children:[c.jsxs(qe,{className:"p-4",variant:"secondary",children:[c.jsx("div",{className:"revka-kicker",children:e("audit.filters")}),c.jsxs("div",{className:"mt-3 space-y-3",children:[c.jsxs("select",{value:p,onChange:j=>f(j.target.value),className:"revka-input",children:[c.jsx("option",{value:"",children:e("audit.all_event_types")}),c.jsx("option",{value:"command_execution",children:e("audit.event.command_execution")}),c.jsx("option",{value:"file_access",children:e("audit.event.file_access")}),c.jsx("option",{value:"config_change",children:e("audit.event.config_change")}),c.jsx("option",{value:"auth_success",children:e("audit.event.auth_success")}),c.jsx("option",{value:"auth_failure",children:e("audit.event.auth_failure")}),c.jsx("option",{value:"policy_violation",children:e("audit.event.policy_violation")}),c.jsx("option",{value:"security_event",children:e("audit.event.security_event")})]}),o?c.jsx("div",{className:"rounded-[12px] border p-3 text-sm",style:{borderColor:o.verified?"color-mix(in srgb, var(--revka-status-success) 24%, transparent)":"color-mix(in srgb, var(--revka-status-danger) 24%, transparent)"},children:c.jsxs("div",{className:"flex items-start gap-2",children:[o.verified?c.jsx(Of,{className:"mt-0.5 h-4 w-4",style:{color:"var(--revka-status-success)"}}):c.jsx(ru,{className:"mt-0.5 h-4 w-4",style:{color:"var(--revka-status-danger)"}}),c.jsxs("div",{children:[c.jsx("div",{style:{color:o.verified?"var(--revka-status-success)":"var(--revka-status-danger)"},children:o.verified?e("audit.chain_verified"):e("audit.chain_invalid")}),c.jsx("div",{className:"mt-1 text-xs",style:{color:"var(--revka-text-secondary)"},children:o.verified?n("audit.entries_verified",{count:o.entry_count??0}):o.error})]})]})}):null]})]}),c.jsxs(qe,{className:"p-5 lg:overflow-y-auto",children:[c.jsx("div",{className:"revka-kicker",children:e("audit.stream_title")}),c.jsx("h3",{className:"mt-2 text-lg font-semibold",children:e("audit.stream_subtitle")}),c.jsx("div",{className:"mt-5 space-y-3",children:s?c.jsx(ft,{tone:"loading",title:e("audit.loading")}):r.length===0?c.jsx(ft,{title:e("audit.empty_title"),description:e("audit.empty_desc")}):r.map(j=>{var C,T,E,A;return c.jsxs("div",{className:"rounded-[14px] border p-4",style:{borderColor:"var(--revka-border-soft)"},children:[c.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("span",{className:"rounded-full px-2.5 py-1 text-[10px] font-semibold uppercase tracking-[0.12em]",style:{color:F8(j.event_type),background:`color-mix(in srgb, ${F8(j.event_type)} 12%, transparent)`},children:v(j.event_type)}),j.actor?c.jsxs("span",{className:"text-xs",style:{color:"var(--revka-text-secondary)"},children:[j.actor.channel,j.actor.username?` · ${j.actor.username}`:""]}):null]}),c.jsx("span",{className:"text-xs",style:{color:"var(--revka-text-faint)"},children:x(j.timestamp)})]}),c.jsxs("div",{className:"mt-3 grid gap-3 md:grid-cols-2 xl:grid-cols-4 text-xs",children:[c.jsxs("div",{children:[c.jsx("div",{className:"revka-kicker",children:e("audit.col.sequence")}),c.jsx("div",{className:"mt-1",style:{color:"var(--revka-text-primary)"},children:j.sequence})]}),c.jsxs("div",{children:[c.jsx("div",{className:"revka-kicker",children:e("audit.col.action")}),c.jsx("div",{className:"mt-1",style:{color:"var(--revka-text-primary)"},children:((C=j.action)==null?void 0:C.command)||"—"})]}),c.jsxs("div",{children:[c.jsx("div",{className:"revka-kicker",children:e("audit.col.result")}),c.jsx("div",{className:"mt-1",style:{color:(T=j.result)!=null&&T.success?"var(--revka-status-success)":"var(--revka-text-secondary)"},children:(E=j.result)!=null&&E.success?e("audit.result_success"):((A=j.result)==null?void 0:A.error)||e("audit.result_recorded")})]}),c.jsxs("div",{children:[c.jsx("div",{className:"revka-kicker",children:e("audit.col.hash")}),c.jsx("div",{className:"mt-1 font-mono",style:{color:"var(--revka-text-faint)"},children:j.entry_hash.slice(0,16)})]})]}),j.security.policy_violation?c.jsxs("div",{className:"mt-3 inline-flex items-center gap-2 rounded-full px-2.5 py-1 text-[10px] font-semibold uppercase tracking-[0.12em]",style:{color:"var(--revka-status-danger)",background:"color-mix(in srgb, var(--revka-status-danger) 10%, transparent)"},children:[c.jsx(C0,{className:"h-3 w-3"}),e("audit.policy_violation_badge")]}):null]},j.event_id)})})]})]})]}):c.jsxs("div",{className:"flex min-h-[calc(100vh-6rem)] flex-col gap-3",children:[c.jsx(oi,{kicker:e("audit.kicker"),title:e("audit.title"),description:e("audit.description")}),c.jsx(qe,{className:"p-5",children:c.jsx(ft,{title:e("audit.disabled_title"),description:e("audit.disabled_desc")})})]})}function PDe(e){return e?new Date(e).toLocaleTimeString():new Date().toLocaleTimeString()}function LDe(e){switch(e.toLowerCase()){case"error":return{color:"var(--revka-status-danger)",bg:"color-mix(in srgb, var(--revka-status-danger) 8%, transparent)",border:"color-mix(in srgb, var(--revka-status-danger) 18%, transparent)"};case"warn":case"warning":return{color:"var(--revka-status-warning)",bg:"color-mix(in srgb, var(--revka-status-warning) 8%, transparent)",border:"color-mix(in srgb, var(--revka-status-warning) 18%, transparent)"};case"tool_call":case"tool_result":case"tool_call_start":return{color:"var(--revka-signal-selected)",bg:"color-mix(in srgb, var(--revka-signal-selected) 8%, transparent)",border:"color-mix(in srgb, var(--revka-signal-selected) 18%, transparent)"};case"llm_request":return{color:"var(--revka-signal-network)",bg:"color-mix(in srgb, var(--revka-signal-network) 8%, transparent)",border:"color-mix(in srgb, var(--revka-signal-network) 18%, transparent)"};case"agent_start":case"agent_end":return{color:"var(--revka-signal-selected)",bg:"color-mix(in srgb, var(--revka-signal-selected) 8%, transparent)",border:"color-mix(in srgb, var(--revka-signal-selected) 18%, transparent)"};case"message":case"chat":return{color:"var(--revka-signal-selected)",bg:"var(--revka-signal-selected-soft, color-mix(in srgb, var(--revka-signal-selected) 18%, transparent))",border:"color-mix(in srgb, var(--revka-signal-selected) 28%, transparent)"};case"log":return{color:"var(--revka-text-secondary)",bg:"color-mix(in srgb, var(--revka-bg-panel-strong) 94%, transparent)",border:"var(--revka-border-soft)"};case"log_unavailable":return{color:"var(--revka-status-danger)",bg:"color-mix(in srgb, var(--revka-status-danger) 8%, transparent)",border:"color-mix(in srgb, var(--revka-status-danger) 18%, transparent)"};default:return{color:"var(--revka-text-secondary)",bg:"color-mix(in srgb, var(--revka-bg-panel-strong) 94%, transparent)",border:"var(--revka-border-soft)"}}}function IDe(){const{t:e,tpl:n}=an(),[r,i]=b.useState([]),[s,a]=b.useState(!1),[o,l]=b.useState(!1),[u,d]=b.useState(!0),[p,f]=b.useState(new Set),g=b.useRef(null),_=b.useRef(!1),x=b.useRef(0);b.useEffect(()=>{_.current=s},[s]),b.useEffect(()=>{const j=new Dv({path:`${Oi}${Xr}/api/daemon/logs`});return j.onConnect=()=>l(!0),j.onError=()=>l(!1),j.onEvent=C=>{if(_.current)return;x.current+=1;const T={id:`log-${x.current}`,event:C};i(E=>{const A=[...E,T];return A.length>500?A.slice(-500):A})},j.connect(),()=>j.disconnect()},[]),b.useEffect(()=>{u&&g.current&&(g.current.scrollTop=g.current.scrollHeight)},[r,u]);const v=b.useCallback(()=>{if(!g.current)return;const{scrollTop:j,scrollHeight:C,clientHeight:T}=g.current;d(C-j-T<50)},[]),S=Array.from(new Set(r.map(j=>j.event.type))).sort(),w=p.size===0?r:r.filter(j=>p.has(j.event.type));return c.jsxs("div",{className:"space-y-6",children:[c.jsx(oi,{kicker:e("logs.kicker"),title:e("logs.title"),description:e("logs.description"),actions:c.jsxs(c.Fragment,{children:[c.jsxs("button",{className:"revka-button",onClick:()=>a(j=>!j),children:[s?c.jsx(k0,{className:"h-4 w-4"}):c.jsx(kz,{className:"h-4 w-4"}),e(s?"logs.resume":"logs.pause")]}),u?null:c.jsxs("button",{className:"revka-button",onClick:()=>{g.current&&(g.current.scrollTop=g.current.scrollHeight),d(!0)},children:[c.jsx(tee,{className:"h-4 w-4"}),e("logs.jump_to_bottom")]})]})}),c.jsxs("div",{className:"grid gap-4 lg:grid-cols-[18rem_minmax(0,1fr)]",children:[c.jsxs("div",{className:"space-y-4",children:[c.jsxs(qe,{className:"p-4",children:[c.jsx("div",{className:"revka-kicker",children:e("logs.stream_status")}),c.jsxs("div",{className:"mt-3 inline-flex items-center gap-2 rounded-full px-3 py-1.5 text-xs font-semibold",style:{color:o?"var(--revka-signal-selected)":"var(--revka-status-danger)",background:o?"color-mix(in srgb, var(--revka-signal-selected) 8%, transparent)":"color-mix(in srgb, var(--revka-status-danger) 8%, transparent)"},children:[c.jsx("span",{className:"revka-dot",style:{background:o?"var(--revka-signal-selected)":"var(--revka-status-danger)"}}),e(o?"logs.connected":"logs.disconnected")]}),c.jsx("div",{className:"mt-3 text-sm",style:{color:"var(--revka-text-secondary)"},children:n("logs.visible_lines",{count:w.length})})]}),c.jsxs(qe,{className:"p-4",variant:"secondary",children:[c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx(gz,{className:"h-4 w-4",style:{color:"var(--revka-text-faint)"}}),c.jsx("div",{className:"revka-kicker",children:e("logs.event_filters")})]}),c.jsxs("div",{className:"mt-3 space-y-2",children:[S.length===0?c.jsx(ft,{compact:!0,title:e("logs.no_event_types"),description:e("logs.no_event_types_desc")}):S.map(j=>c.jsxs("label",{className:"flex items-center gap-2 text-xs",style:{color:"var(--revka-text-secondary)"},children:[c.jsx("input",{type:"checkbox",checked:p.has(j),onChange:()=>f(C=>{const T=new Set(C);return T.has(j)?T.delete(j):T.add(j),T})}),j]},j)),p.size>0?c.jsx("button",{className:"revka-button mt-2",onClick:()=>f(new Set),children:e("logs.clear_filters")}):null]})]})]}),c.jsxs(qe,{className:"p-5",children:[c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx(xv,{className:"h-4 w-4",style:{color:"var(--revka-signal-network)"}}),c.jsx("div",{className:"revka-kicker",children:e("logs.live_event_feed")})]}),c.jsx("div",{ref:g,onScroll:v,className:"mt-4 h-[42rem] overflow-y-auto rounded-[16px] border p-3",style:{borderColor:"var(--revka-border-soft)",background:"color-mix(in srgb, var(--revka-bg-panel-strong) 94%, transparent)"},children:w.length===0?c.jsx(ft,{title:e("logs.no_events"),description:e("logs.no_events_desc")}):c.jsx("div",{className:"space-y-2",children:w.map(j=>{const C=LDe(j.event.type),T=typeof j.event.line=="string"?j.event.line:typeof j.event.message=="string"?j.event.message:typeof j.event.content=="string"?j.event.content:JSON.stringify(j.event);return c.jsxs("div",{className:"rounded-[12px] border p-3",style:{borderColor:C.border,background:C.bg},children:[c.jsxs("div",{className:"flex items-center justify-between gap-2",children:[c.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-[0.14em]",style:{color:C.color},children:j.event.type}),c.jsx("span",{className:"text-[11px]",style:{color:"var(--revka-text-faint)"},children:PDe(j.event.timestamp)})]}),c.jsx("pre",{className:"mt-2 whitespace-pre-wrap break-words text-xs",style:{color:"var(--revka-text-secondary)",fontFamily:"var(--pc-font-mono)"},children:T})]},j.id)})})})]})]})]})}function td(e){return`$${e.toFixed(4)}`}function BDe(){const{t:e,tpl:n}=an(),[r,i]=b.useState(null),[s,a]=b.useState(!0),[o,l]=b.useState(null),[u,d]=b.useState(null);b.useEffect(()=>{ez().then(i).catch(g=>l(g.message)).finally(()=>a(!1))},[]);const p=b.useMemo(()=>r?Object.values(r.by_model).sort((g,_)=>_.cost_usd-g.cost_usd):[],[r]),f=b.useMemo(()=>p.find(g=>g.model===u)??p[0]??null,[p,u]);return b.useEffect(()=>{var g;p.find(_=>_.model===u)||d(((g=p[0])==null?void 0:g.model)??null)},[p,u]),c.jsxs("div",{className:"flex min-h-[calc(100vh-6rem)] flex-col gap-3 md:h-[calc(100vh-6rem)]",children:[c.jsx(oi,{kicker:e("cost.kicker"),title:e("cost.title")}),o?c.jsx("div",{className:"flex min-h-0 flex-1 items-center justify-center",children:c.jsx(ft,{tone:"error",title:e("cost.error_title"),description:o})}):s||!r?c.jsx("div",{className:"flex min-h-0 flex-1 items-center justify-center",children:c.jsx(ft,{tone:"loading",title:e("cost.loading_title")})}):c.jsxs("div",{className:"grid gap-4 grid-cols-1 md:min-h-0 md:flex-1 md:grid-cols-[18rem_minmax(0,1fr)] lg:grid-cols-[18rem_minmax(0,1fr)_22rem]",children:[c.jsxs("div",{className:"flex flex-col gap-4 md:overflow-y-auto md:min-h-0",children:[c.jsxs(qe,{className:"p-4",variant:"secondary",children:[c.jsx("div",{className:"revka-kicker",children:e("cost.spend_posture")}),c.jsx("div",{className:"mt-4 space-y-3",children:[{icon:BE,tone:"var(--revka-signal-live)",label:e("cost.session_cost"),value:td(r.session_cost_usd)},{icon:Wee,tone:"var(--revka-status-success)",label:e("cost.daily_cost"),value:td(r.daily_cost_usd)},{icon:UE,tone:"var(--revka-signal-selected)",label:e("cost.monthly_cost"),value:td(r.monthly_cost_usd)},{icon:FE,tone:"var(--revka-status-warning)",label:e("cost.requests"),value:r.request_count.toLocaleString()}].map(({icon:g,tone:_,label:x,value:v})=>c.jsx("div",{className:"rounded-[14px] border p-3",style:{borderColor:"var(--revka-border-soft)",background:"color-mix(in srgb, var(--revka-bg-panel-strong) 88%, transparent)"},children:c.jsxs("div",{className:"flex items-center gap-3",children:[c.jsx("div",{className:"rounded-[12px] p-2",style:{background:`color-mix(in srgb, ${_} 12%, transparent)`,color:_},children:c.jsx(g,{className:"h-4 w-4"})}),c.jsxs("div",{className:"min-w-0",children:[c.jsx("div",{className:"text-[10px] font-semibold uppercase tracking-[0.14em]",style:{color:"var(--revka-text-faint)"},children:x}),c.jsx("div",{className:"mt-1 font-mono text-sm font-semibold",style:{color:"var(--revka-text-primary)"},children:v})]})]})},x))})]}),c.jsxs(qe,{className:"p-4",variant:"secondary",children:[c.jsx("div",{className:"revka-kicker",children:e("cost.token_efficiency")}),c.jsxs("div",{className:"mt-3 space-y-3 text-sm",children:[c.jsx(Rl,{label:e("cost.total_tokens"),value:r.total_tokens.toLocaleString()}),c.jsx(Rl,{label:e("cost.avg_tokens"),value:r.request_count>0?Math.round(r.total_tokens/r.request_count).toLocaleString():"0"}),c.jsx(Rl,{label:e("cost.cost_per_1k"),value:r.total_tokens>0?td(r.monthly_cost_usd/r.total_tokens*1e3):"$0.0000"})]})]})]}),c.jsxs(qe,{className:"p-5 md:overflow-y-auto",children:[c.jsx("div",{className:"revka-kicker",children:e("cost.model_workspace")}),c.jsx("h3",{className:"mt-2 text-lg font-semibold",children:e("cost.spend_by_model")}),c.jsx("div",{className:"mt-5 space-y-3",children:p.length===0?c.jsx(ft,{title:e("cost.no_model_data"),description:e("cost.no_model_data_desc")}):p.map(g=>{const _=r.monthly_cost_usd>0?g.cost_usd/r.monthly_cost_usd*100:0;return c.jsxs("button",{type:"button",className:"revka-selection-card text-left","data-active":String((f==null?void 0:f.model)===g.model),"data-accent":"workflow",onClick:()=>d(g.model),children:[c.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[c.jsx("div",{className:"text-sm font-semibold",style:{color:"var(--revka-text-primary)"},children:g.model}),c.jsx("div",{className:"font-mono text-sm",style:{color:"var(--revka-text-secondary)"},children:td(g.cost_usd)})]}),c.jsxs("div",{className:"mt-2 grid gap-2 text-xs md:grid-cols-3",style:{color:"var(--revka-text-secondary)"},children:[c.jsx("div",{children:n("cost.tokens_label",{count:g.total_tokens.toLocaleString()})}),c.jsx("div",{children:n("cost.requests_label",{count:g.request_count.toLocaleString()})}),c.jsx("div",{children:n("cost.share_label",{share:_.toFixed(1)})})]}),c.jsx("div",{className:"mt-3 h-2 overflow-hidden rounded-full",style:{background:"color-mix(in srgb, var(--revka-bg-panel-strong) 86%, transparent)"},children:c.jsx("div",{style:{width:`${Math.max(_,2)}%`,background:"var(--revka-signal-selected)",height:"100%"}})})]},g.model)})})]}),c.jsxs("div",{className:"flex flex-col gap-4 lg:overflow-y-auto lg:min-h-0",children:[c.jsxs(qe,{className:"p-4",variant:"utility",children:[c.jsx("div",{className:"revka-kicker",children:e("cost.selected_model")}),f?c.jsxs("div",{className:"mt-3 space-y-3",children:[c.jsx("div",{className:"text-sm font-semibold",style:{color:"var(--revka-text-primary)"},children:f.model}),c.jsx(Rl,{label:e("cost.monthly_spend"),value:td(f.cost_usd)}),c.jsx(Rl,{label:e("cost.requests"),value:f.request_count.toLocaleString()}),c.jsx(Rl,{label:e("cost.tokens"),value:f.total_tokens.toLocaleString()}),c.jsx(Rl,{label:e("cost.avg_tokens"),value:f.request_count>0?Math.round(f.total_tokens/f.request_count).toLocaleString():"0"}),c.jsx(Rl,{label:e("cost.cost_per_1k"),value:f.total_tokens>0?td(f.cost_usd/f.total_tokens*1e3):"$0.0000"}),c.jsx(Rl,{label:e("cost.share_monthly"),value:r.monthly_cost_usd>0?`${(f.cost_usd/r.monthly_cost_usd*100).toFixed(1)}%`:"0.0%"})]}):c.jsx("div",{className:"mt-4",children:c.jsx(ft,{compact:!0,title:e("cost.no_model_selected"),description:e("cost.no_model_selected_desc")})})]}),c.jsxs(qe,{className:"p-4",variant:"secondary",children:[c.jsx("div",{className:"revka-kicker",children:e("cost.interpretation")}),c.jsxs("div",{className:"mt-3 space-y-3 text-sm leading-6",style:{color:"var(--revka-text-secondary)"},children:[c.jsx("p",{children:e("cost.interp_p1")}),c.jsx("p",{children:e("cost.interp_p2")})]})]})]})]})]})}function Rl({label:e,value:n}){return c.jsxs("div",{className:"rounded-[12px] border p-3",style:{borderColor:"var(--revka-border-soft)"},children:[c.jsx("div",{className:"text-[10px] font-semibold uppercase tracking-[0.14em]",style:{color:"var(--revka-text-faint)"},children:e}),c.jsx("div",{className:"mt-1 text-sm font-semibold",style:{color:"var(--revka-text-primary)"},children:n})]})}function zDe(e){switch(e){case"ok":return c.jsx(Of,{className:"h-4 w-4",style:{color:"var(--revka-status-success)"}});case"warn":return c.jsx(As,{className:"h-4 w-4",style:{color:"var(--revka-status-warning)"}});case"error":return c.jsx(ru,{className:"h-4 w-4",style:{color:"var(--revka-status-danger)"}})}}function $De(){const{t:e,tpl:n}=an(),[r,i]=b.useState(null),[s,a]=b.useState(!1),[o,l]=b.useState(null),u=async()=>{a(!0),l(null),i(null);try{i(await DZ())}catch(_){l(_ instanceof Error?_.message:e("doctor.run_failed"))}finally{a(!1)}},d=(r==null?void 0:r.filter(_=>_.severity==="ok").length)??0,p=(r==null?void 0:r.filter(_=>_.severity==="warn").length)??0,f=(r==null?void 0:r.filter(_=>_.severity==="error").length)??0,g=(r==null?void 0:r.reduce((_,x)=>{const v=x.category;return _[v]||(_[v]=[]),_[v].push(x),_},{}))??{};return c.jsxs("div",{className:"space-y-6",children:[c.jsx(oi,{kicker:e("doctor.kicker"),title:e("doctor.title"),description:e("doctor.description"),actions:c.jsxs("button",{className:"revka-button",onClick:u,disabled:s,children:[s?c.jsx(Rr,{className:"h-4 w-4 animate-spin"}):c.jsx(k0,{className:"h-4 w-4"}),e(s?"doctor.running":"doctor.run")]})}),o?c.jsx(qe,{className:"p-5",children:c.jsx(ft,{tone:"error",title:e("doctor.failed_title"),description:o})}):null,s?c.jsx(qe,{className:"p-5",children:c.jsx(ft,{tone:"loading",title:e("doctor.loading_title"),description:e("doctor.loading_desc")})}):r?c.jsx(c.Fragment,{children:c.jsxs("div",{className:"grid gap-4 lg:grid-cols-[22rem_minmax(0,1fr)]",children:[c.jsxs("div",{className:"space-y-4",children:[c.jsxs(qe,{className:"p-4",variant:"secondary",children:[c.jsx("div",{className:"revka-kicker",children:e("doctor.health_summary")}),c.jsxs("div",{className:"mt-4 grid gap-3",children:[c.jsx(Q2,{label:e("doctor.passing"),value:`${d}`,tone:"var(--revka-status-success)",icon:c.jsx(Of,{className:"h-4 w-4",style:{color:"var(--revka-status-success)"}})}),c.jsx(Q2,{label:e("doctor.warnings"),value:`${p}`,tone:"var(--revka-status-warning)",icon:c.jsx(As,{className:"h-4 w-4",style:{color:"var(--revka-status-warning)"}})}),c.jsx(Q2,{label:e("doctor.failures"),value:`${f}`,tone:"var(--revka-status-danger)",icon:c.jsx(ru,{className:"h-4 w-4",style:{color:"var(--revka-status-danger)"}})})]})]}),c.jsxs(qe,{className:"p-4",variant:"secondary",children:[c.jsx("div",{className:"revka-kicker",children:e("doctor.run_context")}),c.jsxs("div",{className:"mt-3 space-y-3 text-sm leading-6",style:{color:"var(--revka-text-secondary)"},children:[c.jsx("p",{children:e("doctor.context_p1")}),c.jsx("p",{children:e("doctor.context_p2")})]})]})]}),c.jsx("div",{className:"space-y-4",children:c.jsxs(qe,{className:"p-4",variant:"utility",children:[c.jsx("div",{className:"revka-kicker",children:e("doctor.subsystem_boards")}),c.jsx("div",{className:"mt-3 grid gap-3 md:grid-cols-2 xl:grid-cols-2",children:Object.entries(g).sort(([_],[x])=>_.localeCompare(x)).map(([_,x])=>{const v=x.filter(j=>j.severity==="ok").length,S=x.filter(j=>j.severity==="warn").length,w=x.filter(j=>j.severity==="error").length;return c.jsxs("div",{className:"rounded-[16px] border p-4",style:{borderColor:"var(--revka-border-soft)",background:"color-mix(in srgb, var(--revka-bg-panel-strong) 94%, transparent)"},children:[c.jsxs("div",{className:"flex items-start justify-between gap-3",children:[c.jsxs("div",{children:[c.jsx("div",{className:"revka-kicker",children:_}),c.jsx("div",{className:"mt-2 text-sm font-semibold",style:{color:"var(--revka-text-primary)"},children:n("doctor.checks",{count:x.length})})]}),c.jsxs("div",{className:"flex gap-2 text-[10px] font-semibold uppercase tracking-[0.12em]",children:[c.jsxs("span",{style:{color:"var(--revka-status-success)"},children:[v," ",e("doctor.ok")]}),c.jsxs("span",{style:{color:"var(--revka-status-warning)"},children:[S," ",e("doctor.warn")]}),c.jsxs("span",{style:{color:"var(--revka-status-danger)"},children:[w," ",e("doctor.fail")]})]})]}),c.jsx("div",{className:"mt-4 space-y-2",children:x.map((j,C)=>c.jsx("div",{className:"rounded-[12px] border p-3",style:{borderColor:j.severity==="ok"?"color-mix(in srgb, var(--revka-status-success) 24%, transparent)":j.severity==="warn"?"color-mix(in srgb, var(--revka-status-warning) 24%, transparent)":"color-mix(in srgb, var(--revka-status-danger) 24%, transparent)"},children:c.jsxs("div",{className:"flex items-start gap-3",children:[zDe(j.severity),c.jsxs("div",{className:"min-w-0",children:[c.jsx("div",{className:"text-sm",style:{color:"var(--revka-text-primary)"},children:j.message}),c.jsx("div",{className:"mt-1 text-[10px] font-semibold uppercase tracking-[0.14em]",style:{color:"var(--revka-text-faint)"},children:j.severity})]})]})},`${_}-${C}`))})]},_)})})]})})]})}):c.jsx(qe,{className:"p-5",children:c.jsx(ft,{title:e("doctor.system_diag_title"),description:e("doctor.system_diag_desc"),action:c.jsx(Ez,{className:"h-5 w-5",style:{color:"var(--revka-signal-network)"}})})})]})}function Q2({label:e,value:n,tone:r,icon:i}){return c.jsxs("div",{className:"rounded-[14px] border p-3",style:{borderColor:"var(--revka-border-soft)",background:"color-mix(in srgb, var(--revka-bg-panel-strong) 88%, transparent)"},children:[c.jsxs("div",{className:"flex items-center gap-2 text-[10px] font-semibold uppercase tracking-[0.14em]",style:{color:"var(--revka-text-faint)"},children:[i,e]}),c.jsx("div",{className:"mt-2 text-2xl font-semibold",style:{color:r},children:n})]})}function FDe(){const{t:e,tpl:n}=an(),[r,i]=b.useState([]),[s,a]=b.useState(!0),[o,l]=b.useState(null),[u,d]=b.useState("all"),[p,f]=b.useState(null),g=w=>{switch(w){case"Active":return{icon:no,label:e("integrations.badge.active"),color:"var(--revka-signal-selected)",border:"color-mix(in srgb, var(--revka-signal-selected) 24%, transparent)",bg:"color-mix(in srgb, var(--revka-signal-selected) 10%, transparent)"};case"Available":return{icon:A0,label:e("integrations.badge.available"),color:"var(--revka-signal-network)",border:"color-mix(in srgb, var(--revka-signal-network) 24%, transparent)",bg:"color-mix(in srgb, var(--revka-signal-network) 10%, transparent)"};case"ComingSoon":return{icon:Jx,label:e("integrations.badge.coming_soon"),color:"var(--revka-text-faint)",border:"var(--revka-border-soft)",bg:"transparent"};default:return{icon:Jx,label:w,color:"var(--revka-text-faint)",border:"var(--revka-border-soft)",bg:"transparent"}}};b.useEffect(()=>{RZ().then(i).catch(w=>l(w.message)).finally(()=>a(!1))},[]);const _=b.useMemo(()=>["all",...Array.from(new Set(r.map(w=>w.category))).sort()],[r]),x=u==="all"?r:r.filter(w=>w.category===u),v=b.useMemo(()=>x.find(w=>w.name===p)??x[0]??null,[x,p]),S=b.useMemo(()=>({active:r.filter(w=>w.status==="Active").length,available:r.filter(w=>w.status==="Available").length,comingSoon:r.filter(w=>w.status==="ComingSoon").length}),[r]);return b.useEffect(()=>{var w;x.find(j=>j.name===p)||f(((w=x[0])==null?void 0:w.name)??null)},[x,p]),c.jsxs("div",{className:"flex min-h-[calc(100vh-6rem)] flex-col gap-3 lg:h-[calc(100vh-6rem)]",children:[c.jsx(oi,{kicker:e("integrations.kicker"),title:e("integrations.title")}),o?c.jsx("div",{className:"text-sm",style:{color:"var(--revka-status-danger)"},children:o}):null,s?c.jsx("div",{className:"flex min-h-0 flex-1 items-center justify-center",children:c.jsx(ft,{tone:"loading",title:e("integrations.loading")})}):c.jsxs("div",{className:"grid gap-4 grid-cols-1 lg:min-h-0 lg:flex-1 lg:grid-cols-[18rem_minmax(0,1.15fr)_minmax(18rem,0.85fr)]",children:[c.jsxs("div",{className:"flex flex-col gap-4 lg:overflow-y-auto lg:min-h-0",children:[c.jsxs(qe,{className:"p-4",variant:"secondary",children:[c.jsx("div",{className:"revka-kicker",children:e("integrations.coverage")}),c.jsxs("div",{className:"mt-4 grid gap-3 sm:grid-cols-3 xl:grid-cols-1",children:[c.jsx(Z2,{label:e("integrations.metric.active"),value:S.active,tone:"var(--revka-signal-selected)"}),c.jsx(Z2,{label:e("integrations.metric.available"),value:S.available,tone:"var(--revka-signal-network)"}),c.jsx(Z2,{label:e("integrations.metric.coming_soon"),value:S.comingSoon,tone:"var(--revka-text-faint)"})]})]}),c.jsxs(qe,{className:"p-4",variant:"secondary",children:[c.jsx("div",{className:"revka-kicker",children:e("integrations.categories")}),c.jsx("div",{className:"mt-3 space-y-2",children:_.map(w=>{const j=w==="all"?r.length:r.filter(C=>C.category===w).length;return c.jsx("button",{type:"button",className:"w-full rounded-[14px] border px-3 py-3 text-left transition",onClick:()=>d(w),style:{borderColor:u===w?"var(--revka-border-strong)":"var(--revka-border-soft)",background:u===w?"color-mix(in srgb, var(--revka-signal-selected) 14%, var(--revka-bg-panel-strong))":"color-mix(in srgb, var(--revka-bg-panel-strong) 94%, transparent)"},children:c.jsxs("div",{className:"flex items-center justify-between gap-3",children:[c.jsx("span",{className:"text-sm font-medium capitalize",children:w==="all"?e("integrations.category_all"):w}),c.jsx("span",{className:"text-xs",style:{color:"var(--revka-text-secondary)"},children:j})]})},w)})})]})]}),c.jsxs(qe,{className:"p-5 lg:overflow-y-auto",children:[c.jsx("div",{className:"revka-kicker",children:e("integrations.workspace")}),c.jsx("h3",{className:"mt-2 text-lg font-semibold",children:u==="all"?e("integrations.all_integrations"):n("integrations.category_integrations",{category:u})}),c.jsx("div",{className:"mt-5 grid gap-3 grid-cols-1 md:grid-cols-2",children:x.length===0?c.jsx(ft,{title:e("integrations.empty_title"),description:e("integrations.empty_desc")}):x.map(w=>{const j=g(w.status),C=j.icon;return c.jsxs("button",{type:"button",className:"rounded-[16px] border p-4 text-left transition",onClick:()=>f(w.name),style:{borderColor:(v==null?void 0:v.name)===w.name?"var(--revka-border-strong)":"var(--revka-border-soft)",background:(v==null?void 0:v.name)===w.name?"color-mix(in srgb, var(--revka-signal-selected) 14%, var(--revka-bg-panel-strong))":"color-mix(in srgb, var(--revka-bg-panel-strong) 94%, transparent)"},children:[c.jsxs("div",{className:"flex items-center justify-between gap-2",children:[c.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[c.jsx(Sz,{className:"h-4 w-4 shrink-0",style:{color:"var(--revka-signal-network)"}}),c.jsx("h4",{className:"truncate text-sm font-semibold",style:{color:"var(--revka-text-primary)"},children:w.name})]}),c.jsxs("span",{className:"shrink-0 inline-flex items-center gap-1 rounded-full border px-2 py-0.5 text-[10px] font-semibold uppercase tracking-[0.12em]",style:{color:j.color,borderColor:j.border,background:j.bg},children:[c.jsx(C,{className:"h-3 w-3"}),j.label]})]}),c.jsx("p",{className:"mt-2 line-clamp-2 text-xs leading-5",style:{color:"var(--revka-text-secondary)"},children:w.description}),c.jsx("div",{className:"mt-2 text-[10px] font-semibold uppercase tracking-[0.14em]",style:{color:"var(--revka-text-faint)"},children:w.category})]},w.name)})})]}),c.jsxs("div",{className:"flex flex-col gap-4 lg:overflow-y-auto lg:min-h-0",children:[c.jsxs(qe,{className:"p-4",variant:"utility",children:[c.jsx("div",{className:"revka-kicker",children:e("integrations.selected")}),v?c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"mt-3 flex items-center gap-2",children:[c.jsx(Dee,{className:"h-4 w-4",style:{color:"var(--revka-signal-network)"}}),c.jsx("div",{className:"text-sm font-semibold",style:{color:"var(--revka-text-primary)"},children:v.name})]}),c.jsx("p",{className:"mt-3 text-sm leading-6",style:{color:"var(--revka-text-secondary)"},children:v.description}),c.jsxs("div",{className:"mt-4 space-y-3",children:[c.jsx(J2,{label:e("integrations.detail.category"),value:v.category}),c.jsx(J2,{label:e("integrations.detail.status"),value:v.status==="ComingSoon"?e("integrations.badge.coming_soon"):v.status==="Active"?e("integrations.badge.active"):e("integrations.badge.available")}),c.jsx(J2,{label:e("integrations.detail.operational_readiness"),value:v.status==="Active"?e("integrations.readiness.active"):v.status==="Available"?e("integrations.readiness.available"):e("integrations.readiness.coming_soon")})]})]}):c.jsx("div",{className:"mt-4",children:c.jsx(ft,{compact:!0,title:e("integrations.no_selected_title"),description:e("integrations.no_selected_desc")})})]}),c.jsxs(qe,{className:"p-4",variant:"secondary",children:[c.jsx("div",{className:"revka-kicker",children:e("integrations.legend")}),c.jsxs("div",{className:"mt-3 space-y-3 text-sm leading-6",style:{color:"var(--revka-text-secondary)"},children:[c.jsx("p",{children:e("integrations.legend.p1")}),c.jsx("p",{children:e("integrations.legend.p2")}),c.jsx("p",{children:e("integrations.legend.p3")})]})]})]})]})]})}function Z2({label:e,value:n,tone:r}){return c.jsxs("div",{className:"rounded-[14px] border p-3",style:{borderColor:"var(--revka-border-soft)",background:"color-mix(in srgb, var(--revka-bg-panel-strong) 88%, transparent)"},children:[c.jsx("div",{className:"text-[10px] font-semibold uppercase tracking-[0.14em]",style:{color:"var(--revka-text-faint)"},children:e}),c.jsx("div",{className:"mt-2 text-xl font-semibold",style:{color:r},children:n})]})}function J2({label:e,value:n}){return c.jsxs("div",{className:"rounded-[12px] border p-3",style:{borderColor:"var(--revka-border-soft)"},children:[c.jsx("div",{className:"text-[10px] font-semibold uppercase tracking-[0.14em]",style:{color:"var(--revka-text-faint)"},children:e}),c.jsx("div",{className:"mt-1 text-sm leading-6",style:{color:"var(--revka-text-primary)"},children:n})]})}const HDe=["Memory","Creative","Privacy","Graph","Behavioral","Other"];function WDe(){const{t:e,tpl:n}=an(),[r,i]=b.useState([]),[s,a]=b.useState(!0),[o,l]=b.useState(null),[u,d]=b.useState(null),[p,f]=b.useState(!1),[g,_]=b.useState(null),[x,v]=b.useState(""),[S,w]=b.useState(null),[j,C]=b.useState(!1),[T,E]=b.useState(!1),[A,O]=b.useState(null),[F,L]=b.useState(""),[$,z]=b.useState([]),[B,H]=b.useState(!0),[D,U]=b.useState(null),[I,X]=b.useState(""),[K,Q]=b.useState(!1),V=async()=>(a(!0),iz(!0,1,100).then(ie=>{i(ie.skills),l(he=>he&&ie.skills.some(Z=>Z.kref===he)?he:null)}).catch(()=>i([])).finally(()=>a(!1))),R=async ie=>{H(!0),U(null);try{const he=(ie==null?void 0:ie.trim())??"";let Z;he.length>1?Z=await dO(he,12):(Z=await tJ(12),Z.length===0&&(Z=await dO("agent",12))),z(Z)}catch(he){console.error("ClawHub marketplace load failed:",he),z([]),U(he instanceof Error?he.message:String(he))}finally{H(!1)}};b.useEffect(()=>{V(),R()},[]);const q=b.useMemo(()=>r.find(ie=>ie.kref===o)??null,[o,r]),W=b.useMemo(()=>!q&&!u?null:(u==null?void 0:u.kref)!==o?q:{...q,...u,deprecated:(q==null?void 0:q.deprecated)??u.deprecated,created_at:(q==null?void 0:q.created_at)??u.created_at},[u,o,q]);b.useEffect(()=>{if(!o){d(null),f(!1),_(null);return}let ie=!1;return f(!0),_(null),d(null),XZ(o).then(he=>{ie||d(he)}).catch(he=>{ie||_(he instanceof Error?he.message:String(he))}).finally(()=>{ie||f(!1)}),()=>{ie=!0}},[o]);const te=b.useMemo(()=>{const ie=x.trim().toLowerCase();return ie?r.filter(he=>he.name.toLowerCase().includes(ie)||he.description.toLowerCase().includes(ie)||he.domain.toLowerCase().includes(ie)||he.tags.some(Z=>Z.toLowerCase().includes(ie))):r},[x,r]),J=b.useMemo(()=>({total:r.length,active:r.filter(ie=>!ie.deprecated).length,deprecated:r.filter(ie=>ie.deprecated).length,domains:new Set(r.map(ie=>ie.domain)).size}),[r]),G=async ie=>{C(!0);try{if(S==="edit"&&W){const he={...ie,kref:W.kref},Z=await ZZ(he);await V(),l(Z.kref),O({tone:"success",message:n("skills.toast.updated",{name:Z.name})})}else{const Z=await QZ(ie);await V(),l(Z.kref),O({tone:"success",message:n("skills.toast.created",{name:Z.name})})}w(null)}catch(he){O({tone:"error",message:he instanceof Error?he.message:e("skills.err.save")})}finally{C(!1)}},re=async()=>{if(W)try{await JZ(W.kref,!W.deprecated),await V(),O({tone:"success",message:n(W.deprecated?"skills.toast.reenabled":"skills.toast.deprecated",{name:W.name})})}catch(ie){O({tone:"error",message:ie instanceof Error?ie.message:e("skills.err.toggle")})}},ne=async()=>{if(W){E(!0);try{const ie=W.name;await eJ(W.kref),l(null),await V(),O({tone:"success",message:n("skills.toast.deleted",{name:ie})})}catch(ie){O({tone:"error",message:ie instanceof Error?ie.message:e("skills.err.delete")})}finally{E(!1)}}},le=async ie=>{try{const he=await hO(ie);await V(),O({tone:"success",message:n("skills.toast.installed",{name:he.name})})}catch(he){O({tone:"error",message:he instanceof Error?he.message:e("skills.err.install")})}},oe=async()=>{const ie=I.trim();if(ie){Q(!0);try{const he=await hO(ie);await V(),X(""),O({tone:"success",message:n("skills.toast.installed_github",{name:he.name})})}catch(he){O({tone:"error",message:he instanceof Error?he.message:e("skills.err.install_github")})}finally{Q(!1)}}};return c.jsxs("div",{className:"flex h-[calc(100vh-6rem)] flex-col gap-3",children:[A?c.jsx(nl,{tone:A.tone,message:A.message,onDismiss:()=>O(null)}):null,c.jsx(oi,{kicker:e("skills.kicker"),title:e("skills.title"),actions:c.jsxs("button",{className:"revka-button","data-variant":"primary",onClick:()=>w("create"),children:[c.jsx(ls,{className:"h-4 w-4"}),e("skills.create_skill")]})}),c.jsxs("div",{className:"revka-skills-grid grid min-h-0 flex-1 gap-4",children:[c.jsxs("div",{className:"flex min-h-0 flex-col gap-4",children:[c.jsxs(qe,{className:"p-4",variant:"secondary",children:[c.jsx("div",{className:"revka-kicker",children:e("skills.registry_status")}),c.jsxs("div",{className:"mt-3 grid grid-cols-2 gap-2 xl:grid-cols-4",children:[c.jsx(px,{label:e("skills.summary.total"),value:J.total}),c.jsx(px,{label:e("skills.summary.active"),value:J.active}),c.jsx(px,{label:e("skills.summary.deprecated"),value:J.deprecated}),c.jsx(px,{label:e("skills.summary.domains"),value:J.domains})]})]}),c.jsxs(qe,{className:"flex min-h-0 flex-1 flex-col p-4",variant:"secondary",children:[c.jsxs("div",{className:"flex items-center justify-between gap-2",children:[c.jsx("div",{className:"revka-kicker",children:e("skills.index")}),c.jsxs("span",{className:"text-[11px]",style:{color:"var(--revka-text-faint)"},children:[te.length," / ",r.length]})]}),c.jsxs("div",{className:"relative mt-3",children:[c.jsx(Da,{className:"pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2",style:{color:"var(--revka-text-faint)"}}),c.jsx("input",{value:x,onChange:ie=>v(ie.target.value),className:"revka-input pl-10",placeholder:e("skills.search_placeholder")})]}),c.jsx("div",{className:"mt-3 min-h-0 flex-1 space-y-2 overflow-y-auto pr-1",children:s?c.jsx(ft,{compact:!0,tone:"loading",title:e("skills.loading")}):te.length===0?c.jsx(ft,{compact:!0,title:e("skills.no_skills_title"),description:e("skills.no_skills_desc")}):te.map(ie=>c.jsx("button",{type:"button",onClick:()=>l(ie.kref),className:"w-full rounded-[14px] border px-3 py-3.5 text-left transition",style:{opacity:ie.deprecated?.65:1,borderColor:ie.kref===o?"var(--revka-border-strong)":"var(--revka-border-soft)",background:ie.kref===o?"color-mix(in srgb, var(--revka-signal-selected) 14%, var(--revka-bg-panel-strong))":"color-mix(in srgb, var(--revka-bg-panel-strong) 94%, transparent)"},children:c.jsxs("div",{className:"flex items-start gap-3",children:[c.jsx("div",{className:"mt-0.5 flex h-9 w-9 shrink-0 items-center justify-center rounded-[10px]",style:{background:"color-mix(in srgb, var(--revka-signal-network) 12%, transparent)",color:"var(--revka-signal-network)"},children:c.jsx(hu,{className:"h-4 w-4"})}),c.jsxs("div",{className:"min-w-0 flex-1",children:[c.jsxs("div",{className:"flex items-start justify-between gap-2",children:[c.jsx("div",{className:"text-sm font-semibold leading-5",style:{color:"var(--revka-text-primary)"},children:ie.name}),c.jsx("span",{className:"shrink-0 rounded-full px-2 py-0.5 text-[10px] font-semibold uppercase tracking-[0.12em]",style:{background:ie.deprecated?"color-mix(in srgb, var(--revka-status-warning) 12%, transparent)":"color-mix(in srgb, var(--revka-signal-selected) 12%, transparent)",color:ie.deprecated?"var(--revka-status-warning)":"var(--revka-signal-selected)"},children:ie.deprecated?e("skills.status.deprecated"):e("skills.status.active")})]}),c.jsx("div",{className:"mt-1 text-xs",style:{color:"var(--revka-text-secondary)"},children:ie.domain}),c.jsx("div",{className:"mt-1.5 line-clamp-2 text-[11px] leading-4",style:{color:"var(--revka-text-faint)"},children:ie.description})]})]})},ie.kref))})]})]}),c.jsxs(qe,{className:"overflow-y-auto p-5",children:[c.jsx("div",{className:"revka-kicker",children:e("skills.workspace")}),c.jsx("h3",{className:"mt-2 text-lg font-semibold",children:(W==null?void 0:W.name)??e("skills.select_placeholder")}),W?c.jsxs("div",{className:"mt-4 space-y-4",children:[c.jsxs("div",{className:"flex items-start justify-between gap-3",children:[c.jsxs("div",{children:[c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx(hu,{className:"h-4 w-4",style:{color:"var(--revka-signal-network)"}}),c.jsx("div",{className:"text-sm font-semibold",style:{color:"var(--revka-text-primary)"},children:W.name})]}),c.jsxs("div",{className:"mt-1 text-xs",style:{color:"var(--revka-text-secondary)"},children:[W.domain," · rev ",W.revision_number," · ",new Date(W.created_at).toLocaleDateString()]})]}),c.jsx("span",{className:"rounded-full px-2.5 py-1 text-[10px] font-semibold uppercase tracking-[0.12em]",style:{background:W.deprecated?"color-mix(in srgb, var(--revka-status-warning) 12%, transparent)":"color-mix(in srgb, var(--revka-signal-selected) 12%, transparent)",color:W.deprecated?"var(--revka-status-warning)":"var(--revka-signal-selected)"},children:W.deprecated?e("skills.status.deprecated"):e("skills.status.active")})]}),c.jsxs("div",{className:"flex flex-wrap gap-2",children:[c.jsx("span",{className:"rounded-full px-2.5 py-1 text-[10px] font-semibold uppercase tracking-[0.12em]",style:{background:"var(--revka-signal-selected-soft, color-mix(in srgb, var(--revka-signal-selected) 18%, transparent))",color:"var(--revka-signal-selected)"},children:W.domain}),W.tags.map(ie=>c.jsx("span",{className:"rounded-full border px-2 py-1 text-[10px] font-semibold uppercase tracking-[0.12em]",style:{borderColor:"var(--revka-border-soft)",color:"var(--revka-text-secondary)"},children:ie},ie))]}),c.jsxs(qe,{className:"p-4",variant:"utility",children:[c.jsx("div",{className:"revka-kicker",children:e("skills.description")}),c.jsx("div",{className:"mt-3 text-sm leading-6",style:{color:"var(--revka-text-secondary)"},children:W.description})]}),c.jsxs("div",{children:[c.jsx("div",{className:"revka-kicker",children:e("skills.content")}),p?c.jsx("div",{className:"mt-2 rounded-[14px] border p-4",style:{borderColor:"var(--revka-border-soft)",background:"color-mix(in srgb, var(--revka-bg-panel-strong) 94%, transparent)"},children:c.jsx(ft,{compact:!0,tone:"loading",title:e("skills.loading")})}):g?c.jsx("div",{className:"mt-2 rounded-[14px] border p-4",style:{borderColor:"var(--revka-border-soft)",background:"color-mix(in srgb, var(--revka-bg-panel-strong) 94%, transparent)"},children:c.jsx(ft,{compact:!0,tone:"error",title:e("skills.err.load_detail"),description:g})}):u!=null&&u.content.trim()?c.jsx("div",{className:"chat-markdown mt-2 max-h-[24rem] overflow-auto rounded-[14px] border p-4 text-sm leading-6",style:{borderColor:"var(--revka-border-soft)",color:"var(--revka-text-secondary)",background:"color-mix(in srgb, var(--revka-bg-panel-strong) 94%, transparent)"},children:c.jsx(xA,{remarkPlugins:[SA],children:u.content})}):c.jsx("div",{className:"mt-2 rounded-[14px] border p-4",style:{borderColor:"var(--revka-border-soft)",background:"color-mix(in srgb, var(--revka-bg-panel-strong) 94%, transparent)"},children:c.jsx(ft,{compact:!0,title:e("skills.content"),description:e("skills.content_empty")})})]}),c.jsxs("div",{className:"flex gap-2",children:[c.jsxs("button",{className:"revka-button",onClick:()=>w("edit"),disabled:p||!u,children:[c.jsx(Sv,{className:"h-4 w-4"}),e("skills.edit")]}),c.jsxs("button",{className:"revka-button",onClick:re,children:[c.jsx(w0,{className:"h-4 w-4"}),W.deprecated?e("skills.reenable"):e("skills.deprecate")]}),c.jsxs("button",{className:"revka-button",onClick:ne,disabled:T,children:[c.jsx(Ki,{className:"h-4 w-4"}),e(T?"skills.deleting":"skills.delete")]})]})]}):c.jsx("div",{className:"mt-4",children:c.jsx(ft,{title:e("skills.no_selected_title"),description:e("skills.no_selected_desc")})})]}),c.jsxs("div",{className:"flex min-h-0 flex-col gap-4",children:[c.jsxs(qe,{className:"p-4",variant:"utility",children:[c.jsx("div",{className:"revka-kicker",children:e("skills.install_github")}),c.jsx("p",{className:"mt-2 text-xs leading-5",style:{color:"var(--revka-text-secondary)"},children:e("skills.install_github_desc")}),c.jsxs("div",{className:"mt-3 flex gap-2",children:[c.jsxs("div",{className:"relative min-w-0 flex-1",children:[c.jsx(mz,{className:"pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2",style:{color:"var(--revka-text-faint)"}}),c.jsx("input",{className:"revka-input pl-10",value:I,onChange:ie=>X(ie.target.value),onKeyDown:ie=>{ie.key==="Enter"&&oe()},placeholder:e("skills.github_placeholder")})]}),c.jsx("button",{className:"revka-button shrink-0","data-variant":"primary",disabled:!I.trim()||K,onClick:oe,children:e(K?"skills.installing":"skills.install")})]})]}),c.jsxs(qe,{className:"flex min-h-0 flex-1 flex-col p-4",variant:"utility",children:[c.jsxs("div",{className:"flex items-center justify-between gap-3",children:[c.jsx("div",{className:"revka-kicker",children:e("skills.marketplace")}),c.jsx("div",{className:"text-xs",style:{color:"var(--revka-text-secondary)"},children:n("skills.marketplace_shown",{count:$.length})})]}),c.jsxs("div",{className:"relative mt-3",children:[c.jsx(Da,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2",style:{color:"var(--revka-text-faint)"}}),c.jsx("input",{className:"revka-input pl-10",value:F,onChange:ie=>L(ie.target.value),onKeyDown:ie=>{ie.key==="Enter"&&R(F)},placeholder:e("skills.marketplace_placeholder")})]}),c.jsxs("div",{className:"mt-3 flex gap-2",children:[c.jsx("button",{className:"revka-button",onClick:()=>R(F),children:e("skills.search")}),c.jsx("button",{className:"revka-button",onClick:()=>{L(""),R()},children:e("skills.trending")})]}),c.jsx("div",{className:"mt-3 min-h-0 flex-1 space-y-2 overflow-y-auto pr-1",children:B?c.jsx(ft,{compact:!0,tone:"loading",title:e("skills.marketplace_loading")}):D?c.jsx(ft,{compact:!0,tone:"error",title:e("skills.marketplace_empty"),description:D}):$.length===0?c.jsx(ft,{compact:!0,title:e("skills.marketplace_empty")}):$.map(ie=>c.jsx("div",{className:"rounded-[12px] border p-3",style:{borderColor:"var(--revka-border-soft)"},children:c.jsxs("div",{className:"flex items-start justify-between gap-2",children:[c.jsxs("div",{className:"min-w-0 flex-1",children:[c.jsx("div",{className:"truncate text-sm font-semibold",style:{color:"var(--revka-text-primary)"},children:ie.displayName||ie.name||ie.slug}),c.jsx("div",{className:"mt-1 line-clamp-2 text-xs",style:{color:"var(--revka-text-secondary)"},children:ie.description})]}),c.jsx("button",{className:"revka-button shrink-0",onClick:()=>le(ie.slug),children:e("skills.install")})]})},ie.slug))})]})]})]}),S?c.jsx(qDe,{skill:S==="edit"?W:null,saving:j,onClose:()=>w(null),onSave:G}):null]})}function px({label:e,value:n}){return c.jsxs("div",{className:"rounded-[14px] border p-3",style:{borderColor:"var(--revka-border-soft)",background:"color-mix(in srgb, var(--revka-bg-panel-strong) 88%, transparent)"},children:[c.jsx("div",{className:"text-[10px] font-semibold uppercase tracking-[0.14em]",style:{color:"var(--revka-text-faint)"},children:e}),c.jsx("div",{className:"mt-2 text-xl font-semibold",style:{color:"var(--revka-text-primary)"},children:n})]})}function qDe({skill:e,saving:n,onClose:r,onSave:i}){const{t:s}=an(),[a,o]=b.useState((e==null?void 0:e.name)??""),[l,u]=b.useState((e==null?void 0:e.description)??""),[d,p]=b.useState((e==null?void 0:e.content)??""),[f,g]=b.useState((e==null?void 0:e.domain)??"Other"),[_,x]=b.useState((e==null?void 0:e.tags.join(", "))??"");return b.useEffect(()=>{o((e==null?void 0:e.name)??""),u((e==null?void 0:e.description)??""),p((e==null?void 0:e.content)??""),g((e==null?void 0:e.domain)??"Other"),x((e==null?void 0:e.tags.join(", "))??"")},[e==null?void 0:e.content,e==null?void 0:e.description,e==null?void 0:e.domain,e==null?void 0:e.name,e==null?void 0:e.tags]),c.jsx(Nu,{title:s(e?"skills.modal.edit_title":"skills.modal.create_title"),description:s("skills.modal.description"),onClose:r,children:c.jsxs("div",{className:"grid gap-4",children:[c.jsx("input",{className:"revka-input",value:a,onChange:v=>o(v.target.value),placeholder:s("skills.modal.name_placeholder")}),c.jsx("textarea",{className:"revka-input min-h-24",value:l,onChange:v=>u(v.target.value),placeholder:s("skills.modal.description_placeholder")}),c.jsx("select",{className:"revka-input",value:f,onChange:v=>g(v.target.value),children:HDe.map(v=>c.jsx("option",{value:v,children:v},v))}),c.jsx("input",{className:"revka-input",value:_,onChange:v=>x(v.target.value),placeholder:s("skills.modal.tags_placeholder")}),c.jsx("textarea",{className:"revka-input min-h-72",value:d,onChange:v=>p(v.target.value),placeholder:s("skills.modal.content_placeholder"),style:{fontFamily:"var(--pc-font-mono)"}}),c.jsxs("div",{className:"flex justify-end gap-3",children:[c.jsx("button",{className:"revka-button",onClick:r,children:s("skills.modal.cancel")}),c.jsx("button",{className:"revka-button","data-variant":"primary",disabled:!a.trim()||!l.trim()||!d.trim()||n,onClick:()=>i({name:a.trim(),description:l.trim(),content:d,domain:f,tags:_.split(",").map(v=>v.trim()).filter(Boolean)}),children:s(n?"skills.modal.saving":e?"skills.modal.save_skill":"skills.create_skill")})]})]})})}function ZV(e){return e instanceof Error?e.message:String(e)}function H8({skin:e,mode:n}){const r=e.manifest.modes[n],i=(r==null?void 0:r.tokens)??{},s=(r==null?void 0:r.assets)??{},a=r!=null&&r.preview?tg(e.id,r.preview):s.dashboardShowcase?tg(e.id,s.dashboardShowcase):s.dashboardHero?tg(e.id,s.dashboardHero):null,o=i["--revka-bg-base"]??(n==="light"?"#eef1f5":"#0b0d10"),l=i["--revka-bg-surface"]??(n==="light"?"#f7f9fb":"#13161d"),u=i["--revka-text-primary"]??(n==="light"?"#111827":"#f7f8fc"),d=i["--revka-signal-live"]??(n==="light"?"#4f75a8":"#8fa8c8");return c.jsxs("div",{className:"overflow-hidden rounded-[12px] border",style:{borderColor:"var(--revka-border-soft)",background:o,color:u},children:[c.jsx("div",{className:"h-20 bg-cover bg-center",style:{backgroundImage:a?`url("${a.replace(/"/g,"%22")}")`:`linear-gradient(135deg, ${d}33, transparent)`}}),c.jsxs("div",{className:"space-y-2 p-3",style:{background:l},children:[c.jsxs("div",{className:"flex items-center justify-between gap-2",children:[c.jsx("span",{className:"text-xs font-semibold uppercase tracking-[0.14em]",children:n}),c.jsx("span",{className:"h-3 w-3 rounded-full",style:{background:d}})]}),c.jsx("div",{className:"grid grid-cols-4 gap-1.5",children:Object.entries(i).slice(0,4).map(([p,f])=>c.jsx("span",{className:"h-5 rounded-[6px] border",style:{background:f,borderColor:"rgba(0,0,0,0.08)"},title:`${p}: ${f}`},p))})]})]})}function UDe({skin:e}){const{activeSkinId:n,setSkin:r,deleteSkin:i}=Pa(),[s,a]=b.useState(!1),[o,l]=b.useState(null),u=n===e.id,d=async()=>{a(!0),l(null);try{await i(e.id)}catch(p){l(ZV(p))}finally{a(!1)}};return c.jsx(qe,{className:"p-4",children:c.jsxs("div",{className:"flex flex-col gap-4",children:[c.jsxs("div",{className:"flex items-start justify-between gap-3",children:[c.jsxs("div",{className:"min-w-0",children:[c.jsx("div",{className:"revka-kicker",children:e.id}),c.jsx("h3",{className:"mt-1 truncate text-lg font-semibold",style:{color:"var(--revka-text-primary)"},children:e.name}),c.jsxs("p",{className:"mt-1 text-xs",style:{color:"var(--revka-text-faint)"},children:["v",e.version,e.builtin?" · Built-in":""]})]}),u?c.jsxs("span",{className:"revka-status-pill",style:{color:"var(--revka-signal-live)"},children:[c.jsx(no,{className:"h-3.5 w-3.5"}),"Active"]}):null]}),c.jsxs("div",{className:"grid gap-3 md:grid-cols-2",children:[c.jsx(H8,{skin:e,mode:"light"}),c.jsx(H8,{skin:e,mode:"dark"})]}),o?c.jsx("div",{className:"rounded-[10px] border px-3 py-2 text-sm",style:{borderColor:"var(--revka-status-danger)",color:"var(--revka-status-danger)"},children:o}):null,c.jsxs("div",{className:"flex flex-wrap gap-2",children:[c.jsxs("button",{type:"button",className:"revka-button text-sm",onClick:()=>r(u?null:e.id),disabled:s,children:[u?c.jsx(zE,{className:"h-4 w-4"}):c.jsx(no,{className:"h-4 w-4"}),u?"Deactivate":"Activate"]}),e.builtin?null:c.jsxs("button",{type:"button",className:"revka-button text-sm",onClick:d,disabled:s,children:[c.jsx(Ki,{className:"h-4 w-4"}),"Delete"]})]})]})})}function KDe(){const{installedSkins:e,skinsLoading:n,importSkinZip:r,refreshSkins:i}=Pa(),[s,a]=b.useState(!1),[o,l]=b.useState(!1),[u,d]=b.useState(null),p=b.useCallback(async g=>{if(g){l(!0),d(null);try{await r(g)}catch(_){d(ZV(_))}finally{l(!1)}}},[r]),f=g=>{g.preventDefault(),a(!1),p(g.dataTransfer.files[0])};return c.jsxs("div",{className:"space-y-4",children:[c.jsx(oi,{kicker:"Appearance",title:"Skins",actions:c.jsxs("button",{type:"button",className:"revka-button text-sm",onClick:()=>void i(),disabled:n,children:[c.jsx($r,{className:`h-4 w-4 ${n?"animate-spin":""}`}),"Refresh"]})}),c.jsxs(qe,{className:"p-5",children:[c.jsxs("label",{className:"flex min-h-36 cursor-pointer flex-col items-center justify-center rounded-[12px] border border-dashed px-4 py-6 text-center transition",style:{borderColor:s?"var(--revka-border-strong)":"var(--revka-border-soft)",background:s?"var(--revka-signal-live-soft)":"var(--revka-bg-surface)"},onDragEnter:g=>{g.preventDefault(),a(!0)},onDragOver:g=>g.preventDefault(),onDragLeave:()=>a(!1),onDrop:f,children:[c.jsx(fee,{className:"h-7 w-7",style:{color:"var(--revka-signal-network)"}}),c.jsx("span",{className:"mt-3 text-sm font-semibold",style:{color:"var(--revka-text-primary)"},children:o?"Importing ZIP...":"Upload skin ZIP"}),c.jsx("span",{className:"mt-1 text-xs",style:{color:"var(--revka-text-faint)"},children:"revka-skin.json, tokens, and local image assets"}),c.jsx("input",{className:"sr-only",type:"file",accept:".zip,application/zip",disabled:o,onChange:g=>{var _;p((_=g.currentTarget.files)==null?void 0:_[0]),g.currentTarget.value=""}})]}),u?c.jsx("div",{className:"mt-4 rounded-[10px] border px-3 py-2 text-sm",style:{borderColor:"var(--revka-status-danger)",color:"var(--revka-status-danger)"},"aria-live":"polite",children:u}):null]}),c.jsx("div",{className:"grid gap-4 xl:grid-cols-2",children:e.map(g=>c.jsx(UDe,{skin:g},g.id))}),!n&&e.length===0?c.jsx(qe,{className:"p-5",variant:"utility",children:c.jsx("div",{className:"text-sm",style:{color:"var(--revka-text-secondary)"},children:"No skins installed."})}):null]})}function W8(e){let n=!1,r=!1;for(let i=0;i<e.length;i+=1){const s=e[i];if(s==="'"&&!r)n=!n;else if(s==='"'&&!n)r=!r;else if(s==="#"&&!n&&!r)return e.slice(0,i).trimEnd()}return e}function eg(e){const n=e.trim();return n==="true"?!0:n==="false"?!1:/^-?\d+$/.test(n)?parseInt(n,10):/^-?\d+\.\d+$/.test(n)?parseFloat(n):n.startsWith('"')&&n.endsWith('"')||n.startsWith("'")&&n.endsWith("'")?n.slice(1,-1):n}function VDe(e){const n=e.trim();if(!n.startsWith("[")||!n.endsWith("]"))return[];const r=n.slice(1,-1).trim();return r?r.split(",").map(i=>{const s=i.trim();return s.startsWith('"')&&s.endsWith('"')||s.startsWith("'")&&s.endsWith("'")?s.slice(1,-1):s}).filter(i=>i.length>0):[]}function q8(e){const n=e.trim();if(!n.startsWith("{")||!n.endsWith("}"))return{};const r=n.slice(1,-1).trim();if(!r)return{};const i={},s=[];let a="",o=!1,l=!1;for(let u=0;u<r.length;u+=1){const d=r[u];d==="'"&&!l?o=!o:d==='"'&&!o&&(l=!l),d===","&&!o&&!l?(s.push(a),a=""):a+=d}a.trim()&&s.push(a);for(const u of s){const d=u.indexOf("=");if(d===-1)continue;const p=u.slice(0,d).trim(),f=u.slice(d+1).trim(),g=eg(f);i[p]=typeof g=="string"?g:String(g)}return i}function vf(e){return`"${e.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`}function YDe(e){return e.length===0?"[]":`[${e.map(vf).join(", ")}]`}function U8(e){const n=Object.entries(e).filter(([r])=>r.length>0);return n.length===0?"{}":`{ ${n.map(([r,i])=>`${r} = ${vf(i)}`).join(", ")} }`}function GDe(e){const n=e.split(`
`),r={enabled:!1,deferred_loading:!1,servers:[]};let i="none",s=null;const a=()=>{if(s){const o=s.transport??"stdio";r.servers.push({...s,name:s.name??"",transport:o})}s=null};for(let o=0;o<n.length;o+=1){const u=n[o].trim();if(!u||u.startsWith("#"))continue;if(u==="[[mcp.servers]]"){a(),i="server",s={};continue}const d=u.match(/^\[([^\]]+)\]$/);if(d){a(),i=d[1].trim()==="mcp"?"mcp":"none";continue}if(i==="none")continue;const p=u.match(/^([A-Za-z0-9_\-.]+)\s*=\s*(.+)$/);if(!p)continue;const f=p[1];let g=W8(p[2]);if(g.trim().startsWith("[")&&!g.trim().endsWith("]")){let _=g.trim();for(let x=o+1;x<n.length;x+=1){o=x;const v=W8(n[x]).trim();if(_+=` ${v}`,v.endsWith("]"))break}g=_}if(i==="mcp"){if(f==="enabled"){const _=eg(g);r.enabled=_===!0}else if(f==="deferred_loading"){const _=eg(g);r.deferred_loading=_===!0}continue}if(i==="server"&&s)switch(f){case"name":case"command":case"url":case"transport":{const _=eg(g);s[f]=typeof _=="string"?_:String(_);break}case"args":{s.args=VDe(g);break}case"timeout_ms":{const _=eg(g);typeof _=="number"&&(s.timeout_ms=_);break}case"env":{s.env=q8(g);break}case"headers":{s.headers=q8(g);break}}}return a(),r}function XDe(e){const n=e.split(`
`);let r=-1,i=n.length;for(let l=0;l<n.length;l+=1){const u=n[l].trim();(u==="[mcp]"||u==="[[mcp.servers]]")&&r===-1&&(r=l)}if(r===-1)return{before:e,after:""};for(let l=r+1;l<n.length;l+=1){const d=n[l].trim().match(/^\[\[?([^\]]+)\]?\]$/);if(d){const p=d[1].trim();if(p!=="mcp"&&!p.startsWith("mcp.")){i=l;break}}}let s=r;for(;s>0&&n[s-1].trim()==="";)s-=1;const a=n.slice(0,s).join(`
`),o=n.slice(i).join(`
`);return{before:a,after:o}}function QDe(e){const n=[];n.push("[mcp]"),n.push(`enabled = ${e.enabled?"true":"false"}`),n.push(`deferred_loading = ${e.deferred_loading?"true":"false"}`);for(const r of e.servers)n.push(""),n.push("[[mcp.servers]]"),n.push(`name = ${vf(r.name)}`),n.push(`transport = ${vf(r.transport)}`),r.transport==="stdio"?(r.command!==void 0&&n.push(`command = ${vf(r.command)}`),r.args&&r.args.length>0&&n.push(`args = ${YDe(r.args)}`),r.env&&Object.keys(r.env).length>0&&n.push(`env = ${U8(r.env)}`)):(r.url!==void 0&&n.push(`url = ${vf(r.url)}`),r.headers&&Object.keys(r.headers).length>0&&n.push(`headers = ${U8(r.headers)}`),typeof r.timeout_ms=="number"&&n.push(`timeout_ms = ${r.timeout_ms}`));return n.join(`
`)}function ZDe(e,n){const{before:r,after:i}=XDe(e),s=QDe(n),a=[];r.trim().length>0&&(a.push(r.replace(/\s+$/,"")),a.push("")),a.push(s),i.trim().length>0&&(a.push(""),a.push(i.replace(/^\s+/,"")));let o=a.join(`
`);return o.endsWith(`
`)||(o+=`
`),o}function JDe(e){const n={},r=new Map;return e.forEach((i,s)=>{const a={},o=i.name.trim();o?r.has(o)?a.name=`Duplicate name (also used by entry ${r.get(o)+1})`:r.set(o,s):a.name="Name is required",i.transport==="stdio"?(!i.command||!i.command.trim())&&(a.command="Command is required for stdio transport"):(!i.url||!i.url.trim())&&(a.url="URL is required for http/sse transport"),(a.name||a.command||a.url)&&(n[s]=a)}),n}function ePe(e){return Object.keys(e).length>0}function JV(e){let n=!1,r=!1;for(let i=0;i<e.length;i+=1){const s=e[i];if(s==="'"&&!r)n=!n;else if(s==='"'&&!n)r=!r;else if(s==="#"&&!n&&!r)return i}return-1}function tPe(e){const n=e.trim();if(n==="true")return!0;if(n==="false")return!1;if(/^-?\d+$/.test(n))return parseInt(n,10);if(/^-?\d+\.\d+$/.test(n))return parseFloat(n);if(n.startsWith('"')&&n.endsWith('"')||n.startsWith("'")&&n.endsWith("'"))return n.slice(1,-1);if(n.startsWith("[")&&n.endsWith("]")){const r=n.slice(1,-1).trim();return r?r.split(",").map(i=>{const s=i.trim();return s.startsWith('"')&&s.endsWith('"')||s.startsWith("'")&&s.endsWith("'")?s.slice(1,-1):s}):[]}return n}function nPe(e){const n={"":{}};let r="";const i=e.split(`
`);for(let a=0;a<i.length;a+=1){const o=i[a].trim();if(!o||o.startsWith("#"))continue;const l=o.match(/^\[([^\]]+)\]$/);if(l){r=l[1].trim(),n[r]||(n[r]={});continue}const u=o.match(/^([A-Za-z0-9_\-.]+)\s*=\s*(.+)$/);if(!u)continue;const d=u[1];let p=u[2];const f=JV(p);f!==-1&&(p=p.slice(0,f).trimEnd());const g=p.trim();if(g.startsWith("[")&&!g.includes("]")){let _=g;for(let x=a+1;x<i.length;x+=1){a=x;const v=i[x].trim();if(_+=` ${v}`,v.endsWith("]"))break}p=_}n[r]||(n[r]={}),n[r][d]=tPe(p)}const s={};Object.assign(s,n[""]??{});for(const[a,o]of Object.entries(n)){if(a==="")continue;const l=a.split(".");let u=s;for(let d=0;d<l.length;d+=1){const p=l[d];d===l.length-1?((!u[p]||typeof u[p]!="object")&&(u[p]={}),Object.assign(u[p],o)):((!u[p]||typeof u[p]!="object")&&(u[p]={}),u=u[p])}}return s}function K8(e){const n=e.trim();return n==="true"||n==="false"?`<span style="color:var(--revka-signal-selected)">${e}</span>`:/^-?\d[\d_]*(\.[\d_]*)?([eE][+-]?\d+)?$/.test(n)?`<span style="color:var(--revka-status-warning)">${e}</span>`:n.startsWith('"')||n.startsWith("'")?`<span style="color:var(--revka-status-success)">${e}</span>`:n.startsWith("[")||n.startsWith("{")?`<span style="color:var(--revka-text-primary)">${e}</span>`:e}function rPe(e){const n=e.trim(),r=JV(n);if(r!==-1){const i=n.slice(0,r).trimEnd(),s=`<span style="color:#6b7280;font-style:italic">${n.slice(r)}</span>`;return`${e.slice(0,e.indexOf(n))}${K8(i)} ${s}`}return K8(e)}function iPe(e){const n=[];for(const r of e.split(`
`)){const i=r.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;");if(/^\s*\[/.test(i)){n.push(`<span style="color:var(--revka-signal-network);font-weight:600">${i}</span>`);continue}if(/^\s*#/.test(i)){n.push(`<span style="color:#6b7280;font-style:italic">${i}</span>`);continue}const s=i.match(/^(\s*)([A-Za-z0-9_\-.]+)(\s*=\s*)(.*)$/);if(s){const[,a,o,l,u]=s;n.push(`${a}<span style="color:var(--revka-signal-selected)">${o}</span><span style="color:var(--revka-text-faint)">${l}</span>${rPe(u??"")}`);continue}n.push(i)}return`${n.join(`
`)}
`}function sPe(e){return typeof e=="boolean"?e?"true":"false":typeof e=="number"?String(e):JSON.stringify(e)}function aPe(e,n,r,i){var d;const s=e.split(`
`),a=`${r} = ${sPe(i)}`;if(!n){const p=s.findIndex(g=>g.trim().startsWith("[")),f=p===-1?s.length:p;for(let g=0;g<f;g+=1)if(new RegExp(`^\\s*${r}\\s*=`).test(s[g]??""))return s[g]=a,s.join(`
`);return s.splice(f,0,a),s.join(`
`)}const o=`[${n}]`,l=s.findIndex(p=>p.trim()===o);if(l===-1){const p=e.endsWith(`
`)||e.length===0?"":`
`;return`${e}${p}${e.trim()?`
`:""}${o}
${a}
`}let u=s.length;for(let p=l+1;p<s.length;p+=1)if((d=s[p])!=null&&d.trim().startsWith("[")){u=p;break}for(let p=l+1;p<u;p+=1)if(new RegExp(`^\\s*${r}\\s*=`).test(s[p]??""))return s[p]=a,s.join(`
`);return s.splice(u,0,a),s.join(`
`)}function Kh(e){return e.filter(n=>n!==void 0&&n!=="").length}function eY(e){return e==null||e===""?0:Array.isArray(e)?e.length>0?1:0:typeof e=="object"?Object.values(e).reduce((n,r)=>n+eY(r),0):1}const oPe=new Set(["agent","memory","kumiho","gateway","autonomy","security","cost","channels_config","mcp","operator"]);function lPe(e){if(!e)return[];const n=[];for(const[r,i]of Object.entries(e))oPe.has(r)||i===null||typeof i!="object"||Array.isArray(i)||n.push({id:`ext:${r}`,path:r,data:i});return n.sort((r,i)=>r.path.localeCompare(i.path))}function cPe(e,n,r,i,s){var l,u,d,p,f,g,_,x,v,S,w,j,C,T,E,A,O,F,L,$,z,B,H,D,U,I,X,K,Q,V,R;const a=[{id:"provider",title:i("config.section.provider"),description:i("config.section.provider_desc"),populatedCount:Kh([e==null?void 0:e.default_provider,e==null?void 0:e.default_model,e==null?void 0:e.default_temperature,e==null?void 0:e.provider_timeout_secs,e==null?void 0:e.provider_max_tokens]),paths:["default_provider","default_model","default_temperature","provider_timeout_secs","provider_max_tokens"]},{id:"agent",title:i("config.section.agent"),description:i("config.section.agent_desc"),populatedCount:Kh([(l=e==null?void 0:e.agent)==null?void 0:l.max_tool_iterations,(u=e==null?void 0:e.agent)==null?void 0:u.max_context_tokens,(d=e==null?void 0:e.agent)==null?void 0:d.max_history_messages,(f=(p=e==null?void 0:e.agent)==null?void 0:p.model_context_windows)==null?void 0:f["gpt-5_5"],(g=e==null?void 0:e.agent)==null?void 0:g.context_window_safety_ratio,(_=e==null?void 0:e.agent)==null?void 0:_.parallel_tools,(v=(x=e==null?void 0:e.agent)==null?void 0:x.thinking)==null?void 0:v.default_level]),paths:["agent.max_tool_iterations","agent.max_context_tokens","agent.max_history_messages","agent.model_context_windows","agent.context_window_safety_ratio","agent.parallel_tools","agent.thinking.default_level"]},{id:"memory",title:i("config.section.memory"),description:i("config.section.memory_desc"),populatedCount:Kh([(S=e==null?void 0:e.memory)==null?void 0:S.backend,(w=e==null?void 0:e.memory)==null?void 0:w.auto_save,(j=e==null?void 0:e.memory)==null?void 0:j.snapshot_enabled,(C=e==null?void 0:e.kumiho)==null?void 0:C.enabled,(T=e==null?void 0:e.kumiho)==null?void 0:T.memory_project,(E=e==null?void 0:e.kumiho)==null?void 0:E.memory_retrieval_limit]),paths:["memory.backend","memory.auto_save","memory.snapshot_enabled","kumiho.enabled","kumiho.memory_project","kumiho.harness_project","kumiho.memory_retrieval_limit"]},{id:"runtime",title:i("config.section.runtime"),description:i("config.section.runtime_desc"),populatedCount:Kh([(A=e==null?void 0:e.gateway)==null?void 0:A.host,(O=e==null?void 0:e.gateway)==null?void 0:O.port,(F=e==null?void 0:e.gateway)==null?void 0:F.require_pairing,(L=e==null?void 0:e.autonomy)==null?void 0:L.level,($=e==null?void 0:e.autonomy)==null?void 0:$.max_actions_per_hour]),paths:["gateway.host","gateway.port","gateway.require_pairing","gateway.session_persistence","autonomy.level","autonomy.max_actions_per_hour"]},{id:"security",title:i("config.section.security"),description:i("config.section.security_desc"),populatedCount:Kh([(B=(z=e==null?void 0:e.security)==null?void 0:z.audit)==null?void 0:B.enabled,(D=(H=e==null?void 0:e.security)==null?void 0:H.sandbox)==null?void 0:D.backend,(U=e==null?void 0:e.cost)==null?void 0:U.daily_limit_usd,(I=e==null?void 0:e.cost)==null?void 0:I.monthly_limit_usd,(X=e==null?void 0:e.cost)==null?void 0:X.warn_at_percent]),paths:["security.audit.enabled","security.sandbox.backend","cost.daily_limit_usd","cost.monthly_limit_usd","cost.warn_at_percent"]},{id:"channels",title:i("config.section.channels"),description:i("config.section.channels_desc"),populatedCount:Kh([(K=e==null?void 0:e.channels_config)==null?void 0:K.cli,(Q=e==null?void 0:e.channels_config)==null?void 0:Q.ack_reactions,(V=e==null?void 0:e.channels_config)==null?void 0:V.show_tool_calls,(R=e==null?void 0:e.channels_config)==null?void 0:R.message_timeout_secs]),paths:["channels_config.cli","channels_config.ack_reactions","channels_config.show_tool_calls","channels_config.message_timeout_secs"]},{id:"mcp",title:i("config.section.mcp"),description:i("config.section.mcp_desc"),populatedCount:(r?1:0)+n,paths:["mcp.enabled","mcp.deferred_loading","mcp.servers[]"]}],o=s.map(q=>({id:q.id,title:`[${q.path}]`,description:i("config.section.extra_desc"),populatedCount:eY(q.data),paths:[q.path]}));return[...a,...o]}function uPe(){var H,D,U,I,X,K,Q,V,R,q,W,te,J,G,re,ne,le,oe,ie,he,Z,de,ue,pe,Oe,fe,Le,Ee,Bt;const{t:e,tpl:n}=an(),[r,i]=b.useState(""),[s,a]=b.useState(!0),[o,l]=b.useState(!1),[u,d]=b.useState(!0),[p,f]=b.useState("structured"),[g,_]=b.useState("provider"),[x,v]=b.useState(null),S=b.useRef(e);S.current=e;const w=b.useCallback(async()=>{a(!0);try{const Xe=await _Z();i(Xe)}catch(Xe){v({tone:"error",message:Xe instanceof Error?Xe.message:S.current("config.err.load")})}finally{a(!1)}},[]);b.useEffect(()=>{w()},[w]);const j=b.useDeferredValue(r),C=b.useMemo(()=>{try{return nPe(j)}catch{return null}},[j]),T=b.useMemo(()=>{try{return GDe(j)}catch{return{enabled:!1,deferred_loading:!1,servers:[]}}},[j]),E=b.useMemo(()=>JDe(T.servers),[T.servers]),A=b.useMemo(()=>iPe(j),[j]),O=b.useMemo(()=>lPe(C),[C]),F=b.useMemo(()=>cPe(C,T.servers.length,T.enabled,e,O),[C,T.servers.length,T.enabled,e,O]),L=F.find(Xe=>Xe.id===g)??F[0],$=async()=>{if(ePe(E)){v({tone:"error",message:e("config.err.mcp_errors")}),_("mcp");return}l(!0);try{await xZ(r),v({tone:"success",message:e("config.toast.saved")})}catch(Xe){v({tone:"error",message:Xe instanceof Error?Xe.message:e("config.err.save")})}finally{l(!1)}},z=(Xe,St,yt)=>{i(Rt=>aPe(Rt,Xe,St,yt))},B=Xe=>{i(St=>ZDe(St,Xe))};return c.jsxs("div",{className:"flex min-h-[calc(100vh-6rem)] flex-col gap-3 md:h-[calc(100vh-6rem)]",children:[x?c.jsx(nl,{tone:x.tone,message:x.message,onDismiss:()=>v(null)}):null,c.jsx(oi,{kicker:e("config.kicker"),title:e("config.page_title"),actions:c.jsxs(c.Fragment,{children:[c.jsxs("button",{className:"revka-button",onClick:()=>void w(),children:[c.jsx($r,{className:`h-4 w-4 ${s?"animate-spin":""}`}),e("config.reload")]}),c.jsxs("button",{className:"revka-button","data-variant":"primary",onClick:$,disabled:o||s,children:[c.jsx(KE,{className:"h-4 w-4"}),e(o?"config.saving_button":"config.save_button")]})]})}),s?c.jsx("div",{className:"flex min-h-0 flex-1 items-center justify-center",children:c.jsx(ft,{tone:"loading",title:e("config.loading_title")})}):c.jsxs("div",{className:"grid gap-4 grid-cols-1 md:min-h-0 md:flex-1 md:grid-cols-[18rem_minmax(0,1fr)] md:[grid-template-rows:minmax(0,1fr)] lg:grid-cols-[18rem_minmax(0,1fr)_24rem]",children:[c.jsx("div",{className:"flex flex-col gap-4 md:overflow-y-auto md:min-h-0",children:c.jsxs(qe,{className:"shrink-0 p-4",variant:"secondary",children:[c.jsx("div",{className:"revka-kicker",children:e("config.map")}),c.jsx("div",{className:"mt-3 space-y-2",children:F.map(Xe=>c.jsxs("button",{type:"button",className:"revka-selection-card text-left","data-active":String(g===Xe.id),"data-accent":"workflow",onClick:()=>{_(Xe.id),f("structured")},children:[c.jsxs("div",{className:"flex items-center justify-between gap-3",children:[c.jsx("span",{className:"text-sm font-medium",children:Xe.title}),c.jsx("span",{className:"text-xs",style:{color:"var(--revka-text-secondary)"},children:Xe.populatedCount})]}),c.jsx("div",{className:"mt-2 text-xs leading-5",style:{color:"var(--revka-text-secondary)"},children:Xe.description})]},Xe.id))})]})}),c.jsxs(qe,{className:"flex min-h-0 flex-col p-5",children:[c.jsxs("div",{className:"flex shrink-0 items-center justify-between gap-3",children:[c.jsxs("div",{children:[c.jsx("div",{className:"revka-kicker",children:e("config.workspace")}),c.jsx("h3",{className:"mt-2 text-lg font-semibold",children:p==="structured"?(L==null?void 0:L.title)??e("config.workspace.structured_heading"):e("config.workspace.source_heading")}),p==="structured"&&L?c.jsx("p",{className:"mt-2 max-w-2xl text-sm leading-6",style:{color:"var(--revka-text-secondary)"},children:L.description}):null]}),c.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[c.jsxs("div",{className:"revka-tab-strip",role:"tablist","aria-label":e("config.tabs_aria"),children:[c.jsx("button",{type:"button",className:"revka-tab-button","data-active":String(p==="structured"),"aria-selected":p==="structured",onClick:()=>f("structured"),children:e("config.tab.structured")}),c.jsx("button",{type:"button",className:"revka-tab-button","data-active":String(p==="source"),"aria-selected":p==="source",onClick:()=>f("source"),children:e("config.tab.source")})]}),c.jsxs("button",{className:"revka-button",onClick:()=>d(Xe=>!Xe),children:[u?c.jsx(zE,{className:"h-4 w-4"}):c.jsx(kv,{className:"h-4 w-4"}),e(u?"config.hide_preview":"config.show_preview")]})]})]}),p==="structured"?C?c.jsxs("div",{className:"mt-5 min-h-0 flex-1 space-y-4 overflow-y-auto pr-1",children:[dPe(g,C,z,T,E,B,O,e,n),(H=L==null?void 0:L.paths)!=null&&H.length?c.jsxs(qe,{className:"p-4",variant:"secondary",children:[c.jsx("div",{className:"revka-kicker",children:e("config.mapped_paths")}),c.jsx("div",{className:"mt-3 flex flex-wrap gap-2",children:L.paths.map(Xe=>c.jsx("span",{className:"rounded-full border px-2.5 py-1 text-[10px] font-semibold uppercase tracking-[0.12em]",style:{borderColor:"var(--revka-border-soft)",color:"var(--revka-text-secondary)"},children:Xe},Xe))})]}):null]}):c.jsx("div",{className:"mt-5",children:c.jsx(ft,{tone:"error",title:e("config.structured.error_title"),description:e("config.structured.error_desc")})}):c.jsxs("div",{className:`mt-5 grid min-h-0 flex-1 gap-4 ${u?"xl:grid-cols-2":"grid-cols-1"}`,children:[c.jsx("textarea",{value:r,onChange:Xe=>i(Xe.target.value),className:"revka-input h-full min-h-0 w-full resize-none",style:{fontFamily:"var(--pc-font-mono)",lineHeight:1.65},spellCheck:!1}),u?c.jsx("div",{className:"min-h-0 overflow-auto rounded-[16px] border p-4",style:{borderColor:"var(--revka-border-soft)",background:"color-mix(in srgb, var(--revka-bg-base) 82%, var(--revka-bg-panel-strong))"},children:c.jsx("pre",{className:"whitespace-pre-wrap break-words text-xs leading-7",style:{color:"var(--revka-text-secondary)",fontFamily:"var(--pc-font-mono)"},dangerouslySetInnerHTML:{__html:A}})}):null]})]}),c.jsxs("div",{className:"flex flex-col gap-4 lg:min-h-0 lg:overflow-hidden",children:[c.jsxs(qe,{className:"flex min-h-0 flex-1 flex-col p-4",variant:"secondary",children:[c.jsxs("div",{className:"inline-flex shrink-0 items-center gap-2",children:[c.jsx(S0,{className:"h-4 w-4",style:{color:"var(--revka-signal-network)"}}),c.jsx("div",{className:"revka-kicker",children:e("config.summary.title")})]}),C?c.jsxs("div",{className:"mt-4 min-h-0 flex-1 space-y-4 overflow-y-auto pr-1 text-sm",children:[c.jsxs(Bm,{title:e("config.section.provider"),children:[c.jsx(vn,{label:e("config.summary.api_url"),value:C.api_url}),c.jsx(vn,{label:e("config.summary.provider"),value:C.default_provider}),c.jsx(vn,{label:e("config.summary.model"),value:C.default_model}),c.jsx(vn,{label:e("config.summary.temperature"),value:C.default_temperature}),c.jsx(vn,{label:e("config.summary.timeout"),value:C.provider_timeout_secs}),c.jsx(vn,{label:e("config.summary.max_tokens"),value:C.provider_max_tokens})]}),c.jsxs(Bm,{title:e("config.summary.runtime"),children:[c.jsx(vn,{label:e("config.summary.gateway"),value:(D=C.gateway)!=null&&D.host&&((U=C.gateway)!=null&&U.port)?`${C.gateway.host}:${C.gateway.port}`:void 0}),c.jsx(vn,{label:e("config.summary.pairing_required"),value:(I=C.gateway)==null?void 0:I.require_pairing}),c.jsx(vn,{label:e("config.summary.session_persistence"),value:(X=C.gateway)==null?void 0:X.session_persistence}),c.jsx(vn,{label:e("config.summary.autonomy_level"),value:(K=C.autonomy)==null?void 0:K.level}),c.jsx(vn,{label:e("config.summary.workspace_only"),value:(Q=C.autonomy)==null?void 0:Q.workspace_only}),c.jsx(vn,{label:e("config.summary.max_actions_hour"),value:(V=C.autonomy)==null?void 0:V.max_actions_per_hour})]}),c.jsxs(Bm,{title:e("config.summary.memory"),children:[c.jsx(vn,{label:e("config.summary.backend"),value:(R=C.memory)==null?void 0:R.backend}),c.jsx(vn,{label:e("config.summary.auto_save"),value:(q=C.memory)==null?void 0:q.auto_save}),c.jsx(vn,{label:e("config.summary.hygiene"),value:(W=C.memory)==null?void 0:W.hygiene_enabled}),c.jsx(vn,{label:e("config.summary.snapshots"),value:(te=C.memory)==null?void 0:te.snapshot_enabled}),c.jsx(vn,{label:e("config.summary.kumiho_enabled"),value:(J=C.kumiho)==null?void 0:J.enabled}),c.jsx(vn,{label:e("config.summary.memory_project"),value:(G=C.kumiho)==null?void 0:G.memory_project}),c.jsx(vn,{label:e("config.summary.retrieval_limit"),value:((re=C.kumiho)==null?void 0:re.memory_retrieval_limit)??3})]}),c.jsxs(Bm,{title:e("config.summary.safety_cost"),children:[c.jsx(vn,{label:e("config.summary.audit_enabled"),value:(le=(ne=C.security)==null?void 0:ne.audit)==null?void 0:le.enabled}),c.jsx(vn,{label:e("config.summary.sandbox_backend"),value:(ie=(oe=C.security)==null?void 0:oe.sandbox)==null?void 0:ie.backend}),c.jsx(vn,{label:e("config.summary.daily_limit"),value:(he=C.cost)==null?void 0:he.daily_limit_usd}),c.jsx(vn,{label:e("config.summary.monthly_limit"),value:(Z=C.cost)==null?void 0:Z.monthly_limit_usd}),c.jsx(vn,{label:e("config.summary.warn_percent"),value:(de=C.cost)==null?void 0:de.warn_at_percent})]}),c.jsxs(Bm,{title:e("config.summary.channels"),children:[c.jsx(vn,{label:e("config.summary.cli"),value:(ue=C.channels_config)==null?void 0:ue.cli}),c.jsx(vn,{label:e("config.summary.telegram"),value:!!((pe=C.channels_config)!=null&&pe.telegram)}),c.jsx(vn,{label:e("config.summary.discord"),value:!!((Oe=C.channels_config)!=null&&Oe.discord)}),c.jsx(vn,{label:e("config.summary.slack"),value:!!((fe=C.channels_config)!=null&&fe.slack)}),c.jsx(vn,{label:e("config.summary.matrix"),value:!!((Le=C.channels_config)!=null&&Le.matrix)}),c.jsx(vn,{label:e("config.summary.signal"),value:!!((Ee=C.channels_config)!=null&&Ee.signal)}),c.jsx(vn,{label:e("config.summary.whatsapp"),value:!!((Bt=C.channels_config)!=null&&Bt.whatsapp)})]})]}):c.jsx("div",{className:"mt-4",children:c.jsx(ft,{tone:"error",compact:!0,title:e("config.summary.error_title"),description:e("config.summary.error_desc")})})]}),c.jsxs(qe,{className:"flex max-h-[22rem] shrink-0 flex-col p-4",variant:"utility",children:[c.jsx("div",{className:"revka-kicker shrink-0",children:e("config.source_health")}),c.jsxs("div",{className:"mt-3 min-h-0 flex-1 space-y-3 overflow-y-auto pr-1 text-sm",children:[c.jsx(vn,{label:e("config.row.workspace_mode"),value:e(p==="structured"?"config.mode.structured":"config.mode.source")}),c.jsx(vn,{label:e("config.row.preview"),value:u}),c.jsx(vn,{label:e("config.row.sections"),value:F.length}),c.jsx(vn,{label:e("config.row.parse_status"),value:e(C?"config.row.parse_valid":"config.row.parse_needs")})]})]})]})]})]})}function dPe(e,n,r,i,s,a,o,l,u){var d,p,f,g,_,x,v,S,w,j,C,T,E,A,O,F,L,$,z,B,H,D,U,I,X,K,Q,V,R,q,W,te,J;if(e.startsWith("ext:")){const G=o.find(re=>re.id===e);return G?c.jsx(gPe,{path:G.path,data:G.data,updateField:r,t:l}):null}switch(e){case"provider":return c.jsxs(Xc,{title:l("config.section.provider"),children:[c.jsx(Tn,{label:l("config.provider.default_provider"),children:c.jsx("input",{className:"revka-input",value:n.default_provider??"",onChange:G=>r(null,"default_provider",G.target.value)})}),c.jsx(Tn,{label:l("config.provider.default_model"),children:c.jsx("input",{className:"revka-input",value:n.default_model??"",onChange:G=>r(null,"default_model",G.target.value)})}),c.jsx(Tn,{label:l("config.provider.temperature"),children:c.jsx("input",{className:"revka-input",type:"number",step:"0.1",value:n.default_temperature??.7,onChange:G=>r(null,"default_temperature",Number(G.target.value))})}),c.jsx(Tn,{label:l("config.provider.timeout"),children:c.jsx("input",{className:"revka-input",type:"number",value:n.provider_timeout_secs??120,onChange:G=>r(null,"provider_timeout_secs",Number(G.target.value))})}),c.jsx(Tn,{label:l("config.provider.max_tokens"),children:c.jsx("input",{className:"revka-input",type:"number",value:n.provider_max_tokens??8192,onChange:G=>r(null,"provider_max_tokens",Number(G.target.value))})})]});case"agent":return c.jsxs(Xc,{title:l("config.section.agent"),children:[c.jsx(Tn,{label:l("config.agent.max_tool_iterations"),children:c.jsx("input",{className:"revka-input",type:"number",value:((d=n.agent)==null?void 0:d.max_tool_iterations)??10,onChange:G=>r("agent","max_tool_iterations",Number(G.target.value))})}),c.jsx(Tn,{label:l("config.agent.max_context_tokens"),children:c.jsx("input",{className:"revka-input",type:"number",value:((p=n.agent)==null?void 0:p.max_context_tokens)??32e3,onChange:G=>r("agent","max_context_tokens",Number(G.target.value))})}),c.jsx(Tn,{label:l("config.agent.max_history_messages"),children:c.jsx("input",{className:"revka-input",type:"number",value:((f=n.agent)==null?void 0:f.max_history_messages)??40,onChange:G=>r("agent","max_history_messages",Number(G.target.value))})}),c.jsx(Tn,{label:l("config.agent.gpt55_context_window"),children:c.jsx("input",{className:"revka-input",type:"number",min:1,value:((_=(g=n.agent)==null?void 0:g.model_context_windows)==null?void 0:_["gpt-5_5"])??105e4,onChange:G=>r("agent.model_context_windows","gpt-5_5",Number(G.target.value))})}),c.jsx(Tn,{label:l("config.agent.context_window_safety_ratio"),children:c.jsx("input",{className:"revka-input",type:"number",min:.1,max:1,step:.01,value:((x=n.agent)==null?void 0:x.context_window_safety_ratio)??.95,onChange:G=>r("agent","context_window_safety_ratio",Number(G.target.value))})}),c.jsx(Js,{label:l("config.agent.parallel_tools"),checked:((v=n.agent)==null?void 0:v.parallel_tools)??!1,onChange:G=>r("agent","parallel_tools",G),t:l}),c.jsx(Tn,{label:l("config.agent.thinking_level"),children:c.jsx("input",{className:"revka-input",value:((w=(S=n.agent)==null?void 0:S.thinking)==null?void 0:w.default_level)??"medium",onChange:G=>r("agent.thinking","default_level",G.target.value)})})]});case"memory":return c.jsxs(Xc,{title:l("config.section.memory"),children:[c.jsx(Js,{label:l("config.memory.kumiho_enabled"),checked:((j=n.kumiho)==null?void 0:j.enabled)??!1,onChange:G=>r("kumiho","enabled",G),t:l}),c.jsx(Tn,{label:l("config.memory.memory_project"),children:c.jsx("input",{className:"revka-input",value:((C=n.kumiho)==null?void 0:C.memory_project)??"",onChange:G=>r("kumiho","memory_project",G.target.value)})}),c.jsx(Tn,{label:l("config.memory.harness_project"),children:c.jsx("input",{className:"revka-input",value:((T=n.kumiho)==null?void 0:T.harness_project)??"",onChange:G=>r("kumiho","harness_project",G.target.value)})}),c.jsx(Tn,{label:l("config.memory.retrieval_limit"),children:c.jsx("input",{className:"revka-input",type:"number",min:1,max:50,value:((E=n.kumiho)==null?void 0:E.memory_retrieval_limit)??3,onChange:G=>r("kumiho","memory_retrieval_limit",Number(G.target.value))})}),c.jsx(Tn,{label:l("config.memory.backend"),children:c.jsx("input",{className:"revka-input",value:((A=n.memory)==null?void 0:A.backend)??"",onChange:G=>r("memory","backend",G.target.value)})}),c.jsx(Js,{label:l("config.memory.auto_save"),checked:((O=n.memory)==null?void 0:O.auto_save)??!1,onChange:G=>r("memory","auto_save",G),t:l}),c.jsx(Js,{label:l("config.memory.snapshots"),checked:((F=n.memory)==null?void 0:F.snapshot_enabled)??!1,onChange:G=>r("memory","snapshot_enabled",G),t:l})]});case"runtime":return c.jsxs(Xc,{title:l("config.section.runtime"),children:[c.jsx(Tn,{label:l("config.runtime.gateway_host"),children:c.jsx("input",{className:"revka-input",value:((L=n.gateway)==null?void 0:L.host)??"",onChange:G=>r("gateway","host",G.target.value)})}),c.jsx(Tn,{label:l("config.runtime.gateway_port"),children:c.jsx("input",{className:"revka-input",type:"number",value:(($=n.gateway)==null?void 0:$.port)??42617,onChange:G=>r("gateway","port",Number(G.target.value))})}),c.jsx(Js,{label:l("config.runtime.require_pairing"),checked:((z=n.gateway)==null?void 0:z.require_pairing)??!1,onChange:G=>r("gateway","require_pairing",G),t:l}),c.jsx(Js,{label:l("config.runtime.session_persistence"),checked:((B=n.gateway)==null?void 0:B.session_persistence)??!1,onChange:G=>r("gateway","session_persistence",G),t:l}),c.jsx(Tn,{label:l("config.runtime.autonomy_level"),children:c.jsx("input",{className:"revka-input",value:((H=n.autonomy)==null?void 0:H.level)??"",onChange:G=>r("autonomy","level",G.target.value)})}),c.jsx(Tn,{label:l("config.runtime.max_actions_hour"),children:c.jsx("input",{className:"revka-input",type:"number",value:((D=n.autonomy)==null?void 0:D.max_actions_per_hour)??0,onChange:G=>r("autonomy","max_actions_per_hour",Number(G.target.value))})})]});case"security":return c.jsxs(Xc,{title:l("config.section.security"),children:[c.jsx(Js,{label:l("config.security.audit_enabled"),checked:((I=(U=n.security)==null?void 0:U.audit)==null?void 0:I.enabled)??!1,onChange:G=>r("security.audit","enabled",G),t:l}),c.jsx(Tn,{label:l("config.security.sandbox_backend"),children:c.jsx("input",{className:"revka-input",value:((K=(X=n.security)==null?void 0:X.sandbox)==null?void 0:K.backend)??"",onChange:G=>r("security.sandbox","backend",G.target.value)})}),c.jsx(Tn,{label:l("config.security.daily_limit"),children:c.jsx("input",{className:"revka-input",type:"number",step:"0.01",value:((Q=n.cost)==null?void 0:Q.daily_limit_usd)??0,onChange:G=>r("cost","daily_limit_usd",Number(G.target.value))})}),c.jsx(Tn,{label:l("config.security.monthly_limit"),children:c.jsx("input",{className:"revka-input",type:"number",step:"0.01",value:((V=n.cost)==null?void 0:V.monthly_limit_usd)??0,onChange:G=>r("cost","monthly_limit_usd",Number(G.target.value))})}),c.jsx(Tn,{label:l("config.security.warn_percent"),children:c.jsx("input",{className:"revka-input",type:"number",value:((R=n.cost)==null?void 0:R.warn_at_percent)??80,onChange:G=>r("cost","warn_at_percent",Number(G.target.value))})})]});case"channels":return c.jsxs(Xc,{title:l("config.section.channels"),children:[c.jsx(Js,{label:l("config.channels.cli"),checked:((q=n.channels_config)==null?void 0:q.cli)??!1,onChange:G=>r("channels_config","cli",G),t:l}),c.jsx(Js,{label:l("config.channels.ack_reactions"),checked:((W=n.channels_config)==null?void 0:W.ack_reactions)??!1,onChange:G=>r("channels_config","ack_reactions",G),t:l}),c.jsx(Js,{label:l("config.channels.show_tool_calls"),checked:((te=n.channels_config)==null?void 0:te.show_tool_calls)??!1,onChange:G=>r("channels_config","show_tool_calls",G),t:l}),c.jsx(Tn,{label:l("config.channels.message_timeout"),children:c.jsx("input",{className:"revka-input",type:"number",value:((J=n.channels_config)==null?void 0:J.message_timeout_secs)??60,onChange:G=>r("channels_config","message_timeout_secs",Number(G.target.value))})})]});case"mcp":return c.jsx(hPe,{config:i,errors:s,onChange:a,t:l,tpl:u});default:return null}}function Xc({title:e,children:n}){return c.jsxs(qe,{className:"p-4",variant:"utility",children:[c.jsx("div",{className:"revka-kicker",children:e}),c.jsx("div",{className:"mt-4 space-y-4",children:n})]})}function Tn({label:e,children:n}){return c.jsxs("label",{className:"grid gap-2 text-sm",children:[c.jsx("span",{style:{color:"var(--revka-text-secondary)"},children:e}),n]})}function Js({label:e,checked:n,onChange:r,t:i}){return c.jsxs("button",{type:"button",className:"flex items-center justify-between rounded-[12px] border px-3 py-3 text-left",style:{borderColor:"var(--revka-border-soft)",background:"color-mix(in srgb, var(--revka-bg-panel-strong) 88%, transparent)"},onClick:()=>r(!n),children:[c.jsx("span",{className:"text-sm",style:{color:"var(--revka-text-primary)"},children:e}),c.jsx("span",{className:"rounded-full px-2 py-1 text-[10px] font-semibold uppercase tracking-[0.12em]",style:{background:n?"var(--revka-signal-selected-soft, color-mix(in srgb, var(--revka-signal-selected) 18%, transparent))":"color-mix(in srgb, var(--revka-text-faint) 14%, transparent)",color:n?"var(--revka-signal-selected)":"var(--revka-text-faint)"},children:i(n?"config.toggle.enabled":"config.toggle.disabled")})]})}function Bm({title:e,children:n}){return c.jsxs("div",{children:[c.jsx("div",{className:"revka-kicker",children:e}),c.jsx("div",{className:"mt-2 space-y-2",children:n})]})}function vn({label:e,value:n}){const{t:r}=an();return c.jsxs("div",{className:"rounded-[12px] border p-3",style:{borderColor:"var(--revka-border-soft)"},children:[c.jsx("div",{className:"text-[10px] font-semibold uppercase tracking-[0.14em]",style:{color:"var(--revka-text-faint)"},children:e}),c.jsx("div",{className:"mt-1 text-sm font-semibold",style:{color:"var(--revka-text-primary)"},children:n===void 0?"—":typeof n=="boolean"?r(n?"config.row.enabled":"config.row.disabled"):String(n)})]})}function hPe({config:e,errors:n,onChange:r,t:i,tpl:s}){const a=g=>r({...e,enabled:g}),o=g=>r({...e,deferred_loading:g}),l=(g,_)=>{const x=e.servers.slice();x[g]={...x[g],..._},r({...e,servers:x})},u=g=>{var w;const _=e.servers[g],x=(w=_==null?void 0:_.name)!=null&&w.trim()?_.name:s("config.mcp.entry_label",{index:g+1});if(!(typeof window<"u"?window.confirm(s("config.mcp.confirm_remove",{label:x})):!0))return;const S=e.servers.filter((j,C)=>C!==g);r({...e,servers:S})},d=()=>{const g=[...e.servers,{name:"",transport:"stdio",command:"",args:[]}];r({...e,servers:g})},p=e.servers.length<=3,f=e.servers.length===0?i("config.mcp.no_servers"):s(e.servers.length===1?"config.mcp.server_count_one":"config.mcp.server_count",{count:e.servers.length});return c.jsxs("div",{className:"space-y-4",children:[c.jsxs(Xc,{title:i("config.mcp.title"),children:[c.jsx(Js,{label:i("config.mcp.enabled"),checked:e.enabled,onChange:a,t:i}),c.jsx(Js,{label:i("config.mcp.deferred"),checked:e.deferred_loading,onChange:o,t:i})]}),c.jsxs(qe,{className:"p-4",variant:"utility",children:[c.jsxs("div",{className:"flex items-center justify-between",children:[c.jsxs("div",{children:[c.jsx("div",{className:"revka-kicker",children:i("config.mcp.servers")}),c.jsx("p",{className:"mt-1 text-xs",style:{color:"var(--revka-text-secondary)"},children:f})]}),c.jsxs("button",{type:"button",className:"revka-button","data-variant":"primary",onClick:d,children:[c.jsx(ls,{className:"h-4 w-4"}),i("config.mcp.add_server")]})]}),c.jsx("div",{className:"mt-4 space-y-3",children:e.servers.map((g,_)=>c.jsx(fPe,{index:_,server:g,errors:n[_],defaultExpanded:p,onUpdate:x=>l(_,x),onDelete:()=>u(_),t:i,tpl:s},`mcp-server-${_}`))})]})]})}function fPe({index:e,server:n,errors:r,defaultExpanded:i,onUpdate:s,onDelete:a,t:o,tpl:l}){var w,j;const[u,d]=b.useState(i),[p,f]=b.useState({kind:"idle"}),g=!!(r!=null&&r.name||r!=null&&r.command||r!=null&&r.url),_=n.name.trim()||l("config.mcp.server_default",{index:e+1}),x=n.transport==="stdio"?(w=n.command)!=null&&w.trim()?n.command:o("config.mcp.stdio_empty"):(j=n.url)!=null&&j.trim()?n.url:l("config.mcp.transport_empty",{transport:n.transport}),v=async()=>{f({kind:"testing"});try{const C=await OZ({name:n.name,transport:n.transport,command:n.command,args:n.args,env:n.env,url:n.url,headers:n.headers,timeout_ms:n.timeout_ms});f({kind:"done",result:C})}catch(C){const T=C instanceof Error?C.message:String(C);f({kind:"done",result:{ok:!1,latency_ms:0,error:T}})}},S=g||p.kind==="testing";return c.jsxs("div",{className:"rounded-[14px] border",style:{borderColor:g?"var(--revka-status-error, var(--revka-status-danger))":"var(--revka-border-soft)",background:"color-mix(in srgb, var(--revka-bg-panel-strong) 88%, transparent)"},children:[c.jsxs("div",{className:"flex items-center justify-between px-4 py-3",children:[c.jsxs("button",{type:"button",className:"flex flex-1 items-center gap-3 text-left",onClick:()=>d(C=>!C),children:[u?c.jsx(Yo,{className:"h-4 w-4",style:{color:"var(--revka-text-secondary)"}}):c.jsx(du,{className:"h-4 w-4",style:{color:"var(--revka-text-secondary)"}}),c.jsxs("div",{className:"min-w-0",children:[c.jsx("div",{className:"text-sm font-semibold",style:{color:"var(--revka-text-primary)"},children:_}),c.jsxs("div",{className:"truncate text-xs",style:{color:"var(--revka-text-secondary)"},children:[n.transport.toUpperCase()," · ",x]})]})]}),c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx(pPe,{state:p,t:o,tpl:l}),c.jsx("button",{type:"button",className:"revka-button",onClick:C=>{C.stopPropagation(),v()},disabled:S,title:o(g?"config.mcp.test_blocked":"config.mcp.test_tooltip"),style:S?{opacity:.5,cursor:"not-allowed"}:void 0,children:p.kind==="testing"?o("config.mcp.testing"):o("config.mcp.test")}),c.jsx("button",{type:"button",className:"revka-button",onClick:C=>{C.stopPropagation(),a()},"aria-label":l("config.mcp.delete_label",{label:_}),children:c.jsx(Ki,{className:"h-4 w-4"})})]})]}),u?c.jsxs("div",{className:"space-y-4 border-t px-4 py-4",style:{borderColor:"var(--revka-border-soft)"},children:[c.jsxs(Tn,{label:o("config.mcp.field_name"),children:[c.jsx("input",{className:"revka-input",value:n.name,placeholder:o("config.mcp.field_name_placeholder"),onChange:C=>s({name:C.target.value})}),r!=null&&r.name?c.jsx(eC,{message:r.name}):null]}),c.jsx(Tn,{label:o("config.mcp.field_transport"),children:c.jsxs("select",{className:"revka-input",value:n.transport,onChange:C=>s({transport:C.target.value}),children:[c.jsx("option",{value:"stdio",children:"stdio"}),c.jsx("option",{value:"http",children:"http"}),c.jsx("option",{value:"sse",children:"sse"})]})}),n.transport==="stdio"?c.jsxs(c.Fragment,{children:[c.jsxs(Tn,{label:o("config.mcp.field_command"),children:[c.jsx("input",{className:"revka-input",value:n.command??"",placeholder:o("config.mcp.field_command_placeholder"),onChange:C=>s({command:C.target.value})}),r!=null&&r.command?c.jsx(eC,{message:r.command}):null]}),c.jsx(mPe,{label:o("config.mcp.field_args"),values:n.args??[],placeholder:o("config.mcp.field_args_placeholder"),onChange:C=>s({args:C}),tpl:l}),c.jsx(V8,{label:o("config.mcp.field_env"),entries:n.env??{},keyPlaceholder:o("config.mcp.field_env_key"),valuePlaceholder:o("config.mcp.field_env_value"),onChange:C=>s({env:C}),tpl:l})]}):c.jsxs(c.Fragment,{children:[c.jsxs(Tn,{label:o("config.mcp.field_url"),children:[c.jsx("input",{className:"revka-input",value:n.url??"",placeholder:o("config.mcp.field_url_placeholder"),onChange:C=>s({url:C.target.value})}),r!=null&&r.url?c.jsx(eC,{message:r.url}):null]}),c.jsx(V8,{label:o("config.mcp.field_headers"),entries:n.headers??{},keyPlaceholder:o("config.mcp.field_headers_key"),valuePlaceholder:o("config.mcp.field_headers_value"),onChange:C=>s({headers:C}),tpl:l}),c.jsx(Tn,{label:o("config.mcp.field_timeout"),children:c.jsx("input",{className:"revka-input",type:"number",value:n.timeout_ms??"",placeholder:o("config.mcp.field_timeout_placeholder"),onChange:C=>{const T=C.target.value;if(T==="")s({timeout_ms:void 0});else{const E=Number(T);Number.isFinite(E)&&s({timeout_ms:E})}}})})]})]}):null]})}function pPe({state:e,t:n,tpl:r}){if(e.kind==="idle")return null;if(e.kind==="testing")return c.jsxs("span",{className:"inline-flex items-center gap-1 text-xs",style:{color:"var(--revka-text-secondary)"},children:[c.jsx($r,{className:"h-3.5 w-3.5 animate-spin"}),n("config.mcp.connecting")]});const{result:i}=e;if(i.ok){const s=i.tool_count??0;return c.jsxs("span",{className:"inline-flex items-center gap-1 rounded border px-2 py-0.5 text-xs",style:{borderColor:"var(--revka-status-ok, var(--revka-status-success))",color:"var(--revka-status-ok, var(--revka-status-success))"},title:i.tools&&i.tools.length>0?r("config.mcp.tools_list",{list:i.tools.join(", ")}):void 0,children:[c.jsx(no,{className:"h-3.5 w-3.5"}),r(s===1?"config.mcp.tool_count_one":"config.mcp.tool_count",{count:s,latency:i.latency_ms})]})}return c.jsxs("span",{className:"inline-flex max-w-xs items-center gap-1 truncate rounded border px-2 py-0.5 text-xs",style:{borderColor:"var(--revka-status-error, var(--revka-status-danger))",color:"var(--revka-status-error, var(--revka-status-danger))"},title:i.error??n("config.mcp.handshake_failed"),children:[c.jsx(vi,{className:"h-3.5 w-3.5"}),i.error??n("config.mcp.handshake_failed")]})}function eC({message:e}){return c.jsx("span",{className:"text-xs",style:{color:"var(--revka-status-error, #f87171)"},children:e})}function mPe({label:e,values:n,placeholder:r,onChange:i,tpl:s}){const a=(u,d)=>{const p=n.slice();p[u]=d,i(p)},o=u=>i(n.filter((d,p)=>p!==u)),l=()=>i([...n,""]);return c.jsxs("div",{className:"grid gap-2 text-sm",children:[c.jsx("span",{style:{color:"var(--revka-text-secondary)"},children:e}),c.jsxs("div",{className:"space-y-2",children:[n.map((u,d)=>c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("input",{className:"revka-input flex-1",value:u,placeholder:r,onChange:p=>a(d,p.target.value)}),c.jsx("button",{type:"button",className:"revka-button",onClick:()=>o(d),"aria-label":s("config.mcp.remove_entry",{label:e,index:d+1}),children:c.jsx(Ki,{className:"h-4 w-4"})})]},`${e}-${d}`)),c.jsxs("button",{type:"button",className:"revka-button",onClick:l,children:[c.jsx(ls,{className:"h-4 w-4"}),s("config.mcp.add_entry",{label:e})]})]})]})}function V8({label:e,entries:n,keyPlaceholder:r,valuePlaceholder:i,onChange:s,tpl:a}){const o=Object.entries(n),l=g=>{const _={};for(const[x,v]of g)x.length!==0&&(_[x]=v);s(_)},u=(g,_)=>{const x=o.slice();x[g]=[_,x[g][1]],l(x)},d=(g,_)=>{const x=o.slice();x[g]=[x[g][0],_],l(x)},p=g=>l(o.filter((_,x)=>x!==g)),f=()=>{const g=`new_key_${o.length+1}`;l([...o,[g,""]])};return c.jsxs("div",{className:"grid gap-2 text-sm",children:[c.jsx("span",{style:{color:"var(--revka-text-secondary)"},children:e}),c.jsxs("div",{className:"space-y-2",children:[o.map(([g,_],x)=>c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("input",{className:"revka-input flex-1",value:g,placeholder:r,onChange:v=>u(x,v.target.value)}),c.jsx("input",{className:"revka-input flex-1",value:_,placeholder:i,onChange:v=>d(x,v.target.value)}),c.jsx("button",{type:"button",className:"revka-button",onClick:()=>p(x),"aria-label":a("config.mcp.remove_entry",{label:e,index:x+1}),children:c.jsx(Ki,{className:"h-4 w-4"})})]},`${e}-${x}`)),c.jsxs("button",{type:"button",className:"revka-button",onClick:f,children:[c.jsx(ls,{className:"h-4 w-4"}),a("config.mcp.add_entry",{label:e})]})]})]})}function gPe({path:e,data:n,updateField:r,t:i}){return c.jsx(Xc,{title:`[${e}]`,children:c.jsx(tY,{pathPrefix:e,data:n,updateField:r,t:i})})}function tY({pathPrefix:e,data:n,updateField:r,t:i}){const s=Object.entries(n);return s.length===0?c.jsx("div",{className:"text-xs",style:{color:"var(--revka-text-faint)"},children:i("config.generic.empty")}):c.jsx(c.Fragment,{children:s.map(([a,o])=>c.jsx(vPe,{pathPrefix:e,fieldKey:a,value:o,updateField:r,t:i},a))})}function vPe({pathPrefix:e,fieldKey:n,value:r,updateField:i,t:s}){return typeof r=="boolean"?c.jsx(Js,{label:n,checked:r,onChange:a=>i(e,n,a),t:s}):typeof r=="number"?c.jsx(Tn,{label:n,children:c.jsx("input",{className:"revka-input",type:"number",value:r,onChange:a=>{const o=Number(a.target.value);Number.isFinite(o)&&i(e,n,o)}})}):typeof r=="string"?c.jsx(Tn,{label:n,children:c.jsx("input",{className:"revka-input",value:r,onChange:a=>i(e,n,a.target.value)})}):Array.isArray(r)?c.jsxs(Tn,{label:n,children:[c.jsx("div",{className:"rounded-[10px] border px-3 py-2 font-mono text-xs",style:{borderColor:"var(--revka-border-soft)",color:"var(--revka-text-secondary)"},children:r.length===0?s("config.generic.empty_array"):JSON.stringify(r)}),c.jsx("span",{className:"text-[10px]",style:{color:"var(--revka-text-faint)"},children:s("config.generic.array_readonly")})]}):r!==null&&typeof r=="object"?c.jsxs(qe,{className:"p-3",variant:"utility",children:[c.jsx("div",{className:"revka-kicker",children:`${e}.${n}`}),c.jsx("div",{className:"mt-3 space-y-3",children:c.jsx(tY,{pathPrefix:`${e}.${n}`,data:r,updateField:i,t:s})})]}):null}function nY(e){return e?new Date(e).toLocaleString():"—"}function yPe(e){if(e==null)return"—";if(e<1e3)return`${e}ms`;const n=e/1e3;return n<60?`${n.toFixed(1)}s`:`${(n/60).toFixed(1)}m`}function rY(e){if(!e)return null;switch(e.toLowerCase()){case"ok":case"success":return c.jsx(Of,{className:"h-4 w-4",style:{color:"var(--revka-status-success)"}});case"error":case"failed":return c.jsx(ru,{className:"h-4 w-4",style:{color:"var(--revka-status-danger)"}});default:return c.jsx(bv,{className:"h-4 w-4",style:{color:"var(--revka-status-warning)"}})}}function _Pe({jobId:e}){const{t:n,tpl:r}=an(),[i,s]=b.useState([]),[a,o]=b.useState(!0),[l,u]=b.useState(null),d=b.useCallback(()=>{o(!0),u(null),AZ(e,20).then(s).catch(p=>u(p.message)).finally(()=>o(!1))},[e]);return b.useEffect(()=>{d()},[d]),a?c.jsx(ft,{compact:!0,tone:"loading",title:n("cron.history.loading")}):l?c.jsx(ft,{compact:!0,tone:"error",title:n("cron.history.error_title"),description:l,action:c.jsxs("button",{className:"revka-button",onClick:d,children:[c.jsx($r,{className:"h-3.5 w-3.5"}),n("cron.history.retry")]})}):i.length===0?c.jsx(ft,{compact:!0,title:n("cron.history.no_runs_title"),description:n("cron.history.no_runs_desc"),action:c.jsxs("button",{className:"revka-button",onClick:d,children:[c.jsx($r,{className:"h-3.5 w-3.5"}),n("cron.history.refresh")]})}):c.jsxs("div",{children:[c.jsxs("div",{className:"mb-2 flex items-center justify-between",children:[c.jsx("div",{className:"revka-kicker",children:r("cron.history.recent",{count:i.length})}),c.jsx("button",{className:"revka-button",onClick:d,title:n("cron.history.refresh_title"),children:c.jsx($r,{className:"h-3.5 w-3.5"})})]}),c.jsx("div",{className:"max-h-60 space-y-1.5 overflow-y-auto",children:i.map(p=>c.jsxs("div",{className:"rounded-[10px] border px-3 py-2 text-xs",style:{background:"color-mix(in srgb, var(--revka-bg-panel-strong) 94%, transparent)",borderColor:"var(--revka-border-soft)"},children:[c.jsxs("div",{className:"mb-1 flex items-center justify-between",children:[c.jsxs("div",{className:"flex items-center gap-2",children:[rY(p.status),c.jsx("span",{style:{color:"var(--revka-text-secondary)"},children:p.status})]}),c.jsx("span",{style:{color:"var(--revka-text-faint)"},children:yPe(p.duration_ms)})]}),c.jsx("div",{className:"flex items-center gap-3",style:{color:"var(--revka-text-faint)"},children:c.jsx("span",{children:nY(p.started_at)})}),p.output?c.jsx("pre",{className:"mt-1.5 max-h-24 overflow-x-auto whitespace-pre-wrap break-words rounded-[8px] p-2 font-mono text-xs",style:{background:"var(--revka-bg-base)",color:"var(--revka-text-secondary)"},children:p.output}):null]},p.id))})]})}function xPe(){const{t:e,tpl:n}=an(),[r,i]=b.useState([]),[s,a]=b.useState(!0),[o,l]=b.useState(null),[u,d]=b.useState(null),[p,f]=b.useState(null),[g,_]=b.useState(null),[x,v]=b.useState(!1),[S,w]=b.useState(null),[j,C]=b.useState(""),[T,E]=b.useState(""),[A,O]=b.useState(""),[F,L]=b.useState(null),[$,z]=b.useState(!1),B=S!==null&&S!=="add",H=b.useCallback(()=>{a(!0),CZ().then(i).catch(R=>l({tone:"error",message:n("cron.err.load",{message:R.message})})).finally(()=>a(!1))},[n]),D=b.useCallback(()=>{TZ().then(_).catch(()=>{})},[]);b.useEffect(()=>{H(),D()},[H,D]);const U=async()=>{if(g){v(!0);try{const R=await MZ({catch_up_on_startup:!g.catch_up_on_startup});_(R)}catch(R){l({tone:"error",message:R instanceof Error?R.message:e("cron.err.settings")})}finally{v(!1)}}},I=()=>{C(""),E(""),O(""),L(null),w("add")},X=R=>{C(R.name??""),E(R.expression),O(R.prompt??R.command),L(null),w(R)},K=()=>{w(null),L(null)},Q=async()=>{if(!T.trim()||!A.trim()){L(e("cron.err.form_required"));return}z(!0),L(null);try{if(B){const R=await EZ(S.id,{name:j.trim()||void 0,schedule:T.trim(),command:A.trim()});i(q=>q.map(W=>W.id===R.id?R:W)),l({tone:"success",message:n("cron.toast.updated",{name:R.name??R.id.slice(0,8)})})}else{const R=await jZ({name:j.trim()||void 0,schedule:T.trim(),command:A.trim()});i(q=>[...q,R]),l({tone:"success",message:n("cron.toast.added",{name:R.name??R.id.slice(0,8)})})}K()}catch(R){L(R instanceof Error?R.message:e("cron.err.save"))}finally{z(!1)}},V=async R=>{try{await NZ(R),i(q=>q.filter(W=>W.id!==R)),l({tone:"success",message:e("cron.toast.deleted")})}catch(q){l({tone:"error",message:q instanceof Error?q.message:e("cron.err.delete")})}finally{d(null)}};return c.jsxs("div",{className:"flex h-[calc(100vh-6rem)] flex-col gap-3",children:[o?c.jsx(nl,{tone:o.tone,message:o.message,onDismiss:()=>l(null)}):null,c.jsx(oi,{kicker:e("cron.kicker"),title:e("cron.title"),description:e("cron.description"),actions:c.jsxs(c.Fragment,{children:[c.jsxs("button",{className:"revka-button",onClick:H,disabled:s,children:[c.jsx($r,{className:`h-4 w-4 ${s?"animate-spin":""}`}),e("cron.reload")]}),c.jsxs("button",{className:"revka-button","data-variant":"primary",onClick:I,children:[c.jsx(ls,{className:"h-4 w-4"}),e("cron.add_job")]})]})}),g?c.jsx(qe,{className:"p-4",variant:"secondary",children:c.jsxs("div",{className:"flex items-center justify-between gap-3",children:[c.jsxs("div",{children:[c.jsx("div",{className:"revka-kicker",children:e("cron.startup_behaviour")}),c.jsx("div",{className:"mt-2 text-sm font-semibold",style:{color:"var(--revka-text-primary)"},children:e("cron.catch_up_title")}),c.jsx("p",{className:"mt-1 text-xs",style:{color:"var(--revka-text-secondary)"},children:e("cron.catch_up_desc")})]}),c.jsx("button",{type:"button",onClick:U,disabled:x,className:"relative inline-flex h-6 w-11 items-center rounded-full transition-colors",style:{background:g.catch_up_on_startup?"var(--revka-signal-selected)":"var(--revka-border-strong)",opacity:x?.6:1},"aria-pressed":g.catch_up_on_startup,children:c.jsx("span",{className:"inline-block h-4 w-4 rounded-full bg-white transition-transform",style:{transform:g.catch_up_on_startup?"translateX(1.5rem)":"translateX(0.25rem)"}})})]})}):null,s?c.jsx("div",{className:"flex min-h-0 flex-1 items-center justify-center",children:c.jsx(ft,{tone:"loading",title:e("cron.loading_jobs")})}):r.length===0?c.jsx(qe,{className:"p-6",children:c.jsx(ft,{tone:"empty",title:e("cron.no_jobs_title"),description:e("cron.no_jobs_desc"),action:c.jsxs("button",{className:"revka-button","data-variant":"primary",onClick:I,children:[c.jsx(ls,{className:"h-4 w-4"}),e("cron.add_job")]})})}):c.jsx(qe,{className:"min-h-0 flex-1 overflow-auto p-0",children:c.jsxs("table",{className:"revka-table w-full",children:[c.jsx("thead",{children:c.jsxs("tr",{children:[c.jsx("th",{className:"text-left",children:e("cron.col.id")}),c.jsx("th",{className:"text-left",children:e("cron.col.name")}),c.jsx("th",{className:"text-left",children:e("cron.col.command")}),c.jsx("th",{className:"text-left",children:e("cron.col.next_run")}),c.jsx("th",{className:"text-left",children:e("cron.col.last_status")}),c.jsx("th",{className:"text-left",children:e("cron.col.enabled")}),c.jsx("th",{className:"text-right",children:e("cron.col.actions")})]})}),c.jsx("tbody",{children:r.map(R=>c.jsxs(ip.Fragment,{children:[c.jsxs("tr",{children:[c.jsx("td",{className:"font-mono text-xs",children:c.jsxs("button",{className:"inline-flex items-center gap-1",style:{color:"var(--revka-text-secondary)"},onClick:()=>f(q=>q===R.id?null:R.id),title:e("cron.toggle_history"),children:[p===R.id?c.jsx(Yo,{className:"h-3.5 w-3.5"}):c.jsx(du,{className:"h-3.5 w-3.5"}),R.id.slice(0,8)]})}),c.jsx("td",{className:"text-sm font-medium",style:{color:"var(--revka-text-primary)"},children:R.name??"—"}),c.jsx("td",{className:"max-w-[240px] truncate font-mono text-xs",style:{color:"var(--revka-text-secondary)"},title:R.prompt??R.command,children:R.prompt??R.command}),c.jsx("td",{className:"text-xs",style:{color:"var(--revka-text-faint)"},children:nY(R.next_run)}),c.jsx("td",{children:c.jsxs("div",{className:"flex items-center gap-1.5",children:[rY(R.last_status),c.jsx("span",{className:"text-xs capitalize",style:{color:"var(--revka-text-secondary)"},children:R.last_status??"—"})]})}),c.jsx("td",{children:c.jsx("span",{className:"inline-flex items-center rounded-full border px-2.5 py-0.5 text-[10px] font-semibold uppercase tracking-wider",style:R.enabled?{color:"var(--revka-signal-selected)",borderColor:"color-mix(in srgb, var(--revka-signal-selected) 28%, transparent)",background:"color-mix(in srgb, var(--revka-signal-selected) 10%, transparent)"}:{color:"var(--revka-text-faint)",borderColor:"var(--revka-border-soft)",background:"transparent"},children:R.enabled?e("cron.enabled_badge"):e("cron.disabled_badge")})}),c.jsx("td",{className:"text-right",children:c.jsxs("div",{className:"inline-flex items-center justify-end gap-1",children:[c.jsx("button",{className:"revka-button",onClick:()=>X(R),title:e("cron.edit"),children:c.jsx(Sv,{className:"h-4 w-4"})}),u===R.id?c.jsxs("div",{className:"inline-flex items-center gap-2",children:[c.jsx("span",{className:"text-xs",style:{color:"var(--revka-status-danger)"},children:e("cron.confirm")}),c.jsx("button",{className:"text-xs font-semibold",style:{color:"var(--revka-status-danger)"},onClick:()=>V(R.id),children:e("cron.yes")}),c.jsx("button",{className:"text-xs font-semibold",style:{color:"var(--revka-text-secondary)"},onClick:()=>d(null),children:e("cron.no")})]}):c.jsx("button",{className:"revka-button",onClick:()=>d(R.id),title:e("cron.delete"),children:c.jsx(Ki,{className:"h-4 w-4"})})]})})]}),p===R.id?c.jsx("tr",{children:c.jsx("td",{colSpan:7,style:{background:"color-mix(in srgb, var(--revka-bg-panel-strong) 60%, transparent)"},children:c.jsx("div",{className:"px-4 py-3",children:c.jsx(_Pe,{jobId:R.id})})})}):null]},R.id))})]})}),S!==null?c.jsx(Nu,{title:e(B?"cron.modal.edit_title":"cron.modal.add_title"),description:e("cron.modal.description"),onClose:K,children:c.jsxs("div",{className:"space-y-4",children:[F?c.jsx(nl,{tone:"error",message:F}):null,c.jsxs("div",{children:[c.jsxs("div",{className:"revka-kicker",children:[e("cron.form.name")," ",c.jsx("span",{style:{color:"var(--revka-text-faint)"},children:e("cron.form.optional")})]}),c.jsx("input",{className:"revka-input mt-2 w-full",value:j,onChange:R=>C(R.target.value),placeholder:e("cron.form.name_placeholder")})]}),c.jsxs("div",{children:[c.jsxs("div",{className:"revka-kicker",children:[e("cron.form.schedule")," ",c.jsx("span",{style:{color:"var(--revka-status-danger)"},children:"*"})]}),c.jsx("input",{className:"revka-input mt-2 w-full font-mono text-sm",value:T,onChange:R=>E(R.target.value),placeholder:"0 0 * * *"})]}),c.jsxs("div",{children:[c.jsxs("div",{className:"revka-kicker",children:[e("cron.form.command")," ",c.jsx("span",{style:{color:"var(--revka-status-danger)"},children:"*"})]}),c.jsx("textarea",{className:"revka-input mt-2 w-full resize-y font-mono text-sm",rows:4,value:A,onChange:R=>O(R.target.value),placeholder:e("cron.form.command_placeholder")})]}),c.jsxs("div",{className:"flex justify-end gap-2 pt-2",children:[c.jsx("button",{className:"revka-button",onClick:K,children:e("cron.form.cancel")}),c.jsx("button",{className:"revka-button","data-variant":"primary",onClick:Q,disabled:$,children:e($?B?"cron.form.saving":"cron.form.adding":B?"cron.form.save":"cron.add_job")})]})]})}):null]})}function bPe(){const{t:e,tpl:n}=an(),[r,i]=b.useState([]),[s,a]=b.useState([]),[o,l]=b.useState(""),[u,d]=b.useState(null),[p,f]=b.useState(!0),[g,_]=b.useState(!0),[x,v]=b.useState(!0),[S,w]=b.useState(null),j=()=>{v(!0),Promise.all([SZ(),FZ()]).then(([E,A])=>{i(E),a(A)}).catch(E=>w({tone:"error",message:n("tools.failed_load",{message:E.message})})).finally(()=>v(!1))};b.useEffect(()=>{j()},[]);const C=b.useMemo(()=>{const E=o.toLowerCase();return r.filter(A=>A.name.toLowerCase().includes(E)||A.description.toLowerCase().includes(E))},[r,o]),T=b.useMemo(()=>{const E=o.toLowerCase();return s.filter(A=>A.name.toLowerCase().includes(E)||A.category.toLowerCase().includes(E))},[s,o]);return c.jsxs("div",{className:"flex h-[calc(100vh-6rem)] flex-col gap-3",children:[S?c.jsx(nl,{tone:S.tone,message:S.message,onDismiss:()=>w(null)}):null,c.jsx(oi,{kicker:e("tools.kicker"),title:e("tools.title"),description:e("tools.description"),actions:c.jsxs("button",{className:"revka-button",onClick:j,disabled:x,children:[c.jsx($r,{className:`h-4 w-4 ${x?"animate-spin":""}`}),e("tools.reload")]})}),c.jsx(qe,{className:"p-3",variant:"secondary",children:c.jsxs("div",{className:"relative",children:[c.jsx(Da,{className:"pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2",style:{color:"var(--revka-text-faint)"}}),c.jsx("input",{type:"text",className:"revka-input w-full pl-9",value:o,onChange:E=>l(E.target.value),placeholder:e("tools.search_placeholder")})]})}),x?c.jsx("div",{className:"flex min-h-0 flex-1 items-center justify-center",children:c.jsx(ft,{tone:"loading",title:e("tools.loading")})}):c.jsxs("div",{className:"flex min-h-0 flex-1 flex-col gap-4",children:[c.jsxs(qe,{className:`flex flex-col p-4 ${p?"min-h-0 flex-1":""}`,children:[c.jsxs("button",{type:"button",className:"flex w-full items-center gap-2 text-left",onClick:()=>f(E=>!E),"aria-expanded":p,children:[c.jsx(E0,{className:"h-4 w-4",style:{color:"var(--revka-signal-network)"}}),c.jsx("span",{className:"revka-kicker flex-1",children:n("tools.agent_tools_count",{count:C.length})}),c.jsx(Yo,{className:"h-4 w-4",style:{color:"var(--revka-text-faint)",transform:p?"rotate(0deg)":"rotate(-90deg)",transition:"transform 0.2s ease"}})]}),p?C.length===0?c.jsx("div",{className:"mt-4",children:c.jsx(ft,{tone:"empty",compact:!0,title:e(o?"tools.no_matches":"tools.no_agent_tools"),description:e(o?"tools.try_different":"tools.agent_tools_empty_desc")})}):c.jsx("div",{className:"mt-4 min-h-0 flex-1 overflow-y-auto pr-1",children:c.jsx("div",{className:"grid grid-cols-1 gap-3 md:grid-cols-2 xl:grid-cols-3",children:C.map(E=>{const A=u===E.name;return c.jsxs("div",{className:"overflow-hidden rounded-[12px] border",style:{borderColor:"var(--revka-border-soft)",background:"color-mix(in srgb, var(--revka-bg-panel-strong) 70%, transparent)"},children:[c.jsxs("button",{type:"button",className:"w-full p-3 text-left transition-colors",onClick:()=>d(A?null:E.name),children:[c.jsxs("div",{className:"flex items-start justify-between gap-2",children:[c.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[c.jsx(Ql,{className:"h-4 w-4 shrink-0",style:{color:"var(--revka-signal-network)"}}),c.jsx("h3",{className:"truncate text-sm font-semibold",style:{color:"var(--revka-text-primary)"},children:E.name})]}),A?c.jsx(Yo,{className:"h-4 w-4 shrink-0",style:{color:"var(--revka-signal-network)"}}):c.jsx(du,{className:"h-4 w-4 shrink-0",style:{color:"var(--revka-text-faint)"}})]}),c.jsx("p",{className:"mt-2 line-clamp-2 text-sm",style:{color:"var(--revka-text-secondary)"},children:E.description})]}),A&&E.parameters?c.jsxs("div",{className:"border-t p-3",style:{borderColor:"var(--revka-border-soft)"},children:[c.jsx("div",{className:"revka-kicker mb-2",children:e("tools.parameter_schema")}),c.jsx("pre",{className:"max-h-64 overflow-auto rounded-[8px] p-3 font-mono text-xs",style:{background:"var(--revka-bg-base)",color:"var(--revka-text-secondary)"},children:JSON.stringify(E.parameters,null,2)})]}):null]},E.name)})})}):null]}),c.jsxs(qe,{className:`flex flex-col p-4 ${g?"min-h-0 flex-1":""}`,children:[c.jsxs("button",{type:"button",className:"flex w-full items-center gap-2 text-left",onClick:()=>_(E=>!E),"aria-expanded":g,children:[c.jsx(jv,{className:"h-4 w-4",style:{color:"var(--revka-signal-selected)"}}),c.jsx("span",{className:"revka-kicker flex-1",children:n("tools.cli_tools_count",{count:T.length})}),c.jsx(Yo,{className:"h-4 w-4",style:{color:"var(--revka-text-faint)",transform:g?"rotate(0deg)":"rotate(-90deg)",transition:"transform 0.2s ease"}})]}),g?T.length===0?c.jsx("div",{className:"mt-4",children:c.jsx(ft,{tone:"empty",compact:!0,title:e(o?"tools.no_matches":"tools.no_cli_tools"),description:e(o?"tools.try_different":"tools.cli_tools_empty_desc")})}):c.jsx("div",{className:"mt-4 min-h-0 flex-1 overflow-auto",children:c.jsxs("table",{className:"revka-table w-full",children:[c.jsx("thead",{children:c.jsxs("tr",{children:[c.jsx("th",{children:e("tools.col.name")}),c.jsx("th",{children:e("tools.col.path")}),c.jsx("th",{children:e("tools.col.version")}),c.jsx("th",{children:e("tools.col.category")})]})}),c.jsx("tbody",{children:T.map(E=>c.jsxs("tr",{children:[c.jsx("td",{className:"text-sm font-medium",style:{color:"var(--revka-text-primary)"},children:E.name}),c.jsx("td",{className:"max-w-[260px] truncate font-mono text-xs",title:E.path,style:{color:"var(--revka-text-faint)"},children:E.path}),c.jsx("td",{style:{color:"var(--revka-text-faint)"},children:E.version??"—"}),c.jsx("td",{children:c.jsx("span",{className:"inline-flex items-center rounded-full border px-2.5 py-0.5 text-[10px] font-semibold capitalize",style:{borderColor:"var(--revka-border-soft)",color:"var(--revka-text-secondary)",background:"color-mix(in srgb, var(--revka-signal-selected) 8%, transparent)"},children:E.category})})]},E.name))})]})}):null]})]})]})}var Vh={},tC,Y8;function kPe(){return Y8||(Y8=1,tC=function(){return typeof Promise=="function"&&Promise.prototype&&Promise.prototype.then}),tC}var nC={},Hc={},G8;function Yd(){if(G8)return Hc;G8=1;let e;const n=[0,26,44,70,100,134,172,196,242,292,346,404,466,532,581,655,733,815,901,991,1085,1156,1258,1364,1474,1588,1706,1828,1921,2051,2185,2323,2465,2611,2761,2876,3034,3196,3362,3532,3706];return Hc.getSymbolSize=function(i){if(!i)throw new Error('"version" cannot be null or undefined');if(i<1||i>40)throw new Error('"version" should be in range from 1 to 40');return i*4+17},Hc.getSymbolTotalCodewords=function(i){return n[i]},Hc.getBCHDigit=function(r){let i=0;for(;r!==0;)i++,r>>>=1;return i},Hc.setToSJISFunction=function(i){if(typeof i!="function")throw new Error('"toSJISFunc" is not a valid function.');e=i},Hc.isKanjiModeEnabled=function(){return typeof e<"u"},Hc.toSJIS=function(i){return e(i)},Hc}var rC={},X8;function uM(){return X8||(X8=1,(function(e){e.L={bit:1},e.M={bit:0},e.Q={bit:3},e.H={bit:2};function n(r){if(typeof r!="string")throw new Error("Param is not a string");switch(r.toLowerCase()){case"l":case"low":return e.L;case"m":case"medium":return e.M;case"q":case"quartile":return e.Q;case"h":case"high":return e.H;default:throw new Error("Unknown EC Level: "+r)}}e.isValid=function(i){return i&&typeof i.bit<"u"&&i.bit>=0&&i.bit<4},e.from=function(i,s){if(e.isValid(i))return i;try{return n(i)}catch{return s}}})(rC)),rC}var iC,Q8;function wPe(){if(Q8)return iC;Q8=1;function e(){this.buffer=[],this.length=0}return e.prototype={get:function(n){const r=Math.floor(n/8);return(this.buffer[r]>>>7-n%8&1)===1},put:function(n,r){for(let i=0;i<r;i++)this.putBit((n>>>r-i-1&1)===1)},getLengthInBits:function(){return this.length},putBit:function(n){const r=Math.floor(this.length/8);this.buffer.length<=r&&this.buffer.push(0),n&&(this.buffer[r]|=128>>>this.length%8),this.length++}},iC=e,iC}var sC,Z8;function SPe(){if(Z8)return sC;Z8=1;function e(n){if(!n||n<1)throw new Error("BitMatrix size must be defined and greater than 0");this.size=n,this.data=new Uint8Array(n*n),this.reservedBit=new Uint8Array(n*n)}return e.prototype.set=function(n,r,i,s){const a=n*this.size+r;this.data[a]=i,s&&(this.reservedBit[a]=!0)},e.prototype.get=function(n,r){return this.data[n*this.size+r]},e.prototype.xor=function(n,r,i){this.data[n*this.size+r]^=i},e.prototype.isReserved=function(n,r){return this.reservedBit[n*this.size+r]},sC=e,sC}var aC={},J8;function CPe(){return J8||(J8=1,(function(e){const n=Yd().getSymbolSize;e.getRowColCoords=function(i){if(i===1)return[];const s=Math.floor(i/7)+2,a=n(i),o=a===145?26:Math.ceil((a-13)/(2*s-2))*2,l=[a-7];for(let u=1;u<s-1;u++)l[u]=l[u-1]-o;return l.push(6),l.reverse()},e.getPositions=function(i){const s=[],a=e.getRowColCoords(i),o=a.length;for(let l=0;l<o;l++)for(let u=0;u<o;u++)l===0&&u===0||l===0&&u===o-1||l===o-1&&u===0||s.push([a[l],a[u]]);return s}})(aC)),aC}var oC={},eB;function jPe(){if(eB)return oC;eB=1;const e=Yd().getSymbolSize,n=7;return oC.getPositions=function(i){const s=e(i);return[[0,0],[s-n,0],[0,s-n]]},oC}var lC={},tB;function NPe(){return tB||(tB=1,(function(e){e.Patterns={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};const n={N1:3,N2:3,N3:40,N4:10};e.isValid=function(s){return s!=null&&s!==""&&!isNaN(s)&&s>=0&&s<=7},e.from=function(s){return e.isValid(s)?parseInt(s,10):void 0},e.getPenaltyN1=function(s){const a=s.size;let o=0,l=0,u=0,d=null,p=null;for(let f=0;f<a;f++){l=u=0,d=p=null;for(let g=0;g<a;g++){let _=s.get(f,g);_===d?l++:(l>=5&&(o+=n.N1+(l-5)),d=_,l=1),_=s.get(g,f),_===p?u++:(u>=5&&(o+=n.N1+(u-5)),p=_,u=1)}l>=5&&(o+=n.N1+(l-5)),u>=5&&(o+=n.N1+(u-5))}return o},e.getPenaltyN2=function(s){const a=s.size;let o=0;for(let l=0;l<a-1;l++)for(let u=0;u<a-1;u++){const d=s.get(l,u)+s.get(l,u+1)+s.get(l+1,u)+s.get(l+1,u+1);(d===4||d===0)&&o++}return o*n.N2},e.getPenaltyN3=function(s){const a=s.size;let o=0,l=0,u=0;for(let d=0;d<a;d++){l=u=0;for(let p=0;p<a;p++)l=l<<1&2047|s.get(d,p),p>=10&&(l===1488||l===93)&&o++,u=u<<1&2047|s.get(p,d),p>=10&&(u===1488||u===93)&&o++}return o*n.N3},e.getPenaltyN4=function(s){let a=0;const o=s.data.length;for(let u=0;u<o;u++)a+=s.data[u];return Math.abs(Math.ceil(a*100/o/5)-10)*n.N4};function r(i,s,a){switch(i){case e.Patterns.PATTERN000:return(s+a)%2===0;case e.Patterns.PATTERN001:return s%2===0;case e.Patterns.PATTERN010:return a%3===0;case e.Patterns.PATTERN011:return(s+a)%3===0;case e.Patterns.PATTERN100:return(Math.floor(s/2)+Math.floor(a/3))%2===0;case e.Patterns.PATTERN101:return s*a%2+s*a%3===0;case e.Patterns.PATTERN110:return(s*a%2+s*a%3)%2===0;case e.Patterns.PATTERN111:return(s*a%3+(s+a)%2)%2===0;default:throw new Error("bad maskPattern:"+i)}}e.applyMask=function(s,a){const o=a.size;for(let l=0;l<o;l++)for(let u=0;u<o;u++)a.isReserved(u,l)||a.xor(u,l,r(s,u,l))},e.getBestMask=function(s,a){const o=Object.keys(e.Patterns).length;let l=0,u=1/0;for(let d=0;d<o;d++){a(d),e.applyMask(d,s);const p=e.getPenaltyN1(s)+e.getPenaltyN2(s)+e.getPenaltyN3(s)+e.getPenaltyN4(s);e.applyMask(d,s),p<u&&(u=p,l=d)}return l}})(lC)),lC}var mx={},nB;function iY(){if(nB)return mx;nB=1;const e=uM(),n=[1,1,1,1,1,1,1,1,1,1,2,2,1,2,2,4,1,2,4,4,2,4,4,4,2,4,6,5,2,4,6,6,2,5,8,8,4,5,8,8,4,5,8,11,4,8,10,11,4,9,12,16,4,9,16,16,6,10,12,18,6,10,17,16,6,11,16,19,6,13,18,21,7,14,21,25,8,16,20,25,8,17,23,25,9,17,23,34,9,18,25,30,10,20,27,32,12,21,29,35,12,23,34,37,12,25,34,40,13,26,35,42,14,28,38,45,15,29,40,48,16,31,43,51,17,33,45,54,18,35,48,57,19,37,51,60,19,38,53,63,20,40,56,66,21,43,59,70,22,45,62,74,24,47,65,77,25,49,68,81],r=[7,10,13,17,10,16,22,28,15,26,36,44,20,36,52,64,26,48,72,88,36,64,96,112,40,72,108,130,48,88,132,156,60,110,160,192,72,130,192,224,80,150,224,264,96,176,260,308,104,198,288,352,120,216,320,384,132,240,360,432,144,280,408,480,168,308,448,532,180,338,504,588,196,364,546,650,224,416,600,700,224,442,644,750,252,476,690,816,270,504,750,900,300,560,810,960,312,588,870,1050,336,644,952,1110,360,700,1020,1200,390,728,1050,1260,420,784,1140,1350,450,812,1200,1440,480,868,1290,1530,510,924,1350,1620,540,980,1440,1710,570,1036,1530,1800,570,1064,1590,1890,600,1120,1680,1980,630,1204,1770,2100,660,1260,1860,2220,720,1316,1950,2310,750,1372,2040,2430];return mx.getBlocksCount=function(s,a){switch(a){case e.L:return n[(s-1)*4+0];case e.M:return n[(s-1)*4+1];case e.Q:return n[(s-1)*4+2];case e.H:return n[(s-1)*4+3];default:return}},mx.getTotalCodewordsCount=function(s,a){switch(a){case e.L:return r[(s-1)*4+0];case e.M:return r[(s-1)*4+1];case e.Q:return r[(s-1)*4+2];case e.H:return r[(s-1)*4+3];default:return}},mx}var cC={},zm={},rB;function EPe(){if(rB)return zm;rB=1;const e=new Uint8Array(512),n=new Uint8Array(256);return(function(){let i=1;for(let s=0;s<255;s++)e[s]=i,n[i]=s,i<<=1,i&256&&(i^=285);for(let s=255;s<512;s++)e[s]=e[s-255]})(),zm.log=function(i){if(i<1)throw new Error("log("+i+")");return n[i]},zm.exp=function(i){return e[i]},zm.mul=function(i,s){return i===0||s===0?0:e[n[i]+n[s]]},zm}var iB;function APe(){return iB||(iB=1,(function(e){const n=EPe();e.mul=function(i,s){const a=new Uint8Array(i.length+s.length-1);for(let o=0;o<i.length;o++)for(let l=0;l<s.length;l++)a[o+l]^=n.mul(i[o],s[l]);return a},e.mod=function(i,s){let a=new Uint8Array(i);for(;a.length-s.length>=0;){const o=a[0];for(let u=0;u<s.length;u++)a[u]^=n.mul(s[u],o);let l=0;for(;l<a.length&&a[l]===0;)l++;a=a.slice(l)}return a},e.generateECPolynomial=function(i){let s=new Uint8Array([1]);for(let a=0;a<i;a++)s=e.mul(s,new Uint8Array([1,n.exp(a)]));return s}})(cC)),cC}var uC,sB;function TPe(){if(sB)return uC;sB=1;const e=APe();function n(r){this.genPoly=void 0,this.degree=r,this.degree&&this.initialize(this.degree)}return n.prototype.initialize=function(i){this.degree=i,this.genPoly=e.generateECPolynomial(this.degree)},n.prototype.encode=function(i){if(!this.genPoly)throw new Error("Encoder not initialized");const s=new Uint8Array(i.length+this.degree);s.set(i);const a=e.mod(s,this.genPoly),o=this.degree-a.length;if(o>0){const l=new Uint8Array(this.degree);return l.set(a,o),l}return a},uC=n,uC}var dC={},hC={},fC={},aB;function sY(){return aB||(aB=1,fC.isValid=function(n){return!isNaN(n)&&n>=1&&n<=40}),fC}var Eo={},oB;function aY(){if(oB)return Eo;oB=1;const e="[0-9]+",n="[A-Z $%*+\\-./:]+";let r="(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";r=r.replace(/u/g,"\\u");const i="(?:(?![A-Z0-9 $%*+\\-./:]|"+r+`)(?:.|[\r
]))+`;Eo.KANJI=new RegExp(r,"g"),Eo.BYTE_KANJI=new RegExp("[^A-Z0-9 $%*+\\-./:]+","g"),Eo.BYTE=new RegExp(i,"g"),Eo.NUMERIC=new RegExp(e,"g"),Eo.ALPHANUMERIC=new RegExp(n,"g");const s=new RegExp("^"+r+"$"),a=new RegExp("^"+e+"$"),o=new RegExp("^[A-Z0-9 $%*+\\-./:]+$");return Eo.testKanji=function(u){return s.test(u)},Eo.testNumeric=function(u){return a.test(u)},Eo.testAlphanumeric=function(u){return o.test(u)},Eo}var lB;function Gd(){return lB||(lB=1,(function(e){const n=sY(),r=aY();e.NUMERIC={id:"Numeric",bit:1,ccBits:[10,12,14]},e.ALPHANUMERIC={id:"Alphanumeric",bit:2,ccBits:[9,11,13]},e.BYTE={id:"Byte",bit:4,ccBits:[8,16,16]},e.KANJI={id:"Kanji",bit:8,ccBits:[8,10,12]},e.MIXED={bit:-1},e.getCharCountIndicator=function(a,o){if(!a.ccBits)throw new Error("Invalid mode: "+a);if(!n.isValid(o))throw new Error("Invalid version: "+o);return o>=1&&o<10?a.ccBits[0]:o<27?a.ccBits[1]:a.ccBits[2]},e.getBestModeForData=function(a){return r.testNumeric(a)?e.NUMERIC:r.testAlphanumeric(a)?e.ALPHANUMERIC:r.testKanji(a)?e.KANJI:e.BYTE},e.toString=function(a){if(a&&a.id)return a.id;throw new Error("Invalid mode")},e.isValid=function(a){return a&&a.bit&&a.ccBits};function i(s){if(typeof s!="string")throw new Error("Param is not a string");switch(s.toLowerCase()){case"numeric":return e.NUMERIC;case"alphanumeric":return e.ALPHANUMERIC;case"kanji":return e.KANJI;case"byte":return e.BYTE;default:throw new Error("Unknown mode: "+s)}}e.from=function(a,o){if(e.isValid(a))return a;try{return i(a)}catch{return o}}})(hC)),hC}var cB;function MPe(){return cB||(cB=1,(function(e){const n=Yd(),r=iY(),i=uM(),s=Gd(),a=sY(),o=7973,l=n.getBCHDigit(o);function u(g,_,x){for(let v=1;v<=40;v++)if(_<=e.getCapacity(v,x,g))return v}function d(g,_){return s.getCharCountIndicator(g,_)+4}function p(g,_){let x=0;return g.forEach(function(v){const S=d(v.mode,_);x+=S+v.getBitsLength()}),x}function f(g,_){for(let x=1;x<=40;x++)if(p(g,x)<=e.getCapacity(x,_,s.MIXED))return x}e.from=function(_,x){return a.isValid(_)?parseInt(_,10):x},e.getCapacity=function(_,x,v){if(!a.isValid(_))throw new Error("Invalid QR Code version");typeof v>"u"&&(v=s.BYTE);const S=n.getSymbolTotalCodewords(_),w=r.getTotalCodewordsCount(_,x),j=(S-w)*8;if(v===s.MIXED)return j;const C=j-d(v,_);switch(v){case s.NUMERIC:return Math.floor(C/10*3);case s.ALPHANUMERIC:return Math.floor(C/11*2);case s.KANJI:return Math.floor(C/13);case s.BYTE:default:return Math.floor(C/8)}},e.getBestVersionForData=function(_,x){let v;const S=i.from(x,i.M);if(Array.isArray(_)){if(_.length>1)return f(_,S);if(_.length===0)return 1;v=_[0]}else v=_;return u(v.mode,v.getLength(),S)},e.getEncodedBits=function(_){if(!a.isValid(_)||_<7)throw new Error("Invalid QR Code version");let x=_<<12;for(;n.getBCHDigit(x)-l>=0;)x^=o<<n.getBCHDigit(x)-l;return _<<12|x}})(dC)),dC}var pC={},uB;function RPe(){if(uB)return pC;uB=1;const e=Yd(),n=1335,r=21522,i=e.getBCHDigit(n);return pC.getEncodedBits=function(a,o){const l=a.bit<<3|o;let u=l<<10;for(;e.getBCHDigit(u)-i>=0;)u^=n<<e.getBCHDigit(u)-i;return(l<<10|u)^r},pC}var mC={},gC,dB;function OPe(){if(dB)return gC;dB=1;const e=Gd();function n(r){this.mode=e.NUMERIC,this.data=r.toString()}return n.getBitsLength=function(i){return 10*Math.floor(i/3)+(i%3?i%3*3+1:0)},n.prototype.getLength=function(){return this.data.length},n.prototype.getBitsLength=function(){return n.getBitsLength(this.data.length)},n.prototype.write=function(i){let s,a,o;for(s=0;s+3<=this.data.length;s+=3)a=this.data.substr(s,3),o=parseInt(a,10),i.put(o,10);const l=this.data.length-s;l>0&&(a=this.data.substr(s),o=parseInt(a,10),i.put(o,l*3+1))},gC=n,gC}var vC,hB;function DPe(){if(hB)return vC;hB=1;const e=Gd(),n=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"," ","$","%","*","+","-",".","/",":"];function r(i){this.mode=e.ALPHANUMERIC,this.data=i}return r.getBitsLength=function(s){return 11*Math.floor(s/2)+6*(s%2)},r.prototype.getLength=function(){return this.data.length},r.prototype.getBitsLength=function(){return r.getBitsLength(this.data.length)},r.prototype.write=function(s){let a;for(a=0;a+2<=this.data.length;a+=2){let o=n.indexOf(this.data[a])*45;o+=n.indexOf(this.data[a+1]),s.put(o,11)}this.data.length%2&&s.put(n.indexOf(this.data[a]),6)},vC=r,vC}var yC,fB;function PPe(){if(fB)return yC;fB=1;const e=Gd();function n(r){this.mode=e.BYTE,typeof r=="string"?this.data=new TextEncoder().encode(r):this.data=new Uint8Array(r)}return n.getBitsLength=function(i){return i*8},n.prototype.getLength=function(){return this.data.length},n.prototype.getBitsLength=function(){return n.getBitsLength(this.data.length)},n.prototype.write=function(r){for(let i=0,s=this.data.length;i<s;i++)r.put(this.data[i],8)},yC=n,yC}var _C,pB;function LPe(){if(pB)return _C;pB=1;const e=Gd(),n=Yd();function r(i){this.mode=e.KANJI,this.data=i}return r.getBitsLength=function(s){return s*13},r.prototype.getLength=function(){return this.data.length},r.prototype.getBitsLength=function(){return r.getBitsLength(this.data.length)},r.prototype.write=function(i){let s;for(s=0;s<this.data.length;s++){let a=n.toSJIS(this.data[s]);if(a>=33088&&a<=40956)a-=33088;else if(a>=57408&&a<=60351)a-=49472;else throw new Error("Invalid SJIS character: "+this.data[s]+`
Make sure your charset is UTF-8`);a=(a>>>8&255)*192+(a&255),i.put(a,13)}},_C=r,_C}var xC={exports:{}},mB;function IPe(){return mB||(mB=1,(function(e){var n={single_source_shortest_paths:function(r,i,s){var a={},o={};o[i]=0;var l=n.PriorityQueue.make();l.push(i,0);for(var u,d,p,f,g,_,x,v,S;!l.empty();){u=l.pop(),d=u.value,f=u.cost,g=r[d]||{};for(p in g)g.hasOwnProperty(p)&&(_=g[p],x=f+_,v=o[p],S=typeof o[p]>"u",(S||v>x)&&(o[p]=x,l.push(p,x),a[p]=d))}if(typeof s<"u"&&typeof o[s]>"u"){var w=["Could not find a path from ",i," to ",s,"."].join("");throw new Error(w)}return a},extract_shortest_path_from_predecessor_list:function(r,i){for(var s=[],a=i;a;)s.push(a),r[a],a=r[a];return s.reverse(),s},find_path:function(r,i,s){var a=n.single_source_shortest_paths(r,i,s);return n.extract_shortest_path_from_predecessor_list(a,s)},PriorityQueue:{make:function(r){var i=n.PriorityQueue,s={},a;r=r||{};for(a in i)i.hasOwnProperty(a)&&(s[a]=i[a]);return s.queue=[],s.sorter=r.sorter||i.default_sorter,s},default_sorter:function(r,i){return r.cost-i.cost},push:function(r,i){var s={value:r,cost:i};this.queue.push(s),this.queue.sort(this.sorter)},pop:function(){return this.queue.shift()},empty:function(){return this.queue.length===0}}};e.exports=n})(xC)),xC.exports}var gB;function BPe(){return gB||(gB=1,(function(e){const n=Gd(),r=OPe(),i=DPe(),s=PPe(),a=LPe(),o=aY(),l=Yd(),u=IPe();function d(w){return unescape(encodeURIComponent(w)).length}function p(w,j,C){const T=[];let E;for(;(E=w.exec(C))!==null;)T.push({data:E[0],index:E.index,mode:j,length:E[0].length});return T}function f(w){const j=p(o.NUMERIC,n.NUMERIC,w),C=p(o.ALPHANUMERIC,n.ALPHANUMERIC,w);let T,E;return l.isKanjiModeEnabled()?(T=p(o.BYTE,n.BYTE,w),E=p(o.KANJI,n.KANJI,w)):(T=p(o.BYTE_KANJI,n.BYTE,w),E=[]),j.concat(C,T,E).sort(function(O,F){return O.index-F.index}).map(function(O){return{data:O.data,mode:O.mode,length:O.length}})}function g(w,j){switch(j){case n.NUMERIC:return r.getBitsLength(w);case n.ALPHANUMERIC:return i.getBitsLength(w);case n.KANJI:return a.getBitsLength(w);case n.BYTE:return s.getBitsLength(w)}}function _(w){return w.reduce(function(j,C){const T=j.length-1>=0?j[j.length-1]:null;return T&&T.mode===C.mode?(j[j.length-1].data+=C.data,j):(j.push(C),j)},[])}function x(w){const j=[];for(let C=0;C<w.length;C++){const T=w[C];switch(T.mode){case n.NUMERIC:j.push([T,{data:T.data,mode:n.ALPHANUMERIC,length:T.length},{data:T.data,mode:n.BYTE,length:T.length}]);break;case n.ALPHANUMERIC:j.push([T,{data:T.data,mode:n.BYTE,length:T.length}]);break;case n.KANJI:j.push([T,{data:T.data,mode:n.BYTE,length:d(T.data)}]);break;case n.BYTE:j.push([{data:T.data,mode:n.BYTE,length:d(T.data)}])}}return j}function v(w,j){const C={},T={start:{}};let E=["start"];for(let A=0;A<w.length;A++){const O=w[A],F=[];for(let L=0;L<O.length;L++){const $=O[L],z=""+A+L;F.push(z),C[z]={node:$,lastCount:0},T[z]={};for(let B=0;B<E.length;B++){const H=E[B];C[H]&&C[H].node.mode===$.mode?(T[H][z]=g(C[H].lastCount+$.length,$.mode)-g(C[H].lastCount,$.mode),C[H].lastCount+=$.length):(C[H]&&(C[H].lastCount=$.length),T[H][z]=g($.length,$.mode)+4+n.getCharCountIndicator($.mode,j))}}E=F}for(let A=0;A<E.length;A++)T[E[A]].end=0;return{map:T,table:C}}function S(w,j){let C;const T=n.getBestModeForData(w);if(C=n.from(j,T),C!==n.BYTE&&C.bit<T.bit)throw new Error('"'+w+'" cannot be encoded with mode '+n.toString(C)+`.
 Suggested mode is: `+n.toString(T));switch(C===n.KANJI&&!l.isKanjiModeEnabled()&&(C=n.BYTE),C){case n.NUMERIC:return new r(w);case n.ALPHANUMERIC:return new i(w);case n.KANJI:return new a(w);case n.BYTE:return new s(w)}}e.fromArray=function(j){return j.reduce(function(C,T){return typeof T=="string"?C.push(S(T,null)):T.data&&C.push(S(T.data,T.mode)),C},[])},e.fromString=function(j,C){const T=f(j,l.isKanjiModeEnabled()),E=x(T),A=v(E,C),O=u.find_path(A.map,"start","end"),F=[];for(let L=1;L<O.length-1;L++)F.push(A.table[O[L]].node);return e.fromArray(_(F))},e.rawSplit=function(j){return e.fromArray(f(j,l.isKanjiModeEnabled()))}})(mC)),mC}var vB;function zPe(){if(vB)return nC;vB=1;const e=Yd(),n=uM(),r=wPe(),i=SPe(),s=CPe(),a=jPe(),o=NPe(),l=iY(),u=TPe(),d=MPe(),p=RPe(),f=Gd(),g=BPe();function _(A,O){const F=A.size,L=a.getPositions(O);for(let $=0;$<L.length;$++){const z=L[$][0],B=L[$][1];for(let H=-1;H<=7;H++)if(!(z+H<=-1||F<=z+H))for(let D=-1;D<=7;D++)B+D<=-1||F<=B+D||(H>=0&&H<=6&&(D===0||D===6)||D>=0&&D<=6&&(H===0||H===6)||H>=2&&H<=4&&D>=2&&D<=4?A.set(z+H,B+D,!0,!0):A.set(z+H,B+D,!1,!0))}}function x(A){const O=A.size;for(let F=8;F<O-8;F++){const L=F%2===0;A.set(F,6,L,!0),A.set(6,F,L,!0)}}function v(A,O){const F=s.getPositions(O);for(let L=0;L<F.length;L++){const $=F[L][0],z=F[L][1];for(let B=-2;B<=2;B++)for(let H=-2;H<=2;H++)B===-2||B===2||H===-2||H===2||B===0&&H===0?A.set($+B,z+H,!0,!0):A.set($+B,z+H,!1,!0)}}function S(A,O){const F=A.size,L=d.getEncodedBits(O);let $,z,B;for(let H=0;H<18;H++)$=Math.floor(H/3),z=H%3+F-8-3,B=(L>>H&1)===1,A.set($,z,B,!0),A.set(z,$,B,!0)}function w(A,O,F){const L=A.size,$=p.getEncodedBits(O,F);let z,B;for(z=0;z<15;z++)B=($>>z&1)===1,z<6?A.set(z,8,B,!0):z<8?A.set(z+1,8,B,!0):A.set(L-15+z,8,B,!0),z<8?A.set(8,L-z-1,B,!0):z<9?A.set(8,15-z-1+1,B,!0):A.set(8,15-z-1,B,!0);A.set(L-8,8,1,!0)}function j(A,O){const F=A.size;let L=-1,$=F-1,z=7,B=0;for(let H=F-1;H>0;H-=2)for(H===6&&H--;;){for(let D=0;D<2;D++)if(!A.isReserved($,H-D)){let U=!1;B<O.length&&(U=(O[B]>>>z&1)===1),A.set($,H-D,U),z--,z===-1&&(B++,z=7)}if($+=L,$<0||F<=$){$-=L,L=-L;break}}}function C(A,O,F){const L=new r;F.forEach(function(D){L.put(D.mode.bit,4),L.put(D.getLength(),f.getCharCountIndicator(D.mode,A)),D.write(L)});const $=e.getSymbolTotalCodewords(A),z=l.getTotalCodewordsCount(A,O),B=($-z)*8;for(L.getLengthInBits()+4<=B&&L.put(0,4);L.getLengthInBits()%8!==0;)L.putBit(0);const H=(B-L.getLengthInBits())/8;for(let D=0;D<H;D++)L.put(D%2?17:236,8);return T(L,A,O)}function T(A,O,F){const L=e.getSymbolTotalCodewords(O),$=l.getTotalCodewordsCount(O,F),z=L-$,B=l.getBlocksCount(O,F),H=L%B,D=B-H,U=Math.floor(L/B),I=Math.floor(z/B),X=I+1,K=U-I,Q=new u(K);let V=0;const R=new Array(B),q=new Array(B);let W=0;const te=new Uint8Array(A.buffer);for(let le=0;le<B;le++){const oe=le<D?I:X;R[le]=te.slice(V,V+oe),q[le]=Q.encode(R[le]),V+=oe,W=Math.max(W,oe)}const J=new Uint8Array(L);let G=0,re,ne;for(re=0;re<W;re++)for(ne=0;ne<B;ne++)re<R[ne].length&&(J[G++]=R[ne][re]);for(re=0;re<K;re++)for(ne=0;ne<B;ne++)J[G++]=q[ne][re];return J}function E(A,O,F,L){let $;if(Array.isArray(A))$=g.fromArray(A);else if(typeof A=="string"){let U=O;if(!U){const I=g.rawSplit(A);U=d.getBestVersionForData(I,F)}$=g.fromString(A,U||40)}else throw new Error("Invalid data");const z=d.getBestVersionForData($,F);if(!z)throw new Error("The amount of data is too big to be stored in a QR Code");if(!O)O=z;else if(O<z)throw new Error(`
The chosen QR Code version cannot contain this amount of data.
Minimum version required to store current data is: `+z+`.
`);const B=C(O,F,$),H=e.getSymbolSize(O),D=new i(H);return _(D,O),x(D),v(D,O),w(D,F,0),O>=7&&S(D,O),j(D,B),isNaN(L)&&(L=o.getBestMask(D,w.bind(null,D,F))),o.applyMask(L,D),w(D,F,L),{modules:D,version:O,errorCorrectionLevel:F,maskPattern:L,segments:$}}return nC.create=function(O,F){if(typeof O>"u"||O==="")throw new Error("No input text");let L=n.M,$,z;return typeof F<"u"&&(L=n.from(F.errorCorrectionLevel,n.M),$=d.from(F.version),z=o.from(F.maskPattern),F.toSJISFunc&&e.setToSJISFunction(F.toSJISFunc)),E(O,$,L,z)},nC}var bC={},kC={},yB;function oY(){return yB||(yB=1,(function(e){function n(r){if(typeof r=="number"&&(r=r.toString()),typeof r!="string")throw new Error("Color should be defined as hex string");let i=r.slice().replace("#","").split("");if(i.length<3||i.length===5||i.length>8)throw new Error("Invalid hex color: "+r);(i.length===3||i.length===4)&&(i=Array.prototype.concat.apply([],i.map(function(a){return[a,a]}))),i.length===6&&i.push("F","F");const s=parseInt(i.join(""),16);return{r:s>>24&255,g:s>>16&255,b:s>>8&255,a:s&255,hex:"#"+i.slice(0,6).join("")}}e.getOptions=function(i){i||(i={}),i.color||(i.color={});const s=typeof i.margin>"u"||i.margin===null||i.margin<0?4:i.margin,a=i.width&&i.width>=21?i.width:void 0,o=i.scale||4;return{width:a,scale:a?4:o,margin:s,color:{dark:n(i.color.dark||"#000000ff"),light:n(i.color.light||"#ffffffff")},type:i.type,rendererOpts:i.rendererOpts||{}}},e.getScale=function(i,s){return s.width&&s.width>=i+s.margin*2?s.width/(i+s.margin*2):s.scale},e.getImageWidth=function(i,s){const a=e.getScale(i,s);return Math.floor((i+s.margin*2)*a)},e.qrToImageData=function(i,s,a){const o=s.modules.size,l=s.modules.data,u=e.getScale(o,a),d=Math.floor((o+a.margin*2)*u),p=a.margin*u,f=[a.color.light,a.color.dark];for(let g=0;g<d;g++)for(let _=0;_<d;_++){let x=(g*d+_)*4,v=a.color.light;if(g>=p&&_>=p&&g<d-p&&_<d-p){const S=Math.floor((g-p)/u),w=Math.floor((_-p)/u);v=f[l[S*o+w]?1:0]}i[x++]=v.r,i[x++]=v.g,i[x++]=v.b,i[x]=v.a}}})(kC)),kC}var _B;function $Pe(){return _B||(_B=1,(function(e){const n=oY();function r(s,a,o){s.clearRect(0,0,a.width,a.height),a.style||(a.style={}),a.height=o,a.width=o,a.style.height=o+"px",a.style.width=o+"px"}function i(){try{return document.createElement("canvas")}catch{throw new Error("You need to specify a canvas element")}}e.render=function(a,o,l){let u=l,d=o;typeof u>"u"&&(!o||!o.getContext)&&(u=o,o=void 0),o||(d=i()),u=n.getOptions(u);const p=n.getImageWidth(a.modules.size,u),f=d.getContext("2d"),g=f.createImageData(p,p);return n.qrToImageData(g.data,a,u),r(f,d,p),f.putImageData(g,0,0),d},e.renderToDataURL=function(a,o,l){let u=l;typeof u>"u"&&(!o||!o.getContext)&&(u=o,o=void 0),u||(u={});const d=e.render(a,o,u),p=u.type||"image/png",f=u.rendererOpts||{};return d.toDataURL(p,f.quality)}})(bC)),bC}var wC={},xB;function FPe(){if(xB)return wC;xB=1;const e=oY();function n(s,a){const o=s.a/255,l=a+'="'+s.hex+'"';return o<1?l+" "+a+'-opacity="'+o.toFixed(2).slice(1)+'"':l}function r(s,a,o){let l=s+a;return typeof o<"u"&&(l+=" "+o),l}function i(s,a,o){let l="",u=0,d=!1,p=0;for(let f=0;f<s.length;f++){const g=Math.floor(f%a),_=Math.floor(f/a);!g&&!d&&(d=!0),s[f]?(p++,f>0&&g>0&&s[f-1]||(l+=d?r("M",g+o,.5+_+o):r("m",u,0),u=0,d=!1),g+1<a&&s[f+1]||(l+=r("h",p),p=0)):u++}return l}return wC.render=function(a,o,l){const u=e.getOptions(o),d=a.modules.size,p=a.modules.data,f=d+u.margin*2,g=u.color.light.a?"<path "+n(u.color.light,"fill")+' d="M0 0h'+f+"v"+f+'H0z"/>':"",_="<path "+n(u.color.dark,"stroke")+' d="'+i(p,d,u.margin)+'"/>',x='viewBox="0 0 '+f+" "+f+'"',S='<svg xmlns="http://www.w3.org/2000/svg" '+(u.width?'width="'+u.width+'" height="'+u.width+'" ':"")+x+' shape-rendering="crispEdges">'+g+_+`</svg>
`;return typeof l=="function"&&l(null,S),S},wC}var bB;function HPe(){if(bB)return Vh;bB=1;const e=kPe(),n=zPe(),r=$Pe(),i=FPe();function s(a,o,l,u,d){const p=[].slice.call(arguments,1),f=p.length,g=typeof p[f-1]=="function";if(!g&&!e())throw new Error("Callback required as last argument");if(g){if(f<2)throw new Error("Too few arguments provided");f===2?(d=l,l=o,o=u=void 0):f===3&&(o.getContext&&typeof d>"u"?(d=u,u=void 0):(d=u,u=l,l=o,o=void 0))}else{if(f<1)throw new Error("Too few arguments provided");return f===1?(l=o,o=u=void 0):f===2&&!o.getContext&&(u=l,l=o,o=void 0),new Promise(function(_,x){try{const v=n.create(l,u);_(a(v,o,u))}catch(v){x(v)}})}try{const _=n.create(l,u);d(null,a(_,o,u))}catch(_){d(_)}}return Vh.create=n.create,Vh.toCanvas=s.bind(null,r.render),Vh.toDataURL=s.bind(null,r.renderToDataURL),Vh.toString=s.bind(null,function(a,o,l){return i.render(a,l)}),Vh}var WPe=HPe();const qPe=wu(WPe);function UPe(e){const n=Oi||window.location.origin;return JSON.stringify({v:1,type:"revka-pair",host:`${n}${Xr||""}`.replace(/\/+$/,""),code:e})}function KPe(){const{t:e,tpl:n}=an(),[r,i]=b.useState([]),[s,a]=b.useState(!0),[o,l]=b.useState(null),[u,d]=b.useState(null),[p,f]=b.useState(!1),[g,_]=b.useState(!1),[x,v]=b.useState(null),[S,w]=b.useState("Revka CLI"),[j,C]=b.useState(()=>ZB("cli").hardware??""),[T,E]=b.useState(null),[A,O]=b.useState(null),F=b.useRef(0),L=b.useCallback(async()=>{a(!0);try{const D=await Ye("/api/devices");i(D.devices??[])}catch(D){O({tone:"error",message:D instanceof Error?D.message:e("pairing.err.load_devices")})}finally{a(!1)}},[e]);b.useEffect(()=>{JB().then(D=>{D.pairing_code&&l(D.pairing_code)}).catch(()=>{})},[]),b.useEffect(()=>{L()},[L]),b.useEffect(()=>{if(!o){d(null);return}const D=++F.current;qPe.toDataURL(UPe(o),{errorCorrectionLevel:"M",margin:1,width:256,color:{dark:"#0a0a0a",light:"#ffffff"}}).then(U=>{F.current===D&&d(U)}).catch(()=>{F.current===D&&d(null)})},[o]);const $=async()=>{f(!0);try{const D=await Ye("/api/pairing/initiate",{method:"POST"});l(D.pairing_code),v(null),O({tone:"success",message:e("pairing.toast.code_generated")})}catch(D){O({tone:"error",message:D instanceof Error?D.message:e("pairing.err.gen_code")})}finally{f(!1)}},z=async()=>{if(o){_(!0),v(null);try{const D=await gZ(o,{device_name:S.trim()||"Revka CLI",device_type:"cli",hardware:j.trim()||void 0});v(D.token),l(null),await L(),O({tone:"success",message:e("pairing.toast.token_minted")})}catch(D){O({tone:"error",message:D instanceof Error?D.message:e("pairing.err.mint_token")})}finally{_(!1)}}},B=D=>{if(!D)return e("pairing.unknown");const U={"legacy-pair":e("pairing.device_type.api_client"),"api-client":e("pairing.device_type.api_client"),browser:e("pairing.device_type.browser"),cli:e("pairing.device_type.cli"),mobile:e("pairing.device_type.mobile"),tablet:e("pairing.device_type.tablet")};return U[D]?U[D]:D.split(/[-_]/).filter(Boolean).map(I=>I.charAt(0).toUpperCase()+I.slice(1)).join(" ")},H=async D=>{try{await Ye(`/api/devices/${D}`,{method:"DELETE"}),i(U=>U.filter(I=>I.id!==D)),O({tone:"success",message:e("pairing.toast.device_revoked")})}catch(U){O({tone:"error",message:U instanceof Error?U.message:e("pairing.err.revoke")})}finally{E(null)}};return c.jsxs("div",{className:"flex h-[calc(100vh-6rem)] flex-col gap-3",children:[A?c.jsx(nl,{tone:A.tone,message:A.message,onDismiss:()=>O(null)}):null,c.jsx(oi,{kicker:e("pairing.kicker"),title:e("pairing.title"),description:e("pairing.description"),actions:c.jsxs(c.Fragment,{children:[c.jsxs("button",{className:"revka-button",onClick:L,disabled:s,children:[c.jsx($r,{className:`h-4 w-4 ${s?"animate-spin":""}`}),e("pairing.reload")]}),c.jsxs("button",{className:"revka-button","data-variant":"primary",onClick:$,disabled:p,children:[c.jsx(RC,{className:"h-4 w-4"}),e(p?"pairing.generating":"pairing.pair_new_device")]})]})}),c.jsxs("div",{className:"grid gap-3",style:{gridTemplateColumns:o?"minmax(0, 1fr) 22rem":"minmax(0, 1fr)"},children:[o?c.jsxs(qe,{className:"p-5",variant:"secondary",children:[c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx(Oee,{className:"h-4 w-4",style:{color:"var(--revka-signal-network)"}}),c.jsx("div",{className:"revka-kicker",children:e("pairing.active_code")})]}),c.jsxs("div",{className:"mt-5 grid grid-cols-[auto_minmax(0,1fr)] gap-5",children:[c.jsx("div",{className:"flex h-[224px] w-[224px] items-center justify-center overflow-hidden rounded-[12px] border",style:{borderColor:"var(--revka-border-soft)",background:"#ffffff"},children:u?c.jsx("img",{src:u,alt:"Pairing QR code",className:"h-full w-full object-contain"}):c.jsx("div",{className:"text-xs",style:{color:"#666"},children:e("pairing.rendering")})}),c.jsxs("div",{className:"flex min-w-0 flex-col justify-between",children:[c.jsxs("div",{children:[c.jsx("div",{className:"rounded-[12px] border px-4 py-3 text-center font-mono text-3xl font-bold tracking-[0.4em]",style:{borderColor:"color-mix(in srgb, var(--revka-signal-selected) 35%, transparent)",background:"color-mix(in srgb, var(--revka-signal-selected) 12%, transparent)",color:"var(--revka-text-primary)"},children:o}),c.jsx("p",{className:"mt-3 text-xs leading-5",style:{color:"var(--revka-text-secondary)"},children:e("pairing.code_hint")})]}),c.jsxs("div",{className:"mt-4 grid gap-2 sm:grid-cols-2",children:[c.jsxs("label",{className:"min-w-0 text-xs font-medium",style:{color:"var(--revka-text-secondary)"},children:[e("pairing.cli_device_name"),c.jsx("input",{className:"revka-input mt-1 h-9 w-full",value:S,onChange:D=>w(D.target.value)})]}),c.jsxs("label",{className:"min-w-0 text-xs font-medium",style:{color:"var(--revka-text-secondary)"},children:[e("pairing.cli_hardware"),c.jsx("input",{className:"revka-input mt-1 h-9 w-full",value:j,onChange:D=>C(D.target.value),placeholder:e("pairing.cli_hardware_placeholder")})]})]}),c.jsxs("div",{className:"mt-4 flex flex-wrap gap-2",children:[c.jsx("button",{className:"revka-button",onClick:async()=>{const D=await ro(o);O(D?{tone:"success",message:e("pairing.toast.code_copied")}:{tone:"error",message:e("pairing.toast.copy_failed")})},children:e("pairing.copy_code")}),c.jsxs("button",{className:"revka-button",onClick:$,disabled:p,children:[c.jsx($r,{className:`h-4 w-4 ${p?"animate-spin":""}`}),e("pairing.rotate")]}),c.jsxs("button",{className:"revka-button","data-variant":"primary",onClick:z,disabled:g,children:[c.jsx(bO,{className:"h-4 w-4"}),e(g?"pairing.minting_token":"pairing.mint_cli_token")]})]})]})]})]}):c.jsx(qe,{className:"p-5",children:c.jsx(ft,{tone:"empty",title:e("pairing.no_code_title"),description:e("pairing.no_code_desc"),action:c.jsxs("button",{className:"revka-button","data-variant":"primary",onClick:$,disabled:p,children:[c.jsx(RC,{className:"h-4 w-4"}),e(p?"pairing.generating":"pairing.pair_new_device")]})})}),o?c.jsxs(qe,{className:"p-4",variant:"utility",children:[c.jsx("div",{className:"revka-kicker",children:e("pairing.how_to_scan")}),c.jsxs("ol",{className:"mt-3 list-inside list-decimal space-y-2 text-xs leading-5",style:{color:"var(--revka-text-secondary)"},children:[c.jsx("li",{children:e("pairing.scan_step1")}),c.jsxs("li",{children:[e("pairing.scan_step2_prefix"),c.jsx("span",{style:{color:"var(--revka-text-primary)"},children:e("pairing.scan_step2_action")}),e("pairing.scan_step2_suffix")]}),c.jsx("li",{children:e("pairing.scan_step3")}),c.jsx("li",{children:e("pairing.scan_step4")})]})]}):null]}),x?c.jsx(qe,{className:"p-4",variant:"utility",children:c.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[c.jsxs("div",{className:"min-w-0 flex-1",children:[c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx(bO,{className:"h-4 w-4",style:{color:"var(--revka-signal-network)"}}),c.jsx("div",{className:"revka-kicker",children:e("pairing.minted_token")})]}),c.jsx("div",{className:"mt-2 max-w-full break-all rounded-[8px] border px-3 py-2 font-mono text-xs",style:{borderColor:"var(--revka-border-soft)",color:"var(--revka-text-primary)"},children:x})]}),c.jsxs("button",{className:"revka-button",onClick:async()=>{const D=await ro(x);O(D?{tone:"success",message:e("pairing.toast.token_copied")}:{tone:"error",message:e("pairing.toast.copy_failed")})},children:[c.jsx(rc,{className:"h-4 w-4"}),e("pairing.copy_token")]})]})}):null,c.jsxs(qe,{className:"min-h-0 flex-1 overflow-hidden p-0",children:[c.jsx("div",{className:"flex items-center justify-between border-b px-4 py-3",style:{borderColor:"var(--revka-border-soft)"},children:c.jsx("div",{className:"revka-kicker",children:n("pairing.paired_devices",{count:r.length})})}),s?c.jsx("div",{className:"flex min-h-[180px] items-center justify-center",children:c.jsx(ft,{tone:"loading",title:e("pairing.loading_devices")})}):r.length===0?c.jsx("div",{className:"p-4",children:c.jsx(ft,{tone:"empty",title:e("pairing.no_devices_title"),description:e("pairing.no_devices_desc")})}):c.jsx("div",{className:"overflow-auto",children:c.jsxs("table",{className:"revka-table w-full",children:[c.jsx("thead",{children:c.jsxs("tr",{children:[c.jsx("th",{children:e("pairing.col.name")}),c.jsx("th",{children:e("pairing.col.type")}),c.jsx("th",{children:e("pairing.col.hardware")}),c.jsx("th",{children:e("pairing.col.paired")}),c.jsx("th",{children:e("pairing.col.last_seen")}),c.jsx("th",{children:e("pairing.col.ip")}),c.jsx("th",{className:"text-right",children:e("pairing.col.actions")})]})}),c.jsx("tbody",{children:r.map(D=>c.jsxs("tr",{children:[c.jsx("td",{className:"text-sm font-medium",style:{color:"var(--revka-text-primary)"},children:D.name||e("pairing.unnamed")}),c.jsx("td",{style:{color:"var(--revka-text-secondary)"},children:B(D.device_type)}),c.jsx("td",{className:"text-xs",style:{color:"var(--revka-text-secondary)"},children:D.hardware||"—"}),c.jsx("td",{className:"text-xs",style:{color:"var(--revka-text-faint)"},children:new Date(D.paired_at).toLocaleDateString()}),c.jsx("td",{className:"text-xs",style:{color:"var(--revka-text-faint)"},children:new Date(D.last_seen).toLocaleString()}),c.jsx("td",{className:"font-mono text-xs",style:{color:"var(--revka-text-secondary)"},children:D.ip_address||"—"}),c.jsx("td",{className:"text-right",children:T===D.id?c.jsxs("div",{className:"inline-flex items-center gap-2",children:[c.jsx("span",{className:"text-xs",style:{color:"var(--revka-status-danger)"},children:e("pairing.revoke")}),c.jsx("button",{className:"text-xs font-semibold",style:{color:"var(--revka-status-danger)"},onClick:()=>H(D.id),children:e("pairing.yes")}),c.jsx("button",{className:"text-xs font-semibold",style:{color:"var(--revka-text-secondary)"},onClick:()=>E(null),children:e("pairing.no")})]}):c.jsx("button",{className:"revka-button",onClick:()=>E(D.id),title:e("pairing.revoke_title"),children:c.jsx(Ki,{className:"h-4 w-4"})})})]},D.id))})]})})]})]})}const dM="revka-agent-events-v1",kB=500,VPe=b.createContext({events:[],pushEvent:()=>{},clearEvents:()=>{}});function YPe(){try{const e=sessionStorage.getItem(dM);if(e){const n=JSON.parse(e);if(Array.isArray(n))return n}}catch{}return[]}function GPe(e){try{sessionStorage.setItem(dM,JSON.stringify(e))}catch{}}function XPe({children:e}){const[n,r]=b.useState(YPe),i=b.useRef(n);i.current=n,b.useEffect(()=>{GPe(n)},[n]);const s=b.useCallback(o=>{r(l=>{if(l.length>0&&l.some(p=>p.agentId===o.agentId&&p.timestamp===o.timestamp&&p.type===o.type))return l;const d=[...l,o];return d.length>kB?d.slice(d.length-kB):d})},[]),a=b.useCallback(()=>{r([]),sessionStorage.removeItem(dM)},[]);return b.useEffect(()=>{const o=new Dv;o.onEvent=d=>{if(d.type!=="channel_event")return;const p=d.payload;if(!p||!p.type||!p.agentId)return;const f={type:p.type,agentId:p.agentId,agentTitle:p.agentTitle??"",content:p.content??{},timestamp:p.timestamp??new Date().toISOString()};s(f)},o.connect();const l=()=>{document.visibilityState==="visible"&&o.reconnectNow()},u=()=>o.reconnectNow();return document.addEventListener("visibilitychange",l),window.addEventListener("online",u),()=>{document.removeEventListener("visibilitychange",l),window.removeEventListener("online",u),o.disconnect()}},[s]),c.jsx(VPe.Provider,{value:{events:n,pushEvent:s,clearEvents:a},children:e})}function QPe(){const{toasts:e,dismissToast:n}=jA();return e.length===0?null:c.jsx("div",{className:"pointer-events-none fixed top-4 right-4 z-50 flex w-[min(22rem,90vw)] flex-col gap-2",children:e.map(r=>c.jsxs("div",{className:"revka-panel pointer-events-auto flex gap-3 p-3 shadow-lg",style:{borderColor:"var(--revka-signal-live)",background:"var(--revka-surface-raised, var(--revka-surface))"},role:"alert",children:[c.jsx(C0,{className:"mt-0.5 h-4 w-4 shrink-0",style:{color:"var(--revka-signal-live)"}}),c.jsxs("div",{className:"min-w-0 flex-1",children:[c.jsx("div",{className:"revka-kicker text-[10px]",children:"Approval needed"}),c.jsx("div",{className:"mt-0.5 truncate text-sm font-medium",children:r.workflowName||r.title}),r.message?c.jsx("p",{className:"mt-1 line-clamp-2 text-xs",style:{color:"var(--revka-text-secondary)"},children:r.message}):null,c.jsxs("div",{className:"mt-2 flex items-center gap-2",children:[c.jsx(Ss,{to:`/runs?run=${encodeURIComponent(r.runId)}`,className:"revka-button px-2 py-1 text-xs",onClick:()=>n(r.toastId),children:"Review"}),c.jsx("button",{type:"button",className:"text-xs underline-offset-2 hover:underline",style:{color:"var(--revka-text-secondary)"},onClick:()=>n(r.toastId),children:"Dismiss"})]})]}),c.jsx("button",{type:"button","aria-label":"Dismiss",onClick:()=>n(r.toastId),className:"self-start text-[var(--revka-text-secondary)] hover:text-[var(--revka-text)]",children:c.jsx(vi,{className:"h-4 w-4"})})]},r.toastId))})}const lY="revka-locale",ZPe="en";function JPe(){const e=localStorage.getItem(lY);return e||ZPe}function eLe(e){console.log("saveLocale",e),localStorage.setItem(lY,e)}const CE=b.createContext({locale:"en",setAppLocale:()=>{}}),tLe=()=>b.useContext(CE);function nLe({onPair:e}){const[n,r]=b.useState(""),[i,s]=b.useState(""),[a,o]=b.useState(!1),[l,u]=b.useState(null),[d,p]=b.useState(!0);b.useEffect(()=>{let g=!1;return JB().then(_=>{!g&&_.pairing_code&&u(_.pairing_code)}).catch(()=>{}).finally(()=>{g||p(!1)}),()=>{g=!0}},[]);const f=async g=>{g.preventDefault(),o(!0),s("");try{await e(n)}catch(_){s(_ instanceof Error?_.message:"Pairing failed")}finally{o(!1)}};return c.jsx("div",{className:"min-h-screen flex items-center justify-center",style:{background:"var(--pc-bg-base)"},children:c.jsxs("div",{className:"relative surface-panel p-8 w-full max-w-md animate-fade-in-scale",children:[c.jsxs("div",{className:"text-center mb-8",children:[c.jsx("img",{src:fd("revka-icon.png"),alt:"Revka",className:"revka-brand-logo h-20 w-20 rounded-2xl object-contain mx-auto mb-4 animate-float",onError:g=>{g.currentTarget.style.display="none"}}),c.jsx("h1",{className:"text-2xl font-bold mb-2 text-gradient-blue",children:"Revka"}),c.jsx("p",{className:"text-sm",style:{color:"var(--pc-text-muted)"},children:l?"Your pairing code":"Enter the pairing code from your terminal"})]}),!d&&l&&c.jsxs("div",{className:"mb-6 p-4 rounded-2xl text-center border",style:{background:"var(--pc-accent-glow)",borderColor:"var(--pc-accent-dim)"},children:[c.jsx("div",{className:"text-4xl font-mono font-bold tracking-[0.4em] py-2",style:{color:"var(--pc-text-primary)"},children:l}),c.jsx("p",{className:"text-xs mt-2",style:{color:"var(--pc-text-muted)"},children:"Enter this code below or on another device"})]}),c.jsxs("form",{onSubmit:f,children:[c.jsx("input",{type:"text",value:n,onChange:g=>r(g.target.value),placeholder:"6-digit code",className:"input-electric w-full px-4 py-4 text-center text-2xl tracking-[0.3em] font-medium mb-4",maxLength:6,autoFocus:!0}),i&&c.jsx("p",{"aria-live":"polite",className:"text-sm mb-4 text-center animate-fade-in",style:{color:"var(--color-status-error)"},children:i}),c.jsx("button",{type:"submit",disabled:a||n.length<6,className:"btn-electric w-full py-3.5 text-sm font-semibold tracking-wide",children:a?c.jsxs("span",{className:"flex items-center justify-center gap-2",children:[c.jsx("span",{className:"h-4 w-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}),"Pairing..."]}):"Pair"})]})]})})}function rLe(){const{pathname:e}=aa(),{isAuthenticated:n,requiresPairing:r,loading:i,pair:s,logout:a}=uz(),[o,l]=b.useState(JPe()),u=ote();CO(o);const d=p=>{l(p),CO(p),eLe(p)};return b.useEffect(()=>{const p=()=>{a()};return window.addEventListener("revka-unauthorized",p),()=>window.removeEventListener("revka-unauthorized",p)},[a]),e==="/"?c.jsx(OC.Provider,{value:u,children:c.jsx(CE.Provider,{value:{locale:o,setAppLocale:d},children:c.jsx(nO,{children:c.jsx(gr,{path:"/",element:c.jsx(nte,{})})})})}):i?c.jsx("div",{className:"min-h-screen flex items-center justify-center",style:{background:"var(--pc-bg-base)"},children:c.jsxs("div",{className:"flex flex-col items-center gap-4 animate-fade-in",children:[c.jsx("div",{className:"h-10 w-10 border-2 rounded-full animate-spin",style:{borderColor:"var(--pc-border)",borderTopColor:"var(--pc-accent)"}}),c.jsx("p",{className:"text-sm",style:{color:"var(--pc-text-muted)"},children:"Connecting..."})]})}):!n&&r?c.jsx(nLe,{onPair:s}):c.jsx(OC.Provider,{value:u,children:c.jsx(CE.Provider,{value:{locale:o,setAppLocale:d},children:c.jsx(XPe,{children:c.jsxs(Vde,{children:[c.jsx(QPe,{}),c.jsxs(nO,{children:[c.jsx(gr,{path:"/memory-auditor",element:c.jsx(tO,{to:"/memory",replace:!0})}),c.jsxs(gr,{element:c.jsx(Zde,{}),children:[c.jsx(gr,{path:"/dashboard",element:c.jsx(b0e,{})}),c.jsx(gr,{path:"/workflows",element:c.jsx(_Re,{})}),c.jsx(gr,{path:"/runs",element:c.jsx(LRe,{})}),c.jsx(gr,{path:"/teams",element:c.jsx(HRe,{})}),c.jsx(gr,{path:"/canvas",element:c.jsx(qRe,{})}),c.jsx(gr,{path:"/agents",element:c.jsx(URe,{})}),c.jsx(gr,{path:"/integrations",element:c.jsx(FDe,{})}),c.jsx(gr,{path:"/config",element:c.jsx(uPe,{})}),c.jsx(gr,{path:"/assets",element:c.jsx(jDe,{})}),c.jsx(gr,{path:"/skins",element:c.jsx(KDe,{})}),c.jsx(gr,{path:"/skills",element:c.jsx(WDe,{})}),c.jsx(gr,{path:"/logs",element:c.jsx(IDe,{})}),c.jsx(gr,{path:"/audit",element:c.jsx(DDe,{})}),c.jsx(gr,{path:"/doctor",element:c.jsx($De,{})}),c.jsx(gr,{path:"/memory",element:c.jsx(ODe,{})}),c.jsx(gr,{path:"/cost",element:c.jsx(BDe,{})}),c.jsx(gr,{path:"/cron",element:c.jsx(xPe,{})}),c.jsx(gr,{path:"/tools",element:c.jsx(bPe,{})}),c.jsx(gr,{path:"/pairing",element:c.jsx(KPe,{})}),c.jsx(gr,{path:"*",element:c.jsx(tO,{to:"/dashboard",replace:!0})})]})]})]})})})})}function iLe(){return c.jsx(IJ,{children:c.jsx(GJ,{children:c.jsx(rLe,{})})})}kX.createRoot(document.getElementById("root")).render(c.jsx(ip.StrictMode,{children:c.jsx(KQ,{basename:Xr||"/",children:c.jsx(iLe,{})})}));
