nterminal 1.2.21 → 1.2.23

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,34 +1,34 @@
1
- (function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))a(o);new MutationObserver(o=>{for(const c of o)if(c.type==="childList")for(const d of c.addedNodes)d.tagName==="LINK"&&d.rel==="modulepreload"&&a(d)}).observe(document,{childList:!0,subtree:!0});function n(o){const c={};return o.integrity&&(c.integrity=o.integrity),o.referrerPolicy&&(c.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?c.credentials="include":o.crossOrigin==="anonymous"?c.credentials="omit":c.credentials="same-origin",c}function a(o){if(o.ep)return;o.ep=!0;const c=n(o);fetch(o.href,c)}})();function IC(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Fd={exports:{}},Ml={};var _y;function FC(){if(_y)return Ml;_y=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function n(a,o,c){var d=null;if(c!==void 0&&(d=""+c),o.key!==void 0&&(d=""+o.key),"key"in o){c={};for(var p in o)p!=="key"&&(c[p]=o[p])}else c=o;return o=c.ref,{$$typeof:e,type:a,key:d,ref:o!==void 0?o:null,props:c}}return Ml.Fragment=t,Ml.jsx=n,Ml.jsxs=n,Ml}var vy;function qC(){return vy||(vy=1,Fd.exports=FC()),Fd.exports}var _=qC(),qd={exports:{}},Ue={};var gy;function WC(){if(gy)return Ue;gy=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),a=Symbol.for("react.strict_mode"),o=Symbol.for("react.profiler"),c=Symbol.for("react.consumer"),d=Symbol.for("react.context"),p=Symbol.for("react.forward_ref"),m=Symbol.for("react.suspense"),f=Symbol.for("react.memo"),S=Symbol.for("react.lazy"),y=Symbol.for("react.activity"),b=Symbol.iterator;function x(E){return E===null||typeof E!="object"?null:(E=b&&E[b]||E["@@iterator"],typeof E=="function"?E:null)}var C={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},k=Object.assign,B={};function R(E,W,ee){this.props=E,this.context=W,this.refs=B,this.updater=ee||C}R.prototype.isReactComponent={},R.prototype.setState=function(E,W){if(typeof E!="object"&&typeof E!="function"&&E!=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,E,W,"setState")},R.prototype.forceUpdate=function(E){this.updater.enqueueForceUpdate(this,E,"forceUpdate")};function re(){}re.prototype=R.prototype;function F(E,W,ee){this.props=E,this.context=W,this.refs=B,this.updater=ee||C}var J=F.prototype=new re;J.constructor=F,k(J,R.prototype),J.isPureReactComponent=!0;var ce=Array.isArray;function q(){}var I={H:null,A:null,T:null,S:null},ie=Object.prototype.hasOwnProperty;function de(E,W,ee){var he=ee.ref;return{$$typeof:e,type:E,key:W,ref:he!==void 0?he:null,props:ee}}function j(E,W){return de(E.type,W,E.props)}function $(E){return typeof E=="object"&&E!==null&&E.$$typeof===e}function H(E){var W={"=":"=0",":":"=2"};return"$"+E.replace(/[=:]/g,function(ee){return W[ee]})}var L=/\/+/g;function X(E,W){return typeof E=="object"&&E!==null&&E.key!=null?H(""+E.key):W.toString(36)}function G(E){switch(E.status){case"fulfilled":return E.value;case"rejected":throw E.reason;default:switch(typeof E.status=="string"?E.then(q,q):(E.status="pending",E.then(function(W){E.status==="pending"&&(E.status="fulfilled",E.value=W)},function(W){E.status==="pending"&&(E.status="rejected",E.reason=W)})),E.status){case"fulfilled":return E.value;case"rejected":throw E.reason}}throw E}function M(E,W,ee,he,ge){var me=typeof E;(me==="undefined"||me==="boolean")&&(E=null);var Ce=!1;if(E===null)Ce=!0;else switch(me){case"bigint":case"string":case"number":Ce=!0;break;case"object":switch(E.$$typeof){case e:case t:Ce=!0;break;case S:return Ce=E._init,M(Ce(E._payload),W,ee,he,ge)}}if(Ce)return ge=ge(E),Ce=he===""?"."+X(E,0):he,ce(ge)?(ee="",Ce!=null&&(ee=Ce.replace(L,"$&/")+"/"),M(ge,W,ee,"",function(Re){return Re})):ge!=null&&($(ge)&&(ge=j(ge,ee+(ge.key==null||E&&E.key===ge.key?"":(""+ge.key).replace(L,"$&/")+"/")+Ce)),W.push(ge)),1;Ce=0;var ze=he===""?".":he+":";if(ce(E))for(var Ne=0;Ne<E.length;Ne++)he=E[Ne],me=ze+X(he,Ne),Ce+=M(he,W,ee,me,ge);else if(Ne=x(E),typeof Ne=="function")for(E=Ne.call(E),Ne=0;!(he=E.next()).done;)he=he.value,me=ze+X(he,Ne++),Ce+=M(he,W,ee,me,ge);else if(me==="object"){if(typeof E.then=="function")return M(G(E),W,ee,he,ge);throw W=String(E),Error("Objects are not valid as a React child (found: "+(W==="[object Object]"?"object with keys {"+Object.keys(E).join(", ")+"}":W)+"). If you meant to render a collection of children, use an array instead.")}return Ce}function V(E,W,ee){if(E==null)return E;var he=[],ge=0;return M(E,he,"","",function(me){return W.call(ee,me,ge++)}),he}function Q(E){if(E._status===-1){var W=E._result;W=W(),W.then(function(ee){(E._status===0||E._status===-1)&&(E._status=1,E._result=ee)},function(ee){(E._status===0||E._status===-1)&&(E._status=2,E._result=ee)}),E._status===-1&&(E._status=0,E._result=W)}if(E._status===1)return E._result.default;throw E._result}var ve=typeof reportError=="function"?reportError:function(E){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var W=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof E=="object"&&E!==null&&typeof E.message=="string"?String(E.message):String(E),error:E});if(!window.dispatchEvent(W))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",E);return}console.error(E)},Se={map:V,forEach:function(E,W,ee){V(E,function(){W.apply(this,arguments)},ee)},count:function(E){var W=0;return V(E,function(){W++}),W},toArray:function(E){return V(E,function(W){return W})||[]},only:function(E){if(!$(E))throw Error("React.Children.only expected to receive a single React element child.");return E}};return Ue.Activity=y,Ue.Children=Se,Ue.Component=R,Ue.Fragment=n,Ue.Profiler=o,Ue.PureComponent=F,Ue.StrictMode=a,Ue.Suspense=m,Ue.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=I,Ue.__COMPILER_RUNTIME={__proto__:null,c:function(E){return I.H.useMemoCache(E)}},Ue.cache=function(E){return function(){return E.apply(null,arguments)}},Ue.cacheSignal=function(){return null},Ue.cloneElement=function(E,W,ee){if(E==null)throw Error("The argument must be a React element, but you passed "+E+".");var he=k({},E.props),ge=E.key;if(W!=null)for(me in W.key!==void 0&&(ge=""+W.key),W)!ie.call(W,me)||me==="key"||me==="__self"||me==="__source"||me==="ref"&&W.ref===void 0||(he[me]=W[me]);var me=arguments.length-2;if(me===1)he.children=ee;else if(1<me){for(var Ce=Array(me),ze=0;ze<me;ze++)Ce[ze]=arguments[ze+2];he.children=Ce}return de(E.type,ge,he)},Ue.createContext=function(E){return E={$$typeof:d,_currentValue:E,_currentValue2:E,_threadCount:0,Provider:null,Consumer:null},E.Provider=E,E.Consumer={$$typeof:c,_context:E},E},Ue.createElement=function(E,W,ee){var he,ge={},me=null;if(W!=null)for(he in W.key!==void 0&&(me=""+W.key),W)ie.call(W,he)&&he!=="key"&&he!=="__self"&&he!=="__source"&&(ge[he]=W[he]);var Ce=arguments.length-2;if(Ce===1)ge.children=ee;else if(1<Ce){for(var ze=Array(Ce),Ne=0;Ne<Ce;Ne++)ze[Ne]=arguments[Ne+2];ge.children=ze}if(E&&E.defaultProps)for(he in Ce=E.defaultProps,Ce)ge[he]===void 0&&(ge[he]=Ce[he]);return de(E,me,ge)},Ue.createRef=function(){return{current:null}},Ue.forwardRef=function(E){return{$$typeof:p,render:E}},Ue.isValidElement=$,Ue.lazy=function(E){return{$$typeof:S,_payload:{_status:-1,_result:E},_init:Q}},Ue.memo=function(E,W){return{$$typeof:f,type:E,compare:W===void 0?null:W}},Ue.startTransition=function(E){var W=I.T,ee={};I.T=ee;try{var he=E(),ge=I.S;ge!==null&&ge(ee,he),typeof he=="object"&&he!==null&&typeof he.then=="function"&&he.then(q,ve)}catch(me){ve(me)}finally{W!==null&&ee.types!==null&&(W.types=ee.types),I.T=W}},Ue.unstable_useCacheRefresh=function(){return I.H.useCacheRefresh()},Ue.use=function(E){return I.H.use(E)},Ue.useActionState=function(E,W,ee){return I.H.useActionState(E,W,ee)},Ue.useCallback=function(E,W){return I.H.useCallback(E,W)},Ue.useContext=function(E){return I.H.useContext(E)},Ue.useDebugValue=function(){},Ue.useDeferredValue=function(E,W){return I.H.useDeferredValue(E,W)},Ue.useEffect=function(E,W){return I.H.useEffect(E,W)},Ue.useEffectEvent=function(E){return I.H.useEffectEvent(E)},Ue.useId=function(){return I.H.useId()},Ue.useImperativeHandle=function(E,W,ee){return I.H.useImperativeHandle(E,W,ee)},Ue.useInsertionEffect=function(E,W){return I.H.useInsertionEffect(E,W)},Ue.useLayoutEffect=function(E,W){return I.H.useLayoutEffect(E,W)},Ue.useMemo=function(E,W){return I.H.useMemo(E,W)},Ue.useOptimistic=function(E,W){return I.H.useOptimistic(E,W)},Ue.useReducer=function(E,W,ee){return I.H.useReducer(E,W,ee)},Ue.useRef=function(E){return I.H.useRef(E)},Ue.useState=function(E){return I.H.useState(E)},Ue.useSyncExternalStore=function(E,W,ee){return I.H.useSyncExternalStore(E,W,ee)},Ue.useTransition=function(){return I.H.useTransition()},Ue.version="19.2.6",Ue}var yy;function Yp(){return yy||(yy=1,qd.exports=WC()),qd.exports}var g=Yp();const xi=IC(g);var Wd={exports:{}},Al={},Yd={exports:{}},$d={};var Sy;function YC(){return Sy||(Sy=1,(function(e){function t(M,V){var Q=M.length;M.push(V);e:for(;0<Q;){var ve=Q-1>>>1,Se=M[ve];if(0<o(Se,V))M[ve]=V,M[Q]=Se,Q=ve;else break e}}function n(M){return M.length===0?null:M[0]}function a(M){if(M.length===0)return null;var V=M[0],Q=M.pop();if(Q!==V){M[0]=Q;e:for(var ve=0,Se=M.length,E=Se>>>1;ve<E;){var W=2*(ve+1)-1,ee=M[W],he=W+1,ge=M[he];if(0>o(ee,Q))he<Se&&0>o(ge,ee)?(M[ve]=ge,M[he]=Q,ve=he):(M[ve]=ee,M[W]=Q,ve=W);else if(he<Se&&0>o(ge,Q))M[ve]=ge,M[he]=Q,ve=he;else break e}}return V}function o(M,V){var Q=M.sortIndex-V.sortIndex;return Q!==0?Q:M.id-V.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var c=performance;e.unstable_now=function(){return c.now()}}else{var d=Date,p=d.now();e.unstable_now=function(){return d.now()-p}}var m=[],f=[],S=1,y=null,b=3,x=!1,C=!1,k=!1,B=!1,R=typeof setTimeout=="function"?setTimeout:null,re=typeof clearTimeout=="function"?clearTimeout:null,F=typeof setImmediate<"u"?setImmediate:null;function J(M){for(var V=n(f);V!==null;){if(V.callback===null)a(f);else if(V.startTime<=M)a(f),V.sortIndex=V.expirationTime,t(m,V);else break;V=n(f)}}function ce(M){if(k=!1,J(M),!C)if(n(m)!==null)C=!0,q||(q=!0,H());else{var V=n(f);V!==null&&G(ce,V.startTime-M)}}var q=!1,I=-1,ie=5,de=-1;function j(){return B?!0:!(e.unstable_now()-de<ie)}function $(){if(B=!1,q){var M=e.unstable_now();de=M;var V=!0;try{e:{C=!1,k&&(k=!1,re(I),I=-1),x=!0;var Q=b;try{t:{for(J(M),y=n(m);y!==null&&!(y.expirationTime>M&&j());){var ve=y.callback;if(typeof ve=="function"){y.callback=null,b=y.priorityLevel;var Se=ve(y.expirationTime<=M);if(M=e.unstable_now(),typeof Se=="function"){y.callback=Se,J(M),V=!0;break t}y===n(m)&&a(m),J(M)}else a(m);y=n(m)}if(y!==null)V=!0;else{var E=n(f);E!==null&&G(ce,E.startTime-M),V=!1}}break e}finally{y=null,b=Q,x=!1}V=void 0}}finally{V?H():q=!1}}}var H;if(typeof F=="function")H=function(){F($)};else if(typeof MessageChannel<"u"){var L=new MessageChannel,X=L.port2;L.port1.onmessage=$,H=function(){X.postMessage(null)}}else H=function(){R($,0)};function G(M,V){I=R(function(){M(e.unstable_now())},V)}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(M){M.callback=null},e.unstable_forceFrameRate=function(M){0>M||125<M?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):ie=0<M?Math.floor(1e3/M):5},e.unstable_getCurrentPriorityLevel=function(){return b},e.unstable_next=function(M){switch(b){case 1:case 2:case 3:var V=3;break;default:V=b}var Q=b;b=V;try{return M()}finally{b=Q}},e.unstable_requestPaint=function(){B=!0},e.unstable_runWithPriority=function(M,V){switch(M){case 1:case 2:case 3:case 4:case 5:break;default:M=3}var Q=b;b=M;try{return V()}finally{b=Q}},e.unstable_scheduleCallback=function(M,V,Q){var ve=e.unstable_now();switch(typeof Q=="object"&&Q!==null?(Q=Q.delay,Q=typeof Q=="number"&&0<Q?ve+Q:ve):Q=ve,M){case 1:var Se=-1;break;case 2:Se=250;break;case 5:Se=1073741823;break;case 4:Se=1e4;break;default:Se=5e3}return Se=Q+Se,M={id:S++,callback:V,priorityLevel:M,startTime:Q,expirationTime:Se,sortIndex:-1},Q>ve?(M.sortIndex=Q,t(f,M),n(m)===null&&M===n(f)&&(k?(re(I),I=-1):k=!0,G(ce,Q-ve))):(M.sortIndex=Se,t(m,M),C||x||(C=!0,q||(q=!0,H()))),M},e.unstable_shouldYield=j,e.unstable_wrapCallback=function(M){var V=b;return function(){var Q=b;b=V;try{return M.apply(this,arguments)}finally{b=Q}}}})($d)),$d}var by;function $C(){return by||(by=1,Yd.exports=YC()),Yd.exports}var Vd={exports:{}},Di={};var wy;function VC(){if(wy)return Di;wy=1;var e=Yp();function t(m){var f="https://react.dev/errors/"+m;if(1<arguments.length){f+="?args[]="+encodeURIComponent(arguments[1]);for(var S=2;S<arguments.length;S++)f+="&args[]="+encodeURIComponent(arguments[S])}return"Minified React error #"+m+"; visit "+f+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function n(){}var a={d:{f:n,r:function(){throw Error(t(522))},D:n,C:n,L:n,m:n,X:n,S:n,M:n},p:0,findDOMNode:null},o=Symbol.for("react.portal");function c(m,f,S){var y=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:o,key:y==null?null:""+y,children:m,containerInfo:f,implementation:S}}var d=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function p(m,f){if(m==="font")return"";if(typeof f=="string")return f==="use-credentials"?f:""}return Di.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=a,Di.createPortal=function(m,f){var S=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!f||f.nodeType!==1&&f.nodeType!==9&&f.nodeType!==11)throw Error(t(299));return c(m,f,null,S)},Di.flushSync=function(m){var f=d.T,S=a.p;try{if(d.T=null,a.p=2,m)return m()}finally{d.T=f,a.p=S,a.d.f()}},Di.preconnect=function(m,f){typeof m=="string"&&(f?(f=f.crossOrigin,f=typeof f=="string"?f==="use-credentials"?f:"":void 0):f=null,a.d.C(m,f))},Di.prefetchDNS=function(m){typeof m=="string"&&a.d.D(m)},Di.preinit=function(m,f){if(typeof m=="string"&&f&&typeof f.as=="string"){var S=f.as,y=p(S,f.crossOrigin),b=typeof f.integrity=="string"?f.integrity:void 0,x=typeof f.fetchPriority=="string"?f.fetchPriority:void 0;S==="style"?a.d.S(m,typeof f.precedence=="string"?f.precedence:void 0,{crossOrigin:y,integrity:b,fetchPriority:x}):S==="script"&&a.d.X(m,{crossOrigin:y,integrity:b,fetchPriority:x,nonce:typeof f.nonce=="string"?f.nonce:void 0})}},Di.preinitModule=function(m,f){if(typeof m=="string")if(typeof f=="object"&&f!==null){if(f.as==null||f.as==="script"){var S=p(f.as,f.crossOrigin);a.d.M(m,{crossOrigin:S,integrity:typeof f.integrity=="string"?f.integrity:void 0,nonce:typeof f.nonce=="string"?f.nonce:void 0})}}else f==null&&a.d.M(m)},Di.preload=function(m,f){if(typeof m=="string"&&typeof f=="object"&&f!==null&&typeof f.as=="string"){var S=f.as,y=p(S,f.crossOrigin);a.d.L(m,S,{crossOrigin:y,integrity:typeof f.integrity=="string"?f.integrity:void 0,nonce:typeof f.nonce=="string"?f.nonce:void 0,type:typeof f.type=="string"?f.type:void 0,fetchPriority:typeof f.fetchPriority=="string"?f.fetchPriority:void 0,referrerPolicy:typeof f.referrerPolicy=="string"?f.referrerPolicy:void 0,imageSrcSet:typeof f.imageSrcSet=="string"?f.imageSrcSet:void 0,imageSizes:typeof f.imageSizes=="string"?f.imageSizes:void 0,media:typeof f.media=="string"?f.media:void 0})}},Di.preloadModule=function(m,f){if(typeof m=="string")if(f){var S=p(f.as,f.crossOrigin);a.d.m(m,{as:typeof f.as=="string"&&f.as!=="script"?f.as:void 0,crossOrigin:S,integrity:typeof f.integrity=="string"?f.integrity:void 0})}else a.d.m(m)},Di.requestFormReset=function(m){a.d.r(m)},Di.unstable_batchedUpdates=function(m,f){return m(f)},Di.useFormState=function(m,f,S){return d.H.useFormState(m,f,S)},Di.useFormStatus=function(){return d.H.useHostTransitionStatus()},Di.version="19.2.6",Di}var Cy;function Sb(){if(Cy)return Vd.exports;Cy=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(t){console.error(t)}}return e(),Vd.exports=VC(),Vd.exports}var xy;function XC(){if(xy)return Al;xy=1;var e=$C(),t=Yp(),n=Sb();function a(i){var s="https://react.dev/errors/"+i;if(1<arguments.length){s+="?args[]="+encodeURIComponent(arguments[1]);for(var r=2;r<arguments.length;r++)s+="&args[]="+encodeURIComponent(arguments[r])}return"Minified React error #"+i+"; visit "+s+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function o(i){return!(!i||i.nodeType!==1&&i.nodeType!==9&&i.nodeType!==11)}function c(i){var s=i,r=i;if(i.alternate)for(;s.return;)s=s.return;else{i=s;do s=i,(s.flags&4098)!==0&&(r=s.return),i=s.return;while(i)}return s.tag===3?r:null}function d(i){if(i.tag===13){var s=i.memoizedState;if(s===null&&(i=i.alternate,i!==null&&(s=i.memoizedState)),s!==null)return s.dehydrated}return null}function p(i){if(i.tag===31){var s=i.memoizedState;if(s===null&&(i=i.alternate,i!==null&&(s=i.memoizedState)),s!==null)return s.dehydrated}return null}function m(i){if(c(i)!==i)throw Error(a(188))}function f(i){var s=i.alternate;if(!s){if(s=c(i),s===null)throw Error(a(188));return s!==i?null:i}for(var r=i,l=s;;){var u=r.return;if(u===null)break;var h=u.alternate;if(h===null){if(l=u.return,l!==null){r=l;continue}break}if(u.child===h.child){for(h=u.child;h;){if(h===r)return m(u),i;if(h===l)return m(u),s;h=h.sibling}throw Error(a(188))}if(r.return!==l.return)r=u,l=h;else{for(var v=!1,w=u.child;w;){if(w===r){v=!0,r=u,l=h;break}if(w===l){v=!0,l=u,r=h;break}w=w.sibling}if(!v){for(w=h.child;w;){if(w===r){v=!0,r=h,l=u;break}if(w===l){v=!0,l=h,r=u;break}w=w.sibling}if(!v)throw Error(a(189))}}if(r.alternate!==l)throw Error(a(190))}if(r.tag!==3)throw Error(a(188));return r.stateNode.current===r?i:s}function S(i){var s=i.tag;if(s===5||s===26||s===27||s===6)return i;for(i=i.child;i!==null;){if(s=S(i),s!==null)return s;i=i.sibling}return null}var y=Object.assign,b=Symbol.for("react.element"),x=Symbol.for("react.transitional.element"),C=Symbol.for("react.portal"),k=Symbol.for("react.fragment"),B=Symbol.for("react.strict_mode"),R=Symbol.for("react.profiler"),re=Symbol.for("react.consumer"),F=Symbol.for("react.context"),J=Symbol.for("react.forward_ref"),ce=Symbol.for("react.suspense"),q=Symbol.for("react.suspense_list"),I=Symbol.for("react.memo"),ie=Symbol.for("react.lazy"),de=Symbol.for("react.activity"),j=Symbol.for("react.memo_cache_sentinel"),$=Symbol.iterator;function H(i){return i===null||typeof i!="object"?null:(i=$&&i[$]||i["@@iterator"],typeof i=="function"?i:null)}var L=Symbol.for("react.client.reference");function X(i){if(i==null)return null;if(typeof i=="function")return i.$$typeof===L?null:i.displayName||i.name||null;if(typeof i=="string")return i;switch(i){case k:return"Fragment";case R:return"Profiler";case B:return"StrictMode";case ce:return"Suspense";case q:return"SuspenseList";case de:return"Activity"}if(typeof i=="object")switch(i.$$typeof){case C:return"Portal";case F:return i.displayName||"Context";case re:return(i._context.displayName||"Context")+".Consumer";case J:var s=i.render;return i=i.displayName,i||(i=s.displayName||s.name||"",i=i!==""?"ForwardRef("+i+")":"ForwardRef"),i;case I:return s=i.displayName||null,s!==null?s:X(i.type)||"Memo";case ie:s=i._payload,i=i._init;try{return X(i(s))}catch{}}return null}var G=Array.isArray,M=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,V=n.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Q={pending:!1,data:null,method:null,action:null},ve=[],Se=-1;function E(i){return{current:i}}function W(i){0>Se||(i.current=ve[Se],ve[Se]=null,Se--)}function ee(i,s){Se++,ve[Se]=i.current,i.current=s}var he=E(null),ge=E(null),me=E(null),Ce=E(null);function ze(i,s){switch(ee(me,s),ee(ge,i),ee(he,null),s.nodeType){case 9:case 11:i=(i=s.documentElement)&&(i=i.namespaceURI)?Ug(i):0;break;default:if(i=s.tagName,s=s.namespaceURI)s=Ug(s),i=Pg(s,i);else switch(i){case"svg":i=1;break;case"math":i=2;break;default:i=0}}W(he),ee(he,i)}function Ne(){W(he),W(ge),W(me)}function Re(i){i.memoizedState!==null&&ee(Ce,i);var s=he.current,r=Pg(s,i.type);s!==r&&(ee(ge,i),ee(he,r))}function Pe(i){ge.current===i&&(W(he),W(ge)),Ce.current===i&&(W(Ce),Tl._currentValue=Q)}var Ye,Be;function ae(i){if(Ye===void 0)try{throw Error()}catch(r){var s=r.stack.trim().match(/\n( *(at )?)/);Ye=s&&s[1]||"",Be=-1<r.stack.indexOf(`
1
+ (function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))a(o);new MutationObserver(o=>{for(const c of o)if(c.type==="childList")for(const d of c.addedNodes)d.tagName==="LINK"&&d.rel==="modulepreload"&&a(d)}).observe(document,{childList:!0,subtree:!0});function n(o){const c={};return o.integrity&&(c.integrity=o.integrity),o.referrerPolicy&&(c.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?c.credentials="include":o.crossOrigin==="anonymous"?c.credentials="omit":c.credentials="same-origin",c}function a(o){if(o.ep)return;o.ep=!0;const c=n(o);fetch(o.href,c)}})();function IC(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Fd={exports:{}},Ml={};var _y;function FC(){if(_y)return Ml;_y=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function n(a,o,c){var d=null;if(c!==void 0&&(d=""+c),o.key!==void 0&&(d=""+o.key),"key"in o){c={};for(var p in o)p!=="key"&&(c[p]=o[p])}else c=o;return o=c.ref,{$$typeof:e,type:a,key:d,ref:o!==void 0?o:null,props:c}}return Ml.Fragment=t,Ml.jsx=n,Ml.jsxs=n,Ml}var vy;function qC(){return vy||(vy=1,Fd.exports=FC()),Fd.exports}var _=qC(),qd={exports:{}},Ue={};var gy;function WC(){if(gy)return Ue;gy=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),a=Symbol.for("react.strict_mode"),o=Symbol.for("react.profiler"),c=Symbol.for("react.consumer"),d=Symbol.for("react.context"),p=Symbol.for("react.forward_ref"),m=Symbol.for("react.suspense"),f=Symbol.for("react.memo"),S=Symbol.for("react.lazy"),y=Symbol.for("react.activity"),b=Symbol.iterator;function x(E){return E===null||typeof E!="object"?null:(E=b&&E[b]||E["@@iterator"],typeof E=="function"?E:null)}var C={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},k=Object.assign,B={};function R(E,W,ee){this.props=E,this.context=W,this.refs=B,this.updater=ee||C}R.prototype.isReactComponent={},R.prototype.setState=function(E,W){if(typeof E!="object"&&typeof E!="function"&&E!=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,E,W,"setState")},R.prototype.forceUpdate=function(E){this.updater.enqueueForceUpdate(this,E,"forceUpdate")};function re(){}re.prototype=R.prototype;function F(E,W,ee){this.props=E,this.context=W,this.refs=B,this.updater=ee||C}var J=F.prototype=new re;J.constructor=F,k(J,R.prototype),J.isPureReactComponent=!0;var ce=Array.isArray;function q(){}var I={H:null,A:null,T:null,S:null},ie=Object.prototype.hasOwnProperty;function de(E,W,ee){var he=ee.ref;return{$$typeof:e,type:E,key:W,ref:he!==void 0?he:null,props:ee}}function j(E,W){return de(E.type,W,E.props)}function $(E){return typeof E=="object"&&E!==null&&E.$$typeof===e}function H(E){var W={"=":"=0",":":"=2"};return"$"+E.replace(/[=:]/g,function(ee){return W[ee]})}var L=/\/+/g;function X(E,W){return typeof E=="object"&&E!==null&&E.key!=null?H(""+E.key):W.toString(36)}function Z(E){switch(E.status){case"fulfilled":return E.value;case"rejected":throw E.reason;default:switch(typeof E.status=="string"?E.then(q,q):(E.status="pending",E.then(function(W){E.status==="pending"&&(E.status="fulfilled",E.value=W)},function(W){E.status==="pending"&&(E.status="rejected",E.reason=W)})),E.status){case"fulfilled":return E.value;case"rejected":throw E.reason}}throw E}function A(E,W,ee,he,ge){var me=typeof E;(me==="undefined"||me==="boolean")&&(E=null);var Ce=!1;if(E===null)Ce=!0;else switch(me){case"bigint":case"string":case"number":Ce=!0;break;case"object":switch(E.$$typeof){case e:case t:Ce=!0;break;case S:return Ce=E._init,A(Ce(E._payload),W,ee,he,ge)}}if(Ce)return ge=ge(E),Ce=he===""?"."+X(E,0):he,ce(ge)?(ee="",Ce!=null&&(ee=Ce.replace(L,"$&/")+"/"),A(ge,W,ee,"",function(Re){return Re})):ge!=null&&($(ge)&&(ge=j(ge,ee+(ge.key==null||E&&E.key===ge.key?"":(""+ge.key).replace(L,"$&/")+"/")+Ce)),W.push(ge)),1;Ce=0;var ze=he===""?".":he+":";if(ce(E))for(var Ne=0;Ne<E.length;Ne++)he=E[Ne],me=ze+X(he,Ne),Ce+=A(he,W,ee,me,ge);else if(Ne=x(E),typeof Ne=="function")for(E=Ne.call(E),Ne=0;!(he=E.next()).done;)he=he.value,me=ze+X(he,Ne++),Ce+=A(he,W,ee,me,ge);else if(me==="object"){if(typeof E.then=="function")return A(Z(E),W,ee,he,ge);throw W=String(E),Error("Objects are not valid as a React child (found: "+(W==="[object Object]"?"object with keys {"+Object.keys(E).join(", ")+"}":W)+"). If you meant to render a collection of children, use an array instead.")}return Ce}function V(E,W,ee){if(E==null)return E;var he=[],ge=0;return A(E,he,"","",function(me){return W.call(ee,me,ge++)}),he}function Q(E){if(E._status===-1){var W=E._result;W=W(),W.then(function(ee){(E._status===0||E._status===-1)&&(E._status=1,E._result=ee)},function(ee){(E._status===0||E._status===-1)&&(E._status=2,E._result=ee)}),E._status===-1&&(E._status=0,E._result=W)}if(E._status===1)return E._result.default;throw E._result}var ve=typeof reportError=="function"?reportError:function(E){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var W=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof E=="object"&&E!==null&&typeof E.message=="string"?String(E.message):String(E),error:E});if(!window.dispatchEvent(W))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",E);return}console.error(E)},Se={map:V,forEach:function(E,W,ee){V(E,function(){W.apply(this,arguments)},ee)},count:function(E){var W=0;return V(E,function(){W++}),W},toArray:function(E){return V(E,function(W){return W})||[]},only:function(E){if(!$(E))throw Error("React.Children.only expected to receive a single React element child.");return E}};return Ue.Activity=y,Ue.Children=Se,Ue.Component=R,Ue.Fragment=n,Ue.Profiler=o,Ue.PureComponent=F,Ue.StrictMode=a,Ue.Suspense=m,Ue.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=I,Ue.__COMPILER_RUNTIME={__proto__:null,c:function(E){return I.H.useMemoCache(E)}},Ue.cache=function(E){return function(){return E.apply(null,arguments)}},Ue.cacheSignal=function(){return null},Ue.cloneElement=function(E,W,ee){if(E==null)throw Error("The argument must be a React element, but you passed "+E+".");var he=k({},E.props),ge=E.key;if(W!=null)for(me in W.key!==void 0&&(ge=""+W.key),W)!ie.call(W,me)||me==="key"||me==="__self"||me==="__source"||me==="ref"&&W.ref===void 0||(he[me]=W[me]);var me=arguments.length-2;if(me===1)he.children=ee;else if(1<me){for(var Ce=Array(me),ze=0;ze<me;ze++)Ce[ze]=arguments[ze+2];he.children=Ce}return de(E.type,ge,he)},Ue.createContext=function(E){return E={$$typeof:d,_currentValue:E,_currentValue2:E,_threadCount:0,Provider:null,Consumer:null},E.Provider=E,E.Consumer={$$typeof:c,_context:E},E},Ue.createElement=function(E,W,ee){var he,ge={},me=null;if(W!=null)for(he in W.key!==void 0&&(me=""+W.key),W)ie.call(W,he)&&he!=="key"&&he!=="__self"&&he!=="__source"&&(ge[he]=W[he]);var Ce=arguments.length-2;if(Ce===1)ge.children=ee;else if(1<Ce){for(var ze=Array(Ce),Ne=0;Ne<Ce;Ne++)ze[Ne]=arguments[Ne+2];ge.children=ze}if(E&&E.defaultProps)for(he in Ce=E.defaultProps,Ce)ge[he]===void 0&&(ge[he]=Ce[he]);return de(E,me,ge)},Ue.createRef=function(){return{current:null}},Ue.forwardRef=function(E){return{$$typeof:p,render:E}},Ue.isValidElement=$,Ue.lazy=function(E){return{$$typeof:S,_payload:{_status:-1,_result:E},_init:Q}},Ue.memo=function(E,W){return{$$typeof:f,type:E,compare:W===void 0?null:W}},Ue.startTransition=function(E){var W=I.T,ee={};I.T=ee;try{var he=E(),ge=I.S;ge!==null&&ge(ee,he),typeof he=="object"&&he!==null&&typeof he.then=="function"&&he.then(q,ve)}catch(me){ve(me)}finally{W!==null&&ee.types!==null&&(W.types=ee.types),I.T=W}},Ue.unstable_useCacheRefresh=function(){return I.H.useCacheRefresh()},Ue.use=function(E){return I.H.use(E)},Ue.useActionState=function(E,W,ee){return I.H.useActionState(E,W,ee)},Ue.useCallback=function(E,W){return I.H.useCallback(E,W)},Ue.useContext=function(E){return I.H.useContext(E)},Ue.useDebugValue=function(){},Ue.useDeferredValue=function(E,W){return I.H.useDeferredValue(E,W)},Ue.useEffect=function(E,W){return I.H.useEffect(E,W)},Ue.useEffectEvent=function(E){return I.H.useEffectEvent(E)},Ue.useId=function(){return I.H.useId()},Ue.useImperativeHandle=function(E,W,ee){return I.H.useImperativeHandle(E,W,ee)},Ue.useInsertionEffect=function(E,W){return I.H.useInsertionEffect(E,W)},Ue.useLayoutEffect=function(E,W){return I.H.useLayoutEffect(E,W)},Ue.useMemo=function(E,W){return I.H.useMemo(E,W)},Ue.useOptimistic=function(E,W){return I.H.useOptimistic(E,W)},Ue.useReducer=function(E,W,ee){return I.H.useReducer(E,W,ee)},Ue.useRef=function(E){return I.H.useRef(E)},Ue.useState=function(E){return I.H.useState(E)},Ue.useSyncExternalStore=function(E,W,ee){return I.H.useSyncExternalStore(E,W,ee)},Ue.useTransition=function(){return I.H.useTransition()},Ue.version="19.2.6",Ue}var yy;function Yp(){return yy||(yy=1,qd.exports=WC()),qd.exports}var g=Yp();const xi=IC(g);var Wd={exports:{}},Al={},Yd={exports:{}},$d={};var Sy;function YC(){return Sy||(Sy=1,(function(e){function t(A,V){var Q=A.length;A.push(V);e:for(;0<Q;){var ve=Q-1>>>1,Se=A[ve];if(0<o(Se,V))A[ve]=V,A[Q]=Se,Q=ve;else break e}}function n(A){return A.length===0?null:A[0]}function a(A){if(A.length===0)return null;var V=A[0],Q=A.pop();if(Q!==V){A[0]=Q;e:for(var ve=0,Se=A.length,E=Se>>>1;ve<E;){var W=2*(ve+1)-1,ee=A[W],he=W+1,ge=A[he];if(0>o(ee,Q))he<Se&&0>o(ge,ee)?(A[ve]=ge,A[he]=Q,ve=he):(A[ve]=ee,A[W]=Q,ve=W);else if(he<Se&&0>o(ge,Q))A[ve]=ge,A[he]=Q,ve=he;else break e}}return V}function o(A,V){var Q=A.sortIndex-V.sortIndex;return Q!==0?Q:A.id-V.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var c=performance;e.unstable_now=function(){return c.now()}}else{var d=Date,p=d.now();e.unstable_now=function(){return d.now()-p}}var m=[],f=[],S=1,y=null,b=3,x=!1,C=!1,k=!1,B=!1,R=typeof setTimeout=="function"?setTimeout:null,re=typeof clearTimeout=="function"?clearTimeout:null,F=typeof setImmediate<"u"?setImmediate:null;function J(A){for(var V=n(f);V!==null;){if(V.callback===null)a(f);else if(V.startTime<=A)a(f),V.sortIndex=V.expirationTime,t(m,V);else break;V=n(f)}}function ce(A){if(k=!1,J(A),!C)if(n(m)!==null)C=!0,q||(q=!0,H());else{var V=n(f);V!==null&&Z(ce,V.startTime-A)}}var q=!1,I=-1,ie=5,de=-1;function j(){return B?!0:!(e.unstable_now()-de<ie)}function $(){if(B=!1,q){var A=e.unstable_now();de=A;var V=!0;try{e:{C=!1,k&&(k=!1,re(I),I=-1),x=!0;var Q=b;try{t:{for(J(A),y=n(m);y!==null&&!(y.expirationTime>A&&j());){var ve=y.callback;if(typeof ve=="function"){y.callback=null,b=y.priorityLevel;var Se=ve(y.expirationTime<=A);if(A=e.unstable_now(),typeof Se=="function"){y.callback=Se,J(A),V=!0;break t}y===n(m)&&a(m),J(A)}else a(m);y=n(m)}if(y!==null)V=!0;else{var E=n(f);E!==null&&Z(ce,E.startTime-A),V=!1}}break e}finally{y=null,b=Q,x=!1}V=void 0}}finally{V?H():q=!1}}}var H;if(typeof F=="function")H=function(){F($)};else if(typeof MessageChannel<"u"){var L=new MessageChannel,X=L.port2;L.port1.onmessage=$,H=function(){X.postMessage(null)}}else H=function(){R($,0)};function Z(A,V){I=R(function(){A(e.unstable_now())},V)}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(A){A.callback=null},e.unstable_forceFrameRate=function(A){0>A||125<A?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):ie=0<A?Math.floor(1e3/A):5},e.unstable_getCurrentPriorityLevel=function(){return b},e.unstable_next=function(A){switch(b){case 1:case 2:case 3:var V=3;break;default:V=b}var Q=b;b=V;try{return A()}finally{b=Q}},e.unstable_requestPaint=function(){B=!0},e.unstable_runWithPriority=function(A,V){switch(A){case 1:case 2:case 3:case 4:case 5:break;default:A=3}var Q=b;b=A;try{return V()}finally{b=Q}},e.unstable_scheduleCallback=function(A,V,Q){var ve=e.unstable_now();switch(typeof Q=="object"&&Q!==null?(Q=Q.delay,Q=typeof Q=="number"&&0<Q?ve+Q:ve):Q=ve,A){case 1:var Se=-1;break;case 2:Se=250;break;case 5:Se=1073741823;break;case 4:Se=1e4;break;default:Se=5e3}return Se=Q+Se,A={id:S++,callback:V,priorityLevel:A,startTime:Q,expirationTime:Se,sortIndex:-1},Q>ve?(A.sortIndex=Q,t(f,A),n(m)===null&&A===n(f)&&(k?(re(I),I=-1):k=!0,Z(ce,Q-ve))):(A.sortIndex=Se,t(m,A),C||x||(C=!0,q||(q=!0,H()))),A},e.unstable_shouldYield=j,e.unstable_wrapCallback=function(A){var V=b;return function(){var Q=b;b=V;try{return A.apply(this,arguments)}finally{b=Q}}}})($d)),$d}var by;function $C(){return by||(by=1,Yd.exports=YC()),Yd.exports}var Vd={exports:{}},Di={};var wy;function VC(){if(wy)return Di;wy=1;var e=Yp();function t(m){var f="https://react.dev/errors/"+m;if(1<arguments.length){f+="?args[]="+encodeURIComponent(arguments[1]);for(var S=2;S<arguments.length;S++)f+="&args[]="+encodeURIComponent(arguments[S])}return"Minified React error #"+m+"; visit "+f+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function n(){}var a={d:{f:n,r:function(){throw Error(t(522))},D:n,C:n,L:n,m:n,X:n,S:n,M:n},p:0,findDOMNode:null},o=Symbol.for("react.portal");function c(m,f,S){var y=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:o,key:y==null?null:""+y,children:m,containerInfo:f,implementation:S}}var d=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function p(m,f){if(m==="font")return"";if(typeof f=="string")return f==="use-credentials"?f:""}return Di.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=a,Di.createPortal=function(m,f){var S=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!f||f.nodeType!==1&&f.nodeType!==9&&f.nodeType!==11)throw Error(t(299));return c(m,f,null,S)},Di.flushSync=function(m){var f=d.T,S=a.p;try{if(d.T=null,a.p=2,m)return m()}finally{d.T=f,a.p=S,a.d.f()}},Di.preconnect=function(m,f){typeof m=="string"&&(f?(f=f.crossOrigin,f=typeof f=="string"?f==="use-credentials"?f:"":void 0):f=null,a.d.C(m,f))},Di.prefetchDNS=function(m){typeof m=="string"&&a.d.D(m)},Di.preinit=function(m,f){if(typeof m=="string"&&f&&typeof f.as=="string"){var S=f.as,y=p(S,f.crossOrigin),b=typeof f.integrity=="string"?f.integrity:void 0,x=typeof f.fetchPriority=="string"?f.fetchPriority:void 0;S==="style"?a.d.S(m,typeof f.precedence=="string"?f.precedence:void 0,{crossOrigin:y,integrity:b,fetchPriority:x}):S==="script"&&a.d.X(m,{crossOrigin:y,integrity:b,fetchPriority:x,nonce:typeof f.nonce=="string"?f.nonce:void 0})}},Di.preinitModule=function(m,f){if(typeof m=="string")if(typeof f=="object"&&f!==null){if(f.as==null||f.as==="script"){var S=p(f.as,f.crossOrigin);a.d.M(m,{crossOrigin:S,integrity:typeof f.integrity=="string"?f.integrity:void 0,nonce:typeof f.nonce=="string"?f.nonce:void 0})}}else f==null&&a.d.M(m)},Di.preload=function(m,f){if(typeof m=="string"&&typeof f=="object"&&f!==null&&typeof f.as=="string"){var S=f.as,y=p(S,f.crossOrigin);a.d.L(m,S,{crossOrigin:y,integrity:typeof f.integrity=="string"?f.integrity:void 0,nonce:typeof f.nonce=="string"?f.nonce:void 0,type:typeof f.type=="string"?f.type:void 0,fetchPriority:typeof f.fetchPriority=="string"?f.fetchPriority:void 0,referrerPolicy:typeof f.referrerPolicy=="string"?f.referrerPolicy:void 0,imageSrcSet:typeof f.imageSrcSet=="string"?f.imageSrcSet:void 0,imageSizes:typeof f.imageSizes=="string"?f.imageSizes:void 0,media:typeof f.media=="string"?f.media:void 0})}},Di.preloadModule=function(m,f){if(typeof m=="string")if(f){var S=p(f.as,f.crossOrigin);a.d.m(m,{as:typeof f.as=="string"&&f.as!=="script"?f.as:void 0,crossOrigin:S,integrity:typeof f.integrity=="string"?f.integrity:void 0})}else a.d.m(m)},Di.requestFormReset=function(m){a.d.r(m)},Di.unstable_batchedUpdates=function(m,f){return m(f)},Di.useFormState=function(m,f,S){return d.H.useFormState(m,f,S)},Di.useFormStatus=function(){return d.H.useHostTransitionStatus()},Di.version="19.2.6",Di}var Cy;function Sb(){if(Cy)return Vd.exports;Cy=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(t){console.error(t)}}return e(),Vd.exports=VC(),Vd.exports}var xy;function XC(){if(xy)return Al;xy=1;var e=$C(),t=Yp(),n=Sb();function a(i){var s="https://react.dev/errors/"+i;if(1<arguments.length){s+="?args[]="+encodeURIComponent(arguments[1]);for(var r=2;r<arguments.length;r++)s+="&args[]="+encodeURIComponent(arguments[r])}return"Minified React error #"+i+"; visit "+s+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function o(i){return!(!i||i.nodeType!==1&&i.nodeType!==9&&i.nodeType!==11)}function c(i){var s=i,r=i;if(i.alternate)for(;s.return;)s=s.return;else{i=s;do s=i,(s.flags&4098)!==0&&(r=s.return),i=s.return;while(i)}return s.tag===3?r:null}function d(i){if(i.tag===13){var s=i.memoizedState;if(s===null&&(i=i.alternate,i!==null&&(s=i.memoizedState)),s!==null)return s.dehydrated}return null}function p(i){if(i.tag===31){var s=i.memoizedState;if(s===null&&(i=i.alternate,i!==null&&(s=i.memoizedState)),s!==null)return s.dehydrated}return null}function m(i){if(c(i)!==i)throw Error(a(188))}function f(i){var s=i.alternate;if(!s){if(s=c(i),s===null)throw Error(a(188));return s!==i?null:i}for(var r=i,l=s;;){var u=r.return;if(u===null)break;var h=u.alternate;if(h===null){if(l=u.return,l!==null){r=l;continue}break}if(u.child===h.child){for(h=u.child;h;){if(h===r)return m(u),i;if(h===l)return m(u),s;h=h.sibling}throw Error(a(188))}if(r.return!==l.return)r=u,l=h;else{for(var v=!1,w=u.child;w;){if(w===r){v=!0,r=u,l=h;break}if(w===l){v=!0,l=u,r=h;break}w=w.sibling}if(!v){for(w=h.child;w;){if(w===r){v=!0,r=h,l=u;break}if(w===l){v=!0,l=h,r=u;break}w=w.sibling}if(!v)throw Error(a(189))}}if(r.alternate!==l)throw Error(a(190))}if(r.tag!==3)throw Error(a(188));return r.stateNode.current===r?i:s}function S(i){var s=i.tag;if(s===5||s===26||s===27||s===6)return i;for(i=i.child;i!==null;){if(s=S(i),s!==null)return s;i=i.sibling}return null}var y=Object.assign,b=Symbol.for("react.element"),x=Symbol.for("react.transitional.element"),C=Symbol.for("react.portal"),k=Symbol.for("react.fragment"),B=Symbol.for("react.strict_mode"),R=Symbol.for("react.profiler"),re=Symbol.for("react.consumer"),F=Symbol.for("react.context"),J=Symbol.for("react.forward_ref"),ce=Symbol.for("react.suspense"),q=Symbol.for("react.suspense_list"),I=Symbol.for("react.memo"),ie=Symbol.for("react.lazy"),de=Symbol.for("react.activity"),j=Symbol.for("react.memo_cache_sentinel"),$=Symbol.iterator;function H(i){return i===null||typeof i!="object"?null:(i=$&&i[$]||i["@@iterator"],typeof i=="function"?i:null)}var L=Symbol.for("react.client.reference");function X(i){if(i==null)return null;if(typeof i=="function")return i.$$typeof===L?null:i.displayName||i.name||null;if(typeof i=="string")return i;switch(i){case k:return"Fragment";case R:return"Profiler";case B:return"StrictMode";case ce:return"Suspense";case q:return"SuspenseList";case de:return"Activity"}if(typeof i=="object")switch(i.$$typeof){case C:return"Portal";case F:return i.displayName||"Context";case re:return(i._context.displayName||"Context")+".Consumer";case J:var s=i.render;return i=i.displayName,i||(i=s.displayName||s.name||"",i=i!==""?"ForwardRef("+i+")":"ForwardRef"),i;case I:return s=i.displayName||null,s!==null?s:X(i.type)||"Memo";case ie:s=i._payload,i=i._init;try{return X(i(s))}catch{}}return null}var Z=Array.isArray,A=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,V=n.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Q={pending:!1,data:null,method:null,action:null},ve=[],Se=-1;function E(i){return{current:i}}function W(i){0>Se||(i.current=ve[Se],ve[Se]=null,Se--)}function ee(i,s){Se++,ve[Se]=i.current,i.current=s}var he=E(null),ge=E(null),me=E(null),Ce=E(null);function ze(i,s){switch(ee(me,s),ee(ge,i),ee(he,null),s.nodeType){case 9:case 11:i=(i=s.documentElement)&&(i=i.namespaceURI)?Ug(i):0;break;default:if(i=s.tagName,s=s.namespaceURI)s=Ug(s),i=Pg(s,i);else switch(i){case"svg":i=1;break;case"math":i=2;break;default:i=0}}W(he),ee(he,i)}function Ne(){W(he),W(ge),W(me)}function Re(i){i.memoizedState!==null&&ee(Ce,i);var s=he.current,r=Pg(s,i.type);s!==r&&(ee(ge,i),ee(he,r))}function Pe(i){ge.current===i&&(W(he),W(ge)),Ce.current===i&&(W(Ce),Tl._currentValue=Q)}var Ye,Be;function ae(i){if(Ye===void 0)try{throw Error()}catch(r){var s=r.stack.trim().match(/\n( *(at )?)/);Ye=s&&s[1]||"",Be=-1<r.stack.indexOf(`
2
2
  at`)?" (<anonymous>)":-1<r.stack.indexOf("@")?"@unknown:0:0":""}return`
3
- `+Ye+i+Be}var Ee=!1;function xe(i,s){if(!i||Ee)return"";Ee=!0;var r=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var l={DetermineComponentFrameRoot:function(){try{if(s){var le=function(){throw Error()};if(Object.defineProperty(le.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(le,[])}catch(Z){var Y=Z}Reflect.construct(i,[],le)}else{try{le.call()}catch(Z){Y=Z}i.call(le.prototype)}}else{try{throw Error()}catch(Z){Y=Z}(le=i())&&typeof le.catch=="function"&&le.catch(function(){})}}catch(Z){if(Z&&Y&&typeof Z.stack=="string")return[Z.stack,Y.stack]}return[null,null]}};l.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var u=Object.getOwnPropertyDescriptor(l.DetermineComponentFrameRoot,"name");u&&u.configurable&&Object.defineProperty(l.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var h=l.DetermineComponentFrameRoot(),v=h[0],w=h[1];if(v&&w){var D=v.split(`
3
+ `+Ye+i+Be}var Ee=!1;function xe(i,s){if(!i||Ee)return"";Ee=!0;var r=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var l={DetermineComponentFrameRoot:function(){try{if(s){var le=function(){throw Error()};if(Object.defineProperty(le.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(le,[])}catch(G){var Y=G}Reflect.construct(i,[],le)}else{try{le.call()}catch(G){Y=G}i.call(le.prototype)}}else{try{throw Error()}catch(G){Y=G}(le=i())&&typeof le.catch=="function"&&le.catch(function(){})}}catch(G){if(G&&Y&&typeof G.stack=="string")return[G.stack,Y.stack]}return[null,null]}};l.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var u=Object.getOwnPropertyDescriptor(l.DetermineComponentFrameRoot,"name");u&&u.configurable&&Object.defineProperty(l.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var h=l.DetermineComponentFrameRoot(),v=h[0],w=h[1];if(v&&w){var D=v.split(`
4
4
  `),P=w.split(`
5
5
  `);for(u=l=0;l<D.length&&!D[l].includes("DetermineComponentFrameRoot");)l++;for(;u<P.length&&!P[u].includes("DetermineComponentFrameRoot");)u++;if(l===D.length||u===P.length)for(l=D.length-1,u=P.length-1;1<=l&&0<=u&&D[l]!==P[u];)u--;for(;1<=l&&0<=u;l--,u--)if(D[l]!==P[u]){if(l!==1||u!==1)do if(l--,u--,0>u||D[l]!==P[u]){var se=`
6
6
  `+D[l].replace(" at new "," at ");return i.displayName&&se.includes("<anonymous>")&&(se=se.replace("<anonymous>",i.displayName)),se}while(1<=l&&0<=u);break}}}finally{Ee=!1,Error.prepareStackTrace=r}return(r=i?i.displayName||i.name:"")?ae(r):""}function Ke(i,s){switch(i.tag){case 26:case 27:case 5:return ae(i.type);case 16:return ae("Lazy");case 13:return i.child!==s&&s!==null?ae("Suspense Fallback"):ae("Suspense");case 19:return ae("SuspenseList");case 0:case 15:return xe(i.type,!1);case 11:return xe(i.type.render,!1);case 1:return xe(i.type,!0);case 31:return ae("Activity");default:return""}}function Xe(i){try{var s="",r=null;do s+=Ke(i,r),r=i,i=i.return;while(i);return s}catch(l){return`
7
7
  Error generating stack: `+l.message+`
8
- `+l.stack}}var gt=Object.prototype.hasOwnProperty,yt=e.unstable_scheduleCallback,mi=e.unstable_cancelCallback,te=e.unstable_shouldYield,je=e.unstable_requestPaint,He=e.unstable_now,_i=e.unstable_getCurrentPriorityLevel,Vi=e.unstable_ImmediatePriority,ai=e.unstable_UserBlockingPriority,kt=e.unstable_NormalPriority,ji=e.unstable_LowPriority,Ti=e.unstable_IdlePriority,Nt=e.log,$s=e.unstable_setDisableYieldValue,Hi=null,qt=null;function Jt(i){if(typeof Nt=="function"&&$s(i),qt&&typeof qt.setStrictMode=="function")try{qt.setStrictMode(Hi,i)}catch{}}var Dt=Math.clz32?Math.clz32:Vs,Cn=Math.log,Bs=Math.LN2;function Vs(i){return i>>>=0,i===0?32:31-(Cn(i)/Bs|0)|0}var Ts=256,ks=262144,ot=4194304;function St(i){var s=i&42;if(s!==0)return s;switch(i&-i){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 i&261888;case 262144:case 524288:case 1048576:case 2097152:return i&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return i&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return i}}function Rt(i,s,r){var l=i.pendingLanes;if(l===0)return 0;var u=0,h=i.suspendedLanes,v=i.pingedLanes;i=i.warmLanes;var w=l&134217727;return w!==0?(l=w&~h,l!==0?u=St(l):(v&=w,v!==0?u=St(v):r||(r=w&~i,r!==0&&(u=St(r))))):(w=l&~h,w!==0?u=St(w):v!==0?u=St(v):r||(r=l&~i,r!==0&&(u=St(r)))),u===0?0:s!==0&&s!==u&&(s&h)===0&&(h=u&-u,r=s&-s,h>=r||h===32&&(r&4194048)!==0)?s:u}function li(i,s){return(i.pendingLanes&~(i.suspendedLanes&~i.pingedLanes)&s)===0}function ei(i,s){switch(i){case 1:case 2:case 4:case 8:case 64:return s+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 s+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 Bt(){var i=ot;return ot<<=1,(ot&62914560)===0&&(ot=4194304),i}function nt(i){for(var s=[],r=0;31>r;r++)s.push(i);return s}function Wt(i,s){i.pendingLanes|=s,s!==268435456&&(i.suspendedLanes=0,i.pingedLanes=0,i.warmLanes=0)}function bt(i,s,r,l,u,h){var v=i.pendingLanes;i.pendingLanes=r,i.suspendedLanes=0,i.pingedLanes=0,i.warmLanes=0,i.expiredLanes&=r,i.entangledLanes&=r,i.errorRecoveryDisabledLanes&=r,i.shellSuspendCounter=0;var w=i.entanglements,D=i.expirationTimes,P=i.hiddenUpdates;for(r=v&~r;0<r;){var se=31-Dt(r),le=1<<se;w[se]=0,D[se]=-1;var Y=P[se];if(Y!==null)for(P[se]=null,se=0;se<Y.length;se++){var Z=Y[se];Z!==null&&(Z.lane&=-536870913)}r&=~le}l!==0&&Ge(i,l,0),h!==0&&u===0&&i.tag!==0&&(i.suspendedLanes|=h&~(v&~s))}function Ge(i,s,r){i.pendingLanes|=s,i.suspendedLanes&=~s;var l=31-Dt(s);i.entangledLanes|=s,i.entanglements[l]=i.entanglements[l]|1073741824|r&261930}function ct(i,s){var r=i.entangledLanes|=s;for(i=i.entanglements;r;){var l=31-Dt(r),u=1<<l;u&s|i[l]&s&&(i[l]|=s),r&=~u}}function vi(i,s){var r=s&-s;return r=(r&42)!==0?1:Ai(r),(r&(i.suspendedLanes|s))!==0?0:r}function Ai(i){switch(i){case 2:i=1;break;case 8:i=4;break;case 32:i=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:i=128;break;case 268435456:i=134217728;break;default:i=0}return i}function Ni(i){return i&=-i,2<i?8<i?(i&134217727)!==0?32:268435456:8:2}function ki(){var i=V.p;return i!==0?i:(i=window.event,i===void 0?32:cy(i.type))}function cs(i,s){var r=V.p;try{return V.p=i,s()}finally{V.p=r}}var gi=Math.random().toString(36).slice(2),mt="__reactFiber$"+gi,Yt="__reactProps$"+gi,us="__reactContainer$"+gi,Xs="__reactEvents$"+gi,xn="__reactListeners$"+gi,hr="__reactHandles$"+gi,Xi="__reactResources$"+gi,Gi="__reactMarker$"+gi;function En(i){delete i[mt],delete i[Yt],delete i[Xs],delete i[xn],delete i[hr]}function Ls(i){var s=i[mt];if(s)return s;for(var r=i.parentNode;r;){if(s=r[us]||r[mt]){if(r=s.alternate,s.child!==null||r!==null&&r.child!==null)for(i=$g(i);i!==null;){if(r=i[mt])return r;i=$g(i)}return s}i=r,r=i.parentNode}return null}function Os(i){if(i=i[mt]||i[us]){var s=i.tag;if(s===5||s===6||s===13||s===31||s===26||s===27||s===3)return i}return null}function Ds(i){var s=i.tag;if(s===5||s===26||s===27||s===6)return i.stateNode;throw Error(a(33))}function Zi(i){var s=i[Xi];return s||(s=i[Xi]={hoistableStyles:new Map,hoistableScripts:new Map}),s}function Lt(i){i[Gi]=!0}var Qi=new Set,Ir={};function Ui(i,s){zs(i,s),zs(i+"Capture",s)}function zs(i,s){for(Ir[i]=s,i=0;i<s.length;i++)Qi.add(s[i])}var O=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]*$"),fe={},Oe={};function T(i){return gt.call(Oe,i)?!0:gt.call(fe,i)?!1:O.test(i)?Oe[i]=!0:(fe[i]=!0,!1)}function A(i,s,r){if(T(s))if(r===null)i.removeAttribute(s);else{switch(typeof r){case"undefined":case"function":case"symbol":i.removeAttribute(s);return;case"boolean":var l=s.toLowerCase().slice(0,5);if(l!=="data-"&&l!=="aria-"){i.removeAttribute(s);return}}i.setAttribute(s,""+r)}}function K(i,s,r){if(r===null)i.removeAttribute(s);else{switch(typeof r){case"undefined":case"function":case"symbol":case"boolean":i.removeAttribute(s);return}i.setAttribute(s,""+r)}}function ue(i,s,r,l){if(l===null)i.removeAttribute(r);else{switch(typeof l){case"undefined":case"function":case"symbol":case"boolean":i.removeAttribute(r);return}i.setAttributeNS(s,r,""+l)}}function pe(i){switch(typeof i){case"bigint":case"boolean":case"number":case"string":case"undefined":return i;case"object":return i;default:return""}}function ke(i){var s=i.type;return(i=i.nodeName)&&i.toLowerCase()==="input"&&(s==="checkbox"||s==="radio")}function De(i,s,r){var l=Object.getOwnPropertyDescriptor(i.constructor.prototype,s);if(!i.hasOwnProperty(s)&&typeof l<"u"&&typeof l.get=="function"&&typeof l.set=="function"){var u=l.get,h=l.set;return Object.defineProperty(i,s,{configurable:!0,get:function(){return u.call(this)},set:function(v){r=""+v,h.call(this,v)}}),Object.defineProperty(i,s,{enumerable:l.enumerable}),{getValue:function(){return r},setValue:function(v){r=""+v},stopTracking:function(){i._valueTracker=null,delete i[s]}}}}function rt(i){if(!i._valueTracker){var s=ke(i)?"checked":"value";i._valueTracker=De(i,s,""+i[s])}}function ut(i){if(!i)return!1;var s=i._valueTracker;if(!s)return!0;var r=s.getValue(),l="";return i&&(l=ke(i)?i.checked?"true":"false":i.value),i=l,i!==r?(s.setValue(i),!0):!1}function yi(i){if(i=i||(typeof document<"u"?document:void 0),typeof i>"u")return null;try{return i.activeElement||i.body}catch{return i.body}}var Fr=/[\n"\\]/g;function Ut(i){return i.replace(Fr,function(s){return"\\"+s.charCodeAt(0).toString(16)+" "})}function qr(i,s,r,l,u,h,v,w){i.name="",v!=null&&typeof v!="function"&&typeof v!="symbol"&&typeof v!="boolean"?i.type=v:i.removeAttribute("type"),s!=null?v==="number"?(s===0&&i.value===""||i.value!=s)&&(i.value=""+pe(s)):i.value!==""+pe(s)&&(i.value=""+pe(s)):v!=="submit"&&v!=="reset"||i.removeAttribute("value"),s!=null?Hu(i,v,pe(s)):r!=null?Hu(i,v,pe(r)):l!=null&&i.removeAttribute("value"),u==null&&h!=null&&(i.defaultChecked=!!h),u!=null&&(i.checked=u&&typeof u!="function"&&typeof u!="symbol"),w!=null&&typeof w!="function"&&typeof w!="symbol"&&typeof w!="boolean"?i.name=""+pe(w):i.removeAttribute("name")}function Ia(i,s,r,l,u,h,v,w){if(h!=null&&typeof h!="function"&&typeof h!="symbol"&&typeof h!="boolean"&&(i.type=h),s!=null||r!=null){if(!(h!=="submit"&&h!=="reset"||s!=null)){rt(i);return}r=r!=null?""+pe(r):"",s=s!=null?""+pe(s):r,w||s===i.value||(i.value=s),i.defaultValue=s}l=l??u,l=typeof l!="function"&&typeof l!="symbol"&&!!l,i.checked=w?i.checked:!!l,i.defaultChecked=!!l,v!=null&&typeof v!="function"&&typeof v!="symbol"&&typeof v!="boolean"&&(i.name=v),rt(i)}function Hu(i,s,r){s==="number"&&yi(i.ownerDocument)===i||i.defaultValue===""+r||(i.defaultValue=""+r)}function Wr(i,s,r,l){if(i=i.options,s){s={};for(var u=0;u<r.length;u++)s["$"+r[u]]=!0;for(r=0;r<i.length;r++)u=s.hasOwnProperty("$"+i[r].value),i[r].selected!==u&&(i[r].selected=u),u&&l&&(i[r].defaultSelected=!0)}else{for(r=""+pe(r),s=null,u=0;u<i.length;u++){if(i[u].value===r){i[u].selected=!0,l&&(i[u].defaultSelected=!0);return}s!==null||i[u].disabled||(s=i[u])}s!==null&&(s.selected=!0)}}function Lm(i,s,r){if(s!=null&&(s=""+pe(s),s!==i.value&&(i.value=s),r==null)){i.defaultValue!==s&&(i.defaultValue=s);return}i.defaultValue=r!=null?""+pe(r):""}function Om(i,s,r,l){if(s==null){if(l!=null){if(r!=null)throw Error(a(92));if(G(l)){if(1<l.length)throw Error(a(93));l=l[0]}r=l}r==null&&(r=""),s=r}r=pe(s),i.defaultValue=r,l=i.textContent,l===r&&l!==""&&l!==null&&(i.value=l),rt(i)}function Yr(i,s){if(s){var r=i.firstChild;if(r&&r===i.lastChild&&r.nodeType===3){r.nodeValue=s;return}}i.textContent=s}var jw=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 zm(i,s,r){var l=s.indexOf("--")===0;r==null||typeof r=="boolean"||r===""?l?i.setProperty(s,""):s==="float"?i.cssFloat="":i[s]="":l?i.setProperty(s,r):typeof r!="number"||r===0||jw.has(s)?s==="float"?i.cssFloat=r:i[s]=(""+r).trim():i[s]=r+"px"}function jm(i,s,r){if(s!=null&&typeof s!="object")throw Error(a(62));if(i=i.style,r!=null){for(var l in r)!r.hasOwnProperty(l)||s!=null&&s.hasOwnProperty(l)||(l.indexOf("--")===0?i.setProperty(l,""):l==="float"?i.cssFloat="":i[l]="");for(var u in s)l=s[u],s.hasOwnProperty(u)&&r[u]!==l&&zm(i,u,l)}else for(var h in s)s.hasOwnProperty(h)&&zm(i,h,s[h])}function Uu(i){if(i.indexOf("-")===-1)return!1;switch(i){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 Hw=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"]]),Uw=/^[\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 Ro(i){return Uw.test(""+i)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":i}function Gs(){}var Pu=null;function Ku(i){return i=i.target||i.srcElement||window,i.correspondingUseElement&&(i=i.correspondingUseElement),i.nodeType===3?i.parentNode:i}var $r=null,Vr=null;function Hm(i){var s=Os(i);if(s&&(i=s.stateNode)){var r=i[Yt]||null;e:switch(i=s.stateNode,s.type){case"input":if(qr(i,r.value,r.defaultValue,r.defaultValue,r.checked,r.defaultChecked,r.type,r.name),s=r.name,r.type==="radio"&&s!=null){for(r=i;r.parentNode;)r=r.parentNode;for(r=r.querySelectorAll('input[name="'+Ut(""+s)+'"][type="radio"]'),s=0;s<r.length;s++){var l=r[s];if(l!==i&&l.form===i.form){var u=l[Yt]||null;if(!u)throw Error(a(90));qr(l,u.value,u.defaultValue,u.defaultValue,u.checked,u.defaultChecked,u.type,u.name)}}for(s=0;s<r.length;s++)l=r[s],l.form===i.form&&ut(l)}break e;case"textarea":Lm(i,r.value,r.defaultValue);break e;case"select":s=r.value,s!=null&&Wr(i,!!r.multiple,s,!1)}}}var Iu=!1;function Um(i,s,r){if(Iu)return i(s,r);Iu=!0;try{var l=i(s);return l}finally{if(Iu=!1,($r!==null||Vr!==null)&&(_c(),$r&&(s=$r,i=Vr,Vr=$r=null,Hm(s),i)))for(s=0;s<i.length;s++)Hm(i[s])}}function Fa(i,s){var r=i.stateNode;if(r===null)return null;var l=r[Yt]||null;if(l===null)return null;r=l[s];e:switch(s){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(l=!l.disabled)||(i=i.type,l=!(i==="button"||i==="input"||i==="select"||i==="textarea")),i=!l;break e;default:i=!1}if(i)return null;if(r&&typeof r!="function")throw Error(a(231,s,typeof r));return r}var Zs=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Fu=!1;if(Zs)try{var qa={};Object.defineProperty(qa,"passive",{get:function(){Fu=!0}}),window.addEventListener("test",qa,qa),window.removeEventListener("test",qa,qa)}catch{Fu=!1}var Tn=null,qu=null,Mo=null;function Pm(){if(Mo)return Mo;var i,s=qu,r=s.length,l,u="value"in Tn?Tn.value:Tn.textContent,h=u.length;for(i=0;i<r&&s[i]===u[i];i++);var v=r-i;for(l=1;l<=v&&s[r-l]===u[h-l];l++);return Mo=u.slice(i,1<l?1-l:void 0)}function Ao(i){var s=i.keyCode;return"charCode"in i?(i=i.charCode,i===0&&s===13&&(i=13)):i=s,i===10&&(i=13),32<=i||i===13?i:0}function No(){return!0}function Km(){return!1}function Pi(i){function s(r,l,u,h,v){this._reactName=r,this._targetInst=u,this.type=l,this.nativeEvent=h,this.target=v,this.currentTarget=null;for(var w in i)i.hasOwnProperty(w)&&(r=i[w],this[w]=r?r(h):h[w]);return this.isDefaultPrevented=(h.defaultPrevented!=null?h.defaultPrevented:h.returnValue===!1)?No:Km,this.isPropagationStopped=Km,this}return y(s.prototype,{preventDefault:function(){this.defaultPrevented=!0;var r=this.nativeEvent;r&&(r.preventDefault?r.preventDefault():typeof r.returnValue!="unknown"&&(r.returnValue=!1),this.isDefaultPrevented=No)},stopPropagation:function(){var r=this.nativeEvent;r&&(r.stopPropagation?r.stopPropagation():typeof r.cancelBubble!="unknown"&&(r.cancelBubble=!0),this.isPropagationStopped=No)},persist:function(){},isPersistent:No}),s}var dr={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(i){return i.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Bo=Pi(dr),Wa=y({},dr,{view:0,detail:0}),Pw=Pi(Wa),Wu,Yu,Ya,Lo=y({},Wa,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Vu,button:0,buttons:0,relatedTarget:function(i){return i.relatedTarget===void 0?i.fromElement===i.srcElement?i.toElement:i.fromElement:i.relatedTarget},movementX:function(i){return"movementX"in i?i.movementX:(i!==Ya&&(Ya&&i.type==="mousemove"?(Wu=i.screenX-Ya.screenX,Yu=i.screenY-Ya.screenY):Yu=Wu=0,Ya=i),Wu)},movementY:function(i){return"movementY"in i?i.movementY:Yu}}),Im=Pi(Lo),Kw=y({},Lo,{dataTransfer:0}),Iw=Pi(Kw),Fw=y({},Wa,{relatedTarget:0}),$u=Pi(Fw),qw=y({},dr,{animationName:0,elapsedTime:0,pseudoElement:0}),Ww=Pi(qw),Yw=y({},dr,{clipboardData:function(i){return"clipboardData"in i?i.clipboardData:window.clipboardData}}),$w=Pi(Yw),Vw=y({},dr,{data:0}),Fm=Pi(Vw),Xw={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Gw={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"},Zw={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Qw(i){var s=this.nativeEvent;return s.getModifierState?s.getModifierState(i):(i=Zw[i])?!!s[i]:!1}function Vu(){return Qw}var Jw=y({},Wa,{key:function(i){if(i.key){var s=Xw[i.key]||i.key;if(s!=="Unidentified")return s}return i.type==="keypress"?(i=Ao(i),i===13?"Enter":String.fromCharCode(i)):i.type==="keydown"||i.type==="keyup"?Gw[i.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Vu,charCode:function(i){return i.type==="keypress"?Ao(i):0},keyCode:function(i){return i.type==="keydown"||i.type==="keyup"?i.keyCode:0},which:function(i){return i.type==="keypress"?Ao(i):i.type==="keydown"||i.type==="keyup"?i.keyCode:0}}),e1=Pi(Jw),t1=y({},Lo,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),qm=Pi(t1),i1=y({},Wa,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Vu}),s1=Pi(i1),n1=y({},dr,{propertyName:0,elapsedTime:0,pseudoElement:0}),r1=Pi(n1),a1=y({},Lo,{deltaX:function(i){return"deltaX"in i?i.deltaX:"wheelDeltaX"in i?-i.wheelDeltaX:0},deltaY:function(i){return"deltaY"in i?i.deltaY:"wheelDeltaY"in i?-i.wheelDeltaY:"wheelDelta"in i?-i.wheelDelta:0},deltaZ:0,deltaMode:0}),l1=Pi(a1),o1=y({},dr,{newState:0,oldState:0}),c1=Pi(o1),u1=[9,13,27,32],Xu=Zs&&"CompositionEvent"in window,$a=null;Zs&&"documentMode"in document&&($a=document.documentMode);var h1=Zs&&"TextEvent"in window&&!$a,Wm=Zs&&(!Xu||$a&&8<$a&&11>=$a),Ym=" ",$m=!1;function Vm(i,s){switch(i){case"keyup":return u1.indexOf(s.keyCode)!==-1;case"keydown":return s.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Xm(i){return i=i.detail,typeof i=="object"&&"data"in i?i.data:null}var Xr=!1;function d1(i,s){switch(i){case"compositionend":return Xm(s);case"keypress":return s.which!==32?null:($m=!0,Ym);case"textInput":return i=s.data,i===Ym&&$m?null:i;default:return null}}function f1(i,s){if(Xr)return i==="compositionend"||!Xu&&Vm(i,s)?(i=Pm(),Mo=qu=Tn=null,Xr=!1,i):null;switch(i){case"paste":return null;case"keypress":if(!(s.ctrlKey||s.altKey||s.metaKey)||s.ctrlKey&&s.altKey){if(s.char&&1<s.char.length)return s.char;if(s.which)return String.fromCharCode(s.which)}return null;case"compositionend":return Wm&&s.locale!=="ko"?null:s.data;default:return null}}var p1={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 Gm(i){var s=i&&i.nodeName&&i.nodeName.toLowerCase();return s==="input"?!!p1[i.type]:s==="textarea"}function Zm(i,s,r,l){$r?Vr?Vr.push(l):Vr=[l]:$r=l,s=Cc(s,"onChange"),0<s.length&&(r=new Bo("onChange","change",null,r,l),i.push({event:r,listeners:s}))}var Va=null,Xa=null;function m1(i){Bg(i,0)}function Oo(i){var s=Ds(i);if(ut(s))return i}function Qm(i,s){if(i==="change")return s}var Jm=!1;if(Zs){var Gu;if(Zs){var Zu="oninput"in document;if(!Zu){var e_=document.createElement("div");e_.setAttribute("oninput","return;"),Zu=typeof e_.oninput=="function"}Gu=Zu}else Gu=!1;Jm=Gu&&(!document.documentMode||9<document.documentMode)}function t_(){Va&&(Va.detachEvent("onpropertychange",i_),Xa=Va=null)}function i_(i){if(i.propertyName==="value"&&Oo(Xa)){var s=[];Zm(s,Xa,i,Ku(i)),Um(m1,s)}}function _1(i,s,r){i==="focusin"?(t_(),Va=s,Xa=r,Va.attachEvent("onpropertychange",i_)):i==="focusout"&&t_()}function v1(i){if(i==="selectionchange"||i==="keyup"||i==="keydown")return Oo(Xa)}function g1(i,s){if(i==="click")return Oo(s)}function y1(i,s){if(i==="input"||i==="change")return Oo(s)}function S1(i,s){return i===s&&(i!==0||1/i===1/s)||i!==i&&s!==s}var Ji=typeof Object.is=="function"?Object.is:S1;function Ga(i,s){if(Ji(i,s))return!0;if(typeof i!="object"||i===null||typeof s!="object"||s===null)return!1;var r=Object.keys(i),l=Object.keys(s);if(r.length!==l.length)return!1;for(l=0;l<r.length;l++){var u=r[l];if(!gt.call(s,u)||!Ji(i[u],s[u]))return!1}return!0}function s_(i){for(;i&&i.firstChild;)i=i.firstChild;return i}function n_(i,s){var r=s_(i);i=0;for(var l;r;){if(r.nodeType===3){if(l=i+r.textContent.length,i<=s&&l>=s)return{node:r,offset:s-i};i=l}e:{for(;r;){if(r.nextSibling){r=r.nextSibling;break e}r=r.parentNode}r=void 0}r=s_(r)}}function r_(i,s){return i&&s?i===s?!0:i&&i.nodeType===3?!1:s&&s.nodeType===3?r_(i,s.parentNode):"contains"in i?i.contains(s):i.compareDocumentPosition?!!(i.compareDocumentPosition(s)&16):!1:!1}function a_(i){i=i!=null&&i.ownerDocument!=null&&i.ownerDocument.defaultView!=null?i.ownerDocument.defaultView:window;for(var s=yi(i.document);s instanceof i.HTMLIFrameElement;){try{var r=typeof s.contentWindow.location.href=="string"}catch{r=!1}if(r)i=s.contentWindow;else break;s=yi(i.document)}return s}function Qu(i){var s=i&&i.nodeName&&i.nodeName.toLowerCase();return s&&(s==="input"&&(i.type==="text"||i.type==="search"||i.type==="tel"||i.type==="url"||i.type==="password")||s==="textarea"||i.contentEditable==="true")}var b1=Zs&&"documentMode"in document&&11>=document.documentMode,Gr=null,Ju=null,Za=null,eh=!1;function l_(i,s,r){var l=r.window===r?r.document:r.nodeType===9?r:r.ownerDocument;eh||Gr==null||Gr!==yi(l)||(l=Gr,"selectionStart"in l&&Qu(l)?l={start:l.selectionStart,end:l.selectionEnd}:(l=(l.ownerDocument&&l.ownerDocument.defaultView||window).getSelection(),l={anchorNode:l.anchorNode,anchorOffset:l.anchorOffset,focusNode:l.focusNode,focusOffset:l.focusOffset}),Za&&Ga(Za,l)||(Za=l,l=Cc(Ju,"onSelect"),0<l.length&&(s=new Bo("onSelect","select",null,s,r),i.push({event:s,listeners:l}),s.target=Gr)))}function fr(i,s){var r={};return r[i.toLowerCase()]=s.toLowerCase(),r["Webkit"+i]="webkit"+s,r["Moz"+i]="moz"+s,r}var Zr={animationend:fr("Animation","AnimationEnd"),animationiteration:fr("Animation","AnimationIteration"),animationstart:fr("Animation","AnimationStart"),transitionrun:fr("Transition","TransitionRun"),transitionstart:fr("Transition","TransitionStart"),transitioncancel:fr("Transition","TransitionCancel"),transitionend:fr("Transition","TransitionEnd")},th={},o_={};Zs&&(o_=document.createElement("div").style,"AnimationEvent"in window||(delete Zr.animationend.animation,delete Zr.animationiteration.animation,delete Zr.animationstart.animation),"TransitionEvent"in window||delete Zr.transitionend.transition);function pr(i){if(th[i])return th[i];if(!Zr[i])return i;var s=Zr[i],r;for(r in s)if(s.hasOwnProperty(r)&&r in o_)return th[i]=s[r];return i}var c_=pr("animationend"),u_=pr("animationiteration"),h_=pr("animationstart"),w1=pr("transitionrun"),C1=pr("transitionstart"),x1=pr("transitioncancel"),d_=pr("transitionend"),f_=new Map,ih="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(" ");ih.push("scrollEnd");function Rs(i,s){f_.set(i,s),Ui(s,[i])}var zo=typeof reportError=="function"?reportError:function(i){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var s=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof i=="object"&&i!==null&&typeof i.message=="string"?String(i.message):String(i),error:i});if(!window.dispatchEvent(s))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",i);return}console.error(i)},hs=[],Qr=0,sh=0;function jo(){for(var i=Qr,s=sh=Qr=0;s<i;){var r=hs[s];hs[s++]=null;var l=hs[s];hs[s++]=null;var u=hs[s];hs[s++]=null;var h=hs[s];if(hs[s++]=null,l!==null&&u!==null){var v=l.pending;v===null?u.next=u:(u.next=v.next,v.next=u),l.pending=u}h!==0&&p_(r,u,h)}}function Ho(i,s,r,l){hs[Qr++]=i,hs[Qr++]=s,hs[Qr++]=r,hs[Qr++]=l,sh|=l,i.lanes|=l,i=i.alternate,i!==null&&(i.lanes|=l)}function nh(i,s,r,l){return Ho(i,s,r,l),Uo(i)}function mr(i,s){return Ho(i,null,null,s),Uo(i)}function p_(i,s,r){i.lanes|=r;var l=i.alternate;l!==null&&(l.lanes|=r);for(var u=!1,h=i.return;h!==null;)h.childLanes|=r,l=h.alternate,l!==null&&(l.childLanes|=r),h.tag===22&&(i=h.stateNode,i===null||i._visibility&1||(u=!0)),i=h,h=h.return;return i.tag===3?(h=i.stateNode,u&&s!==null&&(u=31-Dt(r),i=h.hiddenUpdates,l=i[u],l===null?i[u]=[s]:l.push(s),s.lane=r|536870912),h):null}function Uo(i){if(50<yl)throw yl=0,fd=null,Error(a(185));for(var s=i.return;s!==null;)i=s,s=i.return;return i.tag===3?i.stateNode:null}var Jr={};function E1(i,s,r,l){this.tag=i,this.key=r,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=s,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=l,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function es(i,s,r,l){return new E1(i,s,r,l)}function rh(i){return i=i.prototype,!(!i||!i.isReactComponent)}function Qs(i,s){var r=i.alternate;return r===null?(r=es(i.tag,s,i.key,i.mode),r.elementType=i.elementType,r.type=i.type,r.stateNode=i.stateNode,r.alternate=i,i.alternate=r):(r.pendingProps=s,r.type=i.type,r.flags=0,r.subtreeFlags=0,r.deletions=null),r.flags=i.flags&65011712,r.childLanes=i.childLanes,r.lanes=i.lanes,r.child=i.child,r.memoizedProps=i.memoizedProps,r.memoizedState=i.memoizedState,r.updateQueue=i.updateQueue,s=i.dependencies,r.dependencies=s===null?null:{lanes:s.lanes,firstContext:s.firstContext},r.sibling=i.sibling,r.index=i.index,r.ref=i.ref,r.refCleanup=i.refCleanup,r}function m_(i,s){i.flags&=65011714;var r=i.alternate;return r===null?(i.childLanes=0,i.lanes=s,i.child=null,i.subtreeFlags=0,i.memoizedProps=null,i.memoizedState=null,i.updateQueue=null,i.dependencies=null,i.stateNode=null):(i.childLanes=r.childLanes,i.lanes=r.lanes,i.child=r.child,i.subtreeFlags=0,i.deletions=null,i.memoizedProps=r.memoizedProps,i.memoizedState=r.memoizedState,i.updateQueue=r.updateQueue,i.type=r.type,s=r.dependencies,i.dependencies=s===null?null:{lanes:s.lanes,firstContext:s.firstContext}),i}function Po(i,s,r,l,u,h){var v=0;if(l=i,typeof i=="function")rh(i)&&(v=1);else if(typeof i=="string")v=MC(i,r,he.current)?26:i==="html"||i==="head"||i==="body"?27:5;else e:switch(i){case de:return i=es(31,r,s,u),i.elementType=de,i.lanes=h,i;case k:return _r(r.children,u,h,s);case B:v=8,u|=24;break;case R:return i=es(12,r,s,u|2),i.elementType=R,i.lanes=h,i;case ce:return i=es(13,r,s,u),i.elementType=ce,i.lanes=h,i;case q:return i=es(19,r,s,u),i.elementType=q,i.lanes=h,i;default:if(typeof i=="object"&&i!==null)switch(i.$$typeof){case F:v=10;break e;case re:v=9;break e;case J:v=11;break e;case I:v=14;break e;case ie:v=16,l=null;break e}v=29,r=Error(a(130,i===null?"null":typeof i,"")),l=null}return s=es(v,r,s,u),s.elementType=i,s.type=l,s.lanes=h,s}function _r(i,s,r,l){return i=es(7,i,l,s),i.lanes=r,i}function ah(i,s,r){return i=es(6,i,null,s),i.lanes=r,i}function __(i){var s=es(18,null,null,0);return s.stateNode=i,s}function lh(i,s,r){return s=es(4,i.children!==null?i.children:[],i.key,s),s.lanes=r,s.stateNode={containerInfo:i.containerInfo,pendingChildren:null,implementation:i.implementation},s}var v_=new WeakMap;function ds(i,s){if(typeof i=="object"&&i!==null){var r=v_.get(i);return r!==void 0?r:(s={value:i,source:s,stack:Xe(s)},v_.set(i,s),s)}return{value:i,source:s,stack:Xe(s)}}var ea=[],ta=0,Ko=null,Qa=0,fs=[],ps=0,kn=null,js=1,Hs="";function Js(i,s){ea[ta++]=Qa,ea[ta++]=Ko,Ko=i,Qa=s}function g_(i,s,r){fs[ps++]=js,fs[ps++]=Hs,fs[ps++]=kn,kn=i;var l=js;i=Hs;var u=32-Dt(l)-1;l&=~(1<<u),r+=1;var h=32-Dt(s)+u;if(30<h){var v=u-u%5;h=(l&(1<<v)-1).toString(32),l>>=v,u-=v,js=1<<32-Dt(s)+u|r<<u|l,Hs=h+i}else js=1<<h|r<<u|l,Hs=i}function oh(i){i.return!==null&&(Js(i,1),g_(i,1,0))}function ch(i){for(;i===Ko;)Ko=ea[--ta],ea[ta]=null,Qa=ea[--ta],ea[ta]=null;for(;i===kn;)kn=fs[--ps],fs[ps]=null,Hs=fs[--ps],fs[ps]=null,js=fs[--ps],fs[ps]=null}function y_(i,s){fs[ps++]=js,fs[ps++]=Hs,fs[ps++]=kn,js=s.id,Hs=s.overflow,kn=i}var Si=null,wt=null,Je=!1,Dn=null,ms=!1,uh=Error(a(519));function Rn(i){var s=Error(a(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Ja(ds(s,i)),uh}function S_(i){var s=i.stateNode,r=i.type,l=i.memoizedProps;switch(s[mt]=i,s[Yt]=l,r){case"dialog":Ve("cancel",s),Ve("close",s);break;case"iframe":case"object":case"embed":Ve("load",s);break;case"video":case"audio":for(r=0;r<bl.length;r++)Ve(bl[r],s);break;case"source":Ve("error",s);break;case"img":case"image":case"link":Ve("error",s),Ve("load",s);break;case"details":Ve("toggle",s);break;case"input":Ve("invalid",s),Ia(s,l.value,l.defaultValue,l.checked,l.defaultChecked,l.type,l.name,!0);break;case"select":Ve("invalid",s);break;case"textarea":Ve("invalid",s),Om(s,l.value,l.defaultValue,l.children)}r=l.children,typeof r!="string"&&typeof r!="number"&&typeof r!="bigint"||s.textContent===""+r||l.suppressHydrationWarning===!0||jg(s.textContent,r)?(l.popover!=null&&(Ve("beforetoggle",s),Ve("toggle",s)),l.onScroll!=null&&Ve("scroll",s),l.onScrollEnd!=null&&Ve("scrollend",s),l.onClick!=null&&(s.onclick=Gs),s=!0):s=!1,s||Rn(i,!0)}function b_(i){for(Si=i.return;Si;)switch(Si.tag){case 5:case 31:case 13:ms=!1;return;case 27:case 3:ms=!0;return;default:Si=Si.return}}function ia(i){if(i!==Si)return!1;if(!Je)return b_(i),Je=!0,!1;var s=i.tag,r;if((r=s!==3&&s!==27)&&((r=s===5)&&(r=i.type,r=!(r!=="form"&&r!=="button")||Dd(i.type,i.memoizedProps)),r=!r),r&&wt&&Rn(i),b_(i),s===13){if(i=i.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(a(317));wt=Yg(i)}else if(s===31){if(i=i.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(a(317));wt=Yg(i)}else s===27?(s=wt,Fn(i.type)?(i=Bd,Bd=null,wt=i):wt=s):wt=Si?vs(i.stateNode.nextSibling):null;return!0}function vr(){wt=Si=null,Je=!1}function hh(){var i=Dn;return i!==null&&(qi===null?qi=i:qi.push.apply(qi,i),Dn=null),i}function Ja(i){Dn===null?Dn=[i]:Dn.push(i)}var dh=E(null),gr=null,en=null;function Mn(i,s,r){ee(dh,s._currentValue),s._currentValue=r}function tn(i){i._currentValue=dh.current,W(dh)}function fh(i,s,r){for(;i!==null;){var l=i.alternate;if((i.childLanes&s)!==s?(i.childLanes|=s,l!==null&&(l.childLanes|=s)):l!==null&&(l.childLanes&s)!==s&&(l.childLanes|=s),i===r)break;i=i.return}}function ph(i,s,r,l){var u=i.child;for(u!==null&&(u.return=i);u!==null;){var h=u.dependencies;if(h!==null){var v=u.child;h=h.firstContext;e:for(;h!==null;){var w=h;h=u;for(var D=0;D<s.length;D++)if(w.context===s[D]){h.lanes|=r,w=h.alternate,w!==null&&(w.lanes|=r),fh(h.return,r,i),l||(v=null);break e}h=w.next}}else if(u.tag===18){if(v=u.return,v===null)throw Error(a(341));v.lanes|=r,h=v.alternate,h!==null&&(h.lanes|=r),fh(v,r,i),v=null}else v=u.child;if(v!==null)v.return=u;else for(v=u;v!==null;){if(v===i){v=null;break}if(u=v.sibling,u!==null){u.return=v.return,v=u;break}v=v.return}u=v}}function sa(i,s,r,l){i=null;for(var u=s,h=!1;u!==null;){if(!h){if((u.flags&524288)!==0)h=!0;else if((u.flags&262144)!==0)break}if(u.tag===10){var v=u.alternate;if(v===null)throw Error(a(387));if(v=v.memoizedProps,v!==null){var w=u.type;Ji(u.pendingProps.value,v.value)||(i!==null?i.push(w):i=[w])}}else if(u===Ce.current){if(v=u.alternate,v===null)throw Error(a(387));v.memoizedState.memoizedState!==u.memoizedState.memoizedState&&(i!==null?i.push(Tl):i=[Tl])}u=u.return}i!==null&&ph(s,i,r,l),s.flags|=262144}function Io(i){for(i=i.firstContext;i!==null;){if(!Ji(i.context._currentValue,i.memoizedValue))return!0;i=i.next}return!1}function yr(i){gr=i,en=null,i=i.dependencies,i!==null&&(i.firstContext=null)}function bi(i){return w_(gr,i)}function Fo(i,s){return gr===null&&yr(i),w_(i,s)}function w_(i,s){var r=s._currentValue;if(s={context:s,memoizedValue:r,next:null},en===null){if(i===null)throw Error(a(308));en=s,i.dependencies={lanes:0,firstContext:s},i.flags|=524288}else en=en.next=s;return r}var T1=typeof AbortController<"u"?AbortController:function(){var i=[],s=this.signal={aborted:!1,addEventListener:function(r,l){i.push(l)}};this.abort=function(){s.aborted=!0,i.forEach(function(r){return r()})}},k1=e.unstable_scheduleCallback,D1=e.unstable_NormalPriority,$t={$$typeof:F,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function mh(){return{controller:new T1,data:new Map,refCount:0}}function el(i){i.refCount--,i.refCount===0&&k1(D1,function(){i.controller.abort()})}var tl=null,_h=0,na=0,ra=null;function R1(i,s){if(tl===null){var r=tl=[];_h=0,na=yd(),ra={status:"pending",value:void 0,then:function(l){r.push(l)}}}return _h++,s.then(C_,C_),s}function C_(){if(--_h===0&&tl!==null){ra!==null&&(ra.status="fulfilled");var i=tl;tl=null,na=0,ra=null;for(var s=0;s<i.length;s++)(0,i[s])()}}function M1(i,s){var r=[],l={status:"pending",value:null,reason:null,then:function(u){r.push(u)}};return i.then(function(){l.status="fulfilled",l.value=s;for(var u=0;u<r.length;u++)(0,r[u])(s)},function(u){for(l.status="rejected",l.reason=u,u=0;u<r.length;u++)(0,r[u])(void 0)}),l}var x_=M.S;M.S=function(i,s){lg=He(),typeof s=="object"&&s!==null&&typeof s.then=="function"&&R1(i,s),x_!==null&&x_(i,s)};var Sr=E(null);function vh(){var i=Sr.current;return i!==null?i:_t.pooledCache}function qo(i,s){s===null?ee(Sr,Sr.current):ee(Sr,s.pool)}function E_(){var i=vh();return i===null?null:{parent:$t._currentValue,pool:i}}var aa=Error(a(460)),gh=Error(a(474)),Wo=Error(a(542)),Yo={then:function(){}};function T_(i){return i=i.status,i==="fulfilled"||i==="rejected"}function k_(i,s,r){switch(r=i[r],r===void 0?i.push(s):r!==s&&(s.then(Gs,Gs),s=r),s.status){case"fulfilled":return s.value;case"rejected":throw i=s.reason,R_(i),i;default:if(typeof s.status=="string")s.then(Gs,Gs);else{if(i=_t,i!==null&&100<i.shellSuspendCounter)throw Error(a(482));i=s,i.status="pending",i.then(function(l){if(s.status==="pending"){var u=s;u.status="fulfilled",u.value=l}},function(l){if(s.status==="pending"){var u=s;u.status="rejected",u.reason=l}})}switch(s.status){case"fulfilled":return s.value;case"rejected":throw i=s.reason,R_(i),i}throw wr=s,aa}}function br(i){try{var s=i._init;return s(i._payload)}catch(r){throw r!==null&&typeof r=="object"&&typeof r.then=="function"?(wr=r,aa):r}}var wr=null;function D_(){if(wr===null)throw Error(a(459));var i=wr;return wr=null,i}function R_(i){if(i===aa||i===Wo)throw Error(a(483))}var la=null,il=0;function $o(i){var s=il;return il+=1,la===null&&(la=[]),k_(la,i,s)}function sl(i,s){s=s.props.ref,i.ref=s!==void 0?s:null}function Vo(i,s){throw s.$$typeof===b?Error(a(525)):(i=Object.prototype.toString.call(s),Error(a(31,i==="[object Object]"?"object with keys {"+Object.keys(s).join(", ")+"}":i)))}function M_(i){function s(z,N){if(i){var U=z.deletions;U===null?(z.deletions=[N],z.flags|=16):U.push(N)}}function r(z,N){if(!i)return null;for(;N!==null;)s(z,N),N=N.sibling;return null}function l(z){for(var N=new Map;z!==null;)z.key!==null?N.set(z.key,z):N.set(z.index,z),z=z.sibling;return N}function u(z,N){return z=Qs(z,N),z.index=0,z.sibling=null,z}function h(z,N,U){return z.index=U,i?(U=z.alternate,U!==null?(U=U.index,U<N?(z.flags|=67108866,N):U):(z.flags|=67108866,N)):(z.flags|=1048576,N)}function v(z){return i&&z.alternate===null&&(z.flags|=67108866),z}function w(z,N,U,ne){return N===null||N.tag!==6?(N=ah(U,z.mode,ne),N.return=z,N):(N=u(N,U),N.return=z,N)}function D(z,N,U,ne){var Me=U.type;return Me===k?se(z,N,U.props.children,ne,U.key):N!==null&&(N.elementType===Me||typeof Me=="object"&&Me!==null&&Me.$$typeof===ie&&br(Me)===N.type)?(N=u(N,U.props),sl(N,U),N.return=z,N):(N=Po(U.type,U.key,U.props,null,z.mode,ne),sl(N,U),N.return=z,N)}function P(z,N,U,ne){return N===null||N.tag!==4||N.stateNode.containerInfo!==U.containerInfo||N.stateNode.implementation!==U.implementation?(N=lh(U,z.mode,ne),N.return=z,N):(N=u(N,U.children||[]),N.return=z,N)}function se(z,N,U,ne,Me){return N===null||N.tag!==7?(N=_r(U,z.mode,ne,Me),N.return=z,N):(N=u(N,U),N.return=z,N)}function le(z,N,U){if(typeof N=="string"&&N!==""||typeof N=="number"||typeof N=="bigint")return N=ah(""+N,z.mode,U),N.return=z,N;if(typeof N=="object"&&N!==null){switch(N.$$typeof){case x:return U=Po(N.type,N.key,N.props,null,z.mode,U),sl(U,N),U.return=z,U;case C:return N=lh(N,z.mode,U),N.return=z,N;case ie:return N=br(N),le(z,N,U)}if(G(N)||H(N))return N=_r(N,z.mode,U,null),N.return=z,N;if(typeof N.then=="function")return le(z,$o(N),U);if(N.$$typeof===F)return le(z,Fo(z,N),U);Vo(z,N)}return null}function Y(z,N,U,ne){var Me=N!==null?N.key:null;if(typeof U=="string"&&U!==""||typeof U=="number"||typeof U=="bigint")return Me!==null?null:w(z,N,""+U,ne);if(typeof U=="object"&&U!==null){switch(U.$$typeof){case x:return U.key===Me?D(z,N,U,ne):null;case C:return U.key===Me?P(z,N,U,ne):null;case ie:return U=br(U),Y(z,N,U,ne)}if(G(U)||H(U))return Me!==null?null:se(z,N,U,ne,null);if(typeof U.then=="function")return Y(z,N,$o(U),ne);if(U.$$typeof===F)return Y(z,N,Fo(z,U),ne);Vo(z,U)}return null}function Z(z,N,U,ne,Me){if(typeof ne=="string"&&ne!==""||typeof ne=="number"||typeof ne=="bigint")return z=z.get(U)||null,w(N,z,""+ne,Me);if(typeof ne=="object"&&ne!==null){switch(ne.$$typeof){case x:return z=z.get(ne.key===null?U:ne.key)||null,D(N,z,ne,Me);case C:return z=z.get(ne.key===null?U:ne.key)||null,P(N,z,ne,Me);case ie:return ne=br(ne),Z(z,N,U,ne,Me)}if(G(ne)||H(ne))return z=z.get(U)||null,se(N,z,ne,Me,null);if(typeof ne.then=="function")return Z(z,N,U,$o(ne),Me);if(ne.$$typeof===F)return Z(z,N,U,Fo(N,ne),Me);Vo(N,ne)}return null}function be(z,N,U,ne){for(var Me=null,tt=null,Te=N,Fe=N=0,Qe=null;Te!==null&&Fe<U.length;Fe++){Te.index>Fe?(Qe=Te,Te=null):Qe=Te.sibling;var it=Y(z,Te,U[Fe],ne);if(it===null){Te===null&&(Te=Qe);break}i&&Te&&it.alternate===null&&s(z,Te),N=h(it,N,Fe),tt===null?Me=it:tt.sibling=it,tt=it,Te=Qe}if(Fe===U.length)return r(z,Te),Je&&Js(z,Fe),Me;if(Te===null){for(;Fe<U.length;Fe++)Te=le(z,U[Fe],ne),Te!==null&&(N=h(Te,N,Fe),tt===null?Me=Te:tt.sibling=Te,tt=Te);return Je&&Js(z,Fe),Me}for(Te=l(Te);Fe<U.length;Fe++)Qe=Z(Te,z,Fe,U[Fe],ne),Qe!==null&&(i&&Qe.alternate!==null&&Te.delete(Qe.key===null?Fe:Qe.key),N=h(Qe,N,Fe),tt===null?Me=Qe:tt.sibling=Qe,tt=Qe);return i&&Te.forEach(function(Vn){return s(z,Vn)}),Je&&Js(z,Fe),Me}function Ae(z,N,U,ne){if(U==null)throw Error(a(151));for(var Me=null,tt=null,Te=N,Fe=N=0,Qe=null,it=U.next();Te!==null&&!it.done;Fe++,it=U.next()){Te.index>Fe?(Qe=Te,Te=null):Qe=Te.sibling;var Vn=Y(z,Te,it.value,ne);if(Vn===null){Te===null&&(Te=Qe);break}i&&Te&&Vn.alternate===null&&s(z,Te),N=h(Vn,N,Fe),tt===null?Me=Vn:tt.sibling=Vn,tt=Vn,Te=Qe}if(it.done)return r(z,Te),Je&&Js(z,Fe),Me;if(Te===null){for(;!it.done;Fe++,it=U.next())it=le(z,it.value,ne),it!==null&&(N=h(it,N,Fe),tt===null?Me=it:tt.sibling=it,tt=it);return Je&&Js(z,Fe),Me}for(Te=l(Te);!it.done;Fe++,it=U.next())it=Z(Te,z,Fe,it.value,ne),it!==null&&(i&&it.alternate!==null&&Te.delete(it.key===null?Fe:it.key),N=h(it,N,Fe),tt===null?Me=it:tt.sibling=it,tt=it);return i&&Te.forEach(function(KC){return s(z,KC)}),Je&&Js(z,Fe),Me}function ft(z,N,U,ne){if(typeof U=="object"&&U!==null&&U.type===k&&U.key===null&&(U=U.props.children),typeof U=="object"&&U!==null){switch(U.$$typeof){case x:e:{for(var Me=U.key;N!==null;){if(N.key===Me){if(Me=U.type,Me===k){if(N.tag===7){r(z,N.sibling),ne=u(N,U.props.children),ne.return=z,z=ne;break e}}else if(N.elementType===Me||typeof Me=="object"&&Me!==null&&Me.$$typeof===ie&&br(Me)===N.type){r(z,N.sibling),ne=u(N,U.props),sl(ne,U),ne.return=z,z=ne;break e}r(z,N);break}else s(z,N);N=N.sibling}U.type===k?(ne=_r(U.props.children,z.mode,ne,U.key),ne.return=z,z=ne):(ne=Po(U.type,U.key,U.props,null,z.mode,ne),sl(ne,U),ne.return=z,z=ne)}return v(z);case C:e:{for(Me=U.key;N!==null;){if(N.key===Me)if(N.tag===4&&N.stateNode.containerInfo===U.containerInfo&&N.stateNode.implementation===U.implementation){r(z,N.sibling),ne=u(N,U.children||[]),ne.return=z,z=ne;break e}else{r(z,N);break}else s(z,N);N=N.sibling}ne=lh(U,z.mode,ne),ne.return=z,z=ne}return v(z);case ie:return U=br(U),ft(z,N,U,ne)}if(G(U))return be(z,N,U,ne);if(H(U)){if(Me=H(U),typeof Me!="function")throw Error(a(150));return U=Me.call(U),Ae(z,N,U,ne)}if(typeof U.then=="function")return ft(z,N,$o(U),ne);if(U.$$typeof===F)return ft(z,N,Fo(z,U),ne);Vo(z,U)}return typeof U=="string"&&U!==""||typeof U=="number"||typeof U=="bigint"?(U=""+U,N!==null&&N.tag===6?(r(z,N.sibling),ne=u(N,U),ne.return=z,z=ne):(r(z,N),ne=ah(U,z.mode,ne),ne.return=z,z=ne),v(z)):r(z,N)}return function(z,N,U,ne){try{il=0;var Me=ft(z,N,U,ne);return la=null,Me}catch(Te){if(Te===aa||Te===Wo)throw Te;var tt=es(29,Te,null,z.mode);return tt.lanes=ne,tt.return=z,tt}}}var Cr=M_(!0),A_=M_(!1),An=!1;function yh(i){i.updateQueue={baseState:i.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Sh(i,s){i=i.updateQueue,s.updateQueue===i&&(s.updateQueue={baseState:i.baseState,firstBaseUpdate:i.firstBaseUpdate,lastBaseUpdate:i.lastBaseUpdate,shared:i.shared,callbacks:null})}function Nn(i){return{lane:i,tag:0,payload:null,callback:null,next:null}}function Bn(i,s,r){var l=i.updateQueue;if(l===null)return null;if(l=l.shared,(st&2)!==0){var u=l.pending;return u===null?s.next=s:(s.next=u.next,u.next=s),l.pending=s,s=Uo(i),p_(i,null,r),s}return Ho(i,l,s,r),Uo(i)}function nl(i,s,r){if(s=s.updateQueue,s!==null&&(s=s.shared,(r&4194048)!==0)){var l=s.lanes;l&=i.pendingLanes,r|=l,s.lanes=r,ct(i,r)}}function bh(i,s){var r=i.updateQueue,l=i.alternate;if(l!==null&&(l=l.updateQueue,r===l)){var u=null,h=null;if(r=r.firstBaseUpdate,r!==null){do{var v={lane:r.lane,tag:r.tag,payload:r.payload,callback:null,next:null};h===null?u=h=v:h=h.next=v,r=r.next}while(r!==null);h===null?u=h=s:h=h.next=s}else u=h=s;r={baseState:l.baseState,firstBaseUpdate:u,lastBaseUpdate:h,shared:l.shared,callbacks:l.callbacks},i.updateQueue=r;return}i=r.lastBaseUpdate,i===null?r.firstBaseUpdate=s:i.next=s,r.lastBaseUpdate=s}var wh=!1;function rl(){if(wh){var i=ra;if(i!==null)throw i}}function al(i,s,r,l){wh=!1;var u=i.updateQueue;An=!1;var h=u.firstBaseUpdate,v=u.lastBaseUpdate,w=u.shared.pending;if(w!==null){u.shared.pending=null;var D=w,P=D.next;D.next=null,v===null?h=P:v.next=P,v=D;var se=i.alternate;se!==null&&(se=se.updateQueue,w=se.lastBaseUpdate,w!==v&&(w===null?se.firstBaseUpdate=P:w.next=P,se.lastBaseUpdate=D))}if(h!==null){var le=u.baseState;v=0,se=P=D=null,w=h;do{var Y=w.lane&-536870913,Z=Y!==w.lane;if(Z?(Ze&Y)===Y:(l&Y)===Y){Y!==0&&Y===na&&(wh=!0),se!==null&&(se=se.next={lane:0,tag:w.tag,payload:w.payload,callback:null,next:null});e:{var be=i,Ae=w;Y=s;var ft=r;switch(Ae.tag){case 1:if(be=Ae.payload,typeof be=="function"){le=be.call(ft,le,Y);break e}le=be;break e;case 3:be.flags=be.flags&-65537|128;case 0:if(be=Ae.payload,Y=typeof be=="function"?be.call(ft,le,Y):be,Y==null)break e;le=y({},le,Y);break e;case 2:An=!0}}Y=w.callback,Y!==null&&(i.flags|=64,Z&&(i.flags|=8192),Z=u.callbacks,Z===null?u.callbacks=[Y]:Z.push(Y))}else Z={lane:Y,tag:w.tag,payload:w.payload,callback:w.callback,next:null},se===null?(P=se=Z,D=le):se=se.next=Z,v|=Y;if(w=w.next,w===null){if(w=u.shared.pending,w===null)break;Z=w,w=Z.next,Z.next=null,u.lastBaseUpdate=Z,u.shared.pending=null}}while(!0);se===null&&(D=le),u.baseState=D,u.firstBaseUpdate=P,u.lastBaseUpdate=se,h===null&&(u.shared.lanes=0),Hn|=v,i.lanes=v,i.memoizedState=le}}function N_(i,s){if(typeof i!="function")throw Error(a(191,i));i.call(s)}function B_(i,s){var r=i.callbacks;if(r!==null)for(i.callbacks=null,i=0;i<r.length;i++)N_(r[i],s)}var oa=E(null),Xo=E(0);function L_(i,s){i=hn,ee(Xo,i),ee(oa,s),hn=i|s.baseLanes}function Ch(){ee(Xo,hn),ee(oa,oa.current)}function xh(){hn=Xo.current,W(oa),W(Xo)}var ts=E(null),_s=null;function Ln(i){var s=i.alternate;ee(Pt,Pt.current&1),ee(ts,i),_s===null&&(s===null||oa.current!==null||s.memoizedState!==null)&&(_s=i)}function Eh(i){ee(Pt,Pt.current),ee(ts,i),_s===null&&(_s=i)}function O_(i){i.tag===22?(ee(Pt,Pt.current),ee(ts,i),_s===null&&(_s=i)):On()}function On(){ee(Pt,Pt.current),ee(ts,ts.current)}function is(i){W(ts),_s===i&&(_s=null),W(Pt)}var Pt=E(0);function Go(i){for(var s=i;s!==null;){if(s.tag===13){var r=s.memoizedState;if(r!==null&&(r=r.dehydrated,r===null||Ad(r)||Nd(r)))return s}else if(s.tag===19&&(s.memoizedProps.revealOrder==="forwards"||s.memoizedProps.revealOrder==="backwards"||s.memoizedProps.revealOrder==="unstable_legacy-backwards"||s.memoizedProps.revealOrder==="together")){if((s.flags&128)!==0)return s}else if(s.child!==null){s.child.return=s,s=s.child;continue}if(s===i)break;for(;s.sibling===null;){if(s.return===null||s.return===i)return null;s=s.return}s.sibling.return=s.return,s=s.sibling}return null}var sn=0,Ie=null,ht=null,Vt=null,Zo=!1,ca=!1,xr=!1,Qo=0,ll=0,ua=null,A1=0;function Ot(){throw Error(a(321))}function Th(i,s){if(s===null)return!1;for(var r=0;r<s.length&&r<i.length;r++)if(!Ji(i[r],s[r]))return!1;return!0}function kh(i,s,r,l,u,h){return sn=h,Ie=s,s.memoizedState=null,s.updateQueue=null,s.lanes=0,M.H=i===null||i.memoizedState===null?gv:Ih,xr=!1,h=r(l,u),xr=!1,ca&&(h=j_(s,r,l,u)),z_(i),h}function z_(i){M.H=ul;var s=ht!==null&&ht.next!==null;if(sn=0,Vt=ht=Ie=null,Zo=!1,ll=0,ua=null,s)throw Error(a(300));i===null||Xt||(i=i.dependencies,i!==null&&Io(i)&&(Xt=!0))}function j_(i,s,r,l){Ie=i;var u=0;do{if(ca&&(ua=null),ll=0,ca=!1,25<=u)throw Error(a(301));if(u+=1,Vt=ht=null,i.updateQueue!=null){var h=i.updateQueue;h.lastEffect=null,h.events=null,h.stores=null,h.memoCache!=null&&(h.memoCache.index=0)}M.H=yv,h=s(r,l)}while(ca);return h}function N1(){var i=M.H,s=i.useState()[0];return s=typeof s.then=="function"?ol(s):s,i=i.useState()[0],(ht!==null?ht.memoizedState:null)!==i&&(Ie.flags|=1024),s}function Dh(){var i=Qo!==0;return Qo=0,i}function Rh(i,s,r){s.updateQueue=i.updateQueue,s.flags&=-2053,i.lanes&=~r}function Mh(i){if(Zo){for(i=i.memoizedState;i!==null;){var s=i.queue;s!==null&&(s.pending=null),i=i.next}Zo=!1}sn=0,Vt=ht=Ie=null,ca=!1,ll=Qo=0,ua=null}function Bi(){var i={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Vt===null?Ie.memoizedState=Vt=i:Vt=Vt.next=i,Vt}function Kt(){if(ht===null){var i=Ie.alternate;i=i!==null?i.memoizedState:null}else i=ht.next;var s=Vt===null?Ie.memoizedState:Vt.next;if(s!==null)Vt=s,ht=i;else{if(i===null)throw Ie.alternate===null?Error(a(467)):Error(a(310));ht=i,i={memoizedState:ht.memoizedState,baseState:ht.baseState,baseQueue:ht.baseQueue,queue:ht.queue,next:null},Vt===null?Ie.memoizedState=Vt=i:Vt=Vt.next=i}return Vt}function Jo(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function ol(i){var s=ll;return ll+=1,ua===null&&(ua=[]),i=k_(ua,i,s),s=Ie,(Vt===null?s.memoizedState:Vt.next)===null&&(s=s.alternate,M.H=s===null||s.memoizedState===null?gv:Ih),i}function ec(i){if(i!==null&&typeof i=="object"){if(typeof i.then=="function")return ol(i);if(i.$$typeof===F)return bi(i)}throw Error(a(438,String(i)))}function Ah(i){var s=null,r=Ie.updateQueue;if(r!==null&&(s=r.memoCache),s==null){var l=Ie.alternate;l!==null&&(l=l.updateQueue,l!==null&&(l=l.memoCache,l!=null&&(s={data:l.data.map(function(u){return u.slice()}),index:0})))}if(s==null&&(s={data:[],index:0}),r===null&&(r=Jo(),Ie.updateQueue=r),r.memoCache=s,r=s.data[s.index],r===void 0)for(r=s.data[s.index]=Array(i),l=0;l<i;l++)r[l]=j;return s.index++,r}function nn(i,s){return typeof s=="function"?s(i):s}function tc(i){var s=Kt();return Nh(s,ht,i)}function Nh(i,s,r){var l=i.queue;if(l===null)throw Error(a(311));l.lastRenderedReducer=r;var u=i.baseQueue,h=l.pending;if(h!==null){if(u!==null){var v=u.next;u.next=h.next,h.next=v}s.baseQueue=u=h,l.pending=null}if(h=i.baseState,u===null)i.memoizedState=h;else{s=u.next;var w=v=null,D=null,P=s,se=!1;do{var le=P.lane&-536870913;if(le!==P.lane?(Ze&le)===le:(sn&le)===le){var Y=P.revertLane;if(Y===0)D!==null&&(D=D.next={lane:0,revertLane:0,gesture:null,action:P.action,hasEagerState:P.hasEagerState,eagerState:P.eagerState,next:null}),le===na&&(se=!0);else if((sn&Y)===Y){P=P.next,Y===na&&(se=!0);continue}else le={lane:0,revertLane:P.revertLane,gesture:null,action:P.action,hasEagerState:P.hasEagerState,eagerState:P.eagerState,next:null},D===null?(w=D=le,v=h):D=D.next=le,Ie.lanes|=Y,Hn|=Y;le=P.action,xr&&r(h,le),h=P.hasEagerState?P.eagerState:r(h,le)}else Y={lane:le,revertLane:P.revertLane,gesture:P.gesture,action:P.action,hasEagerState:P.hasEagerState,eagerState:P.eagerState,next:null},D===null?(w=D=Y,v=h):D=D.next=Y,Ie.lanes|=le,Hn|=le;P=P.next}while(P!==null&&P!==s);if(D===null?v=h:D.next=w,!Ji(h,i.memoizedState)&&(Xt=!0,se&&(r=ra,r!==null)))throw r;i.memoizedState=h,i.baseState=v,i.baseQueue=D,l.lastRenderedState=h}return u===null&&(l.lanes=0),[i.memoizedState,l.dispatch]}function Bh(i){var s=Kt(),r=s.queue;if(r===null)throw Error(a(311));r.lastRenderedReducer=i;var l=r.dispatch,u=r.pending,h=s.memoizedState;if(u!==null){r.pending=null;var v=u=u.next;do h=i(h,v.action),v=v.next;while(v!==u);Ji(h,s.memoizedState)||(Xt=!0),s.memoizedState=h,s.baseQueue===null&&(s.baseState=h),r.lastRenderedState=h}return[h,l]}function H_(i,s,r){var l=Ie,u=Kt(),h=Je;if(h){if(r===void 0)throw Error(a(407));r=r()}else r=s();var v=!Ji((ht||u).memoizedState,r);if(v&&(u.memoizedState=r,Xt=!0),u=u.queue,zh(K_.bind(null,l,u,i),[i]),u.getSnapshot!==s||v||Vt!==null&&Vt.memoizedState.tag&1){if(l.flags|=2048,ha(9,{destroy:void 0},P_.bind(null,l,u,r,s),null),_t===null)throw Error(a(349));h||(sn&127)!==0||U_(l,s,r)}return r}function U_(i,s,r){i.flags|=16384,i={getSnapshot:s,value:r},s=Ie.updateQueue,s===null?(s=Jo(),Ie.updateQueue=s,s.stores=[i]):(r=s.stores,r===null?s.stores=[i]:r.push(i))}function P_(i,s,r,l){s.value=r,s.getSnapshot=l,I_(s)&&F_(i)}function K_(i,s,r){return r(function(){I_(s)&&F_(i)})}function I_(i){var s=i.getSnapshot;i=i.value;try{var r=s();return!Ji(i,r)}catch{return!0}}function F_(i){var s=mr(i,2);s!==null&&Wi(s,i,2)}function Lh(i){var s=Bi();if(typeof i=="function"){var r=i;if(i=r(),xr){Jt(!0);try{r()}finally{Jt(!1)}}}return s.memoizedState=s.baseState=i,s.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:nn,lastRenderedState:i},s}function q_(i,s,r,l){return i.baseState=r,Nh(i,ht,typeof l=="function"?l:nn)}function B1(i,s,r,l,u){if(nc(i))throw Error(a(485));if(i=s.action,i!==null){var h={payload:u,action:i,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(v){h.listeners.push(v)}};M.T!==null?r(!0):h.isTransition=!1,l(h),r=s.pending,r===null?(h.next=s.pending=h,W_(s,h)):(h.next=r.next,s.pending=r.next=h)}}function W_(i,s){var r=s.action,l=s.payload,u=i.state;if(s.isTransition){var h=M.T,v={};M.T=v;try{var w=r(u,l),D=M.S;D!==null&&D(v,w),Y_(i,s,w)}catch(P){Oh(i,s,P)}finally{h!==null&&v.types!==null&&(h.types=v.types),M.T=h}}else try{h=r(u,l),Y_(i,s,h)}catch(P){Oh(i,s,P)}}function Y_(i,s,r){r!==null&&typeof r=="object"&&typeof r.then=="function"?r.then(function(l){$_(i,s,l)},function(l){return Oh(i,s,l)}):$_(i,s,r)}function $_(i,s,r){s.status="fulfilled",s.value=r,V_(s),i.state=r,s=i.pending,s!==null&&(r=s.next,r===s?i.pending=null:(r=r.next,s.next=r,W_(i,r)))}function Oh(i,s,r){var l=i.pending;if(i.pending=null,l!==null){l=l.next;do s.status="rejected",s.reason=r,V_(s),s=s.next;while(s!==l)}i.action=null}function V_(i){i=i.listeners;for(var s=0;s<i.length;s++)(0,i[s])()}function X_(i,s){return s}function G_(i,s){if(Je){var r=_t.formState;if(r!==null){e:{var l=Ie;if(Je){if(wt){t:{for(var u=wt,h=ms;u.nodeType!==8;){if(!h){u=null;break t}if(u=vs(u.nextSibling),u===null){u=null;break t}}h=u.data,u=h==="F!"||h==="F"?u:null}if(u){wt=vs(u.nextSibling),l=u.data==="F!";break e}}Rn(l)}l=!1}l&&(s=r[0])}}return r=Bi(),r.memoizedState=r.baseState=s,l={pending:null,lanes:0,dispatch:null,lastRenderedReducer:X_,lastRenderedState:s},r.queue=l,r=mv.bind(null,Ie,l),l.dispatch=r,l=Lh(!1),h=Kh.bind(null,Ie,!1,l.queue),l=Bi(),u={state:s,dispatch:null,action:i,pending:null},l.queue=u,r=B1.bind(null,Ie,u,h,r),u.dispatch=r,l.memoizedState=i,[s,r,!1]}function Z_(i){var s=Kt();return Q_(s,ht,i)}function Q_(i,s,r){if(s=Nh(i,s,X_)[0],i=tc(nn)[0],typeof s=="object"&&s!==null&&typeof s.then=="function")try{var l=ol(s)}catch(v){throw v===aa?Wo:v}else l=s;s=Kt();var u=s.queue,h=u.dispatch;return r!==s.memoizedState&&(Ie.flags|=2048,ha(9,{destroy:void 0},L1.bind(null,u,r),null)),[l,h,i]}function L1(i,s){i.action=s}function J_(i){var s=Kt(),r=ht;if(r!==null)return Q_(s,r,i);Kt(),s=s.memoizedState,r=Kt();var l=r.queue.dispatch;return r.memoizedState=i,[s,l,!1]}function ha(i,s,r,l){return i={tag:i,create:r,deps:l,inst:s,next:null},s=Ie.updateQueue,s===null&&(s=Jo(),Ie.updateQueue=s),r=s.lastEffect,r===null?s.lastEffect=i.next=i:(l=r.next,r.next=i,i.next=l,s.lastEffect=i),i}function ev(){return Kt().memoizedState}function ic(i,s,r,l){var u=Bi();Ie.flags|=i,u.memoizedState=ha(1|s,{destroy:void 0},r,l===void 0?null:l)}function sc(i,s,r,l){var u=Kt();l=l===void 0?null:l;var h=u.memoizedState.inst;ht!==null&&l!==null&&Th(l,ht.memoizedState.deps)?u.memoizedState=ha(s,h,r,l):(Ie.flags|=i,u.memoizedState=ha(1|s,h,r,l))}function tv(i,s){ic(8390656,8,i,s)}function zh(i,s){sc(2048,8,i,s)}function O1(i){Ie.flags|=4;var s=Ie.updateQueue;if(s===null)s=Jo(),Ie.updateQueue=s,s.events=[i];else{var r=s.events;r===null?s.events=[i]:r.push(i)}}function iv(i){var s=Kt().memoizedState;return O1({ref:s,nextImpl:i}),function(){if((st&2)!==0)throw Error(a(440));return s.impl.apply(void 0,arguments)}}function sv(i,s){return sc(4,2,i,s)}function nv(i,s){return sc(4,4,i,s)}function rv(i,s){if(typeof s=="function"){i=i();var r=s(i);return function(){typeof r=="function"?r():s(null)}}if(s!=null)return i=i(),s.current=i,function(){s.current=null}}function av(i,s,r){r=r!=null?r.concat([i]):null,sc(4,4,rv.bind(null,s,i),r)}function jh(){}function lv(i,s){var r=Kt();s=s===void 0?null:s;var l=r.memoizedState;return s!==null&&Th(s,l[1])?l[0]:(r.memoizedState=[i,s],i)}function ov(i,s){var r=Kt();s=s===void 0?null:s;var l=r.memoizedState;if(s!==null&&Th(s,l[1]))return l[0];if(l=i(),xr){Jt(!0);try{i()}finally{Jt(!1)}}return r.memoizedState=[l,s],l}function Hh(i,s,r){return r===void 0||(sn&1073741824)!==0&&(Ze&261930)===0?i.memoizedState=s:(i.memoizedState=r,i=cg(),Ie.lanes|=i,Hn|=i,r)}function cv(i,s,r,l){return Ji(r,s)?r:oa.current!==null?(i=Hh(i,r,l),Ji(i,s)||(Xt=!0),i):(sn&42)===0||(sn&1073741824)!==0&&(Ze&261930)===0?(Xt=!0,i.memoizedState=r):(i=cg(),Ie.lanes|=i,Hn|=i,s)}function uv(i,s,r,l,u){var h=V.p;V.p=h!==0&&8>h?h:8;var v=M.T,w={};M.T=w,Kh(i,!1,s,r);try{var D=u(),P=M.S;if(P!==null&&P(w,D),D!==null&&typeof D=="object"&&typeof D.then=="function"){var se=M1(D,l);cl(i,s,se,rs(i))}else cl(i,s,l,rs(i))}catch(le){cl(i,s,{then:function(){},status:"rejected",reason:le},rs())}finally{V.p=h,v!==null&&w.types!==null&&(v.types=w.types),M.T=v}}function z1(){}function Uh(i,s,r,l){if(i.tag!==5)throw Error(a(476));var u=hv(i).queue;uv(i,u,s,Q,r===null?z1:function(){return dv(i),r(l)})}function hv(i){var s=i.memoizedState;if(s!==null)return s;s={memoizedState:Q,baseState:Q,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:nn,lastRenderedState:Q},next:null};var r={};return s.next={memoizedState:r,baseState:r,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:nn,lastRenderedState:r},next:null},i.memoizedState=s,i=i.alternate,i!==null&&(i.memoizedState=s),s}function dv(i){var s=hv(i);s.next===null&&(s=i.alternate.memoizedState),cl(i,s.next.queue,{},rs())}function Ph(){return bi(Tl)}function fv(){return Kt().memoizedState}function pv(){return Kt().memoizedState}function j1(i){for(var s=i.return;s!==null;){switch(s.tag){case 24:case 3:var r=rs();i=Nn(r);var l=Bn(s,i,r);l!==null&&(Wi(l,s,r),nl(l,s,r)),s={cache:mh()},i.payload=s;return}s=s.return}}function H1(i,s,r){var l=rs();r={lane:l,revertLane:0,gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null},nc(i)?_v(s,r):(r=nh(i,s,r,l),r!==null&&(Wi(r,i,l),vv(r,s,l)))}function mv(i,s,r){var l=rs();cl(i,s,r,l)}function cl(i,s,r,l){var u={lane:l,revertLane:0,gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null};if(nc(i))_v(s,u);else{var h=i.alternate;if(i.lanes===0&&(h===null||h.lanes===0)&&(h=s.lastRenderedReducer,h!==null))try{var v=s.lastRenderedState,w=h(v,r);if(u.hasEagerState=!0,u.eagerState=w,Ji(w,v))return Ho(i,s,u,0),_t===null&&jo(),!1}catch{}if(r=nh(i,s,u,l),r!==null)return Wi(r,i,l),vv(r,s,l),!0}return!1}function Kh(i,s,r,l){if(l={lane:2,revertLane:yd(),gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null},nc(i)){if(s)throw Error(a(479))}else s=nh(i,r,l,2),s!==null&&Wi(s,i,2)}function nc(i){var s=i.alternate;return i===Ie||s!==null&&s===Ie}function _v(i,s){ca=Zo=!0;var r=i.pending;r===null?s.next=s:(s.next=r.next,r.next=s),i.pending=s}function vv(i,s,r){if((r&4194048)!==0){var l=s.lanes;l&=i.pendingLanes,r|=l,s.lanes=r,ct(i,r)}}var ul={readContext:bi,use:ec,useCallback:Ot,useContext:Ot,useEffect:Ot,useImperativeHandle:Ot,useLayoutEffect:Ot,useInsertionEffect:Ot,useMemo:Ot,useReducer:Ot,useRef:Ot,useState:Ot,useDebugValue:Ot,useDeferredValue:Ot,useTransition:Ot,useSyncExternalStore:Ot,useId:Ot,useHostTransitionStatus:Ot,useFormState:Ot,useActionState:Ot,useOptimistic:Ot,useMemoCache:Ot,useCacheRefresh:Ot};ul.useEffectEvent=Ot;var gv={readContext:bi,use:ec,useCallback:function(i,s){return Bi().memoizedState=[i,s===void 0?null:s],i},useContext:bi,useEffect:tv,useImperativeHandle:function(i,s,r){r=r!=null?r.concat([i]):null,ic(4194308,4,rv.bind(null,s,i),r)},useLayoutEffect:function(i,s){return ic(4194308,4,i,s)},useInsertionEffect:function(i,s){ic(4,2,i,s)},useMemo:function(i,s){var r=Bi();s=s===void 0?null:s;var l=i();if(xr){Jt(!0);try{i()}finally{Jt(!1)}}return r.memoizedState=[l,s],l},useReducer:function(i,s,r){var l=Bi();if(r!==void 0){var u=r(s);if(xr){Jt(!0);try{r(s)}finally{Jt(!1)}}}else u=s;return l.memoizedState=l.baseState=u,i={pending:null,lanes:0,dispatch:null,lastRenderedReducer:i,lastRenderedState:u},l.queue=i,i=i.dispatch=H1.bind(null,Ie,i),[l.memoizedState,i]},useRef:function(i){var s=Bi();return i={current:i},s.memoizedState=i},useState:function(i){i=Lh(i);var s=i.queue,r=mv.bind(null,Ie,s);return s.dispatch=r,[i.memoizedState,r]},useDebugValue:jh,useDeferredValue:function(i,s){var r=Bi();return Hh(r,i,s)},useTransition:function(){var i=Lh(!1);return i=uv.bind(null,Ie,i.queue,!0,!1),Bi().memoizedState=i,[!1,i]},useSyncExternalStore:function(i,s,r){var l=Ie,u=Bi();if(Je){if(r===void 0)throw Error(a(407));r=r()}else{if(r=s(),_t===null)throw Error(a(349));(Ze&127)!==0||U_(l,s,r)}u.memoizedState=r;var h={value:r,getSnapshot:s};return u.queue=h,tv(K_.bind(null,l,h,i),[i]),l.flags|=2048,ha(9,{destroy:void 0},P_.bind(null,l,h,r,s),null),r},useId:function(){var i=Bi(),s=_t.identifierPrefix;if(Je){var r=Hs,l=js;r=(l&~(1<<32-Dt(l)-1)).toString(32)+r,s="_"+s+"R_"+r,r=Qo++,0<r&&(s+="H"+r.toString(32)),s+="_"}else r=A1++,s="_"+s+"r_"+r.toString(32)+"_";return i.memoizedState=s},useHostTransitionStatus:Ph,useFormState:G_,useActionState:G_,useOptimistic:function(i){var s=Bi();s.memoizedState=s.baseState=i;var r={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return s.queue=r,s=Kh.bind(null,Ie,!0,r),r.dispatch=s,[i,s]},useMemoCache:Ah,useCacheRefresh:function(){return Bi().memoizedState=j1.bind(null,Ie)},useEffectEvent:function(i){var s=Bi(),r={impl:i};return s.memoizedState=r,function(){if((st&2)!==0)throw Error(a(440));return r.impl.apply(void 0,arguments)}}},Ih={readContext:bi,use:ec,useCallback:lv,useContext:bi,useEffect:zh,useImperativeHandle:av,useInsertionEffect:sv,useLayoutEffect:nv,useMemo:ov,useReducer:tc,useRef:ev,useState:function(){return tc(nn)},useDebugValue:jh,useDeferredValue:function(i,s){var r=Kt();return cv(r,ht.memoizedState,i,s)},useTransition:function(){var i=tc(nn)[0],s=Kt().memoizedState;return[typeof i=="boolean"?i:ol(i),s]},useSyncExternalStore:H_,useId:fv,useHostTransitionStatus:Ph,useFormState:Z_,useActionState:Z_,useOptimistic:function(i,s){var r=Kt();return q_(r,ht,i,s)},useMemoCache:Ah,useCacheRefresh:pv};Ih.useEffectEvent=iv;var yv={readContext:bi,use:ec,useCallback:lv,useContext:bi,useEffect:zh,useImperativeHandle:av,useInsertionEffect:sv,useLayoutEffect:nv,useMemo:ov,useReducer:Bh,useRef:ev,useState:function(){return Bh(nn)},useDebugValue:jh,useDeferredValue:function(i,s){var r=Kt();return ht===null?Hh(r,i,s):cv(r,ht.memoizedState,i,s)},useTransition:function(){var i=Bh(nn)[0],s=Kt().memoizedState;return[typeof i=="boolean"?i:ol(i),s]},useSyncExternalStore:H_,useId:fv,useHostTransitionStatus:Ph,useFormState:J_,useActionState:J_,useOptimistic:function(i,s){var r=Kt();return ht!==null?q_(r,ht,i,s):(r.baseState=i,[i,r.queue.dispatch])},useMemoCache:Ah,useCacheRefresh:pv};yv.useEffectEvent=iv;function Fh(i,s,r,l){s=i.memoizedState,r=r(l,s),r=r==null?s:y({},s,r),i.memoizedState=r,i.lanes===0&&(i.updateQueue.baseState=r)}var qh={enqueueSetState:function(i,s,r){i=i._reactInternals;var l=rs(),u=Nn(l);u.payload=s,r!=null&&(u.callback=r),s=Bn(i,u,l),s!==null&&(Wi(s,i,l),nl(s,i,l))},enqueueReplaceState:function(i,s,r){i=i._reactInternals;var l=rs(),u=Nn(l);u.tag=1,u.payload=s,r!=null&&(u.callback=r),s=Bn(i,u,l),s!==null&&(Wi(s,i,l),nl(s,i,l))},enqueueForceUpdate:function(i,s){i=i._reactInternals;var r=rs(),l=Nn(r);l.tag=2,s!=null&&(l.callback=s),s=Bn(i,l,r),s!==null&&(Wi(s,i,r),nl(s,i,r))}};function Sv(i,s,r,l,u,h,v){return i=i.stateNode,typeof i.shouldComponentUpdate=="function"?i.shouldComponentUpdate(l,h,v):s.prototype&&s.prototype.isPureReactComponent?!Ga(r,l)||!Ga(u,h):!0}function bv(i,s,r,l){i=s.state,typeof s.componentWillReceiveProps=="function"&&s.componentWillReceiveProps(r,l),typeof s.UNSAFE_componentWillReceiveProps=="function"&&s.UNSAFE_componentWillReceiveProps(r,l),s.state!==i&&qh.enqueueReplaceState(s,s.state,null)}function Er(i,s){var r=s;if("ref"in s){r={};for(var l in s)l!=="ref"&&(r[l]=s[l])}if(i=i.defaultProps){r===s&&(r=y({},r));for(var u in i)r[u]===void 0&&(r[u]=i[u])}return r}function wv(i){zo(i)}function Cv(i){console.error(i)}function xv(i){zo(i)}function rc(i,s){try{var r=i.onUncaughtError;r(s.value,{componentStack:s.stack})}catch(l){setTimeout(function(){throw l})}}function Ev(i,s,r){try{var l=i.onCaughtError;l(r.value,{componentStack:r.stack,errorBoundary:s.tag===1?s.stateNode:null})}catch(u){setTimeout(function(){throw u})}}function Wh(i,s,r){return r=Nn(r),r.tag=3,r.payload={element:null},r.callback=function(){rc(i,s)},r}function Tv(i){return i=Nn(i),i.tag=3,i}function kv(i,s,r,l){var u=r.type.getDerivedStateFromError;if(typeof u=="function"){var h=l.value;i.payload=function(){return u(h)},i.callback=function(){Ev(s,r,l)}}var v=r.stateNode;v!==null&&typeof v.componentDidCatch=="function"&&(i.callback=function(){Ev(s,r,l),typeof u!="function"&&(Un===null?Un=new Set([this]):Un.add(this));var w=l.stack;this.componentDidCatch(l.value,{componentStack:w!==null?w:""})})}function U1(i,s,r,l,u){if(r.flags|=32768,l!==null&&typeof l=="object"&&typeof l.then=="function"){if(s=r.alternate,s!==null&&sa(s,r,u,!0),r=ts.current,r!==null){switch(r.tag){case 31:case 13:return _s===null?vc():r.alternate===null&&zt===0&&(zt=3),r.flags&=-257,r.flags|=65536,r.lanes=u,l===Yo?r.flags|=16384:(s=r.updateQueue,s===null?r.updateQueue=new Set([l]):s.add(l),_d(i,l,u)),!1;case 22:return r.flags|=65536,l===Yo?r.flags|=16384:(s=r.updateQueue,s===null?(s={transitions:null,markerInstances:null,retryQueue:new Set([l])},r.updateQueue=s):(r=s.retryQueue,r===null?s.retryQueue=new Set([l]):r.add(l)),_d(i,l,u)),!1}throw Error(a(435,r.tag))}return _d(i,l,u),vc(),!1}if(Je)return s=ts.current,s!==null?((s.flags&65536)===0&&(s.flags|=256),s.flags|=65536,s.lanes=u,l!==uh&&(i=Error(a(422),{cause:l}),Ja(ds(i,r)))):(l!==uh&&(s=Error(a(423),{cause:l}),Ja(ds(s,r))),i=i.current.alternate,i.flags|=65536,u&=-u,i.lanes|=u,l=ds(l,r),u=Wh(i.stateNode,l,u),bh(i,u),zt!==4&&(zt=2)),!1;var h=Error(a(520),{cause:l});if(h=ds(h,r),gl===null?gl=[h]:gl.push(h),zt!==4&&(zt=2),s===null)return!0;l=ds(l,r),r=s;do{switch(r.tag){case 3:return r.flags|=65536,i=u&-u,r.lanes|=i,i=Wh(r.stateNode,l,i),bh(r,i),!1;case 1:if(s=r.type,h=r.stateNode,(r.flags&128)===0&&(typeof s.getDerivedStateFromError=="function"||h!==null&&typeof h.componentDidCatch=="function"&&(Un===null||!Un.has(h))))return r.flags|=65536,u&=-u,r.lanes|=u,u=Tv(u),kv(u,i,r,l),bh(r,u),!1}r=r.return}while(r!==null);return!1}var Yh=Error(a(461)),Xt=!1;function wi(i,s,r,l){s.child=i===null?A_(s,null,r,l):Cr(s,i.child,r,l)}function Dv(i,s,r,l,u){r=r.render;var h=s.ref;if("ref"in l){var v={};for(var w in l)w!=="ref"&&(v[w]=l[w])}else v=l;return yr(s),l=kh(i,s,r,v,h,u),w=Dh(),i!==null&&!Xt?(Rh(i,s,u),rn(i,s,u)):(Je&&w&&oh(s),s.flags|=1,wi(i,s,l,u),s.child)}function Rv(i,s,r,l,u){if(i===null){var h=r.type;return typeof h=="function"&&!rh(h)&&h.defaultProps===void 0&&r.compare===null?(s.tag=15,s.type=h,Mv(i,s,h,l,u)):(i=Po(r.type,null,l,s,s.mode,u),i.ref=s.ref,i.return=s,s.child=i)}if(h=i.child,!ed(i,u)){var v=h.memoizedProps;if(r=r.compare,r=r!==null?r:Ga,r(v,l)&&i.ref===s.ref)return rn(i,s,u)}return s.flags|=1,i=Qs(h,l),i.ref=s.ref,i.return=s,s.child=i}function Mv(i,s,r,l,u){if(i!==null){var h=i.memoizedProps;if(Ga(h,l)&&i.ref===s.ref)if(Xt=!1,s.pendingProps=l=h,ed(i,u))(i.flags&131072)!==0&&(Xt=!0);else return s.lanes=i.lanes,rn(i,s,u)}return $h(i,s,r,l,u)}function Av(i,s,r,l){var u=l.children,h=i!==null?i.memoizedState:null;if(i===null&&s.stateNode===null&&(s.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),l.mode==="hidden"){if((s.flags&128)!==0){if(h=h!==null?h.baseLanes|r:r,i!==null){for(l=s.child=i.child,u=0;l!==null;)u=u|l.lanes|l.childLanes,l=l.sibling;l=u&~h}else l=0,s.child=null;return Nv(i,s,h,r,l)}if((r&536870912)!==0)s.memoizedState={baseLanes:0,cachePool:null},i!==null&&qo(s,h!==null?h.cachePool:null),h!==null?L_(s,h):Ch(),O_(s);else return l=s.lanes=536870912,Nv(i,s,h!==null?h.baseLanes|r:r,r,l)}else h!==null?(qo(s,h.cachePool),L_(s,h),On(),s.memoizedState=null):(i!==null&&qo(s,null),Ch(),On());return wi(i,s,u,r),s.child}function hl(i,s){return i!==null&&i.tag===22||s.stateNode!==null||(s.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),s.sibling}function Nv(i,s,r,l,u){var h=vh();return h=h===null?null:{parent:$t._currentValue,pool:h},s.memoizedState={baseLanes:r,cachePool:h},i!==null&&qo(s,null),Ch(),O_(s),i!==null&&sa(i,s,l,!0),s.childLanes=u,null}function ac(i,s){return s=oc({mode:s.mode,children:s.children},i.mode),s.ref=i.ref,i.child=s,s.return=i,s}function Bv(i,s,r){return Cr(s,i.child,null,r),i=ac(s,s.pendingProps),i.flags|=2,is(s),s.memoizedState=null,i}function P1(i,s,r){var l=s.pendingProps,u=(s.flags&128)!==0;if(s.flags&=-129,i===null){if(Je){if(l.mode==="hidden")return i=ac(s,l),s.lanes=536870912,hl(null,i);if(Eh(s),(i=wt)?(i=Wg(i,ms),i=i!==null&&i.data==="&"?i:null,i!==null&&(s.memoizedState={dehydrated:i,treeContext:kn!==null?{id:js,overflow:Hs}:null,retryLane:536870912,hydrationErrors:null},r=__(i),r.return=s,s.child=r,Si=s,wt=null)):i=null,i===null)throw Rn(s);return s.lanes=536870912,null}return ac(s,l)}var h=i.memoizedState;if(h!==null){var v=h.dehydrated;if(Eh(s),u)if(s.flags&256)s.flags&=-257,s=Bv(i,s,r);else if(s.memoizedState!==null)s.child=i.child,s.flags|=128,s=null;else throw Error(a(558));else if(Xt||sa(i,s,r,!1),u=(r&i.childLanes)!==0,Xt||u){if(l=_t,l!==null&&(v=vi(l,r),v!==0&&v!==h.retryLane))throw h.retryLane=v,mr(i,v),Wi(l,i,v),Yh;vc(),s=Bv(i,s,r)}else i=h.treeContext,wt=vs(v.nextSibling),Si=s,Je=!0,Dn=null,ms=!1,i!==null&&y_(s,i),s=ac(s,l),s.flags|=4096;return s}return i=Qs(i.child,{mode:l.mode,children:l.children}),i.ref=s.ref,s.child=i,i.return=s,i}function lc(i,s){var r=s.ref;if(r===null)i!==null&&i.ref!==null&&(s.flags|=4194816);else{if(typeof r!="function"&&typeof r!="object")throw Error(a(284));(i===null||i.ref!==r)&&(s.flags|=4194816)}}function $h(i,s,r,l,u){return yr(s),r=kh(i,s,r,l,void 0,u),l=Dh(),i!==null&&!Xt?(Rh(i,s,u),rn(i,s,u)):(Je&&l&&oh(s),s.flags|=1,wi(i,s,r,u),s.child)}function Lv(i,s,r,l,u,h){return yr(s),s.updateQueue=null,r=j_(s,l,r,u),z_(i),l=Dh(),i!==null&&!Xt?(Rh(i,s,h),rn(i,s,h)):(Je&&l&&oh(s),s.flags|=1,wi(i,s,r,h),s.child)}function Ov(i,s,r,l,u){if(yr(s),s.stateNode===null){var h=Jr,v=r.contextType;typeof v=="object"&&v!==null&&(h=bi(v)),h=new r(l,h),s.memoizedState=h.state!==null&&h.state!==void 0?h.state:null,h.updater=qh,s.stateNode=h,h._reactInternals=s,h=s.stateNode,h.props=l,h.state=s.memoizedState,h.refs={},yh(s),v=r.contextType,h.context=typeof v=="object"&&v!==null?bi(v):Jr,h.state=s.memoizedState,v=r.getDerivedStateFromProps,typeof v=="function"&&(Fh(s,r,v,l),h.state=s.memoizedState),typeof r.getDerivedStateFromProps=="function"||typeof h.getSnapshotBeforeUpdate=="function"||typeof h.UNSAFE_componentWillMount!="function"&&typeof h.componentWillMount!="function"||(v=h.state,typeof h.componentWillMount=="function"&&h.componentWillMount(),typeof h.UNSAFE_componentWillMount=="function"&&h.UNSAFE_componentWillMount(),v!==h.state&&qh.enqueueReplaceState(h,h.state,null),al(s,l,h,u),rl(),h.state=s.memoizedState),typeof h.componentDidMount=="function"&&(s.flags|=4194308),l=!0}else if(i===null){h=s.stateNode;var w=s.memoizedProps,D=Er(r,w);h.props=D;var P=h.context,se=r.contextType;v=Jr,typeof se=="object"&&se!==null&&(v=bi(se));var le=r.getDerivedStateFromProps;se=typeof le=="function"||typeof h.getSnapshotBeforeUpdate=="function",w=s.pendingProps!==w,se||typeof h.UNSAFE_componentWillReceiveProps!="function"&&typeof h.componentWillReceiveProps!="function"||(w||P!==v)&&bv(s,h,l,v),An=!1;var Y=s.memoizedState;h.state=Y,al(s,l,h,u),rl(),P=s.memoizedState,w||Y!==P||An?(typeof le=="function"&&(Fh(s,r,le,l),P=s.memoizedState),(D=An||Sv(s,r,D,l,Y,P,v))?(se||typeof h.UNSAFE_componentWillMount!="function"&&typeof h.componentWillMount!="function"||(typeof h.componentWillMount=="function"&&h.componentWillMount(),typeof h.UNSAFE_componentWillMount=="function"&&h.UNSAFE_componentWillMount()),typeof h.componentDidMount=="function"&&(s.flags|=4194308)):(typeof h.componentDidMount=="function"&&(s.flags|=4194308),s.memoizedProps=l,s.memoizedState=P),h.props=l,h.state=P,h.context=v,l=D):(typeof h.componentDidMount=="function"&&(s.flags|=4194308),l=!1)}else{h=s.stateNode,Sh(i,s),v=s.memoizedProps,se=Er(r,v),h.props=se,le=s.pendingProps,Y=h.context,P=r.contextType,D=Jr,typeof P=="object"&&P!==null&&(D=bi(P)),w=r.getDerivedStateFromProps,(P=typeof w=="function"||typeof h.getSnapshotBeforeUpdate=="function")||typeof h.UNSAFE_componentWillReceiveProps!="function"&&typeof h.componentWillReceiveProps!="function"||(v!==le||Y!==D)&&bv(s,h,l,D),An=!1,Y=s.memoizedState,h.state=Y,al(s,l,h,u),rl();var Z=s.memoizedState;v!==le||Y!==Z||An||i!==null&&i.dependencies!==null&&Io(i.dependencies)?(typeof w=="function"&&(Fh(s,r,w,l),Z=s.memoizedState),(se=An||Sv(s,r,se,l,Y,Z,D)||i!==null&&i.dependencies!==null&&Io(i.dependencies))?(P||typeof h.UNSAFE_componentWillUpdate!="function"&&typeof h.componentWillUpdate!="function"||(typeof h.componentWillUpdate=="function"&&h.componentWillUpdate(l,Z,D),typeof h.UNSAFE_componentWillUpdate=="function"&&h.UNSAFE_componentWillUpdate(l,Z,D)),typeof h.componentDidUpdate=="function"&&(s.flags|=4),typeof h.getSnapshotBeforeUpdate=="function"&&(s.flags|=1024)):(typeof h.componentDidUpdate!="function"||v===i.memoizedProps&&Y===i.memoizedState||(s.flags|=4),typeof h.getSnapshotBeforeUpdate!="function"||v===i.memoizedProps&&Y===i.memoizedState||(s.flags|=1024),s.memoizedProps=l,s.memoizedState=Z),h.props=l,h.state=Z,h.context=D,l=se):(typeof h.componentDidUpdate!="function"||v===i.memoizedProps&&Y===i.memoizedState||(s.flags|=4),typeof h.getSnapshotBeforeUpdate!="function"||v===i.memoizedProps&&Y===i.memoizedState||(s.flags|=1024),l=!1)}return h=l,lc(i,s),l=(s.flags&128)!==0,h||l?(h=s.stateNode,r=l&&typeof r.getDerivedStateFromError!="function"?null:h.render(),s.flags|=1,i!==null&&l?(s.child=Cr(s,i.child,null,u),s.child=Cr(s,null,r,u)):wi(i,s,r,u),s.memoizedState=h.state,i=s.child):i=rn(i,s,u),i}function zv(i,s,r,l){return vr(),s.flags|=256,wi(i,s,r,l),s.child}var Vh={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Xh(i){return{baseLanes:i,cachePool:E_()}}function Gh(i,s,r){return i=i!==null?i.childLanes&~r:0,s&&(i|=ns),i}function jv(i,s,r){var l=s.pendingProps,u=!1,h=(s.flags&128)!==0,v;if((v=h)||(v=i!==null&&i.memoizedState===null?!1:(Pt.current&2)!==0),v&&(u=!0,s.flags&=-129),v=(s.flags&32)!==0,s.flags&=-33,i===null){if(Je){if(u?Ln(s):On(),(i=wt)?(i=Wg(i,ms),i=i!==null&&i.data!=="&"?i:null,i!==null&&(s.memoizedState={dehydrated:i,treeContext:kn!==null?{id:js,overflow:Hs}:null,retryLane:536870912,hydrationErrors:null},r=__(i),r.return=s,s.child=r,Si=s,wt=null)):i=null,i===null)throw Rn(s);return Nd(i)?s.lanes=32:s.lanes=536870912,null}var w=l.children;return l=l.fallback,u?(On(),u=s.mode,w=oc({mode:"hidden",children:w},u),l=_r(l,u,r,null),w.return=s,l.return=s,w.sibling=l,s.child=w,l=s.child,l.memoizedState=Xh(r),l.childLanes=Gh(i,v,r),s.memoizedState=Vh,hl(null,l)):(Ln(s),Zh(s,w))}var D=i.memoizedState;if(D!==null&&(w=D.dehydrated,w!==null)){if(h)s.flags&256?(Ln(s),s.flags&=-257,s=Qh(i,s,r)):s.memoizedState!==null?(On(),s.child=i.child,s.flags|=128,s=null):(On(),w=l.fallback,u=s.mode,l=oc({mode:"visible",children:l.children},u),w=_r(w,u,r,null),w.flags|=2,l.return=s,w.return=s,l.sibling=w,s.child=l,Cr(s,i.child,null,r),l=s.child,l.memoizedState=Xh(r),l.childLanes=Gh(i,v,r),s.memoizedState=Vh,s=hl(null,l));else if(Ln(s),Nd(w)){if(v=w.nextSibling&&w.nextSibling.dataset,v)var P=v.dgst;v=P,l=Error(a(419)),l.stack="",l.digest=v,Ja({value:l,source:null,stack:null}),s=Qh(i,s,r)}else if(Xt||sa(i,s,r,!1),v=(r&i.childLanes)!==0,Xt||v){if(v=_t,v!==null&&(l=vi(v,r),l!==0&&l!==D.retryLane))throw D.retryLane=l,mr(i,l),Wi(v,i,l),Yh;Ad(w)||vc(),s=Qh(i,s,r)}else Ad(w)?(s.flags|=192,s.child=i.child,s=null):(i=D.treeContext,wt=vs(w.nextSibling),Si=s,Je=!0,Dn=null,ms=!1,i!==null&&y_(s,i),s=Zh(s,l.children),s.flags|=4096);return s}return u?(On(),w=l.fallback,u=s.mode,D=i.child,P=D.sibling,l=Qs(D,{mode:"hidden",children:l.children}),l.subtreeFlags=D.subtreeFlags&65011712,P!==null?w=Qs(P,w):(w=_r(w,u,r,null),w.flags|=2),w.return=s,l.return=s,l.sibling=w,s.child=l,hl(null,l),l=s.child,w=i.child.memoizedState,w===null?w=Xh(r):(u=w.cachePool,u!==null?(D=$t._currentValue,u=u.parent!==D?{parent:D,pool:D}:u):u=E_(),w={baseLanes:w.baseLanes|r,cachePool:u}),l.memoizedState=w,l.childLanes=Gh(i,v,r),s.memoizedState=Vh,hl(i.child,l)):(Ln(s),r=i.child,i=r.sibling,r=Qs(r,{mode:"visible",children:l.children}),r.return=s,r.sibling=null,i!==null&&(v=s.deletions,v===null?(s.deletions=[i],s.flags|=16):v.push(i)),s.child=r,s.memoizedState=null,r)}function Zh(i,s){return s=oc({mode:"visible",children:s},i.mode),s.return=i,i.child=s}function oc(i,s){return i=es(22,i,null,s),i.lanes=0,i}function Qh(i,s,r){return Cr(s,i.child,null,r),i=Zh(s,s.pendingProps.children),i.flags|=2,s.memoizedState=null,i}function Hv(i,s,r){i.lanes|=s;var l=i.alternate;l!==null&&(l.lanes|=s),fh(i.return,s,r)}function Jh(i,s,r,l,u,h){var v=i.memoizedState;v===null?i.memoizedState={isBackwards:s,rendering:null,renderingStartTime:0,last:l,tail:r,tailMode:u,treeForkCount:h}:(v.isBackwards=s,v.rendering=null,v.renderingStartTime=0,v.last=l,v.tail=r,v.tailMode=u,v.treeForkCount=h)}function Uv(i,s,r){var l=s.pendingProps,u=l.revealOrder,h=l.tail;l=l.children;var v=Pt.current,w=(v&2)!==0;if(w?(v=v&1|2,s.flags|=128):v&=1,ee(Pt,v),wi(i,s,l,r),l=Je?Qa:0,!w&&i!==null&&(i.flags&128)!==0)e:for(i=s.child;i!==null;){if(i.tag===13)i.memoizedState!==null&&Hv(i,r,s);else if(i.tag===19)Hv(i,r,s);else if(i.child!==null){i.child.return=i,i=i.child;continue}if(i===s)break e;for(;i.sibling===null;){if(i.return===null||i.return===s)break e;i=i.return}i.sibling.return=i.return,i=i.sibling}switch(u){case"forwards":for(r=s.child,u=null;r!==null;)i=r.alternate,i!==null&&Go(i)===null&&(u=r),r=r.sibling;r=u,r===null?(u=s.child,s.child=null):(u=r.sibling,r.sibling=null),Jh(s,!1,u,r,h,l);break;case"backwards":case"unstable_legacy-backwards":for(r=null,u=s.child,s.child=null;u!==null;){if(i=u.alternate,i!==null&&Go(i)===null){s.child=u;break}i=u.sibling,u.sibling=r,r=u,u=i}Jh(s,!0,r,null,h,l);break;case"together":Jh(s,!1,null,null,void 0,l);break;default:s.memoizedState=null}return s.child}function rn(i,s,r){if(i!==null&&(s.dependencies=i.dependencies),Hn|=s.lanes,(r&s.childLanes)===0)if(i!==null){if(sa(i,s,r,!1),(r&s.childLanes)===0)return null}else return null;if(i!==null&&s.child!==i.child)throw Error(a(153));if(s.child!==null){for(i=s.child,r=Qs(i,i.pendingProps),s.child=r,r.return=s;i.sibling!==null;)i=i.sibling,r=r.sibling=Qs(i,i.pendingProps),r.return=s;r.sibling=null}return s.child}function ed(i,s){return(i.lanes&s)!==0?!0:(i=i.dependencies,!!(i!==null&&Io(i)))}function K1(i,s,r){switch(s.tag){case 3:ze(s,s.stateNode.containerInfo),Mn(s,$t,i.memoizedState.cache),vr();break;case 27:case 5:Re(s);break;case 4:ze(s,s.stateNode.containerInfo);break;case 10:Mn(s,s.type,s.memoizedProps.value);break;case 31:if(s.memoizedState!==null)return s.flags|=128,Eh(s),null;break;case 13:var l=s.memoizedState;if(l!==null)return l.dehydrated!==null?(Ln(s),s.flags|=128,null):(r&s.child.childLanes)!==0?jv(i,s,r):(Ln(s),i=rn(i,s,r),i!==null?i.sibling:null);Ln(s);break;case 19:var u=(i.flags&128)!==0;if(l=(r&s.childLanes)!==0,l||(sa(i,s,r,!1),l=(r&s.childLanes)!==0),u){if(l)return Uv(i,s,r);s.flags|=128}if(u=s.memoizedState,u!==null&&(u.rendering=null,u.tail=null,u.lastEffect=null),ee(Pt,Pt.current),l)break;return null;case 22:return s.lanes=0,Av(i,s,r,s.pendingProps);case 24:Mn(s,$t,i.memoizedState.cache)}return rn(i,s,r)}function Pv(i,s,r){if(i!==null)if(i.memoizedProps!==s.pendingProps)Xt=!0;else{if(!ed(i,r)&&(s.flags&128)===0)return Xt=!1,K1(i,s,r);Xt=(i.flags&131072)!==0}else Xt=!1,Je&&(s.flags&1048576)!==0&&g_(s,Qa,s.index);switch(s.lanes=0,s.tag){case 16:e:{var l=s.pendingProps;if(i=br(s.elementType),s.type=i,typeof i=="function")rh(i)?(l=Er(i,l),s.tag=1,s=Ov(null,s,i,l,r)):(s.tag=0,s=$h(null,s,i,l,r));else{if(i!=null){var u=i.$$typeof;if(u===J){s.tag=11,s=Dv(null,s,i,l,r);break e}else if(u===I){s.tag=14,s=Rv(null,s,i,l,r);break e}}throw s=X(i)||i,Error(a(306,s,""))}}return s;case 0:return $h(i,s,s.type,s.pendingProps,r);case 1:return l=s.type,u=Er(l,s.pendingProps),Ov(i,s,l,u,r);case 3:e:{if(ze(s,s.stateNode.containerInfo),i===null)throw Error(a(387));l=s.pendingProps;var h=s.memoizedState;u=h.element,Sh(i,s),al(s,l,null,r);var v=s.memoizedState;if(l=v.cache,Mn(s,$t,l),l!==h.cache&&ph(s,[$t],r,!0),rl(),l=v.element,h.isDehydrated)if(h={element:l,isDehydrated:!1,cache:v.cache},s.updateQueue.baseState=h,s.memoizedState=h,s.flags&256){s=zv(i,s,l,r);break e}else if(l!==u){u=ds(Error(a(424)),s),Ja(u),s=zv(i,s,l,r);break e}else for(i=s.stateNode.containerInfo,i.nodeType===9?i=i.body:i=i.nodeName==="HTML"?i.ownerDocument.body:i,wt=vs(i.firstChild),Si=s,Je=!0,Dn=null,ms=!0,r=A_(s,null,l,r),s.child=r;r;)r.flags=r.flags&-3|4096,r=r.sibling;else{if(vr(),l===u){s=rn(i,s,r);break e}wi(i,s,l,r)}s=s.child}return s;case 26:return lc(i,s),i===null?(r=Zg(s.type,null,s.pendingProps,null))?s.memoizedState=r:Je||(r=s.type,i=s.pendingProps,l=xc(me.current).createElement(r),l[mt]=s,l[Yt]=i,Ci(l,r,i),Lt(l),s.stateNode=l):s.memoizedState=Zg(s.type,i.memoizedProps,s.pendingProps,i.memoizedState),null;case 27:return Re(s),i===null&&Je&&(l=s.stateNode=Vg(s.type,s.pendingProps,me.current),Si=s,ms=!0,u=wt,Fn(s.type)?(Bd=u,wt=vs(l.firstChild)):wt=u),wi(i,s,s.pendingProps.children,r),lc(i,s),i===null&&(s.flags|=4194304),s.child;case 5:return i===null&&Je&&((u=l=wt)&&(l=vC(l,s.type,s.pendingProps,ms),l!==null?(s.stateNode=l,Si=s,wt=vs(l.firstChild),ms=!1,u=!0):u=!1),u||Rn(s)),Re(s),u=s.type,h=s.pendingProps,v=i!==null?i.memoizedProps:null,l=h.children,Dd(u,h)?l=null:v!==null&&Dd(u,v)&&(s.flags|=32),s.memoizedState!==null&&(u=kh(i,s,N1,null,null,r),Tl._currentValue=u),lc(i,s),wi(i,s,l,r),s.child;case 6:return i===null&&Je&&((i=r=wt)&&(r=gC(r,s.pendingProps,ms),r!==null?(s.stateNode=r,Si=s,wt=null,i=!0):i=!1),i||Rn(s)),null;case 13:return jv(i,s,r);case 4:return ze(s,s.stateNode.containerInfo),l=s.pendingProps,i===null?s.child=Cr(s,null,l,r):wi(i,s,l,r),s.child;case 11:return Dv(i,s,s.type,s.pendingProps,r);case 7:return wi(i,s,s.pendingProps,r),s.child;case 8:return wi(i,s,s.pendingProps.children,r),s.child;case 12:return wi(i,s,s.pendingProps.children,r),s.child;case 10:return l=s.pendingProps,Mn(s,s.type,l.value),wi(i,s,l.children,r),s.child;case 9:return u=s.type._context,l=s.pendingProps.children,yr(s),u=bi(u),l=l(u),s.flags|=1,wi(i,s,l,r),s.child;case 14:return Rv(i,s,s.type,s.pendingProps,r);case 15:return Mv(i,s,s.type,s.pendingProps,r);case 19:return Uv(i,s,r);case 31:return P1(i,s,r);case 22:return Av(i,s,r,s.pendingProps);case 24:return yr(s),l=bi($t),i===null?(u=vh(),u===null&&(u=_t,h=mh(),u.pooledCache=h,h.refCount++,h!==null&&(u.pooledCacheLanes|=r),u=h),s.memoizedState={parent:l,cache:u},yh(s),Mn(s,$t,u)):((i.lanes&r)!==0&&(Sh(i,s),al(s,null,null,r),rl()),u=i.memoizedState,h=s.memoizedState,u.parent!==l?(u={parent:l,cache:l},s.memoizedState=u,s.lanes===0&&(s.memoizedState=s.updateQueue.baseState=u),Mn(s,$t,l)):(l=h.cache,Mn(s,$t,l),l!==u.cache&&ph(s,[$t],r,!0))),wi(i,s,s.pendingProps.children,r),s.child;case 29:throw s.pendingProps}throw Error(a(156,s.tag))}function an(i){i.flags|=4}function td(i,s,r,l,u){if((s=(i.mode&32)!==0)&&(s=!1),s){if(i.flags|=16777216,(u&335544128)===u)if(i.stateNode.complete)i.flags|=8192;else if(fg())i.flags|=8192;else throw wr=Yo,gh}else i.flags&=-16777217}function Kv(i,s){if(s.type!=="stylesheet"||(s.state.loading&4)!==0)i.flags&=-16777217;else if(i.flags|=16777216,!iy(s))if(fg())i.flags|=8192;else throw wr=Yo,gh}function cc(i,s){s!==null&&(i.flags|=4),i.flags&16384&&(s=i.tag!==22?Bt():536870912,i.lanes|=s,ma|=s)}function dl(i,s){if(!Je)switch(i.tailMode){case"hidden":s=i.tail;for(var r=null;s!==null;)s.alternate!==null&&(r=s),s=s.sibling;r===null?i.tail=null:r.sibling=null;break;case"collapsed":r=i.tail;for(var l=null;r!==null;)r.alternate!==null&&(l=r),r=r.sibling;l===null?s||i.tail===null?i.tail=null:i.tail.sibling=null:l.sibling=null}}function Ct(i){var s=i.alternate!==null&&i.alternate.child===i.child,r=0,l=0;if(s)for(var u=i.child;u!==null;)r|=u.lanes|u.childLanes,l|=u.subtreeFlags&65011712,l|=u.flags&65011712,u.return=i,u=u.sibling;else for(u=i.child;u!==null;)r|=u.lanes|u.childLanes,l|=u.subtreeFlags,l|=u.flags,u.return=i,u=u.sibling;return i.subtreeFlags|=l,i.childLanes=r,s}function I1(i,s,r){var l=s.pendingProps;switch(ch(s),s.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Ct(s),null;case 1:return Ct(s),null;case 3:return r=s.stateNode,l=null,i!==null&&(l=i.memoizedState.cache),s.memoizedState.cache!==l&&(s.flags|=2048),tn($t),Ne(),r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),(i===null||i.child===null)&&(ia(s)?an(s):i===null||i.memoizedState.isDehydrated&&(s.flags&256)===0||(s.flags|=1024,hh())),Ct(s),null;case 26:var u=s.type,h=s.memoizedState;return i===null?(an(s),h!==null?(Ct(s),Kv(s,h)):(Ct(s),td(s,u,null,l,r))):h?h!==i.memoizedState?(an(s),Ct(s),Kv(s,h)):(Ct(s),s.flags&=-16777217):(i=i.memoizedProps,i!==l&&an(s),Ct(s),td(s,u,i,l,r)),null;case 27:if(Pe(s),r=me.current,u=s.type,i!==null&&s.stateNode!=null)i.memoizedProps!==l&&an(s);else{if(!l){if(s.stateNode===null)throw Error(a(166));return Ct(s),null}i=he.current,ia(s)?S_(s):(i=Vg(u,l,r),s.stateNode=i,an(s))}return Ct(s),null;case 5:if(Pe(s),u=s.type,i!==null&&s.stateNode!=null)i.memoizedProps!==l&&an(s);else{if(!l){if(s.stateNode===null)throw Error(a(166));return Ct(s),null}if(h=he.current,ia(s))S_(s);else{var v=xc(me.current);switch(h){case 1:h=v.createElementNS("http://www.w3.org/2000/svg",u);break;case 2:h=v.createElementNS("http://www.w3.org/1998/Math/MathML",u);break;default:switch(u){case"svg":h=v.createElementNS("http://www.w3.org/2000/svg",u);break;case"math":h=v.createElementNS("http://www.w3.org/1998/Math/MathML",u);break;case"script":h=v.createElement("div"),h.innerHTML="<script><\/script>",h=h.removeChild(h.firstChild);break;case"select":h=typeof l.is=="string"?v.createElement("select",{is:l.is}):v.createElement("select"),l.multiple?h.multiple=!0:l.size&&(h.size=l.size);break;default:h=typeof l.is=="string"?v.createElement(u,{is:l.is}):v.createElement(u)}}h[mt]=s,h[Yt]=l;e:for(v=s.child;v!==null;){if(v.tag===5||v.tag===6)h.appendChild(v.stateNode);else if(v.tag!==4&&v.tag!==27&&v.child!==null){v.child.return=v,v=v.child;continue}if(v===s)break e;for(;v.sibling===null;){if(v.return===null||v.return===s)break e;v=v.return}v.sibling.return=v.return,v=v.sibling}s.stateNode=h;e:switch(Ci(h,u,l),u){case"button":case"input":case"select":case"textarea":l=!!l.autoFocus;break e;case"img":l=!0;break e;default:l=!1}l&&an(s)}}return Ct(s),td(s,s.type,i===null?null:i.memoizedProps,s.pendingProps,r),null;case 6:if(i&&s.stateNode!=null)i.memoizedProps!==l&&an(s);else{if(typeof l!="string"&&s.stateNode===null)throw Error(a(166));if(i=me.current,ia(s)){if(i=s.stateNode,r=s.memoizedProps,l=null,u=Si,u!==null)switch(u.tag){case 27:case 5:l=u.memoizedProps}i[mt]=s,i=!!(i.nodeValue===r||l!==null&&l.suppressHydrationWarning===!0||jg(i.nodeValue,r)),i||Rn(s,!0)}else i=xc(i).createTextNode(l),i[mt]=s,s.stateNode=i}return Ct(s),null;case 31:if(r=s.memoizedState,i===null||i.memoizedState!==null){if(l=ia(s),r!==null){if(i===null){if(!l)throw Error(a(318));if(i=s.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(a(557));i[mt]=s}else vr(),(s.flags&128)===0&&(s.memoizedState=null),s.flags|=4;Ct(s),i=!1}else r=hh(),i!==null&&i.memoizedState!==null&&(i.memoizedState.hydrationErrors=r),i=!0;if(!i)return s.flags&256?(is(s),s):(is(s),null);if((s.flags&128)!==0)throw Error(a(558))}return Ct(s),null;case 13:if(l=s.memoizedState,i===null||i.memoizedState!==null&&i.memoizedState.dehydrated!==null){if(u=ia(s),l!==null&&l.dehydrated!==null){if(i===null){if(!u)throw Error(a(318));if(u=s.memoizedState,u=u!==null?u.dehydrated:null,!u)throw Error(a(317));u[mt]=s}else vr(),(s.flags&128)===0&&(s.memoizedState=null),s.flags|=4;Ct(s),u=!1}else u=hh(),i!==null&&i.memoizedState!==null&&(i.memoizedState.hydrationErrors=u),u=!0;if(!u)return s.flags&256?(is(s),s):(is(s),null)}return is(s),(s.flags&128)!==0?(s.lanes=r,s):(r=l!==null,i=i!==null&&i.memoizedState!==null,r&&(l=s.child,u=null,l.alternate!==null&&l.alternate.memoizedState!==null&&l.alternate.memoizedState.cachePool!==null&&(u=l.alternate.memoizedState.cachePool.pool),h=null,l.memoizedState!==null&&l.memoizedState.cachePool!==null&&(h=l.memoizedState.cachePool.pool),h!==u&&(l.flags|=2048)),r!==i&&r&&(s.child.flags|=8192),cc(s,s.updateQueue),Ct(s),null);case 4:return Ne(),i===null&&Cd(s.stateNode.containerInfo),Ct(s),null;case 10:return tn(s.type),Ct(s),null;case 19:if(W(Pt),l=s.memoizedState,l===null)return Ct(s),null;if(u=(s.flags&128)!==0,h=l.rendering,h===null)if(u)dl(l,!1);else{if(zt!==0||i!==null&&(i.flags&128)!==0)for(i=s.child;i!==null;){if(h=Go(i),h!==null){for(s.flags|=128,dl(l,!1),i=h.updateQueue,s.updateQueue=i,cc(s,i),s.subtreeFlags=0,i=r,r=s.child;r!==null;)m_(r,i),r=r.sibling;return ee(Pt,Pt.current&1|2),Je&&Js(s,l.treeForkCount),s.child}i=i.sibling}l.tail!==null&&He()>pc&&(s.flags|=128,u=!0,dl(l,!1),s.lanes=4194304)}else{if(!u)if(i=Go(h),i!==null){if(s.flags|=128,u=!0,i=i.updateQueue,s.updateQueue=i,cc(s,i),dl(l,!0),l.tail===null&&l.tailMode==="hidden"&&!h.alternate&&!Je)return Ct(s),null}else 2*He()-l.renderingStartTime>pc&&r!==536870912&&(s.flags|=128,u=!0,dl(l,!1),s.lanes=4194304);l.isBackwards?(h.sibling=s.child,s.child=h):(i=l.last,i!==null?i.sibling=h:s.child=h,l.last=h)}return l.tail!==null?(i=l.tail,l.rendering=i,l.tail=i.sibling,l.renderingStartTime=He(),i.sibling=null,r=Pt.current,ee(Pt,u?r&1|2:r&1),Je&&Js(s,l.treeForkCount),i):(Ct(s),null);case 22:case 23:return is(s),xh(),l=s.memoizedState!==null,i!==null?i.memoizedState!==null!==l&&(s.flags|=8192):l&&(s.flags|=8192),l?(r&536870912)!==0&&(s.flags&128)===0&&(Ct(s),s.subtreeFlags&6&&(s.flags|=8192)):Ct(s),r=s.updateQueue,r!==null&&cc(s,r.retryQueue),r=null,i!==null&&i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(r=i.memoizedState.cachePool.pool),l=null,s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(l=s.memoizedState.cachePool.pool),l!==r&&(s.flags|=2048),i!==null&&W(Sr),null;case 24:return r=null,i!==null&&(r=i.memoizedState.cache),s.memoizedState.cache!==r&&(s.flags|=2048),tn($t),Ct(s),null;case 25:return null;case 30:return null}throw Error(a(156,s.tag))}function F1(i,s){switch(ch(s),s.tag){case 1:return i=s.flags,i&65536?(s.flags=i&-65537|128,s):null;case 3:return tn($t),Ne(),i=s.flags,(i&65536)!==0&&(i&128)===0?(s.flags=i&-65537|128,s):null;case 26:case 27:case 5:return Pe(s),null;case 31:if(s.memoizedState!==null){if(is(s),s.alternate===null)throw Error(a(340));vr()}return i=s.flags,i&65536?(s.flags=i&-65537|128,s):null;case 13:if(is(s),i=s.memoizedState,i!==null&&i.dehydrated!==null){if(s.alternate===null)throw Error(a(340));vr()}return i=s.flags,i&65536?(s.flags=i&-65537|128,s):null;case 19:return W(Pt),null;case 4:return Ne(),null;case 10:return tn(s.type),null;case 22:case 23:return is(s),xh(),i!==null&&W(Sr),i=s.flags,i&65536?(s.flags=i&-65537|128,s):null;case 24:return tn($t),null;case 25:return null;default:return null}}function Iv(i,s){switch(ch(s),s.tag){case 3:tn($t),Ne();break;case 26:case 27:case 5:Pe(s);break;case 4:Ne();break;case 31:s.memoizedState!==null&&is(s);break;case 13:is(s);break;case 19:W(Pt);break;case 10:tn(s.type);break;case 22:case 23:is(s),xh(),i!==null&&W(Sr);break;case 24:tn($t)}}function fl(i,s){try{var r=s.updateQueue,l=r!==null?r.lastEffect:null;if(l!==null){var u=l.next;r=u;do{if((r.tag&i)===i){l=void 0;var h=r.create,v=r.inst;l=h(),v.destroy=l}r=r.next}while(r!==u)}}catch(w){lt(s,s.return,w)}}function zn(i,s,r){try{var l=s.updateQueue,u=l!==null?l.lastEffect:null;if(u!==null){var h=u.next;l=h;do{if((l.tag&i)===i){var v=l.inst,w=v.destroy;if(w!==void 0){v.destroy=void 0,u=s;var D=r,P=w;try{P()}catch(se){lt(u,D,se)}}}l=l.next}while(l!==h)}}catch(se){lt(s,s.return,se)}}function Fv(i){var s=i.updateQueue;if(s!==null){var r=i.stateNode;try{B_(s,r)}catch(l){lt(i,i.return,l)}}}function qv(i,s,r){r.props=Er(i.type,i.memoizedProps),r.state=i.memoizedState;try{r.componentWillUnmount()}catch(l){lt(i,s,l)}}function pl(i,s){try{var r=i.ref;if(r!==null){switch(i.tag){case 26:case 27:case 5:var l=i.stateNode;break;case 30:l=i.stateNode;break;default:l=i.stateNode}typeof r=="function"?i.refCleanup=r(l):r.current=l}}catch(u){lt(i,s,u)}}function Us(i,s){var r=i.ref,l=i.refCleanup;if(r!==null)if(typeof l=="function")try{l()}catch(u){lt(i,s,u)}finally{i.refCleanup=null,i=i.alternate,i!=null&&(i.refCleanup=null)}else if(typeof r=="function")try{r(null)}catch(u){lt(i,s,u)}else r.current=null}function Wv(i){var s=i.type,r=i.memoizedProps,l=i.stateNode;try{e:switch(s){case"button":case"input":case"select":case"textarea":r.autoFocus&&l.focus();break e;case"img":r.src?l.src=r.src:r.srcSet&&(l.srcset=r.srcSet)}}catch(u){lt(i,i.return,u)}}function id(i,s,r){try{var l=i.stateNode;hC(l,i.type,r,s),l[Yt]=s}catch(u){lt(i,i.return,u)}}function Yv(i){return i.tag===5||i.tag===3||i.tag===26||i.tag===27&&Fn(i.type)||i.tag===4}function sd(i){e:for(;;){for(;i.sibling===null;){if(i.return===null||Yv(i.return))return null;i=i.return}for(i.sibling.return=i.return,i=i.sibling;i.tag!==5&&i.tag!==6&&i.tag!==18;){if(i.tag===27&&Fn(i.type)||i.flags&2||i.child===null||i.tag===4)continue e;i.child.return=i,i=i.child}if(!(i.flags&2))return i.stateNode}}function nd(i,s,r){var l=i.tag;if(l===5||l===6)i=i.stateNode,s?(r.nodeType===9?r.body:r.nodeName==="HTML"?r.ownerDocument.body:r).insertBefore(i,s):(s=r.nodeType===9?r.body:r.nodeName==="HTML"?r.ownerDocument.body:r,s.appendChild(i),r=r._reactRootContainer,r!=null||s.onclick!==null||(s.onclick=Gs));else if(l!==4&&(l===27&&Fn(i.type)&&(r=i.stateNode,s=null),i=i.child,i!==null))for(nd(i,s,r),i=i.sibling;i!==null;)nd(i,s,r),i=i.sibling}function uc(i,s,r){var l=i.tag;if(l===5||l===6)i=i.stateNode,s?r.insertBefore(i,s):r.appendChild(i);else if(l!==4&&(l===27&&Fn(i.type)&&(r=i.stateNode),i=i.child,i!==null))for(uc(i,s,r),i=i.sibling;i!==null;)uc(i,s,r),i=i.sibling}function $v(i){var s=i.stateNode,r=i.memoizedProps;try{for(var l=i.type,u=s.attributes;u.length;)s.removeAttributeNode(u[0]);Ci(s,l,r),s[mt]=i,s[Yt]=r}catch(h){lt(i,i.return,h)}}var ln=!1,Gt=!1,rd=!1,Vv=typeof WeakSet=="function"?WeakSet:Set,oi=null;function q1(i,s){if(i=i.containerInfo,Td=Ac,i=a_(i),Qu(i)){if("selectionStart"in i)var r={start:i.selectionStart,end:i.selectionEnd};else e:{r=(r=i.ownerDocument)&&r.defaultView||window;var l=r.getSelection&&r.getSelection();if(l&&l.rangeCount!==0){r=l.anchorNode;var u=l.anchorOffset,h=l.focusNode;l=l.focusOffset;try{r.nodeType,h.nodeType}catch{r=null;break e}var v=0,w=-1,D=-1,P=0,se=0,le=i,Y=null;t:for(;;){for(var Z;le!==r||u!==0&&le.nodeType!==3||(w=v+u),le!==h||l!==0&&le.nodeType!==3||(D=v+l),le.nodeType===3&&(v+=le.nodeValue.length),(Z=le.firstChild)!==null;)Y=le,le=Z;for(;;){if(le===i)break t;if(Y===r&&++P===u&&(w=v),Y===h&&++se===l&&(D=v),(Z=le.nextSibling)!==null)break;le=Y,Y=le.parentNode}le=Z}r=w===-1||D===-1?null:{start:w,end:D}}else r=null}r=r||{start:0,end:0}}else r=null;for(kd={focusedElem:i,selectionRange:r},Ac=!1,oi=s;oi!==null;)if(s=oi,i=s.child,(s.subtreeFlags&1028)!==0&&i!==null)i.return=s,oi=i;else for(;oi!==null;){switch(s=oi,h=s.alternate,i=s.flags,s.tag){case 0:if((i&4)!==0&&(i=s.updateQueue,i=i!==null?i.events:null,i!==null))for(r=0;r<i.length;r++)u=i[r],u.ref.impl=u.nextImpl;break;case 11:case 15:break;case 1:if((i&1024)!==0&&h!==null){i=void 0,r=s,u=h.memoizedProps,h=h.memoizedState,l=r.stateNode;try{var be=Er(r.type,u);i=l.getSnapshotBeforeUpdate(be,h),l.__reactInternalSnapshotBeforeUpdate=i}catch(Ae){lt(r,r.return,Ae)}}break;case 3:if((i&1024)!==0){if(i=s.stateNode.containerInfo,r=i.nodeType,r===9)Md(i);else if(r===1)switch(i.nodeName){case"HEAD":case"HTML":case"BODY":Md(i);break;default:i.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((i&1024)!==0)throw Error(a(163))}if(i=s.sibling,i!==null){i.return=s.return,oi=i;break}oi=s.return}}function Xv(i,s,r){var l=r.flags;switch(r.tag){case 0:case 11:case 15:cn(i,r),l&4&&fl(5,r);break;case 1:if(cn(i,r),l&4)if(i=r.stateNode,s===null)try{i.componentDidMount()}catch(v){lt(r,r.return,v)}else{var u=Er(r.type,s.memoizedProps);s=s.memoizedState;try{i.componentDidUpdate(u,s,i.__reactInternalSnapshotBeforeUpdate)}catch(v){lt(r,r.return,v)}}l&64&&Fv(r),l&512&&pl(r,r.return);break;case 3:if(cn(i,r),l&64&&(i=r.updateQueue,i!==null)){if(s=null,r.child!==null)switch(r.child.tag){case 27:case 5:s=r.child.stateNode;break;case 1:s=r.child.stateNode}try{B_(i,s)}catch(v){lt(r,r.return,v)}}break;case 27:s===null&&l&4&&$v(r);case 26:case 5:cn(i,r),s===null&&l&4&&Wv(r),l&512&&pl(r,r.return);break;case 12:cn(i,r);break;case 31:cn(i,r),l&4&&Qv(i,r);break;case 13:cn(i,r),l&4&&Jv(i,r),l&64&&(i=r.memoizedState,i!==null&&(i=i.dehydrated,i!==null&&(r=J1.bind(null,r),yC(i,r))));break;case 22:if(l=r.memoizedState!==null||ln,!l){s=s!==null&&s.memoizedState!==null||Gt,u=ln;var h=Gt;ln=l,(Gt=s)&&!h?un(i,r,(r.subtreeFlags&8772)!==0):cn(i,r),ln=u,Gt=h}break;case 30:break;default:cn(i,r)}}function Gv(i){var s=i.alternate;s!==null&&(i.alternate=null,Gv(s)),i.child=null,i.deletions=null,i.sibling=null,i.tag===5&&(s=i.stateNode,s!==null&&En(s)),i.stateNode=null,i.return=null,i.dependencies=null,i.memoizedProps=null,i.memoizedState=null,i.pendingProps=null,i.stateNode=null,i.updateQueue=null}var Et=null,Ki=!1;function on(i,s,r){for(r=r.child;r!==null;)Zv(i,s,r),r=r.sibling}function Zv(i,s,r){if(qt&&typeof qt.onCommitFiberUnmount=="function")try{qt.onCommitFiberUnmount(Hi,r)}catch{}switch(r.tag){case 26:Gt||Us(r,s),on(i,s,r),r.memoizedState?r.memoizedState.count--:r.stateNode&&(r=r.stateNode,r.parentNode.removeChild(r));break;case 27:Gt||Us(r,s);var l=Et,u=Ki;Fn(r.type)&&(Et=r.stateNode,Ki=!1),on(i,s,r),Cl(r.stateNode),Et=l,Ki=u;break;case 5:Gt||Us(r,s);case 6:if(l=Et,u=Ki,Et=null,on(i,s,r),Et=l,Ki=u,Et!==null)if(Ki)try{(Et.nodeType===9?Et.body:Et.nodeName==="HTML"?Et.ownerDocument.body:Et).removeChild(r.stateNode)}catch(h){lt(r,s,h)}else try{Et.removeChild(r.stateNode)}catch(h){lt(r,s,h)}break;case 18:Et!==null&&(Ki?(i=Et,Fg(i.nodeType===9?i.body:i.nodeName==="HTML"?i.ownerDocument.body:i,r.stateNode),Ca(i)):Fg(Et,r.stateNode));break;case 4:l=Et,u=Ki,Et=r.stateNode.containerInfo,Ki=!0,on(i,s,r),Et=l,Ki=u;break;case 0:case 11:case 14:case 15:zn(2,r,s),Gt||zn(4,r,s),on(i,s,r);break;case 1:Gt||(Us(r,s),l=r.stateNode,typeof l.componentWillUnmount=="function"&&qv(r,s,l)),on(i,s,r);break;case 21:on(i,s,r);break;case 22:Gt=(l=Gt)||r.memoizedState!==null,on(i,s,r),Gt=l;break;default:on(i,s,r)}}function Qv(i,s){if(s.memoizedState===null&&(i=s.alternate,i!==null&&(i=i.memoizedState,i!==null))){i=i.dehydrated;try{Ca(i)}catch(r){lt(s,s.return,r)}}}function Jv(i,s){if(s.memoizedState===null&&(i=s.alternate,i!==null&&(i=i.memoizedState,i!==null&&(i=i.dehydrated,i!==null))))try{Ca(i)}catch(r){lt(s,s.return,r)}}function W1(i){switch(i.tag){case 31:case 13:case 19:var s=i.stateNode;return s===null&&(s=i.stateNode=new Vv),s;case 22:return i=i.stateNode,s=i._retryCache,s===null&&(s=i._retryCache=new Vv),s;default:throw Error(a(435,i.tag))}}function hc(i,s){var r=W1(i);s.forEach(function(l){if(!r.has(l)){r.add(l);var u=eC.bind(null,i,l);l.then(u,u)}})}function Ii(i,s){var r=s.deletions;if(r!==null)for(var l=0;l<r.length;l++){var u=r[l],h=i,v=s,w=v;e:for(;w!==null;){switch(w.tag){case 27:if(Fn(w.type)){Et=w.stateNode,Ki=!1;break e}break;case 5:Et=w.stateNode,Ki=!1;break e;case 3:case 4:Et=w.stateNode.containerInfo,Ki=!0;break e}w=w.return}if(Et===null)throw Error(a(160));Zv(h,v,u),Et=null,Ki=!1,h=u.alternate,h!==null&&(h.return=null),u.return=null}if(s.subtreeFlags&13886)for(s=s.child;s!==null;)eg(s,i),s=s.sibling}var Ms=null;function eg(i,s){var r=i.alternate,l=i.flags;switch(i.tag){case 0:case 11:case 14:case 15:Ii(s,i),Fi(i),l&4&&(zn(3,i,i.return),fl(3,i),zn(5,i,i.return));break;case 1:Ii(s,i),Fi(i),l&512&&(Gt||r===null||Us(r,r.return)),l&64&&ln&&(i=i.updateQueue,i!==null&&(l=i.callbacks,l!==null&&(r=i.shared.hiddenCallbacks,i.shared.hiddenCallbacks=r===null?l:r.concat(l))));break;case 26:var u=Ms;if(Ii(s,i),Fi(i),l&512&&(Gt||r===null||Us(r,r.return)),l&4){var h=r!==null?r.memoizedState:null;if(l=i.memoizedState,r===null)if(l===null)if(i.stateNode===null){e:{l=i.type,r=i.memoizedProps,u=u.ownerDocument||u;t:switch(l){case"title":h=u.getElementsByTagName("title")[0],(!h||h[Gi]||h[mt]||h.namespaceURI==="http://www.w3.org/2000/svg"||h.hasAttribute("itemprop"))&&(h=u.createElement(l),u.head.insertBefore(h,u.querySelector("head > title"))),Ci(h,l,r),h[mt]=i,Lt(h),l=h;break e;case"link":var v=ey("link","href",u).get(l+(r.href||""));if(v){for(var w=0;w<v.length;w++)if(h=v[w],h.getAttribute("href")===(r.href==null||r.href===""?null:r.href)&&h.getAttribute("rel")===(r.rel==null?null:r.rel)&&h.getAttribute("title")===(r.title==null?null:r.title)&&h.getAttribute("crossorigin")===(r.crossOrigin==null?null:r.crossOrigin)){v.splice(w,1);break t}}h=u.createElement(l),Ci(h,l,r),u.head.appendChild(h);break;case"meta":if(v=ey("meta","content",u).get(l+(r.content||""))){for(w=0;w<v.length;w++)if(h=v[w],h.getAttribute("content")===(r.content==null?null:""+r.content)&&h.getAttribute("name")===(r.name==null?null:r.name)&&h.getAttribute("property")===(r.property==null?null:r.property)&&h.getAttribute("http-equiv")===(r.httpEquiv==null?null:r.httpEquiv)&&h.getAttribute("charset")===(r.charSet==null?null:r.charSet)){v.splice(w,1);break t}}h=u.createElement(l),Ci(h,l,r),u.head.appendChild(h);break;default:throw Error(a(468,l))}h[mt]=i,Lt(h),l=h}i.stateNode=l}else ty(u,i.type,i.stateNode);else i.stateNode=Jg(u,l,i.memoizedProps);else h!==l?(h===null?r.stateNode!==null&&(r=r.stateNode,r.parentNode.removeChild(r)):h.count--,l===null?ty(u,i.type,i.stateNode):Jg(u,l,i.memoizedProps)):l===null&&i.stateNode!==null&&id(i,i.memoizedProps,r.memoizedProps)}break;case 27:Ii(s,i),Fi(i),l&512&&(Gt||r===null||Us(r,r.return)),r!==null&&l&4&&id(i,i.memoizedProps,r.memoizedProps);break;case 5:if(Ii(s,i),Fi(i),l&512&&(Gt||r===null||Us(r,r.return)),i.flags&32){u=i.stateNode;try{Yr(u,"")}catch(be){lt(i,i.return,be)}}l&4&&i.stateNode!=null&&(u=i.memoizedProps,id(i,u,r!==null?r.memoizedProps:u)),l&1024&&(rd=!0);break;case 6:if(Ii(s,i),Fi(i),l&4){if(i.stateNode===null)throw Error(a(162));l=i.memoizedProps,r=i.stateNode;try{r.nodeValue=l}catch(be){lt(i,i.return,be)}}break;case 3:if(kc=null,u=Ms,Ms=Ec(s.containerInfo),Ii(s,i),Ms=u,Fi(i),l&4&&r!==null&&r.memoizedState.isDehydrated)try{Ca(s.containerInfo)}catch(be){lt(i,i.return,be)}rd&&(rd=!1,tg(i));break;case 4:l=Ms,Ms=Ec(i.stateNode.containerInfo),Ii(s,i),Fi(i),Ms=l;break;case 12:Ii(s,i),Fi(i);break;case 31:Ii(s,i),Fi(i),l&4&&(l=i.updateQueue,l!==null&&(i.updateQueue=null,hc(i,l)));break;case 13:Ii(s,i),Fi(i),i.child.flags&8192&&i.memoizedState!==null!=(r!==null&&r.memoizedState!==null)&&(fc=He()),l&4&&(l=i.updateQueue,l!==null&&(i.updateQueue=null,hc(i,l)));break;case 22:u=i.memoizedState!==null;var D=r!==null&&r.memoizedState!==null,P=ln,se=Gt;if(ln=P||u,Gt=se||D,Ii(s,i),Gt=se,ln=P,Fi(i),l&8192)e:for(s=i.stateNode,s._visibility=u?s._visibility&-2:s._visibility|1,u&&(r===null||D||ln||Gt||Tr(i)),r=null,s=i;;){if(s.tag===5||s.tag===26){if(r===null){D=r=s;try{if(h=D.stateNode,u)v=h.style,typeof v.setProperty=="function"?v.setProperty("display","none","important"):v.display="none";else{w=D.stateNode;var le=D.memoizedProps.style,Y=le!=null&&le.hasOwnProperty("display")?le.display:null;w.style.display=Y==null||typeof Y=="boolean"?"":(""+Y).trim()}}catch(be){lt(D,D.return,be)}}}else if(s.tag===6){if(r===null){D=s;try{D.stateNode.nodeValue=u?"":D.memoizedProps}catch(be){lt(D,D.return,be)}}}else if(s.tag===18){if(r===null){D=s;try{var Z=D.stateNode;u?qg(Z,!0):qg(D.stateNode,!1)}catch(be){lt(D,D.return,be)}}}else if((s.tag!==22&&s.tag!==23||s.memoizedState===null||s===i)&&s.child!==null){s.child.return=s,s=s.child;continue}if(s===i)break e;for(;s.sibling===null;){if(s.return===null||s.return===i)break e;r===s&&(r=null),s=s.return}r===s&&(r=null),s.sibling.return=s.return,s=s.sibling}l&4&&(l=i.updateQueue,l!==null&&(r=l.retryQueue,r!==null&&(l.retryQueue=null,hc(i,r))));break;case 19:Ii(s,i),Fi(i),l&4&&(l=i.updateQueue,l!==null&&(i.updateQueue=null,hc(i,l)));break;case 30:break;case 21:break;default:Ii(s,i),Fi(i)}}function Fi(i){var s=i.flags;if(s&2){try{for(var r,l=i.return;l!==null;){if(Yv(l)){r=l;break}l=l.return}if(r==null)throw Error(a(160));switch(r.tag){case 27:var u=r.stateNode,h=sd(i);uc(i,h,u);break;case 5:var v=r.stateNode;r.flags&32&&(Yr(v,""),r.flags&=-33);var w=sd(i);uc(i,w,v);break;case 3:case 4:var D=r.stateNode.containerInfo,P=sd(i);nd(i,P,D);break;default:throw Error(a(161))}}catch(se){lt(i,i.return,se)}i.flags&=-3}s&4096&&(i.flags&=-4097)}function tg(i){if(i.subtreeFlags&1024)for(i=i.child;i!==null;){var s=i;tg(s),s.tag===5&&s.flags&1024&&s.stateNode.reset(),i=i.sibling}}function cn(i,s){if(s.subtreeFlags&8772)for(s=s.child;s!==null;)Xv(i,s.alternate,s),s=s.sibling}function Tr(i){for(i=i.child;i!==null;){var s=i;switch(s.tag){case 0:case 11:case 14:case 15:zn(4,s,s.return),Tr(s);break;case 1:Us(s,s.return);var r=s.stateNode;typeof r.componentWillUnmount=="function"&&qv(s,s.return,r),Tr(s);break;case 27:Cl(s.stateNode);case 26:case 5:Us(s,s.return),Tr(s);break;case 22:s.memoizedState===null&&Tr(s);break;case 30:Tr(s);break;default:Tr(s)}i=i.sibling}}function un(i,s,r){for(r=r&&(s.subtreeFlags&8772)!==0,s=s.child;s!==null;){var l=s.alternate,u=i,h=s,v=h.flags;switch(h.tag){case 0:case 11:case 15:un(u,h,r),fl(4,h);break;case 1:if(un(u,h,r),l=h,u=l.stateNode,typeof u.componentDidMount=="function")try{u.componentDidMount()}catch(P){lt(l,l.return,P)}if(l=h,u=l.updateQueue,u!==null){var w=l.stateNode;try{var D=u.shared.hiddenCallbacks;if(D!==null)for(u.shared.hiddenCallbacks=null,u=0;u<D.length;u++)N_(D[u],w)}catch(P){lt(l,l.return,P)}}r&&v&64&&Fv(h),pl(h,h.return);break;case 27:$v(h);case 26:case 5:un(u,h,r),r&&l===null&&v&4&&Wv(h),pl(h,h.return);break;case 12:un(u,h,r);break;case 31:un(u,h,r),r&&v&4&&Qv(u,h);break;case 13:un(u,h,r),r&&v&4&&Jv(u,h);break;case 22:h.memoizedState===null&&un(u,h,r),pl(h,h.return);break;case 30:break;default:un(u,h,r)}s=s.sibling}}function ad(i,s){var r=null;i!==null&&i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(r=i.memoizedState.cachePool.pool),i=null,s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(i=s.memoizedState.cachePool.pool),i!==r&&(i!=null&&i.refCount++,r!=null&&el(r))}function ld(i,s){i=null,s.alternate!==null&&(i=s.alternate.memoizedState.cache),s=s.memoizedState.cache,s!==i&&(s.refCount++,i!=null&&el(i))}function As(i,s,r,l){if(s.subtreeFlags&10256)for(s=s.child;s!==null;)ig(i,s,r,l),s=s.sibling}function ig(i,s,r,l){var u=s.flags;switch(s.tag){case 0:case 11:case 15:As(i,s,r,l),u&2048&&fl(9,s);break;case 1:As(i,s,r,l);break;case 3:As(i,s,r,l),u&2048&&(i=null,s.alternate!==null&&(i=s.alternate.memoizedState.cache),s=s.memoizedState.cache,s!==i&&(s.refCount++,i!=null&&el(i)));break;case 12:if(u&2048){As(i,s,r,l),i=s.stateNode;try{var h=s.memoizedProps,v=h.id,w=h.onPostCommit;typeof w=="function"&&w(v,s.alternate===null?"mount":"update",i.passiveEffectDuration,-0)}catch(D){lt(s,s.return,D)}}else As(i,s,r,l);break;case 31:As(i,s,r,l);break;case 13:As(i,s,r,l);break;case 23:break;case 22:h=s.stateNode,v=s.alternate,s.memoizedState!==null?h._visibility&2?As(i,s,r,l):ml(i,s):h._visibility&2?As(i,s,r,l):(h._visibility|=2,da(i,s,r,l,(s.subtreeFlags&10256)!==0||!1)),u&2048&&ad(v,s);break;case 24:As(i,s,r,l),u&2048&&ld(s.alternate,s);break;default:As(i,s,r,l)}}function da(i,s,r,l,u){for(u=u&&((s.subtreeFlags&10256)!==0||!1),s=s.child;s!==null;){var h=i,v=s,w=r,D=l,P=v.flags;switch(v.tag){case 0:case 11:case 15:da(h,v,w,D,u),fl(8,v);break;case 23:break;case 22:var se=v.stateNode;v.memoizedState!==null?se._visibility&2?da(h,v,w,D,u):ml(h,v):(se._visibility|=2,da(h,v,w,D,u)),u&&P&2048&&ad(v.alternate,v);break;case 24:da(h,v,w,D,u),u&&P&2048&&ld(v.alternate,v);break;default:da(h,v,w,D,u)}s=s.sibling}}function ml(i,s){if(s.subtreeFlags&10256)for(s=s.child;s!==null;){var r=i,l=s,u=l.flags;switch(l.tag){case 22:ml(r,l),u&2048&&ad(l.alternate,l);break;case 24:ml(r,l),u&2048&&ld(l.alternate,l);break;default:ml(r,l)}s=s.sibling}}var _l=8192;function fa(i,s,r){if(i.subtreeFlags&_l)for(i=i.child;i!==null;)sg(i,s,r),i=i.sibling}function sg(i,s,r){switch(i.tag){case 26:fa(i,s,r),i.flags&_l&&i.memoizedState!==null&&AC(r,Ms,i.memoizedState,i.memoizedProps);break;case 5:fa(i,s,r);break;case 3:case 4:var l=Ms;Ms=Ec(i.stateNode.containerInfo),fa(i,s,r),Ms=l;break;case 22:i.memoizedState===null&&(l=i.alternate,l!==null&&l.memoizedState!==null?(l=_l,_l=16777216,fa(i,s,r),_l=l):fa(i,s,r));break;default:fa(i,s,r)}}function ng(i){var s=i.alternate;if(s!==null&&(i=s.child,i!==null)){s.child=null;do s=i.sibling,i.sibling=null,i=s;while(i!==null)}}function vl(i){var s=i.deletions;if((i.flags&16)!==0){if(s!==null)for(var r=0;r<s.length;r++){var l=s[r];oi=l,ag(l,i)}ng(i)}if(i.subtreeFlags&10256)for(i=i.child;i!==null;)rg(i),i=i.sibling}function rg(i){switch(i.tag){case 0:case 11:case 15:vl(i),i.flags&2048&&zn(9,i,i.return);break;case 3:vl(i);break;case 12:vl(i);break;case 22:var s=i.stateNode;i.memoizedState!==null&&s._visibility&2&&(i.return===null||i.return.tag!==13)?(s._visibility&=-3,dc(i)):vl(i);break;default:vl(i)}}function dc(i){var s=i.deletions;if((i.flags&16)!==0){if(s!==null)for(var r=0;r<s.length;r++){var l=s[r];oi=l,ag(l,i)}ng(i)}for(i=i.child;i!==null;){switch(s=i,s.tag){case 0:case 11:case 15:zn(8,s,s.return),dc(s);break;case 22:r=s.stateNode,r._visibility&2&&(r._visibility&=-3,dc(s));break;default:dc(s)}i=i.sibling}}function ag(i,s){for(;oi!==null;){var r=oi;switch(r.tag){case 0:case 11:case 15:zn(8,r,s);break;case 23:case 22:if(r.memoizedState!==null&&r.memoizedState.cachePool!==null){var l=r.memoizedState.cachePool.pool;l!=null&&l.refCount++}break;case 24:el(r.memoizedState.cache)}if(l=r.child,l!==null)l.return=r,oi=l;else e:for(r=i;oi!==null;){l=oi;var u=l.sibling,h=l.return;if(Gv(l),l===r){oi=null;break e}if(u!==null){u.return=h,oi=u;break e}oi=h}}}var Y1={getCacheForType:function(i){var s=bi($t),r=s.data.get(i);return r===void 0&&(r=i(),s.data.set(i,r)),r},cacheSignal:function(){return bi($t).controller.signal}},$1=typeof WeakMap=="function"?WeakMap:Map,st=0,_t=null,$e=null,Ze=0,at=0,ss=null,jn=!1,pa=!1,od=!1,hn=0,zt=0,Hn=0,kr=0,cd=0,ns=0,ma=0,gl=null,qi=null,ud=!1,fc=0,lg=0,pc=1/0,mc=null,Un=null,ti=0,Pn=null,_a=null,dn=0,hd=0,dd=null,og=null,yl=0,fd=null;function rs(){return(st&2)!==0&&Ze!==0?Ze&-Ze:M.T!==null?yd():ki()}function cg(){if(ns===0)if((Ze&536870912)===0||Je){var i=ks;ks<<=1,(ks&3932160)===0&&(ks=262144),ns=i}else ns=536870912;return i=ts.current,i!==null&&(i.flags|=32),ns}function Wi(i,s,r){(i===_t&&(at===2||at===9)||i.cancelPendingCommit!==null)&&(va(i,0),Kn(i,Ze,ns,!1)),Wt(i,r),((st&2)===0||i!==_t)&&(i===_t&&((st&2)===0&&(kr|=r),zt===4&&Kn(i,Ze,ns,!1)),Ps(i))}function ug(i,s,r){if((st&6)!==0)throw Error(a(327));var l=!r&&(s&127)===0&&(s&i.expiredLanes)===0||li(i,s),u=l?G1(i,s):md(i,s,!0),h=l;do{if(u===0){pa&&!l&&Kn(i,s,0,!1);break}else{if(r=i.current.alternate,h&&!V1(r)){u=md(i,s,!1),h=!1;continue}if(u===2){if(h=s,i.errorRecoveryDisabledLanes&h)var v=0;else v=i.pendingLanes&-536870913,v=v!==0?v:v&536870912?536870912:0;if(v!==0){s=v;e:{var w=i;u=gl;var D=w.current.memoizedState.isDehydrated;if(D&&(va(w,v).flags|=256),v=md(w,v,!1),v!==2){if(od&&!D){w.errorRecoveryDisabledLanes|=h,kr|=h,u=4;break e}h=qi,qi=u,h!==null&&(qi===null?qi=h:qi.push.apply(qi,h))}u=v}if(h=!1,u!==2)continue}}if(u===1){va(i,0),Kn(i,s,0,!0);break}e:{switch(l=i,h=u,h){case 0:case 1:throw Error(a(345));case 4:if((s&4194048)!==s)break;case 6:Kn(l,s,ns,!jn);break e;case 2:qi=null;break;case 3:case 5:break;default:throw Error(a(329))}if((s&62914560)===s&&(u=fc+300-He(),10<u)){if(Kn(l,s,ns,!jn),Rt(l,0,!0)!==0)break e;dn=s,l.timeoutHandle=Kg(hg.bind(null,l,r,qi,mc,ud,s,ns,kr,ma,jn,h,"Throttled",-0,0),u);break e}hg(l,r,qi,mc,ud,s,ns,kr,ma,jn,h,null,-0,0)}}break}while(!0);Ps(i)}function hg(i,s,r,l,u,h,v,w,D,P,se,le,Y,Z){if(i.timeoutHandle=-1,le=s.subtreeFlags,le&8192||(le&16785408)===16785408){le={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Gs},sg(s,h,le);var be=(h&62914560)===h?fc-He():(h&4194048)===h?lg-He():0;if(be=NC(le,be),be!==null){dn=h,i.cancelPendingCommit=be(yg.bind(null,i,s,h,r,l,u,v,w,D,se,le,null,Y,Z)),Kn(i,h,v,!P);return}}yg(i,s,h,r,l,u,v,w,D)}function V1(i){for(var s=i;;){var r=s.tag;if((r===0||r===11||r===15)&&s.flags&16384&&(r=s.updateQueue,r!==null&&(r=r.stores,r!==null)))for(var l=0;l<r.length;l++){var u=r[l],h=u.getSnapshot;u=u.value;try{if(!Ji(h(),u))return!1}catch{return!1}}if(r=s.child,s.subtreeFlags&16384&&r!==null)r.return=s,s=r;else{if(s===i)break;for(;s.sibling===null;){if(s.return===null||s.return===i)return!0;s=s.return}s.sibling.return=s.return,s=s.sibling}}return!0}function Kn(i,s,r,l){s&=~cd,s&=~kr,i.suspendedLanes|=s,i.pingedLanes&=~s,l&&(i.warmLanes|=s),l=i.expirationTimes;for(var u=s;0<u;){var h=31-Dt(u),v=1<<h;l[h]=-1,u&=~v}r!==0&&Ge(i,r,s)}function _c(){return(st&6)===0?(Sl(0),!1):!0}function pd(){if($e!==null){if(at===0)var i=$e.return;else i=$e,en=gr=null,Mh(i),la=null,il=0,i=$e;for(;i!==null;)Iv(i.alternate,i),i=i.return;$e=null}}function va(i,s){var r=i.timeoutHandle;r!==-1&&(i.timeoutHandle=-1,pC(r)),r=i.cancelPendingCommit,r!==null&&(i.cancelPendingCommit=null,r()),dn=0,pd(),_t=i,$e=r=Qs(i.current,null),Ze=s,at=0,ss=null,jn=!1,pa=li(i,s),od=!1,ma=ns=cd=kr=Hn=zt=0,qi=gl=null,ud=!1,(s&8)!==0&&(s|=s&32);var l=i.entangledLanes;if(l!==0)for(i=i.entanglements,l&=s;0<l;){var u=31-Dt(l),h=1<<u;s|=i[u],l&=~h}return hn=s,jo(),r}function dg(i,s){Ie=null,M.H=ul,s===aa||s===Wo?(s=D_(),at=3):s===gh?(s=D_(),at=4):at=s===Yh?8:s!==null&&typeof s=="object"&&typeof s.then=="function"?6:1,ss=s,$e===null&&(zt=1,rc(i,ds(s,i.current)))}function fg(){var i=ts.current;return i===null?!0:(Ze&4194048)===Ze?_s===null:(Ze&62914560)===Ze||(Ze&536870912)!==0?i===_s:!1}function pg(){var i=M.H;return M.H=ul,i===null?ul:i}function mg(){var i=M.A;return M.A=Y1,i}function vc(){zt=4,jn||(Ze&4194048)!==Ze&&ts.current!==null||(pa=!0),(Hn&134217727)===0&&(kr&134217727)===0||_t===null||Kn(_t,Ze,ns,!1)}function md(i,s,r){var l=st;st|=2;var u=pg(),h=mg();(_t!==i||Ze!==s)&&(mc=null,va(i,s)),s=!1;var v=zt;e:do try{if(at!==0&&$e!==null){var w=$e,D=ss;switch(at){case 8:pd(),v=6;break e;case 3:case 2:case 9:case 6:ts.current===null&&(s=!0);var P=at;if(at=0,ss=null,ga(i,w,D,P),r&&pa){v=0;break e}break;default:P=at,at=0,ss=null,ga(i,w,D,P)}}X1(),v=zt;break}catch(se){dg(i,se)}while(!0);return s&&i.shellSuspendCounter++,en=gr=null,st=l,M.H=u,M.A=h,$e===null&&(_t=null,Ze=0,jo()),v}function X1(){for(;$e!==null;)_g($e)}function G1(i,s){var r=st;st|=2;var l=pg(),u=mg();_t!==i||Ze!==s?(mc=null,pc=He()+500,va(i,s)):pa=li(i,s);e:do try{if(at!==0&&$e!==null){s=$e;var h=ss;t:switch(at){case 1:at=0,ss=null,ga(i,s,h,1);break;case 2:case 9:if(T_(h)){at=0,ss=null,vg(s);break}s=function(){at!==2&&at!==9||_t!==i||(at=7),Ps(i)},h.then(s,s);break e;case 3:at=7;break e;case 4:at=5;break e;case 7:T_(h)?(at=0,ss=null,vg(s)):(at=0,ss=null,ga(i,s,h,7));break;case 5:var v=null;switch($e.tag){case 26:v=$e.memoizedState;case 5:case 27:var w=$e;if(v?iy(v):w.stateNode.complete){at=0,ss=null;var D=w.sibling;if(D!==null)$e=D;else{var P=w.return;P!==null?($e=P,gc(P)):$e=null}break t}}at=0,ss=null,ga(i,s,h,5);break;case 6:at=0,ss=null,ga(i,s,h,6);break;case 8:pd(),zt=6;break e;default:throw Error(a(462))}}Z1();break}catch(se){dg(i,se)}while(!0);return en=gr=null,M.H=l,M.A=u,st=r,$e!==null?0:(_t=null,Ze=0,jo(),zt)}function Z1(){for(;$e!==null&&!te();)_g($e)}function _g(i){var s=Pv(i.alternate,i,hn);i.memoizedProps=i.pendingProps,s===null?gc(i):$e=s}function vg(i){var s=i,r=s.alternate;switch(s.tag){case 15:case 0:s=Lv(r,s,s.pendingProps,s.type,void 0,Ze);break;case 11:s=Lv(r,s,s.pendingProps,s.type.render,s.ref,Ze);break;case 5:Mh(s);default:Iv(r,s),s=$e=m_(s,hn),s=Pv(r,s,hn)}i.memoizedProps=i.pendingProps,s===null?gc(i):$e=s}function ga(i,s,r,l){en=gr=null,Mh(s),la=null,il=0;var u=s.return;try{if(U1(i,u,s,r,Ze)){zt=1,rc(i,ds(r,i.current)),$e=null;return}}catch(h){if(u!==null)throw $e=u,h;zt=1,rc(i,ds(r,i.current)),$e=null;return}s.flags&32768?(Je||l===1?i=!0:pa||(Ze&536870912)!==0?i=!1:(jn=i=!0,(l===2||l===9||l===3||l===6)&&(l=ts.current,l!==null&&l.tag===13&&(l.flags|=16384))),gg(s,i)):gc(s)}function gc(i){var s=i;do{if((s.flags&32768)!==0){gg(s,jn);return}i=s.return;var r=I1(s.alternate,s,hn);if(r!==null){$e=r;return}if(s=s.sibling,s!==null){$e=s;return}$e=s=i}while(s!==null);zt===0&&(zt=5)}function gg(i,s){do{var r=F1(i.alternate,i);if(r!==null){r.flags&=32767,$e=r;return}if(r=i.return,r!==null&&(r.flags|=32768,r.subtreeFlags=0,r.deletions=null),!s&&(i=i.sibling,i!==null)){$e=i;return}$e=i=r}while(i!==null);zt=6,$e=null}function yg(i,s,r,l,u,h,v,w,D){i.cancelPendingCommit=null;do yc();while(ti!==0);if((st&6)!==0)throw Error(a(327));if(s!==null){if(s===i.current)throw Error(a(177));if(h=s.lanes|s.childLanes,h|=sh,bt(i,r,h,v,w,D),i===_t&&($e=_t=null,Ze=0),_a=s,Pn=i,dn=r,hd=h,dd=u,og=l,(s.subtreeFlags&10256)!==0||(s.flags&10256)!==0?(i.callbackNode=null,i.callbackPriority=0,tC(kt,function(){return xg(),null})):(i.callbackNode=null,i.callbackPriority=0),l=(s.flags&13878)!==0,(s.subtreeFlags&13878)!==0||l){l=M.T,M.T=null,u=V.p,V.p=2,v=st,st|=4;try{q1(i,s,r)}finally{st=v,V.p=u,M.T=l}}ti=1,Sg(),bg(),wg()}}function Sg(){if(ti===1){ti=0;var i=Pn,s=_a,r=(s.flags&13878)!==0;if((s.subtreeFlags&13878)!==0||r){r=M.T,M.T=null;var l=V.p;V.p=2;var u=st;st|=4;try{eg(s,i);var h=kd,v=a_(i.containerInfo),w=h.focusedElem,D=h.selectionRange;if(v!==w&&w&&w.ownerDocument&&r_(w.ownerDocument.documentElement,w)){if(D!==null&&Qu(w)){var P=D.start,se=D.end;if(se===void 0&&(se=P),"selectionStart"in w)w.selectionStart=P,w.selectionEnd=Math.min(se,w.value.length);else{var le=w.ownerDocument||document,Y=le&&le.defaultView||window;if(Y.getSelection){var Z=Y.getSelection(),be=w.textContent.length,Ae=Math.min(D.start,be),ft=D.end===void 0?Ae:Math.min(D.end,be);!Z.extend&&Ae>ft&&(v=ft,ft=Ae,Ae=v);var z=n_(w,Ae),N=n_(w,ft);if(z&&N&&(Z.rangeCount!==1||Z.anchorNode!==z.node||Z.anchorOffset!==z.offset||Z.focusNode!==N.node||Z.focusOffset!==N.offset)){var U=le.createRange();U.setStart(z.node,z.offset),Z.removeAllRanges(),Ae>ft?(Z.addRange(U),Z.extend(N.node,N.offset)):(U.setEnd(N.node,N.offset),Z.addRange(U))}}}}for(le=[],Z=w;Z=Z.parentNode;)Z.nodeType===1&&le.push({element:Z,left:Z.scrollLeft,top:Z.scrollTop});for(typeof w.focus=="function"&&w.focus(),w=0;w<le.length;w++){var ne=le[w];ne.element.scrollLeft=ne.left,ne.element.scrollTop=ne.top}}Ac=!!Td,kd=Td=null}finally{st=u,V.p=l,M.T=r}}i.current=s,ti=2}}function bg(){if(ti===2){ti=0;var i=Pn,s=_a,r=(s.flags&8772)!==0;if((s.subtreeFlags&8772)!==0||r){r=M.T,M.T=null;var l=V.p;V.p=2;var u=st;st|=4;try{Xv(i,s.alternate,s)}finally{st=u,V.p=l,M.T=r}}ti=3}}function wg(){if(ti===4||ti===3){ti=0,je();var i=Pn,s=_a,r=dn,l=og;(s.subtreeFlags&10256)!==0||(s.flags&10256)!==0?ti=5:(ti=0,_a=Pn=null,Cg(i,i.pendingLanes));var u=i.pendingLanes;if(u===0&&(Un=null),Ni(r),s=s.stateNode,qt&&typeof qt.onCommitFiberRoot=="function")try{qt.onCommitFiberRoot(Hi,s,void 0,(s.current.flags&128)===128)}catch{}if(l!==null){s=M.T,u=V.p,V.p=2,M.T=null;try{for(var h=i.onRecoverableError,v=0;v<l.length;v++){var w=l[v];h(w.value,{componentStack:w.stack})}}finally{M.T=s,V.p=u}}(dn&3)!==0&&yc(),Ps(i),u=i.pendingLanes,(r&261930)!==0&&(u&42)!==0?i===fd?yl++:(yl=0,fd=i):yl=0,Sl(0)}}function Cg(i,s){(i.pooledCacheLanes&=s)===0&&(s=i.pooledCache,s!=null&&(i.pooledCache=null,el(s)))}function yc(){return Sg(),bg(),wg(),xg()}function xg(){if(ti!==5)return!1;var i=Pn,s=hd;hd=0;var r=Ni(dn),l=M.T,u=V.p;try{V.p=32>r?32:r,M.T=null,r=dd,dd=null;var h=Pn,v=dn;if(ti=0,_a=Pn=null,dn=0,(st&6)!==0)throw Error(a(331));var w=st;if(st|=4,rg(h.current),ig(h,h.current,v,r),st=w,Sl(0,!1),qt&&typeof qt.onPostCommitFiberRoot=="function")try{qt.onPostCommitFiberRoot(Hi,h)}catch{}return!0}finally{V.p=u,M.T=l,Cg(i,s)}}function Eg(i,s,r){s=ds(r,s),s=Wh(i.stateNode,s,2),i=Bn(i,s,2),i!==null&&(Wt(i,2),Ps(i))}function lt(i,s,r){if(i.tag===3)Eg(i,i,r);else for(;s!==null;){if(s.tag===3){Eg(s,i,r);break}else if(s.tag===1){var l=s.stateNode;if(typeof s.type.getDerivedStateFromError=="function"||typeof l.componentDidCatch=="function"&&(Un===null||!Un.has(l))){i=ds(r,i),r=Tv(2),l=Bn(s,r,2),l!==null&&(kv(r,l,s,i),Wt(l,2),Ps(l));break}}s=s.return}}function _d(i,s,r){var l=i.pingCache;if(l===null){l=i.pingCache=new $1;var u=new Set;l.set(s,u)}else u=l.get(s),u===void 0&&(u=new Set,l.set(s,u));u.has(r)||(od=!0,u.add(r),i=Q1.bind(null,i,s,r),s.then(i,i))}function Q1(i,s,r){var l=i.pingCache;l!==null&&l.delete(s),i.pingedLanes|=i.suspendedLanes&r,i.warmLanes&=~r,_t===i&&(Ze&r)===r&&(zt===4||zt===3&&(Ze&62914560)===Ze&&300>He()-fc?(st&2)===0&&va(i,0):cd|=r,ma===Ze&&(ma=0)),Ps(i)}function Tg(i,s){s===0&&(s=Bt()),i=mr(i,s),i!==null&&(Wt(i,s),Ps(i))}function J1(i){var s=i.memoizedState,r=0;s!==null&&(r=s.retryLane),Tg(i,r)}function eC(i,s){var r=0;switch(i.tag){case 31:case 13:var l=i.stateNode,u=i.memoizedState;u!==null&&(r=u.retryLane);break;case 19:l=i.stateNode;break;case 22:l=i.stateNode._retryCache;break;default:throw Error(a(314))}l!==null&&l.delete(s),Tg(i,r)}function tC(i,s){return yt(i,s)}var Sc=null,ya=null,vd=!1,bc=!1,gd=!1,In=0;function Ps(i){i!==ya&&i.next===null&&(ya===null?Sc=ya=i:ya=ya.next=i),bc=!0,vd||(vd=!0,sC())}function Sl(i,s){if(!gd&&bc){gd=!0;do for(var r=!1,l=Sc;l!==null;){if(i!==0){var u=l.pendingLanes;if(u===0)var h=0;else{var v=l.suspendedLanes,w=l.pingedLanes;h=(1<<31-Dt(42|i)+1)-1,h&=u&~(v&~w),h=h&201326741?h&201326741|1:h?h|2:0}h!==0&&(r=!0,Mg(l,h))}else h=Ze,h=Rt(l,l===_t?h:0,l.cancelPendingCommit!==null||l.timeoutHandle!==-1),(h&3)===0||li(l,h)||(r=!0,Mg(l,h));l=l.next}while(r);gd=!1}}function iC(){kg()}function kg(){bc=vd=!1;var i=0;In!==0&&fC()&&(i=In);for(var s=He(),r=null,l=Sc;l!==null;){var u=l.next,h=Dg(l,s);h===0?(l.next=null,r===null?Sc=u:r.next=u,u===null&&(ya=r)):(r=l,(i!==0||(h&3)!==0)&&(bc=!0)),l=u}ti!==0&&ti!==5||Sl(i),In!==0&&(In=0)}function Dg(i,s){for(var r=i.suspendedLanes,l=i.pingedLanes,u=i.expirationTimes,h=i.pendingLanes&-62914561;0<h;){var v=31-Dt(h),w=1<<v,D=u[v];D===-1?((w&r)===0||(w&l)!==0)&&(u[v]=ei(w,s)):D<=s&&(i.expiredLanes|=w),h&=~w}if(s=_t,r=Ze,r=Rt(i,i===s?r:0,i.cancelPendingCommit!==null||i.timeoutHandle!==-1),l=i.callbackNode,r===0||i===s&&(at===2||at===9)||i.cancelPendingCommit!==null)return l!==null&&l!==null&&mi(l),i.callbackNode=null,i.callbackPriority=0;if((r&3)===0||li(i,r)){if(s=r&-r,s===i.callbackPriority)return s;switch(l!==null&&mi(l),Ni(r)){case 2:case 8:r=ai;break;case 32:r=kt;break;case 268435456:r=Ti;break;default:r=kt}return l=Rg.bind(null,i),r=yt(r,l),i.callbackPriority=s,i.callbackNode=r,s}return l!==null&&l!==null&&mi(l),i.callbackPriority=2,i.callbackNode=null,2}function Rg(i,s){if(ti!==0&&ti!==5)return i.callbackNode=null,i.callbackPriority=0,null;var r=i.callbackNode;if(yc()&&i.callbackNode!==r)return null;var l=Ze;return l=Rt(i,i===_t?l:0,i.cancelPendingCommit!==null||i.timeoutHandle!==-1),l===0?null:(ug(i,l,s),Dg(i,He()),i.callbackNode!=null&&i.callbackNode===r?Rg.bind(null,i):null)}function Mg(i,s){if(yc())return null;ug(i,s,!0)}function sC(){mC(function(){(st&6)!==0?yt(Vi,iC):kg()})}function yd(){if(In===0){var i=na;i===0&&(i=Ts,Ts<<=1,(Ts&261888)===0&&(Ts=256)),In=i}return In}function Ag(i){return i==null||typeof i=="symbol"||typeof i=="boolean"?null:typeof i=="function"?i:Ro(""+i)}function Ng(i,s){var r=s.ownerDocument.createElement("input");return r.name=s.name,r.value=s.value,i.id&&r.setAttribute("form",i.id),s.parentNode.insertBefore(r,s),i=new FormData(i),r.parentNode.removeChild(r),i}function nC(i,s,r,l,u){if(s==="submit"&&r&&r.stateNode===u){var h=Ag((u[Yt]||null).action),v=l.submitter;v&&(s=(s=v[Yt]||null)?Ag(s.formAction):v.getAttribute("formAction"),s!==null&&(h=s,v=null));var w=new Bo("action","action",null,l,u);i.push({event:w,listeners:[{instance:null,listener:function(){if(l.defaultPrevented){if(In!==0){var D=v?Ng(u,v):new FormData(u);Uh(r,{pending:!0,data:D,method:u.method,action:h},null,D)}}else typeof h=="function"&&(w.preventDefault(),D=v?Ng(u,v):new FormData(u),Uh(r,{pending:!0,data:D,method:u.method,action:h},h,D))},currentTarget:u}]})}}for(var Sd=0;Sd<ih.length;Sd++){var bd=ih[Sd],rC=bd.toLowerCase(),aC=bd[0].toUpperCase()+bd.slice(1);Rs(rC,"on"+aC)}Rs(c_,"onAnimationEnd"),Rs(u_,"onAnimationIteration"),Rs(h_,"onAnimationStart"),Rs("dblclick","onDoubleClick"),Rs("focusin","onFocus"),Rs("focusout","onBlur"),Rs(w1,"onTransitionRun"),Rs(C1,"onTransitionStart"),Rs(x1,"onTransitionCancel"),Rs(d_,"onTransitionEnd"),zs("onMouseEnter",["mouseout","mouseover"]),zs("onMouseLeave",["mouseout","mouseover"]),zs("onPointerEnter",["pointerout","pointerover"]),zs("onPointerLeave",["pointerout","pointerover"]),Ui("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Ui("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Ui("onBeforeInput",["compositionend","keypress","textInput","paste"]),Ui("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Ui("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Ui("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var bl="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(" "),lC=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(bl));function Bg(i,s){s=(s&4)!==0;for(var r=0;r<i.length;r++){var l=i[r],u=l.event;l=l.listeners;e:{var h=void 0;if(s)for(var v=l.length-1;0<=v;v--){var w=l[v],D=w.instance,P=w.currentTarget;if(w=w.listener,D!==h&&u.isPropagationStopped())break e;h=w,u.currentTarget=P;try{h(u)}catch(se){zo(se)}u.currentTarget=null,h=D}else for(v=0;v<l.length;v++){if(w=l[v],D=w.instance,P=w.currentTarget,w=w.listener,D!==h&&u.isPropagationStopped())break e;h=w,u.currentTarget=P;try{h(u)}catch(se){zo(se)}u.currentTarget=null,h=D}}}}function Ve(i,s){var r=s[Xs];r===void 0&&(r=s[Xs]=new Set);var l=i+"__bubble";r.has(l)||(Lg(s,i,2,!1),r.add(l))}function wd(i,s,r){var l=0;s&&(l|=4),Lg(r,i,l,s)}var wc="_reactListening"+Math.random().toString(36).slice(2);function Cd(i){if(!i[wc]){i[wc]=!0,Qi.forEach(function(r){r!=="selectionchange"&&(lC.has(r)||wd(r,!1,i),wd(r,!0,i))});var s=i.nodeType===9?i:i.ownerDocument;s===null||s[wc]||(s[wc]=!0,wd("selectionchange",!1,s))}}function Lg(i,s,r,l){switch(cy(s)){case 2:var u=OC;break;case 8:u=zC;break;default:u=Hd}r=u.bind(null,s,r,i),u=void 0,!Fu||s!=="touchstart"&&s!=="touchmove"&&s!=="wheel"||(u=!0),l?u!==void 0?i.addEventListener(s,r,{capture:!0,passive:u}):i.addEventListener(s,r,!0):u!==void 0?i.addEventListener(s,r,{passive:u}):i.addEventListener(s,r,!1)}function xd(i,s,r,l,u){var h=l;if((s&1)===0&&(s&2)===0&&l!==null)e:for(;;){if(l===null)return;var v=l.tag;if(v===3||v===4){var w=l.stateNode.containerInfo;if(w===u)break;if(v===4)for(v=l.return;v!==null;){var D=v.tag;if((D===3||D===4)&&v.stateNode.containerInfo===u)return;v=v.return}for(;w!==null;){if(v=Ls(w),v===null)return;if(D=v.tag,D===5||D===6||D===26||D===27){l=h=v;continue e}w=w.parentNode}}l=l.return}Um(function(){var P=h,se=Ku(r),le=[];e:{var Y=f_.get(i);if(Y!==void 0){var Z=Bo,be=i;switch(i){case"keypress":if(Ao(r)===0)break e;case"keydown":case"keyup":Z=e1;break;case"focusin":be="focus",Z=$u;break;case"focusout":be="blur",Z=$u;break;case"beforeblur":case"afterblur":Z=$u;break;case"click":if(r.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":Z=Im;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":Z=Iw;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":Z=s1;break;case c_:case u_:case h_:Z=Ww;break;case d_:Z=r1;break;case"scroll":case"scrollend":Z=Pw;break;case"wheel":Z=l1;break;case"copy":case"cut":case"paste":Z=$w;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":Z=qm;break;case"toggle":case"beforetoggle":Z=c1}var Ae=(s&4)!==0,ft=!Ae&&(i==="scroll"||i==="scrollend"),z=Ae?Y!==null?Y+"Capture":null:Y;Ae=[];for(var N=P,U;N!==null;){var ne=N;if(U=ne.stateNode,ne=ne.tag,ne!==5&&ne!==26&&ne!==27||U===null||z===null||(ne=Fa(N,z),ne!=null&&Ae.push(wl(N,ne,U))),ft)break;N=N.return}0<Ae.length&&(Y=new Z(Y,be,null,r,se),le.push({event:Y,listeners:Ae}))}}if((s&7)===0){e:{if(Y=i==="mouseover"||i==="pointerover",Z=i==="mouseout"||i==="pointerout",Y&&r!==Pu&&(be=r.relatedTarget||r.fromElement)&&(Ls(be)||be[us]))break e;if((Z||Y)&&(Y=se.window===se?se:(Y=se.ownerDocument)?Y.defaultView||Y.parentWindow:window,Z?(be=r.relatedTarget||r.toElement,Z=P,be=be?Ls(be):null,be!==null&&(ft=c(be),Ae=be.tag,be!==ft||Ae!==5&&Ae!==27&&Ae!==6)&&(be=null)):(Z=null,be=P),Z!==be)){if(Ae=Im,ne="onMouseLeave",z="onMouseEnter",N="mouse",(i==="pointerout"||i==="pointerover")&&(Ae=qm,ne="onPointerLeave",z="onPointerEnter",N="pointer"),ft=Z==null?Y:Ds(Z),U=be==null?Y:Ds(be),Y=new Ae(ne,N+"leave",Z,r,se),Y.target=ft,Y.relatedTarget=U,ne=null,Ls(se)===P&&(Ae=new Ae(z,N+"enter",be,r,se),Ae.target=U,Ae.relatedTarget=ft,ne=Ae),ft=ne,Z&&be)t:{for(Ae=oC,z=Z,N=be,U=0,ne=z;ne;ne=Ae(ne))U++;ne=0;for(var Me=N;Me;Me=Ae(Me))ne++;for(;0<U-ne;)z=Ae(z),U--;for(;0<ne-U;)N=Ae(N),ne--;for(;U--;){if(z===N||N!==null&&z===N.alternate){Ae=z;break t}z=Ae(z),N=Ae(N)}Ae=null}else Ae=null;Z!==null&&Og(le,Y,Z,Ae,!1),be!==null&&ft!==null&&Og(le,ft,be,Ae,!0)}}e:{if(Y=P?Ds(P):window,Z=Y.nodeName&&Y.nodeName.toLowerCase(),Z==="select"||Z==="input"&&Y.type==="file")var tt=Qm;else if(Gm(Y))if(Jm)tt=y1;else{tt=v1;var Te=_1}else Z=Y.nodeName,!Z||Z.toLowerCase()!=="input"||Y.type!=="checkbox"&&Y.type!=="radio"?P&&Uu(P.elementType)&&(tt=Qm):tt=g1;if(tt&&(tt=tt(i,P))){Zm(le,tt,r,se);break e}Te&&Te(i,Y,P),i==="focusout"&&P&&Y.type==="number"&&P.memoizedProps.value!=null&&Hu(Y,"number",Y.value)}switch(Te=P?Ds(P):window,i){case"focusin":(Gm(Te)||Te.contentEditable==="true")&&(Gr=Te,Ju=P,Za=null);break;case"focusout":Za=Ju=Gr=null;break;case"mousedown":eh=!0;break;case"contextmenu":case"mouseup":case"dragend":eh=!1,l_(le,r,se);break;case"selectionchange":if(b1)break;case"keydown":case"keyup":l_(le,r,se)}var Fe;if(Xu)e:{switch(i){case"compositionstart":var Qe="onCompositionStart";break e;case"compositionend":Qe="onCompositionEnd";break e;case"compositionupdate":Qe="onCompositionUpdate";break e}Qe=void 0}else Xr?Vm(i,r)&&(Qe="onCompositionEnd"):i==="keydown"&&r.keyCode===229&&(Qe="onCompositionStart");Qe&&(Wm&&r.locale!=="ko"&&(Xr||Qe!=="onCompositionStart"?Qe==="onCompositionEnd"&&Xr&&(Fe=Pm()):(Tn=se,qu="value"in Tn?Tn.value:Tn.textContent,Xr=!0)),Te=Cc(P,Qe),0<Te.length&&(Qe=new Fm(Qe,i,null,r,se),le.push({event:Qe,listeners:Te}),Fe?Qe.data=Fe:(Fe=Xm(r),Fe!==null&&(Qe.data=Fe)))),(Fe=h1?d1(i,r):f1(i,r))&&(Qe=Cc(P,"onBeforeInput"),0<Qe.length&&(Te=new Fm("onBeforeInput","beforeinput",null,r,se),le.push({event:Te,listeners:Qe}),Te.data=Fe)),nC(le,i,P,r,se)}Bg(le,s)})}function wl(i,s,r){return{instance:i,listener:s,currentTarget:r}}function Cc(i,s){for(var r=s+"Capture",l=[];i!==null;){var u=i,h=u.stateNode;if(u=u.tag,u!==5&&u!==26&&u!==27||h===null||(u=Fa(i,r),u!=null&&l.unshift(wl(i,u,h)),u=Fa(i,s),u!=null&&l.push(wl(i,u,h))),i.tag===3)return l;i=i.return}return[]}function oC(i){if(i===null)return null;do i=i.return;while(i&&i.tag!==5&&i.tag!==27);return i||null}function Og(i,s,r,l,u){for(var h=s._reactName,v=[];r!==null&&r!==l;){var w=r,D=w.alternate,P=w.stateNode;if(w=w.tag,D!==null&&D===l)break;w!==5&&w!==26&&w!==27||P===null||(D=P,u?(P=Fa(r,h),P!=null&&v.unshift(wl(r,P,D))):u||(P=Fa(r,h),P!=null&&v.push(wl(r,P,D)))),r=r.return}v.length!==0&&i.push({event:s,listeners:v})}var cC=/\r\n?/g,uC=/\u0000|\uFFFD/g;function zg(i){return(typeof i=="string"?i:""+i).replace(cC,`
9
- `).replace(uC,"")}function jg(i,s){return s=zg(s),zg(i)===s}function dt(i,s,r,l,u,h){switch(r){case"children":typeof l=="string"?s==="body"||s==="textarea"&&l===""||Yr(i,l):(typeof l=="number"||typeof l=="bigint")&&s!=="body"&&Yr(i,""+l);break;case"className":K(i,"class",l);break;case"tabIndex":K(i,"tabindex",l);break;case"dir":case"role":case"viewBox":case"width":case"height":K(i,r,l);break;case"style":jm(i,l,h);break;case"data":if(s!=="object"){K(i,"data",l);break}case"src":case"href":if(l===""&&(s!=="a"||r!=="href")){i.removeAttribute(r);break}if(l==null||typeof l=="function"||typeof l=="symbol"||typeof l=="boolean"){i.removeAttribute(r);break}l=Ro(""+l),i.setAttribute(r,l);break;case"action":case"formAction":if(typeof l=="function"){i.setAttribute(r,"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 h=="function"&&(r==="formAction"?(s!=="input"&&dt(i,s,"name",u.name,u,null),dt(i,s,"formEncType",u.formEncType,u,null),dt(i,s,"formMethod",u.formMethod,u,null),dt(i,s,"formTarget",u.formTarget,u,null)):(dt(i,s,"encType",u.encType,u,null),dt(i,s,"method",u.method,u,null),dt(i,s,"target",u.target,u,null)));if(l==null||typeof l=="symbol"||typeof l=="boolean"){i.removeAttribute(r);break}l=Ro(""+l),i.setAttribute(r,l);break;case"onClick":l!=null&&(i.onclick=Gs);break;case"onScroll":l!=null&&Ve("scroll",i);break;case"onScrollEnd":l!=null&&Ve("scrollend",i);break;case"dangerouslySetInnerHTML":if(l!=null){if(typeof l!="object"||!("__html"in l))throw Error(a(61));if(r=l.__html,r!=null){if(u.children!=null)throw Error(a(60));i.innerHTML=r}}break;case"multiple":i.multiple=l&&typeof l!="function"&&typeof l!="symbol";break;case"muted":i.muted=l&&typeof l!="function"&&typeof l!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(l==null||typeof l=="function"||typeof l=="boolean"||typeof l=="symbol"){i.removeAttribute("xlink:href");break}r=Ro(""+l),i.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",r);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":l!=null&&typeof l!="function"&&typeof l!="symbol"?i.setAttribute(r,""+l):i.removeAttribute(r);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":l&&typeof l!="function"&&typeof l!="symbol"?i.setAttribute(r,""):i.removeAttribute(r);break;case"capture":case"download":l===!0?i.setAttribute(r,""):l!==!1&&l!=null&&typeof l!="function"&&typeof l!="symbol"?i.setAttribute(r,l):i.removeAttribute(r);break;case"cols":case"rows":case"size":case"span":l!=null&&typeof l!="function"&&typeof l!="symbol"&&!isNaN(l)&&1<=l?i.setAttribute(r,l):i.removeAttribute(r);break;case"rowSpan":case"start":l==null||typeof l=="function"||typeof l=="symbol"||isNaN(l)?i.removeAttribute(r):i.setAttribute(r,l);break;case"popover":Ve("beforetoggle",i),Ve("toggle",i),A(i,"popover",l);break;case"xlinkActuate":ue(i,"http://www.w3.org/1999/xlink","xlink:actuate",l);break;case"xlinkArcrole":ue(i,"http://www.w3.org/1999/xlink","xlink:arcrole",l);break;case"xlinkRole":ue(i,"http://www.w3.org/1999/xlink","xlink:role",l);break;case"xlinkShow":ue(i,"http://www.w3.org/1999/xlink","xlink:show",l);break;case"xlinkTitle":ue(i,"http://www.w3.org/1999/xlink","xlink:title",l);break;case"xlinkType":ue(i,"http://www.w3.org/1999/xlink","xlink:type",l);break;case"xmlBase":ue(i,"http://www.w3.org/XML/1998/namespace","xml:base",l);break;case"xmlLang":ue(i,"http://www.w3.org/XML/1998/namespace","xml:lang",l);break;case"xmlSpace":ue(i,"http://www.w3.org/XML/1998/namespace","xml:space",l);break;case"is":A(i,"is",l);break;case"innerText":case"textContent":break;default:(!(2<r.length)||r[0]!=="o"&&r[0]!=="O"||r[1]!=="n"&&r[1]!=="N")&&(r=Hw.get(r)||r,A(i,r,l))}}function Ed(i,s,r,l,u,h){switch(r){case"style":jm(i,l,h);break;case"dangerouslySetInnerHTML":if(l!=null){if(typeof l!="object"||!("__html"in l))throw Error(a(61));if(r=l.__html,r!=null){if(u.children!=null)throw Error(a(60));i.innerHTML=r}}break;case"children":typeof l=="string"?Yr(i,l):(typeof l=="number"||typeof l=="bigint")&&Yr(i,""+l);break;case"onScroll":l!=null&&Ve("scroll",i);break;case"onScrollEnd":l!=null&&Ve("scrollend",i);break;case"onClick":l!=null&&(i.onclick=Gs);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Ir.hasOwnProperty(r))e:{if(r[0]==="o"&&r[1]==="n"&&(u=r.endsWith("Capture"),s=r.slice(2,u?r.length-7:void 0),h=i[Yt]||null,h=h!=null?h[r]:null,typeof h=="function"&&i.removeEventListener(s,h,u),typeof l=="function")){typeof h!="function"&&h!==null&&(r in i?i[r]=null:i.hasAttribute(r)&&i.removeAttribute(r)),i.addEventListener(s,l,u);break e}r in i?i[r]=l:l===!0?i.setAttribute(r,""):A(i,r,l)}}}function Ci(i,s,r){switch(s){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Ve("error",i),Ve("load",i);var l=!1,u=!1,h;for(h in r)if(r.hasOwnProperty(h)){var v=r[h];if(v!=null)switch(h){case"src":l=!0;break;case"srcSet":u=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(a(137,s));default:dt(i,s,h,v,r,null)}}u&&dt(i,s,"srcSet",r.srcSet,r,null),l&&dt(i,s,"src",r.src,r,null);return;case"input":Ve("invalid",i);var w=h=v=u=null,D=null,P=null;for(l in r)if(r.hasOwnProperty(l)){var se=r[l];if(se!=null)switch(l){case"name":u=se;break;case"type":v=se;break;case"checked":D=se;break;case"defaultChecked":P=se;break;case"value":h=se;break;case"defaultValue":w=se;break;case"children":case"dangerouslySetInnerHTML":if(se!=null)throw Error(a(137,s));break;default:dt(i,s,l,se,r,null)}}Ia(i,h,w,D,P,v,u,!1);return;case"select":Ve("invalid",i),l=v=h=null;for(u in r)if(r.hasOwnProperty(u)&&(w=r[u],w!=null))switch(u){case"value":h=w;break;case"defaultValue":v=w;break;case"multiple":l=w;default:dt(i,s,u,w,r,null)}s=h,r=v,i.multiple=!!l,s!=null?Wr(i,!!l,s,!1):r!=null&&Wr(i,!!l,r,!0);return;case"textarea":Ve("invalid",i),h=u=l=null;for(v in r)if(r.hasOwnProperty(v)&&(w=r[v],w!=null))switch(v){case"value":l=w;break;case"defaultValue":u=w;break;case"children":h=w;break;case"dangerouslySetInnerHTML":if(w!=null)throw Error(a(91));break;default:dt(i,s,v,w,r,null)}Om(i,l,u,h);return;case"option":for(D in r)r.hasOwnProperty(D)&&(l=r[D],l!=null)&&(D==="selected"?i.selected=l&&typeof l!="function"&&typeof l!="symbol":dt(i,s,D,l,r,null));return;case"dialog":Ve("beforetoggle",i),Ve("toggle",i),Ve("cancel",i),Ve("close",i);break;case"iframe":case"object":Ve("load",i);break;case"video":case"audio":for(l=0;l<bl.length;l++)Ve(bl[l],i);break;case"image":Ve("error",i),Ve("load",i);break;case"details":Ve("toggle",i);break;case"embed":case"source":case"link":Ve("error",i),Ve("load",i);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(P in r)if(r.hasOwnProperty(P)&&(l=r[P],l!=null))switch(P){case"children":case"dangerouslySetInnerHTML":throw Error(a(137,s));default:dt(i,s,P,l,r,null)}return;default:if(Uu(s)){for(se in r)r.hasOwnProperty(se)&&(l=r[se],l!==void 0&&Ed(i,s,se,l,r,void 0));return}}for(w in r)r.hasOwnProperty(w)&&(l=r[w],l!=null&&dt(i,s,w,l,r,null))}function hC(i,s,r,l){switch(s){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var u=null,h=null,v=null,w=null,D=null,P=null,se=null;for(Z in r){var le=r[Z];if(r.hasOwnProperty(Z)&&le!=null)switch(Z){case"checked":break;case"value":break;case"defaultValue":D=le;default:l.hasOwnProperty(Z)||dt(i,s,Z,null,l,le)}}for(var Y in l){var Z=l[Y];if(le=r[Y],l.hasOwnProperty(Y)&&(Z!=null||le!=null))switch(Y){case"type":h=Z;break;case"name":u=Z;break;case"checked":P=Z;break;case"defaultChecked":se=Z;break;case"value":v=Z;break;case"defaultValue":w=Z;break;case"children":case"dangerouslySetInnerHTML":if(Z!=null)throw Error(a(137,s));break;default:Z!==le&&dt(i,s,Y,Z,l,le)}}qr(i,v,w,D,P,se,h,u);return;case"select":Z=v=w=Y=null;for(h in r)if(D=r[h],r.hasOwnProperty(h)&&D!=null)switch(h){case"value":break;case"multiple":Z=D;default:l.hasOwnProperty(h)||dt(i,s,h,null,l,D)}for(u in l)if(h=l[u],D=r[u],l.hasOwnProperty(u)&&(h!=null||D!=null))switch(u){case"value":Y=h;break;case"defaultValue":w=h;break;case"multiple":v=h;default:h!==D&&dt(i,s,u,h,l,D)}s=w,r=v,l=Z,Y!=null?Wr(i,!!r,Y,!1):!!l!=!!r&&(s!=null?Wr(i,!!r,s,!0):Wr(i,!!r,r?[]:"",!1));return;case"textarea":Z=Y=null;for(w in r)if(u=r[w],r.hasOwnProperty(w)&&u!=null&&!l.hasOwnProperty(w))switch(w){case"value":break;case"children":break;default:dt(i,s,w,null,l,u)}for(v in l)if(u=l[v],h=r[v],l.hasOwnProperty(v)&&(u!=null||h!=null))switch(v){case"value":Y=u;break;case"defaultValue":Z=u;break;case"children":break;case"dangerouslySetInnerHTML":if(u!=null)throw Error(a(91));break;default:u!==h&&dt(i,s,v,u,l,h)}Lm(i,Y,Z);return;case"option":for(var be in r)Y=r[be],r.hasOwnProperty(be)&&Y!=null&&!l.hasOwnProperty(be)&&(be==="selected"?i.selected=!1:dt(i,s,be,null,l,Y));for(D in l)Y=l[D],Z=r[D],l.hasOwnProperty(D)&&Y!==Z&&(Y!=null||Z!=null)&&(D==="selected"?i.selected=Y&&typeof Y!="function"&&typeof Y!="symbol":dt(i,s,D,Y,l,Z));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 Ae in r)Y=r[Ae],r.hasOwnProperty(Ae)&&Y!=null&&!l.hasOwnProperty(Ae)&&dt(i,s,Ae,null,l,Y);for(P in l)if(Y=l[P],Z=r[P],l.hasOwnProperty(P)&&Y!==Z&&(Y!=null||Z!=null))switch(P){case"children":case"dangerouslySetInnerHTML":if(Y!=null)throw Error(a(137,s));break;default:dt(i,s,P,Y,l,Z)}return;default:if(Uu(s)){for(var ft in r)Y=r[ft],r.hasOwnProperty(ft)&&Y!==void 0&&!l.hasOwnProperty(ft)&&Ed(i,s,ft,void 0,l,Y);for(se in l)Y=l[se],Z=r[se],!l.hasOwnProperty(se)||Y===Z||Y===void 0&&Z===void 0||Ed(i,s,se,Y,l,Z);return}}for(var z in r)Y=r[z],r.hasOwnProperty(z)&&Y!=null&&!l.hasOwnProperty(z)&&dt(i,s,z,null,l,Y);for(le in l)Y=l[le],Z=r[le],!l.hasOwnProperty(le)||Y===Z||Y==null&&Z==null||dt(i,s,le,Y,l,Z)}function Hg(i){switch(i){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function dC(){if(typeof performance.getEntriesByType=="function"){for(var i=0,s=0,r=performance.getEntriesByType("resource"),l=0;l<r.length;l++){var u=r[l],h=u.transferSize,v=u.initiatorType,w=u.duration;if(h&&w&&Hg(v)){for(v=0,w=u.responseEnd,l+=1;l<r.length;l++){var D=r[l],P=D.startTime;if(P>w)break;var se=D.transferSize,le=D.initiatorType;se&&Hg(le)&&(D=D.responseEnd,v+=se*(D<w?1:(w-P)/(D-P)))}if(--l,s+=8*(h+v)/(u.duration/1e3),i++,10<i)break}}if(0<i)return s/i/1e6}return navigator.connection&&(i=navigator.connection.downlink,typeof i=="number")?i:5}var Td=null,kd=null;function xc(i){return i.nodeType===9?i:i.ownerDocument}function Ug(i){switch(i){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function Pg(i,s){if(i===0)switch(s){case"svg":return 1;case"math":return 2;default:return 0}return i===1&&s==="foreignObject"?0:i}function Dd(i,s){return i==="textarea"||i==="noscript"||typeof s.children=="string"||typeof s.children=="number"||typeof s.children=="bigint"||typeof s.dangerouslySetInnerHTML=="object"&&s.dangerouslySetInnerHTML!==null&&s.dangerouslySetInnerHTML.__html!=null}var Rd=null;function fC(){var i=window.event;return i&&i.type==="popstate"?i===Rd?!1:(Rd=i,!0):(Rd=null,!1)}var Kg=typeof setTimeout=="function"?setTimeout:void 0,pC=typeof clearTimeout=="function"?clearTimeout:void 0,Ig=typeof Promise=="function"?Promise:void 0,mC=typeof queueMicrotask=="function"?queueMicrotask:typeof Ig<"u"?function(i){return Ig.resolve(null).then(i).catch(_C)}:Kg;function _C(i){setTimeout(function(){throw i})}function Fn(i){return i==="head"}function Fg(i,s){var r=s,l=0;do{var u=r.nextSibling;if(i.removeChild(r),u&&u.nodeType===8)if(r=u.data,r==="/$"||r==="/&"){if(l===0){i.removeChild(u),Ca(s);return}l--}else if(r==="$"||r==="$?"||r==="$~"||r==="$!"||r==="&")l++;else if(r==="html")Cl(i.ownerDocument.documentElement);else if(r==="head"){r=i.ownerDocument.head,Cl(r);for(var h=r.firstChild;h;){var v=h.nextSibling,w=h.nodeName;h[Gi]||w==="SCRIPT"||w==="STYLE"||w==="LINK"&&h.rel.toLowerCase()==="stylesheet"||r.removeChild(h),h=v}}else r==="body"&&Cl(i.ownerDocument.body);r=u}while(r);Ca(s)}function qg(i,s){var r=i;i=0;do{var l=r.nextSibling;if(r.nodeType===1?s?(r._stashedDisplay=r.style.display,r.style.display="none"):(r.style.display=r._stashedDisplay||"",r.getAttribute("style")===""&&r.removeAttribute("style")):r.nodeType===3&&(s?(r._stashedText=r.nodeValue,r.nodeValue=""):r.nodeValue=r._stashedText||""),l&&l.nodeType===8)if(r=l.data,r==="/$"){if(i===0)break;i--}else r!=="$"&&r!=="$?"&&r!=="$~"&&r!=="$!"||i++;r=l}while(r)}function Md(i){var s=i.firstChild;for(s&&s.nodeType===10&&(s=s.nextSibling);s;){var r=s;switch(s=s.nextSibling,r.nodeName){case"HTML":case"HEAD":case"BODY":Md(r),En(r);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(r.rel.toLowerCase()==="stylesheet")continue}i.removeChild(r)}}function vC(i,s,r,l){for(;i.nodeType===1;){var u=r;if(i.nodeName.toLowerCase()!==s.toLowerCase()){if(!l&&(i.nodeName!=="INPUT"||i.type!=="hidden"))break}else if(l){if(!i[Gi])switch(s){case"meta":if(!i.hasAttribute("itemprop"))break;return i;case"link":if(h=i.getAttribute("rel"),h==="stylesheet"&&i.hasAttribute("data-precedence"))break;if(h!==u.rel||i.getAttribute("href")!==(u.href==null||u.href===""?null:u.href)||i.getAttribute("crossorigin")!==(u.crossOrigin==null?null:u.crossOrigin)||i.getAttribute("title")!==(u.title==null?null:u.title))break;return i;case"style":if(i.hasAttribute("data-precedence"))break;return i;case"script":if(h=i.getAttribute("src"),(h!==(u.src==null?null:u.src)||i.getAttribute("type")!==(u.type==null?null:u.type)||i.getAttribute("crossorigin")!==(u.crossOrigin==null?null:u.crossOrigin))&&h&&i.hasAttribute("async")&&!i.hasAttribute("itemprop"))break;return i;default:return i}}else if(s==="input"&&i.type==="hidden"){var h=u.name==null?null:""+u.name;if(u.type==="hidden"&&i.getAttribute("name")===h)return i}else return i;if(i=vs(i.nextSibling),i===null)break}return null}function gC(i,s,r){if(s==="")return null;for(;i.nodeType!==3;)if((i.nodeType!==1||i.nodeName!=="INPUT"||i.type!=="hidden")&&!r||(i=vs(i.nextSibling),i===null))return null;return i}function Wg(i,s){for(;i.nodeType!==8;)if((i.nodeType!==1||i.nodeName!=="INPUT"||i.type!=="hidden")&&!s||(i=vs(i.nextSibling),i===null))return null;return i}function Ad(i){return i.data==="$?"||i.data==="$~"}function Nd(i){return i.data==="$!"||i.data==="$?"&&i.ownerDocument.readyState!=="loading"}function yC(i,s){var r=i.ownerDocument;if(i.data==="$~")i._reactRetry=s;else if(i.data!=="$?"||r.readyState!=="loading")s();else{var l=function(){s(),r.removeEventListener("DOMContentLoaded",l)};r.addEventListener("DOMContentLoaded",l),i._reactRetry=l}}function vs(i){for(;i!=null;i=i.nextSibling){var s=i.nodeType;if(s===1||s===3)break;if(s===8){if(s=i.data,s==="$"||s==="$!"||s==="$?"||s==="$~"||s==="&"||s==="F!"||s==="F")break;if(s==="/$"||s==="/&")return null}}return i}var Bd=null;function Yg(i){i=i.nextSibling;for(var s=0;i;){if(i.nodeType===8){var r=i.data;if(r==="/$"||r==="/&"){if(s===0)return vs(i.nextSibling);s--}else r!=="$"&&r!=="$!"&&r!=="$?"&&r!=="$~"&&r!=="&"||s++}i=i.nextSibling}return null}function $g(i){i=i.previousSibling;for(var s=0;i;){if(i.nodeType===8){var r=i.data;if(r==="$"||r==="$!"||r==="$?"||r==="$~"||r==="&"){if(s===0)return i;s--}else r!=="/$"&&r!=="/&"||s++}i=i.previousSibling}return null}function Vg(i,s,r){switch(s=xc(r),i){case"html":if(i=s.documentElement,!i)throw Error(a(452));return i;case"head":if(i=s.head,!i)throw Error(a(453));return i;case"body":if(i=s.body,!i)throw Error(a(454));return i;default:throw Error(a(451))}}function Cl(i){for(var s=i.attributes;s.length;)i.removeAttributeNode(s[0]);En(i)}var gs=new Map,Xg=new Set;function Ec(i){return typeof i.getRootNode=="function"?i.getRootNode():i.nodeType===9?i:i.ownerDocument}var fn=V.d;V.d={f:SC,r:bC,D:wC,C:CC,L:xC,m:EC,X:kC,S:TC,M:DC};function SC(){var i=fn.f(),s=_c();return i||s}function bC(i){var s=Os(i);s!==null&&s.tag===5&&s.type==="form"?dv(s):fn.r(i)}var Sa=typeof document>"u"?null:document;function Gg(i,s,r){var l=Sa;if(l&&typeof s=="string"&&s){var u=Ut(s);u='link[rel="'+i+'"][href="'+u+'"]',typeof r=="string"&&(u+='[crossorigin="'+r+'"]'),Xg.has(u)||(Xg.add(u),i={rel:i,crossOrigin:r,href:s},l.querySelector(u)===null&&(s=l.createElement("link"),Ci(s,"link",i),Lt(s),l.head.appendChild(s)))}}function wC(i){fn.D(i),Gg("dns-prefetch",i,null)}function CC(i,s){fn.C(i,s),Gg("preconnect",i,s)}function xC(i,s,r){fn.L(i,s,r);var l=Sa;if(l&&i&&s){var u='link[rel="preload"][as="'+Ut(s)+'"]';s==="image"&&r&&r.imageSrcSet?(u+='[imagesrcset="'+Ut(r.imageSrcSet)+'"]',typeof r.imageSizes=="string"&&(u+='[imagesizes="'+Ut(r.imageSizes)+'"]')):u+='[href="'+Ut(i)+'"]';var h=u;switch(s){case"style":h=ba(i);break;case"script":h=wa(i)}gs.has(h)||(i=y({rel:"preload",href:s==="image"&&r&&r.imageSrcSet?void 0:i,as:s},r),gs.set(h,i),l.querySelector(u)!==null||s==="style"&&l.querySelector(xl(h))||s==="script"&&l.querySelector(El(h))||(s=l.createElement("link"),Ci(s,"link",i),Lt(s),l.head.appendChild(s)))}}function EC(i,s){fn.m(i,s);var r=Sa;if(r&&i){var l=s&&typeof s.as=="string"?s.as:"script",u='link[rel="modulepreload"][as="'+Ut(l)+'"][href="'+Ut(i)+'"]',h=u;switch(l){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":h=wa(i)}if(!gs.has(h)&&(i=y({rel:"modulepreload",href:i},s),gs.set(h,i),r.querySelector(u)===null)){switch(l){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(r.querySelector(El(h)))return}l=r.createElement("link"),Ci(l,"link",i),Lt(l),r.head.appendChild(l)}}}function TC(i,s,r){fn.S(i,s,r);var l=Sa;if(l&&i){var u=Zi(l).hoistableStyles,h=ba(i);s=s||"default";var v=u.get(h);if(!v){var w={loading:0,preload:null};if(v=l.querySelector(xl(h)))w.loading=5;else{i=y({rel:"stylesheet",href:i,"data-precedence":s},r),(r=gs.get(h))&&Ld(i,r);var D=v=l.createElement("link");Lt(D),Ci(D,"link",i),D._p=new Promise(function(P,se){D.onload=P,D.onerror=se}),D.addEventListener("load",function(){w.loading|=1}),D.addEventListener("error",function(){w.loading|=2}),w.loading|=4,Tc(v,s,l)}v={type:"stylesheet",instance:v,count:1,state:w},u.set(h,v)}}}function kC(i,s){fn.X(i,s);var r=Sa;if(r&&i){var l=Zi(r).hoistableScripts,u=wa(i),h=l.get(u);h||(h=r.querySelector(El(u)),h||(i=y({src:i,async:!0},s),(s=gs.get(u))&&Od(i,s),h=r.createElement("script"),Lt(h),Ci(h,"link",i),r.head.appendChild(h)),h={type:"script",instance:h,count:1,state:null},l.set(u,h))}}function DC(i,s){fn.M(i,s);var r=Sa;if(r&&i){var l=Zi(r).hoistableScripts,u=wa(i),h=l.get(u);h||(h=r.querySelector(El(u)),h||(i=y({src:i,async:!0,type:"module"},s),(s=gs.get(u))&&Od(i,s),h=r.createElement("script"),Lt(h),Ci(h,"link",i),r.head.appendChild(h)),h={type:"script",instance:h,count:1,state:null},l.set(u,h))}}function Zg(i,s,r,l){var u=(u=me.current)?Ec(u):null;if(!u)throw Error(a(446));switch(i){case"meta":case"title":return null;case"style":return typeof r.precedence=="string"&&typeof r.href=="string"?(s=ba(r.href),r=Zi(u).hoistableStyles,l=r.get(s),l||(l={type:"style",instance:null,count:0,state:null},r.set(s,l)),l):{type:"void",instance:null,count:0,state:null};case"link":if(r.rel==="stylesheet"&&typeof r.href=="string"&&typeof r.precedence=="string"){i=ba(r.href);var h=Zi(u).hoistableStyles,v=h.get(i);if(v||(u=u.ownerDocument||u,v={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},h.set(i,v),(h=u.querySelector(xl(i)))&&!h._p&&(v.instance=h,v.state.loading=5),gs.has(i)||(r={rel:"preload",as:"style",href:r.href,crossOrigin:r.crossOrigin,integrity:r.integrity,media:r.media,hrefLang:r.hrefLang,referrerPolicy:r.referrerPolicy},gs.set(i,r),h||RC(u,i,r,v.state))),s&&l===null)throw Error(a(528,""));return v}if(s&&l!==null)throw Error(a(529,""));return null;case"script":return s=r.async,r=r.src,typeof r=="string"&&s&&typeof s!="function"&&typeof s!="symbol"?(s=wa(r),r=Zi(u).hoistableScripts,l=r.get(s),l||(l={type:"script",instance:null,count:0,state:null},r.set(s,l)),l):{type:"void",instance:null,count:0,state:null};default:throw Error(a(444,i))}}function ba(i){return'href="'+Ut(i)+'"'}function xl(i){return'link[rel="stylesheet"]['+i+"]"}function Qg(i){return y({},i,{"data-precedence":i.precedence,precedence:null})}function RC(i,s,r,l){i.querySelector('link[rel="preload"][as="style"]['+s+"]")?l.loading=1:(s=i.createElement("link"),l.preload=s,s.addEventListener("load",function(){return l.loading|=1}),s.addEventListener("error",function(){return l.loading|=2}),Ci(s,"link",r),Lt(s),i.head.appendChild(s))}function wa(i){return'[src="'+Ut(i)+'"]'}function El(i){return"script[async]"+i}function Jg(i,s,r){if(s.count++,s.instance===null)switch(s.type){case"style":var l=i.querySelector('style[data-href~="'+Ut(r.href)+'"]');if(l)return s.instance=l,Lt(l),l;var u=y({},r,{"data-href":r.href,"data-precedence":r.precedence,href:null,precedence:null});return l=(i.ownerDocument||i).createElement("style"),Lt(l),Ci(l,"style",u),Tc(l,r.precedence,i),s.instance=l;case"stylesheet":u=ba(r.href);var h=i.querySelector(xl(u));if(h)return s.state.loading|=4,s.instance=h,Lt(h),h;l=Qg(r),(u=gs.get(u))&&Ld(l,u),h=(i.ownerDocument||i).createElement("link"),Lt(h);var v=h;return v._p=new Promise(function(w,D){v.onload=w,v.onerror=D}),Ci(h,"link",l),s.state.loading|=4,Tc(h,r.precedence,i),s.instance=h;case"script":return h=wa(r.src),(u=i.querySelector(El(h)))?(s.instance=u,Lt(u),u):(l=r,(u=gs.get(h))&&(l=y({},r),Od(l,u)),i=i.ownerDocument||i,u=i.createElement("script"),Lt(u),Ci(u,"link",l),i.head.appendChild(u),s.instance=u);case"void":return null;default:throw Error(a(443,s.type))}else s.type==="stylesheet"&&(s.state.loading&4)===0&&(l=s.instance,s.state.loading|=4,Tc(l,r.precedence,i));return s.instance}function Tc(i,s,r){for(var l=r.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),u=l.length?l[l.length-1]:null,h=u,v=0;v<l.length;v++){var w=l[v];if(w.dataset.precedence===s)h=w;else if(h!==u)break}h?h.parentNode.insertBefore(i,h.nextSibling):(s=r.nodeType===9?r.head:r,s.insertBefore(i,s.firstChild))}function Ld(i,s){i.crossOrigin==null&&(i.crossOrigin=s.crossOrigin),i.referrerPolicy==null&&(i.referrerPolicy=s.referrerPolicy),i.title==null&&(i.title=s.title)}function Od(i,s){i.crossOrigin==null&&(i.crossOrigin=s.crossOrigin),i.referrerPolicy==null&&(i.referrerPolicy=s.referrerPolicy),i.integrity==null&&(i.integrity=s.integrity)}var kc=null;function ey(i,s,r){if(kc===null){var l=new Map,u=kc=new Map;u.set(r,l)}else u=kc,l=u.get(r),l||(l=new Map,u.set(r,l));if(l.has(i))return l;for(l.set(i,null),r=r.getElementsByTagName(i),u=0;u<r.length;u++){var h=r[u];if(!(h[Gi]||h[mt]||i==="link"&&h.getAttribute("rel")==="stylesheet")&&h.namespaceURI!=="http://www.w3.org/2000/svg"){var v=h.getAttribute(s)||"";v=i+v;var w=l.get(v);w?w.push(h):l.set(v,[h])}}return l}function ty(i,s,r){i=i.ownerDocument||i,i.head.insertBefore(r,s==="title"?i.querySelector("head > title"):null)}function MC(i,s,r){if(r===1||s.itemProp!=null)return!1;switch(i){case"meta":case"title":return!0;case"style":if(typeof s.precedence!="string"||typeof s.href!="string"||s.href==="")break;return!0;case"link":if(typeof s.rel!="string"||typeof s.href!="string"||s.href===""||s.onLoad||s.onError)break;return s.rel==="stylesheet"?(i=s.disabled,typeof s.precedence=="string"&&i==null):!0;case"script":if(s.async&&typeof s.async!="function"&&typeof s.async!="symbol"&&!s.onLoad&&!s.onError&&s.src&&typeof s.src=="string")return!0}return!1}function iy(i){return!(i.type==="stylesheet"&&(i.state.loading&3)===0)}function AC(i,s,r,l){if(r.type==="stylesheet"&&(typeof l.media!="string"||matchMedia(l.media).matches!==!1)&&(r.state.loading&4)===0){if(r.instance===null){var u=ba(l.href),h=s.querySelector(xl(u));if(h){s=h._p,s!==null&&typeof s=="object"&&typeof s.then=="function"&&(i.count++,i=Dc.bind(i),s.then(i,i)),r.state.loading|=4,r.instance=h,Lt(h);return}h=s.ownerDocument||s,l=Qg(l),(u=gs.get(u))&&Ld(l,u),h=h.createElement("link"),Lt(h);var v=h;v._p=new Promise(function(w,D){v.onload=w,v.onerror=D}),Ci(h,"link",l),r.instance=h}i.stylesheets===null&&(i.stylesheets=new Map),i.stylesheets.set(r,s),(s=r.state.preload)&&(r.state.loading&3)===0&&(i.count++,r=Dc.bind(i),s.addEventListener("load",r),s.addEventListener("error",r))}}var zd=0;function NC(i,s){return i.stylesheets&&i.count===0&&Mc(i,i.stylesheets),0<i.count||0<i.imgCount?function(r){var l=setTimeout(function(){if(i.stylesheets&&Mc(i,i.stylesheets),i.unsuspend){var h=i.unsuspend;i.unsuspend=null,h()}},6e4+s);0<i.imgBytes&&zd===0&&(zd=62500*dC());var u=setTimeout(function(){if(i.waitingForImages=!1,i.count===0&&(i.stylesheets&&Mc(i,i.stylesheets),i.unsuspend)){var h=i.unsuspend;i.unsuspend=null,h()}},(i.imgBytes>zd?50:800)+s);return i.unsuspend=r,function(){i.unsuspend=null,clearTimeout(l),clearTimeout(u)}}:null}function Dc(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Mc(this,this.stylesheets);else if(this.unsuspend){var i=this.unsuspend;this.unsuspend=null,i()}}}var Rc=null;function Mc(i,s){i.stylesheets=null,i.unsuspend!==null&&(i.count++,Rc=new Map,s.forEach(BC,i),Rc=null,Dc.call(i))}function BC(i,s){if(!(s.state.loading&4)){var r=Rc.get(i);if(r)var l=r.get(null);else{r=new Map,Rc.set(i,r);for(var u=i.querySelectorAll("link[data-precedence],style[data-precedence]"),h=0;h<u.length;h++){var v=u[h];(v.nodeName==="LINK"||v.getAttribute("media")!=="not all")&&(r.set(v.dataset.precedence,v),l=v)}l&&r.set(null,l)}u=s.instance,v=u.getAttribute("data-precedence"),h=r.get(v)||l,h===l&&r.set(null,u),r.set(v,u),this.count++,l=Dc.bind(this),u.addEventListener("load",l),u.addEventListener("error",l),h?h.parentNode.insertBefore(u,h.nextSibling):(i=i.nodeType===9?i.head:i,i.insertBefore(u,i.firstChild)),s.state.loading|=4}}var Tl={$$typeof:F,Provider:null,Consumer:null,_currentValue:Q,_currentValue2:Q,_threadCount:0};function LC(i,s,r,l,u,h,v,w,D){this.tag=1,this.containerInfo=i,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=nt(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=nt(0),this.hiddenUpdates=nt(null),this.identifierPrefix=l,this.onUncaughtError=u,this.onCaughtError=h,this.onRecoverableError=v,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=D,this.incompleteTransitions=new Map}function sy(i,s,r,l,u,h,v,w,D,P,se,le){return i=new LC(i,s,r,v,D,P,se,le,w),s=1,h===!0&&(s|=24),h=es(3,null,null,s),i.current=h,h.stateNode=i,s=mh(),s.refCount++,i.pooledCache=s,s.refCount++,h.memoizedState={element:l,isDehydrated:r,cache:s},yh(h),i}function ny(i){return i?(i=Jr,i):Jr}function ry(i,s,r,l,u,h){u=ny(u),l.context===null?l.context=u:l.pendingContext=u,l=Nn(s),l.payload={element:r},h=h===void 0?null:h,h!==null&&(l.callback=h),r=Bn(i,l,s),r!==null&&(Wi(r,i,s),nl(r,i,s))}function ay(i,s){if(i=i.memoizedState,i!==null&&i.dehydrated!==null){var r=i.retryLane;i.retryLane=r!==0&&r<s?r:s}}function jd(i,s){ay(i,s),(i=i.alternate)&&ay(i,s)}function ly(i){if(i.tag===13||i.tag===31){var s=mr(i,67108864);s!==null&&Wi(s,i,67108864),jd(i,67108864)}}function oy(i){if(i.tag===13||i.tag===31){var s=rs();s=Ai(s);var r=mr(i,s);r!==null&&Wi(r,i,s),jd(i,s)}}var Ac=!0;function OC(i,s,r,l){var u=M.T;M.T=null;var h=V.p;try{V.p=2,Hd(i,s,r,l)}finally{V.p=h,M.T=u}}function zC(i,s,r,l){var u=M.T;M.T=null;var h=V.p;try{V.p=8,Hd(i,s,r,l)}finally{V.p=h,M.T=u}}function Hd(i,s,r,l){if(Ac){var u=Ud(l);if(u===null)xd(i,s,l,Nc,r),uy(i,l);else if(HC(u,i,s,r,l))l.stopPropagation();else if(uy(i,l),s&4&&-1<jC.indexOf(i)){for(;u!==null;){var h=Os(u);if(h!==null)switch(h.tag){case 3:if(h=h.stateNode,h.current.memoizedState.isDehydrated){var v=St(h.pendingLanes);if(v!==0){var w=h;for(w.pendingLanes|=2,w.entangledLanes|=2;v;){var D=1<<31-Dt(v);w.entanglements[1]|=D,v&=~D}Ps(h),(st&6)===0&&(pc=He()+500,Sl(0))}}break;case 31:case 13:w=mr(h,2),w!==null&&Wi(w,h,2),_c(),jd(h,2)}if(h=Ud(l),h===null&&xd(i,s,l,Nc,r),h===u)break;u=h}u!==null&&l.stopPropagation()}else xd(i,s,l,null,r)}}function Ud(i){return i=Ku(i),Pd(i)}var Nc=null;function Pd(i){if(Nc=null,i=Ls(i),i!==null){var s=c(i);if(s===null)i=null;else{var r=s.tag;if(r===13){if(i=d(s),i!==null)return i;i=null}else if(r===31){if(i=p(s),i!==null)return i;i=null}else if(r===3){if(s.stateNode.current.memoizedState.isDehydrated)return s.tag===3?s.stateNode.containerInfo:null;i=null}else s!==i&&(i=null)}}return Nc=i,null}function cy(i){switch(i){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(_i()){case Vi:return 2;case ai:return 8;case kt:case ji:return 32;case Ti:return 268435456;default:return 32}default:return 32}}var Kd=!1,qn=null,Wn=null,Yn=null,kl=new Map,Dl=new Map,$n=[],jC="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 uy(i,s){switch(i){case"focusin":case"focusout":qn=null;break;case"dragenter":case"dragleave":Wn=null;break;case"mouseover":case"mouseout":Yn=null;break;case"pointerover":case"pointerout":kl.delete(s.pointerId);break;case"gotpointercapture":case"lostpointercapture":Dl.delete(s.pointerId)}}function Rl(i,s,r,l,u,h){return i===null||i.nativeEvent!==h?(i={blockedOn:s,domEventName:r,eventSystemFlags:l,nativeEvent:h,targetContainers:[u]},s!==null&&(s=Os(s),s!==null&&ly(s)),i):(i.eventSystemFlags|=l,s=i.targetContainers,u!==null&&s.indexOf(u)===-1&&s.push(u),i)}function HC(i,s,r,l,u){switch(s){case"focusin":return qn=Rl(qn,i,s,r,l,u),!0;case"dragenter":return Wn=Rl(Wn,i,s,r,l,u),!0;case"mouseover":return Yn=Rl(Yn,i,s,r,l,u),!0;case"pointerover":var h=u.pointerId;return kl.set(h,Rl(kl.get(h)||null,i,s,r,l,u)),!0;case"gotpointercapture":return h=u.pointerId,Dl.set(h,Rl(Dl.get(h)||null,i,s,r,l,u)),!0}return!1}function hy(i){var s=Ls(i.target);if(s!==null){var r=c(s);if(r!==null){if(s=r.tag,s===13){if(s=d(r),s!==null){i.blockedOn=s,cs(i.priority,function(){oy(r)});return}}else if(s===31){if(s=p(r),s!==null){i.blockedOn=s,cs(i.priority,function(){oy(r)});return}}else if(s===3&&r.stateNode.current.memoizedState.isDehydrated){i.blockedOn=r.tag===3?r.stateNode.containerInfo:null;return}}}i.blockedOn=null}function Bc(i){if(i.blockedOn!==null)return!1;for(var s=i.targetContainers;0<s.length;){var r=Ud(i.nativeEvent);if(r===null){r=i.nativeEvent;var l=new r.constructor(r.type,r);Pu=l,r.target.dispatchEvent(l),Pu=null}else return s=Os(r),s!==null&&ly(s),i.blockedOn=r,!1;s.shift()}return!0}function dy(i,s,r){Bc(i)&&r.delete(s)}function UC(){Kd=!1,qn!==null&&Bc(qn)&&(qn=null),Wn!==null&&Bc(Wn)&&(Wn=null),Yn!==null&&Bc(Yn)&&(Yn=null),kl.forEach(dy),Dl.forEach(dy)}function Lc(i,s){i.blockedOn===s&&(i.blockedOn=null,Kd||(Kd=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,UC)))}var Oc=null;function fy(i){Oc!==i&&(Oc=i,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){Oc===i&&(Oc=null);for(var s=0;s<i.length;s+=3){var r=i[s],l=i[s+1],u=i[s+2];if(typeof l!="function"){if(Pd(l||r)===null)continue;break}var h=Os(r);h!==null&&(i.splice(s,3),s-=3,Uh(h,{pending:!0,data:u,method:r.method,action:l},l,u))}}))}function Ca(i){function s(D){return Lc(D,i)}qn!==null&&Lc(qn,i),Wn!==null&&Lc(Wn,i),Yn!==null&&Lc(Yn,i),kl.forEach(s),Dl.forEach(s);for(var r=0;r<$n.length;r++){var l=$n[r];l.blockedOn===i&&(l.blockedOn=null)}for(;0<$n.length&&(r=$n[0],r.blockedOn===null);)hy(r),r.blockedOn===null&&$n.shift();if(r=(i.ownerDocument||i).$$reactFormReplay,r!=null)for(l=0;l<r.length;l+=3){var u=r[l],h=r[l+1],v=u[Yt]||null;if(typeof h=="function")v||fy(r);else if(v){var w=null;if(h&&h.hasAttribute("formAction")){if(u=h,v=h[Yt]||null)w=v.formAction;else if(Pd(u)!==null)continue}else w=v.action;typeof w=="function"?r[l+1]=w:(r.splice(l,3),l-=3),fy(r)}}}function py(){function i(h){h.canIntercept&&h.info==="react-transition"&&h.intercept({handler:function(){return new Promise(function(v){return u=v})},focusReset:"manual",scroll:"manual"})}function s(){u!==null&&(u(),u=null),l||setTimeout(r,20)}function r(){if(!l&&!navigation.transition){var h=navigation.currentEntry;h&&h.url!=null&&navigation.navigate(h.url,{state:h.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var l=!1,u=null;return navigation.addEventListener("navigate",i),navigation.addEventListener("navigatesuccess",s),navigation.addEventListener("navigateerror",s),setTimeout(r,100),function(){l=!0,navigation.removeEventListener("navigate",i),navigation.removeEventListener("navigatesuccess",s),navigation.removeEventListener("navigateerror",s),u!==null&&(u(),u=null)}}}function Id(i){this._internalRoot=i}zc.prototype.render=Id.prototype.render=function(i){var s=this._internalRoot;if(s===null)throw Error(a(409));var r=s.current,l=rs();ry(r,l,i,s,null,null)},zc.prototype.unmount=Id.prototype.unmount=function(){var i=this._internalRoot;if(i!==null){this._internalRoot=null;var s=i.containerInfo;ry(i.current,2,null,i,null,null),_c(),s[us]=null}};function zc(i){this._internalRoot=i}zc.prototype.unstable_scheduleHydration=function(i){if(i){var s=ki();i={blockedOn:null,target:i,priority:s};for(var r=0;r<$n.length&&s!==0&&s<$n[r].priority;r++);$n.splice(r,0,i),r===0&&hy(i)}};var my=t.version;if(my!=="19.2.6")throw Error(a(527,my,"19.2.6"));V.findDOMNode=function(i){var s=i._reactInternals;if(s===void 0)throw typeof i.render=="function"?Error(a(188)):(i=Object.keys(i).join(","),Error(a(268,i)));return i=f(s),i=i!==null?S(i):null,i=i===null?null:i.stateNode,i};var PC={bundleType:0,version:"19.2.6",rendererPackageName:"react-dom",currentDispatcherRef:M,reconcilerVersion:"19.2.6"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var jc=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!jc.isDisabled&&jc.supportsFiber)try{Hi=jc.inject(PC),qt=jc}catch{}}return Al.createRoot=function(i,s){if(!o(i))throw Error(a(299));var r=!1,l="",u=wv,h=Cv,v=xv;return s!=null&&(s.unstable_strictMode===!0&&(r=!0),s.identifierPrefix!==void 0&&(l=s.identifierPrefix),s.onUncaughtError!==void 0&&(u=s.onUncaughtError),s.onCaughtError!==void 0&&(h=s.onCaughtError),s.onRecoverableError!==void 0&&(v=s.onRecoverableError)),s=sy(i,1,!1,null,null,r,l,null,u,h,v,py),i[us]=s.current,Cd(i),new Id(s)},Al.hydrateRoot=function(i,s,r){if(!o(i))throw Error(a(299));var l=!1,u="",h=wv,v=Cv,w=xv,D=null;return r!=null&&(r.unstable_strictMode===!0&&(l=!0),r.identifierPrefix!==void 0&&(u=r.identifierPrefix),r.onUncaughtError!==void 0&&(h=r.onUncaughtError),r.onCaughtError!==void 0&&(v=r.onCaughtError),r.onRecoverableError!==void 0&&(w=r.onRecoverableError),r.formState!==void 0&&(D=r.formState)),s=sy(i,1,!0,s,r??null,l,u,D,h,v,w,py),s.context=ny(null),r=s.current,l=rs(),l=Ai(l),u=Nn(l),u.callback=null,Bn(r,u,l),r=l,s.current.lanes=r,Wt(s,r),Ps(s),i[us]=s.current,Cd(i),new zc(s)},Al.version="19.2.6",Al}var Ey;function GC(){if(Ey)return Wd.exports;Ey=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(t){console.error(t)}}return e(),Wd.exports=XC(),Wd.exports}var ZC=GC();class yn extends Error{constructor(t,n){super(n),this.status=t,this.name="ApiError"}status}function Eu(e=fetch){return{getSession:()=>we(e,"/api/auth/session"),setupPassword:t=>we(e,"/api/auth/password",et("POST",t)),login:t=>we(e,"/api/auth/login",et("POST",t)),reauth:t=>we(e,"/api/auth/reauth",et("POST",t)),logout:()=>we(e,"/api/auth/logout",{method:"POST",credentials:"same-origin"}),setupTotp:()=>we(e,"/api/auth/totp/setup",{method:"POST",credentials:"same-origin"}),activateTotp:t=>we(e,"/api/auth/totp/activate",et("POST",t)),disableTotp:()=>we(e,"/api/auth/totp",{method:"DELETE",credentials:"same-origin"}),listDevices:()=>we(e,"/api/auth/devices"),revokeDevice:async t=>{await ka(e,`/api/auth/devices/${encodeURIComponent(t)}`,{method:"DELETE",credentials:"same-origin"})},listNetworks:()=>we(e,"/api/auth/networks"),addNetwork:t=>we(e,"/api/auth/networks",et("POST",t)),removeNetwork:async t=>{await ka(e,`/api/auth/networks/${encodeURIComponent(t)}`,{method:"DELETE",credentials:"same-origin"})},listAgents:()=>we(e,"/api/agents"),addAgent:t=>we(e,"/api/agents",et("POST",t)),renameAgent:(t,n)=>we(e,`/api/agents/${encodeURIComponent(t)}`,et("PATCH",{name:n})),getMainInfo:()=>we(e,"/api/main"),renameMain:t=>we(e,"/api/main",et("PATCH",{name:t})),removeAgent:async t=>{await ka(e,`/api/agents/${encodeURIComponent(t)}`,{method:"DELETE",credentials:"same-origin"})},uninstallAgent:t=>we(e,`/api/agents/${encodeURIComponent(t)}/uninstall`,{method:"POST",credentials:"same-origin"}),pingAgent:t=>we(e,`/api/agents/${encodeURIComponent(t)}/ping`),getMainStats:()=>we(e,"/api/stats"),getAgentStats:t=>we(e,`/api/agents/${encodeURIComponent(t)}/stats`),getVersion:()=>we(e,"/api/version"),checkUpdate:()=>we(e,"/api/update/check",{method:"POST",credentials:"same-origin"}),runUpdate:()=>we(e,"/api/update",{method:"POST",credentials:"same-origin"}),getAgentVersion:t=>we(e,`/api/agents/${encodeURIComponent(t)}/version`),checkAgentUpdate:t=>we(e,`/api/agents/${encodeURIComponent(t)}/update/check`,{method:"POST",credentials:"same-origin"}),runAgentUpdate:t=>we(e,`/api/agents/${encodeURIComponent(t)}/update`,{method:"POST",credentials:"same-origin"}),listTerminals:()=>we(e,"/api/terminals"),getTerminalLayout:()=>we(e,"/api/terminal-layout"),saveTerminalLayout:t=>we(e,"/api/terminal-layout",et("PUT",t)),createFileRoot:t=>we(e,"/api/files/root",et("POST",t)),listFiles:t=>we(e,"/api/files/list",et("POST",t)),readFile:t=>we(e,"/api/files/read",et("POST",t)),writeFile:t=>we(e,"/api/files/write",et("POST",t)),createFileEntry:t=>we(e,"/api/files/create",et("POST",t)),moveFileEntry:t=>we(e,"/api/files/move",et("POST",t)),previewDeleteFileEntry:t=>we(e,"/api/files/delete-preview",et("POST",t)),deleteFileEntry:t=>we(e,"/api/files/delete",et("POST",t)),openFileInTerminal:t=>we(e,"/api/files/open",et("POST",t)),previewFile:t=>bb(e,"/api/files/preview",et("POST",t)),createTerminal:(t={})=>we(e,"/api/terminals",et("POST",t)),closeTerminal:async t=>{await ka(e,`/api/terminals/${encodeURIComponent(t)}`,{method:"DELETE",credentials:"same-origin"})},renameTerminal:(t,n)=>we(e,`/api/terminals/${encodeURIComponent(t)}`,et("PATCH",{title:n})),getTerminalHistory:(t,n={})=>we(e,`/api/terminals/${encodeURIComponent(t)}/history${au(n)}`),getTerminalTranscriptHistory:(t,n={})=>we(e,`/api/terminals/${encodeURIComponent(t)}/transcript-history${au(n)}`),getTerminalTranscriptSource:t=>we(e,`/api/terminals/${encodeURIComponent(t)}/transcript-source`),listNotificationAssets:()=>we(e,"/api/notification-assets"),uploadNotificationAsset:t=>{const n=new FormData;return n.append("asset",t),we(e,"/api/notification-assets",{method:"POST",credentials:"same-origin",body:n})},updateNotificationAssetSelection:t=>we(e,"/api/notification-assets/selection",et("PUT",t)),deleteNotificationAsset:async t=>{await ka(e,`/api/notification-assets/${encodeURIComponent(t)}`,{method:"DELETE",credentials:"same-origin"})}}}function io(e,t=fetch){const n=a=>e?`/api/agents/${encodeURIComponent(e)}/${a}`:`/api/${a}`;return{isAgent:e!==null,listTerminals:()=>we(t,n("terminals")),createTerminal:(a={})=>we(t,n("terminals"),et("POST",a)),closeTerminal:async a=>{await ka(t,n(`terminals/${encodeURIComponent(a)}`),{method:"DELETE",credentials:"same-origin"})},renameTerminal:(a,o)=>we(t,n(`terminals/${encodeURIComponent(a)}`),et("PATCH",{title:o})),getTerminalHistory:(a,o={})=>we(t,`${n(`terminals/${encodeURIComponent(a)}/history`)}${au(o)}`),getTerminalTranscriptHistory:(a,o={})=>we(t,`${n(`terminals/${encodeURIComponent(a)}/transcript-history`)}${au(o)}`),getTerminalTranscriptSource:a=>we(t,n(`terminals/${encodeURIComponent(a)}/transcript-source`)),getTerminalLayout:()=>we(t,n("terminal-layout")),saveTerminalLayout:a=>we(t,n("terminal-layout"),et("PUT",a)),createFileRoot:a=>we(t,n("files/root"),et("POST",a)),listFiles:a=>we(t,n("files/list"),et("POST",a)),readFile:a=>we(t,n("files/read"),et("POST",a)),writeFile:a=>we(t,n("files/write"),et("POST",a)),createFileEntry:a=>we(t,n("files/create"),et("POST",a)),moveFileEntry:a=>we(t,n("files/move"),et("POST",a)),previewDeleteFileEntry:a=>we(t,n("files/delete-preview"),et("POST",a)),deleteFileEntry:a=>we(t,n("files/delete"),et("POST",a)),openFileInTerminal:a=>we(t,n("files/open"),et("POST",a)),previewFile:a=>bb(t,n("files/preview"),et("POST",a)),createWebSocketUrl:(a,o=window.location.href)=>QC(n(`terminals/${encodeURIComponent(a)}/ws`),o)}}function QC(e,t){const n=new URL(t);return n.protocol=n.protocol==="https:"?"wss:":"ws:",n.pathname=e,n.search="",n.hash="",n.toString()}function et(e,t){return{method:e,headers:{"content-type":"application/json"},credentials:"same-origin",body:JSON.stringify(t)}}function au(e){const t=new URLSearchParams;e.beforeLine!==void 0&&t.set("beforeLine",String(e.beforeLine)),e.cursor!==void 0&&t.set("cursor",e.cursor),e.limit!==void 0&&t.set("limit",String(e.limit));const n=t.toString();return n?`?${n}`:""}async function we(e,t,n){const a=await e(t,n??{credentials:"same-origin"});await $p(a);try{return await a.json()}catch{throw new yn(a.status,"invalid_json_response")}}async function ka(e,t,n){const a=await e(t,n);await $p(a)}async function bb(e,t,n){const a=await e(t,n);return await $p(a),a.blob()}async function $p(e){if(e.ok)return;let t=e.statusText||`HTTP ${e.status}`;try{const n=await e.json(),a=typeof n.error=="string"?n.error:n.message;typeof a=="string"&&a.trim()&&(t=a)}catch{}throw new yn(e.status,t)}function wb({size:e=22}){return _.jsx("img",{className:"nterminal-mark",src:"/brand/nterminal-mark.svg",width:e,height:e,alt:"","aria-hidden":"true"})}function Cb({height:e=18}){const t=Math.round(7.147058823529412*e);return _.jsx("img",{className:"nterminal-wordmark",src:"/brand/nterminal-wordmark.svg",width:t,height:e,alt:"NTerminal"})}var Il=Sb();const Tu=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function za(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function Vp(e){return"nodeType"in e}function $i(e){var t,n;return e?za(e)?e:Vp(e)&&(t=(n=e.ownerDocument)==null?void 0:n.defaultView)!=null?t:window:window}function Xp(e){const{Document:t}=$i(e);return e instanceof t}function yo(e){return za(e)?!1:e instanceof $i(e).HTMLElement}function xb(e){return e instanceof $i(e).SVGElement}function ja(e){return e?za(e)?e.document:Vp(e)?Xp(e)?e:yo(e)||xb(e)?e.ownerDocument:document:document:document}const ar=Tu?g.useLayoutEffect:g.useEffect;function Gp(e){const t=g.useRef(e);return ar(()=>{t.current=e}),g.useCallback(function(){for(var n=arguments.length,a=new Array(n),o=0;o<n;o++)a[o]=arguments[o];return t.current==null?void 0:t.current(...a)},[])}function JC(){const e=g.useRef(null),t=g.useCallback((a,o)=>{e.current=setInterval(a,o)},[]),n=g.useCallback(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,n]}function so(e,t){t===void 0&&(t=[e]);const n=g.useRef(e);return ar(()=>{n.current!==e&&(n.current=e)},t),n}function So(e,t){const n=g.useRef();return g.useMemo(()=>{const a=e(n.current);return n.current=a,a},[...t])}function lu(e){const t=Gp(e),n=g.useRef(null),a=g.useCallback(o=>{o!==n.current&&t?.(o,n.current),n.current=o},[]);return[n,a]}function xf(e){const t=g.useRef();return g.useEffect(()=>{t.current=e},[e]),t.current}let Xd={};function ku(e,t){return g.useMemo(()=>{if(t)return t;const n=Xd[e]==null?0:Xd[e]+1;return Xd[e]=n,e+"-"+n},[e,t])}function Eb(e){return function(t){for(var n=arguments.length,a=new Array(n>1?n-1:0),o=1;o<n;o++)a[o-1]=arguments[o];return a.reduce((c,d)=>{const p=Object.entries(d);for(const[m,f]of p){const S=c[m];S!=null&&(c[m]=S+e*f)}return c},{...t})}}const Aa=Eb(1),ou=Eb(-1);function ex(e){return"clientX"in e&&"clientY"in e}function Tb(e){if(!e)return!1;const{KeyboardEvent:t}=$i(e.target);return t&&e instanceof t}function tx(e){if(!e)return!1;const{TouchEvent:t}=$i(e.target);return t&&e instanceof t}function Ef(e){if(tx(e)){if(e.touches&&e.touches.length){const{clientX:t,clientY:n}=e.touches[0];return{x:t,y:n}}else if(e.changedTouches&&e.changedTouches.length){const{clientX:t,clientY:n}=e.changedTouches[0];return{x:t,y:n}}}return ex(e)?{x:e.clientX,y:e.clientY}:null}const Tf=Object.freeze({Translate:{toString(e){if(!e)return;const{x:t,y:n}=e;return"translate3d("+(t?Math.round(t):0)+"px, "+(n?Math.round(n):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;const{scaleX:t,scaleY:n}=e;return"scaleX("+t+") scaleY("+n+")"}},Transform:{toString(e){if(e)return[Tf.Translate.toString(e),Tf.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:n,easing:a}=e;return t+" "+n+"ms "+a}}}),Ty="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function ix(e){return e.matches(Ty)?e:e.querySelector(Ty)}const sx={display:"none"};function nx(e){let{id:t,value:n}=e;return xi.createElement("div",{id:t,style:sx},n)}function rx(e){let{id:t,announcement:n,ariaLiveType:a="assertive"}=e;const o={position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return xi.createElement("div",{id:t,style:o,role:"status","aria-live":a,"aria-atomic":!0},n)}function ax(){const[e,t]=g.useState("");return{announce:g.useCallback(a=>{a!=null&&t(a)},[]),announcement:e}}const kb=g.createContext(null);function lx(e){const t=g.useContext(kb);g.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}function ox(){const[e]=g.useState(()=>new Set),t=g.useCallback(a=>(e.add(a),()=>e.delete(a)),[e]);return[g.useCallback(a=>{let{type:o,event:c}=a;e.forEach(d=>{var p;return(p=d[o])==null?void 0:p.call(d,c)})},[e]),t]}const cx={draggable:`
8
+ `+l.stack}}var gt=Object.prototype.hasOwnProperty,yt=e.unstable_scheduleCallback,mi=e.unstable_cancelCallback,te=e.unstable_shouldYield,je=e.unstable_requestPaint,He=e.unstable_now,_i=e.unstable_getCurrentPriorityLevel,Vi=e.unstable_ImmediatePriority,ai=e.unstable_UserBlockingPriority,kt=e.unstable_NormalPriority,ji=e.unstable_LowPriority,Ti=e.unstable_IdlePriority,Nt=e.log,$s=e.unstable_setDisableYieldValue,Hi=null,qt=null;function Jt(i){if(typeof Nt=="function"&&$s(i),qt&&typeof qt.setStrictMode=="function")try{qt.setStrictMode(Hi,i)}catch{}}var Dt=Math.clz32?Math.clz32:Vs,Cn=Math.log,Bs=Math.LN2;function Vs(i){return i>>>=0,i===0?32:31-(Cn(i)/Bs|0)|0}var Ts=256,ks=262144,ot=4194304;function St(i){var s=i&42;if(s!==0)return s;switch(i&-i){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 i&261888;case 262144:case 524288:case 1048576:case 2097152:return i&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return i&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return i}}function Rt(i,s,r){var l=i.pendingLanes;if(l===0)return 0;var u=0,h=i.suspendedLanes,v=i.pingedLanes;i=i.warmLanes;var w=l&134217727;return w!==0?(l=w&~h,l!==0?u=St(l):(v&=w,v!==0?u=St(v):r||(r=w&~i,r!==0&&(u=St(r))))):(w=l&~h,w!==0?u=St(w):v!==0?u=St(v):r||(r=l&~i,r!==0&&(u=St(r)))),u===0?0:s!==0&&s!==u&&(s&h)===0&&(h=u&-u,r=s&-s,h>=r||h===32&&(r&4194048)!==0)?s:u}function li(i,s){return(i.pendingLanes&~(i.suspendedLanes&~i.pingedLanes)&s)===0}function ei(i,s){switch(i){case 1:case 2:case 4:case 8:case 64:return s+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 s+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 Bt(){var i=ot;return ot<<=1,(ot&62914560)===0&&(ot=4194304),i}function nt(i){for(var s=[],r=0;31>r;r++)s.push(i);return s}function Wt(i,s){i.pendingLanes|=s,s!==268435456&&(i.suspendedLanes=0,i.pingedLanes=0,i.warmLanes=0)}function bt(i,s,r,l,u,h){var v=i.pendingLanes;i.pendingLanes=r,i.suspendedLanes=0,i.pingedLanes=0,i.warmLanes=0,i.expiredLanes&=r,i.entangledLanes&=r,i.errorRecoveryDisabledLanes&=r,i.shellSuspendCounter=0;var w=i.entanglements,D=i.expirationTimes,P=i.hiddenUpdates;for(r=v&~r;0<r;){var se=31-Dt(r),le=1<<se;w[se]=0,D[se]=-1;var Y=P[se];if(Y!==null)for(P[se]=null,se=0;se<Y.length;se++){var G=Y[se];G!==null&&(G.lane&=-536870913)}r&=~le}l!==0&&Ge(i,l,0),h!==0&&u===0&&i.tag!==0&&(i.suspendedLanes|=h&~(v&~s))}function Ge(i,s,r){i.pendingLanes|=s,i.suspendedLanes&=~s;var l=31-Dt(s);i.entangledLanes|=s,i.entanglements[l]=i.entanglements[l]|1073741824|r&261930}function ct(i,s){var r=i.entangledLanes|=s;for(i=i.entanglements;r;){var l=31-Dt(r),u=1<<l;u&s|i[l]&s&&(i[l]|=s),r&=~u}}function vi(i,s){var r=s&-s;return r=(r&42)!==0?1:Ai(r),(r&(i.suspendedLanes|s))!==0?0:r}function Ai(i){switch(i){case 2:i=1;break;case 8:i=4;break;case 32:i=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:i=128;break;case 268435456:i=134217728;break;default:i=0}return i}function Ni(i){return i&=-i,2<i?8<i?(i&134217727)!==0?32:268435456:8:2}function ki(){var i=V.p;return i!==0?i:(i=window.event,i===void 0?32:cy(i.type))}function cs(i,s){var r=V.p;try{return V.p=i,s()}finally{V.p=r}}var gi=Math.random().toString(36).slice(2),mt="__reactFiber$"+gi,Yt="__reactProps$"+gi,us="__reactContainer$"+gi,Xs="__reactEvents$"+gi,xn="__reactListeners$"+gi,hr="__reactHandles$"+gi,Xi="__reactResources$"+gi,Gi="__reactMarker$"+gi;function En(i){delete i[mt],delete i[Yt],delete i[Xs],delete i[xn],delete i[hr]}function Ls(i){var s=i[mt];if(s)return s;for(var r=i.parentNode;r;){if(s=r[us]||r[mt]){if(r=s.alternate,s.child!==null||r!==null&&r.child!==null)for(i=$g(i);i!==null;){if(r=i[mt])return r;i=$g(i)}return s}i=r,r=i.parentNode}return null}function Os(i){if(i=i[mt]||i[us]){var s=i.tag;if(s===5||s===6||s===13||s===31||s===26||s===27||s===3)return i}return null}function Ds(i){var s=i.tag;if(s===5||s===26||s===27||s===6)return i.stateNode;throw Error(a(33))}function Zi(i){var s=i[Xi];return s||(s=i[Xi]={hoistableStyles:new Map,hoistableScripts:new Map}),s}function Lt(i){i[Gi]=!0}var Qi=new Set,Ir={};function Ui(i,s){zs(i,s),zs(i+"Capture",s)}function zs(i,s){for(Ir[i]=s,i=0;i<s.length;i++)Qi.add(s[i])}var O=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]*$"),fe={},Oe={};function T(i){return gt.call(Oe,i)?!0:gt.call(fe,i)?!1:O.test(i)?Oe[i]=!0:(fe[i]=!0,!1)}function M(i,s,r){if(T(s))if(r===null)i.removeAttribute(s);else{switch(typeof r){case"undefined":case"function":case"symbol":i.removeAttribute(s);return;case"boolean":var l=s.toLowerCase().slice(0,5);if(l!=="data-"&&l!=="aria-"){i.removeAttribute(s);return}}i.setAttribute(s,""+r)}}function K(i,s,r){if(r===null)i.removeAttribute(s);else{switch(typeof r){case"undefined":case"function":case"symbol":case"boolean":i.removeAttribute(s);return}i.setAttribute(s,""+r)}}function ue(i,s,r,l){if(l===null)i.removeAttribute(r);else{switch(typeof l){case"undefined":case"function":case"symbol":case"boolean":i.removeAttribute(r);return}i.setAttributeNS(s,r,""+l)}}function pe(i){switch(typeof i){case"bigint":case"boolean":case"number":case"string":case"undefined":return i;case"object":return i;default:return""}}function ke(i){var s=i.type;return(i=i.nodeName)&&i.toLowerCase()==="input"&&(s==="checkbox"||s==="radio")}function De(i,s,r){var l=Object.getOwnPropertyDescriptor(i.constructor.prototype,s);if(!i.hasOwnProperty(s)&&typeof l<"u"&&typeof l.get=="function"&&typeof l.set=="function"){var u=l.get,h=l.set;return Object.defineProperty(i,s,{configurable:!0,get:function(){return u.call(this)},set:function(v){r=""+v,h.call(this,v)}}),Object.defineProperty(i,s,{enumerable:l.enumerable}),{getValue:function(){return r},setValue:function(v){r=""+v},stopTracking:function(){i._valueTracker=null,delete i[s]}}}}function rt(i){if(!i._valueTracker){var s=ke(i)?"checked":"value";i._valueTracker=De(i,s,""+i[s])}}function ut(i){if(!i)return!1;var s=i._valueTracker;if(!s)return!0;var r=s.getValue(),l="";return i&&(l=ke(i)?i.checked?"true":"false":i.value),i=l,i!==r?(s.setValue(i),!0):!1}function yi(i){if(i=i||(typeof document<"u"?document:void 0),typeof i>"u")return null;try{return i.activeElement||i.body}catch{return i.body}}var Fr=/[\n"\\]/g;function Ut(i){return i.replace(Fr,function(s){return"\\"+s.charCodeAt(0).toString(16)+" "})}function qr(i,s,r,l,u,h,v,w){i.name="",v!=null&&typeof v!="function"&&typeof v!="symbol"&&typeof v!="boolean"?i.type=v:i.removeAttribute("type"),s!=null?v==="number"?(s===0&&i.value===""||i.value!=s)&&(i.value=""+pe(s)):i.value!==""+pe(s)&&(i.value=""+pe(s)):v!=="submit"&&v!=="reset"||i.removeAttribute("value"),s!=null?Hu(i,v,pe(s)):r!=null?Hu(i,v,pe(r)):l!=null&&i.removeAttribute("value"),u==null&&h!=null&&(i.defaultChecked=!!h),u!=null&&(i.checked=u&&typeof u!="function"&&typeof u!="symbol"),w!=null&&typeof w!="function"&&typeof w!="symbol"&&typeof w!="boolean"?i.name=""+pe(w):i.removeAttribute("name")}function Ia(i,s,r,l,u,h,v,w){if(h!=null&&typeof h!="function"&&typeof h!="symbol"&&typeof h!="boolean"&&(i.type=h),s!=null||r!=null){if(!(h!=="submit"&&h!=="reset"||s!=null)){rt(i);return}r=r!=null?""+pe(r):"",s=s!=null?""+pe(s):r,w||s===i.value||(i.value=s),i.defaultValue=s}l=l??u,l=typeof l!="function"&&typeof l!="symbol"&&!!l,i.checked=w?i.checked:!!l,i.defaultChecked=!!l,v!=null&&typeof v!="function"&&typeof v!="symbol"&&typeof v!="boolean"&&(i.name=v),rt(i)}function Hu(i,s,r){s==="number"&&yi(i.ownerDocument)===i||i.defaultValue===""+r||(i.defaultValue=""+r)}function Wr(i,s,r,l){if(i=i.options,s){s={};for(var u=0;u<r.length;u++)s["$"+r[u]]=!0;for(r=0;r<i.length;r++)u=s.hasOwnProperty("$"+i[r].value),i[r].selected!==u&&(i[r].selected=u),u&&l&&(i[r].defaultSelected=!0)}else{for(r=""+pe(r),s=null,u=0;u<i.length;u++){if(i[u].value===r){i[u].selected=!0,l&&(i[u].defaultSelected=!0);return}s!==null||i[u].disabled||(s=i[u])}s!==null&&(s.selected=!0)}}function Lm(i,s,r){if(s!=null&&(s=""+pe(s),s!==i.value&&(i.value=s),r==null)){i.defaultValue!==s&&(i.defaultValue=s);return}i.defaultValue=r!=null?""+pe(r):""}function Om(i,s,r,l){if(s==null){if(l!=null){if(r!=null)throw Error(a(92));if(Z(l)){if(1<l.length)throw Error(a(93));l=l[0]}r=l}r==null&&(r=""),s=r}r=pe(s),i.defaultValue=r,l=i.textContent,l===r&&l!==""&&l!==null&&(i.value=l),rt(i)}function Yr(i,s){if(s){var r=i.firstChild;if(r&&r===i.lastChild&&r.nodeType===3){r.nodeValue=s;return}}i.textContent=s}var jw=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 zm(i,s,r){var l=s.indexOf("--")===0;r==null||typeof r=="boolean"||r===""?l?i.setProperty(s,""):s==="float"?i.cssFloat="":i[s]="":l?i.setProperty(s,r):typeof r!="number"||r===0||jw.has(s)?s==="float"?i.cssFloat=r:i[s]=(""+r).trim():i[s]=r+"px"}function jm(i,s,r){if(s!=null&&typeof s!="object")throw Error(a(62));if(i=i.style,r!=null){for(var l in r)!r.hasOwnProperty(l)||s!=null&&s.hasOwnProperty(l)||(l.indexOf("--")===0?i.setProperty(l,""):l==="float"?i.cssFloat="":i[l]="");for(var u in s)l=s[u],s.hasOwnProperty(u)&&r[u]!==l&&zm(i,u,l)}else for(var h in s)s.hasOwnProperty(h)&&zm(i,h,s[h])}function Uu(i){if(i.indexOf("-")===-1)return!1;switch(i){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 Hw=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"]]),Uw=/^[\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 Ro(i){return Uw.test(""+i)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":i}function Gs(){}var Pu=null;function Ku(i){return i=i.target||i.srcElement||window,i.correspondingUseElement&&(i=i.correspondingUseElement),i.nodeType===3?i.parentNode:i}var $r=null,Vr=null;function Hm(i){var s=Os(i);if(s&&(i=s.stateNode)){var r=i[Yt]||null;e:switch(i=s.stateNode,s.type){case"input":if(qr(i,r.value,r.defaultValue,r.defaultValue,r.checked,r.defaultChecked,r.type,r.name),s=r.name,r.type==="radio"&&s!=null){for(r=i;r.parentNode;)r=r.parentNode;for(r=r.querySelectorAll('input[name="'+Ut(""+s)+'"][type="radio"]'),s=0;s<r.length;s++){var l=r[s];if(l!==i&&l.form===i.form){var u=l[Yt]||null;if(!u)throw Error(a(90));qr(l,u.value,u.defaultValue,u.defaultValue,u.checked,u.defaultChecked,u.type,u.name)}}for(s=0;s<r.length;s++)l=r[s],l.form===i.form&&ut(l)}break e;case"textarea":Lm(i,r.value,r.defaultValue);break e;case"select":s=r.value,s!=null&&Wr(i,!!r.multiple,s,!1)}}}var Iu=!1;function Um(i,s,r){if(Iu)return i(s,r);Iu=!0;try{var l=i(s);return l}finally{if(Iu=!1,($r!==null||Vr!==null)&&(_c(),$r&&(s=$r,i=Vr,Vr=$r=null,Hm(s),i)))for(s=0;s<i.length;s++)Hm(i[s])}}function Fa(i,s){var r=i.stateNode;if(r===null)return null;var l=r[Yt]||null;if(l===null)return null;r=l[s];e:switch(s){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(l=!l.disabled)||(i=i.type,l=!(i==="button"||i==="input"||i==="select"||i==="textarea")),i=!l;break e;default:i=!1}if(i)return null;if(r&&typeof r!="function")throw Error(a(231,s,typeof r));return r}var Zs=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Fu=!1;if(Zs)try{var qa={};Object.defineProperty(qa,"passive",{get:function(){Fu=!0}}),window.addEventListener("test",qa,qa),window.removeEventListener("test",qa,qa)}catch{Fu=!1}var Tn=null,qu=null,Mo=null;function Pm(){if(Mo)return Mo;var i,s=qu,r=s.length,l,u="value"in Tn?Tn.value:Tn.textContent,h=u.length;for(i=0;i<r&&s[i]===u[i];i++);var v=r-i;for(l=1;l<=v&&s[r-l]===u[h-l];l++);return Mo=u.slice(i,1<l?1-l:void 0)}function Ao(i){var s=i.keyCode;return"charCode"in i?(i=i.charCode,i===0&&s===13&&(i=13)):i=s,i===10&&(i=13),32<=i||i===13?i:0}function No(){return!0}function Km(){return!1}function Pi(i){function s(r,l,u,h,v){this._reactName=r,this._targetInst=u,this.type=l,this.nativeEvent=h,this.target=v,this.currentTarget=null;for(var w in i)i.hasOwnProperty(w)&&(r=i[w],this[w]=r?r(h):h[w]);return this.isDefaultPrevented=(h.defaultPrevented!=null?h.defaultPrevented:h.returnValue===!1)?No:Km,this.isPropagationStopped=Km,this}return y(s.prototype,{preventDefault:function(){this.defaultPrevented=!0;var r=this.nativeEvent;r&&(r.preventDefault?r.preventDefault():typeof r.returnValue!="unknown"&&(r.returnValue=!1),this.isDefaultPrevented=No)},stopPropagation:function(){var r=this.nativeEvent;r&&(r.stopPropagation?r.stopPropagation():typeof r.cancelBubble!="unknown"&&(r.cancelBubble=!0),this.isPropagationStopped=No)},persist:function(){},isPersistent:No}),s}var dr={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(i){return i.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Bo=Pi(dr),Wa=y({},dr,{view:0,detail:0}),Pw=Pi(Wa),Wu,Yu,Ya,Lo=y({},Wa,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Vu,button:0,buttons:0,relatedTarget:function(i){return i.relatedTarget===void 0?i.fromElement===i.srcElement?i.toElement:i.fromElement:i.relatedTarget},movementX:function(i){return"movementX"in i?i.movementX:(i!==Ya&&(Ya&&i.type==="mousemove"?(Wu=i.screenX-Ya.screenX,Yu=i.screenY-Ya.screenY):Yu=Wu=0,Ya=i),Wu)},movementY:function(i){return"movementY"in i?i.movementY:Yu}}),Im=Pi(Lo),Kw=y({},Lo,{dataTransfer:0}),Iw=Pi(Kw),Fw=y({},Wa,{relatedTarget:0}),$u=Pi(Fw),qw=y({},dr,{animationName:0,elapsedTime:0,pseudoElement:0}),Ww=Pi(qw),Yw=y({},dr,{clipboardData:function(i){return"clipboardData"in i?i.clipboardData:window.clipboardData}}),$w=Pi(Yw),Vw=y({},dr,{data:0}),Fm=Pi(Vw),Xw={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Gw={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"},Zw={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Qw(i){var s=this.nativeEvent;return s.getModifierState?s.getModifierState(i):(i=Zw[i])?!!s[i]:!1}function Vu(){return Qw}var Jw=y({},Wa,{key:function(i){if(i.key){var s=Xw[i.key]||i.key;if(s!=="Unidentified")return s}return i.type==="keypress"?(i=Ao(i),i===13?"Enter":String.fromCharCode(i)):i.type==="keydown"||i.type==="keyup"?Gw[i.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Vu,charCode:function(i){return i.type==="keypress"?Ao(i):0},keyCode:function(i){return i.type==="keydown"||i.type==="keyup"?i.keyCode:0},which:function(i){return i.type==="keypress"?Ao(i):i.type==="keydown"||i.type==="keyup"?i.keyCode:0}}),e1=Pi(Jw),t1=y({},Lo,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),qm=Pi(t1),i1=y({},Wa,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Vu}),s1=Pi(i1),n1=y({},dr,{propertyName:0,elapsedTime:0,pseudoElement:0}),r1=Pi(n1),a1=y({},Lo,{deltaX:function(i){return"deltaX"in i?i.deltaX:"wheelDeltaX"in i?-i.wheelDeltaX:0},deltaY:function(i){return"deltaY"in i?i.deltaY:"wheelDeltaY"in i?-i.wheelDeltaY:"wheelDelta"in i?-i.wheelDelta:0},deltaZ:0,deltaMode:0}),l1=Pi(a1),o1=y({},dr,{newState:0,oldState:0}),c1=Pi(o1),u1=[9,13,27,32],Xu=Zs&&"CompositionEvent"in window,$a=null;Zs&&"documentMode"in document&&($a=document.documentMode);var h1=Zs&&"TextEvent"in window&&!$a,Wm=Zs&&(!Xu||$a&&8<$a&&11>=$a),Ym=" ",$m=!1;function Vm(i,s){switch(i){case"keyup":return u1.indexOf(s.keyCode)!==-1;case"keydown":return s.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Xm(i){return i=i.detail,typeof i=="object"&&"data"in i?i.data:null}var Xr=!1;function d1(i,s){switch(i){case"compositionend":return Xm(s);case"keypress":return s.which!==32?null:($m=!0,Ym);case"textInput":return i=s.data,i===Ym&&$m?null:i;default:return null}}function f1(i,s){if(Xr)return i==="compositionend"||!Xu&&Vm(i,s)?(i=Pm(),Mo=qu=Tn=null,Xr=!1,i):null;switch(i){case"paste":return null;case"keypress":if(!(s.ctrlKey||s.altKey||s.metaKey)||s.ctrlKey&&s.altKey){if(s.char&&1<s.char.length)return s.char;if(s.which)return String.fromCharCode(s.which)}return null;case"compositionend":return Wm&&s.locale!=="ko"?null:s.data;default:return null}}var p1={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 Gm(i){var s=i&&i.nodeName&&i.nodeName.toLowerCase();return s==="input"?!!p1[i.type]:s==="textarea"}function Zm(i,s,r,l){$r?Vr?Vr.push(l):Vr=[l]:$r=l,s=Cc(s,"onChange"),0<s.length&&(r=new Bo("onChange","change",null,r,l),i.push({event:r,listeners:s}))}var Va=null,Xa=null;function m1(i){Bg(i,0)}function Oo(i){var s=Ds(i);if(ut(s))return i}function Qm(i,s){if(i==="change")return s}var Jm=!1;if(Zs){var Gu;if(Zs){var Zu="oninput"in document;if(!Zu){var e_=document.createElement("div");e_.setAttribute("oninput","return;"),Zu=typeof e_.oninput=="function"}Gu=Zu}else Gu=!1;Jm=Gu&&(!document.documentMode||9<document.documentMode)}function t_(){Va&&(Va.detachEvent("onpropertychange",i_),Xa=Va=null)}function i_(i){if(i.propertyName==="value"&&Oo(Xa)){var s=[];Zm(s,Xa,i,Ku(i)),Um(m1,s)}}function _1(i,s,r){i==="focusin"?(t_(),Va=s,Xa=r,Va.attachEvent("onpropertychange",i_)):i==="focusout"&&t_()}function v1(i){if(i==="selectionchange"||i==="keyup"||i==="keydown")return Oo(Xa)}function g1(i,s){if(i==="click")return Oo(s)}function y1(i,s){if(i==="input"||i==="change")return Oo(s)}function S1(i,s){return i===s&&(i!==0||1/i===1/s)||i!==i&&s!==s}var Ji=typeof Object.is=="function"?Object.is:S1;function Ga(i,s){if(Ji(i,s))return!0;if(typeof i!="object"||i===null||typeof s!="object"||s===null)return!1;var r=Object.keys(i),l=Object.keys(s);if(r.length!==l.length)return!1;for(l=0;l<r.length;l++){var u=r[l];if(!gt.call(s,u)||!Ji(i[u],s[u]))return!1}return!0}function s_(i){for(;i&&i.firstChild;)i=i.firstChild;return i}function n_(i,s){var r=s_(i);i=0;for(var l;r;){if(r.nodeType===3){if(l=i+r.textContent.length,i<=s&&l>=s)return{node:r,offset:s-i};i=l}e:{for(;r;){if(r.nextSibling){r=r.nextSibling;break e}r=r.parentNode}r=void 0}r=s_(r)}}function r_(i,s){return i&&s?i===s?!0:i&&i.nodeType===3?!1:s&&s.nodeType===3?r_(i,s.parentNode):"contains"in i?i.contains(s):i.compareDocumentPosition?!!(i.compareDocumentPosition(s)&16):!1:!1}function a_(i){i=i!=null&&i.ownerDocument!=null&&i.ownerDocument.defaultView!=null?i.ownerDocument.defaultView:window;for(var s=yi(i.document);s instanceof i.HTMLIFrameElement;){try{var r=typeof s.contentWindow.location.href=="string"}catch{r=!1}if(r)i=s.contentWindow;else break;s=yi(i.document)}return s}function Qu(i){var s=i&&i.nodeName&&i.nodeName.toLowerCase();return s&&(s==="input"&&(i.type==="text"||i.type==="search"||i.type==="tel"||i.type==="url"||i.type==="password")||s==="textarea"||i.contentEditable==="true")}var b1=Zs&&"documentMode"in document&&11>=document.documentMode,Gr=null,Ju=null,Za=null,eh=!1;function l_(i,s,r){var l=r.window===r?r.document:r.nodeType===9?r:r.ownerDocument;eh||Gr==null||Gr!==yi(l)||(l=Gr,"selectionStart"in l&&Qu(l)?l={start:l.selectionStart,end:l.selectionEnd}:(l=(l.ownerDocument&&l.ownerDocument.defaultView||window).getSelection(),l={anchorNode:l.anchorNode,anchorOffset:l.anchorOffset,focusNode:l.focusNode,focusOffset:l.focusOffset}),Za&&Ga(Za,l)||(Za=l,l=Cc(Ju,"onSelect"),0<l.length&&(s=new Bo("onSelect","select",null,s,r),i.push({event:s,listeners:l}),s.target=Gr)))}function fr(i,s){var r={};return r[i.toLowerCase()]=s.toLowerCase(),r["Webkit"+i]="webkit"+s,r["Moz"+i]="moz"+s,r}var Zr={animationend:fr("Animation","AnimationEnd"),animationiteration:fr("Animation","AnimationIteration"),animationstart:fr("Animation","AnimationStart"),transitionrun:fr("Transition","TransitionRun"),transitionstart:fr("Transition","TransitionStart"),transitioncancel:fr("Transition","TransitionCancel"),transitionend:fr("Transition","TransitionEnd")},th={},o_={};Zs&&(o_=document.createElement("div").style,"AnimationEvent"in window||(delete Zr.animationend.animation,delete Zr.animationiteration.animation,delete Zr.animationstart.animation),"TransitionEvent"in window||delete Zr.transitionend.transition);function pr(i){if(th[i])return th[i];if(!Zr[i])return i;var s=Zr[i],r;for(r in s)if(s.hasOwnProperty(r)&&r in o_)return th[i]=s[r];return i}var c_=pr("animationend"),u_=pr("animationiteration"),h_=pr("animationstart"),w1=pr("transitionrun"),C1=pr("transitionstart"),x1=pr("transitioncancel"),d_=pr("transitionend"),f_=new Map,ih="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(" ");ih.push("scrollEnd");function Rs(i,s){f_.set(i,s),Ui(s,[i])}var zo=typeof reportError=="function"?reportError:function(i){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var s=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof i=="object"&&i!==null&&typeof i.message=="string"?String(i.message):String(i),error:i});if(!window.dispatchEvent(s))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",i);return}console.error(i)},hs=[],Qr=0,sh=0;function jo(){for(var i=Qr,s=sh=Qr=0;s<i;){var r=hs[s];hs[s++]=null;var l=hs[s];hs[s++]=null;var u=hs[s];hs[s++]=null;var h=hs[s];if(hs[s++]=null,l!==null&&u!==null){var v=l.pending;v===null?u.next=u:(u.next=v.next,v.next=u),l.pending=u}h!==0&&p_(r,u,h)}}function Ho(i,s,r,l){hs[Qr++]=i,hs[Qr++]=s,hs[Qr++]=r,hs[Qr++]=l,sh|=l,i.lanes|=l,i=i.alternate,i!==null&&(i.lanes|=l)}function nh(i,s,r,l){return Ho(i,s,r,l),Uo(i)}function mr(i,s){return Ho(i,null,null,s),Uo(i)}function p_(i,s,r){i.lanes|=r;var l=i.alternate;l!==null&&(l.lanes|=r);for(var u=!1,h=i.return;h!==null;)h.childLanes|=r,l=h.alternate,l!==null&&(l.childLanes|=r),h.tag===22&&(i=h.stateNode,i===null||i._visibility&1||(u=!0)),i=h,h=h.return;return i.tag===3?(h=i.stateNode,u&&s!==null&&(u=31-Dt(r),i=h.hiddenUpdates,l=i[u],l===null?i[u]=[s]:l.push(s),s.lane=r|536870912),h):null}function Uo(i){if(50<yl)throw yl=0,fd=null,Error(a(185));for(var s=i.return;s!==null;)i=s,s=i.return;return i.tag===3?i.stateNode:null}var Jr={};function E1(i,s,r,l){this.tag=i,this.key=r,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=s,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=l,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function es(i,s,r,l){return new E1(i,s,r,l)}function rh(i){return i=i.prototype,!(!i||!i.isReactComponent)}function Qs(i,s){var r=i.alternate;return r===null?(r=es(i.tag,s,i.key,i.mode),r.elementType=i.elementType,r.type=i.type,r.stateNode=i.stateNode,r.alternate=i,i.alternate=r):(r.pendingProps=s,r.type=i.type,r.flags=0,r.subtreeFlags=0,r.deletions=null),r.flags=i.flags&65011712,r.childLanes=i.childLanes,r.lanes=i.lanes,r.child=i.child,r.memoizedProps=i.memoizedProps,r.memoizedState=i.memoizedState,r.updateQueue=i.updateQueue,s=i.dependencies,r.dependencies=s===null?null:{lanes:s.lanes,firstContext:s.firstContext},r.sibling=i.sibling,r.index=i.index,r.ref=i.ref,r.refCleanup=i.refCleanup,r}function m_(i,s){i.flags&=65011714;var r=i.alternate;return r===null?(i.childLanes=0,i.lanes=s,i.child=null,i.subtreeFlags=0,i.memoizedProps=null,i.memoizedState=null,i.updateQueue=null,i.dependencies=null,i.stateNode=null):(i.childLanes=r.childLanes,i.lanes=r.lanes,i.child=r.child,i.subtreeFlags=0,i.deletions=null,i.memoizedProps=r.memoizedProps,i.memoizedState=r.memoizedState,i.updateQueue=r.updateQueue,i.type=r.type,s=r.dependencies,i.dependencies=s===null?null:{lanes:s.lanes,firstContext:s.firstContext}),i}function Po(i,s,r,l,u,h){var v=0;if(l=i,typeof i=="function")rh(i)&&(v=1);else if(typeof i=="string")v=MC(i,r,he.current)?26:i==="html"||i==="head"||i==="body"?27:5;else e:switch(i){case de:return i=es(31,r,s,u),i.elementType=de,i.lanes=h,i;case k:return _r(r.children,u,h,s);case B:v=8,u|=24;break;case R:return i=es(12,r,s,u|2),i.elementType=R,i.lanes=h,i;case ce:return i=es(13,r,s,u),i.elementType=ce,i.lanes=h,i;case q:return i=es(19,r,s,u),i.elementType=q,i.lanes=h,i;default:if(typeof i=="object"&&i!==null)switch(i.$$typeof){case F:v=10;break e;case re:v=9;break e;case J:v=11;break e;case I:v=14;break e;case ie:v=16,l=null;break e}v=29,r=Error(a(130,i===null?"null":typeof i,"")),l=null}return s=es(v,r,s,u),s.elementType=i,s.type=l,s.lanes=h,s}function _r(i,s,r,l){return i=es(7,i,l,s),i.lanes=r,i}function ah(i,s,r){return i=es(6,i,null,s),i.lanes=r,i}function __(i){var s=es(18,null,null,0);return s.stateNode=i,s}function lh(i,s,r){return s=es(4,i.children!==null?i.children:[],i.key,s),s.lanes=r,s.stateNode={containerInfo:i.containerInfo,pendingChildren:null,implementation:i.implementation},s}var v_=new WeakMap;function ds(i,s){if(typeof i=="object"&&i!==null){var r=v_.get(i);return r!==void 0?r:(s={value:i,source:s,stack:Xe(s)},v_.set(i,s),s)}return{value:i,source:s,stack:Xe(s)}}var ea=[],ta=0,Ko=null,Qa=0,fs=[],ps=0,kn=null,js=1,Hs="";function Js(i,s){ea[ta++]=Qa,ea[ta++]=Ko,Ko=i,Qa=s}function g_(i,s,r){fs[ps++]=js,fs[ps++]=Hs,fs[ps++]=kn,kn=i;var l=js;i=Hs;var u=32-Dt(l)-1;l&=~(1<<u),r+=1;var h=32-Dt(s)+u;if(30<h){var v=u-u%5;h=(l&(1<<v)-1).toString(32),l>>=v,u-=v,js=1<<32-Dt(s)+u|r<<u|l,Hs=h+i}else js=1<<h|r<<u|l,Hs=i}function oh(i){i.return!==null&&(Js(i,1),g_(i,1,0))}function ch(i){for(;i===Ko;)Ko=ea[--ta],ea[ta]=null,Qa=ea[--ta],ea[ta]=null;for(;i===kn;)kn=fs[--ps],fs[ps]=null,Hs=fs[--ps],fs[ps]=null,js=fs[--ps],fs[ps]=null}function y_(i,s){fs[ps++]=js,fs[ps++]=Hs,fs[ps++]=kn,js=s.id,Hs=s.overflow,kn=i}var Si=null,wt=null,Je=!1,Dn=null,ms=!1,uh=Error(a(519));function Rn(i){var s=Error(a(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Ja(ds(s,i)),uh}function S_(i){var s=i.stateNode,r=i.type,l=i.memoizedProps;switch(s[mt]=i,s[Yt]=l,r){case"dialog":Ve("cancel",s),Ve("close",s);break;case"iframe":case"object":case"embed":Ve("load",s);break;case"video":case"audio":for(r=0;r<bl.length;r++)Ve(bl[r],s);break;case"source":Ve("error",s);break;case"img":case"image":case"link":Ve("error",s),Ve("load",s);break;case"details":Ve("toggle",s);break;case"input":Ve("invalid",s),Ia(s,l.value,l.defaultValue,l.checked,l.defaultChecked,l.type,l.name,!0);break;case"select":Ve("invalid",s);break;case"textarea":Ve("invalid",s),Om(s,l.value,l.defaultValue,l.children)}r=l.children,typeof r!="string"&&typeof r!="number"&&typeof r!="bigint"||s.textContent===""+r||l.suppressHydrationWarning===!0||jg(s.textContent,r)?(l.popover!=null&&(Ve("beforetoggle",s),Ve("toggle",s)),l.onScroll!=null&&Ve("scroll",s),l.onScrollEnd!=null&&Ve("scrollend",s),l.onClick!=null&&(s.onclick=Gs),s=!0):s=!1,s||Rn(i,!0)}function b_(i){for(Si=i.return;Si;)switch(Si.tag){case 5:case 31:case 13:ms=!1;return;case 27:case 3:ms=!0;return;default:Si=Si.return}}function ia(i){if(i!==Si)return!1;if(!Je)return b_(i),Je=!0,!1;var s=i.tag,r;if((r=s!==3&&s!==27)&&((r=s===5)&&(r=i.type,r=!(r!=="form"&&r!=="button")||Dd(i.type,i.memoizedProps)),r=!r),r&&wt&&Rn(i),b_(i),s===13){if(i=i.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(a(317));wt=Yg(i)}else if(s===31){if(i=i.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(a(317));wt=Yg(i)}else s===27?(s=wt,Fn(i.type)?(i=Bd,Bd=null,wt=i):wt=s):wt=Si?vs(i.stateNode.nextSibling):null;return!0}function vr(){wt=Si=null,Je=!1}function hh(){var i=Dn;return i!==null&&(qi===null?qi=i:qi.push.apply(qi,i),Dn=null),i}function Ja(i){Dn===null?Dn=[i]:Dn.push(i)}var dh=E(null),gr=null,en=null;function Mn(i,s,r){ee(dh,s._currentValue),s._currentValue=r}function tn(i){i._currentValue=dh.current,W(dh)}function fh(i,s,r){for(;i!==null;){var l=i.alternate;if((i.childLanes&s)!==s?(i.childLanes|=s,l!==null&&(l.childLanes|=s)):l!==null&&(l.childLanes&s)!==s&&(l.childLanes|=s),i===r)break;i=i.return}}function ph(i,s,r,l){var u=i.child;for(u!==null&&(u.return=i);u!==null;){var h=u.dependencies;if(h!==null){var v=u.child;h=h.firstContext;e:for(;h!==null;){var w=h;h=u;for(var D=0;D<s.length;D++)if(w.context===s[D]){h.lanes|=r,w=h.alternate,w!==null&&(w.lanes|=r),fh(h.return,r,i),l||(v=null);break e}h=w.next}}else if(u.tag===18){if(v=u.return,v===null)throw Error(a(341));v.lanes|=r,h=v.alternate,h!==null&&(h.lanes|=r),fh(v,r,i),v=null}else v=u.child;if(v!==null)v.return=u;else for(v=u;v!==null;){if(v===i){v=null;break}if(u=v.sibling,u!==null){u.return=v.return,v=u;break}v=v.return}u=v}}function sa(i,s,r,l){i=null;for(var u=s,h=!1;u!==null;){if(!h){if((u.flags&524288)!==0)h=!0;else if((u.flags&262144)!==0)break}if(u.tag===10){var v=u.alternate;if(v===null)throw Error(a(387));if(v=v.memoizedProps,v!==null){var w=u.type;Ji(u.pendingProps.value,v.value)||(i!==null?i.push(w):i=[w])}}else if(u===Ce.current){if(v=u.alternate,v===null)throw Error(a(387));v.memoizedState.memoizedState!==u.memoizedState.memoizedState&&(i!==null?i.push(Tl):i=[Tl])}u=u.return}i!==null&&ph(s,i,r,l),s.flags|=262144}function Io(i){for(i=i.firstContext;i!==null;){if(!Ji(i.context._currentValue,i.memoizedValue))return!0;i=i.next}return!1}function yr(i){gr=i,en=null,i=i.dependencies,i!==null&&(i.firstContext=null)}function bi(i){return w_(gr,i)}function Fo(i,s){return gr===null&&yr(i),w_(i,s)}function w_(i,s){var r=s._currentValue;if(s={context:s,memoizedValue:r,next:null},en===null){if(i===null)throw Error(a(308));en=s,i.dependencies={lanes:0,firstContext:s},i.flags|=524288}else en=en.next=s;return r}var T1=typeof AbortController<"u"?AbortController:function(){var i=[],s=this.signal={aborted:!1,addEventListener:function(r,l){i.push(l)}};this.abort=function(){s.aborted=!0,i.forEach(function(r){return r()})}},k1=e.unstable_scheduleCallback,D1=e.unstable_NormalPriority,$t={$$typeof:F,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function mh(){return{controller:new T1,data:new Map,refCount:0}}function el(i){i.refCount--,i.refCount===0&&k1(D1,function(){i.controller.abort()})}var tl=null,_h=0,na=0,ra=null;function R1(i,s){if(tl===null){var r=tl=[];_h=0,na=yd(),ra={status:"pending",value:void 0,then:function(l){r.push(l)}}}return _h++,s.then(C_,C_),s}function C_(){if(--_h===0&&tl!==null){ra!==null&&(ra.status="fulfilled");var i=tl;tl=null,na=0,ra=null;for(var s=0;s<i.length;s++)(0,i[s])()}}function M1(i,s){var r=[],l={status:"pending",value:null,reason:null,then:function(u){r.push(u)}};return i.then(function(){l.status="fulfilled",l.value=s;for(var u=0;u<r.length;u++)(0,r[u])(s)},function(u){for(l.status="rejected",l.reason=u,u=0;u<r.length;u++)(0,r[u])(void 0)}),l}var x_=A.S;A.S=function(i,s){lg=He(),typeof s=="object"&&s!==null&&typeof s.then=="function"&&R1(i,s),x_!==null&&x_(i,s)};var Sr=E(null);function vh(){var i=Sr.current;return i!==null?i:_t.pooledCache}function qo(i,s){s===null?ee(Sr,Sr.current):ee(Sr,s.pool)}function E_(){var i=vh();return i===null?null:{parent:$t._currentValue,pool:i}}var aa=Error(a(460)),gh=Error(a(474)),Wo=Error(a(542)),Yo={then:function(){}};function T_(i){return i=i.status,i==="fulfilled"||i==="rejected"}function k_(i,s,r){switch(r=i[r],r===void 0?i.push(s):r!==s&&(s.then(Gs,Gs),s=r),s.status){case"fulfilled":return s.value;case"rejected":throw i=s.reason,R_(i),i;default:if(typeof s.status=="string")s.then(Gs,Gs);else{if(i=_t,i!==null&&100<i.shellSuspendCounter)throw Error(a(482));i=s,i.status="pending",i.then(function(l){if(s.status==="pending"){var u=s;u.status="fulfilled",u.value=l}},function(l){if(s.status==="pending"){var u=s;u.status="rejected",u.reason=l}})}switch(s.status){case"fulfilled":return s.value;case"rejected":throw i=s.reason,R_(i),i}throw wr=s,aa}}function br(i){try{var s=i._init;return s(i._payload)}catch(r){throw r!==null&&typeof r=="object"&&typeof r.then=="function"?(wr=r,aa):r}}var wr=null;function D_(){if(wr===null)throw Error(a(459));var i=wr;return wr=null,i}function R_(i){if(i===aa||i===Wo)throw Error(a(483))}var la=null,il=0;function $o(i){var s=il;return il+=1,la===null&&(la=[]),k_(la,i,s)}function sl(i,s){s=s.props.ref,i.ref=s!==void 0?s:null}function Vo(i,s){throw s.$$typeof===b?Error(a(525)):(i=Object.prototype.toString.call(s),Error(a(31,i==="[object Object]"?"object with keys {"+Object.keys(s).join(", ")+"}":i)))}function M_(i){function s(z,N){if(i){var U=z.deletions;U===null?(z.deletions=[N],z.flags|=16):U.push(N)}}function r(z,N){if(!i)return null;for(;N!==null;)s(z,N),N=N.sibling;return null}function l(z){for(var N=new Map;z!==null;)z.key!==null?N.set(z.key,z):N.set(z.index,z),z=z.sibling;return N}function u(z,N){return z=Qs(z,N),z.index=0,z.sibling=null,z}function h(z,N,U){return z.index=U,i?(U=z.alternate,U!==null?(U=U.index,U<N?(z.flags|=67108866,N):U):(z.flags|=67108866,N)):(z.flags|=1048576,N)}function v(z){return i&&z.alternate===null&&(z.flags|=67108866),z}function w(z,N,U,ne){return N===null||N.tag!==6?(N=ah(U,z.mode,ne),N.return=z,N):(N=u(N,U),N.return=z,N)}function D(z,N,U,ne){var Me=U.type;return Me===k?se(z,N,U.props.children,ne,U.key):N!==null&&(N.elementType===Me||typeof Me=="object"&&Me!==null&&Me.$$typeof===ie&&br(Me)===N.type)?(N=u(N,U.props),sl(N,U),N.return=z,N):(N=Po(U.type,U.key,U.props,null,z.mode,ne),sl(N,U),N.return=z,N)}function P(z,N,U,ne){return N===null||N.tag!==4||N.stateNode.containerInfo!==U.containerInfo||N.stateNode.implementation!==U.implementation?(N=lh(U,z.mode,ne),N.return=z,N):(N=u(N,U.children||[]),N.return=z,N)}function se(z,N,U,ne,Me){return N===null||N.tag!==7?(N=_r(U,z.mode,ne,Me),N.return=z,N):(N=u(N,U),N.return=z,N)}function le(z,N,U){if(typeof N=="string"&&N!==""||typeof N=="number"||typeof N=="bigint")return N=ah(""+N,z.mode,U),N.return=z,N;if(typeof N=="object"&&N!==null){switch(N.$$typeof){case x:return U=Po(N.type,N.key,N.props,null,z.mode,U),sl(U,N),U.return=z,U;case C:return N=lh(N,z.mode,U),N.return=z,N;case ie:return N=br(N),le(z,N,U)}if(Z(N)||H(N))return N=_r(N,z.mode,U,null),N.return=z,N;if(typeof N.then=="function")return le(z,$o(N),U);if(N.$$typeof===F)return le(z,Fo(z,N),U);Vo(z,N)}return null}function Y(z,N,U,ne){var Me=N!==null?N.key:null;if(typeof U=="string"&&U!==""||typeof U=="number"||typeof U=="bigint")return Me!==null?null:w(z,N,""+U,ne);if(typeof U=="object"&&U!==null){switch(U.$$typeof){case x:return U.key===Me?D(z,N,U,ne):null;case C:return U.key===Me?P(z,N,U,ne):null;case ie:return U=br(U),Y(z,N,U,ne)}if(Z(U)||H(U))return Me!==null?null:se(z,N,U,ne,null);if(typeof U.then=="function")return Y(z,N,$o(U),ne);if(U.$$typeof===F)return Y(z,N,Fo(z,U),ne);Vo(z,U)}return null}function G(z,N,U,ne,Me){if(typeof ne=="string"&&ne!==""||typeof ne=="number"||typeof ne=="bigint")return z=z.get(U)||null,w(N,z,""+ne,Me);if(typeof ne=="object"&&ne!==null){switch(ne.$$typeof){case x:return z=z.get(ne.key===null?U:ne.key)||null,D(N,z,ne,Me);case C:return z=z.get(ne.key===null?U:ne.key)||null,P(N,z,ne,Me);case ie:return ne=br(ne),G(z,N,U,ne,Me)}if(Z(ne)||H(ne))return z=z.get(U)||null,se(N,z,ne,Me,null);if(typeof ne.then=="function")return G(z,N,U,$o(ne),Me);if(ne.$$typeof===F)return G(z,N,U,Fo(N,ne),Me);Vo(N,ne)}return null}function be(z,N,U,ne){for(var Me=null,tt=null,Te=N,Fe=N=0,Qe=null;Te!==null&&Fe<U.length;Fe++){Te.index>Fe?(Qe=Te,Te=null):Qe=Te.sibling;var it=Y(z,Te,U[Fe],ne);if(it===null){Te===null&&(Te=Qe);break}i&&Te&&it.alternate===null&&s(z,Te),N=h(it,N,Fe),tt===null?Me=it:tt.sibling=it,tt=it,Te=Qe}if(Fe===U.length)return r(z,Te),Je&&Js(z,Fe),Me;if(Te===null){for(;Fe<U.length;Fe++)Te=le(z,U[Fe],ne),Te!==null&&(N=h(Te,N,Fe),tt===null?Me=Te:tt.sibling=Te,tt=Te);return Je&&Js(z,Fe),Me}for(Te=l(Te);Fe<U.length;Fe++)Qe=G(Te,z,Fe,U[Fe],ne),Qe!==null&&(i&&Qe.alternate!==null&&Te.delete(Qe.key===null?Fe:Qe.key),N=h(Qe,N,Fe),tt===null?Me=Qe:tt.sibling=Qe,tt=Qe);return i&&Te.forEach(function(Vn){return s(z,Vn)}),Je&&Js(z,Fe),Me}function Ae(z,N,U,ne){if(U==null)throw Error(a(151));for(var Me=null,tt=null,Te=N,Fe=N=0,Qe=null,it=U.next();Te!==null&&!it.done;Fe++,it=U.next()){Te.index>Fe?(Qe=Te,Te=null):Qe=Te.sibling;var Vn=Y(z,Te,it.value,ne);if(Vn===null){Te===null&&(Te=Qe);break}i&&Te&&Vn.alternate===null&&s(z,Te),N=h(Vn,N,Fe),tt===null?Me=Vn:tt.sibling=Vn,tt=Vn,Te=Qe}if(it.done)return r(z,Te),Je&&Js(z,Fe),Me;if(Te===null){for(;!it.done;Fe++,it=U.next())it=le(z,it.value,ne),it!==null&&(N=h(it,N,Fe),tt===null?Me=it:tt.sibling=it,tt=it);return Je&&Js(z,Fe),Me}for(Te=l(Te);!it.done;Fe++,it=U.next())it=G(Te,z,Fe,it.value,ne),it!==null&&(i&&it.alternate!==null&&Te.delete(it.key===null?Fe:it.key),N=h(it,N,Fe),tt===null?Me=it:tt.sibling=it,tt=it);return i&&Te.forEach(function(KC){return s(z,KC)}),Je&&Js(z,Fe),Me}function ft(z,N,U,ne){if(typeof U=="object"&&U!==null&&U.type===k&&U.key===null&&(U=U.props.children),typeof U=="object"&&U!==null){switch(U.$$typeof){case x:e:{for(var Me=U.key;N!==null;){if(N.key===Me){if(Me=U.type,Me===k){if(N.tag===7){r(z,N.sibling),ne=u(N,U.props.children),ne.return=z,z=ne;break e}}else if(N.elementType===Me||typeof Me=="object"&&Me!==null&&Me.$$typeof===ie&&br(Me)===N.type){r(z,N.sibling),ne=u(N,U.props),sl(ne,U),ne.return=z,z=ne;break e}r(z,N);break}else s(z,N);N=N.sibling}U.type===k?(ne=_r(U.props.children,z.mode,ne,U.key),ne.return=z,z=ne):(ne=Po(U.type,U.key,U.props,null,z.mode,ne),sl(ne,U),ne.return=z,z=ne)}return v(z);case C:e:{for(Me=U.key;N!==null;){if(N.key===Me)if(N.tag===4&&N.stateNode.containerInfo===U.containerInfo&&N.stateNode.implementation===U.implementation){r(z,N.sibling),ne=u(N,U.children||[]),ne.return=z,z=ne;break e}else{r(z,N);break}else s(z,N);N=N.sibling}ne=lh(U,z.mode,ne),ne.return=z,z=ne}return v(z);case ie:return U=br(U),ft(z,N,U,ne)}if(Z(U))return be(z,N,U,ne);if(H(U)){if(Me=H(U),typeof Me!="function")throw Error(a(150));return U=Me.call(U),Ae(z,N,U,ne)}if(typeof U.then=="function")return ft(z,N,$o(U),ne);if(U.$$typeof===F)return ft(z,N,Fo(z,U),ne);Vo(z,U)}return typeof U=="string"&&U!==""||typeof U=="number"||typeof U=="bigint"?(U=""+U,N!==null&&N.tag===6?(r(z,N.sibling),ne=u(N,U),ne.return=z,z=ne):(r(z,N),ne=ah(U,z.mode,ne),ne.return=z,z=ne),v(z)):r(z,N)}return function(z,N,U,ne){try{il=0;var Me=ft(z,N,U,ne);return la=null,Me}catch(Te){if(Te===aa||Te===Wo)throw Te;var tt=es(29,Te,null,z.mode);return tt.lanes=ne,tt.return=z,tt}}}var Cr=M_(!0),A_=M_(!1),An=!1;function yh(i){i.updateQueue={baseState:i.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Sh(i,s){i=i.updateQueue,s.updateQueue===i&&(s.updateQueue={baseState:i.baseState,firstBaseUpdate:i.firstBaseUpdate,lastBaseUpdate:i.lastBaseUpdate,shared:i.shared,callbacks:null})}function Nn(i){return{lane:i,tag:0,payload:null,callback:null,next:null}}function Bn(i,s,r){var l=i.updateQueue;if(l===null)return null;if(l=l.shared,(st&2)!==0){var u=l.pending;return u===null?s.next=s:(s.next=u.next,u.next=s),l.pending=s,s=Uo(i),p_(i,null,r),s}return Ho(i,l,s,r),Uo(i)}function nl(i,s,r){if(s=s.updateQueue,s!==null&&(s=s.shared,(r&4194048)!==0)){var l=s.lanes;l&=i.pendingLanes,r|=l,s.lanes=r,ct(i,r)}}function bh(i,s){var r=i.updateQueue,l=i.alternate;if(l!==null&&(l=l.updateQueue,r===l)){var u=null,h=null;if(r=r.firstBaseUpdate,r!==null){do{var v={lane:r.lane,tag:r.tag,payload:r.payload,callback:null,next:null};h===null?u=h=v:h=h.next=v,r=r.next}while(r!==null);h===null?u=h=s:h=h.next=s}else u=h=s;r={baseState:l.baseState,firstBaseUpdate:u,lastBaseUpdate:h,shared:l.shared,callbacks:l.callbacks},i.updateQueue=r;return}i=r.lastBaseUpdate,i===null?r.firstBaseUpdate=s:i.next=s,r.lastBaseUpdate=s}var wh=!1;function rl(){if(wh){var i=ra;if(i!==null)throw i}}function al(i,s,r,l){wh=!1;var u=i.updateQueue;An=!1;var h=u.firstBaseUpdate,v=u.lastBaseUpdate,w=u.shared.pending;if(w!==null){u.shared.pending=null;var D=w,P=D.next;D.next=null,v===null?h=P:v.next=P,v=D;var se=i.alternate;se!==null&&(se=se.updateQueue,w=se.lastBaseUpdate,w!==v&&(w===null?se.firstBaseUpdate=P:w.next=P,se.lastBaseUpdate=D))}if(h!==null){var le=u.baseState;v=0,se=P=D=null,w=h;do{var Y=w.lane&-536870913,G=Y!==w.lane;if(G?(Ze&Y)===Y:(l&Y)===Y){Y!==0&&Y===na&&(wh=!0),se!==null&&(se=se.next={lane:0,tag:w.tag,payload:w.payload,callback:null,next:null});e:{var be=i,Ae=w;Y=s;var ft=r;switch(Ae.tag){case 1:if(be=Ae.payload,typeof be=="function"){le=be.call(ft,le,Y);break e}le=be;break e;case 3:be.flags=be.flags&-65537|128;case 0:if(be=Ae.payload,Y=typeof be=="function"?be.call(ft,le,Y):be,Y==null)break e;le=y({},le,Y);break e;case 2:An=!0}}Y=w.callback,Y!==null&&(i.flags|=64,G&&(i.flags|=8192),G=u.callbacks,G===null?u.callbacks=[Y]:G.push(Y))}else G={lane:Y,tag:w.tag,payload:w.payload,callback:w.callback,next:null},se===null?(P=se=G,D=le):se=se.next=G,v|=Y;if(w=w.next,w===null){if(w=u.shared.pending,w===null)break;G=w,w=G.next,G.next=null,u.lastBaseUpdate=G,u.shared.pending=null}}while(!0);se===null&&(D=le),u.baseState=D,u.firstBaseUpdate=P,u.lastBaseUpdate=se,h===null&&(u.shared.lanes=0),Hn|=v,i.lanes=v,i.memoizedState=le}}function N_(i,s){if(typeof i!="function")throw Error(a(191,i));i.call(s)}function B_(i,s){var r=i.callbacks;if(r!==null)for(i.callbacks=null,i=0;i<r.length;i++)N_(r[i],s)}var oa=E(null),Xo=E(0);function L_(i,s){i=hn,ee(Xo,i),ee(oa,s),hn=i|s.baseLanes}function Ch(){ee(Xo,hn),ee(oa,oa.current)}function xh(){hn=Xo.current,W(oa),W(Xo)}var ts=E(null),_s=null;function Ln(i){var s=i.alternate;ee(Pt,Pt.current&1),ee(ts,i),_s===null&&(s===null||oa.current!==null||s.memoizedState!==null)&&(_s=i)}function Eh(i){ee(Pt,Pt.current),ee(ts,i),_s===null&&(_s=i)}function O_(i){i.tag===22?(ee(Pt,Pt.current),ee(ts,i),_s===null&&(_s=i)):On()}function On(){ee(Pt,Pt.current),ee(ts,ts.current)}function is(i){W(ts),_s===i&&(_s=null),W(Pt)}var Pt=E(0);function Go(i){for(var s=i;s!==null;){if(s.tag===13){var r=s.memoizedState;if(r!==null&&(r=r.dehydrated,r===null||Ad(r)||Nd(r)))return s}else if(s.tag===19&&(s.memoizedProps.revealOrder==="forwards"||s.memoizedProps.revealOrder==="backwards"||s.memoizedProps.revealOrder==="unstable_legacy-backwards"||s.memoizedProps.revealOrder==="together")){if((s.flags&128)!==0)return s}else if(s.child!==null){s.child.return=s,s=s.child;continue}if(s===i)break;for(;s.sibling===null;){if(s.return===null||s.return===i)return null;s=s.return}s.sibling.return=s.return,s=s.sibling}return null}var sn=0,Ie=null,ht=null,Vt=null,Zo=!1,ca=!1,xr=!1,Qo=0,ll=0,ua=null,A1=0;function Ot(){throw Error(a(321))}function Th(i,s){if(s===null)return!1;for(var r=0;r<s.length&&r<i.length;r++)if(!Ji(i[r],s[r]))return!1;return!0}function kh(i,s,r,l,u,h){return sn=h,Ie=s,s.memoizedState=null,s.updateQueue=null,s.lanes=0,A.H=i===null||i.memoizedState===null?gv:Ih,xr=!1,h=r(l,u),xr=!1,ca&&(h=j_(s,r,l,u)),z_(i),h}function z_(i){A.H=ul;var s=ht!==null&&ht.next!==null;if(sn=0,Vt=ht=Ie=null,Zo=!1,ll=0,ua=null,s)throw Error(a(300));i===null||Xt||(i=i.dependencies,i!==null&&Io(i)&&(Xt=!0))}function j_(i,s,r,l){Ie=i;var u=0;do{if(ca&&(ua=null),ll=0,ca=!1,25<=u)throw Error(a(301));if(u+=1,Vt=ht=null,i.updateQueue!=null){var h=i.updateQueue;h.lastEffect=null,h.events=null,h.stores=null,h.memoCache!=null&&(h.memoCache.index=0)}A.H=yv,h=s(r,l)}while(ca);return h}function N1(){var i=A.H,s=i.useState()[0];return s=typeof s.then=="function"?ol(s):s,i=i.useState()[0],(ht!==null?ht.memoizedState:null)!==i&&(Ie.flags|=1024),s}function Dh(){var i=Qo!==0;return Qo=0,i}function Rh(i,s,r){s.updateQueue=i.updateQueue,s.flags&=-2053,i.lanes&=~r}function Mh(i){if(Zo){for(i=i.memoizedState;i!==null;){var s=i.queue;s!==null&&(s.pending=null),i=i.next}Zo=!1}sn=0,Vt=ht=Ie=null,ca=!1,ll=Qo=0,ua=null}function Bi(){var i={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Vt===null?Ie.memoizedState=Vt=i:Vt=Vt.next=i,Vt}function Kt(){if(ht===null){var i=Ie.alternate;i=i!==null?i.memoizedState:null}else i=ht.next;var s=Vt===null?Ie.memoizedState:Vt.next;if(s!==null)Vt=s,ht=i;else{if(i===null)throw Ie.alternate===null?Error(a(467)):Error(a(310));ht=i,i={memoizedState:ht.memoizedState,baseState:ht.baseState,baseQueue:ht.baseQueue,queue:ht.queue,next:null},Vt===null?Ie.memoizedState=Vt=i:Vt=Vt.next=i}return Vt}function Jo(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function ol(i){var s=ll;return ll+=1,ua===null&&(ua=[]),i=k_(ua,i,s),s=Ie,(Vt===null?s.memoizedState:Vt.next)===null&&(s=s.alternate,A.H=s===null||s.memoizedState===null?gv:Ih),i}function ec(i){if(i!==null&&typeof i=="object"){if(typeof i.then=="function")return ol(i);if(i.$$typeof===F)return bi(i)}throw Error(a(438,String(i)))}function Ah(i){var s=null,r=Ie.updateQueue;if(r!==null&&(s=r.memoCache),s==null){var l=Ie.alternate;l!==null&&(l=l.updateQueue,l!==null&&(l=l.memoCache,l!=null&&(s={data:l.data.map(function(u){return u.slice()}),index:0})))}if(s==null&&(s={data:[],index:0}),r===null&&(r=Jo(),Ie.updateQueue=r),r.memoCache=s,r=s.data[s.index],r===void 0)for(r=s.data[s.index]=Array(i),l=0;l<i;l++)r[l]=j;return s.index++,r}function nn(i,s){return typeof s=="function"?s(i):s}function tc(i){var s=Kt();return Nh(s,ht,i)}function Nh(i,s,r){var l=i.queue;if(l===null)throw Error(a(311));l.lastRenderedReducer=r;var u=i.baseQueue,h=l.pending;if(h!==null){if(u!==null){var v=u.next;u.next=h.next,h.next=v}s.baseQueue=u=h,l.pending=null}if(h=i.baseState,u===null)i.memoizedState=h;else{s=u.next;var w=v=null,D=null,P=s,se=!1;do{var le=P.lane&-536870913;if(le!==P.lane?(Ze&le)===le:(sn&le)===le){var Y=P.revertLane;if(Y===0)D!==null&&(D=D.next={lane:0,revertLane:0,gesture:null,action:P.action,hasEagerState:P.hasEagerState,eagerState:P.eagerState,next:null}),le===na&&(se=!0);else if((sn&Y)===Y){P=P.next,Y===na&&(se=!0);continue}else le={lane:0,revertLane:P.revertLane,gesture:null,action:P.action,hasEagerState:P.hasEagerState,eagerState:P.eagerState,next:null},D===null?(w=D=le,v=h):D=D.next=le,Ie.lanes|=Y,Hn|=Y;le=P.action,xr&&r(h,le),h=P.hasEagerState?P.eagerState:r(h,le)}else Y={lane:le,revertLane:P.revertLane,gesture:P.gesture,action:P.action,hasEagerState:P.hasEagerState,eagerState:P.eagerState,next:null},D===null?(w=D=Y,v=h):D=D.next=Y,Ie.lanes|=le,Hn|=le;P=P.next}while(P!==null&&P!==s);if(D===null?v=h:D.next=w,!Ji(h,i.memoizedState)&&(Xt=!0,se&&(r=ra,r!==null)))throw r;i.memoizedState=h,i.baseState=v,i.baseQueue=D,l.lastRenderedState=h}return u===null&&(l.lanes=0),[i.memoizedState,l.dispatch]}function Bh(i){var s=Kt(),r=s.queue;if(r===null)throw Error(a(311));r.lastRenderedReducer=i;var l=r.dispatch,u=r.pending,h=s.memoizedState;if(u!==null){r.pending=null;var v=u=u.next;do h=i(h,v.action),v=v.next;while(v!==u);Ji(h,s.memoizedState)||(Xt=!0),s.memoizedState=h,s.baseQueue===null&&(s.baseState=h),r.lastRenderedState=h}return[h,l]}function H_(i,s,r){var l=Ie,u=Kt(),h=Je;if(h){if(r===void 0)throw Error(a(407));r=r()}else r=s();var v=!Ji((ht||u).memoizedState,r);if(v&&(u.memoizedState=r,Xt=!0),u=u.queue,zh(K_.bind(null,l,u,i),[i]),u.getSnapshot!==s||v||Vt!==null&&Vt.memoizedState.tag&1){if(l.flags|=2048,ha(9,{destroy:void 0},P_.bind(null,l,u,r,s),null),_t===null)throw Error(a(349));h||(sn&127)!==0||U_(l,s,r)}return r}function U_(i,s,r){i.flags|=16384,i={getSnapshot:s,value:r},s=Ie.updateQueue,s===null?(s=Jo(),Ie.updateQueue=s,s.stores=[i]):(r=s.stores,r===null?s.stores=[i]:r.push(i))}function P_(i,s,r,l){s.value=r,s.getSnapshot=l,I_(s)&&F_(i)}function K_(i,s,r){return r(function(){I_(s)&&F_(i)})}function I_(i){var s=i.getSnapshot;i=i.value;try{var r=s();return!Ji(i,r)}catch{return!0}}function F_(i){var s=mr(i,2);s!==null&&Wi(s,i,2)}function Lh(i){var s=Bi();if(typeof i=="function"){var r=i;if(i=r(),xr){Jt(!0);try{r()}finally{Jt(!1)}}}return s.memoizedState=s.baseState=i,s.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:nn,lastRenderedState:i},s}function q_(i,s,r,l){return i.baseState=r,Nh(i,ht,typeof l=="function"?l:nn)}function B1(i,s,r,l,u){if(nc(i))throw Error(a(485));if(i=s.action,i!==null){var h={payload:u,action:i,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(v){h.listeners.push(v)}};A.T!==null?r(!0):h.isTransition=!1,l(h),r=s.pending,r===null?(h.next=s.pending=h,W_(s,h)):(h.next=r.next,s.pending=r.next=h)}}function W_(i,s){var r=s.action,l=s.payload,u=i.state;if(s.isTransition){var h=A.T,v={};A.T=v;try{var w=r(u,l),D=A.S;D!==null&&D(v,w),Y_(i,s,w)}catch(P){Oh(i,s,P)}finally{h!==null&&v.types!==null&&(h.types=v.types),A.T=h}}else try{h=r(u,l),Y_(i,s,h)}catch(P){Oh(i,s,P)}}function Y_(i,s,r){r!==null&&typeof r=="object"&&typeof r.then=="function"?r.then(function(l){$_(i,s,l)},function(l){return Oh(i,s,l)}):$_(i,s,r)}function $_(i,s,r){s.status="fulfilled",s.value=r,V_(s),i.state=r,s=i.pending,s!==null&&(r=s.next,r===s?i.pending=null:(r=r.next,s.next=r,W_(i,r)))}function Oh(i,s,r){var l=i.pending;if(i.pending=null,l!==null){l=l.next;do s.status="rejected",s.reason=r,V_(s),s=s.next;while(s!==l)}i.action=null}function V_(i){i=i.listeners;for(var s=0;s<i.length;s++)(0,i[s])()}function X_(i,s){return s}function G_(i,s){if(Je){var r=_t.formState;if(r!==null){e:{var l=Ie;if(Je){if(wt){t:{for(var u=wt,h=ms;u.nodeType!==8;){if(!h){u=null;break t}if(u=vs(u.nextSibling),u===null){u=null;break t}}h=u.data,u=h==="F!"||h==="F"?u:null}if(u){wt=vs(u.nextSibling),l=u.data==="F!";break e}}Rn(l)}l=!1}l&&(s=r[0])}}return r=Bi(),r.memoizedState=r.baseState=s,l={pending:null,lanes:0,dispatch:null,lastRenderedReducer:X_,lastRenderedState:s},r.queue=l,r=mv.bind(null,Ie,l),l.dispatch=r,l=Lh(!1),h=Kh.bind(null,Ie,!1,l.queue),l=Bi(),u={state:s,dispatch:null,action:i,pending:null},l.queue=u,r=B1.bind(null,Ie,u,h,r),u.dispatch=r,l.memoizedState=i,[s,r,!1]}function Z_(i){var s=Kt();return Q_(s,ht,i)}function Q_(i,s,r){if(s=Nh(i,s,X_)[0],i=tc(nn)[0],typeof s=="object"&&s!==null&&typeof s.then=="function")try{var l=ol(s)}catch(v){throw v===aa?Wo:v}else l=s;s=Kt();var u=s.queue,h=u.dispatch;return r!==s.memoizedState&&(Ie.flags|=2048,ha(9,{destroy:void 0},L1.bind(null,u,r),null)),[l,h,i]}function L1(i,s){i.action=s}function J_(i){var s=Kt(),r=ht;if(r!==null)return Q_(s,r,i);Kt(),s=s.memoizedState,r=Kt();var l=r.queue.dispatch;return r.memoizedState=i,[s,l,!1]}function ha(i,s,r,l){return i={tag:i,create:r,deps:l,inst:s,next:null},s=Ie.updateQueue,s===null&&(s=Jo(),Ie.updateQueue=s),r=s.lastEffect,r===null?s.lastEffect=i.next=i:(l=r.next,r.next=i,i.next=l,s.lastEffect=i),i}function ev(){return Kt().memoizedState}function ic(i,s,r,l){var u=Bi();Ie.flags|=i,u.memoizedState=ha(1|s,{destroy:void 0},r,l===void 0?null:l)}function sc(i,s,r,l){var u=Kt();l=l===void 0?null:l;var h=u.memoizedState.inst;ht!==null&&l!==null&&Th(l,ht.memoizedState.deps)?u.memoizedState=ha(s,h,r,l):(Ie.flags|=i,u.memoizedState=ha(1|s,h,r,l))}function tv(i,s){ic(8390656,8,i,s)}function zh(i,s){sc(2048,8,i,s)}function O1(i){Ie.flags|=4;var s=Ie.updateQueue;if(s===null)s=Jo(),Ie.updateQueue=s,s.events=[i];else{var r=s.events;r===null?s.events=[i]:r.push(i)}}function iv(i){var s=Kt().memoizedState;return O1({ref:s,nextImpl:i}),function(){if((st&2)!==0)throw Error(a(440));return s.impl.apply(void 0,arguments)}}function sv(i,s){return sc(4,2,i,s)}function nv(i,s){return sc(4,4,i,s)}function rv(i,s){if(typeof s=="function"){i=i();var r=s(i);return function(){typeof r=="function"?r():s(null)}}if(s!=null)return i=i(),s.current=i,function(){s.current=null}}function av(i,s,r){r=r!=null?r.concat([i]):null,sc(4,4,rv.bind(null,s,i),r)}function jh(){}function lv(i,s){var r=Kt();s=s===void 0?null:s;var l=r.memoizedState;return s!==null&&Th(s,l[1])?l[0]:(r.memoizedState=[i,s],i)}function ov(i,s){var r=Kt();s=s===void 0?null:s;var l=r.memoizedState;if(s!==null&&Th(s,l[1]))return l[0];if(l=i(),xr){Jt(!0);try{i()}finally{Jt(!1)}}return r.memoizedState=[l,s],l}function Hh(i,s,r){return r===void 0||(sn&1073741824)!==0&&(Ze&261930)===0?i.memoizedState=s:(i.memoizedState=r,i=cg(),Ie.lanes|=i,Hn|=i,r)}function cv(i,s,r,l){return Ji(r,s)?r:oa.current!==null?(i=Hh(i,r,l),Ji(i,s)||(Xt=!0),i):(sn&42)===0||(sn&1073741824)!==0&&(Ze&261930)===0?(Xt=!0,i.memoizedState=r):(i=cg(),Ie.lanes|=i,Hn|=i,s)}function uv(i,s,r,l,u){var h=V.p;V.p=h!==0&&8>h?h:8;var v=A.T,w={};A.T=w,Kh(i,!1,s,r);try{var D=u(),P=A.S;if(P!==null&&P(w,D),D!==null&&typeof D=="object"&&typeof D.then=="function"){var se=M1(D,l);cl(i,s,se,rs(i))}else cl(i,s,l,rs(i))}catch(le){cl(i,s,{then:function(){},status:"rejected",reason:le},rs())}finally{V.p=h,v!==null&&w.types!==null&&(v.types=w.types),A.T=v}}function z1(){}function Uh(i,s,r,l){if(i.tag!==5)throw Error(a(476));var u=hv(i).queue;uv(i,u,s,Q,r===null?z1:function(){return dv(i),r(l)})}function hv(i){var s=i.memoizedState;if(s!==null)return s;s={memoizedState:Q,baseState:Q,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:nn,lastRenderedState:Q},next:null};var r={};return s.next={memoizedState:r,baseState:r,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:nn,lastRenderedState:r},next:null},i.memoizedState=s,i=i.alternate,i!==null&&(i.memoizedState=s),s}function dv(i){var s=hv(i);s.next===null&&(s=i.alternate.memoizedState),cl(i,s.next.queue,{},rs())}function Ph(){return bi(Tl)}function fv(){return Kt().memoizedState}function pv(){return Kt().memoizedState}function j1(i){for(var s=i.return;s!==null;){switch(s.tag){case 24:case 3:var r=rs();i=Nn(r);var l=Bn(s,i,r);l!==null&&(Wi(l,s,r),nl(l,s,r)),s={cache:mh()},i.payload=s;return}s=s.return}}function H1(i,s,r){var l=rs();r={lane:l,revertLane:0,gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null},nc(i)?_v(s,r):(r=nh(i,s,r,l),r!==null&&(Wi(r,i,l),vv(r,s,l)))}function mv(i,s,r){var l=rs();cl(i,s,r,l)}function cl(i,s,r,l){var u={lane:l,revertLane:0,gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null};if(nc(i))_v(s,u);else{var h=i.alternate;if(i.lanes===0&&(h===null||h.lanes===0)&&(h=s.lastRenderedReducer,h!==null))try{var v=s.lastRenderedState,w=h(v,r);if(u.hasEagerState=!0,u.eagerState=w,Ji(w,v))return Ho(i,s,u,0),_t===null&&jo(),!1}catch{}if(r=nh(i,s,u,l),r!==null)return Wi(r,i,l),vv(r,s,l),!0}return!1}function Kh(i,s,r,l){if(l={lane:2,revertLane:yd(),gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null},nc(i)){if(s)throw Error(a(479))}else s=nh(i,r,l,2),s!==null&&Wi(s,i,2)}function nc(i){var s=i.alternate;return i===Ie||s!==null&&s===Ie}function _v(i,s){ca=Zo=!0;var r=i.pending;r===null?s.next=s:(s.next=r.next,r.next=s),i.pending=s}function vv(i,s,r){if((r&4194048)!==0){var l=s.lanes;l&=i.pendingLanes,r|=l,s.lanes=r,ct(i,r)}}var ul={readContext:bi,use:ec,useCallback:Ot,useContext:Ot,useEffect:Ot,useImperativeHandle:Ot,useLayoutEffect:Ot,useInsertionEffect:Ot,useMemo:Ot,useReducer:Ot,useRef:Ot,useState:Ot,useDebugValue:Ot,useDeferredValue:Ot,useTransition:Ot,useSyncExternalStore:Ot,useId:Ot,useHostTransitionStatus:Ot,useFormState:Ot,useActionState:Ot,useOptimistic:Ot,useMemoCache:Ot,useCacheRefresh:Ot};ul.useEffectEvent=Ot;var gv={readContext:bi,use:ec,useCallback:function(i,s){return Bi().memoizedState=[i,s===void 0?null:s],i},useContext:bi,useEffect:tv,useImperativeHandle:function(i,s,r){r=r!=null?r.concat([i]):null,ic(4194308,4,rv.bind(null,s,i),r)},useLayoutEffect:function(i,s){return ic(4194308,4,i,s)},useInsertionEffect:function(i,s){ic(4,2,i,s)},useMemo:function(i,s){var r=Bi();s=s===void 0?null:s;var l=i();if(xr){Jt(!0);try{i()}finally{Jt(!1)}}return r.memoizedState=[l,s],l},useReducer:function(i,s,r){var l=Bi();if(r!==void 0){var u=r(s);if(xr){Jt(!0);try{r(s)}finally{Jt(!1)}}}else u=s;return l.memoizedState=l.baseState=u,i={pending:null,lanes:0,dispatch:null,lastRenderedReducer:i,lastRenderedState:u},l.queue=i,i=i.dispatch=H1.bind(null,Ie,i),[l.memoizedState,i]},useRef:function(i){var s=Bi();return i={current:i},s.memoizedState=i},useState:function(i){i=Lh(i);var s=i.queue,r=mv.bind(null,Ie,s);return s.dispatch=r,[i.memoizedState,r]},useDebugValue:jh,useDeferredValue:function(i,s){var r=Bi();return Hh(r,i,s)},useTransition:function(){var i=Lh(!1);return i=uv.bind(null,Ie,i.queue,!0,!1),Bi().memoizedState=i,[!1,i]},useSyncExternalStore:function(i,s,r){var l=Ie,u=Bi();if(Je){if(r===void 0)throw Error(a(407));r=r()}else{if(r=s(),_t===null)throw Error(a(349));(Ze&127)!==0||U_(l,s,r)}u.memoizedState=r;var h={value:r,getSnapshot:s};return u.queue=h,tv(K_.bind(null,l,h,i),[i]),l.flags|=2048,ha(9,{destroy:void 0},P_.bind(null,l,h,r,s),null),r},useId:function(){var i=Bi(),s=_t.identifierPrefix;if(Je){var r=Hs,l=js;r=(l&~(1<<32-Dt(l)-1)).toString(32)+r,s="_"+s+"R_"+r,r=Qo++,0<r&&(s+="H"+r.toString(32)),s+="_"}else r=A1++,s="_"+s+"r_"+r.toString(32)+"_";return i.memoizedState=s},useHostTransitionStatus:Ph,useFormState:G_,useActionState:G_,useOptimistic:function(i){var s=Bi();s.memoizedState=s.baseState=i;var r={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return s.queue=r,s=Kh.bind(null,Ie,!0,r),r.dispatch=s,[i,s]},useMemoCache:Ah,useCacheRefresh:function(){return Bi().memoizedState=j1.bind(null,Ie)},useEffectEvent:function(i){var s=Bi(),r={impl:i};return s.memoizedState=r,function(){if((st&2)!==0)throw Error(a(440));return r.impl.apply(void 0,arguments)}}},Ih={readContext:bi,use:ec,useCallback:lv,useContext:bi,useEffect:zh,useImperativeHandle:av,useInsertionEffect:sv,useLayoutEffect:nv,useMemo:ov,useReducer:tc,useRef:ev,useState:function(){return tc(nn)},useDebugValue:jh,useDeferredValue:function(i,s){var r=Kt();return cv(r,ht.memoizedState,i,s)},useTransition:function(){var i=tc(nn)[0],s=Kt().memoizedState;return[typeof i=="boolean"?i:ol(i),s]},useSyncExternalStore:H_,useId:fv,useHostTransitionStatus:Ph,useFormState:Z_,useActionState:Z_,useOptimistic:function(i,s){var r=Kt();return q_(r,ht,i,s)},useMemoCache:Ah,useCacheRefresh:pv};Ih.useEffectEvent=iv;var yv={readContext:bi,use:ec,useCallback:lv,useContext:bi,useEffect:zh,useImperativeHandle:av,useInsertionEffect:sv,useLayoutEffect:nv,useMemo:ov,useReducer:Bh,useRef:ev,useState:function(){return Bh(nn)},useDebugValue:jh,useDeferredValue:function(i,s){var r=Kt();return ht===null?Hh(r,i,s):cv(r,ht.memoizedState,i,s)},useTransition:function(){var i=Bh(nn)[0],s=Kt().memoizedState;return[typeof i=="boolean"?i:ol(i),s]},useSyncExternalStore:H_,useId:fv,useHostTransitionStatus:Ph,useFormState:J_,useActionState:J_,useOptimistic:function(i,s){var r=Kt();return ht!==null?q_(r,ht,i,s):(r.baseState=i,[i,r.queue.dispatch])},useMemoCache:Ah,useCacheRefresh:pv};yv.useEffectEvent=iv;function Fh(i,s,r,l){s=i.memoizedState,r=r(l,s),r=r==null?s:y({},s,r),i.memoizedState=r,i.lanes===0&&(i.updateQueue.baseState=r)}var qh={enqueueSetState:function(i,s,r){i=i._reactInternals;var l=rs(),u=Nn(l);u.payload=s,r!=null&&(u.callback=r),s=Bn(i,u,l),s!==null&&(Wi(s,i,l),nl(s,i,l))},enqueueReplaceState:function(i,s,r){i=i._reactInternals;var l=rs(),u=Nn(l);u.tag=1,u.payload=s,r!=null&&(u.callback=r),s=Bn(i,u,l),s!==null&&(Wi(s,i,l),nl(s,i,l))},enqueueForceUpdate:function(i,s){i=i._reactInternals;var r=rs(),l=Nn(r);l.tag=2,s!=null&&(l.callback=s),s=Bn(i,l,r),s!==null&&(Wi(s,i,r),nl(s,i,r))}};function Sv(i,s,r,l,u,h,v){return i=i.stateNode,typeof i.shouldComponentUpdate=="function"?i.shouldComponentUpdate(l,h,v):s.prototype&&s.prototype.isPureReactComponent?!Ga(r,l)||!Ga(u,h):!0}function bv(i,s,r,l){i=s.state,typeof s.componentWillReceiveProps=="function"&&s.componentWillReceiveProps(r,l),typeof s.UNSAFE_componentWillReceiveProps=="function"&&s.UNSAFE_componentWillReceiveProps(r,l),s.state!==i&&qh.enqueueReplaceState(s,s.state,null)}function Er(i,s){var r=s;if("ref"in s){r={};for(var l in s)l!=="ref"&&(r[l]=s[l])}if(i=i.defaultProps){r===s&&(r=y({},r));for(var u in i)r[u]===void 0&&(r[u]=i[u])}return r}function wv(i){zo(i)}function Cv(i){console.error(i)}function xv(i){zo(i)}function rc(i,s){try{var r=i.onUncaughtError;r(s.value,{componentStack:s.stack})}catch(l){setTimeout(function(){throw l})}}function Ev(i,s,r){try{var l=i.onCaughtError;l(r.value,{componentStack:r.stack,errorBoundary:s.tag===1?s.stateNode:null})}catch(u){setTimeout(function(){throw u})}}function Wh(i,s,r){return r=Nn(r),r.tag=3,r.payload={element:null},r.callback=function(){rc(i,s)},r}function Tv(i){return i=Nn(i),i.tag=3,i}function kv(i,s,r,l){var u=r.type.getDerivedStateFromError;if(typeof u=="function"){var h=l.value;i.payload=function(){return u(h)},i.callback=function(){Ev(s,r,l)}}var v=r.stateNode;v!==null&&typeof v.componentDidCatch=="function"&&(i.callback=function(){Ev(s,r,l),typeof u!="function"&&(Un===null?Un=new Set([this]):Un.add(this));var w=l.stack;this.componentDidCatch(l.value,{componentStack:w!==null?w:""})})}function U1(i,s,r,l,u){if(r.flags|=32768,l!==null&&typeof l=="object"&&typeof l.then=="function"){if(s=r.alternate,s!==null&&sa(s,r,u,!0),r=ts.current,r!==null){switch(r.tag){case 31:case 13:return _s===null?vc():r.alternate===null&&zt===0&&(zt=3),r.flags&=-257,r.flags|=65536,r.lanes=u,l===Yo?r.flags|=16384:(s=r.updateQueue,s===null?r.updateQueue=new Set([l]):s.add(l),_d(i,l,u)),!1;case 22:return r.flags|=65536,l===Yo?r.flags|=16384:(s=r.updateQueue,s===null?(s={transitions:null,markerInstances:null,retryQueue:new Set([l])},r.updateQueue=s):(r=s.retryQueue,r===null?s.retryQueue=new Set([l]):r.add(l)),_d(i,l,u)),!1}throw Error(a(435,r.tag))}return _d(i,l,u),vc(),!1}if(Je)return s=ts.current,s!==null?((s.flags&65536)===0&&(s.flags|=256),s.flags|=65536,s.lanes=u,l!==uh&&(i=Error(a(422),{cause:l}),Ja(ds(i,r)))):(l!==uh&&(s=Error(a(423),{cause:l}),Ja(ds(s,r))),i=i.current.alternate,i.flags|=65536,u&=-u,i.lanes|=u,l=ds(l,r),u=Wh(i.stateNode,l,u),bh(i,u),zt!==4&&(zt=2)),!1;var h=Error(a(520),{cause:l});if(h=ds(h,r),gl===null?gl=[h]:gl.push(h),zt!==4&&(zt=2),s===null)return!0;l=ds(l,r),r=s;do{switch(r.tag){case 3:return r.flags|=65536,i=u&-u,r.lanes|=i,i=Wh(r.stateNode,l,i),bh(r,i),!1;case 1:if(s=r.type,h=r.stateNode,(r.flags&128)===0&&(typeof s.getDerivedStateFromError=="function"||h!==null&&typeof h.componentDidCatch=="function"&&(Un===null||!Un.has(h))))return r.flags|=65536,u&=-u,r.lanes|=u,u=Tv(u),kv(u,i,r,l),bh(r,u),!1}r=r.return}while(r!==null);return!1}var Yh=Error(a(461)),Xt=!1;function wi(i,s,r,l){s.child=i===null?A_(s,null,r,l):Cr(s,i.child,r,l)}function Dv(i,s,r,l,u){r=r.render;var h=s.ref;if("ref"in l){var v={};for(var w in l)w!=="ref"&&(v[w]=l[w])}else v=l;return yr(s),l=kh(i,s,r,v,h,u),w=Dh(),i!==null&&!Xt?(Rh(i,s,u),rn(i,s,u)):(Je&&w&&oh(s),s.flags|=1,wi(i,s,l,u),s.child)}function Rv(i,s,r,l,u){if(i===null){var h=r.type;return typeof h=="function"&&!rh(h)&&h.defaultProps===void 0&&r.compare===null?(s.tag=15,s.type=h,Mv(i,s,h,l,u)):(i=Po(r.type,null,l,s,s.mode,u),i.ref=s.ref,i.return=s,s.child=i)}if(h=i.child,!ed(i,u)){var v=h.memoizedProps;if(r=r.compare,r=r!==null?r:Ga,r(v,l)&&i.ref===s.ref)return rn(i,s,u)}return s.flags|=1,i=Qs(h,l),i.ref=s.ref,i.return=s,s.child=i}function Mv(i,s,r,l,u){if(i!==null){var h=i.memoizedProps;if(Ga(h,l)&&i.ref===s.ref)if(Xt=!1,s.pendingProps=l=h,ed(i,u))(i.flags&131072)!==0&&(Xt=!0);else return s.lanes=i.lanes,rn(i,s,u)}return $h(i,s,r,l,u)}function Av(i,s,r,l){var u=l.children,h=i!==null?i.memoizedState:null;if(i===null&&s.stateNode===null&&(s.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),l.mode==="hidden"){if((s.flags&128)!==0){if(h=h!==null?h.baseLanes|r:r,i!==null){for(l=s.child=i.child,u=0;l!==null;)u=u|l.lanes|l.childLanes,l=l.sibling;l=u&~h}else l=0,s.child=null;return Nv(i,s,h,r,l)}if((r&536870912)!==0)s.memoizedState={baseLanes:0,cachePool:null},i!==null&&qo(s,h!==null?h.cachePool:null),h!==null?L_(s,h):Ch(),O_(s);else return l=s.lanes=536870912,Nv(i,s,h!==null?h.baseLanes|r:r,r,l)}else h!==null?(qo(s,h.cachePool),L_(s,h),On(),s.memoizedState=null):(i!==null&&qo(s,null),Ch(),On());return wi(i,s,u,r),s.child}function hl(i,s){return i!==null&&i.tag===22||s.stateNode!==null||(s.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),s.sibling}function Nv(i,s,r,l,u){var h=vh();return h=h===null?null:{parent:$t._currentValue,pool:h},s.memoizedState={baseLanes:r,cachePool:h},i!==null&&qo(s,null),Ch(),O_(s),i!==null&&sa(i,s,l,!0),s.childLanes=u,null}function ac(i,s){return s=oc({mode:s.mode,children:s.children},i.mode),s.ref=i.ref,i.child=s,s.return=i,s}function Bv(i,s,r){return Cr(s,i.child,null,r),i=ac(s,s.pendingProps),i.flags|=2,is(s),s.memoizedState=null,i}function P1(i,s,r){var l=s.pendingProps,u=(s.flags&128)!==0;if(s.flags&=-129,i===null){if(Je){if(l.mode==="hidden")return i=ac(s,l),s.lanes=536870912,hl(null,i);if(Eh(s),(i=wt)?(i=Wg(i,ms),i=i!==null&&i.data==="&"?i:null,i!==null&&(s.memoizedState={dehydrated:i,treeContext:kn!==null?{id:js,overflow:Hs}:null,retryLane:536870912,hydrationErrors:null},r=__(i),r.return=s,s.child=r,Si=s,wt=null)):i=null,i===null)throw Rn(s);return s.lanes=536870912,null}return ac(s,l)}var h=i.memoizedState;if(h!==null){var v=h.dehydrated;if(Eh(s),u)if(s.flags&256)s.flags&=-257,s=Bv(i,s,r);else if(s.memoizedState!==null)s.child=i.child,s.flags|=128,s=null;else throw Error(a(558));else if(Xt||sa(i,s,r,!1),u=(r&i.childLanes)!==0,Xt||u){if(l=_t,l!==null&&(v=vi(l,r),v!==0&&v!==h.retryLane))throw h.retryLane=v,mr(i,v),Wi(l,i,v),Yh;vc(),s=Bv(i,s,r)}else i=h.treeContext,wt=vs(v.nextSibling),Si=s,Je=!0,Dn=null,ms=!1,i!==null&&y_(s,i),s=ac(s,l),s.flags|=4096;return s}return i=Qs(i.child,{mode:l.mode,children:l.children}),i.ref=s.ref,s.child=i,i.return=s,i}function lc(i,s){var r=s.ref;if(r===null)i!==null&&i.ref!==null&&(s.flags|=4194816);else{if(typeof r!="function"&&typeof r!="object")throw Error(a(284));(i===null||i.ref!==r)&&(s.flags|=4194816)}}function $h(i,s,r,l,u){return yr(s),r=kh(i,s,r,l,void 0,u),l=Dh(),i!==null&&!Xt?(Rh(i,s,u),rn(i,s,u)):(Je&&l&&oh(s),s.flags|=1,wi(i,s,r,u),s.child)}function Lv(i,s,r,l,u,h){return yr(s),s.updateQueue=null,r=j_(s,l,r,u),z_(i),l=Dh(),i!==null&&!Xt?(Rh(i,s,h),rn(i,s,h)):(Je&&l&&oh(s),s.flags|=1,wi(i,s,r,h),s.child)}function Ov(i,s,r,l,u){if(yr(s),s.stateNode===null){var h=Jr,v=r.contextType;typeof v=="object"&&v!==null&&(h=bi(v)),h=new r(l,h),s.memoizedState=h.state!==null&&h.state!==void 0?h.state:null,h.updater=qh,s.stateNode=h,h._reactInternals=s,h=s.stateNode,h.props=l,h.state=s.memoizedState,h.refs={},yh(s),v=r.contextType,h.context=typeof v=="object"&&v!==null?bi(v):Jr,h.state=s.memoizedState,v=r.getDerivedStateFromProps,typeof v=="function"&&(Fh(s,r,v,l),h.state=s.memoizedState),typeof r.getDerivedStateFromProps=="function"||typeof h.getSnapshotBeforeUpdate=="function"||typeof h.UNSAFE_componentWillMount!="function"&&typeof h.componentWillMount!="function"||(v=h.state,typeof h.componentWillMount=="function"&&h.componentWillMount(),typeof h.UNSAFE_componentWillMount=="function"&&h.UNSAFE_componentWillMount(),v!==h.state&&qh.enqueueReplaceState(h,h.state,null),al(s,l,h,u),rl(),h.state=s.memoizedState),typeof h.componentDidMount=="function"&&(s.flags|=4194308),l=!0}else if(i===null){h=s.stateNode;var w=s.memoizedProps,D=Er(r,w);h.props=D;var P=h.context,se=r.contextType;v=Jr,typeof se=="object"&&se!==null&&(v=bi(se));var le=r.getDerivedStateFromProps;se=typeof le=="function"||typeof h.getSnapshotBeforeUpdate=="function",w=s.pendingProps!==w,se||typeof h.UNSAFE_componentWillReceiveProps!="function"&&typeof h.componentWillReceiveProps!="function"||(w||P!==v)&&bv(s,h,l,v),An=!1;var Y=s.memoizedState;h.state=Y,al(s,l,h,u),rl(),P=s.memoizedState,w||Y!==P||An?(typeof le=="function"&&(Fh(s,r,le,l),P=s.memoizedState),(D=An||Sv(s,r,D,l,Y,P,v))?(se||typeof h.UNSAFE_componentWillMount!="function"&&typeof h.componentWillMount!="function"||(typeof h.componentWillMount=="function"&&h.componentWillMount(),typeof h.UNSAFE_componentWillMount=="function"&&h.UNSAFE_componentWillMount()),typeof h.componentDidMount=="function"&&(s.flags|=4194308)):(typeof h.componentDidMount=="function"&&(s.flags|=4194308),s.memoizedProps=l,s.memoizedState=P),h.props=l,h.state=P,h.context=v,l=D):(typeof h.componentDidMount=="function"&&(s.flags|=4194308),l=!1)}else{h=s.stateNode,Sh(i,s),v=s.memoizedProps,se=Er(r,v),h.props=se,le=s.pendingProps,Y=h.context,P=r.contextType,D=Jr,typeof P=="object"&&P!==null&&(D=bi(P)),w=r.getDerivedStateFromProps,(P=typeof w=="function"||typeof h.getSnapshotBeforeUpdate=="function")||typeof h.UNSAFE_componentWillReceiveProps!="function"&&typeof h.componentWillReceiveProps!="function"||(v!==le||Y!==D)&&bv(s,h,l,D),An=!1,Y=s.memoizedState,h.state=Y,al(s,l,h,u),rl();var G=s.memoizedState;v!==le||Y!==G||An||i!==null&&i.dependencies!==null&&Io(i.dependencies)?(typeof w=="function"&&(Fh(s,r,w,l),G=s.memoizedState),(se=An||Sv(s,r,se,l,Y,G,D)||i!==null&&i.dependencies!==null&&Io(i.dependencies))?(P||typeof h.UNSAFE_componentWillUpdate!="function"&&typeof h.componentWillUpdate!="function"||(typeof h.componentWillUpdate=="function"&&h.componentWillUpdate(l,G,D),typeof h.UNSAFE_componentWillUpdate=="function"&&h.UNSAFE_componentWillUpdate(l,G,D)),typeof h.componentDidUpdate=="function"&&(s.flags|=4),typeof h.getSnapshotBeforeUpdate=="function"&&(s.flags|=1024)):(typeof h.componentDidUpdate!="function"||v===i.memoizedProps&&Y===i.memoizedState||(s.flags|=4),typeof h.getSnapshotBeforeUpdate!="function"||v===i.memoizedProps&&Y===i.memoizedState||(s.flags|=1024),s.memoizedProps=l,s.memoizedState=G),h.props=l,h.state=G,h.context=D,l=se):(typeof h.componentDidUpdate!="function"||v===i.memoizedProps&&Y===i.memoizedState||(s.flags|=4),typeof h.getSnapshotBeforeUpdate!="function"||v===i.memoizedProps&&Y===i.memoizedState||(s.flags|=1024),l=!1)}return h=l,lc(i,s),l=(s.flags&128)!==0,h||l?(h=s.stateNode,r=l&&typeof r.getDerivedStateFromError!="function"?null:h.render(),s.flags|=1,i!==null&&l?(s.child=Cr(s,i.child,null,u),s.child=Cr(s,null,r,u)):wi(i,s,r,u),s.memoizedState=h.state,i=s.child):i=rn(i,s,u),i}function zv(i,s,r,l){return vr(),s.flags|=256,wi(i,s,r,l),s.child}var Vh={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Xh(i){return{baseLanes:i,cachePool:E_()}}function Gh(i,s,r){return i=i!==null?i.childLanes&~r:0,s&&(i|=ns),i}function jv(i,s,r){var l=s.pendingProps,u=!1,h=(s.flags&128)!==0,v;if((v=h)||(v=i!==null&&i.memoizedState===null?!1:(Pt.current&2)!==0),v&&(u=!0,s.flags&=-129),v=(s.flags&32)!==0,s.flags&=-33,i===null){if(Je){if(u?Ln(s):On(),(i=wt)?(i=Wg(i,ms),i=i!==null&&i.data!=="&"?i:null,i!==null&&(s.memoizedState={dehydrated:i,treeContext:kn!==null?{id:js,overflow:Hs}:null,retryLane:536870912,hydrationErrors:null},r=__(i),r.return=s,s.child=r,Si=s,wt=null)):i=null,i===null)throw Rn(s);return Nd(i)?s.lanes=32:s.lanes=536870912,null}var w=l.children;return l=l.fallback,u?(On(),u=s.mode,w=oc({mode:"hidden",children:w},u),l=_r(l,u,r,null),w.return=s,l.return=s,w.sibling=l,s.child=w,l=s.child,l.memoizedState=Xh(r),l.childLanes=Gh(i,v,r),s.memoizedState=Vh,hl(null,l)):(Ln(s),Zh(s,w))}var D=i.memoizedState;if(D!==null&&(w=D.dehydrated,w!==null)){if(h)s.flags&256?(Ln(s),s.flags&=-257,s=Qh(i,s,r)):s.memoizedState!==null?(On(),s.child=i.child,s.flags|=128,s=null):(On(),w=l.fallback,u=s.mode,l=oc({mode:"visible",children:l.children},u),w=_r(w,u,r,null),w.flags|=2,l.return=s,w.return=s,l.sibling=w,s.child=l,Cr(s,i.child,null,r),l=s.child,l.memoizedState=Xh(r),l.childLanes=Gh(i,v,r),s.memoizedState=Vh,s=hl(null,l));else if(Ln(s),Nd(w)){if(v=w.nextSibling&&w.nextSibling.dataset,v)var P=v.dgst;v=P,l=Error(a(419)),l.stack="",l.digest=v,Ja({value:l,source:null,stack:null}),s=Qh(i,s,r)}else if(Xt||sa(i,s,r,!1),v=(r&i.childLanes)!==0,Xt||v){if(v=_t,v!==null&&(l=vi(v,r),l!==0&&l!==D.retryLane))throw D.retryLane=l,mr(i,l),Wi(v,i,l),Yh;Ad(w)||vc(),s=Qh(i,s,r)}else Ad(w)?(s.flags|=192,s.child=i.child,s=null):(i=D.treeContext,wt=vs(w.nextSibling),Si=s,Je=!0,Dn=null,ms=!1,i!==null&&y_(s,i),s=Zh(s,l.children),s.flags|=4096);return s}return u?(On(),w=l.fallback,u=s.mode,D=i.child,P=D.sibling,l=Qs(D,{mode:"hidden",children:l.children}),l.subtreeFlags=D.subtreeFlags&65011712,P!==null?w=Qs(P,w):(w=_r(w,u,r,null),w.flags|=2),w.return=s,l.return=s,l.sibling=w,s.child=l,hl(null,l),l=s.child,w=i.child.memoizedState,w===null?w=Xh(r):(u=w.cachePool,u!==null?(D=$t._currentValue,u=u.parent!==D?{parent:D,pool:D}:u):u=E_(),w={baseLanes:w.baseLanes|r,cachePool:u}),l.memoizedState=w,l.childLanes=Gh(i,v,r),s.memoizedState=Vh,hl(i.child,l)):(Ln(s),r=i.child,i=r.sibling,r=Qs(r,{mode:"visible",children:l.children}),r.return=s,r.sibling=null,i!==null&&(v=s.deletions,v===null?(s.deletions=[i],s.flags|=16):v.push(i)),s.child=r,s.memoizedState=null,r)}function Zh(i,s){return s=oc({mode:"visible",children:s},i.mode),s.return=i,i.child=s}function oc(i,s){return i=es(22,i,null,s),i.lanes=0,i}function Qh(i,s,r){return Cr(s,i.child,null,r),i=Zh(s,s.pendingProps.children),i.flags|=2,s.memoizedState=null,i}function Hv(i,s,r){i.lanes|=s;var l=i.alternate;l!==null&&(l.lanes|=s),fh(i.return,s,r)}function Jh(i,s,r,l,u,h){var v=i.memoizedState;v===null?i.memoizedState={isBackwards:s,rendering:null,renderingStartTime:0,last:l,tail:r,tailMode:u,treeForkCount:h}:(v.isBackwards=s,v.rendering=null,v.renderingStartTime=0,v.last=l,v.tail=r,v.tailMode=u,v.treeForkCount=h)}function Uv(i,s,r){var l=s.pendingProps,u=l.revealOrder,h=l.tail;l=l.children;var v=Pt.current,w=(v&2)!==0;if(w?(v=v&1|2,s.flags|=128):v&=1,ee(Pt,v),wi(i,s,l,r),l=Je?Qa:0,!w&&i!==null&&(i.flags&128)!==0)e:for(i=s.child;i!==null;){if(i.tag===13)i.memoizedState!==null&&Hv(i,r,s);else if(i.tag===19)Hv(i,r,s);else if(i.child!==null){i.child.return=i,i=i.child;continue}if(i===s)break e;for(;i.sibling===null;){if(i.return===null||i.return===s)break e;i=i.return}i.sibling.return=i.return,i=i.sibling}switch(u){case"forwards":for(r=s.child,u=null;r!==null;)i=r.alternate,i!==null&&Go(i)===null&&(u=r),r=r.sibling;r=u,r===null?(u=s.child,s.child=null):(u=r.sibling,r.sibling=null),Jh(s,!1,u,r,h,l);break;case"backwards":case"unstable_legacy-backwards":for(r=null,u=s.child,s.child=null;u!==null;){if(i=u.alternate,i!==null&&Go(i)===null){s.child=u;break}i=u.sibling,u.sibling=r,r=u,u=i}Jh(s,!0,r,null,h,l);break;case"together":Jh(s,!1,null,null,void 0,l);break;default:s.memoizedState=null}return s.child}function rn(i,s,r){if(i!==null&&(s.dependencies=i.dependencies),Hn|=s.lanes,(r&s.childLanes)===0)if(i!==null){if(sa(i,s,r,!1),(r&s.childLanes)===0)return null}else return null;if(i!==null&&s.child!==i.child)throw Error(a(153));if(s.child!==null){for(i=s.child,r=Qs(i,i.pendingProps),s.child=r,r.return=s;i.sibling!==null;)i=i.sibling,r=r.sibling=Qs(i,i.pendingProps),r.return=s;r.sibling=null}return s.child}function ed(i,s){return(i.lanes&s)!==0?!0:(i=i.dependencies,!!(i!==null&&Io(i)))}function K1(i,s,r){switch(s.tag){case 3:ze(s,s.stateNode.containerInfo),Mn(s,$t,i.memoizedState.cache),vr();break;case 27:case 5:Re(s);break;case 4:ze(s,s.stateNode.containerInfo);break;case 10:Mn(s,s.type,s.memoizedProps.value);break;case 31:if(s.memoizedState!==null)return s.flags|=128,Eh(s),null;break;case 13:var l=s.memoizedState;if(l!==null)return l.dehydrated!==null?(Ln(s),s.flags|=128,null):(r&s.child.childLanes)!==0?jv(i,s,r):(Ln(s),i=rn(i,s,r),i!==null?i.sibling:null);Ln(s);break;case 19:var u=(i.flags&128)!==0;if(l=(r&s.childLanes)!==0,l||(sa(i,s,r,!1),l=(r&s.childLanes)!==0),u){if(l)return Uv(i,s,r);s.flags|=128}if(u=s.memoizedState,u!==null&&(u.rendering=null,u.tail=null,u.lastEffect=null),ee(Pt,Pt.current),l)break;return null;case 22:return s.lanes=0,Av(i,s,r,s.pendingProps);case 24:Mn(s,$t,i.memoizedState.cache)}return rn(i,s,r)}function Pv(i,s,r){if(i!==null)if(i.memoizedProps!==s.pendingProps)Xt=!0;else{if(!ed(i,r)&&(s.flags&128)===0)return Xt=!1,K1(i,s,r);Xt=(i.flags&131072)!==0}else Xt=!1,Je&&(s.flags&1048576)!==0&&g_(s,Qa,s.index);switch(s.lanes=0,s.tag){case 16:e:{var l=s.pendingProps;if(i=br(s.elementType),s.type=i,typeof i=="function")rh(i)?(l=Er(i,l),s.tag=1,s=Ov(null,s,i,l,r)):(s.tag=0,s=$h(null,s,i,l,r));else{if(i!=null){var u=i.$$typeof;if(u===J){s.tag=11,s=Dv(null,s,i,l,r);break e}else if(u===I){s.tag=14,s=Rv(null,s,i,l,r);break e}}throw s=X(i)||i,Error(a(306,s,""))}}return s;case 0:return $h(i,s,s.type,s.pendingProps,r);case 1:return l=s.type,u=Er(l,s.pendingProps),Ov(i,s,l,u,r);case 3:e:{if(ze(s,s.stateNode.containerInfo),i===null)throw Error(a(387));l=s.pendingProps;var h=s.memoizedState;u=h.element,Sh(i,s),al(s,l,null,r);var v=s.memoizedState;if(l=v.cache,Mn(s,$t,l),l!==h.cache&&ph(s,[$t],r,!0),rl(),l=v.element,h.isDehydrated)if(h={element:l,isDehydrated:!1,cache:v.cache},s.updateQueue.baseState=h,s.memoizedState=h,s.flags&256){s=zv(i,s,l,r);break e}else if(l!==u){u=ds(Error(a(424)),s),Ja(u),s=zv(i,s,l,r);break e}else for(i=s.stateNode.containerInfo,i.nodeType===9?i=i.body:i=i.nodeName==="HTML"?i.ownerDocument.body:i,wt=vs(i.firstChild),Si=s,Je=!0,Dn=null,ms=!0,r=A_(s,null,l,r),s.child=r;r;)r.flags=r.flags&-3|4096,r=r.sibling;else{if(vr(),l===u){s=rn(i,s,r);break e}wi(i,s,l,r)}s=s.child}return s;case 26:return lc(i,s),i===null?(r=Zg(s.type,null,s.pendingProps,null))?s.memoizedState=r:Je||(r=s.type,i=s.pendingProps,l=xc(me.current).createElement(r),l[mt]=s,l[Yt]=i,Ci(l,r,i),Lt(l),s.stateNode=l):s.memoizedState=Zg(s.type,i.memoizedProps,s.pendingProps,i.memoizedState),null;case 27:return Re(s),i===null&&Je&&(l=s.stateNode=Vg(s.type,s.pendingProps,me.current),Si=s,ms=!0,u=wt,Fn(s.type)?(Bd=u,wt=vs(l.firstChild)):wt=u),wi(i,s,s.pendingProps.children,r),lc(i,s),i===null&&(s.flags|=4194304),s.child;case 5:return i===null&&Je&&((u=l=wt)&&(l=vC(l,s.type,s.pendingProps,ms),l!==null?(s.stateNode=l,Si=s,wt=vs(l.firstChild),ms=!1,u=!0):u=!1),u||Rn(s)),Re(s),u=s.type,h=s.pendingProps,v=i!==null?i.memoizedProps:null,l=h.children,Dd(u,h)?l=null:v!==null&&Dd(u,v)&&(s.flags|=32),s.memoizedState!==null&&(u=kh(i,s,N1,null,null,r),Tl._currentValue=u),lc(i,s),wi(i,s,l,r),s.child;case 6:return i===null&&Je&&((i=r=wt)&&(r=gC(r,s.pendingProps,ms),r!==null?(s.stateNode=r,Si=s,wt=null,i=!0):i=!1),i||Rn(s)),null;case 13:return jv(i,s,r);case 4:return ze(s,s.stateNode.containerInfo),l=s.pendingProps,i===null?s.child=Cr(s,null,l,r):wi(i,s,l,r),s.child;case 11:return Dv(i,s,s.type,s.pendingProps,r);case 7:return wi(i,s,s.pendingProps,r),s.child;case 8:return wi(i,s,s.pendingProps.children,r),s.child;case 12:return wi(i,s,s.pendingProps.children,r),s.child;case 10:return l=s.pendingProps,Mn(s,s.type,l.value),wi(i,s,l.children,r),s.child;case 9:return u=s.type._context,l=s.pendingProps.children,yr(s),u=bi(u),l=l(u),s.flags|=1,wi(i,s,l,r),s.child;case 14:return Rv(i,s,s.type,s.pendingProps,r);case 15:return Mv(i,s,s.type,s.pendingProps,r);case 19:return Uv(i,s,r);case 31:return P1(i,s,r);case 22:return Av(i,s,r,s.pendingProps);case 24:return yr(s),l=bi($t),i===null?(u=vh(),u===null&&(u=_t,h=mh(),u.pooledCache=h,h.refCount++,h!==null&&(u.pooledCacheLanes|=r),u=h),s.memoizedState={parent:l,cache:u},yh(s),Mn(s,$t,u)):((i.lanes&r)!==0&&(Sh(i,s),al(s,null,null,r),rl()),u=i.memoizedState,h=s.memoizedState,u.parent!==l?(u={parent:l,cache:l},s.memoizedState=u,s.lanes===0&&(s.memoizedState=s.updateQueue.baseState=u),Mn(s,$t,l)):(l=h.cache,Mn(s,$t,l),l!==u.cache&&ph(s,[$t],r,!0))),wi(i,s,s.pendingProps.children,r),s.child;case 29:throw s.pendingProps}throw Error(a(156,s.tag))}function an(i){i.flags|=4}function td(i,s,r,l,u){if((s=(i.mode&32)!==0)&&(s=!1),s){if(i.flags|=16777216,(u&335544128)===u)if(i.stateNode.complete)i.flags|=8192;else if(fg())i.flags|=8192;else throw wr=Yo,gh}else i.flags&=-16777217}function Kv(i,s){if(s.type!=="stylesheet"||(s.state.loading&4)!==0)i.flags&=-16777217;else if(i.flags|=16777216,!iy(s))if(fg())i.flags|=8192;else throw wr=Yo,gh}function cc(i,s){s!==null&&(i.flags|=4),i.flags&16384&&(s=i.tag!==22?Bt():536870912,i.lanes|=s,ma|=s)}function dl(i,s){if(!Je)switch(i.tailMode){case"hidden":s=i.tail;for(var r=null;s!==null;)s.alternate!==null&&(r=s),s=s.sibling;r===null?i.tail=null:r.sibling=null;break;case"collapsed":r=i.tail;for(var l=null;r!==null;)r.alternate!==null&&(l=r),r=r.sibling;l===null?s||i.tail===null?i.tail=null:i.tail.sibling=null:l.sibling=null}}function Ct(i){var s=i.alternate!==null&&i.alternate.child===i.child,r=0,l=0;if(s)for(var u=i.child;u!==null;)r|=u.lanes|u.childLanes,l|=u.subtreeFlags&65011712,l|=u.flags&65011712,u.return=i,u=u.sibling;else for(u=i.child;u!==null;)r|=u.lanes|u.childLanes,l|=u.subtreeFlags,l|=u.flags,u.return=i,u=u.sibling;return i.subtreeFlags|=l,i.childLanes=r,s}function I1(i,s,r){var l=s.pendingProps;switch(ch(s),s.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Ct(s),null;case 1:return Ct(s),null;case 3:return r=s.stateNode,l=null,i!==null&&(l=i.memoizedState.cache),s.memoizedState.cache!==l&&(s.flags|=2048),tn($t),Ne(),r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),(i===null||i.child===null)&&(ia(s)?an(s):i===null||i.memoizedState.isDehydrated&&(s.flags&256)===0||(s.flags|=1024,hh())),Ct(s),null;case 26:var u=s.type,h=s.memoizedState;return i===null?(an(s),h!==null?(Ct(s),Kv(s,h)):(Ct(s),td(s,u,null,l,r))):h?h!==i.memoizedState?(an(s),Ct(s),Kv(s,h)):(Ct(s),s.flags&=-16777217):(i=i.memoizedProps,i!==l&&an(s),Ct(s),td(s,u,i,l,r)),null;case 27:if(Pe(s),r=me.current,u=s.type,i!==null&&s.stateNode!=null)i.memoizedProps!==l&&an(s);else{if(!l){if(s.stateNode===null)throw Error(a(166));return Ct(s),null}i=he.current,ia(s)?S_(s):(i=Vg(u,l,r),s.stateNode=i,an(s))}return Ct(s),null;case 5:if(Pe(s),u=s.type,i!==null&&s.stateNode!=null)i.memoizedProps!==l&&an(s);else{if(!l){if(s.stateNode===null)throw Error(a(166));return Ct(s),null}if(h=he.current,ia(s))S_(s);else{var v=xc(me.current);switch(h){case 1:h=v.createElementNS("http://www.w3.org/2000/svg",u);break;case 2:h=v.createElementNS("http://www.w3.org/1998/Math/MathML",u);break;default:switch(u){case"svg":h=v.createElementNS("http://www.w3.org/2000/svg",u);break;case"math":h=v.createElementNS("http://www.w3.org/1998/Math/MathML",u);break;case"script":h=v.createElement("div"),h.innerHTML="<script><\/script>",h=h.removeChild(h.firstChild);break;case"select":h=typeof l.is=="string"?v.createElement("select",{is:l.is}):v.createElement("select"),l.multiple?h.multiple=!0:l.size&&(h.size=l.size);break;default:h=typeof l.is=="string"?v.createElement(u,{is:l.is}):v.createElement(u)}}h[mt]=s,h[Yt]=l;e:for(v=s.child;v!==null;){if(v.tag===5||v.tag===6)h.appendChild(v.stateNode);else if(v.tag!==4&&v.tag!==27&&v.child!==null){v.child.return=v,v=v.child;continue}if(v===s)break e;for(;v.sibling===null;){if(v.return===null||v.return===s)break e;v=v.return}v.sibling.return=v.return,v=v.sibling}s.stateNode=h;e:switch(Ci(h,u,l),u){case"button":case"input":case"select":case"textarea":l=!!l.autoFocus;break e;case"img":l=!0;break e;default:l=!1}l&&an(s)}}return Ct(s),td(s,s.type,i===null?null:i.memoizedProps,s.pendingProps,r),null;case 6:if(i&&s.stateNode!=null)i.memoizedProps!==l&&an(s);else{if(typeof l!="string"&&s.stateNode===null)throw Error(a(166));if(i=me.current,ia(s)){if(i=s.stateNode,r=s.memoizedProps,l=null,u=Si,u!==null)switch(u.tag){case 27:case 5:l=u.memoizedProps}i[mt]=s,i=!!(i.nodeValue===r||l!==null&&l.suppressHydrationWarning===!0||jg(i.nodeValue,r)),i||Rn(s,!0)}else i=xc(i).createTextNode(l),i[mt]=s,s.stateNode=i}return Ct(s),null;case 31:if(r=s.memoizedState,i===null||i.memoizedState!==null){if(l=ia(s),r!==null){if(i===null){if(!l)throw Error(a(318));if(i=s.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(a(557));i[mt]=s}else vr(),(s.flags&128)===0&&(s.memoizedState=null),s.flags|=4;Ct(s),i=!1}else r=hh(),i!==null&&i.memoizedState!==null&&(i.memoizedState.hydrationErrors=r),i=!0;if(!i)return s.flags&256?(is(s),s):(is(s),null);if((s.flags&128)!==0)throw Error(a(558))}return Ct(s),null;case 13:if(l=s.memoizedState,i===null||i.memoizedState!==null&&i.memoizedState.dehydrated!==null){if(u=ia(s),l!==null&&l.dehydrated!==null){if(i===null){if(!u)throw Error(a(318));if(u=s.memoizedState,u=u!==null?u.dehydrated:null,!u)throw Error(a(317));u[mt]=s}else vr(),(s.flags&128)===0&&(s.memoizedState=null),s.flags|=4;Ct(s),u=!1}else u=hh(),i!==null&&i.memoizedState!==null&&(i.memoizedState.hydrationErrors=u),u=!0;if(!u)return s.flags&256?(is(s),s):(is(s),null)}return is(s),(s.flags&128)!==0?(s.lanes=r,s):(r=l!==null,i=i!==null&&i.memoizedState!==null,r&&(l=s.child,u=null,l.alternate!==null&&l.alternate.memoizedState!==null&&l.alternate.memoizedState.cachePool!==null&&(u=l.alternate.memoizedState.cachePool.pool),h=null,l.memoizedState!==null&&l.memoizedState.cachePool!==null&&(h=l.memoizedState.cachePool.pool),h!==u&&(l.flags|=2048)),r!==i&&r&&(s.child.flags|=8192),cc(s,s.updateQueue),Ct(s),null);case 4:return Ne(),i===null&&Cd(s.stateNode.containerInfo),Ct(s),null;case 10:return tn(s.type),Ct(s),null;case 19:if(W(Pt),l=s.memoizedState,l===null)return Ct(s),null;if(u=(s.flags&128)!==0,h=l.rendering,h===null)if(u)dl(l,!1);else{if(zt!==0||i!==null&&(i.flags&128)!==0)for(i=s.child;i!==null;){if(h=Go(i),h!==null){for(s.flags|=128,dl(l,!1),i=h.updateQueue,s.updateQueue=i,cc(s,i),s.subtreeFlags=0,i=r,r=s.child;r!==null;)m_(r,i),r=r.sibling;return ee(Pt,Pt.current&1|2),Je&&Js(s,l.treeForkCount),s.child}i=i.sibling}l.tail!==null&&He()>pc&&(s.flags|=128,u=!0,dl(l,!1),s.lanes=4194304)}else{if(!u)if(i=Go(h),i!==null){if(s.flags|=128,u=!0,i=i.updateQueue,s.updateQueue=i,cc(s,i),dl(l,!0),l.tail===null&&l.tailMode==="hidden"&&!h.alternate&&!Je)return Ct(s),null}else 2*He()-l.renderingStartTime>pc&&r!==536870912&&(s.flags|=128,u=!0,dl(l,!1),s.lanes=4194304);l.isBackwards?(h.sibling=s.child,s.child=h):(i=l.last,i!==null?i.sibling=h:s.child=h,l.last=h)}return l.tail!==null?(i=l.tail,l.rendering=i,l.tail=i.sibling,l.renderingStartTime=He(),i.sibling=null,r=Pt.current,ee(Pt,u?r&1|2:r&1),Je&&Js(s,l.treeForkCount),i):(Ct(s),null);case 22:case 23:return is(s),xh(),l=s.memoizedState!==null,i!==null?i.memoizedState!==null!==l&&(s.flags|=8192):l&&(s.flags|=8192),l?(r&536870912)!==0&&(s.flags&128)===0&&(Ct(s),s.subtreeFlags&6&&(s.flags|=8192)):Ct(s),r=s.updateQueue,r!==null&&cc(s,r.retryQueue),r=null,i!==null&&i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(r=i.memoizedState.cachePool.pool),l=null,s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(l=s.memoizedState.cachePool.pool),l!==r&&(s.flags|=2048),i!==null&&W(Sr),null;case 24:return r=null,i!==null&&(r=i.memoizedState.cache),s.memoizedState.cache!==r&&(s.flags|=2048),tn($t),Ct(s),null;case 25:return null;case 30:return null}throw Error(a(156,s.tag))}function F1(i,s){switch(ch(s),s.tag){case 1:return i=s.flags,i&65536?(s.flags=i&-65537|128,s):null;case 3:return tn($t),Ne(),i=s.flags,(i&65536)!==0&&(i&128)===0?(s.flags=i&-65537|128,s):null;case 26:case 27:case 5:return Pe(s),null;case 31:if(s.memoizedState!==null){if(is(s),s.alternate===null)throw Error(a(340));vr()}return i=s.flags,i&65536?(s.flags=i&-65537|128,s):null;case 13:if(is(s),i=s.memoizedState,i!==null&&i.dehydrated!==null){if(s.alternate===null)throw Error(a(340));vr()}return i=s.flags,i&65536?(s.flags=i&-65537|128,s):null;case 19:return W(Pt),null;case 4:return Ne(),null;case 10:return tn(s.type),null;case 22:case 23:return is(s),xh(),i!==null&&W(Sr),i=s.flags,i&65536?(s.flags=i&-65537|128,s):null;case 24:return tn($t),null;case 25:return null;default:return null}}function Iv(i,s){switch(ch(s),s.tag){case 3:tn($t),Ne();break;case 26:case 27:case 5:Pe(s);break;case 4:Ne();break;case 31:s.memoizedState!==null&&is(s);break;case 13:is(s);break;case 19:W(Pt);break;case 10:tn(s.type);break;case 22:case 23:is(s),xh(),i!==null&&W(Sr);break;case 24:tn($t)}}function fl(i,s){try{var r=s.updateQueue,l=r!==null?r.lastEffect:null;if(l!==null){var u=l.next;r=u;do{if((r.tag&i)===i){l=void 0;var h=r.create,v=r.inst;l=h(),v.destroy=l}r=r.next}while(r!==u)}}catch(w){lt(s,s.return,w)}}function zn(i,s,r){try{var l=s.updateQueue,u=l!==null?l.lastEffect:null;if(u!==null){var h=u.next;l=h;do{if((l.tag&i)===i){var v=l.inst,w=v.destroy;if(w!==void 0){v.destroy=void 0,u=s;var D=r,P=w;try{P()}catch(se){lt(u,D,se)}}}l=l.next}while(l!==h)}}catch(se){lt(s,s.return,se)}}function Fv(i){var s=i.updateQueue;if(s!==null){var r=i.stateNode;try{B_(s,r)}catch(l){lt(i,i.return,l)}}}function qv(i,s,r){r.props=Er(i.type,i.memoizedProps),r.state=i.memoizedState;try{r.componentWillUnmount()}catch(l){lt(i,s,l)}}function pl(i,s){try{var r=i.ref;if(r!==null){switch(i.tag){case 26:case 27:case 5:var l=i.stateNode;break;case 30:l=i.stateNode;break;default:l=i.stateNode}typeof r=="function"?i.refCleanup=r(l):r.current=l}}catch(u){lt(i,s,u)}}function Us(i,s){var r=i.ref,l=i.refCleanup;if(r!==null)if(typeof l=="function")try{l()}catch(u){lt(i,s,u)}finally{i.refCleanup=null,i=i.alternate,i!=null&&(i.refCleanup=null)}else if(typeof r=="function")try{r(null)}catch(u){lt(i,s,u)}else r.current=null}function Wv(i){var s=i.type,r=i.memoizedProps,l=i.stateNode;try{e:switch(s){case"button":case"input":case"select":case"textarea":r.autoFocus&&l.focus();break e;case"img":r.src?l.src=r.src:r.srcSet&&(l.srcset=r.srcSet)}}catch(u){lt(i,i.return,u)}}function id(i,s,r){try{var l=i.stateNode;hC(l,i.type,r,s),l[Yt]=s}catch(u){lt(i,i.return,u)}}function Yv(i){return i.tag===5||i.tag===3||i.tag===26||i.tag===27&&Fn(i.type)||i.tag===4}function sd(i){e:for(;;){for(;i.sibling===null;){if(i.return===null||Yv(i.return))return null;i=i.return}for(i.sibling.return=i.return,i=i.sibling;i.tag!==5&&i.tag!==6&&i.tag!==18;){if(i.tag===27&&Fn(i.type)||i.flags&2||i.child===null||i.tag===4)continue e;i.child.return=i,i=i.child}if(!(i.flags&2))return i.stateNode}}function nd(i,s,r){var l=i.tag;if(l===5||l===6)i=i.stateNode,s?(r.nodeType===9?r.body:r.nodeName==="HTML"?r.ownerDocument.body:r).insertBefore(i,s):(s=r.nodeType===9?r.body:r.nodeName==="HTML"?r.ownerDocument.body:r,s.appendChild(i),r=r._reactRootContainer,r!=null||s.onclick!==null||(s.onclick=Gs));else if(l!==4&&(l===27&&Fn(i.type)&&(r=i.stateNode,s=null),i=i.child,i!==null))for(nd(i,s,r),i=i.sibling;i!==null;)nd(i,s,r),i=i.sibling}function uc(i,s,r){var l=i.tag;if(l===5||l===6)i=i.stateNode,s?r.insertBefore(i,s):r.appendChild(i);else if(l!==4&&(l===27&&Fn(i.type)&&(r=i.stateNode),i=i.child,i!==null))for(uc(i,s,r),i=i.sibling;i!==null;)uc(i,s,r),i=i.sibling}function $v(i){var s=i.stateNode,r=i.memoizedProps;try{for(var l=i.type,u=s.attributes;u.length;)s.removeAttributeNode(u[0]);Ci(s,l,r),s[mt]=i,s[Yt]=r}catch(h){lt(i,i.return,h)}}var ln=!1,Gt=!1,rd=!1,Vv=typeof WeakSet=="function"?WeakSet:Set,oi=null;function q1(i,s){if(i=i.containerInfo,Td=Ac,i=a_(i),Qu(i)){if("selectionStart"in i)var r={start:i.selectionStart,end:i.selectionEnd};else e:{r=(r=i.ownerDocument)&&r.defaultView||window;var l=r.getSelection&&r.getSelection();if(l&&l.rangeCount!==0){r=l.anchorNode;var u=l.anchorOffset,h=l.focusNode;l=l.focusOffset;try{r.nodeType,h.nodeType}catch{r=null;break e}var v=0,w=-1,D=-1,P=0,se=0,le=i,Y=null;t:for(;;){for(var G;le!==r||u!==0&&le.nodeType!==3||(w=v+u),le!==h||l!==0&&le.nodeType!==3||(D=v+l),le.nodeType===3&&(v+=le.nodeValue.length),(G=le.firstChild)!==null;)Y=le,le=G;for(;;){if(le===i)break t;if(Y===r&&++P===u&&(w=v),Y===h&&++se===l&&(D=v),(G=le.nextSibling)!==null)break;le=Y,Y=le.parentNode}le=G}r=w===-1||D===-1?null:{start:w,end:D}}else r=null}r=r||{start:0,end:0}}else r=null;for(kd={focusedElem:i,selectionRange:r},Ac=!1,oi=s;oi!==null;)if(s=oi,i=s.child,(s.subtreeFlags&1028)!==0&&i!==null)i.return=s,oi=i;else for(;oi!==null;){switch(s=oi,h=s.alternate,i=s.flags,s.tag){case 0:if((i&4)!==0&&(i=s.updateQueue,i=i!==null?i.events:null,i!==null))for(r=0;r<i.length;r++)u=i[r],u.ref.impl=u.nextImpl;break;case 11:case 15:break;case 1:if((i&1024)!==0&&h!==null){i=void 0,r=s,u=h.memoizedProps,h=h.memoizedState,l=r.stateNode;try{var be=Er(r.type,u);i=l.getSnapshotBeforeUpdate(be,h),l.__reactInternalSnapshotBeforeUpdate=i}catch(Ae){lt(r,r.return,Ae)}}break;case 3:if((i&1024)!==0){if(i=s.stateNode.containerInfo,r=i.nodeType,r===9)Md(i);else if(r===1)switch(i.nodeName){case"HEAD":case"HTML":case"BODY":Md(i);break;default:i.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((i&1024)!==0)throw Error(a(163))}if(i=s.sibling,i!==null){i.return=s.return,oi=i;break}oi=s.return}}function Xv(i,s,r){var l=r.flags;switch(r.tag){case 0:case 11:case 15:cn(i,r),l&4&&fl(5,r);break;case 1:if(cn(i,r),l&4)if(i=r.stateNode,s===null)try{i.componentDidMount()}catch(v){lt(r,r.return,v)}else{var u=Er(r.type,s.memoizedProps);s=s.memoizedState;try{i.componentDidUpdate(u,s,i.__reactInternalSnapshotBeforeUpdate)}catch(v){lt(r,r.return,v)}}l&64&&Fv(r),l&512&&pl(r,r.return);break;case 3:if(cn(i,r),l&64&&(i=r.updateQueue,i!==null)){if(s=null,r.child!==null)switch(r.child.tag){case 27:case 5:s=r.child.stateNode;break;case 1:s=r.child.stateNode}try{B_(i,s)}catch(v){lt(r,r.return,v)}}break;case 27:s===null&&l&4&&$v(r);case 26:case 5:cn(i,r),s===null&&l&4&&Wv(r),l&512&&pl(r,r.return);break;case 12:cn(i,r);break;case 31:cn(i,r),l&4&&Qv(i,r);break;case 13:cn(i,r),l&4&&Jv(i,r),l&64&&(i=r.memoizedState,i!==null&&(i=i.dehydrated,i!==null&&(r=J1.bind(null,r),yC(i,r))));break;case 22:if(l=r.memoizedState!==null||ln,!l){s=s!==null&&s.memoizedState!==null||Gt,u=ln;var h=Gt;ln=l,(Gt=s)&&!h?un(i,r,(r.subtreeFlags&8772)!==0):cn(i,r),ln=u,Gt=h}break;case 30:break;default:cn(i,r)}}function Gv(i){var s=i.alternate;s!==null&&(i.alternate=null,Gv(s)),i.child=null,i.deletions=null,i.sibling=null,i.tag===5&&(s=i.stateNode,s!==null&&En(s)),i.stateNode=null,i.return=null,i.dependencies=null,i.memoizedProps=null,i.memoizedState=null,i.pendingProps=null,i.stateNode=null,i.updateQueue=null}var Et=null,Ki=!1;function on(i,s,r){for(r=r.child;r!==null;)Zv(i,s,r),r=r.sibling}function Zv(i,s,r){if(qt&&typeof qt.onCommitFiberUnmount=="function")try{qt.onCommitFiberUnmount(Hi,r)}catch{}switch(r.tag){case 26:Gt||Us(r,s),on(i,s,r),r.memoizedState?r.memoizedState.count--:r.stateNode&&(r=r.stateNode,r.parentNode.removeChild(r));break;case 27:Gt||Us(r,s);var l=Et,u=Ki;Fn(r.type)&&(Et=r.stateNode,Ki=!1),on(i,s,r),Cl(r.stateNode),Et=l,Ki=u;break;case 5:Gt||Us(r,s);case 6:if(l=Et,u=Ki,Et=null,on(i,s,r),Et=l,Ki=u,Et!==null)if(Ki)try{(Et.nodeType===9?Et.body:Et.nodeName==="HTML"?Et.ownerDocument.body:Et).removeChild(r.stateNode)}catch(h){lt(r,s,h)}else try{Et.removeChild(r.stateNode)}catch(h){lt(r,s,h)}break;case 18:Et!==null&&(Ki?(i=Et,Fg(i.nodeType===9?i.body:i.nodeName==="HTML"?i.ownerDocument.body:i,r.stateNode),Ca(i)):Fg(Et,r.stateNode));break;case 4:l=Et,u=Ki,Et=r.stateNode.containerInfo,Ki=!0,on(i,s,r),Et=l,Ki=u;break;case 0:case 11:case 14:case 15:zn(2,r,s),Gt||zn(4,r,s),on(i,s,r);break;case 1:Gt||(Us(r,s),l=r.stateNode,typeof l.componentWillUnmount=="function"&&qv(r,s,l)),on(i,s,r);break;case 21:on(i,s,r);break;case 22:Gt=(l=Gt)||r.memoizedState!==null,on(i,s,r),Gt=l;break;default:on(i,s,r)}}function Qv(i,s){if(s.memoizedState===null&&(i=s.alternate,i!==null&&(i=i.memoizedState,i!==null))){i=i.dehydrated;try{Ca(i)}catch(r){lt(s,s.return,r)}}}function Jv(i,s){if(s.memoizedState===null&&(i=s.alternate,i!==null&&(i=i.memoizedState,i!==null&&(i=i.dehydrated,i!==null))))try{Ca(i)}catch(r){lt(s,s.return,r)}}function W1(i){switch(i.tag){case 31:case 13:case 19:var s=i.stateNode;return s===null&&(s=i.stateNode=new Vv),s;case 22:return i=i.stateNode,s=i._retryCache,s===null&&(s=i._retryCache=new Vv),s;default:throw Error(a(435,i.tag))}}function hc(i,s){var r=W1(i);s.forEach(function(l){if(!r.has(l)){r.add(l);var u=eC.bind(null,i,l);l.then(u,u)}})}function Ii(i,s){var r=s.deletions;if(r!==null)for(var l=0;l<r.length;l++){var u=r[l],h=i,v=s,w=v;e:for(;w!==null;){switch(w.tag){case 27:if(Fn(w.type)){Et=w.stateNode,Ki=!1;break e}break;case 5:Et=w.stateNode,Ki=!1;break e;case 3:case 4:Et=w.stateNode.containerInfo,Ki=!0;break e}w=w.return}if(Et===null)throw Error(a(160));Zv(h,v,u),Et=null,Ki=!1,h=u.alternate,h!==null&&(h.return=null),u.return=null}if(s.subtreeFlags&13886)for(s=s.child;s!==null;)eg(s,i),s=s.sibling}var Ms=null;function eg(i,s){var r=i.alternate,l=i.flags;switch(i.tag){case 0:case 11:case 14:case 15:Ii(s,i),Fi(i),l&4&&(zn(3,i,i.return),fl(3,i),zn(5,i,i.return));break;case 1:Ii(s,i),Fi(i),l&512&&(Gt||r===null||Us(r,r.return)),l&64&&ln&&(i=i.updateQueue,i!==null&&(l=i.callbacks,l!==null&&(r=i.shared.hiddenCallbacks,i.shared.hiddenCallbacks=r===null?l:r.concat(l))));break;case 26:var u=Ms;if(Ii(s,i),Fi(i),l&512&&(Gt||r===null||Us(r,r.return)),l&4){var h=r!==null?r.memoizedState:null;if(l=i.memoizedState,r===null)if(l===null)if(i.stateNode===null){e:{l=i.type,r=i.memoizedProps,u=u.ownerDocument||u;t:switch(l){case"title":h=u.getElementsByTagName("title")[0],(!h||h[Gi]||h[mt]||h.namespaceURI==="http://www.w3.org/2000/svg"||h.hasAttribute("itemprop"))&&(h=u.createElement(l),u.head.insertBefore(h,u.querySelector("head > title"))),Ci(h,l,r),h[mt]=i,Lt(h),l=h;break e;case"link":var v=ey("link","href",u).get(l+(r.href||""));if(v){for(var w=0;w<v.length;w++)if(h=v[w],h.getAttribute("href")===(r.href==null||r.href===""?null:r.href)&&h.getAttribute("rel")===(r.rel==null?null:r.rel)&&h.getAttribute("title")===(r.title==null?null:r.title)&&h.getAttribute("crossorigin")===(r.crossOrigin==null?null:r.crossOrigin)){v.splice(w,1);break t}}h=u.createElement(l),Ci(h,l,r),u.head.appendChild(h);break;case"meta":if(v=ey("meta","content",u).get(l+(r.content||""))){for(w=0;w<v.length;w++)if(h=v[w],h.getAttribute("content")===(r.content==null?null:""+r.content)&&h.getAttribute("name")===(r.name==null?null:r.name)&&h.getAttribute("property")===(r.property==null?null:r.property)&&h.getAttribute("http-equiv")===(r.httpEquiv==null?null:r.httpEquiv)&&h.getAttribute("charset")===(r.charSet==null?null:r.charSet)){v.splice(w,1);break t}}h=u.createElement(l),Ci(h,l,r),u.head.appendChild(h);break;default:throw Error(a(468,l))}h[mt]=i,Lt(h),l=h}i.stateNode=l}else ty(u,i.type,i.stateNode);else i.stateNode=Jg(u,l,i.memoizedProps);else h!==l?(h===null?r.stateNode!==null&&(r=r.stateNode,r.parentNode.removeChild(r)):h.count--,l===null?ty(u,i.type,i.stateNode):Jg(u,l,i.memoizedProps)):l===null&&i.stateNode!==null&&id(i,i.memoizedProps,r.memoizedProps)}break;case 27:Ii(s,i),Fi(i),l&512&&(Gt||r===null||Us(r,r.return)),r!==null&&l&4&&id(i,i.memoizedProps,r.memoizedProps);break;case 5:if(Ii(s,i),Fi(i),l&512&&(Gt||r===null||Us(r,r.return)),i.flags&32){u=i.stateNode;try{Yr(u,"")}catch(be){lt(i,i.return,be)}}l&4&&i.stateNode!=null&&(u=i.memoizedProps,id(i,u,r!==null?r.memoizedProps:u)),l&1024&&(rd=!0);break;case 6:if(Ii(s,i),Fi(i),l&4){if(i.stateNode===null)throw Error(a(162));l=i.memoizedProps,r=i.stateNode;try{r.nodeValue=l}catch(be){lt(i,i.return,be)}}break;case 3:if(kc=null,u=Ms,Ms=Ec(s.containerInfo),Ii(s,i),Ms=u,Fi(i),l&4&&r!==null&&r.memoizedState.isDehydrated)try{Ca(s.containerInfo)}catch(be){lt(i,i.return,be)}rd&&(rd=!1,tg(i));break;case 4:l=Ms,Ms=Ec(i.stateNode.containerInfo),Ii(s,i),Fi(i),Ms=l;break;case 12:Ii(s,i),Fi(i);break;case 31:Ii(s,i),Fi(i),l&4&&(l=i.updateQueue,l!==null&&(i.updateQueue=null,hc(i,l)));break;case 13:Ii(s,i),Fi(i),i.child.flags&8192&&i.memoizedState!==null!=(r!==null&&r.memoizedState!==null)&&(fc=He()),l&4&&(l=i.updateQueue,l!==null&&(i.updateQueue=null,hc(i,l)));break;case 22:u=i.memoizedState!==null;var D=r!==null&&r.memoizedState!==null,P=ln,se=Gt;if(ln=P||u,Gt=se||D,Ii(s,i),Gt=se,ln=P,Fi(i),l&8192)e:for(s=i.stateNode,s._visibility=u?s._visibility&-2:s._visibility|1,u&&(r===null||D||ln||Gt||Tr(i)),r=null,s=i;;){if(s.tag===5||s.tag===26){if(r===null){D=r=s;try{if(h=D.stateNode,u)v=h.style,typeof v.setProperty=="function"?v.setProperty("display","none","important"):v.display="none";else{w=D.stateNode;var le=D.memoizedProps.style,Y=le!=null&&le.hasOwnProperty("display")?le.display:null;w.style.display=Y==null||typeof Y=="boolean"?"":(""+Y).trim()}}catch(be){lt(D,D.return,be)}}}else if(s.tag===6){if(r===null){D=s;try{D.stateNode.nodeValue=u?"":D.memoizedProps}catch(be){lt(D,D.return,be)}}}else if(s.tag===18){if(r===null){D=s;try{var G=D.stateNode;u?qg(G,!0):qg(D.stateNode,!1)}catch(be){lt(D,D.return,be)}}}else if((s.tag!==22&&s.tag!==23||s.memoizedState===null||s===i)&&s.child!==null){s.child.return=s,s=s.child;continue}if(s===i)break e;for(;s.sibling===null;){if(s.return===null||s.return===i)break e;r===s&&(r=null),s=s.return}r===s&&(r=null),s.sibling.return=s.return,s=s.sibling}l&4&&(l=i.updateQueue,l!==null&&(r=l.retryQueue,r!==null&&(l.retryQueue=null,hc(i,r))));break;case 19:Ii(s,i),Fi(i),l&4&&(l=i.updateQueue,l!==null&&(i.updateQueue=null,hc(i,l)));break;case 30:break;case 21:break;default:Ii(s,i),Fi(i)}}function Fi(i){var s=i.flags;if(s&2){try{for(var r,l=i.return;l!==null;){if(Yv(l)){r=l;break}l=l.return}if(r==null)throw Error(a(160));switch(r.tag){case 27:var u=r.stateNode,h=sd(i);uc(i,h,u);break;case 5:var v=r.stateNode;r.flags&32&&(Yr(v,""),r.flags&=-33);var w=sd(i);uc(i,w,v);break;case 3:case 4:var D=r.stateNode.containerInfo,P=sd(i);nd(i,P,D);break;default:throw Error(a(161))}}catch(se){lt(i,i.return,se)}i.flags&=-3}s&4096&&(i.flags&=-4097)}function tg(i){if(i.subtreeFlags&1024)for(i=i.child;i!==null;){var s=i;tg(s),s.tag===5&&s.flags&1024&&s.stateNode.reset(),i=i.sibling}}function cn(i,s){if(s.subtreeFlags&8772)for(s=s.child;s!==null;)Xv(i,s.alternate,s),s=s.sibling}function Tr(i){for(i=i.child;i!==null;){var s=i;switch(s.tag){case 0:case 11:case 14:case 15:zn(4,s,s.return),Tr(s);break;case 1:Us(s,s.return);var r=s.stateNode;typeof r.componentWillUnmount=="function"&&qv(s,s.return,r),Tr(s);break;case 27:Cl(s.stateNode);case 26:case 5:Us(s,s.return),Tr(s);break;case 22:s.memoizedState===null&&Tr(s);break;case 30:Tr(s);break;default:Tr(s)}i=i.sibling}}function un(i,s,r){for(r=r&&(s.subtreeFlags&8772)!==0,s=s.child;s!==null;){var l=s.alternate,u=i,h=s,v=h.flags;switch(h.tag){case 0:case 11:case 15:un(u,h,r),fl(4,h);break;case 1:if(un(u,h,r),l=h,u=l.stateNode,typeof u.componentDidMount=="function")try{u.componentDidMount()}catch(P){lt(l,l.return,P)}if(l=h,u=l.updateQueue,u!==null){var w=l.stateNode;try{var D=u.shared.hiddenCallbacks;if(D!==null)for(u.shared.hiddenCallbacks=null,u=0;u<D.length;u++)N_(D[u],w)}catch(P){lt(l,l.return,P)}}r&&v&64&&Fv(h),pl(h,h.return);break;case 27:$v(h);case 26:case 5:un(u,h,r),r&&l===null&&v&4&&Wv(h),pl(h,h.return);break;case 12:un(u,h,r);break;case 31:un(u,h,r),r&&v&4&&Qv(u,h);break;case 13:un(u,h,r),r&&v&4&&Jv(u,h);break;case 22:h.memoizedState===null&&un(u,h,r),pl(h,h.return);break;case 30:break;default:un(u,h,r)}s=s.sibling}}function ad(i,s){var r=null;i!==null&&i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(r=i.memoizedState.cachePool.pool),i=null,s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(i=s.memoizedState.cachePool.pool),i!==r&&(i!=null&&i.refCount++,r!=null&&el(r))}function ld(i,s){i=null,s.alternate!==null&&(i=s.alternate.memoizedState.cache),s=s.memoizedState.cache,s!==i&&(s.refCount++,i!=null&&el(i))}function As(i,s,r,l){if(s.subtreeFlags&10256)for(s=s.child;s!==null;)ig(i,s,r,l),s=s.sibling}function ig(i,s,r,l){var u=s.flags;switch(s.tag){case 0:case 11:case 15:As(i,s,r,l),u&2048&&fl(9,s);break;case 1:As(i,s,r,l);break;case 3:As(i,s,r,l),u&2048&&(i=null,s.alternate!==null&&(i=s.alternate.memoizedState.cache),s=s.memoizedState.cache,s!==i&&(s.refCount++,i!=null&&el(i)));break;case 12:if(u&2048){As(i,s,r,l),i=s.stateNode;try{var h=s.memoizedProps,v=h.id,w=h.onPostCommit;typeof w=="function"&&w(v,s.alternate===null?"mount":"update",i.passiveEffectDuration,-0)}catch(D){lt(s,s.return,D)}}else As(i,s,r,l);break;case 31:As(i,s,r,l);break;case 13:As(i,s,r,l);break;case 23:break;case 22:h=s.stateNode,v=s.alternate,s.memoizedState!==null?h._visibility&2?As(i,s,r,l):ml(i,s):h._visibility&2?As(i,s,r,l):(h._visibility|=2,da(i,s,r,l,(s.subtreeFlags&10256)!==0||!1)),u&2048&&ad(v,s);break;case 24:As(i,s,r,l),u&2048&&ld(s.alternate,s);break;default:As(i,s,r,l)}}function da(i,s,r,l,u){for(u=u&&((s.subtreeFlags&10256)!==0||!1),s=s.child;s!==null;){var h=i,v=s,w=r,D=l,P=v.flags;switch(v.tag){case 0:case 11:case 15:da(h,v,w,D,u),fl(8,v);break;case 23:break;case 22:var se=v.stateNode;v.memoizedState!==null?se._visibility&2?da(h,v,w,D,u):ml(h,v):(se._visibility|=2,da(h,v,w,D,u)),u&&P&2048&&ad(v.alternate,v);break;case 24:da(h,v,w,D,u),u&&P&2048&&ld(v.alternate,v);break;default:da(h,v,w,D,u)}s=s.sibling}}function ml(i,s){if(s.subtreeFlags&10256)for(s=s.child;s!==null;){var r=i,l=s,u=l.flags;switch(l.tag){case 22:ml(r,l),u&2048&&ad(l.alternate,l);break;case 24:ml(r,l),u&2048&&ld(l.alternate,l);break;default:ml(r,l)}s=s.sibling}}var _l=8192;function fa(i,s,r){if(i.subtreeFlags&_l)for(i=i.child;i!==null;)sg(i,s,r),i=i.sibling}function sg(i,s,r){switch(i.tag){case 26:fa(i,s,r),i.flags&_l&&i.memoizedState!==null&&AC(r,Ms,i.memoizedState,i.memoizedProps);break;case 5:fa(i,s,r);break;case 3:case 4:var l=Ms;Ms=Ec(i.stateNode.containerInfo),fa(i,s,r),Ms=l;break;case 22:i.memoizedState===null&&(l=i.alternate,l!==null&&l.memoizedState!==null?(l=_l,_l=16777216,fa(i,s,r),_l=l):fa(i,s,r));break;default:fa(i,s,r)}}function ng(i){var s=i.alternate;if(s!==null&&(i=s.child,i!==null)){s.child=null;do s=i.sibling,i.sibling=null,i=s;while(i!==null)}}function vl(i){var s=i.deletions;if((i.flags&16)!==0){if(s!==null)for(var r=0;r<s.length;r++){var l=s[r];oi=l,ag(l,i)}ng(i)}if(i.subtreeFlags&10256)for(i=i.child;i!==null;)rg(i),i=i.sibling}function rg(i){switch(i.tag){case 0:case 11:case 15:vl(i),i.flags&2048&&zn(9,i,i.return);break;case 3:vl(i);break;case 12:vl(i);break;case 22:var s=i.stateNode;i.memoizedState!==null&&s._visibility&2&&(i.return===null||i.return.tag!==13)?(s._visibility&=-3,dc(i)):vl(i);break;default:vl(i)}}function dc(i){var s=i.deletions;if((i.flags&16)!==0){if(s!==null)for(var r=0;r<s.length;r++){var l=s[r];oi=l,ag(l,i)}ng(i)}for(i=i.child;i!==null;){switch(s=i,s.tag){case 0:case 11:case 15:zn(8,s,s.return),dc(s);break;case 22:r=s.stateNode,r._visibility&2&&(r._visibility&=-3,dc(s));break;default:dc(s)}i=i.sibling}}function ag(i,s){for(;oi!==null;){var r=oi;switch(r.tag){case 0:case 11:case 15:zn(8,r,s);break;case 23:case 22:if(r.memoizedState!==null&&r.memoizedState.cachePool!==null){var l=r.memoizedState.cachePool.pool;l!=null&&l.refCount++}break;case 24:el(r.memoizedState.cache)}if(l=r.child,l!==null)l.return=r,oi=l;else e:for(r=i;oi!==null;){l=oi;var u=l.sibling,h=l.return;if(Gv(l),l===r){oi=null;break e}if(u!==null){u.return=h,oi=u;break e}oi=h}}}var Y1={getCacheForType:function(i){var s=bi($t),r=s.data.get(i);return r===void 0&&(r=i(),s.data.set(i,r)),r},cacheSignal:function(){return bi($t).controller.signal}},$1=typeof WeakMap=="function"?WeakMap:Map,st=0,_t=null,$e=null,Ze=0,at=0,ss=null,jn=!1,pa=!1,od=!1,hn=0,zt=0,Hn=0,kr=0,cd=0,ns=0,ma=0,gl=null,qi=null,ud=!1,fc=0,lg=0,pc=1/0,mc=null,Un=null,ti=0,Pn=null,_a=null,dn=0,hd=0,dd=null,og=null,yl=0,fd=null;function rs(){return(st&2)!==0&&Ze!==0?Ze&-Ze:A.T!==null?yd():ki()}function cg(){if(ns===0)if((Ze&536870912)===0||Je){var i=ks;ks<<=1,(ks&3932160)===0&&(ks=262144),ns=i}else ns=536870912;return i=ts.current,i!==null&&(i.flags|=32),ns}function Wi(i,s,r){(i===_t&&(at===2||at===9)||i.cancelPendingCommit!==null)&&(va(i,0),Kn(i,Ze,ns,!1)),Wt(i,r),((st&2)===0||i!==_t)&&(i===_t&&((st&2)===0&&(kr|=r),zt===4&&Kn(i,Ze,ns,!1)),Ps(i))}function ug(i,s,r){if((st&6)!==0)throw Error(a(327));var l=!r&&(s&127)===0&&(s&i.expiredLanes)===0||li(i,s),u=l?G1(i,s):md(i,s,!0),h=l;do{if(u===0){pa&&!l&&Kn(i,s,0,!1);break}else{if(r=i.current.alternate,h&&!V1(r)){u=md(i,s,!1),h=!1;continue}if(u===2){if(h=s,i.errorRecoveryDisabledLanes&h)var v=0;else v=i.pendingLanes&-536870913,v=v!==0?v:v&536870912?536870912:0;if(v!==0){s=v;e:{var w=i;u=gl;var D=w.current.memoizedState.isDehydrated;if(D&&(va(w,v).flags|=256),v=md(w,v,!1),v!==2){if(od&&!D){w.errorRecoveryDisabledLanes|=h,kr|=h,u=4;break e}h=qi,qi=u,h!==null&&(qi===null?qi=h:qi.push.apply(qi,h))}u=v}if(h=!1,u!==2)continue}}if(u===1){va(i,0),Kn(i,s,0,!0);break}e:{switch(l=i,h=u,h){case 0:case 1:throw Error(a(345));case 4:if((s&4194048)!==s)break;case 6:Kn(l,s,ns,!jn);break e;case 2:qi=null;break;case 3:case 5:break;default:throw Error(a(329))}if((s&62914560)===s&&(u=fc+300-He(),10<u)){if(Kn(l,s,ns,!jn),Rt(l,0,!0)!==0)break e;dn=s,l.timeoutHandle=Kg(hg.bind(null,l,r,qi,mc,ud,s,ns,kr,ma,jn,h,"Throttled",-0,0),u);break e}hg(l,r,qi,mc,ud,s,ns,kr,ma,jn,h,null,-0,0)}}break}while(!0);Ps(i)}function hg(i,s,r,l,u,h,v,w,D,P,se,le,Y,G){if(i.timeoutHandle=-1,le=s.subtreeFlags,le&8192||(le&16785408)===16785408){le={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Gs},sg(s,h,le);var be=(h&62914560)===h?fc-He():(h&4194048)===h?lg-He():0;if(be=NC(le,be),be!==null){dn=h,i.cancelPendingCommit=be(yg.bind(null,i,s,h,r,l,u,v,w,D,se,le,null,Y,G)),Kn(i,h,v,!P);return}}yg(i,s,h,r,l,u,v,w,D)}function V1(i){for(var s=i;;){var r=s.tag;if((r===0||r===11||r===15)&&s.flags&16384&&(r=s.updateQueue,r!==null&&(r=r.stores,r!==null)))for(var l=0;l<r.length;l++){var u=r[l],h=u.getSnapshot;u=u.value;try{if(!Ji(h(),u))return!1}catch{return!1}}if(r=s.child,s.subtreeFlags&16384&&r!==null)r.return=s,s=r;else{if(s===i)break;for(;s.sibling===null;){if(s.return===null||s.return===i)return!0;s=s.return}s.sibling.return=s.return,s=s.sibling}}return!0}function Kn(i,s,r,l){s&=~cd,s&=~kr,i.suspendedLanes|=s,i.pingedLanes&=~s,l&&(i.warmLanes|=s),l=i.expirationTimes;for(var u=s;0<u;){var h=31-Dt(u),v=1<<h;l[h]=-1,u&=~v}r!==0&&Ge(i,r,s)}function _c(){return(st&6)===0?(Sl(0),!1):!0}function pd(){if($e!==null){if(at===0)var i=$e.return;else i=$e,en=gr=null,Mh(i),la=null,il=0,i=$e;for(;i!==null;)Iv(i.alternate,i),i=i.return;$e=null}}function va(i,s){var r=i.timeoutHandle;r!==-1&&(i.timeoutHandle=-1,pC(r)),r=i.cancelPendingCommit,r!==null&&(i.cancelPendingCommit=null,r()),dn=0,pd(),_t=i,$e=r=Qs(i.current,null),Ze=s,at=0,ss=null,jn=!1,pa=li(i,s),od=!1,ma=ns=cd=kr=Hn=zt=0,qi=gl=null,ud=!1,(s&8)!==0&&(s|=s&32);var l=i.entangledLanes;if(l!==0)for(i=i.entanglements,l&=s;0<l;){var u=31-Dt(l),h=1<<u;s|=i[u],l&=~h}return hn=s,jo(),r}function dg(i,s){Ie=null,A.H=ul,s===aa||s===Wo?(s=D_(),at=3):s===gh?(s=D_(),at=4):at=s===Yh?8:s!==null&&typeof s=="object"&&typeof s.then=="function"?6:1,ss=s,$e===null&&(zt=1,rc(i,ds(s,i.current)))}function fg(){var i=ts.current;return i===null?!0:(Ze&4194048)===Ze?_s===null:(Ze&62914560)===Ze||(Ze&536870912)!==0?i===_s:!1}function pg(){var i=A.H;return A.H=ul,i===null?ul:i}function mg(){var i=A.A;return A.A=Y1,i}function vc(){zt=4,jn||(Ze&4194048)!==Ze&&ts.current!==null||(pa=!0),(Hn&134217727)===0&&(kr&134217727)===0||_t===null||Kn(_t,Ze,ns,!1)}function md(i,s,r){var l=st;st|=2;var u=pg(),h=mg();(_t!==i||Ze!==s)&&(mc=null,va(i,s)),s=!1;var v=zt;e:do try{if(at!==0&&$e!==null){var w=$e,D=ss;switch(at){case 8:pd(),v=6;break e;case 3:case 2:case 9:case 6:ts.current===null&&(s=!0);var P=at;if(at=0,ss=null,ga(i,w,D,P),r&&pa){v=0;break e}break;default:P=at,at=0,ss=null,ga(i,w,D,P)}}X1(),v=zt;break}catch(se){dg(i,se)}while(!0);return s&&i.shellSuspendCounter++,en=gr=null,st=l,A.H=u,A.A=h,$e===null&&(_t=null,Ze=0,jo()),v}function X1(){for(;$e!==null;)_g($e)}function G1(i,s){var r=st;st|=2;var l=pg(),u=mg();_t!==i||Ze!==s?(mc=null,pc=He()+500,va(i,s)):pa=li(i,s);e:do try{if(at!==0&&$e!==null){s=$e;var h=ss;t:switch(at){case 1:at=0,ss=null,ga(i,s,h,1);break;case 2:case 9:if(T_(h)){at=0,ss=null,vg(s);break}s=function(){at!==2&&at!==9||_t!==i||(at=7),Ps(i)},h.then(s,s);break e;case 3:at=7;break e;case 4:at=5;break e;case 7:T_(h)?(at=0,ss=null,vg(s)):(at=0,ss=null,ga(i,s,h,7));break;case 5:var v=null;switch($e.tag){case 26:v=$e.memoizedState;case 5:case 27:var w=$e;if(v?iy(v):w.stateNode.complete){at=0,ss=null;var D=w.sibling;if(D!==null)$e=D;else{var P=w.return;P!==null?($e=P,gc(P)):$e=null}break t}}at=0,ss=null,ga(i,s,h,5);break;case 6:at=0,ss=null,ga(i,s,h,6);break;case 8:pd(),zt=6;break e;default:throw Error(a(462))}}Z1();break}catch(se){dg(i,se)}while(!0);return en=gr=null,A.H=l,A.A=u,st=r,$e!==null?0:(_t=null,Ze=0,jo(),zt)}function Z1(){for(;$e!==null&&!te();)_g($e)}function _g(i){var s=Pv(i.alternate,i,hn);i.memoizedProps=i.pendingProps,s===null?gc(i):$e=s}function vg(i){var s=i,r=s.alternate;switch(s.tag){case 15:case 0:s=Lv(r,s,s.pendingProps,s.type,void 0,Ze);break;case 11:s=Lv(r,s,s.pendingProps,s.type.render,s.ref,Ze);break;case 5:Mh(s);default:Iv(r,s),s=$e=m_(s,hn),s=Pv(r,s,hn)}i.memoizedProps=i.pendingProps,s===null?gc(i):$e=s}function ga(i,s,r,l){en=gr=null,Mh(s),la=null,il=0;var u=s.return;try{if(U1(i,u,s,r,Ze)){zt=1,rc(i,ds(r,i.current)),$e=null;return}}catch(h){if(u!==null)throw $e=u,h;zt=1,rc(i,ds(r,i.current)),$e=null;return}s.flags&32768?(Je||l===1?i=!0:pa||(Ze&536870912)!==0?i=!1:(jn=i=!0,(l===2||l===9||l===3||l===6)&&(l=ts.current,l!==null&&l.tag===13&&(l.flags|=16384))),gg(s,i)):gc(s)}function gc(i){var s=i;do{if((s.flags&32768)!==0){gg(s,jn);return}i=s.return;var r=I1(s.alternate,s,hn);if(r!==null){$e=r;return}if(s=s.sibling,s!==null){$e=s;return}$e=s=i}while(s!==null);zt===0&&(zt=5)}function gg(i,s){do{var r=F1(i.alternate,i);if(r!==null){r.flags&=32767,$e=r;return}if(r=i.return,r!==null&&(r.flags|=32768,r.subtreeFlags=0,r.deletions=null),!s&&(i=i.sibling,i!==null)){$e=i;return}$e=i=r}while(i!==null);zt=6,$e=null}function yg(i,s,r,l,u,h,v,w,D){i.cancelPendingCommit=null;do yc();while(ti!==0);if((st&6)!==0)throw Error(a(327));if(s!==null){if(s===i.current)throw Error(a(177));if(h=s.lanes|s.childLanes,h|=sh,bt(i,r,h,v,w,D),i===_t&&($e=_t=null,Ze=0),_a=s,Pn=i,dn=r,hd=h,dd=u,og=l,(s.subtreeFlags&10256)!==0||(s.flags&10256)!==0?(i.callbackNode=null,i.callbackPriority=0,tC(kt,function(){return xg(),null})):(i.callbackNode=null,i.callbackPriority=0),l=(s.flags&13878)!==0,(s.subtreeFlags&13878)!==0||l){l=A.T,A.T=null,u=V.p,V.p=2,v=st,st|=4;try{q1(i,s,r)}finally{st=v,V.p=u,A.T=l}}ti=1,Sg(),bg(),wg()}}function Sg(){if(ti===1){ti=0;var i=Pn,s=_a,r=(s.flags&13878)!==0;if((s.subtreeFlags&13878)!==0||r){r=A.T,A.T=null;var l=V.p;V.p=2;var u=st;st|=4;try{eg(s,i);var h=kd,v=a_(i.containerInfo),w=h.focusedElem,D=h.selectionRange;if(v!==w&&w&&w.ownerDocument&&r_(w.ownerDocument.documentElement,w)){if(D!==null&&Qu(w)){var P=D.start,se=D.end;if(se===void 0&&(se=P),"selectionStart"in w)w.selectionStart=P,w.selectionEnd=Math.min(se,w.value.length);else{var le=w.ownerDocument||document,Y=le&&le.defaultView||window;if(Y.getSelection){var G=Y.getSelection(),be=w.textContent.length,Ae=Math.min(D.start,be),ft=D.end===void 0?Ae:Math.min(D.end,be);!G.extend&&Ae>ft&&(v=ft,ft=Ae,Ae=v);var z=n_(w,Ae),N=n_(w,ft);if(z&&N&&(G.rangeCount!==1||G.anchorNode!==z.node||G.anchorOffset!==z.offset||G.focusNode!==N.node||G.focusOffset!==N.offset)){var U=le.createRange();U.setStart(z.node,z.offset),G.removeAllRanges(),Ae>ft?(G.addRange(U),G.extend(N.node,N.offset)):(U.setEnd(N.node,N.offset),G.addRange(U))}}}}for(le=[],G=w;G=G.parentNode;)G.nodeType===1&&le.push({element:G,left:G.scrollLeft,top:G.scrollTop});for(typeof w.focus=="function"&&w.focus(),w=0;w<le.length;w++){var ne=le[w];ne.element.scrollLeft=ne.left,ne.element.scrollTop=ne.top}}Ac=!!Td,kd=Td=null}finally{st=u,V.p=l,A.T=r}}i.current=s,ti=2}}function bg(){if(ti===2){ti=0;var i=Pn,s=_a,r=(s.flags&8772)!==0;if((s.subtreeFlags&8772)!==0||r){r=A.T,A.T=null;var l=V.p;V.p=2;var u=st;st|=4;try{Xv(i,s.alternate,s)}finally{st=u,V.p=l,A.T=r}}ti=3}}function wg(){if(ti===4||ti===3){ti=0,je();var i=Pn,s=_a,r=dn,l=og;(s.subtreeFlags&10256)!==0||(s.flags&10256)!==0?ti=5:(ti=0,_a=Pn=null,Cg(i,i.pendingLanes));var u=i.pendingLanes;if(u===0&&(Un=null),Ni(r),s=s.stateNode,qt&&typeof qt.onCommitFiberRoot=="function")try{qt.onCommitFiberRoot(Hi,s,void 0,(s.current.flags&128)===128)}catch{}if(l!==null){s=A.T,u=V.p,V.p=2,A.T=null;try{for(var h=i.onRecoverableError,v=0;v<l.length;v++){var w=l[v];h(w.value,{componentStack:w.stack})}}finally{A.T=s,V.p=u}}(dn&3)!==0&&yc(),Ps(i),u=i.pendingLanes,(r&261930)!==0&&(u&42)!==0?i===fd?yl++:(yl=0,fd=i):yl=0,Sl(0)}}function Cg(i,s){(i.pooledCacheLanes&=s)===0&&(s=i.pooledCache,s!=null&&(i.pooledCache=null,el(s)))}function yc(){return Sg(),bg(),wg(),xg()}function xg(){if(ti!==5)return!1;var i=Pn,s=hd;hd=0;var r=Ni(dn),l=A.T,u=V.p;try{V.p=32>r?32:r,A.T=null,r=dd,dd=null;var h=Pn,v=dn;if(ti=0,_a=Pn=null,dn=0,(st&6)!==0)throw Error(a(331));var w=st;if(st|=4,rg(h.current),ig(h,h.current,v,r),st=w,Sl(0,!1),qt&&typeof qt.onPostCommitFiberRoot=="function")try{qt.onPostCommitFiberRoot(Hi,h)}catch{}return!0}finally{V.p=u,A.T=l,Cg(i,s)}}function Eg(i,s,r){s=ds(r,s),s=Wh(i.stateNode,s,2),i=Bn(i,s,2),i!==null&&(Wt(i,2),Ps(i))}function lt(i,s,r){if(i.tag===3)Eg(i,i,r);else for(;s!==null;){if(s.tag===3){Eg(s,i,r);break}else if(s.tag===1){var l=s.stateNode;if(typeof s.type.getDerivedStateFromError=="function"||typeof l.componentDidCatch=="function"&&(Un===null||!Un.has(l))){i=ds(r,i),r=Tv(2),l=Bn(s,r,2),l!==null&&(kv(r,l,s,i),Wt(l,2),Ps(l));break}}s=s.return}}function _d(i,s,r){var l=i.pingCache;if(l===null){l=i.pingCache=new $1;var u=new Set;l.set(s,u)}else u=l.get(s),u===void 0&&(u=new Set,l.set(s,u));u.has(r)||(od=!0,u.add(r),i=Q1.bind(null,i,s,r),s.then(i,i))}function Q1(i,s,r){var l=i.pingCache;l!==null&&l.delete(s),i.pingedLanes|=i.suspendedLanes&r,i.warmLanes&=~r,_t===i&&(Ze&r)===r&&(zt===4||zt===3&&(Ze&62914560)===Ze&&300>He()-fc?(st&2)===0&&va(i,0):cd|=r,ma===Ze&&(ma=0)),Ps(i)}function Tg(i,s){s===0&&(s=Bt()),i=mr(i,s),i!==null&&(Wt(i,s),Ps(i))}function J1(i){var s=i.memoizedState,r=0;s!==null&&(r=s.retryLane),Tg(i,r)}function eC(i,s){var r=0;switch(i.tag){case 31:case 13:var l=i.stateNode,u=i.memoizedState;u!==null&&(r=u.retryLane);break;case 19:l=i.stateNode;break;case 22:l=i.stateNode._retryCache;break;default:throw Error(a(314))}l!==null&&l.delete(s),Tg(i,r)}function tC(i,s){return yt(i,s)}var Sc=null,ya=null,vd=!1,bc=!1,gd=!1,In=0;function Ps(i){i!==ya&&i.next===null&&(ya===null?Sc=ya=i:ya=ya.next=i),bc=!0,vd||(vd=!0,sC())}function Sl(i,s){if(!gd&&bc){gd=!0;do for(var r=!1,l=Sc;l!==null;){if(i!==0){var u=l.pendingLanes;if(u===0)var h=0;else{var v=l.suspendedLanes,w=l.pingedLanes;h=(1<<31-Dt(42|i)+1)-1,h&=u&~(v&~w),h=h&201326741?h&201326741|1:h?h|2:0}h!==0&&(r=!0,Mg(l,h))}else h=Ze,h=Rt(l,l===_t?h:0,l.cancelPendingCommit!==null||l.timeoutHandle!==-1),(h&3)===0||li(l,h)||(r=!0,Mg(l,h));l=l.next}while(r);gd=!1}}function iC(){kg()}function kg(){bc=vd=!1;var i=0;In!==0&&fC()&&(i=In);for(var s=He(),r=null,l=Sc;l!==null;){var u=l.next,h=Dg(l,s);h===0?(l.next=null,r===null?Sc=u:r.next=u,u===null&&(ya=r)):(r=l,(i!==0||(h&3)!==0)&&(bc=!0)),l=u}ti!==0&&ti!==5||Sl(i),In!==0&&(In=0)}function Dg(i,s){for(var r=i.suspendedLanes,l=i.pingedLanes,u=i.expirationTimes,h=i.pendingLanes&-62914561;0<h;){var v=31-Dt(h),w=1<<v,D=u[v];D===-1?((w&r)===0||(w&l)!==0)&&(u[v]=ei(w,s)):D<=s&&(i.expiredLanes|=w),h&=~w}if(s=_t,r=Ze,r=Rt(i,i===s?r:0,i.cancelPendingCommit!==null||i.timeoutHandle!==-1),l=i.callbackNode,r===0||i===s&&(at===2||at===9)||i.cancelPendingCommit!==null)return l!==null&&l!==null&&mi(l),i.callbackNode=null,i.callbackPriority=0;if((r&3)===0||li(i,r)){if(s=r&-r,s===i.callbackPriority)return s;switch(l!==null&&mi(l),Ni(r)){case 2:case 8:r=ai;break;case 32:r=kt;break;case 268435456:r=Ti;break;default:r=kt}return l=Rg.bind(null,i),r=yt(r,l),i.callbackPriority=s,i.callbackNode=r,s}return l!==null&&l!==null&&mi(l),i.callbackPriority=2,i.callbackNode=null,2}function Rg(i,s){if(ti!==0&&ti!==5)return i.callbackNode=null,i.callbackPriority=0,null;var r=i.callbackNode;if(yc()&&i.callbackNode!==r)return null;var l=Ze;return l=Rt(i,i===_t?l:0,i.cancelPendingCommit!==null||i.timeoutHandle!==-1),l===0?null:(ug(i,l,s),Dg(i,He()),i.callbackNode!=null&&i.callbackNode===r?Rg.bind(null,i):null)}function Mg(i,s){if(yc())return null;ug(i,s,!0)}function sC(){mC(function(){(st&6)!==0?yt(Vi,iC):kg()})}function yd(){if(In===0){var i=na;i===0&&(i=Ts,Ts<<=1,(Ts&261888)===0&&(Ts=256)),In=i}return In}function Ag(i){return i==null||typeof i=="symbol"||typeof i=="boolean"?null:typeof i=="function"?i:Ro(""+i)}function Ng(i,s){var r=s.ownerDocument.createElement("input");return r.name=s.name,r.value=s.value,i.id&&r.setAttribute("form",i.id),s.parentNode.insertBefore(r,s),i=new FormData(i),r.parentNode.removeChild(r),i}function nC(i,s,r,l,u){if(s==="submit"&&r&&r.stateNode===u){var h=Ag((u[Yt]||null).action),v=l.submitter;v&&(s=(s=v[Yt]||null)?Ag(s.formAction):v.getAttribute("formAction"),s!==null&&(h=s,v=null));var w=new Bo("action","action",null,l,u);i.push({event:w,listeners:[{instance:null,listener:function(){if(l.defaultPrevented){if(In!==0){var D=v?Ng(u,v):new FormData(u);Uh(r,{pending:!0,data:D,method:u.method,action:h},null,D)}}else typeof h=="function"&&(w.preventDefault(),D=v?Ng(u,v):new FormData(u),Uh(r,{pending:!0,data:D,method:u.method,action:h},h,D))},currentTarget:u}]})}}for(var Sd=0;Sd<ih.length;Sd++){var bd=ih[Sd],rC=bd.toLowerCase(),aC=bd[0].toUpperCase()+bd.slice(1);Rs(rC,"on"+aC)}Rs(c_,"onAnimationEnd"),Rs(u_,"onAnimationIteration"),Rs(h_,"onAnimationStart"),Rs("dblclick","onDoubleClick"),Rs("focusin","onFocus"),Rs("focusout","onBlur"),Rs(w1,"onTransitionRun"),Rs(C1,"onTransitionStart"),Rs(x1,"onTransitionCancel"),Rs(d_,"onTransitionEnd"),zs("onMouseEnter",["mouseout","mouseover"]),zs("onMouseLeave",["mouseout","mouseover"]),zs("onPointerEnter",["pointerout","pointerover"]),zs("onPointerLeave",["pointerout","pointerover"]),Ui("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Ui("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Ui("onBeforeInput",["compositionend","keypress","textInput","paste"]),Ui("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Ui("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Ui("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var bl="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(" "),lC=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(bl));function Bg(i,s){s=(s&4)!==0;for(var r=0;r<i.length;r++){var l=i[r],u=l.event;l=l.listeners;e:{var h=void 0;if(s)for(var v=l.length-1;0<=v;v--){var w=l[v],D=w.instance,P=w.currentTarget;if(w=w.listener,D!==h&&u.isPropagationStopped())break e;h=w,u.currentTarget=P;try{h(u)}catch(se){zo(se)}u.currentTarget=null,h=D}else for(v=0;v<l.length;v++){if(w=l[v],D=w.instance,P=w.currentTarget,w=w.listener,D!==h&&u.isPropagationStopped())break e;h=w,u.currentTarget=P;try{h(u)}catch(se){zo(se)}u.currentTarget=null,h=D}}}}function Ve(i,s){var r=s[Xs];r===void 0&&(r=s[Xs]=new Set);var l=i+"__bubble";r.has(l)||(Lg(s,i,2,!1),r.add(l))}function wd(i,s,r){var l=0;s&&(l|=4),Lg(r,i,l,s)}var wc="_reactListening"+Math.random().toString(36).slice(2);function Cd(i){if(!i[wc]){i[wc]=!0,Qi.forEach(function(r){r!=="selectionchange"&&(lC.has(r)||wd(r,!1,i),wd(r,!0,i))});var s=i.nodeType===9?i:i.ownerDocument;s===null||s[wc]||(s[wc]=!0,wd("selectionchange",!1,s))}}function Lg(i,s,r,l){switch(cy(s)){case 2:var u=OC;break;case 8:u=zC;break;default:u=Hd}r=u.bind(null,s,r,i),u=void 0,!Fu||s!=="touchstart"&&s!=="touchmove"&&s!=="wheel"||(u=!0),l?u!==void 0?i.addEventListener(s,r,{capture:!0,passive:u}):i.addEventListener(s,r,!0):u!==void 0?i.addEventListener(s,r,{passive:u}):i.addEventListener(s,r,!1)}function xd(i,s,r,l,u){var h=l;if((s&1)===0&&(s&2)===0&&l!==null)e:for(;;){if(l===null)return;var v=l.tag;if(v===3||v===4){var w=l.stateNode.containerInfo;if(w===u)break;if(v===4)for(v=l.return;v!==null;){var D=v.tag;if((D===3||D===4)&&v.stateNode.containerInfo===u)return;v=v.return}for(;w!==null;){if(v=Ls(w),v===null)return;if(D=v.tag,D===5||D===6||D===26||D===27){l=h=v;continue e}w=w.parentNode}}l=l.return}Um(function(){var P=h,se=Ku(r),le=[];e:{var Y=f_.get(i);if(Y!==void 0){var G=Bo,be=i;switch(i){case"keypress":if(Ao(r)===0)break e;case"keydown":case"keyup":G=e1;break;case"focusin":be="focus",G=$u;break;case"focusout":be="blur",G=$u;break;case"beforeblur":case"afterblur":G=$u;break;case"click":if(r.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":G=Im;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":G=Iw;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":G=s1;break;case c_:case u_:case h_:G=Ww;break;case d_:G=r1;break;case"scroll":case"scrollend":G=Pw;break;case"wheel":G=l1;break;case"copy":case"cut":case"paste":G=$w;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":G=qm;break;case"toggle":case"beforetoggle":G=c1}var Ae=(s&4)!==0,ft=!Ae&&(i==="scroll"||i==="scrollend"),z=Ae?Y!==null?Y+"Capture":null:Y;Ae=[];for(var N=P,U;N!==null;){var ne=N;if(U=ne.stateNode,ne=ne.tag,ne!==5&&ne!==26&&ne!==27||U===null||z===null||(ne=Fa(N,z),ne!=null&&Ae.push(wl(N,ne,U))),ft)break;N=N.return}0<Ae.length&&(Y=new G(Y,be,null,r,se),le.push({event:Y,listeners:Ae}))}}if((s&7)===0){e:{if(Y=i==="mouseover"||i==="pointerover",G=i==="mouseout"||i==="pointerout",Y&&r!==Pu&&(be=r.relatedTarget||r.fromElement)&&(Ls(be)||be[us]))break e;if((G||Y)&&(Y=se.window===se?se:(Y=se.ownerDocument)?Y.defaultView||Y.parentWindow:window,G?(be=r.relatedTarget||r.toElement,G=P,be=be?Ls(be):null,be!==null&&(ft=c(be),Ae=be.tag,be!==ft||Ae!==5&&Ae!==27&&Ae!==6)&&(be=null)):(G=null,be=P),G!==be)){if(Ae=Im,ne="onMouseLeave",z="onMouseEnter",N="mouse",(i==="pointerout"||i==="pointerover")&&(Ae=qm,ne="onPointerLeave",z="onPointerEnter",N="pointer"),ft=G==null?Y:Ds(G),U=be==null?Y:Ds(be),Y=new Ae(ne,N+"leave",G,r,se),Y.target=ft,Y.relatedTarget=U,ne=null,Ls(se)===P&&(Ae=new Ae(z,N+"enter",be,r,se),Ae.target=U,Ae.relatedTarget=ft,ne=Ae),ft=ne,G&&be)t:{for(Ae=oC,z=G,N=be,U=0,ne=z;ne;ne=Ae(ne))U++;ne=0;for(var Me=N;Me;Me=Ae(Me))ne++;for(;0<U-ne;)z=Ae(z),U--;for(;0<ne-U;)N=Ae(N),ne--;for(;U--;){if(z===N||N!==null&&z===N.alternate){Ae=z;break t}z=Ae(z),N=Ae(N)}Ae=null}else Ae=null;G!==null&&Og(le,Y,G,Ae,!1),be!==null&&ft!==null&&Og(le,ft,be,Ae,!0)}}e:{if(Y=P?Ds(P):window,G=Y.nodeName&&Y.nodeName.toLowerCase(),G==="select"||G==="input"&&Y.type==="file")var tt=Qm;else if(Gm(Y))if(Jm)tt=y1;else{tt=v1;var Te=_1}else G=Y.nodeName,!G||G.toLowerCase()!=="input"||Y.type!=="checkbox"&&Y.type!=="radio"?P&&Uu(P.elementType)&&(tt=Qm):tt=g1;if(tt&&(tt=tt(i,P))){Zm(le,tt,r,se);break e}Te&&Te(i,Y,P),i==="focusout"&&P&&Y.type==="number"&&P.memoizedProps.value!=null&&Hu(Y,"number",Y.value)}switch(Te=P?Ds(P):window,i){case"focusin":(Gm(Te)||Te.contentEditable==="true")&&(Gr=Te,Ju=P,Za=null);break;case"focusout":Za=Ju=Gr=null;break;case"mousedown":eh=!0;break;case"contextmenu":case"mouseup":case"dragend":eh=!1,l_(le,r,se);break;case"selectionchange":if(b1)break;case"keydown":case"keyup":l_(le,r,se)}var Fe;if(Xu)e:{switch(i){case"compositionstart":var Qe="onCompositionStart";break e;case"compositionend":Qe="onCompositionEnd";break e;case"compositionupdate":Qe="onCompositionUpdate";break e}Qe=void 0}else Xr?Vm(i,r)&&(Qe="onCompositionEnd"):i==="keydown"&&r.keyCode===229&&(Qe="onCompositionStart");Qe&&(Wm&&r.locale!=="ko"&&(Xr||Qe!=="onCompositionStart"?Qe==="onCompositionEnd"&&Xr&&(Fe=Pm()):(Tn=se,qu="value"in Tn?Tn.value:Tn.textContent,Xr=!0)),Te=Cc(P,Qe),0<Te.length&&(Qe=new Fm(Qe,i,null,r,se),le.push({event:Qe,listeners:Te}),Fe?Qe.data=Fe:(Fe=Xm(r),Fe!==null&&(Qe.data=Fe)))),(Fe=h1?d1(i,r):f1(i,r))&&(Qe=Cc(P,"onBeforeInput"),0<Qe.length&&(Te=new Fm("onBeforeInput","beforeinput",null,r,se),le.push({event:Te,listeners:Qe}),Te.data=Fe)),nC(le,i,P,r,se)}Bg(le,s)})}function wl(i,s,r){return{instance:i,listener:s,currentTarget:r}}function Cc(i,s){for(var r=s+"Capture",l=[];i!==null;){var u=i,h=u.stateNode;if(u=u.tag,u!==5&&u!==26&&u!==27||h===null||(u=Fa(i,r),u!=null&&l.unshift(wl(i,u,h)),u=Fa(i,s),u!=null&&l.push(wl(i,u,h))),i.tag===3)return l;i=i.return}return[]}function oC(i){if(i===null)return null;do i=i.return;while(i&&i.tag!==5&&i.tag!==27);return i||null}function Og(i,s,r,l,u){for(var h=s._reactName,v=[];r!==null&&r!==l;){var w=r,D=w.alternate,P=w.stateNode;if(w=w.tag,D!==null&&D===l)break;w!==5&&w!==26&&w!==27||P===null||(D=P,u?(P=Fa(r,h),P!=null&&v.unshift(wl(r,P,D))):u||(P=Fa(r,h),P!=null&&v.push(wl(r,P,D)))),r=r.return}v.length!==0&&i.push({event:s,listeners:v})}var cC=/\r\n?/g,uC=/\u0000|\uFFFD/g;function zg(i){return(typeof i=="string"?i:""+i).replace(cC,`
9
+ `).replace(uC,"")}function jg(i,s){return s=zg(s),zg(i)===s}function dt(i,s,r,l,u,h){switch(r){case"children":typeof l=="string"?s==="body"||s==="textarea"&&l===""||Yr(i,l):(typeof l=="number"||typeof l=="bigint")&&s!=="body"&&Yr(i,""+l);break;case"className":K(i,"class",l);break;case"tabIndex":K(i,"tabindex",l);break;case"dir":case"role":case"viewBox":case"width":case"height":K(i,r,l);break;case"style":jm(i,l,h);break;case"data":if(s!=="object"){K(i,"data",l);break}case"src":case"href":if(l===""&&(s!=="a"||r!=="href")){i.removeAttribute(r);break}if(l==null||typeof l=="function"||typeof l=="symbol"||typeof l=="boolean"){i.removeAttribute(r);break}l=Ro(""+l),i.setAttribute(r,l);break;case"action":case"formAction":if(typeof l=="function"){i.setAttribute(r,"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 h=="function"&&(r==="formAction"?(s!=="input"&&dt(i,s,"name",u.name,u,null),dt(i,s,"formEncType",u.formEncType,u,null),dt(i,s,"formMethod",u.formMethod,u,null),dt(i,s,"formTarget",u.formTarget,u,null)):(dt(i,s,"encType",u.encType,u,null),dt(i,s,"method",u.method,u,null),dt(i,s,"target",u.target,u,null)));if(l==null||typeof l=="symbol"||typeof l=="boolean"){i.removeAttribute(r);break}l=Ro(""+l),i.setAttribute(r,l);break;case"onClick":l!=null&&(i.onclick=Gs);break;case"onScroll":l!=null&&Ve("scroll",i);break;case"onScrollEnd":l!=null&&Ve("scrollend",i);break;case"dangerouslySetInnerHTML":if(l!=null){if(typeof l!="object"||!("__html"in l))throw Error(a(61));if(r=l.__html,r!=null){if(u.children!=null)throw Error(a(60));i.innerHTML=r}}break;case"multiple":i.multiple=l&&typeof l!="function"&&typeof l!="symbol";break;case"muted":i.muted=l&&typeof l!="function"&&typeof l!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(l==null||typeof l=="function"||typeof l=="boolean"||typeof l=="symbol"){i.removeAttribute("xlink:href");break}r=Ro(""+l),i.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",r);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":l!=null&&typeof l!="function"&&typeof l!="symbol"?i.setAttribute(r,""+l):i.removeAttribute(r);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":l&&typeof l!="function"&&typeof l!="symbol"?i.setAttribute(r,""):i.removeAttribute(r);break;case"capture":case"download":l===!0?i.setAttribute(r,""):l!==!1&&l!=null&&typeof l!="function"&&typeof l!="symbol"?i.setAttribute(r,l):i.removeAttribute(r);break;case"cols":case"rows":case"size":case"span":l!=null&&typeof l!="function"&&typeof l!="symbol"&&!isNaN(l)&&1<=l?i.setAttribute(r,l):i.removeAttribute(r);break;case"rowSpan":case"start":l==null||typeof l=="function"||typeof l=="symbol"||isNaN(l)?i.removeAttribute(r):i.setAttribute(r,l);break;case"popover":Ve("beforetoggle",i),Ve("toggle",i),M(i,"popover",l);break;case"xlinkActuate":ue(i,"http://www.w3.org/1999/xlink","xlink:actuate",l);break;case"xlinkArcrole":ue(i,"http://www.w3.org/1999/xlink","xlink:arcrole",l);break;case"xlinkRole":ue(i,"http://www.w3.org/1999/xlink","xlink:role",l);break;case"xlinkShow":ue(i,"http://www.w3.org/1999/xlink","xlink:show",l);break;case"xlinkTitle":ue(i,"http://www.w3.org/1999/xlink","xlink:title",l);break;case"xlinkType":ue(i,"http://www.w3.org/1999/xlink","xlink:type",l);break;case"xmlBase":ue(i,"http://www.w3.org/XML/1998/namespace","xml:base",l);break;case"xmlLang":ue(i,"http://www.w3.org/XML/1998/namespace","xml:lang",l);break;case"xmlSpace":ue(i,"http://www.w3.org/XML/1998/namespace","xml:space",l);break;case"is":M(i,"is",l);break;case"innerText":case"textContent":break;default:(!(2<r.length)||r[0]!=="o"&&r[0]!=="O"||r[1]!=="n"&&r[1]!=="N")&&(r=Hw.get(r)||r,M(i,r,l))}}function Ed(i,s,r,l,u,h){switch(r){case"style":jm(i,l,h);break;case"dangerouslySetInnerHTML":if(l!=null){if(typeof l!="object"||!("__html"in l))throw Error(a(61));if(r=l.__html,r!=null){if(u.children!=null)throw Error(a(60));i.innerHTML=r}}break;case"children":typeof l=="string"?Yr(i,l):(typeof l=="number"||typeof l=="bigint")&&Yr(i,""+l);break;case"onScroll":l!=null&&Ve("scroll",i);break;case"onScrollEnd":l!=null&&Ve("scrollend",i);break;case"onClick":l!=null&&(i.onclick=Gs);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Ir.hasOwnProperty(r))e:{if(r[0]==="o"&&r[1]==="n"&&(u=r.endsWith("Capture"),s=r.slice(2,u?r.length-7:void 0),h=i[Yt]||null,h=h!=null?h[r]:null,typeof h=="function"&&i.removeEventListener(s,h,u),typeof l=="function")){typeof h!="function"&&h!==null&&(r in i?i[r]=null:i.hasAttribute(r)&&i.removeAttribute(r)),i.addEventListener(s,l,u);break e}r in i?i[r]=l:l===!0?i.setAttribute(r,""):M(i,r,l)}}}function Ci(i,s,r){switch(s){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Ve("error",i),Ve("load",i);var l=!1,u=!1,h;for(h in r)if(r.hasOwnProperty(h)){var v=r[h];if(v!=null)switch(h){case"src":l=!0;break;case"srcSet":u=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(a(137,s));default:dt(i,s,h,v,r,null)}}u&&dt(i,s,"srcSet",r.srcSet,r,null),l&&dt(i,s,"src",r.src,r,null);return;case"input":Ve("invalid",i);var w=h=v=u=null,D=null,P=null;for(l in r)if(r.hasOwnProperty(l)){var se=r[l];if(se!=null)switch(l){case"name":u=se;break;case"type":v=se;break;case"checked":D=se;break;case"defaultChecked":P=se;break;case"value":h=se;break;case"defaultValue":w=se;break;case"children":case"dangerouslySetInnerHTML":if(se!=null)throw Error(a(137,s));break;default:dt(i,s,l,se,r,null)}}Ia(i,h,w,D,P,v,u,!1);return;case"select":Ve("invalid",i),l=v=h=null;for(u in r)if(r.hasOwnProperty(u)&&(w=r[u],w!=null))switch(u){case"value":h=w;break;case"defaultValue":v=w;break;case"multiple":l=w;default:dt(i,s,u,w,r,null)}s=h,r=v,i.multiple=!!l,s!=null?Wr(i,!!l,s,!1):r!=null&&Wr(i,!!l,r,!0);return;case"textarea":Ve("invalid",i),h=u=l=null;for(v in r)if(r.hasOwnProperty(v)&&(w=r[v],w!=null))switch(v){case"value":l=w;break;case"defaultValue":u=w;break;case"children":h=w;break;case"dangerouslySetInnerHTML":if(w!=null)throw Error(a(91));break;default:dt(i,s,v,w,r,null)}Om(i,l,u,h);return;case"option":for(D in r)r.hasOwnProperty(D)&&(l=r[D],l!=null)&&(D==="selected"?i.selected=l&&typeof l!="function"&&typeof l!="symbol":dt(i,s,D,l,r,null));return;case"dialog":Ve("beforetoggle",i),Ve("toggle",i),Ve("cancel",i),Ve("close",i);break;case"iframe":case"object":Ve("load",i);break;case"video":case"audio":for(l=0;l<bl.length;l++)Ve(bl[l],i);break;case"image":Ve("error",i),Ve("load",i);break;case"details":Ve("toggle",i);break;case"embed":case"source":case"link":Ve("error",i),Ve("load",i);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(P in r)if(r.hasOwnProperty(P)&&(l=r[P],l!=null))switch(P){case"children":case"dangerouslySetInnerHTML":throw Error(a(137,s));default:dt(i,s,P,l,r,null)}return;default:if(Uu(s)){for(se in r)r.hasOwnProperty(se)&&(l=r[se],l!==void 0&&Ed(i,s,se,l,r,void 0));return}}for(w in r)r.hasOwnProperty(w)&&(l=r[w],l!=null&&dt(i,s,w,l,r,null))}function hC(i,s,r,l){switch(s){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var u=null,h=null,v=null,w=null,D=null,P=null,se=null;for(G in r){var le=r[G];if(r.hasOwnProperty(G)&&le!=null)switch(G){case"checked":break;case"value":break;case"defaultValue":D=le;default:l.hasOwnProperty(G)||dt(i,s,G,null,l,le)}}for(var Y in l){var G=l[Y];if(le=r[Y],l.hasOwnProperty(Y)&&(G!=null||le!=null))switch(Y){case"type":h=G;break;case"name":u=G;break;case"checked":P=G;break;case"defaultChecked":se=G;break;case"value":v=G;break;case"defaultValue":w=G;break;case"children":case"dangerouslySetInnerHTML":if(G!=null)throw Error(a(137,s));break;default:G!==le&&dt(i,s,Y,G,l,le)}}qr(i,v,w,D,P,se,h,u);return;case"select":G=v=w=Y=null;for(h in r)if(D=r[h],r.hasOwnProperty(h)&&D!=null)switch(h){case"value":break;case"multiple":G=D;default:l.hasOwnProperty(h)||dt(i,s,h,null,l,D)}for(u in l)if(h=l[u],D=r[u],l.hasOwnProperty(u)&&(h!=null||D!=null))switch(u){case"value":Y=h;break;case"defaultValue":w=h;break;case"multiple":v=h;default:h!==D&&dt(i,s,u,h,l,D)}s=w,r=v,l=G,Y!=null?Wr(i,!!r,Y,!1):!!l!=!!r&&(s!=null?Wr(i,!!r,s,!0):Wr(i,!!r,r?[]:"",!1));return;case"textarea":G=Y=null;for(w in r)if(u=r[w],r.hasOwnProperty(w)&&u!=null&&!l.hasOwnProperty(w))switch(w){case"value":break;case"children":break;default:dt(i,s,w,null,l,u)}for(v in l)if(u=l[v],h=r[v],l.hasOwnProperty(v)&&(u!=null||h!=null))switch(v){case"value":Y=u;break;case"defaultValue":G=u;break;case"children":break;case"dangerouslySetInnerHTML":if(u!=null)throw Error(a(91));break;default:u!==h&&dt(i,s,v,u,l,h)}Lm(i,Y,G);return;case"option":for(var be in r)Y=r[be],r.hasOwnProperty(be)&&Y!=null&&!l.hasOwnProperty(be)&&(be==="selected"?i.selected=!1:dt(i,s,be,null,l,Y));for(D in l)Y=l[D],G=r[D],l.hasOwnProperty(D)&&Y!==G&&(Y!=null||G!=null)&&(D==="selected"?i.selected=Y&&typeof Y!="function"&&typeof Y!="symbol":dt(i,s,D,Y,l,G));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 Ae in r)Y=r[Ae],r.hasOwnProperty(Ae)&&Y!=null&&!l.hasOwnProperty(Ae)&&dt(i,s,Ae,null,l,Y);for(P in l)if(Y=l[P],G=r[P],l.hasOwnProperty(P)&&Y!==G&&(Y!=null||G!=null))switch(P){case"children":case"dangerouslySetInnerHTML":if(Y!=null)throw Error(a(137,s));break;default:dt(i,s,P,Y,l,G)}return;default:if(Uu(s)){for(var ft in r)Y=r[ft],r.hasOwnProperty(ft)&&Y!==void 0&&!l.hasOwnProperty(ft)&&Ed(i,s,ft,void 0,l,Y);for(se in l)Y=l[se],G=r[se],!l.hasOwnProperty(se)||Y===G||Y===void 0&&G===void 0||Ed(i,s,se,Y,l,G);return}}for(var z in r)Y=r[z],r.hasOwnProperty(z)&&Y!=null&&!l.hasOwnProperty(z)&&dt(i,s,z,null,l,Y);for(le in l)Y=l[le],G=r[le],!l.hasOwnProperty(le)||Y===G||Y==null&&G==null||dt(i,s,le,Y,l,G)}function Hg(i){switch(i){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function dC(){if(typeof performance.getEntriesByType=="function"){for(var i=0,s=0,r=performance.getEntriesByType("resource"),l=0;l<r.length;l++){var u=r[l],h=u.transferSize,v=u.initiatorType,w=u.duration;if(h&&w&&Hg(v)){for(v=0,w=u.responseEnd,l+=1;l<r.length;l++){var D=r[l],P=D.startTime;if(P>w)break;var se=D.transferSize,le=D.initiatorType;se&&Hg(le)&&(D=D.responseEnd,v+=se*(D<w?1:(w-P)/(D-P)))}if(--l,s+=8*(h+v)/(u.duration/1e3),i++,10<i)break}}if(0<i)return s/i/1e6}return navigator.connection&&(i=navigator.connection.downlink,typeof i=="number")?i:5}var Td=null,kd=null;function xc(i){return i.nodeType===9?i:i.ownerDocument}function Ug(i){switch(i){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function Pg(i,s){if(i===0)switch(s){case"svg":return 1;case"math":return 2;default:return 0}return i===1&&s==="foreignObject"?0:i}function Dd(i,s){return i==="textarea"||i==="noscript"||typeof s.children=="string"||typeof s.children=="number"||typeof s.children=="bigint"||typeof s.dangerouslySetInnerHTML=="object"&&s.dangerouslySetInnerHTML!==null&&s.dangerouslySetInnerHTML.__html!=null}var Rd=null;function fC(){var i=window.event;return i&&i.type==="popstate"?i===Rd?!1:(Rd=i,!0):(Rd=null,!1)}var Kg=typeof setTimeout=="function"?setTimeout:void 0,pC=typeof clearTimeout=="function"?clearTimeout:void 0,Ig=typeof Promise=="function"?Promise:void 0,mC=typeof queueMicrotask=="function"?queueMicrotask:typeof Ig<"u"?function(i){return Ig.resolve(null).then(i).catch(_C)}:Kg;function _C(i){setTimeout(function(){throw i})}function Fn(i){return i==="head"}function Fg(i,s){var r=s,l=0;do{var u=r.nextSibling;if(i.removeChild(r),u&&u.nodeType===8)if(r=u.data,r==="/$"||r==="/&"){if(l===0){i.removeChild(u),Ca(s);return}l--}else if(r==="$"||r==="$?"||r==="$~"||r==="$!"||r==="&")l++;else if(r==="html")Cl(i.ownerDocument.documentElement);else if(r==="head"){r=i.ownerDocument.head,Cl(r);for(var h=r.firstChild;h;){var v=h.nextSibling,w=h.nodeName;h[Gi]||w==="SCRIPT"||w==="STYLE"||w==="LINK"&&h.rel.toLowerCase()==="stylesheet"||r.removeChild(h),h=v}}else r==="body"&&Cl(i.ownerDocument.body);r=u}while(r);Ca(s)}function qg(i,s){var r=i;i=0;do{var l=r.nextSibling;if(r.nodeType===1?s?(r._stashedDisplay=r.style.display,r.style.display="none"):(r.style.display=r._stashedDisplay||"",r.getAttribute("style")===""&&r.removeAttribute("style")):r.nodeType===3&&(s?(r._stashedText=r.nodeValue,r.nodeValue=""):r.nodeValue=r._stashedText||""),l&&l.nodeType===8)if(r=l.data,r==="/$"){if(i===0)break;i--}else r!=="$"&&r!=="$?"&&r!=="$~"&&r!=="$!"||i++;r=l}while(r)}function Md(i){var s=i.firstChild;for(s&&s.nodeType===10&&(s=s.nextSibling);s;){var r=s;switch(s=s.nextSibling,r.nodeName){case"HTML":case"HEAD":case"BODY":Md(r),En(r);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(r.rel.toLowerCase()==="stylesheet")continue}i.removeChild(r)}}function vC(i,s,r,l){for(;i.nodeType===1;){var u=r;if(i.nodeName.toLowerCase()!==s.toLowerCase()){if(!l&&(i.nodeName!=="INPUT"||i.type!=="hidden"))break}else if(l){if(!i[Gi])switch(s){case"meta":if(!i.hasAttribute("itemprop"))break;return i;case"link":if(h=i.getAttribute("rel"),h==="stylesheet"&&i.hasAttribute("data-precedence"))break;if(h!==u.rel||i.getAttribute("href")!==(u.href==null||u.href===""?null:u.href)||i.getAttribute("crossorigin")!==(u.crossOrigin==null?null:u.crossOrigin)||i.getAttribute("title")!==(u.title==null?null:u.title))break;return i;case"style":if(i.hasAttribute("data-precedence"))break;return i;case"script":if(h=i.getAttribute("src"),(h!==(u.src==null?null:u.src)||i.getAttribute("type")!==(u.type==null?null:u.type)||i.getAttribute("crossorigin")!==(u.crossOrigin==null?null:u.crossOrigin))&&h&&i.hasAttribute("async")&&!i.hasAttribute("itemprop"))break;return i;default:return i}}else if(s==="input"&&i.type==="hidden"){var h=u.name==null?null:""+u.name;if(u.type==="hidden"&&i.getAttribute("name")===h)return i}else return i;if(i=vs(i.nextSibling),i===null)break}return null}function gC(i,s,r){if(s==="")return null;for(;i.nodeType!==3;)if((i.nodeType!==1||i.nodeName!=="INPUT"||i.type!=="hidden")&&!r||(i=vs(i.nextSibling),i===null))return null;return i}function Wg(i,s){for(;i.nodeType!==8;)if((i.nodeType!==1||i.nodeName!=="INPUT"||i.type!=="hidden")&&!s||(i=vs(i.nextSibling),i===null))return null;return i}function Ad(i){return i.data==="$?"||i.data==="$~"}function Nd(i){return i.data==="$!"||i.data==="$?"&&i.ownerDocument.readyState!=="loading"}function yC(i,s){var r=i.ownerDocument;if(i.data==="$~")i._reactRetry=s;else if(i.data!=="$?"||r.readyState!=="loading")s();else{var l=function(){s(),r.removeEventListener("DOMContentLoaded",l)};r.addEventListener("DOMContentLoaded",l),i._reactRetry=l}}function vs(i){for(;i!=null;i=i.nextSibling){var s=i.nodeType;if(s===1||s===3)break;if(s===8){if(s=i.data,s==="$"||s==="$!"||s==="$?"||s==="$~"||s==="&"||s==="F!"||s==="F")break;if(s==="/$"||s==="/&")return null}}return i}var Bd=null;function Yg(i){i=i.nextSibling;for(var s=0;i;){if(i.nodeType===8){var r=i.data;if(r==="/$"||r==="/&"){if(s===0)return vs(i.nextSibling);s--}else r!=="$"&&r!=="$!"&&r!=="$?"&&r!=="$~"&&r!=="&"||s++}i=i.nextSibling}return null}function $g(i){i=i.previousSibling;for(var s=0;i;){if(i.nodeType===8){var r=i.data;if(r==="$"||r==="$!"||r==="$?"||r==="$~"||r==="&"){if(s===0)return i;s--}else r!=="/$"&&r!=="/&"||s++}i=i.previousSibling}return null}function Vg(i,s,r){switch(s=xc(r),i){case"html":if(i=s.documentElement,!i)throw Error(a(452));return i;case"head":if(i=s.head,!i)throw Error(a(453));return i;case"body":if(i=s.body,!i)throw Error(a(454));return i;default:throw Error(a(451))}}function Cl(i){for(var s=i.attributes;s.length;)i.removeAttributeNode(s[0]);En(i)}var gs=new Map,Xg=new Set;function Ec(i){return typeof i.getRootNode=="function"?i.getRootNode():i.nodeType===9?i:i.ownerDocument}var fn=V.d;V.d={f:SC,r:bC,D:wC,C:CC,L:xC,m:EC,X:kC,S:TC,M:DC};function SC(){var i=fn.f(),s=_c();return i||s}function bC(i){var s=Os(i);s!==null&&s.tag===5&&s.type==="form"?dv(s):fn.r(i)}var Sa=typeof document>"u"?null:document;function Gg(i,s,r){var l=Sa;if(l&&typeof s=="string"&&s){var u=Ut(s);u='link[rel="'+i+'"][href="'+u+'"]',typeof r=="string"&&(u+='[crossorigin="'+r+'"]'),Xg.has(u)||(Xg.add(u),i={rel:i,crossOrigin:r,href:s},l.querySelector(u)===null&&(s=l.createElement("link"),Ci(s,"link",i),Lt(s),l.head.appendChild(s)))}}function wC(i){fn.D(i),Gg("dns-prefetch",i,null)}function CC(i,s){fn.C(i,s),Gg("preconnect",i,s)}function xC(i,s,r){fn.L(i,s,r);var l=Sa;if(l&&i&&s){var u='link[rel="preload"][as="'+Ut(s)+'"]';s==="image"&&r&&r.imageSrcSet?(u+='[imagesrcset="'+Ut(r.imageSrcSet)+'"]',typeof r.imageSizes=="string"&&(u+='[imagesizes="'+Ut(r.imageSizes)+'"]')):u+='[href="'+Ut(i)+'"]';var h=u;switch(s){case"style":h=ba(i);break;case"script":h=wa(i)}gs.has(h)||(i=y({rel:"preload",href:s==="image"&&r&&r.imageSrcSet?void 0:i,as:s},r),gs.set(h,i),l.querySelector(u)!==null||s==="style"&&l.querySelector(xl(h))||s==="script"&&l.querySelector(El(h))||(s=l.createElement("link"),Ci(s,"link",i),Lt(s),l.head.appendChild(s)))}}function EC(i,s){fn.m(i,s);var r=Sa;if(r&&i){var l=s&&typeof s.as=="string"?s.as:"script",u='link[rel="modulepreload"][as="'+Ut(l)+'"][href="'+Ut(i)+'"]',h=u;switch(l){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":h=wa(i)}if(!gs.has(h)&&(i=y({rel:"modulepreload",href:i},s),gs.set(h,i),r.querySelector(u)===null)){switch(l){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(r.querySelector(El(h)))return}l=r.createElement("link"),Ci(l,"link",i),Lt(l),r.head.appendChild(l)}}}function TC(i,s,r){fn.S(i,s,r);var l=Sa;if(l&&i){var u=Zi(l).hoistableStyles,h=ba(i);s=s||"default";var v=u.get(h);if(!v){var w={loading:0,preload:null};if(v=l.querySelector(xl(h)))w.loading=5;else{i=y({rel:"stylesheet",href:i,"data-precedence":s},r),(r=gs.get(h))&&Ld(i,r);var D=v=l.createElement("link");Lt(D),Ci(D,"link",i),D._p=new Promise(function(P,se){D.onload=P,D.onerror=se}),D.addEventListener("load",function(){w.loading|=1}),D.addEventListener("error",function(){w.loading|=2}),w.loading|=4,Tc(v,s,l)}v={type:"stylesheet",instance:v,count:1,state:w},u.set(h,v)}}}function kC(i,s){fn.X(i,s);var r=Sa;if(r&&i){var l=Zi(r).hoistableScripts,u=wa(i),h=l.get(u);h||(h=r.querySelector(El(u)),h||(i=y({src:i,async:!0},s),(s=gs.get(u))&&Od(i,s),h=r.createElement("script"),Lt(h),Ci(h,"link",i),r.head.appendChild(h)),h={type:"script",instance:h,count:1,state:null},l.set(u,h))}}function DC(i,s){fn.M(i,s);var r=Sa;if(r&&i){var l=Zi(r).hoistableScripts,u=wa(i),h=l.get(u);h||(h=r.querySelector(El(u)),h||(i=y({src:i,async:!0,type:"module"},s),(s=gs.get(u))&&Od(i,s),h=r.createElement("script"),Lt(h),Ci(h,"link",i),r.head.appendChild(h)),h={type:"script",instance:h,count:1,state:null},l.set(u,h))}}function Zg(i,s,r,l){var u=(u=me.current)?Ec(u):null;if(!u)throw Error(a(446));switch(i){case"meta":case"title":return null;case"style":return typeof r.precedence=="string"&&typeof r.href=="string"?(s=ba(r.href),r=Zi(u).hoistableStyles,l=r.get(s),l||(l={type:"style",instance:null,count:0,state:null},r.set(s,l)),l):{type:"void",instance:null,count:0,state:null};case"link":if(r.rel==="stylesheet"&&typeof r.href=="string"&&typeof r.precedence=="string"){i=ba(r.href);var h=Zi(u).hoistableStyles,v=h.get(i);if(v||(u=u.ownerDocument||u,v={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},h.set(i,v),(h=u.querySelector(xl(i)))&&!h._p&&(v.instance=h,v.state.loading=5),gs.has(i)||(r={rel:"preload",as:"style",href:r.href,crossOrigin:r.crossOrigin,integrity:r.integrity,media:r.media,hrefLang:r.hrefLang,referrerPolicy:r.referrerPolicy},gs.set(i,r),h||RC(u,i,r,v.state))),s&&l===null)throw Error(a(528,""));return v}if(s&&l!==null)throw Error(a(529,""));return null;case"script":return s=r.async,r=r.src,typeof r=="string"&&s&&typeof s!="function"&&typeof s!="symbol"?(s=wa(r),r=Zi(u).hoistableScripts,l=r.get(s),l||(l={type:"script",instance:null,count:0,state:null},r.set(s,l)),l):{type:"void",instance:null,count:0,state:null};default:throw Error(a(444,i))}}function ba(i){return'href="'+Ut(i)+'"'}function xl(i){return'link[rel="stylesheet"]['+i+"]"}function Qg(i){return y({},i,{"data-precedence":i.precedence,precedence:null})}function RC(i,s,r,l){i.querySelector('link[rel="preload"][as="style"]['+s+"]")?l.loading=1:(s=i.createElement("link"),l.preload=s,s.addEventListener("load",function(){return l.loading|=1}),s.addEventListener("error",function(){return l.loading|=2}),Ci(s,"link",r),Lt(s),i.head.appendChild(s))}function wa(i){return'[src="'+Ut(i)+'"]'}function El(i){return"script[async]"+i}function Jg(i,s,r){if(s.count++,s.instance===null)switch(s.type){case"style":var l=i.querySelector('style[data-href~="'+Ut(r.href)+'"]');if(l)return s.instance=l,Lt(l),l;var u=y({},r,{"data-href":r.href,"data-precedence":r.precedence,href:null,precedence:null});return l=(i.ownerDocument||i).createElement("style"),Lt(l),Ci(l,"style",u),Tc(l,r.precedence,i),s.instance=l;case"stylesheet":u=ba(r.href);var h=i.querySelector(xl(u));if(h)return s.state.loading|=4,s.instance=h,Lt(h),h;l=Qg(r),(u=gs.get(u))&&Ld(l,u),h=(i.ownerDocument||i).createElement("link"),Lt(h);var v=h;return v._p=new Promise(function(w,D){v.onload=w,v.onerror=D}),Ci(h,"link",l),s.state.loading|=4,Tc(h,r.precedence,i),s.instance=h;case"script":return h=wa(r.src),(u=i.querySelector(El(h)))?(s.instance=u,Lt(u),u):(l=r,(u=gs.get(h))&&(l=y({},r),Od(l,u)),i=i.ownerDocument||i,u=i.createElement("script"),Lt(u),Ci(u,"link",l),i.head.appendChild(u),s.instance=u);case"void":return null;default:throw Error(a(443,s.type))}else s.type==="stylesheet"&&(s.state.loading&4)===0&&(l=s.instance,s.state.loading|=4,Tc(l,r.precedence,i));return s.instance}function Tc(i,s,r){for(var l=r.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),u=l.length?l[l.length-1]:null,h=u,v=0;v<l.length;v++){var w=l[v];if(w.dataset.precedence===s)h=w;else if(h!==u)break}h?h.parentNode.insertBefore(i,h.nextSibling):(s=r.nodeType===9?r.head:r,s.insertBefore(i,s.firstChild))}function Ld(i,s){i.crossOrigin==null&&(i.crossOrigin=s.crossOrigin),i.referrerPolicy==null&&(i.referrerPolicy=s.referrerPolicy),i.title==null&&(i.title=s.title)}function Od(i,s){i.crossOrigin==null&&(i.crossOrigin=s.crossOrigin),i.referrerPolicy==null&&(i.referrerPolicy=s.referrerPolicy),i.integrity==null&&(i.integrity=s.integrity)}var kc=null;function ey(i,s,r){if(kc===null){var l=new Map,u=kc=new Map;u.set(r,l)}else u=kc,l=u.get(r),l||(l=new Map,u.set(r,l));if(l.has(i))return l;for(l.set(i,null),r=r.getElementsByTagName(i),u=0;u<r.length;u++){var h=r[u];if(!(h[Gi]||h[mt]||i==="link"&&h.getAttribute("rel")==="stylesheet")&&h.namespaceURI!=="http://www.w3.org/2000/svg"){var v=h.getAttribute(s)||"";v=i+v;var w=l.get(v);w?w.push(h):l.set(v,[h])}}return l}function ty(i,s,r){i=i.ownerDocument||i,i.head.insertBefore(r,s==="title"?i.querySelector("head > title"):null)}function MC(i,s,r){if(r===1||s.itemProp!=null)return!1;switch(i){case"meta":case"title":return!0;case"style":if(typeof s.precedence!="string"||typeof s.href!="string"||s.href==="")break;return!0;case"link":if(typeof s.rel!="string"||typeof s.href!="string"||s.href===""||s.onLoad||s.onError)break;return s.rel==="stylesheet"?(i=s.disabled,typeof s.precedence=="string"&&i==null):!0;case"script":if(s.async&&typeof s.async!="function"&&typeof s.async!="symbol"&&!s.onLoad&&!s.onError&&s.src&&typeof s.src=="string")return!0}return!1}function iy(i){return!(i.type==="stylesheet"&&(i.state.loading&3)===0)}function AC(i,s,r,l){if(r.type==="stylesheet"&&(typeof l.media!="string"||matchMedia(l.media).matches!==!1)&&(r.state.loading&4)===0){if(r.instance===null){var u=ba(l.href),h=s.querySelector(xl(u));if(h){s=h._p,s!==null&&typeof s=="object"&&typeof s.then=="function"&&(i.count++,i=Dc.bind(i),s.then(i,i)),r.state.loading|=4,r.instance=h,Lt(h);return}h=s.ownerDocument||s,l=Qg(l),(u=gs.get(u))&&Ld(l,u),h=h.createElement("link"),Lt(h);var v=h;v._p=new Promise(function(w,D){v.onload=w,v.onerror=D}),Ci(h,"link",l),r.instance=h}i.stylesheets===null&&(i.stylesheets=new Map),i.stylesheets.set(r,s),(s=r.state.preload)&&(r.state.loading&3)===0&&(i.count++,r=Dc.bind(i),s.addEventListener("load",r),s.addEventListener("error",r))}}var zd=0;function NC(i,s){return i.stylesheets&&i.count===0&&Mc(i,i.stylesheets),0<i.count||0<i.imgCount?function(r){var l=setTimeout(function(){if(i.stylesheets&&Mc(i,i.stylesheets),i.unsuspend){var h=i.unsuspend;i.unsuspend=null,h()}},6e4+s);0<i.imgBytes&&zd===0&&(zd=62500*dC());var u=setTimeout(function(){if(i.waitingForImages=!1,i.count===0&&(i.stylesheets&&Mc(i,i.stylesheets),i.unsuspend)){var h=i.unsuspend;i.unsuspend=null,h()}},(i.imgBytes>zd?50:800)+s);return i.unsuspend=r,function(){i.unsuspend=null,clearTimeout(l),clearTimeout(u)}}:null}function Dc(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Mc(this,this.stylesheets);else if(this.unsuspend){var i=this.unsuspend;this.unsuspend=null,i()}}}var Rc=null;function Mc(i,s){i.stylesheets=null,i.unsuspend!==null&&(i.count++,Rc=new Map,s.forEach(BC,i),Rc=null,Dc.call(i))}function BC(i,s){if(!(s.state.loading&4)){var r=Rc.get(i);if(r)var l=r.get(null);else{r=new Map,Rc.set(i,r);for(var u=i.querySelectorAll("link[data-precedence],style[data-precedence]"),h=0;h<u.length;h++){var v=u[h];(v.nodeName==="LINK"||v.getAttribute("media")!=="not all")&&(r.set(v.dataset.precedence,v),l=v)}l&&r.set(null,l)}u=s.instance,v=u.getAttribute("data-precedence"),h=r.get(v)||l,h===l&&r.set(null,u),r.set(v,u),this.count++,l=Dc.bind(this),u.addEventListener("load",l),u.addEventListener("error",l),h?h.parentNode.insertBefore(u,h.nextSibling):(i=i.nodeType===9?i.head:i,i.insertBefore(u,i.firstChild)),s.state.loading|=4}}var Tl={$$typeof:F,Provider:null,Consumer:null,_currentValue:Q,_currentValue2:Q,_threadCount:0};function LC(i,s,r,l,u,h,v,w,D){this.tag=1,this.containerInfo=i,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=nt(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=nt(0),this.hiddenUpdates=nt(null),this.identifierPrefix=l,this.onUncaughtError=u,this.onCaughtError=h,this.onRecoverableError=v,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=D,this.incompleteTransitions=new Map}function sy(i,s,r,l,u,h,v,w,D,P,se,le){return i=new LC(i,s,r,v,D,P,se,le,w),s=1,h===!0&&(s|=24),h=es(3,null,null,s),i.current=h,h.stateNode=i,s=mh(),s.refCount++,i.pooledCache=s,s.refCount++,h.memoizedState={element:l,isDehydrated:r,cache:s},yh(h),i}function ny(i){return i?(i=Jr,i):Jr}function ry(i,s,r,l,u,h){u=ny(u),l.context===null?l.context=u:l.pendingContext=u,l=Nn(s),l.payload={element:r},h=h===void 0?null:h,h!==null&&(l.callback=h),r=Bn(i,l,s),r!==null&&(Wi(r,i,s),nl(r,i,s))}function ay(i,s){if(i=i.memoizedState,i!==null&&i.dehydrated!==null){var r=i.retryLane;i.retryLane=r!==0&&r<s?r:s}}function jd(i,s){ay(i,s),(i=i.alternate)&&ay(i,s)}function ly(i){if(i.tag===13||i.tag===31){var s=mr(i,67108864);s!==null&&Wi(s,i,67108864),jd(i,67108864)}}function oy(i){if(i.tag===13||i.tag===31){var s=rs();s=Ai(s);var r=mr(i,s);r!==null&&Wi(r,i,s),jd(i,s)}}var Ac=!0;function OC(i,s,r,l){var u=A.T;A.T=null;var h=V.p;try{V.p=2,Hd(i,s,r,l)}finally{V.p=h,A.T=u}}function zC(i,s,r,l){var u=A.T;A.T=null;var h=V.p;try{V.p=8,Hd(i,s,r,l)}finally{V.p=h,A.T=u}}function Hd(i,s,r,l){if(Ac){var u=Ud(l);if(u===null)xd(i,s,l,Nc,r),uy(i,l);else if(HC(u,i,s,r,l))l.stopPropagation();else if(uy(i,l),s&4&&-1<jC.indexOf(i)){for(;u!==null;){var h=Os(u);if(h!==null)switch(h.tag){case 3:if(h=h.stateNode,h.current.memoizedState.isDehydrated){var v=St(h.pendingLanes);if(v!==0){var w=h;for(w.pendingLanes|=2,w.entangledLanes|=2;v;){var D=1<<31-Dt(v);w.entanglements[1]|=D,v&=~D}Ps(h),(st&6)===0&&(pc=He()+500,Sl(0))}}break;case 31:case 13:w=mr(h,2),w!==null&&Wi(w,h,2),_c(),jd(h,2)}if(h=Ud(l),h===null&&xd(i,s,l,Nc,r),h===u)break;u=h}u!==null&&l.stopPropagation()}else xd(i,s,l,null,r)}}function Ud(i){return i=Ku(i),Pd(i)}var Nc=null;function Pd(i){if(Nc=null,i=Ls(i),i!==null){var s=c(i);if(s===null)i=null;else{var r=s.tag;if(r===13){if(i=d(s),i!==null)return i;i=null}else if(r===31){if(i=p(s),i!==null)return i;i=null}else if(r===3){if(s.stateNode.current.memoizedState.isDehydrated)return s.tag===3?s.stateNode.containerInfo:null;i=null}else s!==i&&(i=null)}}return Nc=i,null}function cy(i){switch(i){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(_i()){case Vi:return 2;case ai:return 8;case kt:case ji:return 32;case Ti:return 268435456;default:return 32}default:return 32}}var Kd=!1,qn=null,Wn=null,Yn=null,kl=new Map,Dl=new Map,$n=[],jC="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 uy(i,s){switch(i){case"focusin":case"focusout":qn=null;break;case"dragenter":case"dragleave":Wn=null;break;case"mouseover":case"mouseout":Yn=null;break;case"pointerover":case"pointerout":kl.delete(s.pointerId);break;case"gotpointercapture":case"lostpointercapture":Dl.delete(s.pointerId)}}function Rl(i,s,r,l,u,h){return i===null||i.nativeEvent!==h?(i={blockedOn:s,domEventName:r,eventSystemFlags:l,nativeEvent:h,targetContainers:[u]},s!==null&&(s=Os(s),s!==null&&ly(s)),i):(i.eventSystemFlags|=l,s=i.targetContainers,u!==null&&s.indexOf(u)===-1&&s.push(u),i)}function HC(i,s,r,l,u){switch(s){case"focusin":return qn=Rl(qn,i,s,r,l,u),!0;case"dragenter":return Wn=Rl(Wn,i,s,r,l,u),!0;case"mouseover":return Yn=Rl(Yn,i,s,r,l,u),!0;case"pointerover":var h=u.pointerId;return kl.set(h,Rl(kl.get(h)||null,i,s,r,l,u)),!0;case"gotpointercapture":return h=u.pointerId,Dl.set(h,Rl(Dl.get(h)||null,i,s,r,l,u)),!0}return!1}function hy(i){var s=Ls(i.target);if(s!==null){var r=c(s);if(r!==null){if(s=r.tag,s===13){if(s=d(r),s!==null){i.blockedOn=s,cs(i.priority,function(){oy(r)});return}}else if(s===31){if(s=p(r),s!==null){i.blockedOn=s,cs(i.priority,function(){oy(r)});return}}else if(s===3&&r.stateNode.current.memoizedState.isDehydrated){i.blockedOn=r.tag===3?r.stateNode.containerInfo:null;return}}}i.blockedOn=null}function Bc(i){if(i.blockedOn!==null)return!1;for(var s=i.targetContainers;0<s.length;){var r=Ud(i.nativeEvent);if(r===null){r=i.nativeEvent;var l=new r.constructor(r.type,r);Pu=l,r.target.dispatchEvent(l),Pu=null}else return s=Os(r),s!==null&&ly(s),i.blockedOn=r,!1;s.shift()}return!0}function dy(i,s,r){Bc(i)&&r.delete(s)}function UC(){Kd=!1,qn!==null&&Bc(qn)&&(qn=null),Wn!==null&&Bc(Wn)&&(Wn=null),Yn!==null&&Bc(Yn)&&(Yn=null),kl.forEach(dy),Dl.forEach(dy)}function Lc(i,s){i.blockedOn===s&&(i.blockedOn=null,Kd||(Kd=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,UC)))}var Oc=null;function fy(i){Oc!==i&&(Oc=i,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){Oc===i&&(Oc=null);for(var s=0;s<i.length;s+=3){var r=i[s],l=i[s+1],u=i[s+2];if(typeof l!="function"){if(Pd(l||r)===null)continue;break}var h=Os(r);h!==null&&(i.splice(s,3),s-=3,Uh(h,{pending:!0,data:u,method:r.method,action:l},l,u))}}))}function Ca(i){function s(D){return Lc(D,i)}qn!==null&&Lc(qn,i),Wn!==null&&Lc(Wn,i),Yn!==null&&Lc(Yn,i),kl.forEach(s),Dl.forEach(s);for(var r=0;r<$n.length;r++){var l=$n[r];l.blockedOn===i&&(l.blockedOn=null)}for(;0<$n.length&&(r=$n[0],r.blockedOn===null);)hy(r),r.blockedOn===null&&$n.shift();if(r=(i.ownerDocument||i).$$reactFormReplay,r!=null)for(l=0;l<r.length;l+=3){var u=r[l],h=r[l+1],v=u[Yt]||null;if(typeof h=="function")v||fy(r);else if(v){var w=null;if(h&&h.hasAttribute("formAction")){if(u=h,v=h[Yt]||null)w=v.formAction;else if(Pd(u)!==null)continue}else w=v.action;typeof w=="function"?r[l+1]=w:(r.splice(l,3),l-=3),fy(r)}}}function py(){function i(h){h.canIntercept&&h.info==="react-transition"&&h.intercept({handler:function(){return new Promise(function(v){return u=v})},focusReset:"manual",scroll:"manual"})}function s(){u!==null&&(u(),u=null),l||setTimeout(r,20)}function r(){if(!l&&!navigation.transition){var h=navigation.currentEntry;h&&h.url!=null&&navigation.navigate(h.url,{state:h.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var l=!1,u=null;return navigation.addEventListener("navigate",i),navigation.addEventListener("navigatesuccess",s),navigation.addEventListener("navigateerror",s),setTimeout(r,100),function(){l=!0,navigation.removeEventListener("navigate",i),navigation.removeEventListener("navigatesuccess",s),navigation.removeEventListener("navigateerror",s),u!==null&&(u(),u=null)}}}function Id(i){this._internalRoot=i}zc.prototype.render=Id.prototype.render=function(i){var s=this._internalRoot;if(s===null)throw Error(a(409));var r=s.current,l=rs();ry(r,l,i,s,null,null)},zc.prototype.unmount=Id.prototype.unmount=function(){var i=this._internalRoot;if(i!==null){this._internalRoot=null;var s=i.containerInfo;ry(i.current,2,null,i,null,null),_c(),s[us]=null}};function zc(i){this._internalRoot=i}zc.prototype.unstable_scheduleHydration=function(i){if(i){var s=ki();i={blockedOn:null,target:i,priority:s};for(var r=0;r<$n.length&&s!==0&&s<$n[r].priority;r++);$n.splice(r,0,i),r===0&&hy(i)}};var my=t.version;if(my!=="19.2.6")throw Error(a(527,my,"19.2.6"));V.findDOMNode=function(i){var s=i._reactInternals;if(s===void 0)throw typeof i.render=="function"?Error(a(188)):(i=Object.keys(i).join(","),Error(a(268,i)));return i=f(s),i=i!==null?S(i):null,i=i===null?null:i.stateNode,i};var PC={bundleType:0,version:"19.2.6",rendererPackageName:"react-dom",currentDispatcherRef:A,reconcilerVersion:"19.2.6"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var jc=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!jc.isDisabled&&jc.supportsFiber)try{Hi=jc.inject(PC),qt=jc}catch{}}return Al.createRoot=function(i,s){if(!o(i))throw Error(a(299));var r=!1,l="",u=wv,h=Cv,v=xv;return s!=null&&(s.unstable_strictMode===!0&&(r=!0),s.identifierPrefix!==void 0&&(l=s.identifierPrefix),s.onUncaughtError!==void 0&&(u=s.onUncaughtError),s.onCaughtError!==void 0&&(h=s.onCaughtError),s.onRecoverableError!==void 0&&(v=s.onRecoverableError)),s=sy(i,1,!1,null,null,r,l,null,u,h,v,py),i[us]=s.current,Cd(i),new Id(s)},Al.hydrateRoot=function(i,s,r){if(!o(i))throw Error(a(299));var l=!1,u="",h=wv,v=Cv,w=xv,D=null;return r!=null&&(r.unstable_strictMode===!0&&(l=!0),r.identifierPrefix!==void 0&&(u=r.identifierPrefix),r.onUncaughtError!==void 0&&(h=r.onUncaughtError),r.onCaughtError!==void 0&&(v=r.onCaughtError),r.onRecoverableError!==void 0&&(w=r.onRecoverableError),r.formState!==void 0&&(D=r.formState)),s=sy(i,1,!0,s,r??null,l,u,D,h,v,w,py),s.context=ny(null),r=s.current,l=rs(),l=Ai(l),u=Nn(l),u.callback=null,Bn(r,u,l),r=l,s.current.lanes=r,Wt(s,r),Ps(s),i[us]=s.current,Cd(i),new zc(s)},Al.version="19.2.6",Al}var Ey;function GC(){if(Ey)return Wd.exports;Ey=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(t){console.error(t)}}return e(),Wd.exports=XC(),Wd.exports}var ZC=GC();class yn extends Error{constructor(t,n){super(n),this.status=t,this.name="ApiError"}status}function Eu(e=fetch){return{getSession:()=>we(e,"/api/auth/session"),setupPassword:t=>we(e,"/api/auth/password",et("POST",t)),login:t=>we(e,"/api/auth/login",et("POST",t)),reauth:t=>we(e,"/api/auth/reauth",et("POST",t)),logout:()=>we(e,"/api/auth/logout",{method:"POST",credentials:"same-origin"}),setupTotp:()=>we(e,"/api/auth/totp/setup",{method:"POST",credentials:"same-origin"}),activateTotp:t=>we(e,"/api/auth/totp/activate",et("POST",t)),disableTotp:()=>we(e,"/api/auth/totp",{method:"DELETE",credentials:"same-origin"}),listDevices:()=>we(e,"/api/auth/devices"),revokeDevice:async t=>{await ka(e,`/api/auth/devices/${encodeURIComponent(t)}`,{method:"DELETE",credentials:"same-origin"})},listNetworks:()=>we(e,"/api/auth/networks"),addNetwork:t=>we(e,"/api/auth/networks",et("POST",t)),removeNetwork:async t=>{await ka(e,`/api/auth/networks/${encodeURIComponent(t)}`,{method:"DELETE",credentials:"same-origin"})},listAgents:()=>we(e,"/api/agents"),addAgent:t=>we(e,"/api/agents",et("POST",t)),renameAgent:(t,n)=>we(e,`/api/agents/${encodeURIComponent(t)}`,et("PATCH",{name:n})),getMainInfo:()=>we(e,"/api/main"),renameMain:t=>we(e,"/api/main",et("PATCH",{name:t})),removeAgent:async t=>{await ka(e,`/api/agents/${encodeURIComponent(t)}`,{method:"DELETE",credentials:"same-origin"})},uninstallAgent:t=>we(e,`/api/agents/${encodeURIComponent(t)}/uninstall`,{method:"POST",credentials:"same-origin"}),pingAgent:t=>we(e,`/api/agents/${encodeURIComponent(t)}/ping`),getMainStats:()=>we(e,"/api/stats"),getAgentStats:t=>we(e,`/api/agents/${encodeURIComponent(t)}/stats`),getVersion:()=>we(e,"/api/version"),checkUpdate:()=>we(e,"/api/update/check",{method:"POST",credentials:"same-origin"}),runUpdate:()=>we(e,"/api/update",{method:"POST",credentials:"same-origin"}),getAgentVersion:t=>we(e,`/api/agents/${encodeURIComponent(t)}/version`),checkAgentUpdate:t=>we(e,`/api/agents/${encodeURIComponent(t)}/update/check`,{method:"POST",credentials:"same-origin"}),runAgentUpdate:t=>we(e,`/api/agents/${encodeURIComponent(t)}/update`,{method:"POST",credentials:"same-origin"}),listTerminals:()=>we(e,"/api/terminals"),getTerminalLayout:()=>we(e,"/api/terminal-layout"),saveTerminalLayout:t=>we(e,"/api/terminal-layout",et("PUT",t)),createFileRoot:t=>we(e,"/api/files/root",et("POST",t)),listFiles:t=>we(e,"/api/files/list",et("POST",t)),readFile:t=>we(e,"/api/files/read",et("POST",t)),writeFile:t=>we(e,"/api/files/write",et("POST",t)),createFileEntry:t=>we(e,"/api/files/create",et("POST",t)),moveFileEntry:t=>we(e,"/api/files/move",et("POST",t)),previewDeleteFileEntry:t=>we(e,"/api/files/delete-preview",et("POST",t)),deleteFileEntry:t=>we(e,"/api/files/delete",et("POST",t)),openFileInTerminal:t=>we(e,"/api/files/open",et("POST",t)),previewFile:t=>bb(e,"/api/files/preview",et("POST",t)),createTerminal:(t={})=>we(e,"/api/terminals",et("POST",t)),closeTerminal:async t=>{await ka(e,`/api/terminals/${encodeURIComponent(t)}`,{method:"DELETE",credentials:"same-origin"})},renameTerminal:(t,n)=>we(e,`/api/terminals/${encodeURIComponent(t)}`,et("PATCH",{title:n})),getTerminalHistory:(t,n={})=>we(e,`/api/terminals/${encodeURIComponent(t)}/history${au(n)}`),getTerminalTranscriptHistory:(t,n={})=>we(e,`/api/terminals/${encodeURIComponent(t)}/transcript-history${au(n)}`),getTerminalTranscriptSource:t=>we(e,`/api/terminals/${encodeURIComponent(t)}/transcript-source`),listNotificationAssets:()=>we(e,"/api/notification-assets"),uploadNotificationAsset:t=>{const n=new FormData;return n.append("asset",t),we(e,"/api/notification-assets",{method:"POST",credentials:"same-origin",body:n})},updateNotificationAssetSelection:t=>we(e,"/api/notification-assets/selection",et("PUT",t)),deleteNotificationAsset:async t=>{await ka(e,`/api/notification-assets/${encodeURIComponent(t)}`,{method:"DELETE",credentials:"same-origin"})}}}function io(e,t=fetch){const n=a=>e?`/api/agents/${encodeURIComponent(e)}/${a}`:`/api/${a}`;return{isAgent:e!==null,listTerminals:()=>we(t,n("terminals")),createTerminal:(a={})=>we(t,n("terminals"),et("POST",a)),closeTerminal:async a=>{await ka(t,n(`terminals/${encodeURIComponent(a)}`),{method:"DELETE",credentials:"same-origin"})},renameTerminal:(a,o)=>we(t,n(`terminals/${encodeURIComponent(a)}`),et("PATCH",{title:o})),getTerminalHistory:(a,o={})=>we(t,`${n(`terminals/${encodeURIComponent(a)}/history`)}${au(o)}`),getTerminalTranscriptHistory:(a,o={})=>we(t,`${n(`terminals/${encodeURIComponent(a)}/transcript-history`)}${au(o)}`),getTerminalTranscriptSource:a=>we(t,n(`terminals/${encodeURIComponent(a)}/transcript-source`)),getTerminalLayout:()=>we(t,n("terminal-layout")),saveTerminalLayout:a=>we(t,n("terminal-layout"),et("PUT",a)),createFileRoot:a=>we(t,n("files/root"),et("POST",a)),listFiles:a=>we(t,n("files/list"),et("POST",a)),readFile:a=>we(t,n("files/read"),et("POST",a)),writeFile:a=>we(t,n("files/write"),et("POST",a)),createFileEntry:a=>we(t,n("files/create"),et("POST",a)),moveFileEntry:a=>we(t,n("files/move"),et("POST",a)),previewDeleteFileEntry:a=>we(t,n("files/delete-preview"),et("POST",a)),deleteFileEntry:a=>we(t,n("files/delete"),et("POST",a)),openFileInTerminal:a=>we(t,n("files/open"),et("POST",a)),previewFile:a=>bb(t,n("files/preview"),et("POST",a)),createWebSocketUrl:(a,o=window.location.href)=>QC(n(`terminals/${encodeURIComponent(a)}/ws`),o)}}function QC(e,t){const n=new URL(t);return n.protocol=n.protocol==="https:"?"wss:":"ws:",n.pathname=e,n.search="",n.hash="",n.toString()}function et(e,t){return{method:e,headers:{"content-type":"application/json"},credentials:"same-origin",body:JSON.stringify(t)}}function au(e){const t=new URLSearchParams;e.beforeLine!==void 0&&t.set("beforeLine",String(e.beforeLine)),e.cursor!==void 0&&t.set("cursor",e.cursor),e.limit!==void 0&&t.set("limit",String(e.limit));const n=t.toString();return n?`?${n}`:""}async function we(e,t,n){const a=await e(t,n??{credentials:"same-origin"});await $p(a);try{return await a.json()}catch{throw new yn(a.status,"invalid_json_response")}}async function ka(e,t,n){const a=await e(t,n);await $p(a)}async function bb(e,t,n){const a=await e(t,n);return await $p(a),a.blob()}async function $p(e){if(e.ok)return;let t=e.statusText||`HTTP ${e.status}`;try{const n=await e.json(),a=typeof n.error=="string"?n.error:n.message;typeof a=="string"&&a.trim()&&(t=a)}catch{}throw new yn(e.status,t)}function wb({size:e=22}){return _.jsx("img",{className:"nterminal-mark",src:"/brand/nterminal-mark.svg",width:e,height:e,alt:"","aria-hidden":"true"})}function Cb({height:e=18}){const t=Math.round(7.147058823529412*e);return _.jsx("img",{className:"nterminal-wordmark",src:"/brand/nterminal-wordmark.svg",width:t,height:e,alt:"NTerminal"})}var Il=Sb();const Tu=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function za(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function Vp(e){return"nodeType"in e}function $i(e){var t,n;return e?za(e)?e:Vp(e)&&(t=(n=e.ownerDocument)==null?void 0:n.defaultView)!=null?t:window:window}function Xp(e){const{Document:t}=$i(e);return e instanceof t}function yo(e){return za(e)?!1:e instanceof $i(e).HTMLElement}function xb(e){return e instanceof $i(e).SVGElement}function ja(e){return e?za(e)?e.document:Vp(e)?Xp(e)?e:yo(e)||xb(e)?e.ownerDocument:document:document:document}const ar=Tu?g.useLayoutEffect:g.useEffect;function Gp(e){const t=g.useRef(e);return ar(()=>{t.current=e}),g.useCallback(function(){for(var n=arguments.length,a=new Array(n),o=0;o<n;o++)a[o]=arguments[o];return t.current==null?void 0:t.current(...a)},[])}function JC(){const e=g.useRef(null),t=g.useCallback((a,o)=>{e.current=setInterval(a,o)},[]),n=g.useCallback(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,n]}function so(e,t){t===void 0&&(t=[e]);const n=g.useRef(e);return ar(()=>{n.current!==e&&(n.current=e)},t),n}function So(e,t){const n=g.useRef();return g.useMemo(()=>{const a=e(n.current);return n.current=a,a},[...t])}function lu(e){const t=Gp(e),n=g.useRef(null),a=g.useCallback(o=>{o!==n.current&&t?.(o,n.current),n.current=o},[]);return[n,a]}function xf(e){const t=g.useRef();return g.useEffect(()=>{t.current=e},[e]),t.current}let Xd={};function ku(e,t){return g.useMemo(()=>{if(t)return t;const n=Xd[e]==null?0:Xd[e]+1;return Xd[e]=n,e+"-"+n},[e,t])}function Eb(e){return function(t){for(var n=arguments.length,a=new Array(n>1?n-1:0),o=1;o<n;o++)a[o-1]=arguments[o];return a.reduce((c,d)=>{const p=Object.entries(d);for(const[m,f]of p){const S=c[m];S!=null&&(c[m]=S+e*f)}return c},{...t})}}const Aa=Eb(1),ou=Eb(-1);function ex(e){return"clientX"in e&&"clientY"in e}function Tb(e){if(!e)return!1;const{KeyboardEvent:t}=$i(e.target);return t&&e instanceof t}function tx(e){if(!e)return!1;const{TouchEvent:t}=$i(e.target);return t&&e instanceof t}function Ef(e){if(tx(e)){if(e.touches&&e.touches.length){const{clientX:t,clientY:n}=e.touches[0];return{x:t,y:n}}else if(e.changedTouches&&e.changedTouches.length){const{clientX:t,clientY:n}=e.changedTouches[0];return{x:t,y:n}}}return ex(e)?{x:e.clientX,y:e.clientY}:null}const Tf=Object.freeze({Translate:{toString(e){if(!e)return;const{x:t,y:n}=e;return"translate3d("+(t?Math.round(t):0)+"px, "+(n?Math.round(n):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;const{scaleX:t,scaleY:n}=e;return"scaleX("+t+") scaleY("+n+")"}},Transform:{toString(e){if(e)return[Tf.Translate.toString(e),Tf.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:n,easing:a}=e;return t+" "+n+"ms "+a}}}),Ty="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function ix(e){return e.matches(Ty)?e:e.querySelector(Ty)}const sx={display:"none"};function nx(e){let{id:t,value:n}=e;return xi.createElement("div",{id:t,style:sx},n)}function rx(e){let{id:t,announcement:n,ariaLiveType:a="assertive"}=e;const o={position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return xi.createElement("div",{id:t,style:o,role:"status","aria-live":a,"aria-atomic":!0},n)}function ax(){const[e,t]=g.useState("");return{announce:g.useCallback(a=>{a!=null&&t(a)},[]),announcement:e}}const kb=g.createContext(null);function lx(e){const t=g.useContext(kb);g.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}function ox(){const[e]=g.useState(()=>new Set),t=g.useCallback(a=>(e.add(a),()=>e.delete(a)),[e]);return[g.useCallback(a=>{let{type:o,event:c}=a;e.forEach(d=>{var p;return(p=d[o])==null?void 0:p.call(d,c)})},[e]),t]}const cx={draggable:`
10
10
  To pick up a draggable item, press the space bar.
11
11
  While dragging, use the arrow keys to move the item.
12
12
  Press space again to drop the item in its new position, or press escape to cancel.
13
- `},ux={onDragStart(e){let{active:t}=e;return"Picked up draggable item "+t.id+"."},onDragOver(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was moved over droppable area "+n.id+".":"Draggable item "+t.id+" is no longer over a droppable area."},onDragEnd(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was dropped over droppable area "+n.id:"Draggable item "+t.id+" was dropped."},onDragCancel(e){let{active:t}=e;return"Dragging was cancelled. Draggable item "+t.id+" was dropped."}};function hx(e){let{announcements:t=ux,container:n,hiddenTextDescribedById:a,screenReaderInstructions:o=cx}=e;const{announce:c,announcement:d}=ax(),p=ku("DndLiveRegion"),[m,f]=g.useState(!1);if(g.useEffect(()=>{f(!0)},[]),lx(g.useMemo(()=>({onDragStart(y){let{active:b}=y;c(t.onDragStart({active:b}))},onDragMove(y){let{active:b,over:x}=y;t.onDragMove&&c(t.onDragMove({active:b,over:x}))},onDragOver(y){let{active:b,over:x}=y;c(t.onDragOver({active:b,over:x}))},onDragEnd(y){let{active:b,over:x}=y;c(t.onDragEnd({active:b,over:x}))},onDragCancel(y){let{active:b,over:x}=y;c(t.onDragCancel({active:b,over:x}))}}),[c,t])),!m)return null;const S=xi.createElement(xi.Fragment,null,xi.createElement(nx,{id:a,value:o.draggable}),xi.createElement(rx,{id:p,announcement:d}));return n?Il.createPortal(S,n):S}var ni;(function(e){e.DragStart="dragStart",e.DragMove="dragMove",e.DragEnd="dragEnd",e.DragCancel="dragCancel",e.DragOver="dragOver",e.RegisterDroppable="registerDroppable",e.SetDroppableDisabled="setDroppableDisabled",e.UnregisterDroppable="unregisterDroppable"})(ni||(ni={}));function cu(){}function ky(e,t){return g.useMemo(()=>({sensor:e,options:t??{}}),[e,t])}function dx(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return g.useMemo(()=>[...t].filter(a=>a!=null),[...t])}const Ns=Object.freeze({x:0,y:0});function fx(e,t){let{data:{value:n}}=e,{data:{value:a}}=t;return a-n}function px(e,t){if(!e||e.length===0)return null;const[n]=e;return n[t]}function mx(e,t){const n=Math.max(t.top,e.top),a=Math.max(t.left,e.left),o=Math.min(t.left+t.width,e.left+e.width),c=Math.min(t.top+t.height,e.top+e.height),d=o-a,p=c-n;if(a<o&&n<c){const m=t.width*t.height,f=e.width*e.height,S=d*p,y=S/(m+f-S);return Number(y.toFixed(4))}return 0}const _x=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:a}=e;const o=[];for(const c of a){const{id:d}=c,p=n.get(d);if(p){const m=mx(p,t);m>0&&o.push({id:d,data:{droppableContainer:c,value:m}})}}return o.sort(fx)};function vx(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function Db(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:Ns}function gx(e){return function(n){for(var a=arguments.length,o=new Array(a>1?a-1:0),c=1;c<a;c++)o[c-1]=arguments[c];return o.reduce((d,p)=>({...d,top:d.top+e*p.y,bottom:d.bottom+e*p.y,left:d.left+e*p.x,right:d.right+e*p.x}),{...n})}}const yx=gx(1);function Sx(e){if(e.startsWith("matrix3d(")){const t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}else if(e.startsWith("matrix(")){const t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}function bx(e,t,n){const a=Sx(t);if(!a)return e;const{scaleX:o,scaleY:c,x:d,y:p}=a,m=e.left-d-(1-o)*parseFloat(n),f=e.top-p-(1-c)*parseFloat(n.slice(n.indexOf(" ")+1)),S=o?e.width/o:e.width,y=c?e.height/c:e.height;return{width:S,height:y,top:f,right:m+S,bottom:f+y,left:m}}const wx={ignoreTransform:!1};function bo(e,t){t===void 0&&(t=wx);let n=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:f,transformOrigin:S}=$i(e).getComputedStyle(e);f&&(n=bx(n,f,S))}const{top:a,left:o,width:c,height:d,bottom:p,right:m}=n;return{top:a,left:o,width:c,height:d,bottom:p,right:m}}function Dy(e){return bo(e,{ignoreTransform:!0})}function Cx(e){const t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function xx(e,t){return t===void 0&&(t=$i(e).getComputedStyle(e)),t.position==="fixed"}function Ex(e,t){t===void 0&&(t=$i(e).getComputedStyle(e));const n=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(o=>{const c=t[o];return typeof c=="string"?n.test(c):!1})}function Zp(e,t){const n=[];function a(o){if(t!=null&&n.length>=t||!o)return n;if(Xp(o)&&o.scrollingElement!=null&&!n.includes(o.scrollingElement))return n.push(o.scrollingElement),n;if(!yo(o)||xb(o)||n.includes(o))return n;const c=$i(e).getComputedStyle(o);return o!==e&&Ex(o,c)&&n.push(o),xx(o,c)?n:a(o.parentNode)}return e?a(e):n}function Rb(e){const[t]=Zp(e,1);return t??null}function Gd(e){return!Tu||!e?null:za(e)?e:Vp(e)?Xp(e)||e===ja(e).scrollingElement?window:yo(e)?e:null:null}function Mb(e){return za(e)?e.scrollX:e.scrollLeft}function Ab(e){return za(e)?e.scrollY:e.scrollTop}function kf(e){return{x:Mb(e),y:Ab(e)}}var ui;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(ui||(ui={}));function Nb(e){return!Tu||!e?!1:e===document.scrollingElement}function Bb(e){const t={x:0,y:0},n=Nb(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},a={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height},o=e.scrollTop<=t.y,c=e.scrollLeft<=t.x,d=e.scrollTop>=a.y,p=e.scrollLeft>=a.x;return{isTop:o,isLeft:c,isBottom:d,isRight:p,maxScroll:a,minScroll:t}}const Tx={x:.2,y:.2};function kx(e,t,n,a,o){let{top:c,left:d,right:p,bottom:m}=n;a===void 0&&(a=10),o===void 0&&(o=Tx);const{isTop:f,isBottom:S,isLeft:y,isRight:b}=Bb(e),x={x:0,y:0},C={x:0,y:0},k={height:t.height*o.y,width:t.width*o.x};return!f&&c<=t.top+k.height?(x.y=ui.Backward,C.y=a*Math.abs((t.top+k.height-c)/k.height)):!S&&m>=t.bottom-k.height&&(x.y=ui.Forward,C.y=a*Math.abs((t.bottom-k.height-m)/k.height)),!b&&p>=t.right-k.width?(x.x=ui.Forward,C.x=a*Math.abs((t.right-k.width-p)/k.width)):!y&&d<=t.left+k.width&&(x.x=ui.Backward,C.x=a*Math.abs((t.left+k.width-d)/k.width)),{direction:x,speed:C}}function Dx(e){if(e===document.scrollingElement){const{innerWidth:c,innerHeight:d}=window;return{top:0,left:0,right:c,bottom:d,width:c,height:d}}const{top:t,left:n,right:a,bottom:o}=e.getBoundingClientRect();return{top:t,left:n,right:a,bottom:o,width:e.clientWidth,height:e.clientHeight}}function Lb(e){return e.reduce((t,n)=>Aa(t,kf(n)),Ns)}function Rx(e){return e.reduce((t,n)=>t+Mb(n),0)}function Mx(e){return e.reduce((t,n)=>t+Ab(n),0)}function Ax(e,t){if(t===void 0&&(t=bo),!e)return;const{top:n,left:a,bottom:o,right:c}=t(e);Rb(e)&&(o<=0||c<=0||n>=window.innerHeight||a>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const Nx=[["x",["left","right"],Rx],["y",["top","bottom"],Mx]];class Qp{constructor(t,n){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const a=Zp(n),o=Lb(a);this.rect={...t},this.width=t.width,this.height=t.height;for(const[c,d,p]of Nx)for(const m of d)Object.defineProperty(this,m,{get:()=>{const f=p(a),S=o[c]-f;return this.rect[m]+S},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class Gl{constructor(t){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(n=>{var a;return(a=this.target)==null?void 0:a.removeEventListener(...n)})},this.target=t}add(t,n,a){var o;(o=this.target)==null||o.addEventListener(t,n,a),this.listeners.push([t,n,a])}}function Bx(e){const{EventTarget:t}=$i(e);return e instanceof t?e:ja(e)}function Zd(e,t){const n=Math.abs(e.x),a=Math.abs(e.y);return typeof t=="number"?Math.sqrt(n**2+a**2)>t:"x"in t&&"y"in t?n>t.x&&a>t.y:"x"in t?n>t.x:"y"in t?a>t.y:!1}var bs;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(bs||(bs={}));function Ry(e){e.preventDefault()}function Lx(e){e.stopPropagation()}var vt;(function(e){e.Space="Space",e.Down="ArrowDown",e.Right="ArrowRight",e.Left="ArrowLeft",e.Up="ArrowUp",e.Esc="Escape",e.Enter="Enter",e.Tab="Tab"})(vt||(vt={}));const Ob={start:[vt.Space,vt.Enter],cancel:[vt.Esc],end:[vt.Space,vt.Enter,vt.Tab]},Ox=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case vt.Right:return{...n,x:n.x+25};case vt.Left:return{...n,x:n.x-25};case vt.Down:return{...n,y:n.y+25};case vt.Up:return{...n,y:n.y-25}}};class zb{constructor(t){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=t;const{event:{target:n}}=t;this.props=t,this.listeners=new Gl(ja(n)),this.windowListeners=new Gl($i(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(bs.Resize,this.handleCancel),this.windowListeners.add(bs.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(bs.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:n}=this.props,a=t.node.current;a&&Ax(a),n(Ns)}handleKeyDown(t){if(Tb(t)){const{active:n,context:a,options:o}=this.props,{keyboardCodes:c=Ob,coordinateGetter:d=Ox,scrollBehavior:p="smooth"}=o,{code:m}=t;if(c.end.includes(m)){this.handleEnd(t);return}if(c.cancel.includes(m)){this.handleCancel(t);return}const{collisionRect:f}=a.current,S=f?{x:f.left,y:f.top}:Ns;this.referenceCoordinates||(this.referenceCoordinates=S);const y=d(t,{active:n,context:a.current,currentCoordinates:S});if(y){const b=ou(y,S),x={x:0,y:0},{scrollableAncestors:C}=a.current;for(const k of C){const B=t.code,{isTop:R,isRight:re,isLeft:F,isBottom:J,maxScroll:ce,minScroll:q}=Bb(k),I=Dx(k),ie={x:Math.min(B===vt.Right?I.right-I.width/2:I.right,Math.max(B===vt.Right?I.left:I.left+I.width/2,y.x)),y:Math.min(B===vt.Down?I.bottom-I.height/2:I.bottom,Math.max(B===vt.Down?I.top:I.top+I.height/2,y.y))},de=B===vt.Right&&!re||B===vt.Left&&!F,j=B===vt.Down&&!J||B===vt.Up&&!R;if(de&&ie.x!==y.x){const $=k.scrollLeft+b.x,H=B===vt.Right&&$<=ce.x||B===vt.Left&&$>=q.x;if(H&&!b.y){k.scrollTo({left:$,behavior:p});return}H?x.x=k.scrollLeft-$:x.x=B===vt.Right?k.scrollLeft-ce.x:k.scrollLeft-q.x,x.x&&k.scrollBy({left:-x.x,behavior:p});break}else if(j&&ie.y!==y.y){const $=k.scrollTop+b.y,H=B===vt.Down&&$<=ce.y||B===vt.Up&&$>=q.y;if(H&&!b.x){k.scrollTo({top:$,behavior:p});return}H?x.y=k.scrollTop-$:x.y=B===vt.Down?k.scrollTop-ce.y:k.scrollTop-q.y,x.y&&k.scrollBy({top:-x.y,behavior:p});break}}this.handleMove(t,Aa(ou(y,this.referenceCoordinates),x))}}}handleMove(t,n){const{onMove:a}=this.props;t.preventDefault(),a(n)}handleEnd(t){const{onEnd:n}=this.props;t.preventDefault(),this.detach(),n()}handleCancel(t){const{onCancel:n}=this.props;t.preventDefault(),this.detach(),n()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}zb.activators=[{eventName:"onKeyDown",handler:(e,t,n)=>{let{keyboardCodes:a=Ob,onActivation:o}=t,{active:c}=n;const{code:d}=e.nativeEvent;if(a.start.includes(d)){const p=c.activatorNode.current;return p&&e.target!==p?!1:(e.preventDefault(),o?.({event:e.nativeEvent}),!0)}return!1}}];function My(e){return!!(e&&"distance"in e)}function Ay(e){return!!(e&&"delay"in e)}class Jp{constructor(t,n,a){var o;a===void 0&&(a=Bx(t.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=t,this.events=n;const{event:c}=t,{target:d}=c;this.props=t,this.events=n,this.document=ja(d),this.documentListeners=new Gl(this.document),this.listeners=new Gl(a),this.windowListeners=new Gl($i(d)),this.initialCoordinates=(o=Ef(c))!=null?o:Ns,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:t,props:{options:{activationConstraint:n,bypassActivationConstraint:a}}}=this;if(this.listeners.add(t.move.name,this.handleMove,{passive:!1}),this.listeners.add(t.end.name,this.handleEnd),t.cancel&&this.listeners.add(t.cancel.name,this.handleCancel),this.windowListeners.add(bs.Resize,this.handleCancel),this.windowListeners.add(bs.DragStart,Ry),this.windowListeners.add(bs.VisibilityChange,this.handleCancel),this.windowListeners.add(bs.ContextMenu,Ry),this.documentListeners.add(bs.Keydown,this.handleKeydown),n){if(a!=null&&a({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(Ay(n)){this.timeoutId=setTimeout(this.handleStart,n.delay),this.handlePending(n);return}if(My(n)){this.handlePending(n);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(t,n){const{active:a,onPending:o}=this.props;o(a,t,this.initialCoordinates,n)}handleStart(){const{initialCoordinates:t}=this,{onStart:n}=this.props;t&&(this.activated=!0,this.documentListeners.add(bs.Click,Lx,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(bs.SelectionChange,this.removeTextSelection),n(t))}handleMove(t){var n;const{activated:a,initialCoordinates:o,props:c}=this,{onMove:d,options:{activationConstraint:p}}=c;if(!o)return;const m=(n=Ef(t))!=null?n:Ns,f=ou(o,m);if(!a&&p){if(My(p)){if(p.tolerance!=null&&Zd(f,p.tolerance))return this.handleCancel();if(Zd(f,p.distance))return this.handleStart()}if(Ay(p)&&Zd(f,p.tolerance))return this.handleCancel();this.handlePending(p,f);return}t.cancelable&&t.preventDefault(),d(m)}handleEnd(){const{onAbort:t,onEnd:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleCancel(){const{onAbort:t,onCancel:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleKeydown(t){t.code===vt.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const zx={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class jb extends Jp{constructor(t){const{event:n}=t,a=ja(n.target);super(t,zx,a)}}jb.activators=[{eventName:"onPointerDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:a}=t;return!n.isPrimary||n.button!==0?!1:(a?.({event:n}),!0)}}];const jx={move:{name:"mousemove"},end:{name:"mouseup"}};var Df;(function(e){e[e.RightClick=2]="RightClick"})(Df||(Df={}));class Hb extends Jp{constructor(t){super(t,jx,ja(t.event.target))}}Hb.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:a}=t;return n.button===Df.RightClick?!1:(a?.({event:n}),!0)}}];const Qd={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class Ub extends Jp{constructor(t){super(t,Qd)}static setup(){return window.addEventListener(Qd.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(Qd.move.name,t)};function t(){}}}Ub.activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:a}=t;const{touches:o}=n;return o.length>1?!1:(a?.({event:n}),!0)}}];var Zl;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(Zl||(Zl={}));var uu;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(uu||(uu={}));function Hx(e){let{acceleration:t,activator:n=Zl.Pointer,canScroll:a,draggingRect:o,enabled:c,interval:d=5,order:p=uu.TreeOrder,pointerCoordinates:m,scrollableAncestors:f,scrollableAncestorRects:S,delta:y,threshold:b}=e;const x=Px({delta:y,disabled:!c}),[C,k]=JC(),B=g.useRef({x:0,y:0}),R=g.useRef({x:0,y:0}),re=g.useMemo(()=>{switch(n){case Zl.Pointer:return m?{top:m.y,bottom:m.y,left:m.x,right:m.x}:null;case Zl.DraggableRect:return o}},[n,o,m]),F=g.useRef(null),J=g.useCallback(()=>{const q=F.current;if(!q)return;const I=B.current.x*R.current.x,ie=B.current.y*R.current.y;q.scrollBy(I,ie)},[]),ce=g.useMemo(()=>p===uu.TreeOrder?[...f].reverse():f,[p,f]);g.useEffect(()=>{if(!c||!f.length||!re){k();return}for(const q of ce){if(a?.(q)===!1)continue;const I=f.indexOf(q),ie=S[I];if(!ie)continue;const{direction:de,speed:j}=kx(q,ie,re,t,b);for(const $ of["x","y"])x[$][de[$]]||(j[$]=0,de[$]=0);if(j.x>0||j.y>0){k(),F.current=q,C(J,d),B.current=j,R.current=de;return}}B.current={x:0,y:0},R.current={x:0,y:0},k()},[t,J,a,k,c,d,JSON.stringify(re),JSON.stringify(x),C,f,ce,S,JSON.stringify(b)])}const Ux={x:{[ui.Backward]:!1,[ui.Forward]:!1},y:{[ui.Backward]:!1,[ui.Forward]:!1}};function Px(e){let{delta:t,disabled:n}=e;const a=xf(t);return So(o=>{if(n||!a||!o)return Ux;const c={x:Math.sign(t.x-a.x),y:Math.sign(t.y-a.y)};return{x:{[ui.Backward]:o.x[ui.Backward]||c.x===-1,[ui.Forward]:o.x[ui.Forward]||c.x===1},y:{[ui.Backward]:o.y[ui.Backward]||c.y===-1,[ui.Forward]:o.y[ui.Forward]||c.y===1}}},[n,t,a])}function Kx(e,t){const n=t!=null?e.get(t):void 0,a=n?n.node.current:null;return So(o=>{var c;return t==null?null:(c=a??o)!=null?c:null},[a,t])}function Ix(e,t){return g.useMemo(()=>e.reduce((n,a)=>{const{sensor:o}=a,c=o.activators.map(d=>({eventName:d.eventName,handler:t(d.handler,a)}));return[...n,...c]},[]),[e,t])}var no;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(no||(no={}));var Rf;(function(e){e.Optimized="optimized"})(Rf||(Rf={}));const Ny=new Map;function Fx(e,t){let{dragging:n,dependencies:a,config:o}=t;const[c,d]=g.useState(null),{frequency:p,measure:m,strategy:f}=o,S=g.useRef(e),y=B(),b=so(y),x=g.useCallback(function(R){R===void 0&&(R=[]),!b.current&&d(re=>re===null?R:re.concat(R.filter(F=>!re.includes(F))))},[b]),C=g.useRef(null),k=So(R=>{if(y&&!n)return Ny;if(!R||R===Ny||S.current!==e||c!=null){const re=new Map;for(let F of e){if(!F)continue;if(c&&c.length>0&&!c.includes(F.id)&&F.rect.current){re.set(F.id,F.rect.current);continue}const J=F.node.current,ce=J?new Qp(m(J),J):null;F.rect.current=ce,ce&&re.set(F.id,ce)}return re}return R},[e,c,n,y,m]);return g.useEffect(()=>{S.current=e},[e]),g.useEffect(()=>{y||x()},[n,y]),g.useEffect(()=>{c&&c.length>0&&d(null)},[JSON.stringify(c)]),g.useEffect(()=>{y||typeof p!="number"||C.current!==null||(C.current=setTimeout(()=>{x(),C.current=null},p))},[p,y,x,...a]),{droppableRects:k,measureDroppableContainers:x,measuringScheduled:c!=null};function B(){switch(f){case no.Always:return!1;case no.BeforeDragging:return n;default:return!n}}}function Pb(e,t){return So(n=>e?n||(typeof t=="function"?t(e):e):null,[t,e])}function qx(e,t){return Pb(e,t)}function Wx(e){let{callback:t,disabled:n}=e;const a=Gp(t),o=g.useMemo(()=>{if(n||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:c}=window;return new c(a)},[a,n]);return g.useEffect(()=>()=>o?.disconnect(),[o]),o}function Du(e){let{callback:t,disabled:n}=e;const a=Gp(t),o=g.useMemo(()=>{if(n||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:c}=window;return new c(a)},[n]);return g.useEffect(()=>()=>o?.disconnect(),[o]),o}function Yx(e){return new Qp(bo(e),e)}function By(e,t,n){t===void 0&&(t=Yx);const[a,o]=g.useState(null);function c(){o(m=>{if(!e)return null;if(e.isConnected===!1){var f;return(f=m??n)!=null?f:null}const S=t(e);return JSON.stringify(m)===JSON.stringify(S)?m:S})}const d=Wx({callback(m){if(e)for(const f of m){const{type:S,target:y}=f;if(S==="childList"&&y instanceof HTMLElement&&y.contains(e)){c();break}}}}),p=Du({callback:c});return ar(()=>{c(),e?(p?.observe(e),d?.observe(document.body,{childList:!0,subtree:!0})):(p?.disconnect(),d?.disconnect())},[e]),a}function $x(e){const t=Pb(e);return Db(e,t)}const Ly=[];function Vx(e){const t=g.useRef(e),n=So(a=>e?a&&a!==Ly&&e&&t.current&&e.parentNode===t.current.parentNode?a:Zp(e):Ly,[e]);return g.useEffect(()=>{t.current=e},[e]),n}function Xx(e){const[t,n]=g.useState(null),a=g.useRef(e),o=g.useCallback(c=>{const d=Gd(c.target);d&&n(p=>p?(p.set(d,kf(d)),new Map(p)):null)},[]);return g.useEffect(()=>{const c=a.current;if(e!==c){d(c);const p=e.map(m=>{const f=Gd(m);return f?(f.addEventListener("scroll",o,{passive:!0}),[f,kf(f)]):null}).filter(m=>m!=null);n(p.length?new Map(p):null),a.current=e}return()=>{d(e),d(c)};function d(p){p.forEach(m=>{const f=Gd(m);f?.removeEventListener("scroll",o)})}},[o,e]),g.useMemo(()=>e.length?t?Array.from(t.values()).reduce((c,d)=>Aa(c,d),Ns):Lb(e):Ns,[e,t])}function Oy(e,t){t===void 0&&(t=[]);const n=g.useRef(null);return g.useEffect(()=>{n.current=null},t),g.useEffect(()=>{const a=e!==Ns;a&&!n.current&&(n.current=e),!a&&n.current&&(n.current=null)},[e]),n.current?ou(e,n.current):Ns}function Gx(e){g.useEffect(()=>{if(!Tu)return;const t=e.map(n=>{let{sensor:a}=n;return a.setup==null?void 0:a.setup()});return()=>{for(const n of t)n?.()}},e.map(t=>{let{sensor:n}=t;return n}))}function Zx(e,t){return g.useMemo(()=>e.reduce((n,a)=>{let{eventName:o,handler:c}=a;return n[o]=d=>{c(d,t)},n},{}),[e,t])}function Kb(e){return g.useMemo(()=>e?Cx(e):null,[e])}const zy=[];function Qx(e,t){t===void 0&&(t=bo);const[n]=e,a=Kb(n?$i(n):null),[o,c]=g.useState(zy);function d(){c(()=>e.length?e.map(m=>Nb(m)?a:new Qp(t(m),m)):zy)}const p=Du({callback:d});return ar(()=>{p?.disconnect(),d(),e.forEach(m=>p?.observe(m))},[e]),o}function Jx(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return yo(t)?t:e}function eE(e){let{measure:t}=e;const[n,a]=g.useState(null),o=g.useCallback(f=>{for(const{target:S}of f)if(yo(S)){a(y=>{const b=t(S);return y?{...y,width:b.width,height:b.height}:b});break}},[t]),c=Du({callback:o}),d=g.useCallback(f=>{const S=Jx(f);c?.disconnect(),S&&c?.observe(S),a(S?t(S):null)},[t,c]),[p,m]=lu(d);return g.useMemo(()=>({nodeRef:p,rect:n,setRef:m}),[n,p,m])}const tE=[{sensor:jb,options:{}},{sensor:zb,options:{}}],iE={current:{}},Gc={draggable:{measure:Dy},droppable:{measure:Dy,strategy:no.WhileDragging,frequency:Rf.Optimized},dragOverlay:{measure:bo}};class Ql extends Map{get(t){var n;return t!=null&&(n=super.get(t))!=null?n:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(t=>{let{disabled:n}=t;return!n})}getNodeFor(t){var n,a;return(n=(a=this.get(t))==null?void 0:a.node.current)!=null?n:void 0}}const sE={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new Ql,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:cu},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:Gc,measureDroppableContainers:cu,windowRect:null,measuringScheduled:!1},nE={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:cu,draggableNodes:new Map,over:null,measureDroppableContainers:cu},Ru=g.createContext(nE),rE=g.createContext(sE);function aE(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new Ql}}}function lE(e,t){switch(t.type){case ni.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case ni.DragMove:return e.draggable.active==null?e:{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}};case ni.DragEnd:case ni.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case ni.RegisterDroppable:{const{element:n}=t,{id:a}=n,o=new Ql(e.droppable.containers);return o.set(a,n),{...e,droppable:{...e.droppable,containers:o}}}case ni.SetDroppableDisabled:{const{id:n,key:a,disabled:o}=t,c=e.droppable.containers.get(n);if(!c||a!==c.key)return e;const d=new Ql(e.droppable.containers);return d.set(n,{...c,disabled:o}),{...e,droppable:{...e.droppable,containers:d}}}case ni.UnregisterDroppable:{const{id:n,key:a}=t,o=e.droppable.containers.get(n);if(!o||a!==o.key)return e;const c=new Ql(e.droppable.containers);return c.delete(n),{...e,droppable:{...e.droppable,containers:c}}}default:return e}}function oE(e){let{disabled:t}=e;const{active:n,activatorEvent:a,draggableNodes:o}=g.useContext(Ru),c=xf(a),d=xf(n?.id);return g.useEffect(()=>{if(!t&&!a&&c&&d!=null){if(!Tb(c)||document.activeElement===c.target)return;const p=o.get(d);if(!p)return;const{activatorNode:m,node:f}=p;if(!m.current&&!f.current)return;requestAnimationFrame(()=>{for(const S of[m.current,f.current]){if(!S)continue;const y=ix(S);if(y){y.focus();break}}})}},[a,t,o,d,c]),null}function cE(e,t){let{transform:n,...a}=t;return e!=null&&e.length?e.reduce((o,c)=>c({transform:o,...a}),n):n}function uE(e){return g.useMemo(()=>({draggable:{...Gc.draggable,...e?.draggable},droppable:{...Gc.droppable,...e?.droppable},dragOverlay:{...Gc.dragOverlay,...e?.dragOverlay}}),[e?.draggable,e?.droppable,e?.dragOverlay])}function hE(e){let{activeNode:t,measure:n,initialRect:a,config:o=!0}=e;const c=g.useRef(!1),{x:d,y:p}=typeof o=="boolean"?{x:o,y:o}:o;ar(()=>{if(!d&&!p||!t){c.current=!1;return}if(c.current||!a)return;const f=t?.node.current;if(!f||f.isConnected===!1)return;const S=n(f),y=Db(S,a);if(d||(y.x=0),p||(y.y=0),c.current=!0,Math.abs(y.x)>0||Math.abs(y.y)>0){const b=Rb(f);b&&b.scrollBy({top:y.y,left:y.x})}},[t,d,p,a,n])}const Ib=g.createContext({...Ns,scaleX:1,scaleY:1});var er;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(er||(er={}));const dE=g.memo(function(t){var n,a,o,c;let{id:d,accessibility:p,autoScroll:m=!0,children:f,sensors:S=tE,collisionDetection:y=_x,measuring:b,modifiers:x,...C}=t;const k=g.useReducer(lE,void 0,aE),[B,R]=k,[re,F]=ox(),[J,ce]=g.useState(er.Uninitialized),q=J===er.Initialized,{draggable:{active:I,nodes:ie,translate:de},droppable:{containers:j}}=B,$=I!=null?ie.get(I):null,H=g.useRef({initial:null,translated:null}),L=g.useMemo(()=>{var ot;return I!=null?{id:I,data:(ot=$?.data)!=null?ot:iE,rect:H}:null},[I,$]),X=g.useRef(null),[G,M]=g.useState(null),[V,Q]=g.useState(null),ve=so(C,Object.values(C)),Se=ku("DndDescribedBy",d),E=g.useMemo(()=>j.getEnabled(),[j]),W=uE(b),{droppableRects:ee,measureDroppableContainers:he,measuringScheduled:ge}=Fx(E,{dragging:q,dependencies:[de.x,de.y],config:W.droppable}),me=Kx(ie,I),Ce=g.useMemo(()=>V?Ef(V):null,[V]),ze=ks(),Ne=qx(me,W.draggable.measure);hE({activeNode:I!=null?ie.get(I):null,config:ze.layoutShiftCompensation,initialRect:Ne,measure:W.draggable.measure});const Re=By(me,W.draggable.measure,Ne),Pe=By(me?me.parentElement:null),Ye=g.useRef({activatorEvent:null,active:null,activeNode:me,collisionRect:null,collisions:null,droppableRects:ee,draggableNodes:ie,draggingNode:null,draggingNodeRect:null,droppableContainers:j,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),Be=j.getNodeFor((n=Ye.current.over)==null?void 0:n.id),ae=eE({measure:W.dragOverlay.measure}),Ee=(a=ae.nodeRef.current)!=null?a:me,xe=q?(o=ae.rect)!=null?o:Re:null,Ke=!!(ae.nodeRef.current&&ae.rect),Xe=$x(Ke?null:Re),gt=Kb(Ee?$i(Ee):null),yt=Vx(q?Be??me:null),mi=Qx(yt),te=cE(x,{transform:{x:de.x-Xe.x,y:de.y-Xe.y,scaleX:1,scaleY:1},activatorEvent:V,active:L,activeNodeRect:Re,containerNodeRect:Pe,draggingNodeRect:xe,over:Ye.current.over,overlayNodeRect:ae.rect,scrollableAncestors:yt,scrollableAncestorRects:mi,windowRect:gt}),je=Ce?Aa(Ce,de):null,He=Xx(yt),_i=Oy(He),Vi=Oy(He,[Re]),ai=Aa(te,_i),kt=xe?yx(xe,te):null,ji=L&&kt?y({active:L,collisionRect:kt,droppableRects:ee,droppableContainers:E,pointerCoordinates:je}):null,Ti=px(ji,"id"),[Nt,$s]=g.useState(null),Hi=Ke?te:Aa(te,Vi),qt=vx(Hi,(c=Nt?.rect)!=null?c:null,Re),Jt=g.useRef(null),Dt=g.useCallback((ot,St)=>{let{sensor:Rt,options:li}=St;if(X.current==null)return;const ei=ie.get(X.current);if(!ei)return;const Bt=ot.nativeEvent,nt=new Rt({active:X.current,activeNode:ei,event:Bt,options:li,context:Ye,onAbort(bt){if(!ie.get(bt))return;const{onDragAbort:ct}=ve.current,vi={id:bt};ct?.(vi),re({type:"onDragAbort",event:vi})},onPending(bt,Ge,ct,vi){if(!ie.get(bt))return;const{onDragPending:Ni}=ve.current,ki={id:bt,constraint:Ge,initialCoordinates:ct,offset:vi};Ni?.(ki),re({type:"onDragPending",event:ki})},onStart(bt){const Ge=X.current;if(Ge==null)return;const ct=ie.get(Ge);if(!ct)return;const{onDragStart:vi}=ve.current,Ai={activatorEvent:Bt,active:{id:Ge,data:ct.data,rect:H}};Il.unstable_batchedUpdates(()=>{vi?.(Ai),ce(er.Initializing),R({type:ni.DragStart,initialCoordinates:bt,active:Ge}),re({type:"onDragStart",event:Ai}),M(Jt.current),Q(Bt)})},onMove(bt){R({type:ni.DragMove,coordinates:bt})},onEnd:Wt(ni.DragEnd),onCancel:Wt(ni.DragCancel)});Jt.current=nt;function Wt(bt){return async function(){const{active:ct,collisions:vi,over:Ai,scrollAdjustedTranslate:Ni}=Ye.current;let ki=null;if(ct&&Ni){const{cancelDrop:cs}=ve.current;ki={activatorEvent:Bt,active:ct,collisions:vi,delta:Ni,over:Ai},bt===ni.DragEnd&&typeof cs=="function"&&await Promise.resolve(cs(ki))&&(bt=ni.DragCancel)}X.current=null,Il.unstable_batchedUpdates(()=>{R({type:bt}),ce(er.Uninitialized),$s(null),M(null),Q(null),Jt.current=null;const cs=bt===ni.DragEnd?"onDragEnd":"onDragCancel";if(ki){const gi=ve.current[cs];gi?.(ki),re({type:cs,event:ki})}})}}},[ie]),Cn=g.useCallback((ot,St)=>(Rt,li)=>{const ei=Rt.nativeEvent,Bt=ie.get(li);if(X.current!==null||!Bt||ei.dndKit||ei.defaultPrevented)return;const nt={active:Bt};ot(Rt,St.options,nt)===!0&&(ei.dndKit={capturedBy:St.sensor},X.current=li,Dt(Rt,St))},[ie,Dt]),Bs=Ix(S,Cn);Gx(S),ar(()=>{Re&&J===er.Initializing&&ce(er.Initialized)},[Re,J]),g.useEffect(()=>{const{onDragMove:ot}=ve.current,{active:St,activatorEvent:Rt,collisions:li,over:ei}=Ye.current;if(!St||!Rt)return;const Bt={active:St,activatorEvent:Rt,collisions:li,delta:{x:ai.x,y:ai.y},over:ei};Il.unstable_batchedUpdates(()=>{ot?.(Bt),re({type:"onDragMove",event:Bt})})},[ai.x,ai.y]),g.useEffect(()=>{const{active:ot,activatorEvent:St,collisions:Rt,droppableContainers:li,scrollAdjustedTranslate:ei}=Ye.current;if(!ot||X.current==null||!St||!ei)return;const{onDragOver:Bt}=ve.current,nt=li.get(Ti),Wt=nt&&nt.rect.current?{id:nt.id,rect:nt.rect.current,data:nt.data,disabled:nt.disabled}:null,bt={active:ot,activatorEvent:St,collisions:Rt,delta:{x:ei.x,y:ei.y},over:Wt};Il.unstable_batchedUpdates(()=>{$s(Wt),Bt?.(bt),re({type:"onDragOver",event:bt})})},[Ti]),ar(()=>{Ye.current={activatorEvent:V,active:L,activeNode:me,collisionRect:kt,collisions:ji,droppableRects:ee,draggableNodes:ie,draggingNode:Ee,draggingNodeRect:xe,droppableContainers:j,over:Nt,scrollableAncestors:yt,scrollAdjustedTranslate:ai},H.current={initial:xe,translated:kt}},[L,me,ji,kt,ie,Ee,xe,ee,j,Nt,yt,ai]),Hx({...ze,delta:de,draggingRect:kt,pointerCoordinates:je,scrollableAncestors:yt,scrollableAncestorRects:mi});const Vs=g.useMemo(()=>({active:L,activeNode:me,activeNodeRect:Re,activatorEvent:V,collisions:ji,containerNodeRect:Pe,dragOverlay:ae,draggableNodes:ie,droppableContainers:j,droppableRects:ee,over:Nt,measureDroppableContainers:he,scrollableAncestors:yt,scrollableAncestorRects:mi,measuringConfiguration:W,measuringScheduled:ge,windowRect:gt}),[L,me,Re,V,ji,Pe,ae,ie,j,ee,Nt,he,yt,mi,W,ge,gt]),Ts=g.useMemo(()=>({activatorEvent:V,activators:Bs,active:L,activeNodeRect:Re,ariaDescribedById:{draggable:Se},dispatch:R,draggableNodes:ie,over:Nt,measureDroppableContainers:he}),[V,Bs,L,Re,R,Se,ie,Nt,he]);return xi.createElement(kb.Provider,{value:F},xi.createElement(Ru.Provider,{value:Ts},xi.createElement(rE.Provider,{value:Vs},xi.createElement(Ib.Provider,{value:qt},f)),xi.createElement(oE,{disabled:p?.restoreFocus===!1})),xi.createElement(hx,{...p,hiddenTextDescribedById:Se}));function ks(){const ot=G?.autoScrollEnabled===!1,St=typeof m=="object"?m.enabled===!1:m===!1,Rt=q&&!ot&&!St;return typeof m=="object"?{...m,enabled:Rt}:{enabled:Rt}}}),fE=g.createContext(null),jy="button",pE="Draggable";function Fb(e){let{id:t,data:n,disabled:a=!1,attributes:o}=e;const c=ku(pE),{activators:d,activatorEvent:p,active:m,activeNodeRect:f,ariaDescribedById:S,draggableNodes:y,over:b}=g.useContext(Ru),{role:x=jy,roleDescription:C="draggable",tabIndex:k=0}=o??{},B=m?.id===t,R=g.useContext(B?Ib:fE),[re,F]=lu(),[J,ce]=lu(),q=Zx(d,t),I=so(n);ar(()=>(y.set(t,{id:t,key:c,node:re,activatorNode:J,data:I}),()=>{const de=y.get(t);de&&de.key===c&&y.delete(t)}),[y,t]);const ie=g.useMemo(()=>({role:x,tabIndex:k,"aria-disabled":a,"aria-pressed":B&&x===jy?!0:void 0,"aria-roledescription":C,"aria-describedby":S.draggable}),[a,x,k,B,C,S.draggable]);return{active:m,activatorEvent:p,activeNodeRect:f,attributes:ie,isDragging:B,listeners:a?void 0:q,node:re,over:b,setNodeRef:F,setActivatorNodeRef:ce,transform:R}}const mE="Droppable",_E={timeout:25};function qb(e){let{data:t,disabled:n=!1,id:a,resizeObserverConfig:o}=e;const c=ku(mE),{active:d,dispatch:p,over:m,measureDroppableContainers:f}=g.useContext(Ru),S=g.useRef({disabled:n}),y=g.useRef(!1),b=g.useRef(null),x=g.useRef(null),{disabled:C,updateMeasurementsFor:k,timeout:B}={..._E,...o},R=so(k??a),re=g.useCallback(()=>{if(!y.current){y.current=!0;return}x.current!=null&&clearTimeout(x.current),x.current=setTimeout(()=>{f(Array.isArray(R.current)?R.current:[R.current]),x.current=null},B)},[B]),F=Du({callback:re,disabled:C||!d}),J=g.useCallback((ie,de)=>{F&&(de&&(F.unobserve(de),y.current=!1),ie&&F.observe(ie))},[F]),[ce,q]=lu(J),I=so(t);return g.useEffect(()=>{!F||!ce.current||(F.disconnect(),y.current=!1,F.observe(ce.current))},[ce,F]),g.useEffect(()=>(p({type:ni.RegisterDroppable,element:{id:a,key:c,disabled:n,node:ce,rect:b,data:I}}),()=>p({type:ni.UnregisterDroppable,key:c,id:a})),[a]),g.useEffect(()=>{n!==S.current.disabled&&(p({type:ni.SetDroppableDisabled,id:a,key:c,disabled:n}),S.current.disabled=n)},[a,c,n,p]),{active:d,rect:b,isOver:m?.id===a,node:ce,over:m,setNodeRef:q}}const vE=128,gE=512,yE=64,SE=4096;function Wb(e){if(!e||typeof e!="object")return null;const t=e;if(typeof t.activeWorkspaceId!="string"&&t.activeWorkspaceId!==null||!Array.isArray(t.workspaces)||t.workspaces.length>vE)return null;const n=t.workspaces.map(bE);return n.some(a=>a===null)?null:{activeWorkspaceId:t.activeWorkspaceId,workspaces:n}}function bE(e){if(!e||typeof e!="object")return null;const t=e;if(typeof t.id!="string"||typeof t.title!="string"||typeof t.activeTabId!="string"&&t.activeTabId!==null||!Array.isArray(t.tabs)||t.tabs.length>gE)return null;const n=t.tabs.map(wE);return n.some(a=>a===null)?null:{id:t.id,title:t.title,activeTabId:t.activeTabId,tabs:n}}function wE(e){if(!e||typeof e!="object")return null;const t=e;if(typeof t.id!="string"||typeof t.title!="string"||typeof t.activeTerminalId!="string")return null;const n=CE(t.root);return n?{id:t.id,title:t.title,activeTerminalId:t.activeTerminalId,root:n}:null}function CE(e){if(!e||typeof e!="object")return null;let t=0;return Mf(e,1,()=>(t+=1,t<=SE))}function Mf(e,t,n){if(!e||typeof e!="object"||t>yE||!n())return null;const a=e;if(a.type==="pane")return typeof a.terminalId=="string"?{type:"pane",terminalId:a.terminalId}:null;if(a.type!=="split"||a.direction!=="horizontal"&&a.direction!=="vertical")return null;const o=Mf(a.first,t+1,n),c=Mf(a.second,t+1,n);return!o||!c?null:{type:"split",direction:a.direction,ratio:xE(a.ratio),first:o,second:c}}function xE(e){return typeof e=="number"&&Number.isFinite(e)?Math.min(.9,Math.max(.1,e)):.5}const Yb=[{id:"builtin-character-2260",filename:"character-2260.mp4",contentType:"video/mp4",size:123288,createdAt:"2026-05-26T00:00:00.000Z",url:"/assets/notifications/character-2260.mp4"},{id:"builtin-character-2272",filename:"character-2272.mp4",contentType:"video/mp4",size:55873,createdAt:"2026-05-26T00:00:00.000Z",url:"/assets/notifications/character-2272.mp4"},{id:"builtin-character-2258",filename:"character-2258.mp4",contentType:"video/mp4",size:112612,createdAt:"2026-05-26T00:00:00.000Z",url:"/assets/notifications/character-2258.mp4"}];function Hy(e){return e===void 0?"unknown":e==="error"?"offline":"ok"}function Uy(e){const t=e.trim();return t?t.charAt(0).toUpperCase():"?"}const Py="Local",EE=3e4;function Jd(e){return e===void 0?"":e==="error"?"offline":[`CPU ${Cs(e.cpuPercent)} ${em(e)}`,`MEM ${Cs(e.memoryPercent)} ${Sn(e.memoryUsedBytes,e.memoryTotalBytes)}`,`DISK ${Cs(e.diskPercent)} ${Sn(e.diskUsedBytes,e.diskTotalBytes)}`,`SWAP ${Cs(e.swapPercent)} ${Sn(e.swapUsedBytes,e.swapTotalBytes)}`].join(" · ")}function TE(e){if(!(e===void 0||e==="error"))return[`CPU ${Cs(e.cpuPercent)} (${em(e)})`,`RAM ${Cs(e.memoryPercent)} (${Sn(e.memoryUsedBytes,e.memoryTotalBytes)})`,`Disk ${Cs(e.diskPercent)} (${Sn(e.diskUsedBytes,e.diskTotalBytes)})`,`Swap ${Cs(e.swapPercent)} (${Sn(e.swapUsedBytes,e.swapTotalBytes)})`].join(" · ")}function Cs(e){return typeof e=="number"&&Number.isFinite(e)?`${Math.round(e)}%`:"–"}function em(e){const t=Number.isFinite(e.cores)&&e.cores>0?e.cores:null;return e.cpuPercent===null||e.cpuPercent===void 0||!Number.isFinite(e.cpuPercent)||t===null?`–/${t??"–"} cores`:`${Af(e.cpuPercent/100*t)}/${t} cores`}function Sn(e,t){return!Ky(e)||!Ky(t)?"–/–":kE(e,t)}function kE(e,t){const n=t>=1073741824?"GB":t>=1048576?"MB":"KB",a=n==="GB"?1024**3:n==="MB"?1024**2:1024;return`${Af(e/a)}/${Af(t/a)} ${n}`}function Af(e){return e>=10||Number.isInteger(e)?e.toFixed(0):e.toFixed(1)}function Ky(e){return typeof e=="number"&&Number.isFinite(e)&&e>=0}function DE(e){return[{label:"CPU",percent:Cs(e.cpuPercent),detail:em(e)},{label:"MEM",percent:Cs(e.memoryPercent),detail:Sn(e.memoryUsedBytes,e.memoryTotalBytes)},{label:"DISK",percent:Cs(e.diskPercent),detail:Sn(e.diskUsedBytes,e.diskTotalBytes)},{label:"SWAP",percent:Cs(e.swapPercent),detail:Sn(e.swapUsedBytes,e.swapTotalBytes)}]}function Iy({entry:e}){return e==="error"?_.jsx("span",{className:"server-list-stats server-list-stats--offline",children:"offline"}):e===void 0?_.jsx("span",{className:"server-list-stats server-list-stats-grid","aria-hidden":"true",children:["CPU","MEM","DISK","SWAP"].map(t=>_.jsxs("span",{className:"server-list-stat-cell",children:[_.jsx("span",{className:"server-list-stat-label",children:t}),_.jsx("span",{className:"server-list-stat-value",children:"–"}),_.jsx("span",{className:"server-list-stat-detail",children:"–"})]},t))}):_.jsx("span",{className:"server-list-stats server-list-stats-grid",title:TE(e),children:DE(e).map(t=>_.jsxs("span",{className:"server-list-stat-cell",children:[_.jsx("span",{className:"server-list-stat-label",children:t.label}),_.jsx("span",{className:"server-list-stat-value",children:t.percent}),_.jsx("span",{className:"server-list-stat-detail",children:t.detail})]},t.label))})}function ef({api:e,activeAgentId:t,onSelectServer:n,onSessionInvalid:a,refreshToken:o=0,compact:c=!1}){const[d,p]=g.useState([]),[m,f]=g.useState(null),[S,y]=g.useState(null),[b,x]=g.useState(""),C=g.useRef(null),[k,B]=g.useState({});g.useEffect(()=>{let q=!1;return e.listAgents().then(I=>{q||p(I.agents)}).catch(()=>{}),e.getMainInfo().then(I=>{q||f(I.name)}).catch(()=>{}),()=>{q=!0}},[e,o]),g.useEffect(()=>{S&&(C.current?.focus(),C.current?.select())},[S]),g.useEffect(()=>{let q=!1;async function I(){let de=!1;const j=[{key:"__main__",load:()=>e.getMainStats()},...d.map(H=>({key:H.id,load:()=>e.getAgentStats(H.id)}))],$=await Promise.all(j.map(async H=>{try{return[H.key,await H.load()]}catch(L){return L instanceof yn&&L.status===401?(de=!0,[H.key,"error"]):[H.key,"error"]}}));if(!q){if(de){a?.();return}B(H=>{const L={};for(const[G,M]of $)L[G]=M;const X=new Set(["__main__",...d.map(G=>G.id)]);for(const G of Object.keys(H))!X.has(G)||G in L||(L[G]=H[G]);return L})}}I();const ie=window.setInterval(()=>{I()},EE);return()=>{q=!0,window.clearInterval(ie)}},[e,d,a]);function R(q){q==="main"?(x(m??""),y({kind:"main"})):(x(q.name),y({kind:"agent",id:q.id}))}async function re(){if(!S)return;const q=b.trim(),I=S;if(y(null),I.kind==="main"){const ie=q||"";try{const de=await e.renameMain(ie);f(de.name)}catch{}}else{if(!q)return;const ie=d.find(de=>de.id===I.id)?.name;p(de=>de.map(j=>j.id===I.id?{...j,name:q}:j));try{await e.renameAgent(I.id,q)}catch{ie!==void 0&&p(de=>de.map(j=>j.id===I.id?{...j,name:ie}:j))}}}function F(){y(null)}const J=m?.trim()||Py,ce=S?.kind==="main";return c?_.jsxs("div",{className:"server-list server-list--compact",children:[_.jsxs("button",{type:"button",className:`server-list-chip${t===null?" server-list-chip--active":""}`,onClick:()=>n(null),"aria-label":J,title:`${J}${Jd(k.__main__)?` — ${Jd(k.__main__)}`:""}`,children:[_.jsx("span",{className:"server-list-chip-initial",children:Uy(J)}),_.jsx("span",{className:"server-list-chip-pip","data-status":Hy(k.__main__)})]}),d.map(q=>{const I=k[q.id],ie=Jd(I);return _.jsxs("button",{type:"button",className:`server-list-chip${t===q.id?" server-list-chip--active":""}`,onClick:()=>n(q.id),"aria-label":q.name,title:`${q.name}${ie?` — ${ie}`:""}`,children:[_.jsx("span",{className:"server-list-chip-initial",children:Uy(q.name)}),_.jsx("span",{className:"server-list-chip-pip","data-status":Hy(I)})]},q.id)})]}):_.jsxs("div",{className:"server-list",children:[_.jsx("div",{className:"server-list-row",children:ce?_.jsx("form",{className:"server-list-editor",onSubmit:q=>{q.preventDefault(),re()},children:_.jsx("input",{ref:C,"aria-label":"Rename main server",value:b,onChange:q=>x(q.target.value),onBlur:()=>{re()},onKeyDown:q=>{q.key==="Escape"&&(q.preventDefault(),F())},placeholder:Py})}):_.jsxs("button",{type:"button",className:`server-list-item${t===null?" server-list-item--active":""}`,onClick:()=>n(null),onDoubleClick:q=>{q.preventDefault(),R("main")},title:"Double-click to rename",children:[_.jsxs("span",{className:"server-list-item-header",children:[_.jsx("span",{className:"server-list-dot"}),_.jsx("span",{className:"server-list-name",children:J})]}),_.jsx(Iy,{entry:k.__main__})]})}),d.map(q=>{const I=S?.kind==="agent"&&S.id===q.id;return _.jsx("div",{className:"server-list-row",children:I?_.jsx("form",{className:"server-list-editor",onSubmit:ie=>{ie.preventDefault(),re()},children:_.jsx("input",{ref:C,"aria-label":`Rename ${q.name}`,value:b,onChange:ie=>x(ie.target.value),onBlur:()=>{re()},onKeyDown:ie=>{ie.key==="Escape"&&(ie.preventDefault(),F())}})}):_.jsxs("button",{type:"button",className:`server-list-item${t===q.id?" server-list-item--active":""}`,onClick:()=>n(q.id),onDoubleClick:ie=>{ie.preventDefault(),R({id:q.id,name:q.name})},title:"Double-click to rename",children:[_.jsxs("span",{className:"server-list-item-header",children:[_.jsx("span",{className:"server-list-dot"}),_.jsx("span",{className:"server-list-name",title:q.url,children:q.name})]}),_.jsx(Iy,{entry:k[q.id]})]})},q.id)})]})}function RE({api:e}){const[t,n]=g.useState([]),[a,o]=g.useState([]),[c,d]=g.useState(!1),[p,m]=g.useState(null),[f,S]=g.useState(""),[y,b]=g.useState("");async function x(){try{const[R,re,F]=await Promise.all([e.listDevices(),e.listNetworks(),e.getSession()]);n(R.devices),o(re.networks),d(F.totpEnabled),m(null)}catch(R){m(R instanceof Error?R.message:"Failed to load")}}g.useEffect(()=>{x()},[]);async function C(R){await e.revokeDevice(R),await x()}async function k(R){await e.removeNetwork(R),await x()}async function B(R){R.preventDefault(),m(null);try{await e.addNetwork({value:f.trim(),label:y.trim()}),S(""),b(""),await x()}catch(re){m(re instanceof Error?re.message:"Failed to add network")}}return _.jsxs(_.Fragment,{children:[p?_.jsx("p",{className:"form-error",children:p}):null,_.jsxs("section",{className:"security-section",children:[_.jsx("h3",{children:"Trusted devices"}),_.jsx("p",{className:"muted",children:"Devices that can re-authenticate with a 2FA code only (no password) for 30 days."}),t.length===0?_.jsx("p",{className:"muted",children:"No trusted devices."}):_.jsx("ul",{className:"security-list",children:t.map(R=>_.jsxs("li",{children:[_.jsxs("div",{children:[_.jsxs("span",{className:"security-item-label",children:[R.label,R.current?_.jsx("span",{className:"security-badge",children:"this device"}):null]}),_.jsxs("span",{className:"security-item-meta",children:["last seen ",new Date(R.lastSeenAt).toLocaleString()]})]}),_.jsx("button",{type:"button",className:"security-remove",onClick:()=>{C(R.id)},children:"revoke"})]},R.id))})]}),_.jsxs("section",{className:"security-section",children:[_.jsx("h3",{children:"Trusted networks"}),_.jsx("p",{className:"muted",children:"Sessions from these IPs/ranges skip the 2FA re-auth prompt."}),a.length===0?_.jsx("p",{className:"muted",children:"No trusted networks."}):_.jsx("ul",{className:"security-list",children:a.map(R=>_.jsxs("li",{children:[_.jsxs("div",{children:[_.jsx("span",{className:"security-item-label",children:R.value}),R.label!==R.value?_.jsx("span",{className:"security-item-meta",children:R.label}):null]}),_.jsx("button",{type:"button",className:"security-remove",onClick:()=>{k(R.id)},children:"remove"})]},R.id))}),_.jsxs("form",{className:"security-add-form",onSubmit:B,children:[_.jsx("input",{type:"text",placeholder:"IP or CIDR (e.g. 203.0.113.4 or 192.168.0.0/24)",value:f,onChange:R=>S(R.currentTarget.value),required:!0}),_.jsx("input",{type:"text",placeholder:"Label (optional)",value:y,onChange:R=>b(R.currentTarget.value)}),_.jsx("button",{type:"submit",disabled:!f.trim(),children:"Add"})]})]}),c?_.jsxs("section",{className:"security-section",children:[_.jsx("h3",{children:"Two-factor authentication"}),_.jsx("p",{className:"muted",children:"2FA is enabled. Disabling it removes the requirement; you will be asked to set it up again on next login."}),_.jsx("button",{type:"button",className:"security-remove",onClick:async()=>{await e.disableTotp(),await x()},children:"Disable 2FA"})]}):null]})}const $b="nterminal.notifications.completionEnabled",tm="nterminal.notifications.completionToastEnabled",im="nterminal.notifications.completionToastDurationSeconds",sm="nterminal.notifications.completionToastPersistent",Nf="nterminal:completion-toast-display",Jl=6.5,Bf=2,Lf=60;function Mu(){return typeof window<"u"&&"Notification"in window}function Vb(){try{return window.localStorage.getItem($b)==="true"}catch{return!1}}function Fy(e){try{window.localStorage.setItem($b,e?"true":"false")}catch{}}function zr(){return{enabled:BE(),durationSeconds:NE(),persistUntilDismissed:LE()}}function ME(e){if(typeof window<"u"){try{window.localStorage.setItem(tm,e?"true":"false")}catch{}rm()}return zr()}function qy(e){const t=Gb(e);if(typeof window<"u"){try{window.localStorage.setItem(im,String(t))}catch{}rm()}return zr()}function AE(e){if(typeof window<"u"){try{window.localStorage.setItem(sm,e?"true":"false")}catch{}rm()}return zr()}function Xb(e){if(typeof window>"u")return()=>{};const t=n=>{(n.key===tm||n.key===im||n.key===sm)&&e()};return window.addEventListener(Nf,e),window.addEventListener("storage",t),()=>{window.removeEventListener(Nf,e),window.removeEventListener("storage",t)}}function nm(){return Mu()?window.Notification.permission:"unsupported"}function NE(){if(typeof window>"u")return Jl;try{const e=window.localStorage.getItem(im);return e===null?Jl:Gb(Number(e))}catch{return Jl}}function BE(){if(typeof window>"u")return!0;try{return window.localStorage.getItem(tm)!=="false"}catch{return!0}}function LE(){if(typeof window>"u")return!1;try{return window.localStorage.getItem(sm)==="true"}catch{return!1}}function Gb(e){if(!Number.isFinite(e))return Jl;const t=Math.round(e*2)/2;return Math.max(Bf,Math.min(Lf,t))}function rm(){typeof window<"u"&&window.dispatchEvent(new CustomEvent(Nf))}async function OE(){if(!Mu())return"unsupported";try{return await window.Notification.requestPermission()}catch{return nm()}}function zE(e){if(!Mu()||nm()!=="granted"||!Vb()||typeof document<"u"&&document.visibilityState==="visible")return;const t=e.commandName?`${e.commandName} finished`:"Command finished";try{new Notification(`NTerminal · ${e.tabTitle}`,{body:t,tag:e.terminalId,icon:"/icons/app-icon-384.png",silent:!0})}catch{}}const jE=1500,am="nterminal.terminal.fontSize",lm="nterminal.terminal.fontFamily",Of="nterminal:terminal-font-size",zf="nterminal:terminal-font-family",jf=11,Hf=20,Lr=14,hu=[{id:"meslo",label:"MesloLGS NF",cssFamily:['"MesloLGS NF"','"MesloLGS Nerd Font Mono"','"MesloLGSNerdFontMono"','"JetBrainsMono Nerd Font"','"Hack Nerd Font"','"FiraCode Nerd Font"','"SF Mono"',"Menlo","Monaco","Consolas",'"Liberation Mono"','"Symbols Nerd Font Mono"','"Apple Symbols"','"Apple Color Emoji"',"monospace"].join(", "),webFontFamilies:['"MesloLGS NF"']},{id:"jetbrains",label:"JetBrains Mono",cssFamily:['"JetBrainsMono Nerd Font"','"JetBrains Mono"','"Hack Nerd Font"','"FiraCode Nerd Font"','"SF Mono"',"Menlo","Monaco","Consolas",'"Liberation Mono"','"Symbols Nerd Font Mono"','"Apple Symbols"','"Apple Color Emoji"',"monospace"].join(", "),webFontFamilies:[]},{id:"system",label:"System mono",cssFamily:['"SF Mono"',"Menlo","Monaco","Consolas",'"Liberation Mono"','"Symbols Nerd Font Mono"','"Apple Symbols"','"Apple Color Emoji"',"monospace"].join(", "),webFontFamilies:[]}],Na="meslo";Uf(Na);async function tf(e=Lr,t=Na){if(typeof document>"u"||!document.fonts)return;const n=Jb(t).webFontFamilies;if(n.length===0)return;const a=Promise.all(n.map(o=>document.fonts.load(`${e}px ${o}`))).then(()=>{}).catch(()=>{});await Promise.race([a,new Promise(o=>{globalThis.setTimeout(o,jE)})])}function Zb(e){const t=typeof e=="number"?e:Number(e);if(!Number.isFinite(t))return Lr;const n=Math.round(t);return Math.max(jf,Math.min(Hf,n))}function Qb(e){return hu.some(t=>t.id===e)?e:Na}function Uf(e){return Jb(e).cssFamily}function Jb(e){return hu.find(t=>t.id===e)??hu[0]}function Pf(){if(typeof window>"u")return Lr;try{const e=window.localStorage.getItem(am);return e?Zb(e):Lr}catch{return Lr}}function Kf(){if(typeof window>"u")return Na;try{return Qb(window.localStorage.getItem(lm))}catch{return Na}}function Hc(e){const t=Zb(e);if(typeof window>"u")return t;try{window.localStorage.setItem(am,String(t))}catch{}return window.dispatchEvent(new CustomEvent(Of,{detail:t})),t}function HE(e){const t=Qb(e);if(typeof window>"u")return t;try{window.localStorage.setItem(lm,t)}catch{}return window.dispatchEvent(new CustomEvent(zf,{detail:t})),t}function e0(e){if(typeof window>"u")return()=>{};const t=n=>{n.key===am&&e()};return window.addEventListener(Of,e),window.addEventListener("storage",t),()=>{window.removeEventListener(Of,e),window.removeEventListener("storage",t)}}function t0(e){if(typeof window>"u")return()=>{};const t=n=>{n.key===lm&&e()};return window.addEventListener(zf,e),window.addEventListener("storage",t),()=>{window.removeEventListener(zf,e),window.removeEventListener("storage",t)}}const om="nterminal.terminal.showScrollProgress",If="nterminal:terminal-scroll-progress";function Ff(){if(typeof window>"u")return!0;try{return window.localStorage.getItem(om)!=="false"}catch{return!0}}function UE(e){if(typeof window<"u"){try{window.localStorage.setItem(om,e?"true":"false")}catch{}window.dispatchEvent(new CustomEvent(If,{detail:e}))}return e}function i0(e){if(typeof window>"u")return()=>{};const t=n=>{n.key===om&&e()};return window.addEventListener(If,e),window.addEventListener("storage",t),()=>{window.removeEventListener(If,e),window.removeEventListener("storage",t)}}const cm="nterminal.shortcuts.workspace.v1",qf="nterminal:workspace-shortcuts",ro=[{id:"server.previous",label:"Previous server",group:"Servers"},{id:"server.next",label:"Next server",group:"Servers"},{id:"tab.previous",label:"Previous tab",group:"Tabs"},{id:"tab.next",label:"Next tab",group:"Tabs"},{id:"tab.index",label:"Select tab 1-9",group:"Tabs",indexed:!0},{id:"pane.index",label:"Select pane 1-9",group:"Panes",indexed:!0},{id:"split.right",label:"Split right",group:"Panes"},{id:"split.down",label:"Split down",group:"Panes"}],um={"server.previous":Mi("ArrowUp",{ctrlKey:!0}),"server.next":Mi("ArrowDown",{ctrlKey:!0}),"tab.previous":Mi("ArrowLeft",{ctrlKey:!0}),"tab.next":Mi("ArrowRight",{ctrlKey:!0}),"tab.index":Mi("Digit",{ctrlKey:!0,altKey:!0}),"pane.index":Mi("Digit",{ctrlKey:!0,altKey:!0,shiftKey:!0}),"split.right":Mi("ArrowRight",{ctrlKey:!0,altKey:!0,shiftKey:!0}),"split.down":Mi("ArrowDown",{ctrlKey:!0,altKey:!0,shiftKey:!0})},PE={"server.previous":Mi("BracketLeft",{ctrlKey:!0,altKey:!0,shiftKey:!0}),"server.next":Mi("BracketRight",{ctrlKey:!0,altKey:!0,shiftKey:!0}),"tab.previous":Mi("BracketLeft",{ctrlKey:!0,altKey:!0}),"tab.next":Mi("BracketRight",{ctrlKey:!0,altKey:!0}),"tab.index":Mi("Digit",{ctrlKey:!0,altKey:!0,shiftKey:!0}),"pane.index":Mi("Digit",{ctrlKey:!0,altKey:!0}),"split.right":Mi("ArrowRight",{ctrlKey:!0,altKey:!0,shiftKey:!0}),"split.down":Mi("ArrowDown",{ctrlKey:!0,altKey:!0,shiftKey:!0})};function jr(){const e=a0(um);if(typeof window>"u")return e;try{const t=window.localStorage.getItem(cm);if(!t)return e;const n=JSON.parse(t);for(const a of ro){const o=n[a.id];if(XE(o)){const c=l0(o,a);VE(c,PE[a.id])||(e[a.id]=c)}}}catch{return e}return e}function Wy(){return JSON.stringify(jr())}function KE(e,t){const n=jr(),a=ro.find(o=>o.id===e);return a&&(n[e]=l0(t,a),hm(n)),n}function IE(e){const t=jr();return t[e]={...um[e]},hm(t),t}function FE(){const e=a0(um);return hm(e),e}function s0(e){if(typeof window>"u")return()=>{};const t=n=>{n.key===cm&&e()};return window.addEventListener(qf,e),window.addEventListener("storage",t),()=>{window.removeEventListener(qf,e),window.removeEventListener("storage",t)}}function qE(e,t){const n=c0(e);return!n||ZE(n)||t.indexed&&o0(e)===null?null:{ctrlKey:e.ctrlKey,altKey:e.altKey,shiftKey:e.shiftKey,metaKey:e.metaKey,code:t.indexed?"Digit":n}}function WE(e){const t=jr();for(const n of ro){const a=t[n.id];if(!(!a||!GE(e,a))){if(n.indexed){if(a.code!=="Digit")continue;const o=o0(e);if(o!==null)return{id:n.id,index:o};continue}if(c0(e)===a.code)return{id:n.id,index:null}}}return null}function n0(e){return r0(jr()[e])}function r0(e){const t=[];return e.ctrlKey&&t.push("Ctrl"),e.altKey&&t.push("Alt"),e.shiftKey&&t.push("Shift"),e.metaKey&&t.push("Meta"),t.push(QE(e.code)),t.join("+")}const YE=()=>n0("split.right"),$E=()=>n0("split.down");function Mi(e,t){return{ctrlKey:t.ctrlKey??!1,altKey:t.altKey??!1,shiftKey:t.shiftKey??!1,metaKey:t.metaKey??!1,code:e}}function a0(e){return Object.fromEntries(Object.entries(e).map(([t,n])=>[t,{...n}]))}function VE(e,t){return e.ctrlKey===t.ctrlKey&&e.altKey===t.altKey&&e.shiftKey===t.shiftKey&&e.metaKey===t.metaKey&&e.code===t.code}function hm(e){if(!(typeof window>"u")){try{window.localStorage.setItem(cm,JSON.stringify(e))}catch{}window.dispatchEvent(new CustomEvent(qf))}}function l0(e,t){return{ctrlKey:!!e.ctrlKey,altKey:!!e.altKey,shiftKey:!!e.shiftKey,metaKey:!!e.metaKey,code:t.indexed?"Digit":e.code}}function XE(e){if(!e||typeof e!="object")return!1;const t=e;return typeof t.ctrlKey=="boolean"&&typeof t.altKey=="boolean"&&typeof t.shiftKey=="boolean"&&typeof t.metaKey=="boolean"&&typeof t.code=="string"&&t.code.length>0}function GE(e,t){return e.ctrlKey===t.ctrlKey&&e.altKey===t.altKey&&e.shiftKey===t.shiftKey&&e.metaKey===t.metaKey}function o0(e){const t=/^Digit([1-9])$/.exec(e.code);return t?.[1]?Number(t[1]):/^[1-9]$/.test(e.key)?Number(e.key):null}function c0(e){if(e.code)return e.code;if(/^[a-z]$/i.test(e.key))return`Key${e.key.toUpperCase()}`;if(/^[0-9]$/.test(e.key))return`Digit${e.key}`;switch(e.key){case"[":case"{":return"BracketLeft";case"]":case"}":return"BracketRight";case"ArrowLeft":case"ArrowRight":case"ArrowUp":case"ArrowDown":case"Tab":case"Enter":case"Escape":case"Space":return e.key==="Space"?"Space":e.key;default:return null}}function ZE(e){return e==="ControlLeft"||e==="ControlRight"||e==="AltLeft"||e==="AltRight"||e==="ShiftLeft"||e==="ShiftRight"||e==="MetaLeft"||e==="MetaRight"}function QE(e){if(e==="Digit")return"1-9";const t=/^Digit([0-9])$/.exec(e);if(t?.[1])return t[1];const n=/^Key([A-Z])$/.exec(e);if(n?.[1])return n[1];switch(e){case"BracketLeft":return"[";case"BracketRight":return"]";case"ArrowLeft":return"Left";case"ArrowRight":return"Right";case"ArrowUp":return"Up";case"ArrowDown":return"Down";case"Space":return"Space";default:return e.replace(/^(Numpad|Digit|Key)/,"")}}const dm="nterminal.theme.accent",Wf="nterminal:theme-accent",ao=[{id:"aqua",label:"Aqua Teal",accent:"#5EEAD4",soft:"rgba(94, 234, 212, 0.10)",glow:"rgba(94, 234, 212, 0.55)",xtermSelection:"#1f3f45"},{id:"signal-red",label:"Signal Red",accent:"#FF2A3D",soft:"rgba(255, 42, 61, 0.12)",glow:"rgba(255, 42, 61, 0.52)",xtermSelection:"#4a1b22"}],du="aqua";function wo(e){return ao.some(t=>t.id===e)?e:du}function fm(e){return ao.find(t=>t.id===e)??ao[0]}function lr(){if(typeof window>"u")return du;try{return wo(window.localStorage.getItem(dm))}catch{return du}}function JE(e){const t=wo(e);if(typeof window<"u"){try{window.localStorage.setItem(dm,t)}catch{}pm(t),window.dispatchEvent(new CustomEvent(Wf,{detail:t}))}return t}function pm(e=lr()){if(typeof document>"u")return;const t=fm(wo(e)),n=document.documentElement;n.style.setProperty("--nt-accent",t.accent),n.style.setProperty("--nt-accent-soft",t.soft),n.style.setProperty("--nt-accent-glow",t.glow)}function e2(e=lr()){return fm(wo(e)).accent}function t2(e=lr()){return fm(wo(e)).xtermSelection}function u0(e){if(typeof window>"u")return()=>{};const t=n=>{n.key===dm&&(pm(lr()),e())};return window.addEventListener(Wf,e),window.addEventListener("storage",t),()=>{window.removeEventListener(Wf,e),window.removeEventListener("storage",t)}}const i2="Automatic update needs write access to the global npm install. Run the manual update command as the NTerminal runtime user; only the npm install step should use sudo.";function s2(e="nterminal",t=new Date){return{reason:"permission",message:i2,command:`sudo npm i -g ${e}@latest --prefer-online && nterminal restart`,detectedAt:t.toISOString()}}function n2(e){return/\b(?:EACCES|EPERM)\b|permission denied|missing write access|access denied|operation was rejected by your operating system|operation not permitted|root-owned files/i.test(e)}const h0=3600*1e3,r2="local",Yf=new Set,nr=new Map;let or={checking:!1,hasUpdates:!1,lastCheckedAt:null},mm=null,eo=null,fu=0,Jn=null;function a2(e){return Yf.add(e),()=>{Yf.delete(e)}}function Yy(){return or}function l2(e){const t=d2();mm=e,_m(),$f(e,t);const n=()=>{if(document.visibilityState!=="visible"||!cr(e,t))return;const a=or.lastCheckedAt;(a===null||Date.now()-a>=h0)&&$f(e,t)};return document.addEventListener("visibilitychange",n),()=>{document.removeEventListener("visibilitychange",n),cr(e,t)&&h2()}}function o2(e,t){nr.set(e,d0(t)),Ba({...or,hasUpdates:vm(),lastCheckedAt:Date.now()})}function sf(e){e===void 0?nr.clear():nr.set(e,!1),Ba({...or,hasUpdates:vm()})}async function $f(e,t){if(!cr(e,t))return;if(Jn&&Jn.api===e&&Jn.runId===t)return Jn.promise;Ba({...or,checking:!0});const n=c2(e,t).finally(()=>{Jn?.promise===n&&(Jn=null),cr(e,t)&&(Ba({...or,checking:!1,lastCheckedAt:Date.now()}),u2(e,t))});return Jn={api:e,runId:t,promise:n},n}async function c2(e,t){try{const n=await e.listAgents();if(!cr(e,t))return;const a=[{key:r2,check:()=>e.checkUpdate()},...n.agents.map(c=>({key:c.id,check:()=>e.checkAgentUpdate(c.id)}))],o=new Map;if(await Promise.all(a.map(async c=>{try{const d=await c.check();o.set(c.key,d0(d))}catch{o.set(c.key,nr.get(c.key)??!1)}})),!cr(e,t))return;nr.clear();for(const[c,d]of o)nr.set(c,d);Ba({...or,hasUpdates:vm()})}catch{}}function u2(e,t){cr(e,t)&&(_m(),eo=window.setTimeout(()=>{eo=null,cr(e,t)&&$f(e,t)},h0))}function h2(){fu+=1,_m(),mm=null,Jn=null,nr.clear(),Ba({checking:!1,hasUpdates:!1,lastCheckedAt:null})}function _m(){eo!==null&&(window.clearTimeout(eo),eo=null)}function d2(){return fu+=1,fu}function cr(e,t){return mm===e&&fu===t}function d0(e){return e.updateAvailable===!0}function vm(){return Array.from(nr.values()).some(Boolean)}function Ba(e){or=e;for(const t of Array.from(Yf))t()}const f2=e=>new Promise(t=>setTimeout(t,e));function p2({api:e,onAgentRemoved:t}){const[n,a]=g.useState([{key:"local",id:null,name:"Local (main)"}]),[o,c]=g.useState({}),[d,p]=g.useState(!1),[m,f]=g.useState(null),[S,y]=g.useState(!1);function b(j,$){c(H=>({...H,[j]:{...H[j],...$}}))}const x=j=>j.id===null?e.getVersion():e.getAgentVersion(j.id),C=j=>j.id===null?e.checkUpdate():e.checkAgentUpdate(j.id),k=j=>j.id===null?e.runUpdate():e.runAgentUpdate(j.id);g.useEffect(()=>{let j=!1;return e.listAgents().then($=>{if(j)return;const H=[{key:"local",id:null,name:"Local (main)"},...$.agents.map(L=>({key:L.id,id:L.id,name:L.name}))];a(H);for(const L of H)x(L).then(X=>b(L.key,{version:X,manualUpdate:X.manualUpdate??null})).catch(X=>b(L.key,{error:X instanceof Error?X.message:"unreachable"}))}).catch(()=>{}),()=>{j=!0}},[]);async function B(j){b(j.key,{busy:!0,status:"checking…",error:void 0});try{const $=await C(j);o2(j.key,$),b(j.key,{latestVersion:$.latestVersion,updateAvailable:$.updateAvailable,status:I($),...$.updateAvailable===!1?{manualUpdate:null}:{},busy:!1})}catch($){b(j.key,{busy:!1,error:$ instanceof Error?$.message:"check failed"})}}async function R(){p(!0),await Promise.all(n.map(j=>B(j))),p(!1)}async function re(j,$){const H=Date.now()+18e4;for(;Date.now()<H;){await f2(3e3);try{const L=await x(j);if($&&L.runningVersion!==$.runningVersion)return L}catch{}}return null}async function F(j,$={}){let H=o[j.key]?.version;if(!H)try{H=await x(j),b(j.key,{version:H,manualUpdate:H.manualUpdate??null})}catch(M){return b(j.key,{busy:!1,error:M instanceof Error?M.message:"version check failed"}),"failed"}const L=o[j.key]?.manualUpdate??H.manualUpdate??null;if(L&&$.skipManual)return b(j.key,{busy:!1,status:"manual update required",error:void 0,manualUpdate:L}),"manual";b(j.key,{busy:!0,status:"updating…",error:void 0});let X;try{X=await k(j)}catch(M){return b(j.key,{busy:!1,error:M instanceof Error?M.message:"update failed"}),"failed"}if(!X.ok){const M=X.manualUpdate??(n2(X.message)?s2():null);return M?(b(j.key,{busy:!1,status:"manual update required",error:void 0,manualUpdate:M}),"manual"):(b(j.key,{busy:!1,status:void 0,error:X.message}),"failed")}if(!X.changed)return b(j.key,{busy:!1,status:"already up to date",updateAvailable:!1,manualUpdate:null}),sf(j.key),"unchanged";b(j.key,{status:"restarting…"});const G=await re(j,H);return G?(b(j.key,{busy:!1,version:G,updateAvailable:!1,status:"updated",manualUpdate:G.manualUpdate??null}),sf(j.key),j.id===null&&(y(!0),f("Main server updated. Reload the page to use the new client.")),"updated"):(b(j.key,{busy:!1,status:void 0,error:"timed out — check the server log"}),"failed")}async function J(j){if(!(j.id===null||!window.confirm([`Delete secondary server "${j.name}"?`,"","If the secondary is reachable, NTerminal will schedule a clean uninstall on that host, stop its runtime, remove its local state, and remove it from this main server.","If it is already gone or unreachable, only the stale registration on this main server will be removed.","","This can close live terminals on that secondary. Continue?"].join(`
14
- `)))){b(j.key,{busy:!0,status:"deleting…",error:void 0}),f(null);try{const H=await e.uninstallAgent(j.id);a(L=>L.filter(X=>X.key!==j.key)),c(L=>{const X={...L};return delete X[j.key],X}),sf(j.key),t?.(j.id),f(H.message)}catch(H){b(j.key,{busy:!1,status:void 0,error:H instanceof Error?H.message:"delete failed"})}}}async function ce(){p(!0),f(null);const j=n.filter(G=>G.id!==null),$=n.find(G=>G.id===null),H=await Promise.all(j.map(G=>F(G,{skipManual:!0}))),L=H.filter(G=>G==="failed").length;let X=H.filter(G=>G==="manual").length;if(L>0){p(!1);return}if($){const G=await F($,{skipManual:!0});if(G==="manual"&&(X+=1),G==="updated"){p(!1);return}}X>0&&f("Some servers need manual update. Copy and run the command shown on each marked server."),p(!1)}function q(j){return j?j.error?j.error:j.status?j.status:j.manualUpdate?"manual update required":j.version?`v${j.version.version}`:"…":"…"}function I(j){return j.error?j.error:typeof j.updateAvailable=="boolean"?j.updateAvailable?`latest v${j.latestVersion??"available"}`:"up to date":"unknown"}function ie(j){const $=j?.version;return $?`npm package v${$.runningVersion}`:""}async function de(j,$){try{await m2($),b(j,{copiedCommand:!0}),window.setTimeout(()=>b(j,{copiedCommand:!1}),1800)}catch(H){b(j,{error:H instanceof Error?H.message:"copy failed"})}}return _.jsxs("section",{className:"security-section",children:[_.jsx("h3",{children:"Servers"}),_.jsxs("div",{className:"update-actions",children:[_.jsx("button",{type:"button",className:"secondary-button",onClick:()=>{R()},disabled:d,children:"Check for updates"}),_.jsx("button",{type:"button",onClick:()=>{ce()},disabled:d,children:"Update all"})]}),m?_.jsx("p",{className:"settings-status",children:m}):null,S?_.jsxs("div",{className:"server-reload-required",role:"status",children:[_.jsx("span",{children:"Main server update is ready."}),_.jsx("button",{type:"button",onClick:()=>window.location.reload(),children:"Reload page"})]}):null,_.jsx("ul",{className:"security-list",children:n.map(j=>{const $=o[j.key],H=ie($),L=$?.manualUpdate??null,X=$?.version!==void 0&&$?.updateAvailable!==!1&&!L&&!$?.busy&&!d,G=j.id!==null&&!$?.busy&&!d;return _.jsxs("li",{children:[_.jsxs("div",{className:"server-row-main",children:[_.jsxs("div",{children:[_.jsx("span",{className:"security-item-label",children:j.name}),_.jsxs("span",{className:"security-item-meta",children:[H?`${H} — `:"",q($)]})]}),L?_.jsxs("div",{className:"server-manual-update",children:[_.jsx("span",{children:L.message}),_.jsxs("div",{className:"server-manual-command",children:[_.jsx("code",{children:L.command}),_.jsx("button",{type:"button",className:"secondary-button",onClick:()=>{de(j.key,L.command)},children:$?.copiedCommand?"Copied":"Copy"})]})]}):null]}),_.jsxs("div",{className:"server-row-actions",children:[_.jsx("button",{type:"button",className:"secondary-button",onClick:()=>{F(j)},disabled:!X,children:$?.busy?"…":"Update"}),j.id!==null?_.jsx("button",{type:"button",className:"server-delete-button",onClick:()=>{J(j)},disabled:!G,children:"Delete"}):null]})]},j.key)})})]})}async function m2(e){if(navigator.clipboard?.writeText){await navigator.clipboard.writeText(e);return}const t=document.createElement("textarea");t.value=e,t.setAttribute("readonly","true"),t.style.position="fixed",t.style.opacity="0",document.body.appendChild(t),t.select();try{if(!document.execCommand("copy"))throw new Error("copy failed")}finally{t.remove()}}const Uc=[{id:"terminal",label:"Terminal"},{id:"shortcuts",label:"Shortcuts"},{id:"notifications",label:"Notifications"},{id:"security",label:"Security"},{id:"servers",label:"Servers"}];function _2({onClose:e,api:t,updateAvailable:n=!1,onNotificationAssetsChanged:a,onAgentRemoved:o}){const c=g.useMemo(()=>t??Eu(),[t]),[d,p]=g.useState(()=>Pf()),[m,f]=g.useState(()=>Kf()),[S,y]=g.useState(()=>Ff()),[b,x]=g.useState(()=>lr()),[C,k]=g.useState(()=>jr()),[B,R]=g.useState(null),[re,F]=g.useState(null),[J,ce]=g.useState("terminal"),[q,I]=g.useState(()=>Vb()),[ie,de]=g.useState(()=>zr()),[j,$]=g.useState(()=>nm()),[H,L]=g.useState([]),[X,G]=g.useState([]),[M,V]=g.useState([]),[Q,ve]=g.useState(5*1024*1024),[Se,E]=g.useState(!1),[W,ee]=g.useState(null),he=g.useRef(null),ge=g.useRef(null),me=g.useRef({terminal:null,shortcuts:null,notifications:null,security:null,servers:null}),Ce=g.useMemo(()=>new Set(X),[X]),ze=!v2(X,M);g.useEffect(()=>e0(()=>p(Pf())),[]),g.useEffect(()=>t0(()=>f(Kf())),[]),g.useEffect(()=>i0(()=>y(Ff())),[]),g.useEffect(()=>u0(()=>x(lr())),[]),g.useEffect(()=>s0(()=>k(jr())),[]),g.useEffect(()=>Xb(()=>de(zr())),[]),g.useEffect(()=>{if(!B)return;const te=ro.find(He=>He.id===B);if(!te)return;const je=He=>{if(He.preventDefault(),He.stopPropagation(),He.key==="Escape"){R(null),F(null);return}const _i=qE(He,te);if(!_i){F(te.indexed?"Press a shortcut ending in a number from 1 to 9.":"Press a complete shortcut.");return}k(KE(B,_i)),R(null),F(null)};return window.addEventListener("keydown",je,!0),()=>window.removeEventListener("keydown",je,!0)},[B]),g.useEffect(()=>{let te=!1;return c.listNotificationAssets().then(je=>{te||Ee(je)}).catch(je=>{te||ee(Pc(je))}),()=>{te=!0}},[c]);function Ne(te){p(Hc(Number(te)))}function Re(te){de(qy(Number(te)))}function Pe(te){ce(te),me.current[te]?.scrollIntoView?.({block:"start",behavior:"smooth"})}function Ye(){const te=ge.current;if(!te)return;if(te.scrollTop+te.clientHeight>=te.scrollHeight-2){ce(Uc[Uc.length-1].id);return}const je=te.getBoundingClientRect();let He="terminal",_i=0;for(const Vi of Uc){const ai=me.current[Vi.id];if(!ai)continue;const kt=ai.getBoundingClientRect(),ji=Math.max(kt.top,je.top),Ti=Math.min(kt.bottom,je.bottom),Nt=Math.max(0,Ti-ji);Nt>_i&&(He=Vi.id,_i=Nt)}ce(He)}function Be(te){k(IE(te)),R(null),F(null)}function ae(){k(FE()),R(null),F(null)}function Ee(te){const je=te.assets.filter(He=>He.enabled).map(He=>He.id);L(te.assets),G(je),V(je),ve(te.maxFileBytes),ee(null)}async function xe(){if(q){Fy(!1),I(!1);return}let te=j;te==="default"&&(te=await OE(),$(te)),te==="granted"&&(Fy(!0),I(!0))}async function Ke(te){const je=te?.[0];if(je){if(je.size>Q){ee(`File must be ${nf(Q)} or smaller.`),gt();return}if(je.type!=="video/mp4"&&je.type!=="video/webm"){ee("Upload an MP4 or WebM video."),gt();return}E(!0),ee(null);try{await c.uploadNotificationAsset(je),Ee(await c.listNotificationAssets()),a?.()}catch(He){ee(Pc(He))}finally{E(!1),gt()}}}async function Xe(te){E(!0),ee(null);try{await c.deleteNotificationAsset(te),Ee(await c.listNotificationAssets()),a?.()}catch(je){ee(Pc(je))}finally{E(!1)}}function gt(){he.current&&(he.current.value="")}function yt(te,je){const He=new Set(X);if(je?He.add(te):He.delete(te),He.size===0){ee("Keep at least one toast video selected.");return}ee(null),G(Array.from(He))}async function mi(){if(X.length===0){ee("Keep at least one toast video selected.");return}E(!0),ee(null);try{const te=await c.updateNotificationAssetSelection({enabledAssetIds:X});Ee(te),a?.()}catch(te){ee(Pc(te))}finally{E(!1)}}return _.jsx("div",{className:"security-overlay",role:"dialog","aria-modal":"true","aria-label":"Settings",onClick:e,children:_.jsxs("div",{className:"security-panel settings-panel",onClick:te=>te.stopPropagation(),children:[_.jsxs("header",{className:"security-panel-header",children:[_.jsx("h2",{children:"Settings"}),_.jsx("button",{type:"button",className:"security-close","aria-label":"Close",onClick:e,children:"×"})]}),_.jsxs("div",{className:"settings-layout",children:[_.jsx("nav",{className:"settings-nav","aria-label":"Settings categories",children:Uc.map(te=>_.jsxs("button",{type:"button","data-active":J===te.id?"true":"false","aria-current":J===te.id?"true":void 0,onClick:()=>Pe(te.id),children:[te.label,te.id==="servers"&&n?_.jsx("span",{className:"update-pulse-dot settings-update-dot","aria-hidden":"true"}):null]},te.id))}),_.jsxs("div",{ref:ge,className:"settings-content",onScroll:Ye,children:[_.jsxs("section",{id:"settings-terminal",ref:te=>{me.current.terminal=te},className:"security-section settings-section",children:[_.jsx("h3",{children:"Terminal"}),_.jsxs("label",{className:"settings-control",children:[_.jsx("span",{children:"Font size"}),_.jsxs("span",{className:"settings-control-value",children:[d,"px"]}),_.jsx("input",{type:"range",min:jf,max:Hf,step:1,value:d,"aria-label":"Terminal font size",onChange:te=>Ne(te.currentTarget.value)})]}),_.jsxs("div",{className:"settings-stepper-row",children:[_.jsx("button",{type:"button",className:"secondary-button settings-stepper-button",onClick:()=>p(Hc(d-1)),children:"-"}),_.jsx("input",{type:"number",min:jf,max:Hf,step:1,value:d,"aria-label":"Terminal font size value",onChange:te=>Ne(te.currentTarget.value)}),_.jsx("button",{type:"button",className:"secondary-button settings-stepper-button",onClick:()=>p(Hc(d+1)),children:"+"}),_.jsx("button",{type:"button",className:"secondary-button settings-reset-button",onClick:()=>p(Hc(Lr)),children:"Reset"})]}),_.jsxs("label",{className:"settings-control",children:[_.jsx("span",{children:"Font family"}),_.jsx("select",{value:m,"aria-label":"Terminal font family",onChange:te=>f(HE(te.currentTarget.value)),children:hu.map(te=>_.jsx("option",{value:te.id,children:te.label},te.id))})]}),_.jsxs("label",{className:"auth-checkbox settings-checkbox",children:[_.jsx("input",{type:"checkbox",checked:S,onChange:te=>y(UE(te.currentTarget.checked))}),"Show scroll progress"]}),_.jsxs("label",{className:"settings-control",children:[_.jsx("span",{children:"Accent theme"}),_.jsx("select",{value:b,"aria-label":"Theme accent",onChange:te=>x(JE(te.currentTarget.value)),children:ao.map(te=>_.jsx("option",{value:te.id,children:te.label},te.id))})]}),_.jsx("div",{className:"settings-theme-swatches","aria-hidden":"true",children:ao.map(te=>_.jsx("span",{className:"settings-theme-swatch","data-active":b===te.id?"true":"false",style:{"--settings-theme-accent":te.accent}},te.id))})]}),_.jsxs("section",{id:"settings-shortcuts",ref:te=>{me.current.shortcuts=te},className:"security-section settings-section",children:[_.jsxs("div",{className:"settings-section-heading",children:[_.jsx("h3",{children:"Shortcuts"}),_.jsx("button",{type:"button",className:"secondary-button settings-reset-button",onClick:ae,children:"Reset all"})]}),_.jsx("p",{className:"muted",children:"Defaults avoid Chrome's browser-tab shortcuts. Click a shortcut, then press the new key combo."}),re?_.jsx("p",{className:"settings-error",children:re}):null,_.jsx("ul",{className:"settings-shortcut-list","aria-label":"Workspace shortcuts",children:ro.map(te=>{const je=B===te.id;return _.jsxs("li",{children:[_.jsxs("div",{children:[_.jsx("span",{className:"settings-shortcut-label",children:te.label}),_.jsx("span",{className:"settings-shortcut-group",children:te.group})]}),_.jsxs("div",{className:"settings-shortcut-actions",children:[_.jsx("button",{type:"button",className:"settings-shortcut-recorder","data-recording":je?"true":"false",onClick:()=>{R(te.id),F(null)},children:je?"Press keys…":r0(C[te.id])}),_.jsx("button",{type:"button",className:"secondary-button settings-shortcut-reset",onClick:()=>Be(te.id),children:"Reset"})]})]},te.id)})})]}),_.jsxs("section",{id:"settings-notifications",ref:te=>{me.current.notifications=te},className:"security-section settings-section",children:[_.jsx("h3",{children:"Notifications"}),Mu()?_.jsxs(_.Fragment,{children:[_.jsxs("label",{className:"auth-checkbox",children:[_.jsx("input",{type:"checkbox",checked:q&&j==="granted",onChange:()=>{xe()},disabled:j==="denied"}),"System notification when page is hidden"]}),j==="denied"?_.jsx("p",{className:"muted",children:"Notification permission is blocked for this site. Re-enable it in the browser's site settings, then come back here to turn the toggle on."}):_.jsx("p",{className:"muted",children:"Uses browser notifications only when this page isn't visible. Animated toast is controlled separately below."})]}):_.jsx("p",{className:"muted",children:"This browser doesn't expose the Notification API; animated toast and in-app badges can still work."}),_.jsxs("label",{className:"auth-checkbox settings-checkbox",children:[_.jsx("input",{type:"checkbox",checked:ie.enabled,onChange:te=>de(ME(te.currentTarget.checked))}),"Show animated completion toast"]}),_.jsxs("label",{className:"settings-control",children:[_.jsx("span",{children:"Toast duration"}),_.jsx("span",{className:"settings-control-value",children:ie.persistUntilDismissed?"Until closed":`${ie.durationSeconds}s`}),_.jsx("input",{type:"range",min:Bf,max:Lf,step:.5,value:ie.durationSeconds,disabled:!ie.enabled||ie.persistUntilDismissed,"aria-label":"Completion toast duration",onChange:te=>Re(te.currentTarget.value)})]}),_.jsxs("div",{className:"settings-stepper-row settings-duration-row",children:[_.jsx("input",{type:"number",min:Bf,max:Lf,step:.5,value:ie.durationSeconds,disabled:!ie.enabled||ie.persistUntilDismissed,"aria-label":"Completion toast duration value",onChange:te=>Re(te.currentTarget.value)}),_.jsx("button",{type:"button",className:"secondary-button settings-reset-button",disabled:!ie.enabled||ie.persistUntilDismissed,onClick:()=>de(qy(Jl)),children:"Reset"})]}),_.jsxs("label",{className:"auth-checkbox settings-checkbox",children:[_.jsx("input",{type:"checkbox",checked:ie.persistUntilDismissed,disabled:!ie.enabled,onChange:te=>de(AE(te.currentTarget.checked))}),"Keep toast until dismissed"]}),_.jsxs("div",{className:"settings-assets-header",children:[_.jsx("span",{children:"Toast videos"}),_.jsxs("span",{children:[nf(Q)," max"]})]}),_.jsx("input",{ref:he,type:"file",accept:"video/mp4,video/webm",className:"settings-asset-input","aria-label":"Upload toast video",onChange:te=>{Ke(te.currentTarget.files)}}),_.jsx("button",{type:"button",className:"secondary-button settings-upload-button",disabled:Se,onClick:()=>he.current?.click(),children:"Upload video"}),W?_.jsx("p",{className:"settings-error",children:W}):null,H.length>0?_.jsx("ul",{className:"settings-asset-list","aria-label":"Toast videos",children:H.map(te=>_.jsxs("li",{"data-enabled":Ce.has(te.id)?"true":"false",children:[_.jsxs("label",{className:"settings-asset-choice",children:[_.jsx("input",{type:"checkbox",checked:Ce.has(te.id),disabled:Se,"aria-label":`Use ${te.filename}`,onChange:je=>yt(te.id,je.currentTarget.checked)}),_.jsx("video",{src:te.url,muted:!0,autoPlay:!0,loop:!0,playsInline:!0,"aria-hidden":"true"}),_.jsxs("span",{className:"settings-asset-copy",children:[_.jsx("span",{children:te.filename}),_.jsx("small",{children:te.source==="built-in"?"Built-in":nf(te.size)})]})]}),te.source==="uploaded"?_.jsx("button",{type:"button",className:"secondary-button settings-asset-delete",disabled:Se,"aria-label":`Delete ${te.filename}`,onClick:()=>{Xe(te.id)},children:"x"}):null]},te.id))}):_.jsx("p",{className:"muted",children:"Built-in videos will be used."}),_.jsx("button",{type:"button",className:"secondary-button settings-save-assets-button",disabled:Se||H.length===0||!ze,onClick:()=>{mi()},children:"Save selected videos"})]}),_.jsx("div",{id:"settings-security",ref:te=>{me.current.security=te},className:"settings-section-group",children:_.jsx(RE,{api:c})}),_.jsx("div",{id:"settings-servers",ref:te=>{me.current.servers=te},className:"settings-section-group",children:_.jsx(p2,{api:c,...o?{onAgentRemoved:o}:{}})})]})]})]})})}function nf(e){return e>=1024*1024?`${Math.round(e/1024/1024*10)/10} MB`:e>=1024?`${Math.round(e/1024*10)/10} KB`:`${e} B`}function Pc(e){return e instanceof Error?e.message:"Request failed."}function v2(e,t){if(e.length!==t.length)return!1;const n=new Set(t);return e.every(a=>n.has(a))}class Dr extends Error{constructor(t,n){super(n),this.status=t,this.name="UploadClientError"}status}function g2(e){const t=e.createXhr?.()??new XMLHttpRequest,n=new FormData,a=e.files.map((o,c)=>({fieldName:`file${c}`,relativePath:o.relativePath,size:o.file.size}));n.append("manifest",JSON.stringify({terminalId:e.terminalId,entries:a}));for(const[o,c]of e.files.entries())n.append(`file${o}`,c.file);return new Promise((o,c)=>{let d=!1;const p=()=>{e.signal?.removeEventListener("abort",S)},m=y=>{d||(d=!0,p(),o(y))},f=y=>{d||(d=!0,p(),c(y))},S=()=>{t.abort(),f(new Dr(0,"Upload aborted."))};if(e.signal?.aborted){f(new Dr(0,"Upload aborted."));return}e.signal?.addEventListener("abort",S,{once:!0}),t.open("POST","/api/uploads"),t.withCredentials=!0,t.upload.onprogress=y=>{if(e.onProgress){if(y.lengthComputable&&y.total>0){e.onProgress({loaded:y.loaded,total:y.total,percent:Math.round(y.loaded/y.total*100)});return}e.onProgress({loaded:y.loaded,total:null,percent:null})}},t.onload=()=>{if(t.status>=200&&t.status<300){try{m(JSON.parse(t.responseText))}catch{f(new Dr(t.status,"Invalid upload response."))}return}f(new Dr(t.status,y2(t.responseText,t.statusText||`HTTP ${t.status}`)))},t.onerror=()=>f(new Dr(0,"Upload failed.")),t.onabort=()=>f(new Dr(0,"Upload aborted.")),t.ontimeout=()=>f(new Dr(0,"Upload timed out.")),t.send(n)})}function y2(e,t){try{const n=JSON.parse(e),a=typeof n.error=="string"?n.error:n.message;if(typeof a=="string"&&a.trim())return a}catch{}return t}const S2="modulepreload",b2=function(e){return"/"+e},$y={},f0=function(t,n,a){let o=Promise.resolve();if(n&&n.length>0){let m=function(f){return Promise.all(f.map(S=>Promise.resolve(S).then(y=>({status:"fulfilled",value:y}),y=>({status:"rejected",reason:y}))))};document.getElementsByTagName("link");const d=document.querySelector("meta[property=csp-nonce]"),p=d?.nonce||d?.getAttribute("nonce");o=m(n.map(f=>{if(f=b2(f),f in $y)return;$y[f]=!0;const S=f.endsWith(".css"),y=S?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${f}"]${y}`))return;const b=document.createElement("link");if(b.rel=S?"stylesheet":S2,S||(b.as="script"),b.crossOrigin="",b.href=f,p&&b.setAttribute("nonce",p),document.head.appendChild(b),S)return new Promise((x,C)=>{b.addEventListener("load",x),b.addEventListener("error",()=>C(new Error(`Unable to preload CSS for ${f}`)))})}))}function c(d){const p=new Event("vite:preloadError",{cancelable:!0});if(p.payload=d,window.dispatchEvent(p),!p.defaultPrevented)throw d}return o.then(d=>{for(const p of d||[])p.status==="rejected"&&c(p.reason);return t().catch(c)})},w2=g.lazy(()=>f0(()=>import("./MarkdownPreview-DkMcZHuI.js"),[]));function C2({api:e,activeTerminalId:t,activeTerminalCwd:n,onOpenFile:a}){const[o,c]=g.useState(null),[d,p]=g.useState(""),[m,f]=g.useState({}),[S,y]=g.useState(()=>new Set),[b,x]=g.useState(null),[C,k]=g.useState({type:"empty"}),[B,R]=g.useState("idle"),[re,F]=g.useState(null),J=g.useRef(null),ce=g.useRef(null),q=g.useRef(!1),I=g.useRef(0),ie=g.useRef(null);ie.current===null&&t&&(ie.current=t);const de=ie.current,j=t?af(t,n):null,$=o?[o.rootPath,d].filter(Boolean).join("/"):"",H=b?.path??null;g.useEffect(()=>(q.current=!0,()=>{q.current=!1,I.current+=1,ze()}),[]),g.useEffect(()=>{ie.current=t,ce.current=null;const ae=t?af(t,n):null;L(t,ae)},[e]),g.useEffect(()=>{if(!de||t!==de)return;const ae=af(de,n);ae!==ce.current&&L(de,ae)},[de,t,n]);async function L(ae,Ee=j){const xe=Ne();if(ce.current=Ee,ze(),c(null),p(""),f({}),y(new Set),x(null),k({type:"empty"}),F(null),!ae){R("idle");return}R("loading");try{const Ke=await e.createFileRoot({terminalId:ae});if(!Re(xe))return;c({rootToken:Ke.rootToken,rootPath:Ke.rootPath});const Xe=await e.listFiles({rootToken:Ke.rootToken,path:""});if(!Re(xe))return;M(Xe),R("idle")}catch(Ke){if(await Pe(Ke,xe))return;Re(xe)&&(F(Xn(Ke)),R("idle"))}}async function X(ae=d,Ee=o){if(!Ee)return;const xe=Ne();R("loading"),F(null);try{const Ke=await e.listFiles({rootToken:Ee.rootToken,path:ae});if(!Re(xe))return;M(Ke),R("idle")}catch(Ke){if(await Pe(Ke,xe))return;Re(xe)&&(F(Xn(Ke)),R("idle"))}}async function G(){ie.current=t,await L(t,j)}function M(ae){f(Ee=>({...Ee,[ae.path]:E2(ae.entries)}))}async function V(ae){if(!(!rf(ae)||!o)){if(x(ae),F(null),ae.kind==="directory"){p(ae.path),Ce(),await ve(ae);return}if(p(Rr(ae.path)),ae.editable){await E(ae);return}ae.previewKind!=="none"&&await ee(ae,ae.previewKind)}}async function Q(ae){if(!(!rf(ae)||!o)){if(x(ae),F(null),ae.kind==="directory"){p(ae.path),Ce(),await ve(ae);return}if(p(Rr(ae.path)),ae.editable){await W(ae);return}ae.previewKind!=="none"&&await ee(ae,ae.previewKind)}}async function ve(ae){if(S.has(ae.path)){y(Ee=>{const xe=new Set(Ee);return xe.delete(ae.path),xe});return}y(Ee=>new Set(Ee).add(ae.path)),await X(ae.path)}function Se(ae,Ee){ae.key==="Enter"&&(ae.preventDefault(),Q(Ee))}async function E(ae){if(!o)return;const Ee=Ne();R("loading"),ze();try{const xe=await e.readFile({rootToken:o.rootToken,path:ae.path});if(!Re(Ee))return;k({type:"text-preview",file:ae,read:xe}),R("idle")}catch(xe){if(await Pe(xe,Ee))return;Re(Ee)&&(F(Xn(xe)),R("idle"))}}async function W(ae){if(!o)return;const Ee=Ne();R("loading");try{await a({rootToken:o.rootToken,path:ae.path}),Re(Ee)&&R("idle")}catch(xe){if(await Pe(xe,Ee))return;Re(Ee)&&(F(Xn(xe)),R("idle"))}}async function ee(ae,Ee){if(!o)return;const xe=Ne();R("loading"),ze();try{const Ke=await e.previewFile({rootToken:o.rootToken,path:ae.path});if(!Re(xe))return;const Xe=URL.createObjectURL(Ke);if(!Re(xe)){URL.revokeObjectURL(Xe);return}J.current=Xe,k({type:"preview",file:ae,previewKind:Ee,url:Xe}),R("idle")}catch(Ke){if(await Pe(Ke,xe))return;Re(xe)&&(F(Xn(Ke)),R("idle"))}}async function he(ae){if(!o)return;const Ee=ae==="file"?"New file":"New folder",xe=window.prompt(Ee,""),Ke=b?b.kind==="directory"?b.path:Rr(b.path):d,Xe=Vy(xe,Ke);if(Xe){F(null);try{const gt=await e.createFileEntry({rootToken:o.rootToken,path:Xe,kind:ae});x(gt.entry),await X(Ke)}catch(gt){if(await Pe(gt))return;F(Xn(gt))}}}async function ge(){if(!o||!b)return;const ae=window.prompt("Move selected entry",b.path),Ee=Vy(ae,"");if(!Ee||Ee===b.path)return;const xe=Rr(b.path),Ke=Rr(Ee);F(null);try{const Xe=await e.moveFileEntry({rootToken:o.rootToken,sourcePath:b.path,destinationPath:Ee});x(Xe.entry),p(Xe.entry.kind==="directory"?Xe.entry.path:Rr(Xe.entry.path)),Ce(),await X(xe),Ke!==xe&&await X(Ke)}catch(Xe){if(await Pe(Xe))return;F(Xn(Xe))}}async function me(){if(!o||!b)return;const ae=b.path,Ee=Rr(ae);F(null);try{const xe=await e.previewDeleteFileEntry({rootToken:o.rootToken,path:b.path}),Ke=xe.descendantCount>0?` and ${xe.descendantCount} nested item${xe.descendantCount===1?"":"s"}`:"";if(!window.confirm(`Delete ${xe.path}${Ke}?`))return;await e.deleteFileEntry({rootToken:o.rootToken,path:b.path,previewToken:xe.previewToken}),x(null),p(Ee),y(Xe=>{const gt=new Set(Xe);for(const yt of Xe)(yt===ae||yt.startsWith(`${ae}/`))&&gt.delete(yt);return gt}),Ce(),await X(Ee)}catch(xe){if(await Pe(xe))return;F(Xn(xe))}}function Ce(){I.current+=1,ze(),k({type:"empty"})}function ze(){J.current&&(URL.revokeObjectURL(J.current),J.current=null)}function Ne(){return I.current+=1,I.current}function Re(ae){return q.current&&ae===I.current}async function Pe(ae,Ee){return T2(ae)?(Ee!==void 0&&!Re(Ee)||await L(t,j),!0):!1}function Ye(ae,Ee){const xe=rf(ae),Ke=ae.kind==="directory"&&S.has(ae.path),Xe=m[ae.path]??[],gt={"--file-tree-depth":Ee};return _.jsxs(xi.Fragment,{children:[_.jsxs("button",{type:"button",className:"file-entry-button","data-kind":ae.kind,"data-expanded":Ke,"data-active":H===ae.path,disabled:!xe,style:gt,"aria-expanded":ae.kind==="directory"?Ke:void 0,"aria-label":`${ae.kind==="directory"?"Open folder":"Open file"} ${ae.name}`,title:ae.kind==="directory"?"Expand or collapse folder":"Click to preview. Double-click or press Enter to open.",onClick:()=>{V(ae)},onDoubleClick:()=>{Q(ae)},onKeyDown:yt=>Se(yt,ae),children:[_.jsx("span",{className:"file-entry-disclosure","aria-hidden":"true",children:ae.kind==="directory"?Ke?"▾":"▸":""}),_.jsx("span",{className:"file-entry-name",children:ae.name}),_.jsx("small",{children:x2(ae)})]}),Ke?_.jsx("div",{className:"file-tree-children",role:"group",children:Xe.map(yt=>Ye(yt,Ee+1))}):null]},ae.path)}const Be=m[""]??[];return _.jsxs("section",{className:"file-explorer","aria-label":"Files","aria-busy":B==="loading",children:[_.jsxs("header",{className:"file-explorer-header",children:[_.jsx("div",{className:"file-explorer-path",title:$,children:$||"No active pane"}),_.jsxs("div",{className:"file-explorer-toolbar","aria-label":"File actions",children:[_.jsx("button",{type:"button","aria-label":"Refresh files",title:"Refresh",disabled:!t,onClick:()=>{G()},children:"↻"}),_.jsx("button",{type:"button","aria-label":"New file",title:"New file",disabled:!o,onClick:()=>{he("file")},children:"+"}),_.jsx("button",{type:"button","aria-label":"New folder",title:"New folder",disabled:!o,onClick:()=>{he("directory")},children:"▣"})]})]}),re?_.jsx("div",{className:"file-explorer-alert",role:"alert",children:re}):null,_.jsxs("div",{className:"file-explorer-layout",children:[_.jsx("div",{className:"file-tree","aria-label":$?`Files in ${$}`:"Files",children:Be.map(ae=>Ye(ae,0))}),_.jsxs("section",{className:"file-detail","aria-label":"File detail",children:[_.jsxs("div",{className:"file-detail-header",children:[_.jsx("strong",{children:b?.name??"detail"}),_.jsxs("div",{className:"file-detail-actions",children:[_.jsx("button",{type:"button","aria-label":"Move selected entry",disabled:!b,onClick:()=>{ge()},children:"Move"}),_.jsx("button",{type:"button","aria-label":"Delete selected entry",disabled:!b,onClick:()=>{me()},children:"Delete"})]})]}),B==="loading"?_.jsx("div",{className:"file-detail-empty",children:"loading"}):null,C.type==="empty"&&B!=="loading"?_.jsx("div",{className:"file-detail-empty",children:"No file selected"}):null,C.type==="preview"?_.jsxs("div",{className:"file-preview-frame",children:[C.previewKind==="image"?_.jsx("img",{src:C.url,alt:C.file.name}):null,C.previewKind==="pdf"?_.jsx("iframe",{src:C.url,title:C.file.name}):null]}):null,C.type==="text-preview"&&C.read.language==="markdown"?_.jsx("div",{className:"file-markdown-preview","aria-label":`Preview for ${C.file.name}`,children:_.jsx(g.Suspense,{fallback:_.jsx("div",{className:"file-markdown-preview-loading",children:"loading preview"}),children:_.jsx(w2,{content:C.read.content})})}):null,C.type==="text-preview"&&C.read.language==="text"?_.jsx("pre",{className:"file-text-preview","aria-label":`Preview for ${C.file.name}`,children:C.read.content}):null]})]})]})}function rf(e){return e.kind==="directory"||e.editable||e.previewKind!=="none"}function x2(e){return e.kind==="directory"?"dir":e.editable?"edit":e.previewKind!=="none"?e.previewKind:"unsupported"}function af(e,t){return`${e}\0${t??""}`}function E2(e){return[...e].sort((t,n)=>t.kind==="directory"&&n.kind!=="directory"?-1:t.kind!=="directory"&&n.kind==="directory"?1:t.name.localeCompare(n.name))}function Rr(e){const t=e.split("/").filter(Boolean);return t.pop(),t.join("/")}function Vy(e,t){if(e===null)return null;const n=e.trim().replace(/^\/+/,"").replace(/\/{2,}/g,"/").replace(/\/$/,"");return n?!t||n.includes("/")?n:`${t}/${n}`:null}function Xn(e){return e instanceof Error?e.message:"Request failed"}function T2(e){return e instanceof yn&&e.status===409&&e.message==="terminal_cwd_changed"}const k2=g.lazy(()=>f0(()=>import("./MarkdownPreview-DkMcZHuI.js"),[]));function Xy({api:e,editor:t,canClose:n,onClose:a}){const[o,c]=g.useState(t.read),[d,p]=g.useState(t.read.content),[m,f]=g.useState("idle"),[S,y]=g.useState(null),[b,x]=g.useState(!1),[C,k]=g.useState("edit"),B=g.useRef(t),R=g.useRef(t.read),re=g.useRef(t.read.content),F=g.useRef(!1),J=g.useRef(!1),ce=g.useRef(0),q=d!==o.content&&m!=="saving"&&!b;g.useEffect(()=>(J.current=!0,()=>{J.current=!1,ce.current+=1}),[]),g.useEffect(()=>{ce.current+=1,F.current=!1,B.current=t,R.current=t.read,re.current=t.read.content,c(t.read),p(t.read.content),f("idle"),y(null),x(!1),k("edit")},[t.id,t.read]),g.useEffect(()=>{B.current=t},[t]),g.useEffect(()=>{R.current=o},[o]),g.useEffect(()=>{re.current=d},[d]),g.useEffect(()=>{if(d===o.content||b)return;const $=window.setInterval(()=>{!F.current&&re.current!==R.current.content&&I()},1e3);return()=>window.clearInterval($)},[d===o.content,b,t.id]);async function I(){if(F.current)return;const $=re.current,H=R.current;if($===H.content)return;const L=B.current,X=ce.current;F.current=!0,f("saving"),y(null),x(!1);try{const G=await e.writeFile({rootToken:L.rootToken,path:L.path,content:$,expectedVersion:H.version});if(!J.current||X!==ce.current)return;const M={...H,content:$,version:G.version};R.current=M,c(M),f(re.current===$?"saved":"idle")}catch(G){if(!J.current||X!==ce.current)return;if(G instanceof yn&&G.status===409){x(!0),f("idle");return}y(D2(G)),f("idle")}finally{X===ce.current&&(F.current=!1)}}const ie=m==="saving"?"saving":m==="saved"?"saved":o.language,de=o.language==="markdown",j=de&&C==="preview";return _.jsxs("section",{className:"editor-pane","aria-label":`Editor pane ${t.title}`,children:[_.jsxs("header",{className:"editor-pane-header",children:[_.jsx("span",{className:"terminal-pane-dot","aria-hidden":"true"}),_.jsx("strong",{children:t.title}),_.jsx("span",{className:"terminal-pane-spacer"}),_.jsx("span",{className:"terminal-pane-state",children:ie}),_.jsx("button",{type:"button","aria-label":`Save ${t.title}`,disabled:!q,onClick:()=>{I()},children:"Save"}),de?_.jsx("button",{type:"button","aria-label":`${j?"Edit":"Preview"} ${t.title}`,onClick:()=>k($=>$==="preview"?"edit":"preview"),children:j?"Edit":"Preview"}):null,n?_.jsx("button",{type:"button",className:"terminal-pane-close","aria-label":`Close editor ${t.title}`,onClick:a,children:"x"}):null]}),S?_.jsx("div",{className:"editor-pane-alert",role:"alert",children:S}):null,b?_.jsx("div",{className:"editor-pane-alert",role:"alert",children:"File changed on disk."}):null,j?_.jsx("div",{className:"editor-markdown-preview","aria-label":`Markdown preview for ${t.title}`,children:_.jsx(g.Suspense,{fallback:_.jsx("div",{className:"editor-markdown-preview-loading",children:"loading preview"}),children:_.jsx(k2,{content:d})})}):_.jsx("textarea",{className:"editor-pane-textarea","aria-label":`Editor for ${t.title}`,spellCheck:!1,value:d,onChange:$=>{const H=$.target.value;re.current=H,p(H),f("idle"),y(null),x(!1)}})]})}function D2(e){return e instanceof Error?e.message:"Request failed"}var R2=2,M2=1,A2=class{activate(e){this._terminal=e}dispose(){}fit(){let e=this.proposeDimensions();if(!e||!this._terminal||isNaN(e.cols)||isNaN(e.rows))return;let t=this._terminal._core;(this._terminal.rows!==e.rows||this._terminal.cols!==e.cols)&&(t._renderService.clear(),this._terminal.resize(e.cols,e.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;let e=this._terminal._core._renderService.dimensions;if(e.css.cell.width===0||e.css.cell.height===0)return;let t=this._terminal.options.scrollback===0?0:this._terminal.options.overviewRuler?.width||14,n=window.getComputedStyle(this._terminal.element.parentElement),a=parseInt(n.getPropertyValue("height")),o=Math.max(0,parseInt(n.getPropertyValue("width"))),c=window.getComputedStyle(this._terminal.element),d={top:parseInt(c.getPropertyValue("padding-top")),bottom:parseInt(c.getPropertyValue("padding-bottom")),right:parseInt(c.getPropertyValue("padding-right")),left:parseInt(c.getPropertyValue("padding-left"))},p=d.top+d.bottom,m=d.right+d.left,f=a-p,S=o-m-t;return{cols:Math.max(R2,Math.floor(S/e.css.cell.width)),rows:Math.max(M2,Math.floor(f/e.css.cell.height))}}};var p0=Object.defineProperty,N2=Object.getOwnPropertyDescriptor,B2=(e,t)=>{for(var n in t)p0(e,n,{get:t[n],enumerable:!0})},Ht=(e,t,n,a)=>{for(var o=a>1?void 0:a?N2(t,n):t,c=e.length-1,d;c>=0;c--)(d=e[c])&&(o=(a?d(t,n,o):d(o))||o);return a&&o&&p0(t,n,o),o},ye=(e,t)=>(n,a)=>t(n,a,e),Gy="Terminal input",Vf={get:()=>Gy,set:e=>Gy=e},Zy="Too much output to announce, navigate to rows manually to read",Xf={get:()=>Zy,set:e=>Zy=e};function L2(e){return e.replace(/\r?\n/g,"\r")}function O2(e,t){return t?"\x1B[200~"+e+"\x1B[201~":e}function z2(e,t){e.clipboardData&&e.clipboardData.setData("text/plain",t.selectionText),e.preventDefault()}function j2(e,t,n,a){if(e.stopPropagation(),e.clipboardData){let o=e.clipboardData.getData("text/plain");m0(o,t,n,a)}}function m0(e,t,n,a){e=L2(e),e=O2(e,n.decPrivateModes.bracketedPasteMode&&a.rawOptions.ignoreBracketedPasteMode!==!0),n.triggerDataEvent(e,!0),t.value=""}function _0(e,t,n){let a=n.getBoundingClientRect(),o=e.clientX-a.left-10,c=e.clientY-a.top-10;t.style.width="20px",t.style.height="20px",t.style.left=`${o}px`,t.style.top=`${c}px`,t.style.zIndex="1000",t.focus()}function Qy(e,t,n,a,o){_0(e,t,n),o&&a.rightClickSelect(e),t.value=a.selectionText,t.select()}function tr(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}function Au(e,t=0,n=e.length){let a="";for(let o=t;o<n;++o){let c=e[o];c>65535?(c-=65536,a+=String.fromCharCode((c>>10)+55296)+String.fromCharCode(c%1024+56320)):a+=String.fromCharCode(c)}return a}var H2=class{constructor(){this._interim=0}clear(){this._interim=0}decode(e,t){let n=e.length;if(!n)return 0;let a=0,o=0;if(this._interim){let c=e.charCodeAt(o++);56320<=c&&c<=57343?t[a++]=(this._interim-55296)*1024+c-56320+65536:(t[a++]=this._interim,t[a++]=c),this._interim=0}for(let c=o;c<n;++c){let d=e.charCodeAt(c);if(55296<=d&&d<=56319){if(++c>=n)return this._interim=d,a;let p=e.charCodeAt(c);56320<=p&&p<=57343?t[a++]=(d-55296)*1024+p-56320+65536:(t[a++]=d,t[a++]=p);continue}d!==65279&&(t[a++]=d)}return a}},U2=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(e,t){let n=e.length;if(!n)return 0;let a=0,o,c,d,p,m=0,f=0;if(this.interim[0]){let b=!1,x=this.interim[0];x&=(x&224)===192?31:(x&240)===224?15:7;let C=0,k;for(;(k=this.interim[++C]&63)&&C<4;)x<<=6,x|=k;let B=(this.interim[0]&224)===192?2:(this.interim[0]&240)===224?3:4,R=B-C;for(;f<R;){if(f>=n)return 0;if(k=e[f++],(k&192)!==128){f--,b=!0;break}else this.interim[C++]=k,x<<=6,x|=k&63}b||(B===2?x<128?f--:t[a++]=x:B===3?x<2048||x>=55296&&x<=57343||x===65279||(t[a++]=x):x<65536||x>1114111||(t[a++]=x)),this.interim.fill(0)}let S=n-4,y=f;for(;y<n;){for(;y<S&&!((o=e[y])&128)&&!((c=e[y+1])&128)&&!((d=e[y+2])&128)&&!((p=e[y+3])&128);)t[a++]=o,t[a++]=c,t[a++]=d,t[a++]=p,y+=4;if(o=e[y++],o<128)t[a++]=o;else if((o&224)===192){if(y>=n)return this.interim[0]=o,a;if(c=e[y++],(c&192)!==128){y--;continue}if(m=(o&31)<<6|c&63,m<128){y--;continue}t[a++]=m}else if((o&240)===224){if(y>=n)return this.interim[0]=o,a;if(c=e[y++],(c&192)!==128){y--;continue}if(y>=n)return this.interim[0]=o,this.interim[1]=c,a;if(d=e[y++],(d&192)!==128){y--;continue}if(m=(o&15)<<12|(c&63)<<6|d&63,m<2048||m>=55296&&m<=57343||m===65279)continue;t[a++]=m}else if((o&248)===240){if(y>=n)return this.interim[0]=o,a;if(c=e[y++],(c&192)!==128){y--;continue}if(y>=n)return this.interim[0]=o,this.interim[1]=c,a;if(d=e[y++],(d&192)!==128){y--;continue}if(y>=n)return this.interim[0]=o,this.interim[1]=c,this.interim[2]=d,a;if(p=e[y++],(p&192)!==128){y--;continue}if(m=(o&7)<<18|(c&63)<<12|(d&63)<<6|p&63,m<65536||m>1114111)continue;t[a++]=m}}return a}},v0="",sr=" ",Co=class g0{constructor(){this.fg=0,this.bg=0,this.extended=new pu}static toColorRGB(t){return[t>>>16&255,t>>>8&255,t&255]}static fromColorRGB(t){return(t[0]&255)<<16|(t[1]&255)<<8|t[2]&255}clone(){let t=new g0;return t.fg=this.fg,t.bg=this.bg,t.extended=this.extended.clone(),t}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}},pu=class y0{constructor(t=0,n=0){this._ext=0,this._urlId=0,this._ext=t,this._urlId=n}get ext(){return this._urlId?this._ext&-469762049|this.underlineStyle<<26:this._ext}set ext(t){this._ext=t}get underlineStyle(){return this._urlId?5:(this._ext&469762048)>>26}set underlineStyle(t){this._ext&=-469762049,this._ext|=t<<26&469762048}get underlineColor(){return this._ext&67108863}set underlineColor(t){this._ext&=-67108864,this._ext|=t&67108863}get urlId(){return this._urlId}set urlId(t){this._urlId=t}get underlineVariantOffset(){let t=(this._ext&3758096384)>>29;return t<0?t^4294967288:t}set underlineVariantOffset(t){this._ext&=536870911,this._ext|=t<<29&3758096384}clone(){return new y0(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},xs=class S0 extends Co{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new pu,this.combinedData=""}static fromCharData(t){let n=new S0;return n.setFromCharData(t),n}isCombined(){return this.content&2097152}getWidth(){return this.content>>22}getChars(){return this.content&2097152?this.combinedData:this.content&2097151?tr(this.content&2097151):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):this.content&2097151}setFromCharData(t){this.fg=t[0],this.bg=0;let n=!1;if(t[1].length>2)n=!0;else if(t[1].length===2){let a=t[1].charCodeAt(0);if(55296<=a&&a<=56319){let o=t[1].charCodeAt(1);56320<=o&&o<=57343?this.content=(a-55296)*1024+o-56320+65536|t[2]<<22:n=!0}else n=!0}else this.content=t[1].charCodeAt(0)|t[2]<<22;n&&(this.combinedData=t[1],this.content=2097152|t[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},Jy="di$target",Gf="di$dependencies",lf=new Map;function P2(e){return e[Gf]||[]}function pi(e){if(lf.has(e))return lf.get(e);let t=function(n,a,o){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");K2(t,n,o)};return t._id=e,lf.set(e,t),t}function K2(e,t,n){t[Jy]===t?t[Gf].push({id:e,index:n}):(t[Gf]=[{id:e,index:n}],t[Jy]=t)}var Oi=pi("BufferService"),b0=pi("CoreMouseService"),Pr=pi("CoreService"),I2=pi("CharsetService"),gm=pi("InstantiationService"),w0=pi("LogService"),zi=pi("OptionsService"),C0=pi("OscLinkService"),F2=pi("UnicodeService"),xo=pi("DecorationService"),Zf=class{constructor(e,t,n){this._bufferService=e,this._optionsService=t,this._oscLinkService=n}provideLinks(e,t){let n=this._bufferService.buffer.lines.get(e-1);if(!n){t(void 0);return}let a=[],o=this._optionsService.rawOptions.linkHandler,c=new xs,d=n.getTrimmedLength(),p=-1,m=-1,f=!1;for(let S=0;S<d;S++)if(!(m===-1&&!n.hasContent(S))){if(n.loadCell(S,c),c.hasExtendedAttrs()&&c.extended.urlId)if(m===-1){m=S,p=c.extended.urlId;continue}else f=c.extended.urlId!==p;else m!==-1&&(f=!0);if(f||m!==-1&&S===d-1){let y=this._oscLinkService.getLinkData(p)?.uri;if(y){let b={start:{x:m+1,y:e},end:{x:S+(!f&&S===d-1?1:0),y:e}},x=!1;if(!o?.allowNonHttpProtocols)try{let C=new URL(y);["http:","https:"].includes(C.protocol)||(x=!0)}catch{x=!0}x||a.push({text:y,range:b,activate:(C,k)=>o?o.activate(C,k,b):q2(C,k),hover:(C,k)=>o?.hover?.(C,k,b),leave:(C,k)=>o?.leave?.(C,k,b)})}f=!1,c.hasExtendedAttrs()&&c.extended.urlId?(m=S,p=c.extended.urlId):(m=-1,p=-1)}}t(a)}};Zf=Ht([ye(0,Oi),ye(1,zi),ye(2,C0)],Zf);function q2(e,t){if(confirm(`Do you want to navigate to ${t}?
13
+ `},ux={onDragStart(e){let{active:t}=e;return"Picked up draggable item "+t.id+"."},onDragOver(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was moved over droppable area "+n.id+".":"Draggable item "+t.id+" is no longer over a droppable area."},onDragEnd(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was dropped over droppable area "+n.id:"Draggable item "+t.id+" was dropped."},onDragCancel(e){let{active:t}=e;return"Dragging was cancelled. Draggable item "+t.id+" was dropped."}};function hx(e){let{announcements:t=ux,container:n,hiddenTextDescribedById:a,screenReaderInstructions:o=cx}=e;const{announce:c,announcement:d}=ax(),p=ku("DndLiveRegion"),[m,f]=g.useState(!1);if(g.useEffect(()=>{f(!0)},[]),lx(g.useMemo(()=>({onDragStart(y){let{active:b}=y;c(t.onDragStart({active:b}))},onDragMove(y){let{active:b,over:x}=y;t.onDragMove&&c(t.onDragMove({active:b,over:x}))},onDragOver(y){let{active:b,over:x}=y;c(t.onDragOver({active:b,over:x}))},onDragEnd(y){let{active:b,over:x}=y;c(t.onDragEnd({active:b,over:x}))},onDragCancel(y){let{active:b,over:x}=y;c(t.onDragCancel({active:b,over:x}))}}),[c,t])),!m)return null;const S=xi.createElement(xi.Fragment,null,xi.createElement(nx,{id:a,value:o.draggable}),xi.createElement(rx,{id:p,announcement:d}));return n?Il.createPortal(S,n):S}var ni;(function(e){e.DragStart="dragStart",e.DragMove="dragMove",e.DragEnd="dragEnd",e.DragCancel="dragCancel",e.DragOver="dragOver",e.RegisterDroppable="registerDroppable",e.SetDroppableDisabled="setDroppableDisabled",e.UnregisterDroppable="unregisterDroppable"})(ni||(ni={}));function cu(){}function ky(e,t){return g.useMemo(()=>({sensor:e,options:t??{}}),[e,t])}function dx(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return g.useMemo(()=>[...t].filter(a=>a!=null),[...t])}const Ns=Object.freeze({x:0,y:0});function fx(e,t){let{data:{value:n}}=e,{data:{value:a}}=t;return a-n}function px(e,t){if(!e||e.length===0)return null;const[n]=e;return n[t]}function mx(e,t){const n=Math.max(t.top,e.top),a=Math.max(t.left,e.left),o=Math.min(t.left+t.width,e.left+e.width),c=Math.min(t.top+t.height,e.top+e.height),d=o-a,p=c-n;if(a<o&&n<c){const m=t.width*t.height,f=e.width*e.height,S=d*p,y=S/(m+f-S);return Number(y.toFixed(4))}return 0}const _x=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:a}=e;const o=[];for(const c of a){const{id:d}=c,p=n.get(d);if(p){const m=mx(p,t);m>0&&o.push({id:d,data:{droppableContainer:c,value:m}})}}return o.sort(fx)};function vx(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function Db(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:Ns}function gx(e){return function(n){for(var a=arguments.length,o=new Array(a>1?a-1:0),c=1;c<a;c++)o[c-1]=arguments[c];return o.reduce((d,p)=>({...d,top:d.top+e*p.y,bottom:d.bottom+e*p.y,left:d.left+e*p.x,right:d.right+e*p.x}),{...n})}}const yx=gx(1);function Sx(e){if(e.startsWith("matrix3d(")){const t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}else if(e.startsWith("matrix(")){const t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}function bx(e,t,n){const a=Sx(t);if(!a)return e;const{scaleX:o,scaleY:c,x:d,y:p}=a,m=e.left-d-(1-o)*parseFloat(n),f=e.top-p-(1-c)*parseFloat(n.slice(n.indexOf(" ")+1)),S=o?e.width/o:e.width,y=c?e.height/c:e.height;return{width:S,height:y,top:f,right:m+S,bottom:f+y,left:m}}const wx={ignoreTransform:!1};function bo(e,t){t===void 0&&(t=wx);let n=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:f,transformOrigin:S}=$i(e).getComputedStyle(e);f&&(n=bx(n,f,S))}const{top:a,left:o,width:c,height:d,bottom:p,right:m}=n;return{top:a,left:o,width:c,height:d,bottom:p,right:m}}function Dy(e){return bo(e,{ignoreTransform:!0})}function Cx(e){const t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function xx(e,t){return t===void 0&&(t=$i(e).getComputedStyle(e)),t.position==="fixed"}function Ex(e,t){t===void 0&&(t=$i(e).getComputedStyle(e));const n=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(o=>{const c=t[o];return typeof c=="string"?n.test(c):!1})}function Zp(e,t){const n=[];function a(o){if(t!=null&&n.length>=t||!o)return n;if(Xp(o)&&o.scrollingElement!=null&&!n.includes(o.scrollingElement))return n.push(o.scrollingElement),n;if(!yo(o)||xb(o)||n.includes(o))return n;const c=$i(e).getComputedStyle(o);return o!==e&&Ex(o,c)&&n.push(o),xx(o,c)?n:a(o.parentNode)}return e?a(e):n}function Rb(e){const[t]=Zp(e,1);return t??null}function Gd(e){return!Tu||!e?null:za(e)?e:Vp(e)?Xp(e)||e===ja(e).scrollingElement?window:yo(e)?e:null:null}function Mb(e){return za(e)?e.scrollX:e.scrollLeft}function Ab(e){return za(e)?e.scrollY:e.scrollTop}function kf(e){return{x:Mb(e),y:Ab(e)}}var ui;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(ui||(ui={}));function Nb(e){return!Tu||!e?!1:e===document.scrollingElement}function Bb(e){const t={x:0,y:0},n=Nb(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},a={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height},o=e.scrollTop<=t.y,c=e.scrollLeft<=t.x,d=e.scrollTop>=a.y,p=e.scrollLeft>=a.x;return{isTop:o,isLeft:c,isBottom:d,isRight:p,maxScroll:a,minScroll:t}}const Tx={x:.2,y:.2};function kx(e,t,n,a,o){let{top:c,left:d,right:p,bottom:m}=n;a===void 0&&(a=10),o===void 0&&(o=Tx);const{isTop:f,isBottom:S,isLeft:y,isRight:b}=Bb(e),x={x:0,y:0},C={x:0,y:0},k={height:t.height*o.y,width:t.width*o.x};return!f&&c<=t.top+k.height?(x.y=ui.Backward,C.y=a*Math.abs((t.top+k.height-c)/k.height)):!S&&m>=t.bottom-k.height&&(x.y=ui.Forward,C.y=a*Math.abs((t.bottom-k.height-m)/k.height)),!b&&p>=t.right-k.width?(x.x=ui.Forward,C.x=a*Math.abs((t.right-k.width-p)/k.width)):!y&&d<=t.left+k.width&&(x.x=ui.Backward,C.x=a*Math.abs((t.left+k.width-d)/k.width)),{direction:x,speed:C}}function Dx(e){if(e===document.scrollingElement){const{innerWidth:c,innerHeight:d}=window;return{top:0,left:0,right:c,bottom:d,width:c,height:d}}const{top:t,left:n,right:a,bottom:o}=e.getBoundingClientRect();return{top:t,left:n,right:a,bottom:o,width:e.clientWidth,height:e.clientHeight}}function Lb(e){return e.reduce((t,n)=>Aa(t,kf(n)),Ns)}function Rx(e){return e.reduce((t,n)=>t+Mb(n),0)}function Mx(e){return e.reduce((t,n)=>t+Ab(n),0)}function Ax(e,t){if(t===void 0&&(t=bo),!e)return;const{top:n,left:a,bottom:o,right:c}=t(e);Rb(e)&&(o<=0||c<=0||n>=window.innerHeight||a>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const Nx=[["x",["left","right"],Rx],["y",["top","bottom"],Mx]];class Qp{constructor(t,n){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const a=Zp(n),o=Lb(a);this.rect={...t},this.width=t.width,this.height=t.height;for(const[c,d,p]of Nx)for(const m of d)Object.defineProperty(this,m,{get:()=>{const f=p(a),S=o[c]-f;return this.rect[m]+S},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class Gl{constructor(t){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(n=>{var a;return(a=this.target)==null?void 0:a.removeEventListener(...n)})},this.target=t}add(t,n,a){var o;(o=this.target)==null||o.addEventListener(t,n,a),this.listeners.push([t,n,a])}}function Bx(e){const{EventTarget:t}=$i(e);return e instanceof t?e:ja(e)}function Zd(e,t){const n=Math.abs(e.x),a=Math.abs(e.y);return typeof t=="number"?Math.sqrt(n**2+a**2)>t:"x"in t&&"y"in t?n>t.x&&a>t.y:"x"in t?n>t.x:"y"in t?a>t.y:!1}var bs;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(bs||(bs={}));function Ry(e){e.preventDefault()}function Lx(e){e.stopPropagation()}var vt;(function(e){e.Space="Space",e.Down="ArrowDown",e.Right="ArrowRight",e.Left="ArrowLeft",e.Up="ArrowUp",e.Esc="Escape",e.Enter="Enter",e.Tab="Tab"})(vt||(vt={}));const Ob={start:[vt.Space,vt.Enter],cancel:[vt.Esc],end:[vt.Space,vt.Enter,vt.Tab]},Ox=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case vt.Right:return{...n,x:n.x+25};case vt.Left:return{...n,x:n.x-25};case vt.Down:return{...n,y:n.y+25};case vt.Up:return{...n,y:n.y-25}}};class zb{constructor(t){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=t;const{event:{target:n}}=t;this.props=t,this.listeners=new Gl(ja(n)),this.windowListeners=new Gl($i(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(bs.Resize,this.handleCancel),this.windowListeners.add(bs.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(bs.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:n}=this.props,a=t.node.current;a&&Ax(a),n(Ns)}handleKeyDown(t){if(Tb(t)){const{active:n,context:a,options:o}=this.props,{keyboardCodes:c=Ob,coordinateGetter:d=Ox,scrollBehavior:p="smooth"}=o,{code:m}=t;if(c.end.includes(m)){this.handleEnd(t);return}if(c.cancel.includes(m)){this.handleCancel(t);return}const{collisionRect:f}=a.current,S=f?{x:f.left,y:f.top}:Ns;this.referenceCoordinates||(this.referenceCoordinates=S);const y=d(t,{active:n,context:a.current,currentCoordinates:S});if(y){const b=ou(y,S),x={x:0,y:0},{scrollableAncestors:C}=a.current;for(const k of C){const B=t.code,{isTop:R,isRight:re,isLeft:F,isBottom:J,maxScroll:ce,minScroll:q}=Bb(k),I=Dx(k),ie={x:Math.min(B===vt.Right?I.right-I.width/2:I.right,Math.max(B===vt.Right?I.left:I.left+I.width/2,y.x)),y:Math.min(B===vt.Down?I.bottom-I.height/2:I.bottom,Math.max(B===vt.Down?I.top:I.top+I.height/2,y.y))},de=B===vt.Right&&!re||B===vt.Left&&!F,j=B===vt.Down&&!J||B===vt.Up&&!R;if(de&&ie.x!==y.x){const $=k.scrollLeft+b.x,H=B===vt.Right&&$<=ce.x||B===vt.Left&&$>=q.x;if(H&&!b.y){k.scrollTo({left:$,behavior:p});return}H?x.x=k.scrollLeft-$:x.x=B===vt.Right?k.scrollLeft-ce.x:k.scrollLeft-q.x,x.x&&k.scrollBy({left:-x.x,behavior:p});break}else if(j&&ie.y!==y.y){const $=k.scrollTop+b.y,H=B===vt.Down&&$<=ce.y||B===vt.Up&&$>=q.y;if(H&&!b.x){k.scrollTo({top:$,behavior:p});return}H?x.y=k.scrollTop-$:x.y=B===vt.Down?k.scrollTop-ce.y:k.scrollTop-q.y,x.y&&k.scrollBy({top:-x.y,behavior:p});break}}this.handleMove(t,Aa(ou(y,this.referenceCoordinates),x))}}}handleMove(t,n){const{onMove:a}=this.props;t.preventDefault(),a(n)}handleEnd(t){const{onEnd:n}=this.props;t.preventDefault(),this.detach(),n()}handleCancel(t){const{onCancel:n}=this.props;t.preventDefault(),this.detach(),n()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}zb.activators=[{eventName:"onKeyDown",handler:(e,t,n)=>{let{keyboardCodes:a=Ob,onActivation:o}=t,{active:c}=n;const{code:d}=e.nativeEvent;if(a.start.includes(d)){const p=c.activatorNode.current;return p&&e.target!==p?!1:(e.preventDefault(),o?.({event:e.nativeEvent}),!0)}return!1}}];function My(e){return!!(e&&"distance"in e)}function Ay(e){return!!(e&&"delay"in e)}class Jp{constructor(t,n,a){var o;a===void 0&&(a=Bx(t.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=t,this.events=n;const{event:c}=t,{target:d}=c;this.props=t,this.events=n,this.document=ja(d),this.documentListeners=new Gl(this.document),this.listeners=new Gl(a),this.windowListeners=new Gl($i(d)),this.initialCoordinates=(o=Ef(c))!=null?o:Ns,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:t,props:{options:{activationConstraint:n,bypassActivationConstraint:a}}}=this;if(this.listeners.add(t.move.name,this.handleMove,{passive:!1}),this.listeners.add(t.end.name,this.handleEnd),t.cancel&&this.listeners.add(t.cancel.name,this.handleCancel),this.windowListeners.add(bs.Resize,this.handleCancel),this.windowListeners.add(bs.DragStart,Ry),this.windowListeners.add(bs.VisibilityChange,this.handleCancel),this.windowListeners.add(bs.ContextMenu,Ry),this.documentListeners.add(bs.Keydown,this.handleKeydown),n){if(a!=null&&a({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(Ay(n)){this.timeoutId=setTimeout(this.handleStart,n.delay),this.handlePending(n);return}if(My(n)){this.handlePending(n);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(t,n){const{active:a,onPending:o}=this.props;o(a,t,this.initialCoordinates,n)}handleStart(){const{initialCoordinates:t}=this,{onStart:n}=this.props;t&&(this.activated=!0,this.documentListeners.add(bs.Click,Lx,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(bs.SelectionChange,this.removeTextSelection),n(t))}handleMove(t){var n;const{activated:a,initialCoordinates:o,props:c}=this,{onMove:d,options:{activationConstraint:p}}=c;if(!o)return;const m=(n=Ef(t))!=null?n:Ns,f=ou(o,m);if(!a&&p){if(My(p)){if(p.tolerance!=null&&Zd(f,p.tolerance))return this.handleCancel();if(Zd(f,p.distance))return this.handleStart()}if(Ay(p)&&Zd(f,p.tolerance))return this.handleCancel();this.handlePending(p,f);return}t.cancelable&&t.preventDefault(),d(m)}handleEnd(){const{onAbort:t,onEnd:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleCancel(){const{onAbort:t,onCancel:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleKeydown(t){t.code===vt.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const zx={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class jb extends Jp{constructor(t){const{event:n}=t,a=ja(n.target);super(t,zx,a)}}jb.activators=[{eventName:"onPointerDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:a}=t;return!n.isPrimary||n.button!==0?!1:(a?.({event:n}),!0)}}];const jx={move:{name:"mousemove"},end:{name:"mouseup"}};var Df;(function(e){e[e.RightClick=2]="RightClick"})(Df||(Df={}));class Hb extends Jp{constructor(t){super(t,jx,ja(t.event.target))}}Hb.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:a}=t;return n.button===Df.RightClick?!1:(a?.({event:n}),!0)}}];const Qd={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class Ub extends Jp{constructor(t){super(t,Qd)}static setup(){return window.addEventListener(Qd.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(Qd.move.name,t)};function t(){}}}Ub.activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:a}=t;const{touches:o}=n;return o.length>1?!1:(a?.({event:n}),!0)}}];var Zl;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(Zl||(Zl={}));var uu;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(uu||(uu={}));function Hx(e){let{acceleration:t,activator:n=Zl.Pointer,canScroll:a,draggingRect:o,enabled:c,interval:d=5,order:p=uu.TreeOrder,pointerCoordinates:m,scrollableAncestors:f,scrollableAncestorRects:S,delta:y,threshold:b}=e;const x=Px({delta:y,disabled:!c}),[C,k]=JC(),B=g.useRef({x:0,y:0}),R=g.useRef({x:0,y:0}),re=g.useMemo(()=>{switch(n){case Zl.Pointer:return m?{top:m.y,bottom:m.y,left:m.x,right:m.x}:null;case Zl.DraggableRect:return o}},[n,o,m]),F=g.useRef(null),J=g.useCallback(()=>{const q=F.current;if(!q)return;const I=B.current.x*R.current.x,ie=B.current.y*R.current.y;q.scrollBy(I,ie)},[]),ce=g.useMemo(()=>p===uu.TreeOrder?[...f].reverse():f,[p,f]);g.useEffect(()=>{if(!c||!f.length||!re){k();return}for(const q of ce){if(a?.(q)===!1)continue;const I=f.indexOf(q),ie=S[I];if(!ie)continue;const{direction:de,speed:j}=kx(q,ie,re,t,b);for(const $ of["x","y"])x[$][de[$]]||(j[$]=0,de[$]=0);if(j.x>0||j.y>0){k(),F.current=q,C(J,d),B.current=j,R.current=de;return}}B.current={x:0,y:0},R.current={x:0,y:0},k()},[t,J,a,k,c,d,JSON.stringify(re),JSON.stringify(x),C,f,ce,S,JSON.stringify(b)])}const Ux={x:{[ui.Backward]:!1,[ui.Forward]:!1},y:{[ui.Backward]:!1,[ui.Forward]:!1}};function Px(e){let{delta:t,disabled:n}=e;const a=xf(t);return So(o=>{if(n||!a||!o)return Ux;const c={x:Math.sign(t.x-a.x),y:Math.sign(t.y-a.y)};return{x:{[ui.Backward]:o.x[ui.Backward]||c.x===-1,[ui.Forward]:o.x[ui.Forward]||c.x===1},y:{[ui.Backward]:o.y[ui.Backward]||c.y===-1,[ui.Forward]:o.y[ui.Forward]||c.y===1}}},[n,t,a])}function Kx(e,t){const n=t!=null?e.get(t):void 0,a=n?n.node.current:null;return So(o=>{var c;return t==null?null:(c=a??o)!=null?c:null},[a,t])}function Ix(e,t){return g.useMemo(()=>e.reduce((n,a)=>{const{sensor:o}=a,c=o.activators.map(d=>({eventName:d.eventName,handler:t(d.handler,a)}));return[...n,...c]},[]),[e,t])}var no;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(no||(no={}));var Rf;(function(e){e.Optimized="optimized"})(Rf||(Rf={}));const Ny=new Map;function Fx(e,t){let{dragging:n,dependencies:a,config:o}=t;const[c,d]=g.useState(null),{frequency:p,measure:m,strategy:f}=o,S=g.useRef(e),y=B(),b=so(y),x=g.useCallback(function(R){R===void 0&&(R=[]),!b.current&&d(re=>re===null?R:re.concat(R.filter(F=>!re.includes(F))))},[b]),C=g.useRef(null),k=So(R=>{if(y&&!n)return Ny;if(!R||R===Ny||S.current!==e||c!=null){const re=new Map;for(let F of e){if(!F)continue;if(c&&c.length>0&&!c.includes(F.id)&&F.rect.current){re.set(F.id,F.rect.current);continue}const J=F.node.current,ce=J?new Qp(m(J),J):null;F.rect.current=ce,ce&&re.set(F.id,ce)}return re}return R},[e,c,n,y,m]);return g.useEffect(()=>{S.current=e},[e]),g.useEffect(()=>{y||x()},[n,y]),g.useEffect(()=>{c&&c.length>0&&d(null)},[JSON.stringify(c)]),g.useEffect(()=>{y||typeof p!="number"||C.current!==null||(C.current=setTimeout(()=>{x(),C.current=null},p))},[p,y,x,...a]),{droppableRects:k,measureDroppableContainers:x,measuringScheduled:c!=null};function B(){switch(f){case no.Always:return!1;case no.BeforeDragging:return n;default:return!n}}}function Pb(e,t){return So(n=>e?n||(typeof t=="function"?t(e):e):null,[t,e])}function qx(e,t){return Pb(e,t)}function Wx(e){let{callback:t,disabled:n}=e;const a=Gp(t),o=g.useMemo(()=>{if(n||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:c}=window;return new c(a)},[a,n]);return g.useEffect(()=>()=>o?.disconnect(),[o]),o}function Du(e){let{callback:t,disabled:n}=e;const a=Gp(t),o=g.useMemo(()=>{if(n||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:c}=window;return new c(a)},[n]);return g.useEffect(()=>()=>o?.disconnect(),[o]),o}function Yx(e){return new Qp(bo(e),e)}function By(e,t,n){t===void 0&&(t=Yx);const[a,o]=g.useState(null);function c(){o(m=>{if(!e)return null;if(e.isConnected===!1){var f;return(f=m??n)!=null?f:null}const S=t(e);return JSON.stringify(m)===JSON.stringify(S)?m:S})}const d=Wx({callback(m){if(e)for(const f of m){const{type:S,target:y}=f;if(S==="childList"&&y instanceof HTMLElement&&y.contains(e)){c();break}}}}),p=Du({callback:c});return ar(()=>{c(),e?(p?.observe(e),d?.observe(document.body,{childList:!0,subtree:!0})):(p?.disconnect(),d?.disconnect())},[e]),a}function $x(e){const t=Pb(e);return Db(e,t)}const Ly=[];function Vx(e){const t=g.useRef(e),n=So(a=>e?a&&a!==Ly&&e&&t.current&&e.parentNode===t.current.parentNode?a:Zp(e):Ly,[e]);return g.useEffect(()=>{t.current=e},[e]),n}function Xx(e){const[t,n]=g.useState(null),a=g.useRef(e),o=g.useCallback(c=>{const d=Gd(c.target);d&&n(p=>p?(p.set(d,kf(d)),new Map(p)):null)},[]);return g.useEffect(()=>{const c=a.current;if(e!==c){d(c);const p=e.map(m=>{const f=Gd(m);return f?(f.addEventListener("scroll",o,{passive:!0}),[f,kf(f)]):null}).filter(m=>m!=null);n(p.length?new Map(p):null),a.current=e}return()=>{d(e),d(c)};function d(p){p.forEach(m=>{const f=Gd(m);f?.removeEventListener("scroll",o)})}},[o,e]),g.useMemo(()=>e.length?t?Array.from(t.values()).reduce((c,d)=>Aa(c,d),Ns):Lb(e):Ns,[e,t])}function Oy(e,t){t===void 0&&(t=[]);const n=g.useRef(null);return g.useEffect(()=>{n.current=null},t),g.useEffect(()=>{const a=e!==Ns;a&&!n.current&&(n.current=e),!a&&n.current&&(n.current=null)},[e]),n.current?ou(e,n.current):Ns}function Gx(e){g.useEffect(()=>{if(!Tu)return;const t=e.map(n=>{let{sensor:a}=n;return a.setup==null?void 0:a.setup()});return()=>{for(const n of t)n?.()}},e.map(t=>{let{sensor:n}=t;return n}))}function Zx(e,t){return g.useMemo(()=>e.reduce((n,a)=>{let{eventName:o,handler:c}=a;return n[o]=d=>{c(d,t)},n},{}),[e,t])}function Kb(e){return g.useMemo(()=>e?Cx(e):null,[e])}const zy=[];function Qx(e,t){t===void 0&&(t=bo);const[n]=e,a=Kb(n?$i(n):null),[o,c]=g.useState(zy);function d(){c(()=>e.length?e.map(m=>Nb(m)?a:new Qp(t(m),m)):zy)}const p=Du({callback:d});return ar(()=>{p?.disconnect(),d(),e.forEach(m=>p?.observe(m))},[e]),o}function Jx(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return yo(t)?t:e}function eE(e){let{measure:t}=e;const[n,a]=g.useState(null),o=g.useCallback(f=>{for(const{target:S}of f)if(yo(S)){a(y=>{const b=t(S);return y?{...y,width:b.width,height:b.height}:b});break}},[t]),c=Du({callback:o}),d=g.useCallback(f=>{const S=Jx(f);c?.disconnect(),S&&c?.observe(S),a(S?t(S):null)},[t,c]),[p,m]=lu(d);return g.useMemo(()=>({nodeRef:p,rect:n,setRef:m}),[n,p,m])}const tE=[{sensor:jb,options:{}},{sensor:zb,options:{}}],iE={current:{}},Gc={draggable:{measure:Dy},droppable:{measure:Dy,strategy:no.WhileDragging,frequency:Rf.Optimized},dragOverlay:{measure:bo}};class Ql extends Map{get(t){var n;return t!=null&&(n=super.get(t))!=null?n:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(t=>{let{disabled:n}=t;return!n})}getNodeFor(t){var n,a;return(n=(a=this.get(t))==null?void 0:a.node.current)!=null?n:void 0}}const sE={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new Ql,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:cu},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:Gc,measureDroppableContainers:cu,windowRect:null,measuringScheduled:!1},nE={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:cu,draggableNodes:new Map,over:null,measureDroppableContainers:cu},Ru=g.createContext(nE),rE=g.createContext(sE);function aE(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new Ql}}}function lE(e,t){switch(t.type){case ni.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case ni.DragMove:return e.draggable.active==null?e:{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}};case ni.DragEnd:case ni.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case ni.RegisterDroppable:{const{element:n}=t,{id:a}=n,o=new Ql(e.droppable.containers);return o.set(a,n),{...e,droppable:{...e.droppable,containers:o}}}case ni.SetDroppableDisabled:{const{id:n,key:a,disabled:o}=t,c=e.droppable.containers.get(n);if(!c||a!==c.key)return e;const d=new Ql(e.droppable.containers);return d.set(n,{...c,disabled:o}),{...e,droppable:{...e.droppable,containers:d}}}case ni.UnregisterDroppable:{const{id:n,key:a}=t,o=e.droppable.containers.get(n);if(!o||a!==o.key)return e;const c=new Ql(e.droppable.containers);return c.delete(n),{...e,droppable:{...e.droppable,containers:c}}}default:return e}}function oE(e){let{disabled:t}=e;const{active:n,activatorEvent:a,draggableNodes:o}=g.useContext(Ru),c=xf(a),d=xf(n?.id);return g.useEffect(()=>{if(!t&&!a&&c&&d!=null){if(!Tb(c)||document.activeElement===c.target)return;const p=o.get(d);if(!p)return;const{activatorNode:m,node:f}=p;if(!m.current&&!f.current)return;requestAnimationFrame(()=>{for(const S of[m.current,f.current]){if(!S)continue;const y=ix(S);if(y){y.focus();break}}})}},[a,t,o,d,c]),null}function cE(e,t){let{transform:n,...a}=t;return e!=null&&e.length?e.reduce((o,c)=>c({transform:o,...a}),n):n}function uE(e){return g.useMemo(()=>({draggable:{...Gc.draggable,...e?.draggable},droppable:{...Gc.droppable,...e?.droppable},dragOverlay:{...Gc.dragOverlay,...e?.dragOverlay}}),[e?.draggable,e?.droppable,e?.dragOverlay])}function hE(e){let{activeNode:t,measure:n,initialRect:a,config:o=!0}=e;const c=g.useRef(!1),{x:d,y:p}=typeof o=="boolean"?{x:o,y:o}:o;ar(()=>{if(!d&&!p||!t){c.current=!1;return}if(c.current||!a)return;const f=t?.node.current;if(!f||f.isConnected===!1)return;const S=n(f),y=Db(S,a);if(d||(y.x=0),p||(y.y=0),c.current=!0,Math.abs(y.x)>0||Math.abs(y.y)>0){const b=Rb(f);b&&b.scrollBy({top:y.y,left:y.x})}},[t,d,p,a,n])}const Ib=g.createContext({...Ns,scaleX:1,scaleY:1});var er;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(er||(er={}));const dE=g.memo(function(t){var n,a,o,c;let{id:d,accessibility:p,autoScroll:m=!0,children:f,sensors:S=tE,collisionDetection:y=_x,measuring:b,modifiers:x,...C}=t;const k=g.useReducer(lE,void 0,aE),[B,R]=k,[re,F]=ox(),[J,ce]=g.useState(er.Uninitialized),q=J===er.Initialized,{draggable:{active:I,nodes:ie,translate:de},droppable:{containers:j}}=B,$=I!=null?ie.get(I):null,H=g.useRef({initial:null,translated:null}),L=g.useMemo(()=>{var ot;return I!=null?{id:I,data:(ot=$?.data)!=null?ot:iE,rect:H}:null},[I,$]),X=g.useRef(null),[Z,A]=g.useState(null),[V,Q]=g.useState(null),ve=so(C,Object.values(C)),Se=ku("DndDescribedBy",d),E=g.useMemo(()=>j.getEnabled(),[j]),W=uE(b),{droppableRects:ee,measureDroppableContainers:he,measuringScheduled:ge}=Fx(E,{dragging:q,dependencies:[de.x,de.y],config:W.droppable}),me=Kx(ie,I),Ce=g.useMemo(()=>V?Ef(V):null,[V]),ze=ks(),Ne=qx(me,W.draggable.measure);hE({activeNode:I!=null?ie.get(I):null,config:ze.layoutShiftCompensation,initialRect:Ne,measure:W.draggable.measure});const Re=By(me,W.draggable.measure,Ne),Pe=By(me?me.parentElement:null),Ye=g.useRef({activatorEvent:null,active:null,activeNode:me,collisionRect:null,collisions:null,droppableRects:ee,draggableNodes:ie,draggingNode:null,draggingNodeRect:null,droppableContainers:j,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),Be=j.getNodeFor((n=Ye.current.over)==null?void 0:n.id),ae=eE({measure:W.dragOverlay.measure}),Ee=(a=ae.nodeRef.current)!=null?a:me,xe=q?(o=ae.rect)!=null?o:Re:null,Ke=!!(ae.nodeRef.current&&ae.rect),Xe=$x(Ke?null:Re),gt=Kb(Ee?$i(Ee):null),yt=Vx(q?Be??me:null),mi=Qx(yt),te=cE(x,{transform:{x:de.x-Xe.x,y:de.y-Xe.y,scaleX:1,scaleY:1},activatorEvent:V,active:L,activeNodeRect:Re,containerNodeRect:Pe,draggingNodeRect:xe,over:Ye.current.over,overlayNodeRect:ae.rect,scrollableAncestors:yt,scrollableAncestorRects:mi,windowRect:gt}),je=Ce?Aa(Ce,de):null,He=Xx(yt),_i=Oy(He),Vi=Oy(He,[Re]),ai=Aa(te,_i),kt=xe?yx(xe,te):null,ji=L&&kt?y({active:L,collisionRect:kt,droppableRects:ee,droppableContainers:E,pointerCoordinates:je}):null,Ti=px(ji,"id"),[Nt,$s]=g.useState(null),Hi=Ke?te:Aa(te,Vi),qt=vx(Hi,(c=Nt?.rect)!=null?c:null,Re),Jt=g.useRef(null),Dt=g.useCallback((ot,St)=>{let{sensor:Rt,options:li}=St;if(X.current==null)return;const ei=ie.get(X.current);if(!ei)return;const Bt=ot.nativeEvent,nt=new Rt({active:X.current,activeNode:ei,event:Bt,options:li,context:Ye,onAbort(bt){if(!ie.get(bt))return;const{onDragAbort:ct}=ve.current,vi={id:bt};ct?.(vi),re({type:"onDragAbort",event:vi})},onPending(bt,Ge,ct,vi){if(!ie.get(bt))return;const{onDragPending:Ni}=ve.current,ki={id:bt,constraint:Ge,initialCoordinates:ct,offset:vi};Ni?.(ki),re({type:"onDragPending",event:ki})},onStart(bt){const Ge=X.current;if(Ge==null)return;const ct=ie.get(Ge);if(!ct)return;const{onDragStart:vi}=ve.current,Ai={activatorEvent:Bt,active:{id:Ge,data:ct.data,rect:H}};Il.unstable_batchedUpdates(()=>{vi?.(Ai),ce(er.Initializing),R({type:ni.DragStart,initialCoordinates:bt,active:Ge}),re({type:"onDragStart",event:Ai}),A(Jt.current),Q(Bt)})},onMove(bt){R({type:ni.DragMove,coordinates:bt})},onEnd:Wt(ni.DragEnd),onCancel:Wt(ni.DragCancel)});Jt.current=nt;function Wt(bt){return async function(){const{active:ct,collisions:vi,over:Ai,scrollAdjustedTranslate:Ni}=Ye.current;let ki=null;if(ct&&Ni){const{cancelDrop:cs}=ve.current;ki={activatorEvent:Bt,active:ct,collisions:vi,delta:Ni,over:Ai},bt===ni.DragEnd&&typeof cs=="function"&&await Promise.resolve(cs(ki))&&(bt=ni.DragCancel)}X.current=null,Il.unstable_batchedUpdates(()=>{R({type:bt}),ce(er.Uninitialized),$s(null),A(null),Q(null),Jt.current=null;const cs=bt===ni.DragEnd?"onDragEnd":"onDragCancel";if(ki){const gi=ve.current[cs];gi?.(ki),re({type:cs,event:ki})}})}}},[ie]),Cn=g.useCallback((ot,St)=>(Rt,li)=>{const ei=Rt.nativeEvent,Bt=ie.get(li);if(X.current!==null||!Bt||ei.dndKit||ei.defaultPrevented)return;const nt={active:Bt};ot(Rt,St.options,nt)===!0&&(ei.dndKit={capturedBy:St.sensor},X.current=li,Dt(Rt,St))},[ie,Dt]),Bs=Ix(S,Cn);Gx(S),ar(()=>{Re&&J===er.Initializing&&ce(er.Initialized)},[Re,J]),g.useEffect(()=>{const{onDragMove:ot}=ve.current,{active:St,activatorEvent:Rt,collisions:li,over:ei}=Ye.current;if(!St||!Rt)return;const Bt={active:St,activatorEvent:Rt,collisions:li,delta:{x:ai.x,y:ai.y},over:ei};Il.unstable_batchedUpdates(()=>{ot?.(Bt),re({type:"onDragMove",event:Bt})})},[ai.x,ai.y]),g.useEffect(()=>{const{active:ot,activatorEvent:St,collisions:Rt,droppableContainers:li,scrollAdjustedTranslate:ei}=Ye.current;if(!ot||X.current==null||!St||!ei)return;const{onDragOver:Bt}=ve.current,nt=li.get(Ti),Wt=nt&&nt.rect.current?{id:nt.id,rect:nt.rect.current,data:nt.data,disabled:nt.disabled}:null,bt={active:ot,activatorEvent:St,collisions:Rt,delta:{x:ei.x,y:ei.y},over:Wt};Il.unstable_batchedUpdates(()=>{$s(Wt),Bt?.(bt),re({type:"onDragOver",event:bt})})},[Ti]),ar(()=>{Ye.current={activatorEvent:V,active:L,activeNode:me,collisionRect:kt,collisions:ji,droppableRects:ee,draggableNodes:ie,draggingNode:Ee,draggingNodeRect:xe,droppableContainers:j,over:Nt,scrollableAncestors:yt,scrollAdjustedTranslate:ai},H.current={initial:xe,translated:kt}},[L,me,ji,kt,ie,Ee,xe,ee,j,Nt,yt,ai]),Hx({...ze,delta:de,draggingRect:kt,pointerCoordinates:je,scrollableAncestors:yt,scrollableAncestorRects:mi});const Vs=g.useMemo(()=>({active:L,activeNode:me,activeNodeRect:Re,activatorEvent:V,collisions:ji,containerNodeRect:Pe,dragOverlay:ae,draggableNodes:ie,droppableContainers:j,droppableRects:ee,over:Nt,measureDroppableContainers:he,scrollableAncestors:yt,scrollableAncestorRects:mi,measuringConfiguration:W,measuringScheduled:ge,windowRect:gt}),[L,me,Re,V,ji,Pe,ae,ie,j,ee,Nt,he,yt,mi,W,ge,gt]),Ts=g.useMemo(()=>({activatorEvent:V,activators:Bs,active:L,activeNodeRect:Re,ariaDescribedById:{draggable:Se},dispatch:R,draggableNodes:ie,over:Nt,measureDroppableContainers:he}),[V,Bs,L,Re,R,Se,ie,Nt,he]);return xi.createElement(kb.Provider,{value:F},xi.createElement(Ru.Provider,{value:Ts},xi.createElement(rE.Provider,{value:Vs},xi.createElement(Ib.Provider,{value:qt},f)),xi.createElement(oE,{disabled:p?.restoreFocus===!1})),xi.createElement(hx,{...p,hiddenTextDescribedById:Se}));function ks(){const ot=Z?.autoScrollEnabled===!1,St=typeof m=="object"?m.enabled===!1:m===!1,Rt=q&&!ot&&!St;return typeof m=="object"?{...m,enabled:Rt}:{enabled:Rt}}}),fE=g.createContext(null),jy="button",pE="Draggable";function Fb(e){let{id:t,data:n,disabled:a=!1,attributes:o}=e;const c=ku(pE),{activators:d,activatorEvent:p,active:m,activeNodeRect:f,ariaDescribedById:S,draggableNodes:y,over:b}=g.useContext(Ru),{role:x=jy,roleDescription:C="draggable",tabIndex:k=0}=o??{},B=m?.id===t,R=g.useContext(B?Ib:fE),[re,F]=lu(),[J,ce]=lu(),q=Zx(d,t),I=so(n);ar(()=>(y.set(t,{id:t,key:c,node:re,activatorNode:J,data:I}),()=>{const de=y.get(t);de&&de.key===c&&y.delete(t)}),[y,t]);const ie=g.useMemo(()=>({role:x,tabIndex:k,"aria-disabled":a,"aria-pressed":B&&x===jy?!0:void 0,"aria-roledescription":C,"aria-describedby":S.draggable}),[a,x,k,B,C,S.draggable]);return{active:m,activatorEvent:p,activeNodeRect:f,attributes:ie,isDragging:B,listeners:a?void 0:q,node:re,over:b,setNodeRef:F,setActivatorNodeRef:ce,transform:R}}const mE="Droppable",_E={timeout:25};function qb(e){let{data:t,disabled:n=!1,id:a,resizeObserverConfig:o}=e;const c=ku(mE),{active:d,dispatch:p,over:m,measureDroppableContainers:f}=g.useContext(Ru),S=g.useRef({disabled:n}),y=g.useRef(!1),b=g.useRef(null),x=g.useRef(null),{disabled:C,updateMeasurementsFor:k,timeout:B}={..._E,...o},R=so(k??a),re=g.useCallback(()=>{if(!y.current){y.current=!0;return}x.current!=null&&clearTimeout(x.current),x.current=setTimeout(()=>{f(Array.isArray(R.current)?R.current:[R.current]),x.current=null},B)},[B]),F=Du({callback:re,disabled:C||!d}),J=g.useCallback((ie,de)=>{F&&(de&&(F.unobserve(de),y.current=!1),ie&&F.observe(ie))},[F]),[ce,q]=lu(J),I=so(t);return g.useEffect(()=>{!F||!ce.current||(F.disconnect(),y.current=!1,F.observe(ce.current))},[ce,F]),g.useEffect(()=>(p({type:ni.RegisterDroppable,element:{id:a,key:c,disabled:n,node:ce,rect:b,data:I}}),()=>p({type:ni.UnregisterDroppable,key:c,id:a})),[a]),g.useEffect(()=>{n!==S.current.disabled&&(p({type:ni.SetDroppableDisabled,id:a,key:c,disabled:n}),S.current.disabled=n)},[a,c,n,p]),{active:d,rect:b,isOver:m?.id===a,node:ce,over:m,setNodeRef:q}}const vE=128,gE=512,yE=64,SE=4096;function Wb(e){if(!e||typeof e!="object")return null;const t=e;if(typeof t.activeWorkspaceId!="string"&&t.activeWorkspaceId!==null||!Array.isArray(t.workspaces)||t.workspaces.length>vE)return null;const n=t.workspaces.map(bE);return n.some(a=>a===null)?null:{activeWorkspaceId:t.activeWorkspaceId,workspaces:n}}function bE(e){if(!e||typeof e!="object")return null;const t=e;if(typeof t.id!="string"||typeof t.title!="string"||typeof t.activeTabId!="string"&&t.activeTabId!==null||!Array.isArray(t.tabs)||t.tabs.length>gE)return null;const n=t.tabs.map(wE);return n.some(a=>a===null)?null:{id:t.id,title:t.title,activeTabId:t.activeTabId,tabs:n}}function wE(e){if(!e||typeof e!="object")return null;const t=e;if(typeof t.id!="string"||typeof t.title!="string"||typeof t.activeTerminalId!="string")return null;const n=CE(t.root);return n?{id:t.id,title:t.title,activeTerminalId:t.activeTerminalId,root:n}:null}function CE(e){if(!e||typeof e!="object")return null;let t=0;return Mf(e,1,()=>(t+=1,t<=SE))}function Mf(e,t,n){if(!e||typeof e!="object"||t>yE||!n())return null;const a=e;if(a.type==="pane")return typeof a.terminalId=="string"?{type:"pane",terminalId:a.terminalId}:null;if(a.type!=="split"||a.direction!=="horizontal"&&a.direction!=="vertical")return null;const o=Mf(a.first,t+1,n),c=Mf(a.second,t+1,n);return!o||!c?null:{type:"split",direction:a.direction,ratio:xE(a.ratio),first:o,second:c}}function xE(e){return typeof e=="number"&&Number.isFinite(e)?Math.min(.9,Math.max(.1,e)):.5}const Yb=[{id:"builtin-character-2260",filename:"character-2260.mp4",contentType:"video/mp4",size:123288,createdAt:"2026-05-26T00:00:00.000Z",url:"/assets/notifications/character-2260.mp4"},{id:"builtin-character-2272",filename:"character-2272.mp4",contentType:"video/mp4",size:55873,createdAt:"2026-05-26T00:00:00.000Z",url:"/assets/notifications/character-2272.mp4"},{id:"builtin-character-2258",filename:"character-2258.mp4",contentType:"video/mp4",size:112612,createdAt:"2026-05-26T00:00:00.000Z",url:"/assets/notifications/character-2258.mp4"}];function Hy(e){return e===void 0?"unknown":e==="error"?"offline":"ok"}function Uy(e){const t=e.trim();return t?t.charAt(0).toUpperCase():"?"}const Py="Local",EE=3e4;function Jd(e){return e===void 0?"":e==="error"?"offline":[`CPU ${Cs(e.cpuPercent)} ${em(e)}`,`MEM ${Cs(e.memoryPercent)} ${Sn(e.memoryUsedBytes,e.memoryTotalBytes)}`,`DISK ${Cs(e.diskPercent)} ${Sn(e.diskUsedBytes,e.diskTotalBytes)}`,`SWAP ${Cs(e.swapPercent)} ${Sn(e.swapUsedBytes,e.swapTotalBytes)}`].join(" · ")}function TE(e){if(!(e===void 0||e==="error"))return[`CPU ${Cs(e.cpuPercent)} (${em(e)})`,`RAM ${Cs(e.memoryPercent)} (${Sn(e.memoryUsedBytes,e.memoryTotalBytes)})`,`Disk ${Cs(e.diskPercent)} (${Sn(e.diskUsedBytes,e.diskTotalBytes)})`,`Swap ${Cs(e.swapPercent)} (${Sn(e.swapUsedBytes,e.swapTotalBytes)})`].join(" · ")}function Cs(e){return typeof e=="number"&&Number.isFinite(e)?`${Math.round(e)}%`:"–"}function em(e){const t=Number.isFinite(e.cores)&&e.cores>0?e.cores:null;return e.cpuPercent===null||e.cpuPercent===void 0||!Number.isFinite(e.cpuPercent)||t===null?`–/${t??"–"} cores`:`${Af(e.cpuPercent/100*t)}/${t} cores`}function Sn(e,t){return!Ky(e)||!Ky(t)?"–/–":kE(e,t)}function kE(e,t){const n=t>=1073741824?"GB":t>=1048576?"MB":"KB",a=n==="GB"?1024**3:n==="MB"?1024**2:1024;return`${Af(e/a)}/${Af(t/a)} ${n}`}function Af(e){return e>=10||Number.isInteger(e)?e.toFixed(0):e.toFixed(1)}function Ky(e){return typeof e=="number"&&Number.isFinite(e)&&e>=0}function DE(e){return[{label:"CPU",percent:Cs(e.cpuPercent),detail:em(e)},{label:"MEM",percent:Cs(e.memoryPercent),detail:Sn(e.memoryUsedBytes,e.memoryTotalBytes)},{label:"DISK",percent:Cs(e.diskPercent),detail:Sn(e.diskUsedBytes,e.diskTotalBytes)},{label:"SWAP",percent:Cs(e.swapPercent),detail:Sn(e.swapUsedBytes,e.swapTotalBytes)}]}function Iy({entry:e}){return e==="error"?_.jsx("span",{className:"server-list-stats server-list-stats--offline",children:"offline"}):e===void 0?_.jsx("span",{className:"server-list-stats server-list-stats-grid","aria-hidden":"true",children:["CPU","MEM","DISK","SWAP"].map(t=>_.jsxs("span",{className:"server-list-stat-cell",children:[_.jsx("span",{className:"server-list-stat-label",children:t}),_.jsx("span",{className:"server-list-stat-value",children:"–"}),_.jsx("span",{className:"server-list-stat-detail",children:"–"})]},t))}):_.jsx("span",{className:"server-list-stats server-list-stats-grid",title:TE(e),children:DE(e).map(t=>_.jsxs("span",{className:"server-list-stat-cell",children:[_.jsx("span",{className:"server-list-stat-label",children:t.label}),_.jsx("span",{className:"server-list-stat-value",children:t.percent}),_.jsx("span",{className:"server-list-stat-detail",children:t.detail})]},t.label))})}function ef({api:e,activeAgentId:t,onSelectServer:n,onSessionInvalid:a,refreshToken:o=0,compact:c=!1}){const[d,p]=g.useState([]),[m,f]=g.useState(null),[S,y]=g.useState(null),[b,x]=g.useState(""),C=g.useRef(null),[k,B]=g.useState({});g.useEffect(()=>{let q=!1;return e.listAgents().then(I=>{q||p(I.agents)}).catch(()=>{}),e.getMainInfo().then(I=>{q||f(I.name)}).catch(()=>{}),()=>{q=!0}},[e,o]),g.useEffect(()=>{S&&(C.current?.focus(),C.current?.select())},[S]),g.useEffect(()=>{let q=!1;async function I(){let de=!1;const j=[{key:"__main__",load:()=>e.getMainStats()},...d.map(H=>({key:H.id,load:()=>e.getAgentStats(H.id)}))],$=await Promise.all(j.map(async H=>{try{return[H.key,await H.load()]}catch(L){return L instanceof yn&&L.status===401?(de=!0,[H.key,"error"]):[H.key,"error"]}}));if(!q){if(de){a?.();return}B(H=>{const L={};for(const[Z,A]of $)L[Z]=A;const X=new Set(["__main__",...d.map(Z=>Z.id)]);for(const Z of Object.keys(H))!X.has(Z)||Z in L||(L[Z]=H[Z]);return L})}}I();const ie=window.setInterval(()=>{I()},EE);return()=>{q=!0,window.clearInterval(ie)}},[e,d,a]);function R(q){q==="main"?(x(m??""),y({kind:"main"})):(x(q.name),y({kind:"agent",id:q.id}))}async function re(){if(!S)return;const q=b.trim(),I=S;if(y(null),I.kind==="main"){const ie=q||"";try{const de=await e.renameMain(ie);f(de.name)}catch{}}else{if(!q)return;const ie=d.find(de=>de.id===I.id)?.name;p(de=>de.map(j=>j.id===I.id?{...j,name:q}:j));try{await e.renameAgent(I.id,q)}catch{ie!==void 0&&p(de=>de.map(j=>j.id===I.id?{...j,name:ie}:j))}}}function F(){y(null)}const J=m?.trim()||Py,ce=S?.kind==="main";return c?_.jsxs("div",{className:"server-list server-list--compact",children:[_.jsxs("button",{type:"button",className:`server-list-chip${t===null?" server-list-chip--active":""}`,onClick:()=>n(null),"aria-label":J,title:`${J}${Jd(k.__main__)?` — ${Jd(k.__main__)}`:""}`,children:[_.jsx("span",{className:"server-list-chip-initial",children:Uy(J)}),_.jsx("span",{className:"server-list-chip-pip","data-status":Hy(k.__main__)})]}),d.map(q=>{const I=k[q.id],ie=Jd(I);return _.jsxs("button",{type:"button",className:`server-list-chip${t===q.id?" server-list-chip--active":""}`,onClick:()=>n(q.id),"aria-label":q.name,title:`${q.name}${ie?` — ${ie}`:""}`,children:[_.jsx("span",{className:"server-list-chip-initial",children:Uy(q.name)}),_.jsx("span",{className:"server-list-chip-pip","data-status":Hy(I)})]},q.id)})]}):_.jsxs("div",{className:"server-list",children:[_.jsx("div",{className:"server-list-row",children:ce?_.jsx("form",{className:"server-list-editor",onSubmit:q=>{q.preventDefault(),re()},children:_.jsx("input",{ref:C,"aria-label":"Rename main server",value:b,onChange:q=>x(q.target.value),onBlur:()=>{re()},onKeyDown:q=>{q.key==="Escape"&&(q.preventDefault(),F())},placeholder:Py})}):_.jsxs("button",{type:"button",className:`server-list-item${t===null?" server-list-item--active":""}`,onClick:()=>n(null),onDoubleClick:q=>{q.preventDefault(),R("main")},title:"Double-click to rename",children:[_.jsxs("span",{className:"server-list-item-header",children:[_.jsx("span",{className:"server-list-dot"}),_.jsx("span",{className:"server-list-name",children:J})]}),_.jsx(Iy,{entry:k.__main__})]})}),d.map(q=>{const I=S?.kind==="agent"&&S.id===q.id;return _.jsx("div",{className:"server-list-row",children:I?_.jsx("form",{className:"server-list-editor",onSubmit:ie=>{ie.preventDefault(),re()},children:_.jsx("input",{ref:C,"aria-label":`Rename ${q.name}`,value:b,onChange:ie=>x(ie.target.value),onBlur:()=>{re()},onKeyDown:ie=>{ie.key==="Escape"&&(ie.preventDefault(),F())}})}):_.jsxs("button",{type:"button",className:`server-list-item${t===q.id?" server-list-item--active":""}`,onClick:()=>n(q.id),onDoubleClick:ie=>{ie.preventDefault(),R({id:q.id,name:q.name})},title:"Double-click to rename",children:[_.jsxs("span",{className:"server-list-item-header",children:[_.jsx("span",{className:"server-list-dot"}),_.jsx("span",{className:"server-list-name",title:q.url,children:q.name})]}),_.jsx(Iy,{entry:k[q.id]})]})},q.id)})]})}function RE({api:e}){const[t,n]=g.useState([]),[a,o]=g.useState([]),[c,d]=g.useState(!1),[p,m]=g.useState(null),[f,S]=g.useState(""),[y,b]=g.useState("");async function x(){try{const[R,re,F]=await Promise.all([e.listDevices(),e.listNetworks(),e.getSession()]);n(R.devices),o(re.networks),d(F.totpEnabled),m(null)}catch(R){m(R instanceof Error?R.message:"Failed to load")}}g.useEffect(()=>{x()},[]);async function C(R){await e.revokeDevice(R),await x()}async function k(R){await e.removeNetwork(R),await x()}async function B(R){R.preventDefault(),m(null);try{await e.addNetwork({value:f.trim(),label:y.trim()}),S(""),b(""),await x()}catch(re){m(re instanceof Error?re.message:"Failed to add network")}}return _.jsxs(_.Fragment,{children:[p?_.jsx("p",{className:"form-error",children:p}):null,_.jsxs("section",{className:"security-section",children:[_.jsx("h3",{children:"Trusted devices"}),_.jsx("p",{className:"muted",children:"Devices that can re-authenticate with a 2FA code only (no password) for 30 days."}),t.length===0?_.jsx("p",{className:"muted",children:"No trusted devices."}):_.jsx("ul",{className:"security-list",children:t.map(R=>_.jsxs("li",{children:[_.jsxs("div",{children:[_.jsxs("span",{className:"security-item-label",children:[R.label,R.current?_.jsx("span",{className:"security-badge",children:"this device"}):null]}),_.jsxs("span",{className:"security-item-meta",children:["last seen ",new Date(R.lastSeenAt).toLocaleString()]})]}),_.jsx("button",{type:"button",className:"security-remove",onClick:()=>{C(R.id)},children:"revoke"})]},R.id))})]}),_.jsxs("section",{className:"security-section",children:[_.jsx("h3",{children:"Trusted networks"}),_.jsx("p",{className:"muted",children:"Sessions from these IPs/ranges skip the 2FA re-auth prompt."}),a.length===0?_.jsx("p",{className:"muted",children:"No trusted networks."}):_.jsx("ul",{className:"security-list",children:a.map(R=>_.jsxs("li",{children:[_.jsxs("div",{children:[_.jsx("span",{className:"security-item-label",children:R.value}),R.label!==R.value?_.jsx("span",{className:"security-item-meta",children:R.label}):null]}),_.jsx("button",{type:"button",className:"security-remove",onClick:()=>{k(R.id)},children:"remove"})]},R.id))}),_.jsxs("form",{className:"security-add-form",onSubmit:B,children:[_.jsx("input",{type:"text",placeholder:"IP or CIDR (e.g. 203.0.113.4 or 192.168.0.0/24)",value:f,onChange:R=>S(R.currentTarget.value),required:!0}),_.jsx("input",{type:"text",placeholder:"Label (optional)",value:y,onChange:R=>b(R.currentTarget.value)}),_.jsx("button",{type:"submit",disabled:!f.trim(),children:"Add"})]})]}),c?_.jsxs("section",{className:"security-section",children:[_.jsx("h3",{children:"Two-factor authentication"}),_.jsx("p",{className:"muted",children:"2FA is enabled. Disabling it removes the requirement; you will be asked to set it up again on next login."}),_.jsx("button",{type:"button",className:"security-remove",onClick:async()=>{await e.disableTotp(),await x()},children:"Disable 2FA"})]}):null]})}const $b="nterminal.notifications.completionEnabled",tm="nterminal.notifications.completionToastEnabled",im="nterminal.notifications.completionToastDurationSeconds",sm="nterminal.notifications.completionToastPersistent",Nf="nterminal:completion-toast-display",Jl=6.5,Bf=2,Lf=60;function Mu(){return typeof window<"u"&&"Notification"in window}function Vb(){try{return window.localStorage.getItem($b)==="true"}catch{return!1}}function Fy(e){try{window.localStorage.setItem($b,e?"true":"false")}catch{}}function zr(){return{enabled:BE(),durationSeconds:NE(),persistUntilDismissed:LE()}}function ME(e){if(typeof window<"u"){try{window.localStorage.setItem(tm,e?"true":"false")}catch{}rm()}return zr()}function qy(e){const t=Gb(e);if(typeof window<"u"){try{window.localStorage.setItem(im,String(t))}catch{}rm()}return zr()}function AE(e){if(typeof window<"u"){try{window.localStorage.setItem(sm,e?"true":"false")}catch{}rm()}return zr()}function Xb(e){if(typeof window>"u")return()=>{};const t=n=>{(n.key===tm||n.key===im||n.key===sm)&&e()};return window.addEventListener(Nf,e),window.addEventListener("storage",t),()=>{window.removeEventListener(Nf,e),window.removeEventListener("storage",t)}}function nm(){return Mu()?window.Notification.permission:"unsupported"}function NE(){if(typeof window>"u")return Jl;try{const e=window.localStorage.getItem(im);return e===null?Jl:Gb(Number(e))}catch{return Jl}}function BE(){if(typeof window>"u")return!0;try{return window.localStorage.getItem(tm)!=="false"}catch{return!0}}function LE(){if(typeof window>"u")return!1;try{return window.localStorage.getItem(sm)==="true"}catch{return!1}}function Gb(e){if(!Number.isFinite(e))return Jl;const t=Math.round(e*2)/2;return Math.max(Bf,Math.min(Lf,t))}function rm(){typeof window<"u"&&window.dispatchEvent(new CustomEvent(Nf))}async function OE(){if(!Mu())return"unsupported";try{return await window.Notification.requestPermission()}catch{return nm()}}function zE(e){if(!Mu()||nm()!=="granted"||!Vb()||typeof document<"u"&&document.visibilityState==="visible")return;const t=e.commandName?`${e.commandName} finished`:"Command finished";try{new Notification(`NTerminal · ${e.tabTitle}`,{body:t,tag:e.terminalId,icon:"/icons/app-icon-384.png",silent:!0})}catch{}}const jE=1500,am="nterminal.terminal.fontSize",lm="nterminal.terminal.fontFamily",Of="nterminal:terminal-font-size",zf="nterminal:terminal-font-family",jf=11,Hf=20,Lr=14,hu=[{id:"meslo",label:"MesloLGS NF",cssFamily:['"MesloLGS NF"','"MesloLGS Nerd Font Mono"','"MesloLGSNerdFontMono"','"JetBrainsMono Nerd Font"','"Hack Nerd Font"','"FiraCode Nerd Font"','"SF Mono"',"Menlo","Monaco","Consolas",'"Liberation Mono"','"Symbols Nerd Font Mono"','"Apple Symbols"','"Apple Color Emoji"',"monospace"].join(", "),webFontFamilies:['"MesloLGS NF"']},{id:"jetbrains",label:"JetBrains Mono",cssFamily:['"JetBrainsMono Nerd Font"','"JetBrains Mono"','"Hack Nerd Font"','"FiraCode Nerd Font"','"SF Mono"',"Menlo","Monaco","Consolas",'"Liberation Mono"','"Symbols Nerd Font Mono"','"Apple Symbols"','"Apple Color Emoji"',"monospace"].join(", "),webFontFamilies:[]},{id:"system",label:"System mono",cssFamily:['"SF Mono"',"Menlo","Monaco","Consolas",'"Liberation Mono"','"Symbols Nerd Font Mono"','"Apple Symbols"','"Apple Color Emoji"',"monospace"].join(", "),webFontFamilies:[]}],Na="meslo";Uf(Na);async function tf(e=Lr,t=Na){if(typeof document>"u"||!document.fonts)return;const n=Jb(t).webFontFamilies;if(n.length===0)return;const a=Promise.all(n.map(o=>document.fonts.load(`${e}px ${o}`))).then(()=>{}).catch(()=>{});await Promise.race([a,new Promise(o=>{globalThis.setTimeout(o,jE)})])}function Zb(e){const t=typeof e=="number"?e:Number(e);if(!Number.isFinite(t))return Lr;const n=Math.round(t);return Math.max(jf,Math.min(Hf,n))}function Qb(e){return hu.some(t=>t.id===e)?e:Na}function Uf(e){return Jb(e).cssFamily}function Jb(e){return hu.find(t=>t.id===e)??hu[0]}function Pf(){if(typeof window>"u")return Lr;try{const e=window.localStorage.getItem(am);return e?Zb(e):Lr}catch{return Lr}}function Kf(){if(typeof window>"u")return Na;try{return Qb(window.localStorage.getItem(lm))}catch{return Na}}function Hc(e){const t=Zb(e);if(typeof window>"u")return t;try{window.localStorage.setItem(am,String(t))}catch{}return window.dispatchEvent(new CustomEvent(Of,{detail:t})),t}function HE(e){const t=Qb(e);if(typeof window>"u")return t;try{window.localStorage.setItem(lm,t)}catch{}return window.dispatchEvent(new CustomEvent(zf,{detail:t})),t}function e0(e){if(typeof window>"u")return()=>{};const t=n=>{n.key===am&&e()};return window.addEventListener(Of,e),window.addEventListener("storage",t),()=>{window.removeEventListener(Of,e),window.removeEventListener("storage",t)}}function t0(e){if(typeof window>"u")return()=>{};const t=n=>{n.key===lm&&e()};return window.addEventListener(zf,e),window.addEventListener("storage",t),()=>{window.removeEventListener(zf,e),window.removeEventListener("storage",t)}}const om="nterminal.terminal.showScrollProgress",If="nterminal:terminal-scroll-progress";function Ff(){if(typeof window>"u")return!0;try{return window.localStorage.getItem(om)!=="false"}catch{return!0}}function UE(e){if(typeof window<"u"){try{window.localStorage.setItem(om,e?"true":"false")}catch{}window.dispatchEvent(new CustomEvent(If,{detail:e}))}return e}function i0(e){if(typeof window>"u")return()=>{};const t=n=>{n.key===om&&e()};return window.addEventListener(If,e),window.addEventListener("storage",t),()=>{window.removeEventListener(If,e),window.removeEventListener("storage",t)}}const cm="nterminal.shortcuts.workspace.v1",qf="nterminal:workspace-shortcuts",ro=[{id:"server.previous",label:"Previous server",group:"Servers"},{id:"server.next",label:"Next server",group:"Servers"},{id:"tab.previous",label:"Previous tab",group:"Tabs"},{id:"tab.next",label:"Next tab",group:"Tabs"},{id:"tab.index",label:"Select tab 1-9",group:"Tabs",indexed:!0},{id:"pane.index",label:"Select pane 1-9",group:"Panes",indexed:!0},{id:"split.right",label:"Split right",group:"Panes"},{id:"split.down",label:"Split down",group:"Panes"}],um={"server.previous":Mi("ArrowUp",{ctrlKey:!0}),"server.next":Mi("ArrowDown",{ctrlKey:!0}),"tab.previous":Mi("ArrowLeft",{ctrlKey:!0}),"tab.next":Mi("ArrowRight",{ctrlKey:!0}),"tab.index":Mi("Digit",{ctrlKey:!0,altKey:!0}),"pane.index":Mi("Digit",{ctrlKey:!0,altKey:!0,shiftKey:!0}),"split.right":Mi("ArrowRight",{ctrlKey:!0,altKey:!0,shiftKey:!0}),"split.down":Mi("ArrowDown",{ctrlKey:!0,altKey:!0,shiftKey:!0})},PE={"server.previous":Mi("BracketLeft",{ctrlKey:!0,altKey:!0,shiftKey:!0}),"server.next":Mi("BracketRight",{ctrlKey:!0,altKey:!0,shiftKey:!0}),"tab.previous":Mi("BracketLeft",{ctrlKey:!0,altKey:!0}),"tab.next":Mi("BracketRight",{ctrlKey:!0,altKey:!0}),"tab.index":Mi("Digit",{ctrlKey:!0,altKey:!0,shiftKey:!0}),"pane.index":Mi("Digit",{ctrlKey:!0,altKey:!0}),"split.right":Mi("ArrowRight",{ctrlKey:!0,altKey:!0,shiftKey:!0}),"split.down":Mi("ArrowDown",{ctrlKey:!0,altKey:!0,shiftKey:!0})};function jr(){const e=a0(um);if(typeof window>"u")return e;try{const t=window.localStorage.getItem(cm);if(!t)return e;const n=JSON.parse(t);for(const a of ro){const o=n[a.id];if(XE(o)){const c=l0(o,a);VE(c,PE[a.id])||(e[a.id]=c)}}}catch{return e}return e}function Wy(){return JSON.stringify(jr())}function KE(e,t){const n=jr(),a=ro.find(o=>o.id===e);return a&&(n[e]=l0(t,a),hm(n)),n}function IE(e){const t=jr();return t[e]={...um[e]},hm(t),t}function FE(){const e=a0(um);return hm(e),e}function s0(e){if(typeof window>"u")return()=>{};const t=n=>{n.key===cm&&e()};return window.addEventListener(qf,e),window.addEventListener("storage",t),()=>{window.removeEventListener(qf,e),window.removeEventListener("storage",t)}}function qE(e,t){const n=c0(e);return!n||ZE(n)||t.indexed&&o0(e)===null?null:{ctrlKey:e.ctrlKey,altKey:e.altKey,shiftKey:e.shiftKey,metaKey:e.metaKey,code:t.indexed?"Digit":n}}function WE(e){const t=jr();for(const n of ro){const a=t[n.id];if(!(!a||!GE(e,a))){if(n.indexed){if(a.code!=="Digit")continue;const o=o0(e);if(o!==null)return{id:n.id,index:o};continue}if(c0(e)===a.code)return{id:n.id,index:null}}}return null}function n0(e){return r0(jr()[e])}function r0(e){const t=[];return e.ctrlKey&&t.push("Ctrl"),e.altKey&&t.push("Alt"),e.shiftKey&&t.push("Shift"),e.metaKey&&t.push("Meta"),t.push(QE(e.code)),t.join("+")}const YE=()=>n0("split.right"),$E=()=>n0("split.down");function Mi(e,t){return{ctrlKey:t.ctrlKey??!1,altKey:t.altKey??!1,shiftKey:t.shiftKey??!1,metaKey:t.metaKey??!1,code:e}}function a0(e){return Object.fromEntries(Object.entries(e).map(([t,n])=>[t,{...n}]))}function VE(e,t){return e.ctrlKey===t.ctrlKey&&e.altKey===t.altKey&&e.shiftKey===t.shiftKey&&e.metaKey===t.metaKey&&e.code===t.code}function hm(e){if(!(typeof window>"u")){try{window.localStorage.setItem(cm,JSON.stringify(e))}catch{}window.dispatchEvent(new CustomEvent(qf))}}function l0(e,t){return{ctrlKey:!!e.ctrlKey,altKey:!!e.altKey,shiftKey:!!e.shiftKey,metaKey:!!e.metaKey,code:t.indexed?"Digit":e.code}}function XE(e){if(!e||typeof e!="object")return!1;const t=e;return typeof t.ctrlKey=="boolean"&&typeof t.altKey=="boolean"&&typeof t.shiftKey=="boolean"&&typeof t.metaKey=="boolean"&&typeof t.code=="string"&&t.code.length>0}function GE(e,t){return e.ctrlKey===t.ctrlKey&&e.altKey===t.altKey&&e.shiftKey===t.shiftKey&&e.metaKey===t.metaKey}function o0(e){const t=/^Digit([1-9])$/.exec(e.code);return t?.[1]?Number(t[1]):/^[1-9]$/.test(e.key)?Number(e.key):null}function c0(e){if(e.code)return e.code;if(/^[a-z]$/i.test(e.key))return`Key${e.key.toUpperCase()}`;if(/^[0-9]$/.test(e.key))return`Digit${e.key}`;switch(e.key){case"[":case"{":return"BracketLeft";case"]":case"}":return"BracketRight";case"ArrowLeft":case"ArrowRight":case"ArrowUp":case"ArrowDown":case"Tab":case"Enter":case"Escape":case"Space":return e.key==="Space"?"Space":e.key;default:return null}}function ZE(e){return e==="ControlLeft"||e==="ControlRight"||e==="AltLeft"||e==="AltRight"||e==="ShiftLeft"||e==="ShiftRight"||e==="MetaLeft"||e==="MetaRight"}function QE(e){if(e==="Digit")return"1-9";const t=/^Digit([0-9])$/.exec(e);if(t?.[1])return t[1];const n=/^Key([A-Z])$/.exec(e);if(n?.[1])return n[1];switch(e){case"BracketLeft":return"[";case"BracketRight":return"]";case"ArrowLeft":return"Left";case"ArrowRight":return"Right";case"ArrowUp":return"Up";case"ArrowDown":return"Down";case"Space":return"Space";default:return e.replace(/^(Numpad|Digit|Key)/,"")}}const dm="nterminal.theme.accent",Wf="nterminal:theme-accent",ao=[{id:"aqua",label:"Aqua Teal",accent:"#5EEAD4",soft:"rgba(94, 234, 212, 0.10)",glow:"rgba(94, 234, 212, 0.55)",xtermSelection:"#1f3f45"},{id:"signal-red",label:"Signal Red",accent:"#FF2A3D",soft:"rgba(255, 42, 61, 0.12)",glow:"rgba(255, 42, 61, 0.52)",xtermSelection:"#4a1b22"}],du="aqua";function wo(e){return ao.some(t=>t.id===e)?e:du}function fm(e){return ao.find(t=>t.id===e)??ao[0]}function lr(){if(typeof window>"u")return du;try{return wo(window.localStorage.getItem(dm))}catch{return du}}function JE(e){const t=wo(e);if(typeof window<"u"){try{window.localStorage.setItem(dm,t)}catch{}pm(t),window.dispatchEvent(new CustomEvent(Wf,{detail:t}))}return t}function pm(e=lr()){if(typeof document>"u")return;const t=fm(wo(e)),n=document.documentElement;n.style.setProperty("--nt-accent",t.accent),n.style.setProperty("--nt-accent-soft",t.soft),n.style.setProperty("--nt-accent-glow",t.glow)}function e2(e=lr()){return fm(wo(e)).accent}function t2(e=lr()){return fm(wo(e)).xtermSelection}function u0(e){if(typeof window>"u")return()=>{};const t=n=>{n.key===dm&&(pm(lr()),e())};return window.addEventListener(Wf,e),window.addEventListener("storage",t),()=>{window.removeEventListener(Wf,e),window.removeEventListener("storage",t)}}const i2="Automatic update needs write access to the global npm install. Run this from a normal NTerminal runtime-user shell; only the npm install step uses sudo.";function s2(e="nterminal",t=new Date){return{reason:"permission",message:i2,command:`sudo npm i -g ${e}@latest --prefer-online && nterminal restart`,detectedAt:t.toISOString()}}function n2(e){return/\b(?:EACCES|EPERM)\b|permission denied|missing write access|access denied|operation was rejected by your operating system|operation not permitted|root-owned files/i.test(e)}const h0=3600*1e3,r2="local",Yf=new Set,nr=new Map;let or={checking:!1,hasUpdates:!1,lastCheckedAt:null},mm=null,eo=null,fu=0,Jn=null;function a2(e){return Yf.add(e),()=>{Yf.delete(e)}}function Yy(){return or}function l2(e){const t=d2();mm=e,_m(),$f(e,t);const n=()=>{if(document.visibilityState!=="visible"||!cr(e,t))return;const a=or.lastCheckedAt;(a===null||Date.now()-a>=h0)&&$f(e,t)};return document.addEventListener("visibilitychange",n),()=>{document.removeEventListener("visibilitychange",n),cr(e,t)&&h2()}}function o2(e,t){nr.set(e,d0(t)),Ba({...or,hasUpdates:vm(),lastCheckedAt:Date.now()})}function sf(e){e===void 0?nr.clear():nr.set(e,!1),Ba({...or,hasUpdates:vm()})}async function $f(e,t){if(!cr(e,t))return;if(Jn&&Jn.api===e&&Jn.runId===t)return Jn.promise;Ba({...or,checking:!0});const n=c2(e,t).finally(()=>{Jn?.promise===n&&(Jn=null),cr(e,t)&&(Ba({...or,checking:!1,lastCheckedAt:Date.now()}),u2(e,t))});return Jn={api:e,runId:t,promise:n},n}async function c2(e,t){try{const n=await e.listAgents();if(!cr(e,t))return;const a=[{key:r2,check:()=>e.checkUpdate()},...n.agents.map(c=>({key:c.id,check:()=>e.checkAgentUpdate(c.id)}))],o=new Map;if(await Promise.all(a.map(async c=>{try{const d=await c.check();o.set(c.key,d0(d))}catch{o.set(c.key,nr.get(c.key)??!1)}})),!cr(e,t))return;nr.clear();for(const[c,d]of o)nr.set(c,d);Ba({...or,hasUpdates:vm()})}catch{}}function u2(e,t){cr(e,t)&&(_m(),eo=window.setTimeout(()=>{eo=null,cr(e,t)&&$f(e,t)},h0))}function h2(){fu+=1,_m(),mm=null,Jn=null,nr.clear(),Ba({checking:!1,hasUpdates:!1,lastCheckedAt:null})}function _m(){eo!==null&&(window.clearTimeout(eo),eo=null)}function d2(){return fu+=1,fu}function cr(e,t){return mm===e&&fu===t}function d0(e){return e.updateAvailable===!0}function vm(){return Array.from(nr.values()).some(Boolean)}function Ba(e){or=e;for(const t of Array.from(Yf))t()}const f2=e=>new Promise(t=>setTimeout(t,e));function p2({api:e,onAgentRemoved:t}){const[n,a]=g.useState([{key:"local",id:null,name:"Local (main)"}]),[o,c]=g.useState({}),[d,p]=g.useState(!1),[m,f]=g.useState(null),[S,y]=g.useState(!1);function b(j,$){c(H=>({...H,[j]:{...H[j],...$}}))}const x=j=>j.id===null?e.getVersion():e.getAgentVersion(j.id),C=j=>j.id===null?e.checkUpdate():e.checkAgentUpdate(j.id),k=j=>j.id===null?e.runUpdate():e.runAgentUpdate(j.id);g.useEffect(()=>{let j=!1;return e.listAgents().then($=>{if(j)return;const H=[{key:"local",id:null,name:"Local (main)"},...$.agents.map(L=>({key:L.id,id:L.id,name:L.name}))];a(H);for(const L of H)x(L).then(X=>b(L.key,{version:X,manualUpdate:X.manualUpdate??null})).catch(X=>b(L.key,{error:X instanceof Error?X.message:"unreachable"}))}).catch(()=>{}),()=>{j=!0}},[]);async function B(j){b(j.key,{busy:!0,status:"checking…",error:void 0});try{const $=await C(j);o2(j.key,$),b(j.key,{latestVersion:$.latestVersion,updateAvailable:$.updateAvailable,status:I($),...$.updateAvailable===!1?{manualUpdate:null}:{},busy:!1})}catch($){b(j.key,{busy:!1,error:$ instanceof Error?$.message:"check failed"})}}async function R(){p(!0),await Promise.all(n.map(j=>B(j))),p(!1)}async function re(j,$){const H=Date.now()+18e4;for(;Date.now()<H;){await f2(3e3);try{const L=await x(j);if($&&L.runningVersion!==$.runningVersion)return L}catch{}}return null}async function F(j){let $=o[j.key]?.version;if(!$)try{$=await x(j),b(j.key,{version:$,manualUpdate:$.manualUpdate??null})}catch(X){return b(j.key,{busy:!1,error:X instanceof Error?X.message:"version check failed"}),"failed"}b(j.key,{busy:!0,status:"updating…",error:void 0});let H;try{H=await k(j)}catch(X){return b(j.key,{busy:!1,error:X instanceof Error?X.message:"update failed"}),"failed"}if(!H.ok){const X=H.manualUpdate??(n2(H.message)?s2():null);return X?(b(j.key,{busy:!1,status:"manual update required",error:void 0,manualUpdate:X}),"manual"):(b(j.key,{busy:!1,status:void 0,error:H.message}),"failed")}if(!H.changed)return b(j.key,{busy:!1,status:"already up to date",updateAvailable:!1,manualUpdate:null}),sf(j.key),"unchanged";b(j.key,{status:"restarting…"});const L=await re(j,$);return L?(b(j.key,{busy:!1,version:L,updateAvailable:!1,status:"updated",manualUpdate:L.manualUpdate??null}),sf(j.key),j.id===null&&(y(!0),f("Main server updated. Reload the page to use the new client.")),"updated"):(b(j.key,{busy:!1,status:void 0,error:"timed out — check the server log"}),"failed")}async function J(j){if(!(j.id===null||!window.confirm([`Delete secondary server "${j.name}"?`,"","If the secondary is reachable, NTerminal will schedule a clean uninstall on that host, stop its runtime, remove its local state, and remove it from this main server.","If it is already gone or unreachable, only the stale registration on this main server will be removed.","","This can close live terminals on that secondary. Continue?"].join(`
14
+ `)))){b(j.key,{busy:!0,status:"deleting…",error:void 0}),f(null);try{const H=await e.uninstallAgent(j.id);a(L=>L.filter(X=>X.key!==j.key)),c(L=>{const X={...L};return delete X[j.key],X}),sf(j.key),t?.(j.id),f(H.message)}catch(H){b(j.key,{busy:!1,status:void 0,error:H instanceof Error?H.message:"delete failed"})}}}async function ce(){p(!0),f(null);const j=n.filter(Z=>Z.id!==null),$=n.find(Z=>Z.id===null),H=await Promise.all(j.map(Z=>F(Z))),L=H.filter(Z=>Z==="failed").length;let X=H.filter(Z=>Z==="manual").length;if(L>0){p(!1);return}if($){const Z=await F($);if(Z==="manual"&&(X+=1),Z==="updated"){p(!1);return}}X>0&&f("Some servers need manual update. Copy and run the command shown on each marked server."),p(!1)}function q(j){return j?j.error?j.error:j.status?j.status:j.manualUpdate?"manual update required":j.version?`v${j.version.version}`:"…":"…"}function I(j){return j.error?j.error:typeof j.updateAvailable=="boolean"?j.updateAvailable?`latest v${j.latestVersion??"available"}`:"up to date":"unknown"}function ie(j){const $=j?.version;return $?`npm package v${$.runningVersion}`:""}async function de(j,$){try{await m2($),b(j,{copiedCommand:!0}),window.setTimeout(()=>b(j,{copiedCommand:!1}),1800)}catch(H){b(j,{error:H instanceof Error?H.message:"copy failed"})}}return _.jsxs("section",{className:"security-section",children:[_.jsx("h3",{children:"Servers"}),_.jsxs("div",{className:"update-actions",children:[_.jsx("button",{type:"button",className:"secondary-button",onClick:()=>{R()},disabled:d,children:"Check for updates"}),_.jsx("button",{type:"button",onClick:()=>{ce()},disabled:d,children:"Update all"})]}),m?_.jsx("p",{className:"settings-status",children:m}):null,S?_.jsxs("div",{className:"server-reload-required",role:"status",children:[_.jsx("span",{children:"Main server update is ready."}),_.jsx("button",{type:"button",onClick:()=>window.location.reload(),children:"Reload page"})]}):null,_.jsx("ul",{className:"security-list",children:n.map(j=>{const $=o[j.key],H=ie($),L=$?.manualUpdate??null,X=$?.version!==void 0&&$?.updateAvailable!==!1&&!$?.busy&&!d,Z=j.id!==null&&!$?.busy&&!d;return _.jsxs("li",{children:[_.jsxs("div",{className:"server-row-main",children:[_.jsxs("div",{children:[_.jsx("span",{className:"security-item-label",children:j.name}),_.jsxs("span",{className:"security-item-meta",children:[H?`${H} — `:"",q($)]})]}),L?_.jsxs("div",{className:"server-manual-update",children:[_.jsx("span",{children:L.message}),_.jsxs("div",{className:"server-manual-command",children:[_.jsx("code",{children:L.command}),_.jsx("button",{type:"button",className:"secondary-button",onClick:()=>{de(j.key,L.command)},children:$?.copiedCommand?"Copied":"Copy"})]})]}):null]}),_.jsxs("div",{className:"server-row-actions",children:[_.jsx("button",{type:"button",className:"secondary-button",onClick:()=>{F(j)},disabled:!X,children:$?.busy?"…":"Update"}),j.id!==null?_.jsx("button",{type:"button",className:"server-delete-button",onClick:()=>{J(j)},disabled:!Z,children:"Delete"}):null]})]},j.key)})})]})}async function m2(e){if(navigator.clipboard?.writeText){await navigator.clipboard.writeText(e);return}const t=document.createElement("textarea");t.value=e,t.setAttribute("readonly","true"),t.style.position="fixed",t.style.opacity="0",document.body.appendChild(t),t.select();try{if(!document.execCommand("copy"))throw new Error("copy failed")}finally{t.remove()}}const Uc=[{id:"terminal",label:"Terminal"},{id:"shortcuts",label:"Shortcuts"},{id:"notifications",label:"Notifications"},{id:"security",label:"Security"},{id:"servers",label:"Servers"}];function _2({onClose:e,api:t,updateAvailable:n=!1,onNotificationAssetsChanged:a,onAgentRemoved:o}){const c=g.useMemo(()=>t??Eu(),[t]),[d,p]=g.useState(()=>Pf()),[m,f]=g.useState(()=>Kf()),[S,y]=g.useState(()=>Ff()),[b,x]=g.useState(()=>lr()),[C,k]=g.useState(()=>jr()),[B,R]=g.useState(null),[re,F]=g.useState(null),[J,ce]=g.useState("terminal"),[q,I]=g.useState(()=>Vb()),[ie,de]=g.useState(()=>zr()),[j,$]=g.useState(()=>nm()),[H,L]=g.useState([]),[X,Z]=g.useState([]),[A,V]=g.useState([]),[Q,ve]=g.useState(5*1024*1024),[Se,E]=g.useState(!1),[W,ee]=g.useState(null),he=g.useRef(null),ge=g.useRef(null),me=g.useRef({terminal:null,shortcuts:null,notifications:null,security:null,servers:null}),Ce=g.useMemo(()=>new Set(X),[X]),ze=!v2(X,A);g.useEffect(()=>e0(()=>p(Pf())),[]),g.useEffect(()=>t0(()=>f(Kf())),[]),g.useEffect(()=>i0(()=>y(Ff())),[]),g.useEffect(()=>u0(()=>x(lr())),[]),g.useEffect(()=>s0(()=>k(jr())),[]),g.useEffect(()=>Xb(()=>de(zr())),[]),g.useEffect(()=>{if(!B)return;const te=ro.find(He=>He.id===B);if(!te)return;const je=He=>{if(He.preventDefault(),He.stopPropagation(),He.key==="Escape"){R(null),F(null);return}const _i=qE(He,te);if(!_i){F(te.indexed?"Press a shortcut ending in a number from 1 to 9.":"Press a complete shortcut.");return}k(KE(B,_i)),R(null),F(null)};return window.addEventListener("keydown",je,!0),()=>window.removeEventListener("keydown",je,!0)},[B]),g.useEffect(()=>{let te=!1;return c.listNotificationAssets().then(je=>{te||Ee(je)}).catch(je=>{te||ee(Pc(je))}),()=>{te=!0}},[c]);function Ne(te){p(Hc(Number(te)))}function Re(te){de(qy(Number(te)))}function Pe(te){ce(te),me.current[te]?.scrollIntoView?.({block:"start",behavior:"smooth"})}function Ye(){const te=ge.current;if(!te)return;if(te.scrollTop+te.clientHeight>=te.scrollHeight-2){ce(Uc[Uc.length-1].id);return}const je=te.getBoundingClientRect();let He="terminal",_i=0;for(const Vi of Uc){const ai=me.current[Vi.id];if(!ai)continue;const kt=ai.getBoundingClientRect(),ji=Math.max(kt.top,je.top),Ti=Math.min(kt.bottom,je.bottom),Nt=Math.max(0,Ti-ji);Nt>_i&&(He=Vi.id,_i=Nt)}ce(He)}function Be(te){k(IE(te)),R(null),F(null)}function ae(){k(FE()),R(null),F(null)}function Ee(te){const je=te.assets.filter(He=>He.enabled).map(He=>He.id);L(te.assets),Z(je),V(je),ve(te.maxFileBytes),ee(null)}async function xe(){if(q){Fy(!1),I(!1);return}let te=j;te==="default"&&(te=await OE(),$(te)),te==="granted"&&(Fy(!0),I(!0))}async function Ke(te){const je=te?.[0];if(je){if(je.size>Q){ee(`File must be ${nf(Q)} or smaller.`),gt();return}if(je.type!=="video/mp4"&&je.type!=="video/webm"){ee("Upload an MP4 or WebM video."),gt();return}E(!0),ee(null);try{await c.uploadNotificationAsset(je),Ee(await c.listNotificationAssets()),a?.()}catch(He){ee(Pc(He))}finally{E(!1),gt()}}}async function Xe(te){E(!0),ee(null);try{await c.deleteNotificationAsset(te),Ee(await c.listNotificationAssets()),a?.()}catch(je){ee(Pc(je))}finally{E(!1)}}function gt(){he.current&&(he.current.value="")}function yt(te,je){const He=new Set(X);if(je?He.add(te):He.delete(te),He.size===0){ee("Keep at least one toast video selected.");return}ee(null),Z(Array.from(He))}async function mi(){if(X.length===0){ee("Keep at least one toast video selected.");return}E(!0),ee(null);try{const te=await c.updateNotificationAssetSelection({enabledAssetIds:X});Ee(te),a?.()}catch(te){ee(Pc(te))}finally{E(!1)}}return _.jsx("div",{className:"security-overlay",role:"dialog","aria-modal":"true","aria-label":"Settings",onClick:e,children:_.jsxs("div",{className:"security-panel settings-panel",onClick:te=>te.stopPropagation(),children:[_.jsxs("header",{className:"security-panel-header",children:[_.jsx("h2",{children:"Settings"}),_.jsx("button",{type:"button",className:"security-close","aria-label":"Close",onClick:e,children:"×"})]}),_.jsxs("div",{className:"settings-layout",children:[_.jsx("nav",{className:"settings-nav","aria-label":"Settings categories",children:Uc.map(te=>_.jsxs("button",{type:"button","data-active":J===te.id?"true":"false","aria-current":J===te.id?"true":void 0,onClick:()=>Pe(te.id),children:[te.label,te.id==="servers"&&n?_.jsx("span",{className:"update-pulse-dot settings-update-dot","aria-hidden":"true"}):null]},te.id))}),_.jsxs("div",{ref:ge,className:"settings-content",onScroll:Ye,children:[_.jsxs("section",{id:"settings-terminal",ref:te=>{me.current.terminal=te},className:"security-section settings-section",children:[_.jsx("h3",{children:"Terminal"}),_.jsxs("label",{className:"settings-control",children:[_.jsx("span",{children:"Font size"}),_.jsxs("span",{className:"settings-control-value",children:[d,"px"]}),_.jsx("input",{type:"range",min:jf,max:Hf,step:1,value:d,"aria-label":"Terminal font size",onChange:te=>Ne(te.currentTarget.value)})]}),_.jsxs("div",{className:"settings-stepper-row",children:[_.jsx("button",{type:"button",className:"secondary-button settings-stepper-button",onClick:()=>p(Hc(d-1)),children:"-"}),_.jsx("input",{type:"number",min:jf,max:Hf,step:1,value:d,"aria-label":"Terminal font size value",onChange:te=>Ne(te.currentTarget.value)}),_.jsx("button",{type:"button",className:"secondary-button settings-stepper-button",onClick:()=>p(Hc(d+1)),children:"+"}),_.jsx("button",{type:"button",className:"secondary-button settings-reset-button",onClick:()=>p(Hc(Lr)),children:"Reset"})]}),_.jsxs("label",{className:"settings-control",children:[_.jsx("span",{children:"Font family"}),_.jsx("select",{value:m,"aria-label":"Terminal font family",onChange:te=>f(HE(te.currentTarget.value)),children:hu.map(te=>_.jsx("option",{value:te.id,children:te.label},te.id))})]}),_.jsxs("label",{className:"auth-checkbox settings-checkbox",children:[_.jsx("input",{type:"checkbox",checked:S,onChange:te=>y(UE(te.currentTarget.checked))}),"Show scroll progress"]}),_.jsxs("label",{className:"settings-control",children:[_.jsx("span",{children:"Accent theme"}),_.jsx("select",{value:b,"aria-label":"Theme accent",onChange:te=>x(JE(te.currentTarget.value)),children:ao.map(te=>_.jsx("option",{value:te.id,children:te.label},te.id))})]}),_.jsx("div",{className:"settings-theme-swatches","aria-hidden":"true",children:ao.map(te=>_.jsx("span",{className:"settings-theme-swatch","data-active":b===te.id?"true":"false",style:{"--settings-theme-accent":te.accent}},te.id))})]}),_.jsxs("section",{id:"settings-shortcuts",ref:te=>{me.current.shortcuts=te},className:"security-section settings-section",children:[_.jsxs("div",{className:"settings-section-heading",children:[_.jsx("h3",{children:"Shortcuts"}),_.jsx("button",{type:"button",className:"secondary-button settings-reset-button",onClick:ae,children:"Reset all"})]}),_.jsx("p",{className:"muted",children:"Defaults avoid Chrome's browser-tab shortcuts. Click a shortcut, then press the new key combo."}),re?_.jsx("p",{className:"settings-error",children:re}):null,_.jsx("ul",{className:"settings-shortcut-list","aria-label":"Workspace shortcuts",children:ro.map(te=>{const je=B===te.id;return _.jsxs("li",{children:[_.jsxs("div",{children:[_.jsx("span",{className:"settings-shortcut-label",children:te.label}),_.jsx("span",{className:"settings-shortcut-group",children:te.group})]}),_.jsxs("div",{className:"settings-shortcut-actions",children:[_.jsx("button",{type:"button",className:"settings-shortcut-recorder","data-recording":je?"true":"false",onClick:()=>{R(te.id),F(null)},children:je?"Press keys…":r0(C[te.id])}),_.jsx("button",{type:"button",className:"secondary-button settings-shortcut-reset",onClick:()=>Be(te.id),children:"Reset"})]})]},te.id)})})]}),_.jsxs("section",{id:"settings-notifications",ref:te=>{me.current.notifications=te},className:"security-section settings-section",children:[_.jsx("h3",{children:"Notifications"}),Mu()?_.jsxs(_.Fragment,{children:[_.jsxs("label",{className:"auth-checkbox",children:[_.jsx("input",{type:"checkbox",checked:q&&j==="granted",onChange:()=>{xe()},disabled:j==="denied"}),"System notification when page is hidden"]}),j==="denied"?_.jsx("p",{className:"muted",children:"Notification permission is blocked for this site. Re-enable it in the browser's site settings, then come back here to turn the toggle on."}):_.jsx("p",{className:"muted",children:"Uses browser notifications only when this page isn't visible. Animated toast is controlled separately below."})]}):_.jsx("p",{className:"muted",children:"This browser doesn't expose the Notification API; animated toast and in-app badges can still work."}),_.jsxs("label",{className:"auth-checkbox settings-checkbox",children:[_.jsx("input",{type:"checkbox",checked:ie.enabled,onChange:te=>de(ME(te.currentTarget.checked))}),"Show animated completion toast"]}),_.jsxs("label",{className:"settings-control",children:[_.jsx("span",{children:"Toast duration"}),_.jsx("span",{className:"settings-control-value",children:ie.persistUntilDismissed?"Until closed":`${ie.durationSeconds}s`}),_.jsx("input",{type:"range",min:Bf,max:Lf,step:.5,value:ie.durationSeconds,disabled:!ie.enabled||ie.persistUntilDismissed,"aria-label":"Completion toast duration",onChange:te=>Re(te.currentTarget.value)})]}),_.jsxs("div",{className:"settings-stepper-row settings-duration-row",children:[_.jsx("input",{type:"number",min:Bf,max:Lf,step:.5,value:ie.durationSeconds,disabled:!ie.enabled||ie.persistUntilDismissed,"aria-label":"Completion toast duration value",onChange:te=>Re(te.currentTarget.value)}),_.jsx("button",{type:"button",className:"secondary-button settings-reset-button",disabled:!ie.enabled||ie.persistUntilDismissed,onClick:()=>de(qy(Jl)),children:"Reset"})]}),_.jsxs("label",{className:"auth-checkbox settings-checkbox",children:[_.jsx("input",{type:"checkbox",checked:ie.persistUntilDismissed,disabled:!ie.enabled,onChange:te=>de(AE(te.currentTarget.checked))}),"Keep toast until dismissed"]}),_.jsxs("div",{className:"settings-assets-header",children:[_.jsx("span",{children:"Toast videos"}),_.jsxs("span",{children:[nf(Q)," max"]})]}),_.jsx("input",{ref:he,type:"file",accept:"video/mp4,video/webm",className:"settings-asset-input","aria-label":"Upload toast video",onChange:te=>{Ke(te.currentTarget.files)}}),_.jsx("button",{type:"button",className:"secondary-button settings-upload-button",disabled:Se,onClick:()=>he.current?.click(),children:"Upload video"}),W?_.jsx("p",{className:"settings-error",children:W}):null,H.length>0?_.jsx("ul",{className:"settings-asset-list","aria-label":"Toast videos",children:H.map(te=>_.jsxs("li",{"data-enabled":Ce.has(te.id)?"true":"false",children:[_.jsxs("label",{className:"settings-asset-choice",children:[_.jsx("input",{type:"checkbox",checked:Ce.has(te.id),disabled:Se,"aria-label":`Use ${te.filename}`,onChange:je=>yt(te.id,je.currentTarget.checked)}),_.jsx("video",{src:te.url,muted:!0,autoPlay:!0,loop:!0,playsInline:!0,"aria-hidden":"true"}),_.jsxs("span",{className:"settings-asset-copy",children:[_.jsx("span",{children:te.filename}),_.jsx("small",{children:te.source==="built-in"?"Built-in":nf(te.size)})]})]}),te.source==="uploaded"?_.jsx("button",{type:"button",className:"secondary-button settings-asset-delete",disabled:Se,"aria-label":`Delete ${te.filename}`,onClick:()=>{Xe(te.id)},children:"x"}):null]},te.id))}):_.jsx("p",{className:"muted",children:"Built-in videos will be used."}),_.jsx("button",{type:"button",className:"secondary-button settings-save-assets-button",disabled:Se||H.length===0||!ze,onClick:()=>{mi()},children:"Save selected videos"})]}),_.jsx("div",{id:"settings-security",ref:te=>{me.current.security=te},className:"settings-section-group",children:_.jsx(RE,{api:c})}),_.jsx("div",{id:"settings-servers",ref:te=>{me.current.servers=te},className:"settings-section-group",children:_.jsx(p2,{api:c,...o?{onAgentRemoved:o}:{}})})]})]})]})})}function nf(e){return e>=1024*1024?`${Math.round(e/1024/1024*10)/10} MB`:e>=1024?`${Math.round(e/1024*10)/10} KB`:`${e} B`}function Pc(e){return e instanceof Error?e.message:"Request failed."}function v2(e,t){if(e.length!==t.length)return!1;const n=new Set(t);return e.every(a=>n.has(a))}class Dr extends Error{constructor(t,n){super(n),this.status=t,this.name="UploadClientError"}status}function g2(e){const t=e.createXhr?.()??new XMLHttpRequest,n=new FormData,a=e.files.map((o,c)=>({fieldName:`file${c}`,relativePath:o.relativePath,size:o.file.size}));n.append("manifest",JSON.stringify({terminalId:e.terminalId,entries:a}));for(const[o,c]of e.files.entries())n.append(`file${o}`,c.file);return new Promise((o,c)=>{let d=!1;const p=()=>{e.signal?.removeEventListener("abort",S)},m=y=>{d||(d=!0,p(),o(y))},f=y=>{d||(d=!0,p(),c(y))},S=()=>{t.abort(),f(new Dr(0,"Upload aborted."))};if(e.signal?.aborted){f(new Dr(0,"Upload aborted."));return}e.signal?.addEventListener("abort",S,{once:!0}),t.open("POST","/api/uploads"),t.withCredentials=!0,t.upload.onprogress=y=>{if(e.onProgress){if(y.lengthComputable&&y.total>0){e.onProgress({loaded:y.loaded,total:y.total,percent:Math.round(y.loaded/y.total*100)});return}e.onProgress({loaded:y.loaded,total:null,percent:null})}},t.onload=()=>{if(t.status>=200&&t.status<300){try{m(JSON.parse(t.responseText))}catch{f(new Dr(t.status,"Invalid upload response."))}return}f(new Dr(t.status,y2(t.responseText,t.statusText||`HTTP ${t.status}`)))},t.onerror=()=>f(new Dr(0,"Upload failed.")),t.onabort=()=>f(new Dr(0,"Upload aborted.")),t.ontimeout=()=>f(new Dr(0,"Upload timed out.")),t.send(n)})}function y2(e,t){try{const n=JSON.parse(e),a=typeof n.error=="string"?n.error:n.message;if(typeof a=="string"&&a.trim())return a}catch{}return t}const S2="modulepreload",b2=function(e){return"/"+e},$y={},f0=function(t,n,a){let o=Promise.resolve();if(n&&n.length>0){let m=function(f){return Promise.all(f.map(S=>Promise.resolve(S).then(y=>({status:"fulfilled",value:y}),y=>({status:"rejected",reason:y}))))};document.getElementsByTagName("link");const d=document.querySelector("meta[property=csp-nonce]"),p=d?.nonce||d?.getAttribute("nonce");o=m(n.map(f=>{if(f=b2(f),f in $y)return;$y[f]=!0;const S=f.endsWith(".css"),y=S?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${f}"]${y}`))return;const b=document.createElement("link");if(b.rel=S?"stylesheet":S2,S||(b.as="script"),b.crossOrigin="",b.href=f,p&&b.setAttribute("nonce",p),document.head.appendChild(b),S)return new Promise((x,C)=>{b.addEventListener("load",x),b.addEventListener("error",()=>C(new Error(`Unable to preload CSS for ${f}`)))})}))}function c(d){const p=new Event("vite:preloadError",{cancelable:!0});if(p.payload=d,window.dispatchEvent(p),!p.defaultPrevented)throw d}return o.then(d=>{for(const p of d||[])p.status==="rejected"&&c(p.reason);return t().catch(c)})},w2=g.lazy(()=>f0(()=>import("./MarkdownPreview-Dqb1LX21.js"),[]));function C2({api:e,activeTerminalId:t,activeTerminalCwd:n,onOpenFile:a}){const[o,c]=g.useState(null),[d,p]=g.useState(""),[m,f]=g.useState({}),[S,y]=g.useState(()=>new Set),[b,x]=g.useState(null),[C,k]=g.useState({type:"empty"}),[B,R]=g.useState("idle"),[re,F]=g.useState(null),J=g.useRef(null),ce=g.useRef(null),q=g.useRef(!1),I=g.useRef(0),ie=g.useRef(null);ie.current===null&&t&&(ie.current=t);const de=ie.current,j=t?af(t,n):null,$=o?[o.rootPath,d].filter(Boolean).join("/"):"",H=b?.path??null;g.useEffect(()=>(q.current=!0,()=>{q.current=!1,I.current+=1,ze()}),[]),g.useEffect(()=>{ie.current=t,ce.current=null;const ae=t?af(t,n):null;L(t,ae)},[e]),g.useEffect(()=>{if(!de||t!==de)return;const ae=af(de,n);ae!==ce.current&&L(de,ae)},[de,t,n]);async function L(ae,Ee=j){const xe=Ne();if(ce.current=Ee,ze(),c(null),p(""),f({}),y(new Set),x(null),k({type:"empty"}),F(null),!ae){R("idle");return}R("loading");try{const Ke=await e.createFileRoot({terminalId:ae});if(!Re(xe))return;c({rootToken:Ke.rootToken,rootPath:Ke.rootPath});const Xe=await e.listFiles({rootToken:Ke.rootToken,path:""});if(!Re(xe))return;A(Xe),R("idle")}catch(Ke){if(await Pe(Ke,xe))return;Re(xe)&&(F(Xn(Ke)),R("idle"))}}async function X(ae=d,Ee=o){if(!Ee)return;const xe=Ne();R("loading"),F(null);try{const Ke=await e.listFiles({rootToken:Ee.rootToken,path:ae});if(!Re(xe))return;A(Ke),R("idle")}catch(Ke){if(await Pe(Ke,xe))return;Re(xe)&&(F(Xn(Ke)),R("idle"))}}async function Z(){ie.current=t,await L(t,j)}function A(ae){f(Ee=>({...Ee,[ae.path]:E2(ae.entries)}))}async function V(ae){if(!(!rf(ae)||!o)){if(x(ae),F(null),ae.kind==="directory"){p(ae.path),Ce(),await ve(ae);return}if(p(Rr(ae.path)),ae.editable){await E(ae);return}ae.previewKind!=="none"&&await ee(ae,ae.previewKind)}}async function Q(ae){if(!(!rf(ae)||!o)){if(x(ae),F(null),ae.kind==="directory"){p(ae.path),Ce(),await ve(ae);return}if(p(Rr(ae.path)),ae.editable){await W(ae);return}ae.previewKind!=="none"&&await ee(ae,ae.previewKind)}}async function ve(ae){if(S.has(ae.path)){y(Ee=>{const xe=new Set(Ee);return xe.delete(ae.path),xe});return}y(Ee=>new Set(Ee).add(ae.path)),await X(ae.path)}function Se(ae,Ee){ae.key==="Enter"&&(ae.preventDefault(),Q(Ee))}async function E(ae){if(!o)return;const Ee=Ne();R("loading"),ze();try{const xe=await e.readFile({rootToken:o.rootToken,path:ae.path});if(!Re(Ee))return;k({type:"text-preview",file:ae,read:xe}),R("idle")}catch(xe){if(await Pe(xe,Ee))return;Re(Ee)&&(F(Xn(xe)),R("idle"))}}async function W(ae){if(!o)return;const Ee=Ne();R("loading");try{await a({rootToken:o.rootToken,path:ae.path}),Re(Ee)&&R("idle")}catch(xe){if(await Pe(xe,Ee))return;Re(Ee)&&(F(Xn(xe)),R("idle"))}}async function ee(ae,Ee){if(!o)return;const xe=Ne();R("loading"),ze();try{const Ke=await e.previewFile({rootToken:o.rootToken,path:ae.path});if(!Re(xe))return;const Xe=URL.createObjectURL(Ke);if(!Re(xe)){URL.revokeObjectURL(Xe);return}J.current=Xe,k({type:"preview",file:ae,previewKind:Ee,url:Xe}),R("idle")}catch(Ke){if(await Pe(Ke,xe))return;Re(xe)&&(F(Xn(Ke)),R("idle"))}}async function he(ae){if(!o)return;const Ee=ae==="file"?"New file":"New folder",xe=window.prompt(Ee,""),Ke=b?b.kind==="directory"?b.path:Rr(b.path):d,Xe=Vy(xe,Ke);if(Xe){F(null);try{const gt=await e.createFileEntry({rootToken:o.rootToken,path:Xe,kind:ae});x(gt.entry),await X(Ke)}catch(gt){if(await Pe(gt))return;F(Xn(gt))}}}async function ge(){if(!o||!b)return;const ae=window.prompt("Move selected entry",b.path),Ee=Vy(ae,"");if(!Ee||Ee===b.path)return;const xe=Rr(b.path),Ke=Rr(Ee);F(null);try{const Xe=await e.moveFileEntry({rootToken:o.rootToken,sourcePath:b.path,destinationPath:Ee});x(Xe.entry),p(Xe.entry.kind==="directory"?Xe.entry.path:Rr(Xe.entry.path)),Ce(),await X(xe),Ke!==xe&&await X(Ke)}catch(Xe){if(await Pe(Xe))return;F(Xn(Xe))}}async function me(){if(!o||!b)return;const ae=b.path,Ee=Rr(ae);F(null);try{const xe=await e.previewDeleteFileEntry({rootToken:o.rootToken,path:b.path}),Ke=xe.descendantCount>0?` and ${xe.descendantCount} nested item${xe.descendantCount===1?"":"s"}`:"";if(!window.confirm(`Delete ${xe.path}${Ke}?`))return;await e.deleteFileEntry({rootToken:o.rootToken,path:b.path,previewToken:xe.previewToken}),x(null),p(Ee),y(Xe=>{const gt=new Set(Xe);for(const yt of Xe)(yt===ae||yt.startsWith(`${ae}/`))&&gt.delete(yt);return gt}),Ce(),await X(Ee)}catch(xe){if(await Pe(xe))return;F(Xn(xe))}}function Ce(){I.current+=1,ze(),k({type:"empty"})}function ze(){J.current&&(URL.revokeObjectURL(J.current),J.current=null)}function Ne(){return I.current+=1,I.current}function Re(ae){return q.current&&ae===I.current}async function Pe(ae,Ee){return T2(ae)?(Ee!==void 0&&!Re(Ee)||await L(t,j),!0):!1}function Ye(ae,Ee){const xe=rf(ae),Ke=ae.kind==="directory"&&S.has(ae.path),Xe=m[ae.path]??[],gt={"--file-tree-depth":Ee};return _.jsxs(xi.Fragment,{children:[_.jsxs("button",{type:"button",className:"file-entry-button","data-kind":ae.kind,"data-expanded":Ke,"data-active":H===ae.path,disabled:!xe,style:gt,"aria-expanded":ae.kind==="directory"?Ke:void 0,"aria-label":`${ae.kind==="directory"?"Open folder":"Open file"} ${ae.name}`,title:ae.kind==="directory"?"Expand or collapse folder":"Click to preview. Double-click or press Enter to open.",onClick:()=>{V(ae)},onDoubleClick:()=>{Q(ae)},onKeyDown:yt=>Se(yt,ae),children:[_.jsx("span",{className:"file-entry-disclosure","aria-hidden":"true",children:ae.kind==="directory"?Ke?"▾":"▸":""}),_.jsx("span",{className:"file-entry-name",children:ae.name}),_.jsx("small",{children:x2(ae)})]}),Ke?_.jsx("div",{className:"file-tree-children",role:"group",children:Xe.map(yt=>Ye(yt,Ee+1))}):null]},ae.path)}const Be=m[""]??[];return _.jsxs("section",{className:"file-explorer","aria-label":"Files","aria-busy":B==="loading",children:[_.jsxs("header",{className:"file-explorer-header",children:[_.jsx("div",{className:"file-explorer-path",title:$,children:$||"No active pane"}),_.jsxs("div",{className:"file-explorer-toolbar","aria-label":"File actions",children:[_.jsx("button",{type:"button","aria-label":"Refresh files",title:"Refresh",disabled:!t,onClick:()=>{Z()},children:"↻"}),_.jsx("button",{type:"button","aria-label":"New file",title:"New file",disabled:!o,onClick:()=>{he("file")},children:"+"}),_.jsx("button",{type:"button","aria-label":"New folder",title:"New folder",disabled:!o,onClick:()=>{he("directory")},children:"▣"})]})]}),re?_.jsx("div",{className:"file-explorer-alert",role:"alert",children:re}):null,_.jsxs("div",{className:"file-explorer-layout",children:[_.jsx("div",{className:"file-tree","aria-label":$?`Files in ${$}`:"Files",children:Be.map(ae=>Ye(ae,0))}),_.jsxs("section",{className:"file-detail","aria-label":"File detail",children:[_.jsxs("div",{className:"file-detail-header",children:[_.jsx("strong",{children:b?.name??"detail"}),_.jsxs("div",{className:"file-detail-actions",children:[_.jsx("button",{type:"button","aria-label":"Move selected entry",disabled:!b,onClick:()=>{ge()},children:"Move"}),_.jsx("button",{type:"button","aria-label":"Delete selected entry",disabled:!b,onClick:()=>{me()},children:"Delete"})]})]}),B==="loading"?_.jsx("div",{className:"file-detail-empty",children:"loading"}):null,C.type==="empty"&&B!=="loading"?_.jsx("div",{className:"file-detail-empty",children:"No file selected"}):null,C.type==="preview"?_.jsxs("div",{className:"file-preview-frame",children:[C.previewKind==="image"?_.jsx("img",{src:C.url,alt:C.file.name}):null,C.previewKind==="pdf"?_.jsx("iframe",{src:C.url,title:C.file.name}):null]}):null,C.type==="text-preview"&&C.read.language==="markdown"?_.jsx("div",{className:"file-markdown-preview","aria-label":`Preview for ${C.file.name}`,children:_.jsx(g.Suspense,{fallback:_.jsx("div",{className:"file-markdown-preview-loading",children:"loading preview"}),children:_.jsx(w2,{content:C.read.content})})}):null,C.type==="text-preview"&&C.read.language==="text"?_.jsx("pre",{className:"file-text-preview","aria-label":`Preview for ${C.file.name}`,children:C.read.content}):null]})]})]})}function rf(e){return e.kind==="directory"||e.editable||e.previewKind!=="none"}function x2(e){return e.kind==="directory"?"dir":e.editable?"edit":e.previewKind!=="none"?e.previewKind:"unsupported"}function af(e,t){return`${e}\0${t??""}`}function E2(e){return[...e].sort((t,n)=>t.kind==="directory"&&n.kind!=="directory"?-1:t.kind!=="directory"&&n.kind==="directory"?1:t.name.localeCompare(n.name))}function Rr(e){const t=e.split("/").filter(Boolean);return t.pop(),t.join("/")}function Vy(e,t){if(e===null)return null;const n=e.trim().replace(/^\/+/,"").replace(/\/{2,}/g,"/").replace(/\/$/,"");return n?!t||n.includes("/")?n:`${t}/${n}`:null}function Xn(e){return e instanceof Error?e.message:"Request failed"}function T2(e){return e instanceof yn&&e.status===409&&e.message==="terminal_cwd_changed"}const k2=g.lazy(()=>f0(()=>import("./MarkdownPreview-Dqb1LX21.js"),[]));function Xy({api:e,editor:t,canClose:n,onClose:a}){const[o,c]=g.useState(t.read),[d,p]=g.useState(t.read.content),[m,f]=g.useState("idle"),[S,y]=g.useState(null),[b,x]=g.useState(!1),[C,k]=g.useState("edit"),B=g.useRef(t),R=g.useRef(t.read),re=g.useRef(t.read.content),F=g.useRef(!1),J=g.useRef(!1),ce=g.useRef(0),q=d!==o.content&&m!=="saving"&&!b;g.useEffect(()=>(J.current=!0,()=>{J.current=!1,ce.current+=1}),[]),g.useEffect(()=>{ce.current+=1,F.current=!1,B.current=t,R.current=t.read,re.current=t.read.content,c(t.read),p(t.read.content),f("idle"),y(null),x(!1),k("edit")},[t.id,t.read]),g.useEffect(()=>{B.current=t},[t]),g.useEffect(()=>{R.current=o},[o]),g.useEffect(()=>{re.current=d},[d]),g.useEffect(()=>{if(d===o.content||b)return;const $=window.setInterval(()=>{!F.current&&re.current!==R.current.content&&I()},1e3);return()=>window.clearInterval($)},[d===o.content,b,t.id]);async function I(){if(F.current)return;const $=re.current,H=R.current;if($===H.content)return;const L=B.current,X=ce.current;F.current=!0,f("saving"),y(null),x(!1);try{const Z=await e.writeFile({rootToken:L.rootToken,path:L.path,content:$,expectedVersion:H.version});if(!J.current||X!==ce.current)return;const A={...H,content:$,version:Z.version};R.current=A,c(A),f(re.current===$?"saved":"idle")}catch(Z){if(!J.current||X!==ce.current)return;if(Z instanceof yn&&Z.status===409){x(!0),f("idle");return}y(D2(Z)),f("idle")}finally{X===ce.current&&(F.current=!1)}}const ie=m==="saving"?"saving":m==="saved"?"saved":o.language,de=o.language==="markdown",j=de&&C==="preview";return _.jsxs("section",{className:"editor-pane","aria-label":`Editor pane ${t.title}`,children:[_.jsxs("header",{className:"editor-pane-header",children:[_.jsx("span",{className:"terminal-pane-dot","aria-hidden":"true"}),_.jsx("strong",{children:t.title}),_.jsx("span",{className:"terminal-pane-spacer"}),_.jsx("span",{className:"terminal-pane-state",children:ie}),_.jsx("button",{type:"button","aria-label":`Save ${t.title}`,disabled:!q,onClick:()=>{I()},children:"Save"}),de?_.jsx("button",{type:"button","aria-label":`${j?"Edit":"Preview"} ${t.title}`,onClick:()=>k($=>$==="preview"?"edit":"preview"),children:j?"Edit":"Preview"}):null,n?_.jsx("button",{type:"button",className:"terminal-pane-close","aria-label":`Close editor ${t.title}`,onClick:a,children:"x"}):null]}),S?_.jsx("div",{className:"editor-pane-alert",role:"alert",children:S}):null,b?_.jsx("div",{className:"editor-pane-alert",role:"alert",children:"File changed on disk."}):null,j?_.jsx("div",{className:"editor-markdown-preview","aria-label":`Markdown preview for ${t.title}`,children:_.jsx(g.Suspense,{fallback:_.jsx("div",{className:"editor-markdown-preview-loading",children:"loading preview"}),children:_.jsx(k2,{content:d})})}):_.jsx("textarea",{className:"editor-pane-textarea","aria-label":`Editor for ${t.title}`,spellCheck:!1,value:d,onChange:$=>{const H=$.target.value;re.current=H,p(H),f("idle"),y(null),x(!1)}})]})}function D2(e){return e instanceof Error?e.message:"Request failed"}var R2=2,M2=1,A2=class{activate(e){this._terminal=e}dispose(){}fit(){let e=this.proposeDimensions();if(!e||!this._terminal||isNaN(e.cols)||isNaN(e.rows))return;let t=this._terminal._core;(this._terminal.rows!==e.rows||this._terminal.cols!==e.cols)&&(t._renderService.clear(),this._terminal.resize(e.cols,e.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;let e=this._terminal._core._renderService.dimensions;if(e.css.cell.width===0||e.css.cell.height===0)return;let t=this._terminal.options.scrollback===0?0:this._terminal.options.overviewRuler?.width||14,n=window.getComputedStyle(this._terminal.element.parentElement),a=parseInt(n.getPropertyValue("height")),o=Math.max(0,parseInt(n.getPropertyValue("width"))),c=window.getComputedStyle(this._terminal.element),d={top:parseInt(c.getPropertyValue("padding-top")),bottom:parseInt(c.getPropertyValue("padding-bottom")),right:parseInt(c.getPropertyValue("padding-right")),left:parseInt(c.getPropertyValue("padding-left"))},p=d.top+d.bottom,m=d.right+d.left,f=a-p,S=o-m-t;return{cols:Math.max(R2,Math.floor(S/e.css.cell.width)),rows:Math.max(M2,Math.floor(f/e.css.cell.height))}}};var p0=Object.defineProperty,N2=Object.getOwnPropertyDescriptor,B2=(e,t)=>{for(var n in t)p0(e,n,{get:t[n],enumerable:!0})},Ht=(e,t,n,a)=>{for(var o=a>1?void 0:a?N2(t,n):t,c=e.length-1,d;c>=0;c--)(d=e[c])&&(o=(a?d(t,n,o):d(o))||o);return a&&o&&p0(t,n,o),o},ye=(e,t)=>(n,a)=>t(n,a,e),Gy="Terminal input",Vf={get:()=>Gy,set:e=>Gy=e},Zy="Too much output to announce, navigate to rows manually to read",Xf={get:()=>Zy,set:e=>Zy=e};function L2(e){return e.replace(/\r?\n/g,"\r")}function O2(e,t){return t?"\x1B[200~"+e+"\x1B[201~":e}function z2(e,t){e.clipboardData&&e.clipboardData.setData("text/plain",t.selectionText),e.preventDefault()}function j2(e,t,n,a){if(e.stopPropagation(),e.clipboardData){let o=e.clipboardData.getData("text/plain");m0(o,t,n,a)}}function m0(e,t,n,a){e=L2(e),e=O2(e,n.decPrivateModes.bracketedPasteMode&&a.rawOptions.ignoreBracketedPasteMode!==!0),n.triggerDataEvent(e,!0),t.value=""}function _0(e,t,n){let a=n.getBoundingClientRect(),o=e.clientX-a.left-10,c=e.clientY-a.top-10;t.style.width="20px",t.style.height="20px",t.style.left=`${o}px`,t.style.top=`${c}px`,t.style.zIndex="1000",t.focus()}function Qy(e,t,n,a,o){_0(e,t,n),o&&a.rightClickSelect(e),t.value=a.selectionText,t.select()}function tr(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}function Au(e,t=0,n=e.length){let a="";for(let o=t;o<n;++o){let c=e[o];c>65535?(c-=65536,a+=String.fromCharCode((c>>10)+55296)+String.fromCharCode(c%1024+56320)):a+=String.fromCharCode(c)}return a}var H2=class{constructor(){this._interim=0}clear(){this._interim=0}decode(e,t){let n=e.length;if(!n)return 0;let a=0,o=0;if(this._interim){let c=e.charCodeAt(o++);56320<=c&&c<=57343?t[a++]=(this._interim-55296)*1024+c-56320+65536:(t[a++]=this._interim,t[a++]=c),this._interim=0}for(let c=o;c<n;++c){let d=e.charCodeAt(c);if(55296<=d&&d<=56319){if(++c>=n)return this._interim=d,a;let p=e.charCodeAt(c);56320<=p&&p<=57343?t[a++]=(d-55296)*1024+p-56320+65536:(t[a++]=d,t[a++]=p);continue}d!==65279&&(t[a++]=d)}return a}},U2=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(e,t){let n=e.length;if(!n)return 0;let a=0,o,c,d,p,m=0,f=0;if(this.interim[0]){let b=!1,x=this.interim[0];x&=(x&224)===192?31:(x&240)===224?15:7;let C=0,k;for(;(k=this.interim[++C]&63)&&C<4;)x<<=6,x|=k;let B=(this.interim[0]&224)===192?2:(this.interim[0]&240)===224?3:4,R=B-C;for(;f<R;){if(f>=n)return 0;if(k=e[f++],(k&192)!==128){f--,b=!0;break}else this.interim[C++]=k,x<<=6,x|=k&63}b||(B===2?x<128?f--:t[a++]=x:B===3?x<2048||x>=55296&&x<=57343||x===65279||(t[a++]=x):x<65536||x>1114111||(t[a++]=x)),this.interim.fill(0)}let S=n-4,y=f;for(;y<n;){for(;y<S&&!((o=e[y])&128)&&!((c=e[y+1])&128)&&!((d=e[y+2])&128)&&!((p=e[y+3])&128);)t[a++]=o,t[a++]=c,t[a++]=d,t[a++]=p,y+=4;if(o=e[y++],o<128)t[a++]=o;else if((o&224)===192){if(y>=n)return this.interim[0]=o,a;if(c=e[y++],(c&192)!==128){y--;continue}if(m=(o&31)<<6|c&63,m<128){y--;continue}t[a++]=m}else if((o&240)===224){if(y>=n)return this.interim[0]=o,a;if(c=e[y++],(c&192)!==128){y--;continue}if(y>=n)return this.interim[0]=o,this.interim[1]=c,a;if(d=e[y++],(d&192)!==128){y--;continue}if(m=(o&15)<<12|(c&63)<<6|d&63,m<2048||m>=55296&&m<=57343||m===65279)continue;t[a++]=m}else if((o&248)===240){if(y>=n)return this.interim[0]=o,a;if(c=e[y++],(c&192)!==128){y--;continue}if(y>=n)return this.interim[0]=o,this.interim[1]=c,a;if(d=e[y++],(d&192)!==128){y--;continue}if(y>=n)return this.interim[0]=o,this.interim[1]=c,this.interim[2]=d,a;if(p=e[y++],(p&192)!==128){y--;continue}if(m=(o&7)<<18|(c&63)<<12|(d&63)<<6|p&63,m<65536||m>1114111)continue;t[a++]=m}}return a}},v0="",sr=" ",Co=class g0{constructor(){this.fg=0,this.bg=0,this.extended=new pu}static toColorRGB(t){return[t>>>16&255,t>>>8&255,t&255]}static fromColorRGB(t){return(t[0]&255)<<16|(t[1]&255)<<8|t[2]&255}clone(){let t=new g0;return t.fg=this.fg,t.bg=this.bg,t.extended=this.extended.clone(),t}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}},pu=class y0{constructor(t=0,n=0){this._ext=0,this._urlId=0,this._ext=t,this._urlId=n}get ext(){return this._urlId?this._ext&-469762049|this.underlineStyle<<26:this._ext}set ext(t){this._ext=t}get underlineStyle(){return this._urlId?5:(this._ext&469762048)>>26}set underlineStyle(t){this._ext&=-469762049,this._ext|=t<<26&469762048}get underlineColor(){return this._ext&67108863}set underlineColor(t){this._ext&=-67108864,this._ext|=t&67108863}get urlId(){return this._urlId}set urlId(t){this._urlId=t}get underlineVariantOffset(){let t=(this._ext&3758096384)>>29;return t<0?t^4294967288:t}set underlineVariantOffset(t){this._ext&=536870911,this._ext|=t<<29&3758096384}clone(){return new y0(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},xs=class S0 extends Co{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new pu,this.combinedData=""}static fromCharData(t){let n=new S0;return n.setFromCharData(t),n}isCombined(){return this.content&2097152}getWidth(){return this.content>>22}getChars(){return this.content&2097152?this.combinedData:this.content&2097151?tr(this.content&2097151):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):this.content&2097151}setFromCharData(t){this.fg=t[0],this.bg=0;let n=!1;if(t[1].length>2)n=!0;else if(t[1].length===2){let a=t[1].charCodeAt(0);if(55296<=a&&a<=56319){let o=t[1].charCodeAt(1);56320<=o&&o<=57343?this.content=(a-55296)*1024+o-56320+65536|t[2]<<22:n=!0}else n=!0}else this.content=t[1].charCodeAt(0)|t[2]<<22;n&&(this.combinedData=t[1],this.content=2097152|t[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},Jy="di$target",Gf="di$dependencies",lf=new Map;function P2(e){return e[Gf]||[]}function pi(e){if(lf.has(e))return lf.get(e);let t=function(n,a,o){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");K2(t,n,o)};return t._id=e,lf.set(e,t),t}function K2(e,t,n){t[Jy]===t?t[Gf].push({id:e,index:n}):(t[Gf]=[{id:e,index:n}],t[Jy]=t)}var Oi=pi("BufferService"),b0=pi("CoreMouseService"),Pr=pi("CoreService"),I2=pi("CharsetService"),gm=pi("InstantiationService"),w0=pi("LogService"),zi=pi("OptionsService"),C0=pi("OscLinkService"),F2=pi("UnicodeService"),xo=pi("DecorationService"),Zf=class{constructor(e,t,n){this._bufferService=e,this._optionsService=t,this._oscLinkService=n}provideLinks(e,t){let n=this._bufferService.buffer.lines.get(e-1);if(!n){t(void 0);return}let a=[],o=this._optionsService.rawOptions.linkHandler,c=new xs,d=n.getTrimmedLength(),p=-1,m=-1,f=!1;for(let S=0;S<d;S++)if(!(m===-1&&!n.hasContent(S))){if(n.loadCell(S,c),c.hasExtendedAttrs()&&c.extended.urlId)if(m===-1){m=S,p=c.extended.urlId;continue}else f=c.extended.urlId!==p;else m!==-1&&(f=!0);if(f||m!==-1&&S===d-1){let y=this._oscLinkService.getLinkData(p)?.uri;if(y){let b={start:{x:m+1,y:e},end:{x:S+(!f&&S===d-1?1:0),y:e}},x=!1;if(!o?.allowNonHttpProtocols)try{let C=new URL(y);["http:","https:"].includes(C.protocol)||(x=!0)}catch{x=!0}x||a.push({text:y,range:b,activate:(C,k)=>o?o.activate(C,k,b):q2(C,k),hover:(C,k)=>o?.hover?.(C,k,b),leave:(C,k)=>o?.leave?.(C,k,b)})}f=!1,c.hasExtendedAttrs()&&c.extended.urlId?(m=S,p=c.extended.urlId):(m=-1,p=-1)}}t(a)}};Zf=Ht([ye(0,Oi),ye(1,zi),ye(2,C0)],Zf);function q2(e,t){if(confirm(`Do you want to navigate to ${t}?
15
15
 
16
16
  WARNING: This link could potentially be dangerous`)){let n=window.open();if(n){try{n.opener=null}catch{}n.location.href=t}else console.warn("Opening link blocked as opener could not be cleared")}}var Nu=pi("CharSizeService"),bn=pi("CoreBrowserService"),ym=pi("MouseService"),wn=pi("RenderService"),W2=pi("SelectionService"),x0=pi("CharacterJoinerService"),Ha=pi("ThemeService"),E0=pi("LinkProviderService"),Y2=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?eS.isErrorNoTelemetry(e)?new eS(e.message+`
17
17
 
18
18
  `+e.stack):new Error(e.message+`
19
19
 
20
- `+e.stack):e},0)}}addListener(e){return this.listeners.push(e),()=>{this._removeListener(e)}}emit(e){this.listeners.forEach(t=>{t(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)}},$2=new Y2;function Zc(e){V2(e)||$2.onUnexpectedError(e)}var Qf="Canceled";function V2(e){return e instanceof X2?!0:e instanceof Error&&e.name===Qf&&e.message===Qf}var X2=class extends Error{constructor(){super(Qf),this.name=this.message}};function G2(e){return new Error(`Illegal argument: ${e}`)}var eS=class Jf extends Error{constructor(t){super(t),this.name="CodeExpectedError"}static fromError(t){if(t instanceof Jf)return t;let n=new Jf;return n.message=t.message,n.stack=t.stack,n}static isErrorNoTelemetry(t){return t.name==="CodeExpectedError"}},ep=class T0 extends Error{constructor(t){super(t||"An unexpected bug occurred."),Object.setPrototypeOf(this,T0.prototype)}};function as(e,t=0){return e[e.length-(1+t)]}var Z2;(e=>{function t(c){return c<0}e.isLessThan=t;function n(c){return c<=0}e.isLessThanOrEqual=n;function a(c){return c>0}e.isGreaterThan=a;function o(c){return c===0}e.isNeitherLessOrGreaterThan=o,e.greaterThan=1,e.lessThan=-1,e.neitherLessOrGreaterThan=0})(Z2||={});function Q2(e,t){let n=this,a=!1,o;return function(){return a||(a=!0,t||(o=e.apply(n,arguments))),o}}var k0;(e=>{function t(J){return J&&typeof J=="object"&&typeof J[Symbol.iterator]=="function"}e.is=t;let n=Object.freeze([]);function a(){return n}e.empty=a;function*o(J){yield J}e.single=o;function c(J){return t(J)?J:o(J)}e.wrap=c;function d(J){return J||n}e.from=d;function*p(J){for(let ce=J.length-1;ce>=0;ce--)yield J[ce]}e.reverse=p;function m(J){return!J||J[Symbol.iterator]().next().done===!0}e.isEmpty=m;function f(J){return J[Symbol.iterator]().next().value}e.first=f;function S(J,ce){let q=0;for(let I of J)if(ce(I,q++))return!0;return!1}e.some=S;function y(J,ce){for(let q of J)if(ce(q))return q}e.find=y;function*b(J,ce){for(let q of J)ce(q)&&(yield q)}e.filter=b;function*x(J,ce){let q=0;for(let I of J)yield ce(I,q++)}e.map=x;function*C(J,ce){let q=0;for(let I of J)yield*ce(I,q++)}e.flatMap=C;function*k(...J){for(let ce of J)yield*ce}e.concat=k;function B(J,ce,q){let I=q;for(let ie of J)I=ce(I,ie);return I}e.reduce=B;function*R(J,ce,q=J.length){for(ce<0&&(ce+=J.length),q<0?q+=J.length:q>J.length&&(q=J.length);ce<q;ce++)yield J[ce]}e.slice=R;function re(J,ce=Number.POSITIVE_INFINITY){let q=[];if(ce===0)return[q,J];let I=J[Symbol.iterator]();for(let ie=0;ie<ce;ie++){let de=I.next();if(de.done)return[q,e.empty()];q.push(de.value)}return[q,{[Symbol.iterator](){return I}}]}e.consume=re;async function F(J){let ce=[];for await(let q of J)ce.push(q);return Promise.resolve(ce)}e.asyncToArray=F})(k0||={});function Hr(e){if(k0.is(e)){let t=[];for(let n of e)if(n)try{n.dispose()}catch(a){t.push(a)}if(t.length===1)throw t[0];if(t.length>1)throw new AggregateError(t,"Encountered errors while disposing of store");return Array.isArray(e)?[]:e}else if(e)return e.dispose(),e}function J2(...e){return Tt(()=>Hr(e))}function Tt(e){return{dispose:Q2(()=>{e()})}}var D0=class R0{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{Hr(this._toDispose)}finally{this._toDispose.clear()}}add(t){if(!t)return t;if(t===this)throw new Error("Cannot register a disposable on itself!");return this._isDisposed?R0.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(t),t}delete(t){if(t){if(t===this)throw new Error("Cannot dispose a disposable on itself!");this._toDispose.delete(t),t.dispose()}}deleteAndLeak(t){t&&this._toDispose.has(t)&&(this._toDispose.delete(t),void 0)}};D0.DISABLE_DISPOSED_WARNING=!1;var rr=D0,We=class{constructor(){this._store=new rr,this._store}dispose(){this._store.dispose()}_register(e){if(e===this)throw new Error("Cannot register a disposable on itself!");return this._store.add(e)}};We.None=Object.freeze({dispose(){}});var La=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(e){this._isDisposed||e===this._value||(this._value?.dispose(),this._value=e)}clear(){this.value=void 0}dispose(){this._isDisposed=!0,this._value?.dispose(),this._value=void 0}clearAndLeak(){let e=this._value;return this._value=void 0,e}},gn=typeof window=="object"?window:globalThis,tp=class ip{constructor(t){this.element=t,this.next=ip.Undefined,this.prev=ip.Undefined}};tp.Undefined=new tp(void 0);var Mt=tp,tS=class{constructor(){this._first=Mt.Undefined,this._last=Mt.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===Mt.Undefined}clear(){let e=this._first;for(;e!==Mt.Undefined;){let t=e.next;e.prev=Mt.Undefined,e.next=Mt.Undefined,e=t}this._first=Mt.Undefined,this._last=Mt.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){let n=new Mt(e);if(this._first===Mt.Undefined)this._first=n,this._last=n;else if(t){let o=this._last;this._last=n,n.prev=o,o.next=n}else{let o=this._first;this._first=n,n.next=o,o.prev=n}this._size+=1;let a=!1;return()=>{a||(a=!0,this._remove(n))}}shift(){if(this._first!==Mt.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==Mt.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==Mt.Undefined&&e.next!==Mt.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===Mt.Undefined&&e.next===Mt.Undefined?(this._first=Mt.Undefined,this._last=Mt.Undefined):e.next===Mt.Undefined?(this._last=this._last.prev,this._last.next=Mt.Undefined):e.prev===Mt.Undefined&&(this._first=this._first.next,this._first.prev=Mt.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==Mt.Undefined;)yield e.element,e=e.next}},eT=globalThis.performance&&typeof globalThis.performance.now=="function",tT=class M0{static create(t){return new M0(t)}constructor(t){this._now=eT&&t===!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}},Ei;(e=>{e.None=()=>We.None;function t(H,L){return y(H,()=>{},0,void 0,!0,void 0,L)}e.defer=t;function n(H){return(L,X=null,G)=>{let M=!1,V;return V=H(Q=>{if(!M)return V?V.dispose():M=!0,L.call(X,Q)},null,G),M&&V.dispose(),V}}e.once=n;function a(H,L,X){return f((G,M=null,V)=>H(Q=>G.call(M,L(Q)),null,V),X)}e.map=a;function o(H,L,X){return f((G,M=null,V)=>H(Q=>{L(Q),G.call(M,Q)},null,V),X)}e.forEach=o;function c(H,L,X){return f((G,M=null,V)=>H(Q=>L(Q)&&G.call(M,Q),null,V),X)}e.filter=c;function d(H){return H}e.signal=d;function p(...H){return(L,X=null,G)=>{let M=J2(...H.map(V=>V(Q=>L.call(X,Q))));return S(M,G)}}e.any=p;function m(H,L,X,G){let M=X;return a(H,V=>(M=L(M,V),M),G)}e.reduce=m;function f(H,L){let X,G={onWillAddFirstListener(){X=H(M.fire,M)},onDidRemoveLastListener(){X?.dispose()}},M=new _e(G);return L?.add(M),M.event}function S(H,L){return L instanceof Array?L.push(H):L&&L.add(H),H}function y(H,L,X=100,G=!1,M=!1,V,Q){let ve,Se,E,W=0,ee,he={leakWarningThreshold:V,onWillAddFirstListener(){ve=H(me=>{W++,Se=L(Se,me),G&&!E&&(ge.fire(Se),Se=void 0),ee=()=>{let Ce=Se;Se=void 0,E=void 0,(!G||W>1)&&ge.fire(Ce),W=0},typeof X=="number"?(clearTimeout(E),E=setTimeout(ee,X)):E===void 0&&(E=0,queueMicrotask(ee))})},onWillRemoveListener(){M&&W>0&&ee?.()},onDidRemoveLastListener(){ee=void 0,ve.dispose()}},ge=new _e(he);return Q?.add(ge),ge.event}e.debounce=y;function b(H,L=0,X){return e.debounce(H,(G,M)=>G?(G.push(M),G):[M],L,void 0,!0,void 0,X)}e.accumulate=b;function x(H,L=(G,M)=>G===M,X){let G=!0,M;return c(H,V=>{let Q=G||!L(V,M);return G=!1,M=V,Q},X)}e.latch=x;function C(H,L,X){return[e.filter(H,L,X),e.filter(H,G=>!L(G),X)]}e.split=C;function k(H,L=!1,X=[],G){let M=X.slice(),V=H(Se=>{M?M.push(Se):ve.fire(Se)});G&&G.add(V);let Q=()=>{M?.forEach(Se=>ve.fire(Se)),M=null},ve=new _e({onWillAddFirstListener(){V||(V=H(Se=>ve.fire(Se)),G&&G.add(V))},onDidAddFirstListener(){M&&(L?setTimeout(Q):Q())},onDidRemoveLastListener(){V&&V.dispose(),V=null}});return G&&G.add(ve),ve.event}e.buffer=k;function B(H,L){return(X,G,M)=>{let V=L(new re);return H(function(Q){let ve=V.evaluate(Q);ve!==R&&X.call(G,ve)},void 0,M)}}e.chain=B;let R=Symbol("HaltChainable");class re{constructor(){this.steps=[]}map(L){return this.steps.push(L),this}forEach(L){return this.steps.push(X=>(L(X),X)),this}filter(L){return this.steps.push(X=>L(X)?X:R),this}reduce(L,X){let G=X;return this.steps.push(M=>(G=L(G,M),G)),this}latch(L=(X,G)=>X===G){let X=!0,G;return this.steps.push(M=>{let V=X||!L(M,G);return X=!1,G=M,V?M:R}),this}evaluate(L){for(let X of this.steps)if(L=X(L),L===R)break;return L}}function F(H,L,X=G=>G){let G=(...ve)=>Q.fire(X(...ve)),M=()=>H.on(L,G),V=()=>H.removeListener(L,G),Q=new _e({onWillAddFirstListener:M,onDidRemoveLastListener:V});return Q.event}e.fromNodeEventEmitter=F;function J(H,L,X=G=>G){let G=(...ve)=>Q.fire(X(...ve)),M=()=>H.addEventListener(L,G),V=()=>H.removeEventListener(L,G),Q=new _e({onWillAddFirstListener:M,onDidRemoveLastListener:V});return Q.event}e.fromDOMEventEmitter=J;function ce(H){return new Promise(L=>n(H)(L))}e.toPromise=ce;function q(H){let L=new _e;return H.then(X=>{L.fire(X)},()=>{L.fire(void 0)}).finally(()=>{L.dispose()}),L.event}e.fromPromise=q;function I(H,L){return H(X=>L.fire(X))}e.forward=I;function ie(H,L,X){return L(X),H(G=>L(G))}e.runAndSubscribe=ie;class de{constructor(L,X){this._observable=L,this._counter=0,this._hasChanged=!1;let G={onWillAddFirstListener:()=>{L.addObserver(this)},onDidRemoveLastListener:()=>{L.removeObserver(this)}};this.emitter=new _e(G),X&&X.add(this.emitter)}beginUpdate(L){this._counter++}handlePossibleChange(L){}handleChange(L,X){this._hasChanged=!0}endUpdate(L){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function j(H,L){return new de(H,L).emitter.event}e.fromObservable=j;function $(H){return(L,X,G)=>{let M=0,V=!1,Q={beginUpdate(){M++},endUpdate(){M--,M===0&&(H.reportChanges(),V&&(V=!1,L.call(X)))},handlePossibleChange(){},handleChange(){V=!0}};H.addObserver(Q),H.reportChanges();let ve={dispose(){H.removeObserver(Q)}};return G instanceof rr?G.add(ve):Array.isArray(G)&&G.push(ve),ve}}e.fromObservableLight=$})(Ei||={});var sp=class np{constructor(t){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${t}_${np._idPool++}`,np.all.add(this)}start(t){this._stopWatch=new tT,this.listenerCount=t}stop(){if(this._stopWatch){let t=this._stopWatch.elapsed();this.durations.push(t),this.elapsedOverall+=t,this.invocationCount+=1,this._stopWatch=void 0}}};sp.all=new Set,sp._idPool=0;var iT=sp,sT=-1,A0=class N0{constructor(t,n,a=(N0._idPool++).toString(16).padStart(3,"0")){this._errorHandler=t,this.threshold=n,this.name=a,this._warnCountdown=0}dispose(){this._stacks?.clear()}check(t,n){let a=this.threshold;if(a<=0||n<a)return;this._stacks||(this._stacks=new Map);let o=this._stacks.get(t.value)||0;if(this._stacks.set(t.value,o+1),this._warnCountdown-=1,this._warnCountdown<=0){this._warnCountdown=a*.5;let[c,d]=this.getMostFrequentStack(),p=`[${this.name}] potential listener LEAK detected, having ${n} listeners already. MOST frequent listener (${d}):`;console.warn(p),console.warn(c);let m=new aT(p,c);this._errorHandler(m)}return()=>{let c=this._stacks.get(t.value)||0;this._stacks.set(t.value,c-1)}}getMostFrequentStack(){if(!this._stacks)return;let t,n=0;for(let[a,o]of this._stacks)(!t||n<o)&&(t=[a,o],n=o);return t}};A0._idPool=1;var nT=A0,rT=class B0{constructor(t){this.value=t}static create(){let t=new Error;return new B0(t.stack??"")}print(){console.warn(this.value.split(`
20
+ `+e.stack):e},0)}}addListener(e){return this.listeners.push(e),()=>{this._removeListener(e)}}emit(e){this.listeners.forEach(t=>{t(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)}},$2=new Y2;function Zc(e){V2(e)||$2.onUnexpectedError(e)}var Qf="Canceled";function V2(e){return e instanceof X2?!0:e instanceof Error&&e.name===Qf&&e.message===Qf}var X2=class extends Error{constructor(){super(Qf),this.name=this.message}};function G2(e){return new Error(`Illegal argument: ${e}`)}var eS=class Jf extends Error{constructor(t){super(t),this.name="CodeExpectedError"}static fromError(t){if(t instanceof Jf)return t;let n=new Jf;return n.message=t.message,n.stack=t.stack,n}static isErrorNoTelemetry(t){return t.name==="CodeExpectedError"}},ep=class T0 extends Error{constructor(t){super(t||"An unexpected bug occurred."),Object.setPrototypeOf(this,T0.prototype)}};function as(e,t=0){return e[e.length-(1+t)]}var Z2;(e=>{function t(c){return c<0}e.isLessThan=t;function n(c){return c<=0}e.isLessThanOrEqual=n;function a(c){return c>0}e.isGreaterThan=a;function o(c){return c===0}e.isNeitherLessOrGreaterThan=o,e.greaterThan=1,e.lessThan=-1,e.neitherLessOrGreaterThan=0})(Z2||={});function Q2(e,t){let n=this,a=!1,o;return function(){return a||(a=!0,t||(o=e.apply(n,arguments))),o}}var k0;(e=>{function t(J){return J&&typeof J=="object"&&typeof J[Symbol.iterator]=="function"}e.is=t;let n=Object.freeze([]);function a(){return n}e.empty=a;function*o(J){yield J}e.single=o;function c(J){return t(J)?J:o(J)}e.wrap=c;function d(J){return J||n}e.from=d;function*p(J){for(let ce=J.length-1;ce>=0;ce--)yield J[ce]}e.reverse=p;function m(J){return!J||J[Symbol.iterator]().next().done===!0}e.isEmpty=m;function f(J){return J[Symbol.iterator]().next().value}e.first=f;function S(J,ce){let q=0;for(let I of J)if(ce(I,q++))return!0;return!1}e.some=S;function y(J,ce){for(let q of J)if(ce(q))return q}e.find=y;function*b(J,ce){for(let q of J)ce(q)&&(yield q)}e.filter=b;function*x(J,ce){let q=0;for(let I of J)yield ce(I,q++)}e.map=x;function*C(J,ce){let q=0;for(let I of J)yield*ce(I,q++)}e.flatMap=C;function*k(...J){for(let ce of J)yield*ce}e.concat=k;function B(J,ce,q){let I=q;for(let ie of J)I=ce(I,ie);return I}e.reduce=B;function*R(J,ce,q=J.length){for(ce<0&&(ce+=J.length),q<0?q+=J.length:q>J.length&&(q=J.length);ce<q;ce++)yield J[ce]}e.slice=R;function re(J,ce=Number.POSITIVE_INFINITY){let q=[];if(ce===0)return[q,J];let I=J[Symbol.iterator]();for(let ie=0;ie<ce;ie++){let de=I.next();if(de.done)return[q,e.empty()];q.push(de.value)}return[q,{[Symbol.iterator](){return I}}]}e.consume=re;async function F(J){let ce=[];for await(let q of J)ce.push(q);return Promise.resolve(ce)}e.asyncToArray=F})(k0||={});function Hr(e){if(k0.is(e)){let t=[];for(let n of e)if(n)try{n.dispose()}catch(a){t.push(a)}if(t.length===1)throw t[0];if(t.length>1)throw new AggregateError(t,"Encountered errors while disposing of store");return Array.isArray(e)?[]:e}else if(e)return e.dispose(),e}function J2(...e){return Tt(()=>Hr(e))}function Tt(e){return{dispose:Q2(()=>{e()})}}var D0=class R0{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{Hr(this._toDispose)}finally{this._toDispose.clear()}}add(t){if(!t)return t;if(t===this)throw new Error("Cannot register a disposable on itself!");return this._isDisposed?R0.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(t),t}delete(t){if(t){if(t===this)throw new Error("Cannot dispose a disposable on itself!");this._toDispose.delete(t),t.dispose()}}deleteAndLeak(t){t&&this._toDispose.has(t)&&(this._toDispose.delete(t),void 0)}};D0.DISABLE_DISPOSED_WARNING=!1;var rr=D0,We=class{constructor(){this._store=new rr,this._store}dispose(){this._store.dispose()}_register(e){if(e===this)throw new Error("Cannot register a disposable on itself!");return this._store.add(e)}};We.None=Object.freeze({dispose(){}});var La=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(e){this._isDisposed||e===this._value||(this._value?.dispose(),this._value=e)}clear(){this.value=void 0}dispose(){this._isDisposed=!0,this._value?.dispose(),this._value=void 0}clearAndLeak(){let e=this._value;return this._value=void 0,e}},gn=typeof window=="object"?window:globalThis,tp=class ip{constructor(t){this.element=t,this.next=ip.Undefined,this.prev=ip.Undefined}};tp.Undefined=new tp(void 0);var Mt=tp,tS=class{constructor(){this._first=Mt.Undefined,this._last=Mt.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===Mt.Undefined}clear(){let e=this._first;for(;e!==Mt.Undefined;){let t=e.next;e.prev=Mt.Undefined,e.next=Mt.Undefined,e=t}this._first=Mt.Undefined,this._last=Mt.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){let n=new Mt(e);if(this._first===Mt.Undefined)this._first=n,this._last=n;else if(t){let o=this._last;this._last=n,n.prev=o,o.next=n}else{let o=this._first;this._first=n,n.next=o,o.prev=n}this._size+=1;let a=!1;return()=>{a||(a=!0,this._remove(n))}}shift(){if(this._first!==Mt.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==Mt.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==Mt.Undefined&&e.next!==Mt.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===Mt.Undefined&&e.next===Mt.Undefined?(this._first=Mt.Undefined,this._last=Mt.Undefined):e.next===Mt.Undefined?(this._last=this._last.prev,this._last.next=Mt.Undefined):e.prev===Mt.Undefined&&(this._first=this._first.next,this._first.prev=Mt.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==Mt.Undefined;)yield e.element,e=e.next}},eT=globalThis.performance&&typeof globalThis.performance.now=="function",tT=class M0{static create(t){return new M0(t)}constructor(t){this._now=eT&&t===!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}},Ei;(e=>{e.None=()=>We.None;function t(H,L){return y(H,()=>{},0,void 0,!0,void 0,L)}e.defer=t;function n(H){return(L,X=null,Z)=>{let A=!1,V;return V=H(Q=>{if(!A)return V?V.dispose():A=!0,L.call(X,Q)},null,Z),A&&V.dispose(),V}}e.once=n;function a(H,L,X){return f((Z,A=null,V)=>H(Q=>Z.call(A,L(Q)),null,V),X)}e.map=a;function o(H,L,X){return f((Z,A=null,V)=>H(Q=>{L(Q),Z.call(A,Q)},null,V),X)}e.forEach=o;function c(H,L,X){return f((Z,A=null,V)=>H(Q=>L(Q)&&Z.call(A,Q),null,V),X)}e.filter=c;function d(H){return H}e.signal=d;function p(...H){return(L,X=null,Z)=>{let A=J2(...H.map(V=>V(Q=>L.call(X,Q))));return S(A,Z)}}e.any=p;function m(H,L,X,Z){let A=X;return a(H,V=>(A=L(A,V),A),Z)}e.reduce=m;function f(H,L){let X,Z={onWillAddFirstListener(){X=H(A.fire,A)},onDidRemoveLastListener(){X?.dispose()}},A=new _e(Z);return L?.add(A),A.event}function S(H,L){return L instanceof Array?L.push(H):L&&L.add(H),H}function y(H,L,X=100,Z=!1,A=!1,V,Q){let ve,Se,E,W=0,ee,he={leakWarningThreshold:V,onWillAddFirstListener(){ve=H(me=>{W++,Se=L(Se,me),Z&&!E&&(ge.fire(Se),Se=void 0),ee=()=>{let Ce=Se;Se=void 0,E=void 0,(!Z||W>1)&&ge.fire(Ce),W=0},typeof X=="number"?(clearTimeout(E),E=setTimeout(ee,X)):E===void 0&&(E=0,queueMicrotask(ee))})},onWillRemoveListener(){A&&W>0&&ee?.()},onDidRemoveLastListener(){ee=void 0,ve.dispose()}},ge=new _e(he);return Q?.add(ge),ge.event}e.debounce=y;function b(H,L=0,X){return e.debounce(H,(Z,A)=>Z?(Z.push(A),Z):[A],L,void 0,!0,void 0,X)}e.accumulate=b;function x(H,L=(Z,A)=>Z===A,X){let Z=!0,A;return c(H,V=>{let Q=Z||!L(V,A);return Z=!1,A=V,Q},X)}e.latch=x;function C(H,L,X){return[e.filter(H,L,X),e.filter(H,Z=>!L(Z),X)]}e.split=C;function k(H,L=!1,X=[],Z){let A=X.slice(),V=H(Se=>{A?A.push(Se):ve.fire(Se)});Z&&Z.add(V);let Q=()=>{A?.forEach(Se=>ve.fire(Se)),A=null},ve=new _e({onWillAddFirstListener(){V||(V=H(Se=>ve.fire(Se)),Z&&Z.add(V))},onDidAddFirstListener(){A&&(L?setTimeout(Q):Q())},onDidRemoveLastListener(){V&&V.dispose(),V=null}});return Z&&Z.add(ve),ve.event}e.buffer=k;function B(H,L){return(X,Z,A)=>{let V=L(new re);return H(function(Q){let ve=V.evaluate(Q);ve!==R&&X.call(Z,ve)},void 0,A)}}e.chain=B;let R=Symbol("HaltChainable");class re{constructor(){this.steps=[]}map(L){return this.steps.push(L),this}forEach(L){return this.steps.push(X=>(L(X),X)),this}filter(L){return this.steps.push(X=>L(X)?X:R),this}reduce(L,X){let Z=X;return this.steps.push(A=>(Z=L(Z,A),Z)),this}latch(L=(X,Z)=>X===Z){let X=!0,Z;return this.steps.push(A=>{let V=X||!L(A,Z);return X=!1,Z=A,V?A:R}),this}evaluate(L){for(let X of this.steps)if(L=X(L),L===R)break;return L}}function F(H,L,X=Z=>Z){let Z=(...ve)=>Q.fire(X(...ve)),A=()=>H.on(L,Z),V=()=>H.removeListener(L,Z),Q=new _e({onWillAddFirstListener:A,onDidRemoveLastListener:V});return Q.event}e.fromNodeEventEmitter=F;function J(H,L,X=Z=>Z){let Z=(...ve)=>Q.fire(X(...ve)),A=()=>H.addEventListener(L,Z),V=()=>H.removeEventListener(L,Z),Q=new _e({onWillAddFirstListener:A,onDidRemoveLastListener:V});return Q.event}e.fromDOMEventEmitter=J;function ce(H){return new Promise(L=>n(H)(L))}e.toPromise=ce;function q(H){let L=new _e;return H.then(X=>{L.fire(X)},()=>{L.fire(void 0)}).finally(()=>{L.dispose()}),L.event}e.fromPromise=q;function I(H,L){return H(X=>L.fire(X))}e.forward=I;function ie(H,L,X){return L(X),H(Z=>L(Z))}e.runAndSubscribe=ie;class de{constructor(L,X){this._observable=L,this._counter=0,this._hasChanged=!1;let Z={onWillAddFirstListener:()=>{L.addObserver(this)},onDidRemoveLastListener:()=>{L.removeObserver(this)}};this.emitter=new _e(Z),X&&X.add(this.emitter)}beginUpdate(L){this._counter++}handlePossibleChange(L){}handleChange(L,X){this._hasChanged=!0}endUpdate(L){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function j(H,L){return new de(H,L).emitter.event}e.fromObservable=j;function $(H){return(L,X,Z)=>{let A=0,V=!1,Q={beginUpdate(){A++},endUpdate(){A--,A===0&&(H.reportChanges(),V&&(V=!1,L.call(X)))},handlePossibleChange(){},handleChange(){V=!0}};H.addObserver(Q),H.reportChanges();let ve={dispose(){H.removeObserver(Q)}};return Z instanceof rr?Z.add(ve):Array.isArray(Z)&&Z.push(ve),ve}}e.fromObservableLight=$})(Ei||={});var sp=class np{constructor(t){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${t}_${np._idPool++}`,np.all.add(this)}start(t){this._stopWatch=new tT,this.listenerCount=t}stop(){if(this._stopWatch){let t=this._stopWatch.elapsed();this.durations.push(t),this.elapsedOverall+=t,this.invocationCount+=1,this._stopWatch=void 0}}};sp.all=new Set,sp._idPool=0;var iT=sp,sT=-1,A0=class N0{constructor(t,n,a=(N0._idPool++).toString(16).padStart(3,"0")){this._errorHandler=t,this.threshold=n,this.name=a,this._warnCountdown=0}dispose(){this._stacks?.clear()}check(t,n){let a=this.threshold;if(a<=0||n<a)return;this._stacks||(this._stacks=new Map);let o=this._stacks.get(t.value)||0;if(this._stacks.set(t.value,o+1),this._warnCountdown-=1,this._warnCountdown<=0){this._warnCountdown=a*.5;let[c,d]=this.getMostFrequentStack(),p=`[${this.name}] potential listener LEAK detected, having ${n} listeners already. MOST frequent listener (${d}):`;console.warn(p),console.warn(c);let m=new aT(p,c);this._errorHandler(m)}return()=>{let c=this._stacks.get(t.value)||0;this._stacks.set(t.value,c-1)}}getMostFrequentStack(){if(!this._stacks)return;let t,n=0;for(let[a,o]of this._stacks)(!t||n<o)&&(t=[a,o],n=o);return t}};A0._idPool=1;var nT=A0,rT=class B0{constructor(t){this.value=t}static create(){let t=new Error;return new B0(t.stack??"")}print(){console.warn(this.value.split(`
21
21
  `).slice(2).join(`
22
22
  `))}},aT=class extends Error{constructor(e,t){super(e),this.name="ListenerLeakError",this.stack=t}},lT=class extends Error{constructor(e,t){super(e),this.name="ListenerRefusalError",this.stack=t}},oT=0,of=class{constructor(e){this.value=e,this.id=oT++}},cT=2,uT,_e=class{constructor(e){this._size=0,this._options=e,this._leakageMon=this._options?.leakWarningThreshold?new nT(e?.onListenerError??Zc,this._options?.leakWarningThreshold??sT):void 0,this._perfMon=this._options?._profName?new iT(this._options._profName):void 0,this._deliveryQueue=this._options?.deliveryQueue}dispose(){this._disposed||(this._disposed=!0,this._deliveryQueue?.current===this&&this._deliveryQueue.reset(),this._listeners&&(this._listeners=void 0,this._size=0),this._options?.onDidRemoveLastListener?.(),this._leakageMon?.dispose())}get event(){return this._event??=(e,t,n)=>{if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let d=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(d);let p=this._leakageMon.getMostFrequentStack()??["UNKNOWN stack",-1],m=new lT(`${d}. HINT: Stack shows most frequent listener (${p[1]}-times)`,p[0]);return(this._options?.onListenerError||Zc)(m),We.None}if(this._disposed)return We.None;t&&(e=e.bind(t));let a=new of(e),o;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(a.stack=rT.create(),o=this._leakageMon.check(a.stack,this._size+1)),this._listeners?this._listeners instanceof of?(this._deliveryQueue??=new hT,this._listeners=[this._listeners,a]):this._listeners.push(a):(this._options?.onWillAddFirstListener?.(this),this._listeners=a,this._options?.onDidAddFirstListener?.(this)),this._size++;let c=Tt(()=>{o?.(),this._removeListener(a)});return n instanceof rr?n.add(c):Array.isArray(n)&&n.push(c),c},this._event}_removeListener(e){if(this._options?.onWillRemoveListener?.(this),!this._listeners)return;if(this._size===1){this._listeners=void 0,this._options?.onDidRemoveLastListener?.(this),this._size=0;return}let t=this._listeners,n=t.indexOf(e);if(n===-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--,t[n]=void 0;let a=this._deliveryQueue.current===this;if(this._size*cT<=t.length){let o=0;for(let c=0;c<t.length;c++)t[c]?t[o++]=t[c]:a&&(this._deliveryQueue.end--,o<this._deliveryQueue.i&&this._deliveryQueue.i--);t.length=o}}_deliver(e,t){if(!e)return;let n=this._options?.onListenerError||Zc;if(!n){e.value(t);return}try{e.value(t)}catch(a){n(a)}}_deliverQueue(e){let t=e.current._listeners;for(;e.i<e.end;)this._deliver(t[e.i++],e.value);e.reset()}fire(e){if(this._deliveryQueue?.current&&(this._deliverQueue(this._deliveryQueue),this._perfMon?.stop()),this._perfMon?.start(this._size),this._listeners)if(this._listeners instanceof of)this._deliver(this._listeners,e);else{let t=this._deliveryQueue;t.enqueue(this,e,this._listeners.length),this._deliverQueue(t)}this._perfMon?.stop()}hasListeners(){return this._size>0}},hT=class{constructor(){this.i=-1,this.end=0}enqueue(e,t,n){this.i=0,this.end=n,this.current=e,this.value=t}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},rp=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new _e,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new _e,this.onDidChangeFullscreen=this._onDidChangeFullscreen.event,this.mapWindowIdToFullScreen=new Map}getZoomLevel(t){return this.mapWindowIdToZoomLevel.get(this.getWindowId(t))??0}setZoomLevel(t,n){if(this.getZoomLevel(n)===t)return;let a=this.getWindowId(n);this.mapWindowIdToZoomLevel.set(a,t),this._onDidChangeZoomLevel.fire(a)}getZoomFactor(t){return this.mapWindowIdToZoomFactor.get(this.getWindowId(t))??1}setZoomFactor(t,n){this.mapWindowIdToZoomFactor.set(this.getWindowId(n),t)}setFullscreen(t,n){if(this.isFullscreen(n)===t)return;let a=this.getWindowId(n);this.mapWindowIdToFullScreen.set(a,t),this._onDidChangeFullscreen.fire(a)}isFullscreen(t){return!!this.mapWindowIdToFullScreen.get(this.getWindowId(t))}getWindowId(t){return t.vscodeWindowId}};rp.INSTANCE=new rp;var Sm=rp;function dT(e,t,n){typeof t=="string"&&(t=e.matchMedia(t)),t.addEventListener("change",n)}Sm.INSTANCE.onDidChangeZoomLevel;function fT(e){return Sm.INSTANCE.getZoomFactor(e)}Sm.INSTANCE.onDidChangeFullscreen;var Ua=typeof navigator=="object"?navigator.userAgent:"",ap=Ua.indexOf("Firefox")>=0,pT=Ua.indexOf("AppleWebKit")>=0,bm=Ua.indexOf("Chrome")>=0,mT=!bm&&Ua.indexOf("Safari")>=0;Ua.indexOf("Electron/")>=0;Ua.indexOf("Android")>=0;var cf=!1;if(typeof gn.matchMedia=="function"){let e=gn.matchMedia("(display-mode: standalone) or (display-mode: window-controls-overlay)"),t=gn.matchMedia("(display-mode: fullscreen)");cf=e.matches,dT(gn,e,({matches:n})=>{cf&&t.matches||(cf=n)})}var Da="en",lp=!1,op=!1,Qc=!1,L0=!1,Kc,Jc=Da,iS=Da,_T,_n,Or=globalThis,os;typeof Or.vscode<"u"&&typeof Or.vscode.process<"u"?os=Or.vscode.process:typeof process<"u"&&typeof process?.versions?.node=="string"&&(os=process);var vT=typeof os?.versions?.electron=="string",gT=vT&&os?.type==="renderer";if(typeof os=="object"){lp=os.platform==="win32",op=os.platform==="darwin",Qc=os.platform==="linux",Qc&&os.env.SNAP&&os.env.SNAP_REVISION,os.env.CI||os.env.BUILD_ARTIFACTSTAGINGDIRECTORY,Kc=Da,Jc=Da;let e=os.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);Kc=t.userLocale,iS=t.osLocale,Jc=t.resolvedLanguage||Da,_T=t.languagePack?.translationsConfigFile}catch{}L0=!0}else typeof navigator=="object"&&!gT?(_n=navigator.userAgent,lp=_n.indexOf("Windows")>=0,op=_n.indexOf("Macintosh")>=0,(_n.indexOf("Macintosh")>=0||_n.indexOf("iPad")>=0||_n.indexOf("iPhone")>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints>0,Qc=_n.indexOf("Linux")>=0,_n?.indexOf("Mobi")>=0,Jc=globalThis._VSCODE_NLS_LANGUAGE||Da,Kc=navigator.language.toLowerCase(),iS=Kc):console.error("Unable to resolve platform.");var O0=lp,Ws=op,yT=Qc,sS=L0,Ys=_n,Gn=Jc,ST;(e=>{function t(){return Gn}e.value=t;function n(){return Gn.length===2?Gn==="en":Gn.length>=3?Gn[0]==="e"&&Gn[1]==="n"&&Gn[2]==="-":!1}e.isDefaultVariant=n;function a(){return Gn==="en"}e.isDefault=a})(ST||={});var bT=typeof Or.postMessage=="function"&&!Or.importScripts;(()=>{if(bT){let e=[];Or.addEventListener("message",n=>{if(n.data&&n.data.vscodeScheduleAsyncWork)for(let a=0,o=e.length;a<o;a++){let c=e[a];if(c.id===n.data.vscodeScheduleAsyncWork){e.splice(a,1),c.callback();return}}});let t=0;return n=>{let a=++t;e.push({id:a,callback:n}),Or.postMessage({vscodeScheduleAsyncWork:a},"*")}}return e=>setTimeout(e)})();var wT=!!(Ys&&Ys.indexOf("Chrome")>=0);Ys&&Ys.indexOf("Firefox")>=0;!wT&&Ys&&Ys.indexOf("Safari")>=0;Ys&&Ys.indexOf("Edg/")>=0;Ys&&Ys.indexOf("Android")>=0;var xa=typeof navigator=="object"?navigator:{};sS||document.queryCommandSupported&&document.queryCommandSupported("copy")||xa&&xa.clipboard&&xa.clipboard.writeText,sS||xa&&xa.clipboard&&xa.clipboard.readText;var wm=class{constructor(){this._keyCodeToStr=[],this._strToKeyCode=Object.create(null)}define(e,t){this._keyCodeToStr[e]=t,this._strToKeyCode[t.toLowerCase()]=e}keyCodeToStr(e){return this._keyCodeToStr[e]}strToKeyCode(e){return this._strToKeyCode[e.toLowerCase()]||0}},uf=new wm,nS=new wm,rS=new wm,CT=new Array(230),z0;(e=>{function t(p){return uf.keyCodeToStr(p)}e.toString=t;function n(p){return uf.strToKeyCode(p)}e.fromString=n;function a(p){return nS.keyCodeToStr(p)}e.toUserSettingsUS=a;function o(p){return rS.keyCodeToStr(p)}e.toUserSettingsGeneral=o;function c(p){return nS.strToKeyCode(p)||rS.strToKeyCode(p)}e.fromUserSettings=c;function d(p){if(p>=98&&p<=113)return null;switch(p){case 16:return"Up";case 18:return"Down";case 15:return"Left";case 17:return"Right"}return uf.keyCodeToStr(p)}e.toElectronAccelerator=d})(z0||={});var xT=class j0{constructor(t,n,a,o,c){this.ctrlKey=t,this.shiftKey=n,this.altKey=a,this.metaKey=o,this.keyCode=c}equals(t){return t instanceof j0&&this.ctrlKey===t.ctrlKey&&this.shiftKey===t.shiftKey&&this.altKey===t.altKey&&this.metaKey===t.metaKey&&this.keyCode===t.keyCode}getHashCode(){let t=this.ctrlKey?"1":"0",n=this.shiftKey?"1":"0",a=this.altKey?"1":"0",o=this.metaKey?"1":"0";return`K${t}${n}${a}${o}${this.keyCode}`}isModifierKey(){return this.keyCode===0||this.keyCode===5||this.keyCode===57||this.keyCode===6||this.keyCode===4}toKeybinding(){return new ET([this])}isDuplicateModifierCase(){return this.ctrlKey&&this.keyCode===5||this.shiftKey&&this.keyCode===4||this.altKey&&this.keyCode===6||this.metaKey&&this.keyCode===57}},ET=class{constructor(e){if(e.length===0)throw G2("chords");this.chords=e}getHashCode(){let e="";for(let t=0,n=this.chords.length;t<n;t++)t!==0&&(e+=";"),e+=this.chords[t].getHashCode();return e}equals(e){if(e===null||this.chords.length!==e.chords.length)return!1;for(let t=0;t<this.chords.length;t++)if(!this.chords[t].equals(e.chords[t]))return!1;return!0}};function TT(e){if(e.charCode){let n=String.fromCharCode(e.charCode).toUpperCase();return z0.fromString(n)}let t=e.keyCode;if(t===3)return 7;if(ap)switch(t){case 59:return 85;case 60:if(yT)return 97;break;case 61:return 86;case 107:return 109;case 109:return 111;case 173:return 88;case 224:if(Ws)return 57;break}else if(pT&&(Ws&&t===93||!Ws&&t===92))return 57;return CT[t]||0}var kT=Ws?256:2048,DT=512,RT=1024,MT=Ws?2048:256,aS=class{constructor(e){this._standardKeyboardEventBrand=!0;let t=e;this.browserEvent=t,this.target=t.target,this.ctrlKey=t.ctrlKey,this.shiftKey=t.shiftKey,this.altKey=t.altKey,this.metaKey=t.metaKey,this.altGraphKey=t.getModifierState?.("AltGraph"),this.keyCode=TT(t),this.code=t.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 t=0;return this.ctrlKey&&(t|=kT),this.altKey&&(t|=DT),this.shiftKey&&(t|=RT),this.metaKey&&(t|=MT),t|=e,t}_computeKeyCodeChord(){let e=0;return this.keyCode!==5&&this.keyCode!==4&&this.keyCode!==6&&this.keyCode!==57&&(e=this.keyCode),new xT(this.ctrlKey,this.shiftKey,this.altKey,this.metaKey,e)}},lS=new WeakMap;function AT(e){if(!e.parent||e.parent===e)return null;try{let t=e.location,n=e.parent.location;if(t.origin!=="null"&&n.origin!=="null"&&t.origin!==n.origin)return null}catch{return null}return e.parent}var NT=class{static getSameOriginWindowChain(e){let t=lS.get(e);if(!t){t=[],lS.set(e,t);let n=e,a;do a=AT(n),a?t.push({window:new WeakRef(n),iframeElement:n.frameElement||null}):t.push({window:new WeakRef(n),iframeElement:null}),n=a;while(n)}return t.slice(0)}static getPositionOfChildWindowRelativeToAncestorWindow(e,t){if(!t||e===t)return{top:0,left:0};let n=0,a=0,o=this.getSameOriginWindowChain(e);for(let c of o){let d=c.window.deref();if(n+=d?.scrollY??0,a+=d?.scrollX??0,d===t||!c.iframeElement)break;let p=c.iframeElement.getBoundingClientRect();n+=p.top,a+=p.left}return{top:n,left:a}}},Ic=class{constructor(e,t){this.timestamp=Date.now(),this.browserEvent=t,this.leftButton=t.button===0,this.middleButton=t.button===1,this.rightButton=t.button===2,this.buttons=t.buttons,this.target=t.target,this.detail=t.detail||1,t.type==="dblclick"&&(this.detail=2),this.ctrlKey=t.ctrlKey,this.shiftKey=t.shiftKey,this.altKey=t.altKey,this.metaKey=t.metaKey,typeof t.pageX=="number"?(this.posx=t.pageX,this.posy=t.pageY):(this.posx=t.clientX+this.target.ownerDocument.body.scrollLeft+this.target.ownerDocument.documentElement.scrollLeft,this.posy=t.clientY+this.target.ownerDocument.body.scrollTop+this.target.ownerDocument.documentElement.scrollTop);let n=NT.getPositionOfChildWindowRelativeToAncestorWindow(e,t.view);this.posx-=n.left,this.posy-=n.top}preventDefault(){this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent.stopPropagation()}},oS=class{constructor(e,t=0,n=0){this.browserEvent=e||null,this.target=e?e.target||e.targetNode||e.srcElement:null,this.deltaY=n,this.deltaX=t;let a=!1;if(bm){let o=navigator.userAgent.match(/Chrome\/(\d+)/);a=(o?parseInt(o[1]):123)<=122}if(e){let o=e,c=e,d=e.view?.devicePixelRatio||1;if(typeof o.wheelDeltaY<"u")a?this.deltaY=o.wheelDeltaY/(120*d):this.deltaY=o.wheelDeltaY/120;else if(typeof c.VERTICAL_AXIS<"u"&&c.axis===c.VERTICAL_AXIS)this.deltaY=-c.detail/3;else if(e.type==="wheel"){let p=e;p.deltaMode===p.DOM_DELTA_LINE?ap&&!Ws?this.deltaY=-e.deltaY/3:this.deltaY=-e.deltaY:this.deltaY=-e.deltaY/40}if(typeof o.wheelDeltaX<"u")mT&&O0?this.deltaX=-(o.wheelDeltaX/120):a?this.deltaX=o.wheelDeltaX/(120*d):this.deltaX=o.wheelDeltaX/120;else if(typeof c.HORIZONTAL_AXIS<"u"&&c.axis===c.HORIZONTAL_AXIS)this.deltaX=-e.detail/3;else if(e.type==="wheel"){let p=e;p.deltaMode===p.DOM_DELTA_LINE?ap&&!Ws?this.deltaX=-e.deltaX/3:this.deltaX=-e.deltaX:this.deltaX=-e.deltaX/40}this.deltaY===0&&this.deltaX===0&&e.wheelDelta&&(a?this.deltaY=e.wheelDelta/(120*d):this.deltaY=e.wheelDelta/120)}}preventDefault(){this.browserEvent?.preventDefault()}stopPropagation(){this.browserEvent?.stopPropagation()}},H0=Object.freeze(function(e,t){let n=setTimeout(e.bind(t),0);return{dispose(){clearTimeout(n)}}}),BT;(e=>{function t(n){return n===e.None||n===e.Cancelled||n instanceof LT?!0:!n||typeof n!="object"?!1:typeof n.isCancellationRequested=="boolean"&&typeof n.onCancellationRequested=="function"}e.isCancellationToken=t,e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:Ei.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:H0})})(BT||={});var LT=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?H0:(this._emitter||(this._emitter=new _e),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}},Cm=class{constructor(e,t){this._isDisposed=!1,this._token=-1,typeof e=="function"&&typeof t=="number"&&this.setIfNotSet(e,t)}dispose(){this.cancel(),this._isDisposed=!0}cancel(){this._token!==-1&&(clearTimeout(this._token),this._token=-1)}cancelAndSet(e,t){if(this._isDisposed)throw new ep("Calling 'cancelAndSet' on a disposed TimeoutTimer");this.cancel(),this._token=setTimeout(()=>{this._token=-1,e()},t)}setIfNotSet(e,t){if(this._isDisposed)throw new ep("Calling 'setIfNotSet' on a disposed TimeoutTimer");this._token===-1&&(this._token=setTimeout(()=>{this._token=-1,e()},t))}},OT=class{constructor(){this.disposable=void 0,this.isDisposed=!1}cancel(){this.disposable?.dispose(),this.disposable=void 0}cancelAndSet(e,t,n=globalThis){if(this.isDisposed)throw new ep("Calling 'cancelAndSet' on a disposed IntervalTimer");this.cancel();let a=n.setInterval(()=>{e()},t);this.disposable=Tt(()=>{n.clearInterval(a),this.disposable=void 0})}dispose(){this.cancel(),this.isDisposed=!0}},zT;(e=>{async function t(a){let o,c=await Promise.all(a.map(d=>d.then(p=>p,p=>{o||(o=p)})));if(typeof o<"u")throw o;return c}e.settled=t;function n(a){return new Promise(async(o,c)=>{try{await a(o,c)}catch(d){c(d)}})}e.withAsyncBody=n})(zT||={});var cS=class Ss{static fromArray(t){return new Ss(n=>{n.emitMany(t)})}static fromPromise(t){return new Ss(async n=>{n.emitMany(await t)})}static fromPromises(t){return new Ss(async n=>{await Promise.all(t.map(async a=>n.emitOne(await a)))})}static merge(t){return new Ss(async n=>{await Promise.all(t.map(async a=>{for await(let o of a)n.emitOne(o)}))})}constructor(t,n){this._state=0,this._results=[],this._error=null,this._onReturn=n,this._onStateChanged=new _e,queueMicrotask(async()=>{let a={emitOne:o=>this.emitOne(o),emitMany:o=>this.emitMany(o),reject:o=>this.reject(o)};try{await Promise.resolve(t(a)),this.resolve()}catch(o){this.reject(o)}finally{a.emitOne=void 0,a.emitMany=void 0,a.reject=void 0}})}[Symbol.asyncIterator](){let t=0;return{next:async()=>{do{if(this._state===2)throw this._error;if(t<this._results.length)return{done:!1,value:this._results[t++]};if(this._state===1)return{done:!0,value:void 0};await Ei.toPromise(this._onStateChanged.event)}while(!0)},return:async()=>(this._onReturn?.(),{done:!0,value:void 0})}}static map(t,n){return new Ss(async a=>{for await(let o of t)a.emitOne(n(o))})}map(t){return Ss.map(this,t)}static filter(t,n){return new Ss(async a=>{for await(let o of t)n(o)&&a.emitOne(o)})}filter(t){return Ss.filter(this,t)}static coalesce(t){return Ss.filter(t,n=>!!n)}coalesce(){return Ss.coalesce(this)}static async toPromise(t){let n=[];for await(let a of t)n.push(a);return n}toPromise(){return Ss.toPromise(this)}emitOne(t){this._state===0&&(this._results.push(t),this._onStateChanged.fire())}emitMany(t){this._state===0&&(this._results=this._results.concat(t),this._onStateChanged.fire())}resolve(){this._state===0&&(this._state=1,this._onStateChanged.fire())}reject(t){this._state===0&&(this._state=2,this._error=t,this._onStateChanged.fire())}};cS.EMPTY=cS.fromArray([]);var{getWindow:qs,getWindowId:jT,onDidRegisterWindow:HT}=(function(){let e=new Map,t={window:gn,disposables:new rr};e.set(gn.vscodeWindowId,t);let n=new _e,a=new _e,o=new _e;function c(d,p){return(typeof d=="number"?e.get(d):void 0)??(p?t:void 0)}return{onDidRegisterWindow:n.event,onWillUnregisterWindow:o.event,onDidUnregisterWindow:a.event,registerWindow(d){if(e.has(d.vscodeWindowId))return We.None;let p=new rr,m={window:d,disposables:p.add(new rr)};return e.set(d.vscodeWindowId,m),p.add(Tt(()=>{e.delete(d.vscodeWindowId),a.fire(d)})),p.add(Le(d,ci.BEFORE_UNLOAD,()=>{o.fire(d)})),n.fire(m),p},getWindows(){return e.values()},getWindowsCount(){return e.size},getWindowId(d){return d.vscodeWindowId},hasWindow(d){return e.has(d)},getWindowById:c,getWindow(d){let p=d;if(p?.ownerDocument?.defaultView)return p.ownerDocument.defaultView.window;let m=d;return m?.view?m.view.window:gn},getDocument(d){return qs(d).document}}})(),UT=class{constructor(e,t,n,a){this._node=e,this._type=t,this._handler=n,this._options=a||!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 Le(e,t,n,a){return new UT(e,t,n,a)}var uS=function(e,t,n,a){return Le(e,t,n,a)},xm,PT=class extends OT{constructor(e){super(),this.defaultTarget=e&&qs(e)}cancelAndSet(e,t,n){return super.cancelAndSet(e,t,n??this.defaultTarget)}},hS=class{constructor(e,t=0){this._runner=e,this.priority=t,this._canceled=!1}dispose(){this._canceled=!0}execute(){if(!this._canceled)try{this._runner()}catch(e){Zc(e)}}static sort(e,t){return t.priority-e.priority}};(function(){let e=new Map,t=new Map,n=new Map,a=new Map,o=c=>{n.set(c,!1);let d=e.get(c)??[];for(t.set(c,d),e.set(c,[]),a.set(c,!0);d.length>0;)d.sort(hS.sort),d.shift().execute();a.set(c,!1)};xm=(c,d,p=0)=>{let m=jT(c),f=new hS(d,p),S=e.get(m);return S||(S=[],e.set(m,S)),S.push(f),n.get(m)||(n.set(m,!0),c.requestAnimationFrame(()=>o(m))),f}})();function KT(e){let t=e.getBoundingClientRect(),n=qs(e);return{left:t.left+n.scrollX,top:t.top+n.scrollY,width:t.width,height:t.height}}var ci={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"},IT=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 t=Yi(e);this._maxWidth!==t&&(this._maxWidth=t,this.domNode.style.maxWidth=this._maxWidth)}setWidth(e){let t=Yi(e);this._width!==t&&(this._width=t,this.domNode.style.width=this._width)}setHeight(e){let t=Yi(e);this._height!==t&&(this._height=t,this.domNode.style.height=this._height)}setTop(e){let t=Yi(e);this._top!==t&&(this._top=t,this.domNode.style.top=this._top)}setLeft(e){let t=Yi(e);this._left!==t&&(this._left=t,this.domNode.style.left=this._left)}setBottom(e){let t=Yi(e);this._bottom!==t&&(this._bottom=t,this.domNode.style.bottom=this._bottom)}setRight(e){let t=Yi(e);this._right!==t&&(this._right=t,this.domNode.style.right=this._right)}setPaddingTop(e){let t=Yi(e);this._paddingTop!==t&&(this._paddingTop=t,this.domNode.style.paddingTop=this._paddingTop)}setPaddingLeft(e){let t=Yi(e);this._paddingLeft!==t&&(this._paddingLeft=t,this.domNode.style.paddingLeft=this._paddingLeft)}setPaddingBottom(e){let t=Yi(e);this._paddingBottom!==t&&(this._paddingBottom=t,this.domNode.style.paddingBottom=this._paddingBottom)}setPaddingRight(e){let t=Yi(e);this._paddingRight!==t&&(this._paddingRight=t,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 t=Yi(e);this._fontSize!==t&&(this._fontSize=t,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 t=Yi(e);this._lineHeight!==t&&(this._lineHeight=t,this.domNode.style.lineHeight=this._lineHeight)}setLetterSpacing(e){let t=Yi(e);this._letterSpacing!==t&&(this._letterSpacing=t,this.domNode.style.letterSpacing=this._letterSpacing)}setClassName(e){this._className!==e&&(this._className=e,this.domNode.className=this._className)}toggleClassName(e,t){this.domNode.classList.toggle(e,t),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,t){this.domNode.setAttribute(e,t)}removeAttribute(e){this.domNode.removeAttribute(e)}appendChild(e){this.domNode.appendChild(e.domNode)}removeChild(e){this.domNode.removeChild(e.domNode)}};function Yi(e){return typeof e=="number"?`${e}px`:e}function to(e){return new IT(e)}var U0=class{constructor(){this._hooks=new rr,this._pointerMoveCallback=null,this._onStopCallback=null}dispose(){this.stopMonitoring(!1),this._hooks.dispose()}stopMonitoring(e,t){if(!this.isMonitoring())return;this._hooks.clear(),this._pointerMoveCallback=null;let n=this._onStopCallback;this._onStopCallback=null,e&&n&&n(t)}isMonitoring(){return!!this._pointerMoveCallback}startMonitoring(e,t,n,a,o){this.isMonitoring()&&this.stopMonitoring(!1),this._pointerMoveCallback=a,this._onStopCallback=o;let c=e;try{e.setPointerCapture(t),this._hooks.add(Tt(()=>{try{e.releasePointerCapture(t)}catch{}}))}catch{c=qs(e)}this._hooks.add(Le(c,ci.POINTER_MOVE,d=>{if(d.buttons!==n){this.stopMonitoring(!0);return}d.preventDefault(),this._pointerMoveCallback(d)})),this._hooks.add(Le(c,ci.POINTER_UP,d=>this.stopMonitoring(!0)))}};function FT(e,t,n){let a=null,o=null;if(typeof n.value=="function"?(a="value",o=n.value,o.length!==0&&console.warn("Memoize should only be used in functions with zero parameters")):typeof n.get=="function"&&(a="get",o=n.get),!o)throw new Error("not supported");let c=`$memoize$${t}`;n[a]=function(...d){return this.hasOwnProperty(c)||Object.defineProperty(this,c,{configurable:!1,enumerable:!1,writable:!1,value:o.apply(this,d)}),this[c]}}var Fs;(e=>(e.Tap="-xterm-gesturetap",e.Change="-xterm-gesturechange",e.Start="-xterm-gesturestart",e.End="-xterm-gesturesend",e.Contextmenu="-xterm-gesturecontextmenu"))(Fs||={});var Fl=class Ri extends We{constructor(){super(),this.dispatched=!1,this.targets=new tS,this.ignoreTargets=new tS,this.activeTouches={},this.handle=null,this._lastSetTapCountTime=0,this._register(Ei.runAndSubscribe(HT,({window:t,disposables:n})=>{n.add(Le(t.document,"touchstart",a=>this.onTouchStart(a),{passive:!1})),n.add(Le(t.document,"touchend",a=>this.onTouchEnd(t,a))),n.add(Le(t.document,"touchmove",a=>this.onTouchMove(a),{passive:!1}))},{window:gn,disposables:this._store}))}static addTarget(t){if(!Ri.isTouchDevice())return We.None;Ri.INSTANCE||(Ri.INSTANCE=new Ri);let n=Ri.INSTANCE.targets.push(t);return Tt(n)}static ignoreTarget(t){if(!Ri.isTouchDevice())return We.None;Ri.INSTANCE||(Ri.INSTANCE=new Ri);let n=Ri.INSTANCE.ignoreTargets.push(t);return Tt(n)}static isTouchDevice(){return"ontouchstart"in gn||navigator.maxTouchPoints>0}dispose(){this.handle&&(this.handle.dispose(),this.handle=null),super.dispose()}onTouchStart(t){let n=Date.now();this.handle&&(this.handle.dispose(),this.handle=null);for(let a=0,o=t.targetTouches.length;a<o;a++){let c=t.targetTouches.item(a);this.activeTouches[c.identifier]={id:c.identifier,initialTarget:c.target,initialTimeStamp:n,initialPageX:c.pageX,initialPageY:c.pageY,rollingTimestamps:[n],rollingPageX:[c.pageX],rollingPageY:[c.pageY]};let d=this.newGestureEvent(Fs.Start,c.target);d.pageX=c.pageX,d.pageY=c.pageY,this.dispatchEvent(d)}this.dispatched&&(t.preventDefault(),t.stopPropagation(),this.dispatched=!1)}onTouchEnd(t,n){let a=Date.now(),o=Object.keys(this.activeTouches).length;for(let c=0,d=n.changedTouches.length;c<d;c++){let p=n.changedTouches.item(c);if(!this.activeTouches.hasOwnProperty(String(p.identifier))){console.warn("move of an UNKNOWN touch",p);continue}let m=this.activeTouches[p.identifier],f=Date.now()-m.initialTimeStamp;if(f<Ri.HOLD_DELAY&&Math.abs(m.initialPageX-as(m.rollingPageX))<30&&Math.abs(m.initialPageY-as(m.rollingPageY))<30){let S=this.newGestureEvent(Fs.Tap,m.initialTarget);S.pageX=as(m.rollingPageX),S.pageY=as(m.rollingPageY),this.dispatchEvent(S)}else if(f>=Ri.HOLD_DELAY&&Math.abs(m.initialPageX-as(m.rollingPageX))<30&&Math.abs(m.initialPageY-as(m.rollingPageY))<30){let S=this.newGestureEvent(Fs.Contextmenu,m.initialTarget);S.pageX=as(m.rollingPageX),S.pageY=as(m.rollingPageY),this.dispatchEvent(S)}else if(o===1){let S=as(m.rollingPageX),y=as(m.rollingPageY),b=as(m.rollingTimestamps)-m.rollingTimestamps[0],x=S-m.rollingPageX[0],C=y-m.rollingPageY[0],k=[...this.targets].filter(B=>m.initialTarget instanceof Node&&B.contains(m.initialTarget));this.inertia(t,k,a,Math.abs(x)/b,x>0?1:-1,S,Math.abs(C)/b,C>0?1:-1,y)}this.dispatchEvent(this.newGestureEvent(Fs.End,m.initialTarget)),delete this.activeTouches[p.identifier]}this.dispatched&&(n.preventDefault(),n.stopPropagation(),this.dispatched=!1)}newGestureEvent(t,n){let a=document.createEvent("CustomEvent");return a.initEvent(t,!1,!0),a.initialTarget=n,a.tapCount=0,a}dispatchEvent(t){if(t.type===Fs.Tap){let n=new Date().getTime(),a=0;n-this._lastSetTapCountTime>Ri.CLEAR_TAP_COUNT_TIME?a=1:a=2,this._lastSetTapCountTime=n,t.tapCount=a}else(t.type===Fs.Change||t.type===Fs.Contextmenu)&&(this._lastSetTapCountTime=0);if(t.initialTarget instanceof Node){for(let a of this.ignoreTargets)if(a.contains(t.initialTarget))return;let n=[];for(let a of this.targets)if(a.contains(t.initialTarget)){let o=0,c=t.initialTarget;for(;c&&c!==a;)o++,c=c.parentElement;n.push([o,a])}n.sort((a,o)=>a[0]-o[0]);for(let[a,o]of n)o.dispatchEvent(t),this.dispatched=!0}}inertia(t,n,a,o,c,d,p,m,f){this.handle=xm(t,()=>{let S=Date.now(),y=S-a,b=0,x=0,C=!0;o+=Ri.SCROLL_FRICTION*y,p+=Ri.SCROLL_FRICTION*y,o>0&&(C=!1,b=c*o*y),p>0&&(C=!1,x=m*p*y);let k=this.newGestureEvent(Fs.Change);k.translationX=b,k.translationY=x,n.forEach(B=>B.dispatchEvent(k)),C||this.inertia(t,n,S,o,c,d+b,p,m,f+x)})}onTouchMove(t){let n=Date.now();for(let a=0,o=t.changedTouches.length;a<o;a++){let c=t.changedTouches.item(a);if(!this.activeTouches.hasOwnProperty(String(c.identifier))){console.warn("end of an UNKNOWN touch",c);continue}let d=this.activeTouches[c.identifier],p=this.newGestureEvent(Fs.Change,d.initialTarget);p.translationX=c.pageX-as(d.rollingPageX),p.translationY=c.pageY-as(d.rollingPageY),p.pageX=c.pageX,p.pageY=c.pageY,this.dispatchEvent(p),d.rollingPageX.length>3&&(d.rollingPageX.shift(),d.rollingPageY.shift(),d.rollingTimestamps.shift()),d.rollingPageX.push(c.pageX),d.rollingPageY.push(c.pageY),d.rollingTimestamps.push(n)}this.dispatched&&(t.preventDefault(),t.stopPropagation(),this.dispatched=!1)}};Fl.SCROLL_FRICTION=-.005,Fl.HOLD_DELAY=700,Fl.CLEAR_TAP_COUNT_TIME=400,Ht([FT],Fl,"isTouchDevice",1);var qT=Fl,Em=class extends We{onclick(e,t){this._register(Le(e,ci.CLICK,n=>t(new Ic(qs(e),n))))}onmousedown(e,t){this._register(Le(e,ci.MOUSE_DOWN,n=>t(new Ic(qs(e),n))))}onmouseover(e,t){this._register(Le(e,ci.MOUSE_OVER,n=>t(new Ic(qs(e),n))))}onmouseleave(e,t){this._register(Le(e,ci.MOUSE_LEAVE,n=>t(new Ic(qs(e),n))))}onkeydown(e,t){this._register(Le(e,ci.KEY_DOWN,n=>t(new aS(n))))}onkeyup(e,t){this._register(Le(e,ci.KEY_UP,n=>t(new aS(n))))}oninput(e,t){this._register(Le(e,ci.INPUT,t))}onblur(e,t){this._register(Le(e,ci.BLUR,t))}onfocus(e,t){this._register(Le(e,ci.FOCUS,t))}onchange(e,t){this._register(Le(e,ci.CHANGE,t))}ignoreGesture(e){return qT.ignoreTarget(e)}},dS=11,WT=class extends Em{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=dS+"px",this.domNode.style.height=dS+"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 U0),this._register(uS(this.bgDomNode,ci.POINTER_DOWN,t=>this._arrowPointerDown(t))),this._register(uS(this.domNode,ci.POINTER_DOWN,t=>this._arrowPointerDown(t))),this._pointerdownRepeatTimer=this._register(new PT),this._pointerdownScheduleRepeatTimer=this._register(new Cm)}_arrowPointerDown(e){if(!e.target||!(e.target instanceof Element))return;let t=()=>{this._pointerdownRepeatTimer.cancelAndSet(()=>this._onActivate(),1e3/24,qs(e))};this._onActivate(),this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancelAndSet(t,200),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,n=>{},()=>{this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancel()}),e.preventDefault()}},YT=class cp{constructor(t,n,a,o,c,d,p){this._forceIntegerValues=t,this._scrollStateBrand=void 0,this._forceIntegerValues&&(n=n|0,a=a|0,o=o|0,c=c|0,d=d|0,p=p|0),this.rawScrollLeft=o,this.rawScrollTop=p,n<0&&(n=0),o+n>a&&(o=a-n),o<0&&(o=0),c<0&&(c=0),p+c>d&&(p=d-c),p<0&&(p=0),this.width=n,this.scrollWidth=a,this.scrollLeft=o,this.height=c,this.scrollHeight=d,this.scrollTop=p}equals(t){return this.rawScrollLeft===t.rawScrollLeft&&this.rawScrollTop===t.rawScrollTop&&this.width===t.width&&this.scrollWidth===t.scrollWidth&&this.scrollLeft===t.scrollLeft&&this.height===t.height&&this.scrollHeight===t.scrollHeight&&this.scrollTop===t.scrollTop}withScrollDimensions(t,n){return new cp(this._forceIntegerValues,typeof t.width<"u"?t.width:this.width,typeof t.scrollWidth<"u"?t.scrollWidth:this.scrollWidth,n?this.rawScrollLeft:this.scrollLeft,typeof t.height<"u"?t.height:this.height,typeof t.scrollHeight<"u"?t.scrollHeight:this.scrollHeight,n?this.rawScrollTop:this.scrollTop)}withScrollPosition(t){return new cp(this._forceIntegerValues,this.width,this.scrollWidth,typeof t.scrollLeft<"u"?t.scrollLeft:this.rawScrollLeft,this.height,this.scrollHeight,typeof t.scrollTop<"u"?t.scrollTop:this.rawScrollTop)}createScrollEvent(t,n){let a=this.width!==t.width,o=this.scrollWidth!==t.scrollWidth,c=this.scrollLeft!==t.scrollLeft,d=this.height!==t.height,p=this.scrollHeight!==t.scrollHeight,m=this.scrollTop!==t.scrollTop;return{inSmoothScrolling:n,oldWidth:t.width,oldScrollWidth:t.scrollWidth,oldScrollLeft:t.scrollLeft,width:this.width,scrollWidth:this.scrollWidth,scrollLeft:this.scrollLeft,oldHeight:t.height,oldScrollHeight:t.scrollHeight,oldScrollTop:t.scrollTop,height:this.height,scrollHeight:this.scrollHeight,scrollTop:this.scrollTop,widthChanged:a,scrollWidthChanged:o,scrollLeftChanged:c,heightChanged:d,scrollHeightChanged:p,scrollTopChanged:m}}},$T=class extends We{constructor(e){super(),this._scrollableBrand=void 0,this._onScroll=this._register(new _e),this.onScroll=this._onScroll.event,this._smoothScrollDuration=e.smoothScrollDuration,this._scheduleAtNextAnimationFrame=e.scheduleAtNextAnimationFrame,this._state=new YT(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,t){let n=this._state.withScrollDimensions(e,t);this._setState(n,!!this._smoothScrolling),this._smoothScrolling?.acceptScrollDimensions(this._state)}getFutureScrollPosition(){return this._smoothScrolling?this._smoothScrolling.to:this._state}getCurrentScrollPosition(){return this._state}setScrollPositionNow(e){let t=this._state.withScrollPosition(e);this._smoothScrolling&&(this._smoothScrolling.dispose(),this._smoothScrolling=null),this._setState(t,!1)}setScrollPositionSmooth(e,t){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 n=this._state.withScrollPosition(e);if(this._smoothScrolling.to.scrollLeft===n.scrollLeft&&this._smoothScrolling.to.scrollTop===n.scrollTop)return;let a;t?a=new pS(this._smoothScrolling.from,n,this._smoothScrolling.startTime,this._smoothScrolling.duration):a=this._smoothScrolling.combine(this._state,n,this._smoothScrollDuration),this._smoothScrolling.dispose(),this._smoothScrolling=a}else{let n=this._state.withScrollPosition(e);this._smoothScrolling=pS.start(this._state,n,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(),t=this._state.withScrollPosition(e);if(this._setState(t,!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,t){let n=this._state;n.equals(e)||(this._state=e,this._onScroll.fire(this._state.createScrollEvent(n,t)))}},fS=class{constructor(e,t,n){this.scrollLeft=e,this.scrollTop=t,this.isDone=n}};function hf(e,t){let n=t-e;return function(a){return e+n*GT(a)}}function VT(e,t,n){return function(a){return a<n?e(a/n):t((a-n)/(1-n))}}var pS=class up{constructor(t,n,a,o){this.from=t,this.to=n,this.duration=o,this.startTime=a,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(t,n,a){if(Math.abs(t-n)>2.5*a){let o,c;return t<n?(o=t+.75*a,c=n-.75*a):(o=t-.75*a,c=n+.75*a),VT(hf(t,o),hf(c,n),.33)}return hf(t,n)}dispose(){this.animationFrameDisposable!==null&&(this.animationFrameDisposable.dispose(),this.animationFrameDisposable=null)}acceptScrollDimensions(t){this.to=t.withScrollPosition(this.to),this._initAnimations()}tick(){return this._tick(Date.now())}_tick(t){let n=(t-this.startTime)/this.duration;if(n<1){let a=this.scrollLeft(n),o=this.scrollTop(n);return new fS(a,o,!1)}return new fS(this.to.scrollLeft,this.to.scrollTop,!0)}combine(t,n,a){return up.start(t,n,a)}static start(t,n,a){a=a+10;let o=Date.now()-10;return new up(t,n,o,a)}};function XT(e){return Math.pow(e,3)}function GT(e){return 1-XT(1-e)}var ZT=class extends We{constructor(e,t,n){super(),this._visibility=e,this._visibleClassName=t,this._invisibleClassName=n,this._domNode=null,this._isVisible=!1,this._isNeeded=!1,this._rawShouldBeVisible=!1,this._shouldBeVisible=!1,this._revealTimer=this._register(new Cm)}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(()=>{this._domNode?.setClassName(this._visibleClassName)},0))}_hide(e){this._revealTimer.cancel(),this._isVisible&&(this._isVisible=!1,this._domNode?.setClassName(this._invisibleClassName+(e?" fade":"")))}},QT=140,P0=class extends Em{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 ZT(e.visibility,"visible scrollbar "+e.extraScrollbarClassName,"invisible scrollbar "+e.extraScrollbarClassName)),this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._pointerMoveMonitor=this._register(new U0),this._shouldRender=!0,this.domNode=to(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(Le(this.domNode.domNode,ci.POINTER_DOWN,t=>this._domNodePointerDown(t)))}_createArrow(e){let t=this._register(new WT(e));this.domNode.domNode.appendChild(t.bgDomNode),this.domNode.domNode.appendChild(t.domNode)}_createSlider(e,t,n,a){this.slider=to(document.createElement("div")),this.slider.setClassName("slider"),this.slider.setPosition("absolute"),this.slider.setTop(e),this.slider.setLeft(t),typeof n=="number"&&this.slider.setWidth(n),typeof a=="number"&&this.slider.setHeight(a),this.slider.setLayerHinting(!0),this.slider.setContain("strict"),this.domNode.domNode.appendChild(this.slider.domNode),this._register(Le(this.slider.domNode,ci.POINTER_DOWN,o=>{o.button===0&&(o.preventDefault(),this._sliderPointerDown(o))})),this.onclick(this.slider.domNode,o=>{o.leftButton&&o.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 t=this.domNode.domNode.getClientRects()[0].top,n=t+this._scrollbarState.getSliderPosition(),a=t+this._scrollbarState.getSliderPosition()+this._scrollbarState.getSliderSize(),o=this._sliderPointerPosition(e);n<=o&&o<=a?e.button===0&&(e.preventDefault(),this._sliderPointerDown(e)):this._onPointerDown(e)}_onPointerDown(e){let t,n;if(e.target===this.domNode.domNode&&typeof e.offsetX=="number"&&typeof e.offsetY=="number")t=e.offsetX,n=e.offsetY;else{let o=KT(this.domNode.domNode);t=e.pageX-o.left,n=e.pageY-o.top}let a=this._pointerDownRelativePosition(t,n);this._setDesiredScrollPositionNow(this._scrollByPage?this._scrollbarState.getDesiredScrollPositionFromOffsetPaged(a):this._scrollbarState.getDesiredScrollPositionFromOffset(a)),e.button===0&&(e.preventDefault(),this._sliderPointerDown(e))}_sliderPointerDown(e){if(!e.target||!(e.target instanceof Element))return;let t=this._sliderPointerPosition(e),n=this._sliderOrthogonalPointerPosition(e),a=this._scrollbarState.clone();this.slider.toggleClassName("active",!0),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,o=>{let c=this._sliderOrthogonalPointerPosition(o),d=Math.abs(c-n);if(O0&&d>QT){this._setDesiredScrollPositionNow(a.getScrollPosition());return}let p=this._sliderPointerPosition(o)-t;this._setDesiredScrollPositionNow(a.getDesiredScrollPositionFromDelta(p))},()=>{this.slider.toggleClassName("active",!1),this._host.onDragEnd()}),this._host.onDragStart()}_setDesiredScrollPositionNow(e){let t={};this.writeScrollPosition(t,e),this._scrollable.setScrollPositionNow(t)}updateScrollbarSize(e){this._updateScrollbarSize(e),this._scrollbarState.setScrollbarSize(e),this._shouldRender=!0,this._lazyRender||this.render()}isNeeded(){return this._scrollbarState.isNeeded()}},K0=class hp{constructor(t,n,a,o,c,d){this._scrollbarSize=Math.round(n),this._oppositeScrollbarSize=Math.round(a),this._arrowSize=Math.round(t),this._visibleSize=o,this._scrollSize=c,this._scrollPosition=d,this._computedAvailableSize=0,this._computedIsNeeded=!1,this._computedSliderSize=0,this._computedSliderRatio=0,this._computedSliderPosition=0,this._refreshComputedValues()}clone(){return new hp(this._arrowSize,this._scrollbarSize,this._oppositeScrollbarSize,this._visibleSize,this._scrollSize,this._scrollPosition)}setVisibleSize(t){let n=Math.round(t);return this._visibleSize!==n?(this._visibleSize=n,this._refreshComputedValues(),!0):!1}setScrollSize(t){let n=Math.round(t);return this._scrollSize!==n?(this._scrollSize=n,this._refreshComputedValues(),!0):!1}setScrollPosition(t){let n=Math.round(t);return this._scrollPosition!==n?(this._scrollPosition=n,this._refreshComputedValues(),!0):!1}setScrollbarSize(t){this._scrollbarSize=Math.round(t)}setOppositeScrollbarSize(t){this._oppositeScrollbarSize=Math.round(t)}static _computeValues(t,n,a,o,c){let d=Math.max(0,a-t),p=Math.max(0,d-2*n),m=o>0&&o>a;if(!m)return{computedAvailableSize:Math.round(d),computedIsNeeded:m,computedSliderSize:Math.round(p),computedSliderRatio:0,computedSliderPosition:0};let f=Math.round(Math.max(20,Math.floor(a*p/o))),S=(p-f)/(o-a),y=c*S;return{computedAvailableSize:Math.round(d),computedIsNeeded:m,computedSliderSize:Math.round(f),computedSliderRatio:S,computedSliderPosition:Math.round(y)}}_refreshComputedValues(){let t=hp._computeValues(this._oppositeScrollbarSize,this._arrowSize,this._visibleSize,this._scrollSize,this._scrollPosition);this._computedAvailableSize=t.computedAvailableSize,this._computedIsNeeded=t.computedIsNeeded,this._computedSliderSize=t.computedSliderSize,this._computedSliderRatio=t.computedSliderRatio,this._computedSliderPosition=t.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(t){if(!this._computedIsNeeded)return 0;let n=t-this._arrowSize-this._computedSliderSize/2;return Math.round(n/this._computedSliderRatio)}getDesiredScrollPositionFromOffsetPaged(t){if(!this._computedIsNeeded)return 0;let n=t-this._arrowSize,a=this._scrollPosition;return n<this._computedSliderPosition?a-=this._visibleSize:a+=this._visibleSize,a}getDesiredScrollPositionFromDelta(t){if(!this._computedIsNeeded)return 0;let n=this._computedSliderPosition+t;return Math.round(n/this._computedSliderRatio)}},JT=class extends P0{constructor(e,t,n){let a=e.getScrollDimensions(),o=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:n,scrollbarState:new K0(t.horizontalHasArrows?t.arrowSize:0,t.horizontal===2?0:t.horizontalScrollbarSize,t.vertical===2?0:t.verticalScrollbarSize,a.width,a.scrollWidth,o.scrollLeft),visibility:t.horizontal,extraScrollbarClassName:"horizontal",scrollable:e,scrollByPage:t.scrollByPage}),t.horizontalHasArrows)throw new Error("horizontalHasArrows is not supported in xterm.js");this._createSlider(Math.floor((t.horizontalScrollbarSize-t.horizontalSliderSize)/2),0,void 0,t.horizontalSliderSize)}_updateSlider(e,t){this.slider.setWidth(e),this.slider.setLeft(t)}_renderDomNode(e,t){this.domNode.setWidth(e),this.domNode.setHeight(t),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,t){return e}_sliderPointerPosition(e){return e.pageX}_sliderOrthogonalPointerPosition(e){return e.pageY}_updateScrollbarSize(e){this.slider.setHeight(e)}writeScrollPosition(e,t){e.scrollLeft=t}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}},ek=class extends P0{constructor(e,t,n){let a=e.getScrollDimensions(),o=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:n,scrollbarState:new K0(t.verticalHasArrows?t.arrowSize:0,t.vertical===2?0:t.verticalScrollbarSize,0,a.height,a.scrollHeight,o.scrollTop),visibility:t.vertical,extraScrollbarClassName:"vertical",scrollable:e,scrollByPage:t.scrollByPage}),t.verticalHasArrows)throw new Error("horizontalHasArrows is not supported in xterm.js");this._createSlider(0,Math.floor((t.verticalScrollbarSize-t.verticalSliderSize)/2),t.verticalSliderSize,void 0)}_updateSlider(e,t){this.slider.setHeight(e),this.slider.setTop(t)}_renderDomNode(e,t){this.domNode.setWidth(t),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,t){return t}_sliderPointerPosition(e){return e.pageY}_sliderOrthogonalPointerPosition(e){return e.pageX}_updateScrollbarSize(e){this.slider.setWidth(e)}writeScrollPosition(e,t){e.scrollTop=t}updateOptions(e){this.updateScrollbarSize(e.vertical===2?0:e.verticalScrollbarSize),this._scrollbarState.setOppositeScrollbarSize(0),this._visibilityController.setVisibility(e.vertical),this._scrollByPage=e.scrollByPage}},tk=500,mS=50,ik=class{constructor(e,t,n){this.timestamp=e,this.deltaX=t,this.deltaY=n,this.score=0}},dp=class{constructor(){this._capacity=5,this._memory=[],this._front=-1,this._rear=-1}isPhysicalMouseWheel(){if(this._front===-1&&this._rear===-1)return!1;let t=1,n=0,a=1,o=this._rear;do{let c=o===this._front?t:Math.pow(2,-a);if(t-=c,n+=this._memory[o].score*c,o===this._front)break;o=(this._capacity+o-1)%this._capacity,a++}while(!0);return n<=.5}acceptStandardWheelEvent(t){if(bm){let n=qs(t.browserEvent),a=fT(n);this.accept(Date.now(),t.deltaX*a,t.deltaY*a)}else this.accept(Date.now(),t.deltaX,t.deltaY)}accept(t,n,a){let o=null,c=new ik(t,n,a);this._front===-1&&this._rear===-1?(this._memory[0]=c,this._front=0,this._rear=0):(o=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]=c),c.score=this._computeScore(c,o)}_computeScore(t,n){if(Math.abs(t.deltaX)>0&&Math.abs(t.deltaY)>0)return 1;let a=.5;if((!this._isAlmostInt(t.deltaX)||!this._isAlmostInt(t.deltaY))&&(a+=.25),n){let o=Math.abs(t.deltaX),c=Math.abs(t.deltaY),d=Math.abs(n.deltaX),p=Math.abs(n.deltaY),m=Math.max(Math.min(o,d),1),f=Math.max(Math.min(c,p),1),S=Math.max(o,d),y=Math.max(c,p);S%m===0&&y%f===0&&(a-=.5)}return Math.min(Math.max(a,0),1)}_isAlmostInt(t){return Math.abs(Math.round(t)-t)<.01}};dp.INSTANCE=new dp;var sk=dp,nk=class extends Em{constructor(e,t,n){super(),this._onScroll=this._register(new _e),this.onScroll=this._onScroll.event,this._onWillScroll=this._register(new _e),this.onWillScroll=this._onWillScroll.event,this._options=ak(t),this._scrollable=n,this._register(this._scrollable.onScroll(o=>{this._onWillScroll.fire(o),this._onDidScroll(o),this._onScroll.fire(o)}));let a={onMouseWheel:o=>this._onMouseWheel(o),onDragStart:()=>this._onDragStart(),onDragEnd:()=>this._onDragEnd()};this._verticalScrollbar=this._register(new ek(this._scrollable,this._options,a)),this._horizontalScrollbar=this._register(new JT(this._scrollable,this._options,a)),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=to(document.createElement("div")),this._leftShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._leftShadowDomNode.domNode),this._topShadowDomNode=to(document.createElement("div")),this._topShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._topShadowDomNode.domNode),this._topLeftShadowDomNode=to(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,o=>this._onMouseOver(o)),this.onmouseleave(this._listenOnDomNode,o=>this._onMouseLeave(o)),this._hideTimeout=this._register(new Cm),this._isDragging=!1,this._mouseIsOver=!1,this._shouldRender=!0,this._revealOnScroll=!0}get options(){return this._options}dispose(){this._mouseWheelToDispose=Hr(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,Ws&&(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 oS(e))}_setListeningToMouseWheel(e){if(this._mouseWheelToDispose.length>0!==e&&(this._mouseWheelToDispose=Hr(this._mouseWheelToDispose),e)){let t=n=>{this._onMouseWheel(new oS(n))};this._mouseWheelToDispose.push(Le(this._listenOnDomNode,ci.MOUSE_WHEEL,t,{passive:!1}))}}_onMouseWheel(e){if(e.browserEvent?.defaultPrevented)return;let t=sk.INSTANCE;t.acceptStandardWheelEvent(e);let n=!1;if(e.deltaY||e.deltaX){let o=e.deltaY*this._options.mouseWheelScrollSensitivity,c=e.deltaX*this._options.mouseWheelScrollSensitivity;this._options.scrollPredominantAxis&&(this._options.scrollYToX&&c+o===0?c=o=0:Math.abs(o)>=Math.abs(c)?c=0:o=0),this._options.flipAxes&&([o,c]=[c,o]);let d=!Ws&&e.browserEvent&&e.browserEvent.shiftKey;(this._options.scrollYToX||d)&&!c&&(c=o,o=0),e.browserEvent&&e.browserEvent.altKey&&(c=c*this._options.fastScrollSensitivity,o=o*this._options.fastScrollSensitivity);let p=this._scrollable.getFutureScrollPosition(),m={};if(o){let f=mS*o,S=p.scrollTop-(f<0?Math.floor(f):Math.ceil(f));this._verticalScrollbar.writeScrollPosition(m,S)}if(c){let f=mS*c,S=p.scrollLeft-(f<0?Math.floor(f):Math.ceil(f));this._horizontalScrollbar.writeScrollPosition(m,S)}m=this._scrollable.validateScrollPosition(m),(p.scrollLeft!==m.scrollLeft||p.scrollTop!==m.scrollTop)&&(this._options.mouseWheelSmoothScroll&&t.isPhysicalMouseWheel()?this._scrollable.setScrollPositionSmooth(m):this._scrollable.setScrollPositionNow(m),n=!0)}let a=n;!a&&this._options.alwaysConsumeMouseWheel&&(a=!0),!a&&this._options.consumeMouseWheelIfScrollbarIsNeeded&&(this._verticalScrollbar.isNeeded()||this._horizontalScrollbar.isNeeded())&&(a=!0),a&&(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(),t=e.scrollTop>0,n=e.scrollLeft>0,a=n?" left":"",o=t?" top":"",c=n||t?" top-left-corner":"";this._leftShadowDomNode.setClassName(`shadow${a}`),this._topShadowDomNode.setClassName(`shadow${o}`),this._topLeftShadowDomNode.setClassName(`shadow${c}${o}${a}`)}}_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(),tk)}},rk=class extends nk{constructor(e,t,n){super(e,t,n)}setScrollPosition(e){e.reuseAnimation?this._scrollable.setScrollPositionSmooth(e,e.reuseAnimation):this._scrollable.setScrollPositionNow(e)}getScrollPosition(){return this._scrollable.getCurrentScrollPosition()}};function ak(e){let t={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 t.horizontalSliderSize=typeof e.horizontalSliderSize<"u"?e.horizontalSliderSize:t.horizontalScrollbarSize,t.verticalSliderSize=typeof e.verticalSliderSize<"u"?e.verticalSliderSize:t.verticalScrollbarSize,Ws&&(t.className+=" mac"),t}var fp=class extends We{constructor(e,t,n,a,o,c,d,p){super(),this._bufferService=n,this._optionsService=d,this._renderService=p,this._onRequestScrollLines=this._register(new _e),this.onRequestScrollLines=this._onRequestScrollLines.event,this._isSyncing=!1,this._isHandlingScroll=!1,this._suppressOnScrollHandler=!1;let m=this._register(new $T({forceIntegerValues:!1,smoothScrollDuration:this._optionsService.rawOptions.smoothScrollDuration,scheduleAtNextAnimationFrame:f=>xm(a.window,f)}));this._register(this._optionsService.onSpecificOptionChange("smoothScrollDuration",()=>{m.setSmoothScrollDuration(this._optionsService.rawOptions.smoothScrollDuration)})),this._scrollableElement=this._register(new rk(t,{vertical:1,horizontal:2,useShadows:!1,mouseWheelSmoothScroll:!0,...this._getChangeOptions()},m)),this._register(this._optionsService.onMultipleOptionChange(["scrollSensitivity","fastScrollSensitivity","overviewRuler"],()=>this._scrollableElement.updateOptions(this._getChangeOptions()))),this._register(o.onProtocolChange(f=>{this._scrollableElement.updateOptions({handleMouseWheel:!(f&16)})})),this._scrollableElement.setScrollDimensions({height:0,scrollHeight:0}),this._register(Ei.runAndSubscribe(c.onChangeColors,()=>{this._scrollableElement.getDomNode().style.backgroundColor=c.colors.background.css})),e.appendChild(this._scrollableElement.getDomNode()),this._register(Tt(()=>this._scrollableElement.getDomNode().remove())),this._styleElement=a.mainDocument.createElement("style"),t.appendChild(this._styleElement),this._register(Tt(()=>this._styleElement.remove())),this._register(Ei.runAndSubscribe(c.onChangeColors,()=>{this._styleElement.textContent=[".xterm .xterm-scrollable-element > .scrollbar > .slider {",` background: ${c.colors.scrollbarSliderBackground.css};`,"}",".xterm .xterm-scrollable-element > .scrollbar > .slider:hover {",` background: ${c.colors.scrollbarSliderHoverBackground.css};`,"}",".xterm .xterm-scrollable-element > .scrollbar > .slider.active {",` background: ${c.colors.scrollbarSliderActiveBackground.css};`,"}"].join(`
23
23
  `)})),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(f=>this._handleScroll(f)))}scrollLines(e){let t=this._scrollableElement.getScrollPosition();this._scrollableElement.setScrollPosition({reuseAnimation:!0,scrollTop:t.scrollTop+e*this._renderService.dimensions.css.cell.height})}scrollToLine(e,t){t&&(this._latestYDisp=e),this._scrollableElement.setScrollPosition({reuseAnimation:!t,scrollTop:e*this._renderService.dimensions.css.cell.height})}_getChangeOptions(){return{mouseWheelScrollSensitivity:this._optionsService.rawOptions.scrollSensitivity,fastScrollSensitivity:this._optionsService.rawOptions.fastScrollSensitivity,verticalScrollbarSize:this._optionsService.rawOptions.overviewRuler?.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 t=Math.round(e.scrollTop/this._renderService.dimensions.css.cell.height),n=t-this._bufferService.buffer.ydisp;n!==0&&(this._latestYDisp=t,this._onRequestScrollLines.fire(n)),this._isHandlingScroll=!1}};fp=Ht([ye(2,Oi),ye(3,bn),ye(4,b0),ye(5,Ha),ye(6,zi),ye(7,wn)],fp);var pp=class extends We{constructor(e,t,n,a,o){super(),this._screenElement=e,this._bufferService=t,this._coreBrowserService=n,this._decorationService=a,this._renderService=o,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(c=>this._removeDecoration(c))),this._register(Tt(()=>{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){let t=this._coreBrowserService.mainDocument.createElement("div");t.classList.add("xterm-decoration"),t.classList.toggle("xterm-decoration-top-layer",e?.options?.layer==="top"),t.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,t.style.height=`${(e.options.height||1)*this._renderService.dimensions.css.cell.height}px`,t.style.top=`${(e.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height}px`,t.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;let n=e.options.x??0;return n&&n>this._bufferService.cols&&(t.style.display="none"),this._refreshXPosition(e,t),t}_refreshStyle(e){let t=e.marker.line-this._bufferService.buffers.active.ydisp;if(t<0||t>=this._bufferService.rows)e.element&&(e.element.style.display="none",e.onRenderEmitter.fire(e.element));else{let n=this._decorationElements.get(e);n||(n=this._createElement(e),e.element=n,this._decorationElements.set(e,n),this._container.appendChild(n),e.onDispose(()=>{this._decorationElements.delete(e),n.remove()})),n.style.display=this._altBufferIsActive?"none":"block",this._altBufferIsActive||(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=`${t*this._renderService.dimensions.css.cell.height}px`,n.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`),e.onRenderEmitter.fire(n)}}_refreshXPosition(e,t=e.element){if(!t)return;let n=e.options.x??0;(e.options.anchor||"left")==="right"?t.style.right=n?`${n*this._renderService.dimensions.css.cell.width}px`:"":t.style.left=n?`${n*this._renderService.dimensions.css.cell.width}px`:""}_removeDecoration(e){this._decorationElements.get(e)?.remove(),this._decorationElements.delete(e),e.dispose()}};pp=Ht([ye(1,Oi),ye(2,bn),ye(3,xo),ye(4,wn)],pp);var lk=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 t of this._zones)if(t.color===e.options.overviewRulerOptions.color&&t.position===e.options.overviewRulerOptions.position){if(this._lineIntersectsZone(t,e.marker.line))return;if(this._lineAdjacentToZone(t,e.marker.line,e.options.overviewRulerOptions.position)){this._addLineToZone(t,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,t){return t>=e.startBufferLine&&t<=e.endBufferLine}_lineAdjacentToZone(e,t,n){return t>=e.startBufferLine-this._linePadding[n||"full"]&&t<=e.endBufferLine+this._linePadding[n||"full"]}_addLineToZone(e,t){e.startBufferLine=Math.min(e.startBufferLine,t),e.endBufferLine=Math.max(e.endBufferLine,t)}},Ks={full:0,left:0,center:0,right:0},Zn={full:0,left:0,center:0,right:0},Nl={full:0,left:0,center:0,right:0},mu=class extends We{constructor(e,t,n,a,o,c,d,p){super(),this._viewportElement=e,this._screenElement=t,this._bufferService=n,this._decorationService=a,this._renderService=o,this._optionsService=c,this._themeService=d,this._coreBrowserService=p,this._colorZoneStore=new lk,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(),this._viewportElement.parentElement?.insertBefore(this._canvas,this._viewportElement),this._register(Tt(()=>this._canvas?.remove()));let m=this._canvas.getContext("2d");if(m)this._ctx=m;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(){return this._optionsService.options.overviewRuler?.width||0}_refreshDrawConstants(){let e=Math.floor((this._canvas.width-1)/3),t=Math.ceil((this._canvas.width-1)/3);Zn.full=this._canvas.width,Zn.left=e,Zn.center=t,Zn.right=e,this._refreshDrawHeightConstants(),Nl.full=1,Nl.left=1,Nl.center=1+Zn.left,Nl.right=1+Zn.left+Zn.center}_refreshDrawHeightConstants(){Ks.full=Math.round(2*this._coreBrowserService.dpr);let e=this._canvas.height/this._bufferService.buffer.lines.length,t=Math.round(Math.max(Math.min(e,12),6)*this._coreBrowserService.dpr);Ks.left=t,Ks.center=t,Ks.right=t}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Ks.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Ks.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Ks.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Ks.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 t of this._decorationService.decorations)this._colorZoneStore.addDecoration(t);this._ctx.lineWidth=1,this._renderRulerOutline();let e=this._colorZoneStore.zones;for(let t of e)t.position!=="full"&&this._renderColorZone(t);for(let t of e)t.position==="full"&&this._renderColorZone(t);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(Nl[e.position||"full"],Math.round((this._canvas.height-1)*(e.startBufferLine/this._bufferService.buffers.active.lines.length)-Ks[e.position||"full"]/2),Zn[e.position||"full"],Math.round((this._canvas.height-1)*((e.endBufferLine-e.startBufferLine)/this._bufferService.buffers.active.lines.length)+Ks[e.position||"full"]))}_queueRefresh(e,t){this._shouldUpdateDimensions=e||this._shouldUpdateDimensions,this._shouldUpdateAnchor=t||this._shouldUpdateAnchor,this._animationFrame===void 0&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._refreshDecorations(),this._animationFrame=void 0}))}};mu=Ht([ye(2,Oi),ye(3,xo),ye(4,wn),ye(5,zi),ye(6,Ha),ye(7,bn)],mu);var oe;(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=`
24
- `,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=""))(oe||={});var eu;(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="Ÿ"))(eu||={});var I0;(e=>e.ST=`${oe.ESC}\\`)(I0||={});var mp=class{constructor(e,t,n,a,o,c){this._textarea=e,this._compositionView=t,this._bufferService=n,this._optionsService=a,this._coreService=o,this._renderService=c,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 t={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout(()=>{if(this._isSendingComposition){this._isSendingComposition=!1;let n;t.start+=this._dataAlreadySent.length,this._isComposing?n=this._textarea.value.substring(t.start,this._compositionPosition.start):n=this._textarea.value.substring(t.start),n.length>0&&this._coreService.triggerDataEvent(n,!0)}},0)}else{this._isSendingComposition=!1;let t=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(t,!0)}}_handleAnyTextareaChanges(){let e=this._textarea.value;setTimeout(()=>{if(!this._isComposing){let t=this._textarea.value,n=t.replace(e,"");this._dataAlreadySent=n,t.length>e.length?this._coreService.triggerDataEvent(n,!0):t.length<e.length?this._coreService.triggerDataEvent(`${oe.DEL}`,!0):t.length===e.length&&t!==e&&this._coreService.triggerDataEvent(t,!0)}},0)}updateCompositionElements(e){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){let t=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),n=this._renderService.dimensions.css.cell.height,a=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,o=t*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=o+"px",this._compositionView.style.top=a+"px",this._compositionView.style.height=n+"px",this._compositionView.style.lineHeight=n+"px",this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+"px";let c=this._compositionView.getBoundingClientRect();this._textarea.style.left=o+"px",this._textarea.style.top=a+"px",this._textarea.style.width=Math.max(c.width,1)+"px",this._textarea.style.height=Math.max(c.height,1)+"px",this._textarea.style.lineHeight=c.height+"px"}e||setTimeout(()=>this.updateCompositionElements(!0),0)}}};mp=Ht([ye(2,Oi),ye(3,zi),ye(4,Pr),ye(5,wn)],mp);var hi=0,di=0,fi=0,jt=0,_S={css:"#00000000",rgba:0},Qt;(e=>{function t(o,c,d,p){return p!==void 0?`#${Mr(o)}${Mr(c)}${Mr(d)}${Mr(p)}`:`#${Mr(o)}${Mr(c)}${Mr(d)}`}e.toCss=t;function n(o,c,d,p=255){return(o<<24|c<<16|d<<8|p)>>>0}e.toRgba=n;function a(o,c,d,p){return{css:e.toCss(o,c,d,p),rgba:e.toRgba(o,c,d,p)}}e.toColor=a})(Qt||={});var xt;(e=>{function t(m,f){if(jt=(f.rgba&255)/255,jt===1)return{css:f.css,rgba:f.rgba};let S=f.rgba>>24&255,y=f.rgba>>16&255,b=f.rgba>>8&255,x=m.rgba>>24&255,C=m.rgba>>16&255,k=m.rgba>>8&255;hi=x+Math.round((S-x)*jt),di=C+Math.round((y-C)*jt),fi=k+Math.round((b-k)*jt);let B=Qt.toCss(hi,di,fi),R=Qt.toRgba(hi,di,fi);return{css:B,rgba:R}}e.blend=t;function n(m){return(m.rgba&255)===255}e.isOpaque=n;function a(m,f,S){let y=tu.ensureContrastRatio(m.rgba,f.rgba,S);if(y)return Qt.toColor(y>>24&255,y>>16&255,y>>8&255)}e.ensureContrastRatio=a;function o(m){let f=(m.rgba|255)>>>0;return[hi,di,fi]=tu.toChannels(f),{css:Qt.toCss(hi,di,fi),rgba:f}}e.opaque=o;function c(m,f){return jt=Math.round(f*255),[hi,di,fi]=tu.toChannels(m.rgba),{css:Qt.toCss(hi,di,fi,jt),rgba:Qt.toRgba(hi,di,fi,jt)}}e.opacity=c;function d(m,f){return jt=m.rgba&255,c(m,jt*f/255)}e.multiplyOpacity=d;function p(m){return[m.rgba>>24&255,m.rgba>>16&255,m.rgba>>8&255]}e.toColorRGB=p})(xt||={});var At;(e=>{let t,n;try{let o=document.createElement("canvas");o.width=1,o.height=1;let c=o.getContext("2d",{willReadFrequently:!0});c&&(t=c,t.globalCompositeOperation="copy",n=t.createLinearGradient(0,0,1,1))}catch{}function a(o){if(o.match(/#[\da-f]{3,8}/i))switch(o.length){case 4:return hi=parseInt(o.slice(1,2).repeat(2),16),di=parseInt(o.slice(2,3).repeat(2),16),fi=parseInt(o.slice(3,4).repeat(2),16),Qt.toColor(hi,di,fi);case 5:return hi=parseInt(o.slice(1,2).repeat(2),16),di=parseInt(o.slice(2,3).repeat(2),16),fi=parseInt(o.slice(3,4).repeat(2),16),jt=parseInt(o.slice(4,5).repeat(2),16),Qt.toColor(hi,di,fi,jt);case 7:return{css:o,rgba:(parseInt(o.slice(1),16)<<8|255)>>>0};case 9:return{css:o,rgba:parseInt(o.slice(1),16)>>>0}}let c=o.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(c)return hi=parseInt(c[1]),di=parseInt(c[2]),fi=parseInt(c[3]),jt=Math.round((c[5]===void 0?1:parseFloat(c[5]))*255),Qt.toColor(hi,di,fi,jt);if(!t||!n)throw new Error("css.toColor: Unsupported css format");if(t.fillStyle=n,t.fillStyle=o,typeof t.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(t.fillRect(0,0,1,1),[hi,di,fi,jt]=t.getImageData(0,0,1,1).data,jt!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:Qt.toRgba(hi,di,fi,jt),css:o}}e.toColor=a})(At||={});var Li;(e=>{function t(a){return n(a>>16&255,a>>8&255,a&255)}e.relativeLuminance=t;function n(a,o,c){let d=a/255,p=o/255,m=c/255,f=d<=.03928?d/12.92:Math.pow((d+.055)/1.055,2.4),S=p<=.03928?p/12.92:Math.pow((p+.055)/1.055,2.4),y=m<=.03928?m/12.92:Math.pow((m+.055)/1.055,2.4);return f*.2126+S*.7152+y*.0722}e.relativeLuminance2=n})(Li||={});var tu;(e=>{function t(d,p){if(jt=(p&255)/255,jt===1)return p;let m=p>>24&255,f=p>>16&255,S=p>>8&255,y=d>>24&255,b=d>>16&255,x=d>>8&255;return hi=y+Math.round((m-y)*jt),di=b+Math.round((f-b)*jt),fi=x+Math.round((S-x)*jt),Qt.toRgba(hi,di,fi)}e.blend=t;function n(d,p,m){let f=Li.relativeLuminance(d>>8),S=Li.relativeLuminance(p>>8);if(pn(f,S)<m){if(S<f){let x=a(d,p,m),C=pn(f,Li.relativeLuminance(x>>8));if(C<m){let k=o(d,p,m),B=pn(f,Li.relativeLuminance(k>>8));return C>B?x:k}return x}let y=o(d,p,m),b=pn(f,Li.relativeLuminance(y>>8));if(b<m){let x=a(d,p,m),C=pn(f,Li.relativeLuminance(x>>8));return b>C?y:x}return y}}e.ensureContrastRatio=n;function a(d,p,m){let f=d>>24&255,S=d>>16&255,y=d>>8&255,b=p>>24&255,x=p>>16&255,C=p>>8&255,k=pn(Li.relativeLuminance2(b,x,C),Li.relativeLuminance2(f,S,y));for(;k<m&&(b>0||x>0||C>0);)b-=Math.max(0,Math.ceil(b*.1)),x-=Math.max(0,Math.ceil(x*.1)),C-=Math.max(0,Math.ceil(C*.1)),k=pn(Li.relativeLuminance2(b,x,C),Li.relativeLuminance2(f,S,y));return(b<<24|x<<16|C<<8|255)>>>0}e.reduceLuminance=a;function o(d,p,m){let f=d>>24&255,S=d>>16&255,y=d>>8&255,b=p>>24&255,x=p>>16&255,C=p>>8&255,k=pn(Li.relativeLuminance2(b,x,C),Li.relativeLuminance2(f,S,y));for(;k<m&&(b<255||x<255||C<255);)b=Math.min(255,b+Math.ceil((255-b)*.1)),x=Math.min(255,x+Math.ceil((255-x)*.1)),C=Math.min(255,C+Math.ceil((255-C)*.1)),k=pn(Li.relativeLuminance2(b,x,C),Li.relativeLuminance2(f,S,y));return(b<<24|x<<16|C<<8|255)>>>0}e.increaseLuminance=o;function c(d){return[d>>24&255,d>>16&255,d>>8&255,d&255]}e.toChannels=c})(tu||={});function Mr(e){let t=e.toString(16);return t.length<2?"0"+t:t}function pn(e,t){return e<t?(t+.05)/(e+.05):(e+.05)/(t+.05)}var ok=class extends Co{constructor(e,t,n){super(),this.content=0,this.combinedData="",this.fg=e.fg,this.bg=e.bg,this.combinedData=t,this._width=n}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()]}},_u=class{constructor(e){this._bufferService=e,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new xs}register(e){let t={id:this._nextCharacterJoinerId++,handler:e};return this._characterJoiners.push(t),t.id}deregister(e){for(let t=0;t<this._characterJoiners.length;t++)if(this._characterJoiners[t].id===e)return this._characterJoiners.splice(t,1),!0;return!1}getJoinedCharacters(e){if(this._characterJoiners.length===0)return[];let t=this._bufferService.buffer.lines.get(e);if(!t||t.length===0)return[];let n=[],a=t.translateToString(!0),o=0,c=0,d=0,p=t.getFg(0),m=t.getBg(0);for(let f=0;f<t.getTrimmedLength();f++)if(t.loadCell(f,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==p||this._workCell.bg!==m){if(f-o>1){let S=this._getJoinedRanges(a,d,c,t,o);for(let y=0;y<S.length;y++)n.push(S[y])}o=f,d=c,p=this._workCell.fg,m=this._workCell.bg}c+=this._workCell.getChars().length||sr.length}if(this._bufferService.cols-o>1){let f=this._getJoinedRanges(a,d,c,t,o);for(let S=0;S<f.length;S++)n.push(f[S])}return n}_getJoinedRanges(e,t,n,a,o){let c=e.substring(t,n),d=[];try{d=this._characterJoiners[0].handler(c)}catch(p){console.error(p)}for(let p=1;p<this._characterJoiners.length;p++)try{let m=this._characterJoiners[p].handler(c);for(let f=0;f<m.length;f++)_u._mergeRanges(d,m[f])}catch(m){console.error(m)}return this._stringRangesToCellRanges(d,a,o),d}_stringRangesToCellRanges(e,t,n){let a=0,o=!1,c=0,d=e[a];if(d){for(let p=n;p<this._bufferService.cols;p++){let m=t.getWidth(p),f=t.getString(p).length||sr.length;if(m!==0){if(!o&&d[0]<=c&&(d[0]=p,o=!0),d[1]<=c){if(d[1]=p,d=e[++a],!d)break;d[0]<=c?(d[0]=p,o=!0):o=!1}c+=f}}d&&(d[1]=this._bufferService.cols)}}static _mergeRanges(e,t){let n=!1;for(let a=0;a<e.length;a++){let o=e[a];if(n){if(t[1]<=o[0])return e[a-1][1]=t[1],e;if(t[1]<=o[1])return e[a-1][1]=Math.max(t[1],o[1]),e.splice(a,1),e;e.splice(a,1),a--}else{if(t[1]<=o[0])return e.splice(a,0,t),e;if(t[1]<=o[1])return o[0]=Math.min(t[0],o[0]),e;t[0]<o[1]&&(o[0]=Math.min(t[0],o[0]),n=!0);continue}}return n?e[e.length-1][1]=t[1]:e.push(t),e}};_u=Ht([ye(0,Oi)],_u);function ck(e){return 57508<=e&&e<=57558}function uk(e){return 9472<=e&&e<=9631}function hk(e){return ck(e)||uk(e)}function dk(){return{css:{canvas:Fc(),cell:Fc()},device:{canvas:Fc(),cell:Fc(),char:{width:0,height:0,left:0,top:0}}}}function Fc(){return{width:0,height:0}}var _p=class{constructor(e,t,n,a,o,c,d){this._document=e,this._characterJoinerService=t,this._optionsService=n,this._coreBrowserService=a,this._coreService=o,this._decorationService=c,this._themeService=d,this._workCell=new xs,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(e,t,n){this._selectionStart=e,this._selectionEnd=t,this._columnSelectMode=n}createRow(e,t,n,a,o,c,d,p,m,f,S){let y=[],b=this._characterJoinerService.getJoinedCharacters(t),x=this._themeService.colors,C=e.getNoBgTrimmedLength();n&&C<c+1&&(C=c+1);let k,B=0,R="",re=0,F=0,J=0,ce=0,q=!1,I=0,ie=!1,de=0,j=0,$=[],H=f!==-1&&S!==-1;for(let L=0;L<C;L++){e.loadCell(L,this._workCell);let X=this._workCell.getWidth();if(X===0)continue;let G=!1,M=L>=j,V=L,Q=this._workCell;if(b.length>0&&L===b[0][0]&&M){let Be=b.shift(),ae=this._isCellInSelection(Be[0],t);for(re=Be[0]+1;re<Be[1];re++)M&&=ae===this._isCellInSelection(re,t);M&&=!n||c<Be[0]||c>=Be[1],M?(G=!0,Q=new ok(this._workCell,e.translateToString(!0,Be[0],Be[1]),Be[1]-Be[0]),V=Be[1]-1,X=Q.getWidth()):j=Be[1]}let ve=this._isCellInSelection(L,t),Se=n&&L===c,E=H&&L>=f&&L<=S,W=!1;this._decorationService.forEachDecorationAtCell(L,t,void 0,Be=>{W=!0});let ee=Q.getChars()||sr;if(ee===" "&&(Q.isUnderline()||Q.isOverline())&&(ee=" "),de=X*p-m.get(ee,Q.isBold(),Q.isItalic()),!k)k=this._document.createElement("span");else if(B&&(ve&&ie||!ve&&!ie&&Q.bg===F)&&(ve&&ie&&x.selectionForeground||Q.fg===J)&&Q.extended.ext===ce&&E===q&&de===I&&!Se&&!G&&!W&&M){Q.isInvisible()?R+=sr:R+=ee,B++;continue}else B&&(k.textContent=R),k=this._document.createElement("span"),B=0,R="";if(F=Q.bg,J=Q.fg,ce=Q.extended.ext,q=E,I=de,ie=ve,G&&c>=L&&c<=V&&(c=L),!this._coreService.isCursorHidden&&Se&&this._coreService.isCursorInitialized){if($.push("xterm-cursor"),this._coreBrowserService.isFocused)d&&$.push("xterm-cursor-blink"),$.push(a==="bar"?"xterm-cursor-bar":a==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(o)switch(o){case"outline":$.push("xterm-cursor-outline");break;case"block":$.push("xterm-cursor-block");break;case"bar":$.push("xterm-cursor-bar");break;case"underline":$.push("xterm-cursor-underline");break}}if(Q.isBold()&&$.push("xterm-bold"),Q.isItalic()&&$.push("xterm-italic"),Q.isDim()&&$.push("xterm-dim"),Q.isInvisible()?R=sr:R=Q.getChars()||sr,Q.isUnderline()&&($.push(`xterm-underline-${Q.extended.underlineStyle}`),R===" "&&(R=" "),!Q.isUnderlineColorDefault()))if(Q.isUnderlineColorRGB())k.style.textDecorationColor=`rgb(${Co.toColorRGB(Q.getUnderlineColor()).join(",")})`;else{let Be=Q.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&Q.isBold()&&Be<8&&(Be+=8),k.style.textDecorationColor=x.ansi[Be].css}Q.isOverline()&&($.push("xterm-overline"),R===" "&&(R=" ")),Q.isStrikethrough()&&$.push("xterm-strikethrough"),E&&(k.style.textDecoration="underline");let he=Q.getFgColor(),ge=Q.getFgColorMode(),me=Q.getBgColor(),Ce=Q.getBgColorMode(),ze=!!Q.isInverse();if(ze){let Be=he;he=me,me=Be;let ae=ge;ge=Ce,Ce=ae}let Ne,Re,Pe=!1;this._decorationService.forEachDecorationAtCell(L,t,void 0,Be=>{Be.options.layer!=="top"&&Pe||(Be.backgroundColorRGB&&(Ce=50331648,me=Be.backgroundColorRGB.rgba>>8&16777215,Ne=Be.backgroundColorRGB),Be.foregroundColorRGB&&(ge=50331648,he=Be.foregroundColorRGB.rgba>>8&16777215,Re=Be.foregroundColorRGB),Pe=Be.options.layer==="top")}),!Pe&&ve&&(Ne=this._coreBrowserService.isFocused?x.selectionBackgroundOpaque:x.selectionInactiveBackgroundOpaque,me=Ne.rgba>>8&16777215,Ce=50331648,Pe=!0,x.selectionForeground&&(ge=50331648,he=x.selectionForeground.rgba>>8&16777215,Re=x.selectionForeground)),Pe&&$.push("xterm-decoration-top");let Ye;switch(Ce){case 16777216:case 33554432:Ye=x.ansi[me],$.push(`xterm-bg-${me}`);break;case 50331648:Ye=Qt.toColor(me>>16,me>>8&255,me&255),this._addStyle(k,`background-color:#${vS((me>>>0).toString(16),"0",6)}`);break;default:ze?(Ye=x.foreground,$.push("xterm-bg-257")):Ye=x.background}switch(Ne||Q.isDim()&&(Ne=xt.multiplyOpacity(Ye,.5)),ge){case 16777216:case 33554432:Q.isBold()&&he<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(he+=8),this._applyMinimumContrast(k,Ye,x.ansi[he],Q,Ne,void 0)||$.push(`xterm-fg-${he}`);break;case 50331648:let Be=Qt.toColor(he>>16&255,he>>8&255,he&255);this._applyMinimumContrast(k,Ye,Be,Q,Ne,Re)||this._addStyle(k,`color:#${vS(he.toString(16),"0",6)}`);break;default:this._applyMinimumContrast(k,Ye,x.foreground,Q,Ne,Re)||ze&&$.push("xterm-fg-257")}$.length&&(k.className=$.join(" "),$.length=0),!Se&&!G&&!W&&M?B++:k.textContent=R,de!==this.defaultSpacing&&(k.style.letterSpacing=`${de}px`),y.push(k),L=V}return k&&B&&(k.textContent=R),y}_applyMinimumContrast(e,t,n,a,o,c){if(this._optionsService.rawOptions.minimumContrastRatio===1||hk(a.getCode()))return!1;let d=this._getContrastCache(a),p;if(!o&&!c&&(p=d.getColor(t.rgba,n.rgba)),p===void 0){let m=this._optionsService.rawOptions.minimumContrastRatio/(a.isDim()?2:1);p=xt.ensureContrastRatio(o||t,c||n,m),d.setColor((o||t).rgba,(c||n).rgba,p??null)}return p?(this._addStyle(e,`color:${p.css}`),!0):!1}_getContrastCache(e){return e.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(e,t){e.setAttribute("style",`${e.getAttribute("style")||""}${t};`)}_isCellInSelection(e,t){let n=this._selectionStart,a=this._selectionEnd;return!n||!a?!1:this._columnSelectMode?n[0]<=a[0]?e>=n[0]&&t>=n[1]&&e<a[0]&&t<=a[1]:e<n[0]&&t>=n[1]&&e>=a[0]&&t<=a[1]:t>n[1]&&t<a[1]||n[1]===a[1]&&t===n[1]&&e>=n[0]&&e<a[0]||n[1]<a[1]&&t===a[1]&&e<a[0]||n[1]<a[1]&&t===n[1]&&e>=n[0]}};_p=Ht([ye(1,x0),ye(2,zi),ye(3,bn),ye(4,Pr),ye(5,xo),ye(6,Ha)],_p);function vS(e,t,n){for(;e.length<n;)e=t+e;return e}var fk=class{constructor(e,t){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 n=e.createElement("span");n.classList.add("xterm-char-measure-element");let a=e.createElement("span");a.classList.add("xterm-char-measure-element"),a.style.fontWeight="bold";let o=e.createElement("span");o.classList.add("xterm-char-measure-element"),o.style.fontStyle="italic";let c=e.createElement("span");c.classList.add("xterm-char-measure-element"),c.style.fontWeight="bold",c.style.fontStyle="italic",this._measureElements=[n,a,o,c],this._container.appendChild(n),this._container.appendChild(a),this._container.appendChild(o),this._container.appendChild(c),t.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,t,n,a){e===this._font&&t===this._fontSize&&n===this._weight&&a===this._weightBold||(this._font=e,this._fontSize=t,this._weight=n,this._weightBold=a,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${n}`,this._measureElements[1].style.fontWeight=`${a}`,this._measureElements[2].style.fontWeight=`${n}`,this._measureElements[3].style.fontWeight=`${a}`,this.clear())}get(e,t,n){let a=0;if(!t&&!n&&e.length===1&&(a=e.charCodeAt(0))<256){if(this._flat[a]!==-9999)return this._flat[a];let d=this._measure(e,0);return d>0&&(this._flat[a]=d),d}let o=e;t&&(o+="B"),n&&(o+="I");let c=this._holey.get(o);if(c===void 0){let d=0;t&&(d|=1),n&&(d|=2),c=this._measure(e,d),c>0&&this._holey.set(o,c)}return c}_measure(e,t){let n=this._measureElements[t];return n.textContent=e.repeat(32),n.offsetWidth/32}},pk=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,t,n,a=!1){if(this.selectionStart=t,this.selectionEnd=n,!t||!n||t[0]===n[0]&&t[1]===n[1]){this.clear();return}let o=e.buffers.active.ydisp,c=t[1]-o,d=n[1]-o,p=Math.max(c,0),m=Math.min(d,e.rows-1);if(p>=e.rows||m<0){this.clear();return}this.hasSelection=!0,this.columnSelectMode=a,this.viewportStartRow=c,this.viewportEndRow=d,this.viewportCappedStartRow=p,this.viewportCappedEndRow=m,this.startCol=t[0],this.endCol=n[0]}isCellSelected(e,t,n){return this.hasSelection?(n-=e.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?t>=this.startCol&&n>=this.viewportCappedStartRow&&t<this.endCol&&n<=this.viewportCappedEndRow:t<this.startCol&&n>=this.viewportCappedStartRow&&t>=this.endCol&&n<=this.viewportCappedEndRow:n>this.viewportStartRow&&n<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&n===this.viewportStartRow&&t>=this.startCol&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&n===this.viewportEndRow&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&n===this.viewportStartRow&&t>=this.startCol):!1}};function mk(){return new pk}var df="xterm-dom-renderer-owner-",ys="xterm-rows",qc="xterm-fg-",gS="xterm-bg-",Bl="xterm-focus",Wc="xterm-selection",_k=1,vp=class extends We{constructor(e,t,n,a,o,c,d,p,m,f,S,y,b,x){super(),this._terminal=e,this._document=t,this._element=n,this._screenElement=a,this._viewportElement=o,this._helperContainer=c,this._linkifier2=d,this._charSizeService=m,this._optionsService=f,this._bufferService=S,this._coreService=y,this._coreBrowserService=b,this._themeService=x,this._terminalClass=_k++,this._rowElements=[],this._selectionRenderModel=mk(),this.onRequestRedraw=this._register(new _e).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(ys),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(Wc),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=dk(),this._updateDimensions(),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._themeService.onChangeColors(C=>this._injectCss(C))),this._injectCss(this._themeService.colors),this._rowFactory=p.createInstance(_p,document),this._element.classList.add(df+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this._register(this._linkifier2.onShowLinkUnderline(C=>this._handleLinkHover(C))),this._register(this._linkifier2.onHideLinkUnderline(C=>this._handleLinkLeave(C))),this._register(Tt(()=>{this._element.classList.remove(df+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()})),this._widthCache=new fk(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 n of this._rowElements)n.style.width=`${this.dimensions.css.canvas.width}px`,n.style.height=`${this.dimensions.css.cell.height}px`,n.style.lineHeight=`${this.dimensions.css.cell.height}px`,n.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));let t=`${this._terminalSelector} .${ys} span { display: inline-block; height: 100%; vertical-align: top;}`;this._dimensionsStyleElement.textContent=t,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 t=`${this._terminalSelector} .${ys} { 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}`;t+=`${this._terminalSelector} .${ys} .xterm-dim { color: ${xt.multiplyOpacity(e.foreground,.5).css};}`,t+=`${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 n=`blink_underline_${this._terminalClass}`,a=`blink_bar_${this._terminalClass}`,o=`blink_block_${this._terminalClass}`;t+=`@keyframes ${n} { 50% { border-bottom-style: hidden; }}`,t+=`@keyframes ${a} { 50% { box-shadow: none; }}`,t+=`@keyframes ${o} { 0% { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css}; } 50% { background-color: inherit; color: ${e.cursor.css}; }}`,t+=`${this._terminalSelector} .${ys}.${Bl} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${n} 1s step-end infinite;}${this._terminalSelector} .${ys}.${Bl} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${a} 1s step-end infinite;}${this._terminalSelector} .${ys}.${Bl} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${o} 1s step-end infinite;}${this._terminalSelector} .${ys} .xterm-cursor.xterm-cursor-block { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css};}${this._terminalSelector} .${ys} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${e.cursor.css} !important; color: ${e.cursorAccent.css} !important;}${this._terminalSelector} .${ys} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${e.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${ys} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${e.cursor.css} inset;}${this._terminalSelector} .${ys} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${e.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,t+=`${this._terminalSelector} .${Wc} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${Wc} div { position: absolute; background-color: ${e.selectionBackgroundOpaque.css};}${this._terminalSelector} .${Wc} div { position: absolute; background-color: ${e.selectionInactiveBackgroundOpaque.css};}`;for(let[c,d]of e.ansi.entries())t+=`${this._terminalSelector} .${qc}${c} { color: ${d.css}; }${this._terminalSelector} .${qc}${c}.xterm-dim { color: ${xt.multiplyOpacity(d,.5).css}; }${this._terminalSelector} .${gS}${c} { background-color: ${d.css}; }`;t+=`${this._terminalSelector} .${qc}257 { color: ${xt.opaque(e.background).css}; }${this._terminalSelector} .${qc}257.xterm-dim { color: ${xt.multiplyOpacity(xt.opaque(e.background),.5).css}; }${this._terminalSelector} .${gS}257 { background-color: ${e.foreground.css}; }`,this._themeStyleElement.textContent=t}_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,t){for(let n=this._rowElements.length;n<=t;n++){let a=this._document.createElement("div");this._rowContainer.appendChild(a),this._rowElements.push(a)}for(;this._rowElements.length>t;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(e,t){this._refreshRowElements(e,t),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(Bl),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(Bl),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(e,t,n){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(e,t,n),this.renderRows(0,this._bufferService.rows-1),!e||!t||(this._selectionRenderModel.update(this._terminal,e,t,n),!this._selectionRenderModel.hasSelection))return;let a=this._selectionRenderModel.viewportStartRow,o=this._selectionRenderModel.viewportEndRow,c=this._selectionRenderModel.viewportCappedStartRow,d=this._selectionRenderModel.viewportCappedEndRow,p=this._document.createDocumentFragment();if(n){let m=e[0]>t[0];p.appendChild(this._createSelectionElement(c,m?t[0]:e[0],m?e[0]:t[0],d-c+1))}else{let m=a===c?e[0]:0,f=c===o?t[0]:this._bufferService.cols;p.appendChild(this._createSelectionElement(c,m,f));let S=d-c-1;if(p.appendChild(this._createSelectionElement(c+1,0,this._bufferService.cols,S)),c!==d){let y=o===d?t[0]:this._bufferService.cols;p.appendChild(this._createSelectionElement(d,0,y))}}this._selectionContainer.appendChild(p)}_createSelectionElement(e,t,n,a=1){let o=this._document.createElement("div"),c=t*this.dimensions.css.cell.width,d=this.dimensions.css.cell.width*(n-t);return c+d>this.dimensions.css.canvas.width&&(d=this.dimensions.css.canvas.width-c),o.style.height=`${a*this.dimensions.css.cell.height}px`,o.style.top=`${e*this.dimensions.css.cell.height}px`,o.style.left=`${c}px`,o.style.width=`${d}px`,o}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,t){let n=this._bufferService.buffer,a=n.ybase+n.y,o=Math.min(n.x,this._bufferService.cols-1),c=this._coreService.decPrivateModes.cursorBlink??this._optionsService.rawOptions.cursorBlink,d=this._coreService.decPrivateModes.cursorStyle??this._optionsService.rawOptions.cursorStyle,p=this._optionsService.rawOptions.cursorInactiveStyle;for(let m=e;m<=t;m++){let f=m+n.ydisp,S=this._rowElements[m],y=n.lines.get(f);if(!S||!y)break;S.replaceChildren(...this._rowFactory.createRow(y,f,f===a,d,p,o,c,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${df}${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,t,n,a,o,c){n<0&&(e=0),a<0&&(t=0);let d=this._bufferService.rows-1;n=Math.max(Math.min(n,d),0),a=Math.max(Math.min(a,d),0),o=Math.min(o,this._bufferService.cols);let p=this._bufferService.buffer,m=p.ybase+p.y,f=Math.min(p.x,o-1),S=this._optionsService.rawOptions.cursorBlink,y=this._optionsService.rawOptions.cursorStyle,b=this._optionsService.rawOptions.cursorInactiveStyle;for(let x=n;x<=a;++x){let C=x+p.ydisp,k=this._rowElements[x],B=p.lines.get(C);if(!k||!B)break;k.replaceChildren(...this._rowFactory.createRow(B,C,C===m,y,b,f,S,this.dimensions.css.cell.width,this._widthCache,c?x===n?e:0:-1,c?(x===a?t:o)-1:-1))}}};vp=Ht([ye(7,gm),ye(8,Nu),ye(9,zi),ye(10,Oi),ye(11,Pr),ye(12,bn),ye(13,Ha)],vp);var gp=class extends We{constructor(e,t,n){super(),this._optionsService=n,this.width=0,this.height=0,this._onCharSizeChange=this._register(new _e),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this._register(new gk(this._optionsService))}catch{this._measureStrategy=this._register(new vk(e,t,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())}};gp=Ht([ye(2,zi)],gp);var F0=class extends We{constructor(){super(...arguments),this._result={width:0,height:0}}_validateAndSet(e,t){e!==void 0&&e>0&&t!==void 0&&t>0&&(this._result.width=e,this._result.height=t)}},vk=class extends F0{constructor(e,t,n){super(),this._document=e,this._parentElement=t,this._optionsService=n,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}},gk=class extends F0{constructor(e){super(),this._optionsService=e,this._canvas=new OffscreenCanvas(100,100),this._ctx=this._canvas.getContext("2d");let t=this._ctx.measureText("W");if(!("width"in t&&"fontBoundingBoxAscent"in t&&"fontBoundingBoxDescent"in t))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}},yk=class extends We{constructor(e,t,n){super(),this._textarea=e,this._window=t,this.mainDocument=n,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=this._register(new Sk(this._window)),this._onDprChange=this._register(new _e),this.onDprChange=this._onDprChange.event,this._onWindowChange=this._register(new _e),this.onWindowChange=this._onWindowChange.event,this._register(this.onWindowChange(a=>this._screenDprMonitor.setWindow(a))),this._register(Ei.forward(this._screenDprMonitor.onDprChange,this._onDprChange)),this._register(Le(this._textarea,"focus",()=>this._isFocused=!0)),this._register(Le(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}},Sk=class extends We{constructor(e){super(),this._parentWindow=e,this._windowResizeListener=this._register(new La),this._onDprChange=this._register(new _e),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this._register(Tt(()=>this.clearListener()))}setWindow(e){this._parentWindow=e,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=Le(this._parentWindow,"resize",()=>this._setDprAndFireIfDiffers())}_setDprAndFireIfDiffers(){this._parentWindow.devicePixelRatio!==this._currentDevicePixelRatio&&this._onDprChange.fire(this._parentWindow.devicePixelRatio),this._updateDpr()}_updateDpr(){this._outerListener&&(this._resolutionMediaMatchList?.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)}},bk=class extends We{constructor(){super(),this.linkProviders=[],this._register(Tt(()=>this.linkProviders.length=0))}registerLinkProvider(e){return this.linkProviders.push(e),{dispose:()=>{let t=this.linkProviders.indexOf(e);t!==-1&&this.linkProviders.splice(t,1)}}}};function Tm(e,t,n){let a=n.getBoundingClientRect(),o=e.getComputedStyle(n),c=parseInt(o.getPropertyValue("padding-left")),d=parseInt(o.getPropertyValue("padding-top"));return[t.clientX-a.left-c,t.clientY-a.top-d]}function wk(e,t,n,a,o,c,d,p,m){if(!c)return;let f=Tm(e,t,n);if(f)return f[0]=Math.ceil((f[0]+(m?d/2:0))/d),f[1]=Math.ceil(f[1]/p),f[0]=Math.min(Math.max(f[0],1),a+(m?1:0)),f[1]=Math.min(Math.max(f[1],1),o),f}var yp=class{constructor(e,t){this._renderService=e,this._charSizeService=t}getCoords(e,t,n,a,o){return wk(window,e,t,n,a,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,o)}getMouseReportCoords(e,t){let n=Tm(window,e,t);if(this._charSizeService.hasValidSize)return n[0]=Math.min(Math.max(n[0],0),this._renderService.dimensions.css.canvas.width-1),n[1]=Math.min(Math.max(n[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(n[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(n[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(n[0]),y:Math.floor(n[1])}}};yp=Ht([ye(0,wn),ye(1,Nu)],yp);var Ck=class{constructor(e,t){this._renderCallback=e,this._coreBrowserService=t,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,t,n){this._rowCount=n,e=e!==void 0?e:0,t=t!==void 0?t: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,t):t,!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),t=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(e,t),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(let e of this._refreshCallbacks)e(0);this._refreshCallbacks=[]}},q0={};B2(q0,{getSafariVersion:()=>Ek,isChromeOS:()=>V0,isFirefox:()=>W0,isIpad:()=>Tk,isIphone:()=>kk,isLegacyEdge:()=>xk,isLinux:()=>km,isMac:()=>vu,isNode:()=>Bu,isSafari:()=>Y0,isWindows:()=>$0});var Bu=typeof process<"u"&&"title"in process,Eo=Bu?"node":navigator.userAgent,To=Bu?"node":navigator.platform,W0=Eo.includes("Firefox"),xk=Eo.includes("Edge"),Y0=/^((?!chrome|android).)*safari/i.test(Eo);function Ek(){if(!Y0)return 0;let e=Eo.match(/Version\/(\d+)/);return e===null||e.length<2?0:parseInt(e[1])}var vu=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(To),Tk=To==="iPad",kk=To==="iPhone",$0=["Windows","Win16","Win32","WinCE"].includes(To),km=To.indexOf("Linux")>=0,V0=/\bCrOS\b/.test(Eo),X0=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 t=0,n=0,a=e.timeRemaining(),o=0;for(;this._i<this._tasks.length;){if(t=performance.now(),this._tasks[this._i]()||this._i++,t=Math.max(1,performance.now()-t),n=Math.max(t,n),o=e.timeRemaining(),n*1.5>o){a-t<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(a-t))}ms`),this._start();return}a=o}this.clear()}},Dk=class extends X0{_requestCallback(e){return setTimeout(()=>e(this._createDeadline(16)))}_cancelCallback(e){clearTimeout(e)}_createDeadline(e){let t=performance.now()+e;return{timeRemaining:()=>Math.max(0,t-performance.now())}}},Rk=class extends X0{_requestCallback(e){return requestIdleCallback(e)}_cancelCallback(e){cancelIdleCallback(e)}},gu=!Bu&&"requestIdleCallback"in window?Rk:Dk,Mk=class{constructor(){this._queue=new gu}set(e){this._queue.clear(),this._queue.enqueue(e)}flush(){this._queue.flush()}},Sp=class extends We{constructor(e,t,n,a,o,c,d,p,m){super(),this._rowCount=e,this._optionsService=n,this._charSizeService=a,this._coreService=o,this._coreBrowserService=p,this._renderer=this._register(new La),this._pausedResizeTask=new Mk,this._observerDisposable=this._register(new La),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 _e),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this._register(new _e),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this._register(new _e),this.onRender=this._onRender.event,this._onRefreshRequest=this._register(new _e),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new Ck((f,S)=>this._renderRows(f,S),this._coreBrowserService),this._register(this._renderDebouncer),this._syncOutputHandler=new Ak(this._coreBrowserService,this._coreService,()=>this._fullRefresh()),this._register(Tt(()=>this._syncOutputHandler.dispose())),this._register(this._coreBrowserService.onDprChange(()=>this.handleDevicePixelRatioChange())),this._register(d.onResize(()=>this._fullRefresh())),this._register(d.buffers.onBufferActivate(()=>this._renderer.value?.clear())),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._charSizeService.onCharSizeChange(()=>this.handleCharSizeChanged())),this._register(c.onDecorationRegistered(()=>this._fullRefresh())),this._register(c.onDecorationRemoved(()=>this._fullRefresh())),this._register(this._optionsService.onMultipleOptionChange(["customGlyphs","drawBoldTextInBrightColors","letterSpacing","lineHeight","fontFamily","fontSize","fontWeight","fontWeightBold","minimumContrastRatio","rescaleOverlappingGlyphs"],()=>{this.clear(),this.handleResize(d.cols,d.rows),this._fullRefresh()})),this._register(this._optionsService.onMultipleOptionChange(["cursorBlink","cursorStyle"],()=>this.refreshRows(d.buffer.y,d.buffer.y,!0))),this._register(m.onChangeColors(()=>this._fullRefresh())),this._registerIntersectionObserver(this._coreBrowserService.window,t),this._register(this._coreBrowserService.onWindowChange(f=>this._registerIntersectionObserver(f,t)))}get dimensions(){return this._renderer.value.dimensions}_registerIntersectionObserver(e,t){if("IntersectionObserver"in e){let n=new e.IntersectionObserver(a=>this._handleIntersectionChange(a[a.length-1]),{threshold:0});n.observe(t),this._observerDisposable.value=Tt(()=>n.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,t,n=!1){if(this._isPaused){this._needsFullRefresh=!0;return}if(this._coreService.decPrivateModes.synchronizedOutput){this._syncOutputHandler.bufferRows(e,t);return}let a=this._syncOutputHandler.flush();a&&(e=Math.min(e,a.start),t=Math.max(t,a.end)),n||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(e,t,this._rowCount)}_renderRows(e,t){if(this._renderer.value){if(this._coreService.decPrivateModes.synchronizedOutput){this._syncOutputHandler.bufferRows(e,t);return}e=Math.min(e,this._rowCount-1),t=Math.min(t,this._rowCount-1),this._renderer.value.renderRows(e,t),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:t}),this._onRender.fire({start:e,end:t}),this._isNextRenderRedrawOnly=!0}}resize(e,t){this._rowCount=t,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(t=>this.refreshRows(t.start,t.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(){this._renderer.value&&(this._renderer.value.clearTextureAtlas?.(),this._fullRefresh())}handleDevicePixelRatioChange(){this._charSizeService.measure(),this._renderer.value&&(this._renderer.value.handleDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1))}handleResize(e,t){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set(()=>this._renderer.value?.handleResize(e,t)):this._renderer.value.handleResize(e,t),this._fullRefresh())}handleCharSizeChanged(){this._renderer.value?.handleCharSizeChanged()}handleBlur(){this._renderer.value?.handleBlur()}handleFocus(){this._renderer.value?.handleFocus()}handleSelectionChanged(e,t,n){this._selectionState.start=e,this._selectionState.end=t,this._selectionState.columnSelectMode=n,this._renderer.value?.handleSelectionChanged(e,t,n)}handleCursorMove(){this._renderer.value?.handleCursorMove()}clear(){this._renderer.value?.clear()}};Sp=Ht([ye(2,zi),ye(3,Nu),ye(4,Pr),ye(5,xo),ye(6,Oi),ye(7,bn),ye(8,Ha)],Sp);var Ak=class{constructor(e,t,n){this._coreBrowserService=e,this._coreService=t,this._onTimeout=n,this._start=0,this._end=0,this._isBuffering=!1}bufferRows(e,t){this._isBuffering?(this._start=Math.min(this._start,e),this._end=Math.max(this._end,t)):(this._start=e,this._end=t,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 Nk(e,t,n,a){let o=n.buffer.x,c=n.buffer.y;if(!n.buffer.hasScrollback)return Ok(o,c,e,t,n,a)+Lu(c,t,n,a)+zk(o,c,e,t,n,a);let d;if(c===t)return d=o>e?"D":"C",oo(Math.abs(o-e),lo(d,a));d=c>t?"D":"C";let p=Math.abs(c-t),m=Lk(c>t?e:o,n)+(p-1)*n.cols+1+Bk(c>t?o:e);return oo(m,lo(d,a))}function Bk(e,t){return e-1}function Lk(e,t){return t.cols-e}function Ok(e,t,n,a,o,c){return Lu(t,a,o,c).length===0?"":oo(Z0(e,t,e,t-Ur(t,o),!1,o).length,lo("D",c))}function Lu(e,t,n,a){let o=e-Ur(e,n),c=t-Ur(t,n),d=Math.abs(o-c)-jk(e,t,n);return oo(d,lo(G0(e,t),a))}function zk(e,t,n,a,o,c){let d;Lu(t,a,o,c).length>0?d=a-Ur(a,o):d=t;let p=a,m=Hk(e,t,n,a,o,c);return oo(Z0(e,d,n,p,m==="C",o).length,lo(m,c))}function jk(e,t,n){let a=0,o=e-Ur(e,n),c=t-Ur(t,n);for(let d=0;d<Math.abs(o-c);d++){let p=G0(e,t)==="A"?-1:1;n.buffer.lines.get(o+p*d)?.isWrapped&&a++}return a}function Ur(e,t){let n=0,a=t.buffer.lines.get(e),o=a?.isWrapped;for(;o&&e>=0&&e<t.rows;)n++,a=t.buffer.lines.get(--e),o=a?.isWrapped;return n}function Hk(e,t,n,a,o,c){let d;return Lu(n,a,o,c).length>0?d=a-Ur(a,o):d=t,e<n&&d<=a||e>=n&&d<a?"C":"D"}function G0(e,t){return e>t?"A":"B"}function Z0(e,t,n,a,o,c){let d=e,p=t,m="";for(;(d!==n||p!==a)&&p>=0&&p<c.buffer.lines.length;)d+=o?1:-1,o&&d>c.cols-1?(m+=c.buffer.translateBufferLineToString(p,!1,e,d),d=0,e=0,p++):!o&&d<0&&(m+=c.buffer.translateBufferLineToString(p,!1,0,e+1),d=c.cols-1,e=d,p--);return m+c.buffer.translateBufferLineToString(p,!1,e,d)}function lo(e,t){let n=t?"O":"[";return oe.ESC+n+e}function oo(e,t){e=Math.floor(e);let n="";for(let a=0;a<e;a++)n+=t;return n}var Uk=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,t=this.selectionEnd;return!e||!t?!1:e[1]>t[1]||e[1]===t[1]&&e[0]>t[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 yS(e,t){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 t*(e.end.y-e.start.y)+(e.end.x-e.start.x+1)}var ff=50,Pk=15,Kk=50,Ik=500,Fk=" ",qk=new RegExp(Fk,"g"),bp=class extends We{constructor(e,t,n,a,o,c,d,p,m){super(),this._element=e,this._screenElement=t,this._linkifier=n,this._bufferService=a,this._coreService=o,this._mouseService=c,this._optionsService=d,this._renderService=p,this._coreBrowserService=m,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new xs,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this._register(new _e),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this._register(new _e),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this._register(new _e),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this._register(new _e),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=f=>this._handleMouseMove(f),this._mouseUpListener=f=>this._handleMouseUp(f),this._coreService.onUserInput(()=>{this.hasSelection&&this.clearSelection()}),this._trimListener=this._bufferService.buffer.lines.onTrim(f=>this._handleTrim(f)),this._register(this._bufferService.buffers.onBufferActivate(f=>this._handleBufferActivate(f))),this.enable(),this._model=new Uk(this._bufferService),this._activeSelectionMode=0,this._register(Tt(()=>{this._removeMouseDownListeners()})),this._register(this._bufferService.onResize(f=>{f.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,t=this._model.finalSelectionEnd;return!e||!t?!1:e[0]!==t[0]||e[1]!==t[1]}get selectionText(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd;if(!e||!t)return"";let n=this._bufferService.buffer,a=[];if(this._activeSelectionMode===3){if(e[0]===t[0])return"";let o=e[0]<t[0]?e[0]:t[0],c=e[0]<t[0]?t[0]:e[0];for(let d=e[1];d<=t[1];d++){let p=n.translateBufferLineToString(d,!0,o,c);a.push(p)}}else{let o=e[1]===t[1]?t[0]:void 0;a.push(n.translateBufferLineToString(e[1],!0,e[0],o));for(let c=e[1]+1;c<=t[1]-1;c++){let d=n.lines.get(c),p=n.translateBufferLineToString(c,!0);d?.isWrapped?a[a.length-1]+=p:a.push(p)}if(e[1]!==t[1]){let c=n.lines.get(t[1]),d=n.translateBufferLineToString(t[1],!0,0,t[0]);c&&c.isWrapped?a[a.length-1]+=d:a.push(d)}}return a.map(o=>o.replace(qk," ")).join($0?`\r
24
+ `,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=""))(oe||={});var eu;(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="Ÿ"))(eu||={});var I0;(e=>e.ST=`${oe.ESC}\\`)(I0||={});var mp=class{constructor(e,t,n,a,o,c){this._textarea=e,this._compositionView=t,this._bufferService=n,this._optionsService=a,this._coreService=o,this._renderService=c,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 t={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout(()=>{if(this._isSendingComposition){this._isSendingComposition=!1;let n;t.start+=this._dataAlreadySent.length,this._isComposing?n=this._textarea.value.substring(t.start,this._compositionPosition.start):n=this._textarea.value.substring(t.start),n.length>0&&this._coreService.triggerDataEvent(n,!0)}},0)}else{this._isSendingComposition=!1;let t=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(t,!0)}}_handleAnyTextareaChanges(){let e=this._textarea.value;setTimeout(()=>{if(!this._isComposing){let t=this._textarea.value,n=t.replace(e,"");this._dataAlreadySent=n,t.length>e.length?this._coreService.triggerDataEvent(n,!0):t.length<e.length?this._coreService.triggerDataEvent(`${oe.DEL}`,!0):t.length===e.length&&t!==e&&this._coreService.triggerDataEvent(t,!0)}},0)}updateCompositionElements(e){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){let t=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),n=this._renderService.dimensions.css.cell.height,a=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,o=t*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=o+"px",this._compositionView.style.top=a+"px",this._compositionView.style.height=n+"px",this._compositionView.style.lineHeight=n+"px",this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+"px";let c=this._compositionView.getBoundingClientRect();this._textarea.style.left=o+"px",this._textarea.style.top=a+"px",this._textarea.style.width=Math.max(c.width,1)+"px",this._textarea.style.height=Math.max(c.height,1)+"px",this._textarea.style.lineHeight=c.height+"px"}e||setTimeout(()=>this.updateCompositionElements(!0),0)}}};mp=Ht([ye(2,Oi),ye(3,zi),ye(4,Pr),ye(5,wn)],mp);var hi=0,di=0,fi=0,jt=0,_S={css:"#00000000",rgba:0},Qt;(e=>{function t(o,c,d,p){return p!==void 0?`#${Mr(o)}${Mr(c)}${Mr(d)}${Mr(p)}`:`#${Mr(o)}${Mr(c)}${Mr(d)}`}e.toCss=t;function n(o,c,d,p=255){return(o<<24|c<<16|d<<8|p)>>>0}e.toRgba=n;function a(o,c,d,p){return{css:e.toCss(o,c,d,p),rgba:e.toRgba(o,c,d,p)}}e.toColor=a})(Qt||={});var xt;(e=>{function t(m,f){if(jt=(f.rgba&255)/255,jt===1)return{css:f.css,rgba:f.rgba};let S=f.rgba>>24&255,y=f.rgba>>16&255,b=f.rgba>>8&255,x=m.rgba>>24&255,C=m.rgba>>16&255,k=m.rgba>>8&255;hi=x+Math.round((S-x)*jt),di=C+Math.round((y-C)*jt),fi=k+Math.round((b-k)*jt);let B=Qt.toCss(hi,di,fi),R=Qt.toRgba(hi,di,fi);return{css:B,rgba:R}}e.blend=t;function n(m){return(m.rgba&255)===255}e.isOpaque=n;function a(m,f,S){let y=tu.ensureContrastRatio(m.rgba,f.rgba,S);if(y)return Qt.toColor(y>>24&255,y>>16&255,y>>8&255)}e.ensureContrastRatio=a;function o(m){let f=(m.rgba|255)>>>0;return[hi,di,fi]=tu.toChannels(f),{css:Qt.toCss(hi,di,fi),rgba:f}}e.opaque=o;function c(m,f){return jt=Math.round(f*255),[hi,di,fi]=tu.toChannels(m.rgba),{css:Qt.toCss(hi,di,fi,jt),rgba:Qt.toRgba(hi,di,fi,jt)}}e.opacity=c;function d(m,f){return jt=m.rgba&255,c(m,jt*f/255)}e.multiplyOpacity=d;function p(m){return[m.rgba>>24&255,m.rgba>>16&255,m.rgba>>8&255]}e.toColorRGB=p})(xt||={});var At;(e=>{let t,n;try{let o=document.createElement("canvas");o.width=1,o.height=1;let c=o.getContext("2d",{willReadFrequently:!0});c&&(t=c,t.globalCompositeOperation="copy",n=t.createLinearGradient(0,0,1,1))}catch{}function a(o){if(o.match(/#[\da-f]{3,8}/i))switch(o.length){case 4:return hi=parseInt(o.slice(1,2).repeat(2),16),di=parseInt(o.slice(2,3).repeat(2),16),fi=parseInt(o.slice(3,4).repeat(2),16),Qt.toColor(hi,di,fi);case 5:return hi=parseInt(o.slice(1,2).repeat(2),16),di=parseInt(o.slice(2,3).repeat(2),16),fi=parseInt(o.slice(3,4).repeat(2),16),jt=parseInt(o.slice(4,5).repeat(2),16),Qt.toColor(hi,di,fi,jt);case 7:return{css:o,rgba:(parseInt(o.slice(1),16)<<8|255)>>>0};case 9:return{css:o,rgba:parseInt(o.slice(1),16)>>>0}}let c=o.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(c)return hi=parseInt(c[1]),di=parseInt(c[2]),fi=parseInt(c[3]),jt=Math.round((c[5]===void 0?1:parseFloat(c[5]))*255),Qt.toColor(hi,di,fi,jt);if(!t||!n)throw new Error("css.toColor: Unsupported css format");if(t.fillStyle=n,t.fillStyle=o,typeof t.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(t.fillRect(0,0,1,1),[hi,di,fi,jt]=t.getImageData(0,0,1,1).data,jt!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:Qt.toRgba(hi,di,fi,jt),css:o}}e.toColor=a})(At||={});var Li;(e=>{function t(a){return n(a>>16&255,a>>8&255,a&255)}e.relativeLuminance=t;function n(a,o,c){let d=a/255,p=o/255,m=c/255,f=d<=.03928?d/12.92:Math.pow((d+.055)/1.055,2.4),S=p<=.03928?p/12.92:Math.pow((p+.055)/1.055,2.4),y=m<=.03928?m/12.92:Math.pow((m+.055)/1.055,2.4);return f*.2126+S*.7152+y*.0722}e.relativeLuminance2=n})(Li||={});var tu;(e=>{function t(d,p){if(jt=(p&255)/255,jt===1)return p;let m=p>>24&255,f=p>>16&255,S=p>>8&255,y=d>>24&255,b=d>>16&255,x=d>>8&255;return hi=y+Math.round((m-y)*jt),di=b+Math.round((f-b)*jt),fi=x+Math.round((S-x)*jt),Qt.toRgba(hi,di,fi)}e.blend=t;function n(d,p,m){let f=Li.relativeLuminance(d>>8),S=Li.relativeLuminance(p>>8);if(pn(f,S)<m){if(S<f){let x=a(d,p,m),C=pn(f,Li.relativeLuminance(x>>8));if(C<m){let k=o(d,p,m),B=pn(f,Li.relativeLuminance(k>>8));return C>B?x:k}return x}let y=o(d,p,m),b=pn(f,Li.relativeLuminance(y>>8));if(b<m){let x=a(d,p,m),C=pn(f,Li.relativeLuminance(x>>8));return b>C?y:x}return y}}e.ensureContrastRatio=n;function a(d,p,m){let f=d>>24&255,S=d>>16&255,y=d>>8&255,b=p>>24&255,x=p>>16&255,C=p>>8&255,k=pn(Li.relativeLuminance2(b,x,C),Li.relativeLuminance2(f,S,y));for(;k<m&&(b>0||x>0||C>0);)b-=Math.max(0,Math.ceil(b*.1)),x-=Math.max(0,Math.ceil(x*.1)),C-=Math.max(0,Math.ceil(C*.1)),k=pn(Li.relativeLuminance2(b,x,C),Li.relativeLuminance2(f,S,y));return(b<<24|x<<16|C<<8|255)>>>0}e.reduceLuminance=a;function o(d,p,m){let f=d>>24&255,S=d>>16&255,y=d>>8&255,b=p>>24&255,x=p>>16&255,C=p>>8&255,k=pn(Li.relativeLuminance2(b,x,C),Li.relativeLuminance2(f,S,y));for(;k<m&&(b<255||x<255||C<255);)b=Math.min(255,b+Math.ceil((255-b)*.1)),x=Math.min(255,x+Math.ceil((255-x)*.1)),C=Math.min(255,C+Math.ceil((255-C)*.1)),k=pn(Li.relativeLuminance2(b,x,C),Li.relativeLuminance2(f,S,y));return(b<<24|x<<16|C<<8|255)>>>0}e.increaseLuminance=o;function c(d){return[d>>24&255,d>>16&255,d>>8&255,d&255]}e.toChannels=c})(tu||={});function Mr(e){let t=e.toString(16);return t.length<2?"0"+t:t}function pn(e,t){return e<t?(t+.05)/(e+.05):(e+.05)/(t+.05)}var ok=class extends Co{constructor(e,t,n){super(),this.content=0,this.combinedData="",this.fg=e.fg,this.bg=e.bg,this.combinedData=t,this._width=n}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()]}},_u=class{constructor(e){this._bufferService=e,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new xs}register(e){let t={id:this._nextCharacterJoinerId++,handler:e};return this._characterJoiners.push(t),t.id}deregister(e){for(let t=0;t<this._characterJoiners.length;t++)if(this._characterJoiners[t].id===e)return this._characterJoiners.splice(t,1),!0;return!1}getJoinedCharacters(e){if(this._characterJoiners.length===0)return[];let t=this._bufferService.buffer.lines.get(e);if(!t||t.length===0)return[];let n=[],a=t.translateToString(!0),o=0,c=0,d=0,p=t.getFg(0),m=t.getBg(0);for(let f=0;f<t.getTrimmedLength();f++)if(t.loadCell(f,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==p||this._workCell.bg!==m){if(f-o>1){let S=this._getJoinedRanges(a,d,c,t,o);for(let y=0;y<S.length;y++)n.push(S[y])}o=f,d=c,p=this._workCell.fg,m=this._workCell.bg}c+=this._workCell.getChars().length||sr.length}if(this._bufferService.cols-o>1){let f=this._getJoinedRanges(a,d,c,t,o);for(let S=0;S<f.length;S++)n.push(f[S])}return n}_getJoinedRanges(e,t,n,a,o){let c=e.substring(t,n),d=[];try{d=this._characterJoiners[0].handler(c)}catch(p){console.error(p)}for(let p=1;p<this._characterJoiners.length;p++)try{let m=this._characterJoiners[p].handler(c);for(let f=0;f<m.length;f++)_u._mergeRanges(d,m[f])}catch(m){console.error(m)}return this._stringRangesToCellRanges(d,a,o),d}_stringRangesToCellRanges(e,t,n){let a=0,o=!1,c=0,d=e[a];if(d){for(let p=n;p<this._bufferService.cols;p++){let m=t.getWidth(p),f=t.getString(p).length||sr.length;if(m!==0){if(!o&&d[0]<=c&&(d[0]=p,o=!0),d[1]<=c){if(d[1]=p,d=e[++a],!d)break;d[0]<=c?(d[0]=p,o=!0):o=!1}c+=f}}d&&(d[1]=this._bufferService.cols)}}static _mergeRanges(e,t){let n=!1;for(let a=0;a<e.length;a++){let o=e[a];if(n){if(t[1]<=o[0])return e[a-1][1]=t[1],e;if(t[1]<=o[1])return e[a-1][1]=Math.max(t[1],o[1]),e.splice(a,1),e;e.splice(a,1),a--}else{if(t[1]<=o[0])return e.splice(a,0,t),e;if(t[1]<=o[1])return o[0]=Math.min(t[0],o[0]),e;t[0]<o[1]&&(o[0]=Math.min(t[0],o[0]),n=!0);continue}}return n?e[e.length-1][1]=t[1]:e.push(t),e}};_u=Ht([ye(0,Oi)],_u);function ck(e){return 57508<=e&&e<=57558}function uk(e){return 9472<=e&&e<=9631}function hk(e){return ck(e)||uk(e)}function dk(){return{css:{canvas:Fc(),cell:Fc()},device:{canvas:Fc(),cell:Fc(),char:{width:0,height:0,left:0,top:0}}}}function Fc(){return{width:0,height:0}}var _p=class{constructor(e,t,n,a,o,c,d){this._document=e,this._characterJoinerService=t,this._optionsService=n,this._coreBrowserService=a,this._coreService=o,this._decorationService=c,this._themeService=d,this._workCell=new xs,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(e,t,n){this._selectionStart=e,this._selectionEnd=t,this._columnSelectMode=n}createRow(e,t,n,a,o,c,d,p,m,f,S){let y=[],b=this._characterJoinerService.getJoinedCharacters(t),x=this._themeService.colors,C=e.getNoBgTrimmedLength();n&&C<c+1&&(C=c+1);let k,B=0,R="",re=0,F=0,J=0,ce=0,q=!1,I=0,ie=!1,de=0,j=0,$=[],H=f!==-1&&S!==-1;for(let L=0;L<C;L++){e.loadCell(L,this._workCell);let X=this._workCell.getWidth();if(X===0)continue;let Z=!1,A=L>=j,V=L,Q=this._workCell;if(b.length>0&&L===b[0][0]&&A){let Be=b.shift(),ae=this._isCellInSelection(Be[0],t);for(re=Be[0]+1;re<Be[1];re++)A&&=ae===this._isCellInSelection(re,t);A&&=!n||c<Be[0]||c>=Be[1],A?(Z=!0,Q=new ok(this._workCell,e.translateToString(!0,Be[0],Be[1]),Be[1]-Be[0]),V=Be[1]-1,X=Q.getWidth()):j=Be[1]}let ve=this._isCellInSelection(L,t),Se=n&&L===c,E=H&&L>=f&&L<=S,W=!1;this._decorationService.forEachDecorationAtCell(L,t,void 0,Be=>{W=!0});let ee=Q.getChars()||sr;if(ee===" "&&(Q.isUnderline()||Q.isOverline())&&(ee=" "),de=X*p-m.get(ee,Q.isBold(),Q.isItalic()),!k)k=this._document.createElement("span");else if(B&&(ve&&ie||!ve&&!ie&&Q.bg===F)&&(ve&&ie&&x.selectionForeground||Q.fg===J)&&Q.extended.ext===ce&&E===q&&de===I&&!Se&&!Z&&!W&&A){Q.isInvisible()?R+=sr:R+=ee,B++;continue}else B&&(k.textContent=R),k=this._document.createElement("span"),B=0,R="";if(F=Q.bg,J=Q.fg,ce=Q.extended.ext,q=E,I=de,ie=ve,Z&&c>=L&&c<=V&&(c=L),!this._coreService.isCursorHidden&&Se&&this._coreService.isCursorInitialized){if($.push("xterm-cursor"),this._coreBrowserService.isFocused)d&&$.push("xterm-cursor-blink"),$.push(a==="bar"?"xterm-cursor-bar":a==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(o)switch(o){case"outline":$.push("xterm-cursor-outline");break;case"block":$.push("xterm-cursor-block");break;case"bar":$.push("xterm-cursor-bar");break;case"underline":$.push("xterm-cursor-underline");break}}if(Q.isBold()&&$.push("xterm-bold"),Q.isItalic()&&$.push("xterm-italic"),Q.isDim()&&$.push("xterm-dim"),Q.isInvisible()?R=sr:R=Q.getChars()||sr,Q.isUnderline()&&($.push(`xterm-underline-${Q.extended.underlineStyle}`),R===" "&&(R=" "),!Q.isUnderlineColorDefault()))if(Q.isUnderlineColorRGB())k.style.textDecorationColor=`rgb(${Co.toColorRGB(Q.getUnderlineColor()).join(",")})`;else{let Be=Q.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&Q.isBold()&&Be<8&&(Be+=8),k.style.textDecorationColor=x.ansi[Be].css}Q.isOverline()&&($.push("xterm-overline"),R===" "&&(R=" ")),Q.isStrikethrough()&&$.push("xterm-strikethrough"),E&&(k.style.textDecoration="underline");let he=Q.getFgColor(),ge=Q.getFgColorMode(),me=Q.getBgColor(),Ce=Q.getBgColorMode(),ze=!!Q.isInverse();if(ze){let Be=he;he=me,me=Be;let ae=ge;ge=Ce,Ce=ae}let Ne,Re,Pe=!1;this._decorationService.forEachDecorationAtCell(L,t,void 0,Be=>{Be.options.layer!=="top"&&Pe||(Be.backgroundColorRGB&&(Ce=50331648,me=Be.backgroundColorRGB.rgba>>8&16777215,Ne=Be.backgroundColorRGB),Be.foregroundColorRGB&&(ge=50331648,he=Be.foregroundColorRGB.rgba>>8&16777215,Re=Be.foregroundColorRGB),Pe=Be.options.layer==="top")}),!Pe&&ve&&(Ne=this._coreBrowserService.isFocused?x.selectionBackgroundOpaque:x.selectionInactiveBackgroundOpaque,me=Ne.rgba>>8&16777215,Ce=50331648,Pe=!0,x.selectionForeground&&(ge=50331648,he=x.selectionForeground.rgba>>8&16777215,Re=x.selectionForeground)),Pe&&$.push("xterm-decoration-top");let Ye;switch(Ce){case 16777216:case 33554432:Ye=x.ansi[me],$.push(`xterm-bg-${me}`);break;case 50331648:Ye=Qt.toColor(me>>16,me>>8&255,me&255),this._addStyle(k,`background-color:#${vS((me>>>0).toString(16),"0",6)}`);break;default:ze?(Ye=x.foreground,$.push("xterm-bg-257")):Ye=x.background}switch(Ne||Q.isDim()&&(Ne=xt.multiplyOpacity(Ye,.5)),ge){case 16777216:case 33554432:Q.isBold()&&he<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(he+=8),this._applyMinimumContrast(k,Ye,x.ansi[he],Q,Ne,void 0)||$.push(`xterm-fg-${he}`);break;case 50331648:let Be=Qt.toColor(he>>16&255,he>>8&255,he&255);this._applyMinimumContrast(k,Ye,Be,Q,Ne,Re)||this._addStyle(k,`color:#${vS(he.toString(16),"0",6)}`);break;default:this._applyMinimumContrast(k,Ye,x.foreground,Q,Ne,Re)||ze&&$.push("xterm-fg-257")}$.length&&(k.className=$.join(" "),$.length=0),!Se&&!Z&&!W&&A?B++:k.textContent=R,de!==this.defaultSpacing&&(k.style.letterSpacing=`${de}px`),y.push(k),L=V}return k&&B&&(k.textContent=R),y}_applyMinimumContrast(e,t,n,a,o,c){if(this._optionsService.rawOptions.minimumContrastRatio===1||hk(a.getCode()))return!1;let d=this._getContrastCache(a),p;if(!o&&!c&&(p=d.getColor(t.rgba,n.rgba)),p===void 0){let m=this._optionsService.rawOptions.minimumContrastRatio/(a.isDim()?2:1);p=xt.ensureContrastRatio(o||t,c||n,m),d.setColor((o||t).rgba,(c||n).rgba,p??null)}return p?(this._addStyle(e,`color:${p.css}`),!0):!1}_getContrastCache(e){return e.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(e,t){e.setAttribute("style",`${e.getAttribute("style")||""}${t};`)}_isCellInSelection(e,t){let n=this._selectionStart,a=this._selectionEnd;return!n||!a?!1:this._columnSelectMode?n[0]<=a[0]?e>=n[0]&&t>=n[1]&&e<a[0]&&t<=a[1]:e<n[0]&&t>=n[1]&&e>=a[0]&&t<=a[1]:t>n[1]&&t<a[1]||n[1]===a[1]&&t===n[1]&&e>=n[0]&&e<a[0]||n[1]<a[1]&&t===a[1]&&e<a[0]||n[1]<a[1]&&t===n[1]&&e>=n[0]}};_p=Ht([ye(1,x0),ye(2,zi),ye(3,bn),ye(4,Pr),ye(5,xo),ye(6,Ha)],_p);function vS(e,t,n){for(;e.length<n;)e=t+e;return e}var fk=class{constructor(e,t){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 n=e.createElement("span");n.classList.add("xterm-char-measure-element");let a=e.createElement("span");a.classList.add("xterm-char-measure-element"),a.style.fontWeight="bold";let o=e.createElement("span");o.classList.add("xterm-char-measure-element"),o.style.fontStyle="italic";let c=e.createElement("span");c.classList.add("xterm-char-measure-element"),c.style.fontWeight="bold",c.style.fontStyle="italic",this._measureElements=[n,a,o,c],this._container.appendChild(n),this._container.appendChild(a),this._container.appendChild(o),this._container.appendChild(c),t.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,t,n,a){e===this._font&&t===this._fontSize&&n===this._weight&&a===this._weightBold||(this._font=e,this._fontSize=t,this._weight=n,this._weightBold=a,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${n}`,this._measureElements[1].style.fontWeight=`${a}`,this._measureElements[2].style.fontWeight=`${n}`,this._measureElements[3].style.fontWeight=`${a}`,this.clear())}get(e,t,n){let a=0;if(!t&&!n&&e.length===1&&(a=e.charCodeAt(0))<256){if(this._flat[a]!==-9999)return this._flat[a];let d=this._measure(e,0);return d>0&&(this._flat[a]=d),d}let o=e;t&&(o+="B"),n&&(o+="I");let c=this._holey.get(o);if(c===void 0){let d=0;t&&(d|=1),n&&(d|=2),c=this._measure(e,d),c>0&&this._holey.set(o,c)}return c}_measure(e,t){let n=this._measureElements[t];return n.textContent=e.repeat(32),n.offsetWidth/32}},pk=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,t,n,a=!1){if(this.selectionStart=t,this.selectionEnd=n,!t||!n||t[0]===n[0]&&t[1]===n[1]){this.clear();return}let o=e.buffers.active.ydisp,c=t[1]-o,d=n[1]-o,p=Math.max(c,0),m=Math.min(d,e.rows-1);if(p>=e.rows||m<0){this.clear();return}this.hasSelection=!0,this.columnSelectMode=a,this.viewportStartRow=c,this.viewportEndRow=d,this.viewportCappedStartRow=p,this.viewportCappedEndRow=m,this.startCol=t[0],this.endCol=n[0]}isCellSelected(e,t,n){return this.hasSelection?(n-=e.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?t>=this.startCol&&n>=this.viewportCappedStartRow&&t<this.endCol&&n<=this.viewportCappedEndRow:t<this.startCol&&n>=this.viewportCappedStartRow&&t>=this.endCol&&n<=this.viewportCappedEndRow:n>this.viewportStartRow&&n<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&n===this.viewportStartRow&&t>=this.startCol&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&n===this.viewportEndRow&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&n===this.viewportStartRow&&t>=this.startCol):!1}};function mk(){return new pk}var df="xterm-dom-renderer-owner-",ys="xterm-rows",qc="xterm-fg-",gS="xterm-bg-",Bl="xterm-focus",Wc="xterm-selection",_k=1,vp=class extends We{constructor(e,t,n,a,o,c,d,p,m,f,S,y,b,x){super(),this._terminal=e,this._document=t,this._element=n,this._screenElement=a,this._viewportElement=o,this._helperContainer=c,this._linkifier2=d,this._charSizeService=m,this._optionsService=f,this._bufferService=S,this._coreService=y,this._coreBrowserService=b,this._themeService=x,this._terminalClass=_k++,this._rowElements=[],this._selectionRenderModel=mk(),this.onRequestRedraw=this._register(new _e).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(ys),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(Wc),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=dk(),this._updateDimensions(),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._themeService.onChangeColors(C=>this._injectCss(C))),this._injectCss(this._themeService.colors),this._rowFactory=p.createInstance(_p,document),this._element.classList.add(df+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this._register(this._linkifier2.onShowLinkUnderline(C=>this._handleLinkHover(C))),this._register(this._linkifier2.onHideLinkUnderline(C=>this._handleLinkLeave(C))),this._register(Tt(()=>{this._element.classList.remove(df+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()})),this._widthCache=new fk(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 n of this._rowElements)n.style.width=`${this.dimensions.css.canvas.width}px`,n.style.height=`${this.dimensions.css.cell.height}px`,n.style.lineHeight=`${this.dimensions.css.cell.height}px`,n.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));let t=`${this._terminalSelector} .${ys} span { display: inline-block; height: 100%; vertical-align: top;}`;this._dimensionsStyleElement.textContent=t,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 t=`${this._terminalSelector} .${ys} { 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}`;t+=`${this._terminalSelector} .${ys} .xterm-dim { color: ${xt.multiplyOpacity(e.foreground,.5).css};}`,t+=`${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 n=`blink_underline_${this._terminalClass}`,a=`blink_bar_${this._terminalClass}`,o=`blink_block_${this._terminalClass}`;t+=`@keyframes ${n} { 50% { border-bottom-style: hidden; }}`,t+=`@keyframes ${a} { 50% { box-shadow: none; }}`,t+=`@keyframes ${o} { 0% { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css}; } 50% { background-color: inherit; color: ${e.cursor.css}; }}`,t+=`${this._terminalSelector} .${ys}.${Bl} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${n} 1s step-end infinite;}${this._terminalSelector} .${ys}.${Bl} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${a} 1s step-end infinite;}${this._terminalSelector} .${ys}.${Bl} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${o} 1s step-end infinite;}${this._terminalSelector} .${ys} .xterm-cursor.xterm-cursor-block { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css};}${this._terminalSelector} .${ys} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${e.cursor.css} !important; color: ${e.cursorAccent.css} !important;}${this._terminalSelector} .${ys} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${e.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${ys} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${e.cursor.css} inset;}${this._terminalSelector} .${ys} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${e.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,t+=`${this._terminalSelector} .${Wc} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${Wc} div { position: absolute; background-color: ${e.selectionBackgroundOpaque.css};}${this._terminalSelector} .${Wc} div { position: absolute; background-color: ${e.selectionInactiveBackgroundOpaque.css};}`;for(let[c,d]of e.ansi.entries())t+=`${this._terminalSelector} .${qc}${c} { color: ${d.css}; }${this._terminalSelector} .${qc}${c}.xterm-dim { color: ${xt.multiplyOpacity(d,.5).css}; }${this._terminalSelector} .${gS}${c} { background-color: ${d.css}; }`;t+=`${this._terminalSelector} .${qc}257 { color: ${xt.opaque(e.background).css}; }${this._terminalSelector} .${qc}257.xterm-dim { color: ${xt.multiplyOpacity(xt.opaque(e.background),.5).css}; }${this._terminalSelector} .${gS}257 { background-color: ${e.foreground.css}; }`,this._themeStyleElement.textContent=t}_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,t){for(let n=this._rowElements.length;n<=t;n++){let a=this._document.createElement("div");this._rowContainer.appendChild(a),this._rowElements.push(a)}for(;this._rowElements.length>t;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(e,t){this._refreshRowElements(e,t),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(Bl),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(Bl),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(e,t,n){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(e,t,n),this.renderRows(0,this._bufferService.rows-1),!e||!t||(this._selectionRenderModel.update(this._terminal,e,t,n),!this._selectionRenderModel.hasSelection))return;let a=this._selectionRenderModel.viewportStartRow,o=this._selectionRenderModel.viewportEndRow,c=this._selectionRenderModel.viewportCappedStartRow,d=this._selectionRenderModel.viewportCappedEndRow,p=this._document.createDocumentFragment();if(n){let m=e[0]>t[0];p.appendChild(this._createSelectionElement(c,m?t[0]:e[0],m?e[0]:t[0],d-c+1))}else{let m=a===c?e[0]:0,f=c===o?t[0]:this._bufferService.cols;p.appendChild(this._createSelectionElement(c,m,f));let S=d-c-1;if(p.appendChild(this._createSelectionElement(c+1,0,this._bufferService.cols,S)),c!==d){let y=o===d?t[0]:this._bufferService.cols;p.appendChild(this._createSelectionElement(d,0,y))}}this._selectionContainer.appendChild(p)}_createSelectionElement(e,t,n,a=1){let o=this._document.createElement("div"),c=t*this.dimensions.css.cell.width,d=this.dimensions.css.cell.width*(n-t);return c+d>this.dimensions.css.canvas.width&&(d=this.dimensions.css.canvas.width-c),o.style.height=`${a*this.dimensions.css.cell.height}px`,o.style.top=`${e*this.dimensions.css.cell.height}px`,o.style.left=`${c}px`,o.style.width=`${d}px`,o}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,t){let n=this._bufferService.buffer,a=n.ybase+n.y,o=Math.min(n.x,this._bufferService.cols-1),c=this._coreService.decPrivateModes.cursorBlink??this._optionsService.rawOptions.cursorBlink,d=this._coreService.decPrivateModes.cursorStyle??this._optionsService.rawOptions.cursorStyle,p=this._optionsService.rawOptions.cursorInactiveStyle;for(let m=e;m<=t;m++){let f=m+n.ydisp,S=this._rowElements[m],y=n.lines.get(f);if(!S||!y)break;S.replaceChildren(...this._rowFactory.createRow(y,f,f===a,d,p,o,c,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${df}${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,t,n,a,o,c){n<0&&(e=0),a<0&&(t=0);let d=this._bufferService.rows-1;n=Math.max(Math.min(n,d),0),a=Math.max(Math.min(a,d),0),o=Math.min(o,this._bufferService.cols);let p=this._bufferService.buffer,m=p.ybase+p.y,f=Math.min(p.x,o-1),S=this._optionsService.rawOptions.cursorBlink,y=this._optionsService.rawOptions.cursorStyle,b=this._optionsService.rawOptions.cursorInactiveStyle;for(let x=n;x<=a;++x){let C=x+p.ydisp,k=this._rowElements[x],B=p.lines.get(C);if(!k||!B)break;k.replaceChildren(...this._rowFactory.createRow(B,C,C===m,y,b,f,S,this.dimensions.css.cell.width,this._widthCache,c?x===n?e:0:-1,c?(x===a?t:o)-1:-1))}}};vp=Ht([ye(7,gm),ye(8,Nu),ye(9,zi),ye(10,Oi),ye(11,Pr),ye(12,bn),ye(13,Ha)],vp);var gp=class extends We{constructor(e,t,n){super(),this._optionsService=n,this.width=0,this.height=0,this._onCharSizeChange=this._register(new _e),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this._register(new gk(this._optionsService))}catch{this._measureStrategy=this._register(new vk(e,t,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())}};gp=Ht([ye(2,zi)],gp);var F0=class extends We{constructor(){super(...arguments),this._result={width:0,height:0}}_validateAndSet(e,t){e!==void 0&&e>0&&t!==void 0&&t>0&&(this._result.width=e,this._result.height=t)}},vk=class extends F0{constructor(e,t,n){super(),this._document=e,this._parentElement=t,this._optionsService=n,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}},gk=class extends F0{constructor(e){super(),this._optionsService=e,this._canvas=new OffscreenCanvas(100,100),this._ctx=this._canvas.getContext("2d");let t=this._ctx.measureText("W");if(!("width"in t&&"fontBoundingBoxAscent"in t&&"fontBoundingBoxDescent"in t))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}},yk=class extends We{constructor(e,t,n){super(),this._textarea=e,this._window=t,this.mainDocument=n,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=this._register(new Sk(this._window)),this._onDprChange=this._register(new _e),this.onDprChange=this._onDprChange.event,this._onWindowChange=this._register(new _e),this.onWindowChange=this._onWindowChange.event,this._register(this.onWindowChange(a=>this._screenDprMonitor.setWindow(a))),this._register(Ei.forward(this._screenDprMonitor.onDprChange,this._onDprChange)),this._register(Le(this._textarea,"focus",()=>this._isFocused=!0)),this._register(Le(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}},Sk=class extends We{constructor(e){super(),this._parentWindow=e,this._windowResizeListener=this._register(new La),this._onDprChange=this._register(new _e),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this._register(Tt(()=>this.clearListener()))}setWindow(e){this._parentWindow=e,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=Le(this._parentWindow,"resize",()=>this._setDprAndFireIfDiffers())}_setDprAndFireIfDiffers(){this._parentWindow.devicePixelRatio!==this._currentDevicePixelRatio&&this._onDprChange.fire(this._parentWindow.devicePixelRatio),this._updateDpr()}_updateDpr(){this._outerListener&&(this._resolutionMediaMatchList?.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)}},bk=class extends We{constructor(){super(),this.linkProviders=[],this._register(Tt(()=>this.linkProviders.length=0))}registerLinkProvider(e){return this.linkProviders.push(e),{dispose:()=>{let t=this.linkProviders.indexOf(e);t!==-1&&this.linkProviders.splice(t,1)}}}};function Tm(e,t,n){let a=n.getBoundingClientRect(),o=e.getComputedStyle(n),c=parseInt(o.getPropertyValue("padding-left")),d=parseInt(o.getPropertyValue("padding-top"));return[t.clientX-a.left-c,t.clientY-a.top-d]}function wk(e,t,n,a,o,c,d,p,m){if(!c)return;let f=Tm(e,t,n);if(f)return f[0]=Math.ceil((f[0]+(m?d/2:0))/d),f[1]=Math.ceil(f[1]/p),f[0]=Math.min(Math.max(f[0],1),a+(m?1:0)),f[1]=Math.min(Math.max(f[1],1),o),f}var yp=class{constructor(e,t){this._renderService=e,this._charSizeService=t}getCoords(e,t,n,a,o){return wk(window,e,t,n,a,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,o)}getMouseReportCoords(e,t){let n=Tm(window,e,t);if(this._charSizeService.hasValidSize)return n[0]=Math.min(Math.max(n[0],0),this._renderService.dimensions.css.canvas.width-1),n[1]=Math.min(Math.max(n[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(n[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(n[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(n[0]),y:Math.floor(n[1])}}};yp=Ht([ye(0,wn),ye(1,Nu)],yp);var Ck=class{constructor(e,t){this._renderCallback=e,this._coreBrowserService=t,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,t,n){this._rowCount=n,e=e!==void 0?e:0,t=t!==void 0?t: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,t):t,!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),t=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(e,t),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(let e of this._refreshCallbacks)e(0);this._refreshCallbacks=[]}},q0={};B2(q0,{getSafariVersion:()=>Ek,isChromeOS:()=>V0,isFirefox:()=>W0,isIpad:()=>Tk,isIphone:()=>kk,isLegacyEdge:()=>xk,isLinux:()=>km,isMac:()=>vu,isNode:()=>Bu,isSafari:()=>Y0,isWindows:()=>$0});var Bu=typeof process<"u"&&"title"in process,Eo=Bu?"node":navigator.userAgent,To=Bu?"node":navigator.platform,W0=Eo.includes("Firefox"),xk=Eo.includes("Edge"),Y0=/^((?!chrome|android).)*safari/i.test(Eo);function Ek(){if(!Y0)return 0;let e=Eo.match(/Version\/(\d+)/);return e===null||e.length<2?0:parseInt(e[1])}var vu=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(To),Tk=To==="iPad",kk=To==="iPhone",$0=["Windows","Win16","Win32","WinCE"].includes(To),km=To.indexOf("Linux")>=0,V0=/\bCrOS\b/.test(Eo),X0=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 t=0,n=0,a=e.timeRemaining(),o=0;for(;this._i<this._tasks.length;){if(t=performance.now(),this._tasks[this._i]()||this._i++,t=Math.max(1,performance.now()-t),n=Math.max(t,n),o=e.timeRemaining(),n*1.5>o){a-t<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(a-t))}ms`),this._start();return}a=o}this.clear()}},Dk=class extends X0{_requestCallback(e){return setTimeout(()=>e(this._createDeadline(16)))}_cancelCallback(e){clearTimeout(e)}_createDeadline(e){let t=performance.now()+e;return{timeRemaining:()=>Math.max(0,t-performance.now())}}},Rk=class extends X0{_requestCallback(e){return requestIdleCallback(e)}_cancelCallback(e){cancelIdleCallback(e)}},gu=!Bu&&"requestIdleCallback"in window?Rk:Dk,Mk=class{constructor(){this._queue=new gu}set(e){this._queue.clear(),this._queue.enqueue(e)}flush(){this._queue.flush()}},Sp=class extends We{constructor(e,t,n,a,o,c,d,p,m){super(),this._rowCount=e,this._optionsService=n,this._charSizeService=a,this._coreService=o,this._coreBrowserService=p,this._renderer=this._register(new La),this._pausedResizeTask=new Mk,this._observerDisposable=this._register(new La),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 _e),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this._register(new _e),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this._register(new _e),this.onRender=this._onRender.event,this._onRefreshRequest=this._register(new _e),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new Ck((f,S)=>this._renderRows(f,S),this._coreBrowserService),this._register(this._renderDebouncer),this._syncOutputHandler=new Ak(this._coreBrowserService,this._coreService,()=>this._fullRefresh()),this._register(Tt(()=>this._syncOutputHandler.dispose())),this._register(this._coreBrowserService.onDprChange(()=>this.handleDevicePixelRatioChange())),this._register(d.onResize(()=>this._fullRefresh())),this._register(d.buffers.onBufferActivate(()=>this._renderer.value?.clear())),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._charSizeService.onCharSizeChange(()=>this.handleCharSizeChanged())),this._register(c.onDecorationRegistered(()=>this._fullRefresh())),this._register(c.onDecorationRemoved(()=>this._fullRefresh())),this._register(this._optionsService.onMultipleOptionChange(["customGlyphs","drawBoldTextInBrightColors","letterSpacing","lineHeight","fontFamily","fontSize","fontWeight","fontWeightBold","minimumContrastRatio","rescaleOverlappingGlyphs"],()=>{this.clear(),this.handleResize(d.cols,d.rows),this._fullRefresh()})),this._register(this._optionsService.onMultipleOptionChange(["cursorBlink","cursorStyle"],()=>this.refreshRows(d.buffer.y,d.buffer.y,!0))),this._register(m.onChangeColors(()=>this._fullRefresh())),this._registerIntersectionObserver(this._coreBrowserService.window,t),this._register(this._coreBrowserService.onWindowChange(f=>this._registerIntersectionObserver(f,t)))}get dimensions(){return this._renderer.value.dimensions}_registerIntersectionObserver(e,t){if("IntersectionObserver"in e){let n=new e.IntersectionObserver(a=>this._handleIntersectionChange(a[a.length-1]),{threshold:0});n.observe(t),this._observerDisposable.value=Tt(()=>n.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,t,n=!1){if(this._isPaused){this._needsFullRefresh=!0;return}if(this._coreService.decPrivateModes.synchronizedOutput){this._syncOutputHandler.bufferRows(e,t);return}let a=this._syncOutputHandler.flush();a&&(e=Math.min(e,a.start),t=Math.max(t,a.end)),n||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(e,t,this._rowCount)}_renderRows(e,t){if(this._renderer.value){if(this._coreService.decPrivateModes.synchronizedOutput){this._syncOutputHandler.bufferRows(e,t);return}e=Math.min(e,this._rowCount-1),t=Math.min(t,this._rowCount-1),this._renderer.value.renderRows(e,t),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:t}),this._onRender.fire({start:e,end:t}),this._isNextRenderRedrawOnly=!0}}resize(e,t){this._rowCount=t,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(t=>this.refreshRows(t.start,t.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(){this._renderer.value&&(this._renderer.value.clearTextureAtlas?.(),this._fullRefresh())}handleDevicePixelRatioChange(){this._charSizeService.measure(),this._renderer.value&&(this._renderer.value.handleDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1))}handleResize(e,t){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set(()=>this._renderer.value?.handleResize(e,t)):this._renderer.value.handleResize(e,t),this._fullRefresh())}handleCharSizeChanged(){this._renderer.value?.handleCharSizeChanged()}handleBlur(){this._renderer.value?.handleBlur()}handleFocus(){this._renderer.value?.handleFocus()}handleSelectionChanged(e,t,n){this._selectionState.start=e,this._selectionState.end=t,this._selectionState.columnSelectMode=n,this._renderer.value?.handleSelectionChanged(e,t,n)}handleCursorMove(){this._renderer.value?.handleCursorMove()}clear(){this._renderer.value?.clear()}};Sp=Ht([ye(2,zi),ye(3,Nu),ye(4,Pr),ye(5,xo),ye(6,Oi),ye(7,bn),ye(8,Ha)],Sp);var Ak=class{constructor(e,t,n){this._coreBrowserService=e,this._coreService=t,this._onTimeout=n,this._start=0,this._end=0,this._isBuffering=!1}bufferRows(e,t){this._isBuffering?(this._start=Math.min(this._start,e),this._end=Math.max(this._end,t)):(this._start=e,this._end=t,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 Nk(e,t,n,a){let o=n.buffer.x,c=n.buffer.y;if(!n.buffer.hasScrollback)return Ok(o,c,e,t,n,a)+Lu(c,t,n,a)+zk(o,c,e,t,n,a);let d;if(c===t)return d=o>e?"D":"C",oo(Math.abs(o-e),lo(d,a));d=c>t?"D":"C";let p=Math.abs(c-t),m=Lk(c>t?e:o,n)+(p-1)*n.cols+1+Bk(c>t?o:e);return oo(m,lo(d,a))}function Bk(e,t){return e-1}function Lk(e,t){return t.cols-e}function Ok(e,t,n,a,o,c){return Lu(t,a,o,c).length===0?"":oo(Z0(e,t,e,t-Ur(t,o),!1,o).length,lo("D",c))}function Lu(e,t,n,a){let o=e-Ur(e,n),c=t-Ur(t,n),d=Math.abs(o-c)-jk(e,t,n);return oo(d,lo(G0(e,t),a))}function zk(e,t,n,a,o,c){let d;Lu(t,a,o,c).length>0?d=a-Ur(a,o):d=t;let p=a,m=Hk(e,t,n,a,o,c);return oo(Z0(e,d,n,p,m==="C",o).length,lo(m,c))}function jk(e,t,n){let a=0,o=e-Ur(e,n),c=t-Ur(t,n);for(let d=0;d<Math.abs(o-c);d++){let p=G0(e,t)==="A"?-1:1;n.buffer.lines.get(o+p*d)?.isWrapped&&a++}return a}function Ur(e,t){let n=0,a=t.buffer.lines.get(e),o=a?.isWrapped;for(;o&&e>=0&&e<t.rows;)n++,a=t.buffer.lines.get(--e),o=a?.isWrapped;return n}function Hk(e,t,n,a,o,c){let d;return Lu(n,a,o,c).length>0?d=a-Ur(a,o):d=t,e<n&&d<=a||e>=n&&d<a?"C":"D"}function G0(e,t){return e>t?"A":"B"}function Z0(e,t,n,a,o,c){let d=e,p=t,m="";for(;(d!==n||p!==a)&&p>=0&&p<c.buffer.lines.length;)d+=o?1:-1,o&&d>c.cols-1?(m+=c.buffer.translateBufferLineToString(p,!1,e,d),d=0,e=0,p++):!o&&d<0&&(m+=c.buffer.translateBufferLineToString(p,!1,0,e+1),d=c.cols-1,e=d,p--);return m+c.buffer.translateBufferLineToString(p,!1,e,d)}function lo(e,t){let n=t?"O":"[";return oe.ESC+n+e}function oo(e,t){e=Math.floor(e);let n="";for(let a=0;a<e;a++)n+=t;return n}var Uk=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,t=this.selectionEnd;return!e||!t?!1:e[1]>t[1]||e[1]===t[1]&&e[0]>t[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 yS(e,t){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 t*(e.end.y-e.start.y)+(e.end.x-e.start.x+1)}var ff=50,Pk=15,Kk=50,Ik=500,Fk=" ",qk=new RegExp(Fk,"g"),bp=class extends We{constructor(e,t,n,a,o,c,d,p,m){super(),this._element=e,this._screenElement=t,this._linkifier=n,this._bufferService=a,this._coreService=o,this._mouseService=c,this._optionsService=d,this._renderService=p,this._coreBrowserService=m,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new xs,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this._register(new _e),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this._register(new _e),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this._register(new _e),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this._register(new _e),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=f=>this._handleMouseMove(f),this._mouseUpListener=f=>this._handleMouseUp(f),this._coreService.onUserInput(()=>{this.hasSelection&&this.clearSelection()}),this._trimListener=this._bufferService.buffer.lines.onTrim(f=>this._handleTrim(f)),this._register(this._bufferService.buffers.onBufferActivate(f=>this._handleBufferActivate(f))),this.enable(),this._model=new Uk(this._bufferService),this._activeSelectionMode=0,this._register(Tt(()=>{this._removeMouseDownListeners()})),this._register(this._bufferService.onResize(f=>{f.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,t=this._model.finalSelectionEnd;return!e||!t?!1:e[0]!==t[0]||e[1]!==t[1]}get selectionText(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd;if(!e||!t)return"";let n=this._bufferService.buffer,a=[];if(this._activeSelectionMode===3){if(e[0]===t[0])return"";let o=e[0]<t[0]?e[0]:t[0],c=e[0]<t[0]?t[0]:e[0];for(let d=e[1];d<=t[1];d++){let p=n.translateBufferLineToString(d,!0,o,c);a.push(p)}}else{let o=e[1]===t[1]?t[0]:void 0;a.push(n.translateBufferLineToString(e[1],!0,e[0],o));for(let c=e[1]+1;c<=t[1]-1;c++){let d=n.lines.get(c),p=n.translateBufferLineToString(c,!0);d?.isWrapped?a[a.length-1]+=p:a.push(p)}if(e[1]!==t[1]){let c=n.lines.get(t[1]),d=n.translateBufferLineToString(t[1],!0,0,t[0]);c&&c.isWrapped?a[a.length-1]+=d:a.push(d)}}return a.map(o=>o.replace(qk," ")).join($0?`\r
25
25
  `:`
26
26
  `)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(e){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._refresh())),km&&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 t=this._getMouseBufferCoords(e),n=this._model.finalSelectionStart,a=this._model.finalSelectionEnd;return!n||!a||!t?!1:this._areCoordsInSelection(t,n,a)}isCellInSelection(e,t){let n=this._model.finalSelectionStart,a=this._model.finalSelectionEnd;return!n||!a?!1:this._areCoordsInSelection([e,t],n,a)}_areCoordsInSelection(e,t,n){return e[1]>t[1]&&e[1]<n[1]||t[1]===n[1]&&e[1]===t[1]&&e[0]>=t[0]&&e[0]<n[0]||t[1]<n[1]&&e[1]===n[1]&&e[0]<n[0]||t[1]<n[1]&&e[1]===t[1]&&e[0]>=t[0]}_selectWordAtCursor(e,t){let n=this._linkifier.currentLink?.link?.range;if(n)return this._model.selectionStart=[n.start.x-1,n.start.y-1],this._model.selectionStartLength=yS(n,this._bufferService.cols),this._model.selectionEnd=void 0,!0;let a=this._getMouseBufferCoords(e);return a?(this._selectWordAt(a,t),this._model.selectionEnd=void 0,!0):!1}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(e,t){this._model.clearSelection(),e=Math.max(e,0),t=Math.min(t,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,e],this._model.selectionEnd=[this._bufferService.cols,t],this.refresh(),this._onSelectionChange.fire()}_handleTrim(e){this._model.handleTrim(e)&&this.refresh()}_getMouseBufferCoords(e){let t=this._mouseService.getCoords(e,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(t)return t[0]--,t[1]--,t[1]+=this._bufferService.buffer.ydisp,t}_getMouseEventScrollAmount(e){let t=Tm(this._coreBrowserService.window,e,this._screenElement)[1],n=this._renderService.dimensions.css.canvas.height;return t>=0&&t<=n?0:(t>n&&(t-=n),t=Math.min(Math.max(t,-ff),ff),t/=ff,t/Math.abs(t)+Math.round(t*(Pk-1)))}shouldForceSelection(e){return vu?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(),Kk)}_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 t=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);t&&t.length!==this._model.selectionStart[0]&&t.hasWidth(this._model.selectionStart[0])===0&&this._model.selectionStart[0]++}_handleDoubleClick(e){this._selectWordAtCursor(e,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(e){let t=this._getMouseBufferCoords(e);t&&(this._activeSelectionMode=2,this._selectLineAt(t[1]))}shouldColumnSelect(e){return e.altKey&&!(vu&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(e){if(e.stopImmediatePropagation(),!this._model.selectionStart)return;let t=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 n=this._bufferService.buffer;if(this._model.selectionEnd[1]<n.lines.length){let a=n.lines.get(this._model.selectionEnd[1]);a&&a.hasWidth(this._model.selectionEnd[0])===0&&this._model.selectionEnd[0]<this._bufferService.cols&&this._model.selectionEnd[0]++}(!t||t[0]!==this._model.selectionEnd[0]||t[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 t=e.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&t<Ik&&e.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){let n=this._mouseService.getCoords(e,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(n&&n[0]!==void 0&&n[1]!==void 0){let a=Nk(n[0]-1,n[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(a,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd,n=!!e&&!!t&&(e[0]!==t[0]||e[1]!==t[1]);if(!n){this._oldHasSelection&&this._fireOnSelectionChange(e,t,n);return}!e||!t||(!this._oldSelectionStart||!this._oldSelectionEnd||e[0]!==this._oldSelectionStart[0]||e[1]!==this._oldSelectionStart[1]||t[0]!==this._oldSelectionEnd[0]||t[1]!==this._oldSelectionEnd[1])&&this._fireOnSelectionChange(e,t,n)}_fireOnSelectionChange(e,t,n){this._oldSelectionStart=e,this._oldSelectionEnd=t,this._oldHasSelection=n,this._onSelectionChange.fire()}_handleBufferActivate(e){this.clearSelection(),this._trimListener.dispose(),this._trimListener=e.activeBuffer.lines.onTrim(t=>this._handleTrim(t))}_convertViewportColToCharacterIndex(e,t){let n=t;for(let a=0;t>=a;a++){let o=e.loadCell(a,this._workCell).getChars().length;this._workCell.getWidth()===0?n--:o>1&&t!==a&&(n+=o-1)}return n}setSelection(e,t,n){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[e,t],this._model.selectionStartLength=n,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(e){this._isClickInSelection(e)||(this._selectWordAtCursor(e,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(e,t,n=!0,a=!0){if(e[0]>=this._bufferService.cols)return;let o=this._bufferService.buffer,c=o.lines.get(e[1]);if(!c)return;let d=o.translateBufferLineToString(e[1],!1),p=this._convertViewportColToCharacterIndex(c,e[0]),m=p,f=e[0]-p,S=0,y=0,b=0,x=0;if(d.charAt(p)===" "){for(;p>0&&d.charAt(p-1)===" ";)p--;for(;m<d.length&&d.charAt(m+1)===" ";)m++}else{let B=e[0],R=e[0];c.getWidth(B)===0&&(S++,B--),c.getWidth(R)===2&&(y++,R++);let re=c.getString(R).length;for(re>1&&(x+=re-1,m+=re-1);B>0&&p>0&&!this._isCharWordSeparator(c.loadCell(B-1,this._workCell));){c.loadCell(B-1,this._workCell);let F=this._workCell.getChars().length;this._workCell.getWidth()===0?(S++,B--):F>1&&(b+=F-1,p-=F-1),p--,B--}for(;R<c.length&&m+1<d.length&&!this._isCharWordSeparator(c.loadCell(R+1,this._workCell));){c.loadCell(R+1,this._workCell);let F=this._workCell.getChars().length;this._workCell.getWidth()===2?(y++,R++):F>1&&(x+=F-1,m+=F-1),m++,R++}}m++;let C=p+f-S+b,k=Math.min(this._bufferService.cols,m-p+S+y-b-x);if(!(!t&&d.slice(p,m).trim()==="")){if(n&&C===0&&c.getCodePoint(0)!==32){let B=o.lines.get(e[1]-1);if(B&&c.isWrapped&&B.getCodePoint(this._bufferService.cols-1)!==32){let R=this._getWordAt([this._bufferService.cols-1,e[1]-1],!1,!0,!1);if(R){let re=this._bufferService.cols-R.start;C-=re,k+=re}}}if(a&&C+k===this._bufferService.cols&&c.getCodePoint(this._bufferService.cols-1)!==32){let B=o.lines.get(e[1]+1);if(B?.isWrapped&&B.getCodePoint(0)!==32){let R=this._getWordAt([0,e[1]+1],!1,!1,!0);R&&(k+=R.length)}}return{start:C,length:k}}}_selectWordAt(e,t){let n=this._getWordAt(e,t);if(n){for(;n.start<0;)n.start+=this._bufferService.cols,e[1]--;this._model.selectionStart=[n.start,e[1]],this._model.selectionStartLength=n.length}}_selectToWordAt(e){let t=this._getWordAt(e,!0);if(t){let n=e[1];for(;t.start<0;)t.start+=this._bufferService.cols,n--;if(!this._model.areSelectionValuesReversed())for(;t.start+t.length>this._bufferService.cols;)t.length-=this._bufferService.cols,n++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?t.start:t.start+t.length,n]}}_isCharWordSeparator(e){return e.getWidth()===0?!1:this._optionsService.rawOptions.wordSeparator.indexOf(e.getChars())>=0}_selectLineAt(e){let t=this._bufferService.buffer.getWrappedRangeForLine(e),n={start:{x:0,y:t.first},end:{x:this._bufferService.cols-1,y:t.last}};this._model.selectionStart=[0,t.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=yS(n,this._bufferService.cols)}};bp=Ht([ye(3,Oi),ye(4,Pr),ye(5,ym),ye(6,zi),ye(7,wn),ye(8,bn)],bp);var SS=class{constructor(){this._data={}}set(e,t,n){this._data[e]||(this._data[e]={}),this._data[e][t]=n}get(e,t){return this._data[e]?this._data[e][t]:void 0}clear(){this._data={}}},bS=class{constructor(){this._color=new SS,this._css=new SS}setCss(e,t,n){this._css.set(e,t,n)}getCss(e,t){return this._css.get(e,t)}setColor(e,t,n){this._color.set(e,t,n)}getColor(e,t){return this._color.get(e,t)}clear(){this._color.clear(),this._css.clear()}},ii=Object.freeze((()=>{let e=[At.toColor("#2e3436"),At.toColor("#cc0000"),At.toColor("#4e9a06"),At.toColor("#c4a000"),At.toColor("#3465a4"),At.toColor("#75507b"),At.toColor("#06989a"),At.toColor("#d3d7cf"),At.toColor("#555753"),At.toColor("#ef2929"),At.toColor("#8ae234"),At.toColor("#fce94f"),At.toColor("#729fcf"),At.toColor("#ad7fa8"),At.toColor("#34e2e2"),At.toColor("#eeeeec")],t=[0,95,135,175,215,255];for(let n=0;n<216;n++){let a=t[n/36%6|0],o=t[n/6%6|0],c=t[n%6];e.push({css:Qt.toCss(a,o,c),rgba:Qt.toRgba(a,o,c)})}for(let n=0;n<24;n++){let a=8+n*10;e.push({css:Qt.toCss(a,a,a),rgba:Qt.toRgba(a,a,a)})}return e})()),Ar=At.toColor("#ffffff"),ql=At.toColor("#000000"),wS=At.toColor("#ffffff"),CS=ql,Ll={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117},Wk=Ar,wp=class extends We{constructor(e){super(),this._optionsService=e,this._contrastCache=new bS,this._halfContrastCache=new bS,this._onChangeColors=this._register(new _e),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:Ar,background:ql,cursor:wS,cursorAccent:CS,selectionForeground:void 0,selectionBackgroundTransparent:Ll,selectionBackgroundOpaque:xt.blend(ql,Ll),selectionInactiveBackgroundTransparent:Ll,selectionInactiveBackgroundOpaque:xt.blend(ql,Ll),scrollbarSliderBackground:xt.opacity(Ar,.2),scrollbarSliderHoverBackground:xt.opacity(Ar,.4),scrollbarSliderActiveBackground:xt.opacity(Ar,.5),overviewRulerBorder:Ar,ansi:ii.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 t=this._colors;if(t.foreground=pt(e.foreground,Ar),t.background=pt(e.background,ql),t.cursor=xt.blend(t.background,pt(e.cursor,wS)),t.cursorAccent=xt.blend(t.background,pt(e.cursorAccent,CS)),t.selectionBackgroundTransparent=pt(e.selectionBackground,Ll),t.selectionBackgroundOpaque=xt.blend(t.background,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundTransparent=pt(e.selectionInactiveBackground,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundOpaque=xt.blend(t.background,t.selectionInactiveBackgroundTransparent),t.selectionForeground=e.selectionForeground?pt(e.selectionForeground,_S):void 0,t.selectionForeground===_S&&(t.selectionForeground=void 0),xt.isOpaque(t.selectionBackgroundTransparent)&&(t.selectionBackgroundTransparent=xt.opacity(t.selectionBackgroundTransparent,.3)),xt.isOpaque(t.selectionInactiveBackgroundTransparent)&&(t.selectionInactiveBackgroundTransparent=xt.opacity(t.selectionInactiveBackgroundTransparent,.3)),t.scrollbarSliderBackground=pt(e.scrollbarSliderBackground,xt.opacity(t.foreground,.2)),t.scrollbarSliderHoverBackground=pt(e.scrollbarSliderHoverBackground,xt.opacity(t.foreground,.4)),t.scrollbarSliderActiveBackground=pt(e.scrollbarSliderActiveBackground,xt.opacity(t.foreground,.5)),t.overviewRulerBorder=pt(e.overviewRulerBorder,Wk),t.ansi=ii.slice(),t.ansi[0]=pt(e.black,ii[0]),t.ansi[1]=pt(e.red,ii[1]),t.ansi[2]=pt(e.green,ii[2]),t.ansi[3]=pt(e.yellow,ii[3]),t.ansi[4]=pt(e.blue,ii[4]),t.ansi[5]=pt(e.magenta,ii[5]),t.ansi[6]=pt(e.cyan,ii[6]),t.ansi[7]=pt(e.white,ii[7]),t.ansi[8]=pt(e.brightBlack,ii[8]),t.ansi[9]=pt(e.brightRed,ii[9]),t.ansi[10]=pt(e.brightGreen,ii[10]),t.ansi[11]=pt(e.brightYellow,ii[11]),t.ansi[12]=pt(e.brightBlue,ii[12]),t.ansi[13]=pt(e.brightMagenta,ii[13]),t.ansi[14]=pt(e.brightCyan,ii[14]),t.ansi[15]=pt(e.brightWhite,ii[15]),e.extendedAnsi){let n=Math.min(t.ansi.length-16,e.extendedAnsi.length);for(let a=0;a<n;a++)t.ansi[a+16]=pt(e.extendedAnsi[a],ii[a+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 t=0;t<this._restoreColors.ansi.length;++t)this._colors.ansi[t]=this._restoreColors.ansi[t];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()}}};wp=Ht([ye(0,zi)],wp);function pt(e,t){if(e!==void 0)try{return At.toColor(e)}catch{}return t}var Yk=class{constructor(...e){this._entries=new Map;for(let[t,n]of e)this.set(t,n)}set(e,t){let n=this._entries.get(e);return this._entries.set(e,t),n}forEach(e){for(let[t,n]of this._entries.entries())e(t,n)}has(e){return this._entries.has(e)}get(e){return this._entries.get(e)}},$k=class{constructor(){this._services=new Yk,this._services.set(gm,this)}setService(e,t){this._services.set(e,t)}getService(e){return this._services.get(e)}createInstance(e,...t){let n=P2(e).sort((c,d)=>c.index-d.index),a=[];for(let c of n){let d=this._services.get(c.id);if(!d)throw new Error(`[createInstance] ${e.name} depends on UNKNOWN service ${c.id._id}.`);a.push(d)}let o=n.length>0?n[0].index:t.length;if(t.length!==o)throw new Error(`[createInstance] First service dependency of ${e.name} at position ${o+1} conflicts with ${t.length} static arguments`);return new e(...t,...a)}},Vk={trace:0,debug:1,info:2,warn:3,error:4,off:5},Xk="xterm.js: ",Cp=class extends We{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=Vk[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(e){for(let t=0;t<e.length;t++)typeof e[t]=="function"&&(e[t]=e[t]())}_log(e,t,n){this._evalLazyOptionalParams(n),e.call(console,(this._optionsService.options.logger?"":Xk)+t,...n)}trace(e,...t){this._logLevel<=0&&this._log(this._optionsService.options.logger?.trace.bind(this._optionsService.options.logger)??console.log,e,t)}debug(e,...t){this._logLevel<=1&&this._log(this._optionsService.options.logger?.debug.bind(this._optionsService.options.logger)??console.log,e,t)}info(e,...t){this._logLevel<=2&&this._log(this._optionsService.options.logger?.info.bind(this._optionsService.options.logger)??console.info,e,t)}warn(e,...t){this._logLevel<=3&&this._log(this._optionsService.options.logger?.warn.bind(this._optionsService.options.logger)??console.warn,e,t)}error(e,...t){this._logLevel<=4&&this._log(this._optionsService.options.logger?.error.bind(this._optionsService.options.logger)??console.error,e,t)}};Cp=Ht([ye(0,zi)],Cp);var xS=class extends We{constructor(e){super(),this._maxLength=e,this.onDeleteEmitter=this._register(new _e),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this._register(new _e),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this._register(new _e),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 t=new Array(e);for(let n=0;n<Math.min(e,this.length);n++)t[n]=this._array[this._getCyclicIndex(n)];this._array=t,this._maxLength=e,this._startIndex=0}get length(){return this._length}set length(e){if(e>this._length)for(let t=this._length;t<e;t++)this._array[t]=void 0;this._length=e}get(e){return this._array[this._getCyclicIndex(e)]}set(e,t){this._array[this._getCyclicIndex(e)]=t}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,t,...n){if(t){for(let a=e;a<this._length-t;a++)this._array[this._getCyclicIndex(a)]=this._array[this._getCyclicIndex(a+t)];this._length-=t,this.onDeleteEmitter.fire({index:e,amount:t})}for(let a=this._length-1;a>=e;a--)this._array[this._getCyclicIndex(a+n.length)]=this._array[this._getCyclicIndex(a)];for(let a=0;a<n.length;a++)this._array[this._getCyclicIndex(e+a)]=n[a];if(n.length&&this.onInsertEmitter.fire({index:e,amount:n.length}),this._length+n.length>this._maxLength){let a=this._length+n.length-this._maxLength;this._startIndex+=a,this._length=this._maxLength,this.onTrimEmitter.fire(a)}else this._length+=n.length}trimStart(e){e>this._length&&(e=this._length),this._startIndex+=e,this._length-=e,this.onTrimEmitter.fire(e)}shiftElements(e,t,n){if(!(t<=0)){if(e<0||e>=this._length)throw new Error("start argument out of range");if(e+n<0)throw new Error("Cannot shift elements in list beyond index 0");if(n>0){for(let o=t-1;o>=0;o--)this.set(e+o+n,this.get(e+o));let a=e+t+n-this._length;if(a>0)for(this._length+=a;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let a=0;a<t;a++)this.set(e+a+n,this.get(e+a))}}_getCyclicIndex(e){return(this._startIndex+e)%this._maxLength}},qe=3,Zt=Object.freeze(new Co),Yc=0,pf=2,Wl=class Q0{constructor(t,n,a=!1){this.isWrapped=a,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(t*qe);let o=n||xs.fromCharData([0,v0,1,0]);for(let c=0;c<t;++c)this.setCell(c,o);this.length=t}get(t){let n=this._data[t*qe+0],a=n&2097151;return[this._data[t*qe+1],n&2097152?this._combined[t]:a?tr(a):"",n>>22,n&2097152?this._combined[t].charCodeAt(this._combined[t].length-1):a]}set(t,n){this._data[t*qe+1]=n[0],n[1].length>1?(this._combined[t]=n[1],this._data[t*qe+0]=t|2097152|n[2]<<22):this._data[t*qe+0]=n[1].charCodeAt(0)|n[2]<<22}getWidth(t){return this._data[t*qe+0]>>22}hasWidth(t){return this._data[t*qe+0]&12582912}getFg(t){return this._data[t*qe+1]}getBg(t){return this._data[t*qe+2]}hasContent(t){return this._data[t*qe+0]&4194303}getCodePoint(t){let n=this._data[t*qe+0];return n&2097152?this._combined[t].charCodeAt(this._combined[t].length-1):n&2097151}isCombined(t){return this._data[t*qe+0]&2097152}getString(t){let n=this._data[t*qe+0];return n&2097152?this._combined[t]:n&2097151?tr(n&2097151):""}isProtected(t){return this._data[t*qe+2]&536870912}loadCell(t,n){return Yc=t*qe,n.content=this._data[Yc+0],n.fg=this._data[Yc+1],n.bg=this._data[Yc+2],n.content&2097152&&(n.combinedData=this._combined[t]),n.bg&268435456&&(n.extended=this._extendedAttrs[t]),n}setCell(t,n){n.content&2097152&&(this._combined[t]=n.combinedData),n.bg&268435456&&(this._extendedAttrs[t]=n.extended),this._data[t*qe+0]=n.content,this._data[t*qe+1]=n.fg,this._data[t*qe+2]=n.bg}setCellFromCodepoint(t,n,a,o){o.bg&268435456&&(this._extendedAttrs[t]=o.extended),this._data[t*qe+0]=n|a<<22,this._data[t*qe+1]=o.fg,this._data[t*qe+2]=o.bg}addCodepointToCell(t,n,a){let o=this._data[t*qe+0];o&2097152?this._combined[t]+=tr(n):o&2097151?(this._combined[t]=tr(o&2097151)+tr(n),o&=-2097152,o|=2097152):o=n|1<<22,a&&(o&=-12582913,o|=a<<22),this._data[t*qe+0]=o}insertCells(t,n,a){if(t%=this.length,t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,a),n<this.length-t){let o=new xs;for(let c=this.length-t-n-1;c>=0;--c)this.setCell(t+n+c,this.loadCell(t+c,o));for(let c=0;c<n;++c)this.setCell(t+c,a)}else for(let o=t;o<this.length;++o)this.setCell(o,a);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,a)}deleteCells(t,n,a){if(t%=this.length,n<this.length-t){let o=new xs;for(let c=0;c<this.length-t-n;++c)this.setCell(t+c,this.loadCell(t+n+c,o));for(let c=this.length-n;c<this.length;++c)this.setCell(c,a)}else for(let o=t;o<this.length;++o)this.setCell(o,a);t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,a),this.getWidth(t)===0&&!this.hasContent(t)&&this.setCellFromCodepoint(t,0,1,a)}replaceCells(t,n,a,o=!1){if(o){for(t&&this.getWidth(t-1)===2&&!this.isProtected(t-1)&&this.setCellFromCodepoint(t-1,0,1,a),n<this.length&&this.getWidth(n-1)===2&&!this.isProtected(n)&&this.setCellFromCodepoint(n,0,1,a);t<n&&t<this.length;)this.isProtected(t)||this.setCell(t,a),t++;return}for(t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,a),n<this.length&&this.getWidth(n-1)===2&&this.setCellFromCodepoint(n,0,1,a);t<n&&t<this.length;)this.setCell(t++,a)}resize(t,n){if(t===this.length)return this._data.length*4*pf<this._data.buffer.byteLength;let a=t*qe;if(t>this.length){if(this._data.buffer.byteLength>=a*4)this._data=new Uint32Array(this._data.buffer,0,a);else{let o=new Uint32Array(a);o.set(this._data),this._data=o}for(let o=this.length;o<t;++o)this.setCell(o,n)}else{this._data=this._data.subarray(0,a);let o=Object.keys(this._combined);for(let d=0;d<o.length;d++){let p=parseInt(o[d],10);p>=t&&delete this._combined[p]}let c=Object.keys(this._extendedAttrs);for(let d=0;d<c.length;d++){let p=parseInt(c[d],10);p>=t&&delete this._extendedAttrs[p]}}return this.length=t,a*4*pf<this._data.buffer.byteLength}cleanupMemory(){if(this._data.length*4*pf<this._data.buffer.byteLength){let t=new Uint32Array(this._data.length);return t.set(this._data),this._data=t,1}return 0}fill(t,n=!1){if(n){for(let a=0;a<this.length;++a)this.isProtected(a)||this.setCell(a,t);return}this._combined={},this._extendedAttrs={};for(let a=0;a<this.length;++a)this.setCell(a,t)}copyFrom(t){this.length!==t.length?this._data=new Uint32Array(t._data):this._data.set(t._data),this.length=t.length,this._combined={};for(let n in t._combined)this._combined[n]=t._combined[n];this._extendedAttrs={};for(let n in t._extendedAttrs)this._extendedAttrs[n]=t._extendedAttrs[n];this.isWrapped=t.isWrapped}clone(){let t=new Q0(0);t._data=new Uint32Array(this._data),t.length=this.length;for(let n in this._combined)t._combined[n]=this._combined[n];for(let n in this._extendedAttrs)t._extendedAttrs[n]=this._extendedAttrs[n];return t.isWrapped=this.isWrapped,t}getTrimmedLength(){for(let t=this.length-1;t>=0;--t)if(this._data[t*qe+0]&4194303)return t+(this._data[t*qe+0]>>22);return 0}getNoBgTrimmedLength(){for(let t=this.length-1;t>=0;--t)if(this._data[t*qe+0]&4194303||this._data[t*qe+2]&50331648)return t+(this._data[t*qe+0]>>22);return 0}copyCellsFrom(t,n,a,o,c){let d=t._data;if(c)for(let m=o-1;m>=0;m--){for(let f=0;f<qe;f++)this._data[(a+m)*qe+f]=d[(n+m)*qe+f];d[(n+m)*qe+2]&268435456&&(this._extendedAttrs[a+m]=t._extendedAttrs[n+m])}else for(let m=0;m<o;m++){for(let f=0;f<qe;f++)this._data[(a+m)*qe+f]=d[(n+m)*qe+f];d[(n+m)*qe+2]&268435456&&(this._extendedAttrs[a+m]=t._extendedAttrs[n+m])}let p=Object.keys(t._combined);for(let m=0;m<p.length;m++){let f=parseInt(p[m],10);f>=n&&(this._combined[f-n+a]=t._combined[f])}}translateToString(t,n,a,o){n=n??0,a=a??this.length,t&&(a=Math.min(a,this.getTrimmedLength())),o&&(o.length=0);let c="";for(;n<a;){let d=this._data[n*qe+0],p=d&2097151,m=d&2097152?this._combined[n]:p?tr(p):sr;if(c+=m,o)for(let f=0;f<m.length;++f)o.push(n);n+=d>>22||1}return o&&o.push(n),c}};function Gk(e,t,n,a,o,c){let d=[];for(let p=0;p<e.length-1;p++){let m=p,f=e.get(++m);if(!f.isWrapped)continue;let S=[e.get(p)];for(;m<e.length&&f.isWrapped;)S.push(f),f=e.get(++m);if(!c&&a>=p&&a<m){p+=S.length-1;continue}let y=0,b=co(S,y,t),x=1,C=0;for(;x<S.length;){let B=co(S,x,t),R=B-C,re=n-b,F=Math.min(R,re);S[y].copyCellsFrom(S[x],C,b,F,!1),b+=F,b===n&&(y++,b=0),C+=F,C===B&&(x++,C=0),b===0&&y!==0&&S[y-1].getWidth(n-1)===2&&(S[y].copyCellsFrom(S[y-1],n-1,b++,1,!1),S[y-1].setCell(n-1,o))}S[y].replaceCells(b,n,o);let k=0;for(let B=S.length-1;B>0&&(B>y||S[B].getTrimmedLength()===0);B--)k++;k>0&&(d.push(p+S.length-k),d.push(k)),p+=S.length-1}return d}function Zk(e,t){let n=[],a=0,o=t[a],c=0;for(let d=0;d<e.length;d++)if(o===d){let p=t[++a];e.onDeleteEmitter.fire({index:d-c,amount:p}),d+=p-1,c+=p,o=t[++a]}else n.push(d);return{layout:n,countRemoved:c}}function Qk(e,t){let n=[];for(let a=0;a<t.length;a++)n.push(e.get(t[a]));for(let a=0;a<n.length;a++)e.set(a,n[a]);e.length=t.length}function Jk(e,t,n){let a=[],o=e.map((m,f)=>co(e,f,t)).reduce((m,f)=>m+f),c=0,d=0,p=0;for(;p<o;){if(o-p<n){a.push(o-p);break}c+=n;let m=co(e,d,t);c>m&&(c-=m,d++);let f=e[d].getWidth(c-1)===2;f&&c--;let S=f?n-1:n;a.push(S),p+=S}return a}function co(e,t,n){if(t===e.length-1)return e[t].getTrimmedLength();let a=!e[t].hasContent(n-1)&&e[t].getWidth(n-1)===1,o=e[t+1].getWidth(0)===2;return a&&o?n-1:n}var J0=class ew{constructor(t){this.line=t,this.isDisposed=!1,this._disposables=[],this._id=ew._nextId++,this._onDispose=this.register(new _e),this.onDispose=this._onDispose.event}get id(){return this._id}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),Hr(this._disposables),this._disposables.length=0)}register(t){return this._disposables.push(t),t}};J0._nextId=1;var eD=J0,ri={},Nr=ri.B;ri[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:"≥","{":"π","|":"≠","}":"£","~":"·"};ri.A={"#":"£"};ri.B=void 0;ri[4]={"#":"£","@":"¾","[":"ij","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"};ri.C=ri[5]={"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};ri.R={"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"};ri.Q={"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"};ri.K={"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"};ri.Y={"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"};ri.E=ri[6]={"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"};ri.Z={"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"};ri.H=ri[7]={"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};ri["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"};var ES=4294967295,TS=class{constructor(e,t,n){this._hasScrollback=e,this._optionsService=t,this._bufferService=n,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=Zt.clone(),this.savedCharset=Nr,this.markers=[],this._nullCell=xs.fromCharData([0,v0,1,0]),this._whitespaceCell=xs.fromCharData([0,sr,1,32]),this._isClearing=!1,this._memoryCleanupQueue=new gu,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new xS(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 pu),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 pu),this._whitespaceCell}getBlankLine(e,t){return new Wl(this._bufferService.cols,this.getNullCell(e),t)}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 t=e+this._optionsService.rawOptions.scrollback;return t>ES?ES:t}fillViewportRows(e){if(this.lines.length===0){e===void 0&&(e=Zt);let t=this._rows;for(;t--;)this.lines.push(this.getBlankLine(e))}}clear(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new xS(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(e,t){let n=this.getNullCell(Zt),a=0,o=this._getCorrectBufferLength(t);if(o>this.lines.maxLength&&(this.lines.maxLength=o),this.lines.length>0){if(this._cols<e)for(let d=0;d<this.lines.length;d++)a+=+this.lines.get(d).resize(e,n);let c=0;if(this._rows<t)for(let d=this._rows;d<t;d++)this.lines.length<t+this.ybase&&(this._optionsService.rawOptions.windowsMode||this._optionsService.rawOptions.windowsPty.backend!==void 0||this._optionsService.rawOptions.windowsPty.buildNumber!==void 0?this.lines.push(new Wl(e,n)):this.ybase>0&&this.lines.length<=this.ybase+this.y+c+1?(this.ybase--,c++,this.ydisp>0&&this.ydisp--):this.lines.push(new Wl(e,n)));else for(let d=this._rows;d>t;d--)this.lines.length>t+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(o<this.lines.maxLength){let d=this.lines.length-o;d>0&&(this.lines.trimStart(d),this.ybase=Math.max(this.ybase-d,0),this.ydisp=Math.max(this.ydisp-d,0),this.savedY=Math.max(this.savedY-d,0)),this.lines.maxLength=o}this.x=Math.min(this.x,e-1),this.y=Math.min(this.y,t-1),c&&(this.y+=c),this.savedX=Math.min(this.savedX,e-1),this.scrollTop=0}if(this.scrollBottom=t-1,this._isReflowEnabled&&(this._reflow(e,t),this._cols>e))for(let c=0;c<this.lines.length;c++)a+=+this.lines.get(c).resize(e,n);this._cols=e,this._rows=t,this._memoryCleanupQueue.clear(),a>.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 t=0;for(;this._memoryCleanupPosition<this.lines.length;)if(t+=this.lines.get(this._memoryCleanupPosition++).cleanupMemory(),t>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,t){this._cols!==e&&(e>this._cols?this._reflowLarger(e,t):this._reflowSmaller(e,t))}_reflowLarger(e,t){let n=this._optionsService.rawOptions.reflowCursorLine,a=Gk(this.lines,this._cols,e,this.ybase+this.y,this.getNullCell(Zt),n);if(a.length>0){let o=Zk(this.lines,a);Qk(this.lines,o.layout),this._reflowLargerAdjustViewport(e,t,o.countRemoved)}}_reflowLargerAdjustViewport(e,t,n){let a=this.getNullCell(Zt),o=n;for(;o-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<t&&this.lines.push(new Wl(e,a))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-n,0)}_reflowSmaller(e,t){let n=this._optionsService.rawOptions.reflowCursorLine,a=this.getNullCell(Zt),o=[],c=0;for(let d=this.lines.length-1;d>=0;d--){let p=this.lines.get(d);if(!p||!p.isWrapped&&p.getTrimmedLength()<=e)continue;let m=[p];for(;p.isWrapped&&d>0;)p=this.lines.get(--d),m.unshift(p);if(!n){let F=this.ybase+this.y;if(F>=d&&F<d+m.length)continue}let f=m[m.length-1].getTrimmedLength(),S=Jk(m,this._cols,e),y=S.length-m.length,b;this.ybase===0&&this.y!==this.lines.length-1?b=Math.max(0,this.y-this.lines.maxLength+y):b=Math.max(0,this.lines.length-this.lines.maxLength+y);let x=[];for(let F=0;F<y;F++){let J=this.getBlankLine(Zt,!0);x.push(J)}x.length>0&&(o.push({start:d+m.length+c,newLines:x}),c+=x.length),m.push(...x);let C=S.length-1,k=S[C];k===0&&(C--,k=S[C]);let B=m.length-y-1,R=f;for(;B>=0;){let F=Math.min(R,k);if(m[C]===void 0)break;if(m[C].copyCellsFrom(m[B],R-F,k-F,F,!0),k-=F,k===0&&(C--,k=S[C]),R-=F,R===0){B--;let J=Math.max(B,0);R=co(m,J,this._cols)}}for(let F=0;F<m.length;F++)S[F]<e&&m[F].setCell(S[F],a);let re=y-b;for(;re-- >0;)this.ybase===0?this.y<t-1?(this.y++,this.lines.pop()):(this.ybase++,this.ydisp++):this.ybase<Math.min(this.lines.maxLength,this.lines.length+c)-t&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+y,this.ybase+t-1)}if(o.length>0){let d=[],p=[];for(let k=0;k<this.lines.length;k++)p.push(this.lines.get(k));let m=this.lines.length,f=m-1,S=0,y=o[S];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+c);let b=0;for(let k=Math.min(this.lines.maxLength-1,m+c-1);k>=0;k--)if(y&&y.start>f+b){for(let B=y.newLines.length-1;B>=0;B--)this.lines.set(k--,y.newLines[B]);k++,d.push({index:f+1,amount:y.newLines.length}),b+=y.newLines.length,y=o[++S]}else this.lines.set(k,p[f--]);let x=0;for(let k=d.length-1;k>=0;k--)d[k].index+=x,this.lines.onInsertEmitter.fire(d[k]),x+=d[k].amount;let C=Math.max(0,m+c-this.lines.maxLength);C>0&&this.lines.onTrimEmitter.fire(C)}}translateBufferLineToString(e,t,n=0,a){let o=this.lines.get(e);return o?o.translateToString(t,n,a):""}getWrappedRangeForLine(e){let t=e,n=e;for(;t>0&&this.lines.get(t).isWrapped;)t--;for(;n+1<this.lines.length&&this.lines.get(n+1).isWrapped;)n++;return{first:t,last:n}}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 t=0;t<this.markers.length;t++)this.markers[t].line===e&&(this.markers[t].dispose(),this.markers.splice(t--,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 t=new eD(e);return this.markers.push(t),t.register(this.lines.onTrim(n=>{t.line-=n,t.line<0&&t.dispose()})),t.register(this.lines.onInsert(n=>{t.line>=n.index&&(t.line+=n.amount)})),t.register(this.lines.onDelete(n=>{t.line>=n.index&&t.line<n.index+n.amount&&t.dispose(),t.line>n.index&&(t.line-=n.amount)})),t.register(t.onDispose(()=>this._removeMarker(t))),t}_removeMarker(e){this._isClearing||this.markers.splice(this.markers.indexOf(e),1)}},tD=class extends We{constructor(e,t){super(),this._optionsService=e,this._bufferService=t,this._onBufferActivate=this._register(new _e),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 TS(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new TS(!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,t){this._normal.resize(e,t),this._alt.resize(e,t),this.setupTabStops(e)}setupTabStops(e){this._normal.setupTabStops(e),this._alt.setupTabStops(e)}},tw=2,iw=1,xp=class extends We{constructor(e){super(),this.isUserScrolling=!1,this._onResize=this._register(new _e),this.onResize=this._onResize.event,this._onScroll=this._register(new _e),this.onScroll=this._onScroll.event,this.cols=Math.max(e.rawOptions.cols||0,tw),this.rows=Math.max(e.rawOptions.rows||0,iw),this.buffers=this._register(new tD(e,this)),this._register(this.buffers.onBufferActivate(t=>{this._onScroll.fire(t.activeBuffer.ydisp)}))}get buffer(){return this.buffers.active}resize(e,t){let n=this.cols!==e,a=this.rows!==t;this.cols=e,this.rows=t,this.buffers.resize(e,t),this._onResize.fire({cols:e,rows:t,colsChanged:n,rowsChanged:a})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(e,t=!1){let n=this.buffer,a;a=this._cachedBlankLine,(!a||a.length!==this.cols||a.getFg(0)!==e.fg||a.getBg(0)!==e.bg)&&(a=n.getBlankLine(e,t),this._cachedBlankLine=a),a.isWrapped=t;let o=n.ybase+n.scrollTop,c=n.ybase+n.scrollBottom;if(n.scrollTop===0){let d=n.lines.isFull;c===n.lines.length-1?d?n.lines.recycle().copyFrom(a):n.lines.push(a.clone()):n.lines.splice(c+1,0,a.clone()),d?this.isUserScrolling&&(n.ydisp=Math.max(n.ydisp-1,0)):(n.ybase++,this.isUserScrolling||n.ydisp++)}else{let d=c-o+1;n.lines.shiftElements(o+1,d-1,-1),n.lines.set(c,a.clone())}this.isUserScrolling||(n.ydisp=n.ybase),this._onScroll.fire(n.ydisp)}scrollLines(e,t){let n=this.buffer;if(e<0){if(n.ydisp===0)return;this.isUserScrolling=!0}else e+n.ydisp>=n.ybase&&(this.isUserScrolling=!1);let a=n.ydisp;n.ydisp=Math.max(Math.min(n.ydisp+e,n.ybase),0),a!==n.ydisp&&(t||this._onScroll.fire(n.ydisp))}};xp=Ht([ye(0,zi)],xp);var Ea={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:vu,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRuler:{}},iD=["normal","bold","100","200","300","400","500","600","700","800","900"],sD=class extends We{constructor(e){super(),this._onOptionChange=this._register(new _e),this.onOptionChange=this._onOptionChange.event;let t={...Ea};for(let n in e)if(n in t)try{let a=e[n];t[n]=this._sanitizeAndValidateOption(n,a)}catch(a){console.error(a)}this.rawOptions=t,this.options={...t},this._setupOptions(),this._register(Tt(()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null}))}onSpecificOptionChange(e,t){return this.onOptionChange(n=>{n===e&&t(this.rawOptions[e])})}onMultipleOptionChange(e,t){return this.onOptionChange(n=>{e.indexOf(n)!==-1&&t()})}_setupOptions(){let e=n=>{if(!(n in Ea))throw new Error(`No option with key "${n}"`);return this.rawOptions[n]},t=(n,a)=>{if(!(n in Ea))throw new Error(`No option with key "${n}"`);a=this._sanitizeAndValidateOption(n,a),this.rawOptions[n]!==a&&(this.rawOptions[n]=a,this._onOptionChange.fire(n))};for(let n in this.rawOptions){let a={get:e.bind(this,n),set:t.bind(this,n)};Object.defineProperty(this.options,n,a)}}_sanitizeAndValidateOption(e,t){switch(e){case"cursorStyle":if(t||(t=Ea[e]),!nD(t))throw new Error(`"${t}" is not a valid value for ${e}`);break;case"wordSeparator":t||(t=Ea[e]);break;case"fontWeight":case"fontWeightBold":if(typeof t=="number"&&1<=t&&t<=1e3)break;t=iD.includes(t)?t:Ea[e];break;case"cursorWidth":t=Math.floor(t);case"lineHeight":case"tabStopWidth":if(t<1)throw new Error(`${e} cannot be less than 1, value: ${t}`);break;case"minimumContrastRatio":t=Math.max(1,Math.min(21,Math.round(t*10)/10));break;case"scrollback":if(t=Math.min(t,4294967295),t<0)throw new Error(`${e} cannot be less than 0, value: ${t}`);break;case"fastScrollSensitivity":case"scrollSensitivity":if(t<=0)throw new Error(`${e} cannot be less than or equal to 0, value: ${t}`);break;case"rows":case"cols":if(!t&&t!==0)throw new Error(`${e} must be numeric, value: ${t}`);break;case"windowsPty":t=t??{};break}return t}};function nD(e){return e==="block"||e==="underline"||e==="bar"}function Yl(e,t=5){if(typeof e!="object")return e;let n=Array.isArray(e)?[]:{};for(let a in e)n[a]=t<=1?e[a]:e[a]&&Yl(e[a],t-1);return n}var kS=Object.freeze({insertMode:!1}),DS=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,cursorBlink:void 0,cursorStyle:void 0,origin:!1,reverseWraparound:!1,sendFocus:!1,synchronizedOutput:!1,wraparound:!0}),Ep=class extends We{constructor(e,t,n){super(),this._bufferService=e,this._logService=t,this._optionsService=n,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this._register(new _e),this.onData=this._onData.event,this._onUserInput=this._register(new _e),this.onUserInput=this._onUserInput.event,this._onBinary=this._register(new _e),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this._register(new _e),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=Yl(kS),this.decPrivateModes=Yl(DS)}reset(){this.modes=Yl(kS),this.decPrivateModes=Yl(DS)}triggerDataEvent(e,t=!1){if(this._optionsService.rawOptions.disableStdin)return;let n=this._bufferService.buffer;t&&this._optionsService.rawOptions.scrollOnUserInput&&n.ybase!==n.ydisp&&this._onRequestScrollToBottom.fire(),t&&this._onUserInput.fire(),this._logService.debug(`sending data "${e}"`),this._logService.trace("sending data (codes)",()=>e.split("").map(a=>a.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(t=>t.charCodeAt(0))),this._onBinary.fire(e))}};Ep=Ht([ye(0,Oi),ye(1,w0),ye(2,zi)],Ep);var RS={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 mf(e,t){let n=(e.ctrl?16:0)|(e.shift?4:0)|(e.alt?8:0);return e.button===4?(n|=64,n|=e.action):(n|=e.button&3,e.button&4&&(n|=64),e.button&8&&(n|=128),e.action===32?n|=32:e.action===0&&!t&&(n|=3)),n}var _f=String.fromCharCode,MS={DEFAULT:e=>{let t=[mf(e,!1)+32,e.col+32,e.row+32];return t[0]>255||t[1]>255||t[2]>255?"":`\x1B[M${_f(t[0])}${_f(t[1])}${_f(t[2])}`},SGR:e=>{let t=e.action===0&&e.button!==4?"m":"M";return`\x1B[<${mf(e,!0)};${e.col};${e.row}${t}`},SGR_PIXELS:e=>{let t=e.action===0&&e.button!==4?"m":"M";return`\x1B[<${mf(e,!0)};${e.x};${e.y}${t}`}},Tp=class extends We{constructor(e,t,n){super(),this._bufferService=e,this._coreService=t,this._optionsService=n,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._wheelPartialScroll=0,this._onProtocolChange=this._register(new _e),this.onProtocolChange=this._onProtocolChange.event;for(let a of Object.keys(RS))this.addProtocol(a,RS[a]);for(let a of Object.keys(MS))this.addEncoding(a,MS[a]);this.reset()}addProtocol(e,t){this._protocols[e]=t}addEncoding(e,t){this._encodings[e]=t}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,t,n){if(e.deltaY===0||e.shiftKey||t===void 0||n===void 0)return 0;let a=t/n,o=this._applyScrollModifier(e.deltaY,e);return e.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(o/=a+0,Math.abs(e.deltaY)<50&&(o*=.3),this._wheelPartialScroll+=o,o=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):e.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(o*=this._bufferService.rows),o}_applyScrollModifier(e,t){return t.altKey||t.ctrlKey||t.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 t=this._encodings[this._activeEncoding](e);return t&&(this._activeEncoding==="DEFAULT"?this._coreService.triggerBinaryEvent(t):this._coreService.triggerDataEvent(t,!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,t,n){if(n){if(e.x!==t.x||e.y!==t.y)return!1}else if(e.col!==t.col||e.row!==t.row)return!1;return!(e.button!==t.button||e.action!==t.action||e.ctrl!==t.ctrl||e.alt!==t.alt||e.shift!==t.shift)}};Tp=Ht([ye(0,Oi),ye(1,Pr),ye(2,zi)],Tp);var vf=[[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]],rD=[[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]],si;function aD(e,t){let n=0,a=t.length-1,o;if(e<t[0][0]||e>t[a][1])return!1;for(;a>=n;)if(o=n+a>>1,e>t[o][1])n=o+1;else if(e<t[o][0])a=o-1;else return!0;return!1}var lD=class{constructor(){if(this.version="6",!si){si=new Uint8Array(65536),si.fill(1),si[0]=0,si.fill(0,1,32),si.fill(0,127,160),si.fill(2,4352,4448),si[9001]=2,si[9002]=2,si.fill(2,11904,42192),si[12351]=1,si.fill(2,44032,55204),si.fill(2,63744,64256),si.fill(2,65040,65050),si.fill(2,65072,65136),si.fill(2,65280,65377),si.fill(2,65504,65511);for(let e=0;e<vf.length;++e)si.fill(0,vf[e][0],vf[e][1]+1)}}wcwidth(e){return e<32?0:e<127?1:e<65536?si[e]:aD(e,rD)?0:e>=131072&&e<=196605||e>=196608&&e<=262141?2:1}charProperties(e,t){let n=this.wcwidth(e),a=n===0&&t!==0;if(a){let o=Br.extractWidth(t);o===0?a=!1:o>n&&(n=o)}return Br.createPropertyValue(0,n,a)}},Br=class iu{constructor(){this._providers=Object.create(null),this._active="",this._onChange=new _e,this.onChange=this._onChange.event;let t=new lD;this.register(t),this._active=t.version,this._activeProvider=t}static extractShouldJoin(t){return(t&1)!==0}static extractWidth(t){return t>>1&3}static extractCharKind(t){return t>>3}static createPropertyValue(t,n,a=!1){return(t&16777215)<<3|(n&3)<<1|(a?1:0)}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(t){if(!this._providers[t])throw new Error(`unknown Unicode version "${t}"`);this._active=t,this._activeProvider=this._providers[t],this._onChange.fire(t)}register(t){this._providers[t.version]=t}wcwidth(t){return this._activeProvider.wcwidth(t)}getStringCellWidth(t){let n=0,a=0,o=t.length;for(let c=0;c<o;++c){let d=t.charCodeAt(c);if(55296<=d&&d<=56319){if(++c>=o)return n+this.wcwidth(d);let f=t.charCodeAt(c);56320<=f&&f<=57343?d=(d-55296)*1024+f-56320+65536:n+=this.wcwidth(f)}let p=this.charProperties(d,a),m=iu.extractWidth(p);iu.extractShouldJoin(p)&&(m-=iu.extractWidth(a)),n+=m,a=p}return n}charProperties(t,n){return this._activeProvider.charProperties(t,n)}},oD=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,t){this._charsets[e]=t,this.glevel===e&&(this.charset=t)}};function AS(e){let t=e.buffer.lines.get(e.buffer.ybase+e.buffer.y-1)?.get(e.cols-1),n=e.buffer.lines.get(e.buffer.ybase+e.buffer.y);n&&t&&(n.isWrapped=t[3]!==0&&t[3]!==32)}var Ol=2147483647,cD=256,sw=class kp{constructor(t=32,n=32){if(this.maxLength=t,this.maxSubParamsLength=n,n>cD)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(t),this.length=0,this._subParams=new Int32Array(n),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(t),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}static fromArray(t){let n=new kp;if(!t.length)return n;for(let a=Array.isArray(t[0])?1:0;a<t.length;++a){let o=t[a];if(Array.isArray(o))for(let c=0;c<o.length;++c)n.addSubParam(o[c]);else n.addParam(o)}return n}clone(){let t=new kp(this.maxLength,this.maxSubParamsLength);return t.params.set(this.params),t.length=this.length,t._subParams.set(this._subParams),t._subParamsLength=this._subParamsLength,t._subParamsIdx.set(this._subParamsIdx),t._rejectDigits=this._rejectDigits,t._rejectSubDigits=this._rejectSubDigits,t._digitIsSub=this._digitIsSub,t}toArray(){let t=[];for(let n=0;n<this.length;++n){t.push(this.params[n]);let a=this._subParamsIdx[n]>>8,o=this._subParamsIdx[n]&255;o-a>0&&t.push(Array.prototype.slice.call(this._subParams,a,o))}return t}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(t){if(this._digitIsSub=!1,this.length>=this.maxLength){this._rejectDigits=!0;return}if(t<-1)throw new Error("values lesser than -1 are not allowed");this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=t>Ol?Ol:t}addSubParam(t){if(this._digitIsSub=!0,!!this.length){if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength){this._rejectSubDigits=!0;return}if(t<-1)throw new Error("values lesser than -1 are not allowed");this._subParams[this._subParamsLength++]=t>Ol?Ol:t,this._subParamsIdx[this.length-1]++}}hasSubParams(t){return(this._subParamsIdx[t]&255)-(this._subParamsIdx[t]>>8)>0}getSubParams(t){let n=this._subParamsIdx[t]>>8,a=this._subParamsIdx[t]&255;return a-n>0?this._subParams.subarray(n,a):null}getSubParamsAll(){let t={};for(let n=0;n<this.length;++n){let a=this._subParamsIdx[n]>>8,o=this._subParamsIdx[n]&255;o-a>0&&(t[n]=this._subParams.slice(a,o))}return t}addDigit(t){let n;if(this._rejectDigits||!(n=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;let a=this._digitIsSub?this._subParams:this.params,o=a[n-1];a[n-1]=~o?Math.min(o*10+t,Ol):t}},zl=[],uD=class{constructor(){this._state=0,this._active=zl,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(e,t){this._handlers[e]===void 0&&(this._handlers[e]=[]);let n=this._handlers[e];return n.push(t),{dispose:()=>{let a=n.indexOf(t);a!==-1&&n.splice(a,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=zl}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=zl,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||zl,!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,t,n){if(!this._active.length)this._handlerFb(this._id,"PUT",Au(e,t,n));else for(let a=this._active.length-1;a>=0;a--)this._active[a].put(e,t,n)}start(){this.reset(),this._state=1}put(e,t,n){if(this._state!==3){if(this._state===1)for(;t<n;){let a=e[t++];if(a===59){this._state=2,this._start();break}if(a<48||57<a){this._state=3;return}this._id===-1&&(this._id=0),this._id=this._id*10+a-48}this._state===2&&n-t>0&&this._put(e,t,n)}}end(e,t=!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 n=!1,a=this._active.length-1,o=!1;if(this._stack.paused&&(a=this._stack.loopPosition-1,n=t,o=this._stack.fallThrough,this._stack.paused=!1),!o&&n===!1){for(;a>=0&&(n=this._active[a].end(e),n!==!0);a--)if(n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=a,this._stack.fallThrough=!1,n;a--}for(;a>=0;a--)if(n=this._active[a].end(!1),n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=a,this._stack.fallThrough=!0,n}this._active=zl,this._id=-1,this._state=0}}},ls=class{constructor(e){this._handler=e,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(e,t,n){this._hitLimit||(this._data+=Au(e,t,n),this._data.length>1e7&&(this._data="",this._hitLimit=!0))}end(e){let t=!1;if(this._hitLimit)t=!1;else if(e&&(t=this._handler(this._data),t instanceof Promise))return t.then(n=>(this._data="",this._hitLimit=!1,n));return this._data="",this._hitLimit=!1,t}},jl=[],hD=class{constructor(){this._handlers=Object.create(null),this._active=jl,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=jl}registerHandler(e,t){this._handlers[e]===void 0&&(this._handlers[e]=[]);let n=this._handlers[e];return n.push(t),{dispose:()=>{let a=n.indexOf(t);a!==-1&&n.splice(a,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=jl,this._ident=0}hook(e,t){if(this.reset(),this._ident=e,this._active=this._handlers[e]||jl,!this._active.length)this._handlerFb(this._ident,"HOOK",t);else for(let n=this._active.length-1;n>=0;n--)this._active[n].hook(t)}put(e,t,n){if(!this._active.length)this._handlerFb(this._ident,"PUT",Au(e,t,n));else for(let a=this._active.length-1;a>=0;a--)this._active[a].put(e,t,n)}unhook(e,t=!0){if(!this._active.length)this._handlerFb(this._ident,"UNHOOK",e);else{let n=!1,a=this._active.length-1,o=!1;if(this._stack.paused&&(a=this._stack.loopPosition-1,n=t,o=this._stack.fallThrough,this._stack.paused=!1),!o&&n===!1){for(;a>=0&&(n=this._active[a].unhook(e),n!==!0);a--)if(n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=a,this._stack.fallThrough=!1,n;a--}for(;a>=0;a--)if(n=this._active[a].unhook(!1),n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=a,this._stack.fallThrough=!0,n}this._active=jl,this._ident=0}},$l=new sw;$l.addParam(0);var NS=class{constructor(e){this._handler=e,this._data="",this._params=$l,this._hitLimit=!1}hook(e){this._params=e.length>1||e.params[0]?e.clone():$l,this._data="",this._hitLimit=!1}put(e,t,n){this._hitLimit||(this._data+=Au(e,t,n),this._data.length>1e7&&(this._data="",this._hitLimit=!0))}unhook(e){let t=!1;if(this._hitLimit)t=!1;else if(e&&(t=this._handler(this._data,this._params),t instanceof Promise))return t.then(n=>(this._params=$l,this._data="",this._hitLimit=!1,n));return this._params=$l,this._data="",this._hitLimit=!1,t}},dD=class{constructor(e){this.table=new Uint8Array(e)}setDefault(e,t){this.table.fill(e<<4|t)}add(e,t,n,a){this.table[t<<8|e]=n<<4|a}addMany(e,t,n,a){for(let o=0;o<e.length;o++)this.table[t<<8|e[o]]=n<<4|a}},ws=160,fD=(function(){let e=new dD(4095),t=Array.apply(null,Array(256)).map((p,m)=>m),n=(p,m)=>t.slice(p,m),a=n(32,127),o=n(0,24);o.push(25),o.push.apply(o,n(28,32));let c=n(0,14),d;e.setDefault(1,0),e.addMany(a,0,2,0);for(d in c)e.addMany([24,26,153,154],d,3,0),e.addMany(n(128,144),d,3,0),e.addMany(n(144,152),d,3,0),e.add(156,d,0,0),e.add(27,d,11,1),e.add(157,d,4,8),e.addMany([152,158,159],d,0,7),e.add(155,d,11,3),e.add(144,d,11,9);return e.addMany(o,0,3,0),e.addMany(o,1,3,1),e.add(127,1,0,1),e.addMany(o,8,0,8),e.addMany(o,3,3,3),e.add(127,3,0,3),e.addMany(o,4,3,4),e.add(127,4,0,4),e.addMany(o,6,3,6),e.addMany(o,5,3,5),e.add(127,5,0,5),e.addMany(o,2,3,2),e.add(127,2,0,2),e.add(93,1,4,8),e.addMany(a,8,5,8),e.add(127,8,5,8),e.addMany([156,27,24,26,7],8,6,0),e.addMany(n(28,32),8,0,8),e.addMany([88,94,95],1,0,7),e.addMany(a,7,0,7),e.addMany(o,7,0,7),e.add(156,7,0,0),e.add(127,7,0,7),e.add(91,1,11,3),e.addMany(n(64,127),3,7,0),e.addMany(n(48,60),3,8,4),e.addMany([60,61,62,63],3,9,4),e.addMany(n(48,60),4,8,4),e.addMany(n(64,127),4,7,0),e.addMany([60,61,62,63],4,0,6),e.addMany(n(32,64),6,0,6),e.add(127,6,0,6),e.addMany(n(64,127),6,0,0),e.addMany(n(32,48),3,9,5),e.addMany(n(32,48),5,9,5),e.addMany(n(48,64),5,0,6),e.addMany(n(64,127),5,7,0),e.addMany(n(32,48),4,9,5),e.addMany(n(32,48),1,9,2),e.addMany(n(32,48),2,9,2),e.addMany(n(48,127),2,10,0),e.addMany(n(48,80),1,10,0),e.addMany(n(81,88),1,10,0),e.addMany([89,90,92],1,10,0),e.addMany(n(96,127),1,10,0),e.add(80,1,11,9),e.addMany(o,9,0,9),e.add(127,9,0,9),e.addMany(n(28,32),9,0,9),e.addMany(n(32,48),9,9,12),e.addMany(n(48,60),9,8,10),e.addMany([60,61,62,63],9,9,10),e.addMany(o,11,0,11),e.addMany(n(32,128),11,0,11),e.addMany(n(28,32),11,0,11),e.addMany(o,10,0,10),e.add(127,10,0,10),e.addMany(n(28,32),10,0,10),e.addMany(n(48,60),10,8,10),e.addMany([60,61,62,63],10,0,11),e.addMany(n(32,48),10,9,12),e.addMany(o,12,0,12),e.add(127,12,0,12),e.addMany(n(28,32),12,0,12),e.addMany(n(32,48),12,9,12),e.addMany(n(48,64),12,0,11),e.addMany(n(64,127),12,12,13),e.addMany(n(64,127),10,12,13),e.addMany(n(64,127),9,12,13),e.addMany(o,13,13,13),e.addMany(a,13,13,13),e.add(127,13,0,13),e.addMany([27,156,24,26],13,14,0),e.add(ws,0,2,0),e.add(ws,8,5,8),e.add(ws,6,0,6),e.add(ws,11,0,11),e.add(ws,13,13,13),e})(),pD=class extends We{constructor(e=fD){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 sw,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(t,n,a)=>{},this._executeHandlerFb=t=>{},this._csiHandlerFb=(t,n)=>{},this._escHandlerFb=t=>{},this._errorHandlerFb=t=>t,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this._register(Tt(()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)})),this._oscParser=this._register(new uD),this._dcsParser=this._register(new hD),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},()=>!0)}_identifier(e,t=[64,126]){let n=0;if(e.prefix){if(e.prefix.length>1)throw new Error("only one byte as prefix supported");if(n=e.prefix.charCodeAt(0),n&&60>n||n>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 o=0;o<e.intermediates.length;++o){let c=e.intermediates.charCodeAt(o);if(32>c||c>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");n<<=8,n|=c}}if(e.final.length!==1)throw new Error("final must be a single byte");let a=e.final.charCodeAt(0);if(t[0]>a||a>t[1])throw new Error(`final must be in range ${t[0]} .. ${t[1]}`);return n<<=8,n|=a,n}identToString(e){let t=[];for(;e;)t.push(String.fromCharCode(e&255)),e>>=8;return t.reverse().join("")}setPrintHandler(e){this._printHandler=e}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(e,t){let n=this._identifier(e,[48,126]);this._escHandlers[n]===void 0&&(this._escHandlers[n]=[]);let a=this._escHandlers[n];return a.push(t),{dispose:()=>{let o=a.indexOf(t);o!==-1&&a.splice(o,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,t){this._executeHandlers[e.charCodeAt(0)]=t}clearExecuteHandler(e){this._executeHandlers[e.charCodeAt(0)]&&delete this._executeHandlers[e.charCodeAt(0)]}setExecuteHandlerFallback(e){this._executeHandlerFb=e}registerCsiHandler(e,t){let n=this._identifier(e);this._csiHandlers[n]===void 0&&(this._csiHandlers[n]=[]);let a=this._csiHandlers[n];return a.push(t),{dispose:()=>{let o=a.indexOf(t);o!==-1&&a.splice(o,1)}}}clearCsiHandler(e){this._csiHandlers[this._identifier(e)]&&delete this._csiHandlers[this._identifier(e)]}setCsiHandlerFallback(e){this._csiHandlerFb=e}registerDcsHandler(e,t){return this._dcsParser.registerHandler(this._identifier(e),t)}clearDcsHandler(e){this._dcsParser.clearHandler(this._identifier(e))}setDcsHandlerFallback(e){this._dcsParser.setHandlerFallback(e)}registerOscHandler(e,t){return this._oscParser.registerHandler(e,t)}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,t,n,a,o){this._parseStack.state=e,this._parseStack.handlers=t,this._parseStack.handlerPos=n,this._parseStack.transition=a,this._parseStack.chunkPos=o}parse(e,t,n){let a=0,o=0,c=0,d;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,c=this._parseStack.chunkPos+1;else{if(n===void 0||this._parseStack.state===1)throw this._parseStack.state=1,new Error("improper continuation due to previous async handler, giving up parsing");let p=this._parseStack.handlers,m=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(n===!1&&m>-1){for(;m>=0&&(d=p[m](this._params),d!==!0);m--)if(d instanceof Promise)return this._parseStack.handlerPos=m,d}this._parseStack.handlers=[];break;case 4:if(n===!1&&m>-1){for(;m>=0&&(d=p[m](),d!==!0);m--)if(d instanceof Promise)return this._parseStack.handlerPos=m,d}this._parseStack.handlers=[];break;case 6:if(a=e[this._parseStack.chunkPos],d=this._dcsParser.unhook(a!==24&&a!==26,n),d)return d;a===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(a=e[this._parseStack.chunkPos],d=this._oscParser.end(a!==24&&a!==26,n),d)return d;a===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break}this._parseStack.state=0,c=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=this._parseStack.transition&15}for(let p=c;p<t;++p){switch(a=e[p],o=this._transitions.table[this.currentState<<8|(a<160?a:ws)],o>>4){case 2:for(let b=p+1;;++b){if(b>=t||(a=e[b])<32||a>126&&a<ws){this._printHandler(e,p,b),p=b-1;break}if(++b>=t||(a=e[b])<32||a>126&&a<ws){this._printHandler(e,p,b),p=b-1;break}if(++b>=t||(a=e[b])<32||a>126&&a<ws){this._printHandler(e,p,b),p=b-1;break}if(++b>=t||(a=e[b])<32||a>126&&a<ws){this._printHandler(e,p,b),p=b-1;break}}break;case 3:this._executeHandlers[a]?this._executeHandlers[a]():this._executeHandlerFb(a),this.precedingJoinState=0;break;case 0:break;case 1:if(this._errorHandler({position:p,code:a,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:let m=this._csiHandlers[this._collect<<8|a],f=m?m.length-1:-1;for(;f>=0&&(d=m[f](this._params),d!==!0);f--)if(d instanceof Promise)return this._preserveStack(3,m,f,o,p),d;f<0&&this._csiHandlerFb(this._collect<<8|a,this._params),this.precedingJoinState=0;break;case 8:do switch(a){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(a-48)}while(++p<t&&(a=e[p])>47&&a<60);p--;break;case 9:this._collect<<=8,this._collect|=a;break;case 10:let S=this._escHandlers[this._collect<<8|a],y=S?S.length-1:-1;for(;y>=0&&(d=S[y](),d!==!0);y--)if(d instanceof Promise)return this._preserveStack(4,S,y,o,p),d;y<0&&this._escHandlerFb(this._collect<<8|a),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|a,this._params);break;case 13:for(let b=p+1;;++b)if(b>=t||(a=e[b])===24||a===26||a===27||a>127&&a<ws){this._dcsParser.put(e,p,b),p=b-1;break}break;case 14:if(d=this._dcsParser.unhook(a!==24&&a!==26),d)return this._preserveStack(6,[],0,o,p),d;a===27&&(o|=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 b=p+1;;b++)if(b>=t||(a=e[b])<32||a>127&&a<ws){this._oscParser.put(e,p,b),p=b-1;break}break;case 6:if(d=this._oscParser.end(a!==24&&a!==26),d)return this._preserveStack(5,[],0,o,p),d;a===27&&(o|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break}this.currentState=o&15}}},mD=/^([\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})$/,_D=/^[\da-f]+$/;function BS(e){if(!e)return;let t=e.toLowerCase();if(t.indexOf("rgb:")===0){t=t.slice(4);let n=mD.exec(t);if(n){let a=n[1]?15:n[4]?255:n[7]?4095:65535;return[Math.round(parseInt(n[1]||n[4]||n[7]||n[10],16)/a*255),Math.round(parseInt(n[2]||n[5]||n[8]||n[11],16)/a*255),Math.round(parseInt(n[3]||n[6]||n[9]||n[12],16)/a*255)]}}else if(t.indexOf("#")===0&&(t=t.slice(1),_D.exec(t)&&[3,6,9,12].includes(t.length))){let n=t.length/3,a=[0,0,0];for(let o=0;o<3;++o){let c=parseInt(t.slice(n*o,n*o+n),16);a[o]=n===1?c<<4:n===2?c:n===3?c>>4:c>>8}return a}}function gf(e,t){let n=e.toString(16),a=n.length<2?"0"+n:n;switch(t){case 4:return n[0];case 8:return a;case 12:return(a+a).slice(0,3);default:return a+a}}function vD(e,t=16){let[n,a,o]=e;return`rgb:${gf(n,t)}/${gf(a,t)}/${gf(o,t)}`}var gD={"(":0,")":1,"*":2,"+":3,"-":1,".":2},Qn=131072,LS=10;function OS(e,t){if(e>24)return t.setWinLines||!1;switch(e){case 1:return!!t.restoreWin;case 2:return!!t.minimizeWin;case 3:return!!t.setWinPosition;case 4:return!!t.setWinSizePixels;case 5:return!!t.raiseWin;case 6:return!!t.lowerWin;case 7:return!!t.refreshWin;case 8:return!!t.setWinSizeChars;case 9:return!!t.maximizeWin;case 10:return!!t.fullscreenWin;case 11:return!!t.getWinState;case 13:return!!t.getWinPosition;case 14:return!!t.getWinSizePixels;case 15:return!!t.getScreenSizePixels;case 16:return!!t.getCellSizePixels;case 18:return!!t.getWinSizeChars;case 19:return!!t.getScreenSizeChars;case 20:return!!t.getIconTitle;case 21:return!!t.getWinTitle;case 22:return!!t.pushTitle;case 23:return!!t.popTitle;case 24:return!!t.setWinLines}return!1}var zS=5e3,jS=0,yD=class extends We{constructor(e,t,n,a,o,c,d,p,m=new pD){super(),this._bufferService=e,this._charsetService=t,this._coreService=n,this._logService=a,this._optionsService=o,this._oscLinkService=c,this._coreMouseService=d,this._unicodeService=p,this._parser=m,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new H2,this._utf8Decoder=new U2,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=Zt.clone(),this._eraseAttrDataInternal=Zt.clone(),this._onRequestBell=this._register(new _e),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this._register(new _e),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this._register(new _e),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this._register(new _e),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this._register(new _e),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this._register(new _e),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this._register(new _e),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this._register(new _e),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this._register(new _e),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this._register(new _e),this.onLineFeed=this._onLineFeed.event,this._onScroll=this._register(new _e),this.onScroll=this._onScroll.event,this._onTitleChange=this._register(new _e),this.onTitleChange=this._onTitleChange.event,this._onColor=this._register(new _e),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 Dp(this._bufferService),this._activeBuffer=this._bufferService.buffer,this._register(this._bufferService.buffers.onBufferActivate(f=>this._activeBuffer=f.activeBuffer)),this._parser.setCsiHandlerFallback((f,S)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(f),params:S.toArray()})}),this._parser.setEscHandlerFallback(f=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(f)})}),this._parser.setExecuteHandlerFallback(f=>{this._logService.debug("Unknown EXECUTE code: ",{code:f})}),this._parser.setOscHandlerFallback((f,S,y)=>{this._logService.debug("Unknown OSC code: ",{identifier:f,action:S,data:y})}),this._parser.setDcsHandlerFallback((f,S,y)=>{S==="HOOK"&&(y=y.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(f),action:S,payload:y})}),this._parser.setPrintHandler((f,S,y)=>this.print(f,S,y)),this._parser.registerCsiHandler({final:"@"},f=>this.insertChars(f)),this._parser.registerCsiHandler({intermediates:" ",final:"@"},f=>this.scrollLeft(f)),this._parser.registerCsiHandler({final:"A"},f=>this.cursorUp(f)),this._parser.registerCsiHandler({intermediates:" ",final:"A"},f=>this.scrollRight(f)),this._parser.registerCsiHandler({final:"B"},f=>this.cursorDown(f)),this._parser.registerCsiHandler({final:"C"},f=>this.cursorForward(f)),this._parser.registerCsiHandler({final:"D"},f=>this.cursorBackward(f)),this._parser.registerCsiHandler({final:"E"},f=>this.cursorNextLine(f)),this._parser.registerCsiHandler({final:"F"},f=>this.cursorPrecedingLine(f)),this._parser.registerCsiHandler({final:"G"},f=>this.cursorCharAbsolute(f)),this._parser.registerCsiHandler({final:"H"},f=>this.cursorPosition(f)),this._parser.registerCsiHandler({final:"I"},f=>this.cursorForwardTab(f)),this._parser.registerCsiHandler({final:"J"},f=>this.eraseInDisplay(f,!1)),this._parser.registerCsiHandler({prefix:"?",final:"J"},f=>this.eraseInDisplay(f,!0)),this._parser.registerCsiHandler({final:"K"},f=>this.eraseInLine(f,!1)),this._parser.registerCsiHandler({prefix:"?",final:"K"},f=>this.eraseInLine(f,!0)),this._parser.registerCsiHandler({final:"L"},f=>this.insertLines(f)),this._parser.registerCsiHandler({final:"M"},f=>this.deleteLines(f)),this._parser.registerCsiHandler({final:"P"},f=>this.deleteChars(f)),this._parser.registerCsiHandler({final:"S"},f=>this.scrollUp(f)),this._parser.registerCsiHandler({final:"T"},f=>this.scrollDown(f)),this._parser.registerCsiHandler({final:"X"},f=>this.eraseChars(f)),this._parser.registerCsiHandler({final:"Z"},f=>this.cursorBackwardTab(f)),this._parser.registerCsiHandler({final:"`"},f=>this.charPosAbsolute(f)),this._parser.registerCsiHandler({final:"a"},f=>this.hPositionRelative(f)),this._parser.registerCsiHandler({final:"b"},f=>this.repeatPrecedingCharacter(f)),this._parser.registerCsiHandler({final:"c"},f=>this.sendDeviceAttributesPrimary(f)),this._parser.registerCsiHandler({prefix:">",final:"c"},f=>this.sendDeviceAttributesSecondary(f)),this._parser.registerCsiHandler({final:"d"},f=>this.linePosAbsolute(f)),this._parser.registerCsiHandler({final:"e"},f=>this.vPositionRelative(f)),this._parser.registerCsiHandler({final:"f"},f=>this.hVPosition(f)),this._parser.registerCsiHandler({final:"g"},f=>this.tabClear(f)),this._parser.registerCsiHandler({final:"h"},f=>this.setMode(f)),this._parser.registerCsiHandler({prefix:"?",final:"h"},f=>this.setModePrivate(f)),this._parser.registerCsiHandler({final:"l"},f=>this.resetMode(f)),this._parser.registerCsiHandler({prefix:"?",final:"l"},f=>this.resetModePrivate(f)),this._parser.registerCsiHandler({final:"m"},f=>this.charAttributes(f)),this._parser.registerCsiHandler({final:"n"},f=>this.deviceStatus(f)),this._parser.registerCsiHandler({prefix:"?",final:"n"},f=>this.deviceStatusPrivate(f)),this._parser.registerCsiHandler({intermediates:"!",final:"p"},f=>this.softReset(f)),this._parser.registerCsiHandler({intermediates:" ",final:"q"},f=>this.setCursorStyle(f)),this._parser.registerCsiHandler({final:"r"},f=>this.setScrollRegion(f)),this._parser.registerCsiHandler({final:"s"},f=>this.saveCursor(f)),this._parser.registerCsiHandler({final:"t"},f=>this.windowOptions(f)),this._parser.registerCsiHandler({final:"u"},f=>this.restoreCursor(f)),this._parser.registerCsiHandler({intermediates:"'",final:"}"},f=>this.insertColumns(f)),this._parser.registerCsiHandler({intermediates:"'",final:"~"},f=>this.deleteColumns(f)),this._parser.registerCsiHandler({intermediates:'"',final:"q"},f=>this.selectProtected(f)),this._parser.registerCsiHandler({intermediates:"$",final:"p"},f=>this.requestMode(f,!0)),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},f=>this.requestMode(f,!1)),this._parser.setExecuteHandler(oe.BEL,()=>this.bell()),this._parser.setExecuteHandler(oe.LF,()=>this.lineFeed()),this._parser.setExecuteHandler(oe.VT,()=>this.lineFeed()),this._parser.setExecuteHandler(oe.FF,()=>this.lineFeed()),this._parser.setExecuteHandler(oe.CR,()=>this.carriageReturn()),this._parser.setExecuteHandler(oe.BS,()=>this.backspace()),this._parser.setExecuteHandler(oe.HT,()=>this.tab()),this._parser.setExecuteHandler(oe.SO,()=>this.shiftOut()),this._parser.setExecuteHandler(oe.SI,()=>this.shiftIn()),this._parser.setExecuteHandler(eu.IND,()=>this.index()),this._parser.setExecuteHandler(eu.NEL,()=>this.nextLine()),this._parser.setExecuteHandler(eu.HTS,()=>this.tabSet()),this._parser.registerOscHandler(0,new ls(f=>(this.setTitle(f),this.setIconName(f),!0))),this._parser.registerOscHandler(1,new ls(f=>this.setIconName(f))),this._parser.registerOscHandler(2,new ls(f=>this.setTitle(f))),this._parser.registerOscHandler(4,new ls(f=>this.setOrReportIndexedColor(f))),this._parser.registerOscHandler(8,new ls(f=>this.setHyperlink(f))),this._parser.registerOscHandler(10,new ls(f=>this.setOrReportFgColor(f))),this._parser.registerOscHandler(11,new ls(f=>this.setOrReportBgColor(f))),this._parser.registerOscHandler(12,new ls(f=>this.setOrReportCursorColor(f))),this._parser.registerOscHandler(104,new ls(f=>this.restoreIndexedColor(f))),this._parser.registerOscHandler(110,new ls(f=>this.restoreFgColor(f))),this._parser.registerOscHandler(111,new ls(f=>this.restoreBgColor(f))),this._parser.registerOscHandler(112,new ls(f=>this.restoreCursorColor(f))),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 f in ri)this._parser.registerEscHandler({intermediates:"(",final:f},()=>this.selectCharset("("+f)),this._parser.registerEscHandler({intermediates:")",final:f},()=>this.selectCharset(")"+f)),this._parser.registerEscHandler({intermediates:"*",final:f},()=>this.selectCharset("*"+f)),this._parser.registerEscHandler({intermediates:"+",final:f},()=>this.selectCharset("+"+f)),this._parser.registerEscHandler({intermediates:"-",final:f},()=>this.selectCharset("-"+f)),this._parser.registerEscHandler({intermediates:".",final:f},()=>this.selectCharset("."+f)),this._parser.registerEscHandler({intermediates:"/",final:f},()=>this.selectCharset("/"+f));this._parser.registerEscHandler({intermediates:"#",final:"8"},()=>this.screenAlignmentPattern()),this._parser.setErrorHandler(f=>(this._logService.error("Parsing error: ",f),f)),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new NS((f,S)=>this.requestStatusString(f,S)))}getAttrData(){return this._curAttrData}_preserveStack(e,t,n,a){this._parseStack.paused=!0,this._parseStack.cursorStartX=e,this._parseStack.cursorStartY=t,this._parseStack.decodedLength=n,this._parseStack.position=a}_logSlowResolvingAsync(e){this._logService.logLevel<=3&&Promise.race([e,new Promise((t,n)=>setTimeout(()=>n("#SLOW_TIMEOUT"),zS))]).catch(t=>{if(t!=="#SLOW_TIMEOUT")throw t;console.warn(`async parser handler taking longer than ${zS} ms`)})}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(e,t){let n,a=this._activeBuffer.x,o=this._activeBuffer.y,c=0,d=this._parseStack.paused;if(d){if(n=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,t))return this._logSlowResolvingAsync(n),n;a=this._parseStack.cursorStartX,o=this._parseStack.cursorStartY,this._parseStack.paused=!1,e.length>Qn&&(c=this._parseStack.position+Qn)}if(this._logService.logLevel<=1&&this._logService.debug(`parsing data ${typeof e=="string"?` "${e}"`:` "${Array.prototype.map.call(e,f=>String.fromCharCode(f)).join("")}"`}`),this._logService.logLevel===0&&this._logService.trace("parsing data (codes)",typeof e=="string"?e.split("").map(f=>f.charCodeAt(0)):e),this._parseBuffer.length<e.length&&this._parseBuffer.length<Qn&&(this._parseBuffer=new Uint32Array(Math.min(e.length,Qn))),d||this._dirtyRowTracker.clearRange(),e.length>Qn)for(let f=c;f<e.length;f+=Qn){let S=f+Qn<e.length?f+Qn:e.length,y=typeof e=="string"?this._stringDecoder.decode(e.substring(f,S),this._parseBuffer):this._utf8Decoder.decode(e.subarray(f,S),this._parseBuffer);if(n=this._parser.parse(this._parseBuffer,y))return this._preserveStack(a,o,y,f),this._logSlowResolvingAsync(n),n}else if(!d){let f=typeof e=="string"?this._stringDecoder.decode(e,this._parseBuffer):this._utf8Decoder.decode(e,this._parseBuffer);if(n=this._parser.parse(this._parseBuffer,f))return this._preserveStack(a,o,f,0),this._logSlowResolvingAsync(n),n}(this._activeBuffer.x!==a||this._activeBuffer.y!==o)&&this._onCursorMove.fire();let p=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),m=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);m<this._bufferService.rows&&this._onRequestRefreshRows.fire({start:Math.min(m,this._bufferService.rows-1),end:Math.min(p,this._bufferService.rows-1)})}print(e,t,n){let a,o,c=this._charsetService.charset,d=this._optionsService.rawOptions.screenReaderMode,p=this._bufferService.cols,m=this._coreService.decPrivateModes.wraparound,f=this._coreService.modes.insertMode,S=this._curAttrData,y=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&n-t>0&&y.getWidth(this._activeBuffer.x-1)===2&&y.setCellFromCodepoint(this._activeBuffer.x-1,0,1,S);let b=this._parser.precedingJoinState;for(let x=t;x<n;++x){if(a=e[x],a<127&&c){let R=c[String.fromCharCode(a)];R&&(a=R.charCodeAt(0))}let C=this._unicodeService.charProperties(a,b);o=Br.extractWidth(C);let k=Br.extractShouldJoin(C),B=k?Br.extractWidth(b):0;if(b=C,d&&this._onA11yChar.fire(tr(a)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+o-B>p){if(m){let R=y,re=this._activeBuffer.x-B;for(this._activeBuffer.x=B,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),y=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),B>0&&y instanceof Wl&&y.copyCellsFrom(R,re,0,B,!1);re<p;)R.setCellFromCodepoint(re++,0,1,S)}else if(this._activeBuffer.x=p-1,o===2)continue}if(k&&this._activeBuffer.x){let R=y.getWidth(this._activeBuffer.x-1)?1:2;y.addCodepointToCell(this._activeBuffer.x-R,a,o);for(let re=o-B;--re>=0;)y.setCellFromCodepoint(this._activeBuffer.x++,0,0,S);continue}if(f&&(y.insertCells(this._activeBuffer.x,o-B,this._activeBuffer.getNullCell(S)),y.getWidth(p-1)===2&&y.setCellFromCodepoint(p-1,0,1,S)),y.setCellFromCodepoint(this._activeBuffer.x++,a,o,S),o>0)for(;--o;)y.setCellFromCodepoint(this._activeBuffer.x++,0,0,S)}this._parser.precedingJoinState=b,this._activeBuffer.x<p&&n-t>0&&y.getWidth(this._activeBuffer.x)===0&&!y.hasContent(this._activeBuffer.x)&&y.setCellFromCodepoint(this._activeBuffer.x,0,1,S),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(e,t){return e.final==="t"&&!e.prefix&&!e.intermediates?this._parser.registerCsiHandler(e,n=>OS(n.params[0],this._optionsService.rawOptions.windowOptions)?t(n):!0):this._parser.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._parser.registerDcsHandler(e,new NS(t))}registerEscHandler(e,t){return this._parser.registerEscHandler(e,t)}registerOscHandler(e,t){return this._parser.registerOscHandler(e,new ls(t))}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(){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&&this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y)?.isWrapped){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;let e=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);e.hasWidth(this._activeBuffer.x)&&!e.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,t){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=e,this._activeBuffer.y=this._activeBuffer.scrollTop+t):(this._activeBuffer.x=e,this._activeBuffer.y=t),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(e,t){this._restrictCursor(),this._setCursor(this._activeBuffer.x+e,this._activeBuffer.y+t)}cursorUp(e){let t=this._activeBuffer.y-this._activeBuffer.scrollTop;return t>=0?this._moveCursor(0,-Math.min(t,e.params[0]||1)):this._moveCursor(0,-(e.params[0]||1)),!0}cursorDown(e){let t=this._activeBuffer.scrollBottom-this._activeBuffer.y;return t>=0?this._moveCursor(0,Math.min(t,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 t=e.params[0];return t===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:t===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(e){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let t=e.params[0]||1;for(;t--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(e){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let t=e.params[0]||1;for(;t--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(e){let t=e.params[0];return t===1&&(this._curAttrData.bg|=536870912),(t===2||t===0)&&(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(e,t,n,a=!1,o=!1){let c=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);c.replaceCells(t,n,this._activeBuffer.getNullCell(this._eraseAttrData()),o),a&&(c.isWrapped=!1)}_resetBufferLine(e,t=!1){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);n&&(n.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),t),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+e),n.isWrapped=!1)}eraseInDisplay(e,t=!1){this._restrictCursor(this._bufferService.cols);let n;switch(e.params[0]){case 0:for(n=this._activeBuffer.y,this._dirtyRowTracker.markDirty(n),this._eraseInBufferLine(n++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,t);n<this._bufferService.rows;n++)this._resetBufferLine(n,t);this._dirtyRowTracker.markDirty(n);break;case 1:for(n=this._activeBuffer.y,this._dirtyRowTracker.markDirty(n),this._eraseInBufferLine(n,0,this._activeBuffer.x+1,!0,t),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(n+1).isWrapped=!1);n--;)this._resetBufferLine(n,t);this._dirtyRowTracker.markDirty(0);break;case 2:if(this._optionsService.rawOptions.scrollOnEraseInDisplay){for(n=this._bufferService.rows,this._dirtyRowTracker.markRangeDirty(0,n-1);n--&&!this._activeBuffer.lines.get(this._activeBuffer.ybase+n)?.getTrimmedLength(););for(;n>=0;n--)this._bufferService.scroll(this._eraseAttrData())}else{for(n=this._bufferService.rows,this._dirtyRowTracker.markDirty(n-1);n--;)this._resetBufferLine(n,t);this._dirtyRowTracker.markDirty(0)}break;case 3:let a=this._activeBuffer.lines.length-this._bufferService.rows;a>0&&(this._activeBuffer.lines.trimStart(a),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-a,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-a,0),this._onScroll.fire(0));break}return!0}eraseInLine(e,t=!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,t);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,t);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,t);break}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(e){this._restrictCursor();let t=e.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let n=this._activeBuffer.ybase+this._activeBuffer.y,a=this._bufferService.rows-1-this._activeBuffer.scrollBottom,o=this._bufferService.rows-1+this._activeBuffer.ybase-a+1;for(;t--;)this._activeBuffer.lines.splice(o-1,1),this._activeBuffer.lines.splice(n,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 t=e.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let n=this._activeBuffer.ybase+this._activeBuffer.y,a;for(a=this._bufferService.rows-1-this._activeBuffer.scrollBottom,a=this._bufferService.rows-1+this._activeBuffer.ybase-a;t--;)this._activeBuffer.lines.splice(n,1),this._activeBuffer.lines.splice(a,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 t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.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 t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.deleteCells(this._activeBuffer.x,e.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}scrollUp(e){let t=e.params[0]||1;for(;t--;)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 t=e.params[0]||1;for(;t--;)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(Zt));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 t=e.params[0]||1;for(let n=this._activeBuffer.scrollTop;n<=this._activeBuffer.scrollBottom;++n){let a=this._activeBuffer.lines.get(this._activeBuffer.ybase+n);a.deleteCells(0,t,this._activeBuffer.getNullCell(this._eraseAttrData())),a.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 t=e.params[0]||1;for(let n=this._activeBuffer.scrollTop;n<=this._activeBuffer.scrollBottom;++n){let a=this._activeBuffer.lines.get(this._activeBuffer.ybase+n);a.insertCells(0,t,this._activeBuffer.getNullCell(this._eraseAttrData())),a.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 t=e.params[0]||1;for(let n=this._activeBuffer.scrollTop;n<=this._activeBuffer.scrollBottom;++n){let a=this._activeBuffer.lines.get(this._activeBuffer.ybase+n);a.insertCells(this._activeBuffer.x,t,this._activeBuffer.getNullCell(this._eraseAttrData())),a.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 t=e.params[0]||1;for(let n=this._activeBuffer.scrollTop;n<=this._activeBuffer.scrollBottom;++n){let a=this._activeBuffer.lines.get(this._activeBuffer.ybase+n);a.deleteCells(this._activeBuffer.x,t,this._activeBuffer.getNullCell(this._eraseAttrData())),a.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(e){this._restrictCursor();let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.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 t=this._parser.precedingJoinState;if(!t)return!0;let n=e.params[0]||1,a=Br.extractWidth(t),o=this._activeBuffer.x-a,c=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(o),d=new Uint32Array(c.length*n),p=0;for(let f=0;f<c.length;){let S=c.codePointAt(f)||0;d[p++]=S,f+=S>65535?2:1}let m=p;for(let f=1;f<n;++f)d.copyWithin(m,0,p),m+=p;return this.print(d,0,m),!0}sendDeviceAttributesPrimary(e){return e.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(oe.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(oe.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(e){return e.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(oe.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(oe.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(e.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(oe.ESC+"[>83;40003;0c")),!0}_is(e){return(this._optionsService.rawOptions.termName+"").indexOf(e)===0}setMode(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 4:this._coreService.modes.insertMode=!0;break;case 20:this._optionsService.options.convertEol=!0;break}return!0}setModePrivate(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!0;break;case 2:this._charsetService.setgCharset(0,Nr),this._charsetService.setgCharset(1,Nr),this._charsetService.setgCharset(2,Nr),this._charsetService.setgCharset(3,Nr);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 t=0;t<e.length;t++)switch(e.params[t]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1;break}return!0}resetModePrivate(e){for(let t=0;t<e.length;t++)switch(e.params[t]){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[t]===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,t){let n;(k=>(k[k.NOT_RECOGNIZED=0]="NOT_RECOGNIZED",k[k.SET=1]="SET",k[k.RESET=2]="RESET",k[k.PERMANENTLY_SET=3]="PERMANENTLY_SET",k[k.PERMANENTLY_RESET=4]="PERMANENTLY_RESET"))(n||={});let a=this._coreService.decPrivateModes,{activeProtocol:o,activeEncoding:c}=this._coreMouseService,d=this._coreService,{buffers:p,cols:m}=this._bufferService,{active:f,alt:S}=p,y=this._optionsService.rawOptions,b=(k,B)=>(d.triggerDataEvent(`${oe.ESC}[${t?"":"?"}${k};${B}$y`),!0),x=k=>k?1:2,C=e.params[0];return t?C===2?b(C,4):C===4?b(C,x(d.modes.insertMode)):C===12?b(C,3):C===20?b(C,x(y.convertEol)):b(C,0):C===1?b(C,x(a.applicationCursorKeys)):C===3?b(C,y.windowOptions.setWinLines?m===80?2:m===132?1:0:0):C===6?b(C,x(a.origin)):C===7?b(C,x(a.wraparound)):C===8?b(C,3):C===9?b(C,x(o==="X10")):C===12?b(C,x(y.cursorBlink)):C===25?b(C,x(!d.isCursorHidden)):C===45?b(C,x(a.reverseWraparound)):C===66?b(C,x(a.applicationKeypad)):C===67?b(C,4):C===1e3?b(C,x(o==="VT200")):C===1002?b(C,x(o==="DRAG")):C===1003?b(C,x(o==="ANY")):C===1004?b(C,x(a.sendFocus)):C===1005?b(C,4):C===1006?b(C,x(c==="SGR")):C===1015?b(C,4):C===1016?b(C,x(c==="SGR_PIXELS")):C===1048?b(C,1):C===47||C===1047||C===1049?b(C,x(f===S)):C===2004?b(C,x(a.bracketedPasteMode)):C===2026?b(C,x(a.synchronizedOutput)):b(C,0)}_updateAttrColor(e,t,n,a,o){return t===2?(e|=50331648,e&=-16777216,e|=Co.fromColorRGB([n,a,o])):t===5&&(e&=-50331904,e|=33554432|n&255),e}_extractColor(e,t,n){let a=[0,0,-1,0,0,0],o=0,c=0;do{if(a[c+o]=e.params[t+c],e.hasSubParams(t+c)){let d=e.getSubParams(t+c),p=0;do a[1]===5&&(o=1),a[c+p+1+o]=d[p];while(++p<d.length&&p+c+1+o<a.length);break}if(a[1]===5&&c+o>=2||a[1]===2&&c+o>=5)break;a[1]&&(o=1)}while(++c+t<e.length&&c+o<a.length);for(let d=2;d<a.length;++d)a[d]===-1&&(a[d]=0);switch(a[0]){case 38:n.fg=this._updateAttrColor(n.fg,a[1],a[3],a[4],a[5]);break;case 48:n.bg=this._updateAttrColor(n.bg,a[1],a[3],a[4],a[5]);break;case 58:n.extended=n.extended.clone(),n.extended.underlineColor=this._updateAttrColor(n.extended.underlineColor,a[1],a[3],a[4],a[5])}return c}_processUnderline(e,t){t.extended=t.extended.clone(),(!~e||e>5)&&(e=1),t.extended.underlineStyle=e,t.fg|=268435456,e===0&&(t.fg&=-268435457),t.updateExtended()}_processSGR0(e){e.fg=Zt.fg,e.bg=Zt.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 t=e.length,n,a=this._curAttrData;for(let o=0;o<t;o++)n=e.params[o],n>=30&&n<=37?(a.fg&=-50331904,a.fg|=16777216|n-30):n>=40&&n<=47?(a.bg&=-50331904,a.bg|=16777216|n-40):n>=90&&n<=97?(a.fg&=-50331904,a.fg|=16777216|n-90|8):n>=100&&n<=107?(a.bg&=-50331904,a.bg|=16777216|n-100|8):n===0?this._processSGR0(a):n===1?a.fg|=134217728:n===3?a.bg|=67108864:n===4?(a.fg|=268435456,this._processUnderline(e.hasSubParams(o)?e.getSubParams(o)[0]:1,a)):n===5?a.fg|=536870912:n===7?a.fg|=67108864:n===8?a.fg|=1073741824:n===9?a.fg|=2147483648:n===2?a.bg|=134217728:n===21?this._processUnderline(2,a):n===22?(a.fg&=-134217729,a.bg&=-134217729):n===23?a.bg&=-67108865:n===24?(a.fg&=-268435457,this._processUnderline(0,a)):n===25?a.fg&=-536870913:n===27?a.fg&=-67108865:n===28?a.fg&=-1073741825:n===29?a.fg&=2147483647:n===39?(a.fg&=-67108864,a.fg|=Zt.fg&16777215):n===49?(a.bg&=-67108864,a.bg|=Zt.bg&16777215):n===38||n===48||n===58?o+=this._extractColor(e,o,a):n===53?a.bg|=1073741824:n===55?a.bg&=-1073741825:n===59?(a.extended=a.extended.clone(),a.extended.underlineColor=-1,a.updateExtended()):n===100?(a.fg&=-67108864,a.fg|=Zt.fg&16777215,a.bg&=-67108864,a.bg|=Zt.bg&16777215):this._logService.debug("Unknown SGR attribute: %d.",n);return!0}deviceStatus(e){switch(e.params[0]){case 5:this._coreService.triggerDataEvent(`${oe.ESC}[0n`);break;case 6:let t=this._activeBuffer.y+1,n=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${oe.ESC}[${t};${n}R`);break}return!0}deviceStatusPrivate(e){if(e.params[0]===6){let t=this._activeBuffer.y+1,n=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${oe.ESC}[?${t};${n}R`)}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=Zt.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 t=e.length===0?1:e.params[0];if(t===0)this._coreService.decPrivateModes.cursorStyle=void 0,this._coreService.decPrivateModes.cursorBlink=void 0;else{switch(t){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 n=t%2===1;this._coreService.decPrivateModes.cursorBlink=n}return!0}setScrollRegion(e){let t=e.params[0]||1,n;return(e.length<2||(n=e.params[1])>this._bufferService.rows||n===0)&&(n=this._bufferService.rows),n>t&&(this._activeBuffer.scrollTop=t-1,this._activeBuffer.scrollBottom=n-1,this._setCursor(0,0)),!0}windowOptions(e){if(!OS(e.params[0],this._optionsService.rawOptions.windowOptions))return!0;let t=e.length>1?e.params[1]:0;switch(e.params[0]){case 14:t!==2&&this._onRequestWindowsOptionsReport.fire(0);break;case 16:this._onRequestWindowsOptionsReport.fire(1);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`${oe.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:(t===0||t===2)&&(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>LS&&this._windowTitleStack.shift()),(t===0||t===1)&&(this._iconNameStack.push(this._iconName),this._iconNameStack.length>LS&&this._iconNameStack.shift());break;case 23:(t===0||t===2)&&this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),(t===0||t===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 t=[],n=e.split(";");for(;n.length>1;){let a=n.shift(),o=n.shift();if(/^\d+$/.exec(a)){let c=parseInt(a);if(HS(c))if(o==="?")t.push({type:0,index:c});else{let d=BS(o);d&&t.push({type:1,index:c,color:d})}}}return t.length&&this._onColor.fire(t),!0}setHyperlink(e){let t=e.indexOf(";");if(t===-1)return!0;let n=e.slice(0,t).trim(),a=e.slice(t+1);return a?this._createHyperlink(n,a):n.trim()?!1:this._finishHyperlink()}_createHyperlink(e,t){this._getCurrentLinkId()&&this._finishHyperlink();let n=e.split(":"),a,o=n.findIndex(c=>c.startsWith("id="));return o!==-1&&(a=n[o].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:a,uri:t}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(e,t){let n=e.split(";");for(let a=0;a<n.length&&!(t>=this._specialColors.length);++a,++t)if(n[a]==="?")this._onColor.fire([{type:0,index:this._specialColors[t]}]);else{let o=BS(n[a]);o&&this._onColor.fire([{type:1,index:this._specialColors[t],color:o}])}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 t=[],n=e.split(";");for(let a=0;a<n.length;++a)if(/^\d+$/.exec(n[a])){let o=parseInt(n[a]);HS(o)&&t.push({type:2,index:o})}return t.length&&this._onColor.fire(t),!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,Nr),!0}selectCharset(e){return e.length!==2?(this.selectDefaultCharset(),!0):(e[0]==="/"||this._charsetService.setgCharset(gD[e[0]],ri[e[1]]||Nr),!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=Zt.clone(),this._eraseAttrDataInternal=Zt.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 xs;e.content=1<<22|69,e.fg=this._curAttrData.fg,e.bg=this._curAttrData.bg,this._setCursor(0,0);for(let t=0;t<this._bufferService.rows;++t){let n=this._activeBuffer.ybase+this._activeBuffer.y+t,a=this._activeBuffer.lines.get(n);a&&(a.fill(e),a.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(e,t){let n=d=>(this._coreService.triggerDataEvent(`${oe.ESC}${d}${oe.ESC}\\`),!0),a=this._bufferService.buffer,o=this._optionsService.rawOptions;return n(e==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:e==='"p'?'P1$r61;1"p':e==="r"?`P1$r${a.scrollTop+1};${a.scrollBottom+1}r`:e==="m"?"P1$r0m":e===" q"?`P1$r${{block:2,underline:4,bar:6}[o.cursorStyle]-(o.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(e,t){this._dirtyRowTracker.markRangeDirty(e,t)}},Dp=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,t){e>t&&(jS=e,e=t,t=jS),e<this.start&&(this.start=e),t>this.end&&(this.end=t)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};Dp=Ht([ye(0,Oi)],Dp);function HS(e){return 0<=e&&e<256}var SD=5e7,US=12,bD=50,wD=class extends We{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 _e),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(e,t){if(t!==void 0&&this._syncCalls>t){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 n;for(;n=this._writeBuffer.shift();){this._action(n);let a=this._callbacks.shift();a&&a()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(e,t){if(this._pendingData>SD)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(t),this._innerWrite();return}setTimeout(()=>this._innerWrite())}this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(t)}_innerWrite(e=0,t=!0){let n=e||performance.now();for(;this._writeBuffer.length>this._bufferOffset;){let a=this._writeBuffer[this._bufferOffset],o=this._action(a,t);if(o){let d=p=>performance.now()-n>=US?setTimeout(()=>this._innerWrite(0,p)):this._innerWrite(n,p);o.catch(p=>(queueMicrotask(()=>{throw p}),Promise.resolve(!1))).then(d);return}let c=this._callbacks[this._bufferOffset];if(c&&c(),this._bufferOffset++,this._pendingData-=a.length,performance.now()-n>=US)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>bD&&(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()}},Rp=class{constructor(e){this._bufferService=e,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(e){let t=this._bufferService.buffer;if(e.id===void 0){let p=t.addMarker(t.ybase+t.y),m={data:e,id:this._nextId++,lines:[p]};return p.onDispose(()=>this._removeMarkerFromLink(m,p)),this._dataByLinkId.set(m.id,m),m.id}let n=e,a=this._getEntryIdKey(n),o=this._entriesWithId.get(a);if(o)return this.addLineToLink(o.id,t.ybase+t.y),o.id;let c=t.addMarker(t.ybase+t.y),d={id:this._nextId++,key:this._getEntryIdKey(n),data:n,lines:[c]};return c.onDispose(()=>this._removeMarkerFromLink(d,c)),this._entriesWithId.set(d.key,d),this._dataByLinkId.set(d.id,d),d.id}addLineToLink(e,t){let n=this._dataByLinkId.get(e);if(n&&n.lines.every(a=>a.line!==t)){let a=this._bufferService.buffer.addMarker(t);n.lines.push(a),a.onDispose(()=>this._removeMarkerFromLink(n,a))}}getLinkData(e){return this._dataByLinkId.get(e)?.data}_getEntryIdKey(e){return`${e.id};;${e.uri}`}_removeMarkerFromLink(e,t){let n=e.lines.indexOf(t);n!==-1&&(e.lines.splice(n,1),e.lines.length===0&&(e.data.id!==void 0&&this._entriesWithId.delete(e.key),this._dataByLinkId.delete(e.id)))}};Rp=Ht([ye(0,Oi)],Rp);var PS=!1,CD=class extends We{constructor(e){super(),this._windowsWrappingHeuristics=this._register(new La),this._onBinary=this._register(new _e),this.onBinary=this._onBinary.event,this._onData=this._register(new _e),this.onData=this._onData.event,this._onLineFeed=this._register(new _e),this.onLineFeed=this._onLineFeed.event,this._onResize=this._register(new _e),this.onResize=this._onResize.event,this._onWriteParsed=this._register(new _e),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this._register(new _e),this._instantiationService=new $k,this.optionsService=this._register(new sD(e)),this._instantiationService.setService(zi,this.optionsService),this._bufferService=this._register(this._instantiationService.createInstance(xp)),this._instantiationService.setService(Oi,this._bufferService),this._logService=this._register(this._instantiationService.createInstance(Cp)),this._instantiationService.setService(w0,this._logService),this.coreService=this._register(this._instantiationService.createInstance(Ep)),this._instantiationService.setService(Pr,this.coreService),this.coreMouseService=this._register(this._instantiationService.createInstance(Tp)),this._instantiationService.setService(b0,this.coreMouseService),this.unicodeService=this._register(this._instantiationService.createInstance(Br)),this._instantiationService.setService(F2,this.unicodeService),this._charsetService=this._instantiationService.createInstance(oD),this._instantiationService.setService(I2,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(Rp),this._instantiationService.setService(C0,this._oscLinkService),this._inputHandler=this._register(new yD(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this._register(Ei.forward(this._inputHandler.onLineFeed,this._onLineFeed)),this._register(this._inputHandler),this._register(Ei.forward(this._bufferService.onResize,this._onResize)),this._register(Ei.forward(this.coreService.onData,this._onData)),this._register(Ei.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 wD((t,n)=>this._inputHandler.parse(t,n))),this._register(Ei.forward(this._writeBuffer.onWriteParsed,this._onWriteParsed))}get onScroll(){return this._onScrollApi||(this._onScrollApi=this._register(new _e),this._onScroll.event(e=>{this._onScrollApi?.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 t in e)this.optionsService.options[t]=e[t]}write(e,t){this._writeBuffer.write(e,t)}writeSync(e,t){this._logService.logLevel<=3&&!PS&&(this._logService.warn("writeSync is unreliable and will be removed soon."),PS=!0),this._writeBuffer.writeSync(e,t)}input(e,t=!0){this.coreService.triggerDataEvent(e,t)}resize(e,t){isNaN(e)||isNaN(t)||(e=Math.max(e,tw),t=Math.max(t,iw),this._bufferService.resize(e,t))}scroll(e,t=!1){this._bufferService.scroll(e,t)}scrollLines(e,t){this._bufferService.scrollLines(e,t)}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 t=e-this._bufferService.buffer.ydisp;t!==0&&this.scrollLines(t)}registerEscHandler(e,t){return this._inputHandler.registerEscHandler(e,t)}registerDcsHandler(e,t){return this._inputHandler.registerDcsHandler(e,t)}registerCsiHandler(e,t){return this._inputHandler.registerCsiHandler(e,t)}registerOscHandler(e,t){return this._inputHandler.registerOscHandler(e,t)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let e=!1,t=this.optionsService.rawOptions.windowsPty;t&&t.buildNumber!==void 0&&t.buildNumber!==void 0?e=t.backend==="conpty"&&t.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(AS.bind(null,this._bufferService))),e.push(this.registerCsiHandler({final:"H"},()=>(AS(this._bufferService),!1))),this._windowsWrappingHeuristics.value=Tt(()=>{for(let t of e)t.dispose()})}}},xD={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 ED(e,t,n,a){let o={type:0,cancel:!1,key:void 0},c=(e.shiftKey?1:0)|(e.altKey?2:0)|(e.ctrlKey?4:0)|(e.metaKey?8:0);switch(e.keyCode){case 0:e.key==="UIKeyInputUpArrow"?t?o.key=oe.ESC+"OA":o.key=oe.ESC+"[A":e.key==="UIKeyInputLeftArrow"?t?o.key=oe.ESC+"OD":o.key=oe.ESC+"[D":e.key==="UIKeyInputRightArrow"?t?o.key=oe.ESC+"OC":o.key=oe.ESC+"[C":e.key==="UIKeyInputDownArrow"&&(t?o.key=oe.ESC+"OB":o.key=oe.ESC+"[B");break;case 8:o.key=e.ctrlKey?"\b":oe.DEL,e.altKey&&(o.key=oe.ESC+o.key);break;case 9:if(e.shiftKey){o.key=oe.ESC+"[Z";break}o.key=oe.HT,o.cancel=!0;break;case 13:o.key=e.altKey?oe.ESC+oe.CR:oe.CR,o.cancel=!0;break;case 27:o.key=oe.ESC,e.altKey&&(o.key=oe.ESC+oe.ESC),o.cancel=!0;break;case 37:if(e.metaKey)break;c?o.key=oe.ESC+"[1;"+(c+1)+"D":t?o.key=oe.ESC+"OD":o.key=oe.ESC+"[D";break;case 39:if(e.metaKey)break;c?o.key=oe.ESC+"[1;"+(c+1)+"C":t?o.key=oe.ESC+"OC":o.key=oe.ESC+"[C";break;case 38:if(e.metaKey)break;c?o.key=oe.ESC+"[1;"+(c+1)+"A":t?o.key=oe.ESC+"OA":o.key=oe.ESC+"[A";break;case 40:if(e.metaKey)break;c?o.key=oe.ESC+"[1;"+(c+1)+"B":t?o.key=oe.ESC+"OB":o.key=oe.ESC+"[B";break;case 45:!e.shiftKey&&!e.ctrlKey&&(o.key=oe.ESC+"[2~");break;case 46:c?o.key=oe.ESC+"[3;"+(c+1)+"~":o.key=oe.ESC+"[3~";break;case 36:c?o.key=oe.ESC+"[1;"+(c+1)+"H":t?o.key=oe.ESC+"OH":o.key=oe.ESC+"[H";break;case 35:c?o.key=oe.ESC+"[1;"+(c+1)+"F":t?o.key=oe.ESC+"OF":o.key=oe.ESC+"[F";break;case 33:e.shiftKey?o.type=2:e.ctrlKey?o.key=oe.ESC+"[5;"+(c+1)+"~":o.key=oe.ESC+"[5~";break;case 34:e.shiftKey?o.type=3:e.ctrlKey?o.key=oe.ESC+"[6;"+(c+1)+"~":o.key=oe.ESC+"[6~";break;case 112:c?o.key=oe.ESC+"[1;"+(c+1)+"P":o.key=oe.ESC+"OP";break;case 113:c?o.key=oe.ESC+"[1;"+(c+1)+"Q":o.key=oe.ESC+"OQ";break;case 114:c?o.key=oe.ESC+"[1;"+(c+1)+"R":o.key=oe.ESC+"OR";break;case 115:c?o.key=oe.ESC+"[1;"+(c+1)+"S":o.key=oe.ESC+"OS";break;case 116:c?o.key=oe.ESC+"[15;"+(c+1)+"~":o.key=oe.ESC+"[15~";break;case 117:c?o.key=oe.ESC+"[17;"+(c+1)+"~":o.key=oe.ESC+"[17~";break;case 118:c?o.key=oe.ESC+"[18;"+(c+1)+"~":o.key=oe.ESC+"[18~";break;case 119:c?o.key=oe.ESC+"[19;"+(c+1)+"~":o.key=oe.ESC+"[19~";break;case 120:c?o.key=oe.ESC+"[20;"+(c+1)+"~":o.key=oe.ESC+"[20~";break;case 121:c?o.key=oe.ESC+"[21;"+(c+1)+"~":o.key=oe.ESC+"[21~";break;case 122:c?o.key=oe.ESC+"[23;"+(c+1)+"~":o.key=oe.ESC+"[23~";break;case 123:c?o.key=oe.ESC+"[24;"+(c+1)+"~":o.key=oe.ESC+"[24~";break;default:if(e.ctrlKey&&!e.shiftKey&&!e.altKey&&!e.metaKey)e.keyCode>=65&&e.keyCode<=90?o.key=String.fromCharCode(e.keyCode-64):e.keyCode===32?o.key=oe.NUL:e.keyCode>=51&&e.keyCode<=55?o.key=String.fromCharCode(e.keyCode-51+27):e.keyCode===56?o.key=oe.DEL:e.keyCode===219?o.key=oe.ESC:e.keyCode===220?o.key=oe.FS:e.keyCode===221&&(o.key=oe.GS);else if((!n||a)&&e.altKey&&!e.metaKey){let d=xD[e.keyCode]?.[e.shiftKey?1:0];if(d)o.key=oe.ESC+d;else if(e.keyCode>=65&&e.keyCode<=90){let p=e.ctrlKey?e.keyCode-64:e.keyCode+32,m=String.fromCharCode(p);e.shiftKey&&(m=m.toUpperCase()),o.key=oe.ESC+m}else if(e.keyCode===32)o.key=oe.ESC+(e.ctrlKey?oe.NUL:" ");else if(e.key==="Dead"&&e.code.startsWith("Key")){let p=e.code.slice(3,4);e.shiftKey||(p=p.toLowerCase()),o.key=oe.ESC+p,o.cancel=!0}}else n&&!e.altKey&&!e.ctrlKey&&!e.shiftKey&&e.metaKey?e.keyCode===65&&(o.type=1):e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.keyCode>=48&&e.key.length===1?o.key=e.key:e.key&&e.ctrlKey&&(e.key==="_"&&(o.key=oe.US),e.key==="@"&&(o.key=oe.NUL));break}return o}var It=0,TD=class{constructor(e){this._getKey=e,this._array=[],this._insertedValues=[],this._flushInsertedTask=new gu,this._isFlushingInserted=!1,this._deletedIndices=[],this._flushDeletedTask=new gu,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((o,c)=>this._getKey(o)-this._getKey(c)),t=0,n=0,a=new Array(this._array.length+this._insertedValues.length);for(let o=0;o<a.length;o++)n>=this._array.length||this._getKey(e[t])<=this._getKey(this._array[n])?(a[o]=e[t],t++):a[o]=this._array[n++];this._array=a,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 t=this._getKey(e);if(t===void 0||(It=this._search(t),It===-1)||this._getKey(this._array[It])!==t)return!1;do if(this._array[It]===e)return this._deletedIndices.length===0&&this._flushDeletedTask.enqueue(()=>this._flushDeleted()),this._deletedIndices.push(It),!0;while(++It<this._array.length&&this._getKey(this._array[It])===t);return!1}_flushDeleted(){this._isFlushingDeleted=!0;let e=this._deletedIndices.sort((o,c)=>o-c),t=0,n=new Array(this._array.length-e.length),a=0;for(let o=0;o<this._array.length;o++)e[t]===o?t++:n[a++]=this._array[o];this._array=n,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&&(It=this._search(e),!(It<0||It>=this._array.length)&&this._getKey(this._array[It])===e))do yield this._array[It];while(++It<this._array.length&&this._getKey(this._array[It])===e)}forEachByKey(e,t){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(It=this._search(e),!(It<0||It>=this._array.length)&&this._getKey(this._array[It])===e))do t(this._array[It]);while(++It<this._array.length&&this._getKey(this._array[It])===e)}values(){return this._flushCleanupInserted(),this._flushCleanupDeleted(),[...this._array].values()}_search(e){let t=0,n=this._array.length-1;for(;n>=t;){let a=t+n>>1,o=this._getKey(this._array[a]);if(o>e)n=a-1;else if(o<e)t=a+1;else{for(;a>0&&this._getKey(this._array[a-1])===e;)a--;return a}}return t}},yf=0,KS=0,kD=class extends We{constructor(){super(),this._decorations=new TD(e=>e?.marker.line),this._onDecorationRegistered=this._register(new _e),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this._register(new _e),this.onDecorationRemoved=this._onDecorationRemoved.event,this._register(Tt(()=>this.reset()))}get decorations(){return this._decorations.values()}registerDecoration(e){if(e.marker.isDisposed)return;let t=new DD(e);if(t){let n=t.marker.onDispose(()=>t.dispose()),a=t.onDispose(()=>{a.dispose(),t&&(this._decorations.delete(t)&&this._onDecorationRemoved.fire(t),n.dispose())});this._decorations.insert(t),this._onDecorationRegistered.fire(t)}return t}reset(){for(let e of this._decorations.values())e.dispose();this._decorations.clear()}*getDecorationsAtCell(e,t,n){let a=0,o=0;for(let c of this._decorations.getKeyIterator(t))a=c.options.x??0,o=a+(c.options.width??1),e>=a&&e<o&&(!n||(c.options.layer??"bottom")===n)&&(yield c)}forEachDecorationAtCell(e,t,n,a){this._decorations.forEachByKey(t,o=>{yf=o.options.x??0,KS=yf+(o.options.width??1),e>=yf&&e<KS&&(!n||(o.options.layer??"bottom")===n)&&a(o)})}},DD=class extends rr{constructor(e){super(),this.options=e,this.onRenderEmitter=this.add(new _e),this.onRender=this.onRenderEmitter.event,this._onDispose=this.add(new _e),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=At.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this.options.foregroundColor?this._cachedFg=At.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}dispose(){this._onDispose.fire(),super.dispose()}},RD=1e3,MD=class{constructor(e,t=RD){this._renderCallback=e,this._debounceThresholdMS=t,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(e,t,n){this._rowCount=n,e=e!==void 0?e:0,t=t!==void 0?t: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,t):t;let a=performance.now();if(a-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=a,this._innerRefresh();else if(!this._additionalRefreshRequested){let o=a-this._lastRefreshMs,c=this._debounceThresholdMS-o;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout(()=>{this._lastRefreshMs=performance.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0},c)}}_innerRefresh(){if(this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return;let e=Math.max(this._rowStart,0),t=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(e,t)}},IS=20,yu=class extends We{constructor(e,t,n,a){super(),this._terminal=e,this._coreBrowserService=n,this._renderService=a,this._rowColumns=new WeakMap,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce="";let o=this._coreBrowserService.mainDocument;this._accessibilityContainer=o.createElement("div"),this._accessibilityContainer.classList.add("xterm-accessibility"),this._rowContainer=o.createElement("div"),this._rowContainer.setAttribute("role","list"),this._rowContainer.classList.add("xterm-accessibility-tree"),this._rowElements=[];for(let c=0;c<this._terminal.rows;c++)this._rowElements[c]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[c]);if(this._topBoundaryFocusListener=c=>this._handleBoundaryFocus(c,0),this._bottomBoundaryFocusListener=c=>this._handleBoundaryFocus(c,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=o.createElement("div"),this._liveRegion.classList.add("live-region"),this._liveRegion.setAttribute("aria-live","assertive"),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this._register(new MD(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(c=>this._handleResize(c.rows))),this._register(this._terminal.onRender(c=>this._refreshRows(c.start,c.end))),this._register(this._terminal.onScroll(()=>this._refreshRows())),this._register(this._terminal.onA11yChar(c=>this._handleChar(c))),this._register(this._terminal.onLineFeed(()=>this._handleChar(`
27
27
  `))),this._register(this._terminal.onA11yTab(c=>this._handleTab(c))),this._register(this._terminal.onKey(c=>this._handleKey(c.key))),this._register(this._terminal.onBlur(()=>this._clearLiveRegion())),this._register(this._renderService.onDimensionsChange(()=>this._refreshRowsDimensions())),this._register(Le(o,"selectionchange",()=>this._handleSelectionChange())),this._register(this._coreBrowserService.onDprChange(()=>this._refreshRowsDimensions())),this._refreshRowsDimensions(),this._refreshRows(),this._register(Tt(()=>{this._accessibilityContainer.remove(),this._rowElements.length=0}))}_handleTab(e){for(let t=0;t<e;t++)this._handleChar(" ")}_handleChar(e){this._liveRegionLineCount<IS+1&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==e&&(this._charsToAnnounce+=e):this._charsToAnnounce+=e,e===`
28
28
  `&&(this._liveRegionLineCount++,this._liveRegionLineCount===IS+1&&(this._liveRegion.textContent+=Xf.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,t){this._liveRegionDebouncer.refresh(e,t,this._terminal.rows)}_renderRows(e,t){let n=this._terminal.buffer,a=n.lines.length.toString();for(let o=e;o<=t;o++){let c=n.lines.get(n.ydisp+o),d=[],p=c?.translateToString(!0,void 0,void 0,d)||"",m=(n.ydisp+o+1).toString(),f=this._rowElements[o];f&&(p.length===0?(f.textContent=" ",this._rowColumns.set(f,[0,1])):(f.textContent=p,this._rowColumns.set(f,d)),f.setAttribute("aria-posinset",m),f.setAttribute("aria-setsize",a),this._alignRowWidth(f))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(e,t){let n=e.target,a=this._rowElements[t===0?1:this._rowElements.length-2],o=n.getAttribute("aria-posinset"),c=t===0?"1":`${this._terminal.buffer.lines.length}`;if(o===c||e.relatedTarget!==a)return;let d,p;if(t===0?(d=n,p=this._rowElements.pop(),this._rowContainer.removeChild(p)):(d=this._rowElements.shift(),p=n,this._rowContainer.removeChild(d)),d.removeEventListener("focus",this._topBoundaryFocusListener),p.removeEventListener("focus",this._bottomBoundaryFocusListener),t===0){let m=this._createAccessibilityTreeNode();this._rowElements.unshift(m),this._rowContainer.insertAdjacentElement("afterbegin",m)}else{let m=this._createAccessibilityTreeNode();this._rowElements.push(m),this._rowContainer.appendChild(m)}this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._terminal.scrollLines(t===0?-1:1),this._rowElements[t===0?1:this._rowElements.length-2].focus(),e.preventDefault(),e.stopImmediatePropagation()}_handleSelectionChange(){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 t={node:e.anchorNode,offset:e.anchorOffset},n={node:e.focusNode,offset:e.focusOffset};if((t.node.compareDocumentPosition(n.node)&Node.DOCUMENT_POSITION_PRECEDING||t.node===n.node&&t.offset>n.offset)&&([t,n]=[n,t]),t.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(t={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(t.node))return;let a=this._rowElements.slice(-1)[0];if(n.node.compareDocumentPosition(a)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(n={node:a,offset:a.textContent?.length??0}),!this._rowContainer.contains(n.node))return;let o=({node:p,offset:m})=>{let f=p instanceof Text?p.parentNode:p,S=parseInt(f?.getAttribute("aria-posinset"),10)-1;if(isNaN(S))return console.warn("row is invalid. Race condition?"),null;let y=this._rowColumns.get(f);if(!y)return console.warn("columns is null. Race condition?"),null;let b=m<y.length?y[m]:y.slice(-1)[0]+1;return b>=this._terminal.cols&&(++S,b=0),{row:S,column:b}},c=o(t),d=o(n);if(!(!c||!d)){if(c.row>d.row||c.row===d.row&&c.column>=d.column)throw new Error("invalid range");this._terminal.select(c.column,c.row,(d.row-c.row)*this._terminal.cols-c.column+d.column)}}_handleResize(e){this._rowElements[this._rowElements.length-1].removeEventListener("focus",this._bottomBoundaryFocusListener);for(let t=this._rowContainer.children.length;t<this._terminal.rows;t++)this._rowElements[t]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[t]);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){e.style.transform="";let t=e.getBoundingClientRect().width,n=this._rowColumns.get(e)?.slice(-1)?.[0];if(!n)return;let a=n*this._renderService.dimensions.css.cell.width;e.style.transform=`scaleX(${a/t})`}};yu=Ht([ye(1,gm),ye(2,bn),ye(3,wn)],yu);var Mp=class extends We{constructor(e,t,n,a,o){super(),this._element=e,this._mouseService=t,this._renderService=n,this._bufferService=a,this._linkProviderService=o,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this._register(new _e),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this._register(new _e),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this._register(Tt(()=>{Hr(this._linkCacheDisposables),this._linkCacheDisposables.length=0,this._lastMouseEvent=void 0,this._activeProviderReplies?.clear()})),this._register(this._bufferService.onResize(()=>{this._clearCurrentLink(),this._wasResized=!0})),this._register(Le(this._element,"mouseleave",()=>{this._isMouseOut=!0,this._clearCurrentLink()})),this._register(Le(this._element,"mousemove",this._handleMouseMove.bind(this))),this._register(Le(this._element,"mousedown",this._handleMouseDown.bind(this))),this._register(Le(this._element,"mouseup",this._handleMouseUp.bind(this)))}get currentLink(){return this._currentLink}_handleMouseMove(e){this._lastMouseEvent=e;let t=this._positionFromMouseEvent(e,this._element,this._mouseService);if(!t)return;this._isMouseOut=!1;let n=e.composedPath();for(let a=0;a<n.length;a++){let o=n[a];if(o.classList.contains("xterm"))break;if(o.classList.contains("xterm-hover"))return}(!this._lastBufferCell||t.x!==this._lastBufferCell.x||t.y!==this._lastBufferCell.y)&&(this._handleHover(t),this._lastBufferCell=t)}_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,t){(!this._activeProviderReplies||!t)&&(this._activeProviderReplies?.forEach(a=>{a?.forEach(o=>{o.link.dispose&&o.link.dispose()})}),this._activeProviderReplies=new Map,this._activeLine=e.y);let n=!1;for(let[a,o]of this._linkProviderService.linkProviders.entries())t?this._activeProviderReplies?.get(a)&&(n=this._checkLinkProviderResult(a,e,n)):o.provideLinks(e.y,c=>{if(this._isMouseOut)return;let d=c?.map(p=>({link:p}));this._activeProviderReplies?.set(a,d),n=this._checkLinkProviderResult(a,e,n),this._activeProviderReplies?.size===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(e.y,this._activeProviderReplies)})}_removeIntersectingLinks(e,t){let n=new Set;for(let a=0;a<t.size;a++){let o=t.get(a);if(o)for(let c=0;c<o.length;c++){let d=o[c],p=d.link.range.start.y<e?0:d.link.range.start.x,m=d.link.range.end.y>e?this._bufferService.cols:d.link.range.end.x;for(let f=p;f<=m;f++){if(n.has(f)){o.splice(c--,1);break}n.add(f)}}}}_checkLinkProviderResult(e,t,n){if(!this._activeProviderReplies)return n;let a=this._activeProviderReplies.get(e),o=!1;for(let c=0;c<e;c++)(!this._activeProviderReplies.has(c)||this._activeProviderReplies.get(c))&&(o=!0);if(!o&&a){let c=a.find(d=>this._linkAtPosition(d.link,t));c&&(n=!0,this._handleNewLink(c))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!n)for(let c=0;c<this._activeProviderReplies.size;c++){let d=this._activeProviderReplies.get(c)?.find(p=>this._linkAtPosition(p.link,t));if(d){n=!0,this._handleNewLink(d);break}}return n}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(e){if(!this._currentLink)return;let t=this._positionFromMouseEvent(e,this._element,this._mouseService);t&&this._mouseDownLink&&AD(this._mouseDownLink.link,this._currentLink.link)&&this._linkAtPosition(this._currentLink.link,t)&&this._currentLink.link.activate(e,this._currentLink.link.text)}_clearCurrentLink(e,t){!this._currentLink||!this._lastMouseEvent||(!e||!t||this._currentLink.link.range.start.y>=e&&this._currentLink.link.range.end.y<=t)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,Hr(this._linkCacheDisposables),this._linkCacheDisposables.length=0)}_handleNewLink(e){if(!this._lastMouseEvent)return;let t=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);t&&this._linkAtPosition(e.link,t)&&(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:()=>this._currentLink?.state?.decorations.pointerCursor,set:n=>{this._currentLink?.state&&this._currentLink.state.decorations.pointerCursor!==n&&(this._currentLink.state.decorations.pointerCursor=n,this._currentLink.state.isHovered&&this._element.classList.toggle("xterm-cursor-pointer",n))}},underline:{get:()=>this._currentLink?.state?.decorations.underline,set:n=>{this._currentLink?.state&&this._currentLink?.state?.decorations.underline!==n&&(this._currentLink.state.decorations.underline=n,this._currentLink.state.isHovered&&this._fireUnderlineEvent(e.link,n))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange(n=>{if(!this._currentLink)return;let a=n.start===0?0:n.start+1+this._bufferService.buffer.ydisp,o=this._bufferService.buffer.ydisp+1+n.end;if(this._currentLink.link.range.start.y>=a&&this._currentLink.link.range.end.y<=o&&(this._clearCurrentLink(a,o),this._lastMouseEvent)){let c=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);c&&this._askForLink(c,!1)}})))}_linkHover(e,t,n){this._currentLink?.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(t,!0),this._currentLink.state.decorations.pointerCursor&&e.classList.add("xterm-cursor-pointer")),t.hover&&t.hover(n,t.text)}_fireUnderlineEvent(e,t){let n=e.range,a=this._bufferService.buffer.ydisp,o=this._createLinkUnderlineEvent(n.start.x-1,n.start.y-a-1,n.end.x,n.end.y-a-1,void 0);(t?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(o)}_linkLeave(e,t,n){this._currentLink?.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(t,!1),this._currentLink.state.decorations.pointerCursor&&e.classList.remove("xterm-cursor-pointer")),t.leave&&t.leave(n,t.text)}_linkAtPosition(e,t){let n=e.range.start.y*this._bufferService.cols+e.range.start.x,a=e.range.end.y*this._bufferService.cols+e.range.end.x,o=t.y*this._bufferService.cols+t.x;return n<=o&&o<=a}_positionFromMouseEvent(e,t,n){let a=n.getCoords(e,t,this._bufferService.cols,this._bufferService.rows);if(a)return{x:a[0],y:a[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(e,t,n,a,o){return{x1:e,y1:t,x2:n,y2:a,cols:this._bufferService.cols,fg:o}}};Mp=Ht([ye(1,ym),ye(2,wn),ye(3,Oi),ye(4,E0)],Mp);function AD(e,t){return e.text===t.text&&e.range.start.x===t.range.start.x&&e.range.start.y===t.range.start.y&&e.range.end.x===t.range.end.x&&e.range.end.y===t.range.end.y}var ND=class extends CD{constructor(e={}){super(e),this._linkifier=this._register(new La),this.browser=q0,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this._register(new La),this._onCursorMove=this._register(new _e),this.onCursorMove=this._onCursorMove.event,this._onKey=this._register(new _e),this.onKey=this._onKey.event,this._onRender=this._register(new _e),this.onRender=this._onRender.event,this._onSelectionChange=this._register(new _e),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this._register(new _e),this.onTitleChange=this._onTitleChange.event,this._onBell=this._register(new _e),this.onBell=this._onBell.event,this._onFocus=this._register(new _e),this._onBlur=this._register(new _e),this._onA11yCharEmitter=this._register(new _e),this._onA11yTabEmitter=this._register(new _e),this._onWillOpen=this._register(new _e),this._setup(),this._decorationService=this._instantiationService.createInstance(kD),this._instantiationService.setService(xo,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(bk),this._instantiationService.setService(E0,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(Zf)),this._register(this._inputHandler.onRequestBell(()=>this._onBell.fire())),this._register(this._inputHandler.onRequestRefreshRows(t=>this.refresh(t?.start??0,t?.end??this.rows-1))),this._register(this._inputHandler.onRequestSendFocus(()=>this._reportFocus())),this._register(this._inputHandler.onRequestReset(()=>this.reset())),this._register(this._inputHandler.onRequestWindowsOptionsReport(t=>this._reportWindowsOptions(t))),this._register(this._inputHandler.onColor(t=>this._handleColorEvent(t))),this._register(Ei.forward(this._inputHandler.onCursorMove,this._onCursorMove)),this._register(Ei.forward(this._inputHandler.onTitleChange,this._onTitleChange)),this._register(Ei.forward(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this._register(Ei.forward(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this._register(this._bufferService.onResize(t=>this._afterResize(t.cols,t.rows))),this._register(Tt(()=>{this._customKeyEventHandler=void 0,this.element?.parentNode?.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 t of e){let n,a="";switch(t.index){case 256:n="foreground",a="10";break;case 257:n="background",a="11";break;case 258:n="cursor",a="12";break;default:n="ansi",a="4;"+t.index}switch(t.type){case 0:let o=xt.toColorRGB(n==="ansi"?this._themeService.colors.ansi[t.index]:this._themeService.colors[n]);this.coreService.triggerDataEvent(`${oe.ESC}]${a};${vD(o)}${I0.ST}`);break;case 1:if(n==="ansi")this._themeService.modifyColors(c=>c.ansi[t.index]=Qt.toColor(...t.color));else{let c=n;this._themeService.modifyColors(d=>d[c]=Qt.toColor(...t.color))}break;case 2:this._themeService.restoreColor(t.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(yu,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(e){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(oe.ESC+"[I"),this.element.classList.add("focus"),this._showCursor(),this._onFocus.fire()}blur(){return this.textarea?.blur()}_handleTextAreaBlur(){this.textarea.value="",this.refresh(this.buffer.y,this.buffer.y),this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(oe.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,t=this.buffer.lines.get(e);if(!t)return;let n=Math.min(this.buffer.x,this.cols-1),a=this._renderService.dimensions.css.cell.height,o=t.getWidth(n),c=this._renderService.dimensions.css.cell.width*o,d=this.buffer.y*this._renderService.dimensions.css.cell.height,p=n*this._renderService.dimensions.css.cell.width;this.textarea.style.left=p+"px",this.textarea.style.top=d+"px",this.textarea.style.width=c+"px",this.textarea.style.height=a+"px",this.textarea.style.lineHeight=a+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this._register(Le(this.element,"copy",t=>{this.hasSelection()&&z2(t,this._selectionService)}));let e=t=>j2(t,this.textarea,this.coreService,this.optionsService);this._register(Le(this.textarea,"paste",e)),this._register(Le(this.element,"paste",e)),W0?this._register(Le(this.element,"mousedown",t=>{t.button===2&&Qy(t,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})):this._register(Le(this.element,"contextmenu",t=>{Qy(t,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})),km&&this._register(Le(this.element,"auxclick",t=>{t.button===1&&_0(t,this.textarea,this.screenElement)}))}_bindKeys(){this._register(Le(this.textarea,"keyup",e=>this._keyUp(e),!0)),this._register(Le(this.textarea,"keydown",e=>this._keyDown(e),!0)),this._register(Le(this.textarea,"keypress",e=>this._keyPress(e),!0)),this._register(Le(this.textarea,"compositionstart",()=>this._compositionHelper.compositionstart())),this._register(Le(this.textarea,"compositionupdate",e=>this._compositionHelper.compositionupdate(e))),this._register(Le(this.textarea,"compositionend",()=>this._compositionHelper.compositionend())),this._register(Le(this.textarea,"input",e=>this._inputEvent(e),!0)),this._register(this.onRender(()=>this._compositionHelper.updateCompositionElements()))}open(e){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"),this.element?.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 t=this._document.createDocumentFragment();this._viewportElement=this._document.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),t.appendChild(this._viewportElement),this.screenElement=this._document.createElement("div"),this.screenElement.classList.add("xterm-screen"),this._register(Le(this.screenElement,"mousemove",o=>this.updateCursorStyle(o))),this._helperContainer=this._document.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),t.appendChild(this.screenElement);let n=this.textarea=this._document.createElement("textarea");this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",Vf.get()),V0||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",()=>n.readOnly=this.optionsService.rawOptions.disableStdin)),this.textarea.readOnly=this.optionsService.rawOptions.disableStdin,this._coreBrowserService=this._register(this._instantiationService.createInstance(yk,this.textarea,e.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(bn,this._coreBrowserService),this._register(Le(this.textarea,"focus",o=>this._handleTextAreaFocus(o))),this._register(Le(this.textarea,"blur",()=>this._handleTextAreaBlur())),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(gp,this._document,this._helperContainer),this._instantiationService.setService(Nu,this._charSizeService),this._themeService=this._instantiationService.createInstance(wp),this._instantiationService.setService(Ha,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(_u),this._instantiationService.setService(x0,this._characterJoinerService),this._renderService=this._register(this._instantiationService.createInstance(Sp,this.rows,this.screenElement)),this._instantiationService.setService(wn,this._renderService),this._register(this._renderService.onRenderedViewportChange(o=>this._onRender.fire(o))),this.onResize(o=>this._renderService.resize(o.cols,o.rows)),this._compositionView=this._document.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(mp,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(yp),this._instantiationService.setService(ym,this._mouseService);let a=this._linkifier.value=this._register(this._instantiationService.createInstance(Mp,this.screenElement));this.element.appendChild(t);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(fp,this.element,this.screenElement)),this._register(this._viewport.onRequestScrollLines(o=>{super.scrollLines(o,!1),this.refresh(0,this.rows-1)})),this._selectionService=this._register(this._instantiationService.createInstance(bp,this.element,this.screenElement,a)),this._instantiationService.setService(W2,this._selectionService),this._register(this._selectionService.onRequestScrollLines(o=>this.scrollLines(o.amount,o.suppressScrollEvent))),this._register(this._selectionService.onSelectionChange(()=>this._onSelectionChange.fire())),this._register(this._selectionService.onRequestRedraw(o=>this._renderService.handleSelectionChanged(o.start,o.end,o.columnSelectMode))),this._register(this._selectionService.onLinuxMouseSelection(o=>{this.textarea.value=o,this.textarea.focus(),this.textarea.select()})),this._register(Ei.any(this._onScroll.event,this._inputHandler.onScroll)(()=>{this._selectionService.refresh(),this._viewport?.queueSync()})),this._register(this._instantiationService.createInstance(pp,this.screenElement)),this._register(Le(this.element,"mousedown",o=>this._selectionService.handleMouseDown(o))),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(yu,this)),this._register(this.optionsService.onSpecificOptionChange("screenReaderMode",o=>this._handleScreenReaderModeOptionChange(o))),this.options.overviewRuler.width&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(mu,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRuler",o=>{!this._overviewRulerRenderer&&o&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(mu,this._viewportElement,this.screenElement)))}),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(vp,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){let e=this,t=this.element;function n(c){let d=e._mouseService.getMouseReportCoords(c,e.screenElement);if(!d)return!1;let p,m;switch(c.overrideType||c.type){case"mousemove":m=32,c.buttons===void 0?(p=3,c.button!==void 0&&(p=c.button<3?c.button:3)):p=c.buttons&1?0:c.buttons&4?1:c.buttons&2?2:3;break;case"mouseup":m=0,p=c.button<3?c.button:3;break;case"mousedown":m=1,p=c.button<3?c.button:3;break;case"wheel":if(e._customWheelEventHandler&&e._customWheelEventHandler(c)===!1)return!1;let f=c.deltaY;if(f===0||e.coreMouseService.consumeWheelEvent(c,e._renderService?.dimensions?.device?.cell?.height,e._coreBrowserService?.dpr)===0)return!1;m=f<0?0:1,p=4;break;default:return!1}return m===void 0||p===void 0||p>4?!1:e.coreMouseService.triggerMouseEvent({col:d.col,row:d.row,x:d.x,y:d.y,button:p,action:m,ctrl:c.ctrlKey,alt:c.altKey,shift:c.shiftKey})}let a={mouseup:null,wheel:null,mousedrag:null,mousemove:null},o={mouseup:c=>(n(c),c.buttons||(this._document.removeEventListener("mouseup",a.mouseup),a.mousedrag&&this._document.removeEventListener("mousemove",a.mousedrag)),this.cancel(c)),wheel:c=>(n(c),this.cancel(c,!0)),mousedrag:c=>{c.buttons&&n(c)},mousemove:c=>{c.buttons||n(c)}};this._register(this.coreMouseService.onProtocolChange(c=>{c?(this.optionsService.rawOptions.logLevel==="debug"&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(c)),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()),c&8?a.mousemove||(t.addEventListener("mousemove",o.mousemove),a.mousemove=o.mousemove):(t.removeEventListener("mousemove",a.mousemove),a.mousemove=null),c&16?a.wheel||(t.addEventListener("wheel",o.wheel,{passive:!1}),a.wheel=o.wheel):(t.removeEventListener("wheel",a.wheel),a.wheel=null),c&2?a.mouseup||(a.mouseup=o.mouseup):(this._document.removeEventListener("mouseup",a.mouseup),a.mouseup=null),c&4?a.mousedrag||(a.mousedrag=o.mousedrag):(this._document.removeEventListener("mousemove",a.mousedrag),a.mousedrag=null)})),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this._register(Le(t,"mousedown",c=>{if(c.preventDefault(),this.focus(),!(!this.coreMouseService.areMouseEventsActive||this._selectionService.shouldForceSelection(c)))return n(c),a.mouseup&&this._document.addEventListener("mouseup",a.mouseup),a.mousedrag&&this._document.addEventListener("mousemove",a.mousedrag),this.cancel(c)})),this._register(Le(t,"wheel",c=>{if(!a.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(c)===!1)return!1;if(!this.buffer.hasScrollback){if(c.deltaY===0)return!1;if(e.coreMouseService.consumeWheelEvent(c,e._renderService?.dimensions?.device?.cell?.height,e._coreBrowserService?.dpr)===0)return this.cancel(c,!0);let d=oe.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(c.deltaY<0?"A":"B");return this.coreService.triggerDataEvent(d,!0),this.cancel(c,!0)}}},{passive:!1}))}refresh(e,t){this._renderService?.refreshRows(e,t)}updateCursorStyle(e){this._selectionService?.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,t){this._viewport?this._viewport.scrollLines(e):super.scrollLines(e,t),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 t=e-this._bufferService.buffer.ydisp;t!==0&&this.scrollLines(t)}paste(e){m0(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 t=this._characterJoinerService.register(e);return this.refresh(0,this.rows-1),t}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,t,n){this._selectionService.setSelection(e,t,n)}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(){this._selectionService?.clearSelection()}selectAll(){this._selectionService?.selectAll()}selectLines(e,t){this._selectionService?.selectLines(e,t)}_keyDown(e){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)return!1;let t=this.browser.isMac&&this.options.macOptionIsMeta&&e.altKey;if(!t&&!this._compositionHelper.keydown(e))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(!0),!1;!t&&(e.key==="Dead"||e.key==="AltGraph")&&(this._unprocessedDeadKey=!0);let n=ED(e,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(e),n.type===3||n.type===2){let a=this.rows-1;return this.scrollLines(n.type===2?-a:a),this.cancel(e,!0)}if(n.type===1&&this.selectAll(),this._isThirdLevelShift(this.browser,e)||(n.cancel&&this.cancel(e,!0),!n.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((n.key===oe.ETX||n.key===oe.CR)&&(this.textarea.value=""),this._onKey.fire({key:n.key,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(n.key,!0),!this.optionsService.rawOptions.screenReaderMode||e.altKey||e.ctrlKey)return this.cancel(e,!0);this._keyDownHandled=!0}_isThirdLevelShift(e,t){let n=e.isMac&&!this.options.macOptionIsMeta&&t.altKey&&!t.ctrlKey&&!t.metaKey||e.isWindows&&t.altKey&&t.ctrlKey&&!t.metaKey||e.isWindows&&t.getModifierState("AltGraph");return t.type==="keypress"?n:n&&(!t.keyCode||t.keyCode>47)}_keyUp(e){this._keyDownSeen=!1,!(this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)&&(BD(e)||this.focus(),this.updateCursorStyle(e),this._keyPressHandled=!1)}_keyPress(e){let t;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)return!1;if(this.cancel(e),e.charCode)t=e.charCode;else if(e.which===null||e.which===void 0)t=e.keyCode;else if(e.which!==0&&e.charCode!==0)t=e.which;else return!1;return!t||(e.altKey||e.ctrlKey||e.metaKey)&&!this._isThirdLevelShift(this.browser,e)?!1:(t=String.fromCharCode(t),this._onKey.fire({key:t,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(t,!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 t=e.data;return this.coreService.triggerDataEvent(t,!0),this.cancel(e),!0}return!1}resize(e,t){if(e===this.cols&&t===this.rows){this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure();return}super.resize(e,t)}_afterResize(e,t){this._charSizeService?.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(Zt));this._onScroll.fire({position:this.buffer.ydisp}),this.refresh(0,this.rows-1)}}reset(){this.options.rows=this.rows,this.options.cols=this.cols;let e=this._customKeyEventHandler;this._setup(),super.reset(),this._selectionService?.reset(),this._decorationService.reset(),this._customKeyEventHandler=e,this.refresh(0,this.rows-1)}clearTextureAtlas(){this._renderService?.clearTextureAtlas()}_reportFocus(){this.element?.classList.contains("focus")?this.coreService.triggerDataEvent(oe.ESC+"[I"):this.coreService.triggerDataEvent(oe.ESC+"[O")}_reportWindowsOptions(e){if(this._renderService)switch(e){case 0:let t=this._renderService.dimensions.css.canvas.width.toFixed(0),n=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${oe.ESC}[4;${n};${t}t`);break;case 1:let a=this._renderService.dimensions.css.cell.width.toFixed(0),o=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${oe.ESC}[6;${o};${a}t`);break}}cancel(e,t){if(!(!this.options.cancelEvents&&!t))return e.preventDefault(),e.stopPropagation(),!1}};function BD(e){return e.keyCode===16||e.keyCode===17||e.keyCode===18}var LD=class{constructor(){this._addons=[]}dispose(){for(let e=this._addons.length-1;e>=0;e--)this._addons[e].instance.dispose()}loadAddon(e,t){let n={instance:t,dispose:t.dispose,isDisposed:!1};this._addons.push(n),t.dispose=()=>this._wrappedAddonDispose(n),t.activate(e)}_wrappedAddonDispose(e){if(e.isDisposed)return;let t=-1;for(let n=0;n<this._addons.length;n++)if(this._addons[n]===e){t=n;break}if(t===-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(t,1)}},OD=class{constructor(e){this._line=e}get isWrapped(){return this._line.isWrapped}get length(){return this._line.length}getCell(e,t){if(!(e<0||e>=this._line.length))return t?(this._line.loadCell(e,t),t):this._line.loadCell(e,new xs)}translateToString(e,t,n){return this._line.translateToString(e,t,n)}},FS=class{constructor(e,t){this._buffer=e,this.type=t}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 t=this._buffer.lines.get(e);if(t)return new OD(t)}getNullCell(){return new xs}},zD=class extends We{constructor(e){super(),this._core=e,this._onBufferChange=this._register(new _e),this.onBufferChange=this._onBufferChange.event,this._normal=new FS(this._core.buffers.normal,"normal"),this._alternate=new FS(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)}},jD=class{constructor(e){this._core=e}registerCsiHandler(e,t){return this._core.registerCsiHandler(e,n=>t(n.toArray()))}addCsiHandler(e,t){return this.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._core.registerDcsHandler(e,(n,a)=>t(n,a.toArray()))}addDcsHandler(e,t){return this.registerDcsHandler(e,t)}registerEscHandler(e,t){return this._core.registerEscHandler(e,t)}addEscHandler(e,t){return this.registerEscHandler(e,t)}registerOscHandler(e,t){return this._core.registerOscHandler(e,t)}addOscHandler(e,t){return this.registerOscHandler(e,t)}},HD=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}},UD=["cols","rows"],Is=0,PD=class extends We{constructor(e){super(),this._core=this._register(new ND(e)),this._addonManager=this._register(new LD),this._publicOptions={...this._core.options};let t=a=>this._core.options[a],n=(a,o)=>{this._checkReadonlyOptions(a),this._core.options[a]=o};for(let a in this._core.options){let o={get:t.bind(this,a),set:n.bind(this,a)};Object.defineProperty(this._publicOptions,a,o)}}_checkReadonlyOptions(e){if(UD.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 jD(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new HD(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 zD(this._core))),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){let e=this._core.coreService.decPrivateModes,t="none";switch(this._core.coreMouseService.activeProtocol){case"X10":t="x10";break;case"VT200":t="vt200";break;case"DRAG":t="drag";break;case"ANY":t="any";break}return{applicationCursorKeysMode:e.applicationCursorKeys,applicationKeypadMode:e.applicationKeypad,bracketedPasteMode:e.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:t,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 t in e)this._publicOptions[t]=e[t]}blur(){this._core.blur()}focus(){this._core.focus()}input(e,t=!0){this._core.input(e,t)}resize(e,t){this._verifyIntegers(e,t),this._core.resize(e,t)}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,t,n){this._verifyIntegers(e,t,n),this._core.select(e,t,n)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(e,t){this._verifyIntegers(e,t),this._core.selectLines(e,t)}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,t){this._core.write(e,t)}writeln(e,t){this._core.write(e),this._core.write(`\r
29
29
  `,t)}paste(e){this._core.paste(e)}refresh(e,t){this._verifyIntegers(e,t),this._core.refresh(e,t)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(e){this._addonManager.loadAddon(this,e)}static get strings(){return{get promptLabel(){return Vf.get()},set promptLabel(e){Vf.set(e)},get tooMuchOutput(){return Xf.get()},set tooMuchOutput(e){Xf.set(e)}}}_verifyIntegers(...e){for(Is of e)if(Is===1/0||isNaN(Is)||Is%1!==0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...e){for(Is of e)if(Is&&(Is===1/0||isNaN(Is)||Is%1!==0||Is<0))throw new Error("This API only accepts positive integers")}};class KD{pending=null;accept(t){let n="";for(const a of t)n+=this.acceptChar(a);return n}acceptChar(t){return t===""?this.acceptBackspace():lw.has(t)?this.acceptConsonant(t):ow.has(t)?this.acceptVowel(t):WD(t)&&this.canReplacePendingWith(t)?(this.pending=WS(t),""):this.flushPending()+t}acceptConsonant(t){if(!this.pending)return this.pending={initial:t},"";if(!this.pending.vowel){const o=this.flushPending();return this.pending={initial:t},o}if(!this.pending.final){if(cw.has(t))return this.pending.final=t,"";const o=this.flushPending();return this.pending={initial:t},o}const n=qD.get(`${this.pending.final}${t}`);if(n)return this.pending.final=n,"";const a=this.flushPending();return this.pending={initial:t},a}acceptVowel(t){if(!this.pending)return t;if(!this.pending.vowel)return this.pending.vowel=t,"";if(!this.pending.final){const c=FD.get(`${this.pending.vowel}${t}`);return c?(this.pending.vowel=c,""):this.flushPending()+t}const n=qS.get(this.pending.final);if(n){this.pending.final=n[0];const c=this.flushPending();return this.pending={initial:n[1],vowel:t},c}const a=this.pending.final,o=YS({initial:this.pending.initial,vowel:this.pending.vowel});return this.pending={initial:a,vowel:t},o}acceptBackspace(){if(!this.pending)return"";if(this.pending.final){const t=qS.get(this.pending.final);return t?this.pending.final=t[0]:delete this.pending.final,""}return this.pending.vowel?(delete this.pending.vowel,""):(this.pending=null,"")}canReplacePendingWith(t){if(!this.pending?.initial)return!1;const n=WS(t);return n.initial===this.pending.initial&&(!this.pending.vowel||n.vowel===this.pending.vowel)&&(!this.pending.final||n.final===this.pending.final)}flushPending(){if(!this.pending)return"";const t=YS(this.pending);return this.pending=null,t}}const Su=44032,bu=21,Ra=28,ID=19*bu*Ra,nw=["ㄱ","ㄲ","ㄴ","ㄷ","ㄸ","ㄹ","ㅁ","ㅂ","ㅃ","ㅅ","ㅆ","ㅇ","ㅈ","ㅉ","ㅊ","ㅋ","ㅌ","ㅍ","ㅎ"],rw=["ㅏ","ㅐ","ㅑ","ㅒ","ㅓ","ㅔ","ㅕ","ㅖ","ㅗ","ㅘ","ㅙ","ㅚ","ㅛ","ㅜ","ㅝ","ㅞ","ㅟ","ㅠ","ㅡ","ㅢ","ㅣ"],aw=["","ㄱ","ㄲ","ㄳ","ㄴ","ㄵ","ㄶ","ㄷ","ㄹ","ㄺ","ㄻ","ㄼ","ㄽ","ㄾ","ㄿ","ㅀ","ㅁ","ㅂ","ㅄ","ㅅ","ㅆ","ㅇ","ㅈ","ㅊ","ㅋ","ㅌ","ㅍ","ㅎ"],lw=Dm(nw),ow=Dm(rw),cw=Dm(aw),FD=new Map([["ㅗㅏ","ㅘ"],["ㅗㅐ","ㅙ"],["ㅗㅣ","ㅚ"],["ㅜㅓ","ㅝ"],["ㅜㅔ","ㅞ"],["ㅜㅣ","ㅟ"],["ㅡㅣ","ㅢ"]]),uw=[["ㄱㅅ","ㄳ"],["ㄴㅈ","ㄵ"],["ㄴㅎ","ㄶ"],["ㄹㄱ","ㄺ"],["ㄹㅁ","ㄻ"],["ㄹㅂ","ㄼ"],["ㄹㅅ","ㄽ"],["ㄹㅌ","ㄾ"],["ㄹㅍ","ㄿ"],["ㄹㅎ","ㅀ"],["ㅂㅅ","ㅄ"]],qD=new Map(uw),qS=new Map(uw.map(([e,t])=>[t,[e[0],e[1]]]));function Dm(e){return new Map(e.map((t,n)=>[t,n]))}function WD(e){const t=e.codePointAt(0);return t!==void 0&&t>=Su&&t<Su+ID}function WS(e){const t=e.codePointAt(0)-Su,n=Math.floor(t/(bu*Ra)),a=Math.floor(t%(bu*Ra)/Ra),o=t%Ra,c={initial:nw[n],vowel:rw[a]};return o===0?c:{...c,final:aw[o]}}function YS(e){if(!e.vowel)return e.initial;const t=lw.get(e.initial),n=ow.get(e.vowel),a=e.final?cw.get(e.final):0;return t===void 0||n===void 0||a===void 0?`${e.initial}${e.vowel}${e.final??""}`:String.fromCodePoint(Su+(t*bu+n)*Ra+a)}const YD=[{key:"escape",label:"Esc",ariaLabel:"Send Escape"},{key:"tab",label:"Tab",ariaLabel:"Send Tab"},{key:"arrowLeft",label:"←",ariaLabel:"Send Arrow Left"},{key:"arrowDown",label:"↓",ariaLabel:"Send Arrow Down"},{key:"arrowUp",label:"↑",ariaLabel:"Send Arrow Up"},{key:"arrowRight",label:"→",ariaLabel:"Send Arrow Right"}];function $D({ctrlActive:e,onCtrl:t,onStandaloneKey:n,onPreserveFocus:a,onHide:o}){function c(d){d.stopPropagation(),a()}return _.jsxs("div",{className:"mobile-terminal-key-bar",role:"toolbar","aria-label":"Mobile terminal keys",onMouseDown:c,onPointerDown:c,children:[_.jsx("button",{type:"button",className:"mobile-terminal-key mobile-terminal-key-ctrl","aria-label":"Arm Control modifier","aria-pressed":e,"data-active":e,onClick:t,children:"Ctrl"}),YD.map(d=>_.jsx("button",{type:"button",className:"mobile-terminal-key","aria-label":d.ariaLabel,onClick:()=>n(d.key),children:d.label},d.key)),_.jsx("button",{type:"button",className:"mobile-terminal-key mobile-terminal-key-hide","aria-label":"Hide terminal control keys",title:"Hide",onClick:o,children:"×"})]})}const VD={escape:"\x1B",tab:" ",arrowUp:"\x1B[A",arrowDown:"\x1B[B",arrowRight:"\x1B[C",arrowLeft:"\x1B[D"};function XD(e){return VD[e]}function GD(e){return/^[a-z]$/i.test(e)?String.fromCharCode(e.toUpperCase().charCodeAt(0)-64):null}const ko=new Map,uo=new Map,ZD=Object.freeze({open:!1,text:""});function QD(e){let t=uo.get(e);return t||(t=new Set,uo.set(e,t)),t}function hw(e){const t=uo.get(e);if(t)for(const n of Array.from(t))n()}function Rm(e){return ko.get(e)??ZD}function JD(e,t){const n=QD(e);return n.add(t),()=>{n.delete(t)}}function eR(e,t){const n=Rm(e);n.open!==t&&(ko.set(e,{...n,open:t}),hw(e))}function tR(e,t){const n=Rm(e);n.text!==t&&(ko.set(e,{...n,text:t}),hw(e))}function $S(e){ko.delete(e),uo.delete(e)}function iR(){ko.clear(),uo.clear()}const sR=20;function nR({terminalId:e,onSubmit:t,disabled:n=!1}){const a=g.useMemo(()=>b=>JD(e,b),[e]),o=g.useMemo(()=>()=>Rm(e),[e]),c=g.useSyncExternalStore(a,o,o),{open:d,text:p}=c,m=g.useRef(null);g.useEffect(()=>{d&&m.current?.focus()},[d]);function f(b){eR(e,b)}function S(b){tR(e,b)}function y(){if(n||!p)return;const b=p.replace(/\r\n/g,`
30
- `).replace(/\n/g,"\r");b&&t(b),window.setTimeout(()=>t("\r"),sR),S(""),m.current?.focus()}return d?_.jsxs("div",{className:"compose-drawer compose-drawer--open",children:[_.jsxs("button",{type:"button",className:"compose-drawer-header","aria-label":"Collapse compose drawer",title:"Click to collapse — Esc also closes when focus is in the textarea",onClick:()=>f(!1),children:[_.jsx("span",{"aria-hidden":"true",children:"▾"}),_.jsx("span",{className:"compose-drawer-title",children:"compose"}),_.jsx("span",{className:"compose-drawer-hint","aria-hidden":"true",children:"Cmd/Ctrl+Enter to send · Enter for newline · Esc to close"}),_.jsx("span",{className:"compose-drawer-close","aria-hidden":"true",children:"×"})]}),_.jsx("textarea",{ref:m,className:"compose-drawer-input","aria-label":"Compose input",spellCheck:!1,autoCorrect:"off",autoCapitalize:"off",value:p,onChange:b=>S(b.target.value),onKeyDown:b=>{if(b.key==="Enter"&&(b.metaKey||b.ctrlKey)){b.preventDefault(),y();return}b.key==="Escape"&&(b.preventDefault(),f(!1))},placeholder:"Type a longer command here, then Cmd/Ctrl+Enter to send."}),_.jsxs("div",{className:"compose-drawer-actions",children:[_.jsx("button",{type:"button",className:"compose-drawer-clear",onClick:()=>{S(""),m.current?.focus()},disabled:!p,children:"Clear"}),_.jsx("button",{type:"button",className:"compose-drawer-send",onClick:y,disabled:n||!p,children:"Send"})]})]}):_.jsx("div",{className:"compose-drawer compose-drawer--closed",children:_.jsxs("button",{type:"button",className:"compose-drawer-handle","aria-label":"Open compose drawer",title:"Compose long input — type without per-keystroke latency, send with Cmd/Ctrl+Enter",onClick:()=>f(!0),children:[_.jsx("span",{"aria-hidden":"true",children:"▴"}),_.jsx("span",{children:"compose"}),p?_.jsx("span",{className:"compose-drawer-handle-dot","aria-label":"draft saved"}):null]})})}function rR(e){e.attachCustomKeyEventHandler(o=>{if(aR(o)){const c=VS(e);return c?(o.preventDefault(),o.stopPropagation(),XS(c),!1):!0}return lR(o)?(o.preventDefault(),o.stopPropagation(),oR(e),!1):!0});const t=e.element;if(!t)return{dispose(){e.attachCustomKeyEventHandler(()=>!0)}};const n=o=>{const c=VS(e);if(c){if(o.clipboardData){o.clipboardData.setData("text/plain",c),o.preventDefault();return}o.preventDefault(),XS(c)}},a=o=>{const c=o.clipboardData?.getData("text/plain");if(c===void 0)return;const d=dw(c);d!==c&&(o.preventDefault(),o.stopImmediatePropagation(),e.paste(d))};return t.addEventListener("copy",n,!0),t.addEventListener("paste",a,!0),{dispose(){t.removeEventListener("copy",n,!0),t.removeEventListener("paste",a,!0),e.attachCustomKeyEventHandler(()=>!0)}}}function aR(e){return e.type!=="keydown"||e.altKey||e.key.toLowerCase()!=="c"?!1:e.metaKey&&!e.ctrlKey&&!e.shiftKey||e.ctrlKey&&e.shiftKey&&!e.metaKey?!0:e.ctrlKey&&!e.shiftKey&&!e.metaKey}function lR(e){return e.type!=="keydown"||e.altKey||e.key.toLowerCase()!=="v"?!1:e.metaKey&&!e.ctrlKey&&!e.shiftKey||e.ctrlKey&&e.shiftKey&&!e.metaKey?!0:e.ctrlKey&&!e.shiftKey&&!e.metaKey}async function oR(e){if(navigator.clipboard?.readText)try{const t=await navigator.clipboard.readText();if(!t)return;e.paste(dw(t))}catch{}}function VS(e){return e.hasSelection()?e.getSelection():""}function dw(e){return e.replace(/(?:\r\n|\r|\n)+$/,"")}async function XS(e){if(navigator.clipboard?.writeText)try{await navigator.clipboard.writeText(e);return}catch{}cR(e)}function cR(e){const t=document.activeElement instanceof HTMLElement?document.activeElement:null,n=document.createElement("textarea");n.value=e,n.setAttribute("readonly","true"),n.style.position="fixed",n.style.left="-9999px",n.style.top="0",n.style.opacity="0",document.body.appendChild(n),n.focus({preventScroll:!0}),n.select();try{typeof document.execCommand=="function"&&document.execCommand("copy")}finally{n.remove(),t?.focus({preventScroll:!0})}}const uR=[4,10,11,12];function hR(e,t){const n=[e.parser.registerCsiHandler({final:"c"},a=>GS(a)),e.parser.registerCsiHandler({prefix:">",final:"c"},a=>GS(a)),e.parser.registerCsiHandler({final:"n"},a=>dR(a)),e.parser.registerCsiHandler({prefix:"?",final:"n"},a=>fR(a)),e.parser.registerCsiHandler({final:"t"},a=>pR(a)),e.parser.registerDcsHandler({intermediates:"$",final:"q"},()=>!0),...uR.map(a=>e.parser.registerOscHandler(a,o=>mR(o)))];return{dispose(){for(const a of n)a.dispose()}}}function GS(e){return Ou(e)===0}function dR(e){const t=Ou(e);return t===5||t===6}function fR(e){return Ou(e)===6}function pR(e){const t=Ou(e);return t===14||t===16||t===18}function mR(e){return e.split(";").some(t=>t==="?")}function Ou(e){const t=e[0];return typeof t=="number"?t:0}const ho=new Map,_R=2*1024*1024,vR=1500,gR=25e3;function yR(e,t){let n=ho.get(e);n||(n=SR(e),ho.set(e,n),fw(n)),n.listeners.add(t);const a=c=>CR(n,c),o=()=>{n.listeners.delete(t)};return{status:n.status,snapshot:n.snapshot,output:n.output.slice(),history:n.history,send:a,detach:o}}function Ap(e){const t=ho.get(e);t&&(xR(t),ho.delete(e))}function ZS(){for(const e of Array.from(ho.keys()))Ap(e)}function SR(e){return{url:e,socket:null,status:"connecting",snapshot:null,output:[],history:null,outputBytes:0,pendingOut:[],listeners:new Set,reconnectTimer:null,reconnectEnabled:!0,heartbeat:null,isAlive:!1,exited:!1}}function fw(e){if(!e.reconnectEnabled)return;Hl(e,e.socket===null&&e.status!=="reconnecting"?"connecting":"reconnecting");const t=new WebSocket(e.url);e.socket=t,e.isAlive=!1,t.addEventListener("open",()=>{if(e.socket===t){Hl(e,"connected");for(const n of e.pendingOut)t.send(JSON.stringify(n));e.pendingOut.length=0,e.isAlive=!0,bR(e)}}),t.addEventListener("message",n=>{if(e.socket!==t)return;const a=typeof n.data=="string"?n.data:"";if(!a)return;let o=null;try{o=JSON.parse(a)}catch{return}if(!(!o||typeof o.type!="string")){if(o.type==="pong"){e.isAlive=!0;return}wR(e,o),pw(e,{type:"message",message:o})}}),t.addEventListener("close",n=>{if(e.socket===t){if(e.socket=null,Mm(e),n.code===1008){e.reconnectEnabled=!1,Hl(e,"unauthorized");return}if(e.exited||!e.reconnectEnabled){Hl(e,"closed");return}Hl(e,"reconnecting"),e.reconnectTimer=window.setTimeout(()=>{e.reconnectTimer=null,fw(e)},vR)}}),t.addEventListener("error",()=>{})}function bR(e){Mm(e),e.heartbeat=window.setInterval(()=>{const t=e.socket;if(!(!t||t.readyState!==WebSocket.OPEN)){if(!e.isAlive){t.close();return}e.isAlive=!1,t.send(JSON.stringify({type:"ping",nonce:Date.now().toString(36)}))}},gR)}function Mm(e){e.heartbeat!==null&&(window.clearInterval(e.heartbeat),e.heartbeat=null)}function wR(e,t){if(t.type==="snapshot"){e.snapshot=t.terminal,e.output=t.output.slice(),e.history=t.history??null,e.outputBytes=e.output.reduce((n,a)=>n+a.length,0),e.exited=t.terminal.status==="exited",QS(e);return}if(t.type==="output"){e.output.push(t.data),e.outputBytes+=t.data.length,QS(e);return}if(t.type==="terminal_updated"){e.snapshot=t.terminal,t.terminal.status==="exited"&&(e.exited=!0);return}if(t.type==="exit"){e.exited=!0,e.snapshot&&e.snapshot.id===t.terminalId&&(e.snapshot={...e.snapshot,status:"exited",exitCode:t.exitCode});return}}function QS(e){for(;e.outputBytes>_R&&e.output.length>1;){const t=e.output.shift();e.outputBytes-=t.length}}function Hl(e,t){e.status!==t&&(e.status=t,pw(e,{type:"status",status:t}))}function pw(e,t){for(const n of Array.from(e.listeners))n(t)}function CR(e,t){const n=e.socket;return n&&n.readyState===WebSocket.OPEN?(n.send(JSON.stringify(t)),!0):(t.type==="input"&&e.pendingOut.push(t),!1)}function xR(e){e.reconnectEnabled=!1,e.reconnectTimer!==null&&(window.clearTimeout(e.reconnectTimer),e.reconnectTimer=null),Mm(e);const t=e.socket;e.socket=null,t&&(t.readyState===WebSocket.OPEN||t.readyState===WebSocket.CONNECTING)&&t.close(),e.listeners.clear()}const ER=[0,50,150,350],TR=[300,1200,2500],kR=1e3,DR=1e5,Np="\x1B[?1049l\x1B[?1047l\x1B[?47l",RR=new Set(["47","1047","1049"]),MR=80,AR=6,JS=[500,1500,3e3,5e3,8e3];function eb({terminal:e,serverApi:t,active:n,visible:a=!0,canClose:o,refreshCwdOnEnter:c=!1,tabId:d,onSelect:p,onClose:m,onExit:f,onSnapshot:S,onAuthClose:y}){const b=g.useSyncExternalStore(e0,Pf,()=>Lr),x=g.useSyncExternalStore(t0,Kf,()=>Na),C=g.useSyncExternalStore(i0,Ff,()=>!0),k=g.useSyncExternalStore(u0,lr,()=>du),B=g.useRef(null),R=g.useRef(null),re=g.useRef(null),F=g.useRef(null),J=g.useRef({onExit:f,onSnapshot:S}),ce=g.useRef(t.createWebSocketUrl),q=g.useRef(y),I=g.useRef(null),ie=g.useRef(new Map),de=g.useRef([]),j=g.useRef([]),$=g.useRef([]),H=g.useRef(0),L=g.useRef(!1),X=g.useRef(null),G=g.useRef(0),M=g.useRef(null),V=g.useRef(null),Q=g.useRef(!1),ve=g.useRef(!1),Se=g.useRef(!1),E=g.useRef(null),W=g.useRef(null),ee=g.useRef(!1),he=g.useRef(!1),ge=g.useRef(!1),me=g.useRef(!1),Ce=g.useRef(!1),ze=g.useRef(!1),Ne=g.useRef(!1),Re=g.useRef(n),Pe=g.useRef(a),Ye=g.useRef(c),Be=g.useRef(b),ae=g.useRef(x),[,Ee]=g.useState("connecting"),[xe,Ke]=g.useState(!1),[Xe,gt]=g.useState(null),[yt,mi]=g.useState(!1),[te,je]=g.useState(null),[He,_i]=g.useState(!1),[Vi,ai]=g.useState(!1),[kt,ji]=g.useState(!1),[Ti,Nt]=g.useState(null),[$s,Hi]=g.useState(!1),[qt,Jt]=g.useState(!1);g.useLayoutEffect(()=>{Re.current=n},[n]),g.useLayoutEffect(()=>{Pe.current=a},[a]),g.useLayoutEffect(()=>{Ye.current=c},[c]),g.useLayoutEffect(()=>{Be.current=b},[b]),g.useLayoutEffect(()=>{ae.current=x},[x]),g.useEffect(()=>{a&&n&&e.status==="running"&&(nt(),Qi())},[n,a,e.status]),g.useEffect(()=>{J.current={onExit:f,onSnapshot:S}},[f,S]),g.useEffect(()=>{ce.current=t.createWebSocketUrl,q.current=y},[t,y]),g.useEffect(()=>{let O=!1,fe=null,Oe=0;const T=HR(e.currentCommand);function A(){fe!==null&&(window.clearTimeout(fe),fe=null)}function K(){if(!T||Oe>=JS.length||O)return;const pe=JS[Oe++];fe=window.setTimeout(()=>{fe=null,ue()},pe)}async function ue(){try{const pe=await t.getTerminalTranscriptSource(e.id);if(O)return;Nt(pe.source),pe.source||K()}catch(pe){if(O)return;Nt(null),Sf(pe)&&K()}}return Nt(null),e.status!=="running"?()=>{O=!0,A()}:(ue(),()=>{O=!0,A()})},[t,e.currentCommand,e.id,e.status]),g.useEffect(()=>{Hi(!1)},[e.id,Ti?.provider,Ti?.sessionId]),g.useEffect(()=>{const O=R.current;O&&(O.options.disableStdin=e.status==="exited"),e.status==="exited"&&Ee("closed")},[e.status]),g.useEffect(()=>{const O=R.current;O&&(O.options.fontSize=b,tf(b,ae.current).then(()=>{Be.current===b&&nt()}))},[b]),g.useEffect(()=>{const O=R.current;O&&(O.options.fontFamily=Uf(x),tf(Be.current,x).then(()=>{ae.current===x&&nt()}))},[x]),g.useEffect(()=>{const O=R.current;O&&(O.options.theme=tb(k))},[k]),g.useEffect(()=>{const O=B.current;if(!O)return;let fe=!1,Oe=null,T=null,A=null,K=null,ue=null,pe=null,ke=null;I.current=null,Ce.current=!1,ze.current=!1,Wt(),Cn();const De=Be.current,rt=ae.current,ut=new PD({cursorBlink:!0,convertEol:!1,disableStdin:e.status==="exited",fontFamily:Uf(rt),fontSize:De,fontWeight:400,fontWeightBold:700,macOptionClickForcesSelection:!0,scrollback:DR,theme:{...tb(lr())}}),yi=new A2;return ut.loadAddon(yi),K=hR(ut),R.current=ut,re.current=yi,tf(De,rt).then(()=>{if(fe)return;ut.open(O),Ce.current=!0,Oe=rR(ut),Pe.current&&Re.current&&e.status==="running"&&Qi(),nt(),ue=GR(O,ut,()=>Be.current*1.2,Ge,Ut=>{ot(Ut)},Yt,us),pe=$R(O,ut,Ge,Ut=>{ot(Ut)},Yt,us);const Fr=new KD;T=ut.onData(Ut=>{if(Ne.current){const Ia=GD(Ut);if(Ia){Ui(!1),Zi(Ia);return}}const qr=Fr.accept(Ut);qr&&Zi(qr)}),A=ut.onScroll(Ut=>{if(he.current||me.current||ge.current){ct();return}Ni(),ir(ut)&&mt({scrollToBottom:!0}),Ge(),Ut<=3&&ot()}),ke=new ResizeObserver(()=>{ei()}),ke.observe(O),ze.current&&(Ts(),ze.current=!1,nt()),Bt()}),()=>{fe=!0,Ce.current=!1,ze.current=!1,Wt(),bt(),Ai(),ge.current=!1,ue?.(),pe?.(),ke?.disconnect(),Oe?.dispose(),T?.dispose(),A?.dispose(),K?.dispose(),ut.dispose(),R.current=null,re.current=null}},[e.id]),g.useEffect(()=>{const O=ce.current(e.id),fe=yR(O,Dt);return F.current=fe.send,Ee(fe.status),fe.status==="connected"&&nt(),fe.snapshot&&(J.current.onSnapshot(fe.snapshot,{notifyCompletion:!1}),R.current&&(nt(),Bs(fe.output,fe.history),nt())),()=>{fe.detach(),F.current=null}},[e.id]);function Dt(O){if(O.type==="status"){Ee(O.status),O.status==="unauthorized"&&q.current?.(),O.status==="connected"&&nt();return}li(O.message)}function Cn(O=[],fe=null){j.current=[],$.current=ib(O),H.current=0,L.current=!1,X.current=null,ge.current=!1,G.current+=1,M.current=fe,V.current=null,Q.current=!1,ve.current=!1,Se.current=!1,ze.current=!1,E.current=null,ee.current=!1,Ke(!1),gt(null),mi(!1),je(null),_i(!1),ai(!1)}function Bs(O=[],fe=null){Cn(O,fe),Vs()}function Vs(){if(!R.current||!Ce.current){ze.current=!0;return}ze.current=!1,Ts()}async function Ts(){const O=R.current;if(!O)return;const fe=$c(O,ee.current),Oe=fe?$.current.length:H.current;await ks(O,{liveOutputLimit:Oe,scrollToBottom:fe}),R.current===O&&ct()}function ks(O,fe={}){return new Promise(Oe=>{ge.current=!0,L.current=!1;const T=G.current+1;G.current=T;const A=Math.max(0,Math.min(fe.liveOutputLimit??$.current.length,$.current.length)),K=()=>{if(R.current!==O||G.current!==T){Oe();return}try{H.current=A,fe.scrollToBottom&&Xs(O)}finally{ge.current=!1;const pe=gi();pe&&mt(pe),Oe()}},ue=()=>{if(R.current!==O||G.current!==T){Oe();return}O.clear();const pe=ib([...j.current,...$.current.slice(0,A)]);if(pe.length===0){K();return}for(let ke=0;ke<pe.length;ke+=1){const De=pe[ke];ke===pe.length-1?O.write(De,K):O.write(De)}};if(O.buffer.active.type==="alternate"){O.write(Np,ue);return}ue()})}async function ot(O=0){const fe=R.current;if(Se.current||!fe)return;const Oe=M.current;Se.current=!0,Ke(!0);const T=fe.buffer.active.viewportY;try{let A=!!(Oe&&!Oe.hasMore);if(!A)try{const K=await t.getTerminalHistory(e.id,{beforeLine:Oe?.startLine??0,limit:kR});if(M.current={startLine:K.startLine,endLine:K.endLine,hasMore:K.hasMore},K.output.length>0){await Rt(fe,K.output,T,O);return}A=!K.hasMore}catch(K){A=Sf(K)}A&&await St(fe,T,O)}catch{}finally{Se.current=!1,Ke(!1)}}async function St(O,fe,Oe){if(!(Q.current||ve.current))try{const T=V.current,A=await t.getTerminalTranscriptHistory(e.id,{...T?{cursor:T}:{},limit:80});if(Nt(A.source),V.current=A.cursor,ve.current=!A.hasMore||!A.cursor,A.output.length===0)return;await Rt(O,A.output,fe,Oe)}catch(T){Sf(T)&&(Q.current=!0)}}async function Rt(O,fe,Oe,T){j.current=[...fe,...j.current];const A=WR(fe);await ks(O,{liveOutputLimit:H.current,scrollToBottom:!1}),R.current===O&&(xn(O,Math.max(0,Oe+A+Math.min(0,T))),ee.current=!ir(O),Ge())}g.useEffect(()=>{const O=window.visualViewport;function fe(){document.visibilityState==="visible"&&nt()}function Oe(){nt()}function T(){Bt()}return document.addEventListener("visibilitychange",fe),window.addEventListener("pageshow",Oe),window.addEventListener("resize",T),O?.addEventListener("resize",T),O?.addEventListener("scroll",T),()=>{document.removeEventListener("visibilitychange",fe),window.removeEventListener("pageshow",Oe),window.removeEventListener("resize",T),O?.removeEventListener("resize",T),O?.removeEventListener("scroll",T)}},[e.id]);function li(O){if(O.type==="snapshot"&&O.terminal.id===e.id){if(J.current.onSnapshot(O.terminal,{notifyCompletion:!1}),!R.current)return;nt(),Bs(O.output,O.history??null),nt();return}if(O.type==="terminal_updated"&&O.terminal.id===e.id){J.current.onSnapshot(O.terminal,{notifyCompletion:!0});return}if(O.type==="output"&&O.terminalId===e.id){const Oe=_w(O.data);if(!Oe)return;$.current.push(Oe),R.current&&Ce.current?mt({scrollToBottom:!0}):ze.current=!0;return}const fe=R.current;if(fe){if(O.type==="exit"&&O.terminalId===e.id){J.current.onExit(O.exitCode),Ee("closed");return}O.type==="error"&&fe.writeln(`\r
31
- [nterminal] ${O.message}`)}}function ei(O=25){if(document.visibilityState==="hidden"||!Pe.current||ie.current.has(O))return;const fe=window.setTimeout(()=>{ie.current.delete(O),Os()},O);ie.current.set(O,fe)}function Bt(){for(const O of ER)ei(O)}function nt(){I.current=null,Bt()}function Wt(){for(const O of ie.current.values())window.clearTimeout(O);ie.current.clear()}function bt(){for(const O of de.current)window.clearTimeout(O);de.current=[]}function Ge(){if(ct(),!E.current){mi(!1);return}mi(!0),Ai(),W.current=window.setTimeout(()=>{W.current=null,mi(!1)},1200)}function ct(){const O=R.current,fe=O?YR(O):null;if(E.current=fe,gt(fe),ai(!!(O&&fe)),_i(!!(O&&fe&&!ir(O))),fe||!O||!vi()){je(null);return}je({alternate:O.buffer.active.type==="alternate"})}function vi(){const O=M.current;return j.current.length>0||!!O?.hasMore}function Ai(){W.current!==null&&(window.clearTimeout(W.current),W.current=null)}function Ni(){const O=R.current;O&&(ee.current=!ir(O),ct())}function ki(O){X.current=bf(X.current,O)}function cs(O){const fe=X.current;return X.current=null,bf(fe,O)}function gi(){const O=X.current;return X.current=null,O}function mt(O={}){const fe=R.current;if(!fe||!Ce.current){ze.current=!0;return}if(ge.current){ki(O);return}if(L.current){ki(O);return}const Oe=cs(O);if(!Oe.force&&!$c(fe,ee.current)){ct();return}L.current=!0;const T=G.current,A=()=>{if(R.current!==fe||G.current!==T){L.current=!1;return}if(!Oe.force&&!$c(fe,ee.current)){L.current=!1,ct();return}const K=H.current,ue=$.current[K];if(ue===void 0){L.current=!1,Oe.scrollToBottom&&Xs(fe),ct();const pe=gi();pe&&mt(bf(Oe,pe));return}H.current=K+1,fe.write(ue,A)};A()}function Yt(){me.current=!0}function us(){Ni(),me.current=!1;const O=R.current;O&&ir(O)&&mt({scrollToBottom:!0})}function Xs(O){hr(()=>sb(O))&&(ee.current=!1)}function xn(O,fe){hr(()=>(O.scrollToLine(fe),!0))}function hr(O){he.current=!0;try{return O()}finally{he.current=!1}}function Xi(){const O=R.current;if(!O)return;const fe=()=>{sb(O),ee.current=!1,ct(),mt({force:!0,scrollToBottom:!0}),Qi()};if(O.buffer.active.type==="alternate"){O.write(Np,fe);return}fe()}function Gi(O){const fe=R.current,Oe=B.current;if(!fe||!Oe)return;const T=Oe.getBoundingClientRect();if(T.height<=0)return;const A=Math.max(0,Math.min(1,(O-T.top)/T.height)),K=Math.round(fe.buffer.active.baseY*A);Yt();try{fe.scrollToLine(K)}finally{us()}ee.current=!ir(fe),ct(),Ge(),K<=3&&ot()}function En(O){O.preventDefault(),O.stopPropagation(),O.currentTarget.setPointerCapture?.(O.pointerId),Gi(O.clientY)}function Ls(O){(O.buttons&1)!==0&&(O.preventDefault(),O.stopPropagation(),Gi(O.clientY))}function Os(){const O=R.current,fe=re.current;if(!(!O||!fe)&&!(document.visibilityState==="hidden"||!Pe.current||B.current?.isConnected===!1))try{const Oe=$c(O,ee.current);fe.fit(),Oe&&Xs(O),O.refresh(0,Math.max(0,O.rows-1)),ct();const T={cols:O.cols,rows:O.rows},A=I.current;if(A&&A.cols===T.cols&&A.rows===T.rows)return;Ds({type:"resize",terminalId:e.id,cols:T.cols,rows:T.rows})&&(I.current=T)}catch{}}function Ds(O){const fe=F.current;return fe?fe(O):!1}function Zi(O){mt({force:!0,scrollToBottom:!0}),Ds({type:"input",terminalId:e.id,data:O})&&zR(O)&&Lt()}function Lt(){!Ye.current||!Re.current||(bt(),de.current=TR.map(O=>{const fe=window.setTimeout(()=>{de.current=de.current.filter(Oe=>Oe!==fe),Ye.current&&Re.current&&Ds({type:"refresh_cwd",terminalId:e.id})},O);return fe}))}function Qi(){R.current?.focus()}function Ir(){ji(O=>{const fe=!O;return Ne.current=fe,fe}),Qi()}function Ui(O){Ne.current=O,ji(O)}function zs(O){Ne.current&&Ui(!1),Zi(XD(O)),Qi()}return _.jsxs("section",{className:"terminal-pane","data-active":n,onMouseDown:()=>{n||p()},children:[_.jsx(NR,{terminal:e,canClose:o,tabId:d,transcriptSource:Ti,onOpenTranscript:()=>Hi(!0),onClose:m}),_.jsx("div",{className:"xterm-container",ref:B}),xe?_.jsx("div",{className:"terminal-history-loader",role:"status","aria-label":"Loading older terminal output",children:_.jsx("span",{"aria-hidden":"true"})}):null,C&&Xe?_.jsxs("div",{className:"terminal-scroll-progress","data-active":yt,"aria-hidden":"true",children:[Xe.current,"/",Xe.total]}):C&&te?_.jsxs("div",{className:"terminal-scroll-progress","data-active":!1,"data-pending":"true","data-buffer":te.alternate?"alternate":"normal","aria-hidden":"true",children:[te.alternate?"alt ":"","0/?"]}):null,He?_.jsx("button",{type:"button",className:"terminal-scroll-bottom-button","aria-label":"Scroll terminal to bottom",title:"Scroll to bottom",onPointerDown:O=>O.stopPropagation(),onMouseDown:O=>O.stopPropagation(),onClick:O=>{O.stopPropagation(),Xi()},children:"↓"}):null,Vi?_.jsx("button",{type:"button",className:"terminal-scroll-handle","aria-label":"Drag terminal scroll handle",title:"Drag to scroll",onPointerDown:En,onPointerMove:Ls,children:_.jsx("span",{"aria-hidden":"true"})}):null,n&&e.status==="running"?qt?_.jsx($D,{ctrlActive:kt,onCtrl:Ir,onStandaloneKey:zs,onPreserveFocus:Qi,onHide:()=>Jt(!1)}):_.jsx("button",{type:"button",className:"mobile-terminal-key-toggle","aria-label":"Show terminal control keys",title:"Show Ctrl / Esc / Tab / arrows",onMouseDown:O=>{O.stopPropagation(),Qi()},onPointerDown:O=>{O.stopPropagation(),Qi()},onClick:()=>Jt(!0),children:"⌨"}):null,_.jsx(nR,{terminalId:e.id,onSubmit:Zi,disabled:e.status!=="running"}),$s&&Ti?_.jsx(BR,{terminal:e,serverApi:t,source:Ti,onClose:()=>Hi(!1)}):null]})}function tb(e){return{background:"#0a0d10",foreground:"#e2e8ee",cursor:e2(e),selectionBackground:t2(e)}}function NR({terminal:e,canClose:t,tabId:n,transcriptSource:a,onOpenTranscript:o,onClose:c}){const d=Fb({id:`pane-${e.id}`,disabled:!n,...n?{data:{kind:"pane",sourceTabId:n,terminalId:e.id}}:{}}),p={cursor:n?"grab":"default",opacity:d.isDragging?.5:void 0};return _.jsxs("header",{ref:d.setNodeRef,className:"terminal-pane-header",style:p,"data-dragging":d.isDragging,...d.attributes,...d.listeners,children:[_.jsx("span",{className:"terminal-pane-dot","aria-hidden":"true"}),_.jsx("span",{className:"terminal-pane-cwd",title:e.cwd,children:e.cwd}),_.jsx("span",{className:"terminal-pane-spacer"}),a?_.jsx("button",{type:"button",className:"terminal-pane-transcript","data-provider":a.provider,title:`View ${Oa(a.provider)} transcript history`,"aria-label":`View ${Oa(a.provider)} transcript history`,onPointerDown:m=>m.stopPropagation(),onMouseDown:m=>m.stopPropagation(),onClick:m=>{m.stopPropagation(),o()},children:"View history"}):null,_.jsx("span",{className:`terminal-pane-state terminal-pane-state-${e.status}`,children:e.status}),t?_.jsx("button",{type:"button",className:"terminal-pane-close","aria-label":`Close pane ${e.title}`,title:"Close pane",onPointerDown:m=>m.stopPropagation(),onMouseDown:m=>m.stopPropagation(),onClick:m=>{m.stopPropagation(),c()},children:"x"}):null]})}function BR({terminal:e,serverApi:t,source:n,onClose:a}){const o=g.useRef(null),c=g.useRef(0),d=g.useRef(!1),p=g.useRef(!1),m=g.useRef(null),[f,S]=g.useState([]),[y,b]=g.useState(null),[x,C]=g.useState(!1),[k,B]=g.useState(!0),[R,re]=g.useState(!1),[F,J]=g.useState(null),[ce,q]=g.useState(""),[I,ie]=g.useState("all"),[de,j]=g.useState(()=>new Set);g.useEffect(()=>{c.current+=1;const E=c.current;return d.current=!1,p.current=!0,m.current=null,S([]),b(null),C(!1),J(null),$(null,"initial",E),()=>{c.current===E&&(c.current+=1)}},[t,n.provider,n.sessionId,e.id]),g.useLayoutEffect(()=>{const E=o.current;if(!E)return;if(p.current){p.current=!1,E.scrollTop=E.scrollHeight;return}const W=m.current;W!==null&&(m.current=null,E.scrollTop+=E.scrollHeight-W)},[f]);async function $(E,W,ee=c.current){if(!d.current){d.current=!0,W==="initial"?B(!0):(re(!0),m.current=o.current?.scrollHeight??null),J(null);try{await H(E,W,ee)}catch(he){if(c.current!==ee)return;J(he instanceof Error?he.message:"Failed to load transcript history.")}finally{c.current===ee&&(d.current=!1,B(!1),re(!1))}}}async function H(E,W,ee){let he=E,ge=0;for(;c.current===ee;){const me=await t.getTerminalTranscriptHistory(e.id,{...he?{cursor:he}:{},limit:MR});if(c.current!==ee)return;const Ce=UR(me.output,n.provider);if(b(me.cursor),C(!!(me.hasMore&&me.cursor)),Ce){S(ze=>W==="older"?[Ce,...ze]:[Ce]);return}if(!me.hasMore||!me.cursor||ge>=AR)return;he=me.cursor,ge+=1}}function L(){const E=o.current;!E||E.scrollTop>72||!x||!y||d.current||$(y,"older")}const X=Oa(n.provider),G=f.join(""),M=g.useMemo(()=>PR(G,n.provider),[n.provider,G]),V=ce.trim().toLowerCase(),Q=g.useMemo(()=>M.filter(E=>I!=="all"&&E.kind!==I?!1:V?E.searchText.includes(V):!0),[I,V,M]),ve=M.length===0?"0 entries":`${Q.length}/${M.length} entries`;function Se(E){j(W=>{const ee=new Set(W);return ee.has(E)?ee.delete(E):ee.add(E),ee})}return _.jsx("div",{className:"security-overlay transcript-overlay",role:"dialog","aria-modal":"true","aria-labelledby":"transcript-dialog-title",onClick:a,children:_.jsxs("div",{className:"security-panel transcript-dialog",onClick:E=>E.stopPropagation(),children:[_.jsxs("header",{className:"security-panel-header",children:[_.jsxs("div",{className:"transcript-dialog-title",children:[_.jsxs("h2",{id:"transcript-dialog-title",children:[X," JSONL"]}),_.jsx("span",{title:n.sessionId,children:n.sessionId})]}),_.jsx("button",{type:"button",className:"security-close","aria-label":"Close",onClick:a,children:"×"})]}),_.jsxs("div",{className:"transcript-dialog-controls",children:[_.jsxs("label",{className:"transcript-search",children:[_.jsx("span",{children:"Search"}),_.jsx("input",{type:"search",value:ce,"aria-label":"Search JSONL transcript",placeholder:"Find text",onChange:E=>q(E.currentTarget.value)})]}),_.jsx("div",{className:"transcript-filter-group",role:"group","aria-label":"Transcript type filter",children:LR.map(E=>_.jsx("button",{type:"button","data-active":I===E.value,onClick:()=>ie(E.value),children:E.label},E.value))}),_.jsx("span",{className:"transcript-result-count",children:ve})]}),_.jsxs("div",{ref:o,className:"transcript-dialog-scroll","aria-label":"JSONL transcript output",onScroll:L,children:[R?_.jsx("div",{className:"transcript-dialog-status",children:"Loading older entries..."}):null,!k&&x?_.jsx("div",{className:"transcript-dialog-hint",children:"Scroll up for older entries"}):null,G?_.jsx("div",{className:"transcript-block-list",children:Q.map(E=>_.jsx(OR,{block:E,expanded:de.has(E.id),onToggle:()=>Se(E.id)},E.id))}):null,k?_.jsx("div",{className:"transcript-dialog-status",children:"Loading transcript..."}):null,!k&&!G&&!F?_.jsx("div",{className:"transcript-dialog-status",children:"No transcript entries found."}):null,!k&&G&&Q.length===0?_.jsx("div",{className:"transcript-dialog-status",children:"No matching transcript entries."}):null,F?_.jsx("div",{className:"transcript-dialog-error",children:F}):null]})]})})}const LR=[{value:"all",label:"All"},{value:"user",label:"User"},{value:"assistant",label:"Assistant"},{value:"tool",label:"Tool"},{value:"system",label:"System"}];function OR({block:e,expanded:t,onToggle:n}){const a=e.kind==="tool"&&(e.body.length>1800||FR(e.body)>42),c=a&&!t?`${e.body.slice(0,1800).trimEnd()}
30
+ `).replace(/\n/g,"\r");b&&t(b),window.setTimeout(()=>t("\r"),sR),S(""),m.current?.focus()}return d?_.jsxs("div",{className:"compose-drawer compose-drawer--open",children:[_.jsxs("button",{type:"button",className:"compose-drawer-header","aria-label":"Collapse compose drawer",title:"Click to collapse — Esc also closes when focus is in the textarea",onClick:()=>f(!1),children:[_.jsx("span",{"aria-hidden":"true",children:"▾"}),_.jsx("span",{className:"compose-drawer-title",children:"compose"}),_.jsx("span",{className:"compose-drawer-hint","aria-hidden":"true",children:"Cmd/Ctrl+Enter to send · Enter for newline · Esc to close"}),_.jsx("span",{className:"compose-drawer-close","aria-hidden":"true",children:"×"})]}),_.jsx("textarea",{ref:m,className:"compose-drawer-input","aria-label":"Compose input",spellCheck:!1,autoCorrect:"off",autoCapitalize:"off",value:p,onChange:b=>S(b.target.value),onKeyDown:b=>{if(b.key==="Enter"&&(b.metaKey||b.ctrlKey)){b.preventDefault(),y();return}b.key==="Escape"&&(b.preventDefault(),f(!1))},placeholder:"Type a longer command here, then Cmd/Ctrl+Enter to send."}),_.jsxs("div",{className:"compose-drawer-actions",children:[_.jsx("button",{type:"button",className:"compose-drawer-clear",onClick:()=>{S(""),m.current?.focus()},disabled:!p,children:"Clear"}),_.jsx("button",{type:"button",className:"compose-drawer-send",onClick:y,disabled:n||!p,children:"Send"})]})]}):_.jsx("div",{className:"compose-drawer compose-drawer--closed",children:_.jsxs("button",{type:"button",className:"compose-drawer-handle","aria-label":"Open compose drawer",title:"Compose long input — type without per-keystroke latency, send with Cmd/Ctrl+Enter",onClick:()=>f(!0),children:[_.jsx("span",{"aria-hidden":"true",children:"▴"}),_.jsx("span",{children:"compose"}),p?_.jsx("span",{className:"compose-drawer-handle-dot","aria-label":"draft saved"}):null]})})}function rR(e){e.attachCustomKeyEventHandler(o=>{if(aR(o)){const c=VS(e);return c?(o.preventDefault(),o.stopPropagation(),XS(c),!1):!0}return lR(o)?(o.preventDefault(),o.stopPropagation(),oR(e),!1):!0});const t=e.element;if(!t)return{dispose(){e.attachCustomKeyEventHandler(()=>!0)}};const n=o=>{const c=VS(e);if(c){if(o.clipboardData){o.clipboardData.setData("text/plain",c),o.preventDefault();return}o.preventDefault(),XS(c)}},a=o=>{const c=o.clipboardData?.getData("text/plain");if(c===void 0)return;const d=dw(c);d!==c&&(o.preventDefault(),o.stopImmediatePropagation(),e.paste(d))};return t.addEventListener("copy",n,!0),t.addEventListener("paste",a,!0),{dispose(){t.removeEventListener("copy",n,!0),t.removeEventListener("paste",a,!0),e.attachCustomKeyEventHandler(()=>!0)}}}function aR(e){return e.type!=="keydown"||e.altKey||e.key.toLowerCase()!=="c"?!1:e.metaKey&&!e.ctrlKey&&!e.shiftKey||e.ctrlKey&&e.shiftKey&&!e.metaKey?!0:e.ctrlKey&&!e.shiftKey&&!e.metaKey}function lR(e){return e.type!=="keydown"||e.altKey||e.key.toLowerCase()!=="v"?!1:e.metaKey&&!e.ctrlKey&&!e.shiftKey||e.ctrlKey&&e.shiftKey&&!e.metaKey?!0:e.ctrlKey&&!e.shiftKey&&!e.metaKey}async function oR(e){if(navigator.clipboard?.readText)try{const t=await navigator.clipboard.readText();if(!t)return;e.paste(dw(t))}catch{}}function VS(e){return e.hasSelection()?e.getSelection():""}function dw(e){return e.replace(/(?:\r\n|\r|\n)+$/,"")}async function XS(e){if(navigator.clipboard?.writeText)try{await navigator.clipboard.writeText(e);return}catch{}cR(e)}function cR(e){const t=document.activeElement instanceof HTMLElement?document.activeElement:null,n=document.createElement("textarea");n.value=e,n.setAttribute("readonly","true"),n.style.position="fixed",n.style.left="-9999px",n.style.top="0",n.style.opacity="0",document.body.appendChild(n),n.focus({preventScroll:!0}),n.select();try{typeof document.execCommand=="function"&&document.execCommand("copy")}finally{n.remove(),t?.focus({preventScroll:!0})}}const uR=[4,10,11,12];function hR(e,t){const n=[e.parser.registerCsiHandler({final:"c"},a=>GS(a)),e.parser.registerCsiHandler({prefix:">",final:"c"},a=>GS(a)),e.parser.registerCsiHandler({final:"n"},a=>dR(a)),e.parser.registerCsiHandler({prefix:"?",final:"n"},a=>fR(a)),e.parser.registerCsiHandler({final:"t"},a=>pR(a)),e.parser.registerDcsHandler({intermediates:"$",final:"q"},()=>!0),...uR.map(a=>e.parser.registerOscHandler(a,o=>mR(o)))];return{dispose(){for(const a of n)a.dispose()}}}function GS(e){return Ou(e)===0}function dR(e){const t=Ou(e);return t===5||t===6}function fR(e){return Ou(e)===6}function pR(e){const t=Ou(e);return t===14||t===16||t===18}function mR(e){return e.split(";").some(t=>t==="?")}function Ou(e){const t=e[0];return typeof t=="number"?t:0}const ho=new Map,_R=2*1024*1024,vR=1500,gR=25e3;function yR(e,t){let n=ho.get(e);n||(n=SR(e),ho.set(e,n),fw(n)),n.listeners.add(t);const a=c=>CR(n,c),o=()=>{n.listeners.delete(t)};return{status:n.status,snapshot:n.snapshot,output:n.output.slice(),history:n.history,send:a,detach:o}}function Ap(e){const t=ho.get(e);t&&(xR(t),ho.delete(e))}function ZS(){for(const e of Array.from(ho.keys()))Ap(e)}function SR(e){return{url:e,socket:null,status:"connecting",snapshot:null,output:[],history:null,outputBytes:0,pendingOut:[],listeners:new Set,reconnectTimer:null,reconnectEnabled:!0,heartbeat:null,isAlive:!1,exited:!1}}function fw(e){if(!e.reconnectEnabled)return;Hl(e,e.socket===null&&e.status!=="reconnecting"?"connecting":"reconnecting");const t=new WebSocket(e.url);e.socket=t,e.isAlive=!1,t.addEventListener("open",()=>{if(e.socket===t){Hl(e,"connected");for(const n of e.pendingOut)t.send(JSON.stringify(n));e.pendingOut.length=0,e.isAlive=!0,bR(e)}}),t.addEventListener("message",n=>{if(e.socket!==t)return;const a=typeof n.data=="string"?n.data:"";if(!a)return;let o=null;try{o=JSON.parse(a)}catch{return}if(!(!o||typeof o.type!="string")){if(o.type==="pong"){e.isAlive=!0;return}wR(e,o),pw(e,{type:"message",message:o})}}),t.addEventListener("close",n=>{if(e.socket===t){if(e.socket=null,Mm(e),n.code===1008){e.reconnectEnabled=!1,Hl(e,"unauthorized");return}if(e.exited||!e.reconnectEnabled){Hl(e,"closed");return}Hl(e,"reconnecting"),e.reconnectTimer=window.setTimeout(()=>{e.reconnectTimer=null,fw(e)},vR)}}),t.addEventListener("error",()=>{})}function bR(e){Mm(e),e.heartbeat=window.setInterval(()=>{const t=e.socket;if(!(!t||t.readyState!==WebSocket.OPEN)){if(!e.isAlive){t.close();return}e.isAlive=!1,t.send(JSON.stringify({type:"ping",nonce:Date.now().toString(36)}))}},gR)}function Mm(e){e.heartbeat!==null&&(window.clearInterval(e.heartbeat),e.heartbeat=null)}function wR(e,t){if(t.type==="snapshot"){e.snapshot=t.terminal,e.output=t.output.slice(),e.history=t.history??null,e.outputBytes=e.output.reduce((n,a)=>n+a.length,0),e.exited=t.terminal.status==="exited",QS(e);return}if(t.type==="output"){e.output.push(t.data),e.outputBytes+=t.data.length,QS(e);return}if(t.type==="terminal_updated"){e.snapshot=t.terminal,t.terminal.status==="exited"&&(e.exited=!0);return}if(t.type==="exit"){e.exited=!0,e.snapshot&&e.snapshot.id===t.terminalId&&(e.snapshot={...e.snapshot,status:"exited",exitCode:t.exitCode});return}}function QS(e){for(;e.outputBytes>_R&&e.output.length>1;){const t=e.output.shift();e.outputBytes-=t.length}}function Hl(e,t){e.status!==t&&(e.status=t,pw(e,{type:"status",status:t}))}function pw(e,t){for(const n of Array.from(e.listeners))n(t)}function CR(e,t){const n=e.socket;return n&&n.readyState===WebSocket.OPEN?(n.send(JSON.stringify(t)),!0):(t.type==="input"&&e.pendingOut.push(t),!1)}function xR(e){e.reconnectEnabled=!1,e.reconnectTimer!==null&&(window.clearTimeout(e.reconnectTimer),e.reconnectTimer=null),Mm(e);const t=e.socket;e.socket=null,t&&(t.readyState===WebSocket.OPEN||t.readyState===WebSocket.CONNECTING)&&t.close(),e.listeners.clear()}const ER=[0,50,150,350],TR=[300,1200,2500],kR=1e3,DR=1e5,Np="\x1B[?1049l\x1B[?1047l\x1B[?47l",RR=new Set(["47","1047","1049"]),MR=80,AR=6,JS=[500,1500,3e3,5e3,8e3];function eb({terminal:e,serverApi:t,active:n,visible:a=!0,canClose:o,refreshCwdOnEnter:c=!1,tabId:d,onSelect:p,onClose:m,onExit:f,onSnapshot:S,onAuthClose:y}){const b=g.useSyncExternalStore(e0,Pf,()=>Lr),x=g.useSyncExternalStore(t0,Kf,()=>Na),C=g.useSyncExternalStore(i0,Ff,()=>!0),k=g.useSyncExternalStore(u0,lr,()=>du),B=g.useRef(null),R=g.useRef(null),re=g.useRef(null),F=g.useRef(null),J=g.useRef({onExit:f,onSnapshot:S}),ce=g.useRef(t.createWebSocketUrl),q=g.useRef(y),I=g.useRef(null),ie=g.useRef(new Map),de=g.useRef([]),j=g.useRef([]),$=g.useRef([]),H=g.useRef(0),L=g.useRef(!1),X=g.useRef(null),Z=g.useRef(0),A=g.useRef(null),V=g.useRef(null),Q=g.useRef(!1),ve=g.useRef(!1),Se=g.useRef(!1),E=g.useRef(null),W=g.useRef(null),ee=g.useRef(!1),he=g.useRef(!1),ge=g.useRef(!1),me=g.useRef(!1),Ce=g.useRef(!1),ze=g.useRef(!1),Ne=g.useRef(!1),Re=g.useRef(n),Pe=g.useRef(a),Ye=g.useRef(c),Be=g.useRef(b),ae=g.useRef(x),[,Ee]=g.useState("connecting"),[xe,Ke]=g.useState(!1),[Xe,gt]=g.useState(null),[yt,mi]=g.useState(!1),[te,je]=g.useState(null),[He,_i]=g.useState(!1),[Vi,ai]=g.useState(!1),[kt,ji]=g.useState(!1),[Ti,Nt]=g.useState(null),[$s,Hi]=g.useState(!1),[qt,Jt]=g.useState(!1);g.useLayoutEffect(()=>{Re.current=n},[n]),g.useLayoutEffect(()=>{Pe.current=a},[a]),g.useLayoutEffect(()=>{Ye.current=c},[c]),g.useLayoutEffect(()=>{Be.current=b},[b]),g.useLayoutEffect(()=>{ae.current=x},[x]),g.useEffect(()=>{a&&n&&e.status==="running"&&(nt(),Qi())},[n,a,e.status]),g.useEffect(()=>{J.current={onExit:f,onSnapshot:S}},[f,S]),g.useEffect(()=>{ce.current=t.createWebSocketUrl,q.current=y},[t,y]),g.useEffect(()=>{let O=!1,fe=null,Oe=0;const T=HR(e.currentCommand);function M(){fe!==null&&(window.clearTimeout(fe),fe=null)}function K(){if(!T||Oe>=JS.length||O)return;const pe=JS[Oe++];fe=window.setTimeout(()=>{fe=null,ue()},pe)}async function ue(){try{const pe=await t.getTerminalTranscriptSource(e.id);if(O)return;Nt(pe.source),pe.source||K()}catch(pe){if(O)return;Nt(null),Sf(pe)&&K()}}return Nt(null),e.status!=="running"?()=>{O=!0,M()}:(ue(),()=>{O=!0,M()})},[t,e.currentCommand,e.id,e.status]),g.useEffect(()=>{Hi(!1)},[e.id,Ti?.provider,Ti?.sessionId]),g.useEffect(()=>{const O=R.current;O&&(O.options.disableStdin=e.status==="exited"),e.status==="exited"&&Ee("closed")},[e.status]),g.useEffect(()=>{const O=R.current;O&&(O.options.fontSize=b,tf(b,ae.current).then(()=>{Be.current===b&&nt()}))},[b]),g.useEffect(()=>{const O=R.current;O&&(O.options.fontFamily=Uf(x),tf(Be.current,x).then(()=>{ae.current===x&&nt()}))},[x]),g.useEffect(()=>{const O=R.current;O&&(O.options.theme=tb(k))},[k]),g.useEffect(()=>{const O=B.current;if(!O)return;let fe=!1,Oe=null,T=null,M=null,K=null,ue=null,pe=null,ke=null;I.current=null,Ce.current=!1,ze.current=!1,Wt(),Cn();const De=Be.current,rt=ae.current,ut=new PD({cursorBlink:!0,convertEol:!1,disableStdin:e.status==="exited",fontFamily:Uf(rt),fontSize:De,fontWeight:400,fontWeightBold:700,macOptionClickForcesSelection:!0,scrollback:DR,theme:{...tb(lr())}}),yi=new A2;return ut.loadAddon(yi),K=hR(ut),R.current=ut,re.current=yi,tf(De,rt).then(()=>{if(fe)return;ut.open(O),Ce.current=!0,Oe=rR(ut),Pe.current&&Re.current&&e.status==="running"&&Qi(),nt(),ue=GR(O,ut,()=>Be.current*1.2,Ge,Ut=>{ot(Ut)},Yt,us),pe=$R(O,ut,Ge,Ut=>{ot(Ut)},Yt,us);const Fr=new KD;T=ut.onData(Ut=>{if(Ne.current){const Ia=GD(Ut);if(Ia){Ui(!1),Zi(Ia);return}}const qr=Fr.accept(Ut);qr&&Zi(qr)}),M=ut.onScroll(Ut=>{if(he.current||me.current||ge.current){ct();return}Ni(),ir(ut)&&mt({scrollToBottom:!0}),Ge(),Ut<=3&&ot()}),ke=new ResizeObserver(()=>{ei()}),ke.observe(O),ze.current&&(Ts(),ze.current=!1,nt()),Bt()}),()=>{fe=!0,Ce.current=!1,ze.current=!1,Wt(),bt(),Ai(),ge.current=!1,ue?.(),pe?.(),ke?.disconnect(),Oe?.dispose(),T?.dispose(),M?.dispose(),K?.dispose(),ut.dispose(),R.current=null,re.current=null}},[e.id]),g.useEffect(()=>{const O=ce.current(e.id),fe=yR(O,Dt);return F.current=fe.send,Ee(fe.status),fe.status==="connected"&&nt(),fe.snapshot&&(J.current.onSnapshot(fe.snapshot,{notifyCompletion:!1}),R.current&&(nt(),Bs(fe.output,fe.history),nt())),()=>{fe.detach(),F.current=null}},[e.id]);function Dt(O){if(O.type==="status"){Ee(O.status),O.status==="unauthorized"&&q.current?.(),O.status==="connected"&&nt();return}li(O.message)}function Cn(O=[],fe=null){j.current=[],$.current=ib(O),H.current=0,L.current=!1,X.current=null,ge.current=!1,Z.current+=1,A.current=fe,V.current=null,Q.current=!1,ve.current=!1,Se.current=!1,ze.current=!1,E.current=null,ee.current=!1,Ke(!1),gt(null),mi(!1),je(null),_i(!1),ai(!1)}function Bs(O=[],fe=null){Cn(O,fe),Vs()}function Vs(){if(!R.current||!Ce.current){ze.current=!0;return}ze.current=!1,Ts()}async function Ts(){const O=R.current;if(!O)return;const fe=$c(O,ee.current),Oe=fe?$.current.length:H.current;await ks(O,{liveOutputLimit:Oe,scrollToBottom:fe}),R.current===O&&ct()}function ks(O,fe={}){return new Promise(Oe=>{ge.current=!0,L.current=!1;const T=Z.current+1;Z.current=T;const M=Math.max(0,Math.min(fe.liveOutputLimit??$.current.length,$.current.length)),K=()=>{if(R.current!==O||Z.current!==T){Oe();return}try{H.current=M,fe.scrollToBottom&&Xs(O)}finally{ge.current=!1;const pe=gi();pe&&mt(pe),Oe()}},ue=()=>{if(R.current!==O||Z.current!==T){Oe();return}O.clear();const pe=ib([...j.current,...$.current.slice(0,M)]);if(pe.length===0){K();return}for(let ke=0;ke<pe.length;ke+=1){const De=pe[ke];ke===pe.length-1?O.write(De,K):O.write(De)}};if(O.buffer.active.type==="alternate"){O.write(Np,ue);return}ue()})}async function ot(O=0){const fe=R.current;if(Se.current||!fe)return;const Oe=A.current;Se.current=!0,Ke(!0);const T=fe.buffer.active.viewportY;try{let M=!!(Oe&&!Oe.hasMore);if(!M)try{const K=await t.getTerminalHistory(e.id,{beforeLine:Oe?.startLine??0,limit:kR});if(A.current={startLine:K.startLine,endLine:K.endLine,hasMore:K.hasMore},K.output.length>0){await Rt(fe,K.output,T,O);return}M=!K.hasMore}catch(K){M=Sf(K)}M&&await St(fe,T,O)}catch{}finally{Se.current=!1,Ke(!1)}}async function St(O,fe,Oe){if(!(Q.current||ve.current))try{const T=V.current,M=await t.getTerminalTranscriptHistory(e.id,{...T?{cursor:T}:{},limit:80});if(Nt(M.source),V.current=M.cursor,ve.current=!M.hasMore||!M.cursor,M.output.length===0)return;await Rt(O,M.output,fe,Oe)}catch(T){Sf(T)&&(Q.current=!0)}}async function Rt(O,fe,Oe,T){j.current=[...fe,...j.current];const M=WR(fe);await ks(O,{liveOutputLimit:H.current,scrollToBottom:!1}),R.current===O&&(xn(O,Math.max(0,Oe+M+Math.min(0,T))),ee.current=!ir(O),Ge())}g.useEffect(()=>{const O=window.visualViewport;function fe(){document.visibilityState==="visible"&&nt()}function Oe(){nt()}function T(){Bt()}return document.addEventListener("visibilitychange",fe),window.addEventListener("pageshow",Oe),window.addEventListener("resize",T),O?.addEventListener("resize",T),O?.addEventListener("scroll",T),()=>{document.removeEventListener("visibilitychange",fe),window.removeEventListener("pageshow",Oe),window.removeEventListener("resize",T),O?.removeEventListener("resize",T),O?.removeEventListener("scroll",T)}},[e.id]);function li(O){if(O.type==="snapshot"&&O.terminal.id===e.id){if(J.current.onSnapshot(O.terminal,{notifyCompletion:!1}),!R.current)return;nt(),Bs(O.output,O.history??null),nt();return}if(O.type==="terminal_updated"&&O.terminal.id===e.id){J.current.onSnapshot(O.terminal,{notifyCompletion:!0});return}if(O.type==="output"&&O.terminalId===e.id){const Oe=_w(O.data);if(!Oe)return;$.current.push(Oe),R.current&&Ce.current?mt({scrollToBottom:!0}):ze.current=!0;return}const fe=R.current;if(fe){if(O.type==="exit"&&O.terminalId===e.id){J.current.onExit(O.exitCode),Ee("closed");return}O.type==="error"&&fe.writeln(`\r
31
+ [nterminal] ${O.message}`)}}function ei(O=25){if(document.visibilityState==="hidden"||!Pe.current||ie.current.has(O))return;const fe=window.setTimeout(()=>{ie.current.delete(O),Os()},O);ie.current.set(O,fe)}function Bt(){for(const O of ER)ei(O)}function nt(){I.current=null,Bt()}function Wt(){for(const O of ie.current.values())window.clearTimeout(O);ie.current.clear()}function bt(){for(const O of de.current)window.clearTimeout(O);de.current=[]}function Ge(){if(ct(),!E.current){mi(!1);return}mi(!0),Ai(),W.current=window.setTimeout(()=>{W.current=null,mi(!1)},1200)}function ct(){const O=R.current,fe=O?YR(O):null;if(E.current=fe,gt(fe),ai(!!(O&&fe)),_i(!!(O&&fe&&!ir(O))),fe||!O||!vi()){je(null);return}je({alternate:O.buffer.active.type==="alternate"})}function vi(){const O=A.current;return j.current.length>0||!!O?.hasMore}function Ai(){W.current!==null&&(window.clearTimeout(W.current),W.current=null)}function Ni(){const O=R.current;O&&(ee.current=!ir(O),ct())}function ki(O){X.current=bf(X.current,O)}function cs(O){const fe=X.current;return X.current=null,bf(fe,O)}function gi(){const O=X.current;return X.current=null,O}function mt(O={}){const fe=R.current;if(!fe||!Ce.current){ze.current=!0;return}if(ge.current){ki(O);return}if(L.current){ki(O);return}const Oe=cs(O);if(!Oe.force&&!$c(fe,ee.current)){ct();return}L.current=!0;const T=Z.current,M=()=>{if(R.current!==fe||Z.current!==T){L.current=!1;return}if(!Oe.force&&!$c(fe,ee.current)){L.current=!1,ct();return}const K=H.current,ue=$.current[K];if(ue===void 0){L.current=!1,Oe.scrollToBottom&&Xs(fe),ct();const pe=gi();pe&&mt(bf(Oe,pe));return}H.current=K+1,fe.write(ue,M)};M()}function Yt(){me.current=!0}function us(){Ni(),me.current=!1;const O=R.current;O&&ir(O)&&mt({scrollToBottom:!0})}function Xs(O){hr(()=>sb(O))&&(ee.current=!1)}function xn(O,fe){hr(()=>(O.scrollToLine(fe),!0))}function hr(O){he.current=!0;try{return O()}finally{he.current=!1}}function Xi(){const O=R.current;if(!O)return;const fe=()=>{sb(O),ee.current=!1,ct(),mt({force:!0,scrollToBottom:!0}),Qi()};if(O.buffer.active.type==="alternate"){O.write(Np,fe);return}fe()}function Gi(O){const fe=R.current,Oe=B.current;if(!fe||!Oe)return;const T=Oe.getBoundingClientRect();if(T.height<=0)return;const M=Math.max(0,Math.min(1,(O-T.top)/T.height)),K=Math.round(fe.buffer.active.baseY*M);Yt();try{fe.scrollToLine(K)}finally{us()}ee.current=!ir(fe),ct(),Ge(),K<=3&&ot()}function En(O){O.preventDefault(),O.stopPropagation(),O.currentTarget.setPointerCapture?.(O.pointerId),Gi(O.clientY)}function Ls(O){(O.buttons&1)!==0&&(O.preventDefault(),O.stopPropagation(),Gi(O.clientY))}function Os(){const O=R.current,fe=re.current;if(!(!O||!fe)&&!(document.visibilityState==="hidden"||!Pe.current||B.current?.isConnected===!1))try{const Oe=$c(O,ee.current);fe.fit(),Oe&&Xs(O),O.refresh(0,Math.max(0,O.rows-1)),ct();const T={cols:O.cols,rows:O.rows},M=I.current;if(M&&M.cols===T.cols&&M.rows===T.rows)return;Ds({type:"resize",terminalId:e.id,cols:T.cols,rows:T.rows})&&(I.current=T)}catch{}}function Ds(O){const fe=F.current;return fe?fe(O):!1}function Zi(O){mt({force:!0,scrollToBottom:!0}),Ds({type:"input",terminalId:e.id,data:O})&&zR(O)&&Lt()}function Lt(){!Ye.current||!Re.current||(bt(),de.current=TR.map(O=>{const fe=window.setTimeout(()=>{de.current=de.current.filter(Oe=>Oe!==fe),Ye.current&&Re.current&&Ds({type:"refresh_cwd",terminalId:e.id})},O);return fe}))}function Qi(){R.current?.focus()}function Ir(){ji(O=>{const fe=!O;return Ne.current=fe,fe}),Qi()}function Ui(O){Ne.current=O,ji(O)}function zs(O){Ne.current&&Ui(!1),Zi(XD(O)),Qi()}return _.jsxs("section",{className:"terminal-pane","data-active":n,onMouseDown:()=>{n||p()},children:[_.jsx(NR,{terminal:e,canClose:o,tabId:d,transcriptSource:Ti,onOpenTranscript:()=>Hi(!0),onClose:m}),_.jsx("div",{className:"xterm-container",ref:B}),xe?_.jsx("div",{className:"terminal-history-loader",role:"status","aria-label":"Loading older terminal output",children:_.jsx("span",{"aria-hidden":"true"})}):null,C&&Xe?_.jsxs("div",{className:"terminal-scroll-progress","data-active":yt,"aria-hidden":"true",children:[Xe.current,"/",Xe.total]}):C&&te?_.jsxs("div",{className:"terminal-scroll-progress","data-active":!1,"data-pending":"true","data-buffer":te.alternate?"alternate":"normal","aria-hidden":"true",children:[te.alternate?"alt ":"","0/?"]}):null,He?_.jsx("button",{type:"button",className:"terminal-scroll-bottom-button","aria-label":"Scroll terminal to bottom",title:"Scroll to bottom",onPointerDown:O=>O.stopPropagation(),onMouseDown:O=>O.stopPropagation(),onClick:O=>{O.stopPropagation(),Xi()},children:"↓"}):null,Vi?_.jsx("button",{type:"button",className:"terminal-scroll-handle","aria-label":"Drag terminal scroll handle",title:"Drag to scroll",onPointerDown:En,onPointerMove:Ls,children:_.jsx("span",{"aria-hidden":"true"})}):null,n&&e.status==="running"?qt?_.jsx($D,{ctrlActive:kt,onCtrl:Ir,onStandaloneKey:zs,onPreserveFocus:Qi,onHide:()=>Jt(!1)}):_.jsx("button",{type:"button",className:"mobile-terminal-key-toggle","aria-label":"Show terminal control keys",title:"Show Ctrl / Esc / Tab / arrows",onMouseDown:O=>{O.stopPropagation(),Qi()},onPointerDown:O=>{O.stopPropagation(),Qi()},onClick:()=>Jt(!0),children:"⌨"}):null,_.jsx(nR,{terminalId:e.id,onSubmit:Zi,disabled:e.status!=="running"}),$s&&Ti?_.jsx(BR,{terminal:e,serverApi:t,source:Ti,onClose:()=>Hi(!1)}):null]})}function tb(e){return{background:"#0a0d10",foreground:"#e2e8ee",cursor:e2(e),selectionBackground:t2(e)}}function NR({terminal:e,canClose:t,tabId:n,transcriptSource:a,onOpenTranscript:o,onClose:c}){const d=Fb({id:`pane-${e.id}`,disabled:!n,...n?{data:{kind:"pane",sourceTabId:n,terminalId:e.id}}:{}}),p={cursor:n?"grab":"default",opacity:d.isDragging?.5:void 0};return _.jsxs("header",{ref:d.setNodeRef,className:"terminal-pane-header",style:p,"data-dragging":d.isDragging,...d.attributes,...d.listeners,children:[_.jsx("span",{className:"terminal-pane-dot","aria-hidden":"true"}),_.jsx("span",{className:"terminal-pane-cwd",title:e.cwd,children:e.cwd}),_.jsx("span",{className:"terminal-pane-spacer"}),a?_.jsx("button",{type:"button",className:"terminal-pane-transcript","data-provider":a.provider,title:`View ${Oa(a.provider)} transcript history`,"aria-label":`View ${Oa(a.provider)} transcript history`,onPointerDown:m=>m.stopPropagation(),onMouseDown:m=>m.stopPropagation(),onClick:m=>{m.stopPropagation(),o()},children:"View history"}):null,_.jsx("span",{className:`terminal-pane-state terminal-pane-state-${e.status}`,children:e.status}),t?_.jsx("button",{type:"button",className:"terminal-pane-close","aria-label":`Close pane ${e.title}`,title:"Close pane",onPointerDown:m=>m.stopPropagation(),onMouseDown:m=>m.stopPropagation(),onClick:m=>{m.stopPropagation(),c()},children:"x"}):null]})}function BR({terminal:e,serverApi:t,source:n,onClose:a}){const o=g.useRef(null),c=g.useRef(0),d=g.useRef(!1),p=g.useRef(!1),m=g.useRef(null),[f,S]=g.useState([]),[y,b]=g.useState(null),[x,C]=g.useState(!1),[k,B]=g.useState(!0),[R,re]=g.useState(!1),[F,J]=g.useState(null),[ce,q]=g.useState(""),[I,ie]=g.useState("all"),[de,j]=g.useState(()=>new Set);g.useEffect(()=>{c.current+=1;const E=c.current;return d.current=!1,p.current=!0,m.current=null,S([]),b(null),C(!1),J(null),$(null,"initial",E),()=>{c.current===E&&(c.current+=1)}},[t,n.provider,n.sessionId,e.id]),g.useLayoutEffect(()=>{const E=o.current;if(!E)return;if(p.current){p.current=!1,E.scrollTop=E.scrollHeight;return}const W=m.current;W!==null&&(m.current=null,E.scrollTop+=E.scrollHeight-W)},[f]);async function $(E,W,ee=c.current){if(!d.current){d.current=!0,W==="initial"?B(!0):(re(!0),m.current=o.current?.scrollHeight??null),J(null);try{await H(E,W,ee)}catch(he){if(c.current!==ee)return;J(he instanceof Error?he.message:"Failed to load transcript history.")}finally{c.current===ee&&(d.current=!1,B(!1),re(!1))}}}async function H(E,W,ee){let he=E,ge=0;for(;c.current===ee;){const me=await t.getTerminalTranscriptHistory(e.id,{...he?{cursor:he}:{},limit:MR});if(c.current!==ee)return;const Ce=UR(me.output,n.provider);if(b(me.cursor),C(!!(me.hasMore&&me.cursor)),Ce){S(ze=>W==="older"?[Ce,...ze]:[Ce]);return}if(!me.hasMore||!me.cursor||ge>=AR)return;he=me.cursor,ge+=1}}function L(){const E=o.current;!E||E.scrollTop>72||!x||!y||d.current||$(y,"older")}const X=Oa(n.provider),Z=f.join(""),A=g.useMemo(()=>PR(Z,n.provider),[n.provider,Z]),V=ce.trim().toLowerCase(),Q=g.useMemo(()=>A.filter(E=>I!=="all"&&E.kind!==I?!1:V?E.searchText.includes(V):!0),[I,V,A]),ve=A.length===0?"0 entries":`${Q.length}/${A.length} entries`;function Se(E){j(W=>{const ee=new Set(W);return ee.has(E)?ee.delete(E):ee.add(E),ee})}return _.jsx("div",{className:"security-overlay transcript-overlay",role:"dialog","aria-modal":"true","aria-labelledby":"transcript-dialog-title",onClick:a,children:_.jsxs("div",{className:"security-panel transcript-dialog",onClick:E=>E.stopPropagation(),children:[_.jsxs("header",{className:"security-panel-header",children:[_.jsxs("div",{className:"transcript-dialog-title",children:[_.jsxs("h2",{id:"transcript-dialog-title",children:[X," JSONL"]}),_.jsx("span",{title:n.sessionId,children:n.sessionId})]}),_.jsx("button",{type:"button",className:"security-close","aria-label":"Close",onClick:a,children:"×"})]}),_.jsxs("div",{className:"transcript-dialog-controls",children:[_.jsxs("label",{className:"transcript-search",children:[_.jsx("span",{children:"Search"}),_.jsx("input",{type:"search",value:ce,"aria-label":"Search JSONL transcript",placeholder:"Find text",onChange:E=>q(E.currentTarget.value)})]}),_.jsx("div",{className:"transcript-filter-group",role:"group","aria-label":"Transcript type filter",children:LR.map(E=>_.jsx("button",{type:"button","data-active":I===E.value,onClick:()=>ie(E.value),children:E.label},E.value))}),_.jsx("span",{className:"transcript-result-count",children:ve})]}),_.jsxs("div",{ref:o,className:"transcript-dialog-scroll","aria-label":"JSONL transcript output",onScroll:L,children:[R?_.jsx("div",{className:"transcript-dialog-status",children:"Loading older entries..."}):null,!k&&x?_.jsx("div",{className:"transcript-dialog-hint",children:"Scroll up for older entries"}):null,Z?_.jsx("div",{className:"transcript-block-list",children:Q.map(E=>_.jsx(OR,{block:E,expanded:de.has(E.id),onToggle:()=>Se(E.id)},E.id))}):null,k?_.jsx("div",{className:"transcript-dialog-status",children:"Loading transcript..."}):null,!k&&!Z&&!F?_.jsx("div",{className:"transcript-dialog-status",children:"No transcript entries found."}):null,!k&&Z&&Q.length===0?_.jsx("div",{className:"transcript-dialog-status",children:"No matching transcript entries."}):null,F?_.jsx("div",{className:"transcript-dialog-error",children:F}):null]})]})})}const LR=[{value:"all",label:"All"},{value:"user",label:"User"},{value:"assistant",label:"Assistant"},{value:"tool",label:"Tool"},{value:"system",label:"System"}];function OR({block:e,expanded:t,onToggle:n}){const a=e.kind==="tool"&&(e.body.length>1800||FR(e.body)>42),c=a&&!t?`${e.body.slice(0,1800).trimEnd()}
32
32
  ...`:e.body;return _.jsxs("article",{className:"transcript-block","data-kind":e.kind,children:[_.jsxs("header",{children:[_.jsx("span",{children:e.header}),a?_.jsx("button",{type:"button",onClick:n,children:t?"Collapse":"Expand"}):null]}),_.jsx("pre",{children:c})]})}function zR(e){return e.includes("\r")||e.includes(`
33
33
  `)}function Sf(e){return e instanceof yn&&e.status===404}function jR(e){if(!e)return!1;const t=e.replace(/^.*[\\/]/,"").toLowerCase();return t==="codex"||t==="codex.js"||t.startsWith("codex-")||t==="claude"||t==="claude.js"||t.startsWith("claude-")}function HR(e){if(jR(e))return!0;if(!e)return!1;const t=e.replace(/^.*[\\/]/,"").toLowerCase();return t==="node"||t==="nodejs"}function Oa(e){return e==="codex"?"Codex":"Claude"}function UR(e,t){const n=`[nterminal] ${Oa(t)} transcript archive ends here. Live terminal screen continues below.`,a=e.join("").replace(/\r\n/g,`
34
34
  `).replace(/\r/g,`
@@ -39,6 +39,6 @@ WARNING: This link could potentially be dangerous`)){let n=window.open();if(n){t
39
39
  `),o=[];let c=null;for(let d=0;d<a.length;d+=1){const p=a[d];if((d===0||a[d-1]?.trim()==="")&&KR(p,t)){c&&o.push(c),c={header:p,bodyLines:[]};continue}c||(c={header:"Transcript",bodyLines:[]}),c.bodyLines.push(p)}return c&&o.push(c),o.map((d,p)=>{const m=d.bodyLines.join(`
40
40
  `).trimEnd(),f=m?`${d.header}
41
41
  ${m}`:d.header;return{id:`${p}:${qR(f)}`,kind:IR(d.header,m,t),header:d.header,body:m,text:f,searchText:f.toLowerCase()}})}function KR(e,t){const n=mw(e);return n?n==="User"||n===Oa(t)||n==="System"||n==="Tool output"||n.startsWith("Tool call:"):!1}function mw(e){return(e.match(/^\[[^\]\n]+\]\s+(.+)$/)?.[1]??e).trim()||null}function IR(e,t,n){const a=mw(e);return a==="User"?"user":a===Oa(n)?t.startsWith("[tool call:")||t.startsWith("[tool output]")?"tool":"assistant":a==="System"?"system":a==="Tool output"||a?.startsWith("Tool call:")?"tool":"other"}function FR(e){return e.split(`
42
- `).length}function qR(e){let t=5381;for(let n=0;n<e.length;n+=1)t=t*33^e.charCodeAt(n);return(t>>>0).toString(36)}function WR(e){let t=0;for(const n of e){if(!n)continue;const a=n.match(/\r\n|\r|\n/g);t+=a?.length??1}return Math.max(1,t)}function ib(e){const t=[];for(const n of e){const a=_w(n);a&&t.push(a)}return t}function _w(e){return e.replace(/\x1b\[\?([0-9;:]*)([hl])/g,(t,n,a)=>{const o=n.split(";").filter(Boolean).filter(c=>!RR.has(c.split(":")[0]??""));return o.length>0?`\x1B[?${o.join(";")}${a}`:""})}function bf(e,t={}){const n={};return(e?.force||t.force)&&(n.force=!0),(e?.scrollToBottom||t.scrollToBottom)&&(n.scrollToBottom=!0),n}function YR(e){const t=e.buffer.active,n=t.baseY+e.rows;return n<=e.rows?null:{current:Math.max(1,Math.min(n,t.viewportY+1)),total:n}}function ir(e){return e.buffer.active.viewportY>=Math.max(0,e.buffer.active.baseY-1)}function $c(e,t){return!t||ir(e)}function sb(e){return ir(e)?!1:(e.scrollToLine(Math.max(0,e.buffer.active.baseY)),!0)}function $R(e,t,n,a,o,c){const d=p=>{const m=XR(p);m!==0&&(p.cancelable&&p.preventDefault(),p.stopPropagation(),VR(t,m,n,a,o,c))};return e.addEventListener("wheel",d,{capture:!0,passive:!1}),()=>{e.removeEventListener("wheel",d,{capture:!0})}}function VR(e,t,n,a,o,c){const d=()=>{o();try{e.scrollLines(t)}finally{c()}n(),t<0&&e.buffer.active.viewportY<=3&&a(t)};if(e.buffer.active.type==="alternate"){e.write(Np,d);return}d()}function XR(e){const n=e.deltaMode===WheelEvent.DOM_DELTA_PIXEL?e.deltaY/24:e.deltaMode===WheelEvent.DOM_DELTA_PAGE?e.deltaY*24:e.deltaY;if(n===0)return 0;const a=n<0?Math.floor(n):Math.ceil(n);return Math.max(-30,Math.min(30,a))}function GR(e,t,n,a,o,c,d){let p=null,m=0;const f={passive:!1};function S(x){p=wf(x),m=0}function y(x){const C=wf(x);if(C===null){p=null,m=0;return}if(p===null){p=C;return}const k=C.clientY-p.clientY;if(p=C,x.cancelable&&x.preventDefault(),k===0)return;if(ZR(t)&&QR(t,C,-k)){m=0;return}m-=k/n();const B=m<0?Math.ceil(m):Math.floor(m);if(B!==0){m-=B,c();try{t.scrollLines(B)}finally{d()}a(),B<0&&t.buffer.active.viewportY<=3&&o(B)}}function b(x){if(x.touches.length>0){p=wf(x);return}p=null,m=0}return e.addEventListener("touchstart",S,f),e.addEventListener("touchmove",y,f),e.addEventListener("touchend",b),e.addEventListener("touchcancel",b),()=>{e.removeEventListener("touchstart",S,f),e.removeEventListener("touchmove",y,f),e.removeEventListener("touchend",b),e.removeEventListener("touchcancel",b)}}function wf(e){if(e.touches.length!==1)return null;const t=e.touches[0];return t?{clientX:t.clientX,clientY:t.clientY}:null}function ZR(e){return e.buffer.active.type==="alternate"||e.modes.mouseTrackingMode!=="none"}function QR(e,t,n){const a=e.element;return a?(a.dispatchEvent(JR(t,n)),!0):!1}function JR(e,t){const n=typeof WheelEvent=="function"?WheelEvent.DOM_DELTA_PIXEL:0,a={bubbles:!0,cancelable:!0,clientX:e.clientX,clientY:e.clientY,deltaX:0,deltaY:t,deltaMode:n};if(typeof WheelEvent=="function")return new WheelEvent("wheel",a);const o=new Event("wheel",a);return Object.defineProperties(o,{clientX:{value:e.clientX},clientY:{value:e.clientY},deltaX:{value:0},deltaY:{value:t},deltaMode:{value:0}}),o}function Bp({node:e,terminals:t,editors:n,api:a,activeTerminalId:o,visible:c=!0,refreshCwdOnEnter:d=!1,tabId:p,dropZoneActive:m=!1,draggingTerminalId:f=null,mobileFocusLeafKey:S=null,path:y=[],totalPanes:b,onSelect:x,onClose:C,onResize:k,onExit:B,onSnapshot:R,onCloseEditor:re,onAuthClose:F}){const J=b??Lp(e);if(y.length===0&&S){const ie=Op(e),de=ie.some(j=>j.key===S)?S:ie[0]?.key;if(ie.length>1&&de)return _.jsx("div",{className:"mobile-focused-split",children:ie.map(j=>{const $=j.key===de;if(j.type==="editor"){const L=n[j.editorId];return _.jsx("div",{className:"mobile-focused-pane","data-active":$,"aria-hidden":!$,children:L?_.jsx(Xy,{api:a,editor:L,canClose:J>1,onClose:()=>re(j.editorId)}):_.jsx("div",{className:"missing-pane",children:"Editor unavailable"})},j.key)}const H=t[j.terminalId];return H?_.jsx("div",{className:"mobile-focused-pane","data-active":$,"aria-hidden":!$,children:_.jsx(eb,{terminal:H,serverApi:a,active:$,visible:c&&$,canClose:J>1,refreshCwdOnEnter:d&&$,tabId:p,onSelect:()=>x(j.terminalId),onClose:()=>C(j.terminalId),onExit:L=>B(j.terminalId,L),onSnapshot:R,...F?{onAuthClose:F}:{}})},j.key):_.jsx("div",{className:"mobile-focused-pane","data-active":$,"aria-hidden":!$,children:_.jsx("div",{className:"missing-pane",children:"Terminal unavailable"})},j.key)})})}if(e.type==="pane"){const ie=t[e.terminalId];if(!ie)return _.jsx("div",{className:"missing-pane",children:"Terminal unavailable"});const de=_.jsx(eb,{terminal:ie,serverApi:a,active:e.terminalId===o,visible:c,canClose:J>1,refreshCwdOnEnter:d&&e.terminalId===o,tabId:p,onSelect:()=>x(e.terminalId),onClose:()=>C(e.terminalId),onExit:$=>B(e.terminalId,$),onSnapshot:R,...F?{onAuthClose:F}:{}});return m&&f!==e.terminalId?_.jsxs("div",{className:"pane-drop-host",children:[de,_.jsx(Vc,{terminalId:e.terminalId,side:"top"}),_.jsx(Vc,{terminalId:e.terminalId,side:"right"}),_.jsx(Vc,{terminalId:e.terminalId,side:"bottom"}),_.jsx(Vc,{terminalId:e.terminalId,side:"left"})]}):de}if(e.type==="editor"){const ie=n[e.editorId];return ie?_.jsx(Xy,{api:a,editor:ie,canClose:J>1,onClose:()=>re(e.editorId)}):_.jsx("div",{className:"missing-pane",children:"Editor unavailable"})}const ce=`${e.ratio*100}%`,q=`${(1-e.ratio)*100}%`,I=e.direction==="vertical"?{gridTemplateColumns:`${ce} 1px ${q}`}:{gridTemplateRows:`${ce} 1px ${q}`};return _.jsxs("div",{className:"split-pane","data-direction":e.direction,style:I,children:[_.jsx("div",{className:"split-cell",children:_.jsx(Bp,{node:e.first,terminals:t,editors:n,api:a,activeTerminalId:o,visible:c,refreshCwdOnEnter:d,tabId:p,dropZoneActive:m,draggingTerminalId:f,mobileFocusLeafKey:S,path:[...y,0],totalPanes:J,onSelect:x,onClose:C,onResize:k,onExit:B,onSnapshot:R,onCloseEditor:re,...F?{onAuthClose:F}:{}})}),_.jsx(eM,{direction:e.direction,path:y,onResize:k}),_.jsx("div",{className:"split-cell",children:_.jsx(Bp,{node:e.second,terminals:t,editors:n,api:a,activeTerminalId:o,visible:c,refreshCwdOnEnter:d,tabId:p,dropZoneActive:m,draggingTerminalId:f,mobileFocusLeafKey:S,path:[...y,1],totalPanes:J,onSelect:x,onClose:C,onResize:k,onExit:B,onSnapshot:R,onCloseEditor:re,...F?{onAuthClose:F}:{}})})]})}function Vc({terminalId:e,side:t}){const{setNodeRef:n,isOver:a}=qb({id:`pane-${e}-${t}`,data:{kind:"pane-zone",terminalId:e,side:t}});return _.jsx("div",{ref:n,className:`pane-drop-zone pane-drop-zone--${t}`,"data-over":a,"aria-hidden":"true"})}function eM({direction:e,path:t,onResize:n}){function a(o){o.preventDefault(),o.stopPropagation();const c=o.currentTarget;c.setPointerCapture?.(o.pointerId),c.classList.add("is-dragging"),document.body.style.cursor=e==="vertical"?"col-resize":"row-resize";const d=c.parentElement;if(!d)return;const p=d.getBoundingClientRect();function m(S){const y=e==="vertical"?(S.clientX-p.left)/p.width:(S.clientY-p.top)/p.height;n(t,Math.min(.9,Math.max(.1,y)))}function f(){window.removeEventListener("pointermove",m),window.removeEventListener("pointerup",f),c.classList.remove("is-dragging"),document.body.style.cursor=""}window.addEventListener("pointermove",m),window.addEventListener("pointerup",f)}return _.jsx("div",{"aria-label":"Resize panes","aria-orientation":e==="vertical"?"vertical":"horizontal",className:"split-divider","data-direction":e,onPointerDown:a,role:"separator",children:_.jsx("span",{className:"split-divider-handle","aria-hidden":"true"})})}function Lp(e){return e.type==="pane"||e.type==="editor"?1:Lp(e.first)+Lp(e.second)}function Op(e){return e.type==="pane"?[{key:tM(e.terminalId),type:"terminal",terminalId:e.terminalId}]:e.type==="editor"?[{key:iM(e.editorId),type:"editor",editorId:e.editorId}]:[...Op(e.first),...Op(e.second)]}function tM(e){return`terminal:${e}`}function iM(e){return`editor:${e}`}const Am="workspace-default",sM="NTerminal";function nM(){return{workspaces:[],activeWorkspaceId:null,terminals:{}}}function rM(e,t){switch(t.type){case"workspace.hydrated":return zp(t.terminals,t.savedTabs,t.savedWorkspaces,t.savedActiveWorkspaceId);case"workspace.created":return aM(e,{id:t.workspaceId,title:t.title});case"workspace.closed":return oM(e,t.workspaceId);case"workspace.selected":return vw(e,t.workspaceId);case"workspace.renamed":return lM(e,t.workspaceId,t.title);case"terminal.created":return gw(e,t.terminal);case"terminal.split":return cM(e,t.terminal,t.direction);case"terminal.updated":return bM(e,t.terminal);case"terminal.exited":return wM(e,t.terminalId,t.exitCode);case"terminal.closed":return Sw(e,t.terminalId);case"terminal.detached":return CM(e,t.terminalId);case"editor.split":return uM(e,t.editorId,t.title,t.direction);case"editor.closed":return xM(e,t.editorId);case"pane.selected":return vM(e,t.terminalId);case"pane.resized":return gM(e,t.path,t.ratio);case"tab.selected":return dM(e,t.tabId);case"tab.renamed":return _M(e,t.tabId,t.title);case"tab.reordered":return yw(e,t.sourceTabId,t.targetIndex);case"tab.dropped_into_pane":return fM(e,t.sourceTabId,t.sourceTerminalId,t.targetTerminalId,t.side);case"terminal.extracted_to_tab":return pM(e,t.sourceTabId,t.sourceTerminalId,t.targetIndex);case"activePane.closed":return hM(e);default:return e}}function aM(e,t){if(e.workspaces.some(a=>a.id===t.id))return vw(e,t.id);const n={id:t.id,title:t.title,tabs:[],activeTabId:null};return{...e,workspaces:[...e.workspaces,n],activeWorkspaceId:n.id}}function vw(e,t){return e.workspaces.some(n=>n.id===t)?{...e,activeWorkspaceId:t}:e}function lM(e,t,n){const a=n.trim();if(!a)return e;let o=!1;const c=e.workspaces.map(d=>d.id!==t||d.title===a?d:(o=!0,{...d,title:a}));return o?{...e,workspaces:c}:e}function oM(e,t){if(e.workspaces.length<=1||!e.workspaces.some(p=>p.id===t))return e;const n=e.workspaces.find(p=>p.id===t),a=new Set(n?SM(n):[]),o={...e.terminals};for(const p of a)delete o[p];const c=e.workspaces.filter(p=>p.id!==t),d=e.activeWorkspaceId===t?c[0]?.id??null:e.activeWorkspaceId;return{workspaces:c,activeWorkspaceId:d,terminals:o}}function gw(e,t){const n=ww(e),a=Kr(n)??ju(),o=Cw(t);return{...n,activeWorkspaceId:a.id,terminals:{...n.terminals,[t.id]:t},workspaces:n.workspaces.map(c=>c.id===a.id?{...c,tabs:[...c.tabs,o],activeTabId:o.id}:c)}}function cM(e,t,n){const a=Kr(e),o=a?zu(a):void 0;if(!a||!o)return gw(e,t);const c=o.activeTerminalId,d=fo(o.root,c,{type:"split",direction:n,ratio:.5,first:{type:"pane",terminalId:c},second:{type:"pane",terminalId:t.id}});return{...e,terminals:{...e.terminals,[t.id]:t},workspaces:e.workspaces.map(p=>p.id===a.id?{...p,tabs:p.tabs.map(m=>m.id===o.id?{...m,root:d,activeTerminalId:t.id}:m)}:p)}}function uM(e,t,n,a){const o=Kr(e),c=o?zu(o):void 0;if(!o||!c)return e;const d=c.activeTerminalId,p=fo(c.root,d,{type:"split",direction:a,ratio:.5,first:{type:"pane",terminalId:d},second:{type:"editor",editorId:t,title:n}});return{...e,workspaces:e.workspaces.map(m=>m.id===o.id?{...m,tabs:m.tabs.map(f=>f.id===c.id?{...f,root:p,activeTerminalId:d}:f)}:m)}}function hM(e){const t=Kr(e),n=t?zu(t):void 0;return n?Sw(e,n.activeTerminalId):e}function dM(e,t){const n=Kr(e);return!n||!n.tabs.some(a=>a.id===t)?e:{...e,workspaces:e.workspaces.map(a=>a.id===n.id?{...a,activeTabId:t}:a)}}function yw(e,t,n){const a=e.workspaces.map(o=>{const c=o.tabs.findIndex(S=>S.id===t);if(c<0)return o;const d=o.tabs.slice(),[p]=d.splice(c,1);if(!p)return o;const m=Math.max(0,Math.min(d.length,n)),f=d.slice();return f.splice(m,0,p),mM(o.tabs,f)?o:{...o,tabs:f}});return a.every((o,c)=>o===e.workspaces[c])?e:{...e,workspaces:a}}function fM(e,t,n,a,o){if(n===a||!e.terminals[n]||!e.terminals[a])return e;let c=e.workspaces.map(m=>{const f=m.tabs.findIndex(C=>C.id===t);if(f<0)return m;const S=m.tabs[f];if(!S)return m;const y=po(S.root,n);if(!y){const C=m.tabs.filter((k,B)=>B!==f);return{...m,tabs:C}}const b={...S,root:y,activeTerminalId:Es(y)[0]??S.activeTerminalId},x=m.tabs.slice();return x[f]=b,{...m,tabs:x}});const d=o==="left"||o==="right"?"vertical":"horizontal",p=o==="left"||o==="top";return c=c.map(m=>{const f=m.tabs.findIndex(k=>Es(k.root).includes(a));if(f<0)return m;const S=m.tabs[f];if(!S)return m;const y={type:"pane",terminalId:n},b={type:"split",direction:d,ratio:.5,first:p?y:{type:"pane",terminalId:a},second:p?{type:"pane",terminalId:a}:y},x=fo(S.root,a,b),C=m.tabs.slice();return C[f]={...S,root:x,activeTerminalId:n},{...m,tabs:C,activeTabId:S.id}}),ww({...e,workspaces:c})}function pM(e,t,n,a){let o=-1,c=-1;for(let B=0;B<e.workspaces.length;B+=1){const R=e.workspaces[B].tabs.findIndex(re=>re.id===t);if(R>=0){o=B,c=R;break}}if(o<0)return e;const d=e.workspaces[o],p=d.tabs[c],m=Es(p.root);if(!m.includes(n))return e;if(m.length===1)return yw(e,t,a);const f=po(p.root,n);if(!f)return e;const S={...p,root:f,activeTerminalId:Es(f)[0]??p.activeTerminalId},y=e.terminals[n],b={id:`tab-${Date.now().toString(36)}-${n.slice(0,8)}`,title:y?.title??"",activeTerminalId:n,root:{type:"pane",terminalId:n}},x=d.tabs.slice();x[c]=S;const C=Math.max(0,Math.min(x.length,a));x.splice(C,0,b);const k=e.workspaces.slice();return k[o]={...d,tabs:x,activeTabId:b.id},{...e,workspaces:k}}function mM(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n+=1)if(e[n]?.id!==t[n]?.id)return!1;return!0}function _M(e,t,n){const a=n.trim();if(!a)return e;let o=!1;const c=e.workspaces.map(d=>{let p=!1;const m=d.tabs.map(f=>f.id!==t||f.title===a?f:(o=!0,p=!0,{...f,title:a}));return p?{...d,tabs:m}:d});return o?{...e,workspaces:c}:e}function vM(e,t){const n=e.workspaces.find(o=>o.tabs.some(c=>mo(c.root,t))),a=n?.tabs.find(o=>mo(o.root,t));return!n||!a?e:{...e,activeWorkspaceId:n.id,workspaces:e.workspaces.map(o=>o.id===n.id?{...o,activeTabId:a.id,tabs:o.tabs.map(c=>c.id===a.id?{...c,activeTerminalId:t}:c)}:o)}}function gM(e,t,n){const a=Kr(e),o=a?zu(a):void 0;if(!a||!o)return e;const c=Kp(o.root,t,xw(n));return c===o.root?e:{...e,workspaces:e.workspaces.map(d=>d.id===a.id?{...d,tabs:d.tabs.map(p=>p.id===o.id?{...p,root:c}:p)}:d)}}function zp(e,t,n,a){const o=Object.fromEntries(e.map(S=>[S.id,S])),c=new Set(e.map(S=>S.id)),d=new Set;let p=EM(t,n,c,d);p.length===0&&(p=[ju()]);const m=typeof a=="string"&&p.some(S=>S.id===a)?a:p[0]?.id??null,f=m??p[0]?.id??Am;for(const S of e){if(d.has(S.id))continue;const y=Cw(S);p=TM(p,f,y),d.add(S.id)}return{workspaces:p.map(Do),activeWorkspaceId:m,terminals:o}}function Nm(e){return Es(e.root)}function yM(e){return Ip(e.root)}function SM(e){return e.tabs.flatMap(t=>Es(t.root))}function Cf(e){const t=e.workspaces.map(n=>{const a=n.tabs.flatMap(o=>{const c=Up(o.root);return c?[{...o,root:c}]:[]});return Do({...n,tabs:a})});return{activeWorkspaceId:t.some(n=>n.id===e.activeWorkspaceId)?e.activeWorkspaceId:t[0]?.id??null,workspaces:t}}function bM(e,t){return{...e,terminals:{...e.terminals,[t.id]:t},workspaces:e.workspaces.map(n=>({...n,tabs:n.tabs.map(a=>mo(a.root,t.id)?{...a,title:a.title||t.title}:a)}))}}function wM(e,t,n){const a=e.terminals[t];return a?{...e,terminals:{...e.terminals,[t]:{...a,status:"exited",exitCode:n}}}:e}function Sw(e,t){const n={...e.terminals};return delete n[t],bw(e,t,n)}function CM(e,t){return e.terminals[t]?bw(e,t,{...e.terminals}):e}function bw(e,t,n){const a=e.workspaces.map(c=>{const d=[];for(const p of c.tabs){const m=po(p.root,t);if(!m)continue;const f=Es(m),S=f.includes(p.activeTerminalId)?p.activeTerminalId:f[0];S&&d.push({...p,root:m,activeTerminalId:S})}return Do({...c,tabs:d})}),o=a.some(c=>c.id===e.activeWorkspaceId);return{workspaces:a,activeWorkspaceId:o?e.activeWorkspaceId:a[0]?.id??null,terminals:n}}function xM(e,t){const n=e.workspaces.map(o=>{const c=[];for(const d of o.tabs){const p=jp(d.root,t);if(!p)continue;const m=Es(p),f=m.includes(d.activeTerminalId)?d.activeTerminalId:m[0];f&&c.push({...d,root:p,activeTerminalId:f})}return Do({...o,tabs:c})}),a=n.some(o=>o.id===e.activeWorkspaceId);return{...e,workspaces:n,activeWorkspaceId:a?e.activeWorkspaceId:n[0]?.id??null}}function EM(e,t,n,a){if(t&&t.length>0){const o=[];for(const c of t)kM(c)&&o.push(nb(c,n,a));if(o.length>0)return o}return[nb({...ju(),tabs:e??[]},n,a)]}function nb(e,t,n){const a=[];for(const o of e.tabs){if(!DM(o))continue;const c=Hp(o.root,t);if(!c)continue;const d=Es(c);for(const m of d)n.add(m);const p=d.includes(o.activeTerminalId)?o.activeTerminalId:d[0];p&&a.push({...o,root:c,activeTerminalId:p})}return Do({...e,tabs:a})}function ww(e){return Kr(e)?e:{...e,workspaces:[ju()],activeWorkspaceId:Am}}function Kr(e){return e.workspaces.find(t=>t.id===e.activeWorkspaceId)??e.workspaces[0]}function zu(e){return e.tabs.find(t=>t.id===e.activeTabId)??e.tabs[0]}function ju(){return{id:Am,title:sM,tabs:[],activeTabId:null}}function Do(e){const t=e.tabs.some(n=>n.id===e.activeTabId);return{...e,activeTabId:t?e.activeTabId:e.tabs[0]?.id??null}}function TM(e,t,n){return e.map(a=>a.id===t?{...a,tabs:[...a.tabs,n],activeTabId:a.activeTabId??n.id}:a)}function Cw(e){return{id:`tab-${e.id}`,title:e.title||e.id,root:{type:"pane",terminalId:e.id},activeTerminalId:e.id}}function fo(e,t,n){return e.type==="pane"?e.terminalId===t?n:e:e.type==="editor"?e:{...e,first:fo(e.first,t,n),second:fo(e.second,t,n)}}function po(e,t){if(e.type==="pane")return e.terminalId===t?null:e;if(e.type==="editor")return e;const n=po(e.first,t),a=po(e.second,t);return n&&a?{...e,first:n,second:a}:n??a}function jp(e,t){if(e.type==="editor")return e.editorId===t?null:e;if(e.type==="pane")return e;const n=jp(e.first,t),a=jp(e.second,t);return n&&a?{...e,first:n,second:a}:n??a}function Hp(e,t){if(e.type==="pane")return t.has(e.terminalId)?e:null;if(e.type==="editor")return null;const n=Hp(e.first,t),a=Hp(e.second,t);return n&&a?{...e,ratio:xw(e.ratio),first:n,second:a}:n??a}function Up(e){if(e.type==="editor")return null;if(e.type==="pane")return e;const t=Up(e.first),n=Up(e.second);return t&&n?{...e,first:t,second:n}:t??n}function kM(e){if(!e||typeof e!="object")return!1;const t=e;return typeof t.id=="string"&&typeof t.title=="string"&&(typeof t.activeTabId=="string"||t.activeTabId===null)&&Array.isArray(t.tabs)}function DM(e){if(!e||typeof e!="object")return!1;const t=e;return typeof t.id=="string"&&typeof t.title=="string"&&typeof t.activeTerminalId=="string"&&Pp(t.root)}function Pp(e){if(!e||typeof e!="object")return!1;const t=e;return t.type==="pane"?typeof t.terminalId=="string":t.type==="editor"?typeof t.editorId=="string"&&typeof t.title=="string":t.type==="split"?(t.direction==="horizontal"||t.direction==="vertical")&&Pp(t.first)&&Pp(t.second):!1}function Kp(e,t,n){if(e.type==="pane"||e.type==="editor")return e;if(t.length===0)return e.ratio===n?e:{...e,ratio:n};const[a,...o]=t;if(a===0){const c=Kp(e.first,o,n);return c===e.first?e:{...e,first:c}}if(a===1){const c=Kp(e.second,o,n);return c===e.second?e:{...e,second:c}}return e}function xw(e){return Number.isFinite(e)?Math.min(.9,Math.max(.1,e)):.5}function mo(e,t){return e.type==="pane"?e.terminalId===t:e.type==="editor"?!1:mo(e.first,t)||mo(e.second,t)}function Es(e){return e.type==="pane"?[e.terminalId]:e.type==="editor"?[]:[...Es(e.first),...Es(e.second)]}function Ip(e){return e.type==="pane"||e.type==="editor"?1:Ip(e.first)+Ip(e.second)}const ur=new Map,_o=new Map,vo=new Map;function Pa(e){return e??"__local__"}function RM(e){return{agentId:e,state:nM(),editors:{},loaded:!1,error:null,layoutRevision:null,lastPersistedLayoutJson:null,unreadCompletions:new Set,mutable:{editorIdCounter:0,saveCoord:{pendingLayoutSave:null,saveTimer:null,persistChain:Promise.resolve(),nextPersistQueued:!1,nextPersistLayout:null,queuedBaseRevision:void 0}}}}function Ft(e){const t=Pa(e);let n=ur.get(t);return n||(n=RM(e),ur.set(t,n)),n}function Ew(e,t){const n=Pa(e);let a=_o.get(n);return a||(a=new Set,_o.set(n,a)),a.add(t),()=>{a.delete(t)}}function MM(e){const t=Pa(e),n=_o.get(t);if(n)for(const a of Array.from(n))a()}function Ka(e,t){ur.set(Pa(e),t),MM(e)}const Fp=new Set;function AM(e){return Fp.add(e),()=>{Fp.delete(e)}}function Ul(e,t){const n=Ft(e),a=Pa(e);t.type==="workspace.hydrated"&&vo.delete(a);const o=rM(n.state,t);let c=n.unreadCompletions,d=null;if(t.type==="terminal.updated"){const f=n.state.terminals[t.terminal.id],S=f?.activity==="busy",y=t.terminal.activity==="busy",b=t.terminal.activity==="idle",x=HM(a);if(t.notifyCompletion===!0&&y&&x.add(t.terminal.id),t.notifyCompletion===!0&&S&&b&&x.has(t.terminal.id)){const C=NM(o,t.terminal.id);C&&(d={terminalId:t.terminal.id,tabId:C.tab.id,commandName:f?.currentCommand??null},C.workspace.activeTabId!==C.tab.id&&(c.has(C.tab.id)||(c=new Set(c),c.add(C.tab.id))))}(b||t.terminal.status==="exited")&&x.delete(t.terminal.id)}t.type==="tab.selected"&&c.has(t.tabId)&&(c=new Set(c),c.delete(t.tabId));const p=o!==n.state,m=c!==n.unreadCompletions;if((p||m)&&Ka(e,{...n,state:o,unreadCompletions:c}),m&&Bm(),d)for(const f of Array.from(Fp))f({agentId:e,...d})}function NM(e,t){for(const n of e.workspaces)for(const a of n.tabs)if(Es(a.root).includes(t))return{workspace:n,tab:a};return null}const qp=new Set;function BM(e){return qp.add(e),()=>{qp.delete(e)}}function LM(){let e=0;for(const t of ur.values())e+=t.unreadCompletions.size;return e}function Bm(){for(const e of Array.from(qp))e()}function OM(e,t){const n=Ft(e);if(!n.unreadCompletions.has(t))return;const a=new Set(n.unreadCompletions);a.delete(t),Ka(e,{...n,unreadCompletions:a}),Bm()}function rb(e,t){const n=Ft(e);t!==n.state&&Ka(e,{...n,state:t})}function ab(e,t){const n=Ft(e),a=t(n.editors);a!==n.editors&&Ka(e,{...n,editors:a})}function Ta(e,t,n){const a=Ft(e);a.loaded===t&&a.error===n||Ka(e,{...a,loaded:t,error:n})}function Xc(e,t,n){const a=Ft(e);a.layoutRevision===t&&a.lastPersistedLayoutJson===n||Ka(e,{...a,layoutRevision:t,lastPersistedLayoutJson:n})}function zM(e){const t=Ft(e);return t.mutable.editorIdCounter+=1,t.mutable.editorIdCounter}function jM(e){const t=Pa(e),n=ur.get(t);n&&n.mutable.saveCoord.saveTimer!==null&&window.clearTimeout(n.mutable.saveCoord.saveTimer);const a=n?n.unreadCompletions.size>0:!1;ur.delete(t),_o.delete(t),vo.delete(t),a&&Bm()}function lb(){for(const e of ur.values()){const t=e.mutable.saveCoord.saveTimer;t!==null&&window.clearTimeout(t),e.unreadCompletions.size>0}ur.clear(),_o.clear(),vo.clear()}function HM(e){let t=vo.get(e);return t||(t=new Set,vo.set(e,t)),t}function UM(e,t){let n=!1,a=!1,o=null,c=!1;for(const d of Nm(e)){const p=t[d];if(p){if(p.status==="exited"){c=!0,n=!0;continue}p.activity==="busy"?(a=!0,n=!0,!o&&p.currentCommand&&(o=p.currentCommand)):p.activity==="idle"&&(n=!0)}}return n?c?{state:"exited",commandName:null}:a?{state:"busy",commandName:o}:{state:"idle",commandName:null}:null}function PM(e){return e?e.state==="busy"?e.commandName?`running: ${e.commandName}`:"running":e.state==="exited"?"exited":"idle":""}function KM({tabs:e,activeTabId:t,terminals:n,unreadCompletionTabIds:a,detachedTerminals:o,onSelectTab:c,onCreateTab:d,onToggleWorkspaces:p,onCloseTerminals:m,onReattachTerminal:f,onDeleteTerminal:S,onSplitVertical:y,onSplitHorizontal:b,onRenameTab:x,activePaneAvailable:C}){const[k,B]=g.useState(null),[R,re]=g.useState(null),F=g.useRef(null);g.useEffect(()=>{F.current?.focus(),F.current?.select()},[k?.tabId]);function J(I,ie){B({tabId:I,title:ie})}function ce(){if(!k)return;const I=k.title.trim();I&&x(k.tabId,I),B(null)}function q(){return _.jsxs("div",{className:"terminal-pane-actions","aria-label":"Pane actions",children:[_.jsx("button",{type:"button",className:"pane-action-button","aria-label":"Split right",title:`Split right - ${YE()}`,onClick:y,disabled:!C,children:_.jsx("span",{className:"split-icon split-icon-right","aria-hidden":"true"})}),_.jsx("button",{type:"button",className:"pane-action-button","aria-label":"Split down",title:`Split down - ${$E()}`,onClick:b,disabled:!C,children:_.jsx("span",{className:"split-icon split-icon-down","aria-hidden":"true"})})]})}return _.jsxs(_.Fragment,{children:[_.jsxs("nav",{className:"terminal-tabs","aria-label":"Terminal tabs",children:[_.jsx("button",{type:"button",className:"mobile-menu-button","aria-label":"Toggle workspaces",title:"Workspaces",onClick:p,children:_.jsxs("span",{className:"hamburger-lines","aria-hidden":"true",children:[_.jsx("span",{}),_.jsx("span",{}),_.jsx("span",{})]})}),_.jsxs("div",{className:"terminal-tab-list",children:[e.map((I,ie)=>{const de=Nm(I),j=yM(I),$=n[I.activeTerminalId],H=I.title||$?.title||I.activeTerminalId,L=I.id===t,X=k?.tabId===I.id,G=UM(I,n),M=a?.has(I.id)??!1;return _.jsxs(xi.Fragment,{children:[_.jsx(ob,{index:ie}),_.jsx(IM,{tab:I,active:L,editing:X,title:H,paneCount:j,terminalIds:de,canClose:e.length>1,editValue:X?k.title:null,editInputRef:X?F:null,activity:G,unread:M,onSelect:()=>c(I.id),onBeginRename:()=>J(I.id,H),onCloseAll:()=>m(de),onCommitRename:ce,onCancelRename:()=>B(null),onRenameChange:V=>B({tabId:I.id,title:V})})]},I.id)}),_.jsx(ob,{index:e.length}),_.jsx("button",{type:"button",className:"tab-add-button","aria-label":"New tab",title:"New tab",onClick:d,children:"+"}),(o?.length??0)>0?_.jsx("div",{className:"terminal-detached-pills","aria-label":"Detached terminals",children:(o??[]).map(I=>_.jsx(FM,{terminal:I,onReattach:()=>f?.(I.id),onDelete:()=>re(I)},I.id))}):null]}),C?q():null]}),R?_.jsx(qM,{terminal:R,onCancel:()=>re(null),onConfirm:()=>{S?.(R.id),re(null)}}):null]})}function IM({tab:e,active:t,editing:n,title:a,paneCount:o,canClose:c,editValue:d,editInputRef:p,activity:m,unread:f,onSelect:S,onBeginRename:y,onCloseAll:b,onCommitRename:x,onCancelRename:C,onRenameChange:k}){const{attributes:B,listeners:R,setNodeRef:re,transform:F,isDragging:J}=Fb({id:`tab-${e.id}`,data:{kind:"tab",tabId:e.id,terminalId:e.activeTerminalId},disabled:n}),ce={transform:Tf.Translate.toString(F),opacity:J?.4:void 0,zIndex:J?2:void 0};return _.jsxs("div",{ref:re,className:"terminal-tab","data-active":t,"data-dragging":J,"data-unread":f?"true":void 0,style:ce,...B,...R,children:[m?_.jsx("span",{className:"terminal-tab-status-dot","data-activity":m.state,"aria-hidden":"true",title:PM(m)}):null,n&&p&&d!==null?_.jsxs("form",{className:"terminal-tab-editor",onSubmit:q=>{q.preventDefault(),x()},children:[_.jsx("input",{ref:p,"aria-label":`Rename ${a}`,value:d,onBlur:x,onChange:q=>k(q.target.value),onKeyDown:q=>{if(q.key==="Enter"){q.preventDefault(),x();return}q.key==="Escape"&&(q.preventDefault(),C())}}),_.jsx("small",{children:o})]}):_.jsxs("button",{type:"button",className:"terminal-tab-select","aria-label":`Select ${a}`,title:a,onClick:S,onDoubleClick:q=>{q.preventDefault(),y()},children:[_.jsx("span",{children:a}),_.jsxs("small",{children:[o," pane",o===1?"":"s"]})]}),c&&!n?_.jsx("button",{type:"button",className:"icon-button","aria-label":`Close ${a}`,title:`Close ${a}`,onPointerDown:q=>q.stopPropagation(),onClick:q=>{q.stopPropagation(),b()},children:"x"}):null]})}function ob({index:e}){const{setNodeRef:t,isOver:n}=qb({id:`tab-position-${e}`,data:{kind:"tab-position",index:e}});return _.jsx("div",{ref:t,className:"terminal-tab-drop-slot","data-over":n,"aria-hidden":"true"})}function FM({terminal:e,onReattach:t,onDelete:n}){const a=e.title||e.cwd||e.id.slice(0,8),o=`${e.title||"Terminal"}
42
+ `).length}function qR(e){let t=5381;for(let n=0;n<e.length;n+=1)t=t*33^e.charCodeAt(n);return(t>>>0).toString(36)}function WR(e){let t=0;for(const n of e){if(!n)continue;const a=n.match(/\r\n|\r|\n/g);t+=a?.length??1}return Math.max(1,t)}function ib(e){const t=[];for(const n of e){const a=_w(n);a&&t.push(a)}return t}function _w(e){return e.replace(/\x1b\[\?([0-9;:]*)([hl])/g,(t,n,a)=>{const o=n.split(";").filter(Boolean).filter(c=>!RR.has(c.split(":")[0]??""));return o.length>0?`\x1B[?${o.join(";")}${a}`:""})}function bf(e,t={}){const n={};return(e?.force||t.force)&&(n.force=!0),(e?.scrollToBottom||t.scrollToBottom)&&(n.scrollToBottom=!0),n}function YR(e){const t=e.buffer.active,n=t.baseY+e.rows;return n<=e.rows?null:{current:Math.max(1,Math.min(n,t.viewportY+1)),total:n}}function ir(e){return e.buffer.active.viewportY>=Math.max(0,e.buffer.active.baseY-1)}function $c(e,t){return!t||ir(e)}function sb(e){return ir(e)?!1:(e.scrollToLine(Math.max(0,e.buffer.active.baseY)),!0)}function $R(e,t,n,a,o,c){const d=p=>{const m=XR(p);m!==0&&(p.cancelable&&p.preventDefault(),p.stopPropagation(),VR(t,m,n,a,o,c))};return e.addEventListener("wheel",d,{capture:!0,passive:!1}),()=>{e.removeEventListener("wheel",d,{capture:!0})}}function VR(e,t,n,a,o,c){const d=()=>{o();try{e.scrollLines(t)}finally{c()}n(),t<0&&e.buffer.active.viewportY<=3&&a(t)};if(e.buffer.active.type==="alternate"){e.write(Np,d);return}d()}function XR(e){const n=e.deltaMode===WheelEvent.DOM_DELTA_PIXEL?e.deltaY/24:e.deltaMode===WheelEvent.DOM_DELTA_PAGE?e.deltaY*24:e.deltaY;if(n===0)return 0;const a=n<0?Math.floor(n):Math.ceil(n);return Math.max(-30,Math.min(30,a))}function GR(e,t,n,a,o,c,d){let p=null,m=0;const f={passive:!1};function S(x){p=wf(x),m=0}function y(x){const C=wf(x);if(C===null){p=null,m=0;return}if(p===null){p=C;return}const k=C.clientY-p.clientY;if(p=C,x.cancelable&&x.preventDefault(),k===0)return;if(ZR(t)&&QR(t,C,-k)){m=0;return}m-=k/n();const B=m<0?Math.ceil(m):Math.floor(m);if(B!==0){m-=B,c();try{t.scrollLines(B)}finally{d()}a(),B<0&&t.buffer.active.viewportY<=3&&o(B)}}function b(x){if(x.touches.length>0){p=wf(x);return}p=null,m=0}return e.addEventListener("touchstart",S,f),e.addEventListener("touchmove",y,f),e.addEventListener("touchend",b),e.addEventListener("touchcancel",b),()=>{e.removeEventListener("touchstart",S,f),e.removeEventListener("touchmove",y,f),e.removeEventListener("touchend",b),e.removeEventListener("touchcancel",b)}}function wf(e){if(e.touches.length!==1)return null;const t=e.touches[0];return t?{clientX:t.clientX,clientY:t.clientY}:null}function ZR(e){return e.buffer.active.type==="alternate"||e.modes.mouseTrackingMode!=="none"}function QR(e,t,n){const a=e.element;return a?(a.dispatchEvent(JR(t,n)),!0):!1}function JR(e,t){const n=typeof WheelEvent=="function"?WheelEvent.DOM_DELTA_PIXEL:0,a={bubbles:!0,cancelable:!0,clientX:e.clientX,clientY:e.clientY,deltaX:0,deltaY:t,deltaMode:n};if(typeof WheelEvent=="function")return new WheelEvent("wheel",a);const o=new Event("wheel",a);return Object.defineProperties(o,{clientX:{value:e.clientX},clientY:{value:e.clientY},deltaX:{value:0},deltaY:{value:t},deltaMode:{value:0}}),o}function Bp({node:e,terminals:t,editors:n,api:a,activeTerminalId:o,visible:c=!0,refreshCwdOnEnter:d=!1,tabId:p,dropZoneActive:m=!1,draggingTerminalId:f=null,mobileFocusLeafKey:S=null,path:y=[],totalPanes:b,onSelect:x,onClose:C,onResize:k,onExit:B,onSnapshot:R,onCloseEditor:re,onAuthClose:F}){const J=b??Lp(e);if(y.length===0&&S){const ie=Op(e),de=ie.some(j=>j.key===S)?S:ie[0]?.key;if(ie.length>1&&de)return _.jsx("div",{className:"mobile-focused-split",children:ie.map(j=>{const $=j.key===de;if(j.type==="editor"){const L=n[j.editorId];return _.jsx("div",{className:"mobile-focused-pane","data-active":$,"aria-hidden":!$,children:L?_.jsx(Xy,{api:a,editor:L,canClose:J>1,onClose:()=>re(j.editorId)}):_.jsx("div",{className:"missing-pane",children:"Editor unavailable"})},j.key)}const H=t[j.terminalId];return H?_.jsx("div",{className:"mobile-focused-pane","data-active":$,"aria-hidden":!$,children:_.jsx(eb,{terminal:H,serverApi:a,active:$,visible:c&&$,canClose:J>1,refreshCwdOnEnter:d&&$,tabId:p,onSelect:()=>x(j.terminalId),onClose:()=>C(j.terminalId),onExit:L=>B(j.terminalId,L),onSnapshot:R,...F?{onAuthClose:F}:{}})},j.key):_.jsx("div",{className:"mobile-focused-pane","data-active":$,"aria-hidden":!$,children:_.jsx("div",{className:"missing-pane",children:"Terminal unavailable"})},j.key)})})}if(e.type==="pane"){const ie=t[e.terminalId];if(!ie)return _.jsx("div",{className:"missing-pane",children:"Terminal unavailable"});const de=_.jsx(eb,{terminal:ie,serverApi:a,active:e.terminalId===o,visible:c,canClose:J>1,refreshCwdOnEnter:d&&e.terminalId===o,tabId:p,onSelect:()=>x(e.terminalId),onClose:()=>C(e.terminalId),onExit:$=>B(e.terminalId,$),onSnapshot:R,...F?{onAuthClose:F}:{}});return m&&f!==e.terminalId?_.jsxs("div",{className:"pane-drop-host",children:[de,_.jsx(Vc,{terminalId:e.terminalId,side:"top"}),_.jsx(Vc,{terminalId:e.terminalId,side:"right"}),_.jsx(Vc,{terminalId:e.terminalId,side:"bottom"}),_.jsx(Vc,{terminalId:e.terminalId,side:"left"})]}):de}if(e.type==="editor"){const ie=n[e.editorId];return ie?_.jsx(Xy,{api:a,editor:ie,canClose:J>1,onClose:()=>re(e.editorId)}):_.jsx("div",{className:"missing-pane",children:"Editor unavailable"})}const ce=`${e.ratio*100}%`,q=`${(1-e.ratio)*100}%`,I=e.direction==="vertical"?{gridTemplateColumns:`${ce} 1px ${q}`}:{gridTemplateRows:`${ce} 1px ${q}`};return _.jsxs("div",{className:"split-pane","data-direction":e.direction,style:I,children:[_.jsx("div",{className:"split-cell",children:_.jsx(Bp,{node:e.first,terminals:t,editors:n,api:a,activeTerminalId:o,visible:c,refreshCwdOnEnter:d,tabId:p,dropZoneActive:m,draggingTerminalId:f,mobileFocusLeafKey:S,path:[...y,0],totalPanes:J,onSelect:x,onClose:C,onResize:k,onExit:B,onSnapshot:R,onCloseEditor:re,...F?{onAuthClose:F}:{}})}),_.jsx(eM,{direction:e.direction,path:y,onResize:k}),_.jsx("div",{className:"split-cell",children:_.jsx(Bp,{node:e.second,terminals:t,editors:n,api:a,activeTerminalId:o,visible:c,refreshCwdOnEnter:d,tabId:p,dropZoneActive:m,draggingTerminalId:f,mobileFocusLeafKey:S,path:[...y,1],totalPanes:J,onSelect:x,onClose:C,onResize:k,onExit:B,onSnapshot:R,onCloseEditor:re,...F?{onAuthClose:F}:{}})})]})}function Vc({terminalId:e,side:t}){const{setNodeRef:n,isOver:a}=qb({id:`pane-${e}-${t}`,data:{kind:"pane-zone",terminalId:e,side:t}});return _.jsx("div",{ref:n,className:`pane-drop-zone pane-drop-zone--${t}`,"data-over":a,"aria-hidden":"true"})}function eM({direction:e,path:t,onResize:n}){function a(o){o.preventDefault(),o.stopPropagation();const c=o.currentTarget;c.setPointerCapture?.(o.pointerId),c.classList.add("is-dragging"),document.body.style.cursor=e==="vertical"?"col-resize":"row-resize";const d=c.parentElement;if(!d)return;const p=d.getBoundingClientRect();function m(S){const y=e==="vertical"?(S.clientX-p.left)/p.width:(S.clientY-p.top)/p.height;n(t,Math.min(.9,Math.max(.1,y)))}function f(){window.removeEventListener("pointermove",m),window.removeEventListener("pointerup",f),c.classList.remove("is-dragging"),document.body.style.cursor=""}window.addEventListener("pointermove",m),window.addEventListener("pointerup",f)}return _.jsx("div",{"aria-label":"Resize panes","aria-orientation":e==="vertical"?"vertical":"horizontal",className:"split-divider","data-direction":e,onPointerDown:a,role:"separator",children:_.jsx("span",{className:"split-divider-handle","aria-hidden":"true"})})}function Lp(e){return e.type==="pane"||e.type==="editor"?1:Lp(e.first)+Lp(e.second)}function Op(e){return e.type==="pane"?[{key:tM(e.terminalId),type:"terminal",terminalId:e.terminalId}]:e.type==="editor"?[{key:iM(e.editorId),type:"editor",editorId:e.editorId}]:[...Op(e.first),...Op(e.second)]}function tM(e){return`terminal:${e}`}function iM(e){return`editor:${e}`}const Am="workspace-default",sM="NTerminal";function nM(){return{workspaces:[],activeWorkspaceId:null,terminals:{}}}function rM(e,t){switch(t.type){case"workspace.hydrated":return zp(t.terminals,t.savedTabs,t.savedWorkspaces,t.savedActiveWorkspaceId);case"workspace.created":return aM(e,{id:t.workspaceId,title:t.title});case"workspace.closed":return oM(e,t.workspaceId);case"workspace.selected":return vw(e,t.workspaceId);case"workspace.renamed":return lM(e,t.workspaceId,t.title);case"terminal.created":return gw(e,t.terminal);case"terminal.split":return cM(e,t.terminal,t.direction);case"terminal.updated":return bM(e,t.terminal);case"terminal.exited":return wM(e,t.terminalId,t.exitCode);case"terminal.closed":return Sw(e,t.terminalId);case"terminal.detached":return CM(e,t.terminalId);case"editor.split":return uM(e,t.editorId,t.title,t.direction);case"editor.closed":return xM(e,t.editorId);case"pane.selected":return vM(e,t.terminalId);case"pane.resized":return gM(e,t.path,t.ratio);case"tab.selected":return dM(e,t.tabId);case"tab.renamed":return _M(e,t.tabId,t.title);case"tab.reordered":return yw(e,t.sourceTabId,t.targetIndex);case"tab.dropped_into_pane":return fM(e,t.sourceTabId,t.sourceTerminalId,t.targetTerminalId,t.side);case"terminal.extracted_to_tab":return pM(e,t.sourceTabId,t.sourceTerminalId,t.targetIndex);case"activePane.closed":return hM(e);default:return e}}function aM(e,t){if(e.workspaces.some(a=>a.id===t.id))return vw(e,t.id);const n={id:t.id,title:t.title,tabs:[],activeTabId:null};return{...e,workspaces:[...e.workspaces,n],activeWorkspaceId:n.id}}function vw(e,t){return e.workspaces.some(n=>n.id===t)?{...e,activeWorkspaceId:t}:e}function lM(e,t,n){const a=n.trim();if(!a)return e;let o=!1;const c=e.workspaces.map(d=>d.id!==t||d.title===a?d:(o=!0,{...d,title:a}));return o?{...e,workspaces:c}:e}function oM(e,t){if(e.workspaces.length<=1||!e.workspaces.some(p=>p.id===t))return e;const n=e.workspaces.find(p=>p.id===t),a=new Set(n?SM(n):[]),o={...e.terminals};for(const p of a)delete o[p];const c=e.workspaces.filter(p=>p.id!==t),d=e.activeWorkspaceId===t?c[0]?.id??null:e.activeWorkspaceId;return{workspaces:c,activeWorkspaceId:d,terminals:o}}function gw(e,t){const n=ww(e),a=Kr(n)??ju(),o=Cw(t);return{...n,activeWorkspaceId:a.id,terminals:{...n.terminals,[t.id]:t},workspaces:n.workspaces.map(c=>c.id===a.id?{...c,tabs:[...c.tabs,o],activeTabId:o.id}:c)}}function cM(e,t,n){const a=Kr(e),o=a?zu(a):void 0;if(!a||!o)return gw(e,t);const c=o.activeTerminalId,d=fo(o.root,c,{type:"split",direction:n,ratio:.5,first:{type:"pane",terminalId:c},second:{type:"pane",terminalId:t.id}});return{...e,terminals:{...e.terminals,[t.id]:t},workspaces:e.workspaces.map(p=>p.id===a.id?{...p,tabs:p.tabs.map(m=>m.id===o.id?{...m,root:d,activeTerminalId:t.id}:m)}:p)}}function uM(e,t,n,a){const o=Kr(e),c=o?zu(o):void 0;if(!o||!c)return e;const d=c.activeTerminalId,p=fo(c.root,d,{type:"split",direction:a,ratio:.5,first:{type:"pane",terminalId:d},second:{type:"editor",editorId:t,title:n}});return{...e,workspaces:e.workspaces.map(m=>m.id===o.id?{...m,tabs:m.tabs.map(f=>f.id===c.id?{...f,root:p,activeTerminalId:d}:f)}:m)}}function hM(e){const t=Kr(e),n=t?zu(t):void 0;return n?Sw(e,n.activeTerminalId):e}function dM(e,t){const n=Kr(e);return!n||!n.tabs.some(a=>a.id===t)?e:{...e,workspaces:e.workspaces.map(a=>a.id===n.id?{...a,activeTabId:t}:a)}}function yw(e,t,n){const a=e.workspaces.map(o=>{const c=o.tabs.findIndex(S=>S.id===t);if(c<0)return o;const d=o.tabs.slice(),[p]=d.splice(c,1);if(!p)return o;const m=Math.max(0,Math.min(d.length,n)),f=d.slice();return f.splice(m,0,p),mM(o.tabs,f)?o:{...o,tabs:f}});return a.every((o,c)=>o===e.workspaces[c])?e:{...e,workspaces:a}}function fM(e,t,n,a,o){if(n===a||!e.terminals[n]||!e.terminals[a])return e;let c=e.workspaces.map(m=>{const f=m.tabs.findIndex(C=>C.id===t);if(f<0)return m;const S=m.tabs[f];if(!S)return m;const y=po(S.root,n);if(!y){const C=m.tabs.filter((k,B)=>B!==f);return{...m,tabs:C}}const b={...S,root:y,activeTerminalId:Es(y)[0]??S.activeTerminalId},x=m.tabs.slice();return x[f]=b,{...m,tabs:x}});const d=o==="left"||o==="right"?"vertical":"horizontal",p=o==="left"||o==="top";return c=c.map(m=>{const f=m.tabs.findIndex(k=>Es(k.root).includes(a));if(f<0)return m;const S=m.tabs[f];if(!S)return m;const y={type:"pane",terminalId:n},b={type:"split",direction:d,ratio:.5,first:p?y:{type:"pane",terminalId:a},second:p?{type:"pane",terminalId:a}:y},x=fo(S.root,a,b),C=m.tabs.slice();return C[f]={...S,root:x,activeTerminalId:n},{...m,tabs:C,activeTabId:S.id}}),ww({...e,workspaces:c})}function pM(e,t,n,a){let o=-1,c=-1;for(let B=0;B<e.workspaces.length;B+=1){const R=e.workspaces[B].tabs.findIndex(re=>re.id===t);if(R>=0){o=B,c=R;break}}if(o<0)return e;const d=e.workspaces[o],p=d.tabs[c],m=Es(p.root);if(!m.includes(n))return e;if(m.length===1)return yw(e,t,a);const f=po(p.root,n);if(!f)return e;const S={...p,root:f,activeTerminalId:Es(f)[0]??p.activeTerminalId},y=e.terminals[n],b={id:`tab-${Date.now().toString(36)}-${n.slice(0,8)}`,title:y?.title??"",activeTerminalId:n,root:{type:"pane",terminalId:n}},x=d.tabs.slice();x[c]=S;const C=Math.max(0,Math.min(x.length,a));x.splice(C,0,b);const k=e.workspaces.slice();return k[o]={...d,tabs:x,activeTabId:b.id},{...e,workspaces:k}}function mM(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n+=1)if(e[n]?.id!==t[n]?.id)return!1;return!0}function _M(e,t,n){const a=n.trim();if(!a)return e;let o=!1;const c=e.workspaces.map(d=>{let p=!1;const m=d.tabs.map(f=>f.id!==t||f.title===a?f:(o=!0,p=!0,{...f,title:a}));return p?{...d,tabs:m}:d});return o?{...e,workspaces:c}:e}function vM(e,t){const n=e.workspaces.find(o=>o.tabs.some(c=>mo(c.root,t))),a=n?.tabs.find(o=>mo(o.root,t));return!n||!a?e:{...e,activeWorkspaceId:n.id,workspaces:e.workspaces.map(o=>o.id===n.id?{...o,activeTabId:a.id,tabs:o.tabs.map(c=>c.id===a.id?{...c,activeTerminalId:t}:c)}:o)}}function gM(e,t,n){const a=Kr(e),o=a?zu(a):void 0;if(!a||!o)return e;const c=Kp(o.root,t,xw(n));return c===o.root?e:{...e,workspaces:e.workspaces.map(d=>d.id===a.id?{...d,tabs:d.tabs.map(p=>p.id===o.id?{...p,root:c}:p)}:d)}}function zp(e,t,n,a){const o=Object.fromEntries(e.map(S=>[S.id,S])),c=new Set(e.map(S=>S.id)),d=new Set;let p=EM(t,n,c,d);p.length===0&&(p=[ju()]);const m=typeof a=="string"&&p.some(S=>S.id===a)?a:p[0]?.id??null,f=m??p[0]?.id??Am;for(const S of e){if(d.has(S.id))continue;const y=Cw(S);p=TM(p,f,y),d.add(S.id)}return{workspaces:p.map(Do),activeWorkspaceId:m,terminals:o}}function Nm(e){return Es(e.root)}function yM(e){return Ip(e.root)}function SM(e){return e.tabs.flatMap(t=>Es(t.root))}function Cf(e){const t=e.workspaces.map(n=>{const a=n.tabs.flatMap(o=>{const c=Up(o.root);return c?[{...o,root:c}]:[]});return Do({...n,tabs:a})});return{activeWorkspaceId:t.some(n=>n.id===e.activeWorkspaceId)?e.activeWorkspaceId:t[0]?.id??null,workspaces:t}}function bM(e,t){return{...e,terminals:{...e.terminals,[t.id]:t},workspaces:e.workspaces.map(n=>({...n,tabs:n.tabs.map(a=>mo(a.root,t.id)?{...a,title:a.title||t.title}:a)}))}}function wM(e,t,n){const a=e.terminals[t];return a?{...e,terminals:{...e.terminals,[t]:{...a,status:"exited",exitCode:n}}}:e}function Sw(e,t){const n={...e.terminals};return delete n[t],bw(e,t,n)}function CM(e,t){return e.terminals[t]?bw(e,t,{...e.terminals}):e}function bw(e,t,n){const a=e.workspaces.map(c=>{const d=[];for(const p of c.tabs){const m=po(p.root,t);if(!m)continue;const f=Es(m),S=f.includes(p.activeTerminalId)?p.activeTerminalId:f[0];S&&d.push({...p,root:m,activeTerminalId:S})}return Do({...c,tabs:d})}),o=a.some(c=>c.id===e.activeWorkspaceId);return{workspaces:a,activeWorkspaceId:o?e.activeWorkspaceId:a[0]?.id??null,terminals:n}}function xM(e,t){const n=e.workspaces.map(o=>{const c=[];for(const d of o.tabs){const p=jp(d.root,t);if(!p)continue;const m=Es(p),f=m.includes(d.activeTerminalId)?d.activeTerminalId:m[0];f&&c.push({...d,root:p,activeTerminalId:f})}return Do({...o,tabs:c})}),a=n.some(o=>o.id===e.activeWorkspaceId);return{...e,workspaces:n,activeWorkspaceId:a?e.activeWorkspaceId:n[0]?.id??null}}function EM(e,t,n,a){if(t&&t.length>0){const o=[];for(const c of t)kM(c)&&o.push(nb(c,n,a));if(o.length>0)return o}return[nb({...ju(),tabs:e??[]},n,a)]}function nb(e,t,n){const a=[];for(const o of e.tabs){if(!DM(o))continue;const c=Hp(o.root,t);if(!c)continue;const d=Es(c);for(const m of d)n.add(m);const p=d.includes(o.activeTerminalId)?o.activeTerminalId:d[0];p&&a.push({...o,root:c,activeTerminalId:p})}return Do({...e,tabs:a})}function ww(e){return Kr(e)?e:{...e,workspaces:[ju()],activeWorkspaceId:Am}}function Kr(e){return e.workspaces.find(t=>t.id===e.activeWorkspaceId)??e.workspaces[0]}function zu(e){return e.tabs.find(t=>t.id===e.activeTabId)??e.tabs[0]}function ju(){return{id:Am,title:sM,tabs:[],activeTabId:null}}function Do(e){const t=e.tabs.some(n=>n.id===e.activeTabId);return{...e,activeTabId:t?e.activeTabId:e.tabs[0]?.id??null}}function TM(e,t,n){return e.map(a=>a.id===t?{...a,tabs:[...a.tabs,n],activeTabId:a.activeTabId??n.id}:a)}function Cw(e){return{id:`tab-${e.id}`,title:e.title||e.id,root:{type:"pane",terminalId:e.id},activeTerminalId:e.id}}function fo(e,t,n){return e.type==="pane"?e.terminalId===t?n:e:e.type==="editor"?e:{...e,first:fo(e.first,t,n),second:fo(e.second,t,n)}}function po(e,t){if(e.type==="pane")return e.terminalId===t?null:e;if(e.type==="editor")return e;const n=po(e.first,t),a=po(e.second,t);return n&&a?{...e,first:n,second:a}:n??a}function jp(e,t){if(e.type==="editor")return e.editorId===t?null:e;if(e.type==="pane")return e;const n=jp(e.first,t),a=jp(e.second,t);return n&&a?{...e,first:n,second:a}:n??a}function Hp(e,t){if(e.type==="pane")return t.has(e.terminalId)?e:null;if(e.type==="editor")return null;const n=Hp(e.first,t),a=Hp(e.second,t);return n&&a?{...e,ratio:xw(e.ratio),first:n,second:a}:n??a}function Up(e){if(e.type==="editor")return null;if(e.type==="pane")return e;const t=Up(e.first),n=Up(e.second);return t&&n?{...e,first:t,second:n}:t??n}function kM(e){if(!e||typeof e!="object")return!1;const t=e;return typeof t.id=="string"&&typeof t.title=="string"&&(typeof t.activeTabId=="string"||t.activeTabId===null)&&Array.isArray(t.tabs)}function DM(e){if(!e||typeof e!="object")return!1;const t=e;return typeof t.id=="string"&&typeof t.title=="string"&&typeof t.activeTerminalId=="string"&&Pp(t.root)}function Pp(e){if(!e||typeof e!="object")return!1;const t=e;return t.type==="pane"?typeof t.terminalId=="string":t.type==="editor"?typeof t.editorId=="string"&&typeof t.title=="string":t.type==="split"?(t.direction==="horizontal"||t.direction==="vertical")&&Pp(t.first)&&Pp(t.second):!1}function Kp(e,t,n){if(e.type==="pane"||e.type==="editor")return e;if(t.length===0)return e.ratio===n?e:{...e,ratio:n};const[a,...o]=t;if(a===0){const c=Kp(e.first,o,n);return c===e.first?e:{...e,first:c}}if(a===1){const c=Kp(e.second,o,n);return c===e.second?e:{...e,second:c}}return e}function xw(e){return Number.isFinite(e)?Math.min(.9,Math.max(.1,e)):.5}function mo(e,t){return e.type==="pane"?e.terminalId===t:e.type==="editor"?!1:mo(e.first,t)||mo(e.second,t)}function Es(e){return e.type==="pane"?[e.terminalId]:e.type==="editor"?[]:[...Es(e.first),...Es(e.second)]}function Ip(e){return e.type==="pane"||e.type==="editor"?1:Ip(e.first)+Ip(e.second)}const ur=new Map,_o=new Map,vo=new Map;function Pa(e){return e??"__local__"}function RM(e){return{agentId:e,state:nM(),editors:{},loaded:!1,error:null,layoutRevision:null,lastPersistedLayoutJson:null,unreadCompletions:new Set,mutable:{editorIdCounter:0,saveCoord:{pendingLayoutSave:null,saveTimer:null,persistChain:Promise.resolve(),nextPersistQueued:!1,nextPersistLayout:null,queuedBaseRevision:void 0}}}}function Ft(e){const t=Pa(e);let n=ur.get(t);return n||(n=RM(e),ur.set(t,n)),n}function Ew(e,t){const n=Pa(e);let a=_o.get(n);return a||(a=new Set,_o.set(n,a)),a.add(t),()=>{a.delete(t)}}function MM(e){const t=Pa(e),n=_o.get(t);if(n)for(const a of Array.from(n))a()}function Ka(e,t){ur.set(Pa(e),t),MM(e)}const Fp=new Set;function AM(e){return Fp.add(e),()=>{Fp.delete(e)}}function Ul(e,t){const n=Ft(e),a=Pa(e);t.type==="workspace.hydrated"&&vo.delete(a);const o=rM(n.state,t);let c=n.unreadCompletions,d=null;if(t.type==="terminal.updated"){const f=n.state.terminals[t.terminal.id],S=f?.activity==="busy",y=t.terminal.activity==="busy",b=t.terminal.activity==="idle",x=HM(a);if(t.notifyCompletion===!0&&y&&x.add(t.terminal.id),t.notifyCompletion===!0&&S&&b&&x.has(t.terminal.id)){const C=NM(o,t.terminal.id);C&&(d={terminalId:t.terminal.id,tabId:C.tab.id,commandName:f?.currentCommand??null},C.workspace.activeTabId!==C.tab.id&&(c.has(C.tab.id)||(c=new Set(c),c.add(C.tab.id))))}(b||t.terminal.status==="exited")&&x.delete(t.terminal.id)}t.type==="tab.selected"&&c.has(t.tabId)&&(c=new Set(c),c.delete(t.tabId));const p=o!==n.state,m=c!==n.unreadCompletions;if((p||m)&&Ka(e,{...n,state:o,unreadCompletions:c}),m&&Bm(),d)for(const f of Array.from(Fp))f({agentId:e,...d})}function NM(e,t){for(const n of e.workspaces)for(const a of n.tabs)if(Es(a.root).includes(t))return{workspace:n,tab:a};return null}const qp=new Set;function BM(e){return qp.add(e),()=>{qp.delete(e)}}function LM(){let e=0;for(const t of ur.values())e+=t.unreadCompletions.size;return e}function Bm(){for(const e of Array.from(qp))e()}function OM(e,t){const n=Ft(e);if(!n.unreadCompletions.has(t))return;const a=new Set(n.unreadCompletions);a.delete(t),Ka(e,{...n,unreadCompletions:a}),Bm()}function rb(e,t){const n=Ft(e);t!==n.state&&Ka(e,{...n,state:t})}function ab(e,t){const n=Ft(e),a=t(n.editors);a!==n.editors&&Ka(e,{...n,editors:a})}function Ta(e,t,n){const a=Ft(e);a.loaded===t&&a.error===n||Ka(e,{...a,loaded:t,error:n})}function Xc(e,t,n){const a=Ft(e);a.layoutRevision===t&&a.lastPersistedLayoutJson===n||Ka(e,{...a,layoutRevision:t,lastPersistedLayoutJson:n})}function zM(e){const t=Ft(e);return t.mutable.editorIdCounter+=1,t.mutable.editorIdCounter}function jM(e){const t=Pa(e),n=ur.get(t);n&&n.mutable.saveCoord.saveTimer!==null&&window.clearTimeout(n.mutable.saveCoord.saveTimer);const a=n?n.unreadCompletions.size>0:!1;ur.delete(t),_o.delete(t),vo.delete(t),a&&Bm()}function lb(){for(const e of ur.values()){const t=e.mutable.saveCoord.saveTimer;t!==null&&window.clearTimeout(t),e.unreadCompletions.size>0}ur.clear(),_o.clear(),vo.clear()}function HM(e){let t=vo.get(e);return t||(t=new Set,vo.set(e,t)),t}function UM(e,t){let n=!1,a=!1,o=null,c=!1;for(const d of Nm(e)){const p=t[d];if(p){if(p.status==="exited"){c=!0,n=!0;continue}p.activity==="busy"?(a=!0,n=!0,!o&&p.currentCommand&&(o=p.currentCommand)):p.activity==="idle"&&(n=!0)}}return n?c?{state:"exited",commandName:null}:a?{state:"busy",commandName:o}:{state:"idle",commandName:null}:null}function PM(e){return e?e.state==="busy"?e.commandName?`running: ${e.commandName}`:"running":e.state==="exited"?"exited":"idle":""}function KM({tabs:e,activeTabId:t,terminals:n,unreadCompletionTabIds:a,detachedTerminals:o,onSelectTab:c,onCreateTab:d,onToggleWorkspaces:p,onCloseTerminals:m,onReattachTerminal:f,onDeleteTerminal:S,onSplitVertical:y,onSplitHorizontal:b,onRenameTab:x,activePaneAvailable:C}){const[k,B]=g.useState(null),[R,re]=g.useState(null),F=g.useRef(null);g.useEffect(()=>{F.current?.focus(),F.current?.select()},[k?.tabId]);function J(I,ie){B({tabId:I,title:ie})}function ce(){if(!k)return;const I=k.title.trim();I&&x(k.tabId,I),B(null)}function q(){return _.jsxs("div",{className:"terminal-pane-actions","aria-label":"Pane actions",children:[_.jsx("button",{type:"button",className:"pane-action-button","aria-label":"Split right",title:`Split right - ${YE()}`,onClick:y,disabled:!C,children:_.jsx("span",{className:"split-icon split-icon-right","aria-hidden":"true"})}),_.jsx("button",{type:"button",className:"pane-action-button","aria-label":"Split down",title:`Split down - ${$E()}`,onClick:b,disabled:!C,children:_.jsx("span",{className:"split-icon split-icon-down","aria-hidden":"true"})})]})}return _.jsxs(_.Fragment,{children:[_.jsxs("nav",{className:"terminal-tabs","aria-label":"Terminal tabs",children:[_.jsx("button",{type:"button",className:"mobile-menu-button","aria-label":"Toggle workspaces",title:"Workspaces",onClick:p,children:_.jsxs("span",{className:"hamburger-lines","aria-hidden":"true",children:[_.jsx("span",{}),_.jsx("span",{}),_.jsx("span",{})]})}),_.jsxs("div",{className:"terminal-tab-list",children:[e.map((I,ie)=>{const de=Nm(I),j=yM(I),$=n[I.activeTerminalId],H=I.title||$?.title||I.activeTerminalId,L=I.id===t,X=k?.tabId===I.id,Z=UM(I,n),A=a?.has(I.id)??!1;return _.jsxs(xi.Fragment,{children:[_.jsx(ob,{index:ie}),_.jsx(IM,{tab:I,active:L,editing:X,title:H,paneCount:j,terminalIds:de,canClose:e.length>1,editValue:X?k.title:null,editInputRef:X?F:null,activity:Z,unread:A,onSelect:()=>c(I.id),onBeginRename:()=>J(I.id,H),onCloseAll:()=>m(de),onCommitRename:ce,onCancelRename:()=>B(null),onRenameChange:V=>B({tabId:I.id,title:V})})]},I.id)}),_.jsx(ob,{index:e.length}),_.jsx("button",{type:"button",className:"tab-add-button","aria-label":"New tab",title:"New tab",onClick:d,children:"+"}),(o?.length??0)>0?_.jsx("div",{className:"terminal-detached-pills","aria-label":"Detached terminals",children:(o??[]).map(I=>_.jsx(FM,{terminal:I,onReattach:()=>f?.(I.id),onDelete:()=>re(I)},I.id))}):null]}),C?q():null]}),R?_.jsx(qM,{terminal:R,onCancel:()=>re(null),onConfirm:()=>{S?.(R.id),re(null)}}):null]})}function IM({tab:e,active:t,editing:n,title:a,paneCount:o,canClose:c,editValue:d,editInputRef:p,activity:m,unread:f,onSelect:S,onBeginRename:y,onCloseAll:b,onCommitRename:x,onCancelRename:C,onRenameChange:k}){const{attributes:B,listeners:R,setNodeRef:re,transform:F,isDragging:J}=Fb({id:`tab-${e.id}`,data:{kind:"tab",tabId:e.id,terminalId:e.activeTerminalId},disabled:n}),ce={transform:Tf.Translate.toString(F),opacity:J?.4:void 0,zIndex:J?2:void 0};return _.jsxs("div",{ref:re,className:"terminal-tab","data-active":t,"data-dragging":J,"data-unread":f?"true":void 0,style:ce,...B,...R,children:[m?_.jsx("span",{className:"terminal-tab-status-dot","data-activity":m.state,"aria-hidden":"true",title:PM(m)}):null,n&&p&&d!==null?_.jsxs("form",{className:"terminal-tab-editor",onSubmit:q=>{q.preventDefault(),x()},children:[_.jsx("input",{ref:p,"aria-label":`Rename ${a}`,value:d,onBlur:x,onChange:q=>k(q.target.value),onKeyDown:q=>{if(q.key==="Enter"){q.preventDefault(),x();return}q.key==="Escape"&&(q.preventDefault(),C())}}),_.jsx("small",{children:o})]}):_.jsxs("button",{type:"button",className:"terminal-tab-select","aria-label":`Select ${a}`,title:a,onClick:S,onDoubleClick:q=>{q.preventDefault(),y()},children:[_.jsx("span",{children:a}),_.jsxs("small",{children:[o," pane",o===1?"":"s"]})]}),c&&!n?_.jsx("button",{type:"button",className:"icon-button","aria-label":`Close ${a}`,title:`Close ${a}`,onPointerDown:q=>q.stopPropagation(),onClick:q=>{q.stopPropagation(),b()},children:"x"}):null]})}function ob({index:e}){const{setNodeRef:t,isOver:n}=qb({id:`tab-position-${e}`,data:{kind:"tab-position",index:e}});return _.jsx("div",{ref:t,className:"terminal-tab-drop-slot","data-over":n,"aria-hidden":"true"})}function FM({terminal:e,onReattach:t,onDelete:n}){const a=e.title||e.cwd||e.id.slice(0,8),o=`${e.title||"Terminal"}
43
43
  ${e.cwd}
44
- (detached — click to re-open, × to delete)`;return _.jsxs("span",{className:"terminal-detached-pill",title:o,children:[_.jsx("button",{type:"button",className:"terminal-detached-pill-open","aria-label":`Re-open ${a}`,onClick:t,children:a}),_.jsx("button",{type:"button",className:"terminal-detached-pill-delete","aria-label":`Delete ${a}`,title:`Delete ${a} — this destroys the underlying shell session.`,onClick:c=>{c.stopPropagation(),n()},children:"×"})]})}function qM({terminal:e,onCancel:t,onConfirm:n}){const a=e.title||e.cwd||e.id.slice(0,8);return _.jsx("div",{className:"security-overlay",role:"dialog","aria-modal":"true","aria-labelledby":"delete-terminal-title",onClick:t,children:_.jsxs("div",{className:"security-panel terminal-delete-dialog",onClick:o=>o.stopPropagation(),children:[_.jsxs("header",{className:"security-panel-header",children:[_.jsx("h2",{id:"delete-terminal-title",children:"Delete Terminal"}),_.jsx("button",{type:"button",className:"security-close","aria-label":"Close",onClick:t,children:"×"})]}),_.jsxs("section",{className:"terminal-delete-dialog-body",children:[_.jsx("p",{children:"Delete this terminal?"}),_.jsx("span",{children:a}),_.jsx("small",{children:"The shell session and scrollback will be destroyed."})]}),_.jsxs("div",{className:"terminal-delete-dialog-actions",children:[_.jsx("button",{type:"button",className:"secondary-button",onClick:t,children:"Cancel"}),_.jsx("button",{type:"button",className:"terminal-delete-confirm",onClick:n,children:"Delete"})]})]})})}function WM({uploads:e,onDismiss:t,onDismissAll:n,onRetry:a,onCancel:o}){if(e.length===0)return null;const d=e.some(m=>m.status==="failed"||m.status==="partial")?"alert":"status",p=e.filter(m=>m.status==="queued"||m.status==="uploading").length;return _.jsxs("aside",{className:`upload-toast upload-toast-${GM(e)}`,role:d,"aria-live":d==="alert"?"assertive":"polite",children:[_.jsxs("header",{className:"upload-toast-header",children:[_.jsx("strong",{children:e.length===1?su(e[0]):`Uploads ${p>0?`(${p} active)`:`(${e.length})`}`}),_.jsx("button",{type:"button","aria-label":"Dismiss upload status",onClick:n,children:"x"})]}),_.jsx("div",{className:"upload-toast-body upload-queue-body",children:e.map(m=>_.jsx(YM,{upload:m,compact:e.length>1,onDismiss:()=>t(m.id),onRetry:()=>a(m.id),onCancel:()=>o(m.id)},m.id))})]})}function YM({upload:e,compact:t,onDismiss:n,onRetry:a,onCancel:o}){const c="response"in e?e.response:void 0,d=e.status==="failed"||e.status==="partial",p=e.status==="queued"||e.status==="uploading";return _.jsxs("section",{className:"upload-queue-item","data-status":e.status,"aria-label":su(e),children:[_.jsxs("div",{className:"upload-queue-item-header",children:[_.jsx("strong",{children:su(e)}),_.jsxs("div",{className:"upload-queue-actions",children:[p?_.jsx("button",{type:"button",onClick:o,children:"Cancel"}):null,d?_.jsx("button",{type:"button",onClick:a,children:"Retry"}):null,_.jsx("button",{type:"button","aria-label":`Dismiss ${su(e)}`,onClick:n,children:"x"})]})]}),e.status==="queued"?_.jsx("p",{children:e.message??"Queued"}):null,e.status==="uploading"?_.jsx($M,{toast:e}):null,c&&"message"in e&&e.message?_.jsx("p",{className:"upload-toast-muted",children:e.message}):null,c?_.jsx(VM,{response:c,compact:t}):null,e.status==="failed"&&!c&&e.message?_.jsx("p",{children:e.message}):null]})}function $M({toast:e}){const t=e.percent===null?ZM(e.loaded):`${e.percent}%`;return _.jsxs(_.Fragment,{children:[_.jsxs("div",{className:"upload-progress-row",children:[_.jsxs("span",{children:[e.fileCount," file",e.fileCount===1?"":"s"]}),_.jsx("span",{children:t})]}),_.jsx("div",{className:"upload-progress-track","aria-hidden":"true",children:_.jsx("span",{style:{width:e.percent===null?"100%":`${e.percent}%`}})})]})}function VM({response:e,compact:t}){const n=e.results.filter(d=>d.status==="failed"),a=e.results.filter(d=>d.status==="uploaded"),o=t?3:6,c=[...n,...a].slice(0,o);return _.jsxs(_.Fragment,{children:[_.jsx("p",{className:"upload-toast-destination",children:e.destinationCwd}),c.length>0?_.jsx("ul",{className:"upload-result-list",children:c.map((d,p)=>_.jsx(XM,{result:d},`${d.relativePath}-${p}`))}):null,e.results.length>c.length?_.jsxs("p",{className:"upload-toast-muted",children:["+",e.results.length-c.length," more"]}):null]})}function XM({result:e}){const t=e.savedRelativePath??e.relativePath,n=e.status==="uploaded"&&e.savedRelativePath!==void 0&&e.savedRelativePath!==e.relativePath;return _.jsxs("li",{"data-status":e.status,children:[_.jsx("span",{className:"upload-result-path",children:t}),n?_.jsx("span",{className:"upload-result-renamed",children:"renamed"}):null,e.status==="failed"&&e.error?_.jsx("span",{className:"upload-result-error",children:e.error}):null]})}function su(e){if(e.status==="queued")return"Preparing upload";if(e.status==="uploading")return`Uploading ${e.fileCount} file${e.fileCount===1?"":"s"}`;if(e.status==="success"){const t=e.response?.uploaded??e.fileCount;return`Uploaded ${t} file${t===1?"":"s"}`}if(e.status==="partial"){const t=e.response?.uploaded??0,n=(e.response?.uploaded??0)+(e.response?.failed??0)||e.fileCount;return`Uploaded ${t} of ${n} files`}return"Upload failed"}function GM(e){return e.some(t=>t.status==="failed")?"failed":e.some(t=>t.status==="partial")?"partial":e.some(t=>t.status==="uploading")?"uploading":e.some(t=>t.status==="queued")?"queued":"success"}function ZM(e){return e<1024?`${e} B`:e<1024*1024?`${Math.round(e/1024)} KB`:`${Math.round(e/(1024*1024))} MB`}function QM({toast:e,onActivate:t,onDismiss:n}){if(!e)return null;const a=e,o=a.commandName?`${a.commandName} finished`:"Command finished";function c(p){p.stopPropagation(),n()}function d(p){p.key!=="Enter"&&p.key!==" "||(p.preventDefault(),t(a))}return _.jsxs("aside",{className:"completion-toast",role:"status","aria-live":"polite",tabIndex:0,onClick:()=>t(a),onKeyDown:d,children:[_.jsx("video",{className:"completion-toast-character",src:a.assetSrc,muted:!0,autoPlay:!0,loop:!0,playsInline:!0,"aria-hidden":"true"}),_.jsxs("div",{className:"completion-toast-copy",children:[_.jsx("strong",{children:a.tabTitle}),_.jsx("span",{children:o})]}),_.jsx("button",{type:"button","aria-label":"Dismiss completion alert",onClick:c,children:"x"})]})}const JM=Xl(0,0,1,1),vn=1e-6;function eA(e){return Tw(e).map(t=>t.terminalId)}function Tw(e){return Vl(e,JM).sort(nA).map((t,n)=>({...t,index:n+1}))}function tA(e,t,n){const a=Tw(e),o=a.find(d=>d.terminalId===t);return o?a.filter(d=>d.terminalId!==t).map(d=>sA(o,d,n)).filter(d=>d!==null).sort(rA)[0]?.entry.terminalId??null:null}function iA(e,t){return!Number.isInteger(t)||t<1?null:eA(e)[t-1]??null}function Vl(e,t){if(e.type==="pane")return[{terminalId:e.terminalId,bounds:t}];if(e.type==="editor")return[];const n=aA(e.ratio);if(e.direction==="vertical"){const o=t.left+(t.right-t.left)*n;return[...Vl(e.first,Xl(t.left,t.top,o,t.bottom)),...Vl(e.second,Xl(o,t.top,t.right,t.bottom))]}const a=t.top+(t.bottom-t.top)*n;return[...Vl(e.first,Xl(t.left,t.top,t.right,a)),...Vl(e.second,Xl(t.left,a,t.right,t.bottom))]}function sA(e,t,n){const a=e.bounds,o=t.bounds,c=cb(a.left,a.right,o.left,o.right),d=cb(a.top,a.bottom,o.top,o.bottom);switch(n){case"left":return o.centerX>=a.centerX-vn||d<=vn?null:{entry:t,primaryDistance:Math.max(0,a.left-o.right),perpendicularDistance:Math.abs(a.centerY-o.centerY),overlap:d};case"right":return o.centerX<=a.centerX+vn||d<=vn?null:{entry:t,primaryDistance:Math.max(0,o.left-a.right),perpendicularDistance:Math.abs(a.centerY-o.centerY),overlap:d};case"up":return o.centerY>=a.centerY-vn||c<=vn?null:{entry:t,primaryDistance:Math.max(0,a.top-o.bottom),perpendicularDistance:Math.abs(a.centerX-o.centerX),overlap:c};case"down":return o.centerY<=a.centerY+vn||c<=vn?null:{entry:t,primaryDistance:Math.max(0,o.top-a.bottom),perpendicularDistance:Math.abs(a.centerX-o.centerX),overlap:c};default:return null}}function nA(e,t){return Ma(e.bounds.top,t.bounds.top)||Ma(e.bounds.left,t.bounds.left)}function rA(e,t){return Ma(e.primaryDistance,t.primaryDistance)||Ma(e.perpendicularDistance,t.perpendicularDistance)||Ma(t.overlap,e.overlap)||Ma(e.entry.index,t.entry.index)}function Ma(e,t){const n=e-t;return Math.abs(n)<=vn?0:n}function cb(e,t,n,a){return Math.max(0,Math.min(t,a)-Math.max(e,n))}function Xl(e,t,n,a){return{left:e,top:t,right:n,bottom:a,centerX:e+(n-e)/2,centerY:t+(a-t)/2}}function aA(e){return Number.isFinite(e)?Math.min(.9,Math.max(.1,e)):.5}class lA extends Error{constructor(t){super(t),this.name="UploadDropError"}}function ub(e){return e?Array.from(e.types??[]).includes("Files")||Mw(e.items).some(n=>n.kind==="file")?!0:Aw(e.files).length>0:!1}async function oA(e){const t=Mw(e.items).filter(n=>n.kind==="file");return t.length>0?cA(t):uA(e.files)}async function cA(e){const t=[];for(const n of e){const a=pA(n);if(a){await kw(a,"",t);continue}const o=n.getAsFile();if(o){t.push({relativePath:Dw(o),file:o});continue}throw new lA("Folder upload is not supported by this browser.")}return t}function uA(e){return Aw(e).map(t=>({relativePath:Dw(t),file:t}))}async function kw(e,t,n){const a=_A(t,e.name);if(e.isFile){const d=await hA(e);n.push({relativePath:a,file:d});return}if(!e.isDirectory)return;const o=e.createReader(),c=await dA(o);for(const d of c)await kw(d,a,n)}function hA(e){return new Promise((t,n)=>{e.file(t,a=>n(a))})}async function dA(e){const t=[];for(;;){const n=await fA(e);if(n.length===0)return t;t.push(...n)}}function fA(e){return new Promise((t,n)=>{e.readEntries(t,a=>n(a))})}function Dw(e){const t=e.webkitRelativePath;return Rw(typeof t=="string"&&t?t:e.name)}function pA(e){const t=e.webkitGetAsEntry?.();return mA(t)?t:null}function mA(e){if(!e||typeof e!="object")return!1;const t=e;return typeof t.name=="string"&&typeof t.isFile=="boolean"&&typeof t.isDirectory=="boolean"}function _A(e,t){return Rw(e?`${e}/${t}`:t)}function Rw(e){return e.replace(/\\/g,"/").replace(/^\/+/,"").split("/").filter(Boolean).join("/")}function Mw(e){return e?Array.from(e):[]}function Aw(e){return e?Array.from(e):[]}const hb="nterminal.terminalWorkspaces.v2",Nw="nterminal.sidebarCollapsed.v1",vA=75,db=Yb.map(e=>e.url),gA=Yb[0].url;function yA({api:e,serverApi:t,activeAgentId:n=null,onSelectServer:a,sessionExpiresAt:o=null,onLogout:c=async()=>{},onSessionInvalid:d}){const p=g.useMemo(()=>e??Eu(),[e]),m=g.useMemo(()=>t??io(null),[t]),f=g.useMemo(()=>NA(n),[n]),S=g.useMemo(()=>T=>Ew(n,T),[n]),y=g.useMemo(()=>()=>Ft(n),[n]),b=g.useSyncExternalStore(S,y,y),x=b.state,C=b.editors,k=!b.loaded,B=b.error,[R,re]=g.useState(!1),[F,J]=g.useState(()=>jA()),[ce,q]=g.useState("servers"),[I,ie]=g.useState(!1),de=g.useSyncExternalStore(a2,Yy,Yy);g.useSyncExternalStore(s0,Wy,Wy);const[j,$]=g.useState(()=>[null]),[H,L]=g.useState(0),[X,G]=g.useState(()=>[n]),[M,V]=g.useState(()=>new Set),[Q,ve]=g.useState({}),[Se,E]=g.useState(null),W=g.useRef(null);g.useRef(!1);const ee=g.useRef(0),[he,ge]=g.useState(null),me=dx(ky(Hb,{activationConstraint:{distance:8}}),ky(Ub,{activationConstraint:{delay:250,tolerance:5}}));g.useEffect(()=>l2(p),[p]);function Ce(T){const A=T.active.data.current;if(A){if(A.kind==="tab"&&typeof A.tabId=="string"&&typeof A.terminalId=="string"){ge({tabId:A.tabId,terminalId:A.terminalId});return}A.kind==="pane"&&typeof A.sourceTabId=="string"&&typeof A.terminalId=="string"&&ge({tabId:A.sourceTabId,terminalId:A.terminalId})}}function ze(T){ge(null);const A=T.active.data.current,K=T.over?.data.current;if(!(!A||!K||typeof A.terminalId!="string")){if(A.kind==="tab"&&typeof A.tabId=="string"){if(K.kind==="tab-position"&&typeof K.index=="number"){Ge({type:"tab.reordered",sourceTabId:A.tabId,targetIndex:K.index});return}K.kind==="pane-zone"&&typeof K.terminalId=="string"&&(K.side==="top"||K.side==="right"||K.side==="bottom"||K.side==="left")&&Ge({type:"tab.dropped_into_pane",sourceTabId:A.tabId,sourceTerminalId:A.terminalId,targetTerminalId:K.terminalId,side:K.side});return}if(A.kind==="pane"&&typeof A.sourceTabId=="string"){if(K.kind==="tab-position"&&typeof K.index=="number"){Ge({type:"terminal.extracted_to_tab",sourceTabId:A.sourceTabId,sourceTerminalId:A.terminalId,targetIndex:K.index});return}K.kind==="pane-zone"&&typeof K.terminalId=="string"&&(K.side==="top"||K.side==="right"||K.side==="bottom"||K.side==="left")&&Ge({type:"tab.dropped_into_pane",sourceTabId:A.sourceTabId,sourceTerminalId:A.terminalId,targetTerminalId:K.terminalId,side:K.side})}}}function Ne(){ge(null)}const Re=x.workspaces.find(T=>T.id===x.activeWorkspaceId)??x.workspaces[0],Pe=Re?.tabs.find(T=>T.id===Re.activeTabId)??Re?.tabs[0],Ye=Pe?.activeTerminalId??null,Be=Ye?x.terminals[Ye]:void 0,ae=RA("(max-width: 760px)"),Ee=g.useMemo(()=>Pe?wu(Pe.root):[],[Pe]),xe=Re&&Pe?ru(n,Re.id,Pe.id):null,Ke=Pe?Bw(Ee,Pe.activeTerminalId,xe?Q[xe]:void 0):null,Xe=ae&&Ee.length>1,gt=g.useMemo(()=>{const T=new Set;for(const A of x.workspaces)for(const K of A.tabs)for(const ue of Nm(K))T.add(ue);return Object.values(x.terminals).filter(A=>!T.has(A.id))},[x.terminals,x.workspaces]),[yt,mi]=g.useState([]),te=g.useRef([]),je=g.useRef(null),[He,_i]=g.useState(null),[Vi,ai]=g.useState([]),[kt,ji]=g.useState(()=>zr()),Ti=g.useRef(0),Nt=g.useRef(n),$s=g.useRef(db),Hi=g.useRef(kt),qt=g.useRef(()=>{});qt.current=cs;const Jt=g.useCallback(async()=>{try{const T=await p.listNotificationAssets();ai(T.assets.filter(A=>A.enabled).map(A=>A.url))}catch{ai([])}},[p]);g.useEffect(()=>{G(T=>T.some(A=>mn(A,n))?T:[...T,n])},[n]);const Dt=g.useCallback(T=>{const A=Ft(T),K=io(T);for(const ue of Object.keys(A.state.terminals))Ap(K.createWebSocketUrl(ue)),$S(ue);jM(T),G(ue=>ue.filter(pe=>!mn(pe,T))),V(ue=>{const pe=`${nu(T)}:`;let ke=!1;const De=new Set;for(const rt of ue){if(rt.startsWith(pe)){ke=!0;continue}De.add(rt)}return ke?De:ue}),ve(ue=>{const pe=`${nu(T)}:`;let ke=!1;const De={};for(const[rt,ut]of Object.entries(ue)){if(rt.startsWith(pe)){ke=!0;continue}De[rt]=ut}return ke?De:ue})},[]);g.useEffect(()=>{let T=!1;return p.listAgents().then(A=>{if(!T){const K=A.agents.map(pe=>pe.id),ue=[null,...K];n!==null&&!K.includes(n)&&(Dt(n),a?.(null)),$(ue)}}).catch(()=>{}),()=>{T=!0}},[n,p,Dt,a,H]);const Cn=g.useCallback(T=>{Dt(T),L(A=>A+1),mn(T,Nt.current)&&a?.(null)},[Dt,a]);g.useEffect(()=>{$(T=>T.some(A=>mn(A,n))?T:[...T,n])},[n]),g.useEffect(()=>{Nt.current=n},[n]),g.useEffect(()=>{Jt()},[Jt]),g.useEffect(()=>Xb(()=>ji(zr())),[]),g.useEffect(()=>{const T=A=>{qt.current(A)};return window.addEventListener("keydown",T,!0),()=>window.removeEventListener("keydown",T,!0)},[]),g.useEffect(()=>{$s.current=Vi.length>0?Vi:db},[Vi]),g.useEffect(()=>{Hi.current=kt},[kt]),g.useEffect(()=>{if(!b.loaded||!Re||!Pe)return;const T=ru(n,Re.id,Pe.id);V(A=>{if(A.has(T))return A;const K=new Set(A);return K.add(T),K})},[n,b.loaded,Re?.id,Pe?.id]),g.useEffect(()=>()=>{Ir()},[]),g.useEffect(()=>AM(T=>{const A=Ft(T.agentId).state,K=A.workspaces.flatMap(De=>De.tabs).find(De=>De.id===T.tabId),ue=A.terminals[T.terminalId],pe=K?.title?.trim()||ue?.title||T.commandName||"terminal",ke=document.visibilityState==="visible"&&mn(T.agentId,Nt.current)&&T.tabId===AA(A);if(ke||zE({tabTitle:pe,commandName:T.commandName,terminalId:T.terminalId}),!ke&&document.visibilityState==="visible"&&Hi.current.enabled){const De=Ti.current+1;Ti.current=De;const rt=$s.current;_i({id:De,agentId:T.agentId,terminalId:T.terminalId,tabId:T.tabId,tabTitle:pe,commandName:T.commandName,assetSrc:rt[Math.floor(Math.random()*rt.length)]??gA})}}),[]),g.useEffect(()=>{if(!He||kt.persistUntilDismissed)return;const T=window.setTimeout(()=>{_i(A=>A?.id===He.id?null:A)},kt.durationSeconds*1e3);return()=>window.clearTimeout(T)},[He,kt]),g.useEffect(()=>{W.current?.focus(),W.current?.select()},[Se?.workspaceId]),g.useEffect(()=>{HA(F),F&&E(null)},[F]),g.useEffect(()=>{let T=!1;async function A(){if(!Ft(n).loaded){Ta(n,!1,null);try{const ue=BA(f),[pe,ke]=await Promise.all([m.listTerminals(),m.getTerminalLayout()]),De=pe.terminals.length>0?pe.terminals:[(await m.createTerminal({cols:80,rows:24})).terminal];if(!T){const rt=ke.layout?Ow(ke.layout):null,ut=rt??ue??{},yi=zp(De,void 0,ut.savedWorkspaces,ut.savedActiveWorkspaceId),Fr=Cf(yi);rb(n,yi),Xc(n,ke.revision,JSON.stringify(Fr)),Ta(n,!0,null),!rt&&ue&&Ui(Fr,{baseRevision:ke.revision})}}catch(ue){!T&&!bt(ue)&&Ta(n,!0,Kl(ue))}}}return A(),()=>{T=!0}},[n,m]);async function Bs(){await Wt(async()=>{const T=await m.createTerminal({cols:80,rows:24});Ge({type:"terminal.created",terminal:T.terminal})})}async function Vs(T){await Wt(async()=>{const A=Ye?{parentTerminalId:Ye,cols:80,rows:24}:{cols:80,rows:24},K=await m.createTerminal(A);Ge({type:"terminal.split",terminal:K.terminal,direction:T})})}async function Ts(T){if(!Ye)throw new Error("No active pane is available.");const A=await m.readFile(T),K=`editor-${Date.now().toString(36)}-${zM(n)}`,ue=zA(A.path);ab(n,pe=>({...pe,[K]:{id:K,title:ue,rootToken:T.rootToken,path:A.path,read:A}})),xe&&ve(pe=>({...pe,[xe]:Lw(K)})),Ge({type:"editor.split",editorId:K,title:ue,direction:"vertical"})}function ks(T){ab(n,A=>{const K={...A};return delete K[T],K}),Ge({type:"editor.closed",editorId:T})}function ot(T){St([T])}function St(T){for(const A of T)Ge({type:"terminal.detached",terminalId:A})}async function Rt(T){await Wt(async()=>{await Bt(T),Ap(m.createWebSocketUrl(T)),$S(T),Ge({type:"terminal.closed",terminalId:T})})}async function li(T,A){const K=A.trim();if(!K)return;let ue=null;for(const pe of x.workspaces){const ke=pe.tabs.find(De=>De.id===T);if(ke){ue=ke.activeTerminalId;break}}if(Ge({type:"tab.renamed",tabId:T,title:K}),!!ue)try{const pe=await m.renameTerminal(ue,K);ct({type:"terminal.updated",terminal:pe.terminal})}catch(pe){Ta(n,!0,Kl(pe))}}function ei(T){const A=x.terminals[T];A&&Ge({type:"terminal.created",terminal:A})}async function Bt(T){try{await m.closeTerminal(T)}catch(A){if(A instanceof yn&&A.status===404)return;throw A}}async function nt(){await Wt(async()=>{await c()})}async function Wt(T){Ta(n,!0,null);try{await T()}catch(A){if(bt(A))return;Ta(n,!0,Kl(A))}}function bt(T){return T instanceof yn&&T.status===401&&!m.isAgent&&d?(d(),!0):!1}function Ge(T){Ul(n,T);const A=Ft(n),K=A.state;if(!A.loaded||K.workspaces.length===0)return;const ue=Cf(K);JSON.stringify(ue)!==A.lastPersistedLayoutJson&&Qi(ue)}function ct(T){Ul(n,T)}function vi(T,A,K,ue){const pe=ru(T,A,K);ve(ke=>({...ke,[pe]:ue}))}function Ai(T){xe&&ve(A=>({...A,[xe]:T}))}function Ni(T,A){const K=Cu(T);A?vi(n,A.workspaceId,A.tabId,K):Ai(K),Ge({type:"pane.selected",terminalId:T})}function ki(T){Ai(T.key),T.type==="terminal"&&Ge({type:"pane.selected",terminalId:T.terminalId})}function cs(T){if(I||T.isComposing||T.key==="Process"||EA(T.target))return;const A=bA(T);if(!A)return;if(T.preventDefault(),T.stopPropagation(),A.type==="server.previous"||A.type==="server.next"){gi(A.type==="server.next"?1:-1);return}const K=Ft(n).state,ue=K.workspaces.find(De=>De.id===K.activeWorkspaceId)??K.workspaces[0],pe=ue?.tabs.find(De=>De.id===ue.activeTabId)??ue?.tabs[0];if(A.type==="split"){if(!pe)return;Vs(A.direction);return}if(!ue||!pe)return;if(A.type==="tab.previous"||A.type==="tab.next"){const De=xA(ue.tabs,pe.id,A.type==="tab.next"?1:-1);De&&Ge({type:"tab.selected",tabId:De.id});return}if(A.type==="tab.index"){const De=ue.tabs[A.index-1];De&&Ge({type:"tab.selected",tabId:De.id});return}const ke=wA(pe.root,pe.activeTerminalId,A);ke&&Ni(ke,{workspaceId:ue.id,tabId:pe.id})}function gi(T){if(!a||j.length===0)return;const A=j.findIndex(ke=>mn(ke,n)),ue=((A===-1?0:A)+T+j.length)%j.length,pe=j[ue]??null;mn(pe,n)||a(pe)}function mt(T){ub(T.dataTransfer)&&(T.preventDefault(),T.dataTransfer.dropEffect="copy")}function Yt(T){if(!ub(T.dataTransfer))return;T.preventDefault();const A=LA(Ft(n).state),K=ee.current+1;if(ee.current=K,!A){hr({id:K,status:"failed",fileCount:0,message:"No active running terminal is available for upload."});return}hr({id:K,status:"queued",fileCount:0,terminalId:A.id,message:"Preparing upload..."}),us(K,A.id,T.dataTransfer)}async function us(T,A,K){try{const ue=await oA(K);if(ue.length===0)throw new Error("No files were found in the drop.");Xi(T,{id:T,status:"queued",fileCount:ue.length,message:"Queued"},{terminalId:A,files:ue})}catch(ue){Xi(T,{id:T,status:"failed",fileCount:0,message:Kl(ue)},{terminalId:A})}finally{xn()}}async function Xs(T){const A=te.current.find(ke=>ke.id===T);if(!A?.terminalId||!A.files||A.files.length===0)return;const K=A.terminalId,ue=A.files,pe=new AbortController;je.current=T,Xi(T,{id:T,status:"uploading",fileCount:ue.length,loaded:0,total:null,percent:null},{terminalId:K,files:ue,abortController:pe});try{const ke=await g2({terminalId:K,files:ue,signal:pe.signal,onProgress:yi=>{Xi(T,{id:T,status:"uploading",fileCount:ue.length,loaded:yi.loaded,total:yi.total,percent:yi.percent},{terminalId:K,files:ue,abortController:pe})}}),De=ke.failed>0?ke.uploaded>0?"partial":"failed":"success",rt=ke.failed>0?OA(ke):void 0,ut={id:T,status:De,fileCount:ue.length,response:ke};rt&&(ut.message=rt),Xi(T,ut,{terminalId:K,files:ue})}catch(ke){Xi(T,{id:T,status:"failed",fileCount:ue.length,message:pe.signal.aborted?"Upload canceled.":Kl(ke)},{terminalId:K,files:ue})}finally{je.current===T&&(je.current=null),xn()}}function xn(){if(je.current!==null)return;const T=te.current.find(A=>A.status==="queued");T?.terminalId&&T.files&&T.files.length>0&&Xs(T.id)}function hr(T){Gi(A=>[...A,T])}function Xi(T,A,K={}){Gi(ue=>ue.map(pe=>{if(pe.id!==T)return pe;const ke={...A},De=K.terminalId??pe.terminalId,rt=K.files??pe.files;return De!==void 0&&(ke.terminalId=De),rt!==void 0&&(ke.files=rt),K.abortController!==void 0&&(ke.abortController=K.abortController),ke}))}function Gi(T){const A=T(te.current);te.current=A,mi(A)}function En(T){te.current.find(K=>K.id===T)?.abortController?.abort(),je.current===T&&(je.current=null),Gi(K=>K.filter(ue=>ue.id!==T)),xn()}function Ls(){for(const T of te.current)T.abortController?.abort();je.current=null,Gi(()=>[])}function Os(T){const A=te.current.find(K=>K.id===T);if(A){if(A.status==="queued"){En(T);return}A.abortController?.abort()}}function Ds(T){const A=te.current.find(ue=>ue.id===T);if(!A?.terminalId||!A.files||A.files.length===0)return;const K=Zi(A);if(K.length===0){Xi(T,{id:T,status:"failed",fileCount:A.fileCount,message:"No failed files are available to retry."},{terminalId:A.terminalId,files:A.files});return}Xi(T,{id:T,status:"queued",fileCount:K.length,message:"Queued"},{terminalId:A.terminalId,files:K}),xn()}function Zi(T){const A=T.files??[],K="response"in T?T.response:void 0;if(!K)return A;const ue=K.results.filter(De=>De.status==="failed").map(De=>De.relativePath);if(ue.length===0)return[];const pe=new Map;for(const De of A){const rt=pe.get(De.relativePath)??[];rt.push(De),pe.set(De.relativePath,rt)}const ke=[];for(const De of ue){const ut=pe.get(De)?.shift();ut&&ke.push(ut)}return ke}function Lt(T){const K=Ft(T.agentId).state.workspaces.find(ue=>ue.tabs.some(pe=>pe.id===T.tabId));K&&vi(T.agentId,K.id,T.tabId,Cu(T.terminalId)),Ul(T.agentId,{type:"pane.selected",terminalId:T.terminalId}),OM(T.agentId,T.tabId),mn(T.agentId,n)||a?.(T.agentId),_i(null)}function Qi(T){const A=Ft(n).mutable.saveCoord;A.pendingLayoutSave=T,Pl(T,f),A.saveTimer!==null&&window.clearTimeout(A.saveTimer),A.saveTimer=window.setTimeout(()=>{A.saveTimer=null;const K=A.pendingLayoutSave;A.pendingLayoutSave=null,K&&Ui(K)},vA)}function Ir(){const T=Ft(n).mutable.saveCoord;T.saveTimer!==null&&(window.clearTimeout(T.saveTimer),T.saveTimer=null);const A=T.pendingLayoutSave;T.pendingLayoutSave=null,A&&(Pl(A,f),Ui(A))}function Ui(T,A={}){const K=Ft(n).mutable.saveCoord;K.nextPersistLayout=T,A.baseRevision!==void 0&&(K.queuedBaseRevision=A.baseRevision),!K.nextPersistQueued&&(K.nextPersistQueued=!0,K.persistChain=K.persistChain.then(async()=>{K.nextPersistQueued=!1;const ue=K.nextPersistLayout,pe=K.queuedBaseRevision;K.nextPersistLayout=null,K.queuedBaseRevision=void 0,ue&&await zs(ue,pe!==void 0?{baseRevision:pe}:{})}))}async function zs(T,A={}){const K=Ft(n),ue=A.baseRevision??K.layoutRevision,pe={layout:T,...typeof ue=="number"?{baseRevision:ue}:{}};try{const ke=await m.saveTerminalLayout(pe),De=ke.layout??T;Xc(n,ke.revision,JSON.stringify(De)),Pl(De,f);return}catch(ke){if(ke instanceof yn&&ke.status===409)try{const De=await m.getTerminalLayout();if(De.layout){const rt=Ft(n).state,ut=zp(Object.values(rt.terminals),void 0,De.layout.workspaces,De.layout.activeWorkspaceId),yi=Cf(ut);rb(n,ut),Xc(n,De.revision,JSON.stringify(yi)),Pl(yi,f)}else Xc(n,De.revision,K.lastPersistedLayoutJson);return}catch{}Pl(T,f)}}const O=UA(o),fe=!F||R,Oe=fe?ce:"servers";return _.jsx(dE,{sensors:me,onDragStart:Ce,onDragEnd:ze,onDragCancel:Ne,children:_.jsxs("main",{className:"terminal-shell","data-collapsed":F,"data-sidebar-open":R,onDragOver:mt,onDrop:Yt,children:[_.jsx("button",{type:"button",className:"workspace-backdrop","aria-label":"Close workspaces",onClick:()=>re(!1)}),_.jsxs("aside",{className:"workspace-sidebar",children:[_.jsxs("header",{className:"workspace-brand",children:[fe?_.jsx(Cb,{height:20}):_.jsx(wb,{size:24}),_.jsx("button",{type:"button",className:"sidebar-collapse-button","aria-label":F?"Expand sidebar":"Collapse sidebar",title:F?"Expand sidebar":"Collapse sidebar",onClick:()=>J(T=>!T),children:F?">":"<"}),_.jsx("button",{type:"button",className:"sidebar-drawer-close-button","aria-label":"Close workspaces",title:"Close workspaces",onClick:()=>re(!1),children:"x"})]}),_.jsxs("div",{className:"workspace-sidebar-content",children:[fe?_.jsxs("div",{className:"workspace-sidebar-tabs",role:"tablist","aria-label":"Sidebar mode",children:[_.jsx("button",{type:"button",role:"tab","aria-selected":ce==="servers",onClick:()=>{q("servers"),E(null)},children:"Servers"}),_.jsx("button",{type:"button",role:"tab","aria-selected":ce==="files",onClick:()=>{q("files"),E(null)},children:"Files"})]}):null,Oe==="servers"&&fe?_.jsx("nav",{className:"workspace-nav","aria-label":"Servers",children:_.jsx(ef,{api:p,activeAgentId:n,onSelectServer:a??(()=>{}),onSessionInvalid:d,refreshToken:H})}):null,fe?null:_.jsx("nav",{className:"workspace-nav workspace-nav--collapsed","aria-label":"Servers",children:_.jsx(ef,{api:p,activeAgentId:n,onSelectServer:a??(()=>{}),onSessionInvalid:d,refreshToken:H,compact:!0})}),Oe==="files"?_.jsxs(_.Fragment,{children:[fe?_.jsx("nav",{className:"workspace-nav workspace-nav--compact","aria-label":"Servers",children:_.jsx(ef,{api:p,activeAgentId:n,onSelectServer:a??(()=>{}),onSessionInvalid:d,refreshToken:H})}):null,_.jsx(C2,{api:m,activeTerminalId:Ye,activeTerminalCwd:Be?.cwd??null,onOpenFile:Ts})]}):null]}),fe?_.jsxs("div",{className:"workspace-sidebar-footer",children:[_.jsx("span",{children:O}),_.jsxs("div",{className:"workspace-sidebar-footer-actions",children:[_.jsxs("button",{type:"button",className:"workspace-footer-icon-button","aria-label":"settings",title:"Settings",onClick:()=>ie(!0),children:[_.jsx(pb,{name:"settings"}),de.hasUpdates?_.jsx("span",{className:"update-pulse-dot","aria-hidden":"true"}):null]}),_.jsx("button",{type:"button",className:"workspace-footer-icon-button","aria-label":"logout",title:"Logout",onClick:()=>{nt()},children:_.jsx(pb,{name:"logout"})})]})]}):null]}),I?_.jsx(_2,{api:p,onClose:()=>ie(!1),updateAvailable:de.hasUpdates,onNotificationAssetsChanged:()=>{Jt()},onAgentRemoved:Cn}):null,_.jsxs("section",{className:"terminal-main","aria-label":"Terminal workspace","data-mobile-pane-switcher":Xe?"true":void 0,children:[_.jsx(KM,{tabs:Re?.tabs??[],activeTabId:Re?.activeTabId??null,terminals:x.terminals,unreadCompletionTabIds:b.unreadCompletions,detachedTerminals:gt,onSelectTab:T=>Ge({type:"tab.selected",tabId:T}),onCreateTab:()=>{Bs()},onToggleWorkspaces:()=>re(T=>!T),onCloseTerminals:T=>St(T),onReattachTerminal:T=>ei(T),onDeleteTerminal:T=>{Rt(T)},onSplitVertical:()=>{Vs("vertical")},onSplitHorizontal:()=>{Vs("horizontal")},onRenameTab:(T,A)=>{li(T,A)},activePaneAvailable:!!Ye}),Xe?_.jsx(kA,{targets:Ee,activeLeafKey:Ke,terminals:x.terminals,editors:C,onSelect:ki}):null,B?_.jsx("div",{className:"workspace-error",children:B}):null,_.jsxs("section",{className:"workspace-body","aria-busy":k,children:[k?_.jsx("div",{className:"workspace-placeholder",children:"Opening shell..."}):null,!k&&!Pe?_.jsx(TA,{onCreate:()=>{Bs()}}):null,X.map(T=>{const A=mn(T,n);return _.jsx(SA,{agentId:T,active:A,activeServerApi:A?m:void 0,visitedTabKeys:M,refreshCwdOnEnter:A&&Oe==="files",draggingTab:A?he:null,mobileSplitFocus:ae,mobileFocusedLeafByTabKey:Q,onSelect:K=>{A&&Ni(K)},onClose:K=>{A&&ot(K)},onCloseEditor:K=>{A&&ks(K)},onResize:(K,ue)=>{A&&Ge({type:"pane.resized",path:K,ratio:ue})},onExit:(K,ue)=>{A?ct({type:"terminal.exited",terminalId:K,exitCode:ue}):Ul(T,{type:"terminal.exited",terminalId:K,exitCode:ue})},onSnapshot:(K,ue)=>{const pe={type:"terminal.updated",terminal:K,notifyCompletion:ue?.notifyCompletion===!0};A?ct(pe):Ul(T,pe)},...T===null&&d?{onAuthClose:d}:{}},nu(T))})]}),_.jsx(QM,{toast:He,onActivate:Lt,onDismiss:()=>_i(null)}),_.jsx(WM,{uploads:yt,onDismiss:En,onDismissAll:Ls,onRetry:Ds,onCancel:Os})]})]})})}function SA({agentId:e,active:t,activeServerApi:n,visitedTabKeys:a,refreshCwdOnEnter:o,draggingTab:c,mobileSplitFocus:d,mobileFocusedLeafByTabKey:p,onSelect:m,onClose:f,onCloseEditor:S,onResize:y,onExit:b,onSnapshot:x,onAuthClose:C}){const k=g.useMemo(()=>de=>Ew(e,de),[e]),B=g.useMemo(()=>()=>Ft(e),[e]),R=g.useSyncExternalStore(k,B,B),re=g.useMemo(()=>io(e),[e]),F=n??re,J=R.state,ce=J.workspaces.find(de=>de.id===J.activeWorkspaceId)??J.workspaces[0],q=ce?.id??null,ie=(ce?.tabs.find(de=>de.id===ce.activeTabId)??ce?.tabs[0])?.id??null;return!R.loaded||J.workspaces.length===0?null:_.jsx("div",{className:"workspace-server-surface","data-active":t,"aria-hidden":!t,children:J.workspaces.flatMap(de=>de.tabs.map(j=>{const $=t&&de.id===q&&j.id===ie,H=ru(e,de.id,j.id),L=wu(j.root),X=d&&L.length>1?Bw(L,j.activeTerminalId,p[H]):null;return!$&&!a.has(H)?null:_.jsx("div",{className:"workspace-tab-surface","data-active":$,"aria-hidden":!$,children:_.jsx(Bp,{node:j.root,terminals:J.terminals,editors:R.editors,api:F,activeTerminalId:j.activeTerminalId,visible:$,refreshCwdOnEnter:$&&o,tabId:j.id,dropZoneActive:$&&c!==null,draggingTerminalId:$?c?.terminalId??null:null,mobileFocusLeafKey:X,onSelect:m,onClose:f,onCloseEditor:S,onResize:y,onExit:b,onSnapshot:x,...C?{onAuthClose:C}:{}})},`${de.id}:${j.id}`)}))})}function bA(e){const t=WE(e);if(t)switch(t.id){case"server.previous":case"server.next":case"tab.previous":case"tab.next":return{type:t.id};case"tab.index":case"pane.index":return t.index===null?null:{type:t.id,index:t.index};case"split.right":return{type:"split",direction:"vertical"};case"split.down":return{type:"split",direction:"horizontal"};default:return null}if(e.ctrlKey&&e.altKey&&!e.metaKey&&!e.shiftKey){const n=CA(e.key);return n?{type:"pane.direction",direction:n}:null}return null}function wA(e,t,n){switch(n.type){case"pane.direction":return tA(e,t,n.direction);case"pane.index":return iA(e,n.index);default:return null}}function CA(e){switch(e){case"ArrowLeft":return"left";case"ArrowRight":return"right";case"ArrowUp":return"up";case"ArrowDown":return"down";default:return null}}function xA(e,t,n){if(e.length===0)return null;const a=e.findIndex(c=>c.id===t);return e[((a===-1?0:a)+n+e.length)%e.length]??null}function wu(e){return e.type==="pane"?[{key:Cu(e.terminalId),type:"terminal",terminalId:e.terminalId}]:e.type==="editor"?[{key:Lw(e.editorId),type:"editor",editorId:e.editorId,title:e.title}]:[...wu(e.first),...wu(e.second)]}function Bw(e,t,n){if(n&&e.some(o=>o.key===n))return n;const a=t?Cu(t):null;return a&&e.some(o=>o.key===a)?a:e[0]?.key??null}function Cu(e){return`terminal:${e}`}function Lw(e){return`editor:${e}`}function EA(e){if(!(e instanceof HTMLElement)||e.closest(".xterm"))return!1;if(e.closest('input, textarea, select, [role="textbox"]'))return!0;const t=e.closest("[contenteditable]");return t instanceof HTMLElement&&t.getAttribute("contenteditable")?.toLowerCase()!=="false"}function TA({onCreate:e}){return _.jsxs("div",{className:"empty-workspace",children:[_.jsx("span",{children:"No terminal is open."}),_.jsx("button",{type:"button",onClick:e,children:"New tab"})]})}function kA({targets:e,activeLeafKey:t,terminals:n,editors:a,onSelect:o}){const[c,d]=g.useState(!1);if(e.length<=1)return null;const p=t?e.findIndex(b=>b.key===t):-1,m=p>=0?p:0,f=e[m]??e[0],S=fb(f,n,a);function y(b){const x=(m+b+e.length)%e.length,C=e[x];C&&o(C)}return _.jsxs("div",{className:"mobile-pane-switcher",role:"group","aria-label":"Pane switcher",children:[_.jsx("button",{type:"button","aria-label":"Previous pane",onClick:()=>y(-1),children:"<"}),_.jsxs("button",{type:"button",className:"mobile-pane-current","aria-label":"Open pane switcher","aria-haspopup":"dialog","aria-expanded":c,title:S,onClick:()=>d(!0),children:["Pane ",m+1,"/",e.length," | ",S]}),_.jsx("button",{type:"button","aria-label":"Next pane",onClick:()=>y(1),children:">"}),c?_.jsx("div",{className:"mobile-pane-sheet-backdrop",onClick:()=>d(!1),children:_.jsxs("section",{className:"mobile-pane-sheet",role:"dialog","aria-modal":"true","aria-label":"Pane switcher",onClick:b=>b.stopPropagation(),children:[_.jsxs("header",{children:[_.jsx("strong",{children:"Panes"}),_.jsx("button",{type:"button","aria-label":"Close pane switcher",onClick:()=>d(!1),children:"x"})]}),_.jsx("div",{className:"mobile-pane-sheet-list",children:e.map((b,x)=>{const C=fb(b,n,a),k=DA(b,n,a),B=b.key===f.key;return _.jsxs("button",{type:"button","data-active":B,onClick:()=>{o(b),d(!1)},children:[_.jsx("span",{className:"mobile-pane-sheet-index",children:x+1}),_.jsxs("span",{className:"mobile-pane-sheet-copy",children:[_.jsx("strong",{children:C}),_.jsx("small",{children:k})]}),_.jsx("span",{className:"mobile-pane-sheet-type",children:b.type})]},b.key)})})]})}):null]})}function fb(e,t,n){if(e.type==="editor")return n[e.editorId]?.title||e.title||e.editorId;const a=t[e.terminalId];return a?.title||a?.cwd||e.terminalId}function DA(e,t,n){if(e.type==="editor"){const c=n[e.editorId];return c?.path?`editor | ${c.path}`:"editor"}const a=t[e.terminalId];return a?`${a.activity==="busy"?`busy${a.currentCommand?`: ${a.currentCommand}`:""}`:a.activity==="idle"?"idle":a.status} | ${a.cwd}`:"terminal"}function RA(e){const[t,n]=g.useState(()=>MA(e));return g.useEffect(()=>{if(typeof window>"u"||typeof window.matchMedia!="function"){n(!1);return}const a=window.matchMedia(e),o=()=>n(a.matches);return o(),typeof a.addEventListener=="function"?(a.addEventListener("change",o),()=>a.removeEventListener("change",o)):(a.addListener(o),()=>a.removeListener(o))},[e]),t}function MA(e){return typeof window>"u"||typeof window.matchMedia!="function"?!1:window.matchMedia(e).matches}function mn(e,t){return e===t}function AA(e){const t=e.workspaces.find(a=>a.id===e.activeWorkspaceId)??e.workspaces[0];return(t?.tabs.find(a=>a.id===t.activeTabId)??t?.tabs[0])?.id??null}function nu(e){return e??"__local__"}function ru(e,t,n){return`${nu(e)}:${t}:${n}`}function NA(e){return e?{workspaceKey:`${hb}:${e}`}:{workspaceKey:hb}}function BA(e){const t=localStorage.getItem(e.workspaceKey);if(!t)return null;try{const n=JSON.parse(t),a=Wb(n);return a?Ow(a):null}catch{return null}}function Ow(e){const t=Wb(e);return t?{savedWorkspaces:t.workspaces,savedActiveWorkspaceId:t.activeWorkspaceId}:null}function Pl(e,t){if(e.workspaces.length>0){localStorage.setItem(t.workspaceKey,JSON.stringify(e));return}localStorage.removeItem(t.workspaceKey)}function LA(e){const t=e.workspaces.find(o=>o.id===e.activeWorkspaceId)??e.workspaces[0],n=t?.tabs.find(o=>o.id===t.activeTabId)??t?.tabs[0],a=n?e.terminals[n.activeTerminalId]:void 0;return a?.status==="running"?a:null}function OA(e){return e.results.find(t=>t.status==="failed"&&t.error)?.error}function zA(e){return e.split("/").filter(Boolean).pop()??e}function jA(){try{return localStorage.getItem(Nw)==="true"}catch{return!1}}function HA(e){try{localStorage.setItem(Nw,e?"true":"false")}catch{}}function UA(e){if(!e)return"session · local";const t=Date.parse(e);if(!Number.isFinite(t))return"session · local";const n=t-Date.now();if(n<=0)return"session · expired";const a=Math.max(1,Math.floor(n/6e4));return a<60?`session · ${a}m left`:`session · ${Math.floor(a/60)}h left`}function pb({name:e}){return _.jsxs("svg",{className:"workspace-footer-icon",viewBox:"0 0 24 24","aria-hidden":"true",focusable:"false",children:[e==="settings"?_.jsxs(_.Fragment,{children:[_.jsx("path",{d:"M4 7h9"}),_.jsx("path",{d:"M17 7h3"}),_.jsx("circle",{cx:"15",cy:"7",r:"2"}),_.jsx("path",{d:"M4 12h3"}),_.jsx("path",{d:"M11 12h9"}),_.jsx("circle",{cx:"9",cy:"12",r:"2"}),_.jsx("path",{d:"M4 17h9"}),_.jsx("path",{d:"M17 17h3"}),_.jsx("circle",{cx:"15",cy:"17",r:"2"})]}):null,e==="logout"?_.jsxs(_.Fragment,{children:[_.jsx("path",{d:"M10 6H6v12h4"}),_.jsx("path",{d:"M13 8l4 4-4 4"}),_.jsx("path",{d:"M8 12h9"})]}):null]})}function Kl(e){return e instanceof Error?e.message:"Request failed"}function PA({api:e,onDone:t}){const[n,a]=g.useState(null),[o,c]=g.useState(null),[d,p]=g.useState(""),[m,f]=g.useState(!1),[S,y]=g.useState(null),[b,x]=g.useState(null);g.useEffect(()=>{let k=!1;return e.setupTotp().then(B=>{k||(a(B.qrDataUrl),c(B.secret))}).catch(B=>{k||x(B instanceof Error?B.message:"Failed to generate QR code")}),()=>{k=!0}},[e]);async function C(k){if(k.preventDefault(),!!o){f(!0),y(null);try{await e.activateTotp({secret:o,otp:d}),t()}catch(B){y(B instanceof Error?B.message:"Verification failed")}finally{f(!1)}}}return b?_.jsx("p",{className:"form-error",children:b}):!n||!o?_.jsx("p",{className:"muted",children:"Generating authenticator setup..."}):_.jsxs("div",{className:"totp-setup",children:[_.jsx("p",{className:"totp-setup-instructions",children:"Scan this QR code with an authenticator app (Google Authenticator, Authy, 1Password, etc.), then enter the 6-digit code to confirm."}),_.jsx("div",{className:"totp-qr-container",children:_.jsx("img",{src:n,alt:"TOTP QR code",width:192,height:192})}),_.jsxs("details",{className:"totp-secret-details",children:[_.jsx("summary",{children:"Can't scan? Enter manually"}),_.jsx("p",{className:"totp-secret-text",children:o})]}),_.jsxs("form",{className:"auth-form",onSubmit:C,children:[_.jsxs("label",{children:["Verification code",_.jsx("input",{autoFocus:!0,type:"text",inputMode:"numeric",pattern:"[0-9]{6}",maxLength:6,value:d,onChange:k=>p(k.currentTarget.value.replace(/\D/g,"")),placeholder:"000000",required:!0})]}),S?_.jsx("p",{className:"form-error",children:S}):null,_.jsx("button",{type:"submit",disabled:m||d.length!==6,children:"Activate 2FA"})]})]})}function KA({api:e,serverApi:t,activeAgentId:n=null,onSelectServer:a}){const o=g.useMemo(()=>e??Eu(),[e]),c=g.useMemo(()=>t??io(null),[t]),[d,p]=g.useState(null),[m,f]=g.useState(null);g.useEffect(()=>{let C=!1;return o.getSession().then(k=>{C||(p(k),f(null))}).catch(k=>{C||(f(go(k)),p(null))}),()=>{C=!0}},[o]);const S=WA(d);async function y(){const C=await o.getSession();p(C),f(null)}async function b(){ZS(),lb(),iR(),f(null),p(null);try{await y()}catch(C){f(go(C))}}if(S==="workspace")return _.jsx(yA,{api:o,serverApi:c,activeAgentId:n,onSelectServer:a,sessionExpiresAt:d?.expiresAt??null,onSessionInvalid:()=>{b()},onLogout:async()=>{ZS(),lb();const C=await o.logout();p(C)}});const x={loading:"Terminal",setup_password:"Set password",setup_totp:"Set up 2FA",login:"Unlock terminal",reauth:"Verify it’s you",workspace:"Terminal"};return _.jsxs("main",{className:"auth-screen",children:[_.jsxs("div",{className:"auth-background","aria-hidden":"true",children:[_.jsx("div",{className:"auth-grid"}),_.jsx("div",{className:"auth-glow"})]}),_.jsxs("section",{className:"auth-panel","aria-busy":S==="loading",children:[_.jsxs("header",{className:"auth-header",children:[_.jsxs("div",{className:"auth-brand",children:[_.jsx(wb,{size:26}),_.jsxs("div",{children:[_.jsx(Cb,{height:17}),_.jsx("p",{className:"auth-host",children:"local terminal"})]})]}),_.jsx("h1",{children:x[S]})]}),m?_.jsx("p",{className:"form-error",children:m}):null,S==="loading"?_.jsx("p",{className:"muted",children:"Checking session..."}):null,S==="loading"&&m?_.jsx("button",{type:"button",className:"secondary-button",onClick:()=>{b()},children:"Retry"}):null,S==="setup_password"?_.jsx(IA,{api:o,onSession:C=>{p(C)}}):null,S==="setup_totp"?_.jsx(PA,{api:o,onDone:()=>{y()}}):null,S==="login"?_.jsx(FA,{api:o,session:d,onSession:p,onRefresh:y}):null,S==="reauth"?_.jsx(qA,{api:o,session:d,onSession:p,onFullLogin:()=>p(C=>C&&{...C,deviceTrusted:!1})}):null]})]})}function IA({api:e,onSession:t}){const[n,a]=g.useState(""),[o,c]=g.useState(""),[d,p]=g.useState(!1),[m,f]=g.useState(null);async function S(y){y.preventDefault(),p(!0),f(null);try{if(n!==o){f("Passwords do not match");return}t(await e.setupPassword({password:n}))}catch(b){f(go(b))}finally{p(!1)}}return _.jsxs("form",{className:"auth-form",onSubmit:S,children:[_.jsxs("label",{children:["Password",_.jsx("input",{autoFocus:!0,value:n,onChange:y=>a(y.currentTarget.value),type:"password",minLength:8,required:!0})]}),_.jsxs("label",{children:["Confirm password",_.jsx("input",{value:o,onChange:y=>c(y.currentTarget.value),type:"password",minLength:8,required:!0})]}),m?_.jsx("p",{className:"form-error",children:m}):null,_.jsx("button",{type:"submit",disabled:d||n.length<8||o.length<8,children:"Set password"})]})}function FA({api:e,session:t,onSession:n,onRefresh:a}){const[o,c]=g.useState(""),[d,p]=g.useState(""),[m,f]=g.useState(!1),[S,y]=g.useState(!1),[b,x]=g.useState(null),C=t?.totpEnabled??!1,k=t?.currentIpWhitelisted??!1;async function B(R){R.preventDefault(),y(!0),x(null);try{n(await e.login({password:o,...C?{otp:d}:{},rememberNetwork:m}))}catch(re){x(go(re))}finally{y(!1)}}return _.jsxs("form",{className:"auth-form",onSubmit:B,children:[_.jsxs("label",{children:["Password",_.jsx("input",{autoFocus:!0,type:"password",value:o,onChange:R=>c(R.currentTarget.value),required:!0})]}),C?_.jsxs("label",{children:["Authenticator code",_.jsx("input",{type:"text",inputMode:"numeric",pattern:"[0-9]{6}",maxLength:6,value:d,onChange:R=>p(R.currentTarget.value.replace(/\D/g,"")),placeholder:"000000",required:!0})]}):null,k?null:_.jsxs("label",{className:"auth-checkbox",children:[_.jsx("input",{type:"checkbox",checked:m,onChange:R=>f(R.currentTarget.checked)}),"Remember this network (skip 2FA here next time)"]}),b?_.jsx("p",{className:"form-error",children:b}):null,_.jsxs("div",{className:"button-row",children:[_.jsx("button",{type:"submit",disabled:S||o.length===0||C&&d.length!==6,children:"Unlock"}),_.jsx("button",{type:"button",className:"secondary-button",onClick:()=>{a()},disabled:S,children:"Refresh"})]})]})}function qA({api:e,session:t,onSession:n,onFullLogin:a}){const o=t?.currentIpWhitelisted??!1,[c,d]=g.useState(""),[p,m]=g.useState(!1),[f,S]=g.useState(!1),[y,b]=g.useState(null),x=xi.useRef(!1),C=xi.useCallback(async(B,R)=>{S(!0),b(null);try{n(await e.reauth({...B?{otp:B}:{},rememberNetwork:R}))}catch(re){b(go(re))}finally{S(!1)}},[e,n]);g.useEffect(()=>{o&&!x.current&&(x.current=!0,C(void 0,!1))},[o,C]);async function k(B){B.preventDefault(),await C(c,p)}return o&&!y?_.jsx("p",{className:"muted",children:"Reconnecting from a trusted network…"}):_.jsxs("form",{className:"auth-form",onSubmit:k,children:[_.jsx("p",{className:"muted",children:"This device is remembered. Enter your authenticator code to continue."}),_.jsxs("label",{children:["Authenticator code",_.jsx("input",{autoFocus:!0,type:"text",inputMode:"numeric",pattern:"[0-9]{6}",maxLength:6,value:c,onChange:B=>d(B.currentTarget.value.replace(/\D/g,"")),placeholder:"000000",required:!0})]}),_.jsxs("label",{className:"auth-checkbox",children:[_.jsx("input",{type:"checkbox",checked:p,onChange:B=>m(B.currentTarget.checked)}),"Remember this network (skip 2FA here next time)"]}),y?_.jsx("p",{className:"form-error",children:y}):null,_.jsxs("div",{className:"button-row",children:[_.jsx("button",{type:"submit",disabled:f||c.length!==6,children:"Continue"}),_.jsx("button",{type:"button",className:"secondary-button",onClick:a,disabled:f,children:"Use password instead"})]})]})}function WA(e){return e?e.passwordSet?e.authenticated&&!e.totpEnabled?"setup_totp":e.authenticated?"workspace":e.deviceTrusted&&e.totpEnabled?"reauth":"login":"setup_password":"loading"}function go(e){return e instanceof Error?e.message:"Request failed"}const mb="NTerminal",Wp="nterminal.activeAgentId";function YA(){const[e,t]=g.useState(()=>$A()),n=g.useMemo(()=>Eu(),[]),a=g.useMemo(()=>io(e),[e]);g.useEffect(()=>{const c=()=>{const d=LM();document.title=d>0?`(${d}) ${mb}`:mb};return c(),BM(c)},[]);function o(c){VA(c),t(c)}return _.jsx(KA,{api:n,activeAgentId:e,serverApi:a,onSelectServer:o})}function $A(){if(typeof window>"u")return null;try{const e=window.localStorage.getItem(Wp);return e&&e.trim()?e:null}catch{return null}}function VA(e){if(!(typeof window>"u"))try{if(e){window.localStorage.setItem(Wp,e);return}window.localStorage.removeItem(Wp)}catch{}}const _b=["gesturestart","gesturechange","gestureend"],XA=[".workspace-list",".terminal-tab-list",".mobile-terminal-key-bar",".upload-toast-body",".file-tree",".file-detail",".file-editor",".file-markdown-preview",".editor-markdown-preview"].join(",");function GA(e=window){if(!QA(e))return()=>{};const t={passive:!1},n=e.document;function a(c){c.cancelable&&c.preventDefault()}function o(c){if(c.defaultPrevented)return;const d=c.touches;!d||d.length===0||(d.length>1||!ZA(c.target))&&a(c)}for(const c of _b)n.addEventListener(c,a,t);return n.addEventListener("touchmove",o,t),n.addEventListener("dblclick",a,t),()=>{for(const c of _b)n.removeEventListener(c,a,t);n.removeEventListener("touchmove",o,t),n.removeEventListener("dblclick",a,t)}}function ZA(e){return e instanceof Element&&e.closest(XA)!==null}function QA(e){return e.navigator.maxTouchPoints>0?!0:typeof e.matchMedia=="function"&&e.matchMedia("(pointer: coarse)").matches}const vb="--nterminal-viewport-height",gb="--nterminal-keyboard-inset-bottom",yb="data-nterminal-keyboard-visible",JA=120;function eN(e=window){const t=e.document.documentElement,n=e.visualViewport;function a(){const o=tN(e);o!==null&&t.style.setProperty(vb,`${o}px`),t.style.setProperty(gb,`${zw(e)}px`),t.setAttribute(yb,String(iN(e)))}return a(),n?.addEventListener("resize",a),n?.addEventListener("scroll",a),e.addEventListener("resize",a),e.addEventListener("orientationchange",a),e.addEventListener("pageshow",a),e.document.addEventListener("visibilitychange",a),()=>{n?.removeEventListener("resize",a),n?.removeEventListener("scroll",a),e.removeEventListener("resize",a),e.removeEventListener("orientationchange",a),e.removeEventListener("pageshow",a),e.document.removeEventListener("visibilitychange",a),t.style.removeProperty(vb),t.style.removeProperty(gb),t.removeAttribute(yb)}}function tN(e){const t=e.visualViewport?.height;return xu(t)?t:xu(e.innerHeight)?e.innerHeight:null}function xu(e){return typeof e=="number"&&Number.isFinite(e)&&e>0}function iN(e){return zw(e)>JA}function zw(e){const t=e.visualViewport?.height;if(!xu(t)||!xu(e.innerHeight))return 0;const n=typeof e.visualViewport?.offsetTop=="number"?e.visualViewport.offsetTop:0;return Math.max(0,Math.round(e.innerHeight-t-n))}eN();GA();pm();ZC.createRoot(document.getElementById("root")).render(_.jsx(xi.StrictMode,{children:_.jsx(YA,{})}));export{IC as g,_ as j};
44
+ (detached — click to re-open, × to delete)`;return _.jsxs("span",{className:"terminal-detached-pill",title:o,children:[_.jsx("button",{type:"button",className:"terminal-detached-pill-open","aria-label":`Re-open ${a}`,onClick:t,children:a}),_.jsx("button",{type:"button",className:"terminal-detached-pill-delete","aria-label":`Delete ${a}`,title:`Delete ${a} — this destroys the underlying shell session.`,onClick:c=>{c.stopPropagation(),n()},children:"×"})]})}function qM({terminal:e,onCancel:t,onConfirm:n}){const a=e.title||e.cwd||e.id.slice(0,8);return _.jsx("div",{className:"security-overlay",role:"dialog","aria-modal":"true","aria-labelledby":"delete-terminal-title",onClick:t,children:_.jsxs("div",{className:"security-panel terminal-delete-dialog",onClick:o=>o.stopPropagation(),children:[_.jsxs("header",{className:"security-panel-header",children:[_.jsx("h2",{id:"delete-terminal-title",children:"Delete Terminal"}),_.jsx("button",{type:"button",className:"security-close","aria-label":"Close",onClick:t,children:"×"})]}),_.jsxs("section",{className:"terminal-delete-dialog-body",children:[_.jsx("p",{children:"Delete this terminal?"}),_.jsx("span",{children:a}),_.jsx("small",{children:"The shell session and scrollback will be destroyed."})]}),_.jsxs("div",{className:"terminal-delete-dialog-actions",children:[_.jsx("button",{type:"button",className:"secondary-button",onClick:t,children:"Cancel"}),_.jsx("button",{type:"button",className:"terminal-delete-confirm",onClick:n,children:"Delete"})]})]})})}function WM({uploads:e,onDismiss:t,onDismissAll:n,onRetry:a,onCancel:o}){if(e.length===0)return null;const d=e.some(m=>m.status==="failed"||m.status==="partial")?"alert":"status",p=e.filter(m=>m.status==="queued"||m.status==="uploading").length;return _.jsxs("aside",{className:`upload-toast upload-toast-${GM(e)}`,role:d,"aria-live":d==="alert"?"assertive":"polite",children:[_.jsxs("header",{className:"upload-toast-header",children:[_.jsx("strong",{children:e.length===1?su(e[0]):`Uploads ${p>0?`(${p} active)`:`(${e.length})`}`}),_.jsx("button",{type:"button","aria-label":"Dismiss upload status",onClick:n,children:"x"})]}),_.jsx("div",{className:"upload-toast-body upload-queue-body",children:e.map(m=>_.jsx(YM,{upload:m,compact:e.length>1,onDismiss:()=>t(m.id),onRetry:()=>a(m.id),onCancel:()=>o(m.id)},m.id))})]})}function YM({upload:e,compact:t,onDismiss:n,onRetry:a,onCancel:o}){const c="response"in e?e.response:void 0,d=e.status==="failed"||e.status==="partial",p=e.status==="queued"||e.status==="uploading";return _.jsxs("section",{className:"upload-queue-item","data-status":e.status,"aria-label":su(e),children:[_.jsxs("div",{className:"upload-queue-item-header",children:[_.jsx("strong",{children:su(e)}),_.jsxs("div",{className:"upload-queue-actions",children:[p?_.jsx("button",{type:"button",onClick:o,children:"Cancel"}):null,d?_.jsx("button",{type:"button",onClick:a,children:"Retry"}):null,_.jsx("button",{type:"button","aria-label":`Dismiss ${su(e)}`,onClick:n,children:"x"})]})]}),e.status==="queued"?_.jsx("p",{children:e.message??"Queued"}):null,e.status==="uploading"?_.jsx($M,{toast:e}):null,c&&"message"in e&&e.message?_.jsx("p",{className:"upload-toast-muted",children:e.message}):null,c?_.jsx(VM,{response:c,compact:t}):null,e.status==="failed"&&!c&&e.message?_.jsx("p",{children:e.message}):null]})}function $M({toast:e}){const t=e.percent===null?ZM(e.loaded):`${e.percent}%`;return _.jsxs(_.Fragment,{children:[_.jsxs("div",{className:"upload-progress-row",children:[_.jsxs("span",{children:[e.fileCount," file",e.fileCount===1?"":"s"]}),_.jsx("span",{children:t})]}),_.jsx("div",{className:"upload-progress-track","aria-hidden":"true",children:_.jsx("span",{style:{width:e.percent===null?"100%":`${e.percent}%`}})})]})}function VM({response:e,compact:t}){const n=e.results.filter(d=>d.status==="failed"),a=e.results.filter(d=>d.status==="uploaded"),o=t?3:6,c=[...n,...a].slice(0,o);return _.jsxs(_.Fragment,{children:[_.jsx("p",{className:"upload-toast-destination",children:e.destinationCwd}),c.length>0?_.jsx("ul",{className:"upload-result-list",children:c.map((d,p)=>_.jsx(XM,{result:d},`${d.relativePath}-${p}`))}):null,e.results.length>c.length?_.jsxs("p",{className:"upload-toast-muted",children:["+",e.results.length-c.length," more"]}):null]})}function XM({result:e}){const t=e.savedRelativePath??e.relativePath,n=e.status==="uploaded"&&e.savedRelativePath!==void 0&&e.savedRelativePath!==e.relativePath;return _.jsxs("li",{"data-status":e.status,children:[_.jsx("span",{className:"upload-result-path",children:t}),n?_.jsx("span",{className:"upload-result-renamed",children:"renamed"}):null,e.status==="failed"&&e.error?_.jsx("span",{className:"upload-result-error",children:e.error}):null]})}function su(e){if(e.status==="queued")return"Preparing upload";if(e.status==="uploading")return`Uploading ${e.fileCount} file${e.fileCount===1?"":"s"}`;if(e.status==="success"){const t=e.response?.uploaded??e.fileCount;return`Uploaded ${t} file${t===1?"":"s"}`}if(e.status==="partial"){const t=e.response?.uploaded??0,n=(e.response?.uploaded??0)+(e.response?.failed??0)||e.fileCount;return`Uploaded ${t} of ${n} files`}return"Upload failed"}function GM(e){return e.some(t=>t.status==="failed")?"failed":e.some(t=>t.status==="partial")?"partial":e.some(t=>t.status==="uploading")?"uploading":e.some(t=>t.status==="queued")?"queued":"success"}function ZM(e){return e<1024?`${e} B`:e<1024*1024?`${Math.round(e/1024)} KB`:`${Math.round(e/(1024*1024))} MB`}function QM({toast:e,onActivate:t,onDismiss:n}){if(!e)return null;const a=e,o=a.commandName?`${a.commandName} finished`:"Command finished";function c(p){p.stopPropagation(),n()}function d(p){p.key!=="Enter"&&p.key!==" "||(p.preventDefault(),t(a))}return _.jsxs("aside",{className:"completion-toast",role:"status","aria-live":"polite",tabIndex:0,onClick:()=>t(a),onKeyDown:d,children:[_.jsx("video",{className:"completion-toast-character",src:a.assetSrc,muted:!0,autoPlay:!0,loop:!0,playsInline:!0,"aria-hidden":"true"}),_.jsxs("div",{className:"completion-toast-copy",children:[_.jsx("strong",{children:a.tabTitle}),_.jsx("span",{children:o})]}),_.jsx("button",{type:"button","aria-label":"Dismiss completion alert",onClick:c,children:"x"})]})}const JM=Xl(0,0,1,1),vn=1e-6;function eA(e){return Tw(e).map(t=>t.terminalId)}function Tw(e){return Vl(e,JM).sort(nA).map((t,n)=>({...t,index:n+1}))}function tA(e,t,n){const a=Tw(e),o=a.find(d=>d.terminalId===t);return o?a.filter(d=>d.terminalId!==t).map(d=>sA(o,d,n)).filter(d=>d!==null).sort(rA)[0]?.entry.terminalId??null:null}function iA(e,t){return!Number.isInteger(t)||t<1?null:eA(e)[t-1]??null}function Vl(e,t){if(e.type==="pane")return[{terminalId:e.terminalId,bounds:t}];if(e.type==="editor")return[];const n=aA(e.ratio);if(e.direction==="vertical"){const o=t.left+(t.right-t.left)*n;return[...Vl(e.first,Xl(t.left,t.top,o,t.bottom)),...Vl(e.second,Xl(o,t.top,t.right,t.bottom))]}const a=t.top+(t.bottom-t.top)*n;return[...Vl(e.first,Xl(t.left,t.top,t.right,a)),...Vl(e.second,Xl(t.left,a,t.right,t.bottom))]}function sA(e,t,n){const a=e.bounds,o=t.bounds,c=cb(a.left,a.right,o.left,o.right),d=cb(a.top,a.bottom,o.top,o.bottom);switch(n){case"left":return o.centerX>=a.centerX-vn||d<=vn?null:{entry:t,primaryDistance:Math.max(0,a.left-o.right),perpendicularDistance:Math.abs(a.centerY-o.centerY),overlap:d};case"right":return o.centerX<=a.centerX+vn||d<=vn?null:{entry:t,primaryDistance:Math.max(0,o.left-a.right),perpendicularDistance:Math.abs(a.centerY-o.centerY),overlap:d};case"up":return o.centerY>=a.centerY-vn||c<=vn?null:{entry:t,primaryDistance:Math.max(0,a.top-o.bottom),perpendicularDistance:Math.abs(a.centerX-o.centerX),overlap:c};case"down":return o.centerY<=a.centerY+vn||c<=vn?null:{entry:t,primaryDistance:Math.max(0,o.top-a.bottom),perpendicularDistance:Math.abs(a.centerX-o.centerX),overlap:c};default:return null}}function nA(e,t){return Ma(e.bounds.top,t.bounds.top)||Ma(e.bounds.left,t.bounds.left)}function rA(e,t){return Ma(e.primaryDistance,t.primaryDistance)||Ma(e.perpendicularDistance,t.perpendicularDistance)||Ma(t.overlap,e.overlap)||Ma(e.entry.index,t.entry.index)}function Ma(e,t){const n=e-t;return Math.abs(n)<=vn?0:n}function cb(e,t,n,a){return Math.max(0,Math.min(t,a)-Math.max(e,n))}function Xl(e,t,n,a){return{left:e,top:t,right:n,bottom:a,centerX:e+(n-e)/2,centerY:t+(a-t)/2}}function aA(e){return Number.isFinite(e)?Math.min(.9,Math.max(.1,e)):.5}class lA extends Error{constructor(t){super(t),this.name="UploadDropError"}}function ub(e){return e?Array.from(e.types??[]).includes("Files")||Mw(e.items).some(n=>n.kind==="file")?!0:Aw(e.files).length>0:!1}async function oA(e){const t=Mw(e.items).filter(n=>n.kind==="file");return t.length>0?cA(t):uA(e.files)}async function cA(e){const t=[];for(const n of e){const a=pA(n);if(a){await kw(a,"",t);continue}const o=n.getAsFile();if(o){t.push({relativePath:Dw(o),file:o});continue}throw new lA("Folder upload is not supported by this browser.")}return t}function uA(e){return Aw(e).map(t=>({relativePath:Dw(t),file:t}))}async function kw(e,t,n){const a=_A(t,e.name);if(e.isFile){const d=await hA(e);n.push({relativePath:a,file:d});return}if(!e.isDirectory)return;const o=e.createReader(),c=await dA(o);for(const d of c)await kw(d,a,n)}function hA(e){return new Promise((t,n)=>{e.file(t,a=>n(a))})}async function dA(e){const t=[];for(;;){const n=await fA(e);if(n.length===0)return t;t.push(...n)}}function fA(e){return new Promise((t,n)=>{e.readEntries(t,a=>n(a))})}function Dw(e){const t=e.webkitRelativePath;return Rw(typeof t=="string"&&t?t:e.name)}function pA(e){const t=e.webkitGetAsEntry?.();return mA(t)?t:null}function mA(e){if(!e||typeof e!="object")return!1;const t=e;return typeof t.name=="string"&&typeof t.isFile=="boolean"&&typeof t.isDirectory=="boolean"}function _A(e,t){return Rw(e?`${e}/${t}`:t)}function Rw(e){return e.replace(/\\/g,"/").replace(/^\/+/,"").split("/").filter(Boolean).join("/")}function Mw(e){return e?Array.from(e):[]}function Aw(e){return e?Array.from(e):[]}const hb="nterminal.terminalWorkspaces.v2",Nw="nterminal.sidebarCollapsed.v1",vA=75,db=Yb.map(e=>e.url),gA=Yb[0].url;function yA({api:e,serverApi:t,activeAgentId:n=null,onSelectServer:a,sessionExpiresAt:o=null,onLogout:c=async()=>{},onSessionInvalid:d}){const p=g.useMemo(()=>e??Eu(),[e]),m=g.useMemo(()=>t??io(null),[t]),f=g.useMemo(()=>NA(n),[n]),S=g.useMemo(()=>T=>Ew(n,T),[n]),y=g.useMemo(()=>()=>Ft(n),[n]),b=g.useSyncExternalStore(S,y,y),x=b.state,C=b.editors,k=!b.loaded,B=b.error,[R,re]=g.useState(!1),[F,J]=g.useState(()=>jA()),[ce,q]=g.useState("servers"),[I,ie]=g.useState(!1),de=g.useSyncExternalStore(a2,Yy,Yy);g.useSyncExternalStore(s0,Wy,Wy);const[j,$]=g.useState(()=>[null]),[H,L]=g.useState(0),[X,Z]=g.useState(()=>[n]),[A,V]=g.useState(()=>new Set),[Q,ve]=g.useState({}),[Se,E]=g.useState(null),W=g.useRef(null);g.useRef(!1);const ee=g.useRef(0),[he,ge]=g.useState(null),me=dx(ky(Hb,{activationConstraint:{distance:8}}),ky(Ub,{activationConstraint:{delay:250,tolerance:5}}));g.useEffect(()=>l2(p),[p]);function Ce(T){const M=T.active.data.current;if(M){if(M.kind==="tab"&&typeof M.tabId=="string"&&typeof M.terminalId=="string"){ge({tabId:M.tabId,terminalId:M.terminalId});return}M.kind==="pane"&&typeof M.sourceTabId=="string"&&typeof M.terminalId=="string"&&ge({tabId:M.sourceTabId,terminalId:M.terminalId})}}function ze(T){ge(null);const M=T.active.data.current,K=T.over?.data.current;if(!(!M||!K||typeof M.terminalId!="string")){if(M.kind==="tab"&&typeof M.tabId=="string"){if(K.kind==="tab-position"&&typeof K.index=="number"){Ge({type:"tab.reordered",sourceTabId:M.tabId,targetIndex:K.index});return}K.kind==="pane-zone"&&typeof K.terminalId=="string"&&(K.side==="top"||K.side==="right"||K.side==="bottom"||K.side==="left")&&Ge({type:"tab.dropped_into_pane",sourceTabId:M.tabId,sourceTerminalId:M.terminalId,targetTerminalId:K.terminalId,side:K.side});return}if(M.kind==="pane"&&typeof M.sourceTabId=="string"){if(K.kind==="tab-position"&&typeof K.index=="number"){Ge({type:"terminal.extracted_to_tab",sourceTabId:M.sourceTabId,sourceTerminalId:M.terminalId,targetIndex:K.index});return}K.kind==="pane-zone"&&typeof K.terminalId=="string"&&(K.side==="top"||K.side==="right"||K.side==="bottom"||K.side==="left")&&Ge({type:"tab.dropped_into_pane",sourceTabId:M.sourceTabId,sourceTerminalId:M.terminalId,targetTerminalId:K.terminalId,side:K.side})}}}function Ne(){ge(null)}const Re=x.workspaces.find(T=>T.id===x.activeWorkspaceId)??x.workspaces[0],Pe=Re?.tabs.find(T=>T.id===Re.activeTabId)??Re?.tabs[0],Ye=Pe?.activeTerminalId??null,Be=Ye?x.terminals[Ye]:void 0,ae=RA("(max-width: 760px)"),Ee=g.useMemo(()=>Pe?wu(Pe.root):[],[Pe]),xe=Re&&Pe?ru(n,Re.id,Pe.id):null,Ke=Pe?Bw(Ee,Pe.activeTerminalId,xe?Q[xe]:void 0):null,Xe=ae&&Ee.length>1,gt=g.useMemo(()=>{const T=new Set;for(const M of x.workspaces)for(const K of M.tabs)for(const ue of Nm(K))T.add(ue);return Object.values(x.terminals).filter(M=>!T.has(M.id))},[x.terminals,x.workspaces]),[yt,mi]=g.useState([]),te=g.useRef([]),je=g.useRef(null),[He,_i]=g.useState(null),[Vi,ai]=g.useState([]),[kt,ji]=g.useState(()=>zr()),Ti=g.useRef(0),Nt=g.useRef(n),$s=g.useRef(db),Hi=g.useRef(kt),qt=g.useRef(()=>{});qt.current=cs;const Jt=g.useCallback(async()=>{try{const T=await p.listNotificationAssets();ai(T.assets.filter(M=>M.enabled).map(M=>M.url))}catch{ai([])}},[p]);g.useEffect(()=>{Z(T=>T.some(M=>mn(M,n))?T:[...T,n])},[n]);const Dt=g.useCallback(T=>{const M=Ft(T),K=io(T);for(const ue of Object.keys(M.state.terminals))Ap(K.createWebSocketUrl(ue)),$S(ue);jM(T),Z(ue=>ue.filter(pe=>!mn(pe,T))),V(ue=>{const pe=`${nu(T)}:`;let ke=!1;const De=new Set;for(const rt of ue){if(rt.startsWith(pe)){ke=!0;continue}De.add(rt)}return ke?De:ue}),ve(ue=>{const pe=`${nu(T)}:`;let ke=!1;const De={};for(const[rt,ut]of Object.entries(ue)){if(rt.startsWith(pe)){ke=!0;continue}De[rt]=ut}return ke?De:ue})},[]);g.useEffect(()=>{let T=!1;return p.listAgents().then(M=>{if(!T){const K=M.agents.map(pe=>pe.id),ue=[null,...K];n!==null&&!K.includes(n)&&(Dt(n),a?.(null)),$(ue)}}).catch(()=>{}),()=>{T=!0}},[n,p,Dt,a,H]);const Cn=g.useCallback(T=>{Dt(T),L(M=>M+1),mn(T,Nt.current)&&a?.(null)},[Dt,a]);g.useEffect(()=>{$(T=>T.some(M=>mn(M,n))?T:[...T,n])},[n]),g.useEffect(()=>{Nt.current=n},[n]),g.useEffect(()=>{Jt()},[Jt]),g.useEffect(()=>Xb(()=>ji(zr())),[]),g.useEffect(()=>{const T=M=>{qt.current(M)};return window.addEventListener("keydown",T,!0),()=>window.removeEventListener("keydown",T,!0)},[]),g.useEffect(()=>{$s.current=Vi.length>0?Vi:db},[Vi]),g.useEffect(()=>{Hi.current=kt},[kt]),g.useEffect(()=>{if(!b.loaded||!Re||!Pe)return;const T=ru(n,Re.id,Pe.id);V(M=>{if(M.has(T))return M;const K=new Set(M);return K.add(T),K})},[n,b.loaded,Re?.id,Pe?.id]),g.useEffect(()=>()=>{Ir()},[]),g.useEffect(()=>AM(T=>{const M=Ft(T.agentId).state,K=M.workspaces.flatMap(De=>De.tabs).find(De=>De.id===T.tabId),ue=M.terminals[T.terminalId],pe=K?.title?.trim()||ue?.title||T.commandName||"terminal",ke=document.visibilityState==="visible"&&mn(T.agentId,Nt.current)&&T.tabId===AA(M);if(ke||zE({tabTitle:pe,commandName:T.commandName,terminalId:T.terminalId}),!ke&&document.visibilityState==="visible"&&Hi.current.enabled){const De=Ti.current+1;Ti.current=De;const rt=$s.current;_i({id:De,agentId:T.agentId,terminalId:T.terminalId,tabId:T.tabId,tabTitle:pe,commandName:T.commandName,assetSrc:rt[Math.floor(Math.random()*rt.length)]??gA})}}),[]),g.useEffect(()=>{if(!He||kt.persistUntilDismissed)return;const T=window.setTimeout(()=>{_i(M=>M?.id===He.id?null:M)},kt.durationSeconds*1e3);return()=>window.clearTimeout(T)},[He,kt]),g.useEffect(()=>{W.current?.focus(),W.current?.select()},[Se?.workspaceId]),g.useEffect(()=>{HA(F),F&&E(null)},[F]),g.useEffect(()=>{let T=!1;async function M(){if(!Ft(n).loaded){Ta(n,!1,null);try{const ue=BA(f),[pe,ke]=await Promise.all([m.listTerminals(),m.getTerminalLayout()]),De=pe.terminals.length>0?pe.terminals:[(await m.createTerminal({cols:80,rows:24})).terminal];if(!T){const rt=ke.layout?Ow(ke.layout):null,ut=rt??ue??{},yi=zp(De,void 0,ut.savedWorkspaces,ut.savedActiveWorkspaceId),Fr=Cf(yi);rb(n,yi),Xc(n,ke.revision,JSON.stringify(Fr)),Ta(n,!0,null),!rt&&ue&&Ui(Fr,{baseRevision:ke.revision})}}catch(ue){!T&&!bt(ue)&&Ta(n,!0,Kl(ue))}}}return M(),()=>{T=!0}},[n,m]);async function Bs(){await Wt(async()=>{const T=await m.createTerminal({cols:80,rows:24});Ge({type:"terminal.created",terminal:T.terminal})})}async function Vs(T){await Wt(async()=>{const M=Ye?{parentTerminalId:Ye,cols:80,rows:24}:{cols:80,rows:24},K=await m.createTerminal(M);Ge({type:"terminal.split",terminal:K.terminal,direction:T})})}async function Ts(T){if(!Ye)throw new Error("No active pane is available.");const M=await m.readFile(T),K=`editor-${Date.now().toString(36)}-${zM(n)}`,ue=zA(M.path);ab(n,pe=>({...pe,[K]:{id:K,title:ue,rootToken:T.rootToken,path:M.path,read:M}})),xe&&ve(pe=>({...pe,[xe]:Lw(K)})),Ge({type:"editor.split",editorId:K,title:ue,direction:"vertical"})}function ks(T){ab(n,M=>{const K={...M};return delete K[T],K}),Ge({type:"editor.closed",editorId:T})}function ot(T){St([T])}function St(T){for(const M of T)Ge({type:"terminal.detached",terminalId:M})}async function Rt(T){await Wt(async()=>{await Bt(T),Ap(m.createWebSocketUrl(T)),$S(T),Ge({type:"terminal.closed",terminalId:T})})}async function li(T,M){const K=M.trim();if(!K)return;let ue=null;for(const pe of x.workspaces){const ke=pe.tabs.find(De=>De.id===T);if(ke){ue=ke.activeTerminalId;break}}if(Ge({type:"tab.renamed",tabId:T,title:K}),!!ue)try{const pe=await m.renameTerminal(ue,K);ct({type:"terminal.updated",terminal:pe.terminal})}catch(pe){Ta(n,!0,Kl(pe))}}function ei(T){const M=x.terminals[T];M&&Ge({type:"terminal.created",terminal:M})}async function Bt(T){try{await m.closeTerminal(T)}catch(M){if(M instanceof yn&&M.status===404)return;throw M}}async function nt(){await Wt(async()=>{await c()})}async function Wt(T){Ta(n,!0,null);try{await T()}catch(M){if(bt(M))return;Ta(n,!0,Kl(M))}}function bt(T){return T instanceof yn&&T.status===401&&!m.isAgent&&d?(d(),!0):!1}function Ge(T){Ul(n,T);const M=Ft(n),K=M.state;if(!M.loaded||K.workspaces.length===0)return;const ue=Cf(K);JSON.stringify(ue)!==M.lastPersistedLayoutJson&&Qi(ue)}function ct(T){Ul(n,T)}function vi(T,M,K,ue){const pe=ru(T,M,K);ve(ke=>({...ke,[pe]:ue}))}function Ai(T){xe&&ve(M=>({...M,[xe]:T}))}function Ni(T,M){const K=Cu(T);M?vi(n,M.workspaceId,M.tabId,K):Ai(K),Ge({type:"pane.selected",terminalId:T})}function ki(T){Ai(T.key),T.type==="terminal"&&Ge({type:"pane.selected",terminalId:T.terminalId})}function cs(T){if(I||T.isComposing||T.key==="Process"||EA(T.target))return;const M=bA(T);if(!M)return;if(T.preventDefault(),T.stopPropagation(),M.type==="server.previous"||M.type==="server.next"){gi(M.type==="server.next"?1:-1);return}const K=Ft(n).state,ue=K.workspaces.find(De=>De.id===K.activeWorkspaceId)??K.workspaces[0],pe=ue?.tabs.find(De=>De.id===ue.activeTabId)??ue?.tabs[0];if(M.type==="split"){if(!pe)return;Vs(M.direction);return}if(!ue||!pe)return;if(M.type==="tab.previous"||M.type==="tab.next"){const De=xA(ue.tabs,pe.id,M.type==="tab.next"?1:-1);De&&Ge({type:"tab.selected",tabId:De.id});return}if(M.type==="tab.index"){const De=ue.tabs[M.index-1];De&&Ge({type:"tab.selected",tabId:De.id});return}const ke=wA(pe.root,pe.activeTerminalId,M);ke&&Ni(ke,{workspaceId:ue.id,tabId:pe.id})}function gi(T){if(!a||j.length===0)return;const M=j.findIndex(ke=>mn(ke,n)),ue=((M===-1?0:M)+T+j.length)%j.length,pe=j[ue]??null;mn(pe,n)||a(pe)}function mt(T){ub(T.dataTransfer)&&(T.preventDefault(),T.dataTransfer.dropEffect="copy")}function Yt(T){if(!ub(T.dataTransfer))return;T.preventDefault();const M=LA(Ft(n).state),K=ee.current+1;if(ee.current=K,!M){hr({id:K,status:"failed",fileCount:0,message:"No active running terminal is available for upload."});return}hr({id:K,status:"queued",fileCount:0,terminalId:M.id,message:"Preparing upload..."}),us(K,M.id,T.dataTransfer)}async function us(T,M,K){try{const ue=await oA(K);if(ue.length===0)throw new Error("No files were found in the drop.");Xi(T,{id:T,status:"queued",fileCount:ue.length,message:"Queued"},{terminalId:M,files:ue})}catch(ue){Xi(T,{id:T,status:"failed",fileCount:0,message:Kl(ue)},{terminalId:M})}finally{xn()}}async function Xs(T){const M=te.current.find(ke=>ke.id===T);if(!M?.terminalId||!M.files||M.files.length===0)return;const K=M.terminalId,ue=M.files,pe=new AbortController;je.current=T,Xi(T,{id:T,status:"uploading",fileCount:ue.length,loaded:0,total:null,percent:null},{terminalId:K,files:ue,abortController:pe});try{const ke=await g2({terminalId:K,files:ue,signal:pe.signal,onProgress:yi=>{Xi(T,{id:T,status:"uploading",fileCount:ue.length,loaded:yi.loaded,total:yi.total,percent:yi.percent},{terminalId:K,files:ue,abortController:pe})}}),De=ke.failed>0?ke.uploaded>0?"partial":"failed":"success",rt=ke.failed>0?OA(ke):void 0,ut={id:T,status:De,fileCount:ue.length,response:ke};rt&&(ut.message=rt),Xi(T,ut,{terminalId:K,files:ue})}catch(ke){Xi(T,{id:T,status:"failed",fileCount:ue.length,message:pe.signal.aborted?"Upload canceled.":Kl(ke)},{terminalId:K,files:ue})}finally{je.current===T&&(je.current=null),xn()}}function xn(){if(je.current!==null)return;const T=te.current.find(M=>M.status==="queued");T?.terminalId&&T.files&&T.files.length>0&&Xs(T.id)}function hr(T){Gi(M=>[...M,T])}function Xi(T,M,K={}){Gi(ue=>ue.map(pe=>{if(pe.id!==T)return pe;const ke={...M},De=K.terminalId??pe.terminalId,rt=K.files??pe.files;return De!==void 0&&(ke.terminalId=De),rt!==void 0&&(ke.files=rt),K.abortController!==void 0&&(ke.abortController=K.abortController),ke}))}function Gi(T){const M=T(te.current);te.current=M,mi(M)}function En(T){te.current.find(K=>K.id===T)?.abortController?.abort(),je.current===T&&(je.current=null),Gi(K=>K.filter(ue=>ue.id!==T)),xn()}function Ls(){for(const T of te.current)T.abortController?.abort();je.current=null,Gi(()=>[])}function Os(T){const M=te.current.find(K=>K.id===T);if(M){if(M.status==="queued"){En(T);return}M.abortController?.abort()}}function Ds(T){const M=te.current.find(ue=>ue.id===T);if(!M?.terminalId||!M.files||M.files.length===0)return;const K=Zi(M);if(K.length===0){Xi(T,{id:T,status:"failed",fileCount:M.fileCount,message:"No failed files are available to retry."},{terminalId:M.terminalId,files:M.files});return}Xi(T,{id:T,status:"queued",fileCount:K.length,message:"Queued"},{terminalId:M.terminalId,files:K}),xn()}function Zi(T){const M=T.files??[],K="response"in T?T.response:void 0;if(!K)return M;const ue=K.results.filter(De=>De.status==="failed").map(De=>De.relativePath);if(ue.length===0)return[];const pe=new Map;for(const De of M){const rt=pe.get(De.relativePath)??[];rt.push(De),pe.set(De.relativePath,rt)}const ke=[];for(const De of ue){const ut=pe.get(De)?.shift();ut&&ke.push(ut)}return ke}function Lt(T){const K=Ft(T.agentId).state.workspaces.find(ue=>ue.tabs.some(pe=>pe.id===T.tabId));K&&vi(T.agentId,K.id,T.tabId,Cu(T.terminalId)),Ul(T.agentId,{type:"pane.selected",terminalId:T.terminalId}),OM(T.agentId,T.tabId),mn(T.agentId,n)||a?.(T.agentId),_i(null)}function Qi(T){const M=Ft(n).mutable.saveCoord;M.pendingLayoutSave=T,Pl(T,f),M.saveTimer!==null&&window.clearTimeout(M.saveTimer),M.saveTimer=window.setTimeout(()=>{M.saveTimer=null;const K=M.pendingLayoutSave;M.pendingLayoutSave=null,K&&Ui(K)},vA)}function Ir(){const T=Ft(n).mutable.saveCoord;T.saveTimer!==null&&(window.clearTimeout(T.saveTimer),T.saveTimer=null);const M=T.pendingLayoutSave;T.pendingLayoutSave=null,M&&(Pl(M,f),Ui(M))}function Ui(T,M={}){const K=Ft(n).mutable.saveCoord;K.nextPersistLayout=T,M.baseRevision!==void 0&&(K.queuedBaseRevision=M.baseRevision),!K.nextPersistQueued&&(K.nextPersistQueued=!0,K.persistChain=K.persistChain.then(async()=>{K.nextPersistQueued=!1;const ue=K.nextPersistLayout,pe=K.queuedBaseRevision;K.nextPersistLayout=null,K.queuedBaseRevision=void 0,ue&&await zs(ue,pe!==void 0?{baseRevision:pe}:{})}))}async function zs(T,M={}){const K=Ft(n),ue=M.baseRevision??K.layoutRevision,pe={layout:T,...typeof ue=="number"?{baseRevision:ue}:{}};try{const ke=await m.saveTerminalLayout(pe),De=ke.layout??T;Xc(n,ke.revision,JSON.stringify(De)),Pl(De,f);return}catch(ke){if(ke instanceof yn&&ke.status===409)try{const De=await m.getTerminalLayout();if(De.layout){const rt=Ft(n).state,ut=zp(Object.values(rt.terminals),void 0,De.layout.workspaces,De.layout.activeWorkspaceId),yi=Cf(ut);rb(n,ut),Xc(n,De.revision,JSON.stringify(yi)),Pl(yi,f)}else Xc(n,De.revision,K.lastPersistedLayoutJson);return}catch{}Pl(T,f)}}const O=UA(o),fe=!F||R,Oe=fe?ce:"servers";return _.jsx(dE,{sensors:me,onDragStart:Ce,onDragEnd:ze,onDragCancel:Ne,children:_.jsxs("main",{className:"terminal-shell","data-collapsed":F,"data-sidebar-open":R,onDragOver:mt,onDrop:Yt,children:[_.jsx("button",{type:"button",className:"workspace-backdrop","aria-label":"Close workspaces",onClick:()=>re(!1)}),_.jsxs("aside",{className:"workspace-sidebar",children:[_.jsxs("header",{className:"workspace-brand",children:[fe?_.jsx(Cb,{height:20}):_.jsx(wb,{size:24}),_.jsx("button",{type:"button",className:"sidebar-collapse-button","aria-label":F?"Expand sidebar":"Collapse sidebar",title:F?"Expand sidebar":"Collapse sidebar",onClick:()=>J(T=>!T),children:F?">":"<"}),_.jsx("button",{type:"button",className:"sidebar-drawer-close-button","aria-label":"Close workspaces",title:"Close workspaces",onClick:()=>re(!1),children:"x"})]}),_.jsxs("div",{className:"workspace-sidebar-content",children:[fe?_.jsxs("div",{className:"workspace-sidebar-tabs",role:"tablist","aria-label":"Sidebar mode",children:[_.jsx("button",{type:"button",role:"tab","aria-selected":ce==="servers",onClick:()=>{q("servers"),E(null)},children:"Servers"}),_.jsx("button",{type:"button",role:"tab","aria-selected":ce==="files",onClick:()=>{q("files"),E(null)},children:"Files"})]}):null,Oe==="servers"&&fe?_.jsx("nav",{className:"workspace-nav","aria-label":"Servers",children:_.jsx(ef,{api:p,activeAgentId:n,onSelectServer:a??(()=>{}),onSessionInvalid:d,refreshToken:H})}):null,fe?null:_.jsx("nav",{className:"workspace-nav workspace-nav--collapsed","aria-label":"Servers",children:_.jsx(ef,{api:p,activeAgentId:n,onSelectServer:a??(()=>{}),onSessionInvalid:d,refreshToken:H,compact:!0})}),Oe==="files"?_.jsxs(_.Fragment,{children:[fe?_.jsx("nav",{className:"workspace-nav workspace-nav--compact","aria-label":"Servers",children:_.jsx(ef,{api:p,activeAgentId:n,onSelectServer:a??(()=>{}),onSessionInvalid:d,refreshToken:H})}):null,_.jsx(C2,{api:m,activeTerminalId:Ye,activeTerminalCwd:Be?.cwd??null,onOpenFile:Ts})]}):null]}),fe?_.jsxs("div",{className:"workspace-sidebar-footer",children:[_.jsx("span",{children:O}),_.jsxs("div",{className:"workspace-sidebar-footer-actions",children:[_.jsxs("button",{type:"button",className:"workspace-footer-icon-button","aria-label":"settings",title:"Settings",onClick:()=>ie(!0),children:[_.jsx(pb,{name:"settings"}),de.hasUpdates?_.jsx("span",{className:"update-pulse-dot","aria-hidden":"true"}):null]}),_.jsx("button",{type:"button",className:"workspace-footer-icon-button","aria-label":"logout",title:"Logout",onClick:()=>{nt()},children:_.jsx(pb,{name:"logout"})})]})]}):null]}),I?_.jsx(_2,{api:p,onClose:()=>ie(!1),updateAvailable:de.hasUpdates,onNotificationAssetsChanged:()=>{Jt()},onAgentRemoved:Cn}):null,_.jsxs("section",{className:"terminal-main","aria-label":"Terminal workspace","data-mobile-pane-switcher":Xe?"true":void 0,children:[_.jsx(KM,{tabs:Re?.tabs??[],activeTabId:Re?.activeTabId??null,terminals:x.terminals,unreadCompletionTabIds:b.unreadCompletions,detachedTerminals:gt,onSelectTab:T=>Ge({type:"tab.selected",tabId:T}),onCreateTab:()=>{Bs()},onToggleWorkspaces:()=>re(T=>!T),onCloseTerminals:T=>St(T),onReattachTerminal:T=>ei(T),onDeleteTerminal:T=>{Rt(T)},onSplitVertical:()=>{Vs("vertical")},onSplitHorizontal:()=>{Vs("horizontal")},onRenameTab:(T,M)=>{li(T,M)},activePaneAvailable:!!Ye}),Xe?_.jsx(kA,{targets:Ee,activeLeafKey:Ke,terminals:x.terminals,editors:C,onSelect:ki}):null,B?_.jsx("div",{className:"workspace-error",children:B}):null,_.jsxs("section",{className:"workspace-body","aria-busy":k,children:[k?_.jsx("div",{className:"workspace-placeholder",children:"Opening shell..."}):null,!k&&!Pe?_.jsx(TA,{onCreate:()=>{Bs()}}):null,X.map(T=>{const M=mn(T,n);return _.jsx(SA,{agentId:T,active:M,activeServerApi:M?m:void 0,visitedTabKeys:A,refreshCwdOnEnter:M&&Oe==="files",draggingTab:M?he:null,mobileSplitFocus:ae,mobileFocusedLeafByTabKey:Q,onSelect:K=>{M&&Ni(K)},onClose:K=>{M&&ot(K)},onCloseEditor:K=>{M&&ks(K)},onResize:(K,ue)=>{M&&Ge({type:"pane.resized",path:K,ratio:ue})},onExit:(K,ue)=>{M?ct({type:"terminal.exited",terminalId:K,exitCode:ue}):Ul(T,{type:"terminal.exited",terminalId:K,exitCode:ue})},onSnapshot:(K,ue)=>{const pe={type:"terminal.updated",terminal:K,notifyCompletion:ue?.notifyCompletion===!0};M?ct(pe):Ul(T,pe)},...T===null&&d?{onAuthClose:d}:{}},nu(T))})]}),_.jsx(QM,{toast:He,onActivate:Lt,onDismiss:()=>_i(null)}),_.jsx(WM,{uploads:yt,onDismiss:En,onDismissAll:Ls,onRetry:Ds,onCancel:Os})]})]})})}function SA({agentId:e,active:t,activeServerApi:n,visitedTabKeys:a,refreshCwdOnEnter:o,draggingTab:c,mobileSplitFocus:d,mobileFocusedLeafByTabKey:p,onSelect:m,onClose:f,onCloseEditor:S,onResize:y,onExit:b,onSnapshot:x,onAuthClose:C}){const k=g.useMemo(()=>de=>Ew(e,de),[e]),B=g.useMemo(()=>()=>Ft(e),[e]),R=g.useSyncExternalStore(k,B,B),re=g.useMemo(()=>io(e),[e]),F=n??re,J=R.state,ce=J.workspaces.find(de=>de.id===J.activeWorkspaceId)??J.workspaces[0],q=ce?.id??null,ie=(ce?.tabs.find(de=>de.id===ce.activeTabId)??ce?.tabs[0])?.id??null;return!R.loaded||J.workspaces.length===0?null:_.jsx("div",{className:"workspace-server-surface","data-active":t,"aria-hidden":!t,children:J.workspaces.flatMap(de=>de.tabs.map(j=>{const $=t&&de.id===q&&j.id===ie,H=ru(e,de.id,j.id),L=wu(j.root),X=d&&L.length>1?Bw(L,j.activeTerminalId,p[H]):null;return!$&&!a.has(H)?null:_.jsx("div",{className:"workspace-tab-surface","data-active":$,"aria-hidden":!$,children:_.jsx(Bp,{node:j.root,terminals:J.terminals,editors:R.editors,api:F,activeTerminalId:j.activeTerminalId,visible:$,refreshCwdOnEnter:$&&o,tabId:j.id,dropZoneActive:$&&c!==null,draggingTerminalId:$?c?.terminalId??null:null,mobileFocusLeafKey:X,onSelect:m,onClose:f,onCloseEditor:S,onResize:y,onExit:b,onSnapshot:x,...C?{onAuthClose:C}:{}})},`${de.id}:${j.id}`)}))})}function bA(e){const t=WE(e);if(t)switch(t.id){case"server.previous":case"server.next":case"tab.previous":case"tab.next":return{type:t.id};case"tab.index":case"pane.index":return t.index===null?null:{type:t.id,index:t.index};case"split.right":return{type:"split",direction:"vertical"};case"split.down":return{type:"split",direction:"horizontal"};default:return null}if(e.ctrlKey&&e.altKey&&!e.metaKey&&!e.shiftKey){const n=CA(e.key);return n?{type:"pane.direction",direction:n}:null}return null}function wA(e,t,n){switch(n.type){case"pane.direction":return tA(e,t,n.direction);case"pane.index":return iA(e,n.index);default:return null}}function CA(e){switch(e){case"ArrowLeft":return"left";case"ArrowRight":return"right";case"ArrowUp":return"up";case"ArrowDown":return"down";default:return null}}function xA(e,t,n){if(e.length===0)return null;const a=e.findIndex(c=>c.id===t);return e[((a===-1?0:a)+n+e.length)%e.length]??null}function wu(e){return e.type==="pane"?[{key:Cu(e.terminalId),type:"terminal",terminalId:e.terminalId}]:e.type==="editor"?[{key:Lw(e.editorId),type:"editor",editorId:e.editorId,title:e.title}]:[...wu(e.first),...wu(e.second)]}function Bw(e,t,n){if(n&&e.some(o=>o.key===n))return n;const a=t?Cu(t):null;return a&&e.some(o=>o.key===a)?a:e[0]?.key??null}function Cu(e){return`terminal:${e}`}function Lw(e){return`editor:${e}`}function EA(e){if(!(e instanceof HTMLElement)||e.closest(".xterm"))return!1;if(e.closest('input, textarea, select, [role="textbox"]'))return!0;const t=e.closest("[contenteditable]");return t instanceof HTMLElement&&t.getAttribute("contenteditable")?.toLowerCase()!=="false"}function TA({onCreate:e}){return _.jsxs("div",{className:"empty-workspace",children:[_.jsx("span",{children:"No terminal is open."}),_.jsx("button",{type:"button",onClick:e,children:"New tab"})]})}function kA({targets:e,activeLeafKey:t,terminals:n,editors:a,onSelect:o}){const[c,d]=g.useState(!1);if(e.length<=1)return null;const p=t?e.findIndex(b=>b.key===t):-1,m=p>=0?p:0,f=e[m]??e[0],S=fb(f,n,a);function y(b){const x=(m+b+e.length)%e.length,C=e[x];C&&o(C)}return _.jsxs("div",{className:"mobile-pane-switcher",role:"group","aria-label":"Pane switcher",children:[_.jsx("button",{type:"button","aria-label":"Previous pane",onClick:()=>y(-1),children:"<"}),_.jsxs("button",{type:"button",className:"mobile-pane-current","aria-label":"Open pane switcher","aria-haspopup":"dialog","aria-expanded":c,title:S,onClick:()=>d(!0),children:["Pane ",m+1,"/",e.length," | ",S]}),_.jsx("button",{type:"button","aria-label":"Next pane",onClick:()=>y(1),children:">"}),c?_.jsx("div",{className:"mobile-pane-sheet-backdrop",onClick:()=>d(!1),children:_.jsxs("section",{className:"mobile-pane-sheet",role:"dialog","aria-modal":"true","aria-label":"Pane switcher",onClick:b=>b.stopPropagation(),children:[_.jsxs("header",{children:[_.jsx("strong",{children:"Panes"}),_.jsx("button",{type:"button","aria-label":"Close pane switcher",onClick:()=>d(!1),children:"x"})]}),_.jsx("div",{className:"mobile-pane-sheet-list",children:e.map((b,x)=>{const C=fb(b,n,a),k=DA(b,n,a),B=b.key===f.key;return _.jsxs("button",{type:"button","data-active":B,onClick:()=>{o(b),d(!1)},children:[_.jsx("span",{className:"mobile-pane-sheet-index",children:x+1}),_.jsxs("span",{className:"mobile-pane-sheet-copy",children:[_.jsx("strong",{children:C}),_.jsx("small",{children:k})]}),_.jsx("span",{className:"mobile-pane-sheet-type",children:b.type})]},b.key)})})]})}):null]})}function fb(e,t,n){if(e.type==="editor")return n[e.editorId]?.title||e.title||e.editorId;const a=t[e.terminalId];return a?.title||a?.cwd||e.terminalId}function DA(e,t,n){if(e.type==="editor"){const c=n[e.editorId];return c?.path?`editor | ${c.path}`:"editor"}const a=t[e.terminalId];return a?`${a.activity==="busy"?`busy${a.currentCommand?`: ${a.currentCommand}`:""}`:a.activity==="idle"?"idle":a.status} | ${a.cwd}`:"terminal"}function RA(e){const[t,n]=g.useState(()=>MA(e));return g.useEffect(()=>{if(typeof window>"u"||typeof window.matchMedia!="function"){n(!1);return}const a=window.matchMedia(e),o=()=>n(a.matches);return o(),typeof a.addEventListener=="function"?(a.addEventListener("change",o),()=>a.removeEventListener("change",o)):(a.addListener(o),()=>a.removeListener(o))},[e]),t}function MA(e){return typeof window>"u"||typeof window.matchMedia!="function"?!1:window.matchMedia(e).matches}function mn(e,t){return e===t}function AA(e){const t=e.workspaces.find(a=>a.id===e.activeWorkspaceId)??e.workspaces[0];return(t?.tabs.find(a=>a.id===t.activeTabId)??t?.tabs[0])?.id??null}function nu(e){return e??"__local__"}function ru(e,t,n){return`${nu(e)}:${t}:${n}`}function NA(e){return e?{workspaceKey:`${hb}:${e}`}:{workspaceKey:hb}}function BA(e){const t=localStorage.getItem(e.workspaceKey);if(!t)return null;try{const n=JSON.parse(t),a=Wb(n);return a?Ow(a):null}catch{return null}}function Ow(e){const t=Wb(e);return t?{savedWorkspaces:t.workspaces,savedActiveWorkspaceId:t.activeWorkspaceId}:null}function Pl(e,t){if(e.workspaces.length>0){localStorage.setItem(t.workspaceKey,JSON.stringify(e));return}localStorage.removeItem(t.workspaceKey)}function LA(e){const t=e.workspaces.find(o=>o.id===e.activeWorkspaceId)??e.workspaces[0],n=t?.tabs.find(o=>o.id===t.activeTabId)??t?.tabs[0],a=n?e.terminals[n.activeTerminalId]:void 0;return a?.status==="running"?a:null}function OA(e){return e.results.find(t=>t.status==="failed"&&t.error)?.error}function zA(e){return e.split("/").filter(Boolean).pop()??e}function jA(){try{return localStorage.getItem(Nw)==="true"}catch{return!1}}function HA(e){try{localStorage.setItem(Nw,e?"true":"false")}catch{}}function UA(e){if(!e)return"session · local";const t=Date.parse(e);if(!Number.isFinite(t))return"session · local";const n=t-Date.now();if(n<=0)return"session · expired";const a=Math.max(1,Math.floor(n/6e4));return a<60?`session · ${a}m left`:`session · ${Math.floor(a/60)}h left`}function pb({name:e}){return _.jsxs("svg",{className:"workspace-footer-icon",viewBox:"0 0 24 24","aria-hidden":"true",focusable:"false",children:[e==="settings"?_.jsxs(_.Fragment,{children:[_.jsx("path",{d:"M4 7h9"}),_.jsx("path",{d:"M17 7h3"}),_.jsx("circle",{cx:"15",cy:"7",r:"2"}),_.jsx("path",{d:"M4 12h3"}),_.jsx("path",{d:"M11 12h9"}),_.jsx("circle",{cx:"9",cy:"12",r:"2"}),_.jsx("path",{d:"M4 17h9"}),_.jsx("path",{d:"M17 17h3"}),_.jsx("circle",{cx:"15",cy:"17",r:"2"})]}):null,e==="logout"?_.jsxs(_.Fragment,{children:[_.jsx("path",{d:"M10 6H6v12h4"}),_.jsx("path",{d:"M13 8l4 4-4 4"}),_.jsx("path",{d:"M8 12h9"})]}):null]})}function Kl(e){return e instanceof Error?e.message:"Request failed"}function PA({api:e,onDone:t}){const[n,a]=g.useState(null),[o,c]=g.useState(null),[d,p]=g.useState(""),[m,f]=g.useState(!1),[S,y]=g.useState(null),[b,x]=g.useState(null);g.useEffect(()=>{let k=!1;return e.setupTotp().then(B=>{k||(a(B.qrDataUrl),c(B.secret))}).catch(B=>{k||x(B instanceof Error?B.message:"Failed to generate QR code")}),()=>{k=!0}},[e]);async function C(k){if(k.preventDefault(),!!o){f(!0),y(null);try{await e.activateTotp({secret:o,otp:d}),t()}catch(B){y(B instanceof Error?B.message:"Verification failed")}finally{f(!1)}}}return b?_.jsx("p",{className:"form-error",children:b}):!n||!o?_.jsx("p",{className:"muted",children:"Generating authenticator setup..."}):_.jsxs("div",{className:"totp-setup",children:[_.jsx("p",{className:"totp-setup-instructions",children:"Scan this QR code with an authenticator app (Google Authenticator, Authy, 1Password, etc.), then enter the 6-digit code to confirm."}),_.jsx("div",{className:"totp-qr-container",children:_.jsx("img",{src:n,alt:"TOTP QR code",width:192,height:192})}),_.jsxs("details",{className:"totp-secret-details",children:[_.jsx("summary",{children:"Can't scan? Enter manually"}),_.jsx("p",{className:"totp-secret-text",children:o})]}),_.jsxs("form",{className:"auth-form",onSubmit:C,children:[_.jsxs("label",{children:["Verification code",_.jsx("input",{autoFocus:!0,type:"text",inputMode:"numeric",pattern:"[0-9]{6}",maxLength:6,value:d,onChange:k=>p(k.currentTarget.value.replace(/\D/g,"")),placeholder:"000000",required:!0})]}),S?_.jsx("p",{className:"form-error",children:S}):null,_.jsx("button",{type:"submit",disabled:m||d.length!==6,children:"Activate 2FA"})]})]})}function KA({api:e,serverApi:t,activeAgentId:n=null,onSelectServer:a}){const o=g.useMemo(()=>e??Eu(),[e]),c=g.useMemo(()=>t??io(null),[t]),[d,p]=g.useState(null),[m,f]=g.useState(null);g.useEffect(()=>{let C=!1;return o.getSession().then(k=>{C||(p(k),f(null))}).catch(k=>{C||(f(go(k)),p(null))}),()=>{C=!0}},[o]);const S=WA(d);async function y(){const C=await o.getSession();p(C),f(null)}async function b(){ZS(),lb(),iR(),f(null),p(null);try{await y()}catch(C){f(go(C))}}if(S==="workspace")return _.jsx(yA,{api:o,serverApi:c,activeAgentId:n,onSelectServer:a,sessionExpiresAt:d?.expiresAt??null,onSessionInvalid:()=>{b()},onLogout:async()=>{ZS(),lb();const C=await o.logout();p(C)}});const x={loading:"Terminal",setup_password:"Set password",setup_totp:"Set up 2FA",login:"Unlock terminal",reauth:"Verify it’s you",workspace:"Terminal"};return _.jsxs("main",{className:"auth-screen",children:[_.jsxs("div",{className:"auth-background","aria-hidden":"true",children:[_.jsx("div",{className:"auth-grid"}),_.jsx("div",{className:"auth-glow"})]}),_.jsxs("section",{className:"auth-panel","aria-busy":S==="loading",children:[_.jsxs("header",{className:"auth-header",children:[_.jsxs("div",{className:"auth-brand",children:[_.jsx(wb,{size:26}),_.jsxs("div",{children:[_.jsx(Cb,{height:17}),_.jsx("p",{className:"auth-host",children:"local terminal"})]})]}),_.jsx("h1",{children:x[S]})]}),m?_.jsx("p",{className:"form-error",children:m}):null,S==="loading"?_.jsx("p",{className:"muted",children:"Checking session..."}):null,S==="loading"&&m?_.jsx("button",{type:"button",className:"secondary-button",onClick:()=>{b()},children:"Retry"}):null,S==="setup_password"?_.jsx(IA,{api:o,onSession:C=>{p(C)}}):null,S==="setup_totp"?_.jsx(PA,{api:o,onDone:()=>{y()}}):null,S==="login"?_.jsx(FA,{api:o,session:d,onSession:p,onRefresh:y}):null,S==="reauth"?_.jsx(qA,{api:o,session:d,onSession:p,onFullLogin:()=>p(C=>C&&{...C,deviceTrusted:!1})}):null]})]})}function IA({api:e,onSession:t}){const[n,a]=g.useState(""),[o,c]=g.useState(""),[d,p]=g.useState(!1),[m,f]=g.useState(null);async function S(y){y.preventDefault(),p(!0),f(null);try{if(n!==o){f("Passwords do not match");return}t(await e.setupPassword({password:n}))}catch(b){f(go(b))}finally{p(!1)}}return _.jsxs("form",{className:"auth-form",onSubmit:S,children:[_.jsxs("label",{children:["Password",_.jsx("input",{autoFocus:!0,value:n,onChange:y=>a(y.currentTarget.value),type:"password",minLength:8,required:!0})]}),_.jsxs("label",{children:["Confirm password",_.jsx("input",{value:o,onChange:y=>c(y.currentTarget.value),type:"password",minLength:8,required:!0})]}),m?_.jsx("p",{className:"form-error",children:m}):null,_.jsx("button",{type:"submit",disabled:d||n.length<8||o.length<8,children:"Set password"})]})}function FA({api:e,session:t,onSession:n,onRefresh:a}){const[o,c]=g.useState(""),[d,p]=g.useState(""),[m,f]=g.useState(!1),[S,y]=g.useState(!1),[b,x]=g.useState(null),C=t?.totpEnabled??!1,k=t?.currentIpWhitelisted??!1;async function B(R){R.preventDefault(),y(!0),x(null);try{n(await e.login({password:o,...C?{otp:d}:{},rememberNetwork:m}))}catch(re){x(go(re))}finally{y(!1)}}return _.jsxs("form",{className:"auth-form",onSubmit:B,children:[_.jsxs("label",{children:["Password",_.jsx("input",{autoFocus:!0,type:"password",value:o,onChange:R=>c(R.currentTarget.value),required:!0})]}),C?_.jsxs("label",{children:["Authenticator code",_.jsx("input",{type:"text",inputMode:"numeric",pattern:"[0-9]{6}",maxLength:6,value:d,onChange:R=>p(R.currentTarget.value.replace(/\D/g,"")),placeholder:"000000",required:!0})]}):null,k?null:_.jsxs("label",{className:"auth-checkbox",children:[_.jsx("input",{type:"checkbox",checked:m,onChange:R=>f(R.currentTarget.checked)}),"Remember this network (skip 2FA here next time)"]}),b?_.jsx("p",{className:"form-error",children:b}):null,_.jsxs("div",{className:"button-row",children:[_.jsx("button",{type:"submit",disabled:S||o.length===0||C&&d.length!==6,children:"Unlock"}),_.jsx("button",{type:"button",className:"secondary-button",onClick:()=>{a()},disabled:S,children:"Refresh"})]})]})}function qA({api:e,session:t,onSession:n,onFullLogin:a}){const o=t?.currentIpWhitelisted??!1,[c,d]=g.useState(""),[p,m]=g.useState(!1),[f,S]=g.useState(!1),[y,b]=g.useState(null),x=xi.useRef(!1),C=xi.useCallback(async(B,R)=>{S(!0),b(null);try{n(await e.reauth({...B?{otp:B}:{},rememberNetwork:R}))}catch(re){b(go(re))}finally{S(!1)}},[e,n]);g.useEffect(()=>{o&&!x.current&&(x.current=!0,C(void 0,!1))},[o,C]);async function k(B){B.preventDefault(),await C(c,p)}return o&&!y?_.jsx("p",{className:"muted",children:"Reconnecting from a trusted network…"}):_.jsxs("form",{className:"auth-form",onSubmit:k,children:[_.jsx("p",{className:"muted",children:"This device is remembered. Enter your authenticator code to continue."}),_.jsxs("label",{children:["Authenticator code",_.jsx("input",{autoFocus:!0,type:"text",inputMode:"numeric",pattern:"[0-9]{6}",maxLength:6,value:c,onChange:B=>d(B.currentTarget.value.replace(/\D/g,"")),placeholder:"000000",required:!0})]}),_.jsxs("label",{className:"auth-checkbox",children:[_.jsx("input",{type:"checkbox",checked:p,onChange:B=>m(B.currentTarget.checked)}),"Remember this network (skip 2FA here next time)"]}),y?_.jsx("p",{className:"form-error",children:y}):null,_.jsxs("div",{className:"button-row",children:[_.jsx("button",{type:"submit",disabled:f||c.length!==6,children:"Continue"}),_.jsx("button",{type:"button",className:"secondary-button",onClick:a,disabled:f,children:"Use password instead"})]})]})}function WA(e){return e?e.passwordSet?e.authenticated&&!e.totpEnabled?"setup_totp":e.authenticated?"workspace":e.deviceTrusted&&e.totpEnabled?"reauth":"login":"setup_password":"loading"}function go(e){return e instanceof Error?e.message:"Request failed"}const mb="NTerminal",Wp="nterminal.activeAgentId";function YA(){const[e,t]=g.useState(()=>$A()),n=g.useMemo(()=>Eu(),[]),a=g.useMemo(()=>io(e),[e]);g.useEffect(()=>{const c=()=>{const d=LM();document.title=d>0?`(${d}) ${mb}`:mb};return c(),BM(c)},[]);function o(c){VA(c),t(c)}return _.jsx(KA,{api:n,activeAgentId:e,serverApi:a,onSelectServer:o})}function $A(){if(typeof window>"u")return null;try{const e=window.localStorage.getItem(Wp);return e&&e.trim()?e:null}catch{return null}}function VA(e){if(!(typeof window>"u"))try{if(e){window.localStorage.setItem(Wp,e);return}window.localStorage.removeItem(Wp)}catch{}}const _b=["gesturestart","gesturechange","gestureend"],XA=[".workspace-list",".terminal-tab-list",".mobile-terminal-key-bar",".upload-toast-body",".file-tree",".file-detail",".file-editor",".file-markdown-preview",".editor-markdown-preview",".settings-content",".settings-nav",".transcript-dialog-scroll",".transcript-filter-group"].join(",");function GA(e=window){if(!QA(e))return()=>{};const t={passive:!1},n=e.document;function a(c){c.cancelable&&c.preventDefault()}function o(c){if(c.defaultPrevented)return;const d=c.touches;!d||d.length===0||(d.length>1||!ZA(c.target))&&a(c)}for(const c of _b)n.addEventListener(c,a,t);return n.addEventListener("touchmove",o,t),n.addEventListener("dblclick",a,t),()=>{for(const c of _b)n.removeEventListener(c,a,t);n.removeEventListener("touchmove",o,t),n.removeEventListener("dblclick",a,t)}}function ZA(e){return e instanceof Element&&e.closest(XA)!==null}function QA(e){return e.navigator.maxTouchPoints>0?!0:typeof e.matchMedia=="function"&&e.matchMedia("(pointer: coarse)").matches}const vb="--nterminal-viewport-height",gb="--nterminal-keyboard-inset-bottom",yb="data-nterminal-keyboard-visible",JA=120;function eN(e=window){const t=e.document.documentElement,n=e.visualViewport;function a(){const o=tN(e);o!==null&&t.style.setProperty(vb,`${o}px`),t.style.setProperty(gb,`${zw(e)}px`),t.setAttribute(yb,String(iN(e)))}return a(),n?.addEventListener("resize",a),n?.addEventListener("scroll",a),e.addEventListener("resize",a),e.addEventListener("orientationchange",a),e.addEventListener("pageshow",a),e.document.addEventListener("visibilitychange",a),()=>{n?.removeEventListener("resize",a),n?.removeEventListener("scroll",a),e.removeEventListener("resize",a),e.removeEventListener("orientationchange",a),e.removeEventListener("pageshow",a),e.document.removeEventListener("visibilitychange",a),t.style.removeProperty(vb),t.style.removeProperty(gb),t.removeAttribute(yb)}}function tN(e){const t=e.visualViewport?.height;return xu(t)?t:xu(e.innerHeight)?e.innerHeight:null}function xu(e){return typeof e=="number"&&Number.isFinite(e)&&e>0}function iN(e){return zw(e)>JA}function zw(e){const t=e.visualViewport?.height;if(!xu(t)||!xu(e.innerHeight))return 0;const n=typeof e.visualViewport?.offsetTop=="number"?e.visualViewport.offsetTop:0;return Math.max(0,Math.round(e.innerHeight-t-n))}eN();GA();pm();ZC.createRoot(document.getElementById("root")).render(_.jsx(xi.StrictMode,{children:_.jsx(YA,{})}));export{IC as g,_ as j};