nterminal 1.2.42 → 1.2.44
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.
- package/assets/brand/nterminal-mark-light.svg +4 -0
- package/assets/brand/nterminal-wordmark-light.svg +3 -0
- package/dist/client/assets/MarkdownPreview-D2ssNqvK.js +1 -0
- package/dist/client/assets/{TranscriptMarkdownBody-32hVz4hY.js → TranscriptMarkdownBody-JBbhBMv8.js} +1 -1
- package/dist/client/assets/index-DP_J1UQd.css +1 -0
- package/dist/client/assets/{index-CgoQYSx7.js → index-Dw6YSaLh.js} +1 -1
- package/dist/client/assets/{index-B0PnMSkj.js → index-tpwfLyrQ.js} +32 -32
- package/dist/client/brand/nterminal-mark-light.svg +4 -0
- package/dist/client/brand/nterminal-wordmark-light.svg +3 -0
- package/dist/client/index.html +2 -2
- package/package.json +1 -1
- package/public/brand/nterminal-mark-light.svg +4 -0
- package/public/brand/nterminal-wordmark-light.svg +3 -0
- package/dist/client/assets/MarkdownPreview-0CQvz0hX.js +0 -1
- package/dist/client/assets/index-Lb6fN8AB.css +0 -1
|
@@ -1,54 +1,54 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/MarkdownPreview-
|
|
2
|
-
(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 h of c.addedNodes)h.tagName==="LINK"&&h.rel==="modulepreload"&&a(h)}).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 fx(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var af={exports:{}},Wl={};var Oy;function px(){if(Oy)return Wl;Oy=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function n(a,o,c){var h=null;if(c!==void 0&&(h=""+c),o.key!==void 0&&(h=""+o.key),"key"in o){c={};for(var f in o)f!=="key"&&(c[f]=o[f])}else c=o;return o=c.ref,{$$typeof:e,type:a,key:h,ref:o!==void 0?o:null,props:c}}return Wl.Fragment=t,Wl.jsx=n,Wl.jsxs=n,Wl}var zy;function mx(){return zy||(zy=1,af.exports=px()),af.exports}var _=mx(),lf={exports:{}},Ie={};var jy;function _x(){if(jy)return Ie;jy=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"),h=Symbol.for("react.context"),f=Symbol.for("react.forward_ref"),m=Symbol.for("react.suspense"),p=Symbol.for("react.memo"),b=Symbol.for("react.lazy"),y=Symbol.for("react.activity"),w=Symbol.iterator;function x(D){return D===null||typeof D!="object"?null:(D=w&&D[w]||D["@@iterator"],typeof D=="function"?D:null)}var C={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},E=Object.assign,B={};function T(D,W,ne){this.props=D,this.context=W,this.refs=B,this.updater=ne||C}T.prototype.isReactComponent={},T.prototype.setState=function(D,W){if(typeof D!="object"&&typeof D!="function"&&D!=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,D,W,"setState")},T.prototype.forceUpdate=function(D){this.updater.enqueueForceUpdate(this,D,"forceUpdate")};function Y(){}Y.prototype=T.prototype;function K(D,W,ne){this.props=D,this.context=W,this.refs=B,this.updater=ne||C}var X=K.prototype=new Y;X.constructor=K,E(X,T.prototype),X.isPureReactComponent=!0;var re=Array.isArray;function ee(){}var ie={H:null,A:null,T:null,S:null},le=Object.prototype.hasOwnProperty;function de(D,W,ne){var he=ne.ref;return{$$typeof:e,type:D,key:W,ref:he!==void 0?he:null,props:ne}}function N(D,W){return de(D.type,W,D.props)}function U(D){return typeof D=="object"&&D!==null&&D.$$typeof===e}function P(D){var W={"=":"=0",":":"=2"};return"$"+D.replace(/[=:]/g,function(ne){return W[ne]})}var j=/\/+/g;function z(D,W){return typeof D=="object"&&D!==null&&D.key!=null?P(""+D.key):W.toString(36)}function G(D){switch(D.status){case"fulfilled":return D.value;case"rejected":throw D.reason;default:switch(typeof D.status=="string"?D.then(ee,ee):(D.status="pending",D.then(function(W){D.status==="pending"&&(D.status="fulfilled",D.value=W)},function(W){D.status==="pending"&&(D.status="rejected",D.reason=W)})),D.status){case"fulfilled":return D.value;case"rejected":throw D.reason}}throw D}function M(D,W,ne,he,ge){var pe=typeof D;(pe==="undefined"||pe==="boolean")&&(D=null);var ke=!1;if(D===null)ke=!0;else switch(pe){case"bigint":case"string":case"number":ke=!0;break;case"object":switch(D.$$typeof){case e:case t:ke=!0;break;case b:return ke=D._init,M(ke(D._payload),W,ne,he,ge)}}if(ke)return ge=ge(D),ke=he===""?"."+z(D,0):he,re(ge)?(ne="",ke!=null&&(ne=ke.replace(j,"$&/")+"/"),M(ge,W,ne,"",function(Me){return Me})):ge!=null&&(U(ge)&&(ge=N(ge,ne+(ge.key==null||D&&D.key===ge.key?"":(""+ge.key).replace(j,"$&/")+"/")+ke)),W.push(ge)),1;ke=0;var me=he===""?".":he+":";if(re(D))for(var Se=0;Se<D.length;Se++)he=D[Se],pe=me+z(he,Se),ke+=M(he,W,ne,pe,ge);else if(Se=x(D),typeof Se=="function")for(D=Se.call(D),Se=0;!(he=D.next()).done;)he=he.value,pe=me+z(he,Se++),ke+=M(he,W,ne,pe,ge);else if(pe==="object"){if(typeof D.then=="function")return M(G(D),W,ne,he,ge);throw W=String(D),Error("Objects are not valid as a React child (found: "+(W==="[object Object]"?"object with keys {"+Object.keys(D).join(", ")+"}":W)+"). If you meant to render a collection of children, use an array instead.")}return ke}function q(D,W,ne){if(D==null)return D;var he=[],ge=0;return M(D,he,"","",function(pe){return W.call(ne,pe,ge++)}),he}function V(D){if(D._status===-1){var W=D._result;W=W(),W.then(function(ne){(D._status===0||D._status===-1)&&(D._status=1,D._result=ne)},function(ne){(D._status===0||D._status===-1)&&(D._status=2,D._result=ne)}),D._status===-1&&(D._status=0,D._result=W)}if(D._status===1)return D._result.default;throw D._result}var _e=typeof reportError=="function"?reportError:function(D){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var W=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof D=="object"&&D!==null&&typeof D.message=="string"?String(D.message):String(D),error:D});if(!window.dispatchEvent(W))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",D);return}console.error(D)},be={map:q,forEach:function(D,W,ne){q(D,function(){W.apply(this,arguments)},ne)},count:function(D){var W=0;return q(D,function(){W++}),W},toArray:function(D){return q(D,function(W){return W})||[]},only:function(D){if(!U(D))throw Error("React.Children.only expected to receive a single React element child.");return D}};return Ie.Activity=y,Ie.Children=be,Ie.Component=T,Ie.Fragment=n,Ie.Profiler=o,Ie.PureComponent=K,Ie.StrictMode=a,Ie.Suspense=m,Ie.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=ie,Ie.__COMPILER_RUNTIME={__proto__:null,c:function(D){return ie.H.useMemoCache(D)}},Ie.cache=function(D){return function(){return D.apply(null,arguments)}},Ie.cacheSignal=function(){return null},Ie.cloneElement=function(D,W,ne){if(D==null)throw Error("The argument must be a React element, but you passed "+D+".");var he=E({},D.props),ge=D.key;if(W!=null)for(pe in W.key!==void 0&&(ge=""+W.key),W)!le.call(W,pe)||pe==="key"||pe==="__self"||pe==="__source"||pe==="ref"&&W.ref===void 0||(he[pe]=W[pe]);var pe=arguments.length-2;if(pe===1)he.children=ne;else if(1<pe){for(var ke=Array(pe),me=0;me<pe;me++)ke[me]=arguments[me+2];he.children=ke}return de(D.type,ge,he)},Ie.createContext=function(D){return D={$$typeof:h,_currentValue:D,_currentValue2:D,_threadCount:0,Provider:null,Consumer:null},D.Provider=D,D.Consumer={$$typeof:c,_context:D},D},Ie.createElement=function(D,W,ne){var he,ge={},pe=null;if(W!=null)for(he in W.key!==void 0&&(pe=""+W.key),W)le.call(W,he)&&he!=="key"&&he!=="__self"&&he!=="__source"&&(ge[he]=W[he]);var ke=arguments.length-2;if(ke===1)ge.children=ne;else if(1<ke){for(var me=Array(ke),Se=0;Se<ke;Se++)me[Se]=arguments[Se+2];ge.children=me}if(D&&D.defaultProps)for(he in ke=D.defaultProps,ke)ge[he]===void 0&&(ge[he]=ke[he]);return de(D,pe,ge)},Ie.createRef=function(){return{current:null}},Ie.forwardRef=function(D){return{$$typeof:f,render:D}},Ie.isValidElement=U,Ie.lazy=function(D){return{$$typeof:b,_payload:{_status:-1,_result:D},_init:V}},Ie.memo=function(D,W){return{$$typeof:p,type:D,compare:W===void 0?null:W}},Ie.startTransition=function(D){var W=ie.T,ne={};ie.T=ne;try{var he=D(),ge=ie.S;ge!==null&&ge(ne,he),typeof he=="object"&&he!==null&&typeof he.then=="function"&&he.then(ee,_e)}catch(pe){_e(pe)}finally{W!==null&&ne.types!==null&&(W.types=ne.types),ie.T=W}},Ie.unstable_useCacheRefresh=function(){return ie.H.useCacheRefresh()},Ie.use=function(D){return ie.H.use(D)},Ie.useActionState=function(D,W,ne){return ie.H.useActionState(D,W,ne)},Ie.useCallback=function(D,W){return ie.H.useCallback(D,W)},Ie.useContext=function(D){return ie.H.useContext(D)},Ie.useDebugValue=function(){},Ie.useDeferredValue=function(D,W){return ie.H.useDeferredValue(D,W)},Ie.useEffect=function(D,W){return ie.H.useEffect(D,W)},Ie.useEffectEvent=function(D){return ie.H.useEffectEvent(D)},Ie.useId=function(){return ie.H.useId()},Ie.useImperativeHandle=function(D,W,ne){return ie.H.useImperativeHandle(D,W,ne)},Ie.useInsertionEffect=function(D,W){return ie.H.useInsertionEffect(D,W)},Ie.useLayoutEffect=function(D,W){return ie.H.useLayoutEffect(D,W)},Ie.useMemo=function(D,W){return ie.H.useMemo(D,W)},Ie.useOptimistic=function(D,W){return ie.H.useOptimistic(D,W)},Ie.useReducer=function(D,W,ne){return ie.H.useReducer(D,W,ne)},Ie.useRef=function(D){return ie.H.useRef(D)},Ie.useState=function(D){return ie.H.useState(D)},Ie.useSyncExternalStore=function(D,W,ne){return ie.H.useSyncExternalStore(D,W,ne)},Ie.useTransition=function(){return ie.H.useTransition()},Ie.version="19.2.6",Ie}var Hy;function fm(){return Hy||(Hy=1,lf.exports=_x()),lf.exports}var g=fm();const ei=fx(g);var of={exports:{}},$l={},cf={exports:{}},uf={};var Uy;function vx(){return Uy||(Uy=1,(function(e){function t(M,q){var V=M.length;M.push(q);e:for(;0<V;){var _e=V-1>>>1,be=M[_e];if(0<o(be,q))M[_e]=q,M[V]=be,V=_e;else break e}}function n(M){return M.length===0?null:M[0]}function a(M){if(M.length===0)return null;var q=M[0],V=M.pop();if(V!==q){M[0]=V;e:for(var _e=0,be=M.length,D=be>>>1;_e<D;){var W=2*(_e+1)-1,ne=M[W],he=W+1,ge=M[he];if(0>o(ne,V))he<be&&0>o(ge,ne)?(M[_e]=ge,M[he]=V,_e=he):(M[_e]=ne,M[W]=V,_e=W);else if(he<be&&0>o(ge,V))M[_e]=ge,M[he]=V,_e=he;else break e}}return q}function o(M,q){var V=M.sortIndex-q.sortIndex;return V!==0?V:M.id-q.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 h=Date,f=h.now();e.unstable_now=function(){return h.now()-f}}var m=[],p=[],b=1,y=null,w=3,x=!1,C=!1,E=!1,B=!1,T=typeof setTimeout=="function"?setTimeout:null,Y=typeof clearTimeout=="function"?clearTimeout:null,K=typeof setImmediate<"u"?setImmediate:null;function X(M){for(var q=n(p);q!==null;){if(q.callback===null)a(p);else if(q.startTime<=M)a(p),q.sortIndex=q.expirationTime,t(m,q);else break;q=n(p)}}function re(M){if(E=!1,X(M),!C)if(n(m)!==null)C=!0,ee||(ee=!0,P());else{var q=n(p);q!==null&&G(re,q.startTime-M)}}var ee=!1,ie=-1,le=5,de=-1;function N(){return B?!0:!(e.unstable_now()-de<le)}function U(){if(B=!1,ee){var M=e.unstable_now();de=M;var q=!0;try{e:{C=!1,E&&(E=!1,Y(ie),ie=-1),x=!0;var V=w;try{t:{for(X(M),y=n(m);y!==null&&!(y.expirationTime>M&&N());){var _e=y.callback;if(typeof _e=="function"){y.callback=null,w=y.priorityLevel;var be=_e(y.expirationTime<=M);if(M=e.unstable_now(),typeof be=="function"){y.callback=be,X(M),q=!0;break t}y===n(m)&&a(m),X(M)}else a(m);y=n(m)}if(y!==null)q=!0;else{var D=n(p);D!==null&&G(re,D.startTime-M),q=!1}}break e}finally{y=null,w=V,x=!1}q=void 0}}finally{q?P():ee=!1}}}var P;if(typeof K=="function")P=function(){K(U)};else if(typeof MessageChannel<"u"){var j=new MessageChannel,z=j.port2;j.port1.onmessage=U,P=function(){z.postMessage(null)}}else P=function(){T(U,0)};function G(M,q){ie=T(function(){M(e.unstable_now())},q)}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"):le=0<M?Math.floor(1e3/M):5},e.unstable_getCurrentPriorityLevel=function(){return w},e.unstable_next=function(M){switch(w){case 1:case 2:case 3:var q=3;break;default:q=w}var V=w;w=q;try{return M()}finally{w=V}},e.unstable_requestPaint=function(){B=!0},e.unstable_runWithPriority=function(M,q){switch(M){case 1:case 2:case 3:case 4:case 5:break;default:M=3}var V=w;w=M;try{return q()}finally{w=V}},e.unstable_scheduleCallback=function(M,q,V){var _e=e.unstable_now();switch(typeof V=="object"&&V!==null?(V=V.delay,V=typeof V=="number"&&0<V?_e+V:_e):V=_e,M){case 1:var be=-1;break;case 2:be=250;break;case 5:be=1073741823;break;case 4:be=1e4;break;default:be=5e3}return be=V+be,M={id:b++,callback:q,priorityLevel:M,startTime:V,expirationTime:be,sortIndex:-1},V>_e?(M.sortIndex=V,t(p,M),n(m)===null&&M===n(p)&&(E?(Y(ie),ie=-1):E=!0,G(re,V-_e))):(M.sortIndex=be,t(m,M),C||x||(C=!0,ee||(ee=!0,P()))),M},e.unstable_shouldYield=N,e.unstable_wrapCallback=function(M){var q=w;return function(){var V=w;w=q;try{return M.apply(this,arguments)}finally{w=V}}}})(uf)),uf}var Py;function gx(){return Py||(Py=1,cf.exports=vx()),cf.exports}var hf={exports:{}},Bi={};var Ky;function yx(){if(Ky)return Bi;Ky=1;var e=fm();function t(m){var p="https://react.dev/errors/"+m;if(1<arguments.length){p+="?args[]="+encodeURIComponent(arguments[1]);for(var b=2;b<arguments.length;b++)p+="&args[]="+encodeURIComponent(arguments[b])}return"Minified React error #"+m+"; visit "+p+" 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,p,b){var y=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:o,key:y==null?null:""+y,children:m,containerInfo:p,implementation:b}}var h=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function f(m,p){if(m==="font")return"";if(typeof p=="string")return p==="use-credentials"?p:""}return Bi.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=a,Bi.createPortal=function(m,p){var b=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!p||p.nodeType!==1&&p.nodeType!==9&&p.nodeType!==11)throw Error(t(299));return c(m,p,null,b)},Bi.flushSync=function(m){var p=h.T,b=a.p;try{if(h.T=null,a.p=2,m)return m()}finally{h.T=p,a.p=b,a.d.f()}},Bi.preconnect=function(m,p){typeof m=="string"&&(p?(p=p.crossOrigin,p=typeof p=="string"?p==="use-credentials"?p:"":void 0):p=null,a.d.C(m,p))},Bi.prefetchDNS=function(m){typeof m=="string"&&a.d.D(m)},Bi.preinit=function(m,p){if(typeof m=="string"&&p&&typeof p.as=="string"){var b=p.as,y=f(b,p.crossOrigin),w=typeof p.integrity=="string"?p.integrity:void 0,x=typeof p.fetchPriority=="string"?p.fetchPriority:void 0;b==="style"?a.d.S(m,typeof p.precedence=="string"?p.precedence:void 0,{crossOrigin:y,integrity:w,fetchPriority:x}):b==="script"&&a.d.X(m,{crossOrigin:y,integrity:w,fetchPriority:x,nonce:typeof p.nonce=="string"?p.nonce:void 0})}},Bi.preinitModule=function(m,p){if(typeof m=="string")if(typeof p=="object"&&p!==null){if(p.as==null||p.as==="script"){var b=f(p.as,p.crossOrigin);a.d.M(m,{crossOrigin:b,integrity:typeof p.integrity=="string"?p.integrity:void 0,nonce:typeof p.nonce=="string"?p.nonce:void 0})}}else p==null&&a.d.M(m)},Bi.preload=function(m,p){if(typeof m=="string"&&typeof p=="object"&&p!==null&&typeof p.as=="string"){var b=p.as,y=f(b,p.crossOrigin);a.d.L(m,b,{crossOrigin:y,integrity:typeof p.integrity=="string"?p.integrity:void 0,nonce:typeof p.nonce=="string"?p.nonce:void 0,type:typeof p.type=="string"?p.type:void 0,fetchPriority:typeof p.fetchPriority=="string"?p.fetchPriority:void 0,referrerPolicy:typeof p.referrerPolicy=="string"?p.referrerPolicy:void 0,imageSrcSet:typeof p.imageSrcSet=="string"?p.imageSrcSet:void 0,imageSizes:typeof p.imageSizes=="string"?p.imageSizes:void 0,media:typeof p.media=="string"?p.media:void 0})}},Bi.preloadModule=function(m,p){if(typeof m=="string")if(p){var b=f(p.as,p.crossOrigin);a.d.m(m,{as:typeof p.as=="string"&&p.as!=="script"?p.as:void 0,crossOrigin:b,integrity:typeof p.integrity=="string"?p.integrity:void 0})}else a.d.m(m)},Bi.requestFormReset=function(m){a.d.r(m)},Bi.unstable_batchedUpdates=function(m,p){return m(p)},Bi.useFormState=function(m,p,b){return h.H.useFormState(m,p,b)},Bi.useFormStatus=function(){return h.H.useHostTransitionStatus()},Bi.version="19.2.6",Bi}var Iy;function WS(){if(Iy)return hf.exports;Iy=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(),hf.exports=yx(),hf.exports}var Fy;function bx(){if(Fy)return $l;Fy=1;var e=gx(),t=fm(),n=WS();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 h(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 f(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 p(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 d=u.alternate;if(d===null){if(l=u.return,l!==null){r=l;continue}break}if(u.child===d.child){for(d=u.child;d;){if(d===r)return m(u),i;if(d===l)return m(u),s;d=d.sibling}throw Error(a(188))}if(r.return!==l.return)r=u,l=d;else{for(var v=!1,S=u.child;S;){if(S===r){v=!0,r=u,l=d;break}if(S===l){v=!0,l=u,r=d;break}S=S.sibling}if(!v){for(S=d.child;S;){if(S===r){v=!0,r=d,l=u;break}if(S===l){v=!0,l=d,r=u;break}S=S.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 b(i){var s=i.tag;if(s===5||s===26||s===27||s===6)return i;for(i=i.child;i!==null;){if(s=b(i),s!==null)return s;i=i.sibling}return null}var y=Object.assign,w=Symbol.for("react.element"),x=Symbol.for("react.transitional.element"),C=Symbol.for("react.portal"),E=Symbol.for("react.fragment"),B=Symbol.for("react.strict_mode"),T=Symbol.for("react.profiler"),Y=Symbol.for("react.consumer"),K=Symbol.for("react.context"),X=Symbol.for("react.forward_ref"),re=Symbol.for("react.suspense"),ee=Symbol.for("react.suspense_list"),ie=Symbol.for("react.memo"),le=Symbol.for("react.lazy"),de=Symbol.for("react.activity"),N=Symbol.for("react.memo_cache_sentinel"),U=Symbol.iterator;function P(i){return i===null||typeof i!="object"?null:(i=U&&i[U]||i["@@iterator"],typeof i=="function"?i:null)}var j=Symbol.for("react.client.reference");function z(i){if(i==null)return null;if(typeof i=="function")return i.$$typeof===j?null:i.displayName||i.name||null;if(typeof i=="string")return i;switch(i){case E:return"Fragment";case T:return"Profiler";case B:return"StrictMode";case re:return"Suspense";case ee:return"SuspenseList";case de:return"Activity"}if(typeof i=="object")switch(i.$$typeof){case C:return"Portal";case K:return i.displayName||"Context";case Y:return(i._context.displayName||"Context")+".Consumer";case X:var s=i.render;return i=i.displayName,i||(i=s.displayName||s.name||"",i=i!==""?"ForwardRef("+i+")":"ForwardRef"),i;case ie:return s=i.displayName||null,s!==null?s:z(i.type)||"Memo";case le:s=i._payload,i=i._init;try{return z(i(s))}catch{}}return null}var G=Array.isArray,M=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,q=n.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,V={pending:!1,data:null,method:null,action:null},_e=[],be=-1;function D(i){return{current:i}}function W(i){0>be||(i.current=_e[be],_e[be]=null,be--)}function ne(i,s){be++,_e[be]=i.current,i.current=s}var he=D(null),ge=D(null),pe=D(null),ke=D(null);function me(i,s){switch(ne(pe,s),ne(ge,i),ne(he,null),s.nodeType){case 9:case 11:i=(i=s.documentElement)&&(i=i.namespaceURI)?ny(i):0;break;default:if(i=s.tagName,s=s.namespaceURI)s=ny(s),i=ry(s,i);else switch(i){case"svg":i=1;break;case"math":i=2;break;default:i=0}}W(he),ne(he,i)}function Se(){W(he),W(ge),W(pe)}function Me(i){i.memoizedState!==null&&ne(ke,i);var s=he.current,r=ry(s,i.type);s!==r&&(ne(ge,i),ne(he,r))}function Ue(i){ge.current===i&&(W(he),W(ge)),ke.current===i&&(W(ke),Kl._currentValue=V)}var Ke,we;function te(i){if(Ke===void 0)try{throw Error()}catch(r){var s=r.stack.trim().match(/\n( *(at )?)/);Ke=s&&s[1]||"",we=-1<r.stack.indexOf(`
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/MarkdownPreview-D2ssNqvK.js","assets/index-Dw6YSaLh.js","assets/TranscriptMarkdownBody-JBbhBMv8.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
(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 h of c.addedNodes)h.tagName==="LINK"&&h.rel==="modulepreload"&&a(h)}).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 yx(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var lf={exports:{}},Vl={};var Hy;function bx(){if(Hy)return Vl;Hy=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function n(a,o,c){var h=null;if(c!==void 0&&(h=""+c),o.key!==void 0&&(h=""+o.key),"key"in o){c={};for(var f in o)f!=="key"&&(c[f]=o[f])}else c=o;return o=c.ref,{$$typeof:e,type:a,key:h,ref:o!==void 0?o:null,props:c}}return Vl.Fragment=t,Vl.jsx=n,Vl.jsxs=n,Vl}var Uy;function Sx(){return Uy||(Uy=1,lf.exports=bx()),lf.exports}var m=Sx(),of={exports:{}},Ie={};var Py;function wx(){if(Py)return Ie;Py=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"),h=Symbol.for("react.context"),f=Symbol.for("react.forward_ref"),_=Symbol.for("react.suspense"),p=Symbol.for("react.memo"),b=Symbol.for("react.lazy"),y=Symbol.for("react.activity"),w=Symbol.iterator;function x(D){return D===null||typeof D!="object"?null:(D=w&&D[w]||D["@@iterator"],typeof D=="function"?D:null)}var C={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},E=Object.assign,B={};function T(D,W,re){this.props=D,this.context=W,this.refs=B,this.updater=re||C}T.prototype.isReactComponent={},T.prototype.setState=function(D,W){if(typeof D!="object"&&typeof D!="function"&&D!=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,D,W,"setState")},T.prototype.forceUpdate=function(D){this.updater.enqueueForceUpdate(this,D,"forceUpdate")};function Y(){}Y.prototype=T.prototype;function P(D,W,re){this.props=D,this.context=W,this.refs=B,this.updater=re||C}var X=P.prototype=new Y;X.constructor=P,E(X,T.prototype),X.isPureReactComponent=!0;var ee=Array.isArray;function te(){}var se={H:null,A:null,T:null,S:null},le=Object.prototype.hasOwnProperty;function de(D,W,re){var he=re.ref;return{$$typeof:e,type:D,key:W,ref:he!==void 0?he:null,props:re}}function N(D,W){return de(D.type,W,D.props)}function U(D){return typeof D=="object"&&D!==null&&D.$$typeof===e}function K(D){var W={"=":"=0",":":"=2"};return"$"+D.replace(/[=:]/g,function(re){return W[re]})}var j=/\/+/g;function z(D,W){return typeof D=="object"&&D!==null&&D.key!=null?K(""+D.key):W.toString(36)}function G(D){switch(D.status){case"fulfilled":return D.value;case"rejected":throw D.reason;default:switch(typeof D.status=="string"?D.then(te,te):(D.status="pending",D.then(function(W){D.status==="pending"&&(D.status="fulfilled",D.value=W)},function(W){D.status==="pending"&&(D.status="rejected",D.reason=W)})),D.status){case"fulfilled":return D.value;case"rejected":throw D.reason}}throw D}function M(D,W,re,he,ve){var pe=typeof D;(pe==="undefined"||pe==="boolean")&&(D=null);var ke=!1;if(D===null)ke=!0;else switch(pe){case"bigint":case"string":case"number":ke=!0;break;case"object":switch(D.$$typeof){case e:case t:ke=!0;break;case b:return ke=D._init,M(ke(D._payload),W,re,he,ve)}}if(ke)return ve=ve(D),ke=he===""?"."+z(D,0):he,ee(ve)?(re="",ke!=null&&(re=ke.replace(j,"$&/")+"/"),M(ve,W,re,"",function(Me){return Me})):ve!=null&&(U(ve)&&(ve=N(ve,re+(ve.key==null||D&&D.key===ve.key?"":(""+ve.key).replace(j,"$&/")+"/")+ke)),W.push(ve)),1;ke=0;var me=he===""?".":he+":";if(ee(D))for(var Se=0;Se<D.length;Se++)he=D[Se],pe=me+z(he,Se),ke+=M(he,W,re,pe,ve);else if(Se=x(D),typeof Se=="function")for(D=Se.call(D),Se=0;!(he=D.next()).done;)he=he.value,pe=me+z(he,Se++),ke+=M(he,W,re,pe,ve);else if(pe==="object"){if(typeof D.then=="function")return M(G(D),W,re,he,ve);throw W=String(D),Error("Objects are not valid as a React child (found: "+(W==="[object Object]"?"object with keys {"+Object.keys(D).join(", ")+"}":W)+"). If you meant to render a collection of children, use an array instead.")}return ke}function q(D,W,re){if(D==null)return D;var he=[],ve=0;return M(D,he,"","",function(pe){return W.call(re,pe,ve++)}),he}function V(D){if(D._status===-1){var W=D._result;W=W(),W.then(function(re){(D._status===0||D._status===-1)&&(D._status=1,D._result=re)},function(re){(D._status===0||D._status===-1)&&(D._status=2,D._result=re)}),D._status===-1&&(D._status=0,D._result=W)}if(D._status===1)return D._result.default;throw D._result}var _e=typeof reportError=="function"?reportError:function(D){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var W=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof D=="object"&&D!==null&&typeof D.message=="string"?String(D.message):String(D),error:D});if(!window.dispatchEvent(W))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",D);return}console.error(D)},be={map:q,forEach:function(D,W,re){q(D,function(){W.apply(this,arguments)},re)},count:function(D){var W=0;return q(D,function(){W++}),W},toArray:function(D){return q(D,function(W){return W})||[]},only:function(D){if(!U(D))throw Error("React.Children.only expected to receive a single React element child.");return D}};return Ie.Activity=y,Ie.Children=be,Ie.Component=T,Ie.Fragment=n,Ie.Profiler=o,Ie.PureComponent=P,Ie.StrictMode=a,Ie.Suspense=_,Ie.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=se,Ie.__COMPILER_RUNTIME={__proto__:null,c:function(D){return se.H.useMemoCache(D)}},Ie.cache=function(D){return function(){return D.apply(null,arguments)}},Ie.cacheSignal=function(){return null},Ie.cloneElement=function(D,W,re){if(D==null)throw Error("The argument must be a React element, but you passed "+D+".");var he=E({},D.props),ve=D.key;if(W!=null)for(pe in W.key!==void 0&&(ve=""+W.key),W)!le.call(W,pe)||pe==="key"||pe==="__self"||pe==="__source"||pe==="ref"&&W.ref===void 0||(he[pe]=W[pe]);var pe=arguments.length-2;if(pe===1)he.children=re;else if(1<pe){for(var ke=Array(pe),me=0;me<pe;me++)ke[me]=arguments[me+2];he.children=ke}return de(D.type,ve,he)},Ie.createContext=function(D){return D={$$typeof:h,_currentValue:D,_currentValue2:D,_threadCount:0,Provider:null,Consumer:null},D.Provider=D,D.Consumer={$$typeof:c,_context:D},D},Ie.createElement=function(D,W,re){var he,ve={},pe=null;if(W!=null)for(he in W.key!==void 0&&(pe=""+W.key),W)le.call(W,he)&&he!=="key"&&he!=="__self"&&he!=="__source"&&(ve[he]=W[he]);var ke=arguments.length-2;if(ke===1)ve.children=re;else if(1<ke){for(var me=Array(ke),Se=0;Se<ke;Se++)me[Se]=arguments[Se+2];ve.children=me}if(D&&D.defaultProps)for(he in ke=D.defaultProps,ke)ve[he]===void 0&&(ve[he]=ke[he]);return de(D,pe,ve)},Ie.createRef=function(){return{current:null}},Ie.forwardRef=function(D){return{$$typeof:f,render:D}},Ie.isValidElement=U,Ie.lazy=function(D){return{$$typeof:b,_payload:{_status:-1,_result:D},_init:V}},Ie.memo=function(D,W){return{$$typeof:p,type:D,compare:W===void 0?null:W}},Ie.startTransition=function(D){var W=se.T,re={};se.T=re;try{var he=D(),ve=se.S;ve!==null&&ve(re,he),typeof he=="object"&&he!==null&&typeof he.then=="function"&&he.then(te,_e)}catch(pe){_e(pe)}finally{W!==null&&re.types!==null&&(W.types=re.types),se.T=W}},Ie.unstable_useCacheRefresh=function(){return se.H.useCacheRefresh()},Ie.use=function(D){return se.H.use(D)},Ie.useActionState=function(D,W,re){return se.H.useActionState(D,W,re)},Ie.useCallback=function(D,W){return se.H.useCallback(D,W)},Ie.useContext=function(D){return se.H.useContext(D)},Ie.useDebugValue=function(){},Ie.useDeferredValue=function(D,W){return se.H.useDeferredValue(D,W)},Ie.useEffect=function(D,W){return se.H.useEffect(D,W)},Ie.useEffectEvent=function(D){return se.H.useEffectEvent(D)},Ie.useId=function(){return se.H.useId()},Ie.useImperativeHandle=function(D,W,re){return se.H.useImperativeHandle(D,W,re)},Ie.useInsertionEffect=function(D,W){return se.H.useInsertionEffect(D,W)},Ie.useLayoutEffect=function(D,W){return se.H.useLayoutEffect(D,W)},Ie.useMemo=function(D,W){return se.H.useMemo(D,W)},Ie.useOptimistic=function(D,W){return se.H.useOptimistic(D,W)},Ie.useReducer=function(D,W,re){return se.H.useReducer(D,W,re)},Ie.useRef=function(D){return se.H.useRef(D)},Ie.useState=function(D){return se.H.useState(D)},Ie.useSyncExternalStore=function(D,W,re){return se.H.useSyncExternalStore(D,W,re)},Ie.useTransition=function(){return se.H.useTransition()},Ie.version="19.2.6",Ie}var Ky;function mm(){return Ky||(Ky=1,of.exports=wx()),of.exports}var v=mm();const hi=yx(v);var cf={exports:{}},Xl={},uf={exports:{}},hf={};var Iy;function Cx(){return Iy||(Iy=1,(function(e){function t(M,q){var V=M.length;M.push(q);e:for(;0<V;){var _e=V-1>>>1,be=M[_e];if(0<o(be,q))M[_e]=q,M[V]=be,V=_e;else break e}}function n(M){return M.length===0?null:M[0]}function a(M){if(M.length===0)return null;var q=M[0],V=M.pop();if(V!==q){M[0]=V;e:for(var _e=0,be=M.length,D=be>>>1;_e<D;){var W=2*(_e+1)-1,re=M[W],he=W+1,ve=M[he];if(0>o(re,V))he<be&&0>o(ve,re)?(M[_e]=ve,M[he]=V,_e=he):(M[_e]=re,M[W]=V,_e=W);else if(he<be&&0>o(ve,V))M[_e]=ve,M[he]=V,_e=he;else break e}}return q}function o(M,q){var V=M.sortIndex-q.sortIndex;return V!==0?V:M.id-q.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 h=Date,f=h.now();e.unstable_now=function(){return h.now()-f}}var _=[],p=[],b=1,y=null,w=3,x=!1,C=!1,E=!1,B=!1,T=typeof setTimeout=="function"?setTimeout:null,Y=typeof clearTimeout=="function"?clearTimeout:null,P=typeof setImmediate<"u"?setImmediate:null;function X(M){for(var q=n(p);q!==null;){if(q.callback===null)a(p);else if(q.startTime<=M)a(p),q.sortIndex=q.expirationTime,t(_,q);else break;q=n(p)}}function ee(M){if(E=!1,X(M),!C)if(n(_)!==null)C=!0,te||(te=!0,K());else{var q=n(p);q!==null&&G(ee,q.startTime-M)}}var te=!1,se=-1,le=5,de=-1;function N(){return B?!0:!(e.unstable_now()-de<le)}function U(){if(B=!1,te){var M=e.unstable_now();de=M;var q=!0;try{e:{C=!1,E&&(E=!1,Y(se),se=-1),x=!0;var V=w;try{t:{for(X(M),y=n(_);y!==null&&!(y.expirationTime>M&&N());){var _e=y.callback;if(typeof _e=="function"){y.callback=null,w=y.priorityLevel;var be=_e(y.expirationTime<=M);if(M=e.unstable_now(),typeof be=="function"){y.callback=be,X(M),q=!0;break t}y===n(_)&&a(_),X(M)}else a(_);y=n(_)}if(y!==null)q=!0;else{var D=n(p);D!==null&&G(ee,D.startTime-M),q=!1}}break e}finally{y=null,w=V,x=!1}q=void 0}}finally{q?K():te=!1}}}var K;if(typeof P=="function")K=function(){P(U)};else if(typeof MessageChannel<"u"){var j=new MessageChannel,z=j.port2;j.port1.onmessage=U,K=function(){z.postMessage(null)}}else K=function(){T(U,0)};function G(M,q){se=T(function(){M(e.unstable_now())},q)}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"):le=0<M?Math.floor(1e3/M):5},e.unstable_getCurrentPriorityLevel=function(){return w},e.unstable_next=function(M){switch(w){case 1:case 2:case 3:var q=3;break;default:q=w}var V=w;w=q;try{return M()}finally{w=V}},e.unstable_requestPaint=function(){B=!0},e.unstable_runWithPriority=function(M,q){switch(M){case 1:case 2:case 3:case 4:case 5:break;default:M=3}var V=w;w=M;try{return q()}finally{w=V}},e.unstable_scheduleCallback=function(M,q,V){var _e=e.unstable_now();switch(typeof V=="object"&&V!==null?(V=V.delay,V=typeof V=="number"&&0<V?_e+V:_e):V=_e,M){case 1:var be=-1;break;case 2:be=250;break;case 5:be=1073741823;break;case 4:be=1e4;break;default:be=5e3}return be=V+be,M={id:b++,callback:q,priorityLevel:M,startTime:V,expirationTime:be,sortIndex:-1},V>_e?(M.sortIndex=V,t(p,M),n(_)===null&&M===n(p)&&(E?(Y(se),se=-1):E=!0,G(ee,V-_e))):(M.sortIndex=be,t(_,M),C||x||(C=!0,te||(te=!0,K()))),M},e.unstable_shouldYield=N,e.unstable_wrapCallback=function(M){var q=w;return function(){var V=w;w=q;try{return M.apply(this,arguments)}finally{w=V}}}})(hf)),hf}var Fy;function xx(){return Fy||(Fy=1,uf.exports=Cx()),uf.exports}var df={exports:{}},zi={};var qy;function Ex(){if(qy)return zi;qy=1;var e=mm();function t(_){var p="https://react.dev/errors/"+_;if(1<arguments.length){p+="?args[]="+encodeURIComponent(arguments[1]);for(var b=2;b<arguments.length;b++)p+="&args[]="+encodeURIComponent(arguments[b])}return"Minified React error #"+_+"; visit "+p+" 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(_,p,b){var y=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:o,key:y==null?null:""+y,children:_,containerInfo:p,implementation:b}}var h=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function f(_,p){if(_==="font")return"";if(typeof p=="string")return p==="use-credentials"?p:""}return zi.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=a,zi.createPortal=function(_,p){var b=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!p||p.nodeType!==1&&p.nodeType!==9&&p.nodeType!==11)throw Error(t(299));return c(_,p,null,b)},zi.flushSync=function(_){var p=h.T,b=a.p;try{if(h.T=null,a.p=2,_)return _()}finally{h.T=p,a.p=b,a.d.f()}},zi.preconnect=function(_,p){typeof _=="string"&&(p?(p=p.crossOrigin,p=typeof p=="string"?p==="use-credentials"?p:"":void 0):p=null,a.d.C(_,p))},zi.prefetchDNS=function(_){typeof _=="string"&&a.d.D(_)},zi.preinit=function(_,p){if(typeof _=="string"&&p&&typeof p.as=="string"){var b=p.as,y=f(b,p.crossOrigin),w=typeof p.integrity=="string"?p.integrity:void 0,x=typeof p.fetchPriority=="string"?p.fetchPriority:void 0;b==="style"?a.d.S(_,typeof p.precedence=="string"?p.precedence:void 0,{crossOrigin:y,integrity:w,fetchPriority:x}):b==="script"&&a.d.X(_,{crossOrigin:y,integrity:w,fetchPriority:x,nonce:typeof p.nonce=="string"?p.nonce:void 0})}},zi.preinitModule=function(_,p){if(typeof _=="string")if(typeof p=="object"&&p!==null){if(p.as==null||p.as==="script"){var b=f(p.as,p.crossOrigin);a.d.M(_,{crossOrigin:b,integrity:typeof p.integrity=="string"?p.integrity:void 0,nonce:typeof p.nonce=="string"?p.nonce:void 0})}}else p==null&&a.d.M(_)},zi.preload=function(_,p){if(typeof _=="string"&&typeof p=="object"&&p!==null&&typeof p.as=="string"){var b=p.as,y=f(b,p.crossOrigin);a.d.L(_,b,{crossOrigin:y,integrity:typeof p.integrity=="string"?p.integrity:void 0,nonce:typeof p.nonce=="string"?p.nonce:void 0,type:typeof p.type=="string"?p.type:void 0,fetchPriority:typeof p.fetchPriority=="string"?p.fetchPriority:void 0,referrerPolicy:typeof p.referrerPolicy=="string"?p.referrerPolicy:void 0,imageSrcSet:typeof p.imageSrcSet=="string"?p.imageSrcSet:void 0,imageSizes:typeof p.imageSizes=="string"?p.imageSizes:void 0,media:typeof p.media=="string"?p.media:void 0})}},zi.preloadModule=function(_,p){if(typeof _=="string")if(p){var b=f(p.as,p.crossOrigin);a.d.m(_,{as:typeof p.as=="string"&&p.as!=="script"?p.as:void 0,crossOrigin:b,integrity:typeof p.integrity=="string"?p.integrity:void 0})}else a.d.m(_)},zi.requestFormReset=function(_){a.d.r(_)},zi.unstable_batchedUpdates=function(_,p){return _(p)},zi.useFormState=function(_,p,b){return h.H.useFormState(_,p,b)},zi.useFormStatus=function(){return h.H.useHostTransitionStatus()},zi.version="19.2.6",zi}var Wy;function GS(){if(Wy)return df.exports;Wy=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(),df.exports=Ex(),df.exports}var $y;function Tx(){if($y)return Xl;$y=1;var e=xx(),t=mm(),n=GS();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 h(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 f(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 _(i){if(c(i)!==i)throw Error(a(188))}function p(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 d=u.alternate;if(d===null){if(l=u.return,l!==null){r=l;continue}break}if(u.child===d.child){for(d=u.child;d;){if(d===r)return _(u),i;if(d===l)return _(u),s;d=d.sibling}throw Error(a(188))}if(r.return!==l.return)r=u,l=d;else{for(var g=!1,S=u.child;S;){if(S===r){g=!0,r=u,l=d;break}if(S===l){g=!0,l=u,r=d;break}S=S.sibling}if(!g){for(S=d.child;S;){if(S===r){g=!0,r=d,l=u;break}if(S===l){g=!0,l=d,r=u;break}S=S.sibling}if(!g)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 b(i){var s=i.tag;if(s===5||s===26||s===27||s===6)return i;for(i=i.child;i!==null;){if(s=b(i),s!==null)return s;i=i.sibling}return null}var y=Object.assign,w=Symbol.for("react.element"),x=Symbol.for("react.transitional.element"),C=Symbol.for("react.portal"),E=Symbol.for("react.fragment"),B=Symbol.for("react.strict_mode"),T=Symbol.for("react.profiler"),Y=Symbol.for("react.consumer"),P=Symbol.for("react.context"),X=Symbol.for("react.forward_ref"),ee=Symbol.for("react.suspense"),te=Symbol.for("react.suspense_list"),se=Symbol.for("react.memo"),le=Symbol.for("react.lazy"),de=Symbol.for("react.activity"),N=Symbol.for("react.memo_cache_sentinel"),U=Symbol.iterator;function K(i){return i===null||typeof i!="object"?null:(i=U&&i[U]||i["@@iterator"],typeof i=="function"?i:null)}var j=Symbol.for("react.client.reference");function z(i){if(i==null)return null;if(typeof i=="function")return i.$$typeof===j?null:i.displayName||i.name||null;if(typeof i=="string")return i;switch(i){case E:return"Fragment";case T:return"Profiler";case B:return"StrictMode";case ee:return"Suspense";case te:return"SuspenseList";case de:return"Activity"}if(typeof i=="object")switch(i.$$typeof){case C:return"Portal";case P:return i.displayName||"Context";case Y:return(i._context.displayName||"Context")+".Consumer";case X:var s=i.render;return i=i.displayName,i||(i=s.displayName||s.name||"",i=i!==""?"ForwardRef("+i+")":"ForwardRef"),i;case se:return s=i.displayName||null,s!==null?s:z(i.type)||"Memo";case le:s=i._payload,i=i._init;try{return z(i(s))}catch{}}return null}var G=Array.isArray,M=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,q=n.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,V={pending:!1,data:null,method:null,action:null},_e=[],be=-1;function D(i){return{current:i}}function W(i){0>be||(i.current=_e[be],_e[be]=null,be--)}function re(i,s){be++,_e[be]=i.current,i.current=s}var he=D(null),ve=D(null),pe=D(null),ke=D(null);function me(i,s){switch(re(pe,s),re(ve,i),re(he,null),s.nodeType){case 9:case 11:i=(i=s.documentElement)&&(i=i.namespaceURI)?ly(i):0;break;default:if(i=s.tagName,s=s.namespaceURI)s=ly(s),i=oy(s,i);else switch(i){case"svg":i=1;break;case"math":i=2;break;default:i=0}}W(he),re(he,i)}function Se(){W(he),W(ve),W(pe)}function Me(i){i.memoizedState!==null&&re(ke,i);var s=he.current,r=oy(s,i.type);s!==r&&(re(ve,i),re(he,r))}function Ue(i){ve.current===i&&(W(he),W(ve)),ke.current===i&&(W(ke),ql._currentValue=V)}var Ke,we;function ie(i){if(Ke===void 0)try{throw Error()}catch(r){var s=r.stack.trim().match(/\n( *(at )?)/);Ke=s&&s[1]||"",we=-1<r.stack.indexOf(`
|
|
3
3
|
at`)?" (<anonymous>)":-1<r.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
4
|
-
`+Ke+i+we}var De=!1;function Ce(i,s){if(!i||De)return"";De=!0;var r=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var l={DetermineComponentFrameRoot:function(){try{if(s){var ce=function(){throw Error()};if(Object.defineProperty(ce.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(ce,[])}catch(Z){var $=Z}Reflect.construct(i,[],ce)}else{try{ce.call()}catch(Z){$=Z}i.call(ce.prototype)}}else{try{throw Error()}catch(Z){$=Z}(ce=i())&&typeof ce.catch=="function"&&ce.catch(function(){})}}catch(Z){if(Z&&$&&typeof Z.stack=="string")return[Z.stack,$.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 d=l.DetermineComponentFrameRoot(),
|
|
4
|
+
`+Ke+i+we}var De=!1;function Ce(i,s){if(!i||De)return"";De=!0;var r=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var l={DetermineComponentFrameRoot:function(){try{if(s){var ce=function(){throw Error()};if(Object.defineProperty(ce.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(ce,[])}catch(Z){var $=Z}Reflect.construct(i,[],ce)}else{try{ce.call()}catch(Z){$=Z}i.call(ce.prototype)}}else{try{throw Error()}catch(Z){$=Z}(ce=i())&&typeof ce.catch=="function"&&ce.catch(function(){})}}catch(Z){if(Z&&$&&typeof Z.stack=="string")return[Z.stack,$.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 d=l.DetermineComponentFrameRoot(),g=d[0],S=d[1];if(g&&S){var R=g.split(`
|
|
5
5
|
`),F=S.split(`
|
|
6
|
-
`);for(u=l=0;l<R.length&&!R[l].includes("DetermineComponentFrameRoot");)l++;for(;u<F.length&&!F[u].includes("DetermineComponentFrameRoot");)u++;if(l===R.length||u===F.length)for(l=R.length-1,u=F.length-1;1<=l&&0<=u&&R[l]!==F[u];)u--;for(;1<=l&&0<=u;l--,u--)if(R[l]!==F[u]){if(l!==1||u!==1)do if(l--,u--,0>u||R[l]!==F[u]){var
|
|
7
|
-
`+R[l].replace(" at new "," at ");return i.displayName&&
|
|
6
|
+
`);for(u=l=0;l<R.length&&!R[l].includes("DetermineComponentFrameRoot");)l++;for(;u<F.length&&!F[u].includes("DetermineComponentFrameRoot");)u++;if(l===R.length||u===F.length)for(l=R.length-1,u=F.length-1;1<=l&&0<=u&&R[l]!==F[u];)u--;for(;1<=l&&0<=u;l--,u--)if(R[l]!==F[u]){if(l!==1||u!==1)do if(l--,u--,0>u||R[l]!==F[u]){var ne=`
|
|
7
|
+
`+R[l].replace(" at new "," at ");return i.displayName&&ne.includes("<anonymous>")&&(ne=ne.replace("<anonymous>",i.displayName)),ne}while(1<=l&&0<=u);break}}}finally{De=!1,Error.prepareStackTrace=r}return(r=i?i.displayName||i.name:"")?ie(r):""}function Pe(i,s){switch(i.tag){case 26:case 27:case 5:return ie(i.type);case 16:return ie("Lazy");case 13:return i.child!==s&&s!==null?ie("Suspense Fallback"):ie("Suspense");case 19:return ie("SuspenseList");case 0:case 15:return Ce(i.type,!1);case 11:return Ce(i.type.render,!1);case 1:return Ce(i.type,!0);case 31:return ie("Activity");default:return""}}function $e(i){try{var s="",r=null;do s+=Pe(i,r),r=i,i=i.return;while(i);return s}catch(l){return`
|
|
8
8
|
Error generating stack: `+l.message+`
|
|
9
|
-
`+l.stack}}var bt=Object.prototype.hasOwnProperty,ht=e.unstable_scheduleCallback,Si=e.unstable_cancelCallback,J=e.unstable_shouldYield,Fe=e.unstable_requestPaint,Oe=e.unstable_now,Tt=e.unstable_getCurrentPriorityLevel,ji=e.unstable_ImmediatePriority,Ai=e.unstable_UserBlockingPriority,$t=e.unstable_NormalPriority,Vi=e.unstable_LowPriority,Li=e.unstable_IdlePriority,Xi=e.log,Vs=e.unstable_setDisableYieldValue,as=null,Pt=null;function wi(i){if(typeof Xi=="function"&&Vs(i),Pt&&typeof Pt.setStrictMode=="function")try{Pt.setStrictMode(as,i)}catch{}}var Lt=Math.clz32?Math.clz32:ln,Ci=Math.log,Hi=Math.LN2;function ln(i){return i>>>=0,i===0?32:31-(Ci(i)/Hi|0)|0}var bs=256,Ss=262144,_t=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 Bt(i,s,r){var l=i.pendingLanes;if(l===0)return 0;var u=0,d=i.suspendedLanes,v=i.pingedLanes;i=i.warmLanes;var S=l&134217727;return S!==0?(l=S&~d,l!==0?u=St(l):(v&=S,v!==0?u=St(v):r||(r=S&~i,r!==0&&(u=St(r))))):(S=l&~d,S!==0?u=St(S):v!==0?u=St(v):r||(r=l&~i,r!==0&&(u=St(r)))),u===0?0:s!==0&&s!==u&&(s&d)===0&&(d=u&-u,r=s&-s,d>=r||d===32&&(r&4194048)!==0)?s:u}function ii(i,s){return(i.pendingLanes&~(i.suspendedLanes&~i.pingedLanes)&s)===0}function kt(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 Yt(){var i=_t;return _t<<=1,(_t&62914560)===0&&(_t=4194304),i}function si(i){for(var s=[],r=0;31>r;r++)s.push(i);return s}function xi(i,s){i.pendingLanes|=s,s!==268435456&&(i.suspendedLanes=0,i.pingedLanes=0,i.warmLanes=0)}function wt(i,s,r,l,u,d){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 S=i.entanglements,R=i.expirationTimes,F=i.hiddenUpdates;for(r=v&~r;0<r;){var se=31-Lt(r),ce=1<<se;S[se]=0,R[se]=-1;var $=F[se];if($!==null)for(F[se]=null,se=0;se<$.length;se++){var Z=$[se];Z!==null&&(Z.lane&=-536870913)}r&=~ce}l!==0&&Ui(i,l,0),d!==0&&u===0&&i.tag!==0&&(i.suspendedLanes|=d&~(v&~s))}function Ui(i,s,r){i.pendingLanes|=s,i.suspendedLanes&=~s;var l=31-Lt(s);i.entangledLanes|=s,i.entanglements[l]=i.entanglements[l]|1073741824|r&261930}function Kt(i,s){var r=i.entangledLanes|=s;for(i=i.entanglements;r;){var l=31-Lt(r),u=1<<l;u&s|i[l]&s&&(i[l]|=s),r&=~u}}function Ei(i,s){var r=s&-s;return r=(r&42)!==0?1:lt(r),(r&(i.suspendedLanes|s))!==0?0:r}function lt(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 Pi(i){return i&=-i,2<i?8<i?(i&134217727)!==0?32:268435456:8:2}function Ti(){var i=q.p;return i!==0?i:(i=window.event,i===void 0?32:Dy(i.type))}function Ki(i,s){var r=q.p;try{return q.p=i,s()}finally{q.p=r}}var st=Math.random().toString(36).slice(2),Ot="__reactFiber$"+st,ni="__reactProps$"+st,Gi="__reactContainer$"+st,Vt="__reactEvents$"+st,il="__reactListeners$"+st,sa="__reactHandles$"+st,br="__reactResources$"+st,ls="__reactMarker$"+st;function Bn(i){delete i[Ot],delete i[ni],delete i[Vt],delete i[il],delete i[sa]}function di(i){var s=i[Ot];if(s)return s;for(var r=i.parentNode;r;){if(s=r[Gi]||r[Ot]){if(r=s.alternate,s.child!==null||r!==null&&r.child!==null)for(i=dy(i);i!==null;){if(r=i[Ot])return r;i=dy(i)}return s}i=r,r=i.parentNode}return null}function ri(i){if(i=i[Ot]||i[Gi]){var s=i.tag;if(s===5||s===6||s===13||s===31||s===26||s===27||s===3)return i}return null}function ws(i){var s=i.tag;if(s===5||s===26||s===27||s===6)return i.stateNode;throw Error(a(33))}function Xs(i){var s=i[br];return s||(s=i[br]={hoistableStyles:new Map,hoistableScripts:new Map}),s}function Mt(i){i[ls]=!0}var na=new Set,Sr={};function os(i,s){Cs(i,s),Cs(i+"Capture",s)}function Cs(i,s){for(Sr[i]=s,i=0;i<s.length;i++)na.add(s[i])}var wr=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]*$"),On={},Cr={};function sl(i){return bt.call(Cr,i)?!0:bt.call(On,i)?!1:wr.test(i)?Cr[i]=!0:(On[i]=!0,!1)}function Ii(i,s,r){if(sl(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 Ps(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 k(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 O(i){switch(typeof i){case"bigint":case"boolean":case"number":case"string":case"undefined":return i;case"object":return i;default:return""}}function Q(i){var s=i.type;return(i=i.nodeName)&&i.toLowerCase()==="input"&&(s==="checkbox"||s==="radio")}function fe(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,d=l.set;return Object.defineProperty(i,s,{configurable:!0,get:function(){return u.call(this)},set:function(v){r=""+v,d.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 xe(i){if(!i._valueTracker){var s=Q(i)?"checked":"value";i._valueTracker=fe(i,s,""+i[s])}}function Ne(i){if(!i)return!1;var s=i._valueTracker;if(!s)return!0;var r=s.getValue(),l="";return i&&(l=Q(i)?i.checked?"true":"false":i.value),i=l,i!==r?(s.setValue(i),!0):!1}function Ae(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 vt=/[\n"\\]/g;function ot(i){return i.replace(vt,function(s){return"\\"+s.charCodeAt(0).toString(16)+" "})}function Fi(i,s,r,l,u,d,v,S){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=""+O(s)):i.value!==""+O(s)&&(i.value=""+O(s)):v!=="submit"&&v!=="reset"||i.removeAttribute("value"),s!=null?oe(i,v,O(s)):r!=null?oe(i,v,O(r)):l!=null&&i.removeAttribute("value"),u==null&&d!=null&&(i.defaultChecked=!!d),u!=null&&(i.checked=u&&typeof u!="function"&&typeof u!="symbol"),S!=null&&typeof S!="function"&&typeof S!="symbol"&&typeof S!="boolean"?i.name=""+O(S):i.removeAttribute("name")}function A(i,s,r,l,u,d,v,S){if(d!=null&&typeof d!="function"&&typeof d!="symbol"&&typeof d!="boolean"&&(i.type=d),s!=null||r!=null){if(!(d!=="submit"&&d!=="reset"||s!=null)){xe(i);return}r=r!=null?""+O(r):"",s=s!=null?""+O(s):r,S||s===i.value||(i.value=s),i.defaultValue=s}l=l??u,l=typeof l!="function"&&typeof l!="symbol"&&!!l,i.checked=S?i.checked:!!l,i.defaultChecked=!!l,v!=null&&typeof v!="function"&&typeof v!="symbol"&&typeof v!="boolean"&&(i.name=v),xe(i)}function oe(i,s,r){s==="number"&&Ae(i.ownerDocument)===i||i.defaultValue===""+r||(i.defaultValue=""+r)}function Le(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=""+O(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 ze(i,s,r){if(s!=null&&(s=""+O(s),s!==i.value&&(i.value=s),r==null)){i.defaultValue!==s&&(i.defaultValue=s);return}i.defaultValue=r!=null?""+O(r):""}function Ye(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=O(s),i.defaultValue=r,l=i.textContent,l===r&&l!==""&&l!==null&&(i.value=l),xe(i)}function it(i,s){if(s){var r=i.firstChild;if(r&&r===i.lastChild&&r.nodeType===3){r.nodeValue=s;return}}i.textContent=s}var fi=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 ai(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||fi.has(s)?s==="float"?i.cssFloat=r:i[s]=(""+r).trim():i[s]=r+"px"}function Zi(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&&ai(i,u,l)}else for(var d in s)s.hasOwnProperty(d)&&ai(i,d,s[d])}function Ks(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 xr=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"]]),cs=/^[\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 Er(i){return cs.test(""+i)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":i}function Is(){}var xs=null;function ra(i){return i=i.target||i.srcElement||window,i.correspondingUseElement&&(i=i.correspondingUseElement),i.nodeType===3?i.parentNode:i}var on=null,aa=null;function s_(i){var s=ri(i);if(s&&(i=s.stateNode)){var r=i[ni]||null;e:switch(i=s.stateNode,s.type){case"input":if(Fi(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="'+ot(""+s)+'"][type="radio"]'),s=0;s<r.length;s++){var l=r[s];if(l!==i&&l.form===i.form){var u=l[ni]||null;if(!u)throw Error(a(90));Fi(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&&Ne(l)}break e;case"textarea":ze(i,r.value,r.defaultValue);break e;case"select":s=r.value,s!=null&&Le(i,!!r.multiple,s,!1)}}}var nh=!1;function n_(i,s,r){if(nh)return i(s,r);nh=!0;try{var l=i(s);return l}finally{if(nh=!1,(on!==null||aa!==null)&&(Mc(),on&&(s=on,i=aa,aa=on=null,s_(s),i)))for(s=0;s<i.length;s++)s_(i[s])}}function nl(i,s){var r=i.stateNode;if(r===null)return null;var l=r[ni]||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 cn=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),rh=!1;if(cn)try{var rl={};Object.defineProperty(rl,"passive",{get:function(){rh=!0}}),window.addEventListener("test",rl,rl),window.removeEventListener("test",rl,rl)}catch{rh=!1}var zn=null,ah=null,qo=null;function r_(){if(qo)return qo;var i,s=ah,r=s.length,l,u="value"in zn?zn.value:zn.textContent,d=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[d-l];l++);return qo=u.slice(i,1<l?1-l:void 0)}function Wo(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 $o(){return!0}function a_(){return!1}function Qi(i){function s(r,l,u,d,v){this._reactName=r,this._targetInst=u,this.type=l,this.nativeEvent=d,this.target=v,this.currentTarget=null;for(var S in i)i.hasOwnProperty(S)&&(r=i[S],this[S]=r?r(d):d[S]);return this.isDefaultPrevented=(d.defaultPrevented!=null?d.defaultPrevented:d.returnValue===!1)?$o:a_,this.isPropagationStopped=a_,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=$o)},stopPropagation:function(){var r=this.nativeEvent;r&&(r.stopPropagation?r.stopPropagation():typeof r.cancelBubble!="unknown"&&(r.cancelBubble=!0),this.isPropagationStopped=$o)},persist:function(){},isPersistent:$o}),s}var Tr={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(i){return i.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Yo=Qi(Tr),al=y({},Tr,{view:0,detail:0}),h1=Qi(al),lh,oh,ll,Vo=y({},al,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:uh,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!==ll&&(ll&&i.type==="mousemove"?(lh=i.screenX-ll.screenX,oh=i.screenY-ll.screenY):oh=lh=0,ll=i),lh)},movementY:function(i){return"movementY"in i?i.movementY:oh}}),l_=Qi(Vo),d1=y({},Vo,{dataTransfer:0}),f1=Qi(d1),p1=y({},al,{relatedTarget:0}),ch=Qi(p1),m1=y({},Tr,{animationName:0,elapsedTime:0,pseudoElement:0}),_1=Qi(m1),v1=y({},Tr,{clipboardData:function(i){return"clipboardData"in i?i.clipboardData:window.clipboardData}}),g1=Qi(v1),y1=y({},Tr,{data:0}),o_=Qi(y1),b1={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},S1={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"},w1={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function C1(i){var s=this.nativeEvent;return s.getModifierState?s.getModifierState(i):(i=w1[i])?!!s[i]:!1}function uh(){return C1}var x1=y({},al,{key:function(i){if(i.key){var s=b1[i.key]||i.key;if(s!=="Unidentified")return s}return i.type==="keypress"?(i=Wo(i),i===13?"Enter":String.fromCharCode(i)):i.type==="keydown"||i.type==="keyup"?S1[i.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:uh,charCode:function(i){return i.type==="keypress"?Wo(i):0},keyCode:function(i){return i.type==="keydown"||i.type==="keyup"?i.keyCode:0},which:function(i){return i.type==="keypress"?Wo(i):i.type==="keydown"||i.type==="keyup"?i.keyCode:0}}),E1=Qi(x1),T1=y({},Vo,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),c_=Qi(T1),k1=y({},al,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:uh}),D1=Qi(k1),R1=y({},Tr,{propertyName:0,elapsedTime:0,pseudoElement:0}),M1=Qi(R1),N1=y({},Vo,{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}),A1=Qi(N1),L1=y({},Tr,{newState:0,oldState:0}),B1=Qi(L1),O1=[9,13,27,32],hh=cn&&"CompositionEvent"in window,ol=null;cn&&"documentMode"in document&&(ol=document.documentMode);var z1=cn&&"TextEvent"in window&&!ol,u_=cn&&(!hh||ol&&8<ol&&11>=ol),h_=" ",d_=!1;function f_(i,s){switch(i){case"keyup":return O1.indexOf(s.keyCode)!==-1;case"keydown":return s.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function p_(i){return i=i.detail,typeof i=="object"&&"data"in i?i.data:null}var la=!1;function j1(i,s){switch(i){case"compositionend":return p_(s);case"keypress":return s.which!==32?null:(d_=!0,h_);case"textInput":return i=s.data,i===h_&&d_?null:i;default:return null}}function H1(i,s){if(la)return i==="compositionend"||!hh&&f_(i,s)?(i=r_(),qo=ah=zn=null,la=!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 u_&&s.locale!=="ko"?null:s.data;default:return null}}var U1={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 m_(i){var s=i&&i.nodeName&&i.nodeName.toLowerCase();return s==="input"?!!U1[i.type]:s==="textarea"}function __(i,s,r,l){on?aa?aa.push(l):aa=[l]:on=l,s=jc(s,"onChange"),0<s.length&&(r=new Yo("onChange","change",null,r,l),i.push({event:r,listeners:s}))}var cl=null,ul=null;function P1(i){Qg(i,0)}function Xo(i){var s=ws(i);if(Ne(s))return i}function v_(i,s){if(i==="change")return s}var g_=!1;if(cn){var dh;if(cn){var fh="oninput"in document;if(!fh){var y_=document.createElement("div");y_.setAttribute("oninput","return;"),fh=typeof y_.oninput=="function"}dh=fh}else dh=!1;g_=dh&&(!document.documentMode||9<document.documentMode)}function b_(){cl&&(cl.detachEvent("onpropertychange",S_),ul=cl=null)}function S_(i){if(i.propertyName==="value"&&Xo(ul)){var s=[];__(s,ul,i,ra(i)),n_(P1,s)}}function K1(i,s,r){i==="focusin"?(b_(),cl=s,ul=r,cl.attachEvent("onpropertychange",S_)):i==="focusout"&&b_()}function I1(i){if(i==="selectionchange"||i==="keyup"||i==="keydown")return Xo(ul)}function F1(i,s){if(i==="click")return Xo(s)}function q1(i,s){if(i==="input"||i==="change")return Xo(s)}function W1(i,s){return i===s&&(i!==0||1/i===1/s)||i!==i&&s!==s}var us=typeof Object.is=="function"?Object.is:W1;function hl(i,s){if(us(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(!bt.call(s,u)||!us(i[u],s[u]))return!1}return!0}function w_(i){for(;i&&i.firstChild;)i=i.firstChild;return i}function C_(i,s){var r=w_(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=w_(r)}}function x_(i,s){return i&&s?i===s?!0:i&&i.nodeType===3?!1:s&&s.nodeType===3?x_(i,s.parentNode):"contains"in i?i.contains(s):i.compareDocumentPosition?!!(i.compareDocumentPosition(s)&16):!1:!1}function E_(i){i=i!=null&&i.ownerDocument!=null&&i.ownerDocument.defaultView!=null?i.ownerDocument.defaultView:window;for(var s=Ae(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=Ae(i.document)}return s}function ph(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 $1=cn&&"documentMode"in document&&11>=document.documentMode,oa=null,mh=null,dl=null,_h=!1;function T_(i,s,r){var l=r.window===r?r.document:r.nodeType===9?r:r.ownerDocument;_h||oa==null||oa!==Ae(l)||(l=oa,"selectionStart"in l&&ph(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}),dl&&hl(dl,l)||(dl=l,l=jc(mh,"onSelect"),0<l.length&&(s=new Yo("onSelect","select",null,s,r),i.push({event:s,listeners:l}),s.target=oa)))}function kr(i,s){var r={};return r[i.toLowerCase()]=s.toLowerCase(),r["Webkit"+i]="webkit"+s,r["Moz"+i]="moz"+s,r}var ca={animationend:kr("Animation","AnimationEnd"),animationiteration:kr("Animation","AnimationIteration"),animationstart:kr("Animation","AnimationStart"),transitionrun:kr("Transition","TransitionRun"),transitionstart:kr("Transition","TransitionStart"),transitioncancel:kr("Transition","TransitionCancel"),transitionend:kr("Transition","TransitionEnd")},vh={},k_={};cn&&(k_=document.createElement("div").style,"AnimationEvent"in window||(delete ca.animationend.animation,delete ca.animationiteration.animation,delete ca.animationstart.animation),"TransitionEvent"in window||delete ca.transitionend.transition);function Dr(i){if(vh[i])return vh[i];if(!ca[i])return i;var s=ca[i],r;for(r in s)if(s.hasOwnProperty(r)&&r in k_)return vh[i]=s[r];return i}var D_=Dr("animationend"),R_=Dr("animationiteration"),M_=Dr("animationstart"),Y1=Dr("transitionrun"),V1=Dr("transitionstart"),X1=Dr("transitioncancel"),N_=Dr("transitionend"),A_=new Map,gh="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(" ");gh.push("scrollEnd");function Fs(i,s){A_.set(i,s),os(s,[i])}var Go=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)},Es=[],ua=0,yh=0;function Zo(){for(var i=ua,s=yh=ua=0;s<i;){var r=Es[s];Es[s++]=null;var l=Es[s];Es[s++]=null;var u=Es[s];Es[s++]=null;var d=Es[s];if(Es[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}d!==0&&L_(r,u,d)}}function Qo(i,s,r,l){Es[ua++]=i,Es[ua++]=s,Es[ua++]=r,Es[ua++]=l,yh|=l,i.lanes|=l,i=i.alternate,i!==null&&(i.lanes|=l)}function bh(i,s,r,l){return Qo(i,s,r,l),Jo(i)}function Rr(i,s){return Qo(i,null,null,s),Jo(i)}function L_(i,s,r){i.lanes|=r;var l=i.alternate;l!==null&&(l.lanes|=r);for(var u=!1,d=i.return;d!==null;)d.childLanes|=r,l=d.alternate,l!==null&&(l.childLanes|=r),d.tag===22&&(i=d.stateNode,i===null||i._visibility&1||(u=!0)),i=d,d=d.return;return i.tag===3?(d=i.stateNode,u&&s!==null&&(u=31-Lt(r),i=d.hiddenUpdates,l=i[u],l===null?i[u]=[s]:l.push(s),s.lane=r|536870912),d):null}function Jo(i){if(50<Bl)throw Bl=0,Rd=null,Error(a(185));for(var s=i.return;s!==null;)i=s,s=i.return;return i.tag===3?i.stateNode:null}var ha={};function G1(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 hs(i,s,r,l){return new G1(i,s,r,l)}function Sh(i){return i=i.prototype,!(!i||!i.isReactComponent)}function un(i,s){var r=i.alternate;return r===null?(r=hs(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 B_(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 ec(i,s,r,l,u,d){var v=0;if(l=i,typeof i=="function")Sh(i)&&(v=1);else if(typeof i=="string")v=tx(i,r,he.current)?26:i==="html"||i==="head"||i==="body"?27:5;else e:switch(i){case de:return i=hs(31,r,s,u),i.elementType=de,i.lanes=d,i;case E:return Mr(r.children,u,d,s);case B:v=8,u|=24;break;case T:return i=hs(12,r,s,u|2),i.elementType=T,i.lanes=d,i;case re:return i=hs(13,r,s,u),i.elementType=re,i.lanes=d,i;case ee:return i=hs(19,r,s,u),i.elementType=ee,i.lanes=d,i;default:if(typeof i=="object"&&i!==null)switch(i.$$typeof){case K:v=10;break e;case Y:v=9;break e;case X:v=11;break e;case ie:v=14;break e;case le:v=16,l=null;break e}v=29,r=Error(a(130,i===null?"null":typeof i,"")),l=null}return s=hs(v,r,s,u),s.elementType=i,s.type=l,s.lanes=d,s}function Mr(i,s,r,l){return i=hs(7,i,l,s),i.lanes=r,i}function wh(i,s,r){return i=hs(6,i,null,s),i.lanes=r,i}function O_(i){var s=hs(18,null,null,0);return s.stateNode=i,s}function Ch(i,s,r){return s=hs(4,i.children!==null?i.children:[],i.key,s),s.lanes=r,s.stateNode={containerInfo:i.containerInfo,pendingChildren:null,implementation:i.implementation},s}var z_=new WeakMap;function Ts(i,s){if(typeof i=="object"&&i!==null){var r=z_.get(i);return r!==void 0?r:(s={value:i,source:s,stack:$e(s)},z_.set(i,s),s)}return{value:i,source:s,stack:$e(s)}}var da=[],fa=0,tc=null,fl=0,ks=[],Ds=0,jn=null,Gs=1,Zs="";function hn(i,s){da[fa++]=fl,da[fa++]=tc,tc=i,fl=s}function j_(i,s,r){ks[Ds++]=Gs,ks[Ds++]=Zs,ks[Ds++]=jn,jn=i;var l=Gs;i=Zs;var u=32-Lt(l)-1;l&=~(1<<u),r+=1;var d=32-Lt(s)+u;if(30<d){var v=u-u%5;d=(l&(1<<v)-1).toString(32),l>>=v,u-=v,Gs=1<<32-Lt(s)+u|r<<u|l,Zs=d+i}else Gs=1<<d|r<<u|l,Zs=i}function xh(i){i.return!==null&&(hn(i,1),j_(i,1,0))}function Eh(i){for(;i===tc;)tc=da[--fa],da[fa]=null,fl=da[--fa],da[fa]=null;for(;i===jn;)jn=ks[--Ds],ks[Ds]=null,Zs=ks[--Ds],ks[Ds]=null,Gs=ks[--Ds],ks[Ds]=null}function H_(i,s){ks[Ds++]=Gs,ks[Ds++]=Zs,ks[Ds++]=jn,Gs=s.id,Zs=s.overflow,jn=i}var ki=null,Ct=null,et=!1,Hn=null,Rs=!1,Th=Error(a(519));function Un(i){var s=Error(a(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw pl(Ts(s,i)),Th}function U_(i){var s=i.stateNode,r=i.type,l=i.memoizedProps;switch(s[Ot]=i,s[ni]=l,r){case"dialog":Ze("cancel",s),Ze("close",s);break;case"iframe":case"object":case"embed":Ze("load",s);break;case"video":case"audio":for(r=0;r<zl.length;r++)Ze(zl[r],s);break;case"source":Ze("error",s);break;case"img":case"image":case"link":Ze("error",s),Ze("load",s);break;case"details":Ze("toggle",s);break;case"input":Ze("invalid",s),A(s,l.value,l.defaultValue,l.checked,l.defaultChecked,l.type,l.name,!0);break;case"select":Ze("invalid",s);break;case"textarea":Ze("invalid",s),Ye(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||iy(s.textContent,r)?(l.popover!=null&&(Ze("beforetoggle",s),Ze("toggle",s)),l.onScroll!=null&&Ze("scroll",s),l.onScrollEnd!=null&&Ze("scrollend",s),l.onClick!=null&&(s.onclick=Is),s=!0):s=!1,s||Un(i,!0)}function P_(i){for(ki=i.return;ki;)switch(ki.tag){case 5:case 31:case 13:Rs=!1;return;case 27:case 3:Rs=!0;return;default:ki=ki.return}}function pa(i){if(i!==ki)return!1;if(!et)return P_(i),et=!0,!1;var s=i.tag,r;if((r=s!==3&&s!==27)&&((r=s===5)&&(r=i.type,r=!(r!=="form"&&r!=="button")||qd(i.type,i.memoizedProps)),r=!r),r&&Ct&&Un(i),P_(i),s===13){if(i=i.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(a(317));Ct=hy(i)}else if(s===31){if(i=i.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(a(317));Ct=hy(i)}else s===27?(s=Ct,Jn(i.type)?(i=Xd,Xd=null,Ct=i):Ct=s):Ct=ki?Ns(i.stateNode.nextSibling):null;return!0}function Nr(){Ct=ki=null,et=!1}function kh(){var i=Hn;return i!==null&&(is===null?is=i:is.push.apply(is,i),Hn=null),i}function pl(i){Hn===null?Hn=[i]:Hn.push(i)}var Dh=D(null),Ar=null,dn=null;function Pn(i,s,r){ne(Dh,s._currentValue),s._currentValue=r}function fn(i){i._currentValue=Dh.current,W(Dh)}function Rh(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 Mh(i,s,r,l){var u=i.child;for(u!==null&&(u.return=i);u!==null;){var d=u.dependencies;if(d!==null){var v=u.child;d=d.firstContext;e:for(;d!==null;){var S=d;d=u;for(var R=0;R<s.length;R++)if(S.context===s[R]){d.lanes|=r,S=d.alternate,S!==null&&(S.lanes|=r),Rh(d.return,r,i),l||(v=null);break e}d=S.next}}else if(u.tag===18){if(v=u.return,v===null)throw Error(a(341));v.lanes|=r,d=v.alternate,d!==null&&(d.lanes|=r),Rh(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 ma(i,s,r,l){i=null;for(var u=s,d=!1;u!==null;){if(!d){if((u.flags&524288)!==0)d=!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 S=u.type;us(u.pendingProps.value,v.value)||(i!==null?i.push(S):i=[S])}}else if(u===ke.current){if(v=u.alternate,v===null)throw Error(a(387));v.memoizedState.memoizedState!==u.memoizedState.memoizedState&&(i!==null?i.push(Kl):i=[Kl])}u=u.return}i!==null&&Mh(s,i,r,l),s.flags|=262144}function ic(i){for(i=i.firstContext;i!==null;){if(!us(i.context._currentValue,i.memoizedValue))return!0;i=i.next}return!1}function Lr(i){Ar=i,dn=null,i=i.dependencies,i!==null&&(i.firstContext=null)}function Di(i){return K_(Ar,i)}function sc(i,s){return Ar===null&&Lr(i),K_(i,s)}function K_(i,s){var r=s._currentValue;if(s={context:s,memoizedValue:r,next:null},dn===null){if(i===null)throw Error(a(308));dn=s,i.dependencies={lanes:0,firstContext:s},i.flags|=524288}else dn=dn.next=s;return r}var Z1=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()})}},Q1=e.unstable_scheduleCallback,J1=e.unstable_NormalPriority,Xt={$$typeof:K,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Nh(){return{controller:new Z1,data:new Map,refCount:0}}function ml(i){i.refCount--,i.refCount===0&&Q1(J1,function(){i.controller.abort()})}var _l=null,Ah=0,_a=0,va=null;function eC(i,s){if(_l===null){var r=_l=[];Ah=0,_a=Od(),va={status:"pending",value:void 0,then:function(l){r.push(l)}}}return Ah++,s.then(I_,I_),s}function I_(){if(--Ah===0&&_l!==null){va!==null&&(va.status="fulfilled");var i=_l;_l=null,_a=0,va=null;for(var s=0;s<i.length;s++)(0,i[s])()}}function tC(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 F_=M.S;M.S=function(i,s){Tg=Oe(),typeof s=="object"&&s!==null&&typeof s.then=="function"&&eC(i,s),F_!==null&&F_(i,s)};var Br=D(null);function Lh(){var i=Br.current;return i!==null?i:gt.pooledCache}function nc(i,s){s===null?ne(Br,Br.current):ne(Br,s.pool)}function q_(){var i=Lh();return i===null?null:{parent:Xt._currentValue,pool:i}}var ga=Error(a(460)),Bh=Error(a(474)),rc=Error(a(542)),ac={then:function(){}};function W_(i){return i=i.status,i==="fulfilled"||i==="rejected"}function $_(i,s,r){switch(r=i[r],r===void 0?i.push(s):r!==s&&(s.then(Is,Is),s=r),s.status){case"fulfilled":return s.value;case"rejected":throw i=s.reason,V_(i),i;default:if(typeof s.status=="string")s.then(Is,Is);else{if(i=gt,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,V_(i),i}throw zr=s,ga}}function Or(i){try{var s=i._init;return s(i._payload)}catch(r){throw r!==null&&typeof r=="object"&&typeof r.then=="function"?(zr=r,ga):r}}var zr=null;function Y_(){if(zr===null)throw Error(a(459));var i=zr;return zr=null,i}function V_(i){if(i===ga||i===rc)throw Error(a(483))}var ya=null,vl=0;function lc(i){var s=vl;return vl+=1,ya===null&&(ya=[]),$_(ya,i,s)}function gl(i,s){s=s.props.ref,i.ref=s!==void 0?s:null}function oc(i,s){throw s.$$typeof===w?Error(a(525)):(i=Object.prototype.toString.call(s),Error(a(31,i==="[object Object]"?"object with keys {"+Object.keys(s).join(", ")+"}":i)))}function X_(i){function s(H,L){if(i){var I=H.deletions;I===null?(H.deletions=[L],H.flags|=16):I.push(L)}}function r(H,L){if(!i)return null;for(;L!==null;)s(H,L),L=L.sibling;return null}function l(H){for(var L=new Map;H!==null;)H.key!==null?L.set(H.key,H):L.set(H.index,H),H=H.sibling;return L}function u(H,L){return H=un(H,L),H.index=0,H.sibling=null,H}function d(H,L,I){return H.index=I,i?(I=H.alternate,I!==null?(I=I.index,I<L?(H.flags|=67108866,L):I):(H.flags|=67108866,L)):(H.flags|=1048576,L)}function v(H){return i&&H.alternate===null&&(H.flags|=67108866),H}function S(H,L,I,ae){return L===null||L.tag!==6?(L=wh(I,H.mode,ae),L.return=H,L):(L=u(L,I),L.return=H,L)}function R(H,L,I,ae){var Be=I.type;return Be===E?se(H,L,I.props.children,ae,I.key):L!==null&&(L.elementType===Be||typeof Be=="object"&&Be!==null&&Be.$$typeof===le&&Or(Be)===L.type)?(L=u(L,I.props),gl(L,I),L.return=H,L):(L=ec(I.type,I.key,I.props,null,H.mode,ae),gl(L,I),L.return=H,L)}function F(H,L,I,ae){return L===null||L.tag!==4||L.stateNode.containerInfo!==I.containerInfo||L.stateNode.implementation!==I.implementation?(L=Ch(I,H.mode,ae),L.return=H,L):(L=u(L,I.children||[]),L.return=H,L)}function se(H,L,I,ae,Be){return L===null||L.tag!==7?(L=Mr(I,H.mode,ae,Be),L.return=H,L):(L=u(L,I),L.return=H,L)}function ce(H,L,I){if(typeof L=="string"&&L!==""||typeof L=="number"||typeof L=="bigint")return L=wh(""+L,H.mode,I),L.return=H,L;if(typeof L=="object"&&L!==null){switch(L.$$typeof){case x:return I=ec(L.type,L.key,L.props,null,H.mode,I),gl(I,L),I.return=H,I;case C:return L=Ch(L,H.mode,I),L.return=H,L;case le:return L=Or(L),ce(H,L,I)}if(G(L)||P(L))return L=Mr(L,H.mode,I,null),L.return=H,L;if(typeof L.then=="function")return ce(H,lc(L),I);if(L.$$typeof===K)return ce(H,sc(H,L),I);oc(H,L)}return null}function $(H,L,I,ae){var Be=L!==null?L.key:null;if(typeof I=="string"&&I!==""||typeof I=="number"||typeof I=="bigint")return Be!==null?null:S(H,L,""+I,ae);if(typeof I=="object"&&I!==null){switch(I.$$typeof){case x:return I.key===Be?R(H,L,I,ae):null;case C:return I.key===Be?F(H,L,I,ae):null;case le:return I=Or(I),$(H,L,I,ae)}if(G(I)||P(I))return Be!==null?null:se(H,L,I,ae,null);if(typeof I.then=="function")return $(H,L,lc(I),ae);if(I.$$typeof===K)return $(H,L,sc(H,I),ae);oc(H,I)}return null}function Z(H,L,I,ae,Be){if(typeof ae=="string"&&ae!==""||typeof ae=="number"||typeof ae=="bigint")return H=H.get(I)||null,S(L,H,""+ae,Be);if(typeof ae=="object"&&ae!==null){switch(ae.$$typeof){case x:return H=H.get(ae.key===null?I:ae.key)||null,R(L,H,ae,Be);case C:return H=H.get(ae.key===null?I:ae.key)||null,F(L,H,ae,Be);case le:return ae=Or(ae),Z(H,L,I,ae,Be)}if(G(ae)||P(ae))return H=H.get(I)||null,se(L,H,ae,Be,null);if(typeof ae.then=="function")return Z(H,L,I,lc(ae),Be);if(ae.$$typeof===K)return Z(H,L,I,sc(L,ae),Be);oc(L,ae)}return null}function Ee(H,L,I,ae){for(var Be=null,nt=null,Re=L,We=L=0,Je=null;Re!==null&&We<I.length;We++){Re.index>We?(Je=Re,Re=null):Je=Re.sibling;var rt=$(H,Re,I[We],ae);if(rt===null){Re===null&&(Re=Je);break}i&&Re&&rt.alternate===null&&s(H,Re),L=d(rt,L,We),nt===null?Be=rt:nt.sibling=rt,nt=rt,Re=Je}if(We===I.length)return r(H,Re),et&&hn(H,We),Be;if(Re===null){for(;We<I.length;We++)Re=ce(H,I[We],ae),Re!==null&&(L=d(Re,L,We),nt===null?Be=Re:nt.sibling=Re,nt=Re);return et&&hn(H,We),Be}for(Re=l(Re);We<I.length;We++)Je=Z(Re,H,We,I[We],ae),Je!==null&&(i&&Je.alternate!==null&&Re.delete(Je.key===null?We:Je.key),L=d(Je,L,We),nt===null?Be=Je:nt.sibling=Je,nt=Je);return i&&Re.forEach(function(nr){return s(H,nr)}),et&&hn(H,We),Be}function je(H,L,I,ae){if(I==null)throw Error(a(151));for(var Be=null,nt=null,Re=L,We=L=0,Je=null,rt=I.next();Re!==null&&!rt.done;We++,rt=I.next()){Re.index>We?(Je=Re,Re=null):Je=Re.sibling;var nr=$(H,Re,rt.value,ae);if(nr===null){Re===null&&(Re=Je);break}i&&Re&&nr.alternate===null&&s(H,Re),L=d(nr,L,We),nt===null?Be=nr:nt.sibling=nr,nt=nr,Re=Je}if(rt.done)return r(H,Re),et&&hn(H,We),Be;if(Re===null){for(;!rt.done;We++,rt=I.next())rt=ce(H,rt.value,ae),rt!==null&&(L=d(rt,L,We),nt===null?Be=rt:nt.sibling=rt,nt=rt);return et&&hn(H,We),Be}for(Re=l(Re);!rt.done;We++,rt=I.next())rt=Z(Re,H,We,rt.value,ae),rt!==null&&(i&&rt.alternate!==null&&Re.delete(rt.key===null?We:rt.key),L=d(rt,L,We),nt===null?Be=rt:nt.sibling=rt,nt=rt);return i&&Re.forEach(function(dx){return s(H,dx)}),et&&hn(H,We),Be}function pt(H,L,I,ae){if(typeof I=="object"&&I!==null&&I.type===E&&I.key===null&&(I=I.props.children),typeof I=="object"&&I!==null){switch(I.$$typeof){case x:e:{for(var Be=I.key;L!==null;){if(L.key===Be){if(Be=I.type,Be===E){if(L.tag===7){r(H,L.sibling),ae=u(L,I.props.children),ae.return=H,H=ae;break e}}else if(L.elementType===Be||typeof Be=="object"&&Be!==null&&Be.$$typeof===le&&Or(Be)===L.type){r(H,L.sibling),ae=u(L,I.props),gl(ae,I),ae.return=H,H=ae;break e}r(H,L);break}else s(H,L);L=L.sibling}I.type===E?(ae=Mr(I.props.children,H.mode,ae,I.key),ae.return=H,H=ae):(ae=ec(I.type,I.key,I.props,null,H.mode,ae),gl(ae,I),ae.return=H,H=ae)}return v(H);case C:e:{for(Be=I.key;L!==null;){if(L.key===Be)if(L.tag===4&&L.stateNode.containerInfo===I.containerInfo&&L.stateNode.implementation===I.implementation){r(H,L.sibling),ae=u(L,I.children||[]),ae.return=H,H=ae;break e}else{r(H,L);break}else s(H,L);L=L.sibling}ae=Ch(I,H.mode,ae),ae.return=H,H=ae}return v(H);case le:return I=Or(I),pt(H,L,I,ae)}if(G(I))return Ee(H,L,I,ae);if(P(I)){if(Be=P(I),typeof Be!="function")throw Error(a(150));return I=Be.call(I),je(H,L,I,ae)}if(typeof I.then=="function")return pt(H,L,lc(I),ae);if(I.$$typeof===K)return pt(H,L,sc(H,I),ae);oc(H,I)}return typeof I=="string"&&I!==""||typeof I=="number"||typeof I=="bigint"?(I=""+I,L!==null&&L.tag===6?(r(H,L.sibling),ae=u(L,I),ae.return=H,H=ae):(r(H,L),ae=wh(I,H.mode,ae),ae.return=H,H=ae),v(H)):r(H,L)}return function(H,L,I,ae){try{vl=0;var Be=pt(H,L,I,ae);return ya=null,Be}catch(Re){if(Re===ga||Re===rc)throw Re;var nt=hs(29,Re,null,H.mode);return nt.lanes=ae,nt.return=H,nt}}}var jr=X_(!0),G_=X_(!1),Kn=!1;function Oh(i){i.updateQueue={baseState:i.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function zh(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 In(i){return{lane:i,tag:0,payload:null,callback:null,next:null}}function Fn(i,s,r){var l=i.updateQueue;if(l===null)return null;if(l=l.shared,(at&2)!==0){var u=l.pending;return u===null?s.next=s:(s.next=u.next,u.next=s),l.pending=s,s=Jo(i),L_(i,null,r),s}return Qo(i,l,s,r),Jo(i)}function yl(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,Kt(i,r)}}function jh(i,s){var r=i.updateQueue,l=i.alternate;if(l!==null&&(l=l.updateQueue,r===l)){var u=null,d=null;if(r=r.firstBaseUpdate,r!==null){do{var v={lane:r.lane,tag:r.tag,payload:r.payload,callback:null,next:null};d===null?u=d=v:d=d.next=v,r=r.next}while(r!==null);d===null?u=d=s:d=d.next=s}else u=d=s;r={baseState:l.baseState,firstBaseUpdate:u,lastBaseUpdate:d,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 Hh=!1;function bl(){if(Hh){var i=va;if(i!==null)throw i}}function Sl(i,s,r,l){Hh=!1;var u=i.updateQueue;Kn=!1;var d=u.firstBaseUpdate,v=u.lastBaseUpdate,S=u.shared.pending;if(S!==null){u.shared.pending=null;var R=S,F=R.next;R.next=null,v===null?d=F:v.next=F,v=R;var se=i.alternate;se!==null&&(se=se.updateQueue,S=se.lastBaseUpdate,S!==v&&(S===null?se.firstBaseUpdate=F:S.next=F,se.lastBaseUpdate=R))}if(d!==null){var ce=u.baseState;v=0,se=F=R=null,S=d;do{var $=S.lane&-536870913,Z=$!==S.lane;if(Z?(Qe&$)===$:(l&$)===$){$!==0&&$===_a&&(Hh=!0),se!==null&&(se=se.next={lane:0,tag:S.tag,payload:S.payload,callback:null,next:null});e:{var Ee=i,je=S;$=s;var pt=r;switch(je.tag){case 1:if(Ee=je.payload,typeof Ee=="function"){ce=Ee.call(pt,ce,$);break e}ce=Ee;break e;case 3:Ee.flags=Ee.flags&-65537|128;case 0:if(Ee=je.payload,$=typeof Ee=="function"?Ee.call(pt,ce,$):Ee,$==null)break e;ce=y({},ce,$);break e;case 2:Kn=!0}}$=S.callback,$!==null&&(i.flags|=64,Z&&(i.flags|=8192),Z=u.callbacks,Z===null?u.callbacks=[$]:Z.push($))}else Z={lane:$,tag:S.tag,payload:S.payload,callback:S.callback,next:null},se===null?(F=se=Z,R=ce):se=se.next=Z,v|=$;if(S=S.next,S===null){if(S=u.shared.pending,S===null)break;Z=S,S=Z.next,Z.next=null,u.lastBaseUpdate=Z,u.shared.pending=null}}while(!0);se===null&&(R=ce),u.baseState=R,u.firstBaseUpdate=F,u.lastBaseUpdate=se,d===null&&(u.shared.lanes=0),Vn|=v,i.lanes=v,i.memoizedState=ce}}function Z_(i,s){if(typeof i!="function")throw Error(a(191,i));i.call(s)}function Q_(i,s){var r=i.callbacks;if(r!==null)for(i.callbacks=null,i=0;i<r.length;i++)Z_(r[i],s)}var ba=D(null),cc=D(0);function J_(i,s){i=wn,ne(cc,i),ne(ba,s),wn=i|s.baseLanes}function Uh(){ne(cc,wn),ne(ba,ba.current)}function Ph(){wn=cc.current,W(ba),W(cc)}var ds=D(null),Ms=null;function qn(i){var s=i.alternate;ne(It,It.current&1),ne(ds,i),Ms===null&&(s===null||ba.current!==null||s.memoizedState!==null)&&(Ms=i)}function Kh(i){ne(It,It.current),ne(ds,i),Ms===null&&(Ms=i)}function ev(i){i.tag===22?(ne(It,It.current),ne(ds,i),Ms===null&&(Ms=i)):Wn()}function Wn(){ne(It,It.current),ne(ds,ds.current)}function fs(i){W(ds),Ms===i&&(Ms=null),W(It)}var It=D(0);function uc(i){for(var s=i;s!==null;){if(s.tag===13){var r=s.memoizedState;if(r!==null&&(r=r.dehydrated,r===null||Yd(r)||Vd(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 pn=0,qe=null,dt=null,Gt=null,hc=!1,Sa=!1,Hr=!1,dc=0,wl=0,wa=null,iC=0;function zt(){throw Error(a(321))}function Ih(i,s){if(s===null)return!1;for(var r=0;r<s.length&&r<i.length;r++)if(!us(i[r],s[r]))return!1;return!0}function Fh(i,s,r,l,u,d){return pn=d,qe=s,s.memoizedState=null,s.updateQueue=null,s.lanes=0,M.H=i===null||i.memoizedState===null?jv:nd,Hr=!1,d=r(l,u),Hr=!1,Sa&&(d=iv(s,r,l,u)),tv(i),d}function tv(i){M.H=El;var s=dt!==null&&dt.next!==null;if(pn=0,Gt=dt=qe=null,hc=!1,wl=0,wa=null,s)throw Error(a(300));i===null||Zt||(i=i.dependencies,i!==null&&ic(i)&&(Zt=!0))}function iv(i,s,r,l){qe=i;var u=0;do{if(Sa&&(wa=null),wl=0,Sa=!1,25<=u)throw Error(a(301));if(u+=1,Gt=dt=null,i.updateQueue!=null){var d=i.updateQueue;d.lastEffect=null,d.events=null,d.stores=null,d.memoCache!=null&&(d.memoCache.index=0)}M.H=Hv,d=s(r,l)}while(Sa);return d}function sC(){var i=M.H,s=i.useState()[0];return s=typeof s.then=="function"?Cl(s):s,i=i.useState()[0],(dt!==null?dt.memoizedState:null)!==i&&(qe.flags|=1024),s}function qh(){var i=dc!==0;return dc=0,i}function Wh(i,s,r){s.updateQueue=i.updateQueue,s.flags&=-2053,i.lanes&=~r}function $h(i){if(hc){for(i=i.memoizedState;i!==null;){var s=i.queue;s!==null&&(s.pending=null),i=i.next}hc=!1}pn=0,Gt=dt=qe=null,Sa=!1,wl=dc=0,wa=null}function qi(){var i={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Gt===null?qe.memoizedState=Gt=i:Gt=Gt.next=i,Gt}function Ft(){if(dt===null){var i=qe.alternate;i=i!==null?i.memoizedState:null}else i=dt.next;var s=Gt===null?qe.memoizedState:Gt.next;if(s!==null)Gt=s,dt=i;else{if(i===null)throw qe.alternate===null?Error(a(467)):Error(a(310));dt=i,i={memoizedState:dt.memoizedState,baseState:dt.baseState,baseQueue:dt.baseQueue,queue:dt.queue,next:null},Gt===null?qe.memoizedState=Gt=i:Gt=Gt.next=i}return Gt}function fc(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Cl(i){var s=wl;return wl+=1,wa===null&&(wa=[]),i=$_(wa,i,s),s=qe,(Gt===null?s.memoizedState:Gt.next)===null&&(s=s.alternate,M.H=s===null||s.memoizedState===null?jv:nd),i}function pc(i){if(i!==null&&typeof i=="object"){if(typeof i.then=="function")return Cl(i);if(i.$$typeof===K)return Di(i)}throw Error(a(438,String(i)))}function Yh(i){var s=null,r=qe.updateQueue;if(r!==null&&(s=r.memoCache),s==null){var l=qe.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=fc(),qe.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]=N;return s.index++,r}function mn(i,s){return typeof s=="function"?s(i):s}function mc(i){var s=Ft();return Vh(s,dt,i)}function Vh(i,s,r){var l=i.queue;if(l===null)throw Error(a(311));l.lastRenderedReducer=r;var u=i.baseQueue,d=l.pending;if(d!==null){if(u!==null){var v=u.next;u.next=d.next,d.next=v}s.baseQueue=u=d,l.pending=null}if(d=i.baseState,u===null)i.memoizedState=d;else{s=u.next;var S=v=null,R=null,F=s,se=!1;do{var ce=F.lane&-536870913;if(ce!==F.lane?(Qe&ce)===ce:(pn&ce)===ce){var $=F.revertLane;if($===0)R!==null&&(R=R.next={lane:0,revertLane:0,gesture:null,action:F.action,hasEagerState:F.hasEagerState,eagerState:F.eagerState,next:null}),ce===_a&&(se=!0);else if((pn&$)===$){F=F.next,$===_a&&(se=!0);continue}else ce={lane:0,revertLane:F.revertLane,gesture:null,action:F.action,hasEagerState:F.hasEagerState,eagerState:F.eagerState,next:null},R===null?(S=R=ce,v=d):R=R.next=ce,qe.lanes|=$,Vn|=$;ce=F.action,Hr&&r(d,ce),d=F.hasEagerState?F.eagerState:r(d,ce)}else $={lane:ce,revertLane:F.revertLane,gesture:F.gesture,action:F.action,hasEagerState:F.hasEagerState,eagerState:F.eagerState,next:null},R===null?(S=R=$,v=d):R=R.next=$,qe.lanes|=ce,Vn|=ce;F=F.next}while(F!==null&&F!==s);if(R===null?v=d:R.next=S,!us(d,i.memoizedState)&&(Zt=!0,se&&(r=va,r!==null)))throw r;i.memoizedState=d,i.baseState=v,i.baseQueue=R,l.lastRenderedState=d}return u===null&&(l.lanes=0),[i.memoizedState,l.dispatch]}function Xh(i){var s=Ft(),r=s.queue;if(r===null)throw Error(a(311));r.lastRenderedReducer=i;var l=r.dispatch,u=r.pending,d=s.memoizedState;if(u!==null){r.pending=null;var v=u=u.next;do d=i(d,v.action),v=v.next;while(v!==u);us(d,s.memoizedState)||(Zt=!0),s.memoizedState=d,s.baseQueue===null&&(s.baseState=d),r.lastRenderedState=d}return[d,l]}function sv(i,s,r){var l=qe,u=Ft(),d=et;if(d){if(r===void 0)throw Error(a(407));r=r()}else r=s();var v=!us((dt||u).memoizedState,r);if(v&&(u.memoizedState=r,Zt=!0),u=u.queue,Qh(av.bind(null,l,u,i),[i]),u.getSnapshot!==s||v||Gt!==null&&Gt.memoizedState.tag&1){if(l.flags|=2048,Ca(9,{destroy:void 0},rv.bind(null,l,u,r,s),null),gt===null)throw Error(a(349));d||(pn&127)!==0||nv(l,s,r)}return r}function nv(i,s,r){i.flags|=16384,i={getSnapshot:s,value:r},s=qe.updateQueue,s===null?(s=fc(),qe.updateQueue=s,s.stores=[i]):(r=s.stores,r===null?s.stores=[i]:r.push(i))}function rv(i,s,r,l){s.value=r,s.getSnapshot=l,lv(s)&&ov(i)}function av(i,s,r){return r(function(){lv(s)&&ov(i)})}function lv(i){var s=i.getSnapshot;i=i.value;try{var r=s();return!us(i,r)}catch{return!0}}function ov(i){var s=Rr(i,2);s!==null&&ss(s,i,2)}function Gh(i){var s=qi();if(typeof i=="function"){var r=i;if(i=r(),Hr){wi(!0);try{r()}finally{wi(!1)}}}return s.memoizedState=s.baseState=i,s.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:mn,lastRenderedState:i},s}function cv(i,s,r,l){return i.baseState=r,Vh(i,dt,typeof l=="function"?l:mn)}function nC(i,s,r,l,u){if(gc(i))throw Error(a(485));if(i=s.action,i!==null){var d={payload:u,action:i,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(v){d.listeners.push(v)}};M.T!==null?r(!0):d.isTransition=!1,l(d),r=s.pending,r===null?(d.next=s.pending=d,uv(s,d)):(d.next=r.next,s.pending=r.next=d)}}function uv(i,s){var r=s.action,l=s.payload,u=i.state;if(s.isTransition){var d=M.T,v={};M.T=v;try{var S=r(u,l),R=M.S;R!==null&&R(v,S),hv(i,s,S)}catch(F){Zh(i,s,F)}finally{d!==null&&v.types!==null&&(d.types=v.types),M.T=d}}else try{d=r(u,l),hv(i,s,d)}catch(F){Zh(i,s,F)}}function hv(i,s,r){r!==null&&typeof r=="object"&&typeof r.then=="function"?r.then(function(l){dv(i,s,l)},function(l){return Zh(i,s,l)}):dv(i,s,r)}function dv(i,s,r){s.status="fulfilled",s.value=r,fv(s),i.state=r,s=i.pending,s!==null&&(r=s.next,r===s?i.pending=null:(r=r.next,s.next=r,uv(i,r)))}function Zh(i,s,r){var l=i.pending;if(i.pending=null,l!==null){l=l.next;do s.status="rejected",s.reason=r,fv(s),s=s.next;while(s!==l)}i.action=null}function fv(i){i=i.listeners;for(var s=0;s<i.length;s++)(0,i[s])()}function pv(i,s){return s}function mv(i,s){if(et){var r=gt.formState;if(r!==null){e:{var l=qe;if(et){if(Ct){t:{for(var u=Ct,d=Rs;u.nodeType!==8;){if(!d){u=null;break t}if(u=Ns(u.nextSibling),u===null){u=null;break t}}d=u.data,u=d==="F!"||d==="F"?u:null}if(u){Ct=Ns(u.nextSibling),l=u.data==="F!";break e}}Un(l)}l=!1}l&&(s=r[0])}}return r=qi(),r.memoizedState=r.baseState=s,l={pending:null,lanes:0,dispatch:null,lastRenderedReducer:pv,lastRenderedState:s},r.queue=l,r=Bv.bind(null,qe,l),l.dispatch=r,l=Gh(!1),d=sd.bind(null,qe,!1,l.queue),l=qi(),u={state:s,dispatch:null,action:i,pending:null},l.queue=u,r=nC.bind(null,qe,u,d,r),u.dispatch=r,l.memoizedState=i,[s,r,!1]}function _v(i){var s=Ft();return vv(s,dt,i)}function vv(i,s,r){if(s=Vh(i,s,pv)[0],i=mc(mn)[0],typeof s=="object"&&s!==null&&typeof s.then=="function")try{var l=Cl(s)}catch(v){throw v===ga?rc:v}else l=s;s=Ft();var u=s.queue,d=u.dispatch;return r!==s.memoizedState&&(qe.flags|=2048,Ca(9,{destroy:void 0},rC.bind(null,u,r),null)),[l,d,i]}function rC(i,s){i.action=s}function gv(i){var s=Ft(),r=dt;if(r!==null)return vv(s,r,i);Ft(),s=s.memoizedState,r=Ft();var l=r.queue.dispatch;return r.memoizedState=i,[s,l,!1]}function Ca(i,s,r,l){return i={tag:i,create:r,deps:l,inst:s,next:null},s=qe.updateQueue,s===null&&(s=fc(),qe.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 yv(){return Ft().memoizedState}function _c(i,s,r,l){var u=qi();qe.flags|=i,u.memoizedState=Ca(1|s,{destroy:void 0},r,l===void 0?null:l)}function vc(i,s,r,l){var u=Ft();l=l===void 0?null:l;var d=u.memoizedState.inst;dt!==null&&l!==null&&Ih(l,dt.memoizedState.deps)?u.memoizedState=Ca(s,d,r,l):(qe.flags|=i,u.memoizedState=Ca(1|s,d,r,l))}function bv(i,s){_c(8390656,8,i,s)}function Qh(i,s){vc(2048,8,i,s)}function aC(i){qe.flags|=4;var s=qe.updateQueue;if(s===null)s=fc(),qe.updateQueue=s,s.events=[i];else{var r=s.events;r===null?s.events=[i]:r.push(i)}}function Sv(i){var s=Ft().memoizedState;return aC({ref:s,nextImpl:i}),function(){if((at&2)!==0)throw Error(a(440));return s.impl.apply(void 0,arguments)}}function wv(i,s){return vc(4,2,i,s)}function Cv(i,s){return vc(4,4,i,s)}function xv(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 Ev(i,s,r){r=r!=null?r.concat([i]):null,vc(4,4,xv.bind(null,s,i),r)}function Jh(){}function Tv(i,s){var r=Ft();s=s===void 0?null:s;var l=r.memoizedState;return s!==null&&Ih(s,l[1])?l[0]:(r.memoizedState=[i,s],i)}function kv(i,s){var r=Ft();s=s===void 0?null:s;var l=r.memoizedState;if(s!==null&&Ih(s,l[1]))return l[0];if(l=i(),Hr){wi(!0);try{i()}finally{wi(!1)}}return r.memoizedState=[l,s],l}function ed(i,s,r){return r===void 0||(pn&1073741824)!==0&&(Qe&261930)===0?i.memoizedState=s:(i.memoizedState=r,i=Dg(),qe.lanes|=i,Vn|=i,r)}function Dv(i,s,r,l){return us(r,s)?r:ba.current!==null?(i=ed(i,r,l),us(i,s)||(Zt=!0),i):(pn&42)===0||(pn&1073741824)!==0&&(Qe&261930)===0?(Zt=!0,i.memoizedState=r):(i=Dg(),qe.lanes|=i,Vn|=i,s)}function Rv(i,s,r,l,u){var d=q.p;q.p=d!==0&&8>d?d:8;var v=M.T,S={};M.T=S,sd(i,!1,s,r);try{var R=u(),F=M.S;if(F!==null&&F(S,R),R!==null&&typeof R=="object"&&typeof R.then=="function"){var se=tC(R,l);xl(i,s,se,_s(i))}else xl(i,s,l,_s(i))}catch(ce){xl(i,s,{then:function(){},status:"rejected",reason:ce},_s())}finally{q.p=d,v!==null&&S.types!==null&&(v.types=S.types),M.T=v}}function lC(){}function td(i,s,r,l){if(i.tag!==5)throw Error(a(476));var u=Mv(i).queue;Rv(i,u,s,V,r===null?lC:function(){return Nv(i),r(l)})}function Mv(i){var s=i.memoizedState;if(s!==null)return s;s={memoizedState:V,baseState:V,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:mn,lastRenderedState:V},next:null};var r={};return s.next={memoizedState:r,baseState:r,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:mn,lastRenderedState:r},next:null},i.memoizedState=s,i=i.alternate,i!==null&&(i.memoizedState=s),s}function Nv(i){var s=Mv(i);s.next===null&&(s=i.alternate.memoizedState),xl(i,s.next.queue,{},_s())}function id(){return Di(Kl)}function Av(){return Ft().memoizedState}function Lv(){return Ft().memoizedState}function oC(i){for(var s=i.return;s!==null;){switch(s.tag){case 24:case 3:var r=_s();i=In(r);var l=Fn(s,i,r);l!==null&&(ss(l,s,r),yl(l,s,r)),s={cache:Nh()},i.payload=s;return}s=s.return}}function cC(i,s,r){var l=_s();r={lane:l,revertLane:0,gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null},gc(i)?Ov(s,r):(r=bh(i,s,r,l),r!==null&&(ss(r,i,l),zv(r,s,l)))}function Bv(i,s,r){var l=_s();xl(i,s,r,l)}function xl(i,s,r,l){var u={lane:l,revertLane:0,gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null};if(gc(i))Ov(s,u);else{var d=i.alternate;if(i.lanes===0&&(d===null||d.lanes===0)&&(d=s.lastRenderedReducer,d!==null))try{var v=s.lastRenderedState,S=d(v,r);if(u.hasEagerState=!0,u.eagerState=S,us(S,v))return Qo(i,s,u,0),gt===null&&Zo(),!1}catch{}if(r=bh(i,s,u,l),r!==null)return ss(r,i,l),zv(r,s,l),!0}return!1}function sd(i,s,r,l){if(l={lane:2,revertLane:Od(),gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null},gc(i)){if(s)throw Error(a(479))}else s=bh(i,r,l,2),s!==null&&ss(s,i,2)}function gc(i){var s=i.alternate;return i===qe||s!==null&&s===qe}function Ov(i,s){Sa=hc=!0;var r=i.pending;r===null?s.next=s:(s.next=r.next,r.next=s),i.pending=s}function zv(i,s,r){if((r&4194048)!==0){var l=s.lanes;l&=i.pendingLanes,r|=l,s.lanes=r,Kt(i,r)}}var El={readContext:Di,use:pc,useCallback:zt,useContext:zt,useEffect:zt,useImperativeHandle:zt,useLayoutEffect:zt,useInsertionEffect:zt,useMemo:zt,useReducer:zt,useRef:zt,useState:zt,useDebugValue:zt,useDeferredValue:zt,useTransition:zt,useSyncExternalStore:zt,useId:zt,useHostTransitionStatus:zt,useFormState:zt,useActionState:zt,useOptimistic:zt,useMemoCache:zt,useCacheRefresh:zt};El.useEffectEvent=zt;var jv={readContext:Di,use:pc,useCallback:function(i,s){return qi().memoizedState=[i,s===void 0?null:s],i},useContext:Di,useEffect:bv,useImperativeHandle:function(i,s,r){r=r!=null?r.concat([i]):null,_c(4194308,4,xv.bind(null,s,i),r)},useLayoutEffect:function(i,s){return _c(4194308,4,i,s)},useInsertionEffect:function(i,s){_c(4,2,i,s)},useMemo:function(i,s){var r=qi();s=s===void 0?null:s;var l=i();if(Hr){wi(!0);try{i()}finally{wi(!1)}}return r.memoizedState=[l,s],l},useReducer:function(i,s,r){var l=qi();if(r!==void 0){var u=r(s);if(Hr){wi(!0);try{r(s)}finally{wi(!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=cC.bind(null,qe,i),[l.memoizedState,i]},useRef:function(i){var s=qi();return i={current:i},s.memoizedState=i},useState:function(i){i=Gh(i);var s=i.queue,r=Bv.bind(null,qe,s);return s.dispatch=r,[i.memoizedState,r]},useDebugValue:Jh,useDeferredValue:function(i,s){var r=qi();return ed(r,i,s)},useTransition:function(){var i=Gh(!1);return i=Rv.bind(null,qe,i.queue,!0,!1),qi().memoizedState=i,[!1,i]},useSyncExternalStore:function(i,s,r){var l=qe,u=qi();if(et){if(r===void 0)throw Error(a(407));r=r()}else{if(r=s(),gt===null)throw Error(a(349));(Qe&127)!==0||nv(l,s,r)}u.memoizedState=r;var d={value:r,getSnapshot:s};return u.queue=d,bv(av.bind(null,l,d,i),[i]),l.flags|=2048,Ca(9,{destroy:void 0},rv.bind(null,l,d,r,s),null),r},useId:function(){var i=qi(),s=gt.identifierPrefix;if(et){var r=Zs,l=Gs;r=(l&~(1<<32-Lt(l)-1)).toString(32)+r,s="_"+s+"R_"+r,r=dc++,0<r&&(s+="H"+r.toString(32)),s+="_"}else r=iC++,s="_"+s+"r_"+r.toString(32)+"_";return i.memoizedState=s},useHostTransitionStatus:id,useFormState:mv,useActionState:mv,useOptimistic:function(i){var s=qi();s.memoizedState=s.baseState=i;var r={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return s.queue=r,s=sd.bind(null,qe,!0,r),r.dispatch=s,[i,s]},useMemoCache:Yh,useCacheRefresh:function(){return qi().memoizedState=oC.bind(null,qe)},useEffectEvent:function(i){var s=qi(),r={impl:i};return s.memoizedState=r,function(){if((at&2)!==0)throw Error(a(440));return r.impl.apply(void 0,arguments)}}},nd={readContext:Di,use:pc,useCallback:Tv,useContext:Di,useEffect:Qh,useImperativeHandle:Ev,useInsertionEffect:wv,useLayoutEffect:Cv,useMemo:kv,useReducer:mc,useRef:yv,useState:function(){return mc(mn)},useDebugValue:Jh,useDeferredValue:function(i,s){var r=Ft();return Dv(r,dt.memoizedState,i,s)},useTransition:function(){var i=mc(mn)[0],s=Ft().memoizedState;return[typeof i=="boolean"?i:Cl(i),s]},useSyncExternalStore:sv,useId:Av,useHostTransitionStatus:id,useFormState:_v,useActionState:_v,useOptimistic:function(i,s){var r=Ft();return cv(r,dt,i,s)},useMemoCache:Yh,useCacheRefresh:Lv};nd.useEffectEvent=Sv;var Hv={readContext:Di,use:pc,useCallback:Tv,useContext:Di,useEffect:Qh,useImperativeHandle:Ev,useInsertionEffect:wv,useLayoutEffect:Cv,useMemo:kv,useReducer:Xh,useRef:yv,useState:function(){return Xh(mn)},useDebugValue:Jh,useDeferredValue:function(i,s){var r=Ft();return dt===null?ed(r,i,s):Dv(r,dt.memoizedState,i,s)},useTransition:function(){var i=Xh(mn)[0],s=Ft().memoizedState;return[typeof i=="boolean"?i:Cl(i),s]},useSyncExternalStore:sv,useId:Av,useHostTransitionStatus:id,useFormState:gv,useActionState:gv,useOptimistic:function(i,s){var r=Ft();return dt!==null?cv(r,dt,i,s):(r.baseState=i,[i,r.queue.dispatch])},useMemoCache:Yh,useCacheRefresh:Lv};Hv.useEffectEvent=Sv;function rd(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 ad={enqueueSetState:function(i,s,r){i=i._reactInternals;var l=_s(),u=In(l);u.payload=s,r!=null&&(u.callback=r),s=Fn(i,u,l),s!==null&&(ss(s,i,l),yl(s,i,l))},enqueueReplaceState:function(i,s,r){i=i._reactInternals;var l=_s(),u=In(l);u.tag=1,u.payload=s,r!=null&&(u.callback=r),s=Fn(i,u,l),s!==null&&(ss(s,i,l),yl(s,i,l))},enqueueForceUpdate:function(i,s){i=i._reactInternals;var r=_s(),l=In(r);l.tag=2,s!=null&&(l.callback=s),s=Fn(i,l,r),s!==null&&(ss(s,i,r),yl(s,i,r))}};function Uv(i,s,r,l,u,d,v){return i=i.stateNode,typeof i.shouldComponentUpdate=="function"?i.shouldComponentUpdate(l,d,v):s.prototype&&s.prototype.isPureReactComponent?!hl(r,l)||!hl(u,d):!0}function Pv(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&&ad.enqueueReplaceState(s,s.state,null)}function Ur(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 Kv(i){Go(i)}function Iv(i){console.error(i)}function Fv(i){Go(i)}function yc(i,s){try{var r=i.onUncaughtError;r(s.value,{componentStack:s.stack})}catch(l){setTimeout(function(){throw l})}}function qv(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 ld(i,s,r){return r=In(r),r.tag=3,r.payload={element:null},r.callback=function(){yc(i,s)},r}function Wv(i){return i=In(i),i.tag=3,i}function $v(i,s,r,l){var u=r.type.getDerivedStateFromError;if(typeof u=="function"){var d=l.value;i.payload=function(){return u(d)},i.callback=function(){qv(s,r,l)}}var v=r.stateNode;v!==null&&typeof v.componentDidCatch=="function"&&(i.callback=function(){qv(s,r,l),typeof u!="function"&&(Xn===null?Xn=new Set([this]):Xn.add(this));var S=l.stack;this.componentDidCatch(l.value,{componentStack:S!==null?S:""})})}function uC(i,s,r,l,u){if(r.flags|=32768,l!==null&&typeof l=="object"&&typeof l.then=="function"){if(s=r.alternate,s!==null&&ma(s,r,u,!0),r=ds.current,r!==null){switch(r.tag){case 31:case 13:return Ms===null?Nc():r.alternate===null&&jt===0&&(jt=3),r.flags&=-257,r.flags|=65536,r.lanes=u,l===ac?r.flags|=16384:(s=r.updateQueue,s===null?r.updateQueue=new Set([l]):s.add(l),Ad(i,l,u)),!1;case 22:return r.flags|=65536,l===ac?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)),Ad(i,l,u)),!1}throw Error(a(435,r.tag))}return Ad(i,l,u),Nc(),!1}if(et)return s=ds.current,s!==null?((s.flags&65536)===0&&(s.flags|=256),s.flags|=65536,s.lanes=u,l!==Th&&(i=Error(a(422),{cause:l}),pl(Ts(i,r)))):(l!==Th&&(s=Error(a(423),{cause:l}),pl(Ts(s,r))),i=i.current.alternate,i.flags|=65536,u&=-u,i.lanes|=u,l=Ts(l,r),u=ld(i.stateNode,l,u),jh(i,u),jt!==4&&(jt=2)),!1;var d=Error(a(520),{cause:l});if(d=Ts(d,r),Ll===null?Ll=[d]:Ll.push(d),jt!==4&&(jt=2),s===null)return!0;l=Ts(l,r),r=s;do{switch(r.tag){case 3:return r.flags|=65536,i=u&-u,r.lanes|=i,i=ld(r.stateNode,l,i),jh(r,i),!1;case 1:if(s=r.type,d=r.stateNode,(r.flags&128)===0&&(typeof s.getDerivedStateFromError=="function"||d!==null&&typeof d.componentDidCatch=="function"&&(Xn===null||!Xn.has(d))))return r.flags|=65536,u&=-u,r.lanes|=u,u=Wv(u),$v(u,i,r,l),jh(r,u),!1}r=r.return}while(r!==null);return!1}var od=Error(a(461)),Zt=!1;function Ri(i,s,r,l){s.child=i===null?G_(s,null,r,l):jr(s,i.child,r,l)}function Yv(i,s,r,l,u){r=r.render;var d=s.ref;if("ref"in l){var v={};for(var S in l)S!=="ref"&&(v[S]=l[S])}else v=l;return Lr(s),l=Fh(i,s,r,v,d,u),S=qh(),i!==null&&!Zt?(Wh(i,s,u),_n(i,s,u)):(et&&S&&xh(s),s.flags|=1,Ri(i,s,l,u),s.child)}function Vv(i,s,r,l,u){if(i===null){var d=r.type;return typeof d=="function"&&!Sh(d)&&d.defaultProps===void 0&&r.compare===null?(s.tag=15,s.type=d,Xv(i,s,d,l,u)):(i=ec(r.type,null,l,s,s.mode,u),i.ref=s.ref,i.return=s,s.child=i)}if(d=i.child,!_d(i,u)){var v=d.memoizedProps;if(r=r.compare,r=r!==null?r:hl,r(v,l)&&i.ref===s.ref)return _n(i,s,u)}return s.flags|=1,i=un(d,l),i.ref=s.ref,i.return=s,s.child=i}function Xv(i,s,r,l,u){if(i!==null){var d=i.memoizedProps;if(hl(d,l)&&i.ref===s.ref)if(Zt=!1,s.pendingProps=l=d,_d(i,u))(i.flags&131072)!==0&&(Zt=!0);else return s.lanes=i.lanes,_n(i,s,u)}return cd(i,s,r,l,u)}function Gv(i,s,r,l){var u=l.children,d=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(d=d!==null?d.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&~d}else l=0,s.child=null;return Zv(i,s,d,r,l)}if((r&536870912)!==0)s.memoizedState={baseLanes:0,cachePool:null},i!==null&&nc(s,d!==null?d.cachePool:null),d!==null?J_(s,d):Uh(),ev(s);else return l=s.lanes=536870912,Zv(i,s,d!==null?d.baseLanes|r:r,r,l)}else d!==null?(nc(s,d.cachePool),J_(s,d),Wn(),s.memoizedState=null):(i!==null&&nc(s,null),Uh(),Wn());return Ri(i,s,u,r),s.child}function Tl(i,s){return i!==null&&i.tag===22||s.stateNode!==null||(s.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),s.sibling}function Zv(i,s,r,l,u){var d=Lh();return d=d===null?null:{parent:Xt._currentValue,pool:d},s.memoizedState={baseLanes:r,cachePool:d},i!==null&&nc(s,null),Uh(),ev(s),i!==null&&ma(i,s,l,!0),s.childLanes=u,null}function bc(i,s){return s=wc({mode:s.mode,children:s.children},i.mode),s.ref=i.ref,i.child=s,s.return=i,s}function Qv(i,s,r){return jr(s,i.child,null,r),i=bc(s,s.pendingProps),i.flags|=2,fs(s),s.memoizedState=null,i}function hC(i,s,r){var l=s.pendingProps,u=(s.flags&128)!==0;if(s.flags&=-129,i===null){if(et){if(l.mode==="hidden")return i=bc(s,l),s.lanes=536870912,Tl(null,i);if(Kh(s),(i=Ct)?(i=uy(i,Rs),i=i!==null&&i.data==="&"?i:null,i!==null&&(s.memoizedState={dehydrated:i,treeContext:jn!==null?{id:Gs,overflow:Zs}:null,retryLane:536870912,hydrationErrors:null},r=O_(i),r.return=s,s.child=r,ki=s,Ct=null)):i=null,i===null)throw Un(s);return s.lanes=536870912,null}return bc(s,l)}var d=i.memoizedState;if(d!==null){var v=d.dehydrated;if(Kh(s),u)if(s.flags&256)s.flags&=-257,s=Qv(i,s,r);else if(s.memoizedState!==null)s.child=i.child,s.flags|=128,s=null;else throw Error(a(558));else if(Zt||ma(i,s,r,!1),u=(r&i.childLanes)!==0,Zt||u){if(l=gt,l!==null&&(v=Ei(l,r),v!==0&&v!==d.retryLane))throw d.retryLane=v,Rr(i,v),ss(l,i,v),od;Nc(),s=Qv(i,s,r)}else i=d.treeContext,Ct=Ns(v.nextSibling),ki=s,et=!0,Hn=null,Rs=!1,i!==null&&H_(s,i),s=bc(s,l),s.flags|=4096;return s}return i=un(i.child,{mode:l.mode,children:l.children}),i.ref=s.ref,s.child=i,i.return=s,i}function Sc(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 cd(i,s,r,l,u){return Lr(s),r=Fh(i,s,r,l,void 0,u),l=qh(),i!==null&&!Zt?(Wh(i,s,u),_n(i,s,u)):(et&&l&&xh(s),s.flags|=1,Ri(i,s,r,u),s.child)}function Jv(i,s,r,l,u,d){return Lr(s),s.updateQueue=null,r=iv(s,l,r,u),tv(i),l=qh(),i!==null&&!Zt?(Wh(i,s,d),_n(i,s,d)):(et&&l&&xh(s),s.flags|=1,Ri(i,s,r,d),s.child)}function eg(i,s,r,l,u){if(Lr(s),s.stateNode===null){var d=ha,v=r.contextType;typeof v=="object"&&v!==null&&(d=Di(v)),d=new r(l,d),s.memoizedState=d.state!==null&&d.state!==void 0?d.state:null,d.updater=ad,s.stateNode=d,d._reactInternals=s,d=s.stateNode,d.props=l,d.state=s.memoizedState,d.refs={},Oh(s),v=r.contextType,d.context=typeof v=="object"&&v!==null?Di(v):ha,d.state=s.memoizedState,v=r.getDerivedStateFromProps,typeof v=="function"&&(rd(s,r,v,l),d.state=s.memoizedState),typeof r.getDerivedStateFromProps=="function"||typeof d.getSnapshotBeforeUpdate=="function"||typeof d.UNSAFE_componentWillMount!="function"&&typeof d.componentWillMount!="function"||(v=d.state,typeof d.componentWillMount=="function"&&d.componentWillMount(),typeof d.UNSAFE_componentWillMount=="function"&&d.UNSAFE_componentWillMount(),v!==d.state&&ad.enqueueReplaceState(d,d.state,null),Sl(s,l,d,u),bl(),d.state=s.memoizedState),typeof d.componentDidMount=="function"&&(s.flags|=4194308),l=!0}else if(i===null){d=s.stateNode;var S=s.memoizedProps,R=Ur(r,S);d.props=R;var F=d.context,se=r.contextType;v=ha,typeof se=="object"&&se!==null&&(v=Di(se));var ce=r.getDerivedStateFromProps;se=typeof ce=="function"||typeof d.getSnapshotBeforeUpdate=="function",S=s.pendingProps!==S,se||typeof d.UNSAFE_componentWillReceiveProps!="function"&&typeof d.componentWillReceiveProps!="function"||(S||F!==v)&&Pv(s,d,l,v),Kn=!1;var $=s.memoizedState;d.state=$,Sl(s,l,d,u),bl(),F=s.memoizedState,S||$!==F||Kn?(typeof ce=="function"&&(rd(s,r,ce,l),F=s.memoizedState),(R=Kn||Uv(s,r,R,l,$,F,v))?(se||typeof d.UNSAFE_componentWillMount!="function"&&typeof d.componentWillMount!="function"||(typeof d.componentWillMount=="function"&&d.componentWillMount(),typeof d.UNSAFE_componentWillMount=="function"&&d.UNSAFE_componentWillMount()),typeof d.componentDidMount=="function"&&(s.flags|=4194308)):(typeof d.componentDidMount=="function"&&(s.flags|=4194308),s.memoizedProps=l,s.memoizedState=F),d.props=l,d.state=F,d.context=v,l=R):(typeof d.componentDidMount=="function"&&(s.flags|=4194308),l=!1)}else{d=s.stateNode,zh(i,s),v=s.memoizedProps,se=Ur(r,v),d.props=se,ce=s.pendingProps,$=d.context,F=r.contextType,R=ha,typeof F=="object"&&F!==null&&(R=Di(F)),S=r.getDerivedStateFromProps,(F=typeof S=="function"||typeof d.getSnapshotBeforeUpdate=="function")||typeof d.UNSAFE_componentWillReceiveProps!="function"&&typeof d.componentWillReceiveProps!="function"||(v!==ce||$!==R)&&Pv(s,d,l,R),Kn=!1,$=s.memoizedState,d.state=$,Sl(s,l,d,u),bl();var Z=s.memoizedState;v!==ce||$!==Z||Kn||i!==null&&i.dependencies!==null&&ic(i.dependencies)?(typeof S=="function"&&(rd(s,r,S,l),Z=s.memoizedState),(se=Kn||Uv(s,r,se,l,$,Z,R)||i!==null&&i.dependencies!==null&&ic(i.dependencies))?(F||typeof d.UNSAFE_componentWillUpdate!="function"&&typeof d.componentWillUpdate!="function"||(typeof d.componentWillUpdate=="function"&&d.componentWillUpdate(l,Z,R),typeof d.UNSAFE_componentWillUpdate=="function"&&d.UNSAFE_componentWillUpdate(l,Z,R)),typeof d.componentDidUpdate=="function"&&(s.flags|=4),typeof d.getSnapshotBeforeUpdate=="function"&&(s.flags|=1024)):(typeof d.componentDidUpdate!="function"||v===i.memoizedProps&&$===i.memoizedState||(s.flags|=4),typeof d.getSnapshotBeforeUpdate!="function"||v===i.memoizedProps&&$===i.memoizedState||(s.flags|=1024),s.memoizedProps=l,s.memoizedState=Z),d.props=l,d.state=Z,d.context=R,l=se):(typeof d.componentDidUpdate!="function"||v===i.memoizedProps&&$===i.memoizedState||(s.flags|=4),typeof d.getSnapshotBeforeUpdate!="function"||v===i.memoizedProps&&$===i.memoizedState||(s.flags|=1024),l=!1)}return d=l,Sc(i,s),l=(s.flags&128)!==0,d||l?(d=s.stateNode,r=l&&typeof r.getDerivedStateFromError!="function"?null:d.render(),s.flags|=1,i!==null&&l?(s.child=jr(s,i.child,null,u),s.child=jr(s,null,r,u)):Ri(i,s,r,u),s.memoizedState=d.state,i=s.child):i=_n(i,s,u),i}function tg(i,s,r,l){return Nr(),s.flags|=256,Ri(i,s,r,l),s.child}var ud={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function hd(i){return{baseLanes:i,cachePool:q_()}}function dd(i,s,r){return i=i!==null?i.childLanes&~r:0,s&&(i|=ms),i}function ig(i,s,r){var l=s.pendingProps,u=!1,d=(s.flags&128)!==0,v;if((v=d)||(v=i!==null&&i.memoizedState===null?!1:(It.current&2)!==0),v&&(u=!0,s.flags&=-129),v=(s.flags&32)!==0,s.flags&=-33,i===null){if(et){if(u?qn(s):Wn(),(i=Ct)?(i=uy(i,Rs),i=i!==null&&i.data!=="&"?i:null,i!==null&&(s.memoizedState={dehydrated:i,treeContext:jn!==null?{id:Gs,overflow:Zs}:null,retryLane:536870912,hydrationErrors:null},r=O_(i),r.return=s,s.child=r,ki=s,Ct=null)):i=null,i===null)throw Un(s);return Vd(i)?s.lanes=32:s.lanes=536870912,null}var S=l.children;return l=l.fallback,u?(Wn(),u=s.mode,S=wc({mode:"hidden",children:S},u),l=Mr(l,u,r,null),S.return=s,l.return=s,S.sibling=l,s.child=S,l=s.child,l.memoizedState=hd(r),l.childLanes=dd(i,v,r),s.memoizedState=ud,Tl(null,l)):(qn(s),fd(s,S))}var R=i.memoizedState;if(R!==null&&(S=R.dehydrated,S!==null)){if(d)s.flags&256?(qn(s),s.flags&=-257,s=pd(i,s,r)):s.memoizedState!==null?(Wn(),s.child=i.child,s.flags|=128,s=null):(Wn(),S=l.fallback,u=s.mode,l=wc({mode:"visible",children:l.children},u),S=Mr(S,u,r,null),S.flags|=2,l.return=s,S.return=s,l.sibling=S,s.child=l,jr(s,i.child,null,r),l=s.child,l.memoizedState=hd(r),l.childLanes=dd(i,v,r),s.memoizedState=ud,s=Tl(null,l));else if(qn(s),Vd(S)){if(v=S.nextSibling&&S.nextSibling.dataset,v)var F=v.dgst;v=F,l=Error(a(419)),l.stack="",l.digest=v,pl({value:l,source:null,stack:null}),s=pd(i,s,r)}else if(Zt||ma(i,s,r,!1),v=(r&i.childLanes)!==0,Zt||v){if(v=gt,v!==null&&(l=Ei(v,r),l!==0&&l!==R.retryLane))throw R.retryLane=l,Rr(i,l),ss(v,i,l),od;Yd(S)||Nc(),s=pd(i,s,r)}else Yd(S)?(s.flags|=192,s.child=i.child,s=null):(i=R.treeContext,Ct=Ns(S.nextSibling),ki=s,et=!0,Hn=null,Rs=!1,i!==null&&H_(s,i),s=fd(s,l.children),s.flags|=4096);return s}return u?(Wn(),S=l.fallback,u=s.mode,R=i.child,F=R.sibling,l=un(R,{mode:"hidden",children:l.children}),l.subtreeFlags=R.subtreeFlags&65011712,F!==null?S=un(F,S):(S=Mr(S,u,r,null),S.flags|=2),S.return=s,l.return=s,l.sibling=S,s.child=l,Tl(null,l),l=s.child,S=i.child.memoizedState,S===null?S=hd(r):(u=S.cachePool,u!==null?(R=Xt._currentValue,u=u.parent!==R?{parent:R,pool:R}:u):u=q_(),S={baseLanes:S.baseLanes|r,cachePool:u}),l.memoizedState=S,l.childLanes=dd(i,v,r),s.memoizedState=ud,Tl(i.child,l)):(qn(s),r=i.child,i=r.sibling,r=un(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 fd(i,s){return s=wc({mode:"visible",children:s},i.mode),s.return=i,i.child=s}function wc(i,s){return i=hs(22,i,null,s),i.lanes=0,i}function pd(i,s,r){return jr(s,i.child,null,r),i=fd(s,s.pendingProps.children),i.flags|=2,s.memoizedState=null,i}function sg(i,s,r){i.lanes|=s;var l=i.alternate;l!==null&&(l.lanes|=s),Rh(i.return,s,r)}function md(i,s,r,l,u,d){var v=i.memoizedState;v===null?i.memoizedState={isBackwards:s,rendering:null,renderingStartTime:0,last:l,tail:r,tailMode:u,treeForkCount:d}:(v.isBackwards=s,v.rendering=null,v.renderingStartTime=0,v.last=l,v.tail=r,v.tailMode=u,v.treeForkCount=d)}function ng(i,s,r){var l=s.pendingProps,u=l.revealOrder,d=l.tail;l=l.children;var v=It.current,S=(v&2)!==0;if(S?(v=v&1|2,s.flags|=128):v&=1,ne(It,v),Ri(i,s,l,r),l=et?fl:0,!S&&i!==null&&(i.flags&128)!==0)e:for(i=s.child;i!==null;){if(i.tag===13)i.memoizedState!==null&&sg(i,r,s);else if(i.tag===19)sg(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&&uc(i)===null&&(u=r),r=r.sibling;r=u,r===null?(u=s.child,s.child=null):(u=r.sibling,r.sibling=null),md(s,!1,u,r,d,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&&uc(i)===null){s.child=u;break}i=u.sibling,u.sibling=r,r=u,u=i}md(s,!0,r,null,d,l);break;case"together":md(s,!1,null,null,void 0,l);break;default:s.memoizedState=null}return s.child}function _n(i,s,r){if(i!==null&&(s.dependencies=i.dependencies),Vn|=s.lanes,(r&s.childLanes)===0)if(i!==null){if(ma(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=un(i,i.pendingProps),s.child=r,r.return=s;i.sibling!==null;)i=i.sibling,r=r.sibling=un(i,i.pendingProps),r.return=s;r.sibling=null}return s.child}function _d(i,s){return(i.lanes&s)!==0?!0:(i=i.dependencies,!!(i!==null&&ic(i)))}function dC(i,s,r){switch(s.tag){case 3:me(s,s.stateNode.containerInfo),Pn(s,Xt,i.memoizedState.cache),Nr();break;case 27:case 5:Me(s);break;case 4:me(s,s.stateNode.containerInfo);break;case 10:Pn(s,s.type,s.memoizedProps.value);break;case 31:if(s.memoizedState!==null)return s.flags|=128,Kh(s),null;break;case 13:var l=s.memoizedState;if(l!==null)return l.dehydrated!==null?(qn(s),s.flags|=128,null):(r&s.child.childLanes)!==0?ig(i,s,r):(qn(s),i=_n(i,s,r),i!==null?i.sibling:null);qn(s);break;case 19:var u=(i.flags&128)!==0;if(l=(r&s.childLanes)!==0,l||(ma(i,s,r,!1),l=(r&s.childLanes)!==0),u){if(l)return ng(i,s,r);s.flags|=128}if(u=s.memoizedState,u!==null&&(u.rendering=null,u.tail=null,u.lastEffect=null),ne(It,It.current),l)break;return null;case 22:return s.lanes=0,Gv(i,s,r,s.pendingProps);case 24:Pn(s,Xt,i.memoizedState.cache)}return _n(i,s,r)}function rg(i,s,r){if(i!==null)if(i.memoizedProps!==s.pendingProps)Zt=!0;else{if(!_d(i,r)&&(s.flags&128)===0)return Zt=!1,dC(i,s,r);Zt=(i.flags&131072)!==0}else Zt=!1,et&&(s.flags&1048576)!==0&&j_(s,fl,s.index);switch(s.lanes=0,s.tag){case 16:e:{var l=s.pendingProps;if(i=Or(s.elementType),s.type=i,typeof i=="function")Sh(i)?(l=Ur(i,l),s.tag=1,s=eg(null,s,i,l,r)):(s.tag=0,s=cd(null,s,i,l,r));else{if(i!=null){var u=i.$$typeof;if(u===X){s.tag=11,s=Yv(null,s,i,l,r);break e}else if(u===ie){s.tag=14,s=Vv(null,s,i,l,r);break e}}throw s=z(i)||i,Error(a(306,s,""))}}return s;case 0:return cd(i,s,s.type,s.pendingProps,r);case 1:return l=s.type,u=Ur(l,s.pendingProps),eg(i,s,l,u,r);case 3:e:{if(me(s,s.stateNode.containerInfo),i===null)throw Error(a(387));l=s.pendingProps;var d=s.memoizedState;u=d.element,zh(i,s),Sl(s,l,null,r);var v=s.memoizedState;if(l=v.cache,Pn(s,Xt,l),l!==d.cache&&Mh(s,[Xt],r,!0),bl(),l=v.element,d.isDehydrated)if(d={element:l,isDehydrated:!1,cache:v.cache},s.updateQueue.baseState=d,s.memoizedState=d,s.flags&256){s=tg(i,s,l,r);break e}else if(l!==u){u=Ts(Error(a(424)),s),pl(u),s=tg(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,Ct=Ns(i.firstChild),ki=s,et=!0,Hn=null,Rs=!0,r=G_(s,null,l,r),s.child=r;r;)r.flags=r.flags&-3|4096,r=r.sibling;else{if(Nr(),l===u){s=_n(i,s,r);break e}Ri(i,s,l,r)}s=s.child}return s;case 26:return Sc(i,s),i===null?(r=_y(s.type,null,s.pendingProps,null))?s.memoizedState=r:et||(r=s.type,i=s.pendingProps,l=Hc(pe.current).createElement(r),l[Ot]=s,l[ni]=i,Mi(l,r,i),Mt(l),s.stateNode=l):s.memoizedState=_y(s.type,i.memoizedProps,s.pendingProps,i.memoizedState),null;case 27:return Me(s),i===null&&et&&(l=s.stateNode=fy(s.type,s.pendingProps,pe.current),ki=s,Rs=!0,u=Ct,Jn(s.type)?(Xd=u,Ct=Ns(l.firstChild)):Ct=u),Ri(i,s,s.pendingProps.children,r),Sc(i,s),i===null&&(s.flags|=4194304),s.child;case 5:return i===null&&et&&((u=l=Ct)&&(l=IC(l,s.type,s.pendingProps,Rs),l!==null?(s.stateNode=l,ki=s,Ct=Ns(l.firstChild),Rs=!1,u=!0):u=!1),u||Un(s)),Me(s),u=s.type,d=s.pendingProps,v=i!==null?i.memoizedProps:null,l=d.children,qd(u,d)?l=null:v!==null&&qd(u,v)&&(s.flags|=32),s.memoizedState!==null&&(u=Fh(i,s,sC,null,null,r),Kl._currentValue=u),Sc(i,s),Ri(i,s,l,r),s.child;case 6:return i===null&&et&&((i=r=Ct)&&(r=FC(r,s.pendingProps,Rs),r!==null?(s.stateNode=r,ki=s,Ct=null,i=!0):i=!1),i||Un(s)),null;case 13:return ig(i,s,r);case 4:return me(s,s.stateNode.containerInfo),l=s.pendingProps,i===null?s.child=jr(s,null,l,r):Ri(i,s,l,r),s.child;case 11:return Yv(i,s,s.type,s.pendingProps,r);case 7:return Ri(i,s,s.pendingProps,r),s.child;case 8:return Ri(i,s,s.pendingProps.children,r),s.child;case 12:return Ri(i,s,s.pendingProps.children,r),s.child;case 10:return l=s.pendingProps,Pn(s,s.type,l.value),Ri(i,s,l.children,r),s.child;case 9:return u=s.type._context,l=s.pendingProps.children,Lr(s),u=Di(u),l=l(u),s.flags|=1,Ri(i,s,l,r),s.child;case 14:return Vv(i,s,s.type,s.pendingProps,r);case 15:return Xv(i,s,s.type,s.pendingProps,r);case 19:return ng(i,s,r);case 31:return hC(i,s,r);case 22:return Gv(i,s,r,s.pendingProps);case 24:return Lr(s),l=Di(Xt),i===null?(u=Lh(),u===null&&(u=gt,d=Nh(),u.pooledCache=d,d.refCount++,d!==null&&(u.pooledCacheLanes|=r),u=d),s.memoizedState={parent:l,cache:u},Oh(s),Pn(s,Xt,u)):((i.lanes&r)!==0&&(zh(i,s),Sl(s,null,null,r),bl()),u=i.memoizedState,d=s.memoizedState,u.parent!==l?(u={parent:l,cache:l},s.memoizedState=u,s.lanes===0&&(s.memoizedState=s.updateQueue.baseState=u),Pn(s,Xt,l)):(l=d.cache,Pn(s,Xt,l),l!==u.cache&&Mh(s,[Xt],r,!0))),Ri(i,s,s.pendingProps.children,r),s.child;case 29:throw s.pendingProps}throw Error(a(156,s.tag))}function vn(i){i.flags|=4}function vd(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(Ag())i.flags|=8192;else throw zr=ac,Bh}else i.flags&=-16777217}function ag(i,s){if(s.type!=="stylesheet"||(s.state.loading&4)!==0)i.flags&=-16777217;else if(i.flags|=16777216,!Sy(s))if(Ag())i.flags|=8192;else throw zr=ac,Bh}function Cc(i,s){s!==null&&(i.flags|=4),i.flags&16384&&(s=i.tag!==22?Yt():536870912,i.lanes|=s,ka|=s)}function kl(i,s){if(!et)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 xt(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 fC(i,s,r){var l=s.pendingProps;switch(Eh(s),s.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return xt(s),null;case 1:return xt(s),null;case 3:return r=s.stateNode,l=null,i!==null&&(l=i.memoizedState.cache),s.memoizedState.cache!==l&&(s.flags|=2048),fn(Xt),Se(),r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),(i===null||i.child===null)&&(pa(s)?vn(s):i===null||i.memoizedState.isDehydrated&&(s.flags&256)===0||(s.flags|=1024,kh())),xt(s),null;case 26:var u=s.type,d=s.memoizedState;return i===null?(vn(s),d!==null?(xt(s),ag(s,d)):(xt(s),vd(s,u,null,l,r))):d?d!==i.memoizedState?(vn(s),xt(s),ag(s,d)):(xt(s),s.flags&=-16777217):(i=i.memoizedProps,i!==l&&vn(s),xt(s),vd(s,u,i,l,r)),null;case 27:if(Ue(s),r=pe.current,u=s.type,i!==null&&s.stateNode!=null)i.memoizedProps!==l&&vn(s);else{if(!l){if(s.stateNode===null)throw Error(a(166));return xt(s),null}i=he.current,pa(s)?U_(s):(i=fy(u,l,r),s.stateNode=i,vn(s))}return xt(s),null;case 5:if(Ue(s),u=s.type,i!==null&&s.stateNode!=null)i.memoizedProps!==l&&vn(s);else{if(!l){if(s.stateNode===null)throw Error(a(166));return xt(s),null}if(d=he.current,pa(s))U_(s);else{var v=Hc(pe.current);switch(d){case 1:d=v.createElementNS("http://www.w3.org/2000/svg",u);break;case 2:d=v.createElementNS("http://www.w3.org/1998/Math/MathML",u);break;default:switch(u){case"svg":d=v.createElementNS("http://www.w3.org/2000/svg",u);break;case"math":d=v.createElementNS("http://www.w3.org/1998/Math/MathML",u);break;case"script":d=v.createElement("div"),d.innerHTML="<script><\/script>",d=d.removeChild(d.firstChild);break;case"select":d=typeof l.is=="string"?v.createElement("select",{is:l.is}):v.createElement("select"),l.multiple?d.multiple=!0:l.size&&(d.size=l.size);break;default:d=typeof l.is=="string"?v.createElement(u,{is:l.is}):v.createElement(u)}}d[Ot]=s,d[ni]=l;e:for(v=s.child;v!==null;){if(v.tag===5||v.tag===6)d.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=d;e:switch(Mi(d,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&&vn(s)}}return xt(s),vd(s,s.type,i===null?null:i.memoizedProps,s.pendingProps,r),null;case 6:if(i&&s.stateNode!=null)i.memoizedProps!==l&&vn(s);else{if(typeof l!="string"&&s.stateNode===null)throw Error(a(166));if(i=pe.current,pa(s)){if(i=s.stateNode,r=s.memoizedProps,l=null,u=ki,u!==null)switch(u.tag){case 27:case 5:l=u.memoizedProps}i[Ot]=s,i=!!(i.nodeValue===r||l!==null&&l.suppressHydrationWarning===!0||iy(i.nodeValue,r)),i||Un(s,!0)}else i=Hc(i).createTextNode(l),i[Ot]=s,s.stateNode=i}return xt(s),null;case 31:if(r=s.memoizedState,i===null||i.memoizedState!==null){if(l=pa(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[Ot]=s}else Nr(),(s.flags&128)===0&&(s.memoizedState=null),s.flags|=4;xt(s),i=!1}else r=kh(),i!==null&&i.memoizedState!==null&&(i.memoizedState.hydrationErrors=r),i=!0;if(!i)return s.flags&256?(fs(s),s):(fs(s),null);if((s.flags&128)!==0)throw Error(a(558))}return xt(s),null;case 13:if(l=s.memoizedState,i===null||i.memoizedState!==null&&i.memoizedState.dehydrated!==null){if(u=pa(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[Ot]=s}else Nr(),(s.flags&128)===0&&(s.memoizedState=null),s.flags|=4;xt(s),u=!1}else u=kh(),i!==null&&i.memoizedState!==null&&(i.memoizedState.hydrationErrors=u),u=!0;if(!u)return s.flags&256?(fs(s),s):(fs(s),null)}return fs(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),d=null,l.memoizedState!==null&&l.memoizedState.cachePool!==null&&(d=l.memoizedState.cachePool.pool),d!==u&&(l.flags|=2048)),r!==i&&r&&(s.child.flags|=8192),Cc(s,s.updateQueue),xt(s),null);case 4:return Se(),i===null&&Ud(s.stateNode.containerInfo),xt(s),null;case 10:return fn(s.type),xt(s),null;case 19:if(W(It),l=s.memoizedState,l===null)return xt(s),null;if(u=(s.flags&128)!==0,d=l.rendering,d===null)if(u)kl(l,!1);else{if(jt!==0||i!==null&&(i.flags&128)!==0)for(i=s.child;i!==null;){if(d=uc(i),d!==null){for(s.flags|=128,kl(l,!1),i=d.updateQueue,s.updateQueue=i,Cc(s,i),s.subtreeFlags=0,i=r,r=s.child;r!==null;)B_(r,i),r=r.sibling;return ne(It,It.current&1|2),et&&hn(s,l.treeForkCount),s.child}i=i.sibling}l.tail!==null&&Oe()>Dc&&(s.flags|=128,u=!0,kl(l,!1),s.lanes=4194304)}else{if(!u)if(i=uc(d),i!==null){if(s.flags|=128,u=!0,i=i.updateQueue,s.updateQueue=i,Cc(s,i),kl(l,!0),l.tail===null&&l.tailMode==="hidden"&&!d.alternate&&!et)return xt(s),null}else 2*Oe()-l.renderingStartTime>Dc&&r!==536870912&&(s.flags|=128,u=!0,kl(l,!1),s.lanes=4194304);l.isBackwards?(d.sibling=s.child,s.child=d):(i=l.last,i!==null?i.sibling=d:s.child=d,l.last=d)}return l.tail!==null?(i=l.tail,l.rendering=i,l.tail=i.sibling,l.renderingStartTime=Oe(),i.sibling=null,r=It.current,ne(It,u?r&1|2:r&1),et&&hn(s,l.treeForkCount),i):(xt(s),null);case 22:case 23:return fs(s),Ph(),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&&(xt(s),s.subtreeFlags&6&&(s.flags|=8192)):xt(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(Br),null;case 24:return r=null,i!==null&&(r=i.memoizedState.cache),s.memoizedState.cache!==r&&(s.flags|=2048),fn(Xt),xt(s),null;case 25:return null;case 30:return null}throw Error(a(156,s.tag))}function pC(i,s){switch(Eh(s),s.tag){case 1:return i=s.flags,i&65536?(s.flags=i&-65537|128,s):null;case 3:return fn(Xt),Se(),i=s.flags,(i&65536)!==0&&(i&128)===0?(s.flags=i&-65537|128,s):null;case 26:case 27:case 5:return Ue(s),null;case 31:if(s.memoizedState!==null){if(fs(s),s.alternate===null)throw Error(a(340));Nr()}return i=s.flags,i&65536?(s.flags=i&-65537|128,s):null;case 13:if(fs(s),i=s.memoizedState,i!==null&&i.dehydrated!==null){if(s.alternate===null)throw Error(a(340));Nr()}return i=s.flags,i&65536?(s.flags=i&-65537|128,s):null;case 19:return W(It),null;case 4:return Se(),null;case 10:return fn(s.type),null;case 22:case 23:return fs(s),Ph(),i!==null&&W(Br),i=s.flags,i&65536?(s.flags=i&-65537|128,s):null;case 24:return fn(Xt),null;case 25:return null;default:return null}}function lg(i,s){switch(Eh(s),s.tag){case 3:fn(Xt),Se();break;case 26:case 27:case 5:Ue(s);break;case 4:Se();break;case 31:s.memoizedState!==null&&fs(s);break;case 13:fs(s);break;case 19:W(It);break;case 10:fn(s.type);break;case 22:case 23:fs(s),Ph(),i!==null&&W(Br);break;case 24:fn(Xt)}}function Dl(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 d=r.create,v=r.inst;l=d(),v.destroy=l}r=r.next}while(r!==u)}}catch(S){ut(s,s.return,S)}}function $n(i,s,r){try{var l=s.updateQueue,u=l!==null?l.lastEffect:null;if(u!==null){var d=u.next;l=d;do{if((l.tag&i)===i){var v=l.inst,S=v.destroy;if(S!==void 0){v.destroy=void 0,u=s;var R=r,F=S;try{F()}catch(se){ut(u,R,se)}}}l=l.next}while(l!==d)}}catch(se){ut(s,s.return,se)}}function og(i){var s=i.updateQueue;if(s!==null){var r=i.stateNode;try{Q_(s,r)}catch(l){ut(i,i.return,l)}}}function cg(i,s,r){r.props=Ur(i.type,i.memoizedProps),r.state=i.memoizedState;try{r.componentWillUnmount()}catch(l){ut(i,s,l)}}function Rl(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){ut(i,s,u)}}function Qs(i,s){var r=i.ref,l=i.refCleanup;if(r!==null)if(typeof l=="function")try{l()}catch(u){ut(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){ut(i,s,u)}else r.current=null}function ug(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){ut(i,i.return,u)}}function gd(i,s,r){try{var l=i.stateNode;zC(l,i.type,r,s),l[ni]=s}catch(u){ut(i,i.return,u)}}function hg(i){return i.tag===5||i.tag===3||i.tag===26||i.tag===27&&Jn(i.type)||i.tag===4}function yd(i){e:for(;;){for(;i.sibling===null;){if(i.return===null||hg(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&&Jn(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 bd(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=Is));else if(l!==4&&(l===27&&Jn(i.type)&&(r=i.stateNode,s=null),i=i.child,i!==null))for(bd(i,s,r),i=i.sibling;i!==null;)bd(i,s,r),i=i.sibling}function xc(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&&Jn(i.type)&&(r=i.stateNode),i=i.child,i!==null))for(xc(i,s,r),i=i.sibling;i!==null;)xc(i,s,r),i=i.sibling}function dg(i){var s=i.stateNode,r=i.memoizedProps;try{for(var l=i.type,u=s.attributes;u.length;)s.removeAttributeNode(u[0]);Mi(s,l,r),s[Ot]=i,s[ni]=r}catch(d){ut(i,i.return,d)}}var gn=!1,Qt=!1,Sd=!1,fg=typeof WeakSet=="function"?WeakSet:Set,pi=null;function mC(i,s){if(i=i.containerInfo,Id=Wc,i=E_(i),ph(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,d=l.focusNode;l=l.focusOffset;try{r.nodeType,d.nodeType}catch{r=null;break e}var v=0,S=-1,R=-1,F=0,se=0,ce=i,$=null;t:for(;;){for(var Z;ce!==r||u!==0&&ce.nodeType!==3||(S=v+u),ce!==d||l!==0&&ce.nodeType!==3||(R=v+l),ce.nodeType===3&&(v+=ce.nodeValue.length),(Z=ce.firstChild)!==null;)$=ce,ce=Z;for(;;){if(ce===i)break t;if($===r&&++F===u&&(S=v),$===d&&++se===l&&(R=v),(Z=ce.nextSibling)!==null)break;ce=$,$=ce.parentNode}ce=Z}r=S===-1||R===-1?null:{start:S,end:R}}else r=null}r=r||{start:0,end:0}}else r=null;for(Fd={focusedElem:i,selectionRange:r},Wc=!1,pi=s;pi!==null;)if(s=pi,i=s.child,(s.subtreeFlags&1028)!==0&&i!==null)i.return=s,pi=i;else for(;pi!==null;){switch(s=pi,d=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&&d!==null){i=void 0,r=s,u=d.memoizedProps,d=d.memoizedState,l=r.stateNode;try{var Ee=Ur(r.type,u);i=l.getSnapshotBeforeUpdate(Ee,d),l.__reactInternalSnapshotBeforeUpdate=i}catch(je){ut(r,r.return,je)}}break;case 3:if((i&1024)!==0){if(i=s.stateNode.containerInfo,r=i.nodeType,r===9)$d(i);else if(r===1)switch(i.nodeName){case"HEAD":case"HTML":case"BODY":$d(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,pi=i;break}pi=s.return}}function pg(i,s,r){var l=r.flags;switch(r.tag){case 0:case 11:case 15:bn(i,r),l&4&&Dl(5,r);break;case 1:if(bn(i,r),l&4)if(i=r.stateNode,s===null)try{i.componentDidMount()}catch(v){ut(r,r.return,v)}else{var u=Ur(r.type,s.memoizedProps);s=s.memoizedState;try{i.componentDidUpdate(u,s,i.__reactInternalSnapshotBeforeUpdate)}catch(v){ut(r,r.return,v)}}l&64&&og(r),l&512&&Rl(r,r.return);break;case 3:if(bn(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{Q_(i,s)}catch(v){ut(r,r.return,v)}}break;case 27:s===null&&l&4&&dg(r);case 26:case 5:bn(i,r),s===null&&l&4&&ug(r),l&512&&Rl(r,r.return);break;case 12:bn(i,r);break;case 31:bn(i,r),l&4&&vg(i,r);break;case 13:bn(i,r),l&4&&gg(i,r),l&64&&(i=r.memoizedState,i!==null&&(i=i.dehydrated,i!==null&&(r=xC.bind(null,r),qC(i,r))));break;case 22:if(l=r.memoizedState!==null||gn,!l){s=s!==null&&s.memoizedState!==null||Qt,u=gn;var d=Qt;gn=l,(Qt=s)&&!d?Sn(i,r,(r.subtreeFlags&8772)!==0):bn(i,r),gn=u,Qt=d}break;case 30:break;default:bn(i,r)}}function mg(i){var s=i.alternate;s!==null&&(i.alternate=null,mg(s)),i.child=null,i.deletions=null,i.sibling=null,i.tag===5&&(s=i.stateNode,s!==null&&Bn(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 Dt=null,Ji=!1;function yn(i,s,r){for(r=r.child;r!==null;)_g(i,s,r),r=r.sibling}function _g(i,s,r){if(Pt&&typeof Pt.onCommitFiberUnmount=="function")try{Pt.onCommitFiberUnmount(as,r)}catch{}switch(r.tag){case 26:Qt||Qs(r,s),yn(i,s,r),r.memoizedState?r.memoizedState.count--:r.stateNode&&(r=r.stateNode,r.parentNode.removeChild(r));break;case 27:Qt||Qs(r,s);var l=Dt,u=Ji;Jn(r.type)&&(Dt=r.stateNode,Ji=!1),yn(i,s,r),Hl(r.stateNode),Dt=l,Ji=u;break;case 5:Qt||Qs(r,s);case 6:if(l=Dt,u=Ji,Dt=null,yn(i,s,r),Dt=l,Ji=u,Dt!==null)if(Ji)try{(Dt.nodeType===9?Dt.body:Dt.nodeName==="HTML"?Dt.ownerDocument.body:Dt).removeChild(r.stateNode)}catch(d){ut(r,s,d)}else try{Dt.removeChild(r.stateNode)}catch(d){ut(r,s,d)}break;case 18:Dt!==null&&(Ji?(i=Dt,oy(i.nodeType===9?i.body:i.nodeName==="HTML"?i.ownerDocument.body:i,r.stateNode),Oa(i)):oy(Dt,r.stateNode));break;case 4:l=Dt,u=Ji,Dt=r.stateNode.containerInfo,Ji=!0,yn(i,s,r),Dt=l,Ji=u;break;case 0:case 11:case 14:case 15:$n(2,r,s),Qt||$n(4,r,s),yn(i,s,r);break;case 1:Qt||(Qs(r,s),l=r.stateNode,typeof l.componentWillUnmount=="function"&&cg(r,s,l)),yn(i,s,r);break;case 21:yn(i,s,r);break;case 22:Qt=(l=Qt)||r.memoizedState!==null,yn(i,s,r),Qt=l;break;default:yn(i,s,r)}}function vg(i,s){if(s.memoizedState===null&&(i=s.alternate,i!==null&&(i=i.memoizedState,i!==null))){i=i.dehydrated;try{Oa(i)}catch(r){ut(s,s.return,r)}}}function gg(i,s){if(s.memoizedState===null&&(i=s.alternate,i!==null&&(i=i.memoizedState,i!==null&&(i=i.dehydrated,i!==null))))try{Oa(i)}catch(r){ut(s,s.return,r)}}function _C(i){switch(i.tag){case 31:case 13:case 19:var s=i.stateNode;return s===null&&(s=i.stateNode=new fg),s;case 22:return i=i.stateNode,s=i._retryCache,s===null&&(s=i._retryCache=new fg),s;default:throw Error(a(435,i.tag))}}function Ec(i,s){var r=_C(i);s.forEach(function(l){if(!r.has(l)){r.add(l);var u=EC.bind(null,i,l);l.then(u,u)}})}function es(i,s){var r=s.deletions;if(r!==null)for(var l=0;l<r.length;l++){var u=r[l],d=i,v=s,S=v;e:for(;S!==null;){switch(S.tag){case 27:if(Jn(S.type)){Dt=S.stateNode,Ji=!1;break e}break;case 5:Dt=S.stateNode,Ji=!1;break e;case 3:case 4:Dt=S.stateNode.containerInfo,Ji=!0;break e}S=S.return}if(Dt===null)throw Error(a(160));_g(d,v,u),Dt=null,Ji=!1,d=u.alternate,d!==null&&(d.return=null),u.return=null}if(s.subtreeFlags&13886)for(s=s.child;s!==null;)yg(s,i),s=s.sibling}var qs=null;function yg(i,s){var r=i.alternate,l=i.flags;switch(i.tag){case 0:case 11:case 14:case 15:es(s,i),ts(i),l&4&&($n(3,i,i.return),Dl(3,i),$n(5,i,i.return));break;case 1:es(s,i),ts(i),l&512&&(Qt||r===null||Qs(r,r.return)),l&64&&gn&&(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=qs;if(es(s,i),ts(i),l&512&&(Qt||r===null||Qs(r,r.return)),l&4){var d=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":d=u.getElementsByTagName("title")[0],(!d||d[ls]||d[Ot]||d.namespaceURI==="http://www.w3.org/2000/svg"||d.hasAttribute("itemprop"))&&(d=u.createElement(l),u.head.insertBefore(d,u.querySelector("head > title"))),Mi(d,l,r),d[Ot]=i,Mt(d),l=d;break e;case"link":var v=yy("link","href",u).get(l+(r.href||""));if(v){for(var S=0;S<v.length;S++)if(d=v[S],d.getAttribute("href")===(r.href==null||r.href===""?null:r.href)&&d.getAttribute("rel")===(r.rel==null?null:r.rel)&&d.getAttribute("title")===(r.title==null?null:r.title)&&d.getAttribute("crossorigin")===(r.crossOrigin==null?null:r.crossOrigin)){v.splice(S,1);break t}}d=u.createElement(l),Mi(d,l,r),u.head.appendChild(d);break;case"meta":if(v=yy("meta","content",u).get(l+(r.content||""))){for(S=0;S<v.length;S++)if(d=v[S],d.getAttribute("content")===(r.content==null?null:""+r.content)&&d.getAttribute("name")===(r.name==null?null:r.name)&&d.getAttribute("property")===(r.property==null?null:r.property)&&d.getAttribute("http-equiv")===(r.httpEquiv==null?null:r.httpEquiv)&&d.getAttribute("charset")===(r.charSet==null?null:r.charSet)){v.splice(S,1);break t}}d=u.createElement(l),Mi(d,l,r),u.head.appendChild(d);break;default:throw Error(a(468,l))}d[Ot]=i,Mt(d),l=d}i.stateNode=l}else by(u,i.type,i.stateNode);else i.stateNode=gy(u,l,i.memoizedProps);else d!==l?(d===null?r.stateNode!==null&&(r=r.stateNode,r.parentNode.removeChild(r)):d.count--,l===null?by(u,i.type,i.stateNode):gy(u,l,i.memoizedProps)):l===null&&i.stateNode!==null&&gd(i,i.memoizedProps,r.memoizedProps)}break;case 27:es(s,i),ts(i),l&512&&(Qt||r===null||Qs(r,r.return)),r!==null&&l&4&&gd(i,i.memoizedProps,r.memoizedProps);break;case 5:if(es(s,i),ts(i),l&512&&(Qt||r===null||Qs(r,r.return)),i.flags&32){u=i.stateNode;try{it(u,"")}catch(Ee){ut(i,i.return,Ee)}}l&4&&i.stateNode!=null&&(u=i.memoizedProps,gd(i,u,r!==null?r.memoizedProps:u)),l&1024&&(Sd=!0);break;case 6:if(es(s,i),ts(i),l&4){if(i.stateNode===null)throw Error(a(162));l=i.memoizedProps,r=i.stateNode;try{r.nodeValue=l}catch(Ee){ut(i,i.return,Ee)}}break;case 3:if(Kc=null,u=qs,qs=Uc(s.containerInfo),es(s,i),qs=u,ts(i),l&4&&r!==null&&r.memoizedState.isDehydrated)try{Oa(s.containerInfo)}catch(Ee){ut(i,i.return,Ee)}Sd&&(Sd=!1,bg(i));break;case 4:l=qs,qs=Uc(i.stateNode.containerInfo),es(s,i),ts(i),qs=l;break;case 12:es(s,i),ts(i);break;case 31:es(s,i),ts(i),l&4&&(l=i.updateQueue,l!==null&&(i.updateQueue=null,Ec(i,l)));break;case 13:es(s,i),ts(i),i.child.flags&8192&&i.memoizedState!==null!=(r!==null&&r.memoizedState!==null)&&(kc=Oe()),l&4&&(l=i.updateQueue,l!==null&&(i.updateQueue=null,Ec(i,l)));break;case 22:u=i.memoizedState!==null;var R=r!==null&&r.memoizedState!==null,F=gn,se=Qt;if(gn=F||u,Qt=se||R,es(s,i),Qt=se,gn=F,ts(i),l&8192)e:for(s=i.stateNode,s._visibility=u?s._visibility&-2:s._visibility|1,u&&(r===null||R||gn||Qt||Pr(i)),r=null,s=i;;){if(s.tag===5||s.tag===26){if(r===null){R=r=s;try{if(d=R.stateNode,u)v=d.style,typeof v.setProperty=="function"?v.setProperty("display","none","important"):v.display="none";else{S=R.stateNode;var ce=R.memoizedProps.style,$=ce!=null&&ce.hasOwnProperty("display")?ce.display:null;S.style.display=$==null||typeof $=="boolean"?"":(""+$).trim()}}catch(Ee){ut(R,R.return,Ee)}}}else if(s.tag===6){if(r===null){R=s;try{R.stateNode.nodeValue=u?"":R.memoizedProps}catch(Ee){ut(R,R.return,Ee)}}}else if(s.tag===18){if(r===null){R=s;try{var Z=R.stateNode;u?cy(Z,!0):cy(R.stateNode,!1)}catch(Ee){ut(R,R.return,Ee)}}}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,Ec(i,r))));break;case 19:es(s,i),ts(i),l&4&&(l=i.updateQueue,l!==null&&(i.updateQueue=null,Ec(i,l)));break;case 30:break;case 21:break;default:es(s,i),ts(i)}}function ts(i){var s=i.flags;if(s&2){try{for(var r,l=i.return;l!==null;){if(hg(l)){r=l;break}l=l.return}if(r==null)throw Error(a(160));switch(r.tag){case 27:var u=r.stateNode,d=yd(i);xc(i,d,u);break;case 5:var v=r.stateNode;r.flags&32&&(it(v,""),r.flags&=-33);var S=yd(i);xc(i,S,v);break;case 3:case 4:var R=r.stateNode.containerInfo,F=yd(i);bd(i,F,R);break;default:throw Error(a(161))}}catch(se){ut(i,i.return,se)}i.flags&=-3}s&4096&&(i.flags&=-4097)}function bg(i){if(i.subtreeFlags&1024)for(i=i.child;i!==null;){var s=i;bg(s),s.tag===5&&s.flags&1024&&s.stateNode.reset(),i=i.sibling}}function bn(i,s){if(s.subtreeFlags&8772)for(s=s.child;s!==null;)pg(i,s.alternate,s),s=s.sibling}function Pr(i){for(i=i.child;i!==null;){var s=i;switch(s.tag){case 0:case 11:case 14:case 15:$n(4,s,s.return),Pr(s);break;case 1:Qs(s,s.return);var r=s.stateNode;typeof r.componentWillUnmount=="function"&&cg(s,s.return,r),Pr(s);break;case 27:Hl(s.stateNode);case 26:case 5:Qs(s,s.return),Pr(s);break;case 22:s.memoizedState===null&&Pr(s);break;case 30:Pr(s);break;default:Pr(s)}i=i.sibling}}function Sn(i,s,r){for(r=r&&(s.subtreeFlags&8772)!==0,s=s.child;s!==null;){var l=s.alternate,u=i,d=s,v=d.flags;switch(d.tag){case 0:case 11:case 15:Sn(u,d,r),Dl(4,d);break;case 1:if(Sn(u,d,r),l=d,u=l.stateNode,typeof u.componentDidMount=="function")try{u.componentDidMount()}catch(F){ut(l,l.return,F)}if(l=d,u=l.updateQueue,u!==null){var S=l.stateNode;try{var R=u.shared.hiddenCallbacks;if(R!==null)for(u.shared.hiddenCallbacks=null,u=0;u<R.length;u++)Z_(R[u],S)}catch(F){ut(l,l.return,F)}}r&&v&64&&og(d),Rl(d,d.return);break;case 27:dg(d);case 26:case 5:Sn(u,d,r),r&&l===null&&v&4&&ug(d),Rl(d,d.return);break;case 12:Sn(u,d,r);break;case 31:Sn(u,d,r),r&&v&4&&vg(u,d);break;case 13:Sn(u,d,r),r&&v&4&&gg(u,d);break;case 22:d.memoizedState===null&&Sn(u,d,r),Rl(d,d.return);break;case 30:break;default:Sn(u,d,r)}s=s.sibling}}function wd(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&&ml(r))}function Cd(i,s){i=null,s.alternate!==null&&(i=s.alternate.memoizedState.cache),s=s.memoizedState.cache,s!==i&&(s.refCount++,i!=null&&ml(i))}function Ws(i,s,r,l){if(s.subtreeFlags&10256)for(s=s.child;s!==null;)Sg(i,s,r,l),s=s.sibling}function Sg(i,s,r,l){var u=s.flags;switch(s.tag){case 0:case 11:case 15:Ws(i,s,r,l),u&2048&&Dl(9,s);break;case 1:Ws(i,s,r,l);break;case 3:Ws(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&&ml(i)));break;case 12:if(u&2048){Ws(i,s,r,l),i=s.stateNode;try{var d=s.memoizedProps,v=d.id,S=d.onPostCommit;typeof S=="function"&&S(v,s.alternate===null?"mount":"update",i.passiveEffectDuration,-0)}catch(R){ut(s,s.return,R)}}else Ws(i,s,r,l);break;case 31:Ws(i,s,r,l);break;case 13:Ws(i,s,r,l);break;case 23:break;case 22:d=s.stateNode,v=s.alternate,s.memoizedState!==null?d._visibility&2?Ws(i,s,r,l):Ml(i,s):d._visibility&2?Ws(i,s,r,l):(d._visibility|=2,xa(i,s,r,l,(s.subtreeFlags&10256)!==0||!1)),u&2048&&wd(v,s);break;case 24:Ws(i,s,r,l),u&2048&&Cd(s.alternate,s);break;default:Ws(i,s,r,l)}}function xa(i,s,r,l,u){for(u=u&&((s.subtreeFlags&10256)!==0||!1),s=s.child;s!==null;){var d=i,v=s,S=r,R=l,F=v.flags;switch(v.tag){case 0:case 11:case 15:xa(d,v,S,R,u),Dl(8,v);break;case 23:break;case 22:var se=v.stateNode;v.memoizedState!==null?se._visibility&2?xa(d,v,S,R,u):Ml(d,v):(se._visibility|=2,xa(d,v,S,R,u)),u&&F&2048&&wd(v.alternate,v);break;case 24:xa(d,v,S,R,u),u&&F&2048&&Cd(v.alternate,v);break;default:xa(d,v,S,R,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&&wd(l.alternate,l);break;case 24:Ml(r,l),u&2048&&Cd(l.alternate,l);break;default:Ml(r,l)}s=s.sibling}}var Nl=8192;function Ea(i,s,r){if(i.subtreeFlags&Nl)for(i=i.child;i!==null;)wg(i,s,r),i=i.sibling}function wg(i,s,r){switch(i.tag){case 26:Ea(i,s,r),i.flags&Nl&&i.memoizedState!==null&&ix(r,qs,i.memoizedState,i.memoizedProps);break;case 5:Ea(i,s,r);break;case 3:case 4:var l=qs;qs=Uc(i.stateNode.containerInfo),Ea(i,s,r),qs=l;break;case 22:i.memoizedState===null&&(l=i.alternate,l!==null&&l.memoizedState!==null?(l=Nl,Nl=16777216,Ea(i,s,r),Nl=l):Ea(i,s,r));break;default:Ea(i,s,r)}}function Cg(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 Al(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];pi=l,Eg(l,i)}Cg(i)}if(i.subtreeFlags&10256)for(i=i.child;i!==null;)xg(i),i=i.sibling}function xg(i){switch(i.tag){case 0:case 11:case 15:Al(i),i.flags&2048&&$n(9,i,i.return);break;case 3:Al(i);break;case 12:Al(i);break;case 22:var s=i.stateNode;i.memoizedState!==null&&s._visibility&2&&(i.return===null||i.return.tag!==13)?(s._visibility&=-3,Tc(i)):Al(i);break;default:Al(i)}}function Tc(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];pi=l,Eg(l,i)}Cg(i)}for(i=i.child;i!==null;){switch(s=i,s.tag){case 0:case 11:case 15:$n(8,s,s.return),Tc(s);break;case 22:r=s.stateNode,r._visibility&2&&(r._visibility&=-3,Tc(s));break;default:Tc(s)}i=i.sibling}}function Eg(i,s){for(;pi!==null;){var r=pi;switch(r.tag){case 0:case 11:case 15:$n(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:ml(r.memoizedState.cache)}if(l=r.child,l!==null)l.return=r,pi=l;else e:for(r=i;pi!==null;){l=pi;var u=l.sibling,d=l.return;if(mg(l),l===r){pi=null;break e}if(u!==null){u.return=d,pi=u;break e}pi=d}}}var vC={getCacheForType:function(i){var s=Di(Xt),r=s.data.get(i);return r===void 0&&(r=i(),s.data.set(i,r)),r},cacheSignal:function(){return Di(Xt).controller.signal}},gC=typeof WeakMap=="function"?WeakMap:Map,at=0,gt=null,Ge=null,Qe=0,ct=0,ps=null,Yn=!1,Ta=!1,xd=!1,wn=0,jt=0,Vn=0,Kr=0,Ed=0,ms=0,ka=0,Ll=null,is=null,Td=!1,kc=0,Tg=0,Dc=1/0,Rc=null,Xn=null,li=0,Gn=null,Da=null,Cn=0,kd=0,Dd=null,kg=null,Bl=0,Rd=null;function _s(){return(at&2)!==0&&Qe!==0?Qe&-Qe:M.T!==null?Od():Ti()}function Dg(){if(ms===0)if((Qe&536870912)===0||et){var i=Ss;Ss<<=1,(Ss&3932160)===0&&(Ss=262144),ms=i}else ms=536870912;return i=ds.current,i!==null&&(i.flags|=32),ms}function ss(i,s,r){(i===gt&&(ct===2||ct===9)||i.cancelPendingCommit!==null)&&(Ra(i,0),Zn(i,Qe,ms,!1)),xi(i,r),((at&2)===0||i!==gt)&&(i===gt&&((at&2)===0&&(Kr|=r),jt===4&&Zn(i,Qe,ms,!1)),Js(i))}function Rg(i,s,r){if((at&6)!==0)throw Error(a(327));var l=!r&&(s&127)===0&&(s&i.expiredLanes)===0||ii(i,s),u=l?SC(i,s):Nd(i,s,!0),d=l;do{if(u===0){Ta&&!l&&Zn(i,s,0,!1);break}else{if(r=i.current.alternate,d&&!yC(r)){u=Nd(i,s,!1),d=!1;continue}if(u===2){if(d=s,i.errorRecoveryDisabledLanes&d)var v=0;else v=i.pendingLanes&-536870913,v=v!==0?v:v&536870912?536870912:0;if(v!==0){s=v;e:{var S=i;u=Ll;var R=S.current.memoizedState.isDehydrated;if(R&&(Ra(S,v).flags|=256),v=Nd(S,v,!1),v!==2){if(xd&&!R){S.errorRecoveryDisabledLanes|=d,Kr|=d,u=4;break e}d=is,is=u,d!==null&&(is===null?is=d:is.push.apply(is,d))}u=v}if(d=!1,u!==2)continue}}if(u===1){Ra(i,0),Zn(i,s,0,!0);break}e:{switch(l=i,d=u,d){case 0:case 1:throw Error(a(345));case 4:if((s&4194048)!==s)break;case 6:Zn(l,s,ms,!Yn);break e;case 2:is=null;break;case 3:case 5:break;default:throw Error(a(329))}if((s&62914560)===s&&(u=kc+300-Oe(),10<u)){if(Zn(l,s,ms,!Yn),Bt(l,0,!0)!==0)break e;Cn=s,l.timeoutHandle=ay(Mg.bind(null,l,r,is,Rc,Td,s,ms,Kr,ka,Yn,d,"Throttled",-0,0),u);break e}Mg(l,r,is,Rc,Td,s,ms,Kr,ka,Yn,d,null,-0,0)}}break}while(!0);Js(i)}function Mg(i,s,r,l,u,d,v,S,R,F,se,ce,$,Z){if(i.timeoutHandle=-1,ce=s.subtreeFlags,ce&8192||(ce&16785408)===16785408){ce={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Is},wg(s,d,ce);var Ee=(d&62914560)===d?kc-Oe():(d&4194048)===d?Tg-Oe():0;if(Ee=sx(ce,Ee),Ee!==null){Cn=d,i.cancelPendingCommit=Ee(Hg.bind(null,i,s,d,r,l,u,v,S,R,se,ce,null,$,Z)),Zn(i,d,v,!F);return}}Hg(i,s,d,r,l,u,v,S,R)}function yC(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],d=u.getSnapshot;u=u.value;try{if(!us(d(),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 Zn(i,s,r,l){s&=~Ed,s&=~Kr,i.suspendedLanes|=s,i.pingedLanes&=~s,l&&(i.warmLanes|=s),l=i.expirationTimes;for(var u=s;0<u;){var d=31-Lt(u),v=1<<d;l[d]=-1,u&=~v}r!==0&&Ui(i,r,s)}function Mc(){return(at&6)===0?(Ol(0),!1):!0}function Md(){if(Ge!==null){if(ct===0)var i=Ge.return;else i=Ge,dn=Ar=null,$h(i),ya=null,vl=0,i=Ge;for(;i!==null;)lg(i.alternate,i),i=i.return;Ge=null}}function Ra(i,s){var r=i.timeoutHandle;r!==-1&&(i.timeoutHandle=-1,UC(r)),r=i.cancelPendingCommit,r!==null&&(i.cancelPendingCommit=null,r()),Cn=0,Md(),gt=i,Ge=r=un(i.current,null),Qe=s,ct=0,ps=null,Yn=!1,Ta=ii(i,s),xd=!1,ka=ms=Ed=Kr=Vn=jt=0,is=Ll=null,Td=!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-Lt(l),d=1<<u;s|=i[u],l&=~d}return wn=s,Zo(),r}function Ng(i,s){qe=null,M.H=El,s===ga||s===rc?(s=Y_(),ct=3):s===Bh?(s=Y_(),ct=4):ct=s===od?8:s!==null&&typeof s=="object"&&typeof s.then=="function"?6:1,ps=s,Ge===null&&(jt=1,yc(i,Ts(s,i.current)))}function Ag(){var i=ds.current;return i===null?!0:(Qe&4194048)===Qe?Ms===null:(Qe&62914560)===Qe||(Qe&536870912)!==0?i===Ms:!1}function Lg(){var i=M.H;return M.H=El,i===null?El:i}function Bg(){var i=M.A;return M.A=vC,i}function Nc(){jt=4,Yn||(Qe&4194048)!==Qe&&ds.current!==null||(Ta=!0),(Vn&134217727)===0&&(Kr&134217727)===0||gt===null||Zn(gt,Qe,ms,!1)}function Nd(i,s,r){var l=at;at|=2;var u=Lg(),d=Bg();(gt!==i||Qe!==s)&&(Rc=null,Ra(i,s)),s=!1;var v=jt;e:do try{if(ct!==0&&Ge!==null){var S=Ge,R=ps;switch(ct){case 8:Md(),v=6;break e;case 3:case 2:case 9:case 6:ds.current===null&&(s=!0);var F=ct;if(ct=0,ps=null,Ma(i,S,R,F),r&&Ta){v=0;break e}break;default:F=ct,ct=0,ps=null,Ma(i,S,R,F)}}bC(),v=jt;break}catch(se){Ng(i,se)}while(!0);return s&&i.shellSuspendCounter++,dn=Ar=null,at=l,M.H=u,M.A=d,Ge===null&&(gt=null,Qe=0,Zo()),v}function bC(){for(;Ge!==null;)Og(Ge)}function SC(i,s){var r=at;at|=2;var l=Lg(),u=Bg();gt!==i||Qe!==s?(Rc=null,Dc=Oe()+500,Ra(i,s)):Ta=ii(i,s);e:do try{if(ct!==0&&Ge!==null){s=Ge;var d=ps;t:switch(ct){case 1:ct=0,ps=null,Ma(i,s,d,1);break;case 2:case 9:if(W_(d)){ct=0,ps=null,zg(s);break}s=function(){ct!==2&&ct!==9||gt!==i||(ct=7),Js(i)},d.then(s,s);break e;case 3:ct=7;break e;case 4:ct=5;break e;case 7:W_(d)?(ct=0,ps=null,zg(s)):(ct=0,ps=null,Ma(i,s,d,7));break;case 5:var v=null;switch(Ge.tag){case 26:v=Ge.memoizedState;case 5:case 27:var S=Ge;if(v?Sy(v):S.stateNode.complete){ct=0,ps=null;var R=S.sibling;if(R!==null)Ge=R;else{var F=S.return;F!==null?(Ge=F,Ac(F)):Ge=null}break t}}ct=0,ps=null,Ma(i,s,d,5);break;case 6:ct=0,ps=null,Ma(i,s,d,6);break;case 8:Md(),jt=6;break e;default:throw Error(a(462))}}wC();break}catch(se){Ng(i,se)}while(!0);return dn=Ar=null,M.H=l,M.A=u,at=r,Ge!==null?0:(gt=null,Qe=0,Zo(),jt)}function wC(){for(;Ge!==null&&!J();)Og(Ge)}function Og(i){var s=rg(i.alternate,i,wn);i.memoizedProps=i.pendingProps,s===null?Ac(i):Ge=s}function zg(i){var s=i,r=s.alternate;switch(s.tag){case 15:case 0:s=Jv(r,s,s.pendingProps,s.type,void 0,Qe);break;case 11:s=Jv(r,s,s.pendingProps,s.type.render,s.ref,Qe);break;case 5:$h(s);default:lg(r,s),s=Ge=B_(s,wn),s=rg(r,s,wn)}i.memoizedProps=i.pendingProps,s===null?Ac(i):Ge=s}function Ma(i,s,r,l){dn=Ar=null,$h(s),ya=null,vl=0;var u=s.return;try{if(uC(i,u,s,r,Qe)){jt=1,yc(i,Ts(r,i.current)),Ge=null;return}}catch(d){if(u!==null)throw Ge=u,d;jt=1,yc(i,Ts(r,i.current)),Ge=null;return}s.flags&32768?(et||l===1?i=!0:Ta||(Qe&536870912)!==0?i=!1:(Yn=i=!0,(l===2||l===9||l===3||l===6)&&(l=ds.current,l!==null&&l.tag===13&&(l.flags|=16384))),jg(s,i)):Ac(s)}function Ac(i){var s=i;do{if((s.flags&32768)!==0){jg(s,Yn);return}i=s.return;var r=fC(s.alternate,s,wn);if(r!==null){Ge=r;return}if(s=s.sibling,s!==null){Ge=s;return}Ge=s=i}while(s!==null);jt===0&&(jt=5)}function jg(i,s){do{var r=pC(i.alternate,i);if(r!==null){r.flags&=32767,Ge=r;return}if(r=i.return,r!==null&&(r.flags|=32768,r.subtreeFlags=0,r.deletions=null),!s&&(i=i.sibling,i!==null)){Ge=i;return}Ge=i=r}while(i!==null);jt=6,Ge=null}function Hg(i,s,r,l,u,d,v,S,R){i.cancelPendingCommit=null;do Lc();while(li!==0);if((at&6)!==0)throw Error(a(327));if(s!==null){if(s===i.current)throw Error(a(177));if(d=s.lanes|s.childLanes,d|=yh,wt(i,r,d,v,S,R),i===gt&&(Ge=gt=null,Qe=0),Da=s,Gn=i,Cn=r,kd=d,Dd=u,kg=l,(s.subtreeFlags&10256)!==0||(s.flags&10256)!==0?(i.callbackNode=null,i.callbackPriority=0,TC($t,function(){return Fg(),null})):(i.callbackNode=null,i.callbackPriority=0),l=(s.flags&13878)!==0,(s.subtreeFlags&13878)!==0||l){l=M.T,M.T=null,u=q.p,q.p=2,v=at,at|=4;try{mC(i,s,r)}finally{at=v,q.p=u,M.T=l}}li=1,Ug(),Pg(),Kg()}}function Ug(){if(li===1){li=0;var i=Gn,s=Da,r=(s.flags&13878)!==0;if((s.subtreeFlags&13878)!==0||r){r=M.T,M.T=null;var l=q.p;q.p=2;var u=at;at|=4;try{yg(s,i);var d=Fd,v=E_(i.containerInfo),S=d.focusedElem,R=d.selectionRange;if(v!==S&&S&&S.ownerDocument&&x_(S.ownerDocument.documentElement,S)){if(R!==null&&ph(S)){var F=R.start,se=R.end;if(se===void 0&&(se=F),"selectionStart"in S)S.selectionStart=F,S.selectionEnd=Math.min(se,S.value.length);else{var ce=S.ownerDocument||document,$=ce&&ce.defaultView||window;if($.getSelection){var Z=$.getSelection(),Ee=S.textContent.length,je=Math.min(R.start,Ee),pt=R.end===void 0?je:Math.min(R.end,Ee);!Z.extend&&je>pt&&(v=pt,pt=je,je=v);var H=C_(S,je),L=C_(S,pt);if(H&&L&&(Z.rangeCount!==1||Z.anchorNode!==H.node||Z.anchorOffset!==H.offset||Z.focusNode!==L.node||Z.focusOffset!==L.offset)){var I=ce.createRange();I.setStart(H.node,H.offset),Z.removeAllRanges(),je>pt?(Z.addRange(I),Z.extend(L.node,L.offset)):(I.setEnd(L.node,L.offset),Z.addRange(I))}}}}for(ce=[],Z=S;Z=Z.parentNode;)Z.nodeType===1&&ce.push({element:Z,left:Z.scrollLeft,top:Z.scrollTop});for(typeof S.focus=="function"&&S.focus(),S=0;S<ce.length;S++){var ae=ce[S];ae.element.scrollLeft=ae.left,ae.element.scrollTop=ae.top}}Wc=!!Id,Fd=Id=null}finally{at=u,q.p=l,M.T=r}}i.current=s,li=2}}function Pg(){if(li===2){li=0;var i=Gn,s=Da,r=(s.flags&8772)!==0;if((s.subtreeFlags&8772)!==0||r){r=M.T,M.T=null;var l=q.p;q.p=2;var u=at;at|=4;try{pg(i,s.alternate,s)}finally{at=u,q.p=l,M.T=r}}li=3}}function Kg(){if(li===4||li===3){li=0,Fe();var i=Gn,s=Da,r=Cn,l=kg;(s.subtreeFlags&10256)!==0||(s.flags&10256)!==0?li=5:(li=0,Da=Gn=null,Ig(i,i.pendingLanes));var u=i.pendingLanes;if(u===0&&(Xn=null),Pi(r),s=s.stateNode,Pt&&typeof Pt.onCommitFiberRoot=="function")try{Pt.onCommitFiberRoot(as,s,void 0,(s.current.flags&128)===128)}catch{}if(l!==null){s=M.T,u=q.p,q.p=2,M.T=null;try{for(var d=i.onRecoverableError,v=0;v<l.length;v++){var S=l[v];d(S.value,{componentStack:S.stack})}}finally{M.T=s,q.p=u}}(Cn&3)!==0&&Lc(),Js(i),u=i.pendingLanes,(r&261930)!==0&&(u&42)!==0?i===Rd?Bl++:(Bl=0,Rd=i):Bl=0,Ol(0)}}function Ig(i,s){(i.pooledCacheLanes&=s)===0&&(s=i.pooledCache,s!=null&&(i.pooledCache=null,ml(s)))}function Lc(){return Ug(),Pg(),Kg(),Fg()}function Fg(){if(li!==5)return!1;var i=Gn,s=kd;kd=0;var r=Pi(Cn),l=M.T,u=q.p;try{q.p=32>r?32:r,M.T=null,r=Dd,Dd=null;var d=Gn,v=Cn;if(li=0,Da=Gn=null,Cn=0,(at&6)!==0)throw Error(a(331));var S=at;if(at|=4,xg(d.current),Sg(d,d.current,v,r),at=S,Ol(0,!1),Pt&&typeof Pt.onPostCommitFiberRoot=="function")try{Pt.onPostCommitFiberRoot(as,d)}catch{}return!0}finally{q.p=u,M.T=l,Ig(i,s)}}function qg(i,s,r){s=Ts(r,s),s=ld(i.stateNode,s,2),i=Fn(i,s,2),i!==null&&(xi(i,2),Js(i))}function ut(i,s,r){if(i.tag===3)qg(i,i,r);else for(;s!==null;){if(s.tag===3){qg(s,i,r);break}else if(s.tag===1){var l=s.stateNode;if(typeof s.type.getDerivedStateFromError=="function"||typeof l.componentDidCatch=="function"&&(Xn===null||!Xn.has(l))){i=Ts(r,i),r=Wv(2),l=Fn(s,r,2),l!==null&&($v(r,l,s,i),xi(l,2),Js(l));break}}s=s.return}}function Ad(i,s,r){var l=i.pingCache;if(l===null){l=i.pingCache=new gC;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)||(xd=!0,u.add(r),i=CC.bind(null,i,s,r),s.then(i,i))}function CC(i,s,r){var l=i.pingCache;l!==null&&l.delete(s),i.pingedLanes|=i.suspendedLanes&r,i.warmLanes&=~r,gt===i&&(Qe&r)===r&&(jt===4||jt===3&&(Qe&62914560)===Qe&&300>Oe()-kc?(at&2)===0&&Ra(i,0):Ed|=r,ka===Qe&&(ka=0)),Js(i)}function Wg(i,s){s===0&&(s=Yt()),i=Rr(i,s),i!==null&&(xi(i,s),Js(i))}function xC(i){var s=i.memoizedState,r=0;s!==null&&(r=s.retryLane),Wg(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),Wg(i,r)}function TC(i,s){return ht(i,s)}var Bc=null,Na=null,Ld=!1,Oc=!1,Bd=!1,Qn=0;function Js(i){i!==Na&&i.next===null&&(Na===null?Bc=Na=i:Na=Na.next=i),Oc=!0,Ld||(Ld=!0,DC())}function Ol(i,s){if(!Bd&&Oc){Bd=!0;do for(var r=!1,l=Bc;l!==null;){if(i!==0){var u=l.pendingLanes;if(u===0)var d=0;else{var v=l.suspendedLanes,S=l.pingedLanes;d=(1<<31-Lt(42|i)+1)-1,d&=u&~(v&~S),d=d&201326741?d&201326741|1:d?d|2:0}d!==0&&(r=!0,Xg(l,d))}else d=Qe,d=Bt(l,l===gt?d:0,l.cancelPendingCommit!==null||l.timeoutHandle!==-1),(d&3)===0||ii(l,d)||(r=!0,Xg(l,d));l=l.next}while(r);Bd=!1}}function kC(){$g()}function $g(){Oc=Ld=!1;var i=0;Qn!==0&&HC()&&(i=Qn);for(var s=Oe(),r=null,l=Bc;l!==null;){var u=l.next,d=Yg(l,s);d===0?(l.next=null,r===null?Bc=u:r.next=u,u===null&&(Na=r)):(r=l,(i!==0||(d&3)!==0)&&(Oc=!0)),l=u}li!==0&&li!==5||Ol(i),Qn!==0&&(Qn=0)}function Yg(i,s){for(var r=i.suspendedLanes,l=i.pingedLanes,u=i.expirationTimes,d=i.pendingLanes&-62914561;0<d;){var v=31-Lt(d),S=1<<v,R=u[v];R===-1?((S&r)===0||(S&l)!==0)&&(u[v]=kt(S,s)):R<=s&&(i.expiredLanes|=S),d&=~S}if(s=gt,r=Qe,r=Bt(i,i===s?r:0,i.cancelPendingCommit!==null||i.timeoutHandle!==-1),l=i.callbackNode,r===0||i===s&&(ct===2||ct===9)||i.cancelPendingCommit!==null)return l!==null&&l!==null&&Si(l),i.callbackNode=null,i.callbackPriority=0;if((r&3)===0||ii(i,r)){if(s=r&-r,s===i.callbackPriority)return s;switch(l!==null&&Si(l),Pi(r)){case 2:case 8:r=Ai;break;case 32:r=$t;break;case 268435456:r=Li;break;default:r=$t}return l=Vg.bind(null,i),r=ht(r,l),i.callbackPriority=s,i.callbackNode=r,s}return l!==null&&l!==null&&Si(l),i.callbackPriority=2,i.callbackNode=null,2}function Vg(i,s){if(li!==0&&li!==5)return i.callbackNode=null,i.callbackPriority=0,null;var r=i.callbackNode;if(Lc()&&i.callbackNode!==r)return null;var l=Qe;return l=Bt(i,i===gt?l:0,i.cancelPendingCommit!==null||i.timeoutHandle!==-1),l===0?null:(Rg(i,l,s),Yg(i,Oe()),i.callbackNode!=null&&i.callbackNode===r?Vg.bind(null,i):null)}function Xg(i,s){if(Lc())return null;Rg(i,s,!0)}function DC(){PC(function(){(at&6)!==0?ht(ji,kC):$g()})}function Od(){if(Qn===0){var i=_a;i===0&&(i=bs,bs<<=1,(bs&261888)===0&&(bs=256)),Qn=i}return Qn}function Gg(i){return i==null||typeof i=="symbol"||typeof i=="boolean"?null:typeof i=="function"?i:Er(""+i)}function Zg(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 RC(i,s,r,l,u){if(s==="submit"&&r&&r.stateNode===u){var d=Gg((u[ni]||null).action),v=l.submitter;v&&(s=(s=v[ni]||null)?Gg(s.formAction):v.getAttribute("formAction"),s!==null&&(d=s,v=null));var S=new Yo("action","action",null,l,u);i.push({event:S,listeners:[{instance:null,listener:function(){if(l.defaultPrevented){if(Qn!==0){var R=v?Zg(u,v):new FormData(u);td(r,{pending:!0,data:R,method:u.method,action:d},null,R)}}else typeof d=="function"&&(S.preventDefault(),R=v?Zg(u,v):new FormData(u),td(r,{pending:!0,data:R,method:u.method,action:d},d,R))},currentTarget:u}]})}}for(var zd=0;zd<gh.length;zd++){var jd=gh[zd],MC=jd.toLowerCase(),NC=jd[0].toUpperCase()+jd.slice(1);Fs(MC,"on"+NC)}Fs(D_,"onAnimationEnd"),Fs(R_,"onAnimationIteration"),Fs(M_,"onAnimationStart"),Fs("dblclick","onDoubleClick"),Fs("focusin","onFocus"),Fs("focusout","onBlur"),Fs(Y1,"onTransitionRun"),Fs(V1,"onTransitionStart"),Fs(X1,"onTransitionCancel"),Fs(N_,"onTransitionEnd"),Cs("onMouseEnter",["mouseout","mouseover"]),Cs("onMouseLeave",["mouseout","mouseover"]),Cs("onPointerEnter",["pointerout","pointerover"]),Cs("onPointerLeave",["pointerout","pointerover"]),os("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),os("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),os("onBeforeInput",["compositionend","keypress","textInput","paste"]),os("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),os("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),os("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var zl="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(" "),AC=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(zl));function Qg(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 d=void 0;if(s)for(var v=l.length-1;0<=v;v--){var S=l[v],R=S.instance,F=S.currentTarget;if(S=S.listener,R!==d&&u.isPropagationStopped())break e;d=S,u.currentTarget=F;try{d(u)}catch(se){Go(se)}u.currentTarget=null,d=R}else for(v=0;v<l.length;v++){if(S=l[v],R=S.instance,F=S.currentTarget,S=S.listener,R!==d&&u.isPropagationStopped())break e;d=S,u.currentTarget=F;try{d(u)}catch(se){Go(se)}u.currentTarget=null,d=R}}}}function Ze(i,s){var r=s[Vt];r===void 0&&(r=s[Vt]=new Set);var l=i+"__bubble";r.has(l)||(Jg(s,i,2,!1),r.add(l))}function Hd(i,s,r){var l=0;s&&(l|=4),Jg(r,i,l,s)}var zc="_reactListening"+Math.random().toString(36).slice(2);function Ud(i){if(!i[zc]){i[zc]=!0,na.forEach(function(r){r!=="selectionchange"&&(AC.has(r)||Hd(r,!1,i),Hd(r,!0,i))});var s=i.nodeType===9?i:i.ownerDocument;s===null||s[zc]||(s[zc]=!0,Hd("selectionchange",!1,s))}}function Jg(i,s,r,l){switch(Dy(s)){case 2:var u=ax;break;case 8:u=lx;break;default:u=ef}r=u.bind(null,s,r,i),u=void 0,!rh||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 Pd(i,s,r,l,u){var d=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 S=l.stateNode.containerInfo;if(S===u)break;if(v===4)for(v=l.return;v!==null;){var R=v.tag;if((R===3||R===4)&&v.stateNode.containerInfo===u)return;v=v.return}for(;S!==null;){if(v=di(S),v===null)return;if(R=v.tag,R===5||R===6||R===26||R===27){l=d=v;continue e}S=S.parentNode}}l=l.return}n_(function(){var F=d,se=ra(r),ce=[];e:{var $=A_.get(i);if($!==void 0){var Z=Yo,Ee=i;switch(i){case"keypress":if(Wo(r)===0)break e;case"keydown":case"keyup":Z=E1;break;case"focusin":Ee="focus",Z=ch;break;case"focusout":Ee="blur",Z=ch;break;case"beforeblur":case"afterblur":Z=ch;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=l_;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":Z=f1;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":Z=D1;break;case D_:case R_:case M_:Z=_1;break;case N_:Z=M1;break;case"scroll":case"scrollend":Z=h1;break;case"wheel":Z=A1;break;case"copy":case"cut":case"paste":Z=g1;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":Z=c_;break;case"toggle":case"beforetoggle":Z=B1}var je=(s&4)!==0,pt=!je&&(i==="scroll"||i==="scrollend"),H=je?$!==null?$+"Capture":null:$;je=[];for(var L=F,I;L!==null;){var ae=L;if(I=ae.stateNode,ae=ae.tag,ae!==5&&ae!==26&&ae!==27||I===null||H===null||(ae=nl(L,H),ae!=null&&je.push(jl(L,ae,I))),pt)break;L=L.return}0<je.length&&($=new Z($,Ee,null,r,se),ce.push({event:$,listeners:je}))}}if((s&7)===0){e:{if($=i==="mouseover"||i==="pointerover",Z=i==="mouseout"||i==="pointerout",$&&r!==xs&&(Ee=r.relatedTarget||r.fromElement)&&(di(Ee)||Ee[Gi]))break e;if((Z||$)&&($=se.window===se?se:($=se.ownerDocument)?$.defaultView||$.parentWindow:window,Z?(Ee=r.relatedTarget||r.toElement,Z=F,Ee=Ee?di(Ee):null,Ee!==null&&(pt=c(Ee),je=Ee.tag,Ee!==pt||je!==5&&je!==27&&je!==6)&&(Ee=null)):(Z=null,Ee=F),Z!==Ee)){if(je=l_,ae="onMouseLeave",H="onMouseEnter",L="mouse",(i==="pointerout"||i==="pointerover")&&(je=c_,ae="onPointerLeave",H="onPointerEnter",L="pointer"),pt=Z==null?$:ws(Z),I=Ee==null?$:ws(Ee),$=new je(ae,L+"leave",Z,r,se),$.target=pt,$.relatedTarget=I,ae=null,di(se)===F&&(je=new je(H,L+"enter",Ee,r,se),je.target=I,je.relatedTarget=pt,ae=je),pt=ae,Z&&Ee)t:{for(je=LC,H=Z,L=Ee,I=0,ae=H;ae;ae=je(ae))I++;ae=0;for(var Be=L;Be;Be=je(Be))ae++;for(;0<I-ae;)H=je(H),I--;for(;0<ae-I;)L=je(L),ae--;for(;I--;){if(H===L||L!==null&&H===L.alternate){je=H;break t}H=je(H),L=je(L)}je=null}else je=null;Z!==null&&ey(ce,$,Z,je,!1),Ee!==null&&pt!==null&&ey(ce,pt,Ee,je,!0)}}e:{if($=F?ws(F):window,Z=$.nodeName&&$.nodeName.toLowerCase(),Z==="select"||Z==="input"&&$.type==="file")var nt=v_;else if(m_($))if(g_)nt=q1;else{nt=I1;var Re=K1}else Z=$.nodeName,!Z||Z.toLowerCase()!=="input"||$.type!=="checkbox"&&$.type!=="radio"?F&&Ks(F.elementType)&&(nt=v_):nt=F1;if(nt&&(nt=nt(i,F))){__(ce,nt,r,se);break e}Re&&Re(i,$,F),i==="focusout"&&F&&$.type==="number"&&F.memoizedProps.value!=null&&oe($,"number",$.value)}switch(Re=F?ws(F):window,i){case"focusin":(m_(Re)||Re.contentEditable==="true")&&(oa=Re,mh=F,dl=null);break;case"focusout":dl=mh=oa=null;break;case"mousedown":_h=!0;break;case"contextmenu":case"mouseup":case"dragend":_h=!1,T_(ce,r,se);break;case"selectionchange":if($1)break;case"keydown":case"keyup":T_(ce,r,se)}var We;if(hh)e:{switch(i){case"compositionstart":var Je="onCompositionStart";break e;case"compositionend":Je="onCompositionEnd";break e;case"compositionupdate":Je="onCompositionUpdate";break e}Je=void 0}else la?f_(i,r)&&(Je="onCompositionEnd"):i==="keydown"&&r.keyCode===229&&(Je="onCompositionStart");Je&&(u_&&r.locale!=="ko"&&(la||Je!=="onCompositionStart"?Je==="onCompositionEnd"&&la&&(We=r_()):(zn=se,ah="value"in zn?zn.value:zn.textContent,la=!0)),Re=jc(F,Je),0<Re.length&&(Je=new o_(Je,i,null,r,se),ce.push({event:Je,listeners:Re}),We?Je.data=We:(We=p_(r),We!==null&&(Je.data=We)))),(We=z1?j1(i,r):H1(i,r))&&(Je=jc(F,"onBeforeInput"),0<Je.length&&(Re=new o_("onBeforeInput","beforeinput",null,r,se),ce.push({event:Re,listeners:Je}),Re.data=We)),RC(ce,i,F,r,se)}Qg(ce,s)})}function jl(i,s,r){return{instance:i,listener:s,currentTarget:r}}function jc(i,s){for(var r=s+"Capture",l=[];i!==null;){var u=i,d=u.stateNode;if(u=u.tag,u!==5&&u!==26&&u!==27||d===null||(u=nl(i,r),u!=null&&l.unshift(jl(i,u,d)),u=nl(i,s),u!=null&&l.push(jl(i,u,d))),i.tag===3)return l;i=i.return}return[]}function LC(i){if(i===null)return null;do i=i.return;while(i&&i.tag!==5&&i.tag!==27);return i||null}function ey(i,s,r,l,u){for(var d=s._reactName,v=[];r!==null&&r!==l;){var S=r,R=S.alternate,F=S.stateNode;if(S=S.tag,R!==null&&R===l)break;S!==5&&S!==26&&S!==27||F===null||(R=F,u?(F=nl(r,d),F!=null&&v.unshift(jl(r,F,R))):u||(F=nl(r,d),F!=null&&v.push(jl(r,F,R)))),r=r.return}v.length!==0&&i.push({event:s,listeners:v})}var BC=/\r\n?/g,OC=/\u0000|\uFFFD/g;function ty(i){return(typeof i=="string"?i:""+i).replace(BC,`
|
|
10
|
-
`).replace(OC,"")}function iy(i,s){return s=ty(s),ty(i)===s}function ft(i,s,r,l,u,d){switch(r){case"children":typeof l=="string"?s==="body"||s==="textarea"&&l===""||it(i,l):(typeof l=="number"||typeof l=="bigint")&&s!=="body"&&it(i,""+l);break;case"className":Ps(i,"class",l);break;case"tabIndex":Ps(i,"tabindex",l);break;case"dir":case"role":case"viewBox":case"width":case"height":Ps(i,r,l);break;case"style":Zi(i,l,d);break;case"data":if(s!=="object"){Ps(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=Er(""+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 d=="function"&&(r==="formAction"?(s!=="input"&&ft(i,s,"name",u.name,u,null),ft(i,s,"formEncType",u.formEncType,u,null),ft(i,s,"formMethod",u.formMethod,u,null),ft(i,s,"formTarget",u.formTarget,u,null)):(ft(i,s,"encType",u.encType,u,null),ft(i,s,"method",u.method,u,null),ft(i,s,"target",u.target,u,null)));if(l==null||typeof l=="symbol"||typeof l=="boolean"){i.removeAttribute(r);break}l=Er(""+l),i.setAttribute(r,l);break;case"onClick":l!=null&&(i.onclick=Is);break;case"onScroll":l!=null&&Ze("scroll",i);break;case"onScrollEnd":l!=null&&Ze("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=Er(""+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":Ze("beforetoggle",i),Ze("toggle",i),Ii(i,"popover",l);break;case"xlinkActuate":k(i,"http://www.w3.org/1999/xlink","xlink:actuate",l);break;case"xlinkArcrole":k(i,"http://www.w3.org/1999/xlink","xlink:arcrole",l);break;case"xlinkRole":k(i,"http://www.w3.org/1999/xlink","xlink:role",l);break;case"xlinkShow":k(i,"http://www.w3.org/1999/xlink","xlink:show",l);break;case"xlinkTitle":k(i,"http://www.w3.org/1999/xlink","xlink:title",l);break;case"xlinkType":k(i,"http://www.w3.org/1999/xlink","xlink:type",l);break;case"xmlBase":k(i,"http://www.w3.org/XML/1998/namespace","xml:base",l);break;case"xmlLang":k(i,"http://www.w3.org/XML/1998/namespace","xml:lang",l);break;case"xmlSpace":k(i,"http://www.w3.org/XML/1998/namespace","xml:space",l);break;case"is":Ii(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=xr.get(r)||r,Ii(i,r,l))}}function Kd(i,s,r,l,u,d){switch(r){case"style":Zi(i,l,d);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"?it(i,l):(typeof l=="number"||typeof l=="bigint")&&it(i,""+l);break;case"onScroll":l!=null&&Ze("scroll",i);break;case"onScrollEnd":l!=null&&Ze("scrollend",i);break;case"onClick":l!=null&&(i.onclick=Is);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Sr.hasOwnProperty(r))e:{if(r[0]==="o"&&r[1]==="n"&&(u=r.endsWith("Capture"),s=r.slice(2,u?r.length-7:void 0),d=i[ni]||null,d=d!=null?d[r]:null,typeof d=="function"&&i.removeEventListener(s,d,u),typeof l=="function")){typeof d!="function"&&d!==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,""):Ii(i,r,l)}}}function Mi(i,s,r){switch(s){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Ze("error",i),Ze("load",i);var l=!1,u=!1,d;for(d in r)if(r.hasOwnProperty(d)){var v=r[d];if(v!=null)switch(d){case"src":l=!0;break;case"srcSet":u=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(a(137,s));default:ft(i,s,d,v,r,null)}}u&&ft(i,s,"srcSet",r.srcSet,r,null),l&&ft(i,s,"src",r.src,r,null);return;case"input":Ze("invalid",i);var S=d=v=u=null,R=null,F=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":R=se;break;case"defaultChecked":F=se;break;case"value":d=se;break;case"defaultValue":S=se;break;case"children":case"dangerouslySetInnerHTML":if(se!=null)throw Error(a(137,s));break;default:ft(i,s,l,se,r,null)}}A(i,d,S,R,F,v,u,!1);return;case"select":Ze("invalid",i),l=v=d=null;for(u in r)if(r.hasOwnProperty(u)&&(S=r[u],S!=null))switch(u){case"value":d=S;break;case"defaultValue":v=S;break;case"multiple":l=S;default:ft(i,s,u,S,r,null)}s=d,r=v,i.multiple=!!l,s!=null?Le(i,!!l,s,!1):r!=null&&Le(i,!!l,r,!0);return;case"textarea":Ze("invalid",i),d=u=l=null;for(v in r)if(r.hasOwnProperty(v)&&(S=r[v],S!=null))switch(v){case"value":l=S;break;case"defaultValue":u=S;break;case"children":d=S;break;case"dangerouslySetInnerHTML":if(S!=null)throw Error(a(91));break;default:ft(i,s,v,S,r,null)}Ye(i,l,u,d);return;case"option":for(R in r)r.hasOwnProperty(R)&&(l=r[R],l!=null)&&(R==="selected"?i.selected=l&&typeof l!="function"&&typeof l!="symbol":ft(i,s,R,l,r,null));return;case"dialog":Ze("beforetoggle",i),Ze("toggle",i),Ze("cancel",i),Ze("close",i);break;case"iframe":case"object":Ze("load",i);break;case"video":case"audio":for(l=0;l<zl.length;l++)Ze(zl[l],i);break;case"image":Ze("error",i),Ze("load",i);break;case"details":Ze("toggle",i);break;case"embed":case"source":case"link":Ze("error",i),Ze("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(F in r)if(r.hasOwnProperty(F)&&(l=r[F],l!=null))switch(F){case"children":case"dangerouslySetInnerHTML":throw Error(a(137,s));default:ft(i,s,F,l,r,null)}return;default:if(Ks(s)){for(se in r)r.hasOwnProperty(se)&&(l=r[se],l!==void 0&&Kd(i,s,se,l,r,void 0));return}}for(S in r)r.hasOwnProperty(S)&&(l=r[S],l!=null&&ft(i,s,S,l,r,null))}function zC(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,d=null,v=null,S=null,R=null,F=null,se=null;for(Z in r){var ce=r[Z];if(r.hasOwnProperty(Z)&&ce!=null)switch(Z){case"checked":break;case"value":break;case"defaultValue":R=ce;default:l.hasOwnProperty(Z)||ft(i,s,Z,null,l,ce)}}for(var $ in l){var Z=l[$];if(ce=r[$],l.hasOwnProperty($)&&(Z!=null||ce!=null))switch($){case"type":d=Z;break;case"name":u=Z;break;case"checked":F=Z;break;case"defaultChecked":se=Z;break;case"value":v=Z;break;case"defaultValue":S=Z;break;case"children":case"dangerouslySetInnerHTML":if(Z!=null)throw Error(a(137,s));break;default:Z!==ce&&ft(i,s,$,Z,l,ce)}}Fi(i,v,S,R,F,se,d,u);return;case"select":Z=v=S=$=null;for(d in r)if(R=r[d],r.hasOwnProperty(d)&&R!=null)switch(d){case"value":break;case"multiple":Z=R;default:l.hasOwnProperty(d)||ft(i,s,d,null,l,R)}for(u in l)if(d=l[u],R=r[u],l.hasOwnProperty(u)&&(d!=null||R!=null))switch(u){case"value":$=d;break;case"defaultValue":S=d;break;case"multiple":v=d;default:d!==R&&ft(i,s,u,d,l,R)}s=S,r=v,l=Z,$!=null?Le(i,!!r,$,!1):!!l!=!!r&&(s!=null?Le(i,!!r,s,!0):Le(i,!!r,r?[]:"",!1));return;case"textarea":Z=$=null;for(S in r)if(u=r[S],r.hasOwnProperty(S)&&u!=null&&!l.hasOwnProperty(S))switch(S){case"value":break;case"children":break;default:ft(i,s,S,null,l,u)}for(v in l)if(u=l[v],d=r[v],l.hasOwnProperty(v)&&(u!=null||d!=null))switch(v){case"value":$=u;break;case"defaultValue":Z=u;break;case"children":break;case"dangerouslySetInnerHTML":if(u!=null)throw Error(a(91));break;default:u!==d&&ft(i,s,v,u,l,d)}ze(i,$,Z);return;case"option":for(var Ee in r)$=r[Ee],r.hasOwnProperty(Ee)&&$!=null&&!l.hasOwnProperty(Ee)&&(Ee==="selected"?i.selected=!1:ft(i,s,Ee,null,l,$));for(R in l)$=l[R],Z=r[R],l.hasOwnProperty(R)&&$!==Z&&($!=null||Z!=null)&&(R==="selected"?i.selected=$&&typeof $!="function"&&typeof $!="symbol":ft(i,s,R,$,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 je in r)$=r[je],r.hasOwnProperty(je)&&$!=null&&!l.hasOwnProperty(je)&&ft(i,s,je,null,l,$);for(F in l)if($=l[F],Z=r[F],l.hasOwnProperty(F)&&$!==Z&&($!=null||Z!=null))switch(F){case"children":case"dangerouslySetInnerHTML":if($!=null)throw Error(a(137,s));break;default:ft(i,s,F,$,l,Z)}return;default:if(Ks(s)){for(var pt in r)$=r[pt],r.hasOwnProperty(pt)&&$!==void 0&&!l.hasOwnProperty(pt)&&Kd(i,s,pt,void 0,l,$);for(se in l)$=l[se],Z=r[se],!l.hasOwnProperty(se)||$===Z||$===void 0&&Z===void 0||Kd(i,s,se,$,l,Z);return}}for(var H in r)$=r[H],r.hasOwnProperty(H)&&$!=null&&!l.hasOwnProperty(H)&&ft(i,s,H,null,l,$);for(ce in l)$=l[ce],Z=r[ce],!l.hasOwnProperty(ce)||$===Z||$==null&&Z==null||ft(i,s,ce,$,l,Z)}function sy(i){switch(i){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function jC(){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],d=u.transferSize,v=u.initiatorType,S=u.duration;if(d&&S&&sy(v)){for(v=0,S=u.responseEnd,l+=1;l<r.length;l++){var R=r[l],F=R.startTime;if(F>S)break;var se=R.transferSize,ce=R.initiatorType;se&&sy(ce)&&(R=R.responseEnd,v+=se*(R<S?1:(S-F)/(R-F)))}if(--l,s+=8*(d+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 Id=null,Fd=null;function Hc(i){return i.nodeType===9?i:i.ownerDocument}function ny(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 ry(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 qd(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 Wd=null;function HC(){var i=window.event;return i&&i.type==="popstate"?i===Wd?!1:(Wd=i,!0):(Wd=null,!1)}var ay=typeof setTimeout=="function"?setTimeout:void 0,UC=typeof clearTimeout=="function"?clearTimeout:void 0,ly=typeof Promise=="function"?Promise:void 0,PC=typeof queueMicrotask=="function"?queueMicrotask:typeof ly<"u"?function(i){return ly.resolve(null).then(i).catch(KC)}:ay;function KC(i){setTimeout(function(){throw i})}function Jn(i){return i==="head"}function oy(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),Oa(s);return}l--}else if(r==="$"||r==="$?"||r==="$~"||r==="$!"||r==="&")l++;else if(r==="html")Hl(i.ownerDocument.documentElement);else if(r==="head"){r=i.ownerDocument.head,Hl(r);for(var d=r.firstChild;d;){var v=d.nextSibling,S=d.nodeName;d[ls]||S==="SCRIPT"||S==="STYLE"||S==="LINK"&&d.rel.toLowerCase()==="stylesheet"||r.removeChild(d),d=v}}else r==="body"&&Hl(i.ownerDocument.body);r=u}while(r);Oa(s)}function cy(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 $d(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":$d(r),Bn(r);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(r.rel.toLowerCase()==="stylesheet")continue}i.removeChild(r)}}function IC(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[ls])switch(s){case"meta":if(!i.hasAttribute("itemprop"))break;return i;case"link":if(d=i.getAttribute("rel"),d==="stylesheet"&&i.hasAttribute("data-precedence"))break;if(d!==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(d=i.getAttribute("src"),(d!==(u.src==null?null:u.src)||i.getAttribute("type")!==(u.type==null?null:u.type)||i.getAttribute("crossorigin")!==(u.crossOrigin==null?null:u.crossOrigin))&&d&&i.hasAttribute("async")&&!i.hasAttribute("itemprop"))break;return i;default:return i}}else if(s==="input"&&i.type==="hidden"){var d=u.name==null?null:""+u.name;if(u.type==="hidden"&&i.getAttribute("name")===d)return i}else return i;if(i=Ns(i.nextSibling),i===null)break}return null}function FC(i,s,r){if(s==="")return null;for(;i.nodeType!==3;)if((i.nodeType!==1||i.nodeName!=="INPUT"||i.type!=="hidden")&&!r||(i=Ns(i.nextSibling),i===null))return null;return i}function uy(i,s){for(;i.nodeType!==8;)if((i.nodeType!==1||i.nodeName!=="INPUT"||i.type!=="hidden")&&!s||(i=Ns(i.nextSibling),i===null))return null;return i}function Yd(i){return i.data==="$?"||i.data==="$~"}function Vd(i){return i.data==="$!"||i.data==="$?"&&i.ownerDocument.readyState!=="loading"}function qC(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 Ns(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 Xd=null;function hy(i){i=i.nextSibling;for(var s=0;i;){if(i.nodeType===8){var r=i.data;if(r==="/$"||r==="/&"){if(s===0)return Ns(i.nextSibling);s--}else r!=="$"&&r!=="$!"&&r!=="$?"&&r!=="$~"&&r!=="&"||s++}i=i.nextSibling}return null}function dy(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 fy(i,s,r){switch(s=Hc(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 Hl(i){for(var s=i.attributes;s.length;)i.removeAttributeNode(s[0]);Bn(i)}var As=new Map,py=new Set;function Uc(i){return typeof i.getRootNode=="function"?i.getRootNode():i.nodeType===9?i:i.ownerDocument}var xn=q.d;q.d={f:WC,r:$C,D:YC,C:VC,L:XC,m:GC,X:QC,S:ZC,M:JC};function WC(){var i=xn.f(),s=Mc();return i||s}function $C(i){var s=ri(i);s!==null&&s.tag===5&&s.type==="form"?Nv(s):xn.r(i)}var Aa=typeof document>"u"?null:document;function my(i,s,r){var l=Aa;if(l&&typeof s=="string"&&s){var u=ot(s);u='link[rel="'+i+'"][href="'+u+'"]',typeof r=="string"&&(u+='[crossorigin="'+r+'"]'),py.has(u)||(py.add(u),i={rel:i,crossOrigin:r,href:s},l.querySelector(u)===null&&(s=l.createElement("link"),Mi(s,"link",i),Mt(s),l.head.appendChild(s)))}}function YC(i){xn.D(i),my("dns-prefetch",i,null)}function VC(i,s){xn.C(i,s),my("preconnect",i,s)}function XC(i,s,r){xn.L(i,s,r);var l=Aa;if(l&&i&&s){var u='link[rel="preload"][as="'+ot(s)+'"]';s==="image"&&r&&r.imageSrcSet?(u+='[imagesrcset="'+ot(r.imageSrcSet)+'"]',typeof r.imageSizes=="string"&&(u+='[imagesizes="'+ot(r.imageSizes)+'"]')):u+='[href="'+ot(i)+'"]';var d=u;switch(s){case"style":d=La(i);break;case"script":d=Ba(i)}As.has(d)||(i=y({rel:"preload",href:s==="image"&&r&&r.imageSrcSet?void 0:i,as:s},r),As.set(d,i),l.querySelector(u)!==null||s==="style"&&l.querySelector(Ul(d))||s==="script"&&l.querySelector(Pl(d))||(s=l.createElement("link"),Mi(s,"link",i),Mt(s),l.head.appendChild(s)))}}function GC(i,s){xn.m(i,s);var r=Aa;if(r&&i){var l=s&&typeof s.as=="string"?s.as:"script",u='link[rel="modulepreload"][as="'+ot(l)+'"][href="'+ot(i)+'"]',d=u;switch(l){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":d=Ba(i)}if(!As.has(d)&&(i=y({rel:"modulepreload",href:i},s),As.set(d,i),r.querySelector(u)===null)){switch(l){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(r.querySelector(Pl(d)))return}l=r.createElement("link"),Mi(l,"link",i),Mt(l),r.head.appendChild(l)}}}function ZC(i,s,r){xn.S(i,s,r);var l=Aa;if(l&&i){var u=Xs(l).hoistableStyles,d=La(i);s=s||"default";var v=u.get(d);if(!v){var S={loading:0,preload:null};if(v=l.querySelector(Ul(d)))S.loading=5;else{i=y({rel:"stylesheet",href:i,"data-precedence":s},r),(r=As.get(d))&&Gd(i,r);var R=v=l.createElement("link");Mt(R),Mi(R,"link",i),R._p=new Promise(function(F,se){R.onload=F,R.onerror=se}),R.addEventListener("load",function(){S.loading|=1}),R.addEventListener("error",function(){S.loading|=2}),S.loading|=4,Pc(v,s,l)}v={type:"stylesheet",instance:v,count:1,state:S},u.set(d,v)}}}function QC(i,s){xn.X(i,s);var r=Aa;if(r&&i){var l=Xs(r).hoistableScripts,u=Ba(i),d=l.get(u);d||(d=r.querySelector(Pl(u)),d||(i=y({src:i,async:!0},s),(s=As.get(u))&&Zd(i,s),d=r.createElement("script"),Mt(d),Mi(d,"link",i),r.head.appendChild(d)),d={type:"script",instance:d,count:1,state:null},l.set(u,d))}}function JC(i,s){xn.M(i,s);var r=Aa;if(r&&i){var l=Xs(r).hoistableScripts,u=Ba(i),d=l.get(u);d||(d=r.querySelector(Pl(u)),d||(i=y({src:i,async:!0,type:"module"},s),(s=As.get(u))&&Zd(i,s),d=r.createElement("script"),Mt(d),Mi(d,"link",i),r.head.appendChild(d)),d={type:"script",instance:d,count:1,state:null},l.set(u,d))}}function _y(i,s,r,l){var u=(u=pe.current)?Uc(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=La(r.href),r=Xs(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=La(r.href);var d=Xs(u).hoistableStyles,v=d.get(i);if(v||(u=u.ownerDocument||u,v={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},d.set(i,v),(d=u.querySelector(Ul(i)))&&!d._p&&(v.instance=d,v.state.loading=5),As.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},As.set(i,r),d||ex(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=Ba(r),r=Xs(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 La(i){return'href="'+ot(i)+'"'}function Ul(i){return'link[rel="stylesheet"]['+i+"]"}function vy(i){return y({},i,{"data-precedence":i.precedence,precedence:null})}function ex(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}),Mi(s,"link",r),Mt(s),i.head.appendChild(s))}function Ba(i){return'[src="'+ot(i)+'"]'}function Pl(i){return"script[async]"+i}function gy(i,s,r){if(s.count++,s.instance===null)switch(s.type){case"style":var l=i.querySelector('style[data-href~="'+ot(r.href)+'"]');if(l)return s.instance=l,Mt(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"),Mt(l),Mi(l,"style",u),Pc(l,r.precedence,i),s.instance=l;case"stylesheet":u=La(r.href);var d=i.querySelector(Ul(u));if(d)return s.state.loading|=4,s.instance=d,Mt(d),d;l=vy(r),(u=As.get(u))&&Gd(l,u),d=(i.ownerDocument||i).createElement("link"),Mt(d);var v=d;return v._p=new Promise(function(S,R){v.onload=S,v.onerror=R}),Mi(d,"link",l),s.state.loading|=4,Pc(d,r.precedence,i),s.instance=d;case"script":return d=Ba(r.src),(u=i.querySelector(Pl(d)))?(s.instance=u,Mt(u),u):(l=r,(u=As.get(d))&&(l=y({},r),Zd(l,u)),i=i.ownerDocument||i,u=i.createElement("script"),Mt(u),Mi(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,Pc(l,r.precedence,i));return s.instance}function Pc(i,s,r){for(var l=r.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),u=l.length?l[l.length-1]:null,d=u,v=0;v<l.length;v++){var S=l[v];if(S.dataset.precedence===s)d=S;else if(d!==u)break}d?d.parentNode.insertBefore(i,d.nextSibling):(s=r.nodeType===9?r.head:r,s.insertBefore(i,s.firstChild))}function Gd(i,s){i.crossOrigin==null&&(i.crossOrigin=s.crossOrigin),i.referrerPolicy==null&&(i.referrerPolicy=s.referrerPolicy),i.title==null&&(i.title=s.title)}function Zd(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 yy(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 d=r[u];if(!(d[ls]||d[Ot]||i==="link"&&d.getAttribute("rel")==="stylesheet")&&d.namespaceURI!=="http://www.w3.org/2000/svg"){var v=d.getAttribute(s)||"";v=i+v;var S=l.get(v);S?S.push(d):l.set(v,[d])}}return l}function by(i,s,r){i=i.ownerDocument||i,i.head.insertBefore(r,s==="title"?i.querySelector("head > title"):null)}function tx(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 Sy(i){return!(i.type==="stylesheet"&&(i.state.loading&3)===0)}function ix(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=La(l.href),d=s.querySelector(Ul(u));if(d){s=d._p,s!==null&&typeof s=="object"&&typeof s.then=="function"&&(i.count++,i=Ic.bind(i),s.then(i,i)),r.state.loading|=4,r.instance=d,Mt(d);return}d=s.ownerDocument||s,l=vy(l),(u=As.get(u))&&Gd(l,u),d=d.createElement("link"),Mt(d);var v=d;v._p=new Promise(function(S,R){v.onload=S,v.onerror=R}),Mi(d,"link",l),r.instance=d}i.stylesheets===null&&(i.stylesheets=new Map),i.stylesheets.set(r,s),(s=r.state.preload)&&(r.state.loading&3)===0&&(i.count++,r=Ic.bind(i),s.addEventListener("load",r),s.addEventListener("error",r))}}var Qd=0;function sx(i,s){return i.stylesheets&&i.count===0&&qc(i,i.stylesheets),0<i.count||0<i.imgCount?function(r){var l=setTimeout(function(){if(i.stylesheets&&qc(i,i.stylesheets),i.unsuspend){var d=i.unsuspend;i.unsuspend=null,d()}},6e4+s);0<i.imgBytes&&Qd===0&&(Qd=62500*jC());var u=setTimeout(function(){if(i.waitingForImages=!1,i.count===0&&(i.stylesheets&&qc(i,i.stylesheets),i.unsuspend)){var d=i.unsuspend;i.unsuspend=null,d()}},(i.imgBytes>Qd?50:800)+s);return i.unsuspend=r,function(){i.unsuspend=null,clearTimeout(l),clearTimeout(u)}}:null}function Ic(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)qc(this,this.stylesheets);else if(this.unsuspend){var i=this.unsuspend;this.unsuspend=null,i()}}}var Fc=null;function qc(i,s){i.stylesheets=null,i.unsuspend!==null&&(i.count++,Fc=new Map,s.forEach(nx,i),Fc=null,Ic.call(i))}function nx(i,s){if(!(s.state.loading&4)){var r=Fc.get(i);if(r)var l=r.get(null);else{r=new Map,Fc.set(i,r);for(var u=i.querySelectorAll("link[data-precedence],style[data-precedence]"),d=0;d<u.length;d++){var v=u[d];(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"),d=r.get(v)||l,d===l&&r.set(null,u),r.set(v,u),this.count++,l=Ic.bind(this),u.addEventListener("load",l),u.addEventListener("error",l),d?d.parentNode.insertBefore(u,d.nextSibling):(i=i.nodeType===9?i.head:i,i.insertBefore(u,i.firstChild)),s.state.loading|=4}}var Kl={$$typeof:K,Provider:null,Consumer:null,_currentValue:V,_currentValue2:V,_threadCount:0};function rx(i,s,r,l,u,d,v,S,R){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=si(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=si(0),this.hiddenUpdates=si(null),this.identifierPrefix=l,this.onUncaughtError=u,this.onCaughtError=d,this.onRecoverableError=v,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=R,this.incompleteTransitions=new Map}function wy(i,s,r,l,u,d,v,S,R,F,se,ce){return i=new rx(i,s,r,v,R,F,se,ce,S),s=1,d===!0&&(s|=24),d=hs(3,null,null,s),i.current=d,d.stateNode=i,s=Nh(),s.refCount++,i.pooledCache=s,s.refCount++,d.memoizedState={element:l,isDehydrated:r,cache:s},Oh(d),i}function Cy(i){return i?(i=ha,i):ha}function xy(i,s,r,l,u,d){u=Cy(u),l.context===null?l.context=u:l.pendingContext=u,l=In(s),l.payload={element:r},d=d===void 0?null:d,d!==null&&(l.callback=d),r=Fn(i,l,s),r!==null&&(ss(r,i,s),yl(r,i,s))}function Ey(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){Ey(i,s),(i=i.alternate)&&Ey(i,s)}function Ty(i){if(i.tag===13||i.tag===31){var s=Rr(i,67108864);s!==null&&ss(s,i,67108864),Jd(i,67108864)}}function ky(i){if(i.tag===13||i.tag===31){var s=_s();s=lt(s);var r=Rr(i,s);r!==null&&ss(r,i,s),Jd(i,s)}}var Wc=!0;function ax(i,s,r,l){var u=M.T;M.T=null;var d=q.p;try{q.p=2,ef(i,s,r,l)}finally{q.p=d,M.T=u}}function lx(i,s,r,l){var u=M.T;M.T=null;var d=q.p;try{q.p=8,ef(i,s,r,l)}finally{q.p=d,M.T=u}}function ef(i,s,r,l){if(Wc){var u=tf(l);if(u===null)Pd(i,s,l,$c,r),Ry(i,l);else if(cx(u,i,s,r,l))l.stopPropagation();else if(Ry(i,l),s&4&&-1<ox.indexOf(i)){for(;u!==null;){var d=ri(u);if(d!==null)switch(d.tag){case 3:if(d=d.stateNode,d.current.memoizedState.isDehydrated){var v=St(d.pendingLanes);if(v!==0){var S=d;for(S.pendingLanes|=2,S.entangledLanes|=2;v;){var R=1<<31-Lt(v);S.entanglements[1]|=R,v&=~R}Js(d),(at&6)===0&&(Dc=Oe()+500,Ol(0))}}break;case 31:case 13:S=Rr(d,2),S!==null&&ss(S,d,2),Mc(),Jd(d,2)}if(d=tf(l),d===null&&Pd(i,s,l,$c,r),d===u)break;u=d}u!==null&&l.stopPropagation()}else Pd(i,s,l,null,r)}}function tf(i){return i=ra(i),sf(i)}var $c=null;function sf(i){if($c=null,i=di(i),i!==null){var s=c(i);if(s===null)i=null;else{var r=s.tag;if(r===13){if(i=h(s),i!==null)return i;i=null}else if(r===31){if(i=f(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 $c=i,null}function Dy(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(Tt()){case ji:return 2;case Ai:return 8;case $t:case Vi:return 32;case Li:return 268435456;default:return 32}default:return 32}}var nf=!1,er=null,tr=null,ir=null,Il=new Map,Fl=new Map,sr=[],ox="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 Ry(i,s){switch(i){case"focusin":case"focusout":er=null;break;case"dragenter":case"dragleave":tr=null;break;case"mouseover":case"mouseout":ir=null;break;case"pointerover":case"pointerout":Il.delete(s.pointerId);break;case"gotpointercapture":case"lostpointercapture":Fl.delete(s.pointerId)}}function ql(i,s,r,l,u,d){return i===null||i.nativeEvent!==d?(i={blockedOn:s,domEventName:r,eventSystemFlags:l,nativeEvent:d,targetContainers:[u]},s!==null&&(s=ri(s),s!==null&&Ty(s)),i):(i.eventSystemFlags|=l,s=i.targetContainers,u!==null&&s.indexOf(u)===-1&&s.push(u),i)}function cx(i,s,r,l,u){switch(s){case"focusin":return er=ql(er,i,s,r,l,u),!0;case"dragenter":return tr=ql(tr,i,s,r,l,u),!0;case"mouseover":return ir=ql(ir,i,s,r,l,u),!0;case"pointerover":var d=u.pointerId;return Il.set(d,ql(Il.get(d)||null,i,s,r,l,u)),!0;case"gotpointercapture":return d=u.pointerId,Fl.set(d,ql(Fl.get(d)||null,i,s,r,l,u)),!0}return!1}function My(i){var s=di(i.target);if(s!==null){var r=c(s);if(r!==null){if(s=r.tag,s===13){if(s=h(r),s!==null){i.blockedOn=s,Ki(i.priority,function(){ky(r)});return}}else if(s===31){if(s=f(r),s!==null){i.blockedOn=s,Ki(i.priority,function(){ky(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 Yc(i){if(i.blockedOn!==null)return!1;for(var s=i.targetContainers;0<s.length;){var r=tf(i.nativeEvent);if(r===null){r=i.nativeEvent;var l=new r.constructor(r.type,r);xs=l,r.target.dispatchEvent(l),xs=null}else return s=ri(r),s!==null&&Ty(s),i.blockedOn=r,!1;s.shift()}return!0}function Ny(i,s,r){Yc(i)&&r.delete(s)}function ux(){nf=!1,er!==null&&Yc(er)&&(er=null),tr!==null&&Yc(tr)&&(tr=null),ir!==null&&Yc(ir)&&(ir=null),Il.forEach(Ny),Fl.forEach(Ny)}function Vc(i,s){i.blockedOn===s&&(i.blockedOn=null,nf||(nf=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,ux)))}var Xc=null;function Ay(i){Xc!==i&&(Xc=i,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){Xc===i&&(Xc=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(sf(l||r)===null)continue;break}var d=ri(r);d!==null&&(i.splice(s,3),s-=3,td(d,{pending:!0,data:u,method:r.method,action:l},l,u))}}))}function Oa(i){function s(R){return Vc(R,i)}er!==null&&Vc(er,i),tr!==null&&Vc(tr,i),ir!==null&&Vc(ir,i),Il.forEach(s),Fl.forEach(s);for(var r=0;r<sr.length;r++){var l=sr[r];l.blockedOn===i&&(l.blockedOn=null)}for(;0<sr.length&&(r=sr[0],r.blockedOn===null);)My(r),r.blockedOn===null&&sr.shift();if(r=(i.ownerDocument||i).$$reactFormReplay,r!=null)for(l=0;l<r.length;l+=3){var u=r[l],d=r[l+1],v=u[ni]||null;if(typeof d=="function")v||Ay(r);else if(v){var S=null;if(d&&d.hasAttribute("formAction")){if(u=d,v=d[ni]||null)S=v.formAction;else if(sf(u)!==null)continue}else S=v.action;typeof S=="function"?r[l+1]=S:(r.splice(l,3),l-=3),Ay(r)}}}function Ly(){function i(d){d.canIntercept&&d.info==="react-transition"&&d.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 d=navigation.currentEntry;d&&d.url!=null&&navigation.navigate(d.url,{state:d.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 rf(i){this._internalRoot=i}Gc.prototype.render=rf.prototype.render=function(i){var s=this._internalRoot;if(s===null)throw Error(a(409));var r=s.current,l=_s();xy(r,l,i,s,null,null)},Gc.prototype.unmount=rf.prototype.unmount=function(){var i=this._internalRoot;if(i!==null){this._internalRoot=null;var s=i.containerInfo;xy(i.current,2,null,i,null,null),Mc(),s[Gi]=null}};function Gc(i){this._internalRoot=i}Gc.prototype.unstable_scheduleHydration=function(i){if(i){var s=Ti();i={blockedOn:null,target:i,priority:s};for(var r=0;r<sr.length&&s!==0&&s<sr[r].priority;r++);sr.splice(r,0,i),r===0&&My(i)}};var By=t.version;if(By!=="19.2.6")throw Error(a(527,By,"19.2.6"));q.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=p(s),i=i!==null?b(i):null,i=i===null?null:i.stateNode,i};var hx={bundleType:0,version:"19.2.6",rendererPackageName:"react-dom",currentDispatcherRef:M,reconcilerVersion:"19.2.6"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Zc=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Zc.isDisabled&&Zc.supportsFiber)try{as=Zc.inject(hx),Pt=Zc}catch{}}return $l.createRoot=function(i,s){if(!o(i))throw Error(a(299));var r=!1,l="",u=Kv,d=Iv,v=Fv;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&&(d=s.onCaughtError),s.onRecoverableError!==void 0&&(v=s.onRecoverableError)),s=wy(i,1,!1,null,null,r,l,null,u,d,v,Ly),i[Gi]=s.current,Ud(i),new rf(s)},$l.hydrateRoot=function(i,s,r){if(!o(i))throw Error(a(299));var l=!1,u="",d=Kv,v=Iv,S=Fv,R=null;return r!=null&&(r.unstable_strictMode===!0&&(l=!0),r.identifierPrefix!==void 0&&(u=r.identifierPrefix),r.onUncaughtError!==void 0&&(d=r.onUncaughtError),r.onCaughtError!==void 0&&(v=r.onCaughtError),r.onRecoverableError!==void 0&&(S=r.onRecoverableError),r.formState!==void 0&&(R=r.formState)),s=wy(i,1,!0,s,r??null,l,u,R,d,v,S,Ly),s.context=Cy(null),r=s.current,l=_s(),l=lt(l),u=In(l),u.callback=null,Fn(r,u,l),r=l,s.current.lanes=r,xi(s,r),Js(s),i[Gi]=s.current,Ud(i),new Gc(s)},$l.version="19.2.6",$l}var qy;function Sx(){if(qy)return of.exports;qy=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(),of.exports=bx(),of.exports}var wx=Sx();class Mn extends Error{constructor(t,n){super(n),this.status=t,this.name="ApiError"}status}function Fu(e=fetch){return{getSession:()=>Te(e,"/api/auth/session"),setupPassword:t=>Te(e,"/api/auth/password",tt("POST",t)),login:t=>Te(e,"/api/auth/login",tt("POST",t)),reauth:t=>Te(e,"/api/auth/reauth",tt("POST",t)),logout:()=>Te(e,"/api/auth/logout",{method:"POST",credentials:"same-origin"}),setupTotp:()=>Te(e,"/api/auth/totp/setup",{method:"POST",credentials:"same-origin"}),activateTotp:t=>Te(e,"/api/auth/totp/activate",tt("POST",t)),disableTotp:()=>Te(e,"/api/auth/totp",{method:"DELETE",credentials:"same-origin"}),listDevices:()=>Te(e,"/api/auth/devices"),revokeDevice:async t=>{await Ha(e,`/api/auth/devices/${encodeURIComponent(t)}`,{method:"DELETE",credentials:"same-origin"})},listNetworks:()=>Te(e,"/api/auth/networks"),addNetwork:t=>Te(e,"/api/auth/networks",tt("POST",t)),removeNetwork:async t=>{await Ha(e,`/api/auth/networks/${encodeURIComponent(t)}`,{method:"DELETE",credentials:"same-origin"})},listAgents:()=>Te(e,"/api/agents"),addAgent:t=>Te(e,"/api/agents",tt("POST",t)),renameAgent:(t,n)=>Te(e,`/api/agents/${encodeURIComponent(t)}`,tt("PATCH",{name:n})),getMainInfo:()=>Te(e,"/api/main"),renameMain:t=>Te(e,"/api/main",tt("PATCH",{name:t})),removeAgent:async t=>{await Ha(e,`/api/agents/${encodeURIComponent(t)}`,{method:"DELETE",credentials:"same-origin"})},uninstallAgent:t=>Te(e,`/api/agents/${encodeURIComponent(t)}/uninstall`,{method:"POST",credentials:"same-origin"}),pingAgent:t=>Te(e,`/api/agents/${encodeURIComponent(t)}/ping`),getMainStats:()=>Te(e,"/api/stats"),getAgentStats:t=>Te(e,`/api/agents/${encodeURIComponent(t)}/stats`),getVersion:()=>Te(e,"/api/version"),checkUpdate:()=>Te(e,"/api/update/check",{method:"POST",credentials:"same-origin"}),runUpdate:()=>Te(e,"/api/update",{method:"POST",credentials:"same-origin"}),getAgentVersion:t=>Te(e,`/api/agents/${encodeURIComponent(t)}/version`),checkAgentUpdate:t=>Te(e,`/api/agents/${encodeURIComponent(t)}/update/check`,{method:"POST",credentials:"same-origin"}),runAgentUpdate:t=>Te(e,`/api/agents/${encodeURIComponent(t)}/update`,{method:"POST",credentials:"same-origin"}),listTerminals:()=>Te(e,"/api/terminals"),getTerminalLayout:()=>Te(e,"/api/terminal-layout"),saveTerminalLayout:t=>Te(e,"/api/terminal-layout",tt("PUT",t)),createFileRoot:t=>Te(e,"/api/files/root",tt("POST",t)),listFiles:t=>Te(e,"/api/files/list",tt("POST",t)),readFile:t=>Te(e,"/api/files/read",tt("POST",t)),writeFile:t=>Te(e,"/api/files/write",tt("POST",t)),createFileEntry:t=>Te(e,"/api/files/create",tt("POST",t)),moveFileEntry:t=>Te(e,"/api/files/move",tt("POST",t)),previewDeleteFileEntry:t=>Te(e,"/api/files/delete-preview",tt("POST",t)),deleteFileEntry:t=>Te(e,"/api/files/delete",tt("POST",t)),openFileInTerminal:t=>Te(e,"/api/files/open",tt("POST",t)),previewFile:t=>$S(e,"/api/files/preview",tt("POST",t)),createTerminal:(t={})=>Te(e,"/api/terminals",tt("POST",t)),closeTerminal:async t=>{await Ha(e,`/api/terminals/${encodeURIComponent(t)}`,{method:"DELETE",credentials:"same-origin"})},renameTerminal:(t,n)=>Te(e,`/api/terminals/${encodeURIComponent(t)}`,tt("PATCH",{title:n})),getTerminalHistory:(t,n={})=>Te(e,`/api/terminals/${encodeURIComponent(t)}/history${xu(n)}`),getTerminalTranscriptHistory:(t,n={})=>Te(e,`/api/terminals/${encodeURIComponent(t)}/transcript-history${xu(n)}`),getTerminalTranscriptSource:t=>Te(e,`/api/terminals/${encodeURIComponent(t)}/transcript-source`),listNotificationAssets:()=>Te(e,"/api/notification-assets"),uploadNotificationAsset:t=>{const n=new FormData;return n.append("asset",t),Te(e,"/api/notification-assets",{method:"POST",credentials:"same-origin",body:n})},updateNotificationAssetSelection:t=>Te(e,"/api/notification-assets/selection",tt("PUT",t)),deleteNotificationAsset:async t=>{await Ha(e,`/api/notification-assets/${encodeURIComponent(t)}`,{method:"DELETE",credentials:"same-origin"})}}}function yo(e,t=fetch){const n=a=>e?`/api/agents/${encodeURIComponent(e)}/${a}`:`/api/${a}`;return{isAgent:e!==null,listTerminals:()=>Te(t,n("terminals")),createTerminal:(a={})=>Te(t,n("terminals"),tt("POST",a)),closeTerminal:async a=>{await Ha(t,n(`terminals/${encodeURIComponent(a)}`),{method:"DELETE",credentials:"same-origin"})},renameTerminal:(a,o)=>Te(t,n(`terminals/${encodeURIComponent(a)}`),tt("PATCH",{title:o})),getTerminalHistory:(a,o={})=>Te(t,`${n(`terminals/${encodeURIComponent(a)}/history`)}${xu(o)}`),getTerminalTranscriptHistory:(a,o={})=>Te(t,`${n(`terminals/${encodeURIComponent(a)}/transcript-history`)}${xu(o)}`),getTerminalTranscriptSource:a=>Te(t,n(`terminals/${encodeURIComponent(a)}/transcript-source`)),getTerminalLayout:()=>Te(t,n("terminal-layout")),saveTerminalLayout:a=>Te(t,n("terminal-layout"),tt("PUT",a)),createFileRoot:a=>Te(t,n("files/root"),tt("POST",a)),listFiles:a=>Te(t,n("files/list"),tt("POST",a)),readFile:a=>Te(t,n("files/read"),tt("POST",a)),writeFile:a=>Te(t,n("files/write"),tt("POST",a)),createFileEntry:a=>Te(t,n("files/create"),tt("POST",a)),moveFileEntry:a=>Te(t,n("files/move"),tt("POST",a)),previewDeleteFileEntry:a=>Te(t,n("files/delete-preview"),tt("POST",a)),deleteFileEntry:a=>Te(t,n("files/delete"),tt("POST",a)),openFileInTerminal:a=>Te(t,n("files/open"),tt("POST",a)),previewFile:a=>$S(t,n("files/preview"),tt("POST",a)),createWebSocketUrl:(a,o=window.location.href)=>Cx(n(`terminals/${encodeURIComponent(a)}/ws`),o)}}function Cx(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 tt(e,t){return{method:e,headers:{"content-type":"application/json"},credentials:"same-origin",body:JSON.stringify(t)}}function xu(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)),e.includeTools!==void 0&&t.set("includeTools",e.includeTools?"true":"false");const n=t.toString();return n?`?${n}`:""}async function Te(e,t,n){const a=await e(t,n??{credentials:"same-origin"});await pm(a);try{return await a.json()}catch{throw new Mn(a.status,"invalid_json_response")}}async function Ha(e,t,n){const a=await e(t,n);await pm(a)}async function $S(e,t,n){const a=await e(t,n);return await pm(a),a.blob()}async function pm(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 Mn(e.status,t)}function YS({size:e=22}){return _.jsx("img",{className:"nterminal-mark",src:"/brand/nterminal-mark.svg",width:e,height:e,alt:"","aria-hidden":"true"})}function VS({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 so=WS();const qu=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Ga(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function mm(e){return"nodeType"in e}function rs(e){var t,n;return e?Ga(e)?e:mm(e)&&(t=(n=e.ownerDocument)==null?void 0:n.defaultView)!=null?t:window:window}function _m(e){const{Document:t}=rs(e);return e instanceof t}function Bo(e){return Ga(e)?!1:e instanceof rs(e).HTMLElement}function XS(e){return e instanceof rs(e).SVGElement}function Za(e){return e?Ga(e)?e.document:mm(e)?_m(e)?e:Bo(e)||XS(e)?e.ownerDocument:document:document:document}const mr=qu?g.useLayoutEffect:g.useEffect;function vm(e){const t=g.useRef(e);return mr(()=>{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 xx(){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 bo(e,t){t===void 0&&(t=[e]);const n=g.useRef(e);return mr(()=>{n.current!==e&&(n.current=e)},t),n}function Oo(e,t){const n=g.useRef();return g.useMemo(()=>{const a=e(n.current);return n.current=a,a},[...t])}function Eu(e){const t=vm(e),n=g.useRef(null),a=g.useCallback(o=>{o!==n.current&&t?.(o,n.current),n.current=o},[]);return[n,a]}function Uf(e){const t=g.useRef();return g.useEffect(()=>{t.current=e},[e]),t.current}let df={};function Wu(e,t){return g.useMemo(()=>{if(t)return t;const n=df[e]==null?0:df[e]+1;return df[e]=n,e+"-"+n},[e,t])}function GS(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,h)=>{const f=Object.entries(h);for(const[m,p]of f){const b=c[m];b!=null&&(c[m]=b+e*p)}return c},{...t})}}const qa=GS(1),Tu=GS(-1);function Ex(e){return"clientX"in e&&"clientY"in e}function ZS(e){if(!e)return!1;const{KeyboardEvent:t}=rs(e.target);return t&&e instanceof t}function Tx(e){if(!e)return!1;const{TouchEvent:t}=rs(e.target);return t&&e instanceof t}function Pf(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 Kf=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[Kf.Translate.toString(e),Kf.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:n,easing:a}=e;return t+" "+n+"ms "+a}}}),Wy="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function kx(e){return e.matches(Wy)?e:e.querySelector(Wy)}const Dx={display:"none"};function Rx(e){let{id:t,value:n}=e;return ei.createElement("div",{id:t,style:Dx},n)}function Mx(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 ei.createElement("div",{id:t,style:o,role:"status","aria-live":a,"aria-atomic":!0},n)}function Nx(){const[e,t]=g.useState("");return{announce:g.useCallback(a=>{a!=null&&t(a)},[]),announcement:e}}const QS=g.createContext(null);function Ax(e){const t=g.useContext(QS);g.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}function Lx(){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(h=>{var f;return(f=h[o])==null?void 0:f.call(h,c)})},[e]),t]}const Bx={draggable:`
|
|
9
|
+
`+l.stack}}var St=Object.prototype.hasOwnProperty,dt=e.unstable_scheduleCallback,wi=e.unstable_cancelCallback,Q=e.unstable_shouldYield,Fe=e.unstable_requestPaint,Oe=e.unstable_now,kt=e.unstable_getCurrentPriorityLevel,Ui=e.unstable_ImmediatePriority,Li=e.unstable_UserBlockingPriority,Yt=e.unstable_NormalPriority,Xi=e.unstable_LowPriority,Bi=e.unstable_IdlePriority,Gi=e.log,Xs=e.unstable_setDisableYieldValue,ls=null,Kt=null;function Ci(i){if(typeof Gi=="function"&&Xs(i),Kt&&typeof Kt.setStrictMode=="function")try{Kt.setStrictMode(ls,i)}catch{}}var Bt=Math.clz32?Math.clz32:on,xi=Math.log,Pi=Math.LN2;function on(i){return i>>>=0,i===0?32:31-(xi(i)/Pi|0)|0}var Ss=256,ws=262144,gt=4194304;function wt(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 Ot(i,s,r){var l=i.pendingLanes;if(l===0)return 0;var u=0,d=i.suspendedLanes,g=i.pingedLanes;i=i.warmLanes;var S=l&134217727;return S!==0?(l=S&~d,l!==0?u=wt(l):(g&=S,g!==0?u=wt(g):r||(r=S&~i,r!==0&&(u=wt(r))))):(S=l&~d,S!==0?u=wt(S):g!==0?u=wt(g):r||(r=l&~i,r!==0&&(u=wt(r)))),u===0?0:s!==0&&s!==u&&(s&d)===0&&(d=u&-u,r=s&-s,d>=r||d===32&&(r&4194048)!==0)?s:u}function ii(i,s){return(i.pendingLanes&~(i.suspendedLanes&~i.pingedLanes)&s)===0}function Dt(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 Vt(){var i=gt;return gt<<=1,(gt&62914560)===0&&(gt=4194304),i}function si(i){for(var s=[],r=0;31>r;r++)s.push(i);return s}function Ei(i,s){i.pendingLanes|=s,s!==268435456&&(i.suspendedLanes=0,i.pingedLanes=0,i.warmLanes=0)}function Ct(i,s,r,l,u,d){var g=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 S=i.entanglements,R=i.expirationTimes,F=i.hiddenUpdates;for(r=g&~r;0<r;){var ne=31-Bt(r),ce=1<<ne;S[ne]=0,R[ne]=-1;var $=F[ne];if($!==null)for(F[ne]=null,ne=0;ne<$.length;ne++){var Z=$[ne];Z!==null&&(Z.lane&=-536870913)}r&=~ce}l!==0&&Ki(i,l,0),d!==0&&u===0&&i.tag!==0&&(i.suspendedLanes|=d&~(g&~s))}function Ki(i,s,r){i.pendingLanes|=s,i.suspendedLanes&=~s;var l=31-Bt(s);i.entangledLanes|=s,i.entanglements[l]=i.entanglements[l]|1073741824|r&261930}function It(i,s){var r=i.entangledLanes|=s;for(i=i.entanglements;r;){var l=31-Bt(r),u=1<<l;u&s|i[l]&s&&(i[l]|=s),r&=~u}}function Ti(i,s){var r=s&-s;return r=(r&42)!==0?1:ot(r),(r&(i.suspendedLanes|s))!==0?0:r}function ot(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 Ii(i){return i&=-i,2<i?8<i?(i&134217727)!==0?32:268435456:8:2}function ki(){var i=q.p;return i!==0?i:(i=window.event,i===void 0?32:Ny(i.type))}function Fi(i,s){var r=q.p;try{return q.p=i,s()}finally{q.p=r}}var nt=Math.random().toString(36).slice(2),zt="__reactFiber$"+nt,ni="__reactProps$"+nt,Zi="__reactContainer$"+nt,Xt="__reactEvents$"+nt,rl="__reactListeners$"+nt,na="__reactHandles$"+nt,Sr="__reactResources$"+nt,os="__reactMarker$"+nt;function On(i){delete i[zt],delete i[ni],delete i[Xt],delete i[rl],delete i[na]}function fi(i){var s=i[zt];if(s)return s;for(var r=i.parentNode;r;){if(s=r[Zi]||r[zt]){if(r=s.alternate,s.child!==null||r!==null&&r.child!==null)for(i=my(i);i!==null;){if(r=i[zt])return r;i=my(i)}return s}i=r,r=i.parentNode}return null}function ri(i){if(i=i[zt]||i[Zi]){var s=i.tag;if(s===5||s===6||s===13||s===31||s===26||s===27||s===3)return i}return null}function Cs(i){var s=i.tag;if(s===5||s===26||s===27||s===6)return i.stateNode;throw Error(a(33))}function Gs(i){var s=i[Sr];return s||(s=i[Sr]={hoistableStyles:new Map,hoistableScripts:new Map}),s}function Nt(i){i[os]=!0}var ra=new Set,wr={};function cs(i,s){xs(i,s),xs(i+"Capture",s)}function xs(i,s){for(wr[i]=s,i=0;i<s.length;i++)ra.add(s[i])}var Cr=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]*$"),zn={},xr={};function al(i){return St.call(xr,i)?!0:St.call(zn,i)?!1:Cr.test(i)?xr[i]=!0:(zn[i]=!0,!1)}function Oi(i,s,r){if(al(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 Ks(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 k(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 O(i){switch(typeof i){case"bigint":case"boolean":case"number":case"string":case"undefined":return i;case"object":return i;default:return""}}function J(i){var s=i.type;return(i=i.nodeName)&&i.toLowerCase()==="input"&&(s==="checkbox"||s==="radio")}function fe(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,d=l.set;return Object.defineProperty(i,s,{configurable:!0,get:function(){return u.call(this)},set:function(g){r=""+g,d.call(this,g)}}),Object.defineProperty(i,s,{enumerable:l.enumerable}),{getValue:function(){return r},setValue:function(g){r=""+g},stopTracking:function(){i._valueTracker=null,delete i[s]}}}}function xe(i){if(!i._valueTracker){var s=J(i)?"checked":"value";i._valueTracker=fe(i,s,""+i[s])}}function Ne(i){if(!i)return!1;var s=i._valueTracker;if(!s)return!0;var r=s.getValue(),l="";return i&&(l=J(i)?i.checked?"true":"false":i.value),i=l,i!==r?(s.setValue(i),!0):!1}function Ae(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 vt=/[\n"\\]/g;function ct(i){return i.replace(vt,function(s){return"\\"+s.charCodeAt(0).toString(16)+" "})}function qi(i,s,r,l,u,d,g,S){i.name="",g!=null&&typeof g!="function"&&typeof g!="symbol"&&typeof g!="boolean"?i.type=g:i.removeAttribute("type"),s!=null?g==="number"?(s===0&&i.value===""||i.value!=s)&&(i.value=""+O(s)):i.value!==""+O(s)&&(i.value=""+O(s)):g!=="submit"&&g!=="reset"||i.removeAttribute("value"),s!=null?oe(i,g,O(s)):r!=null?oe(i,g,O(r)):l!=null&&i.removeAttribute("value"),u==null&&d!=null&&(i.defaultChecked=!!d),u!=null&&(i.checked=u&&typeof u!="function"&&typeof u!="symbol"),S!=null&&typeof S!="function"&&typeof S!="symbol"&&typeof S!="boolean"?i.name=""+O(S):i.removeAttribute("name")}function A(i,s,r,l,u,d,g,S){if(d!=null&&typeof d!="function"&&typeof d!="symbol"&&typeof d!="boolean"&&(i.type=d),s!=null||r!=null){if(!(d!=="submit"&&d!=="reset"||s!=null)){xe(i);return}r=r!=null?""+O(r):"",s=s!=null?""+O(s):r,S||s===i.value||(i.value=s),i.defaultValue=s}l=l??u,l=typeof l!="function"&&typeof l!="symbol"&&!!l,i.checked=S?i.checked:!!l,i.defaultChecked=!!l,g!=null&&typeof g!="function"&&typeof g!="symbol"&&typeof g!="boolean"&&(i.name=g),xe(i)}function oe(i,s,r){s==="number"&&Ae(i.ownerDocument)===i||i.defaultValue===""+r||(i.defaultValue=""+r)}function Le(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=""+O(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 ze(i,s,r){if(s!=null&&(s=""+O(s),s!==i.value&&(i.value=s),r==null)){i.defaultValue!==s&&(i.defaultValue=s);return}i.defaultValue=r!=null?""+O(r):""}function Ye(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=O(s),i.defaultValue=r,l=i.textContent,l===r&&l!==""&&l!==null&&(i.value=l),xe(i)}function st(i,s){if(s){var r=i.firstChild;if(r&&r===i.lastChild&&r.nodeType===3){r.nodeValue=s;return}}i.textContent=s}var pi=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 ai(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||pi.has(s)?s==="float"?i.cssFloat=r:i[s]=(""+r).trim():i[s]=r+"px"}function Qi(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&&ai(i,u,l)}else for(var d in s)s.hasOwnProperty(d)&&ai(i,d,s[d])}function Is(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 Er=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"]]),us=/^[\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 Tr(i){return us.test(""+i)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":i}function Fs(){}var Es=null;function aa(i){return i=i.target||i.srcElement||window,i.correspondingUseElement&&(i=i.correspondingUseElement),i.nodeType===3?i.parentNode:i}var cn=null,la=null;function a_(i){var s=ri(i);if(s&&(i=s.stateNode)){var r=i[ni]||null;e:switch(i=s.stateNode,s.type){case"input":if(qi(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="'+ct(""+s)+'"][type="radio"]'),s=0;s<r.length;s++){var l=r[s];if(l!==i&&l.form===i.form){var u=l[ni]||null;if(!u)throw Error(a(90));qi(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&&Ne(l)}break e;case"textarea":ze(i,r.value,r.defaultValue);break e;case"select":s=r.value,s!=null&&Le(i,!!r.multiple,s,!1)}}}var rh=!1;function l_(i,s,r){if(rh)return i(s,r);rh=!0;try{var l=i(s);return l}finally{if(rh=!1,(cn!==null||la!==null)&&(Mc(),cn&&(s=cn,i=la,la=cn=null,a_(s),i)))for(s=0;s<i.length;s++)a_(i[s])}}function ll(i,s){var r=i.stateNode;if(r===null)return null;var l=r[ni]||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 un=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),ah=!1;if(un)try{var ol={};Object.defineProperty(ol,"passive",{get:function(){ah=!0}}),window.addEventListener("test",ol,ol),window.removeEventListener("test",ol,ol)}catch{ah=!1}var jn=null,lh=null,qo=null;function o_(){if(qo)return qo;var i,s=lh,r=s.length,l,u="value"in jn?jn.value:jn.textContent,d=u.length;for(i=0;i<r&&s[i]===u[i];i++);var g=r-i;for(l=1;l<=g&&s[r-l]===u[d-l];l++);return qo=u.slice(i,1<l?1-l:void 0)}function Wo(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 $o(){return!0}function c_(){return!1}function Ji(i){function s(r,l,u,d,g){this._reactName=r,this._targetInst=u,this.type=l,this.nativeEvent=d,this.target=g,this.currentTarget=null;for(var S in i)i.hasOwnProperty(S)&&(r=i[S],this[S]=r?r(d):d[S]);return this.isDefaultPrevented=(d.defaultPrevented!=null?d.defaultPrevented:d.returnValue===!1)?$o:c_,this.isPropagationStopped=c_,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=$o)},stopPropagation:function(){var r=this.nativeEvent;r&&(r.stopPropagation?r.stopPropagation():typeof r.cancelBubble!="unknown"&&(r.cancelBubble=!0),this.isPropagationStopped=$o)},persist:function(){},isPersistent:$o}),s}var kr={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(i){return i.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Yo=Ji(kr),cl=y({},kr,{view:0,detail:0}),g1=Ji(cl),oh,ch,ul,Vo=y({},cl,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:hh,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!==ul&&(ul&&i.type==="mousemove"?(oh=i.screenX-ul.screenX,ch=i.screenY-ul.screenY):ch=oh=0,ul=i),oh)},movementY:function(i){return"movementY"in i?i.movementY:ch}}),u_=Ji(Vo),v1=y({},Vo,{dataTransfer:0}),y1=Ji(v1),b1=y({},cl,{relatedTarget:0}),uh=Ji(b1),S1=y({},kr,{animationName:0,elapsedTime:0,pseudoElement:0}),w1=Ji(S1),C1=y({},kr,{clipboardData:function(i){return"clipboardData"in i?i.clipboardData:window.clipboardData}}),x1=Ji(C1),E1=y({},kr,{data:0}),h_=Ji(E1),T1={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},k1={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"},D1={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function R1(i){var s=this.nativeEvent;return s.getModifierState?s.getModifierState(i):(i=D1[i])?!!s[i]:!1}function hh(){return R1}var M1=y({},cl,{key:function(i){if(i.key){var s=T1[i.key]||i.key;if(s!=="Unidentified")return s}return i.type==="keypress"?(i=Wo(i),i===13?"Enter":String.fromCharCode(i)):i.type==="keydown"||i.type==="keyup"?k1[i.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:hh,charCode:function(i){return i.type==="keypress"?Wo(i):0},keyCode:function(i){return i.type==="keydown"||i.type==="keyup"?i.keyCode:0},which:function(i){return i.type==="keypress"?Wo(i):i.type==="keydown"||i.type==="keyup"?i.keyCode:0}}),N1=Ji(M1),A1=y({},Vo,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),d_=Ji(A1),L1=y({},cl,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:hh}),B1=Ji(L1),O1=y({},kr,{propertyName:0,elapsedTime:0,pseudoElement:0}),z1=Ji(O1),j1=y({},Vo,{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}),H1=Ji(j1),U1=y({},kr,{newState:0,oldState:0}),P1=Ji(U1),K1=[9,13,27,32],dh=un&&"CompositionEvent"in window,hl=null;un&&"documentMode"in document&&(hl=document.documentMode);var I1=un&&"TextEvent"in window&&!hl,f_=un&&(!dh||hl&&8<hl&&11>=hl),p_=" ",m_=!1;function __(i,s){switch(i){case"keyup":return K1.indexOf(s.keyCode)!==-1;case"keydown":return s.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function g_(i){return i=i.detail,typeof i=="object"&&"data"in i?i.data:null}var oa=!1;function F1(i,s){switch(i){case"compositionend":return g_(s);case"keypress":return s.which!==32?null:(m_=!0,p_);case"textInput":return i=s.data,i===p_&&m_?null:i;default:return null}}function q1(i,s){if(oa)return i==="compositionend"||!dh&&__(i,s)?(i=o_(),qo=lh=jn=null,oa=!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 f_&&s.locale!=="ko"?null:s.data;default:return null}}var W1={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 v_(i){var s=i&&i.nodeName&&i.nodeName.toLowerCase();return s==="input"?!!W1[i.type]:s==="textarea"}function y_(i,s,r,l){cn?la?la.push(l):la=[l]:cn=l,s=jc(s,"onChange"),0<s.length&&(r=new Yo("onChange","change",null,r,l),i.push({event:r,listeners:s}))}var dl=null,fl=null;function $1(i){ty(i,0)}function Xo(i){var s=Cs(i);if(Ne(s))return i}function b_(i,s){if(i==="change")return s}var S_=!1;if(un){var fh;if(un){var ph="oninput"in document;if(!ph){var w_=document.createElement("div");w_.setAttribute("oninput","return;"),ph=typeof w_.oninput=="function"}fh=ph}else fh=!1;S_=fh&&(!document.documentMode||9<document.documentMode)}function C_(){dl&&(dl.detachEvent("onpropertychange",x_),fl=dl=null)}function x_(i){if(i.propertyName==="value"&&Xo(fl)){var s=[];y_(s,fl,i,aa(i)),l_($1,s)}}function Y1(i,s,r){i==="focusin"?(C_(),dl=s,fl=r,dl.attachEvent("onpropertychange",x_)):i==="focusout"&&C_()}function V1(i){if(i==="selectionchange"||i==="keyup"||i==="keydown")return Xo(fl)}function X1(i,s){if(i==="click")return Xo(s)}function G1(i,s){if(i==="input"||i==="change")return Xo(s)}function Z1(i,s){return i===s&&(i!==0||1/i===1/s)||i!==i&&s!==s}var hs=typeof Object.is=="function"?Object.is:Z1;function pl(i,s){if(hs(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(!St.call(s,u)||!hs(i[u],s[u]))return!1}return!0}function E_(i){for(;i&&i.firstChild;)i=i.firstChild;return i}function T_(i,s){var r=E_(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=E_(r)}}function k_(i,s){return i&&s?i===s?!0:i&&i.nodeType===3?!1:s&&s.nodeType===3?k_(i,s.parentNode):"contains"in i?i.contains(s):i.compareDocumentPosition?!!(i.compareDocumentPosition(s)&16):!1:!1}function D_(i){i=i!=null&&i.ownerDocument!=null&&i.ownerDocument.defaultView!=null?i.ownerDocument.defaultView:window;for(var s=Ae(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=Ae(i.document)}return s}function mh(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 Q1=un&&"documentMode"in document&&11>=document.documentMode,ca=null,_h=null,ml=null,gh=!1;function R_(i,s,r){var l=r.window===r?r.document:r.nodeType===9?r:r.ownerDocument;gh||ca==null||ca!==Ae(l)||(l=ca,"selectionStart"in l&&mh(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}),ml&&pl(ml,l)||(ml=l,l=jc(_h,"onSelect"),0<l.length&&(s=new Yo("onSelect","select",null,s,r),i.push({event:s,listeners:l}),s.target=ca)))}function Dr(i,s){var r={};return r[i.toLowerCase()]=s.toLowerCase(),r["Webkit"+i]="webkit"+s,r["Moz"+i]="moz"+s,r}var ua={animationend:Dr("Animation","AnimationEnd"),animationiteration:Dr("Animation","AnimationIteration"),animationstart:Dr("Animation","AnimationStart"),transitionrun:Dr("Transition","TransitionRun"),transitionstart:Dr("Transition","TransitionStart"),transitioncancel:Dr("Transition","TransitionCancel"),transitionend:Dr("Transition","TransitionEnd")},vh={},M_={};un&&(M_=document.createElement("div").style,"AnimationEvent"in window||(delete ua.animationend.animation,delete ua.animationiteration.animation,delete ua.animationstart.animation),"TransitionEvent"in window||delete ua.transitionend.transition);function Rr(i){if(vh[i])return vh[i];if(!ua[i])return i;var s=ua[i],r;for(r in s)if(s.hasOwnProperty(r)&&r in M_)return vh[i]=s[r];return i}var N_=Rr("animationend"),A_=Rr("animationiteration"),L_=Rr("animationstart"),J1=Rr("transitionrun"),eC=Rr("transitionstart"),tC=Rr("transitioncancel"),B_=Rr("transitionend"),O_=new Map,yh="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(" ");yh.push("scrollEnd");function qs(i,s){O_.set(i,s),cs(s,[i])}var Go=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)},Ts=[],ha=0,bh=0;function Zo(){for(var i=ha,s=bh=ha=0;s<i;){var r=Ts[s];Ts[s++]=null;var l=Ts[s];Ts[s++]=null;var u=Ts[s];Ts[s++]=null;var d=Ts[s];if(Ts[s++]=null,l!==null&&u!==null){var g=l.pending;g===null?u.next=u:(u.next=g.next,g.next=u),l.pending=u}d!==0&&z_(r,u,d)}}function Qo(i,s,r,l){Ts[ha++]=i,Ts[ha++]=s,Ts[ha++]=r,Ts[ha++]=l,bh|=l,i.lanes|=l,i=i.alternate,i!==null&&(i.lanes|=l)}function Sh(i,s,r,l){return Qo(i,s,r,l),Jo(i)}function Mr(i,s){return Qo(i,null,null,s),Jo(i)}function z_(i,s,r){i.lanes|=r;var l=i.alternate;l!==null&&(l.lanes|=r);for(var u=!1,d=i.return;d!==null;)d.childLanes|=r,l=d.alternate,l!==null&&(l.childLanes|=r),d.tag===22&&(i=d.stateNode,i===null||i._visibility&1||(u=!0)),i=d,d=d.return;return i.tag===3?(d=i.stateNode,u&&s!==null&&(u=31-Bt(r),i=d.hiddenUpdates,l=i[u],l===null?i[u]=[s]:l.push(s),s.lane=r|536870912),d):null}function Jo(i){if(50<jl)throw jl=0,Md=null,Error(a(185));for(var s=i.return;s!==null;)i=s,s=i.return;return i.tag===3?i.stateNode:null}var da={};function iC(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 ds(i,s,r,l){return new iC(i,s,r,l)}function wh(i){return i=i.prototype,!(!i||!i.isReactComponent)}function hn(i,s){var r=i.alternate;return r===null?(r=ds(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 j_(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 ec(i,s,r,l,u,d){var g=0;if(l=i,typeof i=="function")wh(i)&&(g=1);else if(typeof i=="string")g=lx(i,r,he.current)?26:i==="html"||i==="head"||i==="body"?27:5;else e:switch(i){case de:return i=ds(31,r,s,u),i.elementType=de,i.lanes=d,i;case E:return Nr(r.children,u,d,s);case B:g=8,u|=24;break;case T:return i=ds(12,r,s,u|2),i.elementType=T,i.lanes=d,i;case ee:return i=ds(13,r,s,u),i.elementType=ee,i.lanes=d,i;case te:return i=ds(19,r,s,u),i.elementType=te,i.lanes=d,i;default:if(typeof i=="object"&&i!==null)switch(i.$$typeof){case P:g=10;break e;case Y:g=9;break e;case X:g=11;break e;case se:g=14;break e;case le:g=16,l=null;break e}g=29,r=Error(a(130,i===null?"null":typeof i,"")),l=null}return s=ds(g,r,s,u),s.elementType=i,s.type=l,s.lanes=d,s}function Nr(i,s,r,l){return i=ds(7,i,l,s),i.lanes=r,i}function Ch(i,s,r){return i=ds(6,i,null,s),i.lanes=r,i}function H_(i){var s=ds(18,null,null,0);return s.stateNode=i,s}function xh(i,s,r){return s=ds(4,i.children!==null?i.children:[],i.key,s),s.lanes=r,s.stateNode={containerInfo:i.containerInfo,pendingChildren:null,implementation:i.implementation},s}var U_=new WeakMap;function ks(i,s){if(typeof i=="object"&&i!==null){var r=U_.get(i);return r!==void 0?r:(s={value:i,source:s,stack:$e(s)},U_.set(i,s),s)}return{value:i,source:s,stack:$e(s)}}var fa=[],pa=0,tc=null,_l=0,Ds=[],Rs=0,Hn=null,Zs=1,Qs="";function dn(i,s){fa[pa++]=_l,fa[pa++]=tc,tc=i,_l=s}function P_(i,s,r){Ds[Rs++]=Zs,Ds[Rs++]=Qs,Ds[Rs++]=Hn,Hn=i;var l=Zs;i=Qs;var u=32-Bt(l)-1;l&=~(1<<u),r+=1;var d=32-Bt(s)+u;if(30<d){var g=u-u%5;d=(l&(1<<g)-1).toString(32),l>>=g,u-=g,Zs=1<<32-Bt(s)+u|r<<u|l,Qs=d+i}else Zs=1<<d|r<<u|l,Qs=i}function Eh(i){i.return!==null&&(dn(i,1),P_(i,1,0))}function Th(i){for(;i===tc;)tc=fa[--pa],fa[pa]=null,_l=fa[--pa],fa[pa]=null;for(;i===Hn;)Hn=Ds[--Rs],Ds[Rs]=null,Qs=Ds[--Rs],Ds[Rs]=null,Zs=Ds[--Rs],Ds[Rs]=null}function K_(i,s){Ds[Rs++]=Zs,Ds[Rs++]=Qs,Ds[Rs++]=Hn,Zs=s.id,Qs=s.overflow,Hn=i}var Di=null,xt=null,tt=!1,Un=null,Ms=!1,kh=Error(a(519));function Pn(i){var s=Error(a(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw gl(ks(s,i)),kh}function I_(i){var s=i.stateNode,r=i.type,l=i.memoizedProps;switch(s[zt]=i,s[ni]=l,r){case"dialog":Qe("cancel",s),Qe("close",s);break;case"iframe":case"object":case"embed":Qe("load",s);break;case"video":case"audio":for(r=0;r<Ul.length;r++)Qe(Ul[r],s);break;case"source":Qe("error",s);break;case"img":case"image":case"link":Qe("error",s),Qe("load",s);break;case"details":Qe("toggle",s);break;case"input":Qe("invalid",s),A(s,l.value,l.defaultValue,l.checked,l.defaultChecked,l.type,l.name,!0);break;case"select":Qe("invalid",s);break;case"textarea":Qe("invalid",s),Ye(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||ry(s.textContent,r)?(l.popover!=null&&(Qe("beforetoggle",s),Qe("toggle",s)),l.onScroll!=null&&Qe("scroll",s),l.onScrollEnd!=null&&Qe("scrollend",s),l.onClick!=null&&(s.onclick=Fs),s=!0):s=!1,s||Pn(i,!0)}function F_(i){for(Di=i.return;Di;)switch(Di.tag){case 5:case 31:case 13:Ms=!1;return;case 27:case 3:Ms=!0;return;default:Di=Di.return}}function ma(i){if(i!==Di)return!1;if(!tt)return F_(i),tt=!0,!1;var s=i.tag,r;if((r=s!==3&&s!==27)&&((r=s===5)&&(r=i.type,r=!(r!=="form"&&r!=="button")||Wd(i.type,i.memoizedProps)),r=!r),r&&xt&&Pn(i),F_(i),s===13){if(i=i.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(a(317));xt=py(i)}else if(s===31){if(i=i.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(a(317));xt=py(i)}else s===27?(s=xt,er(i.type)?(i=Gd,Gd=null,xt=i):xt=s):xt=Di?As(i.stateNode.nextSibling):null;return!0}function Ar(){xt=Di=null,tt=!1}function Dh(){var i=Un;return i!==null&&(ss===null?ss=i:ss.push.apply(ss,i),Un=null),i}function gl(i){Un===null?Un=[i]:Un.push(i)}var Rh=D(null),Lr=null,fn=null;function Kn(i,s,r){re(Rh,s._currentValue),s._currentValue=r}function pn(i){i._currentValue=Rh.current,W(Rh)}function Mh(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 Nh(i,s,r,l){var u=i.child;for(u!==null&&(u.return=i);u!==null;){var d=u.dependencies;if(d!==null){var g=u.child;d=d.firstContext;e:for(;d!==null;){var S=d;d=u;for(var R=0;R<s.length;R++)if(S.context===s[R]){d.lanes|=r,S=d.alternate,S!==null&&(S.lanes|=r),Mh(d.return,r,i),l||(g=null);break e}d=S.next}}else if(u.tag===18){if(g=u.return,g===null)throw Error(a(341));g.lanes|=r,d=g.alternate,d!==null&&(d.lanes|=r),Mh(g,r,i),g=null}else g=u.child;if(g!==null)g.return=u;else for(g=u;g!==null;){if(g===i){g=null;break}if(u=g.sibling,u!==null){u.return=g.return,g=u;break}g=g.return}u=g}}function _a(i,s,r,l){i=null;for(var u=s,d=!1;u!==null;){if(!d){if((u.flags&524288)!==0)d=!0;else if((u.flags&262144)!==0)break}if(u.tag===10){var g=u.alternate;if(g===null)throw Error(a(387));if(g=g.memoizedProps,g!==null){var S=u.type;hs(u.pendingProps.value,g.value)||(i!==null?i.push(S):i=[S])}}else if(u===ke.current){if(g=u.alternate,g===null)throw Error(a(387));g.memoizedState.memoizedState!==u.memoizedState.memoizedState&&(i!==null?i.push(ql):i=[ql])}u=u.return}i!==null&&Nh(s,i,r,l),s.flags|=262144}function ic(i){for(i=i.firstContext;i!==null;){if(!hs(i.context._currentValue,i.memoizedValue))return!0;i=i.next}return!1}function Br(i){Lr=i,fn=null,i=i.dependencies,i!==null&&(i.firstContext=null)}function Ri(i){return q_(Lr,i)}function sc(i,s){return Lr===null&&Br(i),q_(i,s)}function q_(i,s){var r=s._currentValue;if(s={context:s,memoizedValue:r,next:null},fn===null){if(i===null)throw Error(a(308));fn=s,i.dependencies={lanes:0,firstContext:s},i.flags|=524288}else fn=fn.next=s;return r}var sC=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()})}},nC=e.unstable_scheduleCallback,rC=e.unstable_NormalPriority,Gt={$$typeof:P,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Ah(){return{controller:new sC,data:new Map,refCount:0}}function vl(i){i.refCount--,i.refCount===0&&nC(rC,function(){i.controller.abort()})}var yl=null,Lh=0,ga=0,va=null;function aC(i,s){if(yl===null){var r=yl=[];Lh=0,ga=zd(),va={status:"pending",value:void 0,then:function(l){r.push(l)}}}return Lh++,s.then(W_,W_),s}function W_(){if(--Lh===0&&yl!==null){va!==null&&(va.status="fulfilled");var i=yl;yl=null,ga=0,va=null;for(var s=0;s<i.length;s++)(0,i[s])()}}function lC(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 $_=M.S;M.S=function(i,s){Rv=Oe(),typeof s=="object"&&s!==null&&typeof s.then=="function"&&aC(i,s),$_!==null&&$_(i,s)};var Or=D(null);function Bh(){var i=Or.current;return i!==null?i:yt.pooledCache}function nc(i,s){s===null?re(Or,Or.current):re(Or,s.pool)}function Y_(){var i=Bh();return i===null?null:{parent:Gt._currentValue,pool:i}}var ya=Error(a(460)),Oh=Error(a(474)),rc=Error(a(542)),ac={then:function(){}};function V_(i){return i=i.status,i==="fulfilled"||i==="rejected"}function X_(i,s,r){switch(r=i[r],r===void 0?i.push(s):r!==s&&(s.then(Fs,Fs),s=r),s.status){case"fulfilled":return s.value;case"rejected":throw i=s.reason,Z_(i),i;default:if(typeof s.status=="string")s.then(Fs,Fs);else{if(i=yt,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,Z_(i),i}throw jr=s,ya}}function zr(i){try{var s=i._init;return s(i._payload)}catch(r){throw r!==null&&typeof r=="object"&&typeof r.then=="function"?(jr=r,ya):r}}var jr=null;function G_(){if(jr===null)throw Error(a(459));var i=jr;return jr=null,i}function Z_(i){if(i===ya||i===rc)throw Error(a(483))}var ba=null,bl=0;function lc(i){var s=bl;return bl+=1,ba===null&&(ba=[]),X_(ba,i,s)}function Sl(i,s){s=s.props.ref,i.ref=s!==void 0?s:null}function oc(i,s){throw s.$$typeof===w?Error(a(525)):(i=Object.prototype.toString.call(s),Error(a(31,i==="[object Object]"?"object with keys {"+Object.keys(s).join(", ")+"}":i)))}function Q_(i){function s(H,L){if(i){var I=H.deletions;I===null?(H.deletions=[L],H.flags|=16):I.push(L)}}function r(H,L){if(!i)return null;for(;L!==null;)s(H,L),L=L.sibling;return null}function l(H){for(var L=new Map;H!==null;)H.key!==null?L.set(H.key,H):L.set(H.index,H),H=H.sibling;return L}function u(H,L){return H=hn(H,L),H.index=0,H.sibling=null,H}function d(H,L,I){return H.index=I,i?(I=H.alternate,I!==null?(I=I.index,I<L?(H.flags|=67108866,L):I):(H.flags|=67108866,L)):(H.flags|=1048576,L)}function g(H){return i&&H.alternate===null&&(H.flags|=67108866),H}function S(H,L,I,ae){return L===null||L.tag!==6?(L=Ch(I,H.mode,ae),L.return=H,L):(L=u(L,I),L.return=H,L)}function R(H,L,I,ae){var Be=I.type;return Be===E?ne(H,L,I.props.children,ae,I.key):L!==null&&(L.elementType===Be||typeof Be=="object"&&Be!==null&&Be.$$typeof===le&&zr(Be)===L.type)?(L=u(L,I.props),Sl(L,I),L.return=H,L):(L=ec(I.type,I.key,I.props,null,H.mode,ae),Sl(L,I),L.return=H,L)}function F(H,L,I,ae){return L===null||L.tag!==4||L.stateNode.containerInfo!==I.containerInfo||L.stateNode.implementation!==I.implementation?(L=xh(I,H.mode,ae),L.return=H,L):(L=u(L,I.children||[]),L.return=H,L)}function ne(H,L,I,ae,Be){return L===null||L.tag!==7?(L=Nr(I,H.mode,ae,Be),L.return=H,L):(L=u(L,I),L.return=H,L)}function ce(H,L,I){if(typeof L=="string"&&L!==""||typeof L=="number"||typeof L=="bigint")return L=Ch(""+L,H.mode,I),L.return=H,L;if(typeof L=="object"&&L!==null){switch(L.$$typeof){case x:return I=ec(L.type,L.key,L.props,null,H.mode,I),Sl(I,L),I.return=H,I;case C:return L=xh(L,H.mode,I),L.return=H,L;case le:return L=zr(L),ce(H,L,I)}if(G(L)||K(L))return L=Nr(L,H.mode,I,null),L.return=H,L;if(typeof L.then=="function")return ce(H,lc(L),I);if(L.$$typeof===P)return ce(H,sc(H,L),I);oc(H,L)}return null}function $(H,L,I,ae){var Be=L!==null?L.key:null;if(typeof I=="string"&&I!==""||typeof I=="number"||typeof I=="bigint")return Be!==null?null:S(H,L,""+I,ae);if(typeof I=="object"&&I!==null){switch(I.$$typeof){case x:return I.key===Be?R(H,L,I,ae):null;case C:return I.key===Be?F(H,L,I,ae):null;case le:return I=zr(I),$(H,L,I,ae)}if(G(I)||K(I))return Be!==null?null:ne(H,L,I,ae,null);if(typeof I.then=="function")return $(H,L,lc(I),ae);if(I.$$typeof===P)return $(H,L,sc(H,I),ae);oc(H,I)}return null}function Z(H,L,I,ae,Be){if(typeof ae=="string"&&ae!==""||typeof ae=="number"||typeof ae=="bigint")return H=H.get(I)||null,S(L,H,""+ae,Be);if(typeof ae=="object"&&ae!==null){switch(ae.$$typeof){case x:return H=H.get(ae.key===null?I:ae.key)||null,R(L,H,ae,Be);case C:return H=H.get(ae.key===null?I:ae.key)||null,F(L,H,ae,Be);case le:return ae=zr(ae),Z(H,L,I,ae,Be)}if(G(ae)||K(ae))return H=H.get(I)||null,ne(L,H,ae,Be,null);if(typeof ae.then=="function")return Z(H,L,I,lc(ae),Be);if(ae.$$typeof===P)return Z(H,L,I,sc(L,ae),Be);oc(L,ae)}return null}function Ee(H,L,I,ae){for(var Be=null,rt=null,Re=L,We=L=0,et=null;Re!==null&&We<I.length;We++){Re.index>We?(et=Re,Re=null):et=Re.sibling;var at=$(H,Re,I[We],ae);if(at===null){Re===null&&(Re=et);break}i&&Re&&at.alternate===null&&s(H,Re),L=d(at,L,We),rt===null?Be=at:rt.sibling=at,rt=at,Re=et}if(We===I.length)return r(H,Re),tt&&dn(H,We),Be;if(Re===null){for(;We<I.length;We++)Re=ce(H,I[We],ae),Re!==null&&(L=d(Re,L,We),rt===null?Be=Re:rt.sibling=Re,rt=Re);return tt&&dn(H,We),Be}for(Re=l(Re);We<I.length;We++)et=Z(Re,H,We,I[We],ae),et!==null&&(i&&et.alternate!==null&&Re.delete(et.key===null?We:et.key),L=d(et,L,We),rt===null?Be=et:rt.sibling=et,rt=et);return i&&Re.forEach(function(rr){return s(H,rr)}),tt&&dn(H,We),Be}function je(H,L,I,ae){if(I==null)throw Error(a(151));for(var Be=null,rt=null,Re=L,We=L=0,et=null,at=I.next();Re!==null&&!at.done;We++,at=I.next()){Re.index>We?(et=Re,Re=null):et=Re.sibling;var rr=$(H,Re,at.value,ae);if(rr===null){Re===null&&(Re=et);break}i&&Re&&rr.alternate===null&&s(H,Re),L=d(rr,L,We),rt===null?Be=rr:rt.sibling=rr,rt=rr,Re=et}if(at.done)return r(H,Re),tt&&dn(H,We),Be;if(Re===null){for(;!at.done;We++,at=I.next())at=ce(H,at.value,ae),at!==null&&(L=d(at,L,We),rt===null?Be=at:rt.sibling=at,rt=at);return tt&&dn(H,We),Be}for(Re=l(Re);!at.done;We++,at=I.next())at=Z(Re,H,We,at.value,ae),at!==null&&(i&&at.alternate!==null&&Re.delete(at.key===null?We:at.key),L=d(at,L,We),rt===null?Be=at:rt.sibling=at,rt=at);return i&&Re.forEach(function(vx){return s(H,vx)}),tt&&dn(H,We),Be}function mt(H,L,I,ae){if(typeof I=="object"&&I!==null&&I.type===E&&I.key===null&&(I=I.props.children),typeof I=="object"&&I!==null){switch(I.$$typeof){case x:e:{for(var Be=I.key;L!==null;){if(L.key===Be){if(Be=I.type,Be===E){if(L.tag===7){r(H,L.sibling),ae=u(L,I.props.children),ae.return=H,H=ae;break e}}else if(L.elementType===Be||typeof Be=="object"&&Be!==null&&Be.$$typeof===le&&zr(Be)===L.type){r(H,L.sibling),ae=u(L,I.props),Sl(ae,I),ae.return=H,H=ae;break e}r(H,L);break}else s(H,L);L=L.sibling}I.type===E?(ae=Nr(I.props.children,H.mode,ae,I.key),ae.return=H,H=ae):(ae=ec(I.type,I.key,I.props,null,H.mode,ae),Sl(ae,I),ae.return=H,H=ae)}return g(H);case C:e:{for(Be=I.key;L!==null;){if(L.key===Be)if(L.tag===4&&L.stateNode.containerInfo===I.containerInfo&&L.stateNode.implementation===I.implementation){r(H,L.sibling),ae=u(L,I.children||[]),ae.return=H,H=ae;break e}else{r(H,L);break}else s(H,L);L=L.sibling}ae=xh(I,H.mode,ae),ae.return=H,H=ae}return g(H);case le:return I=zr(I),mt(H,L,I,ae)}if(G(I))return Ee(H,L,I,ae);if(K(I)){if(Be=K(I),typeof Be!="function")throw Error(a(150));return I=Be.call(I),je(H,L,I,ae)}if(typeof I.then=="function")return mt(H,L,lc(I),ae);if(I.$$typeof===P)return mt(H,L,sc(H,I),ae);oc(H,I)}return typeof I=="string"&&I!==""||typeof I=="number"||typeof I=="bigint"?(I=""+I,L!==null&&L.tag===6?(r(H,L.sibling),ae=u(L,I),ae.return=H,H=ae):(r(H,L),ae=Ch(I,H.mode,ae),ae.return=H,H=ae),g(H)):r(H,L)}return function(H,L,I,ae){try{bl=0;var Be=mt(H,L,I,ae);return ba=null,Be}catch(Re){if(Re===ya||Re===rc)throw Re;var rt=ds(29,Re,null,H.mode);return rt.lanes=ae,rt.return=H,rt}}}var Hr=Q_(!0),J_=Q_(!1),In=!1;function zh(i){i.updateQueue={baseState:i.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function jh(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 Fn(i){return{lane:i,tag:0,payload:null,callback:null,next:null}}function qn(i,s,r){var l=i.updateQueue;if(l===null)return null;if(l=l.shared,(lt&2)!==0){var u=l.pending;return u===null?s.next=s:(s.next=u.next,u.next=s),l.pending=s,s=Jo(i),z_(i,null,r),s}return Qo(i,l,s,r),Jo(i)}function wl(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,It(i,r)}}function Hh(i,s){var r=i.updateQueue,l=i.alternate;if(l!==null&&(l=l.updateQueue,r===l)){var u=null,d=null;if(r=r.firstBaseUpdate,r!==null){do{var g={lane:r.lane,tag:r.tag,payload:r.payload,callback:null,next:null};d===null?u=d=g:d=d.next=g,r=r.next}while(r!==null);d===null?u=d=s:d=d.next=s}else u=d=s;r={baseState:l.baseState,firstBaseUpdate:u,lastBaseUpdate:d,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 Uh=!1;function Cl(){if(Uh){var i=va;if(i!==null)throw i}}function xl(i,s,r,l){Uh=!1;var u=i.updateQueue;In=!1;var d=u.firstBaseUpdate,g=u.lastBaseUpdate,S=u.shared.pending;if(S!==null){u.shared.pending=null;var R=S,F=R.next;R.next=null,g===null?d=F:g.next=F,g=R;var ne=i.alternate;ne!==null&&(ne=ne.updateQueue,S=ne.lastBaseUpdate,S!==g&&(S===null?ne.firstBaseUpdate=F:S.next=F,ne.lastBaseUpdate=R))}if(d!==null){var ce=u.baseState;g=0,ne=F=R=null,S=d;do{var $=S.lane&-536870913,Z=$!==S.lane;if(Z?(Je&$)===$:(l&$)===$){$!==0&&$===ga&&(Uh=!0),ne!==null&&(ne=ne.next={lane:0,tag:S.tag,payload:S.payload,callback:null,next:null});e:{var Ee=i,je=S;$=s;var mt=r;switch(je.tag){case 1:if(Ee=je.payload,typeof Ee=="function"){ce=Ee.call(mt,ce,$);break e}ce=Ee;break e;case 3:Ee.flags=Ee.flags&-65537|128;case 0:if(Ee=je.payload,$=typeof Ee=="function"?Ee.call(mt,ce,$):Ee,$==null)break e;ce=y({},ce,$);break e;case 2:In=!0}}$=S.callback,$!==null&&(i.flags|=64,Z&&(i.flags|=8192),Z=u.callbacks,Z===null?u.callbacks=[$]:Z.push($))}else Z={lane:$,tag:S.tag,payload:S.payload,callback:S.callback,next:null},ne===null?(F=ne=Z,R=ce):ne=ne.next=Z,g|=$;if(S=S.next,S===null){if(S=u.shared.pending,S===null)break;Z=S,S=Z.next,Z.next=null,u.lastBaseUpdate=Z,u.shared.pending=null}}while(!0);ne===null&&(R=ce),u.baseState=R,u.firstBaseUpdate=F,u.lastBaseUpdate=ne,d===null&&(u.shared.lanes=0),Xn|=g,i.lanes=g,i.memoizedState=ce}}function eg(i,s){if(typeof i!="function")throw Error(a(191,i));i.call(s)}function tg(i,s){var r=i.callbacks;if(r!==null)for(i.callbacks=null,i=0;i<r.length;i++)eg(r[i],s)}var Sa=D(null),cc=D(0);function ig(i,s){i=Cn,re(cc,i),re(Sa,s),Cn=i|s.baseLanes}function Ph(){re(cc,Cn),re(Sa,Sa.current)}function Kh(){Cn=cc.current,W(Sa),W(cc)}var fs=D(null),Ns=null;function Wn(i){var s=i.alternate;re(Ft,Ft.current&1),re(fs,i),Ns===null&&(s===null||Sa.current!==null||s.memoizedState!==null)&&(Ns=i)}function Ih(i){re(Ft,Ft.current),re(fs,i),Ns===null&&(Ns=i)}function sg(i){i.tag===22?(re(Ft,Ft.current),re(fs,i),Ns===null&&(Ns=i)):$n()}function $n(){re(Ft,Ft.current),re(fs,fs.current)}function ps(i){W(fs),Ns===i&&(Ns=null),W(Ft)}var Ft=D(0);function uc(i){for(var s=i;s!==null;){if(s.tag===13){var r=s.memoizedState;if(r!==null&&(r=r.dehydrated,r===null||Vd(r)||Xd(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 mn=0,qe=null,ft=null,Zt=null,hc=!1,wa=!1,Ur=!1,dc=0,El=0,Ca=null,oC=0;function jt(){throw Error(a(321))}function Fh(i,s){if(s===null)return!1;for(var r=0;r<s.length&&r<i.length;r++)if(!hs(i[r],s[r]))return!1;return!0}function qh(i,s,r,l,u,d){return mn=d,qe=s,s.memoizedState=null,s.updateQueue=null,s.lanes=0,M.H=i===null||i.memoizedState===null?Pg:rd,Ur=!1,d=r(l,u),Ur=!1,wa&&(d=rg(s,r,l,u)),ng(i),d}function ng(i){M.H=Dl;var s=ft!==null&&ft.next!==null;if(mn=0,Zt=ft=qe=null,hc=!1,El=0,Ca=null,s)throw Error(a(300));i===null||Qt||(i=i.dependencies,i!==null&&ic(i)&&(Qt=!0))}function rg(i,s,r,l){qe=i;var u=0;do{if(wa&&(Ca=null),El=0,wa=!1,25<=u)throw Error(a(301));if(u+=1,Zt=ft=null,i.updateQueue!=null){var d=i.updateQueue;d.lastEffect=null,d.events=null,d.stores=null,d.memoCache!=null&&(d.memoCache.index=0)}M.H=Kg,d=s(r,l)}while(wa);return d}function cC(){var i=M.H,s=i.useState()[0];return s=typeof s.then=="function"?Tl(s):s,i=i.useState()[0],(ft!==null?ft.memoizedState:null)!==i&&(qe.flags|=1024),s}function Wh(){var i=dc!==0;return dc=0,i}function $h(i,s,r){s.updateQueue=i.updateQueue,s.flags&=-2053,i.lanes&=~r}function Yh(i){if(hc){for(i=i.memoizedState;i!==null;){var s=i.queue;s!==null&&(s.pending=null),i=i.next}hc=!1}mn=0,Zt=ft=qe=null,wa=!1,El=dc=0,Ca=null}function Wi(){var i={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Zt===null?qe.memoizedState=Zt=i:Zt=Zt.next=i,Zt}function qt(){if(ft===null){var i=qe.alternate;i=i!==null?i.memoizedState:null}else i=ft.next;var s=Zt===null?qe.memoizedState:Zt.next;if(s!==null)Zt=s,ft=i;else{if(i===null)throw qe.alternate===null?Error(a(467)):Error(a(310));ft=i,i={memoizedState:ft.memoizedState,baseState:ft.baseState,baseQueue:ft.baseQueue,queue:ft.queue,next:null},Zt===null?qe.memoizedState=Zt=i:Zt=Zt.next=i}return Zt}function fc(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Tl(i){var s=El;return El+=1,Ca===null&&(Ca=[]),i=X_(Ca,i,s),s=qe,(Zt===null?s.memoizedState:Zt.next)===null&&(s=s.alternate,M.H=s===null||s.memoizedState===null?Pg:rd),i}function pc(i){if(i!==null&&typeof i=="object"){if(typeof i.then=="function")return Tl(i);if(i.$$typeof===P)return Ri(i)}throw Error(a(438,String(i)))}function Vh(i){var s=null,r=qe.updateQueue;if(r!==null&&(s=r.memoCache),s==null){var l=qe.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=fc(),qe.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]=N;return s.index++,r}function _n(i,s){return typeof s=="function"?s(i):s}function mc(i){var s=qt();return Xh(s,ft,i)}function Xh(i,s,r){var l=i.queue;if(l===null)throw Error(a(311));l.lastRenderedReducer=r;var u=i.baseQueue,d=l.pending;if(d!==null){if(u!==null){var g=u.next;u.next=d.next,d.next=g}s.baseQueue=u=d,l.pending=null}if(d=i.baseState,u===null)i.memoizedState=d;else{s=u.next;var S=g=null,R=null,F=s,ne=!1;do{var ce=F.lane&-536870913;if(ce!==F.lane?(Je&ce)===ce:(mn&ce)===ce){var $=F.revertLane;if($===0)R!==null&&(R=R.next={lane:0,revertLane:0,gesture:null,action:F.action,hasEagerState:F.hasEagerState,eagerState:F.eagerState,next:null}),ce===ga&&(ne=!0);else if((mn&$)===$){F=F.next,$===ga&&(ne=!0);continue}else ce={lane:0,revertLane:F.revertLane,gesture:null,action:F.action,hasEagerState:F.hasEagerState,eagerState:F.eagerState,next:null},R===null?(S=R=ce,g=d):R=R.next=ce,qe.lanes|=$,Xn|=$;ce=F.action,Ur&&r(d,ce),d=F.hasEagerState?F.eagerState:r(d,ce)}else $={lane:ce,revertLane:F.revertLane,gesture:F.gesture,action:F.action,hasEagerState:F.hasEagerState,eagerState:F.eagerState,next:null},R===null?(S=R=$,g=d):R=R.next=$,qe.lanes|=ce,Xn|=ce;F=F.next}while(F!==null&&F!==s);if(R===null?g=d:R.next=S,!hs(d,i.memoizedState)&&(Qt=!0,ne&&(r=va,r!==null)))throw r;i.memoizedState=d,i.baseState=g,i.baseQueue=R,l.lastRenderedState=d}return u===null&&(l.lanes=0),[i.memoizedState,l.dispatch]}function Gh(i){var s=qt(),r=s.queue;if(r===null)throw Error(a(311));r.lastRenderedReducer=i;var l=r.dispatch,u=r.pending,d=s.memoizedState;if(u!==null){r.pending=null;var g=u=u.next;do d=i(d,g.action),g=g.next;while(g!==u);hs(d,s.memoizedState)||(Qt=!0),s.memoizedState=d,s.baseQueue===null&&(s.baseState=d),r.lastRenderedState=d}return[d,l]}function ag(i,s,r){var l=qe,u=qt(),d=tt;if(d){if(r===void 0)throw Error(a(407));r=r()}else r=s();var g=!hs((ft||u).memoizedState,r);if(g&&(u.memoizedState=r,Qt=!0),u=u.queue,Jh(cg.bind(null,l,u,i),[i]),u.getSnapshot!==s||g||Zt!==null&&Zt.memoizedState.tag&1){if(l.flags|=2048,xa(9,{destroy:void 0},og.bind(null,l,u,r,s),null),yt===null)throw Error(a(349));d||(mn&127)!==0||lg(l,s,r)}return r}function lg(i,s,r){i.flags|=16384,i={getSnapshot:s,value:r},s=qe.updateQueue,s===null?(s=fc(),qe.updateQueue=s,s.stores=[i]):(r=s.stores,r===null?s.stores=[i]:r.push(i))}function og(i,s,r,l){s.value=r,s.getSnapshot=l,ug(s)&&hg(i)}function cg(i,s,r){return r(function(){ug(s)&&hg(i)})}function ug(i){var s=i.getSnapshot;i=i.value;try{var r=s();return!hs(i,r)}catch{return!0}}function hg(i){var s=Mr(i,2);s!==null&&ns(s,i,2)}function Zh(i){var s=Wi();if(typeof i=="function"){var r=i;if(i=r(),Ur){Ci(!0);try{r()}finally{Ci(!1)}}}return s.memoizedState=s.baseState=i,s.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:_n,lastRenderedState:i},s}function dg(i,s,r,l){return i.baseState=r,Xh(i,ft,typeof l=="function"?l:_n)}function uC(i,s,r,l,u){if(vc(i))throw Error(a(485));if(i=s.action,i!==null){var d={payload:u,action:i,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(g){d.listeners.push(g)}};M.T!==null?r(!0):d.isTransition=!1,l(d),r=s.pending,r===null?(d.next=s.pending=d,fg(s,d)):(d.next=r.next,s.pending=r.next=d)}}function fg(i,s){var r=s.action,l=s.payload,u=i.state;if(s.isTransition){var d=M.T,g={};M.T=g;try{var S=r(u,l),R=M.S;R!==null&&R(g,S),pg(i,s,S)}catch(F){Qh(i,s,F)}finally{d!==null&&g.types!==null&&(d.types=g.types),M.T=d}}else try{d=r(u,l),pg(i,s,d)}catch(F){Qh(i,s,F)}}function pg(i,s,r){r!==null&&typeof r=="object"&&typeof r.then=="function"?r.then(function(l){mg(i,s,l)},function(l){return Qh(i,s,l)}):mg(i,s,r)}function mg(i,s,r){s.status="fulfilled",s.value=r,_g(s),i.state=r,s=i.pending,s!==null&&(r=s.next,r===s?i.pending=null:(r=r.next,s.next=r,fg(i,r)))}function Qh(i,s,r){var l=i.pending;if(i.pending=null,l!==null){l=l.next;do s.status="rejected",s.reason=r,_g(s),s=s.next;while(s!==l)}i.action=null}function _g(i){i=i.listeners;for(var s=0;s<i.length;s++)(0,i[s])()}function gg(i,s){return s}function vg(i,s){if(tt){var r=yt.formState;if(r!==null){e:{var l=qe;if(tt){if(xt){t:{for(var u=xt,d=Ms;u.nodeType!==8;){if(!d){u=null;break t}if(u=As(u.nextSibling),u===null){u=null;break t}}d=u.data,u=d==="F!"||d==="F"?u:null}if(u){xt=As(u.nextSibling),l=u.data==="F!";break e}}Pn(l)}l=!1}l&&(s=r[0])}}return r=Wi(),r.memoizedState=r.baseState=s,l={pending:null,lanes:0,dispatch:null,lastRenderedReducer:gg,lastRenderedState:s},r.queue=l,r=jg.bind(null,qe,l),l.dispatch=r,l=Zh(!1),d=nd.bind(null,qe,!1,l.queue),l=Wi(),u={state:s,dispatch:null,action:i,pending:null},l.queue=u,r=uC.bind(null,qe,u,d,r),u.dispatch=r,l.memoizedState=i,[s,r,!1]}function yg(i){var s=qt();return bg(s,ft,i)}function bg(i,s,r){if(s=Xh(i,s,gg)[0],i=mc(_n)[0],typeof s=="object"&&s!==null&&typeof s.then=="function")try{var l=Tl(s)}catch(g){throw g===ya?rc:g}else l=s;s=qt();var u=s.queue,d=u.dispatch;return r!==s.memoizedState&&(qe.flags|=2048,xa(9,{destroy:void 0},hC.bind(null,u,r),null)),[l,d,i]}function hC(i,s){i.action=s}function Sg(i){var s=qt(),r=ft;if(r!==null)return bg(s,r,i);qt(),s=s.memoizedState,r=qt();var l=r.queue.dispatch;return r.memoizedState=i,[s,l,!1]}function xa(i,s,r,l){return i={tag:i,create:r,deps:l,inst:s,next:null},s=qe.updateQueue,s===null&&(s=fc(),qe.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 wg(){return qt().memoizedState}function _c(i,s,r,l){var u=Wi();qe.flags|=i,u.memoizedState=xa(1|s,{destroy:void 0},r,l===void 0?null:l)}function gc(i,s,r,l){var u=qt();l=l===void 0?null:l;var d=u.memoizedState.inst;ft!==null&&l!==null&&Fh(l,ft.memoizedState.deps)?u.memoizedState=xa(s,d,r,l):(qe.flags|=i,u.memoizedState=xa(1|s,d,r,l))}function Cg(i,s){_c(8390656,8,i,s)}function Jh(i,s){gc(2048,8,i,s)}function dC(i){qe.flags|=4;var s=qe.updateQueue;if(s===null)s=fc(),qe.updateQueue=s,s.events=[i];else{var r=s.events;r===null?s.events=[i]:r.push(i)}}function xg(i){var s=qt().memoizedState;return dC({ref:s,nextImpl:i}),function(){if((lt&2)!==0)throw Error(a(440));return s.impl.apply(void 0,arguments)}}function Eg(i,s){return gc(4,2,i,s)}function Tg(i,s){return gc(4,4,i,s)}function kg(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 Dg(i,s,r){r=r!=null?r.concat([i]):null,gc(4,4,kg.bind(null,s,i),r)}function ed(){}function Rg(i,s){var r=qt();s=s===void 0?null:s;var l=r.memoizedState;return s!==null&&Fh(s,l[1])?l[0]:(r.memoizedState=[i,s],i)}function Mg(i,s){var r=qt();s=s===void 0?null:s;var l=r.memoizedState;if(s!==null&&Fh(s,l[1]))return l[0];if(l=i(),Ur){Ci(!0);try{i()}finally{Ci(!1)}}return r.memoizedState=[l,s],l}function td(i,s,r){return r===void 0||(mn&1073741824)!==0&&(Je&261930)===0?i.memoizedState=s:(i.memoizedState=r,i=Nv(),qe.lanes|=i,Xn|=i,r)}function Ng(i,s,r,l){return hs(r,s)?r:Sa.current!==null?(i=td(i,r,l),hs(i,s)||(Qt=!0),i):(mn&42)===0||(mn&1073741824)!==0&&(Je&261930)===0?(Qt=!0,i.memoizedState=r):(i=Nv(),qe.lanes|=i,Xn|=i,s)}function Ag(i,s,r,l,u){var d=q.p;q.p=d!==0&&8>d?d:8;var g=M.T,S={};M.T=S,nd(i,!1,s,r);try{var R=u(),F=M.S;if(F!==null&&F(S,R),R!==null&&typeof R=="object"&&typeof R.then=="function"){var ne=lC(R,l);kl(i,s,ne,gs(i))}else kl(i,s,l,gs(i))}catch(ce){kl(i,s,{then:function(){},status:"rejected",reason:ce},gs())}finally{q.p=d,g!==null&&S.types!==null&&(g.types=S.types),M.T=g}}function fC(){}function id(i,s,r,l){if(i.tag!==5)throw Error(a(476));var u=Lg(i).queue;Ag(i,u,s,V,r===null?fC:function(){return Bg(i),r(l)})}function Lg(i){var s=i.memoizedState;if(s!==null)return s;s={memoizedState:V,baseState:V,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:_n,lastRenderedState:V},next:null};var r={};return s.next={memoizedState:r,baseState:r,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:_n,lastRenderedState:r},next:null},i.memoizedState=s,i=i.alternate,i!==null&&(i.memoizedState=s),s}function Bg(i){var s=Lg(i);s.next===null&&(s=i.alternate.memoizedState),kl(i,s.next.queue,{},gs())}function sd(){return Ri(ql)}function Og(){return qt().memoizedState}function zg(){return qt().memoizedState}function pC(i){for(var s=i.return;s!==null;){switch(s.tag){case 24:case 3:var r=gs();i=Fn(r);var l=qn(s,i,r);l!==null&&(ns(l,s,r),wl(l,s,r)),s={cache:Ah()},i.payload=s;return}s=s.return}}function mC(i,s,r){var l=gs();r={lane:l,revertLane:0,gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null},vc(i)?Hg(s,r):(r=Sh(i,s,r,l),r!==null&&(ns(r,i,l),Ug(r,s,l)))}function jg(i,s,r){var l=gs();kl(i,s,r,l)}function kl(i,s,r,l){var u={lane:l,revertLane:0,gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null};if(vc(i))Hg(s,u);else{var d=i.alternate;if(i.lanes===0&&(d===null||d.lanes===0)&&(d=s.lastRenderedReducer,d!==null))try{var g=s.lastRenderedState,S=d(g,r);if(u.hasEagerState=!0,u.eagerState=S,hs(S,g))return Qo(i,s,u,0),yt===null&&Zo(),!1}catch{}if(r=Sh(i,s,u,l),r!==null)return ns(r,i,l),Ug(r,s,l),!0}return!1}function nd(i,s,r,l){if(l={lane:2,revertLane:zd(),gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null},vc(i)){if(s)throw Error(a(479))}else s=Sh(i,r,l,2),s!==null&&ns(s,i,2)}function vc(i){var s=i.alternate;return i===qe||s!==null&&s===qe}function Hg(i,s){wa=hc=!0;var r=i.pending;r===null?s.next=s:(s.next=r.next,r.next=s),i.pending=s}function Ug(i,s,r){if((r&4194048)!==0){var l=s.lanes;l&=i.pendingLanes,r|=l,s.lanes=r,It(i,r)}}var Dl={readContext:Ri,use:pc,useCallback:jt,useContext:jt,useEffect:jt,useImperativeHandle:jt,useLayoutEffect:jt,useInsertionEffect:jt,useMemo:jt,useReducer:jt,useRef:jt,useState:jt,useDebugValue:jt,useDeferredValue:jt,useTransition:jt,useSyncExternalStore:jt,useId:jt,useHostTransitionStatus:jt,useFormState:jt,useActionState:jt,useOptimistic:jt,useMemoCache:jt,useCacheRefresh:jt};Dl.useEffectEvent=jt;var Pg={readContext:Ri,use:pc,useCallback:function(i,s){return Wi().memoizedState=[i,s===void 0?null:s],i},useContext:Ri,useEffect:Cg,useImperativeHandle:function(i,s,r){r=r!=null?r.concat([i]):null,_c(4194308,4,kg.bind(null,s,i),r)},useLayoutEffect:function(i,s){return _c(4194308,4,i,s)},useInsertionEffect:function(i,s){_c(4,2,i,s)},useMemo:function(i,s){var r=Wi();s=s===void 0?null:s;var l=i();if(Ur){Ci(!0);try{i()}finally{Ci(!1)}}return r.memoizedState=[l,s],l},useReducer:function(i,s,r){var l=Wi();if(r!==void 0){var u=r(s);if(Ur){Ci(!0);try{r(s)}finally{Ci(!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=mC.bind(null,qe,i),[l.memoizedState,i]},useRef:function(i){var s=Wi();return i={current:i},s.memoizedState=i},useState:function(i){i=Zh(i);var s=i.queue,r=jg.bind(null,qe,s);return s.dispatch=r,[i.memoizedState,r]},useDebugValue:ed,useDeferredValue:function(i,s){var r=Wi();return td(r,i,s)},useTransition:function(){var i=Zh(!1);return i=Ag.bind(null,qe,i.queue,!0,!1),Wi().memoizedState=i,[!1,i]},useSyncExternalStore:function(i,s,r){var l=qe,u=Wi();if(tt){if(r===void 0)throw Error(a(407));r=r()}else{if(r=s(),yt===null)throw Error(a(349));(Je&127)!==0||lg(l,s,r)}u.memoizedState=r;var d={value:r,getSnapshot:s};return u.queue=d,Cg(cg.bind(null,l,d,i),[i]),l.flags|=2048,xa(9,{destroy:void 0},og.bind(null,l,d,r,s),null),r},useId:function(){var i=Wi(),s=yt.identifierPrefix;if(tt){var r=Qs,l=Zs;r=(l&~(1<<32-Bt(l)-1)).toString(32)+r,s="_"+s+"R_"+r,r=dc++,0<r&&(s+="H"+r.toString(32)),s+="_"}else r=oC++,s="_"+s+"r_"+r.toString(32)+"_";return i.memoizedState=s},useHostTransitionStatus:sd,useFormState:vg,useActionState:vg,useOptimistic:function(i){var s=Wi();s.memoizedState=s.baseState=i;var r={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return s.queue=r,s=nd.bind(null,qe,!0,r),r.dispatch=s,[i,s]},useMemoCache:Vh,useCacheRefresh:function(){return Wi().memoizedState=pC.bind(null,qe)},useEffectEvent:function(i){var s=Wi(),r={impl:i};return s.memoizedState=r,function(){if((lt&2)!==0)throw Error(a(440));return r.impl.apply(void 0,arguments)}}},rd={readContext:Ri,use:pc,useCallback:Rg,useContext:Ri,useEffect:Jh,useImperativeHandle:Dg,useInsertionEffect:Eg,useLayoutEffect:Tg,useMemo:Mg,useReducer:mc,useRef:wg,useState:function(){return mc(_n)},useDebugValue:ed,useDeferredValue:function(i,s){var r=qt();return Ng(r,ft.memoizedState,i,s)},useTransition:function(){var i=mc(_n)[0],s=qt().memoizedState;return[typeof i=="boolean"?i:Tl(i),s]},useSyncExternalStore:ag,useId:Og,useHostTransitionStatus:sd,useFormState:yg,useActionState:yg,useOptimistic:function(i,s){var r=qt();return dg(r,ft,i,s)},useMemoCache:Vh,useCacheRefresh:zg};rd.useEffectEvent=xg;var Kg={readContext:Ri,use:pc,useCallback:Rg,useContext:Ri,useEffect:Jh,useImperativeHandle:Dg,useInsertionEffect:Eg,useLayoutEffect:Tg,useMemo:Mg,useReducer:Gh,useRef:wg,useState:function(){return Gh(_n)},useDebugValue:ed,useDeferredValue:function(i,s){var r=qt();return ft===null?td(r,i,s):Ng(r,ft.memoizedState,i,s)},useTransition:function(){var i=Gh(_n)[0],s=qt().memoizedState;return[typeof i=="boolean"?i:Tl(i),s]},useSyncExternalStore:ag,useId:Og,useHostTransitionStatus:sd,useFormState:Sg,useActionState:Sg,useOptimistic:function(i,s){var r=qt();return ft!==null?dg(r,ft,i,s):(r.baseState=i,[i,r.queue.dispatch])},useMemoCache:Vh,useCacheRefresh:zg};Kg.useEffectEvent=xg;function ad(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 ld={enqueueSetState:function(i,s,r){i=i._reactInternals;var l=gs(),u=Fn(l);u.payload=s,r!=null&&(u.callback=r),s=qn(i,u,l),s!==null&&(ns(s,i,l),wl(s,i,l))},enqueueReplaceState:function(i,s,r){i=i._reactInternals;var l=gs(),u=Fn(l);u.tag=1,u.payload=s,r!=null&&(u.callback=r),s=qn(i,u,l),s!==null&&(ns(s,i,l),wl(s,i,l))},enqueueForceUpdate:function(i,s){i=i._reactInternals;var r=gs(),l=Fn(r);l.tag=2,s!=null&&(l.callback=s),s=qn(i,l,r),s!==null&&(ns(s,i,r),wl(s,i,r))}};function Ig(i,s,r,l,u,d,g){return i=i.stateNode,typeof i.shouldComponentUpdate=="function"?i.shouldComponentUpdate(l,d,g):s.prototype&&s.prototype.isPureReactComponent?!pl(r,l)||!pl(u,d):!0}function Fg(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&&ld.enqueueReplaceState(s,s.state,null)}function Pr(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 qg(i){Go(i)}function Wg(i){console.error(i)}function $g(i){Go(i)}function yc(i,s){try{var r=i.onUncaughtError;r(s.value,{componentStack:s.stack})}catch(l){setTimeout(function(){throw l})}}function Yg(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 od(i,s,r){return r=Fn(r),r.tag=3,r.payload={element:null},r.callback=function(){yc(i,s)},r}function Vg(i){return i=Fn(i),i.tag=3,i}function Xg(i,s,r,l){var u=r.type.getDerivedStateFromError;if(typeof u=="function"){var d=l.value;i.payload=function(){return u(d)},i.callback=function(){Yg(s,r,l)}}var g=r.stateNode;g!==null&&typeof g.componentDidCatch=="function"&&(i.callback=function(){Yg(s,r,l),typeof u!="function"&&(Gn===null?Gn=new Set([this]):Gn.add(this));var S=l.stack;this.componentDidCatch(l.value,{componentStack:S!==null?S:""})})}function _C(i,s,r,l,u){if(r.flags|=32768,l!==null&&typeof l=="object"&&typeof l.then=="function"){if(s=r.alternate,s!==null&&_a(s,r,u,!0),r=fs.current,r!==null){switch(r.tag){case 31:case 13:return Ns===null?Nc():r.alternate===null&&Ht===0&&(Ht=3),r.flags&=-257,r.flags|=65536,r.lanes=u,l===ac?r.flags|=16384:(s=r.updateQueue,s===null?r.updateQueue=new Set([l]):s.add(l),Ld(i,l,u)),!1;case 22:return r.flags|=65536,l===ac?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)),Ld(i,l,u)),!1}throw Error(a(435,r.tag))}return Ld(i,l,u),Nc(),!1}if(tt)return s=fs.current,s!==null?((s.flags&65536)===0&&(s.flags|=256),s.flags|=65536,s.lanes=u,l!==kh&&(i=Error(a(422),{cause:l}),gl(ks(i,r)))):(l!==kh&&(s=Error(a(423),{cause:l}),gl(ks(s,r))),i=i.current.alternate,i.flags|=65536,u&=-u,i.lanes|=u,l=ks(l,r),u=od(i.stateNode,l,u),Hh(i,u),Ht!==4&&(Ht=2)),!1;var d=Error(a(520),{cause:l});if(d=ks(d,r),zl===null?zl=[d]:zl.push(d),Ht!==4&&(Ht=2),s===null)return!0;l=ks(l,r),r=s;do{switch(r.tag){case 3:return r.flags|=65536,i=u&-u,r.lanes|=i,i=od(r.stateNode,l,i),Hh(r,i),!1;case 1:if(s=r.type,d=r.stateNode,(r.flags&128)===0&&(typeof s.getDerivedStateFromError=="function"||d!==null&&typeof d.componentDidCatch=="function"&&(Gn===null||!Gn.has(d))))return r.flags|=65536,u&=-u,r.lanes|=u,u=Vg(u),Xg(u,i,r,l),Hh(r,u),!1}r=r.return}while(r!==null);return!1}var cd=Error(a(461)),Qt=!1;function Mi(i,s,r,l){s.child=i===null?J_(s,null,r,l):Hr(s,i.child,r,l)}function Gg(i,s,r,l,u){r=r.render;var d=s.ref;if("ref"in l){var g={};for(var S in l)S!=="ref"&&(g[S]=l[S])}else g=l;return Br(s),l=qh(i,s,r,g,d,u),S=Wh(),i!==null&&!Qt?($h(i,s,u),gn(i,s,u)):(tt&&S&&Eh(s),s.flags|=1,Mi(i,s,l,u),s.child)}function Zg(i,s,r,l,u){if(i===null){var d=r.type;return typeof d=="function"&&!wh(d)&&d.defaultProps===void 0&&r.compare===null?(s.tag=15,s.type=d,Qg(i,s,d,l,u)):(i=ec(r.type,null,l,s,s.mode,u),i.ref=s.ref,i.return=s,s.child=i)}if(d=i.child,!gd(i,u)){var g=d.memoizedProps;if(r=r.compare,r=r!==null?r:pl,r(g,l)&&i.ref===s.ref)return gn(i,s,u)}return s.flags|=1,i=hn(d,l),i.ref=s.ref,i.return=s,s.child=i}function Qg(i,s,r,l,u){if(i!==null){var d=i.memoizedProps;if(pl(d,l)&&i.ref===s.ref)if(Qt=!1,s.pendingProps=l=d,gd(i,u))(i.flags&131072)!==0&&(Qt=!0);else return s.lanes=i.lanes,gn(i,s,u)}return ud(i,s,r,l,u)}function Jg(i,s,r,l){var u=l.children,d=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(d=d!==null?d.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&~d}else l=0,s.child=null;return ev(i,s,d,r,l)}if((r&536870912)!==0)s.memoizedState={baseLanes:0,cachePool:null},i!==null&&nc(s,d!==null?d.cachePool:null),d!==null?ig(s,d):Ph(),sg(s);else return l=s.lanes=536870912,ev(i,s,d!==null?d.baseLanes|r:r,r,l)}else d!==null?(nc(s,d.cachePool),ig(s,d),$n(),s.memoizedState=null):(i!==null&&nc(s,null),Ph(),$n());return Mi(i,s,u,r),s.child}function Rl(i,s){return i!==null&&i.tag===22||s.stateNode!==null||(s.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),s.sibling}function ev(i,s,r,l,u){var d=Bh();return d=d===null?null:{parent:Gt._currentValue,pool:d},s.memoizedState={baseLanes:r,cachePool:d},i!==null&&nc(s,null),Ph(),sg(s),i!==null&&_a(i,s,l,!0),s.childLanes=u,null}function bc(i,s){return s=wc({mode:s.mode,children:s.children},i.mode),s.ref=i.ref,i.child=s,s.return=i,s}function tv(i,s,r){return Hr(s,i.child,null,r),i=bc(s,s.pendingProps),i.flags|=2,ps(s),s.memoizedState=null,i}function gC(i,s,r){var l=s.pendingProps,u=(s.flags&128)!==0;if(s.flags&=-129,i===null){if(tt){if(l.mode==="hidden")return i=bc(s,l),s.lanes=536870912,Rl(null,i);if(Ih(s),(i=xt)?(i=fy(i,Ms),i=i!==null&&i.data==="&"?i:null,i!==null&&(s.memoizedState={dehydrated:i,treeContext:Hn!==null?{id:Zs,overflow:Qs}:null,retryLane:536870912,hydrationErrors:null},r=H_(i),r.return=s,s.child=r,Di=s,xt=null)):i=null,i===null)throw Pn(s);return s.lanes=536870912,null}return bc(s,l)}var d=i.memoizedState;if(d!==null){var g=d.dehydrated;if(Ih(s),u)if(s.flags&256)s.flags&=-257,s=tv(i,s,r);else if(s.memoizedState!==null)s.child=i.child,s.flags|=128,s=null;else throw Error(a(558));else if(Qt||_a(i,s,r,!1),u=(r&i.childLanes)!==0,Qt||u){if(l=yt,l!==null&&(g=Ti(l,r),g!==0&&g!==d.retryLane))throw d.retryLane=g,Mr(i,g),ns(l,i,g),cd;Nc(),s=tv(i,s,r)}else i=d.treeContext,xt=As(g.nextSibling),Di=s,tt=!0,Un=null,Ms=!1,i!==null&&K_(s,i),s=bc(s,l),s.flags|=4096;return s}return i=hn(i.child,{mode:l.mode,children:l.children}),i.ref=s.ref,s.child=i,i.return=s,i}function Sc(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 ud(i,s,r,l,u){return Br(s),r=qh(i,s,r,l,void 0,u),l=Wh(),i!==null&&!Qt?($h(i,s,u),gn(i,s,u)):(tt&&l&&Eh(s),s.flags|=1,Mi(i,s,r,u),s.child)}function iv(i,s,r,l,u,d){return Br(s),s.updateQueue=null,r=rg(s,l,r,u),ng(i),l=Wh(),i!==null&&!Qt?($h(i,s,d),gn(i,s,d)):(tt&&l&&Eh(s),s.flags|=1,Mi(i,s,r,d),s.child)}function sv(i,s,r,l,u){if(Br(s),s.stateNode===null){var d=da,g=r.contextType;typeof g=="object"&&g!==null&&(d=Ri(g)),d=new r(l,d),s.memoizedState=d.state!==null&&d.state!==void 0?d.state:null,d.updater=ld,s.stateNode=d,d._reactInternals=s,d=s.stateNode,d.props=l,d.state=s.memoizedState,d.refs={},zh(s),g=r.contextType,d.context=typeof g=="object"&&g!==null?Ri(g):da,d.state=s.memoizedState,g=r.getDerivedStateFromProps,typeof g=="function"&&(ad(s,r,g,l),d.state=s.memoizedState),typeof r.getDerivedStateFromProps=="function"||typeof d.getSnapshotBeforeUpdate=="function"||typeof d.UNSAFE_componentWillMount!="function"&&typeof d.componentWillMount!="function"||(g=d.state,typeof d.componentWillMount=="function"&&d.componentWillMount(),typeof d.UNSAFE_componentWillMount=="function"&&d.UNSAFE_componentWillMount(),g!==d.state&&ld.enqueueReplaceState(d,d.state,null),xl(s,l,d,u),Cl(),d.state=s.memoizedState),typeof d.componentDidMount=="function"&&(s.flags|=4194308),l=!0}else if(i===null){d=s.stateNode;var S=s.memoizedProps,R=Pr(r,S);d.props=R;var F=d.context,ne=r.contextType;g=da,typeof ne=="object"&&ne!==null&&(g=Ri(ne));var ce=r.getDerivedStateFromProps;ne=typeof ce=="function"||typeof d.getSnapshotBeforeUpdate=="function",S=s.pendingProps!==S,ne||typeof d.UNSAFE_componentWillReceiveProps!="function"&&typeof d.componentWillReceiveProps!="function"||(S||F!==g)&&Fg(s,d,l,g),In=!1;var $=s.memoizedState;d.state=$,xl(s,l,d,u),Cl(),F=s.memoizedState,S||$!==F||In?(typeof ce=="function"&&(ad(s,r,ce,l),F=s.memoizedState),(R=In||Ig(s,r,R,l,$,F,g))?(ne||typeof d.UNSAFE_componentWillMount!="function"&&typeof d.componentWillMount!="function"||(typeof d.componentWillMount=="function"&&d.componentWillMount(),typeof d.UNSAFE_componentWillMount=="function"&&d.UNSAFE_componentWillMount()),typeof d.componentDidMount=="function"&&(s.flags|=4194308)):(typeof d.componentDidMount=="function"&&(s.flags|=4194308),s.memoizedProps=l,s.memoizedState=F),d.props=l,d.state=F,d.context=g,l=R):(typeof d.componentDidMount=="function"&&(s.flags|=4194308),l=!1)}else{d=s.stateNode,jh(i,s),g=s.memoizedProps,ne=Pr(r,g),d.props=ne,ce=s.pendingProps,$=d.context,F=r.contextType,R=da,typeof F=="object"&&F!==null&&(R=Ri(F)),S=r.getDerivedStateFromProps,(F=typeof S=="function"||typeof d.getSnapshotBeforeUpdate=="function")||typeof d.UNSAFE_componentWillReceiveProps!="function"&&typeof d.componentWillReceiveProps!="function"||(g!==ce||$!==R)&&Fg(s,d,l,R),In=!1,$=s.memoizedState,d.state=$,xl(s,l,d,u),Cl();var Z=s.memoizedState;g!==ce||$!==Z||In||i!==null&&i.dependencies!==null&&ic(i.dependencies)?(typeof S=="function"&&(ad(s,r,S,l),Z=s.memoizedState),(ne=In||Ig(s,r,ne,l,$,Z,R)||i!==null&&i.dependencies!==null&&ic(i.dependencies))?(F||typeof d.UNSAFE_componentWillUpdate!="function"&&typeof d.componentWillUpdate!="function"||(typeof d.componentWillUpdate=="function"&&d.componentWillUpdate(l,Z,R),typeof d.UNSAFE_componentWillUpdate=="function"&&d.UNSAFE_componentWillUpdate(l,Z,R)),typeof d.componentDidUpdate=="function"&&(s.flags|=4),typeof d.getSnapshotBeforeUpdate=="function"&&(s.flags|=1024)):(typeof d.componentDidUpdate!="function"||g===i.memoizedProps&&$===i.memoizedState||(s.flags|=4),typeof d.getSnapshotBeforeUpdate!="function"||g===i.memoizedProps&&$===i.memoizedState||(s.flags|=1024),s.memoizedProps=l,s.memoizedState=Z),d.props=l,d.state=Z,d.context=R,l=ne):(typeof d.componentDidUpdate!="function"||g===i.memoizedProps&&$===i.memoizedState||(s.flags|=4),typeof d.getSnapshotBeforeUpdate!="function"||g===i.memoizedProps&&$===i.memoizedState||(s.flags|=1024),l=!1)}return d=l,Sc(i,s),l=(s.flags&128)!==0,d||l?(d=s.stateNode,r=l&&typeof r.getDerivedStateFromError!="function"?null:d.render(),s.flags|=1,i!==null&&l?(s.child=Hr(s,i.child,null,u),s.child=Hr(s,null,r,u)):Mi(i,s,r,u),s.memoizedState=d.state,i=s.child):i=gn(i,s,u),i}function nv(i,s,r,l){return Ar(),s.flags|=256,Mi(i,s,r,l),s.child}var hd={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function dd(i){return{baseLanes:i,cachePool:Y_()}}function fd(i,s,r){return i=i!==null?i.childLanes&~r:0,s&&(i|=_s),i}function rv(i,s,r){var l=s.pendingProps,u=!1,d=(s.flags&128)!==0,g;if((g=d)||(g=i!==null&&i.memoizedState===null?!1:(Ft.current&2)!==0),g&&(u=!0,s.flags&=-129),g=(s.flags&32)!==0,s.flags&=-33,i===null){if(tt){if(u?Wn(s):$n(),(i=xt)?(i=fy(i,Ms),i=i!==null&&i.data!=="&"?i:null,i!==null&&(s.memoizedState={dehydrated:i,treeContext:Hn!==null?{id:Zs,overflow:Qs}:null,retryLane:536870912,hydrationErrors:null},r=H_(i),r.return=s,s.child=r,Di=s,xt=null)):i=null,i===null)throw Pn(s);return Xd(i)?s.lanes=32:s.lanes=536870912,null}var S=l.children;return l=l.fallback,u?($n(),u=s.mode,S=wc({mode:"hidden",children:S},u),l=Nr(l,u,r,null),S.return=s,l.return=s,S.sibling=l,s.child=S,l=s.child,l.memoizedState=dd(r),l.childLanes=fd(i,g,r),s.memoizedState=hd,Rl(null,l)):(Wn(s),pd(s,S))}var R=i.memoizedState;if(R!==null&&(S=R.dehydrated,S!==null)){if(d)s.flags&256?(Wn(s),s.flags&=-257,s=md(i,s,r)):s.memoizedState!==null?($n(),s.child=i.child,s.flags|=128,s=null):($n(),S=l.fallback,u=s.mode,l=wc({mode:"visible",children:l.children},u),S=Nr(S,u,r,null),S.flags|=2,l.return=s,S.return=s,l.sibling=S,s.child=l,Hr(s,i.child,null,r),l=s.child,l.memoizedState=dd(r),l.childLanes=fd(i,g,r),s.memoizedState=hd,s=Rl(null,l));else if(Wn(s),Xd(S)){if(g=S.nextSibling&&S.nextSibling.dataset,g)var F=g.dgst;g=F,l=Error(a(419)),l.stack="",l.digest=g,gl({value:l,source:null,stack:null}),s=md(i,s,r)}else if(Qt||_a(i,s,r,!1),g=(r&i.childLanes)!==0,Qt||g){if(g=yt,g!==null&&(l=Ti(g,r),l!==0&&l!==R.retryLane))throw R.retryLane=l,Mr(i,l),ns(g,i,l),cd;Vd(S)||Nc(),s=md(i,s,r)}else Vd(S)?(s.flags|=192,s.child=i.child,s=null):(i=R.treeContext,xt=As(S.nextSibling),Di=s,tt=!0,Un=null,Ms=!1,i!==null&&K_(s,i),s=pd(s,l.children),s.flags|=4096);return s}return u?($n(),S=l.fallback,u=s.mode,R=i.child,F=R.sibling,l=hn(R,{mode:"hidden",children:l.children}),l.subtreeFlags=R.subtreeFlags&65011712,F!==null?S=hn(F,S):(S=Nr(S,u,r,null),S.flags|=2),S.return=s,l.return=s,l.sibling=S,s.child=l,Rl(null,l),l=s.child,S=i.child.memoizedState,S===null?S=dd(r):(u=S.cachePool,u!==null?(R=Gt._currentValue,u=u.parent!==R?{parent:R,pool:R}:u):u=Y_(),S={baseLanes:S.baseLanes|r,cachePool:u}),l.memoizedState=S,l.childLanes=fd(i,g,r),s.memoizedState=hd,Rl(i.child,l)):(Wn(s),r=i.child,i=r.sibling,r=hn(r,{mode:"visible",children:l.children}),r.return=s,r.sibling=null,i!==null&&(g=s.deletions,g===null?(s.deletions=[i],s.flags|=16):g.push(i)),s.child=r,s.memoizedState=null,r)}function pd(i,s){return s=wc({mode:"visible",children:s},i.mode),s.return=i,i.child=s}function wc(i,s){return i=ds(22,i,null,s),i.lanes=0,i}function md(i,s,r){return Hr(s,i.child,null,r),i=pd(s,s.pendingProps.children),i.flags|=2,s.memoizedState=null,i}function av(i,s,r){i.lanes|=s;var l=i.alternate;l!==null&&(l.lanes|=s),Mh(i.return,s,r)}function _d(i,s,r,l,u,d){var g=i.memoizedState;g===null?i.memoizedState={isBackwards:s,rendering:null,renderingStartTime:0,last:l,tail:r,tailMode:u,treeForkCount:d}:(g.isBackwards=s,g.rendering=null,g.renderingStartTime=0,g.last=l,g.tail=r,g.tailMode=u,g.treeForkCount=d)}function lv(i,s,r){var l=s.pendingProps,u=l.revealOrder,d=l.tail;l=l.children;var g=Ft.current,S=(g&2)!==0;if(S?(g=g&1|2,s.flags|=128):g&=1,re(Ft,g),Mi(i,s,l,r),l=tt?_l:0,!S&&i!==null&&(i.flags&128)!==0)e:for(i=s.child;i!==null;){if(i.tag===13)i.memoizedState!==null&&av(i,r,s);else if(i.tag===19)av(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&&uc(i)===null&&(u=r),r=r.sibling;r=u,r===null?(u=s.child,s.child=null):(u=r.sibling,r.sibling=null),_d(s,!1,u,r,d,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&&uc(i)===null){s.child=u;break}i=u.sibling,u.sibling=r,r=u,u=i}_d(s,!0,r,null,d,l);break;case"together":_d(s,!1,null,null,void 0,l);break;default:s.memoizedState=null}return s.child}function gn(i,s,r){if(i!==null&&(s.dependencies=i.dependencies),Xn|=s.lanes,(r&s.childLanes)===0)if(i!==null){if(_a(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=hn(i,i.pendingProps),s.child=r,r.return=s;i.sibling!==null;)i=i.sibling,r=r.sibling=hn(i,i.pendingProps),r.return=s;r.sibling=null}return s.child}function gd(i,s){return(i.lanes&s)!==0?!0:(i=i.dependencies,!!(i!==null&&ic(i)))}function vC(i,s,r){switch(s.tag){case 3:me(s,s.stateNode.containerInfo),Kn(s,Gt,i.memoizedState.cache),Ar();break;case 27:case 5:Me(s);break;case 4:me(s,s.stateNode.containerInfo);break;case 10:Kn(s,s.type,s.memoizedProps.value);break;case 31:if(s.memoizedState!==null)return s.flags|=128,Ih(s),null;break;case 13:var l=s.memoizedState;if(l!==null)return l.dehydrated!==null?(Wn(s),s.flags|=128,null):(r&s.child.childLanes)!==0?rv(i,s,r):(Wn(s),i=gn(i,s,r),i!==null?i.sibling:null);Wn(s);break;case 19:var u=(i.flags&128)!==0;if(l=(r&s.childLanes)!==0,l||(_a(i,s,r,!1),l=(r&s.childLanes)!==0),u){if(l)return lv(i,s,r);s.flags|=128}if(u=s.memoizedState,u!==null&&(u.rendering=null,u.tail=null,u.lastEffect=null),re(Ft,Ft.current),l)break;return null;case 22:return s.lanes=0,Jg(i,s,r,s.pendingProps);case 24:Kn(s,Gt,i.memoizedState.cache)}return gn(i,s,r)}function ov(i,s,r){if(i!==null)if(i.memoizedProps!==s.pendingProps)Qt=!0;else{if(!gd(i,r)&&(s.flags&128)===0)return Qt=!1,vC(i,s,r);Qt=(i.flags&131072)!==0}else Qt=!1,tt&&(s.flags&1048576)!==0&&P_(s,_l,s.index);switch(s.lanes=0,s.tag){case 16:e:{var l=s.pendingProps;if(i=zr(s.elementType),s.type=i,typeof i=="function")wh(i)?(l=Pr(i,l),s.tag=1,s=sv(null,s,i,l,r)):(s.tag=0,s=ud(null,s,i,l,r));else{if(i!=null){var u=i.$$typeof;if(u===X){s.tag=11,s=Gg(null,s,i,l,r);break e}else if(u===se){s.tag=14,s=Zg(null,s,i,l,r);break e}}throw s=z(i)||i,Error(a(306,s,""))}}return s;case 0:return ud(i,s,s.type,s.pendingProps,r);case 1:return l=s.type,u=Pr(l,s.pendingProps),sv(i,s,l,u,r);case 3:e:{if(me(s,s.stateNode.containerInfo),i===null)throw Error(a(387));l=s.pendingProps;var d=s.memoizedState;u=d.element,jh(i,s),xl(s,l,null,r);var g=s.memoizedState;if(l=g.cache,Kn(s,Gt,l),l!==d.cache&&Nh(s,[Gt],r,!0),Cl(),l=g.element,d.isDehydrated)if(d={element:l,isDehydrated:!1,cache:g.cache},s.updateQueue.baseState=d,s.memoizedState=d,s.flags&256){s=nv(i,s,l,r);break e}else if(l!==u){u=ks(Error(a(424)),s),gl(u),s=nv(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,xt=As(i.firstChild),Di=s,tt=!0,Un=null,Ms=!0,r=J_(s,null,l,r),s.child=r;r;)r.flags=r.flags&-3|4096,r=r.sibling;else{if(Ar(),l===u){s=gn(i,s,r);break e}Mi(i,s,l,r)}s=s.child}return s;case 26:return Sc(i,s),i===null?(r=yy(s.type,null,s.pendingProps,null))?s.memoizedState=r:tt||(r=s.type,i=s.pendingProps,l=Hc(pe.current).createElement(r),l[zt]=s,l[ni]=i,Ni(l,r,i),Nt(l),s.stateNode=l):s.memoizedState=yy(s.type,i.memoizedProps,s.pendingProps,i.memoizedState),null;case 27:return Me(s),i===null&&tt&&(l=s.stateNode=_y(s.type,s.pendingProps,pe.current),Di=s,Ms=!0,u=xt,er(s.type)?(Gd=u,xt=As(l.firstChild)):xt=u),Mi(i,s,s.pendingProps.children,r),Sc(i,s),i===null&&(s.flags|=4194304),s.child;case 5:return i===null&&tt&&((u=l=xt)&&(l=VC(l,s.type,s.pendingProps,Ms),l!==null?(s.stateNode=l,Di=s,xt=As(l.firstChild),Ms=!1,u=!0):u=!1),u||Pn(s)),Me(s),u=s.type,d=s.pendingProps,g=i!==null?i.memoizedProps:null,l=d.children,Wd(u,d)?l=null:g!==null&&Wd(u,g)&&(s.flags|=32),s.memoizedState!==null&&(u=qh(i,s,cC,null,null,r),ql._currentValue=u),Sc(i,s),Mi(i,s,l,r),s.child;case 6:return i===null&&tt&&((i=r=xt)&&(r=XC(r,s.pendingProps,Ms),r!==null?(s.stateNode=r,Di=s,xt=null,i=!0):i=!1),i||Pn(s)),null;case 13:return rv(i,s,r);case 4:return me(s,s.stateNode.containerInfo),l=s.pendingProps,i===null?s.child=Hr(s,null,l,r):Mi(i,s,l,r),s.child;case 11:return Gg(i,s,s.type,s.pendingProps,r);case 7:return Mi(i,s,s.pendingProps,r),s.child;case 8:return Mi(i,s,s.pendingProps.children,r),s.child;case 12:return Mi(i,s,s.pendingProps.children,r),s.child;case 10:return l=s.pendingProps,Kn(s,s.type,l.value),Mi(i,s,l.children,r),s.child;case 9:return u=s.type._context,l=s.pendingProps.children,Br(s),u=Ri(u),l=l(u),s.flags|=1,Mi(i,s,l,r),s.child;case 14:return Zg(i,s,s.type,s.pendingProps,r);case 15:return Qg(i,s,s.type,s.pendingProps,r);case 19:return lv(i,s,r);case 31:return gC(i,s,r);case 22:return Jg(i,s,r,s.pendingProps);case 24:return Br(s),l=Ri(Gt),i===null?(u=Bh(),u===null&&(u=yt,d=Ah(),u.pooledCache=d,d.refCount++,d!==null&&(u.pooledCacheLanes|=r),u=d),s.memoizedState={parent:l,cache:u},zh(s),Kn(s,Gt,u)):((i.lanes&r)!==0&&(jh(i,s),xl(s,null,null,r),Cl()),u=i.memoizedState,d=s.memoizedState,u.parent!==l?(u={parent:l,cache:l},s.memoizedState=u,s.lanes===0&&(s.memoizedState=s.updateQueue.baseState=u),Kn(s,Gt,l)):(l=d.cache,Kn(s,Gt,l),l!==u.cache&&Nh(s,[Gt],r,!0))),Mi(i,s,s.pendingProps.children,r),s.child;case 29:throw s.pendingProps}throw Error(a(156,s.tag))}function vn(i){i.flags|=4}function vd(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(Ov())i.flags|=8192;else throw jr=ac,Oh}else i.flags&=-16777217}function cv(i,s){if(s.type!=="stylesheet"||(s.state.loading&4)!==0)i.flags&=-16777217;else if(i.flags|=16777216,!xy(s))if(Ov())i.flags|=8192;else throw jr=ac,Oh}function Cc(i,s){s!==null&&(i.flags|=4),i.flags&16384&&(s=i.tag!==22?Vt():536870912,i.lanes|=s,Da|=s)}function Ml(i,s){if(!tt)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 Et(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 yC(i,s,r){var l=s.pendingProps;switch(Th(s),s.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Et(s),null;case 1:return Et(s),null;case 3:return r=s.stateNode,l=null,i!==null&&(l=i.memoizedState.cache),s.memoizedState.cache!==l&&(s.flags|=2048),pn(Gt),Se(),r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),(i===null||i.child===null)&&(ma(s)?vn(s):i===null||i.memoizedState.isDehydrated&&(s.flags&256)===0||(s.flags|=1024,Dh())),Et(s),null;case 26:var u=s.type,d=s.memoizedState;return i===null?(vn(s),d!==null?(Et(s),cv(s,d)):(Et(s),vd(s,u,null,l,r))):d?d!==i.memoizedState?(vn(s),Et(s),cv(s,d)):(Et(s),s.flags&=-16777217):(i=i.memoizedProps,i!==l&&vn(s),Et(s),vd(s,u,i,l,r)),null;case 27:if(Ue(s),r=pe.current,u=s.type,i!==null&&s.stateNode!=null)i.memoizedProps!==l&&vn(s);else{if(!l){if(s.stateNode===null)throw Error(a(166));return Et(s),null}i=he.current,ma(s)?I_(s):(i=_y(u,l,r),s.stateNode=i,vn(s))}return Et(s),null;case 5:if(Ue(s),u=s.type,i!==null&&s.stateNode!=null)i.memoizedProps!==l&&vn(s);else{if(!l){if(s.stateNode===null)throw Error(a(166));return Et(s),null}if(d=he.current,ma(s))I_(s);else{var g=Hc(pe.current);switch(d){case 1:d=g.createElementNS("http://www.w3.org/2000/svg",u);break;case 2:d=g.createElementNS("http://www.w3.org/1998/Math/MathML",u);break;default:switch(u){case"svg":d=g.createElementNS("http://www.w3.org/2000/svg",u);break;case"math":d=g.createElementNS("http://www.w3.org/1998/Math/MathML",u);break;case"script":d=g.createElement("div"),d.innerHTML="<script><\/script>",d=d.removeChild(d.firstChild);break;case"select":d=typeof l.is=="string"?g.createElement("select",{is:l.is}):g.createElement("select"),l.multiple?d.multiple=!0:l.size&&(d.size=l.size);break;default:d=typeof l.is=="string"?g.createElement(u,{is:l.is}):g.createElement(u)}}d[zt]=s,d[ni]=l;e:for(g=s.child;g!==null;){if(g.tag===5||g.tag===6)d.appendChild(g.stateNode);else if(g.tag!==4&&g.tag!==27&&g.child!==null){g.child.return=g,g=g.child;continue}if(g===s)break e;for(;g.sibling===null;){if(g.return===null||g.return===s)break e;g=g.return}g.sibling.return=g.return,g=g.sibling}s.stateNode=d;e:switch(Ni(d,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&&vn(s)}}return Et(s),vd(s,s.type,i===null?null:i.memoizedProps,s.pendingProps,r),null;case 6:if(i&&s.stateNode!=null)i.memoizedProps!==l&&vn(s);else{if(typeof l!="string"&&s.stateNode===null)throw Error(a(166));if(i=pe.current,ma(s)){if(i=s.stateNode,r=s.memoizedProps,l=null,u=Di,u!==null)switch(u.tag){case 27:case 5:l=u.memoizedProps}i[zt]=s,i=!!(i.nodeValue===r||l!==null&&l.suppressHydrationWarning===!0||ry(i.nodeValue,r)),i||Pn(s,!0)}else i=Hc(i).createTextNode(l),i[zt]=s,s.stateNode=i}return Et(s),null;case 31:if(r=s.memoizedState,i===null||i.memoizedState!==null){if(l=ma(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[zt]=s}else Ar(),(s.flags&128)===0&&(s.memoizedState=null),s.flags|=4;Et(s),i=!1}else r=Dh(),i!==null&&i.memoizedState!==null&&(i.memoizedState.hydrationErrors=r),i=!0;if(!i)return s.flags&256?(ps(s),s):(ps(s),null);if((s.flags&128)!==0)throw Error(a(558))}return Et(s),null;case 13:if(l=s.memoizedState,i===null||i.memoizedState!==null&&i.memoizedState.dehydrated!==null){if(u=ma(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[zt]=s}else Ar(),(s.flags&128)===0&&(s.memoizedState=null),s.flags|=4;Et(s),u=!1}else u=Dh(),i!==null&&i.memoizedState!==null&&(i.memoizedState.hydrationErrors=u),u=!0;if(!u)return s.flags&256?(ps(s),s):(ps(s),null)}return ps(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),d=null,l.memoizedState!==null&&l.memoizedState.cachePool!==null&&(d=l.memoizedState.cachePool.pool),d!==u&&(l.flags|=2048)),r!==i&&r&&(s.child.flags|=8192),Cc(s,s.updateQueue),Et(s),null);case 4:return Se(),i===null&&Pd(s.stateNode.containerInfo),Et(s),null;case 10:return pn(s.type),Et(s),null;case 19:if(W(Ft),l=s.memoizedState,l===null)return Et(s),null;if(u=(s.flags&128)!==0,d=l.rendering,d===null)if(u)Ml(l,!1);else{if(Ht!==0||i!==null&&(i.flags&128)!==0)for(i=s.child;i!==null;){if(d=uc(i),d!==null){for(s.flags|=128,Ml(l,!1),i=d.updateQueue,s.updateQueue=i,Cc(s,i),s.subtreeFlags=0,i=r,r=s.child;r!==null;)j_(r,i),r=r.sibling;return re(Ft,Ft.current&1|2),tt&&dn(s,l.treeForkCount),s.child}i=i.sibling}l.tail!==null&&Oe()>Dc&&(s.flags|=128,u=!0,Ml(l,!1),s.lanes=4194304)}else{if(!u)if(i=uc(d),i!==null){if(s.flags|=128,u=!0,i=i.updateQueue,s.updateQueue=i,Cc(s,i),Ml(l,!0),l.tail===null&&l.tailMode==="hidden"&&!d.alternate&&!tt)return Et(s),null}else 2*Oe()-l.renderingStartTime>Dc&&r!==536870912&&(s.flags|=128,u=!0,Ml(l,!1),s.lanes=4194304);l.isBackwards?(d.sibling=s.child,s.child=d):(i=l.last,i!==null?i.sibling=d:s.child=d,l.last=d)}return l.tail!==null?(i=l.tail,l.rendering=i,l.tail=i.sibling,l.renderingStartTime=Oe(),i.sibling=null,r=Ft.current,re(Ft,u?r&1|2:r&1),tt&&dn(s,l.treeForkCount),i):(Et(s),null);case 22:case 23:return ps(s),Kh(),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&&(Et(s),s.subtreeFlags&6&&(s.flags|=8192)):Et(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(Or),null;case 24:return r=null,i!==null&&(r=i.memoizedState.cache),s.memoizedState.cache!==r&&(s.flags|=2048),pn(Gt),Et(s),null;case 25:return null;case 30:return null}throw Error(a(156,s.tag))}function bC(i,s){switch(Th(s),s.tag){case 1:return i=s.flags,i&65536?(s.flags=i&-65537|128,s):null;case 3:return pn(Gt),Se(),i=s.flags,(i&65536)!==0&&(i&128)===0?(s.flags=i&-65537|128,s):null;case 26:case 27:case 5:return Ue(s),null;case 31:if(s.memoizedState!==null){if(ps(s),s.alternate===null)throw Error(a(340));Ar()}return i=s.flags,i&65536?(s.flags=i&-65537|128,s):null;case 13:if(ps(s),i=s.memoizedState,i!==null&&i.dehydrated!==null){if(s.alternate===null)throw Error(a(340));Ar()}return i=s.flags,i&65536?(s.flags=i&-65537|128,s):null;case 19:return W(Ft),null;case 4:return Se(),null;case 10:return pn(s.type),null;case 22:case 23:return ps(s),Kh(),i!==null&&W(Or),i=s.flags,i&65536?(s.flags=i&-65537|128,s):null;case 24:return pn(Gt),null;case 25:return null;default:return null}}function uv(i,s){switch(Th(s),s.tag){case 3:pn(Gt),Se();break;case 26:case 27:case 5:Ue(s);break;case 4:Se();break;case 31:s.memoizedState!==null&&ps(s);break;case 13:ps(s);break;case 19:W(Ft);break;case 10:pn(s.type);break;case 22:case 23:ps(s),Kh(),i!==null&&W(Or);break;case 24:pn(Gt)}}function Nl(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 d=r.create,g=r.inst;l=d(),g.destroy=l}r=r.next}while(r!==u)}}catch(S){ht(s,s.return,S)}}function Yn(i,s,r){try{var l=s.updateQueue,u=l!==null?l.lastEffect:null;if(u!==null){var d=u.next;l=d;do{if((l.tag&i)===i){var g=l.inst,S=g.destroy;if(S!==void 0){g.destroy=void 0,u=s;var R=r,F=S;try{F()}catch(ne){ht(u,R,ne)}}}l=l.next}while(l!==d)}}catch(ne){ht(s,s.return,ne)}}function hv(i){var s=i.updateQueue;if(s!==null){var r=i.stateNode;try{tg(s,r)}catch(l){ht(i,i.return,l)}}}function dv(i,s,r){r.props=Pr(i.type,i.memoizedProps),r.state=i.memoizedState;try{r.componentWillUnmount()}catch(l){ht(i,s,l)}}function Al(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){ht(i,s,u)}}function Js(i,s){var r=i.ref,l=i.refCleanup;if(r!==null)if(typeof l=="function")try{l()}catch(u){ht(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){ht(i,s,u)}else r.current=null}function fv(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){ht(i,i.return,u)}}function yd(i,s,r){try{var l=i.stateNode;IC(l,i.type,r,s),l[ni]=s}catch(u){ht(i,i.return,u)}}function pv(i){return i.tag===5||i.tag===3||i.tag===26||i.tag===27&&er(i.type)||i.tag===4}function bd(i){e:for(;;){for(;i.sibling===null;){if(i.return===null||pv(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&&er(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 Sd(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=Fs));else if(l!==4&&(l===27&&er(i.type)&&(r=i.stateNode,s=null),i=i.child,i!==null))for(Sd(i,s,r),i=i.sibling;i!==null;)Sd(i,s,r),i=i.sibling}function xc(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&&er(i.type)&&(r=i.stateNode),i=i.child,i!==null))for(xc(i,s,r),i=i.sibling;i!==null;)xc(i,s,r),i=i.sibling}function mv(i){var s=i.stateNode,r=i.memoizedProps;try{for(var l=i.type,u=s.attributes;u.length;)s.removeAttributeNode(u[0]);Ni(s,l,r),s[zt]=i,s[ni]=r}catch(d){ht(i,i.return,d)}}var yn=!1,Jt=!1,wd=!1,_v=typeof WeakSet=="function"?WeakSet:Set,mi=null;function SC(i,s){if(i=i.containerInfo,Fd=Wc,i=D_(i),mh(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,d=l.focusNode;l=l.focusOffset;try{r.nodeType,d.nodeType}catch{r=null;break e}var g=0,S=-1,R=-1,F=0,ne=0,ce=i,$=null;t:for(;;){for(var Z;ce!==r||u!==0&&ce.nodeType!==3||(S=g+u),ce!==d||l!==0&&ce.nodeType!==3||(R=g+l),ce.nodeType===3&&(g+=ce.nodeValue.length),(Z=ce.firstChild)!==null;)$=ce,ce=Z;for(;;){if(ce===i)break t;if($===r&&++F===u&&(S=g),$===d&&++ne===l&&(R=g),(Z=ce.nextSibling)!==null)break;ce=$,$=ce.parentNode}ce=Z}r=S===-1||R===-1?null:{start:S,end:R}}else r=null}r=r||{start:0,end:0}}else r=null;for(qd={focusedElem:i,selectionRange:r},Wc=!1,mi=s;mi!==null;)if(s=mi,i=s.child,(s.subtreeFlags&1028)!==0&&i!==null)i.return=s,mi=i;else for(;mi!==null;){switch(s=mi,d=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&&d!==null){i=void 0,r=s,u=d.memoizedProps,d=d.memoizedState,l=r.stateNode;try{var Ee=Pr(r.type,u);i=l.getSnapshotBeforeUpdate(Ee,d),l.__reactInternalSnapshotBeforeUpdate=i}catch(je){ht(r,r.return,je)}}break;case 3:if((i&1024)!==0){if(i=s.stateNode.containerInfo,r=i.nodeType,r===9)Yd(i);else if(r===1)switch(i.nodeName){case"HEAD":case"HTML":case"BODY":Yd(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,mi=i;break}mi=s.return}}function gv(i,s,r){var l=r.flags;switch(r.tag){case 0:case 11:case 15:Sn(i,r),l&4&&Nl(5,r);break;case 1:if(Sn(i,r),l&4)if(i=r.stateNode,s===null)try{i.componentDidMount()}catch(g){ht(r,r.return,g)}else{var u=Pr(r.type,s.memoizedProps);s=s.memoizedState;try{i.componentDidUpdate(u,s,i.__reactInternalSnapshotBeforeUpdate)}catch(g){ht(r,r.return,g)}}l&64&&hv(r),l&512&&Al(r,r.return);break;case 3:if(Sn(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{tg(i,s)}catch(g){ht(r,r.return,g)}}break;case 27:s===null&&l&4&&mv(r);case 26:case 5:Sn(i,r),s===null&&l&4&&fv(r),l&512&&Al(r,r.return);break;case 12:Sn(i,r);break;case 31:Sn(i,r),l&4&&bv(i,r);break;case 13:Sn(i,r),l&4&&Sv(i,r),l&64&&(i=r.memoizedState,i!==null&&(i=i.dehydrated,i!==null&&(r=MC.bind(null,r),GC(i,r))));break;case 22:if(l=r.memoizedState!==null||yn,!l){s=s!==null&&s.memoizedState!==null||Jt,u=yn;var d=Jt;yn=l,(Jt=s)&&!d?wn(i,r,(r.subtreeFlags&8772)!==0):Sn(i,r),yn=u,Jt=d}break;case 30:break;default:Sn(i,r)}}function vv(i){var s=i.alternate;s!==null&&(i.alternate=null,vv(s)),i.child=null,i.deletions=null,i.sibling=null,i.tag===5&&(s=i.stateNode,s!==null&&On(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 Rt=null,es=!1;function bn(i,s,r){for(r=r.child;r!==null;)yv(i,s,r),r=r.sibling}function yv(i,s,r){if(Kt&&typeof Kt.onCommitFiberUnmount=="function")try{Kt.onCommitFiberUnmount(ls,r)}catch{}switch(r.tag){case 26:Jt||Js(r,s),bn(i,s,r),r.memoizedState?r.memoizedState.count--:r.stateNode&&(r=r.stateNode,r.parentNode.removeChild(r));break;case 27:Jt||Js(r,s);var l=Rt,u=es;er(r.type)&&(Rt=r.stateNode,es=!1),bn(i,s,r),Kl(r.stateNode),Rt=l,es=u;break;case 5:Jt||Js(r,s);case 6:if(l=Rt,u=es,Rt=null,bn(i,s,r),Rt=l,es=u,Rt!==null)if(es)try{(Rt.nodeType===9?Rt.body:Rt.nodeName==="HTML"?Rt.ownerDocument.body:Rt).removeChild(r.stateNode)}catch(d){ht(r,s,d)}else try{Rt.removeChild(r.stateNode)}catch(d){ht(r,s,d)}break;case 18:Rt!==null&&(es?(i=Rt,hy(i.nodeType===9?i.body:i.nodeName==="HTML"?i.ownerDocument.body:i,r.stateNode),za(i)):hy(Rt,r.stateNode));break;case 4:l=Rt,u=es,Rt=r.stateNode.containerInfo,es=!0,bn(i,s,r),Rt=l,es=u;break;case 0:case 11:case 14:case 15:Yn(2,r,s),Jt||Yn(4,r,s),bn(i,s,r);break;case 1:Jt||(Js(r,s),l=r.stateNode,typeof l.componentWillUnmount=="function"&&dv(r,s,l)),bn(i,s,r);break;case 21:bn(i,s,r);break;case 22:Jt=(l=Jt)||r.memoizedState!==null,bn(i,s,r),Jt=l;break;default:bn(i,s,r)}}function bv(i,s){if(s.memoizedState===null&&(i=s.alternate,i!==null&&(i=i.memoizedState,i!==null))){i=i.dehydrated;try{za(i)}catch(r){ht(s,s.return,r)}}}function Sv(i,s){if(s.memoizedState===null&&(i=s.alternate,i!==null&&(i=i.memoizedState,i!==null&&(i=i.dehydrated,i!==null))))try{za(i)}catch(r){ht(s,s.return,r)}}function wC(i){switch(i.tag){case 31:case 13:case 19:var s=i.stateNode;return s===null&&(s=i.stateNode=new _v),s;case 22:return i=i.stateNode,s=i._retryCache,s===null&&(s=i._retryCache=new _v),s;default:throw Error(a(435,i.tag))}}function Ec(i,s){var r=wC(i);s.forEach(function(l){if(!r.has(l)){r.add(l);var u=NC.bind(null,i,l);l.then(u,u)}})}function ts(i,s){var r=s.deletions;if(r!==null)for(var l=0;l<r.length;l++){var u=r[l],d=i,g=s,S=g;e:for(;S!==null;){switch(S.tag){case 27:if(er(S.type)){Rt=S.stateNode,es=!1;break e}break;case 5:Rt=S.stateNode,es=!1;break e;case 3:case 4:Rt=S.stateNode.containerInfo,es=!0;break e}S=S.return}if(Rt===null)throw Error(a(160));yv(d,g,u),Rt=null,es=!1,d=u.alternate,d!==null&&(d.return=null),u.return=null}if(s.subtreeFlags&13886)for(s=s.child;s!==null;)wv(s,i),s=s.sibling}var Ws=null;function wv(i,s){var r=i.alternate,l=i.flags;switch(i.tag){case 0:case 11:case 14:case 15:ts(s,i),is(i),l&4&&(Yn(3,i,i.return),Nl(3,i),Yn(5,i,i.return));break;case 1:ts(s,i),is(i),l&512&&(Jt||r===null||Js(r,r.return)),l&64&&yn&&(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=Ws;if(ts(s,i),is(i),l&512&&(Jt||r===null||Js(r,r.return)),l&4){var d=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":d=u.getElementsByTagName("title")[0],(!d||d[os]||d[zt]||d.namespaceURI==="http://www.w3.org/2000/svg"||d.hasAttribute("itemprop"))&&(d=u.createElement(l),u.head.insertBefore(d,u.querySelector("head > title"))),Ni(d,l,r),d[zt]=i,Nt(d),l=d;break e;case"link":var g=wy("link","href",u).get(l+(r.href||""));if(g){for(var S=0;S<g.length;S++)if(d=g[S],d.getAttribute("href")===(r.href==null||r.href===""?null:r.href)&&d.getAttribute("rel")===(r.rel==null?null:r.rel)&&d.getAttribute("title")===(r.title==null?null:r.title)&&d.getAttribute("crossorigin")===(r.crossOrigin==null?null:r.crossOrigin)){g.splice(S,1);break t}}d=u.createElement(l),Ni(d,l,r),u.head.appendChild(d);break;case"meta":if(g=wy("meta","content",u).get(l+(r.content||""))){for(S=0;S<g.length;S++)if(d=g[S],d.getAttribute("content")===(r.content==null?null:""+r.content)&&d.getAttribute("name")===(r.name==null?null:r.name)&&d.getAttribute("property")===(r.property==null?null:r.property)&&d.getAttribute("http-equiv")===(r.httpEquiv==null?null:r.httpEquiv)&&d.getAttribute("charset")===(r.charSet==null?null:r.charSet)){g.splice(S,1);break t}}d=u.createElement(l),Ni(d,l,r),u.head.appendChild(d);break;default:throw Error(a(468,l))}d[zt]=i,Nt(d),l=d}i.stateNode=l}else Cy(u,i.type,i.stateNode);else i.stateNode=Sy(u,l,i.memoizedProps);else d!==l?(d===null?r.stateNode!==null&&(r=r.stateNode,r.parentNode.removeChild(r)):d.count--,l===null?Cy(u,i.type,i.stateNode):Sy(u,l,i.memoizedProps)):l===null&&i.stateNode!==null&&yd(i,i.memoizedProps,r.memoizedProps)}break;case 27:ts(s,i),is(i),l&512&&(Jt||r===null||Js(r,r.return)),r!==null&&l&4&&yd(i,i.memoizedProps,r.memoizedProps);break;case 5:if(ts(s,i),is(i),l&512&&(Jt||r===null||Js(r,r.return)),i.flags&32){u=i.stateNode;try{st(u,"")}catch(Ee){ht(i,i.return,Ee)}}l&4&&i.stateNode!=null&&(u=i.memoizedProps,yd(i,u,r!==null?r.memoizedProps:u)),l&1024&&(wd=!0);break;case 6:if(ts(s,i),is(i),l&4){if(i.stateNode===null)throw Error(a(162));l=i.memoizedProps,r=i.stateNode;try{r.nodeValue=l}catch(Ee){ht(i,i.return,Ee)}}break;case 3:if(Kc=null,u=Ws,Ws=Uc(s.containerInfo),ts(s,i),Ws=u,is(i),l&4&&r!==null&&r.memoizedState.isDehydrated)try{za(s.containerInfo)}catch(Ee){ht(i,i.return,Ee)}wd&&(wd=!1,Cv(i));break;case 4:l=Ws,Ws=Uc(i.stateNode.containerInfo),ts(s,i),is(i),Ws=l;break;case 12:ts(s,i),is(i);break;case 31:ts(s,i),is(i),l&4&&(l=i.updateQueue,l!==null&&(i.updateQueue=null,Ec(i,l)));break;case 13:ts(s,i),is(i),i.child.flags&8192&&i.memoizedState!==null!=(r!==null&&r.memoizedState!==null)&&(kc=Oe()),l&4&&(l=i.updateQueue,l!==null&&(i.updateQueue=null,Ec(i,l)));break;case 22:u=i.memoizedState!==null;var R=r!==null&&r.memoizedState!==null,F=yn,ne=Jt;if(yn=F||u,Jt=ne||R,ts(s,i),Jt=ne,yn=F,is(i),l&8192)e:for(s=i.stateNode,s._visibility=u?s._visibility&-2:s._visibility|1,u&&(r===null||R||yn||Jt||Kr(i)),r=null,s=i;;){if(s.tag===5||s.tag===26){if(r===null){R=r=s;try{if(d=R.stateNode,u)g=d.style,typeof g.setProperty=="function"?g.setProperty("display","none","important"):g.display="none";else{S=R.stateNode;var ce=R.memoizedProps.style,$=ce!=null&&ce.hasOwnProperty("display")?ce.display:null;S.style.display=$==null||typeof $=="boolean"?"":(""+$).trim()}}catch(Ee){ht(R,R.return,Ee)}}}else if(s.tag===6){if(r===null){R=s;try{R.stateNode.nodeValue=u?"":R.memoizedProps}catch(Ee){ht(R,R.return,Ee)}}}else if(s.tag===18){if(r===null){R=s;try{var Z=R.stateNode;u?dy(Z,!0):dy(R.stateNode,!1)}catch(Ee){ht(R,R.return,Ee)}}}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,Ec(i,r))));break;case 19:ts(s,i),is(i),l&4&&(l=i.updateQueue,l!==null&&(i.updateQueue=null,Ec(i,l)));break;case 30:break;case 21:break;default:ts(s,i),is(i)}}function is(i){var s=i.flags;if(s&2){try{for(var r,l=i.return;l!==null;){if(pv(l)){r=l;break}l=l.return}if(r==null)throw Error(a(160));switch(r.tag){case 27:var u=r.stateNode,d=bd(i);xc(i,d,u);break;case 5:var g=r.stateNode;r.flags&32&&(st(g,""),r.flags&=-33);var S=bd(i);xc(i,S,g);break;case 3:case 4:var R=r.stateNode.containerInfo,F=bd(i);Sd(i,F,R);break;default:throw Error(a(161))}}catch(ne){ht(i,i.return,ne)}i.flags&=-3}s&4096&&(i.flags&=-4097)}function Cv(i){if(i.subtreeFlags&1024)for(i=i.child;i!==null;){var s=i;Cv(s),s.tag===5&&s.flags&1024&&s.stateNode.reset(),i=i.sibling}}function Sn(i,s){if(s.subtreeFlags&8772)for(s=s.child;s!==null;)gv(i,s.alternate,s),s=s.sibling}function Kr(i){for(i=i.child;i!==null;){var s=i;switch(s.tag){case 0:case 11:case 14:case 15:Yn(4,s,s.return),Kr(s);break;case 1:Js(s,s.return);var r=s.stateNode;typeof r.componentWillUnmount=="function"&&dv(s,s.return,r),Kr(s);break;case 27:Kl(s.stateNode);case 26:case 5:Js(s,s.return),Kr(s);break;case 22:s.memoizedState===null&&Kr(s);break;case 30:Kr(s);break;default:Kr(s)}i=i.sibling}}function wn(i,s,r){for(r=r&&(s.subtreeFlags&8772)!==0,s=s.child;s!==null;){var l=s.alternate,u=i,d=s,g=d.flags;switch(d.tag){case 0:case 11:case 15:wn(u,d,r),Nl(4,d);break;case 1:if(wn(u,d,r),l=d,u=l.stateNode,typeof u.componentDidMount=="function")try{u.componentDidMount()}catch(F){ht(l,l.return,F)}if(l=d,u=l.updateQueue,u!==null){var S=l.stateNode;try{var R=u.shared.hiddenCallbacks;if(R!==null)for(u.shared.hiddenCallbacks=null,u=0;u<R.length;u++)eg(R[u],S)}catch(F){ht(l,l.return,F)}}r&&g&64&&hv(d),Al(d,d.return);break;case 27:mv(d);case 26:case 5:wn(u,d,r),r&&l===null&&g&4&&fv(d),Al(d,d.return);break;case 12:wn(u,d,r);break;case 31:wn(u,d,r),r&&g&4&&bv(u,d);break;case 13:wn(u,d,r),r&&g&4&&Sv(u,d);break;case 22:d.memoizedState===null&&wn(u,d,r),Al(d,d.return);break;case 30:break;default:wn(u,d,r)}s=s.sibling}}function Cd(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&&vl(r))}function xd(i,s){i=null,s.alternate!==null&&(i=s.alternate.memoizedState.cache),s=s.memoizedState.cache,s!==i&&(s.refCount++,i!=null&&vl(i))}function $s(i,s,r,l){if(s.subtreeFlags&10256)for(s=s.child;s!==null;)xv(i,s,r,l),s=s.sibling}function xv(i,s,r,l){var u=s.flags;switch(s.tag){case 0:case 11:case 15:$s(i,s,r,l),u&2048&&Nl(9,s);break;case 1:$s(i,s,r,l);break;case 3:$s(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&&vl(i)));break;case 12:if(u&2048){$s(i,s,r,l),i=s.stateNode;try{var d=s.memoizedProps,g=d.id,S=d.onPostCommit;typeof S=="function"&&S(g,s.alternate===null?"mount":"update",i.passiveEffectDuration,-0)}catch(R){ht(s,s.return,R)}}else $s(i,s,r,l);break;case 31:$s(i,s,r,l);break;case 13:$s(i,s,r,l);break;case 23:break;case 22:d=s.stateNode,g=s.alternate,s.memoizedState!==null?d._visibility&2?$s(i,s,r,l):Ll(i,s):d._visibility&2?$s(i,s,r,l):(d._visibility|=2,Ea(i,s,r,l,(s.subtreeFlags&10256)!==0||!1)),u&2048&&Cd(g,s);break;case 24:$s(i,s,r,l),u&2048&&xd(s.alternate,s);break;default:$s(i,s,r,l)}}function Ea(i,s,r,l,u){for(u=u&&((s.subtreeFlags&10256)!==0||!1),s=s.child;s!==null;){var d=i,g=s,S=r,R=l,F=g.flags;switch(g.tag){case 0:case 11:case 15:Ea(d,g,S,R,u),Nl(8,g);break;case 23:break;case 22:var ne=g.stateNode;g.memoizedState!==null?ne._visibility&2?Ea(d,g,S,R,u):Ll(d,g):(ne._visibility|=2,Ea(d,g,S,R,u)),u&&F&2048&&Cd(g.alternate,g);break;case 24:Ea(d,g,S,R,u),u&&F&2048&&xd(g.alternate,g);break;default:Ea(d,g,S,R,u)}s=s.sibling}}function Ll(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:Ll(r,l),u&2048&&Cd(l.alternate,l);break;case 24:Ll(r,l),u&2048&&xd(l.alternate,l);break;default:Ll(r,l)}s=s.sibling}}var Bl=8192;function Ta(i,s,r){if(i.subtreeFlags&Bl)for(i=i.child;i!==null;)Ev(i,s,r),i=i.sibling}function Ev(i,s,r){switch(i.tag){case 26:Ta(i,s,r),i.flags&Bl&&i.memoizedState!==null&&ox(r,Ws,i.memoizedState,i.memoizedProps);break;case 5:Ta(i,s,r);break;case 3:case 4:var l=Ws;Ws=Uc(i.stateNode.containerInfo),Ta(i,s,r),Ws=l;break;case 22:i.memoizedState===null&&(l=i.alternate,l!==null&&l.memoizedState!==null?(l=Bl,Bl=16777216,Ta(i,s,r),Bl=l):Ta(i,s,r));break;default:Ta(i,s,r)}}function Tv(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 Ol(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];mi=l,Dv(l,i)}Tv(i)}if(i.subtreeFlags&10256)for(i=i.child;i!==null;)kv(i),i=i.sibling}function kv(i){switch(i.tag){case 0:case 11:case 15:Ol(i),i.flags&2048&&Yn(9,i,i.return);break;case 3:Ol(i);break;case 12:Ol(i);break;case 22:var s=i.stateNode;i.memoizedState!==null&&s._visibility&2&&(i.return===null||i.return.tag!==13)?(s._visibility&=-3,Tc(i)):Ol(i);break;default:Ol(i)}}function Tc(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];mi=l,Dv(l,i)}Tv(i)}for(i=i.child;i!==null;){switch(s=i,s.tag){case 0:case 11:case 15:Yn(8,s,s.return),Tc(s);break;case 22:r=s.stateNode,r._visibility&2&&(r._visibility&=-3,Tc(s));break;default:Tc(s)}i=i.sibling}}function Dv(i,s){for(;mi!==null;){var r=mi;switch(r.tag){case 0:case 11:case 15:Yn(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:vl(r.memoizedState.cache)}if(l=r.child,l!==null)l.return=r,mi=l;else e:for(r=i;mi!==null;){l=mi;var u=l.sibling,d=l.return;if(vv(l),l===r){mi=null;break e}if(u!==null){u.return=d,mi=u;break e}mi=d}}}var CC={getCacheForType:function(i){var s=Ri(Gt),r=s.data.get(i);return r===void 0&&(r=i(),s.data.set(i,r)),r},cacheSignal:function(){return Ri(Gt).controller.signal}},xC=typeof WeakMap=="function"?WeakMap:Map,lt=0,yt=null,Ze=null,Je=0,ut=0,ms=null,Vn=!1,ka=!1,Ed=!1,Cn=0,Ht=0,Xn=0,Ir=0,Td=0,_s=0,Da=0,zl=null,ss=null,kd=!1,kc=0,Rv=0,Dc=1/0,Rc=null,Gn=null,li=0,Zn=null,Ra=null,xn=0,Dd=0,Rd=null,Mv=null,jl=0,Md=null;function gs(){return(lt&2)!==0&&Je!==0?Je&-Je:M.T!==null?zd():ki()}function Nv(){if(_s===0)if((Je&536870912)===0||tt){var i=ws;ws<<=1,(ws&3932160)===0&&(ws=262144),_s=i}else _s=536870912;return i=fs.current,i!==null&&(i.flags|=32),_s}function ns(i,s,r){(i===yt&&(ut===2||ut===9)||i.cancelPendingCommit!==null)&&(Ma(i,0),Qn(i,Je,_s,!1)),Ei(i,r),((lt&2)===0||i!==yt)&&(i===yt&&((lt&2)===0&&(Ir|=r),Ht===4&&Qn(i,Je,_s,!1)),en(i))}function Av(i,s,r){if((lt&6)!==0)throw Error(a(327));var l=!r&&(s&127)===0&&(s&i.expiredLanes)===0||ii(i,s),u=l?kC(i,s):Ad(i,s,!0),d=l;do{if(u===0){ka&&!l&&Qn(i,s,0,!1);break}else{if(r=i.current.alternate,d&&!EC(r)){u=Ad(i,s,!1),d=!1;continue}if(u===2){if(d=s,i.errorRecoveryDisabledLanes&d)var g=0;else g=i.pendingLanes&-536870913,g=g!==0?g:g&536870912?536870912:0;if(g!==0){s=g;e:{var S=i;u=zl;var R=S.current.memoizedState.isDehydrated;if(R&&(Ma(S,g).flags|=256),g=Ad(S,g,!1),g!==2){if(Ed&&!R){S.errorRecoveryDisabledLanes|=d,Ir|=d,u=4;break e}d=ss,ss=u,d!==null&&(ss===null?ss=d:ss.push.apply(ss,d))}u=g}if(d=!1,u!==2)continue}}if(u===1){Ma(i,0),Qn(i,s,0,!0);break}e:{switch(l=i,d=u,d){case 0:case 1:throw Error(a(345));case 4:if((s&4194048)!==s)break;case 6:Qn(l,s,_s,!Vn);break e;case 2:ss=null;break;case 3:case 5:break;default:throw Error(a(329))}if((s&62914560)===s&&(u=kc+300-Oe(),10<u)){if(Qn(l,s,_s,!Vn),Ot(l,0,!0)!==0)break e;xn=s,l.timeoutHandle=cy(Lv.bind(null,l,r,ss,Rc,kd,s,_s,Ir,Da,Vn,d,"Throttled",-0,0),u);break e}Lv(l,r,ss,Rc,kd,s,_s,Ir,Da,Vn,d,null,-0,0)}}break}while(!0);en(i)}function Lv(i,s,r,l,u,d,g,S,R,F,ne,ce,$,Z){if(i.timeoutHandle=-1,ce=s.subtreeFlags,ce&8192||(ce&16785408)===16785408){ce={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Fs},Ev(s,d,ce);var Ee=(d&62914560)===d?kc-Oe():(d&4194048)===d?Rv-Oe():0;if(Ee=cx(ce,Ee),Ee!==null){xn=d,i.cancelPendingCommit=Ee(Kv.bind(null,i,s,d,r,l,u,g,S,R,ne,ce,null,$,Z)),Qn(i,d,g,!F);return}}Kv(i,s,d,r,l,u,g,S,R)}function EC(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],d=u.getSnapshot;u=u.value;try{if(!hs(d(),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 Qn(i,s,r,l){s&=~Td,s&=~Ir,i.suspendedLanes|=s,i.pingedLanes&=~s,l&&(i.warmLanes|=s),l=i.expirationTimes;for(var u=s;0<u;){var d=31-Bt(u),g=1<<d;l[d]=-1,u&=~g}r!==0&&Ki(i,r,s)}function Mc(){return(lt&6)===0?(Hl(0),!1):!0}function Nd(){if(Ze!==null){if(ut===0)var i=Ze.return;else i=Ze,fn=Lr=null,Yh(i),ba=null,bl=0,i=Ze;for(;i!==null;)uv(i.alternate,i),i=i.return;Ze=null}}function Ma(i,s){var r=i.timeoutHandle;r!==-1&&(i.timeoutHandle=-1,WC(r)),r=i.cancelPendingCommit,r!==null&&(i.cancelPendingCommit=null,r()),xn=0,Nd(),yt=i,Ze=r=hn(i.current,null),Je=s,ut=0,ms=null,Vn=!1,ka=ii(i,s),Ed=!1,Da=_s=Td=Ir=Xn=Ht=0,ss=zl=null,kd=!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-Bt(l),d=1<<u;s|=i[u],l&=~d}return Cn=s,Zo(),r}function Bv(i,s){qe=null,M.H=Dl,s===ya||s===rc?(s=G_(),ut=3):s===Oh?(s=G_(),ut=4):ut=s===cd?8:s!==null&&typeof s=="object"&&typeof s.then=="function"?6:1,ms=s,Ze===null&&(Ht=1,yc(i,ks(s,i.current)))}function Ov(){var i=fs.current;return i===null?!0:(Je&4194048)===Je?Ns===null:(Je&62914560)===Je||(Je&536870912)!==0?i===Ns:!1}function zv(){var i=M.H;return M.H=Dl,i===null?Dl:i}function jv(){var i=M.A;return M.A=CC,i}function Nc(){Ht=4,Vn||(Je&4194048)!==Je&&fs.current!==null||(ka=!0),(Xn&134217727)===0&&(Ir&134217727)===0||yt===null||Qn(yt,Je,_s,!1)}function Ad(i,s,r){var l=lt;lt|=2;var u=zv(),d=jv();(yt!==i||Je!==s)&&(Rc=null,Ma(i,s)),s=!1;var g=Ht;e:do try{if(ut!==0&&Ze!==null){var S=Ze,R=ms;switch(ut){case 8:Nd(),g=6;break e;case 3:case 2:case 9:case 6:fs.current===null&&(s=!0);var F=ut;if(ut=0,ms=null,Na(i,S,R,F),r&&ka){g=0;break e}break;default:F=ut,ut=0,ms=null,Na(i,S,R,F)}}TC(),g=Ht;break}catch(ne){Bv(i,ne)}while(!0);return s&&i.shellSuspendCounter++,fn=Lr=null,lt=l,M.H=u,M.A=d,Ze===null&&(yt=null,Je=0,Zo()),g}function TC(){for(;Ze!==null;)Hv(Ze)}function kC(i,s){var r=lt;lt|=2;var l=zv(),u=jv();yt!==i||Je!==s?(Rc=null,Dc=Oe()+500,Ma(i,s)):ka=ii(i,s);e:do try{if(ut!==0&&Ze!==null){s=Ze;var d=ms;t:switch(ut){case 1:ut=0,ms=null,Na(i,s,d,1);break;case 2:case 9:if(V_(d)){ut=0,ms=null,Uv(s);break}s=function(){ut!==2&&ut!==9||yt!==i||(ut=7),en(i)},d.then(s,s);break e;case 3:ut=7;break e;case 4:ut=5;break e;case 7:V_(d)?(ut=0,ms=null,Uv(s)):(ut=0,ms=null,Na(i,s,d,7));break;case 5:var g=null;switch(Ze.tag){case 26:g=Ze.memoizedState;case 5:case 27:var S=Ze;if(g?xy(g):S.stateNode.complete){ut=0,ms=null;var R=S.sibling;if(R!==null)Ze=R;else{var F=S.return;F!==null?(Ze=F,Ac(F)):Ze=null}break t}}ut=0,ms=null,Na(i,s,d,5);break;case 6:ut=0,ms=null,Na(i,s,d,6);break;case 8:Nd(),Ht=6;break e;default:throw Error(a(462))}}DC();break}catch(ne){Bv(i,ne)}while(!0);return fn=Lr=null,M.H=l,M.A=u,lt=r,Ze!==null?0:(yt=null,Je=0,Zo(),Ht)}function DC(){for(;Ze!==null&&!Q();)Hv(Ze)}function Hv(i){var s=ov(i.alternate,i,Cn);i.memoizedProps=i.pendingProps,s===null?Ac(i):Ze=s}function Uv(i){var s=i,r=s.alternate;switch(s.tag){case 15:case 0:s=iv(r,s,s.pendingProps,s.type,void 0,Je);break;case 11:s=iv(r,s,s.pendingProps,s.type.render,s.ref,Je);break;case 5:Yh(s);default:uv(r,s),s=Ze=j_(s,Cn),s=ov(r,s,Cn)}i.memoizedProps=i.pendingProps,s===null?Ac(i):Ze=s}function Na(i,s,r,l){fn=Lr=null,Yh(s),ba=null,bl=0;var u=s.return;try{if(_C(i,u,s,r,Je)){Ht=1,yc(i,ks(r,i.current)),Ze=null;return}}catch(d){if(u!==null)throw Ze=u,d;Ht=1,yc(i,ks(r,i.current)),Ze=null;return}s.flags&32768?(tt||l===1?i=!0:ka||(Je&536870912)!==0?i=!1:(Vn=i=!0,(l===2||l===9||l===3||l===6)&&(l=fs.current,l!==null&&l.tag===13&&(l.flags|=16384))),Pv(s,i)):Ac(s)}function Ac(i){var s=i;do{if((s.flags&32768)!==0){Pv(s,Vn);return}i=s.return;var r=yC(s.alternate,s,Cn);if(r!==null){Ze=r;return}if(s=s.sibling,s!==null){Ze=s;return}Ze=s=i}while(s!==null);Ht===0&&(Ht=5)}function Pv(i,s){do{var r=bC(i.alternate,i);if(r!==null){r.flags&=32767,Ze=r;return}if(r=i.return,r!==null&&(r.flags|=32768,r.subtreeFlags=0,r.deletions=null),!s&&(i=i.sibling,i!==null)){Ze=i;return}Ze=i=r}while(i!==null);Ht=6,Ze=null}function Kv(i,s,r,l,u,d,g,S,R){i.cancelPendingCommit=null;do Lc();while(li!==0);if((lt&6)!==0)throw Error(a(327));if(s!==null){if(s===i.current)throw Error(a(177));if(d=s.lanes|s.childLanes,d|=bh,Ct(i,r,d,g,S,R),i===yt&&(Ze=yt=null,Je=0),Ra=s,Zn=i,xn=r,Dd=d,Rd=u,Mv=l,(s.subtreeFlags&10256)!==0||(s.flags&10256)!==0?(i.callbackNode=null,i.callbackPriority=0,AC(Yt,function(){return $v(),null})):(i.callbackNode=null,i.callbackPriority=0),l=(s.flags&13878)!==0,(s.subtreeFlags&13878)!==0||l){l=M.T,M.T=null,u=q.p,q.p=2,g=lt,lt|=4;try{SC(i,s,r)}finally{lt=g,q.p=u,M.T=l}}li=1,Iv(),Fv(),qv()}}function Iv(){if(li===1){li=0;var i=Zn,s=Ra,r=(s.flags&13878)!==0;if((s.subtreeFlags&13878)!==0||r){r=M.T,M.T=null;var l=q.p;q.p=2;var u=lt;lt|=4;try{wv(s,i);var d=qd,g=D_(i.containerInfo),S=d.focusedElem,R=d.selectionRange;if(g!==S&&S&&S.ownerDocument&&k_(S.ownerDocument.documentElement,S)){if(R!==null&&mh(S)){var F=R.start,ne=R.end;if(ne===void 0&&(ne=F),"selectionStart"in S)S.selectionStart=F,S.selectionEnd=Math.min(ne,S.value.length);else{var ce=S.ownerDocument||document,$=ce&&ce.defaultView||window;if($.getSelection){var Z=$.getSelection(),Ee=S.textContent.length,je=Math.min(R.start,Ee),mt=R.end===void 0?je:Math.min(R.end,Ee);!Z.extend&&je>mt&&(g=mt,mt=je,je=g);var H=T_(S,je),L=T_(S,mt);if(H&&L&&(Z.rangeCount!==1||Z.anchorNode!==H.node||Z.anchorOffset!==H.offset||Z.focusNode!==L.node||Z.focusOffset!==L.offset)){var I=ce.createRange();I.setStart(H.node,H.offset),Z.removeAllRanges(),je>mt?(Z.addRange(I),Z.extend(L.node,L.offset)):(I.setEnd(L.node,L.offset),Z.addRange(I))}}}}for(ce=[],Z=S;Z=Z.parentNode;)Z.nodeType===1&&ce.push({element:Z,left:Z.scrollLeft,top:Z.scrollTop});for(typeof S.focus=="function"&&S.focus(),S=0;S<ce.length;S++){var ae=ce[S];ae.element.scrollLeft=ae.left,ae.element.scrollTop=ae.top}}Wc=!!Fd,qd=Fd=null}finally{lt=u,q.p=l,M.T=r}}i.current=s,li=2}}function Fv(){if(li===2){li=0;var i=Zn,s=Ra,r=(s.flags&8772)!==0;if((s.subtreeFlags&8772)!==0||r){r=M.T,M.T=null;var l=q.p;q.p=2;var u=lt;lt|=4;try{gv(i,s.alternate,s)}finally{lt=u,q.p=l,M.T=r}}li=3}}function qv(){if(li===4||li===3){li=0,Fe();var i=Zn,s=Ra,r=xn,l=Mv;(s.subtreeFlags&10256)!==0||(s.flags&10256)!==0?li=5:(li=0,Ra=Zn=null,Wv(i,i.pendingLanes));var u=i.pendingLanes;if(u===0&&(Gn=null),Ii(r),s=s.stateNode,Kt&&typeof Kt.onCommitFiberRoot=="function")try{Kt.onCommitFiberRoot(ls,s,void 0,(s.current.flags&128)===128)}catch{}if(l!==null){s=M.T,u=q.p,q.p=2,M.T=null;try{for(var d=i.onRecoverableError,g=0;g<l.length;g++){var S=l[g];d(S.value,{componentStack:S.stack})}}finally{M.T=s,q.p=u}}(xn&3)!==0&&Lc(),en(i),u=i.pendingLanes,(r&261930)!==0&&(u&42)!==0?i===Md?jl++:(jl=0,Md=i):jl=0,Hl(0)}}function Wv(i,s){(i.pooledCacheLanes&=s)===0&&(s=i.pooledCache,s!=null&&(i.pooledCache=null,vl(s)))}function Lc(){return Iv(),Fv(),qv(),$v()}function $v(){if(li!==5)return!1;var i=Zn,s=Dd;Dd=0;var r=Ii(xn),l=M.T,u=q.p;try{q.p=32>r?32:r,M.T=null,r=Rd,Rd=null;var d=Zn,g=xn;if(li=0,Ra=Zn=null,xn=0,(lt&6)!==0)throw Error(a(331));var S=lt;if(lt|=4,kv(d.current),xv(d,d.current,g,r),lt=S,Hl(0,!1),Kt&&typeof Kt.onPostCommitFiberRoot=="function")try{Kt.onPostCommitFiberRoot(ls,d)}catch{}return!0}finally{q.p=u,M.T=l,Wv(i,s)}}function Yv(i,s,r){s=ks(r,s),s=od(i.stateNode,s,2),i=qn(i,s,2),i!==null&&(Ei(i,2),en(i))}function ht(i,s,r){if(i.tag===3)Yv(i,i,r);else for(;s!==null;){if(s.tag===3){Yv(s,i,r);break}else if(s.tag===1){var l=s.stateNode;if(typeof s.type.getDerivedStateFromError=="function"||typeof l.componentDidCatch=="function"&&(Gn===null||!Gn.has(l))){i=ks(r,i),r=Vg(2),l=qn(s,r,2),l!==null&&(Xg(r,l,s,i),Ei(l,2),en(l));break}}s=s.return}}function Ld(i,s,r){var l=i.pingCache;if(l===null){l=i.pingCache=new xC;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)||(Ed=!0,u.add(r),i=RC.bind(null,i,s,r),s.then(i,i))}function RC(i,s,r){var l=i.pingCache;l!==null&&l.delete(s),i.pingedLanes|=i.suspendedLanes&r,i.warmLanes&=~r,yt===i&&(Je&r)===r&&(Ht===4||Ht===3&&(Je&62914560)===Je&&300>Oe()-kc?(lt&2)===0&&Ma(i,0):Td|=r,Da===Je&&(Da=0)),en(i)}function Vv(i,s){s===0&&(s=Vt()),i=Mr(i,s),i!==null&&(Ei(i,s),en(i))}function MC(i){var s=i.memoizedState,r=0;s!==null&&(r=s.retryLane),Vv(i,r)}function NC(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),Vv(i,r)}function AC(i,s){return dt(i,s)}var Bc=null,Aa=null,Bd=!1,Oc=!1,Od=!1,Jn=0;function en(i){i!==Aa&&i.next===null&&(Aa===null?Bc=Aa=i:Aa=Aa.next=i),Oc=!0,Bd||(Bd=!0,BC())}function Hl(i,s){if(!Od&&Oc){Od=!0;do for(var r=!1,l=Bc;l!==null;){if(i!==0){var u=l.pendingLanes;if(u===0)var d=0;else{var g=l.suspendedLanes,S=l.pingedLanes;d=(1<<31-Bt(42|i)+1)-1,d&=u&~(g&~S),d=d&201326741?d&201326741|1:d?d|2:0}d!==0&&(r=!0,Qv(l,d))}else d=Je,d=Ot(l,l===yt?d:0,l.cancelPendingCommit!==null||l.timeoutHandle!==-1),(d&3)===0||ii(l,d)||(r=!0,Qv(l,d));l=l.next}while(r);Od=!1}}function LC(){Xv()}function Xv(){Oc=Bd=!1;var i=0;Jn!==0&&qC()&&(i=Jn);for(var s=Oe(),r=null,l=Bc;l!==null;){var u=l.next,d=Gv(l,s);d===0?(l.next=null,r===null?Bc=u:r.next=u,u===null&&(Aa=r)):(r=l,(i!==0||(d&3)!==0)&&(Oc=!0)),l=u}li!==0&&li!==5||Hl(i),Jn!==0&&(Jn=0)}function Gv(i,s){for(var r=i.suspendedLanes,l=i.pingedLanes,u=i.expirationTimes,d=i.pendingLanes&-62914561;0<d;){var g=31-Bt(d),S=1<<g,R=u[g];R===-1?((S&r)===0||(S&l)!==0)&&(u[g]=Dt(S,s)):R<=s&&(i.expiredLanes|=S),d&=~S}if(s=yt,r=Je,r=Ot(i,i===s?r:0,i.cancelPendingCommit!==null||i.timeoutHandle!==-1),l=i.callbackNode,r===0||i===s&&(ut===2||ut===9)||i.cancelPendingCommit!==null)return l!==null&&l!==null&&wi(l),i.callbackNode=null,i.callbackPriority=0;if((r&3)===0||ii(i,r)){if(s=r&-r,s===i.callbackPriority)return s;switch(l!==null&&wi(l),Ii(r)){case 2:case 8:r=Li;break;case 32:r=Yt;break;case 268435456:r=Bi;break;default:r=Yt}return l=Zv.bind(null,i),r=dt(r,l),i.callbackPriority=s,i.callbackNode=r,s}return l!==null&&l!==null&&wi(l),i.callbackPriority=2,i.callbackNode=null,2}function Zv(i,s){if(li!==0&&li!==5)return i.callbackNode=null,i.callbackPriority=0,null;var r=i.callbackNode;if(Lc()&&i.callbackNode!==r)return null;var l=Je;return l=Ot(i,i===yt?l:0,i.cancelPendingCommit!==null||i.timeoutHandle!==-1),l===0?null:(Av(i,l,s),Gv(i,Oe()),i.callbackNode!=null&&i.callbackNode===r?Zv.bind(null,i):null)}function Qv(i,s){if(Lc())return null;Av(i,s,!0)}function BC(){$C(function(){(lt&6)!==0?dt(Ui,LC):Xv()})}function zd(){if(Jn===0){var i=ga;i===0&&(i=Ss,Ss<<=1,(Ss&261888)===0&&(Ss=256)),Jn=i}return Jn}function Jv(i){return i==null||typeof i=="symbol"||typeof i=="boolean"?null:typeof i=="function"?i:Tr(""+i)}function ey(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 OC(i,s,r,l,u){if(s==="submit"&&r&&r.stateNode===u){var d=Jv((u[ni]||null).action),g=l.submitter;g&&(s=(s=g[ni]||null)?Jv(s.formAction):g.getAttribute("formAction"),s!==null&&(d=s,g=null));var S=new Yo("action","action",null,l,u);i.push({event:S,listeners:[{instance:null,listener:function(){if(l.defaultPrevented){if(Jn!==0){var R=g?ey(u,g):new FormData(u);id(r,{pending:!0,data:R,method:u.method,action:d},null,R)}}else typeof d=="function"&&(S.preventDefault(),R=g?ey(u,g):new FormData(u),id(r,{pending:!0,data:R,method:u.method,action:d},d,R))},currentTarget:u}]})}}for(var jd=0;jd<yh.length;jd++){var Hd=yh[jd],zC=Hd.toLowerCase(),jC=Hd[0].toUpperCase()+Hd.slice(1);qs(zC,"on"+jC)}qs(N_,"onAnimationEnd"),qs(A_,"onAnimationIteration"),qs(L_,"onAnimationStart"),qs("dblclick","onDoubleClick"),qs("focusin","onFocus"),qs("focusout","onBlur"),qs(J1,"onTransitionRun"),qs(eC,"onTransitionStart"),qs(tC,"onTransitionCancel"),qs(B_,"onTransitionEnd"),xs("onMouseEnter",["mouseout","mouseover"]),xs("onMouseLeave",["mouseout","mouseover"]),xs("onPointerEnter",["pointerout","pointerover"]),xs("onPointerLeave",["pointerout","pointerover"]),cs("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),cs("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),cs("onBeforeInput",["compositionend","keypress","textInput","paste"]),cs("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),cs("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),cs("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Ul="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(" "),HC=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Ul));function ty(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 d=void 0;if(s)for(var g=l.length-1;0<=g;g--){var S=l[g],R=S.instance,F=S.currentTarget;if(S=S.listener,R!==d&&u.isPropagationStopped())break e;d=S,u.currentTarget=F;try{d(u)}catch(ne){Go(ne)}u.currentTarget=null,d=R}else for(g=0;g<l.length;g++){if(S=l[g],R=S.instance,F=S.currentTarget,S=S.listener,R!==d&&u.isPropagationStopped())break e;d=S,u.currentTarget=F;try{d(u)}catch(ne){Go(ne)}u.currentTarget=null,d=R}}}}function Qe(i,s){var r=s[Xt];r===void 0&&(r=s[Xt]=new Set);var l=i+"__bubble";r.has(l)||(iy(s,i,2,!1),r.add(l))}function Ud(i,s,r){var l=0;s&&(l|=4),iy(r,i,l,s)}var zc="_reactListening"+Math.random().toString(36).slice(2);function Pd(i){if(!i[zc]){i[zc]=!0,ra.forEach(function(r){r!=="selectionchange"&&(HC.has(r)||Ud(r,!1,i),Ud(r,!0,i))});var s=i.nodeType===9?i:i.ownerDocument;s===null||s[zc]||(s[zc]=!0,Ud("selectionchange",!1,s))}}function iy(i,s,r,l){switch(Ny(s)){case 2:var u=dx;break;case 8:u=fx;break;default:u=tf}r=u.bind(null,s,r,i),u=void 0,!ah||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 Kd(i,s,r,l,u){var d=l;if((s&1)===0&&(s&2)===0&&l!==null)e:for(;;){if(l===null)return;var g=l.tag;if(g===3||g===4){var S=l.stateNode.containerInfo;if(S===u)break;if(g===4)for(g=l.return;g!==null;){var R=g.tag;if((R===3||R===4)&&g.stateNode.containerInfo===u)return;g=g.return}for(;S!==null;){if(g=fi(S),g===null)return;if(R=g.tag,R===5||R===6||R===26||R===27){l=d=g;continue e}S=S.parentNode}}l=l.return}l_(function(){var F=d,ne=aa(r),ce=[];e:{var $=O_.get(i);if($!==void 0){var Z=Yo,Ee=i;switch(i){case"keypress":if(Wo(r)===0)break e;case"keydown":case"keyup":Z=N1;break;case"focusin":Ee="focus",Z=uh;break;case"focusout":Ee="blur",Z=uh;break;case"beforeblur":case"afterblur":Z=uh;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=u_;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":Z=y1;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":Z=B1;break;case N_:case A_:case L_:Z=w1;break;case B_:Z=z1;break;case"scroll":case"scrollend":Z=g1;break;case"wheel":Z=H1;break;case"copy":case"cut":case"paste":Z=x1;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":Z=d_;break;case"toggle":case"beforetoggle":Z=P1}var je=(s&4)!==0,mt=!je&&(i==="scroll"||i==="scrollend"),H=je?$!==null?$+"Capture":null:$;je=[];for(var L=F,I;L!==null;){var ae=L;if(I=ae.stateNode,ae=ae.tag,ae!==5&&ae!==26&&ae!==27||I===null||H===null||(ae=ll(L,H),ae!=null&&je.push(Pl(L,ae,I))),mt)break;L=L.return}0<je.length&&($=new Z($,Ee,null,r,ne),ce.push({event:$,listeners:je}))}}if((s&7)===0){e:{if($=i==="mouseover"||i==="pointerover",Z=i==="mouseout"||i==="pointerout",$&&r!==Es&&(Ee=r.relatedTarget||r.fromElement)&&(fi(Ee)||Ee[Zi]))break e;if((Z||$)&&($=ne.window===ne?ne:($=ne.ownerDocument)?$.defaultView||$.parentWindow:window,Z?(Ee=r.relatedTarget||r.toElement,Z=F,Ee=Ee?fi(Ee):null,Ee!==null&&(mt=c(Ee),je=Ee.tag,Ee!==mt||je!==5&&je!==27&&je!==6)&&(Ee=null)):(Z=null,Ee=F),Z!==Ee)){if(je=u_,ae="onMouseLeave",H="onMouseEnter",L="mouse",(i==="pointerout"||i==="pointerover")&&(je=d_,ae="onPointerLeave",H="onPointerEnter",L="pointer"),mt=Z==null?$:Cs(Z),I=Ee==null?$:Cs(Ee),$=new je(ae,L+"leave",Z,r,ne),$.target=mt,$.relatedTarget=I,ae=null,fi(ne)===F&&(je=new je(H,L+"enter",Ee,r,ne),je.target=I,je.relatedTarget=mt,ae=je),mt=ae,Z&&Ee)t:{for(je=UC,H=Z,L=Ee,I=0,ae=H;ae;ae=je(ae))I++;ae=0;for(var Be=L;Be;Be=je(Be))ae++;for(;0<I-ae;)H=je(H),I--;for(;0<ae-I;)L=je(L),ae--;for(;I--;){if(H===L||L!==null&&H===L.alternate){je=H;break t}H=je(H),L=je(L)}je=null}else je=null;Z!==null&&sy(ce,$,Z,je,!1),Ee!==null&&mt!==null&&sy(ce,mt,Ee,je,!0)}}e:{if($=F?Cs(F):window,Z=$.nodeName&&$.nodeName.toLowerCase(),Z==="select"||Z==="input"&&$.type==="file")var rt=b_;else if(v_($))if(S_)rt=G1;else{rt=V1;var Re=Y1}else Z=$.nodeName,!Z||Z.toLowerCase()!=="input"||$.type!=="checkbox"&&$.type!=="radio"?F&&Is(F.elementType)&&(rt=b_):rt=X1;if(rt&&(rt=rt(i,F))){y_(ce,rt,r,ne);break e}Re&&Re(i,$,F),i==="focusout"&&F&&$.type==="number"&&F.memoizedProps.value!=null&&oe($,"number",$.value)}switch(Re=F?Cs(F):window,i){case"focusin":(v_(Re)||Re.contentEditable==="true")&&(ca=Re,_h=F,ml=null);break;case"focusout":ml=_h=ca=null;break;case"mousedown":gh=!0;break;case"contextmenu":case"mouseup":case"dragend":gh=!1,R_(ce,r,ne);break;case"selectionchange":if(Q1)break;case"keydown":case"keyup":R_(ce,r,ne)}var We;if(dh)e:{switch(i){case"compositionstart":var et="onCompositionStart";break e;case"compositionend":et="onCompositionEnd";break e;case"compositionupdate":et="onCompositionUpdate";break e}et=void 0}else oa?__(i,r)&&(et="onCompositionEnd"):i==="keydown"&&r.keyCode===229&&(et="onCompositionStart");et&&(f_&&r.locale!=="ko"&&(oa||et!=="onCompositionStart"?et==="onCompositionEnd"&&oa&&(We=o_()):(jn=ne,lh="value"in jn?jn.value:jn.textContent,oa=!0)),Re=jc(F,et),0<Re.length&&(et=new h_(et,i,null,r,ne),ce.push({event:et,listeners:Re}),We?et.data=We:(We=g_(r),We!==null&&(et.data=We)))),(We=I1?F1(i,r):q1(i,r))&&(et=jc(F,"onBeforeInput"),0<et.length&&(Re=new h_("onBeforeInput","beforeinput",null,r,ne),ce.push({event:Re,listeners:et}),Re.data=We)),OC(ce,i,F,r,ne)}ty(ce,s)})}function Pl(i,s,r){return{instance:i,listener:s,currentTarget:r}}function jc(i,s){for(var r=s+"Capture",l=[];i!==null;){var u=i,d=u.stateNode;if(u=u.tag,u!==5&&u!==26&&u!==27||d===null||(u=ll(i,r),u!=null&&l.unshift(Pl(i,u,d)),u=ll(i,s),u!=null&&l.push(Pl(i,u,d))),i.tag===3)return l;i=i.return}return[]}function UC(i){if(i===null)return null;do i=i.return;while(i&&i.tag!==5&&i.tag!==27);return i||null}function sy(i,s,r,l,u){for(var d=s._reactName,g=[];r!==null&&r!==l;){var S=r,R=S.alternate,F=S.stateNode;if(S=S.tag,R!==null&&R===l)break;S!==5&&S!==26&&S!==27||F===null||(R=F,u?(F=ll(r,d),F!=null&&g.unshift(Pl(r,F,R))):u||(F=ll(r,d),F!=null&&g.push(Pl(r,F,R)))),r=r.return}g.length!==0&&i.push({event:s,listeners:g})}var PC=/\r\n?/g,KC=/\u0000|\uFFFD/g;function ny(i){return(typeof i=="string"?i:""+i).replace(PC,`
|
|
10
|
+
`).replace(KC,"")}function ry(i,s){return s=ny(s),ny(i)===s}function pt(i,s,r,l,u,d){switch(r){case"children":typeof l=="string"?s==="body"||s==="textarea"&&l===""||st(i,l):(typeof l=="number"||typeof l=="bigint")&&s!=="body"&&st(i,""+l);break;case"className":Ks(i,"class",l);break;case"tabIndex":Ks(i,"tabindex",l);break;case"dir":case"role":case"viewBox":case"width":case"height":Ks(i,r,l);break;case"style":Qi(i,l,d);break;case"data":if(s!=="object"){Ks(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=Tr(""+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 d=="function"&&(r==="formAction"?(s!=="input"&&pt(i,s,"name",u.name,u,null),pt(i,s,"formEncType",u.formEncType,u,null),pt(i,s,"formMethod",u.formMethod,u,null),pt(i,s,"formTarget",u.formTarget,u,null)):(pt(i,s,"encType",u.encType,u,null),pt(i,s,"method",u.method,u,null),pt(i,s,"target",u.target,u,null)));if(l==null||typeof l=="symbol"||typeof l=="boolean"){i.removeAttribute(r);break}l=Tr(""+l),i.setAttribute(r,l);break;case"onClick":l!=null&&(i.onclick=Fs);break;case"onScroll":l!=null&&Qe("scroll",i);break;case"onScrollEnd":l!=null&&Qe("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=Tr(""+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":Qe("beforetoggle",i),Qe("toggle",i),Oi(i,"popover",l);break;case"xlinkActuate":k(i,"http://www.w3.org/1999/xlink","xlink:actuate",l);break;case"xlinkArcrole":k(i,"http://www.w3.org/1999/xlink","xlink:arcrole",l);break;case"xlinkRole":k(i,"http://www.w3.org/1999/xlink","xlink:role",l);break;case"xlinkShow":k(i,"http://www.w3.org/1999/xlink","xlink:show",l);break;case"xlinkTitle":k(i,"http://www.w3.org/1999/xlink","xlink:title",l);break;case"xlinkType":k(i,"http://www.w3.org/1999/xlink","xlink:type",l);break;case"xmlBase":k(i,"http://www.w3.org/XML/1998/namespace","xml:base",l);break;case"xmlLang":k(i,"http://www.w3.org/XML/1998/namespace","xml:lang",l);break;case"xmlSpace":k(i,"http://www.w3.org/XML/1998/namespace","xml:space",l);break;case"is":Oi(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=Er.get(r)||r,Oi(i,r,l))}}function Id(i,s,r,l,u,d){switch(r){case"style":Qi(i,l,d);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"?st(i,l):(typeof l=="number"||typeof l=="bigint")&&st(i,""+l);break;case"onScroll":l!=null&&Qe("scroll",i);break;case"onScrollEnd":l!=null&&Qe("scrollend",i);break;case"onClick":l!=null&&(i.onclick=Fs);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!wr.hasOwnProperty(r))e:{if(r[0]==="o"&&r[1]==="n"&&(u=r.endsWith("Capture"),s=r.slice(2,u?r.length-7:void 0),d=i[ni]||null,d=d!=null?d[r]:null,typeof d=="function"&&i.removeEventListener(s,d,u),typeof l=="function")){typeof d!="function"&&d!==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,""):Oi(i,r,l)}}}function Ni(i,s,r){switch(s){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Qe("error",i),Qe("load",i);var l=!1,u=!1,d;for(d in r)if(r.hasOwnProperty(d)){var g=r[d];if(g!=null)switch(d){case"src":l=!0;break;case"srcSet":u=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(a(137,s));default:pt(i,s,d,g,r,null)}}u&&pt(i,s,"srcSet",r.srcSet,r,null),l&&pt(i,s,"src",r.src,r,null);return;case"input":Qe("invalid",i);var S=d=g=u=null,R=null,F=null;for(l in r)if(r.hasOwnProperty(l)){var ne=r[l];if(ne!=null)switch(l){case"name":u=ne;break;case"type":g=ne;break;case"checked":R=ne;break;case"defaultChecked":F=ne;break;case"value":d=ne;break;case"defaultValue":S=ne;break;case"children":case"dangerouslySetInnerHTML":if(ne!=null)throw Error(a(137,s));break;default:pt(i,s,l,ne,r,null)}}A(i,d,S,R,F,g,u,!1);return;case"select":Qe("invalid",i),l=g=d=null;for(u in r)if(r.hasOwnProperty(u)&&(S=r[u],S!=null))switch(u){case"value":d=S;break;case"defaultValue":g=S;break;case"multiple":l=S;default:pt(i,s,u,S,r,null)}s=d,r=g,i.multiple=!!l,s!=null?Le(i,!!l,s,!1):r!=null&&Le(i,!!l,r,!0);return;case"textarea":Qe("invalid",i),d=u=l=null;for(g in r)if(r.hasOwnProperty(g)&&(S=r[g],S!=null))switch(g){case"value":l=S;break;case"defaultValue":u=S;break;case"children":d=S;break;case"dangerouslySetInnerHTML":if(S!=null)throw Error(a(91));break;default:pt(i,s,g,S,r,null)}Ye(i,l,u,d);return;case"option":for(R in r)r.hasOwnProperty(R)&&(l=r[R],l!=null)&&(R==="selected"?i.selected=l&&typeof l!="function"&&typeof l!="symbol":pt(i,s,R,l,r,null));return;case"dialog":Qe("beforetoggle",i),Qe("toggle",i),Qe("cancel",i),Qe("close",i);break;case"iframe":case"object":Qe("load",i);break;case"video":case"audio":for(l=0;l<Ul.length;l++)Qe(Ul[l],i);break;case"image":Qe("error",i),Qe("load",i);break;case"details":Qe("toggle",i);break;case"embed":case"source":case"link":Qe("error",i),Qe("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(F in r)if(r.hasOwnProperty(F)&&(l=r[F],l!=null))switch(F){case"children":case"dangerouslySetInnerHTML":throw Error(a(137,s));default:pt(i,s,F,l,r,null)}return;default:if(Is(s)){for(ne in r)r.hasOwnProperty(ne)&&(l=r[ne],l!==void 0&&Id(i,s,ne,l,r,void 0));return}}for(S in r)r.hasOwnProperty(S)&&(l=r[S],l!=null&&pt(i,s,S,l,r,null))}function IC(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,d=null,g=null,S=null,R=null,F=null,ne=null;for(Z in r){var ce=r[Z];if(r.hasOwnProperty(Z)&&ce!=null)switch(Z){case"checked":break;case"value":break;case"defaultValue":R=ce;default:l.hasOwnProperty(Z)||pt(i,s,Z,null,l,ce)}}for(var $ in l){var Z=l[$];if(ce=r[$],l.hasOwnProperty($)&&(Z!=null||ce!=null))switch($){case"type":d=Z;break;case"name":u=Z;break;case"checked":F=Z;break;case"defaultChecked":ne=Z;break;case"value":g=Z;break;case"defaultValue":S=Z;break;case"children":case"dangerouslySetInnerHTML":if(Z!=null)throw Error(a(137,s));break;default:Z!==ce&&pt(i,s,$,Z,l,ce)}}qi(i,g,S,R,F,ne,d,u);return;case"select":Z=g=S=$=null;for(d in r)if(R=r[d],r.hasOwnProperty(d)&&R!=null)switch(d){case"value":break;case"multiple":Z=R;default:l.hasOwnProperty(d)||pt(i,s,d,null,l,R)}for(u in l)if(d=l[u],R=r[u],l.hasOwnProperty(u)&&(d!=null||R!=null))switch(u){case"value":$=d;break;case"defaultValue":S=d;break;case"multiple":g=d;default:d!==R&&pt(i,s,u,d,l,R)}s=S,r=g,l=Z,$!=null?Le(i,!!r,$,!1):!!l!=!!r&&(s!=null?Le(i,!!r,s,!0):Le(i,!!r,r?[]:"",!1));return;case"textarea":Z=$=null;for(S in r)if(u=r[S],r.hasOwnProperty(S)&&u!=null&&!l.hasOwnProperty(S))switch(S){case"value":break;case"children":break;default:pt(i,s,S,null,l,u)}for(g in l)if(u=l[g],d=r[g],l.hasOwnProperty(g)&&(u!=null||d!=null))switch(g){case"value":$=u;break;case"defaultValue":Z=u;break;case"children":break;case"dangerouslySetInnerHTML":if(u!=null)throw Error(a(91));break;default:u!==d&&pt(i,s,g,u,l,d)}ze(i,$,Z);return;case"option":for(var Ee in r)$=r[Ee],r.hasOwnProperty(Ee)&&$!=null&&!l.hasOwnProperty(Ee)&&(Ee==="selected"?i.selected=!1:pt(i,s,Ee,null,l,$));for(R in l)$=l[R],Z=r[R],l.hasOwnProperty(R)&&$!==Z&&($!=null||Z!=null)&&(R==="selected"?i.selected=$&&typeof $!="function"&&typeof $!="symbol":pt(i,s,R,$,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 je in r)$=r[je],r.hasOwnProperty(je)&&$!=null&&!l.hasOwnProperty(je)&&pt(i,s,je,null,l,$);for(F in l)if($=l[F],Z=r[F],l.hasOwnProperty(F)&&$!==Z&&($!=null||Z!=null))switch(F){case"children":case"dangerouslySetInnerHTML":if($!=null)throw Error(a(137,s));break;default:pt(i,s,F,$,l,Z)}return;default:if(Is(s)){for(var mt in r)$=r[mt],r.hasOwnProperty(mt)&&$!==void 0&&!l.hasOwnProperty(mt)&&Id(i,s,mt,void 0,l,$);for(ne in l)$=l[ne],Z=r[ne],!l.hasOwnProperty(ne)||$===Z||$===void 0&&Z===void 0||Id(i,s,ne,$,l,Z);return}}for(var H in r)$=r[H],r.hasOwnProperty(H)&&$!=null&&!l.hasOwnProperty(H)&&pt(i,s,H,null,l,$);for(ce in l)$=l[ce],Z=r[ce],!l.hasOwnProperty(ce)||$===Z||$==null&&Z==null||pt(i,s,ce,$,l,Z)}function ay(i){switch(i){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function FC(){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],d=u.transferSize,g=u.initiatorType,S=u.duration;if(d&&S&&ay(g)){for(g=0,S=u.responseEnd,l+=1;l<r.length;l++){var R=r[l],F=R.startTime;if(F>S)break;var ne=R.transferSize,ce=R.initiatorType;ne&&ay(ce)&&(R=R.responseEnd,g+=ne*(R<S?1:(S-F)/(R-F)))}if(--l,s+=8*(d+g)/(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 Fd=null,qd=null;function Hc(i){return i.nodeType===9?i:i.ownerDocument}function ly(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 oy(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 Wd(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 $d=null;function qC(){var i=window.event;return i&&i.type==="popstate"?i===$d?!1:($d=i,!0):($d=null,!1)}var cy=typeof setTimeout=="function"?setTimeout:void 0,WC=typeof clearTimeout=="function"?clearTimeout:void 0,uy=typeof Promise=="function"?Promise:void 0,$C=typeof queueMicrotask=="function"?queueMicrotask:typeof uy<"u"?function(i){return uy.resolve(null).then(i).catch(YC)}:cy;function YC(i){setTimeout(function(){throw i})}function er(i){return i==="head"}function hy(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),za(s);return}l--}else if(r==="$"||r==="$?"||r==="$~"||r==="$!"||r==="&")l++;else if(r==="html")Kl(i.ownerDocument.documentElement);else if(r==="head"){r=i.ownerDocument.head,Kl(r);for(var d=r.firstChild;d;){var g=d.nextSibling,S=d.nodeName;d[os]||S==="SCRIPT"||S==="STYLE"||S==="LINK"&&d.rel.toLowerCase()==="stylesheet"||r.removeChild(d),d=g}}else r==="body"&&Kl(i.ownerDocument.body);r=u}while(r);za(s)}function dy(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 Yd(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":Yd(r),On(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[os])switch(s){case"meta":if(!i.hasAttribute("itemprop"))break;return i;case"link":if(d=i.getAttribute("rel"),d==="stylesheet"&&i.hasAttribute("data-precedence"))break;if(d!==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(d=i.getAttribute("src"),(d!==(u.src==null?null:u.src)||i.getAttribute("type")!==(u.type==null?null:u.type)||i.getAttribute("crossorigin")!==(u.crossOrigin==null?null:u.crossOrigin))&&d&&i.hasAttribute("async")&&!i.hasAttribute("itemprop"))break;return i;default:return i}}else if(s==="input"&&i.type==="hidden"){var d=u.name==null?null:""+u.name;if(u.type==="hidden"&&i.getAttribute("name")===d)return i}else return i;if(i=As(i.nextSibling),i===null)break}return null}function XC(i,s,r){if(s==="")return null;for(;i.nodeType!==3;)if((i.nodeType!==1||i.nodeName!=="INPUT"||i.type!=="hidden")&&!r||(i=As(i.nextSibling),i===null))return null;return i}function fy(i,s){for(;i.nodeType!==8;)if((i.nodeType!==1||i.nodeName!=="INPUT"||i.type!=="hidden")&&!s||(i=As(i.nextSibling),i===null))return null;return i}function Vd(i){return i.data==="$?"||i.data==="$~"}function Xd(i){return i.data==="$!"||i.data==="$?"&&i.ownerDocument.readyState!=="loading"}function GC(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 As(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 Gd=null;function py(i){i=i.nextSibling;for(var s=0;i;){if(i.nodeType===8){var r=i.data;if(r==="/$"||r==="/&"){if(s===0)return As(i.nextSibling);s--}else r!=="$"&&r!=="$!"&&r!=="$?"&&r!=="$~"&&r!=="&"||s++}i=i.nextSibling}return null}function my(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 _y(i,s,r){switch(s=Hc(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 Kl(i){for(var s=i.attributes;s.length;)i.removeAttributeNode(s[0]);On(i)}var Ls=new Map,gy=new Set;function Uc(i){return typeof i.getRootNode=="function"?i.getRootNode():i.nodeType===9?i:i.ownerDocument}var En=q.d;q.d={f:ZC,r:QC,D:JC,C:ex,L:tx,m:ix,X:nx,S:sx,M:rx};function ZC(){var i=En.f(),s=Mc();return i||s}function QC(i){var s=ri(i);s!==null&&s.tag===5&&s.type==="form"?Bg(s):En.r(i)}var La=typeof document>"u"?null:document;function vy(i,s,r){var l=La;if(l&&typeof s=="string"&&s){var u=ct(s);u='link[rel="'+i+'"][href="'+u+'"]',typeof r=="string"&&(u+='[crossorigin="'+r+'"]'),gy.has(u)||(gy.add(u),i={rel:i,crossOrigin:r,href:s},l.querySelector(u)===null&&(s=l.createElement("link"),Ni(s,"link",i),Nt(s),l.head.appendChild(s)))}}function JC(i){En.D(i),vy("dns-prefetch",i,null)}function ex(i,s){En.C(i,s),vy("preconnect",i,s)}function tx(i,s,r){En.L(i,s,r);var l=La;if(l&&i&&s){var u='link[rel="preload"][as="'+ct(s)+'"]';s==="image"&&r&&r.imageSrcSet?(u+='[imagesrcset="'+ct(r.imageSrcSet)+'"]',typeof r.imageSizes=="string"&&(u+='[imagesizes="'+ct(r.imageSizes)+'"]')):u+='[href="'+ct(i)+'"]';var d=u;switch(s){case"style":d=Ba(i);break;case"script":d=Oa(i)}Ls.has(d)||(i=y({rel:"preload",href:s==="image"&&r&&r.imageSrcSet?void 0:i,as:s},r),Ls.set(d,i),l.querySelector(u)!==null||s==="style"&&l.querySelector(Il(d))||s==="script"&&l.querySelector(Fl(d))||(s=l.createElement("link"),Ni(s,"link",i),Nt(s),l.head.appendChild(s)))}}function ix(i,s){En.m(i,s);var r=La;if(r&&i){var l=s&&typeof s.as=="string"?s.as:"script",u='link[rel="modulepreload"][as="'+ct(l)+'"][href="'+ct(i)+'"]',d=u;switch(l){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":d=Oa(i)}if(!Ls.has(d)&&(i=y({rel:"modulepreload",href:i},s),Ls.set(d,i),r.querySelector(u)===null)){switch(l){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(r.querySelector(Fl(d)))return}l=r.createElement("link"),Ni(l,"link",i),Nt(l),r.head.appendChild(l)}}}function sx(i,s,r){En.S(i,s,r);var l=La;if(l&&i){var u=Gs(l).hoistableStyles,d=Ba(i);s=s||"default";var g=u.get(d);if(!g){var S={loading:0,preload:null};if(g=l.querySelector(Il(d)))S.loading=5;else{i=y({rel:"stylesheet",href:i,"data-precedence":s},r),(r=Ls.get(d))&&Zd(i,r);var R=g=l.createElement("link");Nt(R),Ni(R,"link",i),R._p=new Promise(function(F,ne){R.onload=F,R.onerror=ne}),R.addEventListener("load",function(){S.loading|=1}),R.addEventListener("error",function(){S.loading|=2}),S.loading|=4,Pc(g,s,l)}g={type:"stylesheet",instance:g,count:1,state:S},u.set(d,g)}}}function nx(i,s){En.X(i,s);var r=La;if(r&&i){var l=Gs(r).hoistableScripts,u=Oa(i),d=l.get(u);d||(d=r.querySelector(Fl(u)),d||(i=y({src:i,async:!0},s),(s=Ls.get(u))&&Qd(i,s),d=r.createElement("script"),Nt(d),Ni(d,"link",i),r.head.appendChild(d)),d={type:"script",instance:d,count:1,state:null},l.set(u,d))}}function rx(i,s){En.M(i,s);var r=La;if(r&&i){var l=Gs(r).hoistableScripts,u=Oa(i),d=l.get(u);d||(d=r.querySelector(Fl(u)),d||(i=y({src:i,async:!0,type:"module"},s),(s=Ls.get(u))&&Qd(i,s),d=r.createElement("script"),Nt(d),Ni(d,"link",i),r.head.appendChild(d)),d={type:"script",instance:d,count:1,state:null},l.set(u,d))}}function yy(i,s,r,l){var u=(u=pe.current)?Uc(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=Gs(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 d=Gs(u).hoistableStyles,g=d.get(i);if(g||(u=u.ownerDocument||u,g={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},d.set(i,g),(d=u.querySelector(Il(i)))&&!d._p&&(g.instance=d,g.state.loading=5),Ls.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},Ls.set(i,r),d||ax(u,i,r,g.state))),s&&l===null)throw Error(a(528,""));return g}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=Oa(r),r=Gs(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="'+ct(i)+'"'}function Il(i){return'link[rel="stylesheet"]['+i+"]"}function by(i){return y({},i,{"data-precedence":i.precedence,precedence:null})}function ax(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}),Ni(s,"link",r),Nt(s),i.head.appendChild(s))}function Oa(i){return'[src="'+ct(i)+'"]'}function Fl(i){return"script[async]"+i}function Sy(i,s,r){if(s.count++,s.instance===null)switch(s.type){case"style":var l=i.querySelector('style[data-href~="'+ct(r.href)+'"]');if(l)return s.instance=l,Nt(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"),Nt(l),Ni(l,"style",u),Pc(l,r.precedence,i),s.instance=l;case"stylesheet":u=Ba(r.href);var d=i.querySelector(Il(u));if(d)return s.state.loading|=4,s.instance=d,Nt(d),d;l=by(r),(u=Ls.get(u))&&Zd(l,u),d=(i.ownerDocument||i).createElement("link"),Nt(d);var g=d;return g._p=new Promise(function(S,R){g.onload=S,g.onerror=R}),Ni(d,"link",l),s.state.loading|=4,Pc(d,r.precedence,i),s.instance=d;case"script":return d=Oa(r.src),(u=i.querySelector(Fl(d)))?(s.instance=u,Nt(u),u):(l=r,(u=Ls.get(d))&&(l=y({},r),Qd(l,u)),i=i.ownerDocument||i,u=i.createElement("script"),Nt(u),Ni(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,Pc(l,r.precedence,i));return s.instance}function Pc(i,s,r){for(var l=r.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),u=l.length?l[l.length-1]:null,d=u,g=0;g<l.length;g++){var S=l[g];if(S.dataset.precedence===s)d=S;else if(d!==u)break}d?d.parentNode.insertBefore(i,d.nextSibling):(s=r.nodeType===9?r.head:r,s.insertBefore(i,s.firstChild))}function Zd(i,s){i.crossOrigin==null&&(i.crossOrigin=s.crossOrigin),i.referrerPolicy==null&&(i.referrerPolicy=s.referrerPolicy),i.title==null&&(i.title=s.title)}function Qd(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 wy(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 d=r[u];if(!(d[os]||d[zt]||i==="link"&&d.getAttribute("rel")==="stylesheet")&&d.namespaceURI!=="http://www.w3.org/2000/svg"){var g=d.getAttribute(s)||"";g=i+g;var S=l.get(g);S?S.push(d):l.set(g,[d])}}return l}function Cy(i,s,r){i=i.ownerDocument||i,i.head.insertBefore(r,s==="title"?i.querySelector("head > title"):null)}function lx(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 xy(i){return!(i.type==="stylesheet"&&(i.state.loading&3)===0)}function ox(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),d=s.querySelector(Il(u));if(d){s=d._p,s!==null&&typeof s=="object"&&typeof s.then=="function"&&(i.count++,i=Ic.bind(i),s.then(i,i)),r.state.loading|=4,r.instance=d,Nt(d);return}d=s.ownerDocument||s,l=by(l),(u=Ls.get(u))&&Zd(l,u),d=d.createElement("link"),Nt(d);var g=d;g._p=new Promise(function(S,R){g.onload=S,g.onerror=R}),Ni(d,"link",l),r.instance=d}i.stylesheets===null&&(i.stylesheets=new Map),i.stylesheets.set(r,s),(s=r.state.preload)&&(r.state.loading&3)===0&&(i.count++,r=Ic.bind(i),s.addEventListener("load",r),s.addEventListener("error",r))}}var Jd=0;function cx(i,s){return i.stylesheets&&i.count===0&&qc(i,i.stylesheets),0<i.count||0<i.imgCount?function(r){var l=setTimeout(function(){if(i.stylesheets&&qc(i,i.stylesheets),i.unsuspend){var d=i.unsuspend;i.unsuspend=null,d()}},6e4+s);0<i.imgBytes&&Jd===0&&(Jd=62500*FC());var u=setTimeout(function(){if(i.waitingForImages=!1,i.count===0&&(i.stylesheets&&qc(i,i.stylesheets),i.unsuspend)){var d=i.unsuspend;i.unsuspend=null,d()}},(i.imgBytes>Jd?50:800)+s);return i.unsuspend=r,function(){i.unsuspend=null,clearTimeout(l),clearTimeout(u)}}:null}function Ic(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)qc(this,this.stylesheets);else if(this.unsuspend){var i=this.unsuspend;this.unsuspend=null,i()}}}var Fc=null;function qc(i,s){i.stylesheets=null,i.unsuspend!==null&&(i.count++,Fc=new Map,s.forEach(ux,i),Fc=null,Ic.call(i))}function ux(i,s){if(!(s.state.loading&4)){var r=Fc.get(i);if(r)var l=r.get(null);else{r=new Map,Fc.set(i,r);for(var u=i.querySelectorAll("link[data-precedence],style[data-precedence]"),d=0;d<u.length;d++){var g=u[d];(g.nodeName==="LINK"||g.getAttribute("media")!=="not all")&&(r.set(g.dataset.precedence,g),l=g)}l&&r.set(null,l)}u=s.instance,g=u.getAttribute("data-precedence"),d=r.get(g)||l,d===l&&r.set(null,u),r.set(g,u),this.count++,l=Ic.bind(this),u.addEventListener("load",l),u.addEventListener("error",l),d?d.parentNode.insertBefore(u,d.nextSibling):(i=i.nodeType===9?i.head:i,i.insertBefore(u,i.firstChild)),s.state.loading|=4}}var ql={$$typeof:P,Provider:null,Consumer:null,_currentValue:V,_currentValue2:V,_threadCount:0};function hx(i,s,r,l,u,d,g,S,R){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=si(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=si(0),this.hiddenUpdates=si(null),this.identifierPrefix=l,this.onUncaughtError=u,this.onCaughtError=d,this.onRecoverableError=g,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=R,this.incompleteTransitions=new Map}function Ey(i,s,r,l,u,d,g,S,R,F,ne,ce){return i=new hx(i,s,r,g,R,F,ne,ce,S),s=1,d===!0&&(s|=24),d=ds(3,null,null,s),i.current=d,d.stateNode=i,s=Ah(),s.refCount++,i.pooledCache=s,s.refCount++,d.memoizedState={element:l,isDehydrated:r,cache:s},zh(d),i}function Ty(i){return i?(i=da,i):da}function ky(i,s,r,l,u,d){u=Ty(u),l.context===null?l.context=u:l.pendingContext=u,l=Fn(s),l.payload={element:r},d=d===void 0?null:d,d!==null&&(l.callback=d),r=qn(i,l,s),r!==null&&(ns(r,i,s),wl(r,i,s))}function Dy(i,s){if(i=i.memoizedState,i!==null&&i.dehydrated!==null){var r=i.retryLane;i.retryLane=r!==0&&r<s?r:s}}function ef(i,s){Dy(i,s),(i=i.alternate)&&Dy(i,s)}function Ry(i){if(i.tag===13||i.tag===31){var s=Mr(i,67108864);s!==null&&ns(s,i,67108864),ef(i,67108864)}}function My(i){if(i.tag===13||i.tag===31){var s=gs();s=ot(s);var r=Mr(i,s);r!==null&&ns(r,i,s),ef(i,s)}}var Wc=!0;function dx(i,s,r,l){var u=M.T;M.T=null;var d=q.p;try{q.p=2,tf(i,s,r,l)}finally{q.p=d,M.T=u}}function fx(i,s,r,l){var u=M.T;M.T=null;var d=q.p;try{q.p=8,tf(i,s,r,l)}finally{q.p=d,M.T=u}}function tf(i,s,r,l){if(Wc){var u=sf(l);if(u===null)Kd(i,s,l,$c,r),Ay(i,l);else if(mx(u,i,s,r,l))l.stopPropagation();else if(Ay(i,l),s&4&&-1<px.indexOf(i)){for(;u!==null;){var d=ri(u);if(d!==null)switch(d.tag){case 3:if(d=d.stateNode,d.current.memoizedState.isDehydrated){var g=wt(d.pendingLanes);if(g!==0){var S=d;for(S.pendingLanes|=2,S.entangledLanes|=2;g;){var R=1<<31-Bt(g);S.entanglements[1]|=R,g&=~R}en(d),(lt&6)===0&&(Dc=Oe()+500,Hl(0))}}break;case 31:case 13:S=Mr(d,2),S!==null&&ns(S,d,2),Mc(),ef(d,2)}if(d=sf(l),d===null&&Kd(i,s,l,$c,r),d===u)break;u=d}u!==null&&l.stopPropagation()}else Kd(i,s,l,null,r)}}function sf(i){return i=aa(i),nf(i)}var $c=null;function nf(i){if($c=null,i=fi(i),i!==null){var s=c(i);if(s===null)i=null;else{var r=s.tag;if(r===13){if(i=h(s),i!==null)return i;i=null}else if(r===31){if(i=f(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 $c=i,null}function Ny(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(kt()){case Ui:return 2;case Li:return 8;case Yt:case Xi:return 32;case Bi:return 268435456;default:return 32}default:return 32}}var rf=!1,tr=null,ir=null,sr=null,Wl=new Map,$l=new Map,nr=[],px="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 Ay(i,s){switch(i){case"focusin":case"focusout":tr=null;break;case"dragenter":case"dragleave":ir=null;break;case"mouseover":case"mouseout":sr=null;break;case"pointerover":case"pointerout":Wl.delete(s.pointerId);break;case"gotpointercapture":case"lostpointercapture":$l.delete(s.pointerId)}}function Yl(i,s,r,l,u,d){return i===null||i.nativeEvent!==d?(i={blockedOn:s,domEventName:r,eventSystemFlags:l,nativeEvent:d,targetContainers:[u]},s!==null&&(s=ri(s),s!==null&&Ry(s)),i):(i.eventSystemFlags|=l,s=i.targetContainers,u!==null&&s.indexOf(u)===-1&&s.push(u),i)}function mx(i,s,r,l,u){switch(s){case"focusin":return tr=Yl(tr,i,s,r,l,u),!0;case"dragenter":return ir=Yl(ir,i,s,r,l,u),!0;case"mouseover":return sr=Yl(sr,i,s,r,l,u),!0;case"pointerover":var d=u.pointerId;return Wl.set(d,Yl(Wl.get(d)||null,i,s,r,l,u)),!0;case"gotpointercapture":return d=u.pointerId,$l.set(d,Yl($l.get(d)||null,i,s,r,l,u)),!0}return!1}function Ly(i){var s=fi(i.target);if(s!==null){var r=c(s);if(r!==null){if(s=r.tag,s===13){if(s=h(r),s!==null){i.blockedOn=s,Fi(i.priority,function(){My(r)});return}}else if(s===31){if(s=f(r),s!==null){i.blockedOn=s,Fi(i.priority,function(){My(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 Yc(i){if(i.blockedOn!==null)return!1;for(var s=i.targetContainers;0<s.length;){var r=sf(i.nativeEvent);if(r===null){r=i.nativeEvent;var l=new r.constructor(r.type,r);Es=l,r.target.dispatchEvent(l),Es=null}else return s=ri(r),s!==null&&Ry(s),i.blockedOn=r,!1;s.shift()}return!0}function By(i,s,r){Yc(i)&&r.delete(s)}function _x(){rf=!1,tr!==null&&Yc(tr)&&(tr=null),ir!==null&&Yc(ir)&&(ir=null),sr!==null&&Yc(sr)&&(sr=null),Wl.forEach(By),$l.forEach(By)}function Vc(i,s){i.blockedOn===s&&(i.blockedOn=null,rf||(rf=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,_x)))}var Xc=null;function Oy(i){Xc!==i&&(Xc=i,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){Xc===i&&(Xc=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(nf(l||r)===null)continue;break}var d=ri(r);d!==null&&(i.splice(s,3),s-=3,id(d,{pending:!0,data:u,method:r.method,action:l},l,u))}}))}function za(i){function s(R){return Vc(R,i)}tr!==null&&Vc(tr,i),ir!==null&&Vc(ir,i),sr!==null&&Vc(sr,i),Wl.forEach(s),$l.forEach(s);for(var r=0;r<nr.length;r++){var l=nr[r];l.blockedOn===i&&(l.blockedOn=null)}for(;0<nr.length&&(r=nr[0],r.blockedOn===null);)Ly(r),r.blockedOn===null&&nr.shift();if(r=(i.ownerDocument||i).$$reactFormReplay,r!=null)for(l=0;l<r.length;l+=3){var u=r[l],d=r[l+1],g=u[ni]||null;if(typeof d=="function")g||Oy(r);else if(g){var S=null;if(d&&d.hasAttribute("formAction")){if(u=d,g=d[ni]||null)S=g.formAction;else if(nf(u)!==null)continue}else S=g.action;typeof S=="function"?r[l+1]=S:(r.splice(l,3),l-=3),Oy(r)}}}function zy(){function i(d){d.canIntercept&&d.info==="react-transition"&&d.intercept({handler:function(){return new Promise(function(g){return u=g})},focusReset:"manual",scroll:"manual"})}function s(){u!==null&&(u(),u=null),l||setTimeout(r,20)}function r(){if(!l&&!navigation.transition){var d=navigation.currentEntry;d&&d.url!=null&&navigation.navigate(d.url,{state:d.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 af(i){this._internalRoot=i}Gc.prototype.render=af.prototype.render=function(i){var s=this._internalRoot;if(s===null)throw Error(a(409));var r=s.current,l=gs();ky(r,l,i,s,null,null)},Gc.prototype.unmount=af.prototype.unmount=function(){var i=this._internalRoot;if(i!==null){this._internalRoot=null;var s=i.containerInfo;ky(i.current,2,null,i,null,null),Mc(),s[Zi]=null}};function Gc(i){this._internalRoot=i}Gc.prototype.unstable_scheduleHydration=function(i){if(i){var s=ki();i={blockedOn:null,target:i,priority:s};for(var r=0;r<nr.length&&s!==0&&s<nr[r].priority;r++);nr.splice(r,0,i),r===0&&Ly(i)}};var jy=t.version;if(jy!=="19.2.6")throw Error(a(527,jy,"19.2.6"));q.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=p(s),i=i!==null?b(i):null,i=i===null?null:i.stateNode,i};var gx={bundleType:0,version:"19.2.6",rendererPackageName:"react-dom",currentDispatcherRef:M,reconcilerVersion:"19.2.6"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Zc=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Zc.isDisabled&&Zc.supportsFiber)try{ls=Zc.inject(gx),Kt=Zc}catch{}}return Xl.createRoot=function(i,s){if(!o(i))throw Error(a(299));var r=!1,l="",u=qg,d=Wg,g=$g;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&&(d=s.onCaughtError),s.onRecoverableError!==void 0&&(g=s.onRecoverableError)),s=Ey(i,1,!1,null,null,r,l,null,u,d,g,zy),i[Zi]=s.current,Pd(i),new af(s)},Xl.hydrateRoot=function(i,s,r){if(!o(i))throw Error(a(299));var l=!1,u="",d=qg,g=Wg,S=$g,R=null;return r!=null&&(r.unstable_strictMode===!0&&(l=!0),r.identifierPrefix!==void 0&&(u=r.identifierPrefix),r.onUncaughtError!==void 0&&(d=r.onUncaughtError),r.onCaughtError!==void 0&&(g=r.onCaughtError),r.onRecoverableError!==void 0&&(S=r.onRecoverableError),r.formState!==void 0&&(R=r.formState)),s=Ey(i,1,!0,s,r??null,l,u,R,d,g,S,zy),s.context=Ty(null),r=s.current,l=gs(),l=ot(l),u=Fn(l),u.callback=null,qn(r,u,l),r=l,s.current.lanes=r,Ei(s,r),en(s),i[Zi]=s.current,Pd(i),new Gc(s)},Xl.version="19.2.6",Xl}var Yy;function kx(){if(Yy)return cf.exports;Yy=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(),cf.exports=Tx(),cf.exports}var Dx=kx();class Nn extends Error{constructor(t,n){super(n),this.status=t,this.name="ApiError"}status}function Fu(e=fetch){return{getSession:()=>Te(e,"/api/auth/session"),setupPassword:t=>Te(e,"/api/auth/password",it("POST",t)),login:t=>Te(e,"/api/auth/login",it("POST",t)),reauth:t=>Te(e,"/api/auth/reauth",it("POST",t)),logout:()=>Te(e,"/api/auth/logout",{method:"POST",credentials:"same-origin"}),setupTotp:()=>Te(e,"/api/auth/totp/setup",{method:"POST",credentials:"same-origin"}),activateTotp:t=>Te(e,"/api/auth/totp/activate",it("POST",t)),disableTotp:()=>Te(e,"/api/auth/totp",{method:"DELETE",credentials:"same-origin"}),listDevices:()=>Te(e,"/api/auth/devices"),revokeDevice:async t=>{await Ua(e,`/api/auth/devices/${encodeURIComponent(t)}`,{method:"DELETE",credentials:"same-origin"})},listNetworks:()=>Te(e,"/api/auth/networks"),addNetwork:t=>Te(e,"/api/auth/networks",it("POST",t)),removeNetwork:async t=>{await Ua(e,`/api/auth/networks/${encodeURIComponent(t)}`,{method:"DELETE",credentials:"same-origin"})},listAgents:()=>Te(e,"/api/agents"),addAgent:t=>Te(e,"/api/agents",it("POST",t)),renameAgent:(t,n)=>Te(e,`/api/agents/${encodeURIComponent(t)}`,it("PATCH",{name:n})),getMainInfo:()=>Te(e,"/api/main"),renameMain:t=>Te(e,"/api/main",it("PATCH",{name:t})),removeAgent:async t=>{await Ua(e,`/api/agents/${encodeURIComponent(t)}`,{method:"DELETE",credentials:"same-origin"})},uninstallAgent:t=>Te(e,`/api/agents/${encodeURIComponent(t)}/uninstall`,{method:"POST",credentials:"same-origin"}),pingAgent:t=>Te(e,`/api/agents/${encodeURIComponent(t)}/ping`),getMainStats:()=>Te(e,"/api/stats"),getAgentStats:t=>Te(e,`/api/agents/${encodeURIComponent(t)}/stats`),getVersion:()=>Te(e,"/api/version"),checkUpdate:()=>Te(e,"/api/update/check",{method:"POST",credentials:"same-origin"}),runUpdate:()=>Te(e,"/api/update",{method:"POST",credentials:"same-origin"}),getAgentVersion:t=>Te(e,`/api/agents/${encodeURIComponent(t)}/version`),checkAgentUpdate:t=>Te(e,`/api/agents/${encodeURIComponent(t)}/update/check`,{method:"POST",credentials:"same-origin"}),runAgentUpdate:t=>Te(e,`/api/agents/${encodeURIComponent(t)}/update`,{method:"POST",credentials:"same-origin"}),listTerminals:()=>Te(e,"/api/terminals"),getTerminalLayout:()=>Te(e,"/api/terminal-layout"),saveTerminalLayout:t=>Te(e,"/api/terminal-layout",it("PUT",t)),createFileRoot:t=>Te(e,"/api/files/root",it("POST",t)),listFiles:t=>Te(e,"/api/files/list",it("POST",t)),readFile:t=>Te(e,"/api/files/read",it("POST",t)),writeFile:t=>Te(e,"/api/files/write",it("POST",t)),createFileEntry:t=>Te(e,"/api/files/create",it("POST",t)),moveFileEntry:t=>Te(e,"/api/files/move",it("POST",t)),previewDeleteFileEntry:t=>Te(e,"/api/files/delete-preview",it("POST",t)),deleteFileEntry:t=>Te(e,"/api/files/delete",it("POST",t)),openFileInTerminal:t=>Te(e,"/api/files/open",it("POST",t)),previewFile:t=>ZS(e,"/api/files/preview",it("POST",t)),createTerminal:(t={})=>Te(e,"/api/terminals",it("POST",t)),closeTerminal:async t=>{await Ua(e,`/api/terminals/${encodeURIComponent(t)}`,{method:"DELETE",credentials:"same-origin"})},renameTerminal:(t,n)=>Te(e,`/api/terminals/${encodeURIComponent(t)}`,it("PATCH",{title:n})),getTerminalHistory:(t,n={})=>Te(e,`/api/terminals/${encodeURIComponent(t)}/history${xu(n)}`),getTerminalTranscriptHistory:(t,n={})=>Te(e,`/api/terminals/${encodeURIComponent(t)}/transcript-history${xu(n)}`),getTerminalTranscriptSource:t=>Te(e,`/api/terminals/${encodeURIComponent(t)}/transcript-source`),listNotificationAssets:()=>Te(e,"/api/notification-assets"),uploadNotificationAsset:t=>{const n=new FormData;return n.append("asset",t),Te(e,"/api/notification-assets",{method:"POST",credentials:"same-origin",body:n})},updateNotificationAssetSelection:t=>Te(e,"/api/notification-assets/selection",it("PUT",t)),deleteNotificationAsset:async t=>{await Ua(e,`/api/notification-assets/${encodeURIComponent(t)}`,{method:"DELETE",credentials:"same-origin"})}}}function wo(e,t=fetch){const n=a=>e?`/api/agents/${encodeURIComponent(e)}/${a}`:`/api/${a}`;return{isAgent:e!==null,listTerminals:()=>Te(t,n("terminals")),createTerminal:(a={})=>Te(t,n("terminals"),it("POST",a)),closeTerminal:async a=>{await Ua(t,n(`terminals/${encodeURIComponent(a)}`),{method:"DELETE",credentials:"same-origin"})},renameTerminal:(a,o)=>Te(t,n(`terminals/${encodeURIComponent(a)}`),it("PATCH",{title:o})),getTerminalHistory:(a,o={})=>Te(t,`${n(`terminals/${encodeURIComponent(a)}/history`)}${xu(o)}`),getTerminalTranscriptHistory:(a,o={})=>Te(t,`${n(`terminals/${encodeURIComponent(a)}/transcript-history`)}${xu(o)}`),getTerminalTranscriptSource:a=>Te(t,n(`terminals/${encodeURIComponent(a)}/transcript-source`)),getTerminalLayout:()=>Te(t,n("terminal-layout")),saveTerminalLayout:a=>Te(t,n("terminal-layout"),it("PUT",a)),createFileRoot:a=>Te(t,n("files/root"),it("POST",a)),listFiles:a=>Te(t,n("files/list"),it("POST",a)),readFile:a=>Te(t,n("files/read"),it("POST",a)),writeFile:a=>Te(t,n("files/write"),it("POST",a)),createFileEntry:a=>Te(t,n("files/create"),it("POST",a)),moveFileEntry:a=>Te(t,n("files/move"),it("POST",a)),previewDeleteFileEntry:a=>Te(t,n("files/delete-preview"),it("POST",a)),deleteFileEntry:a=>Te(t,n("files/delete"),it("POST",a)),openFileInTerminal:a=>Te(t,n("files/open"),it("POST",a)),previewFile:a=>ZS(t,n("files/preview"),it("POST",a)),createWebSocketUrl:(a,o=window.location.href)=>Rx(n(`terminals/${encodeURIComponent(a)}/ws`),o)}}function Rx(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 it(e,t){return{method:e,headers:{"content-type":"application/json"},credentials:"same-origin",body:JSON.stringify(t)}}function xu(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)),e.includeTools!==void 0&&t.set("includeTools",e.includeTools?"true":"false");const n=t.toString();return n?`?${n}`:""}async function Te(e,t,n){const a=await e(t,n??{credentials:"same-origin"});await _m(a);try{return await a.json()}catch{throw new Nn(a.status,"invalid_json_response")}}async function Ua(e,t,n){const a=await e(t,n);await _m(a)}async function ZS(e,t,n){const a=await e(t,n);return await _m(a),a.blob()}async function _m(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 Nn(e.status,t)}const gm="nterminal.theme.id",QS="nterminal.theme.accent",Kf="nterminal:theme",Eu=[{id:"midnight",label:"Midnight",description:"Current dark terminal look with aqua focus.",mode:"dark",tokens:{bg:"#0a0d10",bg2:"#0d1216",bgSidebar:"#08090b",line:"#1a2128",line2:"#2a3340",fg:"#e2e8ee",fg2:"#8896a3",fg3:"#54616d",fg4:"#3f4a54",accent:"#5eead4",accentSoft:"rgba(94, 234, 212, 0.10)",accentGlow:"rgba(94, 234, 212, 0.55)",onAccent:"#062423",ok:"#34d399",danger:"#f87171",onDanger:"#190607",dangerSoft:"rgba(248, 113, 113, 0.08)",dangerLine:"rgba(248, 113, 113, 0.30)",warning:"#fbbf24",warningSoft:"rgba(247, 217, 119, 0.075)",warningGlow:"rgba(245, 158, 11, 0.55)",scrim:"rgba(0, 0, 0, 0.55)",scrimSoft:"rgba(0, 0, 0, 0.28)",shadow:"rgba(0, 0, 0, 0.35)",shadowStrong:"rgba(0, 0, 0, 0.50)",floatingBg:"rgba(10, 13, 16, 0.86)",floatingBgStrong:"rgba(10, 13, 16, 0.96)",floatingBgHover:"rgba(15, 23, 27, 0.94)",subtleFill:"rgba(255, 255, 255, 0.018)",hoverFill:"rgba(255, 255, 255, 0.015)",scrollbarThumb:"rgba(148, 163, 184, 0.50)",scrollbarThumbHover:"rgba(148, 163, 184, 0.70)",transcriptUser:"#f7d977",transcriptTool:"#9aa7b4",transcriptCommand:"#8fd6ff",transcriptCode:"#c4f1ff",transcriptSearch:"#f7d977",transcriptOnSearch:"#121417",qrBg:"#ffffff"},xterm:{background:"#0a0d10",foreground:"#e2e8ee",cursor:"#5eead4",selectionBackground:"#1f3f45"}},{id:"daylight",label:"Daylight",description:"Light workspace with dark terminal contrast.",mode:"light",tokens:{bg:"#f7f9fc",bg2:"#ffffff",bgSidebar:"#eef2f7",line:"#dbe3ec",line2:"#c3cedb",fg:"#17212b",fg2:"#526170",fg3:"#7b8794",fg4:"#a1acb8",accent:"#0f8f83",accentSoft:"rgba(15, 143, 131, 0.11)",accentGlow:"rgba(15, 143, 131, 0.24)",onAccent:"#021918",ok:"#16835c",danger:"#c03545",onDanger:"#fff7f8",dangerSoft:"rgba(192, 53, 69, 0.10)",dangerLine:"rgba(192, 53, 69, 0.30)",warning:"#b7791f",warningSoft:"rgba(183, 121, 31, 0.12)",warningGlow:"rgba(183, 121, 31, 0.26)",scrim:"rgba(15, 23, 42, 0.34)",scrimSoft:"rgba(15, 23, 42, 0.20)",shadow:"rgba(15, 23, 42, 0.18)",shadowStrong:"rgba(15, 23, 42, 0.28)",floatingBg:"rgba(255, 255, 255, 0.92)",floatingBgStrong:"rgba(255, 255, 255, 0.98)",floatingBgHover:"rgba(239, 246, 249, 0.96)",subtleFill:"rgba(15, 23, 42, 0.025)",hoverFill:"rgba(15, 23, 42, 0.035)",scrollbarThumb:"rgba(82, 97, 112, 0.38)",scrollbarThumbHover:"rgba(82, 97, 112, 0.58)",transcriptUser:"#8a5a00",transcriptTool:"#66717d",transcriptCommand:"#0b6fa4",transcriptCode:"#075985",transcriptSearch:"#f0c14b",transcriptOnSearch:"#1f1a10",qrBg:"#ffffff"},xterm:{background:"#ffffff",foreground:"#17212b",cursor:"#0f8f83",selectionBackground:"#cdeee9",...Vy({foreground:"#17212b",foregroundMuted:"#526170",line:"#dbe3ec",red:"#b4232f",green:"#16794f",yellow:"#9a6700",blue:"#0b6fa4",magenta:"#8f3f85",cyan:"#0f766e"})}},{id:"signal-red",label:"Signal",description:"Dark control-room surface with red alerts.",mode:"dark",tokens:{bg:"#100d0f",bg2:"#171113",bgSidebar:"#0b080a",line:"#2a1b20",line2:"#452b32",fg:"#f1e7e9",fg2:"#a58d93",fg3:"#765f66",fg4:"#55434a",accent:"#ff2a3d",accentSoft:"rgba(255, 42, 61, 0.12)",accentGlow:"rgba(255, 42, 61, 0.52)",onAccent:"#210407",ok:"#34d399",danger:"#ff4d5f",onDanger:"#210407",dangerSoft:"rgba(255, 77, 95, 0.10)",dangerLine:"rgba(255, 77, 95, 0.32)",warning:"#fbbf24",warningSoft:"rgba(251, 191, 36, 0.10)",warningGlow:"rgba(245, 158, 11, 0.50)",scrim:"rgba(0, 0, 0, 0.58)",scrimSoft:"rgba(0, 0, 0, 0.30)",shadow:"rgba(0, 0, 0, 0.36)",shadowStrong:"rgba(0, 0, 0, 0.52)",floatingBg:"rgba(16, 13, 15, 0.88)",floatingBgStrong:"rgba(16, 13, 15, 0.96)",floatingBgHover:"rgba(25, 16, 19, 0.96)",subtleFill:"rgba(255, 255, 255, 0.018)",hoverFill:"rgba(255, 255, 255, 0.018)",scrollbarThumb:"rgba(165, 141, 147, 0.45)",scrollbarThumbHover:"rgba(165, 141, 147, 0.65)",transcriptUser:"#f8d36f",transcriptTool:"#ad9ca2",transcriptCommand:"#ff9ca6",transcriptCode:"#ffd1d6",transcriptSearch:"#f8d36f",transcriptOnSearch:"#1b0e10",qrBg:"#ffffff"},xterm:{background:"#100d0f",foreground:"#f1e7e9",cursor:"#ff2a3d",selectionBackground:"#4a1b22"}},{id:"graphite",label:"Graphite",description:"Neutral dark theme with blue command focus.",mode:"dark",tokens:{bg:"#101214",bg2:"#171a1d",bgSidebar:"#0c0e10",line:"#262b30",line2:"#39414a",fg:"#eceff3",fg2:"#9aa4af",fg3:"#6c7680",fg4:"#4d5660",accent:"#7dd3fc",accentSoft:"rgba(125, 211, 252, 0.11)",accentGlow:"rgba(125, 211, 252, 0.38)",onAccent:"#071c26",ok:"#4ade80",danger:"#fb7185",onDanger:"#26070d",dangerSoft:"rgba(251, 113, 133, 0.09)",dangerLine:"rgba(251, 113, 133, 0.30)",warning:"#facc15",warningSoft:"rgba(250, 204, 21, 0.09)",warningGlow:"rgba(250, 204, 21, 0.42)",scrim:"rgba(0, 0, 0, 0.55)",scrimSoft:"rgba(0, 0, 0, 0.28)",shadow:"rgba(0, 0, 0, 0.34)",shadowStrong:"rgba(0, 0, 0, 0.50)",floatingBg:"rgba(16, 18, 20, 0.88)",floatingBgStrong:"rgba(16, 18, 20, 0.96)",floatingBgHover:"rgba(22, 28, 33, 0.96)",subtleFill:"rgba(255, 255, 255, 0.018)",hoverFill:"rgba(255, 255, 255, 0.018)",scrollbarThumb:"rgba(154, 164, 175, 0.45)",scrollbarThumbHover:"rgba(154, 164, 175, 0.65)",transcriptUser:"#f2d675",transcriptTool:"#aab4bf",transcriptCommand:"#8fd6ff",transcriptCode:"#c4f1ff",transcriptSearch:"#f2d675",transcriptOnSearch:"#141513",qrBg:"#ffffff"},xterm:{background:"#101214",foreground:"#eceff3",cursor:"#7dd3fc",selectionBackground:"#263d4b"}},{id:"paper",label:"Paper",description:"Warm light surface with restrained amber accent.",mode:"light",tokens:{bg:"#fbfaf7",bg2:"#ffffff",bgSidebar:"#f2f0ea",line:"#e2ddd4",line2:"#cbc3b6",fg:"#25211d",fg2:"#62584e",fg3:"#8d8275",fg4:"#afa69b",accent:"#a35d00",accentSoft:"rgba(163, 93, 0, 0.11)",accentGlow:"rgba(163, 93, 0, 0.24)",onAccent:"#fffaf2",ok:"#26744d",danger:"#b23a48",onDanger:"#fff8f8",dangerSoft:"rgba(178, 58, 72, 0.10)",dangerLine:"rgba(178, 58, 72, 0.30)",warning:"#a35d00",warningSoft:"rgba(163, 93, 0, 0.12)",warningGlow:"rgba(163, 93, 0, 0.26)",scrim:"rgba(37, 33, 29, 0.32)",scrimSoft:"rgba(37, 33, 29, 0.18)",shadow:"rgba(37, 33, 29, 0.18)",shadowStrong:"rgba(37, 33, 29, 0.28)",floatingBg:"rgba(255, 253, 249, 0.92)",floatingBgStrong:"rgba(255, 253, 249, 0.98)",floatingBgHover:"rgba(250, 247, 240, 0.96)",subtleFill:"rgba(37, 33, 29, 0.025)",hoverFill:"rgba(37, 33, 29, 0.035)",scrollbarThumb:"rgba(98, 88, 78, 0.35)",scrollbarThumbHover:"rgba(98, 88, 78, 0.55)",transcriptUser:"#875600",transcriptTool:"#776d63",transcriptCommand:"#176a94",transcriptCode:"#6f4b00",transcriptSearch:"#e9c46a",transcriptOnSearch:"#241b0a",qrBg:"#ffffff"},xterm:{background:"#fffdf9",foreground:"#25211d",cursor:"#a35d00",selectionBackground:"#f2dfc5",...Vy({foreground:"#25211d",foregroundMuted:"#62584e",line:"#e2ddd4",red:"#a8323d",green:"#26744d",yellow:"#875600",blue:"#176a94",magenta:"#8b4b80",cyan:"#276f68"})}}],Ya="midnight";function qu(e){return Eu.some(t=>t.id===e)?e:Ya}function vm(e){return Eu.find(t=>t.id===e)??Eu[0]}function _r(){if(typeof window>"u")return Ya;try{const e=window.localStorage.getItem(gm);return e?qu(e):Bx(window.localStorage.getItem(QS))}catch{return Ya}}function Mx(e){const t=qu(e);if(typeof window<"u"){try{window.localStorage.setItem(gm,t)}catch{}ym(t),window.dispatchEvent(new CustomEvent(Kf,{detail:t}))}return t}function ym(e=_r()){if(typeof document>"u")return;const t=vm(qu(e)),n=document.documentElement;n.dataset.ntTheme=t.id,n.style.setProperty("color-scheme",t.mode),Ve(n,"--nt-bg",t.tokens.bg),Ve(n,"--nt-bg-2",t.tokens.bg2),Ve(n,"--nt-bg-sidebar",t.tokens.bgSidebar),Ve(n,"--nt-line",t.tokens.line),Ve(n,"--nt-line-2",t.tokens.line2),Ve(n,"--nt-fg",t.tokens.fg),Ve(n,"--nt-fg-2",t.tokens.fg2),Ve(n,"--nt-fg-3",t.tokens.fg3),Ve(n,"--nt-fg-4",t.tokens.fg4),Ve(n,"--nt-accent",t.tokens.accent),Ve(n,"--nt-accent-soft",t.tokens.accentSoft),Ve(n,"--nt-accent-glow",t.tokens.accentGlow),Ve(n,"--nt-on-accent",t.tokens.onAccent),Ve(n,"--nt-ok",t.tokens.ok),Ve(n,"--nt-danger",t.tokens.danger),Ve(n,"--nt-on-danger",t.tokens.onDanger),Ve(n,"--nt-danger-soft",t.tokens.dangerSoft),Ve(n,"--nt-danger-line",t.tokens.dangerLine),Ve(n,"--nt-warning",t.tokens.warning),Ve(n,"--nt-warn",t.tokens.warning),Ve(n,"--nt-warning-soft",t.tokens.warningSoft),Ve(n,"--nt-warning-glow",t.tokens.warningGlow),Ve(n,"--nt-scrim",t.tokens.scrim),Ve(n,"--nt-scrim-soft",t.tokens.scrimSoft),Ve(n,"--nt-shadow",t.tokens.shadow),Ve(n,"--nt-shadow-strong",t.tokens.shadowStrong),Ve(n,"--nt-floating-bg",t.tokens.floatingBg),Ve(n,"--nt-floating-bg-strong",t.tokens.floatingBgStrong),Ve(n,"--nt-floating-bg-hover",t.tokens.floatingBgHover),Ve(n,"--nt-subtle-fill",t.tokens.subtleFill),Ve(n,"--nt-hover-fill",t.tokens.hoverFill),Ve(n,"--nt-scrollbar-thumb",t.tokens.scrollbarThumb),Ve(n,"--nt-scrollbar-thumb-hover",t.tokens.scrollbarThumbHover),Ve(n,"--nt-transcript-user",t.tokens.transcriptUser),Ve(n,"--nt-transcript-tool",t.tokens.transcriptTool),Ve(n,"--nt-transcript-command",t.tokens.transcriptCommand),Ve(n,"--nt-transcript-code",t.tokens.transcriptCode),Ve(n,"--nt-transcript-search",t.tokens.transcriptSearch),Ve(n,"--nt-transcript-on-search",t.tokens.transcriptOnSearch),Ve(n,"--nt-qr-bg",t.tokens.qrBg)}function Nx(e=_r()){return vm(qu(e)).xterm}function bm(e){if(typeof window>"u")return()=>{};const t=n=>{(n.key===gm||n.key===QS)&&(ym(_r()),e())};return window.addEventListener(Kf,e),window.addEventListener("storage",t),()=>{window.removeEventListener(Kf,e),window.removeEventListener("storage",t)}}function Ve(e,t,n){e.style.setProperty(t,n)}function Vy(e){const t=Ax(237);return t[215]=e.foreground,t[221]=e.line,{black:e.foreground,red:e.red,green:e.green,yellow:e.yellow,blue:e.blue,magenta:e.magenta,cyan:e.cyan,white:e.foregroundMuted,brightBlack:e.foregroundMuted,brightRed:e.red,brightGreen:e.green,brightYellow:e.yellow,brightBlue:e.blue,brightMagenta:e.magenta,brightCyan:e.cyan,brightWhite:e.foreground,extendedAnsi:t}}function Ax(e){const t=[];for(let n=16;n<=e;n+=1)t.push(Lx(n));return t}function Lx(e){if(e>=16&&e<=231){const t=e-16,n=[0,95,135,175,215,255],a=n[Math.floor(t/36)%6],o=n[Math.floor(t/6)%6],c=n[t%6];return Xy(a,o,c)}if(e>=232&&e<=255){const t=8+(e-232)*10;return Xy(t,t,t)}return"#000000"}function Xy(e,t,n){return`#${ff(e)}${ff(t)}${ff(n)}`}function ff(e){return e.toString(16).padStart(2,"0")}function Bx(e){return e==="signal-red"?"signal-red":Ya}function JS(){const e=v.useSyncExternalStore(bm,_r,()=>Ya);return vm(e).mode==="light"?"-light":""}function e0({size:e=22}){const t=JS();return m.jsx("img",{className:"nterminal-mark",src:`/brand/nterminal-mark${t}.svg`,width:e,height:e,alt:"","aria-hidden":"true"})}function t0({height:e=18}){const t=JS(),n=Math.round(243/34*e);return m.jsx("img",{className:"nterminal-wordmark",src:`/brand/nterminal-wordmark${t}.svg`,width:n,height:e,alt:"NTerminal"})}var ao=GS();const Wu=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Ja(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function Sm(e){return"nodeType"in e}function as(e){var t,n;return e?Ja(e)?e:Sm(e)&&(t=(n=e.ownerDocument)==null?void 0:n.defaultView)!=null?t:window:window}function wm(e){const{Document:t}=as(e);return e instanceof t}function Oo(e){return Ja(e)?!1:e instanceof as(e).HTMLElement}function i0(e){return e instanceof as(e).SVGElement}function el(e){return e?Ja(e)?e.document:Sm(e)?wm(e)?e:Oo(e)||i0(e)?e.ownerDocument:document:document:document}const gr=Wu?v.useLayoutEffect:v.useEffect;function Cm(e){const t=v.useRef(e);return gr(()=>{t.current=e}),v.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 Ox(){const e=v.useRef(null),t=v.useCallback((a,o)=>{e.current=setInterval(a,o)},[]),n=v.useCallback(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,n]}function Co(e,t){t===void 0&&(t=[e]);const n=v.useRef(e);return gr(()=>{n.current!==e&&(n.current=e)},t),n}function zo(e,t){const n=v.useRef();return v.useMemo(()=>{const a=e(n.current);return n.current=a,a},[...t])}function Tu(e){const t=Cm(e),n=v.useRef(null),a=v.useCallback(o=>{o!==n.current&&t?.(o,n.current),n.current=o},[]);return[n,a]}function If(e){const t=v.useRef();return v.useEffect(()=>{t.current=e},[e]),t.current}let pf={};function $u(e,t){return v.useMemo(()=>{if(t)return t;const n=pf[e]==null?0:pf[e]+1;return pf[e]=n,e+"-"+n},[e,t])}function s0(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,h)=>{const f=Object.entries(h);for(const[_,p]of f){const b=c[_];b!=null&&(c[_]=b+e*p)}return c},{...t})}}const Wa=s0(1),ku=s0(-1);function zx(e){return"clientX"in e&&"clientY"in e}function n0(e){if(!e)return!1;const{KeyboardEvent:t}=as(e.target);return t&&e instanceof t}function jx(e){if(!e)return!1;const{TouchEvent:t}=as(e.target);return t&&e instanceof t}function Ff(e){if(jx(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 zx(e)?{x:e.clientX,y:e.clientY}:null}const qf=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[qf.Translate.toString(e),qf.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:n,easing:a}=e;return t+" "+n+"ms "+a}}}),Gy="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function Hx(e){return e.matches(Gy)?e:e.querySelector(Gy)}const Ux={display:"none"};function Px(e){let{id:t,value:n}=e;return hi.createElement("div",{id:t,style:Ux},n)}function Kx(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 hi.createElement("div",{id:t,style:o,role:"status","aria-live":a,"aria-atomic":!0},n)}function Ix(){const[e,t]=v.useState("");return{announce:v.useCallback(a=>{a!=null&&t(a)},[]),announcement:e}}const r0=v.createContext(null);function Fx(e){const t=v.useContext(r0);v.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}function qx(){const[e]=v.useState(()=>new Set),t=v.useCallback(a=>(e.add(a),()=>e.delete(a)),[e]);return[v.useCallback(a=>{let{type:o,event:c}=a;e.forEach(h=>{var f;return(f=h[o])==null?void 0:f.call(h,c)})},[e]),t]}const Wx={draggable:`
|
|
11
11
|
To pick up a draggable item, press the space bar.
|
|
12
12
|
While dragging, use the arrow keys to move the item.
|
|
13
13
|
Press space again to drop the item in its new position, or press escape to cancel.
|
|
14
|
-
`},Ox={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 zx(e){let{announcements:t=Ox,container:n,hiddenTextDescribedById:a,screenReaderInstructions:o=Bx}=e;const{announce:c,announcement:h}=Nx(),f=Wu("DndLiveRegion"),[m,p]=g.useState(!1);if(g.useEffect(()=>{p(!0)},[]),Ax(g.useMemo(()=>({onDragStart(y){let{active:w}=y;c(t.onDragStart({active:w}))},onDragMove(y){let{active:w,over:x}=y;t.onDragMove&&c(t.onDragMove({active:w,over:x}))},onDragOver(y){let{active:w,over:x}=y;c(t.onDragOver({active:w,over:x}))},onDragEnd(y){let{active:w,over:x}=y;c(t.onDragEnd({active:w,over:x}))},onDragCancel(y){let{active:w,over:x}=y;c(t.onDragCancel({active:w,over:x}))}}),[c,t])),!m)return null;const b=ei.createElement(ei.Fragment,null,ei.createElement(Rx,{id:a,value:o.draggable}),ei.createElement(Mx,{id:f,announcement:h}));return n?so.createPortal(b,n):b}var ui;(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"})(ui||(ui={}));function ku(){}function $y(e,t){return g.useMemo(()=>({sensor:e,options:t??{}}),[e,t])}function jx(){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 Ys=Object.freeze({x:0,y:0});function Hx(e,t){let{data:{value:n}}=e,{data:{value:a}}=t;return a-n}function Ux(e,t){if(!e||e.length===0)return null;const[n]=e;return n[t]}function Px(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),h=o-a,f=c-n;if(a<o&&n<c){const m=t.width*t.height,p=e.width*e.height,b=h*f,y=b/(m+p-b);return Number(y.toFixed(4))}return 0}const Kx=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:a}=e;const o=[];for(const c of a){const{id:h}=c,f=n.get(h);if(f){const m=Px(f,t);m>0&&o.push({id:h,data:{droppableContainer:c,value:m}})}}return o.sort(Hx)};function Ix(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function JS(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:Ys}function Fx(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((h,f)=>({...h,top:h.top+e*f.y,bottom:h.bottom+e*f.y,left:h.left+e*f.x,right:h.right+e*f.x}),{...n})}}const qx=Fx(1);function Wx(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 $x(e,t,n){const a=Wx(t);if(!a)return e;const{scaleX:o,scaleY:c,x:h,y:f}=a,m=e.left-h-(1-o)*parseFloat(n),p=e.top-f-(1-c)*parseFloat(n.slice(n.indexOf(" ")+1)),b=o?e.width/o:e.width,y=c?e.height/c:e.height;return{width:b,height:y,top:p,right:m+b,bottom:p+y,left:m}}const Yx={ignoreTransform:!1};function zo(e,t){t===void 0&&(t=Yx);let n=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:p,transformOrigin:b}=rs(e).getComputedStyle(e);p&&(n=$x(n,p,b))}const{top:a,left:o,width:c,height:h,bottom:f,right:m}=n;return{top:a,left:o,width:c,height:h,bottom:f,right:m}}function Yy(e){return zo(e,{ignoreTransform:!0})}function Vx(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=rs(e).getComputedStyle(e)),t.position==="fixed"}function Gx(e,t){t===void 0&&(t=rs(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 gm(e,t){const n=[];function a(o){if(t!=null&&n.length>=t||!o)return n;if(_m(o)&&o.scrollingElement!=null&&!n.includes(o.scrollingElement))return n.push(o.scrollingElement),n;if(!Bo(o)||XS(o)||n.includes(o))return n;const c=rs(e).getComputedStyle(o);return o!==e&&Gx(o,c)&&n.push(o),Xx(o,c)?n:a(o.parentNode)}return e?a(e):n}function e0(e){const[t]=gm(e,1);return t??null}function ff(e){return!qu||!e?null:Ga(e)?e:mm(e)?_m(e)||e===Za(e).scrollingElement?window:Bo(e)?e:null:null}function t0(e){return Ga(e)?e.scrollX:e.scrollLeft}function i0(e){return Ga(e)?e.scrollY:e.scrollTop}function If(e){return{x:t0(e),y:i0(e)}}var _i;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(_i||(_i={}));function s0(e){return!qu||!e?!1:e===document.scrollingElement}function n0(e){const t={x:0,y:0},n=s0(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,h=e.scrollTop>=a.y,f=e.scrollLeft>=a.x;return{isTop:o,isLeft:c,isBottom:h,isRight:f,maxScroll:a,minScroll:t}}const Zx={x:.2,y:.2};function Qx(e,t,n,a,o){let{top:c,left:h,right:f,bottom:m}=n;a===void 0&&(a=10),o===void 0&&(o=Zx);const{isTop:p,isBottom:b,isLeft:y,isRight:w}=n0(e),x={x:0,y:0},C={x:0,y:0},E={height:t.height*o.y,width:t.width*o.x};return!p&&c<=t.top+E.height?(x.y=_i.Backward,C.y=a*Math.abs((t.top+E.height-c)/E.height)):!b&&m>=t.bottom-E.height&&(x.y=_i.Forward,C.y=a*Math.abs((t.bottom-E.height-m)/E.height)),!w&&f>=t.right-E.width?(x.x=_i.Forward,C.x=a*Math.abs((t.right-E.width-f)/E.width)):!y&&h<=t.left+E.width&&(x.x=_i.Backward,C.x=a*Math.abs((t.left+E.width-h)/E.width)),{direction:x,speed:C}}function Jx(e){if(e===document.scrollingElement){const{innerWidth:c,innerHeight:h}=window;return{top:0,left:0,right:c,bottom:h,width:c,height:h}}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 r0(e){return e.reduce((t,n)=>qa(t,If(n)),Ys)}function eE(e){return e.reduce((t,n)=>t+t0(n),0)}function tE(e){return e.reduce((t,n)=>t+i0(n),0)}function iE(e,t){if(t===void 0&&(t=zo),!e)return;const{top:n,left:a,bottom:o,right:c}=t(e);e0(e)&&(o<=0||c<=0||n>=window.innerHeight||a>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const sE=[["x",["left","right"],eE],["y",["top","bottom"],tE]];class ym{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=gm(n),o=r0(a);this.rect={...t},this.width=t.width,this.height=t.height;for(const[c,h,f]of sE)for(const m of h)Object.defineProperty(this,m,{get:()=>{const p=f(a),b=o[c]-p;return this.rect[m]+b},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class ho{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 nE(e){const{EventTarget:t}=rs(e);return e instanceof t?e:Za(e)}function pf(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 Os;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(Os||(Os={}));function Vy(e){e.preventDefault()}function rE(e){e.stopPropagation()}var yt;(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"})(yt||(yt={}));const a0={start:[yt.Space,yt.Enter],cancel:[yt.Esc],end:[yt.Space,yt.Enter,yt.Tab]},aE=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case yt.Right:return{...n,x:n.x+25};case yt.Left:return{...n,x:n.x-25};case yt.Down:return{...n,y:n.y+25};case yt.Up:return{...n,y:n.y-25}}};class l0{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 ho(Za(n)),this.windowListeners=new ho(rs(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(Os.Resize,this.handleCancel),this.windowListeners.add(Os.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(Os.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:n}=this.props,a=t.node.current;a&&iE(a),n(Ys)}handleKeyDown(t){if(ZS(t)){const{active:n,context:a,options:o}=this.props,{keyboardCodes:c=a0,coordinateGetter:h=aE,scrollBehavior:f="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:p}=a.current,b=p?{x:p.left,y:p.top}:Ys;this.referenceCoordinates||(this.referenceCoordinates=b);const y=h(t,{active:n,context:a.current,currentCoordinates:b});if(y){const w=Tu(y,b),x={x:0,y:0},{scrollableAncestors:C}=a.current;for(const E of C){const B=t.code,{isTop:T,isRight:Y,isLeft:K,isBottom:X,maxScroll:re,minScroll:ee}=n0(E),ie=Jx(E),le={x:Math.min(B===yt.Right?ie.right-ie.width/2:ie.right,Math.max(B===yt.Right?ie.left:ie.left+ie.width/2,y.x)),y:Math.min(B===yt.Down?ie.bottom-ie.height/2:ie.bottom,Math.max(B===yt.Down?ie.top:ie.top+ie.height/2,y.y))},de=B===yt.Right&&!Y||B===yt.Left&&!K,N=B===yt.Down&&!X||B===yt.Up&&!T;if(de&&le.x!==y.x){const U=E.scrollLeft+w.x,P=B===yt.Right&&U<=re.x||B===yt.Left&&U>=ee.x;if(P&&!w.y){E.scrollTo({left:U,behavior:f});return}P?x.x=E.scrollLeft-U:x.x=B===yt.Right?E.scrollLeft-re.x:E.scrollLeft-ee.x,x.x&&E.scrollBy({left:-x.x,behavior:f});break}else if(N&&le.y!==y.y){const U=E.scrollTop+w.y,P=B===yt.Down&&U<=re.y||B===yt.Up&&U>=ee.y;if(P&&!w.x){E.scrollTo({top:U,behavior:f});return}P?x.y=E.scrollTop-U:x.y=B===yt.Down?E.scrollTop-re.y:E.scrollTop-ee.y,x.y&&E.scrollBy({top:-x.y,behavior:f});break}}this.handleMove(t,qa(Tu(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()}}l0.activators=[{eventName:"onKeyDown",handler:(e,t,n)=>{let{keyboardCodes:a=a0,onActivation:o}=t,{active:c}=n;const{code:h}=e.nativeEvent;if(a.start.includes(h)){const f=c.activatorNode.current;return f&&e.target!==f?!1:(e.preventDefault(),o?.({event:e.nativeEvent}),!0)}return!1}}];function Xy(e){return!!(e&&"distance"in e)}function Gy(e){return!!(e&&"delay"in e)}class bm{constructor(t,n,a){var o;a===void 0&&(a=nE(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:h}=c;this.props=t,this.events=n,this.document=Za(h),this.documentListeners=new ho(this.document),this.listeners=new ho(a),this.windowListeners=new ho(rs(h)),this.initialCoordinates=(o=Pf(c))!=null?o:Ys,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(Os.Resize,this.handleCancel),this.windowListeners.add(Os.DragStart,Vy),this.windowListeners.add(Os.VisibilityChange,this.handleCancel),this.windowListeners.add(Os.ContextMenu,Vy),this.documentListeners.add(Os.Keydown,this.handleKeydown),n){if(a!=null&&a({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(Gy(n)){this.timeoutId=setTimeout(this.handleStart,n.delay),this.handlePending(n);return}if(Xy(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(Os.Click,rE,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(Os.SelectionChange,this.removeTextSelection),n(t))}handleMove(t){var n;const{activated:a,initialCoordinates:o,props:c}=this,{onMove:h,options:{activationConstraint:f}}=c;if(!o)return;const m=(n=Pf(t))!=null?n:Ys,p=Tu(o,m);if(!a&&f){if(Xy(f)){if(f.tolerance!=null&&pf(p,f.tolerance))return this.handleCancel();if(pf(p,f.distance))return this.handleStart()}if(Gy(f)&&pf(p,f.tolerance))return this.handleCancel();this.handlePending(f,p);return}t.cancelable&&t.preventDefault(),h(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===yt.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const lE={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class o0 extends bm{constructor(t){const{event:n}=t,a=Za(n.target);super(t,lE,a)}}o0.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 oE={move:{name:"mousemove"},end:{name:"mouseup"}};var Ff;(function(e){e[e.RightClick=2]="RightClick"})(Ff||(Ff={}));class c0 extends bm{constructor(t){super(t,oE,Za(t.event.target))}}c0.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:a}=t;return n.button===Ff.RightClick?!1:(a?.({event:n}),!0)}}];const mf={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class u0 extends bm{constructor(t){super(t,mf)}static setup(){return window.addEventListener(mf.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(mf.move.name,t)};function t(){}}}u0.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 fo;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(fo||(fo={}));var Du;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(Du||(Du={}));function cE(e){let{acceleration:t,activator:n=fo.Pointer,canScroll:a,draggingRect:o,enabled:c,interval:h=5,order:f=Du.TreeOrder,pointerCoordinates:m,scrollableAncestors:p,scrollableAncestorRects:b,delta:y,threshold:w}=e;const x=hE({delta:y,disabled:!c}),[C,E]=xx(),B=g.useRef({x:0,y:0}),T=g.useRef({x:0,y:0}),Y=g.useMemo(()=>{switch(n){case fo.Pointer:return m?{top:m.y,bottom:m.y,left:m.x,right:m.x}:null;case fo.DraggableRect:return o}},[n,o,m]),K=g.useRef(null),X=g.useCallback(()=>{const ee=K.current;if(!ee)return;const ie=B.current.x*T.current.x,le=B.current.y*T.current.y;ee.scrollBy(ie,le)},[]),re=g.useMemo(()=>f===Du.TreeOrder?[...p].reverse():p,[f,p]);g.useEffect(()=>{if(!c||!p.length||!Y){E();return}for(const ee of re){if(a?.(ee)===!1)continue;const ie=p.indexOf(ee),le=b[ie];if(!le)continue;const{direction:de,speed:N}=Qx(ee,le,Y,t,w);for(const U of["x","y"])x[U][de[U]]||(N[U]=0,de[U]=0);if(N.x>0||N.y>0){E(),K.current=ee,C(X,h),B.current=N,T.current=de;return}}B.current={x:0,y:0},T.current={x:0,y:0},E()},[t,X,a,E,c,h,JSON.stringify(Y),JSON.stringify(x),C,p,re,b,JSON.stringify(w)])}const uE={x:{[_i.Backward]:!1,[_i.Forward]:!1},y:{[_i.Backward]:!1,[_i.Forward]:!1}};function hE(e){let{delta:t,disabled:n}=e;const a=Uf(t);return Oo(o=>{if(n||!a||!o)return uE;const c={x:Math.sign(t.x-a.x),y:Math.sign(t.y-a.y)};return{x:{[_i.Backward]:o.x[_i.Backward]||c.x===-1,[_i.Forward]:o.x[_i.Forward]||c.x===1},y:{[_i.Backward]:o.y[_i.Backward]||c.y===-1,[_i.Forward]:o.y[_i.Forward]||c.y===1}}},[n,t,a])}function dE(e,t){const n=t!=null?e.get(t):void 0,a=n?n.node.current:null;return Oo(o=>{var c;return t==null?null:(c=a??o)!=null?c:null},[a,t])}function fE(e,t){return g.useMemo(()=>e.reduce((n,a)=>{const{sensor:o}=a,c=o.activators.map(h=>({eventName:h.eventName,handler:t(h.handler,a)}));return[...n,...c]},[]),[e,t])}var So;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(So||(So={}));var qf;(function(e){e.Optimized="optimized"})(qf||(qf={}));const Zy=new Map;function pE(e,t){let{dragging:n,dependencies:a,config:o}=t;const[c,h]=g.useState(null),{frequency:f,measure:m,strategy:p}=o,b=g.useRef(e),y=B(),w=bo(y),x=g.useCallback(function(T){T===void 0&&(T=[]),!w.current&&h(Y=>Y===null?T:Y.concat(T.filter(K=>!Y.includes(K))))},[w]),C=g.useRef(null),E=Oo(T=>{if(y&&!n)return Zy;if(!T||T===Zy||b.current!==e||c!=null){const Y=new Map;for(let K of e){if(!K)continue;if(c&&c.length>0&&!c.includes(K.id)&&K.rect.current){Y.set(K.id,K.rect.current);continue}const X=K.node.current,re=X?new ym(m(X),X):null;K.rect.current=re,re&&Y.set(K.id,re)}return Y}return T},[e,c,n,y,m]);return g.useEffect(()=>{b.current=e},[e]),g.useEffect(()=>{y||x()},[n,y]),g.useEffect(()=>{c&&c.length>0&&h(null)},[JSON.stringify(c)]),g.useEffect(()=>{y||typeof f!="number"||C.current!==null||(C.current=setTimeout(()=>{x(),C.current=null},f))},[f,y,x,...a]),{droppableRects:E,measureDroppableContainers:x,measuringScheduled:c!=null};function B(){switch(p){case So.Always:return!1;case So.BeforeDragging:return n;default:return!n}}}function h0(e,t){return Oo(n=>e?n||(typeof t=="function"?t(e):e):null,[t,e])}function mE(e,t){return h0(e,t)}function _E(e){let{callback:t,disabled:n}=e;const a=vm(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 $u(e){let{callback:t,disabled:n}=e;const a=vm(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 vE(e){return new ym(zo(e),e)}function Qy(e,t,n){t===void 0&&(t=vE);const[a,o]=g.useState(null);function c(){o(m=>{if(!e)return null;if(e.isConnected===!1){var p;return(p=m??n)!=null?p:null}const b=t(e);return JSON.stringify(m)===JSON.stringify(b)?m:b})}const h=_E({callback(m){if(e)for(const p of m){const{type:b,target:y}=p;if(b==="childList"&&y instanceof HTMLElement&&y.contains(e)){c();break}}}}),f=$u({callback:c});return mr(()=>{c(),e?(f?.observe(e),h?.observe(document.body,{childList:!0,subtree:!0})):(f?.disconnect(),h?.disconnect())},[e]),a}function gE(e){const t=h0(e);return JS(e,t)}const Jy=[];function yE(e){const t=g.useRef(e),n=Oo(a=>e?a&&a!==Jy&&e&&t.current&&e.parentNode===t.current.parentNode?a:gm(e):Jy,[e]);return g.useEffect(()=>{t.current=e},[e]),n}function bE(e){const[t,n]=g.useState(null),a=g.useRef(e),o=g.useCallback(c=>{const h=ff(c.target);h&&n(f=>f?(f.set(h,If(h)),new Map(f)):null)},[]);return g.useEffect(()=>{const c=a.current;if(e!==c){h(c);const f=e.map(m=>{const p=ff(m);return p?(p.addEventListener("scroll",o,{passive:!0}),[p,If(p)]):null}).filter(m=>m!=null);n(f.length?new Map(f):null),a.current=e}return()=>{h(e),h(c)};function h(f){f.forEach(m=>{const p=ff(m);p?.removeEventListener("scroll",o)})}},[o,e]),g.useMemo(()=>e.length?t?Array.from(t.values()).reduce((c,h)=>qa(c,h),Ys):r0(e):Ys,[e,t])}function eb(e,t){t===void 0&&(t=[]);const n=g.useRef(null);return g.useEffect(()=>{n.current=null},t),g.useEffect(()=>{const a=e!==Ys;a&&!n.current&&(n.current=e),!a&&n.current&&(n.current=null)},[e]),n.current?Tu(e,n.current):Ys}function SE(e){g.useEffect(()=>{if(!qu)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 wE(e,t){return g.useMemo(()=>e.reduce((n,a)=>{let{eventName:o,handler:c}=a;return n[o]=h=>{c(h,t)},n},{}),[e,t])}function d0(e){return g.useMemo(()=>e?Vx(e):null,[e])}const tb=[];function CE(e,t){t===void 0&&(t=zo);const[n]=e,a=d0(n?rs(n):null),[o,c]=g.useState(tb);function h(){c(()=>e.length?e.map(m=>s0(m)?a:new ym(t(m),m)):tb)}const f=$u({callback:h});return mr(()=>{f?.disconnect(),h(),e.forEach(m=>f?.observe(m))},[e]),o}function xE(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return Bo(t)?t:e}function EE(e){let{measure:t}=e;const[n,a]=g.useState(null),o=g.useCallback(p=>{for(const{target:b}of p)if(Bo(b)){a(y=>{const w=t(b);return y?{...y,width:w.width,height:w.height}:w});break}},[t]),c=$u({callback:o}),h=g.useCallback(p=>{const b=xE(p);c?.disconnect(),b&&c?.observe(b),a(b?t(b):null)},[t,c]),[f,m]=Eu(h);return g.useMemo(()=>({nodeRef:f,rect:n,setRef:m}),[n,f,m])}const TE=[{sensor:o0,options:{}},{sensor:l0,options:{}}],kE={current:{}},du={draggable:{measure:Yy},droppable:{measure:Yy,strategy:So.WhileDragging,frequency:qf.Optimized},dragOverlay:{measure:zo}};class po 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 DE={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new po,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:ku},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:du,measureDroppableContainers:ku,windowRect:null,measuringScheduled:!1},RE={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:ku,draggableNodes:new Map,over:null,measureDroppableContainers:ku},Yu=g.createContext(RE),ME=g.createContext(DE);function NE(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new po}}}function AE(e,t){switch(t.type){case ui.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case ui.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 ui.DragEnd:case ui.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case ui.RegisterDroppable:{const{element:n}=t,{id:a}=n,o=new po(e.droppable.containers);return o.set(a,n),{...e,droppable:{...e.droppable,containers:o}}}case ui.SetDroppableDisabled:{const{id:n,key:a,disabled:o}=t,c=e.droppable.containers.get(n);if(!c||a!==c.key)return e;const h=new po(e.droppable.containers);return h.set(n,{...c,disabled:o}),{...e,droppable:{...e.droppable,containers:h}}}case ui.UnregisterDroppable:{const{id:n,key:a}=t,o=e.droppable.containers.get(n);if(!o||a!==o.key)return e;const c=new po(e.droppable.containers);return c.delete(n),{...e,droppable:{...e.droppable,containers:c}}}default:return e}}function LE(e){let{disabled:t}=e;const{active:n,activatorEvent:a,draggableNodes:o}=g.useContext(Yu),c=Uf(a),h=Uf(n?.id);return g.useEffect(()=>{if(!t&&!a&&c&&h!=null){if(!ZS(c)||document.activeElement===c.target)return;const f=o.get(h);if(!f)return;const{activatorNode:m,node:p}=f;if(!m.current&&!p.current)return;requestAnimationFrame(()=>{for(const b of[m.current,p.current]){if(!b)continue;const y=kx(b);if(y){y.focus();break}}})}},[a,t,o,h,c]),null}function BE(e,t){let{transform:n,...a}=t;return e!=null&&e.length?e.reduce((o,c)=>c({transform:o,...a}),n):n}function OE(e){return g.useMemo(()=>({draggable:{...du.draggable,...e?.draggable},droppable:{...du.droppable,...e?.droppable},dragOverlay:{...du.dragOverlay,...e?.dragOverlay}}),[e?.draggable,e?.droppable,e?.dragOverlay])}function zE(e){let{activeNode:t,measure:n,initialRect:a,config:o=!0}=e;const c=g.useRef(!1),{x:h,y:f}=typeof o=="boolean"?{x:o,y:o}:o;mr(()=>{if(!h&&!f||!t){c.current=!1;return}if(c.current||!a)return;const p=t?.node.current;if(!p||p.isConnected===!1)return;const b=n(p),y=JS(b,a);if(h||(y.x=0),f||(y.y=0),c.current=!0,Math.abs(y.x)>0||Math.abs(y.y)>0){const w=e0(p);w&&w.scrollBy({top:y.y,left:y.x})}},[t,h,f,a,n])}const f0=g.createContext({...Ys,scaleX:1,scaleY:1});var ur;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(ur||(ur={}));const jE=g.memo(function(t){var n,a,o,c;let{id:h,accessibility:f,autoScroll:m=!0,children:p,sensors:b=TE,collisionDetection:y=Kx,measuring:w,modifiers:x,...C}=t;const E=g.useReducer(AE,void 0,NE),[B,T]=E,[Y,K]=Lx(),[X,re]=g.useState(ur.Uninitialized),ee=X===ur.Initialized,{draggable:{active:ie,nodes:le,translate:de},droppable:{containers:N}}=B,U=ie!=null?le.get(ie):null,P=g.useRef({initial:null,translated:null}),j=g.useMemo(()=>{var _t;return ie!=null?{id:ie,data:(_t=U?.data)!=null?_t:kE,rect:P}:null},[ie,U]),z=g.useRef(null),[G,M]=g.useState(null),[q,V]=g.useState(null),_e=bo(C,Object.values(C)),be=Wu("DndDescribedBy",h),D=g.useMemo(()=>N.getEnabled(),[N]),W=OE(w),{droppableRects:ne,measureDroppableContainers:he,measuringScheduled:ge}=pE(D,{dragging:ee,dependencies:[de.x,de.y],config:W.droppable}),pe=dE(le,ie),ke=g.useMemo(()=>q?Pf(q):null,[q]),me=Ss(),Se=mE(pe,W.draggable.measure);zE({activeNode:ie!=null?le.get(ie):null,config:me.layoutShiftCompensation,initialRect:Se,measure:W.draggable.measure});const Me=Qy(pe,W.draggable.measure,Se),Ue=Qy(pe?pe.parentElement:null),Ke=g.useRef({activatorEvent:null,active:null,activeNode:pe,collisionRect:null,collisions:null,droppableRects:ne,draggableNodes:le,draggingNode:null,draggingNodeRect:null,droppableContainers:N,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),we=N.getNodeFor((n=Ke.current.over)==null?void 0:n.id),te=EE({measure:W.dragOverlay.measure}),De=(a=te.nodeRef.current)!=null?a:pe,Ce=ee?(o=te.rect)!=null?o:Me:null,Pe=!!(te.nodeRef.current&&te.rect),$e=gE(Pe?null:Me),bt=d0(De?rs(De):null),ht=yE(ee?we??pe:null),Si=CE(ht),J=BE(x,{transform:{x:de.x-$e.x,y:de.y-$e.y,scaleX:1,scaleY:1},activatorEvent:q,active:j,activeNodeRect:Me,containerNodeRect:Ue,draggingNodeRect:Ce,over:Ke.current.over,overlayNodeRect:te.rect,scrollableAncestors:ht,scrollableAncestorRects:Si,windowRect:bt}),Fe=ke?qa(ke,de):null,Oe=bE(ht),Tt=eb(Oe),ji=eb(Oe,[Me]),Ai=qa(J,Tt),$t=Ce?qx(Ce,J):null,Vi=j&&$t?y({active:j,collisionRect:$t,droppableRects:ne,droppableContainers:D,pointerCoordinates:Fe}):null,Li=Ux(Vi,"id"),[Xi,Vs]=g.useState(null),as=Pe?J:qa(J,ji),Pt=Ix(as,(c=Xi?.rect)!=null?c:null,Me),wi=g.useRef(null),Lt=g.useCallback((_t,St)=>{let{sensor:Bt,options:ii}=St;if(z.current==null)return;const kt=le.get(z.current);if(!kt)return;const Yt=_t.nativeEvent,si=new Bt({active:z.current,activeNode:kt,event:Yt,options:ii,context:Ke,onAbort(wt){if(!le.get(wt))return;const{onDragAbort:Kt}=_e.current,Ei={id:wt};Kt?.(Ei),Y({type:"onDragAbort",event:Ei})},onPending(wt,Ui,Kt,Ei){if(!le.get(wt))return;const{onDragPending:Pi}=_e.current,Ti={id:wt,constraint:Ui,initialCoordinates:Kt,offset:Ei};Pi?.(Ti),Y({type:"onDragPending",event:Ti})},onStart(wt){const Ui=z.current;if(Ui==null)return;const Kt=le.get(Ui);if(!Kt)return;const{onDragStart:Ei}=_e.current,lt={activatorEvent:Yt,active:{id:Ui,data:Kt.data,rect:P}};so.unstable_batchedUpdates(()=>{Ei?.(lt),re(ur.Initializing),T({type:ui.DragStart,initialCoordinates:wt,active:Ui}),Y({type:"onDragStart",event:lt}),M(wi.current),V(Yt)})},onMove(wt){T({type:ui.DragMove,coordinates:wt})},onEnd:xi(ui.DragEnd),onCancel:xi(ui.DragCancel)});wi.current=si;function xi(wt){return async function(){const{active:Kt,collisions:Ei,over:lt,scrollAdjustedTranslate:Pi}=Ke.current;let Ti=null;if(Kt&&Pi){const{cancelDrop:Ki}=_e.current;Ti={activatorEvent:Yt,active:Kt,collisions:Ei,delta:Pi,over:lt},wt===ui.DragEnd&&typeof Ki=="function"&&await Promise.resolve(Ki(Ti))&&(wt=ui.DragCancel)}z.current=null,so.unstable_batchedUpdates(()=>{T({type:wt}),re(ur.Uninitialized),Vs(null),M(null),V(null),wi.current=null;const Ki=wt===ui.DragEnd?"onDragEnd":"onDragCancel";if(Ti){const st=_e.current[Ki];st?.(Ti),Y({type:Ki,event:Ti})}})}}},[le]),Ci=g.useCallback((_t,St)=>(Bt,ii)=>{const kt=Bt.nativeEvent,Yt=le.get(ii);if(z.current!==null||!Yt||kt.dndKit||kt.defaultPrevented)return;const si={active:Yt};_t(Bt,St.options,si)===!0&&(kt.dndKit={capturedBy:St.sensor},z.current=ii,Lt(Bt,St))},[le,Lt]),Hi=fE(b,Ci);SE(b),mr(()=>{Me&&X===ur.Initializing&&re(ur.Initialized)},[Me,X]),g.useEffect(()=>{const{onDragMove:_t}=_e.current,{active:St,activatorEvent:Bt,collisions:ii,over:kt}=Ke.current;if(!St||!Bt)return;const Yt={active:St,activatorEvent:Bt,collisions:ii,delta:{x:Ai.x,y:Ai.y},over:kt};so.unstable_batchedUpdates(()=>{_t?.(Yt),Y({type:"onDragMove",event:Yt})})},[Ai.x,Ai.y]),g.useEffect(()=>{const{active:_t,activatorEvent:St,collisions:Bt,droppableContainers:ii,scrollAdjustedTranslate:kt}=Ke.current;if(!_t||z.current==null||!St||!kt)return;const{onDragOver:Yt}=_e.current,si=ii.get(Li),xi=si&&si.rect.current?{id:si.id,rect:si.rect.current,data:si.data,disabled:si.disabled}:null,wt={active:_t,activatorEvent:St,collisions:Bt,delta:{x:kt.x,y:kt.y},over:xi};so.unstable_batchedUpdates(()=>{Vs(xi),Yt?.(wt),Y({type:"onDragOver",event:wt})})},[Li]),mr(()=>{Ke.current={activatorEvent:q,active:j,activeNode:pe,collisionRect:$t,collisions:Vi,droppableRects:ne,draggableNodes:le,draggingNode:De,draggingNodeRect:Ce,droppableContainers:N,over:Xi,scrollableAncestors:ht,scrollAdjustedTranslate:Ai},P.current={initial:Ce,translated:$t}},[j,pe,Vi,$t,le,De,Ce,ne,N,Xi,ht,Ai]),cE({...me,delta:de,draggingRect:$t,pointerCoordinates:Fe,scrollableAncestors:ht,scrollableAncestorRects:Si});const ln=g.useMemo(()=>({active:j,activeNode:pe,activeNodeRect:Me,activatorEvent:q,collisions:Vi,containerNodeRect:Ue,dragOverlay:te,draggableNodes:le,droppableContainers:N,droppableRects:ne,over:Xi,measureDroppableContainers:he,scrollableAncestors:ht,scrollableAncestorRects:Si,measuringConfiguration:W,measuringScheduled:ge,windowRect:bt}),[j,pe,Me,q,Vi,Ue,te,le,N,ne,Xi,he,ht,Si,W,ge,bt]),bs=g.useMemo(()=>({activatorEvent:q,activators:Hi,active:j,activeNodeRect:Me,ariaDescribedById:{draggable:be},dispatch:T,draggableNodes:le,over:Xi,measureDroppableContainers:he}),[q,Hi,j,Me,T,be,le,Xi,he]);return ei.createElement(QS.Provider,{value:K},ei.createElement(Yu.Provider,{value:bs},ei.createElement(ME.Provider,{value:ln},ei.createElement(f0.Provider,{value:Pt},p)),ei.createElement(LE,{disabled:f?.restoreFocus===!1})),ei.createElement(zx,{...f,hiddenTextDescribedById:be}));function Ss(){const _t=G?.autoScrollEnabled===!1,St=typeof m=="object"?m.enabled===!1:m===!1,Bt=ee&&!_t&&!St;return typeof m=="object"?{...m,enabled:Bt}:{enabled:Bt}}}),HE=g.createContext(null),ib="button",UE="Draggable";function p0(e){let{id:t,data:n,disabled:a=!1,attributes:o}=e;const c=Wu(UE),{activators:h,activatorEvent:f,active:m,activeNodeRect:p,ariaDescribedById:b,draggableNodes:y,over:w}=g.useContext(Yu),{role:x=ib,roleDescription:C="draggable",tabIndex:E=0}=o??{},B=m?.id===t,T=g.useContext(B?f0:HE),[Y,K]=Eu(),[X,re]=Eu(),ee=wE(h,t),ie=bo(n);mr(()=>(y.set(t,{id:t,key:c,node:Y,activatorNode:X,data:ie}),()=>{const de=y.get(t);de&&de.key===c&&y.delete(t)}),[y,t]);const le=g.useMemo(()=>({role:x,tabIndex:E,"aria-disabled":a,"aria-pressed":B&&x===ib?!0:void 0,"aria-roledescription":C,"aria-describedby":b.draggable}),[a,x,E,B,C,b.draggable]);return{active:m,activatorEvent:f,activeNodeRect:p,attributes:le,isDragging:B,listeners:a?void 0:ee,node:Y,over:w,setNodeRef:K,setActivatorNodeRef:re,transform:T}}const PE="Droppable",KE={timeout:25};function m0(e){let{data:t,disabled:n=!1,id:a,resizeObserverConfig:o}=e;const c=Wu(PE),{active:h,dispatch:f,over:m,measureDroppableContainers:p}=g.useContext(Yu),b=g.useRef({disabled:n}),y=g.useRef(!1),w=g.useRef(null),x=g.useRef(null),{disabled:C,updateMeasurementsFor:E,timeout:B}={...KE,...o},T=bo(E??a),Y=g.useCallback(()=>{if(!y.current){y.current=!0;return}x.current!=null&&clearTimeout(x.current),x.current=setTimeout(()=>{p(Array.isArray(T.current)?T.current:[T.current]),x.current=null},B)},[B]),K=$u({callback:Y,disabled:C||!h}),X=g.useCallback((le,de)=>{K&&(de&&(K.unobserve(de),y.current=!1),le&&K.observe(le))},[K]),[re,ee]=Eu(X),ie=bo(t);return g.useEffect(()=>{!K||!re.current||(K.disconnect(),y.current=!1,K.observe(re.current))},[re,K]),g.useEffect(()=>(f({type:ui.RegisterDroppable,element:{id:a,key:c,disabled:n,node:re,rect:w,data:ie}}),()=>f({type:ui.UnregisterDroppable,key:c,id:a})),[a]),g.useEffect(()=>{n!==b.current.disabled&&(f({type:ui.SetDroppableDisabled,id:a,key:c,disabled:n}),b.current.disabled=n)},[a,c,n,f]),{active:h,rect:w,isOver:m?.id===a,node:re,over:m,setNodeRef:ee}}const IE=128,FE=512,qE=64,WE=4096;function _0(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>IE)return null;const n=t.workspaces.map($E);return n.some(a=>a===null)?null:{activeWorkspaceId:t.activeWorkspaceId,workspaces:n}}function $E(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>FE)return null;const n=t.tabs.map(YE);return n.some(a=>a===null)?null:{id:t.id,title:t.title,activeTabId:t.activeTabId,tabs:n}}function YE(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=VE(t.root);return n?{id:t.id,title:t.title,activeTerminalId:t.activeTerminalId,root:n}:null}function VE(e){if(!e||typeof e!="object")return null;let t=0;return Wf(e,1,()=>(t+=1,t<=WE))}function Wf(e,t,n){if(!e||typeof e!="object"||t>qE||!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=Wf(a.first,t+1,n),c=Wf(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 v0=[{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 sb(e){return e===void 0?"unknown":e==="error"?"offline":"ok"}function nb(e){const t=e.trim();return t?t.charAt(0).toUpperCase():"?"}const rb="Local",GE=3e4,g0="nterminal.serverList.viewMode.v1";function ZE(){try{return window.localStorage.getItem(g0)==="list"?"list":"stats"}catch{return"stats"}}function QE(e){try{window.localStorage.setItem(g0,e)}catch{}}function fu(e){return e===void 0?"":e==="error"?"offline":[`CPU ${js(e.cpuPercent)} ${Sm(e)}`,`MEM ${js(e.memoryPercent)} ${Nn(e.memoryUsedBytes,e.memoryTotalBytes)}`,`DISK ${js(e.diskPercent)} ${Nn(e.diskUsedBytes,e.diskTotalBytes)}`,`SWAP ${js(e.swapPercent)} ${Nn(e.swapUsedBytes,e.swapTotalBytes)}`].join(" · ")}function JE(e){if(!(e===void 0||e==="error"))return[`CPU ${js(e.cpuPercent)} (${Sm(e)})`,`RAM ${js(e.memoryPercent)} (${Nn(e.memoryUsedBytes,e.memoryTotalBytes)})`,`Disk ${js(e.diskPercent)} (${Nn(e.diskUsedBytes,e.diskTotalBytes)})`,`Swap ${js(e.swapPercent)} (${Nn(e.swapUsedBytes,e.swapTotalBytes)})`].join(" · ")}function ab(e,t){const n=fu(t);return`${e}${n?` — ${n}`:""}. Double-click to rename.`}function js(e){return typeof e=="number"&&Number.isFinite(e)?`${Math.round(e)}%`:"–"}function Sm(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`:`${$f(e.cpuPercent/100*t)}/${t} cores`}function Nn(e,t){return!lb(e)||!lb(t)?"–/–":e2(e,t)}function e2(e,t){const n=t>=1073741824?"GB":t>=1048576?"MB":"KB",a=n==="GB"?1024**3:n==="MB"?1024**2:1024;return`${$f(e/a)}/${$f(t/a)} ${n}`}function $f(e){return e>=10||Number.isInteger(e)?e.toFixed(0):e.toFixed(1)}function lb(e){return typeof e=="number"&&Number.isFinite(e)&&e>=0}function Qc(e){return typeof e!="number"||!Number.isFinite(e)?"normal":e>95?"danger":e>90?"warning":"normal"}function t2(e){return[{label:"CPU",percent:js(e.cpuPercent),detail:Sm(e),tone:Qc(e.cpuPercent)},{label:"MEM",percent:js(e.memoryPercent),detail:Nn(e.memoryUsedBytes,e.memoryTotalBytes),tone:Qc(e.memoryPercent)},{label:"DISK",percent:js(e.diskPercent),detail:Nn(e.diskUsedBytes,e.diskTotalBytes),tone:Qc(e.diskPercent)},{label:"SWAP",percent:js(e.swapPercent),detail:Nn(e.swapUsedBytes,e.swapTotalBytes),tone:Qc(e.swapPercent)}]}function ob({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:JE(e),children:t2(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","data-tone":t.tone,children:t.percent}),_.jsx("span",{className:"server-list-stat-detail",children:t.detail})]},t.label))})}function _f({api:e,activeAgentId:t,onSelectServer:n,onSessionInvalid:a,refreshToken:o=0,compact:c=!1}){const[h,f]=g.useState([]),[m,p]=g.useState(null),[b,y]=g.useState(null),[w,x]=g.useState(""),C=g.useRef(null),[E,B]=g.useState(()=>ZE()),[T,Y]=g.useState({});g.useEffect(()=>{let N=!1;return e.listAgents().then(U=>{N||f(U.agents)}).catch(()=>{}),e.getMainInfo().then(U=>{N||p(U.name)}).catch(()=>{}),()=>{N=!0}},[e,o]),g.useEffect(()=>{b&&(C.current?.focus(),C.current?.select())},[b]),g.useEffect(()=>{let N=!1;function U(){const j=[{key:"__main__",load:()=>e.getMainStats()},...h.map(G=>({key:G.id,load:()=>e.getAgentStats(G.id)}))],z=new Set(j.map(G=>G.key));Y(G=>{const M={};for(const q of z)q in G&&(M[q]=G[q]);return M});for(const G of j)G.load().then(M=>{N||Y(q=>z.has(G.key)?{...q,[G.key]:M}:q)}).catch(M=>{if(!N){if(M instanceof Mn&&M.status===401){a?.();return}Y(q=>z.has(G.key)?{...q,[G.key]:"error"}:q)}})}U();const P=window.setInterval(U,GE);return()=>{N=!0,window.clearInterval(P)}},[e,h,a]);function K(N){N==="main"?(x(m??""),y({kind:"main"})):(x(N.name),y({kind:"agent",id:N.id}))}async function X(){if(!b)return;const N=w.trim(),U=b;if(y(null),U.kind==="main"){const P=N||"";try{const j=await e.renameMain(P);p(j.name)}catch{}}else{if(!N)return;const P=h.find(j=>j.id===U.id)?.name;f(j=>j.map(z=>z.id===U.id?{...z,name:N}:z));try{await e.renameAgent(U.id,N)}catch{P!==void 0&&f(j=>j.map(z=>z.id===U.id?{...z,name:P}:z))}}}function re(){y(null)}function ee(N){B(N),QE(N)}const ie=m?.trim()||rb,le=b?.kind==="main",de=E==="stats";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":ie,title:`${ie}${fu(T.__main__)?` — ${fu(T.__main__)}`:""}`,children:[_.jsx("span",{className:"server-list-chip-initial",children:nb(ie)}),_.jsx("span",{className:"server-list-chip-pip","data-status":sb(T.__main__)})]}),h.map(N=>{const U=T[N.id],P=fu(U);return _.jsxs("button",{type:"button",className:`server-list-chip${t===N.id?" server-list-chip--active":""}`,onClick:()=>n(N.id),"aria-label":N.name,title:`${N.name}${P?` — ${P}`:""}`,children:[_.jsx("span",{className:"server-list-chip-initial",children:nb(N.name)}),_.jsx("span",{className:"server-list-chip-pip","data-status":sb(U)})]},N.id)})]}):_.jsxs("div",{className:`server-list server-list--${E}`,children:[_.jsxs("div",{className:"server-list-toolbar","aria-label":"Server list display",children:[_.jsx("button",{type:"button",className:"server-list-view-button","aria-pressed":E==="list",onClick:()=>ee("list"),title:"Show server names only",children:"List"}),_.jsx("button",{type:"button",className:"server-list-view-button","aria-pressed":E==="stats",onClick:()=>ee("stats"),title:"Show resource usage",children:"Stats"})]}),_.jsx("div",{className:"server-list-row",children:le?_.jsx("form",{className:"server-list-editor",onSubmit:N=>{N.preventDefault(),X()},children:_.jsx("input",{ref:C,"aria-label":"Rename main server",value:w,onChange:N=>x(N.target.value),onBlur:()=>{X()},onKeyDown:N=>{N.key==="Escape"&&(N.preventDefault(),re())},placeholder:rb})}):_.jsxs("button",{type:"button",className:`server-list-item${t===null?" server-list-item--active":""}`,onClick:()=>n(null),onDoubleClick:N=>{N.preventDefault(),K("main")},title:ab(ie,T.__main__),children:[_.jsxs("span",{className:"server-list-item-header",children:[_.jsx("span",{className:"server-list-dot"}),_.jsx("span",{className:"server-list-name",children:ie})]}),de?_.jsx(ob,{entry:T.__main__}):null]})}),h.map(N=>{const U=b?.kind==="agent"&&b.id===N.id;return _.jsx("div",{className:"server-list-row",children:U?_.jsx("form",{className:"server-list-editor",onSubmit:P=>{P.preventDefault(),X()},children:_.jsx("input",{ref:C,"aria-label":`Rename ${N.name}`,value:w,onChange:P=>x(P.target.value),onBlur:()=>{X()},onKeyDown:P=>{P.key==="Escape"&&(P.preventDefault(),re())}})}):_.jsxs("button",{type:"button",className:`server-list-item${t===N.id?" server-list-item--active":""}`,onClick:()=>n(N.id),onDoubleClick:P=>{P.preventDefault(),K({id:N.id,name:N.name})},title:ab(N.name,T[N.id]),children:[_.jsxs("span",{className:"server-list-item-header",children:[_.jsx("span",{className:"server-list-dot"}),_.jsx("span",{className:"server-list-name",title:N.url,children:N.name})]}),de?_.jsx(ob,{entry:T[N.id]}):null]})},N.id)})]})}function i2({api:e}){const[t,n]=g.useState([]),[a,o]=g.useState([]),[c,h]=g.useState(!1),[f,m]=g.useState(null),[p,b]=g.useState(""),[y,w]=g.useState("");async function x(){try{const[T,Y,K]=await Promise.all([e.listDevices(),e.listNetworks(),e.getSession()]);n(T.devices),o(Y.networks),h(K.totpEnabled),m(null)}catch(T){m(T instanceof Error?T.message:"Failed to load")}}g.useEffect(()=>{x()},[]);async function C(T){await e.revokeDevice(T),await x()}async function E(T){await e.removeNetwork(T),await x()}async function B(T){T.preventDefault(),m(null);try{await e.addNetwork({value:p.trim(),label:y.trim()}),b(""),w(""),await x()}catch(Y){m(Y instanceof Error?Y.message:"Failed to add network")}}return _.jsxs(_.Fragment,{children:[f?_.jsx("p",{className:"form-error",children:f}):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(T=>_.jsxs("li",{children:[_.jsxs("div",{children:[_.jsxs("span",{className:"security-item-label",children:[T.label,T.current?_.jsx("span",{className:"security-badge",children:"this device"}):null]}),_.jsxs("span",{className:"security-item-meta",children:["last seen ",new Date(T.lastSeenAt).toLocaleString()]})]}),_.jsx("button",{type:"button",className:"security-remove",onClick:()=>{C(T.id)},children:"revoke"})]},T.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(T=>_.jsxs("li",{children:[_.jsxs("div",{children:[_.jsx("span",{className:"security-item-label",children:T.value}),T.label!==T.value?_.jsx("span",{className:"security-item-meta",children:T.label}):null]}),_.jsx("button",{type:"button",className:"security-remove",onClick:()=>{E(T.id)},children:"remove"})]},T.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:p,onChange:T=>b(T.currentTarget.value),required:!0}),_.jsx("input",{type:"text",placeholder:"Label (optional)",value:y,onChange:T=>w(T.currentTarget.value)}),_.jsx("button",{type:"submit",disabled:!p.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 y0="nterminal.notifications.completionEnabled",wm="nterminal.notifications.completionToastEnabled",Cm="nterminal.notifications.completionToastDurationSeconds",xm="nterminal.notifications.completionToastPersistent",Yf="nterminal:completion-toast-display",mo=6.5,Vf=2,Xf=60;function Vu(){return typeof window<"u"&&"Notification"in window}function b0(){try{return window.localStorage.getItem(y0)==="true"}catch{return!1}}function cb(e){try{window.localStorage.setItem(y0,e?"true":"false")}catch{}}function Zr(){return{enabled:a2(),durationSeconds:r2(),persistUntilDismissed:l2()}}function s2(e){if(typeof window<"u"){try{window.localStorage.setItem(wm,e?"true":"false")}catch{}Tm()}return Zr()}function ub(e){const t=w0(e);if(typeof window<"u"){try{window.localStorage.setItem(Cm,String(t))}catch{}Tm()}return Zr()}function n2(e){if(typeof window<"u"){try{window.localStorage.setItem(xm,e?"true":"false")}catch{}Tm()}return Zr()}function S0(e){if(typeof window>"u")return()=>{};const t=n=>{(n.key===wm||n.key===Cm||n.key===xm)&&e()};return window.addEventListener(Yf,e),window.addEventListener("storage",t),()=>{window.removeEventListener(Yf,e),window.removeEventListener("storage",t)}}function Em(){return Vu()?window.Notification.permission:"unsupported"}function r2(){if(typeof window>"u")return mo;try{const e=window.localStorage.getItem(Cm);return e===null?mo:w0(Number(e))}catch{return mo}}function a2(){if(typeof window>"u")return!0;try{return window.localStorage.getItem(wm)!=="false"}catch{return!0}}function l2(){if(typeof window>"u")return!1;try{return window.localStorage.getItem(xm)==="true"}catch{return!1}}function w0(e){if(!Number.isFinite(e))return mo;const t=Math.round(e*2)/2;return Math.max(Vf,Math.min(Xf,t))}function Tm(){typeof window<"u"&&window.dispatchEvent(new CustomEvent(Yf))}async function o2(){if(!Vu())return"unsupported";try{return await window.Notification.requestPermission()}catch{return Em()}}function c2(e){if(!Vu()||Em()!=="granted"||!b0()||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 u2=1500,km="nterminal.terminal.fontSize",Dm="nterminal.terminal.fontFamily",Gf="nterminal:terminal-font-size",Zf="nterminal:terminal-font-family",Qf=11,Jf=20,Xr=14,Ru=[{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:[]}],$a="meslo";ep($a);async function vf(e=Xr,t=$a){if(typeof document>"u"||!document.fonts)return;const n=E0(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,u2)})])}function C0(e){const t=typeof e=="number"?e:Number(e);if(!Number.isFinite(t))return Xr;const n=Math.round(t);return Math.max(Qf,Math.min(Jf,n))}function x0(e){return Ru.some(t=>t.id===e)?e:$a}function ep(e){return E0(e).cssFamily}function E0(e){return Ru.find(t=>t.id===e)??Ru[0]}function tp(){if(typeof window>"u")return Xr;try{const e=window.localStorage.getItem(km);return e?C0(e):Xr}catch{return Xr}}function ip(){if(typeof window>"u")return $a;try{return x0(window.localStorage.getItem(Dm))}catch{return $a}}function Jc(e){const t=C0(e);if(typeof window>"u")return t;try{window.localStorage.setItem(km,String(t))}catch{}return window.dispatchEvent(new CustomEvent(Gf,{detail:t})),t}function h2(e){const t=x0(e);if(typeof window>"u")return t;try{window.localStorage.setItem(Dm,t)}catch{}return window.dispatchEvent(new CustomEvent(Zf,{detail:t})),t}function T0(e){if(typeof window>"u")return()=>{};const t=n=>{n.key===km&&e()};return window.addEventListener(Gf,e),window.addEventListener("storage",t),()=>{window.removeEventListener(Gf,e),window.removeEventListener("storage",t)}}function k0(e){if(typeof window>"u")return()=>{};const t=n=>{n.key===Dm&&e()};return window.addEventListener(Zf,e),window.addEventListener("storage",t),()=>{window.removeEventListener(Zf,e),window.removeEventListener("storage",t)}}const Rm="nterminal.terminal.showScrollProgress",sp="nterminal:terminal-scroll-progress";function np(){if(typeof window>"u")return!0;try{return window.localStorage.getItem(Rm)!=="false"}catch{return!0}}function d2(e){if(typeof window<"u"){try{window.localStorage.setItem(Rm,e?"true":"false")}catch{}window.dispatchEvent(new CustomEvent(sp,{detail:e}))}return e}function D0(e){if(typeof window>"u")return()=>{};const t=n=>{n.key===Rm&&e()};return window.addEventListener(sp,e),window.addEventListener("storage",t),()=>{window.removeEventListener(sp,e),window.removeEventListener("storage",t)}}const Mm="nterminal.shortcuts.workspace.v1",rp="nterminal:workspace-shortcuts",wo=[{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"}],Nm={"server.previous":zi("ArrowUp",{ctrlKey:!0}),"server.next":zi("ArrowDown",{ctrlKey:!0}),"tab.previous":zi("ArrowLeft",{ctrlKey:!0}),"tab.next":zi("ArrowRight",{ctrlKey:!0}),"tab.index":zi("Digit",{ctrlKey:!0,altKey:!0}),"pane.index":zi("Digit",{ctrlKey:!0,altKey:!0,shiftKey:!0}),"split.right":zi("ArrowRight",{ctrlKey:!0,altKey:!0,shiftKey:!0}),"split.down":zi("ArrowDown",{ctrlKey:!0,altKey:!0,shiftKey:!0})},f2={"server.previous":zi("BracketLeft",{ctrlKey:!0,altKey:!0,shiftKey:!0}),"server.next":zi("BracketRight",{ctrlKey:!0,altKey:!0,shiftKey:!0}),"tab.previous":zi("BracketLeft",{ctrlKey:!0,altKey:!0}),"tab.next":zi("BracketRight",{ctrlKey:!0,altKey:!0}),"tab.index":zi("Digit",{ctrlKey:!0,altKey:!0,shiftKey:!0}),"pane.index":zi("Digit",{ctrlKey:!0,altKey:!0}),"split.right":zi("ArrowRight",{ctrlKey:!0,altKey:!0,shiftKey:!0}),"split.down":zi("ArrowDown",{ctrlKey:!0,altKey:!0,shiftKey:!0})};function Qr(){const e=A0(Nm);if(typeof window>"u")return e;try{const t=window.localStorage.getItem(Mm);if(!t)return e;const n=JSON.parse(t);for(const a of wo){const o=n[a.id];if(w2(o)){const c=L0(o,a);S2(c,f2[a.id])||(e[a.id]=c)}}}catch{return e}return e}function hb(){return JSON.stringify(Qr())}function p2(e,t){const n=Qr(),a=wo.find(o=>o.id===e);return a&&(n[e]=L0(t,a),Am(n)),n}function m2(e){const t=Qr();return t[e]={...Nm[e]},Am(t),t}function _2(){const e=A0(Nm);return Am(e),e}function R0(e){if(typeof window>"u")return()=>{};const t=n=>{n.key===Mm&&e()};return window.addEventListener(rp,e),window.addEventListener("storage",t),()=>{window.removeEventListener(rp,e),window.removeEventListener("storage",t)}}function v2(e,t){const n=O0(e);return!n||x2(n)||t.indexed&&B0(e)===null?null:{ctrlKey:e.ctrlKey,altKey:e.altKey,shiftKey:e.shiftKey,metaKey:e.metaKey,code:t.indexed?"Digit":n}}function g2(e){const t=Qr();for(const n of wo){const a=t[n.id];if(!(!a||!C2(e,a))){if(n.indexed){if(a.code!=="Digit")continue;const o=B0(e);if(o!==null)return{id:n.id,index:o};continue}if(O0(e)===a.code)return{id:n.id,index:null}}}return null}function M0(e){return N0(Qr()[e])}function N0(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(E2(e.code)),t.join("+")}const y2=()=>M0("split.right"),b2=()=>M0("split.down");function zi(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 S2(e,t){return e.ctrlKey===t.ctrlKey&&e.altKey===t.altKey&&e.shiftKey===t.shiftKey&&e.metaKey===t.metaKey&&e.code===t.code}function Am(e){if(!(typeof window>"u")){try{window.localStorage.setItem(Mm,JSON.stringify(e))}catch{}window.dispatchEvent(new CustomEvent(rp))}}function L0(e,t){return{ctrlKey:!!e.ctrlKey,altKey:!!e.altKey,shiftKey:!!e.shiftKey,metaKey:!!e.metaKey,code:t.indexed?"Digit":e.code}}function w2(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 C2(e,t){return e.ctrlKey===t.ctrlKey&&e.altKey===t.altKey&&e.shiftKey===t.shiftKey&&e.metaKey===t.metaKey}function B0(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 O0(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 x2(e){return e==="ControlLeft"||e==="ControlRight"||e==="AltLeft"||e==="AltRight"||e==="ShiftLeft"||e==="ShiftRight"||e==="MetaLeft"||e==="MetaRight"}function E2(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 Lm="nterminal.theme.accent",ap="nterminal:theme-accent",Co=[{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"}],Mu="aqua";function jo(e){return Co.some(t=>t.id===e)?e:Mu}function Bm(e){return Co.find(t=>t.id===e)??Co[0]}function _r(){if(typeof window>"u")return Mu;try{return jo(window.localStorage.getItem(Lm))}catch{return Mu}}function T2(e){const t=jo(e);if(typeof window<"u"){try{window.localStorage.setItem(Lm,t)}catch{}Om(t),window.dispatchEvent(new CustomEvent(ap,{detail:t}))}return t}function Om(e=_r()){if(typeof document>"u")return;const t=Bm(jo(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 k2(e=_r()){return Bm(jo(e)).accent}function D2(e=_r()){return Bm(jo(e)).xtermSelection}function z0(e){if(typeof window>"u")return()=>{};const t=n=>{n.key===Lm&&(Om(_r()),e())};return window.addEventListener(ap,e),window.addEventListener("storage",t),()=>{window.removeEventListener(ap,e),window.removeEventListener("storage",t)}}const R2="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 M2(e="nterminal",t=new Date){return{reason:"permission",message:R2,command:`sudo npm i -g ${e}@latest --prefer-online && nterminal restart-after-update`,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 j0=3600*1e3,A2="local",lp=new Set,fr=new Map;let vr={checking:!1,hasUpdates:!1,lastCheckedAt:null},zm=null,_o=null,Nu=0,cr=null;function L2(e){return lp.add(e),()=>{lp.delete(e)}}function db(){return vr}function B2(e){const t=U2();zm=e,jm(),op(e,t);const n=()=>{if(document.visibilityState!=="visible"||!gr(e,t))return;const a=vr.lastCheckedAt;(a===null||Date.now()-a>=j0)&&op(e,t)};return document.addEventListener("visibilitychange",n),()=>{document.removeEventListener("visibilitychange",n),gr(e,t)&&H2()}}function O2(e,t){fr.set(e,H0(t)),Ya({...vr,hasUpdates:Hm(),lastCheckedAt:Date.now()})}function gf(e){e===void 0?fr.clear():fr.set(e,!1),Ya({...vr,hasUpdates:Hm()})}async function op(e,t){if(!gr(e,t))return;if(cr&&cr.api===e&&cr.runId===t)return cr.promise;Ya({...vr,checking:!0});const n=z2(e,t).finally(()=>{cr?.promise===n&&(cr=null),gr(e,t)&&(Ya({...vr,checking:!1,lastCheckedAt:Date.now()}),j2(e,t))});return cr={api:e,runId:t,promise:n},n}async function z2(e,t){try{const n=await e.listAgents();if(!gr(e,t))return;const a=[{key:A2,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 h=await c.check();o.set(c.key,H0(h))}catch{o.set(c.key,fr.get(c.key)??!1)}})),!gr(e,t))return;fr.clear();for(const[c,h]of o)fr.set(c,h);Ya({...vr,hasUpdates:Hm()})}catch{}}function j2(e,t){gr(e,t)&&(jm(),_o=window.setTimeout(()=>{_o=null,gr(e,t)&&op(e,t)},j0))}function H2(){Nu+=1,jm(),zm=null,cr=null,fr.clear(),Ya({checking:!1,hasUpdates:!1,lastCheckedAt:null})}function jm(){_o!==null&&(window.clearTimeout(_o),_o=null)}function U2(){return Nu+=1,Nu}function gr(e,t){return zm===e&&Nu===t}function H0(e){return e.updateAvailable===!0}function Hm(){return Array.from(fr.values()).some(Boolean)}function Ya(e){vr=e;for(const t of Array.from(lp))t()}const P2=e=>new Promise(t=>setTimeout(t,e));function K2({api:e,onAgentRemoved:t}){const[n,a]=g.useState([{key:"local",id:null,name:"Local (main)"}]),[o,c]=g.useState({}),[h,f]=g.useState(!1),[m,p]=g.useState(null),[b,y]=g.useState(!1);function w(N,U){c(P=>({...P,[N]:{...P[N],...U}}))}const x=N=>N.id===null?e.getVersion():e.getAgentVersion(N.id),C=N=>N.id===null?e.checkUpdate():e.checkAgentUpdate(N.id),E=N=>N.id===null?e.runUpdate():e.runAgentUpdate(N.id);g.useEffect(()=>{let N=!1;return e.listAgents().then(U=>{if(N)return;const P=[{key:"local",id:null,name:"Local (main)"},...U.agents.map(j=>({key:j.id,id:j.id,name:j.name}))];a(P);for(const j of P)x(j).then(z=>w(j.key,{version:z,manualUpdate:z.manualUpdate??null})).catch(z=>w(j.key,{error:z instanceof Error?z.message:"unreachable"}))}).catch(()=>{}),()=>{N=!0}},[]);async function B(N){w(N.key,{busy:!0,status:"checking…",error:void 0});try{const U=await C(N);O2(N.key,U),w(N.key,{latestVersion:U.latestVersion,updateAvailable:U.updateAvailable,status:ie(U),...U.updateAvailable===!1?{manualUpdate:null}:{},busy:!1})}catch(U){w(N.key,{busy:!1,error:U instanceof Error?U.message:"check failed"})}}async function T(){f(!0),await Promise.all(n.map(N=>B(N))),f(!1)}async function Y(N,U){const P=Date.now()+18e4;for(;Date.now()<P;){await P2(3e3);try{const j=await x(N);if(U&&j.runningVersion!==U.runningVersion)return j}catch{}}return null}async function K(N){let U=o[N.key]?.version;if(!U)try{U=await x(N),w(N.key,{version:U,manualUpdate:U.manualUpdate??null})}catch(z){return w(N.key,{busy:!1,error:z instanceof Error?z.message:"version check failed"}),"failed"}w(N.key,{busy:!0,status:"updating…",error:void 0});let P;try{P=await E(N)}catch(z){return w(N.key,{busy:!1,error:z instanceof Error?z.message:"update failed"}),"failed"}if(!P.ok){const z=P.manualUpdate??(N2(P.message)?M2():null);return z?(w(N.key,{busy:!1,status:"manual update required",error:void 0,manualUpdate:z}),"manual"):(w(N.key,{busy:!1,status:void 0,error:P.message}),"failed")}if(!P.changed)return w(N.key,{busy:!1,status:"already up to date",updateAvailable:!1,manualUpdate:null}),gf(N.key),"unchanged";w(N.key,{status:"restarting…"});const j=await Y(N,U);return j?(w(N.key,{busy:!1,version:j,updateAvailable:!1,status:"updated",manualUpdate:j.manualUpdate??null}),gf(N.key),N.id===null&&(y(!0),p("Main server updated. Reload the page to use the new client.")),"updated"):(w(N.key,{busy:!1,status:void 0,error:"timed out — check the server log"}),"failed")}async function X(N){if(!(N.id===null||!window.confirm([`Delete secondary server "${N.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(`
|
|
15
|
-
`)))){w(N.key,{busy:!0,status:"deleting…",error:void 0}),p(null);try{const P=await e.uninstallAgent(N.id);a(j=>j.filter(z=>z.key!==N.key)),c(j=>{const z={...j};return delete z[N.key],z}),gf(N.key),t?.(N.id),p(P.message)}catch(P){w(N.key,{busy:!1,status:void 0,error:P instanceof Error?P.message:"delete failed"})}}}async function re(){f(!0),p(null);const N=n.filter(M=>M.id!==null),U=n.find(M=>M.id===null),P=await Promise.all(N.map(M=>K(M))),j=P.filter(M=>M==="failed").length;let z=P.filter(M=>M==="manual").length,G=null;if(U&&(G=await K(U),G==="manual"&&(z+=1),G==="updated")){j>0&&p("Main server updated. Reload the page to use the new client. Some secondary servers failed; check their rows and retry."),f(!1);return}j>0&&z>0?p("Some servers failed and some need manual update. Check each marked row."):j>0?p("Some secondary servers failed to update. Check their rows and retry."):z>0&&p("Some servers need manual update. Copy and run the command shown on each marked server."),f(!1)}function ee(N){return N?N.error?N.error:N.status?N.status:N.manualUpdate?"manual update required":N.version?`v${N.version.version}`:"…":"…"}function ie(N){return N.error?N.error:typeof N.updateAvailable=="boolean"?N.updateAvailable?`latest v${N.latestVersion??"available"}`:"up to date":"unknown"}function le(N){const U=N?.version;return U?`npm package v${U.runningVersion}`:""}async function de(N,U){try{await I2(U),w(N,{copiedCommand:!0}),window.setTimeout(()=>w(N,{copiedCommand:!1}),1800)}catch(P){w(N,{error:P instanceof Error?P.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:()=>{T()},disabled:h,children:"Check for updates"}),_.jsx("button",{type:"button",onClick:()=>{re()},disabled:h,children:"Update all"})]}),m?_.jsx("p",{className:"settings-status",children:m}):null,b?_.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(N=>{const U=o[N.key],P=le(U),j=U?.manualUpdate??null,z=U?.version!==void 0&&U?.updateAvailable!==!1&&!U?.busy&&!h,G=N.id!==null&&!U?.busy&&!h;return _.jsxs("li",{children:[_.jsxs("div",{className:"server-row-main",children:[_.jsxs("div",{children:[_.jsx("span",{className:"security-item-label",children:N.name}),_.jsxs("span",{className:"security-item-meta",children:[P?`${P} — `:"",ee(U)]})]}),j?_.jsxs("div",{className:"server-manual-update",children:[_.jsx("span",{children:j.message}),_.jsxs("div",{className:"server-manual-command",children:[_.jsx("code",{children:j.command}),_.jsx("button",{type:"button",className:"secondary-button",onClick:()=>{de(N.key,j.command)},children:U?.copiedCommand?"Copied":"Copy"})]})]}):null]}),_.jsxs("div",{className:"server-row-actions",children:[_.jsx("button",{type:"button",className:"secondary-button",onClick:()=>{K(N)},disabled:!z,children:U?.busy?"…":"Update"}),N.id!==null?_.jsx("button",{type:"button",className:"server-delete-button",onClick:()=>{X(N)},disabled:!G,children:"Delete"}):null]})]},N.key)})})]})}async function I2(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 eu=[{id:"terminal",label:"Terminal"},{id:"shortcuts",label:"Shortcuts"},{id:"notifications",label:"Notifications"},{id:"security",label:"Security"},{id:"servers",label:"Servers"}];function F2({onClose:e,api:t,updateAvailable:n=!1,onNotificationAssetsChanged:a,onAgentRemoved:o}){const c=g.useMemo(()=>t??Fu(),[t]),[h,f]=g.useState(()=>tp()),[m,p]=g.useState(()=>ip()),[b,y]=g.useState(()=>np()),[w,x]=g.useState(()=>_r()),[C,E]=g.useState(()=>Qr()),[B,T]=g.useState(null),[Y,K]=g.useState(null),[X,re]=g.useState("terminal"),[ee,ie]=g.useState(()=>b0()),[le,de]=g.useState(()=>Zr()),[N,U]=g.useState(()=>Em()),[P,j]=g.useState([]),[z,G]=g.useState([]),[M,q]=g.useState([]),[V,_e]=g.useState(5*1024*1024),[be,D]=g.useState(!1),[W,ne]=g.useState(null),he=g.useRef(null),ge=g.useRef(null),pe=g.useRef({terminal:null,shortcuts:null,notifications:null,security:null,servers:null}),ke=g.useMemo(()=>new Set(z),[z]),me=!q2(z,M);g.useEffect(()=>T0(()=>f(tp())),[]),g.useEffect(()=>k0(()=>p(ip())),[]),g.useEffect(()=>D0(()=>y(np())),[]),g.useEffect(()=>z0(()=>x(_r())),[]),g.useEffect(()=>R0(()=>E(Qr())),[]),g.useEffect(()=>S0(()=>de(Zr())),[]),g.useEffect(()=>{if(!B)return;const J=wo.find(Oe=>Oe.id===B);if(!J)return;const Fe=Oe=>{if(Oe.preventDefault(),Oe.stopPropagation(),Oe.key==="Escape"){T(null),K(null);return}const Tt=v2(Oe,J);if(!Tt){K(J.indexed?"Press a shortcut ending in a number from 1 to 9.":"Press a complete shortcut.");return}E(p2(B,Tt)),T(null),K(null)};return window.addEventListener("keydown",Fe,!0),()=>window.removeEventListener("keydown",Fe,!0)},[B]),g.useEffect(()=>{let J=!1;return c.listNotificationAssets().then(Fe=>{J||De(Fe)}).catch(Fe=>{J||ne(tu(Fe))}),()=>{J=!0}},[c]);function Se(J){f(Jc(Number(J)))}function Me(J){de(ub(Number(J)))}function Ue(J){re(J);const Fe=ge.current,Oe=pe.current[J];if(!Fe||!Oe)return;const Tt=Math.max(0,fb(Oe,Fe)-12);typeof Fe.scrollTo=="function"?Fe.scrollTo({top:Tt,behavior:"smooth"}):Fe.scrollTop=Tt}function Ke(){const J=ge.current;if(!J)return;if(J.scrollTop+J.clientHeight>=J.scrollHeight-2){re(eu[eu.length-1].id);return}let Fe="terminal";const Oe=J.scrollTop+Math.min(180,Math.max(48,J.clientHeight*.28));for(const Tt of eu){const ji=pe.current[Tt.id];ji&&fb(ji,J)<=Oe&&(Fe=Tt.id)}re(Fe)}function we(J){E(m2(J)),T(null),K(null)}function te(){E(_2()),T(null),K(null)}function De(J){const Fe=J.assets.filter(Oe=>Oe.enabled).map(Oe=>Oe.id);j(J.assets),G(Fe),q(Fe),_e(J.maxFileBytes),ne(null)}async function Ce(){if(ee){cb(!1),ie(!1);return}let J=N;J==="default"&&(J=await o2(),U(J)),J==="granted"&&(cb(!0),ie(!0))}async function Pe(J){const Fe=J?.[0];if(Fe){if(Fe.size>V){ne(`File must be ${yf(V)} or smaller.`),bt();return}if(Fe.type!=="video/mp4"&&Fe.type!=="video/webm"){ne("Upload an MP4 or WebM video."),bt();return}D(!0),ne(null);try{await c.uploadNotificationAsset(Fe),De(await c.listNotificationAssets()),a?.()}catch(Oe){ne(tu(Oe))}finally{D(!1),bt()}}}async function $e(J){D(!0),ne(null);try{await c.deleteNotificationAsset(J),De(await c.listNotificationAssets()),a?.()}catch(Fe){ne(tu(Fe))}finally{D(!1)}}function bt(){he.current&&(he.current.value="")}function ht(J,Fe){const Oe=new Set(z);if(Fe?Oe.add(J):Oe.delete(J),Oe.size===0){ne("Keep at least one toast video selected.");return}ne(null),G(Array.from(Oe))}async function Si(){if(z.length===0){ne("Keep at least one toast video selected.");return}D(!0),ne(null);try{const J=await c.updateNotificationAssetSelection({enabledAssetIds:z});De(J),a?.()}catch(J){ne(tu(J))}finally{D(!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:J=>J.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:eu.map(J=>_.jsxs("button",{type:"button","data-active":X===J.id?"true":"false","aria-current":X===J.id?"true":void 0,onClick:()=>Ue(J.id),children:[J.label,J.id==="servers"&&n?_.jsx("span",{className:"update-pulse-dot settings-update-dot","aria-hidden":"true"}):null]},J.id))}),_.jsxs("div",{ref:ge,className:"settings-content",onScroll:Ke,children:[_.jsxs("section",{id:"settings-terminal",ref:J=>{pe.current.terminal=J},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:[h,"px"]}),_.jsx("input",{type:"range",min:Qf,max:Jf,step:1,value:h,"aria-label":"Terminal font size",onChange:J=>Se(J.currentTarget.value)})]}),_.jsxs("div",{className:"settings-stepper-row",children:[_.jsx("button",{type:"button",className:"secondary-button settings-stepper-button",onClick:()=>f(Jc(h-1)),children:"-"}),_.jsx("input",{type:"number",min:Qf,max:Jf,step:1,value:h,"aria-label":"Terminal font size value",onChange:J=>Se(J.currentTarget.value)}),_.jsx("button",{type:"button",className:"secondary-button settings-stepper-button",onClick:()=>f(Jc(h+1)),children:"+"}),_.jsx("button",{type:"button",className:"secondary-button settings-reset-button",onClick:()=>f(Jc(Xr)),children:"Reset"})]}),_.jsxs("label",{className:"settings-control",children:[_.jsx("span",{children:"Font family"}),_.jsx("select",{value:m,"aria-label":"Terminal font family",onChange:J=>p(h2(J.currentTarget.value)),children:Ru.map(J=>_.jsx("option",{value:J.id,children:J.label},J.id))})]}),_.jsxs("label",{className:"auth-checkbox settings-checkbox",children:[_.jsx("input",{type:"checkbox",checked:b,onChange:J=>y(d2(J.currentTarget.checked))}),"Show scroll progress"]}),_.jsxs("label",{className:"settings-control",children:[_.jsx("span",{children:"Accent theme"}),_.jsx("select",{value:w,"aria-label":"Theme accent",onChange:J=>x(T2(J.currentTarget.value)),children:Co.map(J=>_.jsx("option",{value:J.id,children:J.label},J.id))})]}),_.jsx("div",{className:"settings-theme-swatches","aria-hidden":"true",children:Co.map(J=>_.jsx("span",{className:"settings-theme-swatch","data-active":w===J.id?"true":"false",style:{"--settings-theme-accent":J.accent}},J.id))})]}),_.jsxs("section",{id:"settings-shortcuts",ref:J=>{pe.current.shortcuts=J},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:te,children:"Reset all"})]}),_.jsx("p",{className:"muted",children:"Defaults avoid Chrome's browser-tab shortcuts. Click a shortcut, then press the new key combo."}),Y?_.jsx("p",{className:"settings-error",children:Y}):null,_.jsx("ul",{className:"settings-shortcut-list","aria-label":"Workspace shortcuts",children:wo.map(J=>{const Fe=B===J.id;return _.jsxs("li",{children:[_.jsxs("div",{children:[_.jsx("span",{className:"settings-shortcut-label",children:J.label}),_.jsx("span",{className:"settings-shortcut-group",children:J.group})]}),_.jsxs("div",{className:"settings-shortcut-actions",children:[_.jsx("button",{type:"button",className:"settings-shortcut-recorder","data-recording":Fe?"true":"false",onClick:()=>{T(J.id),K(null)},children:Fe?"Press keys…":N0(C[J.id])}),_.jsx("button",{type:"button",className:"secondary-button settings-shortcut-reset",onClick:()=>we(J.id),children:"Reset"})]})]},J.id)})})]}),_.jsxs("section",{id:"settings-notifications",ref:J=>{pe.current.notifications=J},className:"security-section settings-section",children:[_.jsx("h3",{children:"Notifications"}),Vu()?_.jsxs(_.Fragment,{children:[_.jsxs("label",{className:"auth-checkbox",children:[_.jsx("input",{type:"checkbox",checked:ee&&N==="granted",onChange:()=>{Ce()},disabled:N==="denied"}),"System notification when page is hidden"]}),N==="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:le.enabled,onChange:J=>de(s2(J.currentTarget.checked))}),"Show animated completion toast"]}),_.jsxs("label",{className:"settings-control",children:[_.jsx("span",{children:"Toast duration"}),_.jsx("span",{className:"settings-control-value",children:le.persistUntilDismissed?"Until closed":`${le.durationSeconds}s`}),_.jsx("input",{type:"range",min:Vf,max:Xf,step:.5,value:le.durationSeconds,disabled:!le.enabled||le.persistUntilDismissed,"aria-label":"Completion toast duration",onChange:J=>Me(J.currentTarget.value)})]}),_.jsxs("div",{className:"settings-stepper-row settings-duration-row",children:[_.jsx("input",{type:"number",min:Vf,max:Xf,step:.5,value:le.durationSeconds,disabled:!le.enabled||le.persistUntilDismissed,"aria-label":"Completion toast duration value",onChange:J=>Me(J.currentTarget.value)}),_.jsx("button",{type:"button",className:"secondary-button settings-reset-button",disabled:!le.enabled||le.persistUntilDismissed,onClick:()=>de(ub(mo)),children:"Reset"})]}),_.jsxs("label",{className:"auth-checkbox settings-checkbox",children:[_.jsx("input",{type:"checkbox",checked:le.persistUntilDismissed,disabled:!le.enabled,onChange:J=>de(n2(J.currentTarget.checked))}),"Keep toast until dismissed"]}),_.jsxs("div",{className:"settings-assets-header",children:[_.jsx("span",{children:"Toast videos"}),_.jsxs("span",{children:[yf(V)," max"]})]}),_.jsx("input",{ref:he,type:"file",accept:"video/mp4,video/webm",className:"settings-asset-input","aria-label":"Upload toast video",onChange:J=>{Pe(J.currentTarget.files)}}),_.jsx("button",{type:"button",className:"secondary-button settings-upload-button",disabled:be,onClick:()=>he.current?.click(),children:"Upload video"}),W?_.jsx("p",{className:"settings-error",children:W}):null,P.length>0?_.jsx("ul",{className:"settings-asset-list","aria-label":"Toast videos",children:P.map(J=>_.jsxs("li",{"data-enabled":ke.has(J.id)?"true":"false",children:[_.jsxs("label",{className:"settings-asset-choice",children:[_.jsx("input",{type:"checkbox",checked:ke.has(J.id),disabled:be,"aria-label":`Use ${J.filename}`,onChange:Fe=>ht(J.id,Fe.currentTarget.checked)}),_.jsx("video",{src:J.url,muted:!0,autoPlay:!0,loop:!0,playsInline:!0,"aria-hidden":"true"}),_.jsxs("span",{className:"settings-asset-copy",children:[_.jsx("span",{children:J.filename}),_.jsx("small",{children:J.source==="built-in"?"Built-in":yf(J.size)})]})]}),J.source==="uploaded"?_.jsx("button",{type:"button",className:"secondary-button settings-asset-delete",disabled:be,"aria-label":`Delete ${J.filename}`,onClick:()=>{$e(J.id)},children:"x"}):null]},J.id))}):_.jsx("p",{className:"muted",children:"Built-in videos will be used."}),_.jsx("button",{type:"button",className:"secondary-button settings-save-assets-button",disabled:be||P.length===0||!me,onClick:()=>{Si()},children:"Save selected videos"})]}),_.jsx("div",{id:"settings-security",ref:J=>{pe.current.security=J},className:"settings-section-group",children:_.jsx(i2,{api:c})}),_.jsx("div",{id:"settings-servers",ref:J=>{pe.current.servers=J},className:"settings-section-group",children:_.jsx(K2,{api:c,...o?{onAgentRemoved:o}:{}})})]})]})]})})}function fb(e,t){const n=e.getBoundingClientRect(),a=t.getBoundingClientRect();return n.top-a.top+t.scrollTop}function yf(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 tu(e){return e instanceof Error?e.message:"Request failed."}function q2(e,t){if(e.length!==t.length)return!1;const n=new Set(t);return e.every(a=>n.has(a))}class Ir extends Error{constructor(t,n){super(n),this.status=t,this.name="UploadClientError"}status}function W2(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 h=!1;const f=()=>{e.signal?.removeEventListener("abort",b)},m=y=>{h||(h=!0,f(),o(y))},p=y=>{h||(h=!0,f(),c(y))},b=()=>{t.abort(),p(new Ir(0,"Upload aborted."))};if(e.signal?.aborted){p(new Ir(0,"Upload aborted."));return}e.signal?.addEventListener("abort",b,{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{p(new Ir(t.status,"Invalid upload response."))}return}p(new Ir(t.status,$2(t.responseText,t.statusText||`HTTP ${t.status}`)))},t.onerror=()=>p(new Ir(0,"Upload failed.")),t.onabort=()=>p(new Ir(0,"Upload aborted.")),t.ontimeout=()=>p(new Ir(0,"Upload timed out.")),t.send(n)})}function $2(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 Y2="modulepreload",V2=function(e){return"/"+e},pb={},Um=function(t,n,a){let o=Promise.resolve();if(n&&n.length>0){let m=function(p){return Promise.all(p.map(b=>Promise.resolve(b).then(y=>({status:"fulfilled",value:y}),y=>({status:"rejected",reason:y}))))};document.getElementsByTagName("link");const h=document.querySelector("meta[property=csp-nonce]"),f=h?.nonce||h?.getAttribute("nonce");o=m(n.map(p=>{if(p=V2(p),p in pb)return;pb[p]=!0;const b=p.endsWith(".css"),y=b?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${p}"]${y}`))return;const w=document.createElement("link");if(w.rel=b?"stylesheet":Y2,b||(w.as="script"),w.crossOrigin="",w.href=p,f&&w.setAttribute("nonce",f),document.head.appendChild(w),b)return new Promise((x,C)=>{w.addEventListener("load",x),w.addEventListener("error",()=>C(new Error(`Unable to preload CSS for ${p}`)))})}))}function c(h){const f=new Event("vite:preloadError",{cancelable:!0});if(f.payload=h,window.dispatchEvent(f),!f.defaultPrevented)throw h}return o.then(h=>{for(const f of h||[])f.status==="rejected"&&c(f.reason);return t().catch(c)})},X2=g.lazy(()=>Um(()=>import("./MarkdownPreview-0CQvz0hX.js"),__vite__mapDeps([0,1])));function G2({api:e,activeTerminalId:t,activeTerminalCwd:n,onOpenFile:a}){const[o,c]=g.useState(null),[h,f]=g.useState(""),[m,p]=g.useState({}),[b,y]=g.useState(()=>new Set),[w,x]=g.useState(null),[C,E]=g.useState({type:"empty"}),[B,T]=g.useState("idle"),[Y,K]=g.useState(null),X=g.useRef(null),re=g.useRef(null),ee=g.useRef(!1),ie=g.useRef(0),le=g.useRef(null);le.current===null&&t&&(le.current=t);const de=le.current,N=t?Sf(t,n):null,U=o?[o.rootPath,h].filter(Boolean).join("/"):"",P=w?.path??null;g.useEffect(()=>(ee.current=!0,()=>{ee.current=!1,ie.current+=1,me()}),[]),g.useEffect(()=>{le.current=t,re.current=null;const te=t?Sf(t,n):null;j(t,te)},[e]),g.useEffect(()=>{if(!de||t!==de)return;const te=Sf(de,n);te!==re.current&&j(de,te)},[de,t,n]);async function j(te,De=N){const Ce=Se();if(re.current=De,me(),c(null),f(""),p({}),y(new Set),x(null),E({type:"empty"}),K(null),!te){T("idle");return}T("loading");try{const Pe=await e.createFileRoot({terminalId:te});if(!Me(Ce))return;c({rootToken:Pe.rootToken,rootPath:Pe.rootPath});const $e=await e.listFiles({rootToken:Pe.rootToken,path:""});if(!Me(Ce))return;M($e),T("idle")}catch(Pe){if(await Ue(Pe,Ce))return;Me(Ce)&&(K(rr(Pe)),T("idle"))}}async function z(te=h,De=o){if(!De)return;const Ce=Se();T("loading"),K(null);try{const Pe=await e.listFiles({rootToken:De.rootToken,path:te});if(!Me(Ce))return;M(Pe),T("idle")}catch(Pe){if(await Ue(Pe,Ce))return;Me(Ce)&&(K(rr(Pe)),T("idle"))}}async function G(){le.current=t,await j(t,N)}function M(te){p(De=>({...De,[te.path]:Q2(te.entries)}))}async function q(te){if(!(!bf(te)||!o)){if(x(te),K(null),te.kind==="directory"){f(te.path),ke(),await _e(te);return}if(f(Fr(te.path)),te.editable){await D(te);return}te.previewKind!=="none"&&await ne(te,te.previewKind)}}async function V(te){if(!(!bf(te)||!o)){if(x(te),K(null),te.kind==="directory"){f(te.path),ke(),await _e(te);return}if(f(Fr(te.path)),te.editable){await W(te);return}te.previewKind!=="none"&&await ne(te,te.previewKind)}}async function _e(te){if(b.has(te.path)){y(De=>{const Ce=new Set(De);return Ce.delete(te.path),Ce});return}y(De=>new Set(De).add(te.path)),await z(te.path)}function be(te,De){te.key==="Enter"&&(te.preventDefault(),V(De))}async function D(te){if(!o)return;const De=Se();T("loading"),me();try{const Ce=await e.readFile({rootToken:o.rootToken,path:te.path});if(!Me(De))return;E({type:"text-preview",file:te,read:Ce}),T("idle")}catch(Ce){if(await Ue(Ce,De))return;Me(De)&&(K(rr(Ce)),T("idle"))}}async function W(te){if(!o)return;const De=Se();T("loading");try{await a({rootToken:o.rootToken,path:te.path}),Me(De)&&T("idle")}catch(Ce){if(await Ue(Ce,De))return;Me(De)&&(K(rr(Ce)),T("idle"))}}async function ne(te,De){if(!o)return;const Ce=Se();T("loading"),me();try{const Pe=await e.previewFile({rootToken:o.rootToken,path:te.path});if(!Me(Ce))return;const $e=URL.createObjectURL(Pe);if(!Me(Ce)){URL.revokeObjectURL($e);return}X.current=$e,E({type:"preview",file:te,previewKind:De,url:$e}),T("idle")}catch(Pe){if(await Ue(Pe,Ce))return;Me(Ce)&&(K(rr(Pe)),T("idle"))}}async function he(te){if(!o)return;const De=te==="file"?"New file":"New folder",Ce=window.prompt(De,""),Pe=w?w.kind==="directory"?w.path:Fr(w.path):h,$e=mb(Ce,Pe);if($e){K(null);try{const bt=await e.createFileEntry({rootToken:o.rootToken,path:$e,kind:te});x(bt.entry),await z(Pe)}catch(bt){if(await Ue(bt))return;K(rr(bt))}}}async function ge(){if(!o||!w)return;const te=window.prompt("Move selected entry",w.path),De=mb(te,"");if(!De||De===w.path)return;const Ce=Fr(w.path),Pe=Fr(De);K(null);try{const $e=await e.moveFileEntry({rootToken:o.rootToken,sourcePath:w.path,destinationPath:De});x($e.entry),f($e.entry.kind==="directory"?$e.entry.path:Fr($e.entry.path)),ke(),await z(Ce),Pe!==Ce&&await z(Pe)}catch($e){if(await Ue($e))return;K(rr($e))}}async function pe(){if(!o||!w)return;const te=w.path,De=Fr(te);K(null);try{const Ce=await e.previewDeleteFileEntry({rootToken:o.rootToken,path:w.path}),Pe=Ce.descendantCount>0?` and ${Ce.descendantCount} nested item${Ce.descendantCount===1?"":"s"}`:"";if(!window.confirm(`Delete ${Ce.path}${Pe}?`))return;await e.deleteFileEntry({rootToken:o.rootToken,path:w.path,previewToken:Ce.previewToken}),x(null),f(De),y($e=>{const bt=new Set($e);for(const ht of $e)(ht===te||ht.startsWith(`${te}/`))&&bt.delete(ht);return bt}),ke(),await z(De)}catch(Ce){if(await Ue(Ce))return;K(rr(Ce))}}function ke(){ie.current+=1,me(),E({type:"empty"})}function me(){X.current&&(URL.revokeObjectURL(X.current),X.current=null)}function Se(){return ie.current+=1,ie.current}function Me(te){return ee.current&&te===ie.current}async function Ue(te,De){return J2(te)?(De!==void 0&&!Me(De)||await j(t,N),!0):!1}function Ke(te,De){const Ce=bf(te),Pe=te.kind==="directory"&&b.has(te.path),$e=m[te.path]??[],bt={"--file-tree-depth":De};return _.jsxs(ei.Fragment,{children:[_.jsxs("button",{type:"button",className:"file-entry-button","data-kind":te.kind,"data-expanded":Pe,"data-active":P===te.path,disabled:!Ce,style:bt,"aria-expanded":te.kind==="directory"?Pe:void 0,"aria-label":`${te.kind==="directory"?"Open folder":"Open file"} ${te.name}`,title:te.kind==="directory"?"Expand or collapse folder":"Click to preview. Double-click or press Enter to open.",onClick:()=>{q(te)},onDoubleClick:()=>{V(te)},onKeyDown:ht=>be(ht,te),children:[_.jsx("span",{className:"file-entry-disclosure","aria-hidden":"true",children:te.kind==="directory"?Pe?"▾":"▸":""}),_.jsx("span",{className:"file-entry-name",children:te.name}),_.jsx("small",{children:Z2(te)})]}),Pe?_.jsx("div",{className:"file-tree-children",role:"group",children:$e.map(ht=>Ke(ht,De+1))}):null]},te.path)}const we=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:U,children:U||"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:"▣"})]})]}),Y?_.jsx("div",{className:"file-explorer-alert",role:"alert",children:Y}):null,_.jsxs("div",{className:"file-explorer-layout",children:[_.jsx("div",{className:"file-tree","aria-label":U?`Files in ${U}`:"Files",children:we.map(te=>Ke(te,0))}),_.jsxs("section",{className:"file-detail","aria-label":"File detail",children:[_.jsxs("div",{className:"file-detail-header",children:[_.jsx("strong",{children:w?.name??"detail"}),_.jsxs("div",{className:"file-detail-actions",children:[_.jsx("button",{type:"button","aria-label":"Move selected entry",disabled:!w,onClick:()=>{ge()},children:"Move"}),_.jsx("button",{type:"button","aria-label":"Delete selected entry",disabled:!w,onClick:()=>{pe()},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(X2,{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 bf(e){return e.kind==="directory"||e.editable||e.previewKind!=="none"}function Z2(e){return e.kind==="directory"?"dir":e.editable?"edit":e.previewKind!=="none"?e.previewKind:"unsupported"}function Sf(e,t){return`${e}\0${t??""}`}function Q2(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 Fr(e){const t=e.split("/").filter(Boolean);return t.pop(),t.join("/")}function mb(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 rr(e){return e instanceof Error?e.message:"Request failed"}function J2(e){return e instanceof Mn&&e.status===409&&e.message==="terminal_cwd_changed"}const eT=g.lazy(()=>Um(()=>import("./MarkdownPreview-0CQvz0hX.js"),__vite__mapDeps([0,1])));function _b({api:e,editor:t,canClose:n,onClose:a}){const[o,c]=g.useState(t.read),[h,f]=g.useState(t.read.content),[m,p]=g.useState("idle"),[b,y]=g.useState(null),[w,x]=g.useState(!1),[C,E]=g.useState("edit"),B=g.useRef(t),T=g.useRef(t.read),Y=g.useRef(t.read.content),K=g.useRef(!1),X=g.useRef(!1),re=g.useRef(0),ee=h!==o.content&&m!=="saving"&&!w;g.useEffect(()=>(X.current=!0,()=>{X.current=!1,re.current+=1}),[]),g.useEffect(()=>{re.current+=1,K.current=!1,B.current=t,T.current=t.read,Y.current=t.read.content,c(t.read),f(t.read.content),p("idle"),y(null),x(!1),E("edit")},[t.id,t.read]),g.useEffect(()=>{B.current=t},[t]),g.useEffect(()=>{T.current=o},[o]),g.useEffect(()=>{Y.current=h},[h]),g.useEffect(()=>{if(h===o.content||w)return;const U=window.setInterval(()=>{!K.current&&Y.current!==T.current.content&&ie()},1e3);return()=>window.clearInterval(U)},[h===o.content,w,t.id]);async function ie(){if(K.current)return;const U=Y.current,P=T.current;if(U===P.content)return;const j=B.current,z=re.current;K.current=!0,p("saving"),y(null),x(!1);try{const G=await e.writeFile({rootToken:j.rootToken,path:j.path,content:U,expectedVersion:P.version});if(!X.current||z!==re.current)return;const M={...P,content:U,version:G.version};T.current=M,c(M),p(Y.current===U?"saved":"idle")}catch(G){if(!X.current||z!==re.current)return;if(G instanceof Mn&&G.status===409){x(!0),p("idle");return}y(tT(G)),p("idle")}finally{z===re.current&&(K.current=!1)}}const le=m==="saving"?"saving":m==="saved"?"saved":o.language,de=o.language==="markdown",N=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:le}),_.jsx("button",{type:"button","aria-label":`Save ${t.title}`,disabled:!ee,onClick:()=>{ie()},children:"Save"}),de?_.jsx("button",{type:"button","aria-label":`${N?"Edit":"Preview"} ${t.title}`,onClick:()=>E(U=>U==="preview"?"edit":"preview"),children:N?"Edit":"Preview"}):null,n?_.jsx("button",{type:"button",className:"terminal-pane-close","aria-label":`Close editor ${t.title}`,onClick:a,children:"x"}):null]}),b?_.jsx("div",{className:"editor-pane-alert",role:"alert",children:b}):null,w?_.jsx("div",{className:"editor-pane-alert",role:"alert",children:"File changed on disk."}):null,N?_.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(eT,{content:h})})}):_.jsx("textarea",{className:"editor-pane-textarea","aria-label":`Editor for ${t.title}`,spellCheck:!1,value:h,onChange:U=>{const P=U.target.value;Y.current=P,f(P),p("idle"),y(null),x(!1)}})]})}function tT(e){return e instanceof Error?e.message:"Request failed"}var iT=2,sT=1,nT=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),h={top:parseInt(c.getPropertyValue("padding-top")),bottom:parseInt(c.getPropertyValue("padding-bottom")),right:parseInt(c.getPropertyValue("padding-right")),left:parseInt(c.getPropertyValue("padding-left"))},f=h.top+h.bottom,m=h.right+h.left,p=a-f,b=o-m-t;return{cols:Math.max(iT,Math.floor(b/e.css.cell.width)),rows:Math.max(sT,Math.floor(p/e.css.cell.height))}}};var U0=Object.defineProperty,rT=Object.getOwnPropertyDescriptor,aT=(e,t)=>{for(var n in t)U0(e,n,{get:t[n],enumerable:!0})},Ut=(e,t,n,a)=>{for(var o=a>1?void 0:a?rT(t,n):t,c=e.length-1,h;c>=0;c--)(h=e[c])&&(o=(a?h(t,n,o):h(o))||o);return a&&o&&U0(t,n,o),o},ye=(e,t)=>(n,a)=>t(n,a,e),vb="Terminal input",cp={get:()=>vb,set:e=>vb=e},gb="Too much output to announce, navigate to rows manually to read",up={get:()=>gb,set:e=>gb=e};function lT(e){return e.replace(/\r?\n/g,"\r")}function oT(e,t){return t?"\x1B[200~"+e+"\x1B[201~":e}function cT(e,t){e.clipboardData&&e.clipboardData.setData("text/plain",t.selectionText),e.preventDefault()}function uT(e,t,n,a){if(e.stopPropagation(),e.clipboardData){let o=e.clipboardData.getData("text/plain");P0(o,t,n,a)}}function P0(e,t,n,a){e=lT(e),e=oT(e,n.decPrivateModes.bracketedPasteMode&&a.rawOptions.ignoreBracketedPasteMode!==!0),n.triggerDataEvent(e,!0),t.value=""}function K0(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 yb(e,t,n,a,o){K0(e,t,n),o&&a.rightClickSelect(e),t.value=a.selectionText,t.select()}function hr(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}function Xu(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 hT=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 h=e.charCodeAt(c);if(55296<=h&&h<=56319){if(++c>=n)return this._interim=h,a;let f=e.charCodeAt(c);56320<=f&&f<=57343?t[a++]=(h-55296)*1024+f-56320+65536:(t[a++]=h,t[a++]=f);continue}h!==65279&&(t[a++]=h)}return a}},dT=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,h,f,m=0,p=0;if(this.interim[0]){let w=!1,x=this.interim[0];x&=(x&224)===192?31:(x&240)===224?15:7;let C=0,E;for(;(E=this.interim[++C]&63)&&C<4;)x<<=6,x|=E;let B=(this.interim[0]&224)===192?2:(this.interim[0]&240)===224?3:4,T=B-C;for(;p<T;){if(p>=n)return 0;if(E=e[p++],(E&192)!==128){p--,w=!0;break}else this.interim[C++]=E,x<<=6,x|=E&63}w||(B===2?x<128?p--: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 b=n-4,y=p;for(;y<n;){for(;y<b&&!((o=e[y])&128)&&!((c=e[y+1])&128)&&!((h=e[y+2])&128)&&!((f=e[y+3])&128);)t[a++]=o,t[a++]=c,t[a++]=h,t[a++]=f,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(h=e[y++],(h&192)!==128){y--;continue}if(m=(o&15)<<12|(c&63)<<6|h&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(h=e[y++],(h&192)!==128){y--;continue}if(y>=n)return this.interim[0]=o,this.interim[1]=c,this.interim[2]=h,a;if(f=e[y++],(f&192)!==128){y--;continue}if(m=(o&7)<<18|(c&63)<<12|(h&63)<<6|f&63,m<65536||m>1114111)continue;t[a++]=m}}return a}},I0="",dr=" ",Ho=class F0{constructor(){this.fg=0,this.bg=0,this.extended=new Au}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 F0;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}},Au=class q0{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 q0(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},Hs=class W0 extends Ho{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new Au,this.combinedData=""}static fromCharData(t){let n=new W0;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?hr(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()]}},bb="di$target",hp="di$dependencies",wf=new Map;function fT(e){return e[hp]||[]}function bi(e){if(wf.has(e))return wf.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");pT(t,n,o)};return t._id=e,wf.set(e,t),t}function pT(e,t,n){t[bb]===t?t[hp].push({id:e,index:n}):(t[hp]=[{id:e,index:n}],t[bb]=t)}var $i=bi("BufferService"),$0=bi("CoreMouseService"),ta=bi("CoreService"),mT=bi("CharsetService"),Pm=bi("InstantiationService"),Y0=bi("LogService"),Yi=bi("OptionsService"),V0=bi("OscLinkService"),_T=bi("UnicodeService"),Uo=bi("DecorationService"),dp=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 Hs,h=n.getTrimmedLength(),f=-1,m=-1,p=!1;for(let b=0;b<h;b++)if(!(m===-1&&!n.hasContent(b))){if(n.loadCell(b,c),c.hasExtendedAttrs()&&c.extended.urlId)if(m===-1){m=b,f=c.extended.urlId;continue}else p=c.extended.urlId!==f;else m!==-1&&(p=!0);if(p||m!==-1&&b===h-1){let y=this._oscLinkService.getLinkData(f)?.uri;if(y){let w={start:{x:m+1,y:e},end:{x:b+(!p&&b===h-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:w,activate:(C,E)=>o?o.activate(C,E,w):vT(C,E),hover:(C,E)=>o?.hover?.(C,E,w),leave:(C,E)=>o?.leave?.(C,E,w)})}p=!1,c.hasExtendedAttrs()&&c.extended.urlId?(m=b,f=c.extended.urlId):(m=-1,f=-1)}}t(a)}};dp=Ut([ye(0,$i),ye(1,Yi),ye(2,V0)],dp);function vT(e,t){if(confirm(`Do you want to navigate to ${t}?
|
|
14
|
+
`},$x={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 Yx(e){let{announcements:t=$x,container:n,hiddenTextDescribedById:a,screenReaderInstructions:o=Wx}=e;const{announce:c,announcement:h}=Ix(),f=$u("DndLiveRegion"),[_,p]=v.useState(!1);if(v.useEffect(()=>{p(!0)},[]),Fx(v.useMemo(()=>({onDragStart(y){let{active:w}=y;c(t.onDragStart({active:w}))},onDragMove(y){let{active:w,over:x}=y;t.onDragMove&&c(t.onDragMove({active:w,over:x}))},onDragOver(y){let{active:w,over:x}=y;c(t.onDragOver({active:w,over:x}))},onDragEnd(y){let{active:w,over:x}=y;c(t.onDragEnd({active:w,over:x}))},onDragCancel(y){let{active:w,over:x}=y;c(t.onDragCancel({active:w,over:x}))}}),[c,t])),!_)return null;const b=hi.createElement(hi.Fragment,null,hi.createElement(Px,{id:a,value:o.draggable}),hi.createElement(Kx,{id:f,announcement:h}));return n?ao.createPortal(b,n):b}var ui;(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"})(ui||(ui={}));function Du(){}function Zy(e,t){return v.useMemo(()=>({sensor:e,options:t??{}}),[e,t])}function Vx(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return v.useMemo(()=>[...t].filter(a=>a!=null),[...t])}const Vs=Object.freeze({x:0,y:0});function Xx(e,t){let{data:{value:n}}=e,{data:{value:a}}=t;return a-n}function Gx(e,t){if(!e||e.length===0)return null;const[n]=e;return n[t]}function Zx(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),h=o-a,f=c-n;if(a<o&&n<c){const _=t.width*t.height,p=e.width*e.height,b=h*f,y=b/(_+p-b);return Number(y.toFixed(4))}return 0}const Qx=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:a}=e;const o=[];for(const c of a){const{id:h}=c,f=n.get(h);if(f){const _=Zx(f,t);_>0&&o.push({id:h,data:{droppableContainer:c,value:_}})}}return o.sort(Xx)};function Jx(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function a0(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:Vs}function e2(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((h,f)=>({...h,top:h.top+e*f.y,bottom:h.bottom+e*f.y,left:h.left+e*f.x,right:h.right+e*f.x}),{...n})}}const t2=e2(1);function i2(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 s2(e,t,n){const a=i2(t);if(!a)return e;const{scaleX:o,scaleY:c,x:h,y:f}=a,_=e.left-h-(1-o)*parseFloat(n),p=e.top-f-(1-c)*parseFloat(n.slice(n.indexOf(" ")+1)),b=o?e.width/o:e.width,y=c?e.height/c:e.height;return{width:b,height:y,top:p,right:_+b,bottom:p+y,left:_}}const n2={ignoreTransform:!1};function jo(e,t){t===void 0&&(t=n2);let n=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:p,transformOrigin:b}=as(e).getComputedStyle(e);p&&(n=s2(n,p,b))}const{top:a,left:o,width:c,height:h,bottom:f,right:_}=n;return{top:a,left:o,width:c,height:h,bottom:f,right:_}}function Qy(e){return jo(e,{ignoreTransform:!0})}function r2(e){const t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function a2(e,t){return t===void 0&&(t=as(e).getComputedStyle(e)),t.position==="fixed"}function l2(e,t){t===void 0&&(t=as(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 xm(e,t){const n=[];function a(o){if(t!=null&&n.length>=t||!o)return n;if(wm(o)&&o.scrollingElement!=null&&!n.includes(o.scrollingElement))return n.push(o.scrollingElement),n;if(!Oo(o)||i0(o)||n.includes(o))return n;const c=as(e).getComputedStyle(o);return o!==e&&l2(o,c)&&n.push(o),a2(o,c)?n:a(o.parentNode)}return e?a(e):n}function l0(e){const[t]=xm(e,1);return t??null}function mf(e){return!Wu||!e?null:Ja(e)?e:Sm(e)?wm(e)||e===el(e).scrollingElement?window:Oo(e)?e:null:null}function o0(e){return Ja(e)?e.scrollX:e.scrollLeft}function c0(e){return Ja(e)?e.scrollY:e.scrollTop}function Wf(e){return{x:o0(e),y:c0(e)}}var gi;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(gi||(gi={}));function u0(e){return!Wu||!e?!1:e===document.scrollingElement}function h0(e){const t={x:0,y:0},n=u0(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,h=e.scrollTop>=a.y,f=e.scrollLeft>=a.x;return{isTop:o,isLeft:c,isBottom:h,isRight:f,maxScroll:a,minScroll:t}}const o2={x:.2,y:.2};function c2(e,t,n,a,o){let{top:c,left:h,right:f,bottom:_}=n;a===void 0&&(a=10),o===void 0&&(o=o2);const{isTop:p,isBottom:b,isLeft:y,isRight:w}=h0(e),x={x:0,y:0},C={x:0,y:0},E={height:t.height*o.y,width:t.width*o.x};return!p&&c<=t.top+E.height?(x.y=gi.Backward,C.y=a*Math.abs((t.top+E.height-c)/E.height)):!b&&_>=t.bottom-E.height&&(x.y=gi.Forward,C.y=a*Math.abs((t.bottom-E.height-_)/E.height)),!w&&f>=t.right-E.width?(x.x=gi.Forward,C.x=a*Math.abs((t.right-E.width-f)/E.width)):!y&&h<=t.left+E.width&&(x.x=gi.Backward,C.x=a*Math.abs((t.left+E.width-h)/E.width)),{direction:x,speed:C}}function u2(e){if(e===document.scrollingElement){const{innerWidth:c,innerHeight:h}=window;return{top:0,left:0,right:c,bottom:h,width:c,height:h}}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 d0(e){return e.reduce((t,n)=>Wa(t,Wf(n)),Vs)}function h2(e){return e.reduce((t,n)=>t+o0(n),0)}function d2(e){return e.reduce((t,n)=>t+c0(n),0)}function f2(e,t){if(t===void 0&&(t=jo),!e)return;const{top:n,left:a,bottom:o,right:c}=t(e);l0(e)&&(o<=0||c<=0||n>=window.innerHeight||a>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const p2=[["x",["left","right"],h2],["y",["top","bottom"],d2]];class Em{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=xm(n),o=d0(a);this.rect={...t},this.width=t.width,this.height=t.height;for(const[c,h,f]of p2)for(const _ of h)Object.defineProperty(this,_,{get:()=>{const p=f(a),b=o[c]-p;return this.rect[_]+b},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class mo{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 m2(e){const{EventTarget:t}=as(e);return e instanceof t?e:el(e)}function _f(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 zs;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(zs||(zs={}));function Jy(e){e.preventDefault()}function _2(e){e.stopPropagation()}var bt;(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"})(bt||(bt={}));const f0={start:[bt.Space,bt.Enter],cancel:[bt.Esc],end:[bt.Space,bt.Enter,bt.Tab]},g2=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case bt.Right:return{...n,x:n.x+25};case bt.Left:return{...n,x:n.x-25};case bt.Down:return{...n,y:n.y+25};case bt.Up:return{...n,y:n.y-25}}};class p0{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 mo(el(n)),this.windowListeners=new mo(as(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(zs.Resize,this.handleCancel),this.windowListeners.add(zs.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(zs.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:n}=this.props,a=t.node.current;a&&f2(a),n(Vs)}handleKeyDown(t){if(n0(t)){const{active:n,context:a,options:o}=this.props,{keyboardCodes:c=f0,coordinateGetter:h=g2,scrollBehavior:f="smooth"}=o,{code:_}=t;if(c.end.includes(_)){this.handleEnd(t);return}if(c.cancel.includes(_)){this.handleCancel(t);return}const{collisionRect:p}=a.current,b=p?{x:p.left,y:p.top}:Vs;this.referenceCoordinates||(this.referenceCoordinates=b);const y=h(t,{active:n,context:a.current,currentCoordinates:b});if(y){const w=ku(y,b),x={x:0,y:0},{scrollableAncestors:C}=a.current;for(const E of C){const B=t.code,{isTop:T,isRight:Y,isLeft:P,isBottom:X,maxScroll:ee,minScroll:te}=h0(E),se=u2(E),le={x:Math.min(B===bt.Right?se.right-se.width/2:se.right,Math.max(B===bt.Right?se.left:se.left+se.width/2,y.x)),y:Math.min(B===bt.Down?se.bottom-se.height/2:se.bottom,Math.max(B===bt.Down?se.top:se.top+se.height/2,y.y))},de=B===bt.Right&&!Y||B===bt.Left&&!P,N=B===bt.Down&&!X||B===bt.Up&&!T;if(de&&le.x!==y.x){const U=E.scrollLeft+w.x,K=B===bt.Right&&U<=ee.x||B===bt.Left&&U>=te.x;if(K&&!w.y){E.scrollTo({left:U,behavior:f});return}K?x.x=E.scrollLeft-U:x.x=B===bt.Right?E.scrollLeft-ee.x:E.scrollLeft-te.x,x.x&&E.scrollBy({left:-x.x,behavior:f});break}else if(N&&le.y!==y.y){const U=E.scrollTop+w.y,K=B===bt.Down&&U<=ee.y||B===bt.Up&&U>=te.y;if(K&&!w.x){E.scrollTo({top:U,behavior:f});return}K?x.y=E.scrollTop-U:x.y=B===bt.Down?E.scrollTop-ee.y:E.scrollTop-te.y,x.y&&E.scrollBy({top:-x.y,behavior:f});break}}this.handleMove(t,Wa(ku(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()}}p0.activators=[{eventName:"onKeyDown",handler:(e,t,n)=>{let{keyboardCodes:a=f0,onActivation:o}=t,{active:c}=n;const{code:h}=e.nativeEvent;if(a.start.includes(h)){const f=c.activatorNode.current;return f&&e.target!==f?!1:(e.preventDefault(),o?.({event:e.nativeEvent}),!0)}return!1}}];function eb(e){return!!(e&&"distance"in e)}function tb(e){return!!(e&&"delay"in e)}class Tm{constructor(t,n,a){var o;a===void 0&&(a=m2(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:h}=c;this.props=t,this.events=n,this.document=el(h),this.documentListeners=new mo(this.document),this.listeners=new mo(a),this.windowListeners=new mo(as(h)),this.initialCoordinates=(o=Ff(c))!=null?o:Vs,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(zs.Resize,this.handleCancel),this.windowListeners.add(zs.DragStart,Jy),this.windowListeners.add(zs.VisibilityChange,this.handleCancel),this.windowListeners.add(zs.ContextMenu,Jy),this.documentListeners.add(zs.Keydown,this.handleKeydown),n){if(a!=null&&a({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(tb(n)){this.timeoutId=setTimeout(this.handleStart,n.delay),this.handlePending(n);return}if(eb(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(zs.Click,_2,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(zs.SelectionChange,this.removeTextSelection),n(t))}handleMove(t){var n;const{activated:a,initialCoordinates:o,props:c}=this,{onMove:h,options:{activationConstraint:f}}=c;if(!o)return;const _=(n=Ff(t))!=null?n:Vs,p=ku(o,_);if(!a&&f){if(eb(f)){if(f.tolerance!=null&&_f(p,f.tolerance))return this.handleCancel();if(_f(p,f.distance))return this.handleStart()}if(tb(f)&&_f(p,f.tolerance))return this.handleCancel();this.handlePending(f,p);return}t.cancelable&&t.preventDefault(),h(_)}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===bt.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const v2={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class m0 extends Tm{constructor(t){const{event:n}=t,a=el(n.target);super(t,v2,a)}}m0.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 y2={move:{name:"mousemove"},end:{name:"mouseup"}};var $f;(function(e){e[e.RightClick=2]="RightClick"})($f||($f={}));class _0 extends Tm{constructor(t){super(t,y2,el(t.event.target))}}_0.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:a}=t;return n.button===$f.RightClick?!1:(a?.({event:n}),!0)}}];const gf={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class g0 extends Tm{constructor(t){super(t,gf)}static setup(){return window.addEventListener(gf.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(gf.move.name,t)};function t(){}}}g0.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 _o;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(_o||(_o={}));var Ru;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(Ru||(Ru={}));function b2(e){let{acceleration:t,activator:n=_o.Pointer,canScroll:a,draggingRect:o,enabled:c,interval:h=5,order:f=Ru.TreeOrder,pointerCoordinates:_,scrollableAncestors:p,scrollableAncestorRects:b,delta:y,threshold:w}=e;const x=w2({delta:y,disabled:!c}),[C,E]=Ox(),B=v.useRef({x:0,y:0}),T=v.useRef({x:0,y:0}),Y=v.useMemo(()=>{switch(n){case _o.Pointer:return _?{top:_.y,bottom:_.y,left:_.x,right:_.x}:null;case _o.DraggableRect:return o}},[n,o,_]),P=v.useRef(null),X=v.useCallback(()=>{const te=P.current;if(!te)return;const se=B.current.x*T.current.x,le=B.current.y*T.current.y;te.scrollBy(se,le)},[]),ee=v.useMemo(()=>f===Ru.TreeOrder?[...p].reverse():p,[f,p]);v.useEffect(()=>{if(!c||!p.length||!Y){E();return}for(const te of ee){if(a?.(te)===!1)continue;const se=p.indexOf(te),le=b[se];if(!le)continue;const{direction:de,speed:N}=c2(te,le,Y,t,w);for(const U of["x","y"])x[U][de[U]]||(N[U]=0,de[U]=0);if(N.x>0||N.y>0){E(),P.current=te,C(X,h),B.current=N,T.current=de;return}}B.current={x:0,y:0},T.current={x:0,y:0},E()},[t,X,a,E,c,h,JSON.stringify(Y),JSON.stringify(x),C,p,ee,b,JSON.stringify(w)])}const S2={x:{[gi.Backward]:!1,[gi.Forward]:!1},y:{[gi.Backward]:!1,[gi.Forward]:!1}};function w2(e){let{delta:t,disabled:n}=e;const a=If(t);return zo(o=>{if(n||!a||!o)return S2;const c={x:Math.sign(t.x-a.x),y:Math.sign(t.y-a.y)};return{x:{[gi.Backward]:o.x[gi.Backward]||c.x===-1,[gi.Forward]:o.x[gi.Forward]||c.x===1},y:{[gi.Backward]:o.y[gi.Backward]||c.y===-1,[gi.Forward]:o.y[gi.Forward]||c.y===1}}},[n,t,a])}function C2(e,t){const n=t!=null?e.get(t):void 0,a=n?n.node.current:null;return zo(o=>{var c;return t==null?null:(c=a??o)!=null?c:null},[a,t])}function x2(e,t){return v.useMemo(()=>e.reduce((n,a)=>{const{sensor:o}=a,c=o.activators.map(h=>({eventName:h.eventName,handler:t(h.handler,a)}));return[...n,...c]},[]),[e,t])}var xo;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(xo||(xo={}));var Yf;(function(e){e.Optimized="optimized"})(Yf||(Yf={}));const ib=new Map;function E2(e,t){let{dragging:n,dependencies:a,config:o}=t;const[c,h]=v.useState(null),{frequency:f,measure:_,strategy:p}=o,b=v.useRef(e),y=B(),w=Co(y),x=v.useCallback(function(T){T===void 0&&(T=[]),!w.current&&h(Y=>Y===null?T:Y.concat(T.filter(P=>!Y.includes(P))))},[w]),C=v.useRef(null),E=zo(T=>{if(y&&!n)return ib;if(!T||T===ib||b.current!==e||c!=null){const Y=new Map;for(let P of e){if(!P)continue;if(c&&c.length>0&&!c.includes(P.id)&&P.rect.current){Y.set(P.id,P.rect.current);continue}const X=P.node.current,ee=X?new Em(_(X),X):null;P.rect.current=ee,ee&&Y.set(P.id,ee)}return Y}return T},[e,c,n,y,_]);return v.useEffect(()=>{b.current=e},[e]),v.useEffect(()=>{y||x()},[n,y]),v.useEffect(()=>{c&&c.length>0&&h(null)},[JSON.stringify(c)]),v.useEffect(()=>{y||typeof f!="number"||C.current!==null||(C.current=setTimeout(()=>{x(),C.current=null},f))},[f,y,x,...a]),{droppableRects:E,measureDroppableContainers:x,measuringScheduled:c!=null};function B(){switch(p){case xo.Always:return!1;case xo.BeforeDragging:return n;default:return!n}}}function v0(e,t){return zo(n=>e?n||(typeof t=="function"?t(e):e):null,[t,e])}function T2(e,t){return v0(e,t)}function k2(e){let{callback:t,disabled:n}=e;const a=Cm(t),o=v.useMemo(()=>{if(n||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:c}=window;return new c(a)},[a,n]);return v.useEffect(()=>()=>o?.disconnect(),[o]),o}function Yu(e){let{callback:t,disabled:n}=e;const a=Cm(t),o=v.useMemo(()=>{if(n||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:c}=window;return new c(a)},[n]);return v.useEffect(()=>()=>o?.disconnect(),[o]),o}function D2(e){return new Em(jo(e),e)}function sb(e,t,n){t===void 0&&(t=D2);const[a,o]=v.useState(null);function c(){o(_=>{if(!e)return null;if(e.isConnected===!1){var p;return(p=_??n)!=null?p:null}const b=t(e);return JSON.stringify(_)===JSON.stringify(b)?_:b})}const h=k2({callback(_){if(e)for(const p of _){const{type:b,target:y}=p;if(b==="childList"&&y instanceof HTMLElement&&y.contains(e)){c();break}}}}),f=Yu({callback:c});return gr(()=>{c(),e?(f?.observe(e),h?.observe(document.body,{childList:!0,subtree:!0})):(f?.disconnect(),h?.disconnect())},[e]),a}function R2(e){const t=v0(e);return a0(e,t)}const nb=[];function M2(e){const t=v.useRef(e),n=zo(a=>e?a&&a!==nb&&e&&t.current&&e.parentNode===t.current.parentNode?a:xm(e):nb,[e]);return v.useEffect(()=>{t.current=e},[e]),n}function N2(e){const[t,n]=v.useState(null),a=v.useRef(e),o=v.useCallback(c=>{const h=mf(c.target);h&&n(f=>f?(f.set(h,Wf(h)),new Map(f)):null)},[]);return v.useEffect(()=>{const c=a.current;if(e!==c){h(c);const f=e.map(_=>{const p=mf(_);return p?(p.addEventListener("scroll",o,{passive:!0}),[p,Wf(p)]):null}).filter(_=>_!=null);n(f.length?new Map(f):null),a.current=e}return()=>{h(e),h(c)};function h(f){f.forEach(_=>{const p=mf(_);p?.removeEventListener("scroll",o)})}},[o,e]),v.useMemo(()=>e.length?t?Array.from(t.values()).reduce((c,h)=>Wa(c,h),Vs):d0(e):Vs,[e,t])}function rb(e,t){t===void 0&&(t=[]);const n=v.useRef(null);return v.useEffect(()=>{n.current=null},t),v.useEffect(()=>{const a=e!==Vs;a&&!n.current&&(n.current=e),!a&&n.current&&(n.current=null)},[e]),n.current?ku(e,n.current):Vs}function A2(e){v.useEffect(()=>{if(!Wu)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 L2(e,t){return v.useMemo(()=>e.reduce((n,a)=>{let{eventName:o,handler:c}=a;return n[o]=h=>{c(h,t)},n},{}),[e,t])}function y0(e){return v.useMemo(()=>e?r2(e):null,[e])}const ab=[];function B2(e,t){t===void 0&&(t=jo);const[n]=e,a=y0(n?as(n):null),[o,c]=v.useState(ab);function h(){c(()=>e.length?e.map(_=>u0(_)?a:new Em(t(_),_)):ab)}const f=Yu({callback:h});return gr(()=>{f?.disconnect(),h(),e.forEach(_=>f?.observe(_))},[e]),o}function O2(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return Oo(t)?t:e}function z2(e){let{measure:t}=e;const[n,a]=v.useState(null),o=v.useCallback(p=>{for(const{target:b}of p)if(Oo(b)){a(y=>{const w=t(b);return y?{...y,width:w.width,height:w.height}:w});break}},[t]),c=Yu({callback:o}),h=v.useCallback(p=>{const b=O2(p);c?.disconnect(),b&&c?.observe(b),a(b?t(b):null)},[t,c]),[f,_]=Tu(h);return v.useMemo(()=>({nodeRef:f,rect:n,setRef:_}),[n,f,_])}const j2=[{sensor:m0,options:{}},{sensor:p0,options:{}}],H2={current:{}},du={draggable:{measure:Qy},droppable:{measure:Qy,strategy:xo.WhileDragging,frequency:Yf.Optimized},dragOverlay:{measure:jo}};class go 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 U2={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new go,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:Du},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:du,measureDroppableContainers:Du,windowRect:null,measuringScheduled:!1},P2={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:Du,draggableNodes:new Map,over:null,measureDroppableContainers:Du},Vu=v.createContext(P2),K2=v.createContext(U2);function I2(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new go}}}function F2(e,t){switch(t.type){case ui.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case ui.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 ui.DragEnd:case ui.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case ui.RegisterDroppable:{const{element:n}=t,{id:a}=n,o=new go(e.droppable.containers);return o.set(a,n),{...e,droppable:{...e.droppable,containers:o}}}case ui.SetDroppableDisabled:{const{id:n,key:a,disabled:o}=t,c=e.droppable.containers.get(n);if(!c||a!==c.key)return e;const h=new go(e.droppable.containers);return h.set(n,{...c,disabled:o}),{...e,droppable:{...e.droppable,containers:h}}}case ui.UnregisterDroppable:{const{id:n,key:a}=t,o=e.droppable.containers.get(n);if(!o||a!==o.key)return e;const c=new go(e.droppable.containers);return c.delete(n),{...e,droppable:{...e.droppable,containers:c}}}default:return e}}function q2(e){let{disabled:t}=e;const{active:n,activatorEvent:a,draggableNodes:o}=v.useContext(Vu),c=If(a),h=If(n?.id);return v.useEffect(()=>{if(!t&&!a&&c&&h!=null){if(!n0(c)||document.activeElement===c.target)return;const f=o.get(h);if(!f)return;const{activatorNode:_,node:p}=f;if(!_.current&&!p.current)return;requestAnimationFrame(()=>{for(const b of[_.current,p.current]){if(!b)continue;const y=Hx(b);if(y){y.focus();break}}})}},[a,t,o,h,c]),null}function W2(e,t){let{transform:n,...a}=t;return e!=null&&e.length?e.reduce((o,c)=>c({transform:o,...a}),n):n}function $2(e){return v.useMemo(()=>({draggable:{...du.draggable,...e?.draggable},droppable:{...du.droppable,...e?.droppable},dragOverlay:{...du.dragOverlay,...e?.dragOverlay}}),[e?.draggable,e?.droppable,e?.dragOverlay])}function Y2(e){let{activeNode:t,measure:n,initialRect:a,config:o=!0}=e;const c=v.useRef(!1),{x:h,y:f}=typeof o=="boolean"?{x:o,y:o}:o;gr(()=>{if(!h&&!f||!t){c.current=!1;return}if(c.current||!a)return;const p=t?.node.current;if(!p||p.isConnected===!1)return;const b=n(p),y=a0(b,a);if(h||(y.x=0),f||(y.y=0),c.current=!0,Math.abs(y.x)>0||Math.abs(y.y)>0){const w=l0(p);w&&w.scrollBy({top:y.y,left:y.x})}},[t,h,f,a,n])}const b0=v.createContext({...Vs,scaleX:1,scaleY:1});var hr;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(hr||(hr={}));const V2=v.memo(function(t){var n,a,o,c;let{id:h,accessibility:f,autoScroll:_=!0,children:p,sensors:b=j2,collisionDetection:y=Qx,measuring:w,modifiers:x,...C}=t;const E=v.useReducer(F2,void 0,I2),[B,T]=E,[Y,P]=qx(),[X,ee]=v.useState(hr.Uninitialized),te=X===hr.Initialized,{draggable:{active:se,nodes:le,translate:de},droppable:{containers:N}}=B,U=se!=null?le.get(se):null,K=v.useRef({initial:null,translated:null}),j=v.useMemo(()=>{var gt;return se!=null?{id:se,data:(gt=U?.data)!=null?gt:H2,rect:K}:null},[se,U]),z=v.useRef(null),[G,M]=v.useState(null),[q,V]=v.useState(null),_e=Co(C,Object.values(C)),be=$u("DndDescribedBy",h),D=v.useMemo(()=>N.getEnabled(),[N]),W=$2(w),{droppableRects:re,measureDroppableContainers:he,measuringScheduled:ve}=E2(D,{dragging:te,dependencies:[de.x,de.y],config:W.droppable}),pe=C2(le,se),ke=v.useMemo(()=>q?Ff(q):null,[q]),me=ws(),Se=T2(pe,W.draggable.measure);Y2({activeNode:se!=null?le.get(se):null,config:me.layoutShiftCompensation,initialRect:Se,measure:W.draggable.measure});const Me=sb(pe,W.draggable.measure,Se),Ue=sb(pe?pe.parentElement:null),Ke=v.useRef({activatorEvent:null,active:null,activeNode:pe,collisionRect:null,collisions:null,droppableRects:re,draggableNodes:le,draggingNode:null,draggingNodeRect:null,droppableContainers:N,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),we=N.getNodeFor((n=Ke.current.over)==null?void 0:n.id),ie=z2({measure:W.dragOverlay.measure}),De=(a=ie.nodeRef.current)!=null?a:pe,Ce=te?(o=ie.rect)!=null?o:Me:null,Pe=!!(ie.nodeRef.current&&ie.rect),$e=R2(Pe?null:Me),St=y0(De?as(De):null),dt=M2(te?we??pe:null),wi=B2(dt),Q=W2(x,{transform:{x:de.x-$e.x,y:de.y-$e.y,scaleX:1,scaleY:1},activatorEvent:q,active:j,activeNodeRect:Me,containerNodeRect:Ue,draggingNodeRect:Ce,over:Ke.current.over,overlayNodeRect:ie.rect,scrollableAncestors:dt,scrollableAncestorRects:wi,windowRect:St}),Fe=ke?Wa(ke,de):null,Oe=N2(dt),kt=rb(Oe),Ui=rb(Oe,[Me]),Li=Wa(Q,kt),Yt=Ce?t2(Ce,Q):null,Xi=j&&Yt?y({active:j,collisionRect:Yt,droppableRects:re,droppableContainers:D,pointerCoordinates:Fe}):null,Bi=Gx(Xi,"id"),[Gi,Xs]=v.useState(null),ls=Pe?Q:Wa(Q,Ui),Kt=Jx(ls,(c=Gi?.rect)!=null?c:null,Me),Ci=v.useRef(null),Bt=v.useCallback((gt,wt)=>{let{sensor:Ot,options:ii}=wt;if(z.current==null)return;const Dt=le.get(z.current);if(!Dt)return;const Vt=gt.nativeEvent,si=new Ot({active:z.current,activeNode:Dt,event:Vt,options:ii,context:Ke,onAbort(Ct){if(!le.get(Ct))return;const{onDragAbort:It}=_e.current,Ti={id:Ct};It?.(Ti),Y({type:"onDragAbort",event:Ti})},onPending(Ct,Ki,It,Ti){if(!le.get(Ct))return;const{onDragPending:Ii}=_e.current,ki={id:Ct,constraint:Ki,initialCoordinates:It,offset:Ti};Ii?.(ki),Y({type:"onDragPending",event:ki})},onStart(Ct){const Ki=z.current;if(Ki==null)return;const It=le.get(Ki);if(!It)return;const{onDragStart:Ti}=_e.current,ot={activatorEvent:Vt,active:{id:Ki,data:It.data,rect:K}};ao.unstable_batchedUpdates(()=>{Ti?.(ot),ee(hr.Initializing),T({type:ui.DragStart,initialCoordinates:Ct,active:Ki}),Y({type:"onDragStart",event:ot}),M(Ci.current),V(Vt)})},onMove(Ct){T({type:ui.DragMove,coordinates:Ct})},onEnd:Ei(ui.DragEnd),onCancel:Ei(ui.DragCancel)});Ci.current=si;function Ei(Ct){return async function(){const{active:It,collisions:Ti,over:ot,scrollAdjustedTranslate:Ii}=Ke.current;let ki=null;if(It&&Ii){const{cancelDrop:Fi}=_e.current;ki={activatorEvent:Vt,active:It,collisions:Ti,delta:Ii,over:ot},Ct===ui.DragEnd&&typeof Fi=="function"&&await Promise.resolve(Fi(ki))&&(Ct=ui.DragCancel)}z.current=null,ao.unstable_batchedUpdates(()=>{T({type:Ct}),ee(hr.Uninitialized),Xs(null),M(null),V(null),Ci.current=null;const Fi=Ct===ui.DragEnd?"onDragEnd":"onDragCancel";if(ki){const nt=_e.current[Fi];nt?.(ki),Y({type:Fi,event:ki})}})}}},[le]),xi=v.useCallback((gt,wt)=>(Ot,ii)=>{const Dt=Ot.nativeEvent,Vt=le.get(ii);if(z.current!==null||!Vt||Dt.dndKit||Dt.defaultPrevented)return;const si={active:Vt};gt(Ot,wt.options,si)===!0&&(Dt.dndKit={capturedBy:wt.sensor},z.current=ii,Bt(Ot,wt))},[le,Bt]),Pi=x2(b,xi);A2(b),gr(()=>{Me&&X===hr.Initializing&&ee(hr.Initialized)},[Me,X]),v.useEffect(()=>{const{onDragMove:gt}=_e.current,{active:wt,activatorEvent:Ot,collisions:ii,over:Dt}=Ke.current;if(!wt||!Ot)return;const Vt={active:wt,activatorEvent:Ot,collisions:ii,delta:{x:Li.x,y:Li.y},over:Dt};ao.unstable_batchedUpdates(()=>{gt?.(Vt),Y({type:"onDragMove",event:Vt})})},[Li.x,Li.y]),v.useEffect(()=>{const{active:gt,activatorEvent:wt,collisions:Ot,droppableContainers:ii,scrollAdjustedTranslate:Dt}=Ke.current;if(!gt||z.current==null||!wt||!Dt)return;const{onDragOver:Vt}=_e.current,si=ii.get(Bi),Ei=si&&si.rect.current?{id:si.id,rect:si.rect.current,data:si.data,disabled:si.disabled}:null,Ct={active:gt,activatorEvent:wt,collisions:Ot,delta:{x:Dt.x,y:Dt.y},over:Ei};ao.unstable_batchedUpdates(()=>{Xs(Ei),Vt?.(Ct),Y({type:"onDragOver",event:Ct})})},[Bi]),gr(()=>{Ke.current={activatorEvent:q,active:j,activeNode:pe,collisionRect:Yt,collisions:Xi,droppableRects:re,draggableNodes:le,draggingNode:De,draggingNodeRect:Ce,droppableContainers:N,over:Gi,scrollableAncestors:dt,scrollAdjustedTranslate:Li},K.current={initial:Ce,translated:Yt}},[j,pe,Xi,Yt,le,De,Ce,re,N,Gi,dt,Li]),b2({...me,delta:de,draggingRect:Yt,pointerCoordinates:Fe,scrollableAncestors:dt,scrollableAncestorRects:wi});const on=v.useMemo(()=>({active:j,activeNode:pe,activeNodeRect:Me,activatorEvent:q,collisions:Xi,containerNodeRect:Ue,dragOverlay:ie,draggableNodes:le,droppableContainers:N,droppableRects:re,over:Gi,measureDroppableContainers:he,scrollableAncestors:dt,scrollableAncestorRects:wi,measuringConfiguration:W,measuringScheduled:ve,windowRect:St}),[j,pe,Me,q,Xi,Ue,ie,le,N,re,Gi,he,dt,wi,W,ve,St]),Ss=v.useMemo(()=>({activatorEvent:q,activators:Pi,active:j,activeNodeRect:Me,ariaDescribedById:{draggable:be},dispatch:T,draggableNodes:le,over:Gi,measureDroppableContainers:he}),[q,Pi,j,Me,T,be,le,Gi,he]);return hi.createElement(r0.Provider,{value:P},hi.createElement(Vu.Provider,{value:Ss},hi.createElement(K2.Provider,{value:on},hi.createElement(b0.Provider,{value:Kt},p)),hi.createElement(q2,{disabled:f?.restoreFocus===!1})),hi.createElement(Yx,{...f,hiddenTextDescribedById:be}));function ws(){const gt=G?.autoScrollEnabled===!1,wt=typeof _=="object"?_.enabled===!1:_===!1,Ot=te&&!gt&&!wt;return typeof _=="object"?{..._,enabled:Ot}:{enabled:Ot}}}),X2=v.createContext(null),lb="button",G2="Draggable";function S0(e){let{id:t,data:n,disabled:a=!1,attributes:o}=e;const c=$u(G2),{activators:h,activatorEvent:f,active:_,activeNodeRect:p,ariaDescribedById:b,draggableNodes:y,over:w}=v.useContext(Vu),{role:x=lb,roleDescription:C="draggable",tabIndex:E=0}=o??{},B=_?.id===t,T=v.useContext(B?b0:X2),[Y,P]=Tu(),[X,ee]=Tu(),te=L2(h,t),se=Co(n);gr(()=>(y.set(t,{id:t,key:c,node:Y,activatorNode:X,data:se}),()=>{const de=y.get(t);de&&de.key===c&&y.delete(t)}),[y,t]);const le=v.useMemo(()=>({role:x,tabIndex:E,"aria-disabled":a,"aria-pressed":B&&x===lb?!0:void 0,"aria-roledescription":C,"aria-describedby":b.draggable}),[a,x,E,B,C,b.draggable]);return{active:_,activatorEvent:f,activeNodeRect:p,attributes:le,isDragging:B,listeners:a?void 0:te,node:Y,over:w,setNodeRef:P,setActivatorNodeRef:ee,transform:T}}const Z2="Droppable",Q2={timeout:25};function w0(e){let{data:t,disabled:n=!1,id:a,resizeObserverConfig:o}=e;const c=$u(Z2),{active:h,dispatch:f,over:_,measureDroppableContainers:p}=v.useContext(Vu),b=v.useRef({disabled:n}),y=v.useRef(!1),w=v.useRef(null),x=v.useRef(null),{disabled:C,updateMeasurementsFor:E,timeout:B}={...Q2,...o},T=Co(E??a),Y=v.useCallback(()=>{if(!y.current){y.current=!0;return}x.current!=null&&clearTimeout(x.current),x.current=setTimeout(()=>{p(Array.isArray(T.current)?T.current:[T.current]),x.current=null},B)},[B]),P=Yu({callback:Y,disabled:C||!h}),X=v.useCallback((le,de)=>{P&&(de&&(P.unobserve(de),y.current=!1),le&&P.observe(le))},[P]),[ee,te]=Tu(X),se=Co(t);return v.useEffect(()=>{!P||!ee.current||(P.disconnect(),y.current=!1,P.observe(ee.current))},[ee,P]),v.useEffect(()=>(f({type:ui.RegisterDroppable,element:{id:a,key:c,disabled:n,node:ee,rect:w,data:se}}),()=>f({type:ui.UnregisterDroppable,key:c,id:a})),[a]),v.useEffect(()=>{n!==b.current.disabled&&(f({type:ui.SetDroppableDisabled,id:a,key:c,disabled:n}),b.current.disabled=n)},[a,c,n,f]),{active:h,rect:w,isOver:_?.id===a,node:ee,over:_,setNodeRef:te}}const J2=128,eE=512,tE=64,iE=4096;function C0(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>J2)return null;const n=t.workspaces.map(sE);return n.some(a=>a===null)?null:{activeWorkspaceId:t.activeWorkspaceId,workspaces:n}}function sE(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>eE)return null;const n=t.tabs.map(nE);return n.some(a=>a===null)?null:{id:t.id,title:t.title,activeTabId:t.activeTabId,tabs:n}}function nE(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=rE(t.root);return n?{id:t.id,title:t.title,activeTerminalId:t.activeTerminalId,root:n}:null}function rE(e){if(!e||typeof e!="object")return null;let t=0;return Vf(e,1,()=>(t+=1,t<=iE))}function Vf(e,t,n){if(!e||typeof e!="object"||t>tE||!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=Vf(a.first,t+1,n),c=Vf(a.second,t+1,n);return!o||!c?null:{type:"split",direction:a.direction,ratio:aE(a.ratio),first:o,second:c}}function aE(e){return typeof e=="number"&&Number.isFinite(e)?Math.min(.9,Math.max(.1,e)):.5}const x0=[{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 ob(e){return e===void 0?"unknown":e==="error"?"offline":"ok"}function cb(e){const t=e.trim();return t?t.charAt(0).toUpperCase():"?"}const ub="Local",lE=3e4,E0="nterminal.serverList.viewMode.v1";function oE(){try{return window.localStorage.getItem(E0)==="list"?"list":"stats"}catch{return"stats"}}function cE(e){try{window.localStorage.setItem(E0,e)}catch{}}function fu(e){return e===void 0?"":e==="error"?"offline":[`CPU ${Hs(e.cpuPercent)} ${km(e)}`,`MEM ${Hs(e.memoryPercent)} ${An(e.memoryUsedBytes,e.memoryTotalBytes)}`,`DISK ${Hs(e.diskPercent)} ${An(e.diskUsedBytes,e.diskTotalBytes)}`,`SWAP ${Hs(e.swapPercent)} ${An(e.swapUsedBytes,e.swapTotalBytes)}`].join(" · ")}function uE(e){if(!(e===void 0||e==="error"))return[`CPU ${Hs(e.cpuPercent)} (${km(e)})`,`RAM ${Hs(e.memoryPercent)} (${An(e.memoryUsedBytes,e.memoryTotalBytes)})`,`Disk ${Hs(e.diskPercent)} (${An(e.diskUsedBytes,e.diskTotalBytes)})`,`Swap ${Hs(e.swapPercent)} (${An(e.swapUsedBytes,e.swapTotalBytes)})`].join(" · ")}function hb(e,t){const n=fu(t);return`${e}${n?` — ${n}`:""}. Double-click to rename.`}function Hs(e){return typeof e=="number"&&Number.isFinite(e)?`${Math.round(e)}%`:"–"}function km(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`:`${Xf(e.cpuPercent/100*t)}/${t} cores`}function An(e,t){return!db(e)||!db(t)?"–/–":hE(e,t)}function hE(e,t){const n=t>=1073741824?"GB":t>=1048576?"MB":"KB",a=n==="GB"?1024**3:n==="MB"?1024**2:1024;return`${Xf(e/a)}/${Xf(t/a)} ${n}`}function Xf(e){return e>=10||Number.isInteger(e)?e.toFixed(0):e.toFixed(1)}function db(e){return typeof e=="number"&&Number.isFinite(e)&&e>=0}function Qc(e){return typeof e!="number"||!Number.isFinite(e)?"normal":e>95?"danger":e>90?"warning":"normal"}function dE(e){return[{label:"CPU",percent:Hs(e.cpuPercent),detail:km(e),tone:Qc(e.cpuPercent)},{label:"MEM",percent:Hs(e.memoryPercent),detail:An(e.memoryUsedBytes,e.memoryTotalBytes),tone:Qc(e.memoryPercent)},{label:"DISK",percent:Hs(e.diskPercent),detail:An(e.diskUsedBytes,e.diskTotalBytes),tone:Qc(e.diskPercent)},{label:"SWAP",percent:Hs(e.swapPercent),detail:An(e.swapUsedBytes,e.swapTotalBytes),tone:Qc(e.swapPercent)}]}function fb({entry:e}){return e==="error"?m.jsx("span",{className:"server-list-stats server-list-stats--offline",children:"offline"}):e===void 0?m.jsx("span",{className:"server-list-stats server-list-stats-grid","aria-hidden":"true",children:["CPU","MEM","DISK","SWAP"].map(t=>m.jsxs("span",{className:"server-list-stat-cell",children:[m.jsx("span",{className:"server-list-stat-label",children:t}),m.jsx("span",{className:"server-list-stat-value",children:"–"}),m.jsx("span",{className:"server-list-stat-detail",children:"–"})]},t))}):m.jsx("span",{className:"server-list-stats server-list-stats-grid",title:uE(e),children:dE(e).map(t=>m.jsxs("span",{className:"server-list-stat-cell",children:[m.jsx("span",{className:"server-list-stat-label",children:t.label}),m.jsx("span",{className:"server-list-stat-value","data-tone":t.tone,children:t.percent}),m.jsx("span",{className:"server-list-stat-detail",children:t.detail})]},t.label))})}function vf({api:e,activeAgentId:t,onSelectServer:n,onSessionInvalid:a,refreshToken:o=0,compact:c=!1}){const[h,f]=v.useState([]),[_,p]=v.useState(null),[b,y]=v.useState(null),[w,x]=v.useState(""),C=v.useRef(null),[E,B]=v.useState(()=>oE()),[T,Y]=v.useState({});v.useEffect(()=>{let N=!1;return e.listAgents().then(U=>{N||f(U.agents)}).catch(()=>{}),e.getMainInfo().then(U=>{N||p(U.name)}).catch(()=>{}),()=>{N=!0}},[e,o]),v.useEffect(()=>{b&&(C.current?.focus(),C.current?.select())},[b]),v.useEffect(()=>{let N=!1;function U(){const j=[{key:"__main__",load:()=>e.getMainStats()},...h.map(G=>({key:G.id,load:()=>e.getAgentStats(G.id)}))],z=new Set(j.map(G=>G.key));Y(G=>{const M={};for(const q of z)q in G&&(M[q]=G[q]);return M});for(const G of j)G.load().then(M=>{N||Y(q=>z.has(G.key)?{...q,[G.key]:M}:q)}).catch(M=>{if(!N){if(M instanceof Nn&&M.status===401){a?.();return}Y(q=>z.has(G.key)?{...q,[G.key]:"error"}:q)}})}U();const K=window.setInterval(U,lE);return()=>{N=!0,window.clearInterval(K)}},[e,h,a]);function P(N){N==="main"?(x(_??""),y({kind:"main"})):(x(N.name),y({kind:"agent",id:N.id}))}async function X(){if(!b)return;const N=w.trim(),U=b;if(y(null),U.kind==="main"){const K=N||"";try{const j=await e.renameMain(K);p(j.name)}catch{}}else{if(!N)return;const K=h.find(j=>j.id===U.id)?.name;f(j=>j.map(z=>z.id===U.id?{...z,name:N}:z));try{await e.renameAgent(U.id,N)}catch{K!==void 0&&f(j=>j.map(z=>z.id===U.id?{...z,name:K}:z))}}}function ee(){y(null)}function te(N){B(N),cE(N)}const se=_?.trim()||ub,le=b?.kind==="main",de=E==="stats";return c?m.jsxs("div",{className:"server-list server-list--compact",children:[m.jsxs("button",{type:"button",className:`server-list-chip${t===null?" server-list-chip--active":""}`,onClick:()=>n(null),"aria-label":se,title:`${se}${fu(T.__main__)?` — ${fu(T.__main__)}`:""}`,children:[m.jsx("span",{className:"server-list-chip-initial",children:cb(se)}),m.jsx("span",{className:"server-list-chip-pip","data-status":ob(T.__main__)})]}),h.map(N=>{const U=T[N.id],K=fu(U);return m.jsxs("button",{type:"button",className:`server-list-chip${t===N.id?" server-list-chip--active":""}`,onClick:()=>n(N.id),"aria-label":N.name,title:`${N.name}${K?` — ${K}`:""}`,children:[m.jsx("span",{className:"server-list-chip-initial",children:cb(N.name)}),m.jsx("span",{className:"server-list-chip-pip","data-status":ob(U)})]},N.id)})]}):m.jsxs("div",{className:`server-list server-list--${E}`,children:[m.jsxs("div",{className:"server-list-toolbar","aria-label":"Server list display",children:[m.jsx("button",{type:"button",className:"server-list-view-button","aria-pressed":E==="list",onClick:()=>te("list"),title:"Show server names only",children:"List"}),m.jsx("button",{type:"button",className:"server-list-view-button","aria-pressed":E==="stats",onClick:()=>te("stats"),title:"Show resource usage",children:"Stats"})]}),m.jsx("div",{className:"server-list-row",children:le?m.jsx("form",{className:"server-list-editor",onSubmit:N=>{N.preventDefault(),X()},children:m.jsx("input",{ref:C,"aria-label":"Rename main server",value:w,onChange:N=>x(N.target.value),onBlur:()=>{X()},onKeyDown:N=>{N.key==="Escape"&&(N.preventDefault(),ee())},placeholder:ub})}):m.jsxs("button",{type:"button",className:`server-list-item${t===null?" server-list-item--active":""}`,onClick:()=>n(null),onDoubleClick:N=>{N.preventDefault(),P("main")},title:hb(se,T.__main__),children:[m.jsxs("span",{className:"server-list-item-header",children:[m.jsx("span",{className:"server-list-dot"}),m.jsx("span",{className:"server-list-name",children:se})]}),de?m.jsx(fb,{entry:T.__main__}):null]})}),h.map(N=>{const U=b?.kind==="agent"&&b.id===N.id;return m.jsx("div",{className:"server-list-row",children:U?m.jsx("form",{className:"server-list-editor",onSubmit:K=>{K.preventDefault(),X()},children:m.jsx("input",{ref:C,"aria-label":`Rename ${N.name}`,value:w,onChange:K=>x(K.target.value),onBlur:()=>{X()},onKeyDown:K=>{K.key==="Escape"&&(K.preventDefault(),ee())}})}):m.jsxs("button",{type:"button",className:`server-list-item${t===N.id?" server-list-item--active":""}`,onClick:()=>n(N.id),onDoubleClick:K=>{K.preventDefault(),P({id:N.id,name:N.name})},title:hb(N.name,T[N.id]),children:[m.jsxs("span",{className:"server-list-item-header",children:[m.jsx("span",{className:"server-list-dot"}),m.jsx("span",{className:"server-list-name",title:N.url,children:N.name})]}),de?m.jsx(fb,{entry:T[N.id]}):null]})},N.id)})]})}function fE({api:e}){const[t,n]=v.useState([]),[a,o]=v.useState([]),[c,h]=v.useState(!1),[f,_]=v.useState(null),[p,b]=v.useState(""),[y,w]=v.useState("");async function x(){try{const[T,Y,P]=await Promise.all([e.listDevices(),e.listNetworks(),e.getSession()]);n(T.devices),o(Y.networks),h(P.totpEnabled),_(null)}catch(T){_(T instanceof Error?T.message:"Failed to load")}}v.useEffect(()=>{x()},[]);async function C(T){await e.revokeDevice(T),await x()}async function E(T){await e.removeNetwork(T),await x()}async function B(T){T.preventDefault(),_(null);try{await e.addNetwork({value:p.trim(),label:y.trim()}),b(""),w(""),await x()}catch(Y){_(Y instanceof Error?Y.message:"Failed to add network")}}return m.jsxs(m.Fragment,{children:[f?m.jsx("p",{className:"form-error",children:f}):null,m.jsxs("section",{className:"security-section",children:[m.jsx("h3",{children:"Trusted devices"}),m.jsx("p",{className:"muted",children:"Devices that can re-authenticate with a 2FA code only (no password) for 30 days."}),t.length===0?m.jsx("p",{className:"muted",children:"No trusted devices."}):m.jsx("ul",{className:"security-list",children:t.map(T=>m.jsxs("li",{children:[m.jsxs("div",{children:[m.jsxs("span",{className:"security-item-label",children:[T.label,T.current?m.jsx("span",{className:"security-badge",children:"this device"}):null]}),m.jsxs("span",{className:"security-item-meta",children:["last seen ",new Date(T.lastSeenAt).toLocaleString()]})]}),m.jsx("button",{type:"button",className:"security-remove",onClick:()=>{C(T.id)},children:"revoke"})]},T.id))})]}),m.jsxs("section",{className:"security-section",children:[m.jsx("h3",{children:"Trusted networks"}),m.jsx("p",{className:"muted",children:"Sessions from these IPs/ranges skip the 2FA re-auth prompt."}),a.length===0?m.jsx("p",{className:"muted",children:"No trusted networks."}):m.jsx("ul",{className:"security-list",children:a.map(T=>m.jsxs("li",{children:[m.jsxs("div",{children:[m.jsx("span",{className:"security-item-label",children:T.value}),T.label!==T.value?m.jsx("span",{className:"security-item-meta",children:T.label}):null]}),m.jsx("button",{type:"button",className:"security-remove",onClick:()=>{E(T.id)},children:"remove"})]},T.id))}),m.jsxs("form",{className:"security-add-form",onSubmit:B,children:[m.jsx("input",{type:"text",placeholder:"IP or CIDR (e.g. 203.0.113.4 or 192.168.0.0/24)",value:p,onChange:T=>b(T.currentTarget.value),required:!0}),m.jsx("input",{type:"text",placeholder:"Label (optional)",value:y,onChange:T=>w(T.currentTarget.value)}),m.jsx("button",{type:"submit",disabled:!p.trim(),children:"Add"})]})]}),c?m.jsxs("section",{className:"security-section",children:[m.jsx("h3",{children:"Two-factor authentication"}),m.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."}),m.jsx("button",{type:"button",className:"security-remove",onClick:async()=>{await e.disableTotp(),await x()},children:"Disable 2FA"})]}):null]})}const T0="nterminal.notifications.completionEnabled",Dm="nterminal.notifications.completionToastEnabled",Rm="nterminal.notifications.completionToastDurationSeconds",Mm="nterminal.notifications.completionToastPersistent",Gf="nterminal:completion-toast-display",vo=6.5,Zf=2,Qf=60;function Xu(){return typeof window<"u"&&"Notification"in window}function k0(){try{return window.localStorage.getItem(T0)==="true"}catch{return!1}}function pb(e){try{window.localStorage.setItem(T0,e?"true":"false")}catch{}}function Qr(){return{enabled:gE(),durationSeconds:_E(),persistUntilDismissed:vE()}}function pE(e){if(typeof window<"u"){try{window.localStorage.setItem(Dm,e?"true":"false")}catch{}Am()}return Qr()}function mb(e){const t=R0(e);if(typeof window<"u"){try{window.localStorage.setItem(Rm,String(t))}catch{}Am()}return Qr()}function mE(e){if(typeof window<"u"){try{window.localStorage.setItem(Mm,e?"true":"false")}catch{}Am()}return Qr()}function D0(e){if(typeof window>"u")return()=>{};const t=n=>{(n.key===Dm||n.key===Rm||n.key===Mm)&&e()};return window.addEventListener(Gf,e),window.addEventListener("storage",t),()=>{window.removeEventListener(Gf,e),window.removeEventListener("storage",t)}}function Nm(){return Xu()?window.Notification.permission:"unsupported"}function _E(){if(typeof window>"u")return vo;try{const e=window.localStorage.getItem(Rm);return e===null?vo:R0(Number(e))}catch{return vo}}function gE(){if(typeof window>"u")return!0;try{return window.localStorage.getItem(Dm)!=="false"}catch{return!0}}function vE(){if(typeof window>"u")return!1;try{return window.localStorage.getItem(Mm)==="true"}catch{return!1}}function R0(e){if(!Number.isFinite(e))return vo;const t=Math.round(e*2)/2;return Math.max(Zf,Math.min(Qf,t))}function Am(){typeof window<"u"&&window.dispatchEvent(new CustomEvent(Gf))}async function yE(){if(!Xu())return"unsupported";try{return await window.Notification.requestPermission()}catch{return Nm()}}function bE(e){if(!Xu()||Nm()!=="granted"||!k0()||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 SE=1500,Lm="nterminal.terminal.fontSize",Bm="nterminal.terminal.fontFamily",Jf="nterminal:terminal-font-size",ep="nterminal:terminal-font-family",tp=11,ip=20,Gr=14,Mu=[{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:[]}],Va="meslo";sp(Va);async function yf(e=Gr,t=Va){if(typeof document>"u"||!document.fonts)return;const n=A0(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,SE)})])}function M0(e){const t=typeof e=="number"?e:Number(e);if(!Number.isFinite(t))return Gr;const n=Math.round(t);return Math.max(tp,Math.min(ip,n))}function N0(e){return Mu.some(t=>t.id===e)?e:Va}function sp(e){return A0(e).cssFamily}function A0(e){return Mu.find(t=>t.id===e)??Mu[0]}function np(){if(typeof window>"u")return Gr;try{const e=window.localStorage.getItem(Lm);return e?M0(e):Gr}catch{return Gr}}function rp(){if(typeof window>"u")return Va;try{return N0(window.localStorage.getItem(Bm))}catch{return Va}}function Jc(e){const t=M0(e);if(typeof window>"u")return t;try{window.localStorage.setItem(Lm,String(t))}catch{}return window.dispatchEvent(new CustomEvent(Jf,{detail:t})),t}function wE(e){const t=N0(e);if(typeof window>"u")return t;try{window.localStorage.setItem(Bm,t)}catch{}return window.dispatchEvent(new CustomEvent(ep,{detail:t})),t}function L0(e){if(typeof window>"u")return()=>{};const t=n=>{n.key===Lm&&e()};return window.addEventListener(Jf,e),window.addEventListener("storage",t),()=>{window.removeEventListener(Jf,e),window.removeEventListener("storage",t)}}function B0(e){if(typeof window>"u")return()=>{};const t=n=>{n.key===Bm&&e()};return window.addEventListener(ep,e),window.addEventListener("storage",t),()=>{window.removeEventListener(ep,e),window.removeEventListener("storage",t)}}const Om="nterminal.terminal.showScrollProgress",ap="nterminal:terminal-scroll-progress";function lp(){if(typeof window>"u")return!0;try{return window.localStorage.getItem(Om)!=="false"}catch{return!0}}function CE(e){if(typeof window<"u"){try{window.localStorage.setItem(Om,e?"true":"false")}catch{}window.dispatchEvent(new CustomEvent(ap,{detail:e}))}return e}function O0(e){if(typeof window>"u")return()=>{};const t=n=>{n.key===Om&&e()};return window.addEventListener(ap,e),window.addEventListener("storage",t),()=>{window.removeEventListener(ap,e),window.removeEventListener("storage",t)}}const zm="nterminal.shortcuts.workspace.v1",op="nterminal:workspace-shortcuts",Eo=[{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"}],jm={"server.previous":Hi("ArrowUp",{ctrlKey:!0}),"server.next":Hi("ArrowDown",{ctrlKey:!0}),"tab.previous":Hi("ArrowLeft",{ctrlKey:!0}),"tab.next":Hi("ArrowRight",{ctrlKey:!0}),"tab.index":Hi("Digit",{ctrlKey:!0,altKey:!0}),"pane.index":Hi("Digit",{ctrlKey:!0,altKey:!0,shiftKey:!0}),"split.right":Hi("ArrowRight",{ctrlKey:!0,altKey:!0,shiftKey:!0}),"split.down":Hi("ArrowDown",{ctrlKey:!0,altKey:!0,shiftKey:!0})},xE={"server.previous":Hi("BracketLeft",{ctrlKey:!0,altKey:!0,shiftKey:!0}),"server.next":Hi("BracketRight",{ctrlKey:!0,altKey:!0,shiftKey:!0}),"tab.previous":Hi("BracketLeft",{ctrlKey:!0,altKey:!0}),"tab.next":Hi("BracketRight",{ctrlKey:!0,altKey:!0}),"tab.index":Hi("Digit",{ctrlKey:!0,altKey:!0,shiftKey:!0}),"pane.index":Hi("Digit",{ctrlKey:!0,altKey:!0}),"split.right":Hi("ArrowRight",{ctrlKey:!0,altKey:!0,shiftKey:!0}),"split.down":Hi("ArrowDown",{ctrlKey:!0,altKey:!0,shiftKey:!0})};function Jr(){const e=U0(jm);if(typeof window>"u")return e;try{const t=window.localStorage.getItem(zm);if(!t)return e;const n=JSON.parse(t);for(const a of Eo){const o=n[a.id];if(LE(o)){const c=P0(o,a);AE(c,xE[a.id])||(e[a.id]=c)}}}catch{return e}return e}function _b(){return JSON.stringify(Jr())}function EE(e,t){const n=Jr(),a=Eo.find(o=>o.id===e);return a&&(n[e]=P0(t,a),Hm(n)),n}function TE(e){const t=Jr();return t[e]={...jm[e]},Hm(t),t}function kE(){const e=U0(jm);return Hm(e),e}function z0(e){if(typeof window>"u")return()=>{};const t=n=>{n.key===zm&&e()};return window.addEventListener(op,e),window.addEventListener("storage",t),()=>{window.removeEventListener(op,e),window.removeEventListener("storage",t)}}function DE(e,t){const n=I0(e);return!n||OE(n)||t.indexed&&K0(e)===null?null:{ctrlKey:e.ctrlKey,altKey:e.altKey,shiftKey:e.shiftKey,metaKey:e.metaKey,code:t.indexed?"Digit":n}}function RE(e){const t=Jr();for(const n of Eo){const a=t[n.id];if(!(!a||!BE(e,a))){if(n.indexed){if(a.code!=="Digit")continue;const o=K0(e);if(o!==null)return{id:n.id,index:o};continue}if(I0(e)===a.code)return{id:n.id,index:null}}}return null}function j0(e){return H0(Jr()[e])}function H0(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(zE(e.code)),t.join("+")}const ME=()=>j0("split.right"),NE=()=>j0("split.down");function Hi(e,t){return{ctrlKey:t.ctrlKey??!1,altKey:t.altKey??!1,shiftKey:t.shiftKey??!1,metaKey:t.metaKey??!1,code:e}}function U0(e){return Object.fromEntries(Object.entries(e).map(([t,n])=>[t,{...n}]))}function AE(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(zm,JSON.stringify(e))}catch{}window.dispatchEvent(new CustomEvent(op))}}function P0(e,t){return{ctrlKey:!!e.ctrlKey,altKey:!!e.altKey,shiftKey:!!e.shiftKey,metaKey:!!e.metaKey,code:t.indexed?"Digit":e.code}}function LE(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 BE(e,t){return e.ctrlKey===t.ctrlKey&&e.altKey===t.altKey&&e.shiftKey===t.shiftKey&&e.metaKey===t.metaKey}function K0(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 I0(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 OE(e){return e==="ControlLeft"||e==="ControlRight"||e==="AltLeft"||e==="AltRight"||e==="ShiftLeft"||e==="ShiftRight"||e==="MetaLeft"||e==="MetaRight"}function zE(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 jE="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 HE(e="nterminal",t=new Date){return{reason:"permission",message:jE,command:`sudo npm i -g ${e}@latest --prefer-online && nterminal restart-after-update`,detectedAt:t.toISOString()}}function UE(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 F0=3600*1e3,PE="local",cp=new Set,pr=new Map;let vr={checking:!1,hasUpdates:!1,lastCheckedAt:null},Um=null,yo=null,Nu=0,ur=null;function KE(e){return cp.add(e),()=>{cp.delete(e)}}function gb(){return vr}function IE(e){const t=YE();Um=e,Pm(),up(e,t);const n=()=>{if(document.visibilityState!=="visible"||!yr(e,t))return;const a=vr.lastCheckedAt;(a===null||Date.now()-a>=F0)&&up(e,t)};return document.addEventListener("visibilitychange",n),()=>{document.removeEventListener("visibilitychange",n),yr(e,t)&&$E()}}function FE(e,t){pr.set(e,q0(t)),Xa({...vr,hasUpdates:Km(),lastCheckedAt:Date.now()})}function bf(e){e===void 0?pr.clear():pr.set(e,!1),Xa({...vr,hasUpdates:Km()})}async function up(e,t){if(!yr(e,t))return;if(ur&&ur.api===e&&ur.runId===t)return ur.promise;Xa({...vr,checking:!0});const n=qE(e,t).finally(()=>{ur?.promise===n&&(ur=null),yr(e,t)&&(Xa({...vr,checking:!1,lastCheckedAt:Date.now()}),WE(e,t))});return ur={api:e,runId:t,promise:n},n}async function qE(e,t){try{const n=await e.listAgents();if(!yr(e,t))return;const a=[{key:PE,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 h=await c.check();o.set(c.key,q0(h))}catch{o.set(c.key,pr.get(c.key)??!1)}})),!yr(e,t))return;pr.clear();for(const[c,h]of o)pr.set(c,h);Xa({...vr,hasUpdates:Km()})}catch{}}function WE(e,t){yr(e,t)&&(Pm(),yo=window.setTimeout(()=>{yo=null,yr(e,t)&&up(e,t)},F0))}function $E(){Nu+=1,Pm(),Um=null,ur=null,pr.clear(),Xa({checking:!1,hasUpdates:!1,lastCheckedAt:null})}function Pm(){yo!==null&&(window.clearTimeout(yo),yo=null)}function YE(){return Nu+=1,Nu}function yr(e,t){return Um===e&&Nu===t}function q0(e){return e.updateAvailable===!0}function Km(){return Array.from(pr.values()).some(Boolean)}function Xa(e){vr=e;for(const t of Array.from(cp))t()}const VE=e=>new Promise(t=>setTimeout(t,e));function XE({api:e,onAgentRemoved:t}){const[n,a]=v.useState([{key:"local",id:null,name:"Local (main)"}]),[o,c]=v.useState({}),[h,f]=v.useState(!1),[_,p]=v.useState(null),[b,y]=v.useState(!1);function w(N,U){c(K=>({...K,[N]:{...K[N],...U}}))}const x=N=>N.id===null?e.getVersion():e.getAgentVersion(N.id),C=N=>N.id===null?e.checkUpdate():e.checkAgentUpdate(N.id),E=N=>N.id===null?e.runUpdate():e.runAgentUpdate(N.id);v.useEffect(()=>{let N=!1;return e.listAgents().then(U=>{if(N)return;const K=[{key:"local",id:null,name:"Local (main)"},...U.agents.map(j=>({key:j.id,id:j.id,name:j.name}))];a(K);for(const j of K)x(j).then(z=>w(j.key,{version:z,manualUpdate:z.manualUpdate??null})).catch(z=>w(j.key,{error:z instanceof Error?z.message:"unreachable"}))}).catch(()=>{}),()=>{N=!0}},[]);async function B(N){w(N.key,{busy:!0,status:"checking…",error:void 0});try{const U=await C(N);FE(N.key,U),w(N.key,{latestVersion:U.latestVersion,updateAvailable:U.updateAvailable,status:se(U),...U.updateAvailable===!1?{manualUpdate:null}:{},busy:!1})}catch(U){w(N.key,{busy:!1,error:U instanceof Error?U.message:"check failed"})}}async function T(){f(!0),await Promise.all(n.map(N=>B(N))),f(!1)}async function Y(N,U){const K=Date.now()+18e4;for(;Date.now()<K;){await VE(3e3);try{const j=await x(N);if(U&&j.runningVersion!==U.runningVersion)return j}catch{}}return null}async function P(N){let U=o[N.key]?.version;if(!U)try{U=await x(N),w(N.key,{version:U,manualUpdate:U.manualUpdate??null})}catch(z){return w(N.key,{busy:!1,error:z instanceof Error?z.message:"version check failed"}),"failed"}w(N.key,{busy:!0,status:"updating…",error:void 0});let K;try{K=await E(N)}catch(z){return w(N.key,{busy:!1,error:z instanceof Error?z.message:"update failed"}),"failed"}if(!K.ok){const z=K.manualUpdate??(UE(K.message)?HE():null);return z?(w(N.key,{busy:!1,status:"manual update required",error:void 0,manualUpdate:z}),"manual"):(w(N.key,{busy:!1,status:void 0,error:K.message}),"failed")}if(!K.changed)return w(N.key,{busy:!1,status:"already up to date",updateAvailable:!1,manualUpdate:null}),bf(N.key),"unchanged";w(N.key,{status:"restarting…"});const j=await Y(N,U);return j?(w(N.key,{busy:!1,version:j,updateAvailable:!1,status:"updated",manualUpdate:j.manualUpdate??null}),bf(N.key),N.id===null&&(y(!0),p("Main server updated. Reload the page to use the new client.")),"updated"):(w(N.key,{busy:!1,status:void 0,error:"timed out — check the server log"}),"failed")}async function X(N){if(!(N.id===null||!window.confirm([`Delete secondary server "${N.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(`
|
|
15
|
+
`)))){w(N.key,{busy:!0,status:"deleting…",error:void 0}),p(null);try{const K=await e.uninstallAgent(N.id);a(j=>j.filter(z=>z.key!==N.key)),c(j=>{const z={...j};return delete z[N.key],z}),bf(N.key),t?.(N.id),p(K.message)}catch(K){w(N.key,{busy:!1,status:void 0,error:K instanceof Error?K.message:"delete failed"})}}}async function ee(){f(!0),p(null);const N=n.filter(M=>M.id!==null),U=n.find(M=>M.id===null),K=await Promise.all(N.map(M=>P(M))),j=K.filter(M=>M==="failed").length;let z=K.filter(M=>M==="manual").length,G=null;if(U&&(G=await P(U),G==="manual"&&(z+=1),G==="updated")){j>0&&p("Main server updated. Reload the page to use the new client. Some secondary servers failed; check their rows and retry."),f(!1);return}j>0&&z>0?p("Some servers failed and some need manual update. Check each marked row."):j>0?p("Some secondary servers failed to update. Check their rows and retry."):z>0&&p("Some servers need manual update. Copy and run the command shown on each marked server."),f(!1)}function te(N){return N?N.error?N.error:N.status?N.status:N.manualUpdate?"manual update required":N.version?`v${N.version.version}`:"…":"…"}function se(N){return N.error?N.error:typeof N.updateAvailable=="boolean"?N.updateAvailable?`latest v${N.latestVersion??"available"}`:"up to date":"unknown"}function le(N){const U=N?.version;return U?`npm package v${U.runningVersion}`:""}async function de(N,U){try{await GE(U),w(N,{copiedCommand:!0}),window.setTimeout(()=>w(N,{copiedCommand:!1}),1800)}catch(K){w(N,{error:K instanceof Error?K.message:"copy failed"})}}return m.jsxs("section",{className:"security-section",children:[m.jsx("h3",{children:"Servers"}),m.jsxs("div",{className:"update-actions",children:[m.jsx("button",{type:"button",className:"secondary-button",onClick:()=>{T()},disabled:h,children:"Check for updates"}),m.jsx("button",{type:"button",onClick:()=>{ee()},disabled:h,children:"Update all"})]}),_?m.jsx("p",{className:"settings-status",children:_}):null,b?m.jsxs("div",{className:"server-reload-required",role:"status",children:[m.jsx("span",{children:"Main server update is ready."}),m.jsx("button",{type:"button",onClick:()=>window.location.reload(),children:"Reload page"})]}):null,m.jsx("ul",{className:"security-list",children:n.map(N=>{const U=o[N.key],K=le(U),j=U?.manualUpdate??null,z=U?.version!==void 0&&U?.updateAvailable!==!1&&!U?.busy&&!h,G=N.id!==null&&!U?.busy&&!h;return m.jsxs("li",{children:[m.jsxs("div",{className:"server-row-main",children:[m.jsxs("div",{children:[m.jsx("span",{className:"security-item-label",children:N.name}),m.jsxs("span",{className:"security-item-meta",children:[K?`${K} — `:"",te(U)]})]}),j?m.jsxs("div",{className:"server-manual-update",children:[m.jsx("span",{children:j.message}),m.jsxs("div",{className:"server-manual-command",children:[m.jsx("code",{children:j.command}),m.jsx("button",{type:"button",className:"secondary-button",onClick:()=>{de(N.key,j.command)},children:U?.copiedCommand?"Copied":"Copy"})]})]}):null]}),m.jsxs("div",{className:"server-row-actions",children:[m.jsx("button",{type:"button",className:"secondary-button",onClick:()=>{P(N)},disabled:!z,children:U?.busy?"…":"Update"}),N.id!==null?m.jsx("button",{type:"button",className:"server-delete-button",onClick:()=>{X(N)},disabled:!G,children:"Delete"}):null]})]},N.key)})})]})}async function GE(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 eu=[{id:"appearance",label:"Appearance"},{id:"shortcuts",label:"Shortcuts"},{id:"notifications",label:"Notifications"},{id:"security",label:"Security"},{id:"servers",label:"Servers"}];function ZE({onClose:e,api:t,updateAvailable:n=!1,onNotificationAssetsChanged:a,onAgentRemoved:o}){const c=v.useMemo(()=>t??Fu(),[t]),[h,f]=v.useState(()=>np()),[_,p]=v.useState(()=>rp()),[b,y]=v.useState(()=>lp()),[w,x]=v.useState(()=>_r()),[C,E]=v.useState(()=>Jr()),[B,T]=v.useState(null),[Y,P]=v.useState(null),[X,ee]=v.useState("appearance"),[te,se]=v.useState(()=>k0()),[le,de]=v.useState(()=>Qr()),[N,U]=v.useState(()=>Nm()),[K,j]=v.useState([]),[z,G]=v.useState([]),[M,q]=v.useState([]),[V,_e]=v.useState(5*1024*1024),[be,D]=v.useState(!1),[W,re]=v.useState(null),he=v.useRef(null),ve=v.useRef(null),pe=v.useRef({appearance:null,shortcuts:null,notifications:null,security:null,servers:null}),ke=v.useMemo(()=>new Set(z),[z]),me=!QE(z,M);v.useEffect(()=>L0(()=>f(np())),[]),v.useEffect(()=>B0(()=>p(rp())),[]),v.useEffect(()=>O0(()=>y(lp())),[]),v.useEffect(()=>bm(()=>x(_r())),[]),v.useEffect(()=>z0(()=>E(Jr())),[]),v.useEffect(()=>D0(()=>de(Qr())),[]),v.useEffect(()=>{if(!B)return;const Q=Eo.find(Oe=>Oe.id===B);if(!Q)return;const Fe=Oe=>{if(Oe.preventDefault(),Oe.stopPropagation(),Oe.key==="Escape"){T(null),P(null);return}const kt=DE(Oe,Q);if(!kt){P(Q.indexed?"Press a shortcut ending in a number from 1 to 9.":"Press a complete shortcut.");return}E(EE(B,kt)),T(null),P(null)};return window.addEventListener("keydown",Fe,!0),()=>window.removeEventListener("keydown",Fe,!0)},[B]),v.useEffect(()=>{let Q=!1;return c.listNotificationAssets().then(Fe=>{Q||De(Fe)}).catch(Fe=>{Q||re(tu(Fe))}),()=>{Q=!0}},[c]);function Se(Q){f(Jc(Number(Q)))}function Me(Q){de(mb(Number(Q)))}function Ue(Q){ee(Q);const Fe=ve.current,Oe=pe.current[Q];if(!Fe||!Oe)return;const kt=Math.max(0,vb(Oe,Fe)-12);typeof Fe.scrollTo=="function"?Fe.scrollTo({top:kt,behavior:"smooth"}):Fe.scrollTop=kt}function Ke(){const Q=ve.current;if(!Q)return;if(Q.scrollTop+Q.clientHeight>=Q.scrollHeight-2){ee(eu[eu.length-1].id);return}let Fe="appearance";const Oe=Q.scrollTop+Math.min(180,Math.max(48,Q.clientHeight*.28));for(const kt of eu){const Ui=pe.current[kt.id];Ui&&vb(Ui,Q)<=Oe&&(Fe=kt.id)}ee(Fe)}function we(Q){E(TE(Q)),T(null),P(null)}function ie(){E(kE()),T(null),P(null)}function De(Q){const Fe=Q.assets.filter(Oe=>Oe.enabled).map(Oe=>Oe.id);j(Q.assets),G(Fe),q(Fe),_e(Q.maxFileBytes),re(null)}async function Ce(){if(te){pb(!1),se(!1);return}let Q=N;Q==="default"&&(Q=await yE(),U(Q)),Q==="granted"&&(pb(!0),se(!0))}async function Pe(Q){const Fe=Q?.[0];if(Fe){if(Fe.size>V){re(`File must be ${Sf(V)} or smaller.`),St();return}if(Fe.type!=="video/mp4"&&Fe.type!=="video/webm"){re("Upload an MP4 or WebM video."),St();return}D(!0),re(null);try{await c.uploadNotificationAsset(Fe),De(await c.listNotificationAssets()),a?.()}catch(Oe){re(tu(Oe))}finally{D(!1),St()}}}async function $e(Q){D(!0),re(null);try{await c.deleteNotificationAsset(Q),De(await c.listNotificationAssets()),a?.()}catch(Fe){re(tu(Fe))}finally{D(!1)}}function St(){he.current&&(he.current.value="")}function dt(Q,Fe){const Oe=new Set(z);if(Fe?Oe.add(Q):Oe.delete(Q),Oe.size===0){re("Keep at least one toast video selected.");return}re(null),G(Array.from(Oe))}async function wi(){if(z.length===0){re("Keep at least one toast video selected.");return}D(!0),re(null);try{const Q=await c.updateNotificationAssetSelection({enabledAssetIds:z});De(Q),a?.()}catch(Q){re(tu(Q))}finally{D(!1)}}return m.jsx("div",{className:"security-overlay",role:"dialog","aria-modal":"true","aria-label":"Settings",onClick:e,children:m.jsxs("div",{className:"security-panel settings-panel",onClick:Q=>Q.stopPropagation(),children:[m.jsxs("header",{className:"security-panel-header",children:[m.jsx("h2",{children:"Settings"}),m.jsx("button",{type:"button",className:"security-close","aria-label":"Close",onClick:e,children:"×"})]}),m.jsxs("div",{className:"settings-layout",children:[m.jsx("nav",{className:"settings-nav","aria-label":"Settings categories",children:eu.map(Q=>m.jsxs("button",{type:"button","data-active":X===Q.id?"true":"false","aria-current":X===Q.id?"true":void 0,onClick:()=>Ue(Q.id),children:[Q.label,Q.id==="servers"&&n?m.jsx("span",{className:"update-pulse-dot settings-update-dot","aria-hidden":"true"}):null]},Q.id))}),m.jsxs("div",{ref:ve,className:"settings-content",onScroll:Ke,children:[m.jsxs("section",{id:"settings-appearance",ref:Q=>{pe.current.appearance=Q},className:"security-section settings-section",children:[m.jsx("h3",{children:"Appearance"}),m.jsx("div",{className:"settings-section-heading",children:m.jsxs("div",{children:[m.jsx("span",{className:"settings-control-title",children:"Theme"}),m.jsx("p",{className:"muted settings-control-description",children:"Choose the workspace and terminal color preset."})]})}),m.jsx("div",{className:"settings-theme-picker",role:"radiogroup","aria-label":"Interface theme",children:Eu.map(Q=>m.jsxs("button",{type:"button",className:"settings-theme-card",role:"radio","aria-checked":w===Q.id,"data-active":w===Q.id?"true":"false",onClick:()=>x(Mx(Q.id)),style:{"--settings-theme-bg":Q.tokens.bg,"--settings-theme-bg-2":Q.tokens.bg2,"--settings-theme-sidebar":Q.tokens.bgSidebar,"--settings-theme-line":Q.tokens.line,"--settings-theme-fg":Q.tokens.fg,"--settings-theme-fg-2":Q.tokens.fg2,"--settings-theme-accent":Q.tokens.accent,"--settings-theme-xterm-bg":Q.xterm.background,"--settings-theme-xterm-fg":Q.xterm.foreground,"--settings-theme-xterm-selection":Q.xterm.selectionBackground},children:[m.jsxs("span",{className:"settings-theme-preview","aria-hidden":"true",children:[m.jsxs("span",{className:"settings-theme-preview-sidebar",children:[m.jsx("span",{}),m.jsx("span",{}),m.jsx("span",{})]}),m.jsxs("span",{className:"settings-theme-preview-main",children:[m.jsxs("span",{className:"settings-theme-preview-tabs",children:[m.jsx("span",{}),m.jsx("span",{})]}),m.jsxs("span",{className:"settings-theme-preview-terminal",children:[m.jsx("span",{}),m.jsx("span",{}),m.jsx("span",{})]})]})]}),m.jsxs("span",{className:"settings-theme-card-copy",children:[m.jsx("strong",{children:Q.label}),m.jsx("small",{children:Q.description})]})]},Q.id))}),m.jsxs("label",{className:"settings-control",children:[m.jsx("span",{children:"Font size"}),m.jsxs("span",{className:"settings-control-value",children:[h,"px"]}),m.jsx("input",{type:"range",min:tp,max:ip,step:1,value:h,"aria-label":"Terminal font size",onChange:Q=>Se(Q.currentTarget.value)})]}),m.jsxs("div",{className:"settings-stepper-row",children:[m.jsx("button",{type:"button",className:"secondary-button settings-stepper-button",onClick:()=>f(Jc(h-1)),children:"-"}),m.jsx("input",{type:"number",min:tp,max:ip,step:1,value:h,"aria-label":"Terminal font size value",onChange:Q=>Se(Q.currentTarget.value)}),m.jsx("button",{type:"button",className:"secondary-button settings-stepper-button",onClick:()=>f(Jc(h+1)),children:"+"}),m.jsx("button",{type:"button",className:"secondary-button settings-reset-button",onClick:()=>f(Jc(Gr)),children:"Reset"})]}),m.jsxs("label",{className:"settings-control",children:[m.jsx("span",{children:"Font family"}),m.jsx("select",{value:_,"aria-label":"Terminal font family",onChange:Q=>p(wE(Q.currentTarget.value)),children:Mu.map(Q=>m.jsx("option",{value:Q.id,children:Q.label},Q.id))})]}),m.jsxs("label",{className:"auth-checkbox settings-checkbox",children:[m.jsx("input",{type:"checkbox",checked:b,onChange:Q=>y(CE(Q.currentTarget.checked))}),"Show scroll progress"]})]}),m.jsxs("section",{id:"settings-shortcuts",ref:Q=>{pe.current.shortcuts=Q},className:"security-section settings-section",children:[m.jsxs("div",{className:"settings-section-heading",children:[m.jsx("h3",{children:"Shortcuts"}),m.jsx("button",{type:"button",className:"secondary-button settings-reset-button",onClick:ie,children:"Reset all"})]}),m.jsx("p",{className:"muted",children:"Defaults avoid Chrome's browser-tab shortcuts. Click a shortcut, then press the new key combo."}),Y?m.jsx("p",{className:"settings-error",children:Y}):null,m.jsx("ul",{className:"settings-shortcut-list","aria-label":"Workspace shortcuts",children:Eo.map(Q=>{const Fe=B===Q.id;return m.jsxs("li",{children:[m.jsxs("div",{children:[m.jsx("span",{className:"settings-shortcut-label",children:Q.label}),m.jsx("span",{className:"settings-shortcut-group",children:Q.group})]}),m.jsxs("div",{className:"settings-shortcut-actions",children:[m.jsx("button",{type:"button",className:"settings-shortcut-recorder","data-recording":Fe?"true":"false",onClick:()=>{T(Q.id),P(null)},children:Fe?"Press keys…":H0(C[Q.id])}),m.jsx("button",{type:"button",className:"secondary-button settings-shortcut-reset",onClick:()=>we(Q.id),children:"Reset"})]})]},Q.id)})})]}),m.jsxs("section",{id:"settings-notifications",ref:Q=>{pe.current.notifications=Q},className:"security-section settings-section",children:[m.jsx("h3",{children:"Notifications"}),Xu()?m.jsxs(m.Fragment,{children:[m.jsxs("label",{className:"auth-checkbox",children:[m.jsx("input",{type:"checkbox",checked:te&&N==="granted",onChange:()=>{Ce()},disabled:N==="denied"}),"System notification when page is hidden"]}),N==="denied"?m.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."}):m.jsx("p",{className:"muted",children:"Uses browser notifications only when this page isn't visible. Animated toast is controlled separately below."})]}):m.jsx("p",{className:"muted",children:"This browser doesn't expose the Notification API; animated toast and in-app badges can still work."}),m.jsxs("label",{className:"auth-checkbox settings-checkbox",children:[m.jsx("input",{type:"checkbox",checked:le.enabled,onChange:Q=>de(pE(Q.currentTarget.checked))}),"Show animated completion toast"]}),m.jsxs("label",{className:"settings-control",children:[m.jsx("span",{children:"Toast duration"}),m.jsx("span",{className:"settings-control-value",children:le.persistUntilDismissed?"Until closed":`${le.durationSeconds}s`}),m.jsx("input",{type:"range",min:Zf,max:Qf,step:.5,value:le.durationSeconds,disabled:!le.enabled||le.persistUntilDismissed,"aria-label":"Completion toast duration",onChange:Q=>Me(Q.currentTarget.value)})]}),m.jsxs("div",{className:"settings-stepper-row settings-duration-row",children:[m.jsx("input",{type:"number",min:Zf,max:Qf,step:.5,value:le.durationSeconds,disabled:!le.enabled||le.persistUntilDismissed,"aria-label":"Completion toast duration value",onChange:Q=>Me(Q.currentTarget.value)}),m.jsx("button",{type:"button",className:"secondary-button settings-reset-button",disabled:!le.enabled||le.persistUntilDismissed,onClick:()=>de(mb(vo)),children:"Reset"})]}),m.jsxs("label",{className:"auth-checkbox settings-checkbox",children:[m.jsx("input",{type:"checkbox",checked:le.persistUntilDismissed,disabled:!le.enabled,onChange:Q=>de(mE(Q.currentTarget.checked))}),"Keep toast until dismissed"]}),m.jsxs("div",{className:"settings-assets-header",children:[m.jsx("span",{children:"Toast videos"}),m.jsxs("span",{children:[Sf(V)," max"]})]}),m.jsx("input",{ref:he,type:"file",accept:"video/mp4,video/webm",className:"settings-asset-input","aria-label":"Upload toast video",onChange:Q=>{Pe(Q.currentTarget.files)}}),m.jsx("button",{type:"button",className:"secondary-button settings-upload-button",disabled:be,onClick:()=>he.current?.click(),children:"Upload video"}),W?m.jsx("p",{className:"settings-error",children:W}):null,K.length>0?m.jsx("ul",{className:"settings-asset-list","aria-label":"Toast videos",children:K.map(Q=>m.jsxs("li",{"data-enabled":ke.has(Q.id)?"true":"false",children:[m.jsxs("label",{className:"settings-asset-choice",children:[m.jsx("input",{type:"checkbox",checked:ke.has(Q.id),disabled:be,"aria-label":`Use ${Q.filename}`,onChange:Fe=>dt(Q.id,Fe.currentTarget.checked)}),m.jsx("video",{src:Q.url,muted:!0,autoPlay:!0,loop:!0,playsInline:!0,"aria-hidden":"true"}),m.jsxs("span",{className:"settings-asset-copy",children:[m.jsx("span",{children:Q.filename}),m.jsx("small",{children:Q.source==="built-in"?"Built-in":Sf(Q.size)})]})]}),Q.source==="uploaded"?m.jsx("button",{type:"button",className:"secondary-button settings-asset-delete",disabled:be,"aria-label":`Delete ${Q.filename}`,onClick:()=>{$e(Q.id)},children:"x"}):null]},Q.id))}):m.jsx("p",{className:"muted",children:"Built-in videos will be used."}),m.jsx("button",{type:"button",className:"secondary-button settings-save-assets-button",disabled:be||K.length===0||!me,onClick:()=>{wi()},children:"Save selected videos"})]}),m.jsx("div",{id:"settings-security",ref:Q=>{pe.current.security=Q},className:"settings-section-group",children:m.jsx(fE,{api:c})}),m.jsx("div",{id:"settings-servers",ref:Q=>{pe.current.servers=Q},className:"settings-section-group",children:m.jsx(XE,{api:c,...o?{onAgentRemoved:o}:{}})})]})]})]})})}function vb(e,t){const n=e.getBoundingClientRect(),a=t.getBoundingClientRect();return n.top-a.top+t.scrollTop}function Sf(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 tu(e){return e instanceof Error?e.message:"Request failed."}function QE(e,t){if(e.length!==t.length)return!1;const n=new Set(t);return e.every(a=>n.has(a))}class Fr extends Error{constructor(t,n){super(n),this.status=t,this.name="UploadClientError"}status}function JE(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 h=!1;const f=()=>{e.signal?.removeEventListener("abort",b)},_=y=>{h||(h=!0,f(),o(y))},p=y=>{h||(h=!0,f(),c(y))},b=()=>{t.abort(),p(new Fr(0,"Upload aborted."))};if(e.signal?.aborted){p(new Fr(0,"Upload aborted."));return}e.signal?.addEventListener("abort",b,{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{_(JSON.parse(t.responseText))}catch{p(new Fr(t.status,"Invalid upload response."))}return}p(new Fr(t.status,eT(t.responseText,t.statusText||`HTTP ${t.status}`)))},t.onerror=()=>p(new Fr(0,"Upload failed.")),t.onabort=()=>p(new Fr(0,"Upload aborted.")),t.ontimeout=()=>p(new Fr(0,"Upload timed out.")),t.send(n)})}function eT(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 tT="modulepreload",iT=function(e){return"/"+e},yb={},Im=function(t,n,a){let o=Promise.resolve();if(n&&n.length>0){let _=function(p){return Promise.all(p.map(b=>Promise.resolve(b).then(y=>({status:"fulfilled",value:y}),y=>({status:"rejected",reason:y}))))};document.getElementsByTagName("link");const h=document.querySelector("meta[property=csp-nonce]"),f=h?.nonce||h?.getAttribute("nonce");o=_(n.map(p=>{if(p=iT(p),p in yb)return;yb[p]=!0;const b=p.endsWith(".css"),y=b?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${p}"]${y}`))return;const w=document.createElement("link");if(w.rel=b?"stylesheet":tT,b||(w.as="script"),w.crossOrigin="",w.href=p,f&&w.setAttribute("nonce",f),document.head.appendChild(w),b)return new Promise((x,C)=>{w.addEventListener("load",x),w.addEventListener("error",()=>C(new Error(`Unable to preload CSS for ${p}`)))})}))}function c(h){const f=new Event("vite:preloadError",{cancelable:!0});if(f.payload=h,window.dispatchEvent(f),!f.defaultPrevented)throw h}return o.then(h=>{for(const f of h||[])f.status==="rejected"&&c(f.reason);return t().catch(c)})},sT=v.lazy(()=>Im(()=>import("./MarkdownPreview-D2ssNqvK.js"),__vite__mapDeps([0,1])));function nT({api:e,activeTerminalId:t,activeTerminalCwd:n,onOpenFile:a}){const[o,c]=v.useState(null),[h,f]=v.useState(""),[_,p]=v.useState({}),[b,y]=v.useState(()=>new Set),[w,x]=v.useState(null),[C,E]=v.useState({type:"empty"}),[B,T]=v.useState("idle"),[Y,P]=v.useState(null),X=v.useRef(null),ee=v.useRef(null),te=v.useRef(!1),se=v.useRef(0),le=v.useRef(null);le.current===null&&t&&(le.current=t);const de=le.current,N=t?Cf(t,n):null,U=o?[o.rootPath,h].filter(Boolean).join("/"):"",K=w?.path??null;v.useEffect(()=>(te.current=!0,()=>{te.current=!1,se.current+=1,me()}),[]),v.useEffect(()=>{le.current=t,ee.current=null;const ie=t?Cf(t,n):null;j(t,ie)},[e]),v.useEffect(()=>{if(!de||t!==de)return;const ie=Cf(de,n);ie!==ee.current&&j(de,ie)},[de,t,n]);async function j(ie,De=N){const Ce=Se();if(ee.current=De,me(),c(null),f(""),p({}),y(new Set),x(null),E({type:"empty"}),P(null),!ie){T("idle");return}T("loading");try{const Pe=await e.createFileRoot({terminalId:ie});if(!Me(Ce))return;c({rootToken:Pe.rootToken,rootPath:Pe.rootPath});const $e=await e.listFiles({rootToken:Pe.rootToken,path:""});if(!Me(Ce))return;M($e),T("idle")}catch(Pe){if(await Ue(Pe,Ce))return;Me(Ce)&&(P(ar(Pe)),T("idle"))}}async function z(ie=h,De=o){if(!De)return;const Ce=Se();T("loading"),P(null);try{const Pe=await e.listFiles({rootToken:De.rootToken,path:ie});if(!Me(Ce))return;M(Pe),T("idle")}catch(Pe){if(await Ue(Pe,Ce))return;Me(Ce)&&(P(ar(Pe)),T("idle"))}}async function G(){le.current=t,await j(t,N)}function M(ie){p(De=>({...De,[ie.path]:aT(ie.entries)}))}async function q(ie){if(!(!wf(ie)||!o)){if(x(ie),P(null),ie.kind==="directory"){f(ie.path),ke(),await _e(ie);return}if(f(qr(ie.path)),ie.editable){await D(ie);return}ie.previewKind!=="none"&&await re(ie,ie.previewKind)}}async function V(ie){if(!(!wf(ie)||!o)){if(x(ie),P(null),ie.kind==="directory"){f(ie.path),ke(),await _e(ie);return}if(f(qr(ie.path)),ie.editable){await W(ie);return}ie.previewKind!=="none"&&await re(ie,ie.previewKind)}}async function _e(ie){if(b.has(ie.path)){y(De=>{const Ce=new Set(De);return Ce.delete(ie.path),Ce});return}y(De=>new Set(De).add(ie.path)),await z(ie.path)}function be(ie,De){ie.key==="Enter"&&(ie.preventDefault(),V(De))}async function D(ie){if(!o)return;const De=Se();T("loading"),me();try{const Ce=await e.readFile({rootToken:o.rootToken,path:ie.path});if(!Me(De))return;E({type:"text-preview",file:ie,read:Ce}),T("idle")}catch(Ce){if(await Ue(Ce,De))return;Me(De)&&(P(ar(Ce)),T("idle"))}}async function W(ie){if(!o)return;const De=Se();T("loading");try{await a({rootToken:o.rootToken,path:ie.path}),Me(De)&&T("idle")}catch(Ce){if(await Ue(Ce,De))return;Me(De)&&(P(ar(Ce)),T("idle"))}}async function re(ie,De){if(!o)return;const Ce=Se();T("loading"),me();try{const Pe=await e.previewFile({rootToken:o.rootToken,path:ie.path});if(!Me(Ce))return;const $e=URL.createObjectURL(Pe);if(!Me(Ce)){URL.revokeObjectURL($e);return}X.current=$e,E({type:"preview",file:ie,previewKind:De,url:$e}),T("idle")}catch(Pe){if(await Ue(Pe,Ce))return;Me(Ce)&&(P(ar(Pe)),T("idle"))}}async function he(ie){if(!o)return;const De=ie==="file"?"New file":"New folder",Ce=window.prompt(De,""),Pe=w?w.kind==="directory"?w.path:qr(w.path):h,$e=bb(Ce,Pe);if($e){P(null);try{const St=await e.createFileEntry({rootToken:o.rootToken,path:$e,kind:ie});x(St.entry),await z(Pe)}catch(St){if(await Ue(St))return;P(ar(St))}}}async function ve(){if(!o||!w)return;const ie=window.prompt("Move selected entry",w.path),De=bb(ie,"");if(!De||De===w.path)return;const Ce=qr(w.path),Pe=qr(De);P(null);try{const $e=await e.moveFileEntry({rootToken:o.rootToken,sourcePath:w.path,destinationPath:De});x($e.entry),f($e.entry.kind==="directory"?$e.entry.path:qr($e.entry.path)),ke(),await z(Ce),Pe!==Ce&&await z(Pe)}catch($e){if(await Ue($e))return;P(ar($e))}}async function pe(){if(!o||!w)return;const ie=w.path,De=qr(ie);P(null);try{const Ce=await e.previewDeleteFileEntry({rootToken:o.rootToken,path:w.path}),Pe=Ce.descendantCount>0?` and ${Ce.descendantCount} nested item${Ce.descendantCount===1?"":"s"}`:"";if(!window.confirm(`Delete ${Ce.path}${Pe}?`))return;await e.deleteFileEntry({rootToken:o.rootToken,path:w.path,previewToken:Ce.previewToken}),x(null),f(De),y($e=>{const St=new Set($e);for(const dt of $e)(dt===ie||dt.startsWith(`${ie}/`))&&St.delete(dt);return St}),ke(),await z(De)}catch(Ce){if(await Ue(Ce))return;P(ar(Ce))}}function ke(){se.current+=1,me(),E({type:"empty"})}function me(){X.current&&(URL.revokeObjectURL(X.current),X.current=null)}function Se(){return se.current+=1,se.current}function Me(ie){return te.current&&ie===se.current}async function Ue(ie,De){return lT(ie)?(De!==void 0&&!Me(De)||await j(t,N),!0):!1}function Ke(ie,De){const Ce=wf(ie),Pe=ie.kind==="directory"&&b.has(ie.path),$e=_[ie.path]??[],St={"--file-tree-depth":De};return m.jsxs(hi.Fragment,{children:[m.jsxs("button",{type:"button",className:"file-entry-button","data-kind":ie.kind,"data-expanded":Pe,"data-active":K===ie.path,disabled:!Ce,style:St,"aria-expanded":ie.kind==="directory"?Pe:void 0,"aria-label":`${ie.kind==="directory"?"Open folder":"Open file"} ${ie.name}`,title:ie.kind==="directory"?"Expand or collapse folder":"Click to preview. Double-click or press Enter to open.",onClick:()=>{q(ie)},onDoubleClick:()=>{V(ie)},onKeyDown:dt=>be(dt,ie),children:[m.jsx("span",{className:"file-entry-disclosure","aria-hidden":"true",children:ie.kind==="directory"?Pe?"▾":"▸":""}),m.jsx("span",{className:"file-entry-name",children:ie.name}),m.jsx("small",{children:rT(ie)})]}),Pe?m.jsx("div",{className:"file-tree-children",role:"group",children:$e.map(dt=>Ke(dt,De+1))}):null]},ie.path)}const we=_[""]??[];return m.jsxs("section",{className:"file-explorer","aria-label":"Files","aria-busy":B==="loading",children:[m.jsxs("header",{className:"file-explorer-header",children:[m.jsx("div",{className:"file-explorer-path",title:U,children:U||"No active pane"}),m.jsxs("div",{className:"file-explorer-toolbar","aria-label":"File actions",children:[m.jsx("button",{type:"button","aria-label":"Refresh files",title:"Refresh",disabled:!t,onClick:()=>{G()},children:"↻"}),m.jsx("button",{type:"button","aria-label":"New file",title:"New file",disabled:!o,onClick:()=>{he("file")},children:"+"}),m.jsx("button",{type:"button","aria-label":"New folder",title:"New folder",disabled:!o,onClick:()=>{he("directory")},children:"▣"})]})]}),Y?m.jsx("div",{className:"file-explorer-alert",role:"alert",children:Y}):null,m.jsxs("div",{className:"file-explorer-layout",children:[m.jsx("div",{className:"file-tree","aria-label":U?`Files in ${U}`:"Files",children:we.map(ie=>Ke(ie,0))}),m.jsxs("section",{className:"file-detail","aria-label":"File detail",children:[m.jsxs("div",{className:"file-detail-header",children:[m.jsx("strong",{children:w?.name??"detail"}),m.jsxs("div",{className:"file-detail-actions",children:[m.jsx("button",{type:"button","aria-label":"Move selected entry",disabled:!w,onClick:()=>{ve()},children:"Move"}),m.jsx("button",{type:"button","aria-label":"Delete selected entry",disabled:!w,onClick:()=>{pe()},children:"Delete"})]})]}),B==="loading"?m.jsx("div",{className:"file-detail-empty",children:"loading"}):null,C.type==="empty"&&B!=="loading"?m.jsx("div",{className:"file-detail-empty",children:"No file selected"}):null,C.type==="preview"?m.jsxs("div",{className:"file-preview-frame",children:[C.previewKind==="image"?m.jsx("img",{src:C.url,alt:C.file.name}):null,C.previewKind==="pdf"?m.jsx("iframe",{src:C.url,title:C.file.name}):null]}):null,C.type==="text-preview"&&C.read.language==="markdown"?m.jsx("div",{className:"file-markdown-preview","aria-label":`Preview for ${C.file.name}`,children:m.jsx(v.Suspense,{fallback:m.jsx("div",{className:"file-markdown-preview-loading",children:"loading preview"}),children:m.jsx(sT,{content:C.read.content})})}):null,C.type==="text-preview"&&C.read.language==="text"?m.jsx("pre",{className:"file-text-preview","aria-label":`Preview for ${C.file.name}`,children:C.read.content}):null]})]})]})}function wf(e){return e.kind==="directory"||e.editable||e.previewKind!=="none"}function rT(e){return e.kind==="directory"?"dir":e.editable?"edit":e.previewKind!=="none"?e.previewKind:"unsupported"}function Cf(e,t){return`${e}\0${t??""}`}function aT(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 qr(e){const t=e.split("/").filter(Boolean);return t.pop(),t.join("/")}function bb(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 ar(e){return e instanceof Error?e.message:"Request failed"}function lT(e){return e instanceof Nn&&e.status===409&&e.message==="terminal_cwd_changed"}const oT=v.lazy(()=>Im(()=>import("./MarkdownPreview-D2ssNqvK.js"),__vite__mapDeps([0,1])));function Sb({api:e,editor:t,canClose:n,onClose:a}){const[o,c]=v.useState(t.read),[h,f]=v.useState(t.read.content),[_,p]=v.useState("idle"),[b,y]=v.useState(null),[w,x]=v.useState(!1),[C,E]=v.useState("edit"),B=v.useRef(t),T=v.useRef(t.read),Y=v.useRef(t.read.content),P=v.useRef(!1),X=v.useRef(!1),ee=v.useRef(0),te=h!==o.content&&_!=="saving"&&!w;v.useEffect(()=>(X.current=!0,()=>{X.current=!1,ee.current+=1}),[]),v.useEffect(()=>{ee.current+=1,P.current=!1,B.current=t,T.current=t.read,Y.current=t.read.content,c(t.read),f(t.read.content),p("idle"),y(null),x(!1),E("edit")},[t.id,t.read]),v.useEffect(()=>{B.current=t},[t]),v.useEffect(()=>{T.current=o},[o]),v.useEffect(()=>{Y.current=h},[h]),v.useEffect(()=>{if(h===o.content||w)return;const U=window.setInterval(()=>{!P.current&&Y.current!==T.current.content&&se()},1e3);return()=>window.clearInterval(U)},[h===o.content,w,t.id]);async function se(){if(P.current)return;const U=Y.current,K=T.current;if(U===K.content)return;const j=B.current,z=ee.current;P.current=!0,p("saving"),y(null),x(!1);try{const G=await e.writeFile({rootToken:j.rootToken,path:j.path,content:U,expectedVersion:K.version});if(!X.current||z!==ee.current)return;const M={...K,content:U,version:G.version};T.current=M,c(M),p(Y.current===U?"saved":"idle")}catch(G){if(!X.current||z!==ee.current)return;if(G instanceof Nn&&G.status===409){x(!0),p("idle");return}y(cT(G)),p("idle")}finally{z===ee.current&&(P.current=!1)}}const le=_==="saving"?"saving":_==="saved"?"saved":o.language,de=o.language==="markdown",N=de&&C==="preview";return m.jsxs("section",{className:"editor-pane","aria-label":`Editor pane ${t.title}`,children:[m.jsxs("header",{className:"editor-pane-header",children:[m.jsx("span",{className:"terminal-pane-dot","aria-hidden":"true"}),m.jsx("strong",{children:t.title}),m.jsx("span",{className:"terminal-pane-spacer"}),m.jsx("span",{className:"terminal-pane-state",children:le}),m.jsx("button",{type:"button","aria-label":`Save ${t.title}`,disabled:!te,onClick:()=>{se()},children:"Save"}),de?m.jsx("button",{type:"button","aria-label":`${N?"Edit":"Preview"} ${t.title}`,onClick:()=>E(U=>U==="preview"?"edit":"preview"),children:N?"Edit":"Preview"}):null,n?m.jsx("button",{type:"button",className:"terminal-pane-close","aria-label":`Close editor ${t.title}`,onClick:a,children:"x"}):null]}),b?m.jsx("div",{className:"editor-pane-alert",role:"alert",children:b}):null,w?m.jsx("div",{className:"editor-pane-alert",role:"alert",children:"File changed on disk."}):null,N?m.jsx("div",{className:"editor-markdown-preview","aria-label":`Markdown preview for ${t.title}`,children:m.jsx(v.Suspense,{fallback:m.jsx("div",{className:"editor-markdown-preview-loading",children:"loading preview"}),children:m.jsx(oT,{content:h})})}):m.jsx("textarea",{className:"editor-pane-textarea","aria-label":`Editor for ${t.title}`,spellCheck:!1,value:h,onChange:U=>{const K=U.target.value;Y.current=K,f(K),p("idle"),y(null),x(!1)}})]})}function cT(e){return e instanceof Error?e.message:"Request failed"}var uT=2,hT=1,dT=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),h={top:parseInt(c.getPropertyValue("padding-top")),bottom:parseInt(c.getPropertyValue("padding-bottom")),right:parseInt(c.getPropertyValue("padding-right")),left:parseInt(c.getPropertyValue("padding-left"))},f=h.top+h.bottom,_=h.right+h.left,p=a-f,b=o-_-t;return{cols:Math.max(uT,Math.floor(b/e.css.cell.width)),rows:Math.max(hT,Math.floor(p/e.css.cell.height))}}};var W0=Object.defineProperty,fT=Object.getOwnPropertyDescriptor,pT=(e,t)=>{for(var n in t)W0(e,n,{get:t[n],enumerable:!0})},Pt=(e,t,n,a)=>{for(var o=a>1?void 0:a?fT(t,n):t,c=e.length-1,h;c>=0;c--)(h=e[c])&&(o=(a?h(t,n,o):h(o))||o);return a&&o&&W0(t,n,o),o},ye=(e,t)=>(n,a)=>t(n,a,e),wb="Terminal input",hp={get:()=>wb,set:e=>wb=e},Cb="Too much output to announce, navigate to rows manually to read",dp={get:()=>Cb,set:e=>Cb=e};function mT(e){return e.replace(/\r?\n/g,"\r")}function _T(e,t){return t?"\x1B[200~"+e+"\x1B[201~":e}function gT(e,t){e.clipboardData&&e.clipboardData.setData("text/plain",t.selectionText),e.preventDefault()}function vT(e,t,n,a){if(e.stopPropagation(),e.clipboardData){let o=e.clipboardData.getData("text/plain");$0(o,t,n,a)}}function $0(e,t,n,a){e=mT(e),e=_T(e,n.decPrivateModes.bracketedPasteMode&&a.rawOptions.ignoreBracketedPasteMode!==!0),n.triggerDataEvent(e,!0),t.value=""}function Y0(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 xb(e,t,n,a,o){Y0(e,t,n),o&&a.rightClickSelect(e),t.value=a.selectionText,t.select()}function dr(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}function Gu(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 yT=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 h=e.charCodeAt(c);if(55296<=h&&h<=56319){if(++c>=n)return this._interim=h,a;let f=e.charCodeAt(c);56320<=f&&f<=57343?t[a++]=(h-55296)*1024+f-56320+65536:(t[a++]=h,t[a++]=f);continue}h!==65279&&(t[a++]=h)}return a}},bT=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,h,f,_=0,p=0;if(this.interim[0]){let w=!1,x=this.interim[0];x&=(x&224)===192?31:(x&240)===224?15:7;let C=0,E;for(;(E=this.interim[++C]&63)&&C<4;)x<<=6,x|=E;let B=(this.interim[0]&224)===192?2:(this.interim[0]&240)===224?3:4,T=B-C;for(;p<T;){if(p>=n)return 0;if(E=e[p++],(E&192)!==128){p--,w=!0;break}else this.interim[C++]=E,x<<=6,x|=E&63}w||(B===2?x<128?p--: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 b=n-4,y=p;for(;y<n;){for(;y<b&&!((o=e[y])&128)&&!((c=e[y+1])&128)&&!((h=e[y+2])&128)&&!((f=e[y+3])&128);)t[a++]=o,t[a++]=c,t[a++]=h,t[a++]=f,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(_=(o&31)<<6|c&63,_<128){y--;continue}t[a++]=_}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(h=e[y++],(h&192)!==128){y--;continue}if(_=(o&15)<<12|(c&63)<<6|h&63,_<2048||_>=55296&&_<=57343||_===65279)continue;t[a++]=_}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(h=e[y++],(h&192)!==128){y--;continue}if(y>=n)return this.interim[0]=o,this.interim[1]=c,this.interim[2]=h,a;if(f=e[y++],(f&192)!==128){y--;continue}if(_=(o&7)<<18|(c&63)<<12|(h&63)<<6|f&63,_<65536||_>1114111)continue;t[a++]=_}}return a}},V0="",fr=" ",Ho=class X0{constructor(){this.fg=0,this.bg=0,this.extended=new Au}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 X0;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}},Au=class G0{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 G0(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},Us=class Z0 extends Ho{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new Au,this.combinedData=""}static fromCharData(t){let n=new Z0;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?dr(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()]}},Eb="di$target",fp="di$dependencies",xf=new Map;function ST(e){return e[fp]||[]}function Si(e){if(xf.has(e))return xf.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");wT(t,n,o)};return t._id=e,xf.set(e,t),t}function wT(e,t,n){t[Eb]===t?t[fp].push({id:e,index:n}):(t[fp]=[{id:e,index:n}],t[Eb]=t)}var Yi=Si("BufferService"),Q0=Si("CoreMouseService"),ia=Si("CoreService"),CT=Si("CharsetService"),Fm=Si("InstantiationService"),J0=Si("LogService"),Vi=Si("OptionsService"),ew=Si("OscLinkService"),xT=Si("UnicodeService"),Uo=Si("DecorationService"),pp=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 Us,h=n.getTrimmedLength(),f=-1,_=-1,p=!1;for(let b=0;b<h;b++)if(!(_===-1&&!n.hasContent(b))){if(n.loadCell(b,c),c.hasExtendedAttrs()&&c.extended.urlId)if(_===-1){_=b,f=c.extended.urlId;continue}else p=c.extended.urlId!==f;else _!==-1&&(p=!0);if(p||_!==-1&&b===h-1){let y=this._oscLinkService.getLinkData(f)?.uri;if(y){let w={start:{x:_+1,y:e},end:{x:b+(!p&&b===h-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:w,activate:(C,E)=>o?o.activate(C,E,w):ET(C,E),hover:(C,E)=>o?.hover?.(C,E,w),leave:(C,E)=>o?.leave?.(C,E,w)})}p=!1,c.hasExtendedAttrs()&&c.extended.urlId?(_=b,f=c.extended.urlId):(_=-1,f=-1)}}t(a)}};pp=Pt([ye(0,Yi),ye(1,Vi),ye(2,ew)],pp);function ET(e,t){if(confirm(`Do you want to navigate to ${t}?
|
|
16
16
|
|
|
17
|
-
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
|
|
17
|
+
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 Zu=Si("CharSizeService"),Ln=Si("CoreBrowserService"),qm=Si("MouseService"),Bn=Si("RenderService"),TT=Si("SelectionService"),tw=Si("CharacterJoinerService"),tl=Si("ThemeService"),iw=Si("LinkProviderService"),kT=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?Tb.isErrorNoTelemetry(e)?new Tb(e.message+`
|
|
18
18
|
|
|
19
19
|
`+e.stack):new Error(e.message+`
|
|
20
20
|
|
|
21
|
-
`+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)}},bT=new yT;function pu(e){ST(e)||bT.onUnexpectedError(e)}var fp="Canceled";function ST(e){return e instanceof wT?!0:e instanceof Error&&e.name===fp&&e.message===fp}var wT=class extends Error{constructor(){super(fp),this.name=this.message}};function CT(e){return new Error(`Illegal argument: ${e}`)}var Sb=class pp extends Error{constructor(t){super(t),this.name="CodeExpectedError"}static fromError(t){if(t instanceof pp)return t;let n=new pp;return n.message=t.message,n.stack=t.stack,n}static isErrorNoTelemetry(t){return t.name==="CodeExpectedError"}},mp=class Z0 extends Error{constructor(t){super(t||"An unexpected bug occurred."),Object.setPrototypeOf(this,Z0.prototype)}};function vs(e,t=0){return e[e.length-(1+t)]}var xT;(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})(xT||={});function ET(e,t){let n=this,a=!1,o;return function(){return a||(a=!0,t||(o=e.apply(n,arguments))),o}}var Q0;(e=>{function t(X){return X&&typeof X=="object"&&typeof X[Symbol.iterator]=="function"}e.is=t;let n=Object.freeze([]);function a(){return n}e.empty=a;function*o(X){yield X}e.single=o;function c(X){return t(X)?X:o(X)}e.wrap=c;function h(X){return X||n}e.from=h;function*f(X){for(let re=X.length-1;re>=0;re--)yield X[re]}e.reverse=f;function m(X){return!X||X[Symbol.iterator]().next().done===!0}e.isEmpty=m;function p(X){return X[Symbol.iterator]().next().value}e.first=p;function b(X,re){let ee=0;for(let ie of X)if(re(ie,ee++))return!0;return!1}e.some=b;function y(X,re){for(let ee of X)if(re(ee))return ee}e.find=y;function*w(X,re){for(let ee of X)re(ee)&&(yield ee)}e.filter=w;function*x(X,re){let ee=0;for(let ie of X)yield re(ie,ee++)}e.map=x;function*C(X,re){let ee=0;for(let ie of X)yield*re(ie,ee++)}e.flatMap=C;function*E(...X){for(let re of X)yield*re}e.concat=E;function B(X,re,ee){let ie=ee;for(let le of X)ie=re(ie,le);return ie}e.reduce=B;function*T(X,re,ee=X.length){for(re<0&&(re+=X.length),ee<0?ee+=X.length:ee>X.length&&(ee=X.length);re<ee;re++)yield X[re]}e.slice=T;function Y(X,re=Number.POSITIVE_INFINITY){let ee=[];if(re===0)return[ee,X];let ie=X[Symbol.iterator]();for(let le=0;le<re;le++){let de=ie.next();if(de.done)return[ee,e.empty()];ee.push(de.value)}return[ee,{[Symbol.iterator](){return ie}}]}e.consume=Y;async function K(X){let re=[];for await(let ee of X)re.push(ee);return Promise.resolve(re)}e.asyncToArray=K})(Q0||={});function Jr(e){if(Q0.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 TT(...e){return Rt(()=>Jr(e))}function Rt(e){return{dispose:ET(()=>{e()})}}var J0=class ew{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{Jr(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?ew.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)}};J0.DISABLE_DISPOSED_WARNING=!1;var pr=J0,Xe=class{constructor(){this._store=new pr,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)}};Xe.None=Object.freeze({dispose(){}});var Va=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}},Rn=typeof window=="object"?window:globalThis,_p=class vp{constructor(t){this.element=t,this.next=vp.Undefined,this.prev=vp.Undefined}};_p.Undefined=new _p(void 0);var Nt=_p,wb=class{constructor(){this._first=Nt.Undefined,this._last=Nt.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===Nt.Undefined}clear(){let e=this._first;for(;e!==Nt.Undefined;){let t=e.next;e.prev=Nt.Undefined,e.next=Nt.Undefined,e=t}this._first=Nt.Undefined,this._last=Nt.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){let n=new Nt(e);if(this._first===Nt.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!==Nt.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==Nt.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==Nt.Undefined&&e.next!==Nt.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===Nt.Undefined&&e.next===Nt.Undefined?(this._first=Nt.Undefined,this._last=Nt.Undefined):e.next===Nt.Undefined?(this._last=this._last.prev,this._last.next=Nt.Undefined):e.prev===Nt.Undefined&&(this._first=this._first.next,this._first.prev=Nt.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==Nt.Undefined;)yield e.element,e=e.next}},kT=globalThis.performance&&typeof globalThis.performance.now=="function",DT=class tw{static create(t){return new tw(t)}constructor(t){this._now=kT&&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}},Ni;(e=>{e.None=()=>Xe.None;function t(P,j){return y(P,()=>{},0,void 0,!0,void 0,j)}e.defer=t;function n(P){return(j,z=null,G)=>{let M=!1,q;return q=P(V=>{if(!M)return q?q.dispose():M=!0,j.call(z,V)},null,G),M&&q.dispose(),q}}e.once=n;function a(P,j,z){return p((G,M=null,q)=>P(V=>G.call(M,j(V)),null,q),z)}e.map=a;function o(P,j,z){return p((G,M=null,q)=>P(V=>{j(V),G.call(M,V)},null,q),z)}e.forEach=o;function c(P,j,z){return p((G,M=null,q)=>P(V=>j(V)&&G.call(M,V),null,q),z)}e.filter=c;function h(P){return P}e.signal=h;function f(...P){return(j,z=null,G)=>{let M=TT(...P.map(q=>q(V=>j.call(z,V))));return b(M,G)}}e.any=f;function m(P,j,z,G){let M=z;return a(P,q=>(M=j(M,q),M),G)}e.reduce=m;function p(P,j){let z,G={onWillAddFirstListener(){z=P(M.fire,M)},onDidRemoveLastListener(){z?.dispose()}},M=new ve(G);return j?.add(M),M.event}function b(P,j){return j instanceof Array?j.push(P):j&&j.add(P),P}function y(P,j,z=100,G=!1,M=!1,q,V){let _e,be,D,W=0,ne,he={leakWarningThreshold:q,onWillAddFirstListener(){_e=P(pe=>{W++,be=j(be,pe),G&&!D&&(ge.fire(be),be=void 0),ne=()=>{let ke=be;be=void 0,D=void 0,(!G||W>1)&&ge.fire(ke),W=0},typeof z=="number"?(clearTimeout(D),D=setTimeout(ne,z)):D===void 0&&(D=0,queueMicrotask(ne))})},onWillRemoveListener(){M&&W>0&&ne?.()},onDidRemoveLastListener(){ne=void 0,_e.dispose()}},ge=new ve(he);return V?.add(ge),ge.event}e.debounce=y;function w(P,j=0,z){return e.debounce(P,(G,M)=>G?(G.push(M),G):[M],j,void 0,!0,void 0,z)}e.accumulate=w;function x(P,j=(G,M)=>G===M,z){let G=!0,M;return c(P,q=>{let V=G||!j(q,M);return G=!1,M=q,V},z)}e.latch=x;function C(P,j,z){return[e.filter(P,j,z),e.filter(P,G=>!j(G),z)]}e.split=C;function E(P,j=!1,z=[],G){let M=z.slice(),q=P(be=>{M?M.push(be):_e.fire(be)});G&&G.add(q);let V=()=>{M?.forEach(be=>_e.fire(be)),M=null},_e=new ve({onWillAddFirstListener(){q||(q=P(be=>_e.fire(be)),G&&G.add(q))},onDidAddFirstListener(){M&&(j?setTimeout(V):V())},onDidRemoveLastListener(){q&&q.dispose(),q=null}});return G&&G.add(_e),_e.event}e.buffer=E;function B(P,j){return(z,G,M)=>{let q=j(new Y);return P(function(V){let _e=q.evaluate(V);_e!==T&&z.call(G,_e)},void 0,M)}}e.chain=B;let T=Symbol("HaltChainable");class Y{constructor(){this.steps=[]}map(j){return this.steps.push(j),this}forEach(j){return this.steps.push(z=>(j(z),z)),this}filter(j){return this.steps.push(z=>j(z)?z:T),this}reduce(j,z){let G=z;return this.steps.push(M=>(G=j(G,M),G)),this}latch(j=(z,G)=>z===G){let z=!0,G;return this.steps.push(M=>{let q=z||!j(M,G);return z=!1,G=M,q?M:T}),this}evaluate(j){for(let z of this.steps)if(j=z(j),j===T)break;return j}}function K(P,j,z=G=>G){let G=(..._e)=>V.fire(z(..._e)),M=()=>P.on(j,G),q=()=>P.removeListener(j,G),V=new ve({onWillAddFirstListener:M,onDidRemoveLastListener:q});return V.event}e.fromNodeEventEmitter=K;function X(P,j,z=G=>G){let G=(..._e)=>V.fire(z(..._e)),M=()=>P.addEventListener(j,G),q=()=>P.removeEventListener(j,G),V=new ve({onWillAddFirstListener:M,onDidRemoveLastListener:q});return V.event}e.fromDOMEventEmitter=X;function re(P){return new Promise(j=>n(P)(j))}e.toPromise=re;function ee(P){let j=new ve;return P.then(z=>{j.fire(z)},()=>{j.fire(void 0)}).finally(()=>{j.dispose()}),j.event}e.fromPromise=ee;function ie(P,j){return P(z=>j.fire(z))}e.forward=ie;function le(P,j,z){return j(z),P(G=>j(G))}e.runAndSubscribe=le;class de{constructor(j,z){this._observable=j,this._counter=0,this._hasChanged=!1;let G={onWillAddFirstListener:()=>{j.addObserver(this)},onDidRemoveLastListener:()=>{j.removeObserver(this)}};this.emitter=new ve(G),z&&z.add(this.emitter)}beginUpdate(j){this._counter++}handlePossibleChange(j){}handleChange(j,z){this._hasChanged=!0}endUpdate(j){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function N(P,j){return new de(P,j).emitter.event}e.fromObservable=N;function U(P){return(j,z,G)=>{let M=0,q=!1,V={beginUpdate(){M++},endUpdate(){M--,M===0&&(P.reportChanges(),q&&(q=!1,j.call(z)))},handlePossibleChange(){},handleChange(){q=!0}};P.addObserver(V),P.reportChanges();let _e={dispose(){P.removeObserver(V)}};return G instanceof pr?G.add(_e):Array.isArray(G)&&G.push(_e),_e}}e.fromObservableLight=U})(Ni||={});var gp=class yp{constructor(t){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${t}_${yp._idPool++}`,yp.all.add(this)}start(t){this._stopWatch=new DT,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}}};gp.all=new Set,gp._idPool=0;var RT=gp,MT=-1,iw=class sw{constructor(t,n,a=(sw._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,h]=this.getMostFrequentStack(),f=`[${this.name}] potential listener LEAK detected, having ${n} listeners already. MOST frequent listener (${h}):`;console.warn(f),console.warn(c);let m=new LT(f,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}};iw._idPool=1;var NT=iw,AT=class nw{constructor(t){this.value=t}static create(){let t=new Error;return new nw(t.stack??"")}print(){console.warn(this.value.split(`
|
|
21
|
+
`+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)}},DT=new kT;function pu(e){RT(e)||DT.onUnexpectedError(e)}var mp="Canceled";function RT(e){return e instanceof MT?!0:e instanceof Error&&e.name===mp&&e.message===mp}var MT=class extends Error{constructor(){super(mp),this.name=this.message}};function NT(e){return new Error(`Illegal argument: ${e}`)}var Tb=class _p extends Error{constructor(t){super(t),this.name="CodeExpectedError"}static fromError(t){if(t instanceof _p)return t;let n=new _p;return n.message=t.message,n.stack=t.stack,n}static isErrorNoTelemetry(t){return t.name==="CodeExpectedError"}},gp=class sw extends Error{constructor(t){super(t||"An unexpected bug occurred."),Object.setPrototypeOf(this,sw.prototype)}};function vs(e,t=0){return e[e.length-(1+t)]}var AT;(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})(AT||={});function LT(e,t){let n=this,a=!1,o;return function(){return a||(a=!0,t||(o=e.apply(n,arguments))),o}}var nw;(e=>{function t(X){return X&&typeof X=="object"&&typeof X[Symbol.iterator]=="function"}e.is=t;let n=Object.freeze([]);function a(){return n}e.empty=a;function*o(X){yield X}e.single=o;function c(X){return t(X)?X:o(X)}e.wrap=c;function h(X){return X||n}e.from=h;function*f(X){for(let ee=X.length-1;ee>=0;ee--)yield X[ee]}e.reverse=f;function _(X){return!X||X[Symbol.iterator]().next().done===!0}e.isEmpty=_;function p(X){return X[Symbol.iterator]().next().value}e.first=p;function b(X,ee){let te=0;for(let se of X)if(ee(se,te++))return!0;return!1}e.some=b;function y(X,ee){for(let te of X)if(ee(te))return te}e.find=y;function*w(X,ee){for(let te of X)ee(te)&&(yield te)}e.filter=w;function*x(X,ee){let te=0;for(let se of X)yield ee(se,te++)}e.map=x;function*C(X,ee){let te=0;for(let se of X)yield*ee(se,te++)}e.flatMap=C;function*E(...X){for(let ee of X)yield*ee}e.concat=E;function B(X,ee,te){let se=te;for(let le of X)se=ee(se,le);return se}e.reduce=B;function*T(X,ee,te=X.length){for(ee<0&&(ee+=X.length),te<0?te+=X.length:te>X.length&&(te=X.length);ee<te;ee++)yield X[ee]}e.slice=T;function Y(X,ee=Number.POSITIVE_INFINITY){let te=[];if(ee===0)return[te,X];let se=X[Symbol.iterator]();for(let le=0;le<ee;le++){let de=se.next();if(de.done)return[te,e.empty()];te.push(de.value)}return[te,{[Symbol.iterator](){return se}}]}e.consume=Y;async function P(X){let ee=[];for await(let te of X)ee.push(te);return Promise.resolve(ee)}e.asyncToArray=P})(nw||={});function ea(e){if(nw.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 BT(...e){return Mt(()=>ea(e))}function Mt(e){return{dispose:LT(()=>{e()})}}var rw=class aw{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{ea(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?aw.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)}};rw.DISABLE_DISPOSED_WARNING=!1;var mr=rw,Ge=class{constructor(){this._store=new mr,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)}};Ge.None=Object.freeze({dispose(){}});var Ga=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}},Mn=typeof window=="object"?window:globalThis,vp=class yp{constructor(t){this.element=t,this.next=yp.Undefined,this.prev=yp.Undefined}};vp.Undefined=new vp(void 0);var At=vp,kb=class{constructor(){this._first=At.Undefined,this._last=At.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===At.Undefined}clear(){let e=this._first;for(;e!==At.Undefined;){let t=e.next;e.prev=At.Undefined,e.next=At.Undefined,e=t}this._first=At.Undefined,this._last=At.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){let n=new At(e);if(this._first===At.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!==At.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==At.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==At.Undefined&&e.next!==At.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===At.Undefined&&e.next===At.Undefined?(this._first=At.Undefined,this._last=At.Undefined):e.next===At.Undefined?(this._last=this._last.prev,this._last.next=At.Undefined):e.prev===At.Undefined&&(this._first=this._first.next,this._first.prev=At.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==At.Undefined;)yield e.element,e=e.next}},OT=globalThis.performance&&typeof globalThis.performance.now=="function",zT=class lw{static create(t){return new lw(t)}constructor(t){this._now=OT&&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}},Ai;(e=>{e.None=()=>Ge.None;function t(K,j){return y(K,()=>{},0,void 0,!0,void 0,j)}e.defer=t;function n(K){return(j,z=null,G)=>{let M=!1,q;return q=K(V=>{if(!M)return q?q.dispose():M=!0,j.call(z,V)},null,G),M&&q.dispose(),q}}e.once=n;function a(K,j,z){return p((G,M=null,q)=>K(V=>G.call(M,j(V)),null,q),z)}e.map=a;function o(K,j,z){return p((G,M=null,q)=>K(V=>{j(V),G.call(M,V)},null,q),z)}e.forEach=o;function c(K,j,z){return p((G,M=null,q)=>K(V=>j(V)&&G.call(M,V),null,q),z)}e.filter=c;function h(K){return K}e.signal=h;function f(...K){return(j,z=null,G)=>{let M=BT(...K.map(q=>q(V=>j.call(z,V))));return b(M,G)}}e.any=f;function _(K,j,z,G){let M=z;return a(K,q=>(M=j(M,q),M),G)}e.reduce=_;function p(K,j){let z,G={onWillAddFirstListener(){z=K(M.fire,M)},onDidRemoveLastListener(){z?.dispose()}},M=new ge(G);return j?.add(M),M.event}function b(K,j){return j instanceof Array?j.push(K):j&&j.add(K),K}function y(K,j,z=100,G=!1,M=!1,q,V){let _e,be,D,W=0,re,he={leakWarningThreshold:q,onWillAddFirstListener(){_e=K(pe=>{W++,be=j(be,pe),G&&!D&&(ve.fire(be),be=void 0),re=()=>{let ke=be;be=void 0,D=void 0,(!G||W>1)&&ve.fire(ke),W=0},typeof z=="number"?(clearTimeout(D),D=setTimeout(re,z)):D===void 0&&(D=0,queueMicrotask(re))})},onWillRemoveListener(){M&&W>0&&re?.()},onDidRemoveLastListener(){re=void 0,_e.dispose()}},ve=new ge(he);return V?.add(ve),ve.event}e.debounce=y;function w(K,j=0,z){return e.debounce(K,(G,M)=>G?(G.push(M),G):[M],j,void 0,!0,void 0,z)}e.accumulate=w;function x(K,j=(G,M)=>G===M,z){let G=!0,M;return c(K,q=>{let V=G||!j(q,M);return G=!1,M=q,V},z)}e.latch=x;function C(K,j,z){return[e.filter(K,j,z),e.filter(K,G=>!j(G),z)]}e.split=C;function E(K,j=!1,z=[],G){let M=z.slice(),q=K(be=>{M?M.push(be):_e.fire(be)});G&&G.add(q);let V=()=>{M?.forEach(be=>_e.fire(be)),M=null},_e=new ge({onWillAddFirstListener(){q||(q=K(be=>_e.fire(be)),G&&G.add(q))},onDidAddFirstListener(){M&&(j?setTimeout(V):V())},onDidRemoveLastListener(){q&&q.dispose(),q=null}});return G&&G.add(_e),_e.event}e.buffer=E;function B(K,j){return(z,G,M)=>{let q=j(new Y);return K(function(V){let _e=q.evaluate(V);_e!==T&&z.call(G,_e)},void 0,M)}}e.chain=B;let T=Symbol("HaltChainable");class Y{constructor(){this.steps=[]}map(j){return this.steps.push(j),this}forEach(j){return this.steps.push(z=>(j(z),z)),this}filter(j){return this.steps.push(z=>j(z)?z:T),this}reduce(j,z){let G=z;return this.steps.push(M=>(G=j(G,M),G)),this}latch(j=(z,G)=>z===G){let z=!0,G;return this.steps.push(M=>{let q=z||!j(M,G);return z=!1,G=M,q?M:T}),this}evaluate(j){for(let z of this.steps)if(j=z(j),j===T)break;return j}}function P(K,j,z=G=>G){let G=(..._e)=>V.fire(z(..._e)),M=()=>K.on(j,G),q=()=>K.removeListener(j,G),V=new ge({onWillAddFirstListener:M,onDidRemoveLastListener:q});return V.event}e.fromNodeEventEmitter=P;function X(K,j,z=G=>G){let G=(..._e)=>V.fire(z(..._e)),M=()=>K.addEventListener(j,G),q=()=>K.removeEventListener(j,G),V=new ge({onWillAddFirstListener:M,onDidRemoveLastListener:q});return V.event}e.fromDOMEventEmitter=X;function ee(K){return new Promise(j=>n(K)(j))}e.toPromise=ee;function te(K){let j=new ge;return K.then(z=>{j.fire(z)},()=>{j.fire(void 0)}).finally(()=>{j.dispose()}),j.event}e.fromPromise=te;function se(K,j){return K(z=>j.fire(z))}e.forward=se;function le(K,j,z){return j(z),K(G=>j(G))}e.runAndSubscribe=le;class de{constructor(j,z){this._observable=j,this._counter=0,this._hasChanged=!1;let G={onWillAddFirstListener:()=>{j.addObserver(this)},onDidRemoveLastListener:()=>{j.removeObserver(this)}};this.emitter=new ge(G),z&&z.add(this.emitter)}beginUpdate(j){this._counter++}handlePossibleChange(j){}handleChange(j,z){this._hasChanged=!0}endUpdate(j){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function N(K,j){return new de(K,j).emitter.event}e.fromObservable=N;function U(K){return(j,z,G)=>{let M=0,q=!1,V={beginUpdate(){M++},endUpdate(){M--,M===0&&(K.reportChanges(),q&&(q=!1,j.call(z)))},handlePossibleChange(){},handleChange(){q=!0}};K.addObserver(V),K.reportChanges();let _e={dispose(){K.removeObserver(V)}};return G instanceof mr?G.add(_e):Array.isArray(G)&&G.push(_e),_e}}e.fromObservableLight=U})(Ai||={});var bp=class Sp{constructor(t){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${t}_${Sp._idPool++}`,Sp.all.add(this)}start(t){this._stopWatch=new zT,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}}};bp.all=new Set,bp._idPool=0;var jT=bp,HT=-1,ow=class cw{constructor(t,n,a=(cw._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,h]=this.getMostFrequentStack(),f=`[${this.name}] potential listener LEAK detected, having ${n} listeners already. MOST frequent listener (${h}):`;console.warn(f),console.warn(c);let _=new KT(f,c);this._errorHandler(_)}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}};ow._idPool=1;var UT=ow,PT=class uw{constructor(t){this.value=t}static create(){let t=new Error;return new uw(t.stack??"")}print(){console.warn(this.value.split(`
|
|
22
22
|
`).slice(2).join(`
|
|
23
|
-
`))}},LT=class extends Error{constructor(e,t){super(e),this.name="ListenerLeakError",this.stack=t}},BT=class extends Error{constructor(e,t){super(e),this.name="ListenerRefusalError",this.stack=t}},OT=0,Cf=class{constructor(e){this.value=e,this.id=OT++}},zT=2,jT,ve=class{constructor(e){this._size=0,this._options=e,this._leakageMon=this._options?.leakWarningThreshold?new NT(e?.onListenerError??pu,this._options?.leakWarningThreshold??MT):void 0,this._perfMon=this._options?._profName?new RT(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 h=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(h);let f=this._leakageMon.getMostFrequentStack()??["UNKNOWN stack",-1],m=new BT(`${h}. HINT: Stack shows most frequent listener (${f[1]}-times)`,f[0]);return(this._options?.onListenerError||pu)(m),Xe.None}if(this._disposed)return Xe.None;t&&(e=e.bind(t));let a=new Cf(e),o;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(a.stack=AT.create(),o=this._leakageMon.check(a.stack,this._size+1)),this._listeners?this._listeners instanceof Cf?(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=Rt(()=>{o?.(),this._removeListener(a)});return n instanceof pr?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*zT<=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||pu;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 Cf)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}},bp=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new ve,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new ve,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}};bp.INSTANCE=new bp;var Im=bp;function UT(e,t,n){typeof t=="string"&&(t=e.matchMedia(t)),t.addEventListener("change",n)}Im.INSTANCE.onDidChangeZoomLevel;function PT(e){return Im.INSTANCE.getZoomFactor(e)}Im.INSTANCE.onDidChangeFullscreen;var Ja=typeof navigator=="object"?navigator.userAgent:"",Sp=Ja.indexOf("Firefox")>=0,KT=Ja.indexOf("AppleWebKit")>=0,Fm=Ja.indexOf("Chrome")>=0,IT=!Fm&&Ja.indexOf("Safari")>=0;Ja.indexOf("Electron/")>=0;Ja.indexOf("Android")>=0;var xf=!1;if(typeof Rn.matchMedia=="function"){let e=Rn.matchMedia("(display-mode: standalone) or (display-mode: window-controls-overlay)"),t=Rn.matchMedia("(display-mode: fullscreen)");xf=e.matches,UT(Rn,e,({matches:n})=>{xf&&t.matches||(xf=n)})}var Pa="en",wp=!1,Cp=!1,mu=!1,rw=!1,iu,_u=Pa,Cb=Pa,FT,kn,Gr=globalThis,ys;typeof Gr.vscode<"u"&&typeof Gr.vscode.process<"u"?ys=Gr.vscode.process:typeof process<"u"&&typeof process?.versions?.node=="string"&&(ys=process);var qT=typeof ys?.versions?.electron=="string",WT=qT&&ys?.type==="renderer";if(typeof ys=="object"){wp=ys.platform==="win32",Cp=ys.platform==="darwin",mu=ys.platform==="linux",mu&&ys.env.SNAP&&ys.env.SNAP_REVISION,ys.env.CI||ys.env.BUILD_ARTIFACTSTAGINGDIRECTORY,iu=Pa,_u=Pa;let e=ys.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);iu=t.userLocale,Cb=t.osLocale,_u=t.resolvedLanguage||Pa,FT=t.languagePack?.translationsConfigFile}catch{}rw=!0}else typeof navigator=="object"&&!WT?(kn=navigator.userAgent,wp=kn.indexOf("Windows")>=0,Cp=kn.indexOf("Macintosh")>=0,(kn.indexOf("Macintosh")>=0||kn.indexOf("iPad")>=0||kn.indexOf("iPhone")>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints>0,mu=kn.indexOf("Linux")>=0,kn?.indexOf("Mobi")>=0,_u=globalThis._VSCODE_NLS_LANGUAGE||Pa,iu=navigator.language.toLowerCase(),Cb=iu):console.error("Unable to resolve platform.");var aw=wp,rn=Cp,$T=mu,xb=rw,an=kn,ar=_u,YT;(e=>{function t(){return ar}e.value=t;function n(){return ar.length===2?ar==="en":ar.length>=3?ar[0]==="e"&&ar[1]==="n"&&ar[2]==="-":!1}e.isDefaultVariant=n;function a(){return ar==="en"}e.isDefault=a})(YT||={});var VT=typeof Gr.postMessage=="function"&&!Gr.importScripts;(()=>{if(VT){let e=[];Gr.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}),Gr.postMessage({vscodeScheduleAsyncWork:a},"*")}}return e=>setTimeout(e)})();var XT=!!(an&&an.indexOf("Chrome")>=0);an&&an.indexOf("Firefox")>=0;!XT&&an&&an.indexOf("Safari")>=0;an&&an.indexOf("Edg/")>=0;an&&an.indexOf("Android")>=0;var za=typeof navigator=="object"?navigator:{};xb||document.queryCommandSupported&&document.queryCommandSupported("copy")||za&&za.clipboard&&za.clipboard.writeText,xb||za&&za.clipboard&&za.clipboard.readText;var qm=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}},Ef=new qm,Eb=new qm,Tb=new qm,GT=new Array(230),lw;(e=>{function t(f){return Ef.keyCodeToStr(f)}e.toString=t;function n(f){return Ef.strToKeyCode(f)}e.fromString=n;function a(f){return Eb.keyCodeToStr(f)}e.toUserSettingsUS=a;function o(f){return Tb.keyCodeToStr(f)}e.toUserSettingsGeneral=o;function c(f){return Eb.strToKeyCode(f)||Tb.strToKeyCode(f)}e.fromUserSettings=c;function h(f){if(f>=98&&f<=113)return null;switch(f){case 16:return"Up";case 18:return"Down";case 15:return"Left";case 17:return"Right"}return Ef.keyCodeToStr(f)}e.toElectronAccelerator=h})(lw||={});var ZT=class ow{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 ow&&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 QT([this])}isDuplicateModifierCase(){return this.ctrlKey&&this.keyCode===5||this.shiftKey&&this.keyCode===4||this.altKey&&this.keyCode===6||this.metaKey&&this.keyCode===57}},QT=class{constructor(e){if(e.length===0)throw CT("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 JT(e){if(e.charCode){let n=String.fromCharCode(e.charCode).toUpperCase();return lw.fromString(n)}let t=e.keyCode;if(t===3)return 7;if(Sp)switch(t){case 59:return 85;case 60:if($T)return 97;break;case 61:return 86;case 107:return 109;case 109:return 111;case 173:return 88;case 224:if(rn)return 57;break}else if(KT&&(rn&&t===93||!rn&&t===92))return 57;return GT[t]||0}var ek=rn?256:2048,tk=512,ik=1024,sk=rn?2048:256,kb=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=JT(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|=ek),this.altKey&&(t|=tk),this.shiftKey&&(t|=ik),this.metaKey&&(t|=sk),t|=e,t}_computeKeyCodeChord(){let e=0;return this.keyCode!==5&&this.keyCode!==4&&this.keyCode!==6&&this.keyCode!==57&&(e=this.keyCode),new ZT(this.ctrlKey,this.shiftKey,this.altKey,this.metaKey,e)}},Db=new WeakMap;function nk(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 rk=class{static getSameOriginWindowChain(e){let t=Db.get(e);if(!t){t=[],Db.set(e,t);let n=e,a;do a=nk(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 h=c.window.deref();if(n+=h?.scrollY??0,a+=h?.scrollX??0,h===t||!c.iframeElement)break;let f=c.iframeElement.getBoundingClientRect();n+=f.top,a+=f.left}return{top:n,left:a}}},su=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=rk.getPositionOfChildWindowRelativeToAncestorWindow(e,t.view);this.posx-=n.left,this.posy-=n.top}preventDefault(){this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent.stopPropagation()}},Rb=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(Fm){let o=navigator.userAgent.match(/Chrome\/(\d+)/);a=(o?parseInt(o[1]):123)<=122}if(e){let o=e,c=e,h=e.view?.devicePixelRatio||1;if(typeof o.wheelDeltaY<"u")a?this.deltaY=o.wheelDeltaY/(120*h):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 f=e;f.deltaMode===f.DOM_DELTA_LINE?Sp&&!rn?this.deltaY=-e.deltaY/3:this.deltaY=-e.deltaY:this.deltaY=-e.deltaY/40}if(typeof o.wheelDeltaX<"u")IT&&aw?this.deltaX=-(o.wheelDeltaX/120):a?this.deltaX=o.wheelDeltaX/(120*h):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 f=e;f.deltaMode===f.DOM_DELTA_LINE?Sp&&!rn?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*h):this.deltaY=e.wheelDelta/120)}}preventDefault(){this.browserEvent?.preventDefault()}stopPropagation(){this.browserEvent?.stopPropagation()}},cw=Object.freeze(function(e,t){let n=setTimeout(e.bind(t),0);return{dispose(){clearTimeout(n)}}}),ak;(e=>{function t(n){return n===e.None||n===e.Cancelled||n instanceof lk?!0:!n||typeof n!="object"?!1:typeof n.isCancellationRequested=="boolean"&&typeof n.onCancellationRequested=="function"}e.isCancellationToken=t,e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:Ni.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:cw})})(ak||={});var lk=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?cw:(this._emitter||(this._emitter=new ve),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}},Wm=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 mp("Calling 'cancelAndSet' on a disposed TimeoutTimer");this.cancel(),this._token=setTimeout(()=>{this._token=-1,e()},t)}setIfNotSet(e,t){if(this._isDisposed)throw new mp("Calling 'setIfNotSet' on a disposed TimeoutTimer");this._token===-1&&(this._token=setTimeout(()=>{this._token=-1,e()},t))}},ok=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 mp("Calling 'cancelAndSet' on a disposed IntervalTimer");this.cancel();let a=n.setInterval(()=>{e()},t);this.disposable=Rt(()=>{n.clearInterval(a),this.disposable=void 0})}dispose(){this.cancel(),this.isDisposed=!0}},ck;(e=>{async function t(a){let o,c=await Promise.all(a.map(h=>h.then(f=>f,f=>{o||(o=f)})));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(h){c(h)}})}e.withAsyncBody=n})(ck||={});var Mb=class Bs{static fromArray(t){return new Bs(n=>{n.emitMany(t)})}static fromPromise(t){return new Bs(async n=>{n.emitMany(await t)})}static fromPromises(t){return new Bs(async n=>{await Promise.all(t.map(async a=>n.emitOne(await a)))})}static merge(t){return new Bs(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 ve,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 Ni.toPromise(this._onStateChanged.event)}while(!0)},return:async()=>(this._onReturn?.(),{done:!0,value:void 0})}}static map(t,n){return new Bs(async a=>{for await(let o of t)a.emitOne(n(o))})}map(t){return Bs.map(this,t)}static filter(t,n){return new Bs(async a=>{for await(let o of t)n(o)&&a.emitOne(o)})}filter(t){return Bs.filter(this,t)}static coalesce(t){return Bs.filter(t,n=>!!n)}coalesce(){return Bs.coalesce(this)}static async toPromise(t){let n=[];for await(let a of t)n.push(a);return n}toPromise(){return Bs.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())}};Mb.EMPTY=Mb.fromArray([]);var{getWindow:nn,getWindowId:uk,onDidRegisterWindow:hk}=(function(){let e=new Map,t={window:Rn,disposables:new pr};e.set(Rn.vscodeWindowId,t);let n=new ve,a=new ve,o=new ve;function c(h,f){return(typeof h=="number"?e.get(h):void 0)??(f?t:void 0)}return{onDidRegisterWindow:n.event,onWillUnregisterWindow:o.event,onDidUnregisterWindow:a.event,registerWindow(h){if(e.has(h.vscodeWindowId))return Xe.None;let f=new pr,m={window:h,disposables:f.add(new pr)};return e.set(h.vscodeWindowId,m),f.add(Rt(()=>{e.delete(h.vscodeWindowId),a.fire(h)})),f.add(He(h,mi.BEFORE_UNLOAD,()=>{o.fire(h)})),n.fire(m),f},getWindows(){return e.values()},getWindowsCount(){return e.size},getWindowId(h){return h.vscodeWindowId},hasWindow(h){return e.has(h)},getWindowById:c,getWindow(h){let f=h;if(f?.ownerDocument?.defaultView)return f.ownerDocument.defaultView.window;let m=h;return m?.view?m.view.window:Rn},getDocument(h){return nn(h).document}}})(),dk=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 He(e,t,n,a){return new dk(e,t,n,a)}var Nb=function(e,t,n,a){return He(e,t,n,a)},$m,fk=class extends ok{constructor(e){super(),this.defaultTarget=e&&nn(e)}cancelAndSet(e,t,n){return super.cancelAndSet(e,t,n??this.defaultTarget)}},Ab=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){pu(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 h=e.get(c)??[];for(t.set(c,h),e.set(c,[]),a.set(c,!0);h.length>0;)h.sort(Ab.sort),h.shift().execute();a.set(c,!1)};$m=(c,h,f=0)=>{let m=uk(c),p=new Ab(h,f),b=e.get(m);return b||(b=[],e.set(m,b)),b.push(p),n.get(m)||(n.set(m,!0),c.requestAnimationFrame(()=>o(m))),p}})();function pk(e){let t=e.getBoundingClientRect(),n=nn(e);return{left:t.left+n.scrollX,top:t.top+n.scrollY,width:t.width,height:t.height}}var mi={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"},mk=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=ns(e);this._maxWidth!==t&&(this._maxWidth=t,this.domNode.style.maxWidth=this._maxWidth)}setWidth(e){let t=ns(e);this._width!==t&&(this._width=t,this.domNode.style.width=this._width)}setHeight(e){let t=ns(e);this._height!==t&&(this._height=t,this.domNode.style.height=this._height)}setTop(e){let t=ns(e);this._top!==t&&(this._top=t,this.domNode.style.top=this._top)}setLeft(e){let t=ns(e);this._left!==t&&(this._left=t,this.domNode.style.left=this._left)}setBottom(e){let t=ns(e);this._bottom!==t&&(this._bottom=t,this.domNode.style.bottom=this._bottom)}setRight(e){let t=ns(e);this._right!==t&&(this._right=t,this.domNode.style.right=this._right)}setPaddingTop(e){let t=ns(e);this._paddingTop!==t&&(this._paddingTop=t,this.domNode.style.paddingTop=this._paddingTop)}setPaddingLeft(e){let t=ns(e);this._paddingLeft!==t&&(this._paddingLeft=t,this.domNode.style.paddingLeft=this._paddingLeft)}setPaddingBottom(e){let t=ns(e);this._paddingBottom!==t&&(this._paddingBottom=t,this.domNode.style.paddingBottom=this._paddingBottom)}setPaddingRight(e){let t=ns(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=ns(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=ns(e);this._lineHeight!==t&&(this._lineHeight=t,this.domNode.style.lineHeight=this._lineHeight)}setLetterSpacing(e){let t=ns(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 ns(e){return typeof e=="number"?`${e}px`:e}function vo(e){return new mk(e)}var uw=class{constructor(){this._hooks=new pr,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(Rt(()=>{try{e.releasePointerCapture(t)}catch{}}))}catch{c=nn(e)}this._hooks.add(He(c,mi.POINTER_MOVE,h=>{if(h.buttons!==n){this.stopMonitoring(!0);return}h.preventDefault(),this._pointerMoveCallback(h)})),this._hooks.add(He(c,mi.POINTER_UP,h=>this.stopMonitoring(!0)))}};function _k(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(...h){return this.hasOwnProperty(c)||Object.defineProperty(this,c,{configurable:!1,enumerable:!1,writable:!1,value:o.apply(this,h)}),this[c]}}var sn;(e=>(e.Tap="-xterm-gesturetap",e.Change="-xterm-gesturechange",e.Start="-xterm-gesturestart",e.End="-xterm-gesturesend",e.Contextmenu="-xterm-gesturecontextmenu"))(sn||={});var no=class Oi extends Xe{constructor(){super(),this.dispatched=!1,this.targets=new wb,this.ignoreTargets=new wb,this.activeTouches={},this.handle=null,this._lastSetTapCountTime=0,this._register(Ni.runAndSubscribe(hk,({window:t,disposables:n})=>{n.add(He(t.document,"touchstart",a=>this.onTouchStart(a),{passive:!1})),n.add(He(t.document,"touchend",a=>this.onTouchEnd(t,a))),n.add(He(t.document,"touchmove",a=>this.onTouchMove(a),{passive:!1}))},{window:Rn,disposables:this._store}))}static addTarget(t){if(!Oi.isTouchDevice())return Xe.None;Oi.INSTANCE||(Oi.INSTANCE=new Oi);let n=Oi.INSTANCE.targets.push(t);return Rt(n)}static ignoreTarget(t){if(!Oi.isTouchDevice())return Xe.None;Oi.INSTANCE||(Oi.INSTANCE=new Oi);let n=Oi.INSTANCE.ignoreTargets.push(t);return Rt(n)}static isTouchDevice(){return"ontouchstart"in Rn||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 h=this.newGestureEvent(sn.Start,c.target);h.pageX=c.pageX,h.pageY=c.pageY,this.dispatchEvent(h)}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,h=n.changedTouches.length;c<h;c++){let f=n.changedTouches.item(c);if(!this.activeTouches.hasOwnProperty(String(f.identifier))){console.warn("move of an UNKNOWN touch",f);continue}let m=this.activeTouches[f.identifier],p=Date.now()-m.initialTimeStamp;if(p<Oi.HOLD_DELAY&&Math.abs(m.initialPageX-vs(m.rollingPageX))<30&&Math.abs(m.initialPageY-vs(m.rollingPageY))<30){let b=this.newGestureEvent(sn.Tap,m.initialTarget);b.pageX=vs(m.rollingPageX),b.pageY=vs(m.rollingPageY),this.dispatchEvent(b)}else if(p>=Oi.HOLD_DELAY&&Math.abs(m.initialPageX-vs(m.rollingPageX))<30&&Math.abs(m.initialPageY-vs(m.rollingPageY))<30){let b=this.newGestureEvent(sn.Contextmenu,m.initialTarget);b.pageX=vs(m.rollingPageX),b.pageY=vs(m.rollingPageY),this.dispatchEvent(b)}else if(o===1){let b=vs(m.rollingPageX),y=vs(m.rollingPageY),w=vs(m.rollingTimestamps)-m.rollingTimestamps[0],x=b-m.rollingPageX[0],C=y-m.rollingPageY[0],E=[...this.targets].filter(B=>m.initialTarget instanceof Node&&B.contains(m.initialTarget));this.inertia(t,E,a,Math.abs(x)/w,x>0?1:-1,b,Math.abs(C)/w,C>0?1:-1,y)}this.dispatchEvent(this.newGestureEvent(sn.End,m.initialTarget)),delete this.activeTouches[f.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===sn.Tap){let n=new Date().getTime(),a=0;n-this._lastSetTapCountTime>Oi.CLEAR_TAP_COUNT_TIME?a=1:a=2,this._lastSetTapCountTime=n,t.tapCount=a}else(t.type===sn.Change||t.type===sn.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,h,f,m,p){this.handle=$m(t,()=>{let b=Date.now(),y=b-a,w=0,x=0,C=!0;o+=Oi.SCROLL_FRICTION*y,f+=Oi.SCROLL_FRICTION*y,o>0&&(C=!1,w=c*o*y),f>0&&(C=!1,x=m*f*y);let E=this.newGestureEvent(sn.Change);E.translationX=w,E.translationY=x,n.forEach(B=>B.dispatchEvent(E)),C||this.inertia(t,n,b,o,c,h+w,f,m,p+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 h=this.activeTouches[c.identifier],f=this.newGestureEvent(sn.Change,h.initialTarget);f.translationX=c.pageX-vs(h.rollingPageX),f.translationY=c.pageY-vs(h.rollingPageY),f.pageX=c.pageX,f.pageY=c.pageY,this.dispatchEvent(f),h.rollingPageX.length>3&&(h.rollingPageX.shift(),h.rollingPageY.shift(),h.rollingTimestamps.shift()),h.rollingPageX.push(c.pageX),h.rollingPageY.push(c.pageY),h.rollingTimestamps.push(n)}this.dispatched&&(t.preventDefault(),t.stopPropagation(),this.dispatched=!1)}};no.SCROLL_FRICTION=-.005,no.HOLD_DELAY=700,no.CLEAR_TAP_COUNT_TIME=400,Ut([_k],no,"isTouchDevice",1);var vk=no,Ym=class extends Xe{onclick(e,t){this._register(He(e,mi.CLICK,n=>t(new su(nn(e),n))))}onmousedown(e,t){this._register(He(e,mi.MOUSE_DOWN,n=>t(new su(nn(e),n))))}onmouseover(e,t){this._register(He(e,mi.MOUSE_OVER,n=>t(new su(nn(e),n))))}onmouseleave(e,t){this._register(He(e,mi.MOUSE_LEAVE,n=>t(new su(nn(e),n))))}onkeydown(e,t){this._register(He(e,mi.KEY_DOWN,n=>t(new kb(n))))}onkeyup(e,t){this._register(He(e,mi.KEY_UP,n=>t(new kb(n))))}oninput(e,t){this._register(He(e,mi.INPUT,t))}onblur(e,t){this._register(He(e,mi.BLUR,t))}onfocus(e,t){this._register(He(e,mi.FOCUS,t))}onchange(e,t){this._register(He(e,mi.CHANGE,t))}ignoreGesture(e){return vk.ignoreTarget(e)}},Lb=11,gk=class extends Ym{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=Lb+"px",this.domNode.style.height=Lb+"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 uw),this._register(Nb(this.bgDomNode,mi.POINTER_DOWN,t=>this._arrowPointerDown(t))),this._register(Nb(this.domNode,mi.POINTER_DOWN,t=>this._arrowPointerDown(t))),this._pointerdownRepeatTimer=this._register(new fk),this._pointerdownScheduleRepeatTimer=this._register(new Wm)}_arrowPointerDown(e){if(!e.target||!(e.target instanceof Element))return;let t=()=>{this._pointerdownRepeatTimer.cancelAndSet(()=>this._onActivate(),1e3/24,nn(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()}},yk=class xp{constructor(t,n,a,o,c,h,f){this._forceIntegerValues=t,this._scrollStateBrand=void 0,this._forceIntegerValues&&(n=n|0,a=a|0,o=o|0,c=c|0,h=h|0,f=f|0),this.rawScrollLeft=o,this.rawScrollTop=f,n<0&&(n=0),o+n>a&&(o=a-n),o<0&&(o=0),c<0&&(c=0),f+c>h&&(f=h-c),f<0&&(f=0),this.width=n,this.scrollWidth=a,this.scrollLeft=o,this.height=c,this.scrollHeight=h,this.scrollTop=f}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 xp(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 xp(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,h=this.height!==t.height,f=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:h,scrollHeightChanged:f,scrollTopChanged:m}}},bk=class extends Xe{constructor(e){super(),this._scrollableBrand=void 0,this._onScroll=this._register(new ve),this.onScroll=this._onScroll.event,this._smoothScrollDuration=e.smoothScrollDuration,this._scheduleAtNextAnimationFrame=e.scheduleAtNextAnimationFrame,this._state=new yk(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 Ob(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=Ob.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)))}},Bb=class{constructor(e,t,n){this.scrollLeft=e,this.scrollTop=t,this.isDone=n}};function Tf(e,t){let n=t-e;return function(a){return e+n*Ck(a)}}function Sk(e,t,n){return function(a){return a<n?e(a/n):t((a-n)/(1-n))}}var Ob=class Ep{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),Sk(Tf(t,o),Tf(c,n),.33)}return Tf(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 Bb(a,o,!1)}return new Bb(this.to.scrollLeft,this.to.scrollTop,!0)}combine(t,n,a){return Ep.start(t,n,a)}static start(t,n,a){a=a+10;let o=Date.now()-10;return new Ep(t,n,o,a)}};function wk(e){return Math.pow(e,3)}function Ck(e){return 1-wk(1-e)}var xk=class extends Xe{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 Wm)}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":"")))}},Ek=140,hw=class extends Ym{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 xk(e.visibility,"visible scrollbar "+e.extraScrollbarClassName,"invisible scrollbar "+e.extraScrollbarClassName)),this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._pointerMoveMonitor=this._register(new uw),this._shouldRender=!0,this.domNode=vo(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(He(this.domNode.domNode,mi.POINTER_DOWN,t=>this._domNodePointerDown(t)))}_createArrow(e){let t=this._register(new gk(e));this.domNode.domNode.appendChild(t.bgDomNode),this.domNode.domNode.appendChild(t.domNode)}_createSlider(e,t,n,a){this.slider=vo(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(He(this.slider.domNode,mi.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=pk(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),h=Math.abs(c-n);if(aw&&h>Ek){this._setDesiredScrollPositionNow(a.getScrollPosition());return}let f=this._sliderPointerPosition(o)-t;this._setDesiredScrollPositionNow(a.getDesiredScrollPositionFromDelta(f))},()=>{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()}},dw=class Tp{constructor(t,n,a,o,c,h){this._scrollbarSize=Math.round(n),this._oppositeScrollbarSize=Math.round(a),this._arrowSize=Math.round(t),this._visibleSize=o,this._scrollSize=c,this._scrollPosition=h,this._computedAvailableSize=0,this._computedIsNeeded=!1,this._computedSliderSize=0,this._computedSliderRatio=0,this._computedSliderPosition=0,this._refreshComputedValues()}clone(){return new Tp(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 h=Math.max(0,a-t),f=Math.max(0,h-2*n),m=o>0&&o>a;if(!m)return{computedAvailableSize:Math.round(h),computedIsNeeded:m,computedSliderSize:Math.round(f),computedSliderRatio:0,computedSliderPosition:0};let p=Math.round(Math.max(20,Math.floor(a*f/o))),b=(f-p)/(o-a),y=c*b;return{computedAvailableSize:Math.round(h),computedIsNeeded:m,computedSliderSize:Math.round(p),computedSliderRatio:b,computedSliderPosition:Math.round(y)}}_refreshComputedValues(){let t=Tp._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)}},Tk=class extends hw{constructor(e,t,n){let a=e.getScrollDimensions(),o=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:n,scrollbarState:new dw(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}},kk=class extends hw{constructor(e,t,n){let a=e.getScrollDimensions(),o=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:n,scrollbarState:new dw(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}},Dk=500,zb=50,Rk=class{constructor(e,t,n){this.timestamp=e,this.deltaX=t,this.deltaY=n,this.score=0}},kp=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(Fm){let n=nn(t.browserEvent),a=PT(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 Rk(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),h=Math.abs(n.deltaX),f=Math.abs(n.deltaY),m=Math.max(Math.min(o,h),1),p=Math.max(Math.min(c,f),1),b=Math.max(o,h),y=Math.max(c,f);b%m===0&&y%p===0&&(a-=.5)}return Math.min(Math.max(a,0),1)}_isAlmostInt(t){return Math.abs(Math.round(t)-t)<.01}};kp.INSTANCE=new kp;var Mk=kp,Nk=class extends Ym{constructor(e,t,n){super(),this._onScroll=this._register(new ve),this.onScroll=this._onScroll.event,this._onWillScroll=this._register(new ve),this.onWillScroll=this._onWillScroll.event,this._options=Lk(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 kk(this._scrollable,this._options,a)),this._horizontalScrollbar=this._register(new Tk(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=vo(document.createElement("div")),this._leftShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._leftShadowDomNode.domNode),this._topShadowDomNode=vo(document.createElement("div")),this._topShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._topShadowDomNode.domNode),this._topLeftShadowDomNode=vo(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 Wm),this._isDragging=!1,this._mouseIsOver=!1,this._shouldRender=!0,this._revealOnScroll=!0}get options(){return this._options}dispose(){this._mouseWheelToDispose=Jr(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,rn&&(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 Rb(e))}_setListeningToMouseWheel(e){if(this._mouseWheelToDispose.length>0!==e&&(this._mouseWheelToDispose=Jr(this._mouseWheelToDispose),e)){let t=n=>{this._onMouseWheel(new Rb(n))};this._mouseWheelToDispose.push(He(this._listenOnDomNode,mi.MOUSE_WHEEL,t,{passive:!1}))}}_onMouseWheel(e){if(e.browserEvent?.defaultPrevented)return;let t=Mk.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 h=!rn&&e.browserEvent&&e.browserEvent.shiftKey;(this._options.scrollYToX||h)&&!c&&(c=o,o=0),e.browserEvent&&e.browserEvent.altKey&&(c=c*this._options.fastScrollSensitivity,o=o*this._options.fastScrollSensitivity);let f=this._scrollable.getFutureScrollPosition(),m={};if(o){let p=zb*o,b=f.scrollTop-(p<0?Math.floor(p):Math.ceil(p));this._verticalScrollbar.writeScrollPosition(m,b)}if(c){let p=zb*c,b=f.scrollLeft-(p<0?Math.floor(p):Math.ceil(p));this._horizontalScrollbar.writeScrollPosition(m,b)}m=this._scrollable.validateScrollPosition(m),(f.scrollLeft!==m.scrollLeft||f.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(),Dk)}},Ak=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 Lk(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,rn&&(t.className+=" mac"),t}var Dp=class extends Xe{constructor(e,t,n,a,o,c,h,f){super(),this._bufferService=n,this._optionsService=h,this._renderService=f,this._onRequestScrollLines=this._register(new ve),this.onRequestScrollLines=this._onRequestScrollLines.event,this._isSyncing=!1,this._isHandlingScroll=!1,this._suppressOnScrollHandler=!1;let m=this._register(new bk({forceIntegerValues:!1,smoothScrollDuration:this._optionsService.rawOptions.smoothScrollDuration,scheduleAtNextAnimationFrame:p=>$m(a.window,p)}));this._register(this._optionsService.onSpecificOptionChange("smoothScrollDuration",()=>{m.setSmoothScrollDuration(this._optionsService.rawOptions.smoothScrollDuration)})),this._scrollableElement=this._register(new Ak(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(p=>{this._scrollableElement.updateOptions({handleMouseWheel:!(p&16)})})),this._scrollableElement.setScrollDimensions({height:0,scrollHeight:0}),this._register(Ni.runAndSubscribe(c.onChangeColors,()=>{this._scrollableElement.getDomNode().style.backgroundColor=c.colors.background.css})),e.appendChild(this._scrollableElement.getDomNode()),this._register(Rt(()=>this._scrollableElement.getDomNode().remove())),this._styleElement=a.mainDocument.createElement("style"),t.appendChild(this._styleElement),this._register(Rt(()=>this._styleElement.remove())),this._register(Ni.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(`
|
|
24
|
-
`)})),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(p=>this._handleScroll(p)))}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}};Dp=Ut([ye(2,$i),ye(3,An),ye(4,$0),ye(5,Qa),ye(6,Yi),ye(7,Ln)],Dp);var Rp=class extends Xe{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(Rt(()=>{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()}};Rp=Ut([ye(1,$i),ye(2,An),ye(3,Uo),ye(4,Ln)],Rp);var Bk=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)}},en={full:0,left:0,center:0,right:0},lr={full:0,left:0,center:0,right:0},Yl={full:0,left:0,center:0,right:0},Lu=class extends Xe{constructor(e,t,n,a,o,c,h,f){super(),this._viewportElement=e,this._screenElement=t,this._bufferService=n,this._decorationService=a,this._renderService=o,this._optionsService=c,this._themeService=h,this._coreBrowserService=f,this._colorZoneStore=new Bk,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(Rt(()=>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);lr.full=this._canvas.width,lr.left=e,lr.center=t,lr.right=e,this._refreshDrawHeightConstants(),Yl.full=1,Yl.left=1,Yl.center=1+lr.left,Yl.right=1+lr.left+lr.center}_refreshDrawHeightConstants(){en.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);en.left=t,en.center=t,en.right=t}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*en.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*en.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*en.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*en.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(Yl[e.position||"full"],Math.round((this._canvas.height-1)*(e.startBufferLine/this._bufferService.buffers.active.lines.length)-en[e.position||"full"]/2),lr[e.position||"full"],Math.round((this._canvas.height-1)*((e.endBufferLine-e.startBufferLine)/this._bufferService.buffers.active.lines.length)+en[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}))}};Lu=Ut([ye(2,$i),ye(3,Uo),ye(4,Ln),ye(5,Yi),ye(6,Qa),ye(7,An)],Lu);var ue;(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=`
|
|
25
|
-
`,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=""))(ue||={});var vu;(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=""))(vu||={});var fw;(e=>e.ST=`${ue.ESC}\\`)(fw||={});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(`${ue.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=Ut([ye(2,$i),ye(3,Yi),ye(4,ta),ye(5,Ln)],Mp);var vi=0,gi=0,yi=0,Ht=0,jb={css:"#00000000",rgba:0},ti;(e=>{function t(o,c,h,f){return f!==void 0?`#${qr(o)}${qr(c)}${qr(h)}${qr(f)}`:`#${qr(o)}${qr(c)}${qr(h)}`}e.toCss=t;function n(o,c,h,f=255){return(o<<24|c<<16|h<<8|f)>>>0}e.toRgba=n;function a(o,c,h,f){return{css:e.toCss(o,c,h,f),rgba:e.toRgba(o,c,h,f)}}e.toColor=a})(ti||={});var Et;(e=>{function t(m,p){if(Ht=(p.rgba&255)/255,Ht===1)return{css:p.css,rgba:p.rgba};let b=p.rgba>>24&255,y=p.rgba>>16&255,w=p.rgba>>8&255,x=m.rgba>>24&255,C=m.rgba>>16&255,E=m.rgba>>8&255;vi=x+Math.round((b-x)*Ht),gi=C+Math.round((y-C)*Ht),yi=E+Math.round((w-E)*Ht);let B=ti.toCss(vi,gi,yi),T=ti.toRgba(vi,gi,yi);return{css:B,rgba:T}}e.blend=t;function n(m){return(m.rgba&255)===255}e.isOpaque=n;function a(m,p,b){let y=gu.ensureContrastRatio(m.rgba,p.rgba,b);if(y)return ti.toColor(y>>24&255,y>>16&255,y>>8&255)}e.ensureContrastRatio=a;function o(m){let p=(m.rgba|255)>>>0;return[vi,gi,yi]=gu.toChannels(p),{css:ti.toCss(vi,gi,yi),rgba:p}}e.opaque=o;function c(m,p){return Ht=Math.round(p*255),[vi,gi,yi]=gu.toChannels(m.rgba),{css:ti.toCss(vi,gi,yi,Ht),rgba:ti.toRgba(vi,gi,yi,Ht)}}e.opacity=c;function h(m,p){return Ht=m.rgba&255,c(m,Ht*p/255)}e.multiplyOpacity=h;function f(m){return[m.rgba>>24&255,m.rgba>>16&255,m.rgba>>8&255]}e.toColorRGB=f})(Et||={});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 vi=parseInt(o.slice(1,2).repeat(2),16),gi=parseInt(o.slice(2,3).repeat(2),16),yi=parseInt(o.slice(3,4).repeat(2),16),ti.toColor(vi,gi,yi);case 5:return vi=parseInt(o.slice(1,2).repeat(2),16),gi=parseInt(o.slice(2,3).repeat(2),16),yi=parseInt(o.slice(3,4).repeat(2),16),Ht=parseInt(o.slice(4,5).repeat(2),16),ti.toColor(vi,gi,yi,Ht);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 vi=parseInt(c[1]),gi=parseInt(c[2]),yi=parseInt(c[3]),Ht=Math.round((c[5]===void 0?1:parseFloat(c[5]))*255),ti.toColor(vi,gi,yi,Ht);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),[vi,gi,yi,Ht]=t.getImageData(0,0,1,1).data,Ht!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:ti.toRgba(vi,gi,yi,Ht),css:o}}e.toColor=a})(At||={});var Wi;(e=>{function t(a){return n(a>>16&255,a>>8&255,a&255)}e.relativeLuminance=t;function n(a,o,c){let h=a/255,f=o/255,m=c/255,p=h<=.03928?h/12.92:Math.pow((h+.055)/1.055,2.4),b=f<=.03928?f/12.92:Math.pow((f+.055)/1.055,2.4),y=m<=.03928?m/12.92:Math.pow((m+.055)/1.055,2.4);return p*.2126+b*.7152+y*.0722}e.relativeLuminance2=n})(Wi||={});var gu;(e=>{function t(h,f){if(Ht=(f&255)/255,Ht===1)return f;let m=f>>24&255,p=f>>16&255,b=f>>8&255,y=h>>24&255,w=h>>16&255,x=h>>8&255;return vi=y+Math.round((m-y)*Ht),gi=w+Math.round((p-w)*Ht),yi=x+Math.round((b-x)*Ht),ti.toRgba(vi,gi,yi)}e.blend=t;function n(h,f,m){let p=Wi.relativeLuminance(h>>8),b=Wi.relativeLuminance(f>>8);if(En(p,b)<m){if(b<p){let x=a(h,f,m),C=En(p,Wi.relativeLuminance(x>>8));if(C<m){let E=o(h,f,m),B=En(p,Wi.relativeLuminance(E>>8));return C>B?x:E}return x}let y=o(h,f,m),w=En(p,Wi.relativeLuminance(y>>8));if(w<m){let x=a(h,f,m),C=En(p,Wi.relativeLuminance(x>>8));return w>C?y:x}return y}}e.ensureContrastRatio=n;function a(h,f,m){let p=h>>24&255,b=h>>16&255,y=h>>8&255,w=f>>24&255,x=f>>16&255,C=f>>8&255,E=En(Wi.relativeLuminance2(w,x,C),Wi.relativeLuminance2(p,b,y));for(;E<m&&(w>0||x>0||C>0);)w-=Math.max(0,Math.ceil(w*.1)),x-=Math.max(0,Math.ceil(x*.1)),C-=Math.max(0,Math.ceil(C*.1)),E=En(Wi.relativeLuminance2(w,x,C),Wi.relativeLuminance2(p,b,y));return(w<<24|x<<16|C<<8|255)>>>0}e.reduceLuminance=a;function o(h,f,m){let p=h>>24&255,b=h>>16&255,y=h>>8&255,w=f>>24&255,x=f>>16&255,C=f>>8&255,E=En(Wi.relativeLuminance2(w,x,C),Wi.relativeLuminance2(p,b,y));for(;E<m&&(w<255||x<255||C<255);)w=Math.min(255,w+Math.ceil((255-w)*.1)),x=Math.min(255,x+Math.ceil((255-x)*.1)),C=Math.min(255,C+Math.ceil((255-C)*.1)),E=En(Wi.relativeLuminance2(w,x,C),Wi.relativeLuminance2(p,b,y));return(w<<24|x<<16|C<<8|255)>>>0}e.increaseLuminance=o;function c(h){return[h>>24&255,h>>16&255,h>>8&255,h&255]}e.toChannels=c})(gu||={});function qr(e){let t=e.toString(16);return t.length<2?"0"+t:t}function En(e,t){return e<t?(t+.05)/(e+.05):(e+.05)/(t+.05)}var Ok=class extends Ho{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()]}},Bu=class{constructor(e){this._bufferService=e,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new Hs}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,h=0,f=t.getFg(0),m=t.getBg(0);for(let p=0;p<t.getTrimmedLength();p++)if(t.loadCell(p,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==f||this._workCell.bg!==m){if(p-o>1){let b=this._getJoinedRanges(a,h,c,t,o);for(let y=0;y<b.length;y++)n.push(b[y])}o=p,h=c,f=this._workCell.fg,m=this._workCell.bg}c+=this._workCell.getChars().length||dr.length}if(this._bufferService.cols-o>1){let p=this._getJoinedRanges(a,h,c,t,o);for(let b=0;b<p.length;b++)n.push(p[b])}return n}_getJoinedRanges(e,t,n,a,o){let c=e.substring(t,n),h=[];try{h=this._characterJoiners[0].handler(c)}catch(f){console.error(f)}for(let f=1;f<this._characterJoiners.length;f++)try{let m=this._characterJoiners[f].handler(c);for(let p=0;p<m.length;p++)Bu._mergeRanges(h,m[p])}catch(m){console.error(m)}return this._stringRangesToCellRanges(h,a,o),h}_stringRangesToCellRanges(e,t,n){let a=0,o=!1,c=0,h=e[a];if(h){for(let f=n;f<this._bufferService.cols;f++){let m=t.getWidth(f),p=t.getString(f).length||dr.length;if(m!==0){if(!o&&h[0]<=c&&(h[0]=f,o=!0),h[1]<=c){if(h[1]=f,h=e[++a],!h)break;h[0]<=c?(h[0]=f,o=!0):o=!1}c+=p}}h&&(h[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}};Bu=Ut([ye(0,$i)],Bu);function zk(e){return 57508<=e&&e<=57558}function jk(e){return 9472<=e&&e<=9631}function Hk(e){return zk(e)||jk(e)}function Uk(){return{css:{canvas:nu(),cell:nu()},device:{canvas:nu(),cell:nu(),char:{width:0,height:0,left:0,top:0}}}}function nu(){return{width:0,height:0}}var Np=class{constructor(e,t,n,a,o,c,h){this._document=e,this._characterJoinerService=t,this._optionsService=n,this._coreBrowserService=a,this._coreService=o,this._decorationService=c,this._themeService=h,this._workCell=new Hs,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,h,f,m,p,b){let y=[],w=this._characterJoinerService.getJoinedCharacters(t),x=this._themeService.colors,C=e.getNoBgTrimmedLength();n&&C<c+1&&(C=c+1);let E,B=0,T="",Y=0,K=0,X=0,re=0,ee=!1,ie=0,le=!1,de=0,N=0,U=[],P=p!==-1&&b!==-1;for(let j=0;j<C;j++){e.loadCell(j,this._workCell);let z=this._workCell.getWidth();if(z===0)continue;let G=!1,M=j>=N,q=j,V=this._workCell;if(w.length>0&&j===w[0][0]&&M){let we=w.shift(),te=this._isCellInSelection(we[0],t);for(Y=we[0]+1;Y<we[1];Y++)M&&=te===this._isCellInSelection(Y,t);M&&=!n||c<we[0]||c>=we[1],M?(G=!0,V=new Ok(this._workCell,e.translateToString(!0,we[0],we[1]),we[1]-we[0]),q=we[1]-1,z=V.getWidth()):N=we[1]}let _e=this._isCellInSelection(j,t),be=n&&j===c,D=P&&j>=p&&j<=b,W=!1;this._decorationService.forEachDecorationAtCell(j,t,void 0,we=>{W=!0});let ne=V.getChars()||dr;if(ne===" "&&(V.isUnderline()||V.isOverline())&&(ne=" "),de=z*f-m.get(ne,V.isBold(),V.isItalic()),!E)E=this._document.createElement("span");else if(B&&(_e&&le||!_e&&!le&&V.bg===K)&&(_e&&le&&x.selectionForeground||V.fg===X)&&V.extended.ext===re&&D===ee&&de===ie&&!be&&!G&&!W&&M){V.isInvisible()?T+=dr:T+=ne,B++;continue}else B&&(E.textContent=T),E=this._document.createElement("span"),B=0,T="";if(K=V.bg,X=V.fg,re=V.extended.ext,ee=D,ie=de,le=_e,G&&c>=j&&c<=q&&(c=j),!this._coreService.isCursorHidden&&be&&this._coreService.isCursorInitialized){if(U.push("xterm-cursor"),this._coreBrowserService.isFocused)h&&U.push("xterm-cursor-blink"),U.push(a==="bar"?"xterm-cursor-bar":a==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(o)switch(o){case"outline":U.push("xterm-cursor-outline");break;case"block":U.push("xterm-cursor-block");break;case"bar":U.push("xterm-cursor-bar");break;case"underline":U.push("xterm-cursor-underline");break}}if(V.isBold()&&U.push("xterm-bold"),V.isItalic()&&U.push("xterm-italic"),V.isDim()&&U.push("xterm-dim"),V.isInvisible()?T=dr:T=V.getChars()||dr,V.isUnderline()&&(U.push(`xterm-underline-${V.extended.underlineStyle}`),T===" "&&(T=" "),!V.isUnderlineColorDefault()))if(V.isUnderlineColorRGB())E.style.textDecorationColor=`rgb(${Ho.toColorRGB(V.getUnderlineColor()).join(",")})`;else{let we=V.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&V.isBold()&&we<8&&(we+=8),E.style.textDecorationColor=x.ansi[we].css}V.isOverline()&&(U.push("xterm-overline"),T===" "&&(T=" ")),V.isStrikethrough()&&U.push("xterm-strikethrough"),D&&(E.style.textDecoration="underline");let he=V.getFgColor(),ge=V.getFgColorMode(),pe=V.getBgColor(),ke=V.getBgColorMode(),me=!!V.isInverse();if(me){let we=he;he=pe,pe=we;let te=ge;ge=ke,ke=te}let Se,Me,Ue=!1;this._decorationService.forEachDecorationAtCell(j,t,void 0,we=>{we.options.layer!=="top"&&Ue||(we.backgroundColorRGB&&(ke=50331648,pe=we.backgroundColorRGB.rgba>>8&16777215,Se=we.backgroundColorRGB),we.foregroundColorRGB&&(ge=50331648,he=we.foregroundColorRGB.rgba>>8&16777215,Me=we.foregroundColorRGB),Ue=we.options.layer==="top")}),!Ue&&_e&&(Se=this._coreBrowserService.isFocused?x.selectionBackgroundOpaque:x.selectionInactiveBackgroundOpaque,pe=Se.rgba>>8&16777215,ke=50331648,Ue=!0,x.selectionForeground&&(ge=50331648,he=x.selectionForeground.rgba>>8&16777215,Me=x.selectionForeground)),Ue&&U.push("xterm-decoration-top");let Ke;switch(ke){case 16777216:case 33554432:Ke=x.ansi[pe],U.push(`xterm-bg-${pe}`);break;case 50331648:Ke=ti.toColor(pe>>16,pe>>8&255,pe&255),this._addStyle(E,`background-color:#${Hb((pe>>>0).toString(16),"0",6)}`);break;default:me?(Ke=x.foreground,U.push("xterm-bg-257")):Ke=x.background}switch(Se||V.isDim()&&(Se=Et.multiplyOpacity(Ke,.5)),ge){case 16777216:case 33554432:V.isBold()&&he<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(he+=8),this._applyMinimumContrast(E,Ke,x.ansi[he],V,Se,void 0)||U.push(`xterm-fg-${he}`);break;case 50331648:let we=ti.toColor(he>>16&255,he>>8&255,he&255);this._applyMinimumContrast(E,Ke,we,V,Se,Me)||this._addStyle(E,`color:#${Hb(he.toString(16),"0",6)}`);break;default:this._applyMinimumContrast(E,Ke,x.foreground,V,Se,Me)||me&&U.push("xterm-fg-257")}U.length&&(E.className=U.join(" "),U.length=0),!be&&!G&&!W&&M?B++:E.textContent=T,de!==this.defaultSpacing&&(E.style.letterSpacing=`${de}px`),y.push(E),j=q}return E&&B&&(E.textContent=T),y}_applyMinimumContrast(e,t,n,a,o,c){if(this._optionsService.rawOptions.minimumContrastRatio===1||Hk(a.getCode()))return!1;let h=this._getContrastCache(a),f;if(!o&&!c&&(f=h.getColor(t.rgba,n.rgba)),f===void 0){let m=this._optionsService.rawOptions.minimumContrastRatio/(a.isDim()?2:1);f=Et.ensureContrastRatio(o||t,c||n,m),h.setColor((o||t).rgba,(c||n).rgba,f??null)}return f?(this._addStyle(e,`color:${f.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]}};Np=Ut([ye(1,X0),ye(2,Yi),ye(3,An),ye(4,ta),ye(5,Uo),ye(6,Qa)],Np);function Hb(e,t,n){for(;e.length<n;)e=t+e;return e}var Pk=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 h=this._measure(e,0);return h>0&&(this._flat[a]=h),h}let o=e;t&&(o+="B"),n&&(o+="I");let c=this._holey.get(o);if(c===void 0){let h=0;t&&(h|=1),n&&(h|=2),c=this._measure(e,h),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}},Kk=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,h=n[1]-o,f=Math.max(c,0),m=Math.min(h,e.rows-1);if(f>=e.rows||m<0){this.clear();return}this.hasSelection=!0,this.columnSelectMode=a,this.viewportStartRow=c,this.viewportEndRow=h,this.viewportCappedStartRow=f,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 Ik(){return new Kk}var kf="xterm-dom-renderer-owner-",Ls="xterm-rows",ru="xterm-fg-",Ub="xterm-bg-",Vl="xterm-focus",au="xterm-selection",Fk=1,Ap=class extends Xe{constructor(e,t,n,a,o,c,h,f,m,p,b,y,w,x){super(),this._terminal=e,this._document=t,this._element=n,this._screenElement=a,this._viewportElement=o,this._helperContainer=c,this._linkifier2=h,this._charSizeService=m,this._optionsService=p,this._bufferService=b,this._coreService=y,this._coreBrowserService=w,this._themeService=x,this._terminalClass=Fk++,this._rowElements=[],this._selectionRenderModel=Ik(),this.onRequestRedraw=this._register(new ve).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(Ls),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(au),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=Uk(),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=f.createInstance(Np,document),this._element.classList.add(kf+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(Rt(()=>{this._element.classList.remove(kf+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()})),this._widthCache=new Pk(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} .${Ls} 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} .${Ls} { 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} .${Ls} .xterm-dim { color: ${Et.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} .${Ls}.${Vl} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${n} 1s step-end infinite;}${this._terminalSelector} .${Ls}.${Vl} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${a} 1s step-end infinite;}${this._terminalSelector} .${Ls}.${Vl} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${o} 1s step-end infinite;}${this._terminalSelector} .${Ls} .xterm-cursor.xterm-cursor-block { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css};}${this._terminalSelector} .${Ls} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${e.cursor.css} !important; color: ${e.cursorAccent.css} !important;}${this._terminalSelector} .${Ls} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${e.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${Ls} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${e.cursor.css} inset;}${this._terminalSelector} .${Ls} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${e.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,t+=`${this._terminalSelector} .${au} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${au} div { position: absolute; background-color: ${e.selectionBackgroundOpaque.css};}${this._terminalSelector} .${au} div { position: absolute; background-color: ${e.selectionInactiveBackgroundOpaque.css};}`;for(let[c,h]of e.ansi.entries())t+=`${this._terminalSelector} .${ru}${c} { color: ${h.css}; }${this._terminalSelector} .${ru}${c}.xterm-dim { color: ${Et.multiplyOpacity(h,.5).css}; }${this._terminalSelector} .${Ub}${c} { background-color: ${h.css}; }`;t+=`${this._terminalSelector} .${ru}257 { color: ${Et.opaque(e.background).css}; }${this._terminalSelector} .${ru}257.xterm-dim { color: ${Et.multiplyOpacity(Et.opaque(e.background),.5).css}; }${this._terminalSelector} .${Ub}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(Vl),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(Vl),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,h=this._selectionRenderModel.viewportCappedEndRow,f=this._document.createDocumentFragment();if(n){let m=e[0]>t[0];f.appendChild(this._createSelectionElement(c,m?t[0]:e[0],m?e[0]:t[0],h-c+1))}else{let m=a===c?e[0]:0,p=c===o?t[0]:this._bufferService.cols;f.appendChild(this._createSelectionElement(c,m,p));let b=h-c-1;if(f.appendChild(this._createSelectionElement(c+1,0,this._bufferService.cols,b)),c!==h){let y=o===h?t[0]:this._bufferService.cols;f.appendChild(this._createSelectionElement(h,0,y))}}this._selectionContainer.appendChild(f)}_createSelectionElement(e,t,n,a=1){let o=this._document.createElement("div"),c=t*this.dimensions.css.cell.width,h=this.dimensions.css.cell.width*(n-t);return c+h>this.dimensions.css.canvas.width&&(h=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=`${h}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,h=this._coreService.decPrivateModes.cursorStyle??this._optionsService.rawOptions.cursorStyle,f=this._optionsService.rawOptions.cursorInactiveStyle;for(let m=e;m<=t;m++){let p=m+n.ydisp,b=this._rowElements[m],y=n.lines.get(p);if(!b||!y)break;b.replaceChildren(...this._rowFactory.createRow(y,p,p===a,h,f,o,c,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${kf}${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 h=this._bufferService.rows-1;n=Math.max(Math.min(n,h),0),a=Math.max(Math.min(a,h),0),o=Math.min(o,this._bufferService.cols);let f=this._bufferService.buffer,m=f.ybase+f.y,p=Math.min(f.x,o-1),b=this._optionsService.rawOptions.cursorBlink,y=this._optionsService.rawOptions.cursorStyle,w=this._optionsService.rawOptions.cursorInactiveStyle;for(let x=n;x<=a;++x){let C=x+f.ydisp,E=this._rowElements[x],B=f.lines.get(C);if(!E||!B)break;E.replaceChildren(...this._rowFactory.createRow(B,C,C===m,y,w,p,b,this.dimensions.css.cell.width,this._widthCache,c?x===n?e:0:-1,c?(x===a?t:o)-1:-1))}}};Ap=Ut([ye(7,Pm),ye(8,Gu),ye(9,Yi),ye(10,$i),ye(11,ta),ye(12,An),ye(13,Qa)],Ap);var Lp=class extends Xe{constructor(e,t,n){super(),this._optionsService=n,this.width=0,this.height=0,this._onCharSizeChange=this._register(new ve),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this._register(new Wk(this._optionsService))}catch{this._measureStrategy=this._register(new qk(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())}};Lp=Ut([ye(2,Yi)],Lp);var pw=class extends Xe{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)}},qk=class extends pw{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}},Wk=class extends pw{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}},$k=class extends Xe{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 Yk(this._window)),this._onDprChange=this._register(new ve),this.onDprChange=this._onDprChange.event,this._onWindowChange=this._register(new ve),this.onWindowChange=this._onWindowChange.event,this._register(this.onWindowChange(a=>this._screenDprMonitor.setWindow(a))),this._register(Ni.forward(this._screenDprMonitor.onDprChange,this._onDprChange)),this._register(He(this._textarea,"focus",()=>this._isFocused=!0)),this._register(He(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}},Yk=class extends Xe{constructor(e){super(),this._parentWindow=e,this._windowResizeListener=this._register(new Va),this._onDprChange=this._register(new ve),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this._register(Rt(()=>this.clearListener()))}setWindow(e){this._parentWindow=e,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=He(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)}},Vk=class extends Xe{constructor(){super(),this.linkProviders=[],this._register(Rt(()=>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 Vm(e,t,n){let a=n.getBoundingClientRect(),o=e.getComputedStyle(n),c=parseInt(o.getPropertyValue("padding-left")),h=parseInt(o.getPropertyValue("padding-top"));return[t.clientX-a.left-c,t.clientY-a.top-h]}function Xk(e,t,n,a,o,c,h,f,m){if(!c)return;let p=Vm(e,t,n);if(p)return p[0]=Math.ceil((p[0]+(m?h/2:0))/h),p[1]=Math.ceil(p[1]/f),p[0]=Math.min(Math.max(p[0],1),a+(m?1:0)),p[1]=Math.min(Math.max(p[1],1),o),p}var Bp=class{constructor(e,t){this._renderService=e,this._charSizeService=t}getCoords(e,t,n,a,o){return Xk(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=Vm(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])}}};Bp=Ut([ye(0,Ln),ye(1,Gu)],Bp);var Gk=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=[]}},mw={};aT(mw,{getSafariVersion:()=>Qk,isChromeOS:()=>yw,isFirefox:()=>_w,isIpad:()=>Jk,isIphone:()=>eD,isLegacyEdge:()=>Zk,isLinux:()=>Xm,isMac:()=>Ou,isNode:()=>Zu,isSafari:()=>vw,isWindows:()=>gw});var Zu=typeof process<"u"&&"title"in process,Po=Zu?"node":navigator.userAgent,Ko=Zu?"node":navigator.platform,_w=Po.includes("Firefox"),Zk=Po.includes("Edge"),vw=/^((?!chrome|android).)*safari/i.test(Po);function Qk(){if(!vw)return 0;let e=Po.match(/Version\/(\d+)/);return e===null||e.length<2?0:parseInt(e[1])}var Ou=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(Ko),Jk=Ko==="iPad",eD=Ko==="iPhone",gw=["Windows","Win16","Win32","WinCE"].includes(Ko),Xm=Ko.indexOf("Linux")>=0,yw=/\bCrOS\b/.test(Po),bw=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()}},tD=class extends bw{_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())}}},iD=class extends bw{_requestCallback(e){return requestIdleCallback(e)}_cancelCallback(e){cancelIdleCallback(e)}},zu=!Zu&&"requestIdleCallback"in window?iD:tD,sD=class{constructor(){this._queue=new zu}set(e){this._queue.clear(),this._queue.enqueue(e)}flush(){this._queue.flush()}},Op=class extends Xe{constructor(e,t,n,a,o,c,h,f,m){super(),this._rowCount=e,this._optionsService=n,this._charSizeService=a,this._coreService=o,this._coreBrowserService=f,this._renderer=this._register(new Va),this._pausedResizeTask=new sD,this._observerDisposable=this._register(new Va),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 ve),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this._register(new ve),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this._register(new ve),this.onRender=this._onRender.event,this._onRefreshRequest=this._register(new ve),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new Gk((p,b)=>this._renderRows(p,b),this._coreBrowserService),this._register(this._renderDebouncer),this._syncOutputHandler=new nD(this._coreBrowserService,this._coreService,()=>this._fullRefresh()),this._register(Rt(()=>this._syncOutputHandler.dispose())),this._register(this._coreBrowserService.onDprChange(()=>this.handleDevicePixelRatioChange())),this._register(h.onResize(()=>this._fullRefresh())),this._register(h.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(h.cols,h.rows),this._fullRefresh()})),this._register(this._optionsService.onMultipleOptionChange(["cursorBlink","cursorStyle"],()=>this.refreshRows(h.buffer.y,h.buffer.y,!0))),this._register(m.onChangeColors(()=>this._fullRefresh())),this._registerIntersectionObserver(this._coreBrowserService.window,t),this._register(this._coreBrowserService.onWindowChange(p=>this._registerIntersectionObserver(p,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=Rt(()=>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()}};Op=Ut([ye(2,Yi),ye(3,Gu),ye(4,ta),ye(5,Uo),ye(6,$i),ye(7,An),ye(8,Qa)],Op);var nD=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 rD(e,t,n,a){let o=n.buffer.x,c=n.buffer.y;if(!n.buffer.hasScrollback)return oD(o,c,e,t,n,a)+Qu(c,t,n,a)+cD(o,c,e,t,n,a);let h;if(c===t)return h=o>e?"D":"C",Eo(Math.abs(o-e),xo(h,a));h=c>t?"D":"C";let f=Math.abs(c-t),m=lD(c>t?e:o,n)+(f-1)*n.cols+1+aD(c>t?o:e);return Eo(m,xo(h,a))}function aD(e,t){return e-1}function lD(e,t){return t.cols-e}function oD(e,t,n,a,o,c){return Qu(t,a,o,c).length===0?"":Eo(ww(e,t,e,t-ea(t,o),!1,o).length,xo("D",c))}function Qu(e,t,n,a){let o=e-ea(e,n),c=t-ea(t,n),h=Math.abs(o-c)-uD(e,t,n);return Eo(h,xo(Sw(e,t),a))}function cD(e,t,n,a,o,c){let h;Qu(t,a,o,c).length>0?h=a-ea(a,o):h=t;let f=a,m=hD(e,t,n,a,o,c);return Eo(ww(e,h,n,f,m==="C",o).length,xo(m,c))}function uD(e,t,n){let a=0,o=e-ea(e,n),c=t-ea(t,n);for(let h=0;h<Math.abs(o-c);h++){let f=Sw(e,t)==="A"?-1:1;n.buffer.lines.get(o+f*h)?.isWrapped&&a++}return a}function ea(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 hD(e,t,n,a,o,c){let h;return Qu(n,a,o,c).length>0?h=a-ea(a,o):h=t,e<n&&h<=a||e>=n&&h<a?"C":"D"}function Sw(e,t){return e>t?"A":"B"}function ww(e,t,n,a,o,c){let h=e,f=t,m="";for(;(h!==n||f!==a)&&f>=0&&f<c.buffer.lines.length;)h+=o?1:-1,o&&h>c.cols-1?(m+=c.buffer.translateBufferLineToString(f,!1,e,h),h=0,e=0,f++):!o&&h<0&&(m+=c.buffer.translateBufferLineToString(f,!1,0,e+1),h=c.cols-1,e=h,f--);return m+c.buffer.translateBufferLineToString(f,!1,e,h)}function xo(e,t){let n=t?"O":"[";return ue.ESC+n+e}function Eo(e,t){e=Math.floor(e);let n="";for(let a=0;a<e;a++)n+=t;return n}var dD=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 Pb(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 Df=50,fD=15,pD=50,mD=500,_D=" ",vD=new RegExp(_D,"g"),zp=class extends Xe{constructor(e,t,n,a,o,c,h,f,m){super(),this._element=e,this._screenElement=t,this._linkifier=n,this._bufferService=a,this._coreService=o,this._mouseService=c,this._optionsService=h,this._renderService=f,this._coreBrowserService=m,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new Hs,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this._register(new ve),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this._register(new ve),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this._register(new ve),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this._register(new ve),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=p=>this._handleMouseMove(p),this._mouseUpListener=p=>this._handleMouseUp(p),this._coreService.onUserInput(()=>{this.hasSelection&&this.clearSelection()}),this._trimListener=this._bufferService.buffer.lines.onTrim(p=>this._handleTrim(p)),this._register(this._bufferService.buffers.onBufferActivate(p=>this._handleBufferActivate(p))),this.enable(),this._model=new dD(this._bufferService),this._activeSelectionMode=0,this._register(Rt(()=>{this._removeMouseDownListeners()})),this._register(this._bufferService.onResize(p=>{p.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 h=e[1];h<=t[1];h++){let f=n.translateBufferLineToString(h,!0,o,c);a.push(f)}}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 h=n.lines.get(c),f=n.translateBufferLineToString(c,!0);h?.isWrapped?a[a.length-1]+=f:a.push(f)}if(e[1]!==t[1]){let c=n.lines.get(t[1]),h=n.translateBufferLineToString(t[1],!0,0,t[0]);c&&c.isWrapped?a[a.length-1]+=h:a.push(h)}}return a.map(o=>o.replace(vD," ")).join(gw?`\r
|
|
23
|
+
`))}},KT=class extends Error{constructor(e,t){super(e),this.name="ListenerLeakError",this.stack=t}},IT=class extends Error{constructor(e,t){super(e),this.name="ListenerRefusalError",this.stack=t}},FT=0,Ef=class{constructor(e){this.value=e,this.id=FT++}},qT=2,WT,ge=class{constructor(e){this._size=0,this._options=e,this._leakageMon=this._options?.leakWarningThreshold?new UT(e?.onListenerError??pu,this._options?.leakWarningThreshold??HT):void 0,this._perfMon=this._options?._profName?new jT(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 h=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(h);let f=this._leakageMon.getMostFrequentStack()??["UNKNOWN stack",-1],_=new IT(`${h}. HINT: Stack shows most frequent listener (${f[1]}-times)`,f[0]);return(this._options?.onListenerError||pu)(_),Ge.None}if(this._disposed)return Ge.None;t&&(e=e.bind(t));let a=new Ef(e),o;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(a.stack=PT.create(),o=this._leakageMon.check(a.stack,this._size+1)),this._listeners?this._listeners instanceof Ef?(this._deliveryQueue??=new $T,this._listeners=[this._listeners,a]):this._listeners.push(a):(this._options?.onWillAddFirstListener?.(this),this._listeners=a,this._options?.onDidAddFirstListener?.(this)),this._size++;let c=Mt(()=>{o?.(),this._removeListener(a)});return n instanceof mr?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*qT<=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||pu;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 Ef)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}},$T=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}},wp=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new ge,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new ge,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}};wp.INSTANCE=new wp;var Wm=wp;function YT(e,t,n){typeof t=="string"&&(t=e.matchMedia(t)),t.addEventListener("change",n)}Wm.INSTANCE.onDidChangeZoomLevel;function VT(e){return Wm.INSTANCE.getZoomFactor(e)}Wm.INSTANCE.onDidChangeFullscreen;var il=typeof navigator=="object"?navigator.userAgent:"",Cp=il.indexOf("Firefox")>=0,XT=il.indexOf("AppleWebKit")>=0,$m=il.indexOf("Chrome")>=0,GT=!$m&&il.indexOf("Safari")>=0;il.indexOf("Electron/")>=0;il.indexOf("Android")>=0;var Tf=!1;if(typeof Mn.matchMedia=="function"){let e=Mn.matchMedia("(display-mode: standalone) or (display-mode: window-controls-overlay)"),t=Mn.matchMedia("(display-mode: fullscreen)");Tf=e.matches,YT(Mn,e,({matches:n})=>{Tf&&t.matches||(Tf=n)})}var Ka="en",xp=!1,Ep=!1,mu=!1,hw=!1,iu,_u=Ka,Db=Ka,ZT,Dn,Zr=globalThis,bs;typeof Zr.vscode<"u"&&typeof Zr.vscode.process<"u"?bs=Zr.vscode.process:typeof process<"u"&&typeof process?.versions?.node=="string"&&(bs=process);var QT=typeof bs?.versions?.electron=="string",JT=QT&&bs?.type==="renderer";if(typeof bs=="object"){xp=bs.platform==="win32",Ep=bs.platform==="darwin",mu=bs.platform==="linux",mu&&bs.env.SNAP&&bs.env.SNAP_REVISION,bs.env.CI||bs.env.BUILD_ARTIFACTSTAGINGDIRECTORY,iu=Ka,_u=Ka;let e=bs.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);iu=t.userLocale,Db=t.osLocale,_u=t.resolvedLanguage||Ka,ZT=t.languagePack?.translationsConfigFile}catch{}hw=!0}else typeof navigator=="object"&&!JT?(Dn=navigator.userAgent,xp=Dn.indexOf("Windows")>=0,Ep=Dn.indexOf("Macintosh")>=0,(Dn.indexOf("Macintosh")>=0||Dn.indexOf("iPad")>=0||Dn.indexOf("iPhone")>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints>0,mu=Dn.indexOf("Linux")>=0,Dn?.indexOf("Mobi")>=0,_u=globalThis._VSCODE_NLS_LANGUAGE||Ka,iu=navigator.language.toLowerCase(),Db=iu):console.error("Unable to resolve platform.");var dw=xp,an=Ep,ek=mu,Rb=hw,ln=Dn,lr=_u,tk;(e=>{function t(){return lr}e.value=t;function n(){return lr.length===2?lr==="en":lr.length>=3?lr[0]==="e"&&lr[1]==="n"&&lr[2]==="-":!1}e.isDefaultVariant=n;function a(){return lr==="en"}e.isDefault=a})(tk||={});var ik=typeof Zr.postMessage=="function"&&!Zr.importScripts;(()=>{if(ik){let e=[];Zr.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}),Zr.postMessage({vscodeScheduleAsyncWork:a},"*")}}return e=>setTimeout(e)})();var sk=!!(ln&&ln.indexOf("Chrome")>=0);ln&&ln.indexOf("Firefox")>=0;!sk&&ln&&ln.indexOf("Safari")>=0;ln&&ln.indexOf("Edg/")>=0;ln&&ln.indexOf("Android")>=0;var ja=typeof navigator=="object"?navigator:{};Rb||document.queryCommandSupported&&document.queryCommandSupported("copy")||ja&&ja.clipboard&&ja.clipboard.writeText,Rb||ja&&ja.clipboard&&ja.clipboard.readText;var Ym=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}},kf=new Ym,Mb=new Ym,Nb=new Ym,nk=new Array(230),fw;(e=>{function t(f){return kf.keyCodeToStr(f)}e.toString=t;function n(f){return kf.strToKeyCode(f)}e.fromString=n;function a(f){return Mb.keyCodeToStr(f)}e.toUserSettingsUS=a;function o(f){return Nb.keyCodeToStr(f)}e.toUserSettingsGeneral=o;function c(f){return Mb.strToKeyCode(f)||Nb.strToKeyCode(f)}e.fromUserSettings=c;function h(f){if(f>=98&&f<=113)return null;switch(f){case 16:return"Up";case 18:return"Down";case 15:return"Left";case 17:return"Right"}return kf.keyCodeToStr(f)}e.toElectronAccelerator=h})(fw||={});var rk=class pw{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 pw&&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 ak([this])}isDuplicateModifierCase(){return this.ctrlKey&&this.keyCode===5||this.shiftKey&&this.keyCode===4||this.altKey&&this.keyCode===6||this.metaKey&&this.keyCode===57}},ak=class{constructor(e){if(e.length===0)throw NT("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 lk(e){if(e.charCode){let n=String.fromCharCode(e.charCode).toUpperCase();return fw.fromString(n)}let t=e.keyCode;if(t===3)return 7;if(Cp)switch(t){case 59:return 85;case 60:if(ek)return 97;break;case 61:return 86;case 107:return 109;case 109:return 111;case 173:return 88;case 224:if(an)return 57;break}else if(XT&&(an&&t===93||!an&&t===92))return 57;return nk[t]||0}var ok=an?256:2048,ck=512,uk=1024,hk=an?2048:256,Ab=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=lk(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|=ok),this.altKey&&(t|=ck),this.shiftKey&&(t|=uk),this.metaKey&&(t|=hk),t|=e,t}_computeKeyCodeChord(){let e=0;return this.keyCode!==5&&this.keyCode!==4&&this.keyCode!==6&&this.keyCode!==57&&(e=this.keyCode),new rk(this.ctrlKey,this.shiftKey,this.altKey,this.metaKey,e)}},Lb=new WeakMap;function dk(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 fk=class{static getSameOriginWindowChain(e){let t=Lb.get(e);if(!t){t=[],Lb.set(e,t);let n=e,a;do a=dk(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 h=c.window.deref();if(n+=h?.scrollY??0,a+=h?.scrollX??0,h===t||!c.iframeElement)break;let f=c.iframeElement.getBoundingClientRect();n+=f.top,a+=f.left}return{top:n,left:a}}},su=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=fk.getPositionOfChildWindowRelativeToAncestorWindow(e,t.view);this.posx-=n.left,this.posy-=n.top}preventDefault(){this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent.stopPropagation()}},Bb=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($m){let o=navigator.userAgent.match(/Chrome\/(\d+)/);a=(o?parseInt(o[1]):123)<=122}if(e){let o=e,c=e,h=e.view?.devicePixelRatio||1;if(typeof o.wheelDeltaY<"u")a?this.deltaY=o.wheelDeltaY/(120*h):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 f=e;f.deltaMode===f.DOM_DELTA_LINE?Cp&&!an?this.deltaY=-e.deltaY/3:this.deltaY=-e.deltaY:this.deltaY=-e.deltaY/40}if(typeof o.wheelDeltaX<"u")GT&&dw?this.deltaX=-(o.wheelDeltaX/120):a?this.deltaX=o.wheelDeltaX/(120*h):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 f=e;f.deltaMode===f.DOM_DELTA_LINE?Cp&&!an?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*h):this.deltaY=e.wheelDelta/120)}}preventDefault(){this.browserEvent?.preventDefault()}stopPropagation(){this.browserEvent?.stopPropagation()}},mw=Object.freeze(function(e,t){let n=setTimeout(e.bind(t),0);return{dispose(){clearTimeout(n)}}}),pk;(e=>{function t(n){return n===e.None||n===e.Cancelled||n instanceof mk?!0:!n||typeof n!="object"?!1:typeof n.isCancellationRequested=="boolean"&&typeof n.onCancellationRequested=="function"}e.isCancellationToken=t,e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:Ai.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:mw})})(pk||={});var mk=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?mw:(this._emitter||(this._emitter=new ge),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}},Vm=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 gp("Calling 'cancelAndSet' on a disposed TimeoutTimer");this.cancel(),this._token=setTimeout(()=>{this._token=-1,e()},t)}setIfNotSet(e,t){if(this._isDisposed)throw new gp("Calling 'setIfNotSet' on a disposed TimeoutTimer");this._token===-1&&(this._token=setTimeout(()=>{this._token=-1,e()},t))}},_k=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 gp("Calling 'cancelAndSet' on a disposed IntervalTimer");this.cancel();let a=n.setInterval(()=>{e()},t);this.disposable=Mt(()=>{n.clearInterval(a),this.disposable=void 0})}dispose(){this.cancel(),this.isDisposed=!0}},gk;(e=>{async function t(a){let o,c=await Promise.all(a.map(h=>h.then(f=>f,f=>{o||(o=f)})));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(h){c(h)}})}e.withAsyncBody=n})(gk||={});var Ob=class Os{static fromArray(t){return new Os(n=>{n.emitMany(t)})}static fromPromise(t){return new Os(async n=>{n.emitMany(await t)})}static fromPromises(t){return new Os(async n=>{await Promise.all(t.map(async a=>n.emitOne(await a)))})}static merge(t){return new Os(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 ge,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 Ai.toPromise(this._onStateChanged.event)}while(!0)},return:async()=>(this._onReturn?.(),{done:!0,value:void 0})}}static map(t,n){return new Os(async a=>{for await(let o of t)a.emitOne(n(o))})}map(t){return Os.map(this,t)}static filter(t,n){return new Os(async a=>{for await(let o of t)n(o)&&a.emitOne(o)})}filter(t){return Os.filter(this,t)}static coalesce(t){return Os.filter(t,n=>!!n)}coalesce(){return Os.coalesce(this)}static async toPromise(t){let n=[];for await(let a of t)n.push(a);return n}toPromise(){return Os.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())}};Ob.EMPTY=Ob.fromArray([]);var{getWindow:rn,getWindowId:vk,onDidRegisterWindow:yk}=(function(){let e=new Map,t={window:Mn,disposables:new mr};e.set(Mn.vscodeWindowId,t);let n=new ge,a=new ge,o=new ge;function c(h,f){return(typeof h=="number"?e.get(h):void 0)??(f?t:void 0)}return{onDidRegisterWindow:n.event,onWillUnregisterWindow:o.event,onDidUnregisterWindow:a.event,registerWindow(h){if(e.has(h.vscodeWindowId))return Ge.None;let f=new mr,_={window:h,disposables:f.add(new mr)};return e.set(h.vscodeWindowId,_),f.add(Mt(()=>{e.delete(h.vscodeWindowId),a.fire(h)})),f.add(He(h,_i.BEFORE_UNLOAD,()=>{o.fire(h)})),n.fire(_),f},getWindows(){return e.values()},getWindowsCount(){return e.size},getWindowId(h){return h.vscodeWindowId},hasWindow(h){return e.has(h)},getWindowById:c,getWindow(h){let f=h;if(f?.ownerDocument?.defaultView)return f.ownerDocument.defaultView.window;let _=h;return _?.view?_.view.window:Mn},getDocument(h){return rn(h).document}}})(),bk=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 He(e,t,n,a){return new bk(e,t,n,a)}var zb=function(e,t,n,a){return He(e,t,n,a)},Xm,Sk=class extends _k{constructor(e){super(),this.defaultTarget=e&&rn(e)}cancelAndSet(e,t,n){return super.cancelAndSet(e,t,n??this.defaultTarget)}},jb=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){pu(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 h=e.get(c)??[];for(t.set(c,h),e.set(c,[]),a.set(c,!0);h.length>0;)h.sort(jb.sort),h.shift().execute();a.set(c,!1)};Xm=(c,h,f=0)=>{let _=vk(c),p=new jb(h,f),b=e.get(_);return b||(b=[],e.set(_,b)),b.push(p),n.get(_)||(n.set(_,!0),c.requestAnimationFrame(()=>o(_))),p}})();function wk(e){let t=e.getBoundingClientRect(),n=rn(e);return{left:t.left+n.scrollX,top:t.top+n.scrollY,width:t.width,height:t.height}}var _i={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"},Ck=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=rs(e);this._maxWidth!==t&&(this._maxWidth=t,this.domNode.style.maxWidth=this._maxWidth)}setWidth(e){let t=rs(e);this._width!==t&&(this._width=t,this.domNode.style.width=this._width)}setHeight(e){let t=rs(e);this._height!==t&&(this._height=t,this.domNode.style.height=this._height)}setTop(e){let t=rs(e);this._top!==t&&(this._top=t,this.domNode.style.top=this._top)}setLeft(e){let t=rs(e);this._left!==t&&(this._left=t,this.domNode.style.left=this._left)}setBottom(e){let t=rs(e);this._bottom!==t&&(this._bottom=t,this.domNode.style.bottom=this._bottom)}setRight(e){let t=rs(e);this._right!==t&&(this._right=t,this.domNode.style.right=this._right)}setPaddingTop(e){let t=rs(e);this._paddingTop!==t&&(this._paddingTop=t,this.domNode.style.paddingTop=this._paddingTop)}setPaddingLeft(e){let t=rs(e);this._paddingLeft!==t&&(this._paddingLeft=t,this.domNode.style.paddingLeft=this._paddingLeft)}setPaddingBottom(e){let t=rs(e);this._paddingBottom!==t&&(this._paddingBottom=t,this.domNode.style.paddingBottom=this._paddingBottom)}setPaddingRight(e){let t=rs(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=rs(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=rs(e);this._lineHeight!==t&&(this._lineHeight=t,this.domNode.style.lineHeight=this._lineHeight)}setLetterSpacing(e){let t=rs(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 rs(e){return typeof e=="number"?`${e}px`:e}function bo(e){return new Ck(e)}var _w=class{constructor(){this._hooks=new mr,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(Mt(()=>{try{e.releasePointerCapture(t)}catch{}}))}catch{c=rn(e)}this._hooks.add(He(c,_i.POINTER_MOVE,h=>{if(h.buttons!==n){this.stopMonitoring(!0);return}h.preventDefault(),this._pointerMoveCallback(h)})),this._hooks.add(He(c,_i.POINTER_UP,h=>this.stopMonitoring(!0)))}};function xk(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(...h){return this.hasOwnProperty(c)||Object.defineProperty(this,c,{configurable:!1,enumerable:!1,writable:!1,value:o.apply(this,h)}),this[c]}}var nn;(e=>(e.Tap="-xterm-gesturetap",e.Change="-xterm-gesturechange",e.Start="-xterm-gesturestart",e.End="-xterm-gesturesend",e.Contextmenu="-xterm-gesturecontextmenu"))(nn||={});var lo=class ji extends Ge{constructor(){super(),this.dispatched=!1,this.targets=new kb,this.ignoreTargets=new kb,this.activeTouches={},this.handle=null,this._lastSetTapCountTime=0,this._register(Ai.runAndSubscribe(yk,({window:t,disposables:n})=>{n.add(He(t.document,"touchstart",a=>this.onTouchStart(a),{passive:!1})),n.add(He(t.document,"touchend",a=>this.onTouchEnd(t,a))),n.add(He(t.document,"touchmove",a=>this.onTouchMove(a),{passive:!1}))},{window:Mn,disposables:this._store}))}static addTarget(t){if(!ji.isTouchDevice())return Ge.None;ji.INSTANCE||(ji.INSTANCE=new ji);let n=ji.INSTANCE.targets.push(t);return Mt(n)}static ignoreTarget(t){if(!ji.isTouchDevice())return Ge.None;ji.INSTANCE||(ji.INSTANCE=new ji);let n=ji.INSTANCE.ignoreTargets.push(t);return Mt(n)}static isTouchDevice(){return"ontouchstart"in Mn||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 h=this.newGestureEvent(nn.Start,c.target);h.pageX=c.pageX,h.pageY=c.pageY,this.dispatchEvent(h)}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,h=n.changedTouches.length;c<h;c++){let f=n.changedTouches.item(c);if(!this.activeTouches.hasOwnProperty(String(f.identifier))){console.warn("move of an UNKNOWN touch",f);continue}let _=this.activeTouches[f.identifier],p=Date.now()-_.initialTimeStamp;if(p<ji.HOLD_DELAY&&Math.abs(_.initialPageX-vs(_.rollingPageX))<30&&Math.abs(_.initialPageY-vs(_.rollingPageY))<30){let b=this.newGestureEvent(nn.Tap,_.initialTarget);b.pageX=vs(_.rollingPageX),b.pageY=vs(_.rollingPageY),this.dispatchEvent(b)}else if(p>=ji.HOLD_DELAY&&Math.abs(_.initialPageX-vs(_.rollingPageX))<30&&Math.abs(_.initialPageY-vs(_.rollingPageY))<30){let b=this.newGestureEvent(nn.Contextmenu,_.initialTarget);b.pageX=vs(_.rollingPageX),b.pageY=vs(_.rollingPageY),this.dispatchEvent(b)}else if(o===1){let b=vs(_.rollingPageX),y=vs(_.rollingPageY),w=vs(_.rollingTimestamps)-_.rollingTimestamps[0],x=b-_.rollingPageX[0],C=y-_.rollingPageY[0],E=[...this.targets].filter(B=>_.initialTarget instanceof Node&&B.contains(_.initialTarget));this.inertia(t,E,a,Math.abs(x)/w,x>0?1:-1,b,Math.abs(C)/w,C>0?1:-1,y)}this.dispatchEvent(this.newGestureEvent(nn.End,_.initialTarget)),delete this.activeTouches[f.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===nn.Tap){let n=new Date().getTime(),a=0;n-this._lastSetTapCountTime>ji.CLEAR_TAP_COUNT_TIME?a=1:a=2,this._lastSetTapCountTime=n,t.tapCount=a}else(t.type===nn.Change||t.type===nn.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,h,f,_,p){this.handle=Xm(t,()=>{let b=Date.now(),y=b-a,w=0,x=0,C=!0;o+=ji.SCROLL_FRICTION*y,f+=ji.SCROLL_FRICTION*y,o>0&&(C=!1,w=c*o*y),f>0&&(C=!1,x=_*f*y);let E=this.newGestureEvent(nn.Change);E.translationX=w,E.translationY=x,n.forEach(B=>B.dispatchEvent(E)),C||this.inertia(t,n,b,o,c,h+w,f,_,p+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 h=this.activeTouches[c.identifier],f=this.newGestureEvent(nn.Change,h.initialTarget);f.translationX=c.pageX-vs(h.rollingPageX),f.translationY=c.pageY-vs(h.rollingPageY),f.pageX=c.pageX,f.pageY=c.pageY,this.dispatchEvent(f),h.rollingPageX.length>3&&(h.rollingPageX.shift(),h.rollingPageY.shift(),h.rollingTimestamps.shift()),h.rollingPageX.push(c.pageX),h.rollingPageY.push(c.pageY),h.rollingTimestamps.push(n)}this.dispatched&&(t.preventDefault(),t.stopPropagation(),this.dispatched=!1)}};lo.SCROLL_FRICTION=-.005,lo.HOLD_DELAY=700,lo.CLEAR_TAP_COUNT_TIME=400,Pt([xk],lo,"isTouchDevice",1);var Ek=lo,Gm=class extends Ge{onclick(e,t){this._register(He(e,_i.CLICK,n=>t(new su(rn(e),n))))}onmousedown(e,t){this._register(He(e,_i.MOUSE_DOWN,n=>t(new su(rn(e),n))))}onmouseover(e,t){this._register(He(e,_i.MOUSE_OVER,n=>t(new su(rn(e),n))))}onmouseleave(e,t){this._register(He(e,_i.MOUSE_LEAVE,n=>t(new su(rn(e),n))))}onkeydown(e,t){this._register(He(e,_i.KEY_DOWN,n=>t(new Ab(n))))}onkeyup(e,t){this._register(He(e,_i.KEY_UP,n=>t(new Ab(n))))}oninput(e,t){this._register(He(e,_i.INPUT,t))}onblur(e,t){this._register(He(e,_i.BLUR,t))}onfocus(e,t){this._register(He(e,_i.FOCUS,t))}onchange(e,t){this._register(He(e,_i.CHANGE,t))}ignoreGesture(e){return Ek.ignoreTarget(e)}},Hb=11,Tk=class extends Gm{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=Hb+"px",this.domNode.style.height=Hb+"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 _w),this._register(zb(this.bgDomNode,_i.POINTER_DOWN,t=>this._arrowPointerDown(t))),this._register(zb(this.domNode,_i.POINTER_DOWN,t=>this._arrowPointerDown(t))),this._pointerdownRepeatTimer=this._register(new Sk),this._pointerdownScheduleRepeatTimer=this._register(new Vm)}_arrowPointerDown(e){if(!e.target||!(e.target instanceof Element))return;let t=()=>{this._pointerdownRepeatTimer.cancelAndSet(()=>this._onActivate(),1e3/24,rn(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()}},kk=class Tp{constructor(t,n,a,o,c,h,f){this._forceIntegerValues=t,this._scrollStateBrand=void 0,this._forceIntegerValues&&(n=n|0,a=a|0,o=o|0,c=c|0,h=h|0,f=f|0),this.rawScrollLeft=o,this.rawScrollTop=f,n<0&&(n=0),o+n>a&&(o=a-n),o<0&&(o=0),c<0&&(c=0),f+c>h&&(f=h-c),f<0&&(f=0),this.width=n,this.scrollWidth=a,this.scrollLeft=o,this.height=c,this.scrollHeight=h,this.scrollTop=f}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 Tp(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 Tp(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,h=this.height!==t.height,f=this.scrollHeight!==t.scrollHeight,_=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:h,scrollHeightChanged:f,scrollTopChanged:_}}},Dk=class extends Ge{constructor(e){super(),this._scrollableBrand=void 0,this._onScroll=this._register(new ge),this.onScroll=this._onScroll.event,this._smoothScrollDuration=e.smoothScrollDuration,this._scheduleAtNextAnimationFrame=e.scheduleAtNextAnimationFrame,this._state=new kk(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 Pb(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=Pb.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)))}},Ub=class{constructor(e,t,n){this.scrollLeft=e,this.scrollTop=t,this.isDone=n}};function Df(e,t){let n=t-e;return function(a){return e+n*Nk(a)}}function Rk(e,t,n){return function(a){return a<n?e(a/n):t((a-n)/(1-n))}}var Pb=class kp{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),Rk(Df(t,o),Df(c,n),.33)}return Df(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 Ub(a,o,!1)}return new Ub(this.to.scrollLeft,this.to.scrollTop,!0)}combine(t,n,a){return kp.start(t,n,a)}static start(t,n,a){a=a+10;let o=Date.now()-10;return new kp(t,n,o,a)}};function Mk(e){return Math.pow(e,3)}function Nk(e){return 1-Mk(1-e)}var Ak=class extends Ge{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 Vm)}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":"")))}},Lk=140,gw=class extends Gm{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 Ak(e.visibility,"visible scrollbar "+e.extraScrollbarClassName,"invisible scrollbar "+e.extraScrollbarClassName)),this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._pointerMoveMonitor=this._register(new _w),this._shouldRender=!0,this.domNode=bo(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(He(this.domNode.domNode,_i.POINTER_DOWN,t=>this._domNodePointerDown(t)))}_createArrow(e){let t=this._register(new Tk(e));this.domNode.domNode.appendChild(t.bgDomNode),this.domNode.domNode.appendChild(t.domNode)}_createSlider(e,t,n,a){this.slider=bo(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(He(this.slider.domNode,_i.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=wk(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),h=Math.abs(c-n);if(dw&&h>Lk){this._setDesiredScrollPositionNow(a.getScrollPosition());return}let f=this._sliderPointerPosition(o)-t;this._setDesiredScrollPositionNow(a.getDesiredScrollPositionFromDelta(f))},()=>{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()}},vw=class Dp{constructor(t,n,a,o,c,h){this._scrollbarSize=Math.round(n),this._oppositeScrollbarSize=Math.round(a),this._arrowSize=Math.round(t),this._visibleSize=o,this._scrollSize=c,this._scrollPosition=h,this._computedAvailableSize=0,this._computedIsNeeded=!1,this._computedSliderSize=0,this._computedSliderRatio=0,this._computedSliderPosition=0,this._refreshComputedValues()}clone(){return new Dp(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 h=Math.max(0,a-t),f=Math.max(0,h-2*n),_=o>0&&o>a;if(!_)return{computedAvailableSize:Math.round(h),computedIsNeeded:_,computedSliderSize:Math.round(f),computedSliderRatio:0,computedSliderPosition:0};let p=Math.round(Math.max(20,Math.floor(a*f/o))),b=(f-p)/(o-a),y=c*b;return{computedAvailableSize:Math.round(h),computedIsNeeded:_,computedSliderSize:Math.round(p),computedSliderRatio:b,computedSliderPosition:Math.round(y)}}_refreshComputedValues(){let t=Dp._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)}},Bk=class extends gw{constructor(e,t,n){let a=e.getScrollDimensions(),o=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:n,scrollbarState:new vw(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}},Ok=class extends gw{constructor(e,t,n){let a=e.getScrollDimensions(),o=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:n,scrollbarState:new vw(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}},zk=500,Kb=50,jk=class{constructor(e,t,n){this.timestamp=e,this.deltaX=t,this.deltaY=n,this.score=0}},Rp=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($m){let n=rn(t.browserEvent),a=VT(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 jk(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),h=Math.abs(n.deltaX),f=Math.abs(n.deltaY),_=Math.max(Math.min(o,h),1),p=Math.max(Math.min(c,f),1),b=Math.max(o,h),y=Math.max(c,f);b%_===0&&y%p===0&&(a-=.5)}return Math.min(Math.max(a,0),1)}_isAlmostInt(t){return Math.abs(Math.round(t)-t)<.01}};Rp.INSTANCE=new Rp;var Hk=Rp,Uk=class extends Gm{constructor(e,t,n){super(),this._onScroll=this._register(new ge),this.onScroll=this._onScroll.event,this._onWillScroll=this._register(new ge),this.onWillScroll=this._onWillScroll.event,this._options=Kk(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 Ok(this._scrollable,this._options,a)),this._horizontalScrollbar=this._register(new Bk(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=bo(document.createElement("div")),this._leftShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._leftShadowDomNode.domNode),this._topShadowDomNode=bo(document.createElement("div")),this._topShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._topShadowDomNode.domNode),this._topLeftShadowDomNode=bo(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 Vm),this._isDragging=!1,this._mouseIsOver=!1,this._shouldRender=!0,this._revealOnScroll=!0}get options(){return this._options}dispose(){this._mouseWheelToDispose=ea(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,an&&(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 Bb(e))}_setListeningToMouseWheel(e){if(this._mouseWheelToDispose.length>0!==e&&(this._mouseWheelToDispose=ea(this._mouseWheelToDispose),e)){let t=n=>{this._onMouseWheel(new Bb(n))};this._mouseWheelToDispose.push(He(this._listenOnDomNode,_i.MOUSE_WHEEL,t,{passive:!1}))}}_onMouseWheel(e){if(e.browserEvent?.defaultPrevented)return;let t=Hk.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 h=!an&&e.browserEvent&&e.browserEvent.shiftKey;(this._options.scrollYToX||h)&&!c&&(c=o,o=0),e.browserEvent&&e.browserEvent.altKey&&(c=c*this._options.fastScrollSensitivity,o=o*this._options.fastScrollSensitivity);let f=this._scrollable.getFutureScrollPosition(),_={};if(o){let p=Kb*o,b=f.scrollTop-(p<0?Math.floor(p):Math.ceil(p));this._verticalScrollbar.writeScrollPosition(_,b)}if(c){let p=Kb*c,b=f.scrollLeft-(p<0?Math.floor(p):Math.ceil(p));this._horizontalScrollbar.writeScrollPosition(_,b)}_=this._scrollable.validateScrollPosition(_),(f.scrollLeft!==_.scrollLeft||f.scrollTop!==_.scrollTop)&&(this._options.mouseWheelSmoothScroll&&t.isPhysicalMouseWheel()?this._scrollable.setScrollPositionSmooth(_):this._scrollable.setScrollPositionNow(_),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(),zk)}},Pk=class extends Uk{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 Kk(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,an&&(t.className+=" mac"),t}var Mp=class extends Ge{constructor(e,t,n,a,o,c,h,f){super(),this._bufferService=n,this._optionsService=h,this._renderService=f,this._onRequestScrollLines=this._register(new ge),this.onRequestScrollLines=this._onRequestScrollLines.event,this._isSyncing=!1,this._isHandlingScroll=!1,this._suppressOnScrollHandler=!1;let _=this._register(new Dk({forceIntegerValues:!1,smoothScrollDuration:this._optionsService.rawOptions.smoothScrollDuration,scheduleAtNextAnimationFrame:p=>Xm(a.window,p)}));this._register(this._optionsService.onSpecificOptionChange("smoothScrollDuration",()=>{_.setSmoothScrollDuration(this._optionsService.rawOptions.smoothScrollDuration)})),this._scrollableElement=this._register(new Pk(t,{vertical:1,horizontal:2,useShadows:!1,mouseWheelSmoothScroll:!0,...this._getChangeOptions()},_)),this._register(this._optionsService.onMultipleOptionChange(["scrollSensitivity","fastScrollSensitivity","overviewRuler"],()=>this._scrollableElement.updateOptions(this._getChangeOptions()))),this._register(o.onProtocolChange(p=>{this._scrollableElement.updateOptions({handleMouseWheel:!(p&16)})})),this._scrollableElement.setScrollDimensions({height:0,scrollHeight:0}),this._register(Ai.runAndSubscribe(c.onChangeColors,()=>{this._scrollableElement.getDomNode().style.backgroundColor=c.colors.background.css})),e.appendChild(this._scrollableElement.getDomNode()),this._register(Mt(()=>this._scrollableElement.getDomNode().remove())),this._styleElement=a.mainDocument.createElement("style"),t.appendChild(this._styleElement),this._register(Mt(()=>this._styleElement.remove())),this._register(Ai.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(`
|
|
24
|
+
`)})),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(p=>this._handleScroll(p)))}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}};Mp=Pt([ye(2,Yi),ye(3,Ln),ye(4,Q0),ye(5,tl),ye(6,Vi),ye(7,Bn)],Mp);var Np=class extends Ge{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(Mt(()=>{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()}};Np=Pt([ye(1,Yi),ye(2,Ln),ye(3,Uo),ye(4,Bn)],Np);var Ik=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)}},tn={full:0,left:0,center:0,right:0},or={full:0,left:0,center:0,right:0},Gl={full:0,left:0,center:0,right:0},Lu=class extends Ge{constructor(e,t,n,a,o,c,h,f){super(),this._viewportElement=e,this._screenElement=t,this._bufferService=n,this._decorationService=a,this._renderService=o,this._optionsService=c,this._themeService=h,this._coreBrowserService=f,this._colorZoneStore=new Ik,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(Mt(()=>this._canvas?.remove()));let _=this._canvas.getContext("2d");if(_)this._ctx=_;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);or.full=this._canvas.width,or.left=e,or.center=t,or.right=e,this._refreshDrawHeightConstants(),Gl.full=1,Gl.left=1,Gl.center=1+or.left,Gl.right=1+or.left+or.center}_refreshDrawHeightConstants(){tn.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);tn.left=t,tn.center=t,tn.right=t}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*tn.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*tn.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*tn.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*tn.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(Gl[e.position||"full"],Math.round((this._canvas.height-1)*(e.startBufferLine/this._bufferService.buffers.active.lines.length)-tn[e.position||"full"]/2),or[e.position||"full"],Math.round((this._canvas.height-1)*((e.endBufferLine-e.startBufferLine)/this._bufferService.buffers.active.lines.length)+tn[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}))}};Lu=Pt([ye(2,Yi),ye(3,Uo),ye(4,Bn),ye(5,Vi),ye(6,tl),ye(7,Ln)],Lu);var ue;(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=`
|
|
25
|
+
`,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=""))(ue||={});var gu;(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=""))(gu||={});var yw;(e=>e.ST=`${ue.ESC}\\`)(yw||={});var Ap=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(`${ue.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)}}};Ap=Pt([ye(2,Yi),ye(3,Vi),ye(4,ia),ye(5,Bn)],Ap);var vi=0,yi=0,bi=0,Ut=0,Ib={css:"#00000000",rgba:0},ti;(e=>{function t(o,c,h,f){return f!==void 0?`#${Wr(o)}${Wr(c)}${Wr(h)}${Wr(f)}`:`#${Wr(o)}${Wr(c)}${Wr(h)}`}e.toCss=t;function n(o,c,h,f=255){return(o<<24|c<<16|h<<8|f)>>>0}e.toRgba=n;function a(o,c,h,f){return{css:e.toCss(o,c,h,f),rgba:e.toRgba(o,c,h,f)}}e.toColor=a})(ti||={});var Tt;(e=>{function t(_,p){if(Ut=(p.rgba&255)/255,Ut===1)return{css:p.css,rgba:p.rgba};let b=p.rgba>>24&255,y=p.rgba>>16&255,w=p.rgba>>8&255,x=_.rgba>>24&255,C=_.rgba>>16&255,E=_.rgba>>8&255;vi=x+Math.round((b-x)*Ut),yi=C+Math.round((y-C)*Ut),bi=E+Math.round((w-E)*Ut);let B=ti.toCss(vi,yi,bi),T=ti.toRgba(vi,yi,bi);return{css:B,rgba:T}}e.blend=t;function n(_){return(_.rgba&255)===255}e.isOpaque=n;function a(_,p,b){let y=vu.ensureContrastRatio(_.rgba,p.rgba,b);if(y)return ti.toColor(y>>24&255,y>>16&255,y>>8&255)}e.ensureContrastRatio=a;function o(_){let p=(_.rgba|255)>>>0;return[vi,yi,bi]=vu.toChannels(p),{css:ti.toCss(vi,yi,bi),rgba:p}}e.opaque=o;function c(_,p){return Ut=Math.round(p*255),[vi,yi,bi]=vu.toChannels(_.rgba),{css:ti.toCss(vi,yi,bi,Ut),rgba:ti.toRgba(vi,yi,bi,Ut)}}e.opacity=c;function h(_,p){return Ut=_.rgba&255,c(_,Ut*p/255)}e.multiplyOpacity=h;function f(_){return[_.rgba>>24&255,_.rgba>>16&255,_.rgba>>8&255]}e.toColorRGB=f})(Tt||={});var Lt;(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 vi=parseInt(o.slice(1,2).repeat(2),16),yi=parseInt(o.slice(2,3).repeat(2),16),bi=parseInt(o.slice(3,4).repeat(2),16),ti.toColor(vi,yi,bi);case 5:return vi=parseInt(o.slice(1,2).repeat(2),16),yi=parseInt(o.slice(2,3).repeat(2),16),bi=parseInt(o.slice(3,4).repeat(2),16),Ut=parseInt(o.slice(4,5).repeat(2),16),ti.toColor(vi,yi,bi,Ut);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 vi=parseInt(c[1]),yi=parseInt(c[2]),bi=parseInt(c[3]),Ut=Math.round((c[5]===void 0?1:parseFloat(c[5]))*255),ti.toColor(vi,yi,bi,Ut);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),[vi,yi,bi,Ut]=t.getImageData(0,0,1,1).data,Ut!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:ti.toRgba(vi,yi,bi,Ut),css:o}}e.toColor=a})(Lt||={});var $i;(e=>{function t(a){return n(a>>16&255,a>>8&255,a&255)}e.relativeLuminance=t;function n(a,o,c){let h=a/255,f=o/255,_=c/255,p=h<=.03928?h/12.92:Math.pow((h+.055)/1.055,2.4),b=f<=.03928?f/12.92:Math.pow((f+.055)/1.055,2.4),y=_<=.03928?_/12.92:Math.pow((_+.055)/1.055,2.4);return p*.2126+b*.7152+y*.0722}e.relativeLuminance2=n})($i||={});var vu;(e=>{function t(h,f){if(Ut=(f&255)/255,Ut===1)return f;let _=f>>24&255,p=f>>16&255,b=f>>8&255,y=h>>24&255,w=h>>16&255,x=h>>8&255;return vi=y+Math.round((_-y)*Ut),yi=w+Math.round((p-w)*Ut),bi=x+Math.round((b-x)*Ut),ti.toRgba(vi,yi,bi)}e.blend=t;function n(h,f,_){let p=$i.relativeLuminance(h>>8),b=$i.relativeLuminance(f>>8);if(Tn(p,b)<_){if(b<p){let x=a(h,f,_),C=Tn(p,$i.relativeLuminance(x>>8));if(C<_){let E=o(h,f,_),B=Tn(p,$i.relativeLuminance(E>>8));return C>B?x:E}return x}let y=o(h,f,_),w=Tn(p,$i.relativeLuminance(y>>8));if(w<_){let x=a(h,f,_),C=Tn(p,$i.relativeLuminance(x>>8));return w>C?y:x}return y}}e.ensureContrastRatio=n;function a(h,f,_){let p=h>>24&255,b=h>>16&255,y=h>>8&255,w=f>>24&255,x=f>>16&255,C=f>>8&255,E=Tn($i.relativeLuminance2(w,x,C),$i.relativeLuminance2(p,b,y));for(;E<_&&(w>0||x>0||C>0);)w-=Math.max(0,Math.ceil(w*.1)),x-=Math.max(0,Math.ceil(x*.1)),C-=Math.max(0,Math.ceil(C*.1)),E=Tn($i.relativeLuminance2(w,x,C),$i.relativeLuminance2(p,b,y));return(w<<24|x<<16|C<<8|255)>>>0}e.reduceLuminance=a;function o(h,f,_){let p=h>>24&255,b=h>>16&255,y=h>>8&255,w=f>>24&255,x=f>>16&255,C=f>>8&255,E=Tn($i.relativeLuminance2(w,x,C),$i.relativeLuminance2(p,b,y));for(;E<_&&(w<255||x<255||C<255);)w=Math.min(255,w+Math.ceil((255-w)*.1)),x=Math.min(255,x+Math.ceil((255-x)*.1)),C=Math.min(255,C+Math.ceil((255-C)*.1)),E=Tn($i.relativeLuminance2(w,x,C),$i.relativeLuminance2(p,b,y));return(w<<24|x<<16|C<<8|255)>>>0}e.increaseLuminance=o;function c(h){return[h>>24&255,h>>16&255,h>>8&255,h&255]}e.toChannels=c})(vu||={});function Wr(e){let t=e.toString(16);return t.length<2?"0"+t:t}function Tn(e,t){return e<t?(t+.05)/(e+.05):(e+.05)/(t+.05)}var Fk=class extends Ho{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()]}},Bu=class{constructor(e){this._bufferService=e,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new Us}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,h=0,f=t.getFg(0),_=t.getBg(0);for(let p=0;p<t.getTrimmedLength();p++)if(t.loadCell(p,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==f||this._workCell.bg!==_){if(p-o>1){let b=this._getJoinedRanges(a,h,c,t,o);for(let y=0;y<b.length;y++)n.push(b[y])}o=p,h=c,f=this._workCell.fg,_=this._workCell.bg}c+=this._workCell.getChars().length||fr.length}if(this._bufferService.cols-o>1){let p=this._getJoinedRanges(a,h,c,t,o);for(let b=0;b<p.length;b++)n.push(p[b])}return n}_getJoinedRanges(e,t,n,a,o){let c=e.substring(t,n),h=[];try{h=this._characterJoiners[0].handler(c)}catch(f){console.error(f)}for(let f=1;f<this._characterJoiners.length;f++)try{let _=this._characterJoiners[f].handler(c);for(let p=0;p<_.length;p++)Bu._mergeRanges(h,_[p])}catch(_){console.error(_)}return this._stringRangesToCellRanges(h,a,o),h}_stringRangesToCellRanges(e,t,n){let a=0,o=!1,c=0,h=e[a];if(h){for(let f=n;f<this._bufferService.cols;f++){let _=t.getWidth(f),p=t.getString(f).length||fr.length;if(_!==0){if(!o&&h[0]<=c&&(h[0]=f,o=!0),h[1]<=c){if(h[1]=f,h=e[++a],!h)break;h[0]<=c?(h[0]=f,o=!0):o=!1}c+=p}}h&&(h[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}};Bu=Pt([ye(0,Yi)],Bu);function qk(e){return 57508<=e&&e<=57558}function Wk(e){return 9472<=e&&e<=9631}function $k(e){return qk(e)||Wk(e)}function Yk(){return{css:{canvas:nu(),cell:nu()},device:{canvas:nu(),cell:nu(),char:{width:0,height:0,left:0,top:0}}}}function nu(){return{width:0,height:0}}var Lp=class{constructor(e,t,n,a,o,c,h){this._document=e,this._characterJoinerService=t,this._optionsService=n,this._coreBrowserService=a,this._coreService=o,this._decorationService=c,this._themeService=h,this._workCell=new Us,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,h,f,_,p,b){let y=[],w=this._characterJoinerService.getJoinedCharacters(t),x=this._themeService.colors,C=e.getNoBgTrimmedLength();n&&C<c+1&&(C=c+1);let E,B=0,T="",Y=0,P=0,X=0,ee=0,te=!1,se=0,le=!1,de=0,N=0,U=[],K=p!==-1&&b!==-1;for(let j=0;j<C;j++){e.loadCell(j,this._workCell);let z=this._workCell.getWidth();if(z===0)continue;let G=!1,M=j>=N,q=j,V=this._workCell;if(w.length>0&&j===w[0][0]&&M){let we=w.shift(),ie=this._isCellInSelection(we[0],t);for(Y=we[0]+1;Y<we[1];Y++)M&&=ie===this._isCellInSelection(Y,t);M&&=!n||c<we[0]||c>=we[1],M?(G=!0,V=new Fk(this._workCell,e.translateToString(!0,we[0],we[1]),we[1]-we[0]),q=we[1]-1,z=V.getWidth()):N=we[1]}let _e=this._isCellInSelection(j,t),be=n&&j===c,D=K&&j>=p&&j<=b,W=!1;this._decorationService.forEachDecorationAtCell(j,t,void 0,we=>{W=!0});let re=V.getChars()||fr;if(re===" "&&(V.isUnderline()||V.isOverline())&&(re=" "),de=z*f-_.get(re,V.isBold(),V.isItalic()),!E)E=this._document.createElement("span");else if(B&&(_e&&le||!_e&&!le&&V.bg===P)&&(_e&&le&&x.selectionForeground||V.fg===X)&&V.extended.ext===ee&&D===te&&de===se&&!be&&!G&&!W&&M){V.isInvisible()?T+=fr:T+=re,B++;continue}else B&&(E.textContent=T),E=this._document.createElement("span"),B=0,T="";if(P=V.bg,X=V.fg,ee=V.extended.ext,te=D,se=de,le=_e,G&&c>=j&&c<=q&&(c=j),!this._coreService.isCursorHidden&&be&&this._coreService.isCursorInitialized){if(U.push("xterm-cursor"),this._coreBrowserService.isFocused)h&&U.push("xterm-cursor-blink"),U.push(a==="bar"?"xterm-cursor-bar":a==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(o)switch(o){case"outline":U.push("xterm-cursor-outline");break;case"block":U.push("xterm-cursor-block");break;case"bar":U.push("xterm-cursor-bar");break;case"underline":U.push("xterm-cursor-underline");break}}if(V.isBold()&&U.push("xterm-bold"),V.isItalic()&&U.push("xterm-italic"),V.isDim()&&U.push("xterm-dim"),V.isInvisible()?T=fr:T=V.getChars()||fr,V.isUnderline()&&(U.push(`xterm-underline-${V.extended.underlineStyle}`),T===" "&&(T=" "),!V.isUnderlineColorDefault()))if(V.isUnderlineColorRGB())E.style.textDecorationColor=`rgb(${Ho.toColorRGB(V.getUnderlineColor()).join(",")})`;else{let we=V.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&V.isBold()&&we<8&&(we+=8),E.style.textDecorationColor=x.ansi[we].css}V.isOverline()&&(U.push("xterm-overline"),T===" "&&(T=" ")),V.isStrikethrough()&&U.push("xterm-strikethrough"),D&&(E.style.textDecoration="underline");let he=V.getFgColor(),ve=V.getFgColorMode(),pe=V.getBgColor(),ke=V.getBgColorMode(),me=!!V.isInverse();if(me){let we=he;he=pe,pe=we;let ie=ve;ve=ke,ke=ie}let Se,Me,Ue=!1;this._decorationService.forEachDecorationAtCell(j,t,void 0,we=>{we.options.layer!=="top"&&Ue||(we.backgroundColorRGB&&(ke=50331648,pe=we.backgroundColorRGB.rgba>>8&16777215,Se=we.backgroundColorRGB),we.foregroundColorRGB&&(ve=50331648,he=we.foregroundColorRGB.rgba>>8&16777215,Me=we.foregroundColorRGB),Ue=we.options.layer==="top")}),!Ue&&_e&&(Se=this._coreBrowserService.isFocused?x.selectionBackgroundOpaque:x.selectionInactiveBackgroundOpaque,pe=Se.rgba>>8&16777215,ke=50331648,Ue=!0,x.selectionForeground&&(ve=50331648,he=x.selectionForeground.rgba>>8&16777215,Me=x.selectionForeground)),Ue&&U.push("xterm-decoration-top");let Ke;switch(ke){case 16777216:case 33554432:Ke=x.ansi[pe],U.push(`xterm-bg-${pe}`);break;case 50331648:Ke=ti.toColor(pe>>16,pe>>8&255,pe&255),this._addStyle(E,`background-color:#${Fb((pe>>>0).toString(16),"0",6)}`);break;default:me?(Ke=x.foreground,U.push("xterm-bg-257")):Ke=x.background}switch(Se||V.isDim()&&(Se=Tt.multiplyOpacity(Ke,.5)),ve){case 16777216:case 33554432:V.isBold()&&he<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(he+=8),this._applyMinimumContrast(E,Ke,x.ansi[he],V,Se,void 0)||U.push(`xterm-fg-${he}`);break;case 50331648:let we=ti.toColor(he>>16&255,he>>8&255,he&255);this._applyMinimumContrast(E,Ke,we,V,Se,Me)||this._addStyle(E,`color:#${Fb(he.toString(16),"0",6)}`);break;default:this._applyMinimumContrast(E,Ke,x.foreground,V,Se,Me)||me&&U.push("xterm-fg-257")}U.length&&(E.className=U.join(" "),U.length=0),!be&&!G&&!W&&M?B++:E.textContent=T,de!==this.defaultSpacing&&(E.style.letterSpacing=`${de}px`),y.push(E),j=q}return E&&B&&(E.textContent=T),y}_applyMinimumContrast(e,t,n,a,o,c){if(this._optionsService.rawOptions.minimumContrastRatio===1||$k(a.getCode()))return!1;let h=this._getContrastCache(a),f;if(!o&&!c&&(f=h.getColor(t.rgba,n.rgba)),f===void 0){let _=this._optionsService.rawOptions.minimumContrastRatio/(a.isDim()?2:1);f=Tt.ensureContrastRatio(o||t,c||n,_),h.setColor((o||t).rgba,(c||n).rgba,f??null)}return f?(this._addStyle(e,`color:${f.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]}};Lp=Pt([ye(1,tw),ye(2,Vi),ye(3,Ln),ye(4,ia),ye(5,Uo),ye(6,tl)],Lp);function Fb(e,t,n){for(;e.length<n;)e=t+e;return e}var Vk=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 h=this._measure(e,0);return h>0&&(this._flat[a]=h),h}let o=e;t&&(o+="B"),n&&(o+="I");let c=this._holey.get(o);if(c===void 0){let h=0;t&&(h|=1),n&&(h|=2),c=this._measure(e,h),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}},Xk=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,h=n[1]-o,f=Math.max(c,0),_=Math.min(h,e.rows-1);if(f>=e.rows||_<0){this.clear();return}this.hasSelection=!0,this.columnSelectMode=a,this.viewportStartRow=c,this.viewportEndRow=h,this.viewportCappedStartRow=f,this.viewportCappedEndRow=_,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 Gk(){return new Xk}var Rf="xterm-dom-renderer-owner-",Bs="xterm-rows",ru="xterm-fg-",qb="xterm-bg-",Zl="xterm-focus",au="xterm-selection",Zk=1,Bp=class extends Ge{constructor(e,t,n,a,o,c,h,f,_,p,b,y,w,x){super(),this._terminal=e,this._document=t,this._element=n,this._screenElement=a,this._viewportElement=o,this._helperContainer=c,this._linkifier2=h,this._charSizeService=_,this._optionsService=p,this._bufferService=b,this._coreService=y,this._coreBrowserService=w,this._themeService=x,this._terminalClass=Zk++,this._rowElements=[],this._selectionRenderModel=Gk(),this.onRequestRedraw=this._register(new ge).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(Bs),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(au),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=Yk(),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=f.createInstance(Lp,document),this._element.classList.add(Rf+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(Mt(()=>{this._element.classList.remove(Rf+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()})),this._widthCache=new Vk(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} .${Bs} 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} .${Bs} { 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} .${Bs} .xterm-dim { color: ${Tt.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} .${Bs}.${Zl} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${n} 1s step-end infinite;}${this._terminalSelector} .${Bs}.${Zl} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${a} 1s step-end infinite;}${this._terminalSelector} .${Bs}.${Zl} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${o} 1s step-end infinite;}${this._terminalSelector} .${Bs} .xterm-cursor.xterm-cursor-block { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css};}${this._terminalSelector} .${Bs} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${e.cursor.css} !important; color: ${e.cursorAccent.css} !important;}${this._terminalSelector} .${Bs} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${e.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${Bs} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${e.cursor.css} inset;}${this._terminalSelector} .${Bs} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${e.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,t+=`${this._terminalSelector} .${au} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${au} div { position: absolute; background-color: ${e.selectionBackgroundOpaque.css};}${this._terminalSelector} .${au} div { position: absolute; background-color: ${e.selectionInactiveBackgroundOpaque.css};}`;for(let[c,h]of e.ansi.entries())t+=`${this._terminalSelector} .${ru}${c} { color: ${h.css}; }${this._terminalSelector} .${ru}${c}.xterm-dim { color: ${Tt.multiplyOpacity(h,.5).css}; }${this._terminalSelector} .${qb}${c} { background-color: ${h.css}; }`;t+=`${this._terminalSelector} .${ru}257 { color: ${Tt.opaque(e.background).css}; }${this._terminalSelector} .${ru}257.xterm-dim { color: ${Tt.multiplyOpacity(Tt.opaque(e.background),.5).css}; }${this._terminalSelector} .${qb}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(Zl),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(Zl),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,h=this._selectionRenderModel.viewportCappedEndRow,f=this._document.createDocumentFragment();if(n){let _=e[0]>t[0];f.appendChild(this._createSelectionElement(c,_?t[0]:e[0],_?e[0]:t[0],h-c+1))}else{let _=a===c?e[0]:0,p=c===o?t[0]:this._bufferService.cols;f.appendChild(this._createSelectionElement(c,_,p));let b=h-c-1;if(f.appendChild(this._createSelectionElement(c+1,0,this._bufferService.cols,b)),c!==h){let y=o===h?t[0]:this._bufferService.cols;f.appendChild(this._createSelectionElement(h,0,y))}}this._selectionContainer.appendChild(f)}_createSelectionElement(e,t,n,a=1){let o=this._document.createElement("div"),c=t*this.dimensions.css.cell.width,h=this.dimensions.css.cell.width*(n-t);return c+h>this.dimensions.css.canvas.width&&(h=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=`${h}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,h=this._coreService.decPrivateModes.cursorStyle??this._optionsService.rawOptions.cursorStyle,f=this._optionsService.rawOptions.cursorInactiveStyle;for(let _=e;_<=t;_++){let p=_+n.ydisp,b=this._rowElements[_],y=n.lines.get(p);if(!b||!y)break;b.replaceChildren(...this._rowFactory.createRow(y,p,p===a,h,f,o,c,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${Rf}${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 h=this._bufferService.rows-1;n=Math.max(Math.min(n,h),0),a=Math.max(Math.min(a,h),0),o=Math.min(o,this._bufferService.cols);let f=this._bufferService.buffer,_=f.ybase+f.y,p=Math.min(f.x,o-1),b=this._optionsService.rawOptions.cursorBlink,y=this._optionsService.rawOptions.cursorStyle,w=this._optionsService.rawOptions.cursorInactiveStyle;for(let x=n;x<=a;++x){let C=x+f.ydisp,E=this._rowElements[x],B=f.lines.get(C);if(!E||!B)break;E.replaceChildren(...this._rowFactory.createRow(B,C,C===_,y,w,p,b,this.dimensions.css.cell.width,this._widthCache,c?x===n?e:0:-1,c?(x===a?t:o)-1:-1))}}};Bp=Pt([ye(7,Fm),ye(8,Zu),ye(9,Vi),ye(10,Yi),ye(11,ia),ye(12,Ln),ye(13,tl)],Bp);var Op=class extends Ge{constructor(e,t,n){super(),this._optionsService=n,this.width=0,this.height=0,this._onCharSizeChange=this._register(new ge),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this._register(new Jk(this._optionsService))}catch{this._measureStrategy=this._register(new Qk(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())}};Op=Pt([ye(2,Vi)],Op);var bw=class extends Ge{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)}},Qk=class extends bw{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}},Jk=class extends bw{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}},eD=class extends Ge{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 tD(this._window)),this._onDprChange=this._register(new ge),this.onDprChange=this._onDprChange.event,this._onWindowChange=this._register(new ge),this.onWindowChange=this._onWindowChange.event,this._register(this.onWindowChange(a=>this._screenDprMonitor.setWindow(a))),this._register(Ai.forward(this._screenDprMonitor.onDprChange,this._onDprChange)),this._register(He(this._textarea,"focus",()=>this._isFocused=!0)),this._register(He(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}},tD=class extends Ge{constructor(e){super(),this._parentWindow=e,this._windowResizeListener=this._register(new Ga),this._onDprChange=this._register(new ge),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this._register(Mt(()=>this.clearListener()))}setWindow(e){this._parentWindow=e,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=He(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)}},iD=class extends Ge{constructor(){super(),this.linkProviders=[],this._register(Mt(()=>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 Zm(e,t,n){let a=n.getBoundingClientRect(),o=e.getComputedStyle(n),c=parseInt(o.getPropertyValue("padding-left")),h=parseInt(o.getPropertyValue("padding-top"));return[t.clientX-a.left-c,t.clientY-a.top-h]}function sD(e,t,n,a,o,c,h,f,_){if(!c)return;let p=Zm(e,t,n);if(p)return p[0]=Math.ceil((p[0]+(_?h/2:0))/h),p[1]=Math.ceil(p[1]/f),p[0]=Math.min(Math.max(p[0],1),a+(_?1:0)),p[1]=Math.min(Math.max(p[1],1),o),p}var zp=class{constructor(e,t){this._renderService=e,this._charSizeService=t}getCoords(e,t,n,a,o){return sD(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=Zm(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])}}};zp=Pt([ye(0,Bn),ye(1,Zu)],zp);var nD=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=[]}},Sw={};pT(Sw,{getSafariVersion:()=>aD,isChromeOS:()=>Ew,isFirefox:()=>ww,isIpad:()=>lD,isIphone:()=>oD,isLegacyEdge:()=>rD,isLinux:()=>Qm,isMac:()=>Ou,isNode:()=>Qu,isSafari:()=>Cw,isWindows:()=>xw});var Qu=typeof process<"u"&&"title"in process,Po=Qu?"node":navigator.userAgent,Ko=Qu?"node":navigator.platform,ww=Po.includes("Firefox"),rD=Po.includes("Edge"),Cw=/^((?!chrome|android).)*safari/i.test(Po);function aD(){if(!Cw)return 0;let e=Po.match(/Version\/(\d+)/);return e===null||e.length<2?0:parseInt(e[1])}var Ou=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(Ko),lD=Ko==="iPad",oD=Ko==="iPhone",xw=["Windows","Win16","Win32","WinCE"].includes(Ko),Qm=Ko.indexOf("Linux")>=0,Ew=/\bCrOS\b/.test(Po),Tw=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()}},cD=class extends Tw{_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())}}},uD=class extends Tw{_requestCallback(e){return requestIdleCallback(e)}_cancelCallback(e){cancelIdleCallback(e)}},zu=!Qu&&"requestIdleCallback"in window?uD:cD,hD=class{constructor(){this._queue=new zu}set(e){this._queue.clear(),this._queue.enqueue(e)}flush(){this._queue.flush()}},jp=class extends Ge{constructor(e,t,n,a,o,c,h,f,_){super(),this._rowCount=e,this._optionsService=n,this._charSizeService=a,this._coreService=o,this._coreBrowserService=f,this._renderer=this._register(new Ga),this._pausedResizeTask=new hD,this._observerDisposable=this._register(new Ga),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 ge),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this._register(new ge),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this._register(new ge),this.onRender=this._onRender.event,this._onRefreshRequest=this._register(new ge),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new nD((p,b)=>this._renderRows(p,b),this._coreBrowserService),this._register(this._renderDebouncer),this._syncOutputHandler=new dD(this._coreBrowserService,this._coreService,()=>this._fullRefresh()),this._register(Mt(()=>this._syncOutputHandler.dispose())),this._register(this._coreBrowserService.onDprChange(()=>this.handleDevicePixelRatioChange())),this._register(h.onResize(()=>this._fullRefresh())),this._register(h.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(h.cols,h.rows),this._fullRefresh()})),this._register(this._optionsService.onMultipleOptionChange(["cursorBlink","cursorStyle"],()=>this.refreshRows(h.buffer.y,h.buffer.y,!0))),this._register(_.onChangeColors(()=>this._fullRefresh())),this._registerIntersectionObserver(this._coreBrowserService.window,t),this._register(this._coreBrowserService.onWindowChange(p=>this._registerIntersectionObserver(p,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=Mt(()=>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()}};jp=Pt([ye(2,Vi),ye(3,Zu),ye(4,ia),ye(5,Uo),ye(6,Yi),ye(7,Ln),ye(8,tl)],jp);var dD=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 fD(e,t,n,a){let o=n.buffer.x,c=n.buffer.y;if(!n.buffer.hasScrollback)return _D(o,c,e,t,n,a)+Ju(c,t,n,a)+gD(o,c,e,t,n,a);let h;if(c===t)return h=o>e?"D":"C",ko(Math.abs(o-e),To(h,a));h=c>t?"D":"C";let f=Math.abs(c-t),_=mD(c>t?e:o,n)+(f-1)*n.cols+1+pD(c>t?o:e);return ko(_,To(h,a))}function pD(e,t){return e-1}function mD(e,t){return t.cols-e}function _D(e,t,n,a,o,c){return Ju(t,a,o,c).length===0?"":ko(Dw(e,t,e,t-ta(t,o),!1,o).length,To("D",c))}function Ju(e,t,n,a){let o=e-ta(e,n),c=t-ta(t,n),h=Math.abs(o-c)-vD(e,t,n);return ko(h,To(kw(e,t),a))}function gD(e,t,n,a,o,c){let h;Ju(t,a,o,c).length>0?h=a-ta(a,o):h=t;let f=a,_=yD(e,t,n,a,o,c);return ko(Dw(e,h,n,f,_==="C",o).length,To(_,c))}function vD(e,t,n){let a=0,o=e-ta(e,n),c=t-ta(t,n);for(let h=0;h<Math.abs(o-c);h++){let f=kw(e,t)==="A"?-1:1;n.buffer.lines.get(o+f*h)?.isWrapped&&a++}return a}function ta(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 yD(e,t,n,a,o,c){let h;return Ju(n,a,o,c).length>0?h=a-ta(a,o):h=t,e<n&&h<=a||e>=n&&h<a?"C":"D"}function kw(e,t){return e>t?"A":"B"}function Dw(e,t,n,a,o,c){let h=e,f=t,_="";for(;(h!==n||f!==a)&&f>=0&&f<c.buffer.lines.length;)h+=o?1:-1,o&&h>c.cols-1?(_+=c.buffer.translateBufferLineToString(f,!1,e,h),h=0,e=0,f++):!o&&h<0&&(_+=c.buffer.translateBufferLineToString(f,!1,0,e+1),h=c.cols-1,e=h,f--);return _+c.buffer.translateBufferLineToString(f,!1,e,h)}function To(e,t){let n=t?"O":"[";return ue.ESC+n+e}function ko(e,t){e=Math.floor(e);let n="";for(let a=0;a<e;a++)n+=t;return n}var bD=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 Wb(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 Mf=50,SD=15,wD=50,CD=500,xD=" ",ED=new RegExp(xD,"g"),Hp=class extends Ge{constructor(e,t,n,a,o,c,h,f,_){super(),this._element=e,this._screenElement=t,this._linkifier=n,this._bufferService=a,this._coreService=o,this._mouseService=c,this._optionsService=h,this._renderService=f,this._coreBrowserService=_,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new Us,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this._register(new ge),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this._register(new ge),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this._register(new ge),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this._register(new ge),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=p=>this._handleMouseMove(p),this._mouseUpListener=p=>this._handleMouseUp(p),this._coreService.onUserInput(()=>{this.hasSelection&&this.clearSelection()}),this._trimListener=this._bufferService.buffer.lines.onTrim(p=>this._handleTrim(p)),this._register(this._bufferService.buffers.onBufferActivate(p=>this._handleBufferActivate(p))),this.enable(),this._model=new bD(this._bufferService),this._activeSelectionMode=0,this._register(Mt(()=>{this._removeMouseDownListeners()})),this._register(this._bufferService.onResize(p=>{p.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 h=e[1];h<=t[1];h++){let f=n.translateBufferLineToString(h,!0,o,c);a.push(f)}}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 h=n.lines.get(c),f=n.translateBufferLineToString(c,!0);h?.isWrapped?a[a.length-1]+=f:a.push(f)}if(e[1]!==t[1]){let c=n.lines.get(t[1]),h=n.translateBufferLineToString(t[1],!0,0,t[0]);c&&c.isWrapped?a[a.length-1]+=h:a.push(h)}}return a.map(o=>o.replace(ED," ")).join(xw?`\r
|
|
26
26
|
`:`
|
|
27
|
-
`)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(e){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._refresh())),Xm&&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=Pb(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=Vm(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,-Df),Df),t/=Df,t/Math.abs(t)+Math.round(t*(fD-1)))}shouldForceSelection(e){return Ou?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(),pD)}_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&&!(Ou&&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<mD&&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=rD(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 h=o.translateBufferLineToString(e[1],!1),f=this._convertViewportColToCharacterIndex(c,e[0]),m=f,p=e[0]-f,b=0,y=0,w=0,x=0;if(h.charAt(f)===" "){for(;f>0&&h.charAt(f-1)===" ";)f--;for(;m<h.length&&h.charAt(m+1)===" ";)m++}else{let B=e[0],T=e[0];c.getWidth(B)===0&&(b++,B--),c.getWidth(T)===2&&(y++,T++);let Y=c.getString(T).length;for(Y>1&&(x+=Y-1,m+=Y-1);B>0&&f>0&&!this._isCharWordSeparator(c.loadCell(B-1,this._workCell));){c.loadCell(B-1,this._workCell);let K=this._workCell.getChars().length;this._workCell.getWidth()===0?(b++,B--):K>1&&(w+=K-1,f-=K-1),f--,B--}for(;T<c.length&&m+1<h.length&&!this._isCharWordSeparator(c.loadCell(T+1,this._workCell));){c.loadCell(T+1,this._workCell);let K=this._workCell.getChars().length;this._workCell.getWidth()===2?(y++,T++):K>1&&(x+=K-1,m+=K-1),m++,T++}}m++;let C=f+p-b+w,E=Math.min(this._bufferService.cols,m-f+b+y-w-x);if(!(!t&&h.slice(f,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 T=this._getWordAt([this._bufferService.cols-1,e[1]-1],!1,!0,!1);if(T){let Y=this._bufferService.cols-T.start;C-=Y,E+=Y}}}if(a&&C+E===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 T=this._getWordAt([0,e[1]+1],!1,!1,!0);T&&(E+=T.length)}}return{start:C,length:E}}}_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=Pb(n,this._bufferService.cols)}};zp=Ut([ye(3,$i),ye(4,ta),ye(5,Km),ye(6,Yi),ye(7,Ln),ye(8,An)],zp);var Kb=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={}}},Ib=class{constructor(){this._color=new Kb,this._css=new Kb}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()}},oi=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:ti.toCss(a,o,c),rgba:ti.toRgba(a,o,c)})}for(let n=0;n<24;n++){let a=8+n*10;e.push({css:ti.toCss(a,a,a),rgba:ti.toRgba(a,a,a)})}return e})()),$r=At.toColor("#ffffff"),ro=At.toColor("#000000"),Fb=At.toColor("#ffffff"),qb=ro,Xl={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117},gD=$r,jp=class extends Xe{constructor(e){super(),this._optionsService=e,this._contrastCache=new Ib,this._halfContrastCache=new Ib,this._onChangeColors=this._register(new ve),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:$r,background:ro,cursor:Fb,cursorAccent:qb,selectionForeground:void 0,selectionBackgroundTransparent:Xl,selectionBackgroundOpaque:Et.blend(ro,Xl),selectionInactiveBackgroundTransparent:Xl,selectionInactiveBackgroundOpaque:Et.blend(ro,Xl),scrollbarSliderBackground:Et.opacity($r,.2),scrollbarSliderHoverBackground:Et.opacity($r,.4),scrollbarSliderActiveBackground:Et.opacity($r,.5),overviewRulerBorder:$r,ansi:oi.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=mt(e.foreground,$r),t.background=mt(e.background,ro),t.cursor=Et.blend(t.background,mt(e.cursor,Fb)),t.cursorAccent=Et.blend(t.background,mt(e.cursorAccent,qb)),t.selectionBackgroundTransparent=mt(e.selectionBackground,Xl),t.selectionBackgroundOpaque=Et.blend(t.background,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundTransparent=mt(e.selectionInactiveBackground,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundOpaque=Et.blend(t.background,t.selectionInactiveBackgroundTransparent),t.selectionForeground=e.selectionForeground?mt(e.selectionForeground,jb):void 0,t.selectionForeground===jb&&(t.selectionForeground=void 0),Et.isOpaque(t.selectionBackgroundTransparent)&&(t.selectionBackgroundTransparent=Et.opacity(t.selectionBackgroundTransparent,.3)),Et.isOpaque(t.selectionInactiveBackgroundTransparent)&&(t.selectionInactiveBackgroundTransparent=Et.opacity(t.selectionInactiveBackgroundTransparent,.3)),t.scrollbarSliderBackground=mt(e.scrollbarSliderBackground,Et.opacity(t.foreground,.2)),t.scrollbarSliderHoverBackground=mt(e.scrollbarSliderHoverBackground,Et.opacity(t.foreground,.4)),t.scrollbarSliderActiveBackground=mt(e.scrollbarSliderActiveBackground,Et.opacity(t.foreground,.5)),t.overviewRulerBorder=mt(e.overviewRulerBorder,gD),t.ansi=oi.slice(),t.ansi[0]=mt(e.black,oi[0]),t.ansi[1]=mt(e.red,oi[1]),t.ansi[2]=mt(e.green,oi[2]),t.ansi[3]=mt(e.yellow,oi[3]),t.ansi[4]=mt(e.blue,oi[4]),t.ansi[5]=mt(e.magenta,oi[5]),t.ansi[6]=mt(e.cyan,oi[6]),t.ansi[7]=mt(e.white,oi[7]),t.ansi[8]=mt(e.brightBlack,oi[8]),t.ansi[9]=mt(e.brightRed,oi[9]),t.ansi[10]=mt(e.brightGreen,oi[10]),t.ansi[11]=mt(e.brightYellow,oi[11]),t.ansi[12]=mt(e.brightBlue,oi[12]),t.ansi[13]=mt(e.brightMagenta,oi[13]),t.ansi[14]=mt(e.brightCyan,oi[14]),t.ansi[15]=mt(e.brightWhite,oi[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]=mt(e.extendedAnsi[a],oi[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()}}};jp=Ut([ye(0,Yi)],jp);function mt(e,t){if(e!==void 0)try{return At.toColor(e)}catch{}return t}var yD=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)}},bD=class{constructor(){this._services=new yD,this._services.set(Pm,this)}setService(e,t){this._services.set(e,t)}getService(e){return this._services.get(e)}createInstance(e,...t){let n=fT(e).sort((c,h)=>c.index-h.index),a=[];for(let c of n){let h=this._services.get(c.id);if(!h)throw new Error(`[createInstance] ${e.name} depends on UNKNOWN service ${c.id._id}.`);a.push(h)}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)}},SD={trace:0,debug:1,info:2,warn:3,error:4,off:5},wD="xterm.js: ",Hp=class extends Xe{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=SD[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?"":wD)+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)}};Hp=Ut([ye(0,Yi)],Hp);var Wb=class extends Xe{constructor(e){super(),this._maxLength=e,this.onDeleteEmitter=this._register(new ve),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this._register(new ve),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this._register(new ve),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}},Ve=3,Jt=Object.freeze(new Ho),lu=0,Rf=2,ao=class Cw{constructor(t,n,a=!1){this.isWrapped=a,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(t*Ve);let o=n||Hs.fromCharData([0,I0,1,0]);for(let c=0;c<t;++c)this.setCell(c,o);this.length=t}get(t){let n=this._data[t*Ve+0],a=n&2097151;return[this._data[t*Ve+1],n&2097152?this._combined[t]:a?hr(a):"",n>>22,n&2097152?this._combined[t].charCodeAt(this._combined[t].length-1):a]}set(t,n){this._data[t*Ve+1]=n[0],n[1].length>1?(this._combined[t]=n[1],this._data[t*Ve+0]=t|2097152|n[2]<<22):this._data[t*Ve+0]=n[1].charCodeAt(0)|n[2]<<22}getWidth(t){return this._data[t*Ve+0]>>22}hasWidth(t){return this._data[t*Ve+0]&12582912}getFg(t){return this._data[t*Ve+1]}getBg(t){return this._data[t*Ve+2]}hasContent(t){return this._data[t*Ve+0]&4194303}getCodePoint(t){let n=this._data[t*Ve+0];return n&2097152?this._combined[t].charCodeAt(this._combined[t].length-1):n&2097151}isCombined(t){return this._data[t*Ve+0]&2097152}getString(t){let n=this._data[t*Ve+0];return n&2097152?this._combined[t]:n&2097151?hr(n&2097151):""}isProtected(t){return this._data[t*Ve+2]&536870912}loadCell(t,n){return lu=t*Ve,n.content=this._data[lu+0],n.fg=this._data[lu+1],n.bg=this._data[lu+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*Ve+0]=n.content,this._data[t*Ve+1]=n.fg,this._data[t*Ve+2]=n.bg}setCellFromCodepoint(t,n,a,o){o.bg&268435456&&(this._extendedAttrs[t]=o.extended),this._data[t*Ve+0]=n|a<<22,this._data[t*Ve+1]=o.fg,this._data[t*Ve+2]=o.bg}addCodepointToCell(t,n,a){let o=this._data[t*Ve+0];o&2097152?this._combined[t]+=hr(n):o&2097151?(this._combined[t]=hr(o&2097151)+hr(n),o&=-2097152,o|=2097152):o=n|1<<22,a&&(o&=-12582913,o|=a<<22),this._data[t*Ve+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 Hs;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 Hs;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*Rf<this._data.buffer.byteLength;let a=t*Ve;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 h=0;h<o.length;h++){let f=parseInt(o[h],10);f>=t&&delete this._combined[f]}let c=Object.keys(this._extendedAttrs);for(let h=0;h<c.length;h++){let f=parseInt(c[h],10);f>=t&&delete this._extendedAttrs[f]}}return this.length=t,a*4*Rf<this._data.buffer.byteLength}cleanupMemory(){if(this._data.length*4*Rf<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 Cw(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*Ve+0]&4194303)return t+(this._data[t*Ve+0]>>22);return 0}getNoBgTrimmedLength(){for(let t=this.length-1;t>=0;--t)if(this._data[t*Ve+0]&4194303||this._data[t*Ve+2]&50331648)return t+(this._data[t*Ve+0]>>22);return 0}copyCellsFrom(t,n,a,o,c){let h=t._data;if(c)for(let m=o-1;m>=0;m--){for(let p=0;p<Ve;p++)this._data[(a+m)*Ve+p]=h[(n+m)*Ve+p];h[(n+m)*Ve+2]&268435456&&(this._extendedAttrs[a+m]=t._extendedAttrs[n+m])}else for(let m=0;m<o;m++){for(let p=0;p<Ve;p++)this._data[(a+m)*Ve+p]=h[(n+m)*Ve+p];h[(n+m)*Ve+2]&268435456&&(this._extendedAttrs[a+m]=t._extendedAttrs[n+m])}let f=Object.keys(t._combined);for(let m=0;m<f.length;m++){let p=parseInt(f[m],10);p>=n&&(this._combined[p-n+a]=t._combined[p])}}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 h=this._data[n*Ve+0],f=h&2097151,m=h&2097152?this._combined[n]:f?hr(f):dr;if(c+=m,o)for(let p=0;p<m.length;++p)o.push(n);n+=h>>22||1}return o&&o.push(n),c}};function CD(e,t,n,a,o,c){let h=[];for(let f=0;f<e.length-1;f++){let m=f,p=e.get(++m);if(!p.isWrapped)continue;let b=[e.get(f)];for(;m<e.length&&p.isWrapped;)b.push(p),p=e.get(++m);if(!c&&a>=f&&a<m){f+=b.length-1;continue}let y=0,w=To(b,y,t),x=1,C=0;for(;x<b.length;){let B=To(b,x,t),T=B-C,Y=n-w,K=Math.min(T,Y);b[y].copyCellsFrom(b[x],C,w,K,!1),w+=K,w===n&&(y++,w=0),C+=K,C===B&&(x++,C=0),w===0&&y!==0&&b[y-1].getWidth(n-1)===2&&(b[y].copyCellsFrom(b[y-1],n-1,w++,1,!1),b[y-1].setCell(n-1,o))}b[y].replaceCells(w,n,o);let E=0;for(let B=b.length-1;B>0&&(B>y||b[B].getTrimmedLength()===0);B--)E++;E>0&&(h.push(f+b.length-E),h.push(E)),f+=b.length-1}return h}function xD(e,t){let n=[],a=0,o=t[a],c=0;for(let h=0;h<e.length;h++)if(o===h){let f=t[++a];e.onDeleteEmitter.fire({index:h-c,amount:f}),h+=f-1,c+=f,o=t[++a]}else n.push(h);return{layout:n,countRemoved:c}}function ED(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 TD(e,t,n){let a=[],o=e.map((m,p)=>To(e,p,t)).reduce((m,p)=>m+p),c=0,h=0,f=0;for(;f<o;){if(o-f<n){a.push(o-f);break}c+=n;let m=To(e,h,t);c>m&&(c-=m,h++);let p=e[h].getWidth(c-1)===2;p&&c--;let b=p?n-1:n;a.push(b),f+=b}return a}function To(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 xw=class Ew{constructor(t){this.line=t,this.isDisposed=!1,this._disposables=[],this._id=Ew._nextId++,this._onDispose=this.register(new ve),this.onDispose=this._onDispose.event}get id(){return this._id}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),Jr(this._disposables),this._disposables.length=0)}register(t){return this._disposables.push(t),t}};xw._nextId=1;var kD=xw,hi={},Yr=hi.B;hi[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:"≥","{":"π","|":"≠","}":"£","~":"·"};hi.A={"#":"£"};hi.B=void 0;hi[4]={"#":"£","@":"¾","[":"ij","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"};hi.C=hi[5]={"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};hi.R={"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"};hi.Q={"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"};hi.K={"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"};hi.Y={"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"};hi.E=hi[6]={"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"};hi.Z={"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"};hi.H=hi[7]={"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};hi["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"};var $b=4294967295,Yb=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=Jt.clone(),this.savedCharset=Yr,this.markers=[],this._nullCell=Hs.fromCharData([0,I0,1,0]),this._whitespaceCell=Hs.fromCharData([0,dr,1,32]),this._isClearing=!1,this._memoryCleanupQueue=new zu,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new Wb(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 Au),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 Au),this._whitespaceCell}getBlankLine(e,t){return new ao(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>$b?$b:t}fillViewportRows(e){if(this.lines.length===0){e===void 0&&(e=Jt);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 Wb(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(e,t){let n=this.getNullCell(Jt),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 h=0;h<this.lines.length;h++)a+=+this.lines.get(h).resize(e,n);let c=0;if(this._rows<t)for(let h=this._rows;h<t;h++)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 ao(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 ao(e,n)));else for(let h=this._rows;h>t;h--)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 h=this.lines.length-o;h>0&&(this.lines.trimStart(h),this.ybase=Math.max(this.ybase-h,0),this.ydisp=Math.max(this.ydisp-h,0),this.savedY=Math.max(this.savedY-h,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=CD(this.lines,this._cols,e,this.ybase+this.y,this.getNullCell(Jt),n);if(a.length>0){let o=xD(this.lines,a);ED(this.lines,o.layout),this._reflowLargerAdjustViewport(e,t,o.countRemoved)}}_reflowLargerAdjustViewport(e,t,n){let a=this.getNullCell(Jt),o=n;for(;o-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<t&&this.lines.push(new ao(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(Jt),o=[],c=0;for(let h=this.lines.length-1;h>=0;h--){let f=this.lines.get(h);if(!f||!f.isWrapped&&f.getTrimmedLength()<=e)continue;let m=[f];for(;f.isWrapped&&h>0;)f=this.lines.get(--h),m.unshift(f);if(!n){let K=this.ybase+this.y;if(K>=h&&K<h+m.length)continue}let p=m[m.length-1].getTrimmedLength(),b=TD(m,this._cols,e),y=b.length-m.length,w;this.ybase===0&&this.y!==this.lines.length-1?w=Math.max(0,this.y-this.lines.maxLength+y):w=Math.max(0,this.lines.length-this.lines.maxLength+y);let x=[];for(let K=0;K<y;K++){let X=this.getBlankLine(Jt,!0);x.push(X)}x.length>0&&(o.push({start:h+m.length+c,newLines:x}),c+=x.length),m.push(...x);let C=b.length-1,E=b[C];E===0&&(C--,E=b[C]);let B=m.length-y-1,T=p;for(;B>=0;){let K=Math.min(T,E);if(m[C]===void 0)break;if(m[C].copyCellsFrom(m[B],T-K,E-K,K,!0),E-=K,E===0&&(C--,E=b[C]),T-=K,T===0){B--;let X=Math.max(B,0);T=To(m,X,this._cols)}}for(let K=0;K<m.length;K++)b[K]<e&&m[K].setCell(b[K],a);let Y=y-w;for(;Y-- >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 h=[],f=[];for(let E=0;E<this.lines.length;E++)f.push(this.lines.get(E));let m=this.lines.length,p=m-1,b=0,y=o[b];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+c);let w=0;for(let E=Math.min(this.lines.maxLength-1,m+c-1);E>=0;E--)if(y&&y.start>p+w){for(let B=y.newLines.length-1;B>=0;B--)this.lines.set(E--,y.newLines[B]);E++,h.push({index:p+1,amount:y.newLines.length}),w+=y.newLines.length,y=o[++b]}else this.lines.set(E,f[p--]);let x=0;for(let E=h.length-1;E>=0;E--)h[E].index+=x,this.lines.onInsertEmitter.fire(h[E]),x+=h[E].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 kD(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)}},DD=class extends Xe{constructor(e,t){super(),this._optionsService=e,this._bufferService=t,this._onBufferActivate=this._register(new ve),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 Yb(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new Yb(!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,kw=1,Up=class extends Xe{constructor(e){super(),this.isUserScrolling=!1,this._onResize=this._register(new ve),this.onResize=this._onResize.event,this._onScroll=this._register(new ve),this.onScroll=this._onScroll.event,this.cols=Math.max(e.rawOptions.cols||0,Tw),this.rows=Math.max(e.rawOptions.rows||0,kw),this.buffers=this._register(new DD(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 h=n.lines.isFull;c===n.lines.length-1?h?n.lines.recycle().copyFrom(a):n.lines.push(a.clone()):n.lines.splice(c+1,0,a.clone()),h?this.isUserScrolling&&(n.ydisp=Math.max(n.ydisp-1,0)):(n.ybase++,this.isUserScrolling||n.ydisp++)}else{let h=c-o+1;n.lines.shiftElements(o+1,h-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))}};Up=Ut([ye(0,Yi)],Up);var ja={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:Ou,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRuler:{}},RD=["normal","bold","100","200","300","400","500","600","700","800","900"],MD=class extends Xe{constructor(e){super(),this._onOptionChange=this._register(new ve),this.onOptionChange=this._onOptionChange.event;let t={...ja};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(Rt(()=>{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 ja))throw new Error(`No option with key "${n}"`);return this.rawOptions[n]},t=(n,a)=>{if(!(n in ja))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=ja[e]),!ND(t))throw new Error(`"${t}" is not a valid value for ${e}`);break;case"wordSeparator":t||(t=ja[e]);break;case"fontWeight":case"fontWeightBold":if(typeof t=="number"&&1<=t&&t<=1e3)break;t=RD.includes(t)?t:ja[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 lo(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]&&lo(e[a],t-1);return n}var Vb=Object.freeze({insertMode:!1}),Xb=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,cursorBlink:void 0,cursorStyle:void 0,origin:!1,reverseWraparound:!1,sendFocus:!1,synchronizedOutput:!1,wraparound:!0}),Pp=class extends Xe{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 ve),this.onData=this._onData.event,this._onUserInput=this._register(new ve),this.onUserInput=this._onUserInput.event,this._onBinary=this._register(new ve),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this._register(new ve),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=lo(Vb),this.decPrivateModes=lo(Xb)}reset(){this.modes=lo(Vb),this.decPrivateModes=lo(Xb)}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))}};Pp=Ut([ye(0,$i),ye(1,Y0),ye(2,Yi)],Pp);var Gb={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 Nf=String.fromCharCode,Zb={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${Nf(t[0])}${Nf(t[1])}${Nf(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}`}},Kp=class extends Xe{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 ve),this.onProtocolChange=this._onProtocolChange.event;for(let a of Object.keys(Gb))this.addProtocol(a,Gb[a]);for(let a of Object.keys(Zb))this.addEncoding(a,Zb[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)}};Kp=Ut([ye(0,$i),ye(1,ta),ye(2,Yi)],Kp);var Af=[[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]],AD=[[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]],ci;function LD(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 BD=class{constructor(){if(this.version="6",!ci){ci=new Uint8Array(65536),ci.fill(1),ci[0]=0,ci.fill(0,1,32),ci.fill(0,127,160),ci.fill(2,4352,4448),ci[9001]=2,ci[9002]=2,ci.fill(2,11904,42192),ci[12351]=1,ci.fill(2,44032,55204),ci.fill(2,63744,64256),ci.fill(2,65040,65050),ci.fill(2,65072,65136),ci.fill(2,65280,65377),ci.fill(2,65504,65511);for(let e=0;e<Af.length;++e)ci.fill(0,Af[e][0],Af[e][1]+1)}}wcwidth(e){return e<32?0:e<127?1:e<65536?ci[e]:LD(e,AD)?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=Vr.extractWidth(t);o===0?a=!1:o>n&&(n=o)}return Vr.createPropertyValue(0,n,a)}},Vr=class yu{constructor(){this._providers=Object.create(null),this._active="",this._onChange=new ve,this.onChange=this._onChange.event;let t=new BD;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 h=t.charCodeAt(c);if(55296<=h&&h<=56319){if(++c>=o)return n+this.wcwidth(h);let p=t.charCodeAt(c);56320<=p&&p<=57343?h=(h-55296)*1024+p-56320+65536:n+=this.wcwidth(p)}let f=this.charProperties(h,a),m=yu.extractWidth(f);yu.extractShouldJoin(f)&&(m-=yu.extractWidth(a)),n+=m,a=f}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 Qb(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 Gl=2147483647,zD=256,Dw=class Ip{constructor(t=32,n=32){if(this.maxLength=t,this.maxSubParamsLength=n,n>zD)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 Ip;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 Ip(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>Gl?Gl: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>Gl?Gl: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,Gl):t}},Zl=[],jD=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",Xu(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}}},gs=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+=Xu(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}},Ql=[],HD=class{constructor(){this._handlers=Object.create(null),this._active=Ql,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=Ql}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=Ql,this._ident=0}hook(e,t){if(this.reset(),this._ident=e,this._active=this._handlers[e]||Ql,!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",Xu(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=Ql,this._ident=0}},oo=new Dw;oo.addParam(0);var Jb=class{constructor(e){this._handler=e,this._data="",this._params=oo,this._hitLimit=!1}hook(e){this._params=e.length>1||e.params[0]?e.clone():oo,this._data="",this._hitLimit=!1}put(e,t,n){this._hitLimit||(this._data+=Xu(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=oo,this._data="",this._hitLimit=!1,n));return this._params=oo,this._data="",this._hitLimit=!1,t}},UD=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}},zs=160,PD=(function(){let e=new UD(4095),t=Array.apply(null,Array(256)).map((f,m)=>m),n=(f,m)=>t.slice(f,m),a=n(32,127),o=n(0,24);o.push(25),o.push.apply(o,n(28,32));let c=n(0,14),h;e.setDefault(1,0),e.addMany(a,0,2,0);for(h in c)e.addMany([24,26,153,154],h,3,0),e.addMany(n(128,144),h,3,0),e.addMany(n(144,152),h,3,0),e.add(156,h,0,0),e.add(27,h,11,1),e.add(157,h,4,8),e.addMany([152,158,159],h,0,7),e.add(155,h,11,3),e.add(144,h,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(zs,0,2,0),e.add(zs,8,5,8),e.add(zs,6,0,6),e.add(zs,11,0,11),e.add(zs,13,13,13),e})(),KD=class extends Xe{constructor(e=PD){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 Dw,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(Rt(()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)})),this._oscParser=this._register(new jD),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,h;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 f=this._parseStack.handlers,m=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(n===!1&&m>-1){for(;m>=0&&(h=f[m](this._params),h!==!0);m--)if(h instanceof Promise)return this._parseStack.handlerPos=m,h}this._parseStack.handlers=[];break;case 4:if(n===!1&&m>-1){for(;m>=0&&(h=f[m](),h!==!0);m--)if(h instanceof Promise)return this._parseStack.handlerPos=m,h}this._parseStack.handlers=[];break;case 6:if(a=e[this._parseStack.chunkPos],h=this._dcsParser.unhook(a!==24&&a!==26,n),h)return h;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],h=this._oscParser.end(a!==24&&a!==26,n),h)return h;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 f=c;f<t;++f){switch(a=e[f],o=this._transitions.table[this.currentState<<8|(a<160?a:zs)],o>>4){case 2:for(let w=f+1;;++w){if(w>=t||(a=e[w])<32||a>126&&a<zs){this._printHandler(e,f,w),f=w-1;break}if(++w>=t||(a=e[w])<32||a>126&&a<zs){this._printHandler(e,f,w),f=w-1;break}if(++w>=t||(a=e[w])<32||a>126&&a<zs){this._printHandler(e,f,w),f=w-1;break}if(++w>=t||(a=e[w])<32||a>126&&a<zs){this._printHandler(e,f,w),f=w-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:f,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],p=m?m.length-1:-1;for(;p>=0&&(h=m[p](this._params),h!==!0);p--)if(h instanceof Promise)return this._preserveStack(3,m,p,o,f),h;p<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(++f<t&&(a=e[f])>47&&a<60);f--;break;case 9:this._collect<<=8,this._collect|=a;break;case 10:let b=this._escHandlers[this._collect<<8|a],y=b?b.length-1:-1;for(;y>=0&&(h=b[y](),h!==!0);y--)if(h instanceof Promise)return this._preserveStack(4,b,y,o,f),h;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 w=f+1;;++w)if(w>=t||(a=e[w])===24||a===26||a===27||a>127&&a<zs){this._dcsParser.put(e,f,w),f=w-1;break}break;case 14:if(h=this._dcsParser.unhook(a!==24&&a!==26),h)return this._preserveStack(6,[],0,o,f),h;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 w=f+1;;w++)if(w>=t||(a=e[w])<32||a>127&&a<zs){this._oscParser.put(e,f,w),f=w-1;break}break;case 6:if(h=this._oscParser.end(a!==24&&a!==26),h)return this._preserveStack(5,[],0,o,f),h;a===27&&(o|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break}this.currentState=o&15}}},ID=/^([\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})$/,FD=/^[\da-f]+$/;function eS(e){if(!e)return;let t=e.toLowerCase();if(t.indexOf("rgb:")===0){t=t.slice(4);let n=ID.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),FD.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 Lf(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 qD(e,t=16){let[n,a,o]=e;return`rgb:${Lf(n,t)}/${Lf(a,t)}/${Lf(o,t)}`}var WD={"(":0,")":1,"*":2,"+":3,"-":1,".":2},or=131072,tS=10;function iS(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 sS=5e3,nS=0,$D=class extends Xe{constructor(e,t,n,a,o,c,h,f,m=new KD){super(),this._bufferService=e,this._charsetService=t,this._coreService=n,this._logService=a,this._optionsService=o,this._oscLinkService=c,this._coreMouseService=h,this._unicodeService=f,this._parser=m,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new hT,this._utf8Decoder=new dT,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=Jt.clone(),this._eraseAttrDataInternal=Jt.clone(),this._onRequestBell=this._register(new ve),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this._register(new ve),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this._register(new ve),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this._register(new ve),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this._register(new ve),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this._register(new ve),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this._register(new ve),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this._register(new ve),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this._register(new ve),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this._register(new ve),this.onLineFeed=this._onLineFeed.event,this._onScroll=this._register(new ve),this.onScroll=this._onScroll.event,this._onTitleChange=this._register(new ve),this.onTitleChange=this._onTitleChange.event,this._onColor=this._register(new ve),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 Fp(this._bufferService),this._activeBuffer=this._bufferService.buffer,this._register(this._bufferService.buffers.onBufferActivate(p=>this._activeBuffer=p.activeBuffer)),this._parser.setCsiHandlerFallback((p,b)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(p),params:b.toArray()})}),this._parser.setEscHandlerFallback(p=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(p)})}),this._parser.setExecuteHandlerFallback(p=>{this._logService.debug("Unknown EXECUTE code: ",{code:p})}),this._parser.setOscHandlerFallback((p,b,y)=>{this._logService.debug("Unknown OSC code: ",{identifier:p,action:b,data:y})}),this._parser.setDcsHandlerFallback((p,b,y)=>{b==="HOOK"&&(y=y.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(p),action:b,payload:y})}),this._parser.setPrintHandler((p,b,y)=>this.print(p,b,y)),this._parser.registerCsiHandler({final:"@"},p=>this.insertChars(p)),this._parser.registerCsiHandler({intermediates:" ",final:"@"},p=>this.scrollLeft(p)),this._parser.registerCsiHandler({final:"A"},p=>this.cursorUp(p)),this._parser.registerCsiHandler({intermediates:" ",final:"A"},p=>this.scrollRight(p)),this._parser.registerCsiHandler({final:"B"},p=>this.cursorDown(p)),this._parser.registerCsiHandler({final:"C"},p=>this.cursorForward(p)),this._parser.registerCsiHandler({final:"D"},p=>this.cursorBackward(p)),this._parser.registerCsiHandler({final:"E"},p=>this.cursorNextLine(p)),this._parser.registerCsiHandler({final:"F"},p=>this.cursorPrecedingLine(p)),this._parser.registerCsiHandler({final:"G"},p=>this.cursorCharAbsolute(p)),this._parser.registerCsiHandler({final:"H"},p=>this.cursorPosition(p)),this._parser.registerCsiHandler({final:"I"},p=>this.cursorForwardTab(p)),this._parser.registerCsiHandler({final:"J"},p=>this.eraseInDisplay(p,!1)),this._parser.registerCsiHandler({prefix:"?",final:"J"},p=>this.eraseInDisplay(p,!0)),this._parser.registerCsiHandler({final:"K"},p=>this.eraseInLine(p,!1)),this._parser.registerCsiHandler({prefix:"?",final:"K"},p=>this.eraseInLine(p,!0)),this._parser.registerCsiHandler({final:"L"},p=>this.insertLines(p)),this._parser.registerCsiHandler({final:"M"},p=>this.deleteLines(p)),this._parser.registerCsiHandler({final:"P"},p=>this.deleteChars(p)),this._parser.registerCsiHandler({final:"S"},p=>this.scrollUp(p)),this._parser.registerCsiHandler({final:"T"},p=>this.scrollDown(p)),this._parser.registerCsiHandler({final:"X"},p=>this.eraseChars(p)),this._parser.registerCsiHandler({final:"Z"},p=>this.cursorBackwardTab(p)),this._parser.registerCsiHandler({final:"`"},p=>this.charPosAbsolute(p)),this._parser.registerCsiHandler({final:"a"},p=>this.hPositionRelative(p)),this._parser.registerCsiHandler({final:"b"},p=>this.repeatPrecedingCharacter(p)),this._parser.registerCsiHandler({final:"c"},p=>this.sendDeviceAttributesPrimary(p)),this._parser.registerCsiHandler({prefix:">",final:"c"},p=>this.sendDeviceAttributesSecondary(p)),this._parser.registerCsiHandler({final:"d"},p=>this.linePosAbsolute(p)),this._parser.registerCsiHandler({final:"e"},p=>this.vPositionRelative(p)),this._parser.registerCsiHandler({final:"f"},p=>this.hVPosition(p)),this._parser.registerCsiHandler({final:"g"},p=>this.tabClear(p)),this._parser.registerCsiHandler({final:"h"},p=>this.setMode(p)),this._parser.registerCsiHandler({prefix:"?",final:"h"},p=>this.setModePrivate(p)),this._parser.registerCsiHandler({final:"l"},p=>this.resetMode(p)),this._parser.registerCsiHandler({prefix:"?",final:"l"},p=>this.resetModePrivate(p)),this._parser.registerCsiHandler({final:"m"},p=>this.charAttributes(p)),this._parser.registerCsiHandler({final:"n"},p=>this.deviceStatus(p)),this._parser.registerCsiHandler({prefix:"?",final:"n"},p=>this.deviceStatusPrivate(p)),this._parser.registerCsiHandler({intermediates:"!",final:"p"},p=>this.softReset(p)),this._parser.registerCsiHandler({intermediates:" ",final:"q"},p=>this.setCursorStyle(p)),this._parser.registerCsiHandler({final:"r"},p=>this.setScrollRegion(p)),this._parser.registerCsiHandler({final:"s"},p=>this.saveCursor(p)),this._parser.registerCsiHandler({final:"t"},p=>this.windowOptions(p)),this._parser.registerCsiHandler({final:"u"},p=>this.restoreCursor(p)),this._parser.registerCsiHandler({intermediates:"'",final:"}"},p=>this.insertColumns(p)),this._parser.registerCsiHandler({intermediates:"'",final:"~"},p=>this.deleteColumns(p)),this._parser.registerCsiHandler({intermediates:'"',final:"q"},p=>this.selectProtected(p)),this._parser.registerCsiHandler({intermediates:"$",final:"p"},p=>this.requestMode(p,!0)),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},p=>this.requestMode(p,!1)),this._parser.setExecuteHandler(ue.BEL,()=>this.bell()),this._parser.setExecuteHandler(ue.LF,()=>this.lineFeed()),this._parser.setExecuteHandler(ue.VT,()=>this.lineFeed()),this._parser.setExecuteHandler(ue.FF,()=>this.lineFeed()),this._parser.setExecuteHandler(ue.CR,()=>this.carriageReturn()),this._parser.setExecuteHandler(ue.BS,()=>this.backspace()),this._parser.setExecuteHandler(ue.HT,()=>this.tab()),this._parser.setExecuteHandler(ue.SO,()=>this.shiftOut()),this._parser.setExecuteHandler(ue.SI,()=>this.shiftIn()),this._parser.setExecuteHandler(vu.IND,()=>this.index()),this._parser.setExecuteHandler(vu.NEL,()=>this.nextLine()),this._parser.setExecuteHandler(vu.HTS,()=>this.tabSet()),this._parser.registerOscHandler(0,new gs(p=>(this.setTitle(p),this.setIconName(p),!0))),this._parser.registerOscHandler(1,new gs(p=>this.setIconName(p))),this._parser.registerOscHandler(2,new gs(p=>this.setTitle(p))),this._parser.registerOscHandler(4,new gs(p=>this.setOrReportIndexedColor(p))),this._parser.registerOscHandler(8,new gs(p=>this.setHyperlink(p))),this._parser.registerOscHandler(10,new gs(p=>this.setOrReportFgColor(p))),this._parser.registerOscHandler(11,new gs(p=>this.setOrReportBgColor(p))),this._parser.registerOscHandler(12,new gs(p=>this.setOrReportCursorColor(p))),this._parser.registerOscHandler(104,new gs(p=>this.restoreIndexedColor(p))),this._parser.registerOscHandler(110,new gs(p=>this.restoreFgColor(p))),this._parser.registerOscHandler(111,new gs(p=>this.restoreBgColor(p))),this._parser.registerOscHandler(112,new gs(p=>this.restoreCursorColor(p))),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 p in hi)this._parser.registerEscHandler({intermediates:"(",final:p},()=>this.selectCharset("("+p)),this._parser.registerEscHandler({intermediates:")",final:p},()=>this.selectCharset(")"+p)),this._parser.registerEscHandler({intermediates:"*",final:p},()=>this.selectCharset("*"+p)),this._parser.registerEscHandler({intermediates:"+",final:p},()=>this.selectCharset("+"+p)),this._parser.registerEscHandler({intermediates:"-",final:p},()=>this.selectCharset("-"+p)),this._parser.registerEscHandler({intermediates:".",final:p},()=>this.selectCharset("."+p)),this._parser.registerEscHandler({intermediates:"/",final:p},()=>this.selectCharset("/"+p));this._parser.registerEscHandler({intermediates:"#",final:"8"},()=>this.screenAlignmentPattern()),this._parser.setErrorHandler(p=>(this._logService.error("Parsing error: ",p),p)),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new Jb((p,b)=>this.requestStatusString(p,b)))}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"),sS))]).catch(t=>{if(t!=="#SLOW_TIMEOUT")throw t;console.warn(`async parser handler taking longer than ${sS} ms`)})}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(e,t){let n,a=this._activeBuffer.x,o=this._activeBuffer.y,c=0,h=this._parseStack.paused;if(h){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>or&&(c=this._parseStack.position+or)}if(this._logService.logLevel<=1&&this._logService.debug(`parsing data ${typeof e=="string"?` "${e}"`:` "${Array.prototype.map.call(e,p=>String.fromCharCode(p)).join("")}"`}`),this._logService.logLevel===0&&this._logService.trace("parsing data (codes)",typeof e=="string"?e.split("").map(p=>p.charCodeAt(0)):e),this._parseBuffer.length<e.length&&this._parseBuffer.length<or&&(this._parseBuffer=new Uint32Array(Math.min(e.length,or))),h||this._dirtyRowTracker.clearRange(),e.length>or)for(let p=c;p<e.length;p+=or){let b=p+or<e.length?p+or:e.length,y=typeof e=="string"?this._stringDecoder.decode(e.substring(p,b),this._parseBuffer):this._utf8Decoder.decode(e.subarray(p,b),this._parseBuffer);if(n=this._parser.parse(this._parseBuffer,y))return this._preserveStack(a,o,y,p),this._logSlowResolvingAsync(n),n}else if(!h){let p=typeof e=="string"?this._stringDecoder.decode(e,this._parseBuffer):this._utf8Decoder.decode(e,this._parseBuffer);if(n=this._parser.parse(this._parseBuffer,p))return this._preserveStack(a,o,p,0),this._logSlowResolvingAsync(n),n}(this._activeBuffer.x!==a||this._activeBuffer.y!==o)&&this._onCursorMove.fire();let f=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(f,this._bufferService.rows-1)})}print(e,t,n){let a,o,c=this._charsetService.charset,h=this._optionsService.rawOptions.screenReaderMode,f=this._bufferService.cols,m=this._coreService.decPrivateModes.wraparound,p=this._coreService.modes.insertMode,b=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,b);let w=this._parser.precedingJoinState;for(let x=t;x<n;++x){if(a=e[x],a<127&&c){let T=c[String.fromCharCode(a)];T&&(a=T.charCodeAt(0))}let C=this._unicodeService.charProperties(a,w);o=Vr.extractWidth(C);let E=Vr.extractShouldJoin(C),B=E?Vr.extractWidth(w):0;if(w=C,h&&this._onA11yChar.fire(hr(a)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+o-B>f){if(m){let T=y,Y=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 ao&&y.copyCellsFrom(T,Y,0,B,!1);Y<f;)T.setCellFromCodepoint(Y++,0,1,b)}else if(this._activeBuffer.x=f-1,o===2)continue}if(E&&this._activeBuffer.x){let T=y.getWidth(this._activeBuffer.x-1)?1:2;y.addCodepointToCell(this._activeBuffer.x-T,a,o);for(let Y=o-B;--Y>=0;)y.setCellFromCodepoint(this._activeBuffer.x++,0,0,b);continue}if(p&&(y.insertCells(this._activeBuffer.x,o-B,this._activeBuffer.getNullCell(b)),y.getWidth(f-1)===2&&y.setCellFromCodepoint(f-1,0,1,b)),y.setCellFromCodepoint(this._activeBuffer.x++,a,o,b),o>0)for(;--o;)y.setCellFromCodepoint(this._activeBuffer.x++,0,0,b)}this._parser.precedingJoinState=w,this._activeBuffer.x<f&&n-t>0&&y.getWidth(this._activeBuffer.x)===0&&!y.hasContent(this._activeBuffer.x)&&y.setCellFromCodepoint(this._activeBuffer.x,0,1,b),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(e,t){return e.final==="t"&&!e.prefix&&!e.intermediates?this._parser.registerCsiHandler(e,n=>iS(n.params[0],this._optionsService.rawOptions.windowOptions)?t(n):!0):this._parser.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._parser.registerDcsHandler(e,new Jb(t))}registerEscHandler(e,t){return this._parser.registerEscHandler(e,t)}registerOscHandler(e,t){return this._parser.registerOscHandler(e,new gs(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(Jt));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=Vr.extractWidth(t),o=this._activeBuffer.x-a,c=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(o),h=new Uint32Array(c.length*n),f=0;for(let p=0;p<c.length;){let b=c.codePointAt(p)||0;h[f++]=b,p+=b>65535?2:1}let m=f;for(let p=1;p<n;++p)h.copyWithin(m,0,f),m+=f;return this.print(h,0,m),!0}sendDeviceAttributesPrimary(e){return e.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(ue.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(ue.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(e){return e.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(ue.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(ue.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(e.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(ue.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,Yr),this._charsetService.setgCharset(1,Yr),this._charsetService.setgCharset(2,Yr),this._charsetService.setgCharset(3,Yr);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;(E=>(E[E.NOT_RECOGNIZED=0]="NOT_RECOGNIZED",E[E.SET=1]="SET",E[E.RESET=2]="RESET",E[E.PERMANENTLY_SET=3]="PERMANENTLY_SET",E[E.PERMANENTLY_RESET=4]="PERMANENTLY_RESET"))(n||={});let a=this._coreService.decPrivateModes,{activeProtocol:o,activeEncoding:c}=this._coreMouseService,h=this._coreService,{buffers:f,cols:m}=this._bufferService,{active:p,alt:b}=f,y=this._optionsService.rawOptions,w=(E,B)=>(h.triggerDataEvent(`${ue.ESC}[${t?"":"?"}${E};${B}$y`),!0),x=E=>E?1:2,C=e.params[0];return t?C===2?w(C,4):C===4?w(C,x(h.modes.insertMode)):C===12?w(C,3):C===20?w(C,x(y.convertEol)):w(C,0):C===1?w(C,x(a.applicationCursorKeys)):C===3?w(C,y.windowOptions.setWinLines?m===80?2:m===132?1:0:0):C===6?w(C,x(a.origin)):C===7?w(C,x(a.wraparound)):C===8?w(C,3):C===9?w(C,x(o==="X10")):C===12?w(C,x(y.cursorBlink)):C===25?w(C,x(!h.isCursorHidden)):C===45?w(C,x(a.reverseWraparound)):C===66?w(C,x(a.applicationKeypad)):C===67?w(C,4):C===1e3?w(C,x(o==="VT200")):C===1002?w(C,x(o==="DRAG")):C===1003?w(C,x(o==="ANY")):C===1004?w(C,x(a.sendFocus)):C===1005?w(C,4):C===1006?w(C,x(c==="SGR")):C===1015?w(C,4):C===1016?w(C,x(c==="SGR_PIXELS")):C===1048?w(C,1):C===47||C===1047||C===1049?w(C,x(p===b)):C===2004?w(C,x(a.bracketedPasteMode)):C===2026?w(C,x(a.synchronizedOutput)):w(C,0)}_updateAttrColor(e,t,n,a,o){return t===2?(e|=50331648,e&=-16777216,e|=Ho.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 h=e.getSubParams(t+c),f=0;do a[1]===5&&(o=1),a[c+f+1+o]=h[f];while(++f<h.length&&f+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 h=2;h<a.length;++h)a[h]===-1&&(a[h]=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=Jt.fg,e.bg=Jt.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|=Jt.fg&16777215):n===49?(a.bg&=-67108864,a.bg|=Jt.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|=Jt.fg&16777215,a.bg&=-67108864,a.bg|=Jt.bg&16777215):this._logService.debug("Unknown SGR attribute: %d.",n);return!0}deviceStatus(e){switch(e.params[0]){case 5:this._coreService.triggerDataEvent(`${ue.ESC}[0n`);break;case 6:let t=this._activeBuffer.y+1,n=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${ue.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(`${ue.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=Jt.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(!iS(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(`${ue.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:(t===0||t===2)&&(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>tS&&this._windowTitleStack.shift()),(t===0||t===1)&&(this._iconNameStack.push(this._iconName),this._iconNameStack.length>tS&&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(rS(c))if(o==="?")t.push({type:0,index:c});else{let h=eS(o);h&&t.push({type:1,index:c,color:h})}}}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=eS(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]);rS(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,Yr),!0}selectCharset(e){return e.length!==2?(this.selectDefaultCharset(),!0):(e[0]==="/"||this._charsetService.setgCharset(WD[e[0]],hi[e[1]]||Yr),!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=Jt.clone(),this._eraseAttrDataInternal=Jt.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 Hs;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=h=>(this._coreService.triggerDataEvent(`${ue.ESC}${h}${ue.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)}},Fp=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&&(nS=e,e=t,t=nS),e<this.start&&(this.start=e),t>this.end&&(this.end=t)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};Fp=Ut([ye(0,$i)],Fp);function rS(e){return 0<=e&&e<256}var YD=5e7,aS=12,VD=50,XD=class extends Xe{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 ve),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>YD)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 h=f=>performance.now()-n>=aS?setTimeout(()=>this._innerWrite(0,f)):this._innerWrite(n,f);o.catch(f=>(queueMicrotask(()=>{throw f}),Promise.resolve(!1))).then(h);return}let c=this._callbacks[this._bufferOffset];if(c&&c(),this._bufferOffset++,this._pendingData-=a.length,performance.now()-n>=aS)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>VD&&(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()}},qp=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 f=t.addMarker(t.ybase+t.y),m={data:e,id:this._nextId++,lines:[f]};return f.onDispose(()=>this._removeMarkerFromLink(m,f)),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),h={id:this._nextId++,key:this._getEntryIdKey(n),data:n,lines:[c]};return c.onDispose(()=>this._removeMarkerFromLink(h,c)),this._entriesWithId.set(h.key,h),this._dataByLinkId.set(h.id,h),h.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)))}};qp=Ut([ye(0,$i)],qp);var lS=!1,GD=class extends Xe{constructor(e){super(),this._windowsWrappingHeuristics=this._register(new Va),this._onBinary=this._register(new ve),this.onBinary=this._onBinary.event,this._onData=this._register(new ve),this.onData=this._onData.event,this._onLineFeed=this._register(new ve),this.onLineFeed=this._onLineFeed.event,this._onResize=this._register(new ve),this.onResize=this._onResize.event,this._onWriteParsed=this._register(new ve),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this._register(new ve),this._instantiationService=new bD,this.optionsService=this._register(new MD(e)),this._instantiationService.setService(Yi,this.optionsService),this._bufferService=this._register(this._instantiationService.createInstance(Up)),this._instantiationService.setService($i,this._bufferService),this._logService=this._register(this._instantiationService.createInstance(Hp)),this._instantiationService.setService(Y0,this._logService),this.coreService=this._register(this._instantiationService.createInstance(Pp)),this._instantiationService.setService(ta,this.coreService),this.coreMouseService=this._register(this._instantiationService.createInstance(Kp)),this._instantiationService.setService($0,this.coreMouseService),this.unicodeService=this._register(this._instantiationService.createInstance(Vr)),this._instantiationService.setService(_T,this.unicodeService),this._charsetService=this._instantiationService.createInstance(OD),this._instantiationService.setService(mT,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(qp),this._instantiationService.setService(V0,this._oscLinkService),this._inputHandler=this._register(new $D(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this._register(Ni.forward(this._inputHandler.onLineFeed,this._onLineFeed)),this._register(this._inputHandler),this._register(Ni.forward(this._bufferService.onResize,this._onResize)),this._register(Ni.forward(this.coreService.onData,this._onData)),this._register(Ni.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 XD((t,n)=>this._inputHandler.parse(t,n))),this._register(Ni.forward(this._writeBuffer.onWriteParsed,this._onWriteParsed))}get onScroll(){return this._onScrollApi||(this._onScrollApi=this._register(new ve),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&&!lS&&(this._logService.warn("writeSync is unreliable and will be removed soon."),lS=!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,kw),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(Qb.bind(null,this._bufferService))),e.push(this.registerCsiHandler({final:"H"},()=>(Qb(this._bufferService),!1))),this._windowsWrappingHeuristics.value=Rt(()=>{for(let t of e)t.dispose()})}}},ZD={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 QD(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=ue.ESC+"OA":o.key=ue.ESC+"[A":e.key==="UIKeyInputLeftArrow"?t?o.key=ue.ESC+"OD":o.key=ue.ESC+"[D":e.key==="UIKeyInputRightArrow"?t?o.key=ue.ESC+"OC":o.key=ue.ESC+"[C":e.key==="UIKeyInputDownArrow"&&(t?o.key=ue.ESC+"OB":o.key=ue.ESC+"[B");break;case 8:o.key=e.ctrlKey?"\b":ue.DEL,e.altKey&&(o.key=ue.ESC+o.key);break;case 9:if(e.shiftKey){o.key=ue.ESC+"[Z";break}o.key=ue.HT,o.cancel=!0;break;case 13:o.key=e.altKey?ue.ESC+ue.CR:ue.CR,o.cancel=!0;break;case 27:o.key=ue.ESC,e.altKey&&(o.key=ue.ESC+ue.ESC),o.cancel=!0;break;case 37:if(e.metaKey)break;c?o.key=ue.ESC+"[1;"+(c+1)+"D":t?o.key=ue.ESC+"OD":o.key=ue.ESC+"[D";break;case 39:if(e.metaKey)break;c?o.key=ue.ESC+"[1;"+(c+1)+"C":t?o.key=ue.ESC+"OC":o.key=ue.ESC+"[C";break;case 38:if(e.metaKey)break;c?o.key=ue.ESC+"[1;"+(c+1)+"A":t?o.key=ue.ESC+"OA":o.key=ue.ESC+"[A";break;case 40:if(e.metaKey)break;c?o.key=ue.ESC+"[1;"+(c+1)+"B":t?o.key=ue.ESC+"OB":o.key=ue.ESC+"[B";break;case 45:!e.shiftKey&&!e.ctrlKey&&(o.key=ue.ESC+"[2~");break;case 46:c?o.key=ue.ESC+"[3;"+(c+1)+"~":o.key=ue.ESC+"[3~";break;case 36:c?o.key=ue.ESC+"[1;"+(c+1)+"H":t?o.key=ue.ESC+"OH":o.key=ue.ESC+"[H";break;case 35:c?o.key=ue.ESC+"[1;"+(c+1)+"F":t?o.key=ue.ESC+"OF":o.key=ue.ESC+"[F";break;case 33:e.shiftKey?o.type=2:e.ctrlKey?o.key=ue.ESC+"[5;"+(c+1)+"~":o.key=ue.ESC+"[5~";break;case 34:e.shiftKey?o.type=3:e.ctrlKey?o.key=ue.ESC+"[6;"+(c+1)+"~":o.key=ue.ESC+"[6~";break;case 112:c?o.key=ue.ESC+"[1;"+(c+1)+"P":o.key=ue.ESC+"OP";break;case 113:c?o.key=ue.ESC+"[1;"+(c+1)+"Q":o.key=ue.ESC+"OQ";break;case 114:c?o.key=ue.ESC+"[1;"+(c+1)+"R":o.key=ue.ESC+"OR";break;case 115:c?o.key=ue.ESC+"[1;"+(c+1)+"S":o.key=ue.ESC+"OS";break;case 116:c?o.key=ue.ESC+"[15;"+(c+1)+"~":o.key=ue.ESC+"[15~";break;case 117:c?o.key=ue.ESC+"[17;"+(c+1)+"~":o.key=ue.ESC+"[17~";break;case 118:c?o.key=ue.ESC+"[18;"+(c+1)+"~":o.key=ue.ESC+"[18~";break;case 119:c?o.key=ue.ESC+"[19;"+(c+1)+"~":o.key=ue.ESC+"[19~";break;case 120:c?o.key=ue.ESC+"[20;"+(c+1)+"~":o.key=ue.ESC+"[20~";break;case 121:c?o.key=ue.ESC+"[21;"+(c+1)+"~":o.key=ue.ESC+"[21~";break;case 122:c?o.key=ue.ESC+"[23;"+(c+1)+"~":o.key=ue.ESC+"[23~";break;case 123:c?o.key=ue.ESC+"[24;"+(c+1)+"~":o.key=ue.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=ue.NUL:e.keyCode>=51&&e.keyCode<=55?o.key=String.fromCharCode(e.keyCode-51+27):e.keyCode===56?o.key=ue.DEL:e.keyCode===219?o.key=ue.ESC:e.keyCode===220?o.key=ue.FS:e.keyCode===221&&(o.key=ue.GS);else if((!n||a)&&e.altKey&&!e.metaKey){let h=ZD[e.keyCode]?.[e.shiftKey?1:0];if(h)o.key=ue.ESC+h;else if(e.keyCode>=65&&e.keyCode<=90){let f=e.ctrlKey?e.keyCode-64:e.keyCode+32,m=String.fromCharCode(f);e.shiftKey&&(m=m.toUpperCase()),o.key=ue.ESC+m}else if(e.keyCode===32)o.key=ue.ESC+(e.ctrlKey?ue.NUL:" ");else if(e.key==="Dead"&&e.code.startsWith("Key")){let f=e.code.slice(3,4);e.shiftKey||(f=f.toLowerCase()),o.key=ue.ESC+f,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=ue.US),e.key==="@"&&(o.key=ue.NUL));break}return o}var qt=0,JD=class{constructor(e){this._getKey=e,this._array=[],this._insertedValues=[],this._flushInsertedTask=new zu,this._isFlushingInserted=!1,this._deletedIndices=[],this._flushDeletedTask=new zu,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||(qt=this._search(t),qt===-1)||this._getKey(this._array[qt])!==t)return!1;do if(this._array[qt]===e)return this._deletedIndices.length===0&&this._flushDeletedTask.enqueue(()=>this._flushDeleted()),this._deletedIndices.push(qt),!0;while(++qt<this._array.length&&this._getKey(this._array[qt])===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&&(qt=this._search(e),!(qt<0||qt>=this._array.length)&&this._getKey(this._array[qt])===e))do yield this._array[qt];while(++qt<this._array.length&&this._getKey(this._array[qt])===e)}forEachByKey(e,t){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(qt=this._search(e),!(qt<0||qt>=this._array.length)&&this._getKey(this._array[qt])===e))do t(this._array[qt]);while(++qt<this._array.length&&this._getKey(this._array[qt])===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}},Bf=0,oS=0,eR=class extends Xe{constructor(){super(),this._decorations=new JD(e=>e?.marker.line),this._onDecorationRegistered=this._register(new ve),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this._register(new ve),this.onDecorationRemoved=this._onDecorationRemoved.event,this._register(Rt(()=>this.reset()))}get decorations(){return this._decorations.values()}registerDecoration(e){if(e.marker.isDisposed)return;let t=new tR(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=>{Bf=o.options.x??0,oS=Bf+(o.options.width??1),e>=Bf&&e<oS&&(!n||(o.options.layer??"bottom")===n)&&a(o)})}},tR=class extends pr{constructor(e){super(),this.options=e,this.onRenderEmitter=this.add(new ve),this.onRender=this.onRenderEmitter.event,this._onDispose=this.add(new ve),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()}},iR=1e3,sR=class{constructor(e,t=iR){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)}},cS=20,ju=class extends Xe{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 sR(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(`
|
|
28
|
-
`))),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(He(o,"selectionchange",()=>this._handleSelectionChange())),this._register(this._coreBrowserService.onDprChange(()=>this._refreshRowsDimensions())),this._refreshRowsDimensions(),this._refreshRows(),this._register(
|
|
29
|
-
`&&(this._liveRegionLineCount++,this._liveRegionLineCount===cS+1&&(this._liveRegion.textContent+=up.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),h=[],f=c?.translateToString(!0,void 0,void 0,h)||"",m=(n.ydisp+o+1).toString(),p=this._rowElements[o];p&&(f.length===0?(p.textContent=" ",this._rowColumns.set(p,[0,1])):(p.textContent=f,this._rowColumns.set(p,h)),p.setAttribute("aria-posinset",m),p.setAttribute("aria-setsize",a),this._alignRowWidth(p))}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 h,f;if(t===0?(h=n,f=this._rowElements.pop(),this._rowContainer.removeChild(f)):(h=this._rowElements.shift(),f=n,this._rowContainer.removeChild(h)),h.removeEventListener("focus",this._topBoundaryFocusListener),f.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:f,offset:m})=>{let p=f instanceof Text?f.parentNode:f,b=parseInt(p?.getAttribute("aria-posinset"),10)-1;if(isNaN(b))return console.warn("row is invalid. Race condition?"),null;let y=this._rowColumns.get(p);if(!y)return console.warn("columns is null. Race condition?"),null;let w=m<y.length?y[m]:y.slice(-1)[0]+1;return w>=this._terminal.cols&&(++b,w=0),{row:b,column:w}},c=o(t),h=o(n);if(!(!c||!h)){if(c.row>h.row||c.row===h.row&&c.column>=h.column)throw new Error("invalid range");this._terminal.select(c.column,c.row,(h.row-c.row)*this._terminal.cols-c.column+h.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})`}};ju=Ut([ye(1,Pm),ye(2,An),ye(3,Ln)],ju);var Wp=class extends Xe{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 ve),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this._register(new ve),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this._register(Rt(()=>{Jr(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(He(this._element,"mouseleave",()=>{this._isMouseOut=!0,this._clearCurrentLink()})),this._register(He(this._element,"mousemove",this._handleMouseMove.bind(this))),this._register(He(this._element,"mousedown",this._handleMouseDown.bind(this))),this._register(He(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 h=c?.map(f=>({link:f}));this._activeProviderReplies?.set(a,h),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 h=o[c],f=h.link.range.start.y<e?0:h.link.range.start.x,m=h.link.range.end.y>e?this._bufferService.cols:h.link.range.end.x;for(let p=f;p<=m;p++){if(n.has(p)){o.splice(c--,1);break}n.add(p)}}}}_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(h=>this._linkAtPosition(h.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 h=this._activeProviderReplies.get(c)?.find(f=>this._linkAtPosition(f.link,t));if(h){n=!0,this._handleNewLink(h);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&&nR(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,Jr(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}}};Wp=Ut([ye(1,Km),ye(2,Ln),ye(3,$i),ye(4,G0)],Wp);function nR(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 rR=class extends GD{constructor(e={}){super(e),this._linkifier=this._register(new Va),this.browser=mw,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this._register(new Va),this._onCursorMove=this._register(new ve),this.onCursorMove=this._onCursorMove.event,this._onKey=this._register(new ve),this.onKey=this._onKey.event,this._onRender=this._register(new ve),this.onRender=this._onRender.event,this._onSelectionChange=this._register(new ve),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this._register(new ve),this.onTitleChange=this._onTitleChange.event,this._onBell=this._register(new ve),this.onBell=this._onBell.event,this._onFocus=this._register(new ve),this._onBlur=this._register(new ve),this._onA11yCharEmitter=this._register(new ve),this._onA11yTabEmitter=this._register(new ve),this._onWillOpen=this._register(new ve),this._setup(),this._decorationService=this._instantiationService.createInstance(eR),this._instantiationService.setService(Uo,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(Vk),this._instantiationService.setService(G0,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(dp)),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(Ni.forward(this._inputHandler.onCursorMove,this._onCursorMove)),this._register(Ni.forward(this._inputHandler.onTitleChange,this._onTitleChange)),this._register(Ni.forward(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this._register(Ni.forward(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this._register(this._bufferService.onResize(t=>this._afterResize(t.cols,t.rows))),this._register(Rt(()=>{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=Et.toColorRGB(n==="ansi"?this._themeService.colors.ansi[t.index]:this._themeService.colors[n]);this.coreService.triggerDataEvent(`${ue.ESC}]${a};${qD(o)}${fw.ST}`);break;case 1:if(n==="ansi")this._themeService.modifyColors(c=>c.ansi[t.index]=ti.toColor(...t.color));else{let c=n;this._themeService.modifyColors(h=>h[c]=ti.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(ju,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(e){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(ue.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(ue.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,h=this.buffer.y*this._renderService.dimensions.css.cell.height,f=n*this._renderService.dimensions.css.cell.width;this.textarea.style.left=f+"px",this.textarea.style.top=h+"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(He(this.element,"copy",t=>{this.hasSelection()&&cT(t,this._selectionService)}));let e=t=>uT(t,this.textarea,this.coreService,this.optionsService);this._register(He(this.textarea,"paste",e)),this._register(He(this.element,"paste",e)),_w?this._register(He(this.element,"mousedown",t=>{t.button===2&&yb(t,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})):this._register(He(this.element,"contextmenu",t=>{yb(t,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})),Xm&&this._register(He(this.element,"auxclick",t=>{t.button===1&&K0(t,this.textarea,this.screenElement)}))}_bindKeys(){this._register(He(this.textarea,"keyup",e=>this._keyUp(e),!0)),this._register(He(this.textarea,"keydown",e=>this._keyDown(e),!0)),this._register(He(this.textarea,"keypress",e=>this._keyPress(e),!0)),this._register(He(this.textarea,"compositionstart",()=>this._compositionHelper.compositionstart())),this._register(He(this.textarea,"compositionupdate",e=>this._compositionHelper.compositionupdate(e))),this._register(He(this.textarea,"compositionend",()=>this._compositionHelper.compositionend())),this._register(He(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(He(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",cp.get()),yw||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($k,this.textarea,e.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(An,this._coreBrowserService),this._register(He(this.textarea,"focus",o=>this._handleTextAreaFocus(o))),this._register(He(this.textarea,"blur",()=>this._handleTextAreaBlur())),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(Lp,this._document,this._helperContainer),this._instantiationService.setService(Gu,this._charSizeService),this._themeService=this._instantiationService.createInstance(jp),this._instantiationService.setService(Qa,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(Bu),this._instantiationService.setService(X0,this._characterJoinerService),this._renderService=this._register(this._instantiationService.createInstance(Op,this.rows,this.screenElement)),this._instantiationService.setService(Ln,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(Bp),this._instantiationService.setService(Km,this._mouseService);let a=this._linkifier.value=this._register(this._instantiationService.createInstance(Wp,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(Dp,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(zp,this.element,this.screenElement,a)),this._instantiationService.setService(gT,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(Ni.any(this._onScroll.event,this._inputHandler.onScroll)(()=>{this._selectionService.refresh(),this._viewport?.queueSync()})),this._register(this._instantiationService.createInstance(Rp,this.screenElement)),this._register(He(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(ju,this)),this._register(this.optionsService.onSpecificOptionChange("screenReaderMode",o=>this._handleScreenReaderModeOptionChange(o))),this.options.overviewRuler.width&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(Lu,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRuler",o=>{!this._overviewRulerRenderer&&o&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(Lu,this._viewportElement,this.screenElement)))}),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(Ap,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){let e=this,t=this.element;function n(c){let h=e._mouseService.getMouseReportCoords(c,e.screenElement);if(!h)return!1;let f,m;switch(c.overrideType||c.type){case"mousemove":m=32,c.buttons===void 0?(f=3,c.button!==void 0&&(f=c.button<3?c.button:3)):f=c.buttons&1?0:c.buttons&4?1:c.buttons&2?2:3;break;case"mouseup":m=0,f=c.button<3?c.button:3;break;case"mousedown":m=1,f=c.button<3?c.button:3;break;case"wheel":if(e._customWheelEventHandler&&e._customWheelEventHandler(c)===!1)return!1;let p=c.deltaY;if(p===0||e.coreMouseService.consumeWheelEvent(c,e._renderService?.dimensions?.device?.cell?.height,e._coreBrowserService?.dpr)===0)return!1;m=p<0?0:1,f=4;break;default:return!1}return m===void 0||f===void 0||f>4?!1:e.coreMouseService.triggerMouseEvent({col:h.col,row:h.row,x:h.x,y:h.y,button:f,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(He(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(He(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 h=ue.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(c.deltaY<0?"A":"B");return this.coreService.triggerDataEvent(h,!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){P0(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=QD(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===ue.ETX||n.key===ue.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)&&(aR(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(Jt));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(ue.ESC+"[I"):this.coreService.triggerDataEvent(ue.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(`${ue.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(`${ue.ESC}[6;${o};${a}t`);break}}cancel(e,t){if(!(!this.options.cancelEvents&&!t))return e.preventDefault(),e.stopPropagation(),!1}};function aR(e){return e.keyCode===16||e.keyCode===17||e.keyCode===18}var lR=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)}},oR=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 Hs)}translateToString(e,t,n){return this._line.translateToString(e,t,n)}},uS=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 oR(t)}getNullCell(){return new Hs}},cR=class extends Xe{constructor(e){super(),this._core=e,this._onBufferChange=this._register(new ve),this.onBufferChange=this._onBufferChange.event,this._normal=new uS(this._core.buffers.normal,"normal"),this._alternate=new uS(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)}},uR=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)}},hR=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}},dR=["cols","rows"],tn=0,fR=class extends Xe{constructor(e){super(),this._core=this._register(new rR(e)),this._addonManager=this._register(new lR),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(dR.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 uR(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new hR(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 cR(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
|
|
30
|
-
`,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
|
|
31
|
-
`).replace(/\n/g,"\r");if(E&&t(E),window.setTimeout(()=>t("\r"),gS),w(""),Yp()){b.current?.blur(),yS();return}window.setTimeout(()=>b.current?.focus(),gS+20)}return _.jsxs("div",{ref:m,className:"compose-drawer","data-open":h?"true":"false",children:[_.jsxs("button",{type:"button",className:"compose-drawer-handle","aria-label":"Open compose drawer","aria-hidden":h?"true":void 0,tabIndex:h?-1:0,title:"Compose long input — type without per-keystroke latency, send with Cmd/Ctrl+Enter",onClick:()=>y(!0),children:[_.jsx("span",{"aria-hidden":"true",children:"▴"}),_.jsx("span",{children:"compose"}),f?_.jsx("span",{className:"compose-drawer-handle-dot","aria-label":"draft saved"}):null]}),_.jsxs("div",{ref:p,className:"compose-drawer-panel","aria-hidden":h?void 0:"true",children:[_.jsxs("button",{type:"button",className:"compose-drawer-header","aria-label":"Collapse compose drawer",tabIndex:h?0:-1,title:"Click to collapse — Esc also closes when focus is in the textarea",onClick:x,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:b,className:"compose-drawer-input","aria-label":"Compose input",tabIndex:h?0:-1,spellCheck:!1,autoCorrect:"off",autoCapitalize:"off",value:f,onChange:E=>w(E.target.value),onKeyDown:E=>{if(E.key==="Enter"&&(E.metaKey||E.ctrlKey)){E.preventDefault(),C();return}E.key==="Escape"&&(E.preventDefault(),x())},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",tabIndex:h?0:-1,onClick:()=>{w(""),b.current?.focus()},disabled:!f,children:"Clear"}),_.jsx("button",{type:"button",className:"compose-drawer-send",tabIndex:h?0:-1,onClick:C,disabled:n||!f,children:"Send"})]})]})]})}function zR(e){const t=document.activeElement;t instanceof HTMLElement&&(!e||e.contains(t))&&t.blur()}function Yp(){return navigator.maxTouchPoints>0?!0:typeof window.matchMedia=="function"&&window.matchMedia("(pointer: coarse)").matches}function yS(){if(!Yp())return;const e=()=>{window.scrollTo(0,0),document.documentElement.scrollTop=0,document.body.scrollTop=0,Ia()};e(),window.requestAnimationFrame?.(e),window.setTimeout(e,120),window.setTimeout(e,320)}function jR(e){Wa!==null&&(window.clearTimeout(Wa),Wa=null),bu.add(e),document.documentElement.setAttribute(Zm,"true"),Ia()}function HR(e){if(bu.delete(e),bu.size>0||Wa!==null){Ia();return}Wa=window.setTimeout(()=>{if(Wa=null,bu.size>0){Ia();return}document.documentElement.removeAttribute(Zm),Ia()},BR),Ia()}function Ia(){window.dispatchEvent(new Event($p))}function UR(e){e.attachCustomKeyEventHandler(o=>{if(PR(o)){const c=bS(e);return c?(o.preventDefault(),o.stopPropagation(),SS(c),!1):!0}return KR(o)?(o.preventDefault(),o.stopPropagation(),IR(e),!1):!0});const t=e.element;if(!t)return{dispose(){e.attachCustomKeyEventHandler(()=>!0)}};const n=o=>{const c=bS(e);if(c){if(o.clipboardData){o.clipboardData.setData("text/plain",c),o.preventDefault();return}o.preventDefault(),SS(c)}},a=o=>{const c=o.clipboardData?.getData("text/plain");if(c===void 0)return;const h=Hw(c);h!==c&&(o.preventDefault(),o.stopImmediatePropagation(),e.paste(h))};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 PR(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 KR(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 IR(e){if(navigator.clipboard?.readText)try{const t=await navigator.clipboard.readText();if(!t)return;e.paste(Hw(t))}catch{}}function bS(e){return e.hasSelection()?e.getSelection():""}function Hw(e){return e.replace(/(?:\r\n|\r|\n)+$/,"")}async function SS(e){if(navigator.clipboard?.writeText)try{await navigator.clipboard.writeText(e);return}catch{}FR(e)}function FR(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 qR=[4,10,11,12];function WR(e,t){const n=[e.parser.registerCsiHandler({final:"c"},a=>wS(a)),e.parser.registerCsiHandler({prefix:">",final:"c"},a=>wS(a)),e.parser.registerCsiHandler({final:"n"},a=>$R(a)),e.parser.registerCsiHandler({prefix:"?",final:"n"},a=>YR(a)),e.parser.registerCsiHandler({final:"t"},a=>VR(a)),e.parser.registerDcsHandler({intermediates:"$",final:"q"},()=>!0),...qR.map(a=>e.parser.registerOscHandler(a,o=>XR(o)))];return{dispose(){for(const a of n)a.dispose()}}}function wS(e){return Ju(e)===0}function $R(e){const t=Ju(e);return t===5||t===6}function YR(e){return Ju(e)===6}function VR(e){const t=Ju(e);return t===14||t===16||t===18}function XR(e){return e.split(";").some(t=>t==="?")}function Ju(e){const t=e[0];return typeof t=="number"?t:0}const Xa=new Map,GR=2*1024*1024,ZR=1500,QR=25e3;function JR(e,t){let n=Xa.get(e);n||(n=tM(e),Xa.set(e,n),Jm(n)),n.listeners.add(t);const a=c=>nM(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 Vp(e){const t=Xa.get(e);t&&(rM(t),Xa.delete(e))}function eM(e){const t=Xa.get(e);if(!t)return!1;t.exited=!1,t.reconnectEnabled=!0,t.reconnectTimer!==null&&(window.clearTimeout(t.reconnectTimer),t.reconnectTimer=null),eh(t);const n=t.socket;return t.socket=null,Ua(t,"reconnecting"),n&&(n.readyState===WebSocket.OPEN||n.readyState===WebSocket.CONNECTING)&&n.close(),Jm(t),!0}function CS(){for(const e of Array.from(Xa.keys()))Vp(e)}function tM(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 Jm(e){if(!e.reconnectEnabled)return;Ua(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){Ua(e,"connected");for(const n of e.pendingOut)t.send(JSON.stringify(n));e.pendingOut.length=0,e.isAlive=!0,iM(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}sM(e,o),Uw(e,{type:"message",message:o})}}),t.addEventListener("close",n=>{if(e.socket===t){if(e.socket=null,eh(e),n.code===1008){e.reconnectEnabled=!1,Ua(e,"unauthorized");return}if(e.exited||!e.reconnectEnabled){Ua(e,"closed");return}Ua(e,"reconnecting"),e.reconnectTimer=window.setTimeout(()=>{e.reconnectTimer=null,Jm(e)},ZR)}}),t.addEventListener("error",()=>{})}function iM(e){eh(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)}))}},QR)}function eh(e){e.heartbeat!==null&&(window.clearInterval(e.heartbeat),e.heartbeat=null)}function sM(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",xS(e);return}if(t.type==="output"){e.output.push(t.data),e.outputBytes+=t.data.length,xS(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 xS(e){for(;e.outputBytes>GR&&e.output.length>1;){const t=e.output.shift();e.outputBytes-=t.length}}function Ua(e,t){e.status!==t&&(e.status=t,Uw(e,{type:"status",status:t}))}function Uw(e,t){for(const n of Array.from(e.listeners))n(t)}function nM(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 rM(e){e.reconnectEnabled=!1,e.reconnectTimer!==null&&(window.clearTimeout(e.reconnectTimer),e.reconnectTimer=null),eh(e);const t=e.socket;e.socket=null,t&&(t.readyState===WebSocket.OPEN||t.readyState===WebSocket.CONNECTING)&&t.close(),e.listeners.clear()}const aM=[0,50,150,350],lM=[300,1200,2500],ES=1e3,oM=1e5,Xp="\x1B[?1049l\x1B[?1047l\x1B[?47l",cM=new Set(["47","1047","1049"]),Pw=400,uM=6,TS=[500,1500,3e3,5e3,8e3],hM=ei.lazy(()=>Um(()=>import("./TranscriptMarkdownBody-32hVz4hY.js"),__vite__mapDeps([2,1])));function kS({terminal:e,serverApi:t,active:n,visible:a=!0,canClose:o,refreshCwdOnEnter:c=!1,tabId:h,onSelect:f,onClose:m,onExit:p,onSnapshot:b,onAuthClose:y}){const w=g.useSyncExternalStore(T0,tp,()=>Xr),x=g.useSyncExternalStore(k0,ip,()=>$a),C=g.useSyncExternalStore(D0,np,()=>!0),E=g.useSyncExternalStore(z0,_r,()=>Mu),B=g.useRef(null),T=g.useRef(null),Y=g.useRef(null),K=g.useRef(null),X=g.useRef({onExit:p,onSnapshot:b}),re=g.useRef(t.createWebSocketUrl),ee=g.useRef(y),ie=g.useRef(null),le=g.useRef(new Map),de=g.useRef([]),N=g.useRef([]),U=g.useRef([]),P=g.useRef(0),j=g.useRef(!1),z=g.useRef(null),G=g.useRef(0),M=g.useRef(null),q=g.useRef(null),V=g.useRef(!1),_e=g.useRef(!1),be=g.useRef(!1),D=g.useRef(0),W=g.useRef(null),ne=g.useRef(null),he=g.useRef(null),ge=g.useRef(null),pe=g.useRef(!1),ke=g.useRef(!1),me=g.useRef(!1),Se=g.useRef(!1),Me=g.useRef(!1),Ue=g.useRef(!1),Ke=g.useRef(!1),we=g.useRef(n),te=g.useRef(a),De=g.useRef(c),Ce=g.useRef(w),Pe=g.useRef(x),$e=g.useRef(!1),bt=g.useRef(null),ht=g.useRef(!1),Si=g.useRef(null),[,J]=g.useState("connecting"),[Fe,Oe]=g.useState(!1),[Tt,ji]=g.useState(null),[Ai,$t]=g.useState(!1),[Vi,Li]=g.useState(null),[Xi,Vs]=g.useState(!1),[as,Pt]=g.useState(!1),[wi,Lt]=g.useState(!1),[Ci,Hi]=g.useState(null),[ln,bs]=g.useState(!1),Ss=!!Ci||Gp(e.currentCommand),[_t,St]=g.useState(!1);g.useLayoutEffect(()=>{we.current=n},[n]),g.useLayoutEffect(()=>{te.current=a},[a]),g.useLayoutEffect(()=>{De.current=c},[c]),g.useLayoutEffect(()=>{Ce.current=w},[w]),g.useLayoutEffect(()=>{Pe.current=x},[x]),g.useLayoutEffect(()=>{$e.current=ln},[ln]),g.useLayoutEffect(()=>{ht.current=Ss},[Ss]),g.useEffect(()=>{a&&n&&e.status==="running"&&(st(),Ne())},[n,a,e.status]),g.useEffect(()=>{X.current={onExit:p,onSnapshot:b}},[p,b]),g.useEffect(()=>{re.current=t.createWebSocketUrl,ee.current=y},[t,y]),g.useEffect(()=>{let A=!1,oe=null,Le=0;const ze=wM(e.currentCommand);function Ye(){oe!==null&&(window.clearTimeout(oe),oe=null)}function it(){if(!ze||Le>=TS.length||A)return;const ai=TS[Le++];oe=window.setTimeout(()=>{oe=null,fi()},ai)}async function fi(){try{const ai=await t.getTerminalTranscriptSource(e.id);if(A)return;Hi(ai.source),ai.source||it()}catch(ai){if(A)return;Hi(null),Of(ai)&&it()}}return Hi(null),e.status!=="running"?()=>{A=!0,Ye()}:(fi(),()=>{A=!0,Ye()})},[t,e.currentCommand,e.id,e.status]),g.useEffect(()=>{const A=Ci?`${e.id}:${Ci.provider}:${Ci.sessionId}`:null,oe=bt.current;oe!==null&&oe!==A&&$e.current&&bs(!1),bt.current=A},[e.id,Ci?.provider,Ci?.sessionId]),g.useEffect(()=>{const A=T.current;A&&(A.options.disableStdin=e.status==="exited"),e.status==="exited"&&J("closed")},[e.status]),g.useEffect(()=>{const A=T.current;A&&(A.options.fontSize=w,vf(w,Pe.current).then(()=>{Ce.current===w&&st()}))},[w]),g.useEffect(()=>{const A=T.current;A&&(A.options.fontFamily=ep(x),vf(Ce.current,x).then(()=>{Pe.current===x&&st()}))},[x]),g.useEffect(()=>{const A=T.current;A&&(A.options.theme=DS(E))},[E]),g.useEffect(()=>{const A=B.current;if(!A)return;let oe=!1,Le=null,ze=null,Ye=null,it=null,fi=null,ai=null,Zi=null;ie.current=null,Me.current=!1,Ue.current=!1,W.current=null,ne.current=null,Ot(),ii();const Ks=Ce.current,xr=Pe.current,cs=new fR({cursorBlink:!0,convertEol:!1,disableStdin:e.status==="exited",fontFamily:ep(xr),fontSize:Ks,fontWeight:400,fontWeightBold:700,macOptionClickForcesSelection:!0,scrollback:oM,theme:{...DS(_r())}}),Er=new nT;return cs.loadAddon(Er),it=WR(cs),T.current=cs,Y.current=Er,vf(Ks,xr).then(()=>{if(oe)return;cs.open(A),Me.current=!0,Le=UR(cs),te.current&&we.current&&e.status==="running"&&Ne(),st(),fi=AM(A,cs,()=>Ce.current*1.2,Gi,xs=>{wt(xs)},os,Cs),ai=RM(A,cs,Gi,xs=>{wt(xs)},os,Cs);const Is=new pR;ze=cs.onData(xs=>{if(Ke.current){const on=CR(xs);if(on){ot(!1),fe(on);return}}const ra=Is.accept(xs);ra&&fe(ra)}),Ye=cs.onScroll(xs=>{if(ke.current||Se.current||me.current){Vt();return}br(),$s(cs)&&ri({scrollToBottom:!0}),Gi(),xs<=3&&wt()}),Zi=new ResizeObserver(()=>{Ti()}),Zi.observe(A),Ue.current&&(si(),Ue.current=!1,st()),Ki()}),()=>{oe=!0,Me.current=!1,Ue.current=!1,Ot(),ni(),sa(),me.current=!1,fi?.(),ai?.(),Zi?.disconnect(),Le?.dispose(),ze?.dispose(),Ye?.dispose(),it?.dispose(),cs.dispose(),T.current=null,Y.current=null}},[e.id]),g.useEffect(()=>{const A=re.current(e.id),oe=JR(A,Bt);return K.current=oe.send,J(oe.status),oe.status==="connected"&&st(),oe.snapshot&&(X.current.onSnapshot(oe.snapshot,{notifyCompletion:!1}),T.current&&(st(),kt(oe.output,oe.history),st())),()=>{oe.detach(),K.current=null}},[e.id,e.status]);function Bt(A){if(A.type==="status"){J(A.status),A.status==="unauthorized"&&ee.current?.(),A.status==="connected"&&st();return}Pi(A.message)}function ii(A=[],oe=null){N.current=[],U.current=ou(A),P.current=0,j.current=!1,z.current=null,me.current=!1,G.current+=1,M.current=oe,q.current=null,V.current=!1,_e.current=!1,be.current=!1,Ue.current=!1,Si.current=null,he.current=null,pe.current=!1,Oe(!1),ji(null),$t(!1),Li(null),Vs(!1),Pt(!1)}function kt(A=[],oe=null){ii(A,oe),Yt()}function Yt(){if(!T.current||!Me.current){Ue.current=!0;return}Ue.current=!1,si()}async function si(){const A=T.current;if(!A)return;const oe=cu(A,pe.current),Le=oe?U.current.length:P.current;await xi(A,{liveOutputLimit:Le,scrollToBottom:oe}),T.current===A&&Vt()}function xi(A,oe={}){return new Promise(Le=>{me.current=!0,j.current=!1;const ze=G.current+1;G.current=ze;const Ye=Math.max(0,Math.min(oe.liveOutputLimit??U.current.length,U.current.length)),it=oe.historyPages??N.current,fi=()=>{if(T.current!==A||G.current!==ze){Le(!1);return}try{P.current=Ye,oe.scrollToBottom&&wr(A)}finally{me.current=!1;const Zi=di();Zi?ri(Zi):oe.applyDeferredSnapshot!==!1&&Sr(),Le(!0)}},ai=()=>{if(T.current!==A||G.current!==ze){Le(!1);return}A.clear();const Zi=ou([...it,...U.current.slice(0,Ye)]);if(Zi.length===0){fi();return}for(let Ks=0;Ks<Zi.length;Ks+=1){const xr=Zi[Ks];Ks===Zi.length-1?A.write(xr,fi):A.write(xr)}};if(A.buffer.active.type==="alternate"){A.write(Xp,ai);return}ai()})}async function wt(A=0){const oe=T.current;if(be.current||!oe)return;if(ws(oe)){Vt();return}const Le=M.current;be.current=!0,Oe(!0);const ze=oe.buffer.active.viewportY;try{let Ye=!!(Le&&!Le.hasMore);if(!Ye)try{const it=await t.getTerminalHistory(e.id,{beforeLine:Le?.startLine??0,limit:ES}),fi={startLine:it.startLine,endLine:it.endLine,hasMore:it.hasMore};if(it.output.length>0){await Kt(oe,it.output,ze,A)&&(M.current=fi);return}M.current=fi,Ye=!it.hasMore}catch(it){Ye=Of(it)}if(Ye){if(ws(oe)){Vt();return}await Ui(oe,ze,A)}}catch{}finally{be.current=!1,Oe(!1)}}async function Ui(A,oe,Le){if(!(V.current||_e.current))try{const ze=q.current,Ye=await t.getTerminalTranscriptHistory(e.id,{...ze?{cursor:ze}:{},limit:Pw}),it=Ye.output.map(Iw);if(it.length===0){Hi(Ye.source),q.current=Ye.cursor,_e.current=!Ye.hasMore||!Ye.cursor;return}await Kt(A,it,oe,Le)&&(Hi(Ye.source),q.current=Ye.cursor,_e.current=!Ye.hasMore||!Ye.cursor)}catch(ze){Of(ze)&&(V.current=!0)}}async function Kt(A,oe,Le,ze){if(ws(A))return Vt(),!1;const Ye=[...oe,...N.current],it=kM(oe);return!await xi(A,{liveOutputLimit:P.current,scrollToBottom:!1,historyPages:Ye,applyDeferredSnapshot:!1})||T.current!==A?!1:(N.current=Ye,On(A,Math.max(0,Le+it+Math.min(0,ze))),pe.current=!$s(A),Gi(),!0)}g.useEffect(()=>{const A=window.visualViewport;function oe(){document.visibilityState==="visible"&&st()}function Le(){st()}function ze(){Ki()}return document.addEventListener("visibilitychange",oe),window.addEventListener("pageshow",Le),window.addEventListener("resize",ze),A?.addEventListener("resize",ze),A?.addEventListener("scroll",ze),()=>{document.removeEventListener("visibilitychange",oe),window.removeEventListener("pageshow",Le),window.removeEventListener("resize",ze),A?.removeEventListener("resize",ze),A?.removeEventListener("scroll",ze)}},[e.id]);function Ei(){const A=re.current(e.id),oe=D.current+1;D.current=oe,W.current={generation:oe,snapshot:null},ne.current=oe,J("reconnecting"),eM(A),lt(oe)}async function lt(A){try{const oe=await t.getTerminalHistory(e.id,{limit:ES});if(D.current!==A)return;const Le=W.current,ze=Le?.generation===A?Le.snapshot:null;W.current=null,ze&&(ne.current=null);const Ye={startLine:oe.startLine,endLine:oe.endLine,hasMore:oe.hasMore};if(oe.output.length>0){kt(oe.output,Ye);return}ze?kt(ze.output,ze.history):ne.current=null}catch{if(D.current!==A)return;const oe=W.current,Le=oe?.generation===A?oe.snapshot:null;W.current=null,ne.current=null,Le&&kt(Le.output,Le.history)}}function Pi(A){if(A.type==="snapshot"&&A.terminal.id===e.id){X.current.onSnapshot(A.terminal,{notifyCompletion:!1});const Le=T.current;if(!Le)return;st();const ze=W.current;if(ze){ze.snapshot={output:A.output,history:A.history??null},st();return}if(ne.current!==null){ne.current=null,st();return}if(Xs(Le,A.terminal)){na(A.output,A.history??null),Vt(),st();return}kt(A.output,A.history??null),st();return}if(A.type==="terminal_updated"&&A.terminal.id===e.id){X.current.onSnapshot(A.terminal,{notifyCompletion:!0});return}if(A.type==="output"&&A.terminalId===e.id){const Le=Ww(A.data);if(!Le)return;U.current.push(Le),T.current&&Me.current?ri({scrollToBottom:!0}):Ue.current=!0;return}const oe=T.current;if(oe){if(A.type==="exit"&&A.terminalId===e.id){X.current.onExit(A.exitCode),J("closed");return}A.type==="error"&&oe.writeln(`\r
|
|
32
|
-
[nterminal] ${A.message}`)}}function
|
|
33
|
-
`).length-1:0,
|
|
27
|
+
`)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(e){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._refresh())),Qm&&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=Wb(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=Zm(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,-Mf),Mf),t/=Mf,t/Math.abs(t)+Math.round(t*(SD-1)))}shouldForceSelection(e){return Ou?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(),wD)}_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&&!(Ou&&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<CD&&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=fD(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 h=o.translateBufferLineToString(e[1],!1),f=this._convertViewportColToCharacterIndex(c,e[0]),_=f,p=e[0]-f,b=0,y=0,w=0,x=0;if(h.charAt(f)===" "){for(;f>0&&h.charAt(f-1)===" ";)f--;for(;_<h.length&&h.charAt(_+1)===" ";)_++}else{let B=e[0],T=e[0];c.getWidth(B)===0&&(b++,B--),c.getWidth(T)===2&&(y++,T++);let Y=c.getString(T).length;for(Y>1&&(x+=Y-1,_+=Y-1);B>0&&f>0&&!this._isCharWordSeparator(c.loadCell(B-1,this._workCell));){c.loadCell(B-1,this._workCell);let P=this._workCell.getChars().length;this._workCell.getWidth()===0?(b++,B--):P>1&&(w+=P-1,f-=P-1),f--,B--}for(;T<c.length&&_+1<h.length&&!this._isCharWordSeparator(c.loadCell(T+1,this._workCell));){c.loadCell(T+1,this._workCell);let P=this._workCell.getChars().length;this._workCell.getWidth()===2?(y++,T++):P>1&&(x+=P-1,_+=P-1),_++,T++}}_++;let C=f+p-b+w,E=Math.min(this._bufferService.cols,_-f+b+y-w-x);if(!(!t&&h.slice(f,_).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 T=this._getWordAt([this._bufferService.cols-1,e[1]-1],!1,!0,!1);if(T){let Y=this._bufferService.cols-T.start;C-=Y,E+=Y}}}if(a&&C+E===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 T=this._getWordAt([0,e[1]+1],!1,!1,!0);T&&(E+=T.length)}}return{start:C,length:E}}}_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=Wb(n,this._bufferService.cols)}};Hp=Pt([ye(3,Yi),ye(4,ia),ye(5,qm),ye(6,Vi),ye(7,Bn),ye(8,Ln)],Hp);var $b=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={}}},Yb=class{constructor(){this._color=new $b,this._css=new $b}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()}},oi=Object.freeze((()=>{let e=[Lt.toColor("#2e3436"),Lt.toColor("#cc0000"),Lt.toColor("#4e9a06"),Lt.toColor("#c4a000"),Lt.toColor("#3465a4"),Lt.toColor("#75507b"),Lt.toColor("#06989a"),Lt.toColor("#d3d7cf"),Lt.toColor("#555753"),Lt.toColor("#ef2929"),Lt.toColor("#8ae234"),Lt.toColor("#fce94f"),Lt.toColor("#729fcf"),Lt.toColor("#ad7fa8"),Lt.toColor("#34e2e2"),Lt.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:ti.toCss(a,o,c),rgba:ti.toRgba(a,o,c)})}for(let n=0;n<24;n++){let a=8+n*10;e.push({css:ti.toCss(a,a,a),rgba:ti.toRgba(a,a,a)})}return e})()),Yr=Lt.toColor("#ffffff"),oo=Lt.toColor("#000000"),Vb=Lt.toColor("#ffffff"),Xb=oo,Ql={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117},TD=Yr,Up=class extends Ge{constructor(e){super(),this._optionsService=e,this._contrastCache=new Yb,this._halfContrastCache=new Yb,this._onChangeColors=this._register(new ge),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:Yr,background:oo,cursor:Vb,cursorAccent:Xb,selectionForeground:void 0,selectionBackgroundTransparent:Ql,selectionBackgroundOpaque:Tt.blend(oo,Ql),selectionInactiveBackgroundTransparent:Ql,selectionInactiveBackgroundOpaque:Tt.blend(oo,Ql),scrollbarSliderBackground:Tt.opacity(Yr,.2),scrollbarSliderHoverBackground:Tt.opacity(Yr,.4),scrollbarSliderActiveBackground:Tt.opacity(Yr,.5),overviewRulerBorder:Yr,ansi:oi.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=_t(e.foreground,Yr),t.background=_t(e.background,oo),t.cursor=Tt.blend(t.background,_t(e.cursor,Vb)),t.cursorAccent=Tt.blend(t.background,_t(e.cursorAccent,Xb)),t.selectionBackgroundTransparent=_t(e.selectionBackground,Ql),t.selectionBackgroundOpaque=Tt.blend(t.background,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundTransparent=_t(e.selectionInactiveBackground,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundOpaque=Tt.blend(t.background,t.selectionInactiveBackgroundTransparent),t.selectionForeground=e.selectionForeground?_t(e.selectionForeground,Ib):void 0,t.selectionForeground===Ib&&(t.selectionForeground=void 0),Tt.isOpaque(t.selectionBackgroundTransparent)&&(t.selectionBackgroundTransparent=Tt.opacity(t.selectionBackgroundTransparent,.3)),Tt.isOpaque(t.selectionInactiveBackgroundTransparent)&&(t.selectionInactiveBackgroundTransparent=Tt.opacity(t.selectionInactiveBackgroundTransparent,.3)),t.scrollbarSliderBackground=_t(e.scrollbarSliderBackground,Tt.opacity(t.foreground,.2)),t.scrollbarSliderHoverBackground=_t(e.scrollbarSliderHoverBackground,Tt.opacity(t.foreground,.4)),t.scrollbarSliderActiveBackground=_t(e.scrollbarSliderActiveBackground,Tt.opacity(t.foreground,.5)),t.overviewRulerBorder=_t(e.overviewRulerBorder,TD),t.ansi=oi.slice(),t.ansi[0]=_t(e.black,oi[0]),t.ansi[1]=_t(e.red,oi[1]),t.ansi[2]=_t(e.green,oi[2]),t.ansi[3]=_t(e.yellow,oi[3]),t.ansi[4]=_t(e.blue,oi[4]),t.ansi[5]=_t(e.magenta,oi[5]),t.ansi[6]=_t(e.cyan,oi[6]),t.ansi[7]=_t(e.white,oi[7]),t.ansi[8]=_t(e.brightBlack,oi[8]),t.ansi[9]=_t(e.brightRed,oi[9]),t.ansi[10]=_t(e.brightGreen,oi[10]),t.ansi[11]=_t(e.brightYellow,oi[11]),t.ansi[12]=_t(e.brightBlue,oi[12]),t.ansi[13]=_t(e.brightMagenta,oi[13]),t.ansi[14]=_t(e.brightCyan,oi[14]),t.ansi[15]=_t(e.brightWhite,oi[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]=_t(e.extendedAnsi[a],oi[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()}}};Up=Pt([ye(0,Vi)],Up);function _t(e,t){if(e!==void 0)try{return Lt.toColor(e)}catch{}return t}var kD=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)}},DD=class{constructor(){this._services=new kD,this._services.set(Fm,this)}setService(e,t){this._services.set(e,t)}getService(e){return this._services.get(e)}createInstance(e,...t){let n=ST(e).sort((c,h)=>c.index-h.index),a=[];for(let c of n){let h=this._services.get(c.id);if(!h)throw new Error(`[createInstance] ${e.name} depends on UNKNOWN service ${c.id._id}.`);a.push(h)}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)}},RD={trace:0,debug:1,info:2,warn:3,error:4,off:5},MD="xterm.js: ",Pp=class extends Ge{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=RD[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?"":MD)+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)}};Pp=Pt([ye(0,Vi)],Pp);var Gb=class extends Ge{constructor(e){super(),this._maxLength=e,this.onDeleteEmitter=this._register(new ge),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this._register(new ge),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this._register(new ge),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}},Xe=3,ei=Object.freeze(new Ho),lu=0,Nf=2,co=class Rw{constructor(t,n,a=!1){this.isWrapped=a,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(t*Xe);let o=n||Us.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*Xe+0],a=n&2097151;return[this._data[t*Xe+1],n&2097152?this._combined[t]:a?dr(a):"",n>>22,n&2097152?this._combined[t].charCodeAt(this._combined[t].length-1):a]}set(t,n){this._data[t*Xe+1]=n[0],n[1].length>1?(this._combined[t]=n[1],this._data[t*Xe+0]=t|2097152|n[2]<<22):this._data[t*Xe+0]=n[1].charCodeAt(0)|n[2]<<22}getWidth(t){return this._data[t*Xe+0]>>22}hasWidth(t){return this._data[t*Xe+0]&12582912}getFg(t){return this._data[t*Xe+1]}getBg(t){return this._data[t*Xe+2]}hasContent(t){return this._data[t*Xe+0]&4194303}getCodePoint(t){let n=this._data[t*Xe+0];return n&2097152?this._combined[t].charCodeAt(this._combined[t].length-1):n&2097151}isCombined(t){return this._data[t*Xe+0]&2097152}getString(t){let n=this._data[t*Xe+0];return n&2097152?this._combined[t]:n&2097151?dr(n&2097151):""}isProtected(t){return this._data[t*Xe+2]&536870912}loadCell(t,n){return lu=t*Xe,n.content=this._data[lu+0],n.fg=this._data[lu+1],n.bg=this._data[lu+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*Xe+0]=n.content,this._data[t*Xe+1]=n.fg,this._data[t*Xe+2]=n.bg}setCellFromCodepoint(t,n,a,o){o.bg&268435456&&(this._extendedAttrs[t]=o.extended),this._data[t*Xe+0]=n|a<<22,this._data[t*Xe+1]=o.fg,this._data[t*Xe+2]=o.bg}addCodepointToCell(t,n,a){let o=this._data[t*Xe+0];o&2097152?this._combined[t]+=dr(n):o&2097151?(this._combined[t]=dr(o&2097151)+dr(n),o&=-2097152,o|=2097152):o=n|1<<22,a&&(o&=-12582913,o|=a<<22),this._data[t*Xe+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 Us;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 Us;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*Nf<this._data.buffer.byteLength;let a=t*Xe;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 h=0;h<o.length;h++){let f=parseInt(o[h],10);f>=t&&delete this._combined[f]}let c=Object.keys(this._extendedAttrs);for(let h=0;h<c.length;h++){let f=parseInt(c[h],10);f>=t&&delete this._extendedAttrs[f]}}return this.length=t,a*4*Nf<this._data.buffer.byteLength}cleanupMemory(){if(this._data.length*4*Nf<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 Rw(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*Xe+0]&4194303)return t+(this._data[t*Xe+0]>>22);return 0}getNoBgTrimmedLength(){for(let t=this.length-1;t>=0;--t)if(this._data[t*Xe+0]&4194303||this._data[t*Xe+2]&50331648)return t+(this._data[t*Xe+0]>>22);return 0}copyCellsFrom(t,n,a,o,c){let h=t._data;if(c)for(let _=o-1;_>=0;_--){for(let p=0;p<Xe;p++)this._data[(a+_)*Xe+p]=h[(n+_)*Xe+p];h[(n+_)*Xe+2]&268435456&&(this._extendedAttrs[a+_]=t._extendedAttrs[n+_])}else for(let _=0;_<o;_++){for(let p=0;p<Xe;p++)this._data[(a+_)*Xe+p]=h[(n+_)*Xe+p];h[(n+_)*Xe+2]&268435456&&(this._extendedAttrs[a+_]=t._extendedAttrs[n+_])}let f=Object.keys(t._combined);for(let _=0;_<f.length;_++){let p=parseInt(f[_],10);p>=n&&(this._combined[p-n+a]=t._combined[p])}}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 h=this._data[n*Xe+0],f=h&2097151,_=h&2097152?this._combined[n]:f?dr(f):fr;if(c+=_,o)for(let p=0;p<_.length;++p)o.push(n);n+=h>>22||1}return o&&o.push(n),c}};function ND(e,t,n,a,o,c){let h=[];for(let f=0;f<e.length-1;f++){let _=f,p=e.get(++_);if(!p.isWrapped)continue;let b=[e.get(f)];for(;_<e.length&&p.isWrapped;)b.push(p),p=e.get(++_);if(!c&&a>=f&&a<_){f+=b.length-1;continue}let y=0,w=Do(b,y,t),x=1,C=0;for(;x<b.length;){let B=Do(b,x,t),T=B-C,Y=n-w,P=Math.min(T,Y);b[y].copyCellsFrom(b[x],C,w,P,!1),w+=P,w===n&&(y++,w=0),C+=P,C===B&&(x++,C=0),w===0&&y!==0&&b[y-1].getWidth(n-1)===2&&(b[y].copyCellsFrom(b[y-1],n-1,w++,1,!1),b[y-1].setCell(n-1,o))}b[y].replaceCells(w,n,o);let E=0;for(let B=b.length-1;B>0&&(B>y||b[B].getTrimmedLength()===0);B--)E++;E>0&&(h.push(f+b.length-E),h.push(E)),f+=b.length-1}return h}function AD(e,t){let n=[],a=0,o=t[a],c=0;for(let h=0;h<e.length;h++)if(o===h){let f=t[++a];e.onDeleteEmitter.fire({index:h-c,amount:f}),h+=f-1,c+=f,o=t[++a]}else n.push(h);return{layout:n,countRemoved:c}}function LD(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 BD(e,t,n){let a=[],o=e.map((_,p)=>Do(e,p,t)).reduce((_,p)=>_+p),c=0,h=0,f=0;for(;f<o;){if(o-f<n){a.push(o-f);break}c+=n;let _=Do(e,h,t);c>_&&(c-=_,h++);let p=e[h].getWidth(c-1)===2;p&&c--;let b=p?n-1:n;a.push(b),f+=b}return a}function Do(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 Mw=class Nw{constructor(t){this.line=t,this.isDisposed=!1,this._disposables=[],this._id=Nw._nextId++,this._onDispose=this.register(new ge),this.onDispose=this._onDispose.event}get id(){return this._id}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),ea(this._disposables),this._disposables.length=0)}register(t){return this._disposables.push(t),t}};Mw._nextId=1;var OD=Mw,di={},Vr=di.B;di[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:"≥","{":"π","|":"≠","}":"£","~":"·"};di.A={"#":"£"};di.B=void 0;di[4]={"#":"£","@":"¾","[":"ij","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"};di.C=di[5]={"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};di.R={"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"};di.Q={"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"};di.K={"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"};di.Y={"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"};di.E=di[6]={"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"};di.Z={"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"};di.H=di[7]={"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};di["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"};var Zb=4294967295,Qb=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=ei.clone(),this.savedCharset=Vr,this.markers=[],this._nullCell=Us.fromCharData([0,V0,1,0]),this._whitespaceCell=Us.fromCharData([0,fr,1,32]),this._isClearing=!1,this._memoryCleanupQueue=new zu,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new Gb(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 Au),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 Au),this._whitespaceCell}getBlankLine(e,t){return new co(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>Zb?Zb:t}fillViewportRows(e){if(this.lines.length===0){e===void 0&&(e=ei);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 Gb(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(e,t){let n=this.getNullCell(ei),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 h=0;h<this.lines.length;h++)a+=+this.lines.get(h).resize(e,n);let c=0;if(this._rows<t)for(let h=this._rows;h<t;h++)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 co(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 co(e,n)));else for(let h=this._rows;h>t;h--)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 h=this.lines.length-o;h>0&&(this.lines.trimStart(h),this.ybase=Math.max(this.ybase-h,0),this.ydisp=Math.max(this.ydisp-h,0),this.savedY=Math.max(this.savedY-h,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=ND(this.lines,this._cols,e,this.ybase+this.y,this.getNullCell(ei),n);if(a.length>0){let o=AD(this.lines,a);LD(this.lines,o.layout),this._reflowLargerAdjustViewport(e,t,o.countRemoved)}}_reflowLargerAdjustViewport(e,t,n){let a=this.getNullCell(ei),o=n;for(;o-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<t&&this.lines.push(new co(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(ei),o=[],c=0;for(let h=this.lines.length-1;h>=0;h--){let f=this.lines.get(h);if(!f||!f.isWrapped&&f.getTrimmedLength()<=e)continue;let _=[f];for(;f.isWrapped&&h>0;)f=this.lines.get(--h),_.unshift(f);if(!n){let P=this.ybase+this.y;if(P>=h&&P<h+_.length)continue}let p=_[_.length-1].getTrimmedLength(),b=BD(_,this._cols,e),y=b.length-_.length,w;this.ybase===0&&this.y!==this.lines.length-1?w=Math.max(0,this.y-this.lines.maxLength+y):w=Math.max(0,this.lines.length-this.lines.maxLength+y);let x=[];for(let P=0;P<y;P++){let X=this.getBlankLine(ei,!0);x.push(X)}x.length>0&&(o.push({start:h+_.length+c,newLines:x}),c+=x.length),_.push(...x);let C=b.length-1,E=b[C];E===0&&(C--,E=b[C]);let B=_.length-y-1,T=p;for(;B>=0;){let P=Math.min(T,E);if(_[C]===void 0)break;if(_[C].copyCellsFrom(_[B],T-P,E-P,P,!0),E-=P,E===0&&(C--,E=b[C]),T-=P,T===0){B--;let X=Math.max(B,0);T=Do(_,X,this._cols)}}for(let P=0;P<_.length;P++)b[P]<e&&_[P].setCell(b[P],a);let Y=y-w;for(;Y-- >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 h=[],f=[];for(let E=0;E<this.lines.length;E++)f.push(this.lines.get(E));let _=this.lines.length,p=_-1,b=0,y=o[b];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+c);let w=0;for(let E=Math.min(this.lines.maxLength-1,_+c-1);E>=0;E--)if(y&&y.start>p+w){for(let B=y.newLines.length-1;B>=0;B--)this.lines.set(E--,y.newLines[B]);E++,h.push({index:p+1,amount:y.newLines.length}),w+=y.newLines.length,y=o[++b]}else this.lines.set(E,f[p--]);let x=0;for(let E=h.length-1;E>=0;E--)h[E].index+=x,this.lines.onInsertEmitter.fire(h[E]),x+=h[E].amount;let C=Math.max(0,_+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 OD(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)}},zD=class extends Ge{constructor(e,t){super(),this._optionsService=e,this._bufferService=t,this._onBufferActivate=this._register(new ge),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 Qb(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new Qb(!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)}},Aw=2,Lw=1,Kp=class extends Ge{constructor(e){super(),this.isUserScrolling=!1,this._onResize=this._register(new ge),this.onResize=this._onResize.event,this._onScroll=this._register(new ge),this.onScroll=this._onScroll.event,this.cols=Math.max(e.rawOptions.cols||0,Aw),this.rows=Math.max(e.rawOptions.rows||0,Lw),this.buffers=this._register(new zD(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 h=n.lines.isFull;c===n.lines.length-1?h?n.lines.recycle().copyFrom(a):n.lines.push(a.clone()):n.lines.splice(c+1,0,a.clone()),h?this.isUserScrolling&&(n.ydisp=Math.max(n.ydisp-1,0)):(n.ybase++,this.isUserScrolling||n.ydisp++)}else{let h=c-o+1;n.lines.shiftElements(o+1,h-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))}};Kp=Pt([ye(0,Vi)],Kp);var Ha={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:Ou,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRuler:{}},jD=["normal","bold","100","200","300","400","500","600","700","800","900"],HD=class extends Ge{constructor(e){super(),this._onOptionChange=this._register(new ge),this.onOptionChange=this._onOptionChange.event;let t={...Ha};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(Mt(()=>{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 Ha))throw new Error(`No option with key "${n}"`);return this.rawOptions[n]},t=(n,a)=>{if(!(n in Ha))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=Ha[e]),!UD(t))throw new Error(`"${t}" is not a valid value for ${e}`);break;case"wordSeparator":t||(t=Ha[e]);break;case"fontWeight":case"fontWeightBold":if(typeof t=="number"&&1<=t&&t<=1e3)break;t=jD.includes(t)?t:Ha[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 UD(e){return e==="block"||e==="underline"||e==="bar"}function uo(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]&&uo(e[a],t-1);return n}var Jb=Object.freeze({insertMode:!1}),eS=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,cursorBlink:void 0,cursorStyle:void 0,origin:!1,reverseWraparound:!1,sendFocus:!1,synchronizedOutput:!1,wraparound:!0}),Ip=class extends Ge{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 ge),this.onData=this._onData.event,this._onUserInput=this._register(new ge),this.onUserInput=this._onUserInput.event,this._onBinary=this._register(new ge),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this._register(new ge),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=uo(Jb),this.decPrivateModes=uo(eS)}reset(){this.modes=uo(Jb),this.decPrivateModes=uo(eS)}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))}};Ip=Pt([ye(0,Yi),ye(1,J0),ye(2,Vi)],Ip);var tS={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 Af(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 Lf=String.fromCharCode,iS={DEFAULT:e=>{let t=[Af(e,!1)+32,e.col+32,e.row+32];return t[0]>255||t[1]>255||t[2]>255?"":`\x1B[M${Lf(t[0])}${Lf(t[1])}${Lf(t[2])}`},SGR:e=>{let t=e.action===0&&e.button!==4?"m":"M";return`\x1B[<${Af(e,!0)};${e.col};${e.row}${t}`},SGR_PIXELS:e=>{let t=e.action===0&&e.button!==4?"m":"M";return`\x1B[<${Af(e,!0)};${e.x};${e.y}${t}`}},Fp=class extends Ge{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 ge),this.onProtocolChange=this._onProtocolChange.event;for(let a of Object.keys(tS))this.addProtocol(a,tS[a]);for(let a of Object.keys(iS))this.addEncoding(a,iS[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)}};Fp=Pt([ye(0,Yi),ye(1,ia),ye(2,Vi)],Fp);var Bf=[[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]],PD=[[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]],ci;function KD(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 ID=class{constructor(){if(this.version="6",!ci){ci=new Uint8Array(65536),ci.fill(1),ci[0]=0,ci.fill(0,1,32),ci.fill(0,127,160),ci.fill(2,4352,4448),ci[9001]=2,ci[9002]=2,ci.fill(2,11904,42192),ci[12351]=1,ci.fill(2,44032,55204),ci.fill(2,63744,64256),ci.fill(2,65040,65050),ci.fill(2,65072,65136),ci.fill(2,65280,65377),ci.fill(2,65504,65511);for(let e=0;e<Bf.length;++e)ci.fill(0,Bf[e][0],Bf[e][1]+1)}}wcwidth(e){return e<32?0:e<127?1:e<65536?ci[e]:KD(e,PD)?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=Xr.extractWidth(t);o===0?a=!1:o>n&&(n=o)}return Xr.createPropertyValue(0,n,a)}},Xr=class yu{constructor(){this._providers=Object.create(null),this._active="",this._onChange=new ge,this.onChange=this._onChange.event;let t=new ID;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 h=t.charCodeAt(c);if(55296<=h&&h<=56319){if(++c>=o)return n+this.wcwidth(h);let p=t.charCodeAt(c);56320<=p&&p<=57343?h=(h-55296)*1024+p-56320+65536:n+=this.wcwidth(p)}let f=this.charProperties(h,a),_=yu.extractWidth(f);yu.extractShouldJoin(f)&&(_-=yu.extractWidth(a)),n+=_,a=f}return n}charProperties(t,n){return this._activeProvider.charProperties(t,n)}},FD=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 sS(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 Jl=2147483647,qD=256,Bw=class qp{constructor(t=32,n=32){if(this.maxLength=t,this.maxSubParamsLength=n,n>qD)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 qp;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 qp(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>Jl?Jl: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>Jl?Jl: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,Jl):t}},eo=[],WD=class{constructor(){this._state=0,this._active=eo,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=eo}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=eo,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||eo,!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",Gu(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=eo,this._id=-1,this._state=0}}},ys=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+=Gu(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}},to=[],$D=class{constructor(){this._handlers=Object.create(null),this._active=to,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=to}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=to,this._ident=0}hook(e,t){if(this.reset(),this._ident=e,this._active=this._handlers[e]||to,!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",Gu(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=to,this._ident=0}},ho=new Bw;ho.addParam(0);var nS=class{constructor(e){this._handler=e,this._data="",this._params=ho,this._hitLimit=!1}hook(e){this._params=e.length>1||e.params[0]?e.clone():ho,this._data="",this._hitLimit=!1}put(e,t,n){this._hitLimit||(this._data+=Gu(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=ho,this._data="",this._hitLimit=!1,n));return this._params=ho,this._data="",this._hitLimit=!1,t}},YD=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}},js=160,VD=(function(){let e=new YD(4095),t=Array.apply(null,Array(256)).map((f,_)=>_),n=(f,_)=>t.slice(f,_),a=n(32,127),o=n(0,24);o.push(25),o.push.apply(o,n(28,32));let c=n(0,14),h;e.setDefault(1,0),e.addMany(a,0,2,0);for(h in c)e.addMany([24,26,153,154],h,3,0),e.addMany(n(128,144),h,3,0),e.addMany(n(144,152),h,3,0),e.add(156,h,0,0),e.add(27,h,11,1),e.add(157,h,4,8),e.addMany([152,158,159],h,0,7),e.add(155,h,11,3),e.add(144,h,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(js,0,2,0),e.add(js,8,5,8),e.add(js,6,0,6),e.add(js,11,0,11),e.add(js,13,13,13),e})(),XD=class extends Ge{constructor(e=VD){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 Bw,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(Mt(()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)})),this._oscParser=this._register(new WD),this._dcsParser=this._register(new $D),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,h;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 f=this._parseStack.handlers,_=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(n===!1&&_>-1){for(;_>=0&&(h=f[_](this._params),h!==!0);_--)if(h instanceof Promise)return this._parseStack.handlerPos=_,h}this._parseStack.handlers=[];break;case 4:if(n===!1&&_>-1){for(;_>=0&&(h=f[_](),h!==!0);_--)if(h instanceof Promise)return this._parseStack.handlerPos=_,h}this._parseStack.handlers=[];break;case 6:if(a=e[this._parseStack.chunkPos],h=this._dcsParser.unhook(a!==24&&a!==26,n),h)return h;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],h=this._oscParser.end(a!==24&&a!==26,n),h)return h;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 f=c;f<t;++f){switch(a=e[f],o=this._transitions.table[this.currentState<<8|(a<160?a:js)],o>>4){case 2:for(let w=f+1;;++w){if(w>=t||(a=e[w])<32||a>126&&a<js){this._printHandler(e,f,w),f=w-1;break}if(++w>=t||(a=e[w])<32||a>126&&a<js){this._printHandler(e,f,w),f=w-1;break}if(++w>=t||(a=e[w])<32||a>126&&a<js){this._printHandler(e,f,w),f=w-1;break}if(++w>=t||(a=e[w])<32||a>126&&a<js){this._printHandler(e,f,w),f=w-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:f,code:a,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:let _=this._csiHandlers[this._collect<<8|a],p=_?_.length-1:-1;for(;p>=0&&(h=_[p](this._params),h!==!0);p--)if(h instanceof Promise)return this._preserveStack(3,_,p,o,f),h;p<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(++f<t&&(a=e[f])>47&&a<60);f--;break;case 9:this._collect<<=8,this._collect|=a;break;case 10:let b=this._escHandlers[this._collect<<8|a],y=b?b.length-1:-1;for(;y>=0&&(h=b[y](),h!==!0);y--)if(h instanceof Promise)return this._preserveStack(4,b,y,o,f),h;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 w=f+1;;++w)if(w>=t||(a=e[w])===24||a===26||a===27||a>127&&a<js){this._dcsParser.put(e,f,w),f=w-1;break}break;case 14:if(h=this._dcsParser.unhook(a!==24&&a!==26),h)return this._preserveStack(6,[],0,o,f),h;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 w=f+1;;w++)if(w>=t||(a=e[w])<32||a>127&&a<js){this._oscParser.put(e,f,w),f=w-1;break}break;case 6:if(h=this._oscParser.end(a!==24&&a!==26),h)return this._preserveStack(5,[],0,o,f),h;a===27&&(o|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break}this.currentState=o&15}}},GD=/^([\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})$/,ZD=/^[\da-f]+$/;function rS(e){if(!e)return;let t=e.toLowerCase();if(t.indexOf("rgb:")===0){t=t.slice(4);let n=GD.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),ZD.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 Of(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 QD(e,t=16){let[n,a,o]=e;return`rgb:${Of(n,t)}/${Of(a,t)}/${Of(o,t)}`}var JD={"(":0,")":1,"*":2,"+":3,"-":1,".":2},cr=131072,aS=10;function lS(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 oS=5e3,cS=0,eR=class extends Ge{constructor(e,t,n,a,o,c,h,f,_=new XD){super(),this._bufferService=e,this._charsetService=t,this._coreService=n,this._logService=a,this._optionsService=o,this._oscLinkService=c,this._coreMouseService=h,this._unicodeService=f,this._parser=_,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new yT,this._utf8Decoder=new bT,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=ei.clone(),this._eraseAttrDataInternal=ei.clone(),this._onRequestBell=this._register(new ge),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this._register(new ge),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this._register(new ge),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this._register(new ge),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this._register(new ge),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this._register(new ge),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this._register(new ge),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this._register(new ge),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this._register(new ge),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this._register(new ge),this.onLineFeed=this._onLineFeed.event,this._onScroll=this._register(new ge),this.onScroll=this._onScroll.event,this._onTitleChange=this._register(new ge),this.onTitleChange=this._onTitleChange.event,this._onColor=this._register(new ge),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 Wp(this._bufferService),this._activeBuffer=this._bufferService.buffer,this._register(this._bufferService.buffers.onBufferActivate(p=>this._activeBuffer=p.activeBuffer)),this._parser.setCsiHandlerFallback((p,b)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(p),params:b.toArray()})}),this._parser.setEscHandlerFallback(p=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(p)})}),this._parser.setExecuteHandlerFallback(p=>{this._logService.debug("Unknown EXECUTE code: ",{code:p})}),this._parser.setOscHandlerFallback((p,b,y)=>{this._logService.debug("Unknown OSC code: ",{identifier:p,action:b,data:y})}),this._parser.setDcsHandlerFallback((p,b,y)=>{b==="HOOK"&&(y=y.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(p),action:b,payload:y})}),this._parser.setPrintHandler((p,b,y)=>this.print(p,b,y)),this._parser.registerCsiHandler({final:"@"},p=>this.insertChars(p)),this._parser.registerCsiHandler({intermediates:" ",final:"@"},p=>this.scrollLeft(p)),this._parser.registerCsiHandler({final:"A"},p=>this.cursorUp(p)),this._parser.registerCsiHandler({intermediates:" ",final:"A"},p=>this.scrollRight(p)),this._parser.registerCsiHandler({final:"B"},p=>this.cursorDown(p)),this._parser.registerCsiHandler({final:"C"},p=>this.cursorForward(p)),this._parser.registerCsiHandler({final:"D"},p=>this.cursorBackward(p)),this._parser.registerCsiHandler({final:"E"},p=>this.cursorNextLine(p)),this._parser.registerCsiHandler({final:"F"},p=>this.cursorPrecedingLine(p)),this._parser.registerCsiHandler({final:"G"},p=>this.cursorCharAbsolute(p)),this._parser.registerCsiHandler({final:"H"},p=>this.cursorPosition(p)),this._parser.registerCsiHandler({final:"I"},p=>this.cursorForwardTab(p)),this._parser.registerCsiHandler({final:"J"},p=>this.eraseInDisplay(p,!1)),this._parser.registerCsiHandler({prefix:"?",final:"J"},p=>this.eraseInDisplay(p,!0)),this._parser.registerCsiHandler({final:"K"},p=>this.eraseInLine(p,!1)),this._parser.registerCsiHandler({prefix:"?",final:"K"},p=>this.eraseInLine(p,!0)),this._parser.registerCsiHandler({final:"L"},p=>this.insertLines(p)),this._parser.registerCsiHandler({final:"M"},p=>this.deleteLines(p)),this._parser.registerCsiHandler({final:"P"},p=>this.deleteChars(p)),this._parser.registerCsiHandler({final:"S"},p=>this.scrollUp(p)),this._parser.registerCsiHandler({final:"T"},p=>this.scrollDown(p)),this._parser.registerCsiHandler({final:"X"},p=>this.eraseChars(p)),this._parser.registerCsiHandler({final:"Z"},p=>this.cursorBackwardTab(p)),this._parser.registerCsiHandler({final:"`"},p=>this.charPosAbsolute(p)),this._parser.registerCsiHandler({final:"a"},p=>this.hPositionRelative(p)),this._parser.registerCsiHandler({final:"b"},p=>this.repeatPrecedingCharacter(p)),this._parser.registerCsiHandler({final:"c"},p=>this.sendDeviceAttributesPrimary(p)),this._parser.registerCsiHandler({prefix:">",final:"c"},p=>this.sendDeviceAttributesSecondary(p)),this._parser.registerCsiHandler({final:"d"},p=>this.linePosAbsolute(p)),this._parser.registerCsiHandler({final:"e"},p=>this.vPositionRelative(p)),this._parser.registerCsiHandler({final:"f"},p=>this.hVPosition(p)),this._parser.registerCsiHandler({final:"g"},p=>this.tabClear(p)),this._parser.registerCsiHandler({final:"h"},p=>this.setMode(p)),this._parser.registerCsiHandler({prefix:"?",final:"h"},p=>this.setModePrivate(p)),this._parser.registerCsiHandler({final:"l"},p=>this.resetMode(p)),this._parser.registerCsiHandler({prefix:"?",final:"l"},p=>this.resetModePrivate(p)),this._parser.registerCsiHandler({final:"m"},p=>this.charAttributes(p)),this._parser.registerCsiHandler({final:"n"},p=>this.deviceStatus(p)),this._parser.registerCsiHandler({prefix:"?",final:"n"},p=>this.deviceStatusPrivate(p)),this._parser.registerCsiHandler({intermediates:"!",final:"p"},p=>this.softReset(p)),this._parser.registerCsiHandler({intermediates:" ",final:"q"},p=>this.setCursorStyle(p)),this._parser.registerCsiHandler({final:"r"},p=>this.setScrollRegion(p)),this._parser.registerCsiHandler({final:"s"},p=>this.saveCursor(p)),this._parser.registerCsiHandler({final:"t"},p=>this.windowOptions(p)),this._parser.registerCsiHandler({final:"u"},p=>this.restoreCursor(p)),this._parser.registerCsiHandler({intermediates:"'",final:"}"},p=>this.insertColumns(p)),this._parser.registerCsiHandler({intermediates:"'",final:"~"},p=>this.deleteColumns(p)),this._parser.registerCsiHandler({intermediates:'"',final:"q"},p=>this.selectProtected(p)),this._parser.registerCsiHandler({intermediates:"$",final:"p"},p=>this.requestMode(p,!0)),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},p=>this.requestMode(p,!1)),this._parser.setExecuteHandler(ue.BEL,()=>this.bell()),this._parser.setExecuteHandler(ue.LF,()=>this.lineFeed()),this._parser.setExecuteHandler(ue.VT,()=>this.lineFeed()),this._parser.setExecuteHandler(ue.FF,()=>this.lineFeed()),this._parser.setExecuteHandler(ue.CR,()=>this.carriageReturn()),this._parser.setExecuteHandler(ue.BS,()=>this.backspace()),this._parser.setExecuteHandler(ue.HT,()=>this.tab()),this._parser.setExecuteHandler(ue.SO,()=>this.shiftOut()),this._parser.setExecuteHandler(ue.SI,()=>this.shiftIn()),this._parser.setExecuteHandler(gu.IND,()=>this.index()),this._parser.setExecuteHandler(gu.NEL,()=>this.nextLine()),this._parser.setExecuteHandler(gu.HTS,()=>this.tabSet()),this._parser.registerOscHandler(0,new ys(p=>(this.setTitle(p),this.setIconName(p),!0))),this._parser.registerOscHandler(1,new ys(p=>this.setIconName(p))),this._parser.registerOscHandler(2,new ys(p=>this.setTitle(p))),this._parser.registerOscHandler(4,new ys(p=>this.setOrReportIndexedColor(p))),this._parser.registerOscHandler(8,new ys(p=>this.setHyperlink(p))),this._parser.registerOscHandler(10,new ys(p=>this.setOrReportFgColor(p))),this._parser.registerOscHandler(11,new ys(p=>this.setOrReportBgColor(p))),this._parser.registerOscHandler(12,new ys(p=>this.setOrReportCursorColor(p))),this._parser.registerOscHandler(104,new ys(p=>this.restoreIndexedColor(p))),this._parser.registerOscHandler(110,new ys(p=>this.restoreFgColor(p))),this._parser.registerOscHandler(111,new ys(p=>this.restoreBgColor(p))),this._parser.registerOscHandler(112,new ys(p=>this.restoreCursorColor(p))),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 p in di)this._parser.registerEscHandler({intermediates:"(",final:p},()=>this.selectCharset("("+p)),this._parser.registerEscHandler({intermediates:")",final:p},()=>this.selectCharset(")"+p)),this._parser.registerEscHandler({intermediates:"*",final:p},()=>this.selectCharset("*"+p)),this._parser.registerEscHandler({intermediates:"+",final:p},()=>this.selectCharset("+"+p)),this._parser.registerEscHandler({intermediates:"-",final:p},()=>this.selectCharset("-"+p)),this._parser.registerEscHandler({intermediates:".",final:p},()=>this.selectCharset("."+p)),this._parser.registerEscHandler({intermediates:"/",final:p},()=>this.selectCharset("/"+p));this._parser.registerEscHandler({intermediates:"#",final:"8"},()=>this.screenAlignmentPattern()),this._parser.setErrorHandler(p=>(this._logService.error("Parsing error: ",p),p)),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new nS((p,b)=>this.requestStatusString(p,b)))}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"),oS))]).catch(t=>{if(t!=="#SLOW_TIMEOUT")throw t;console.warn(`async parser handler taking longer than ${oS} ms`)})}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(e,t){let n,a=this._activeBuffer.x,o=this._activeBuffer.y,c=0,h=this._parseStack.paused;if(h){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>cr&&(c=this._parseStack.position+cr)}if(this._logService.logLevel<=1&&this._logService.debug(`parsing data ${typeof e=="string"?` "${e}"`:` "${Array.prototype.map.call(e,p=>String.fromCharCode(p)).join("")}"`}`),this._logService.logLevel===0&&this._logService.trace("parsing data (codes)",typeof e=="string"?e.split("").map(p=>p.charCodeAt(0)):e),this._parseBuffer.length<e.length&&this._parseBuffer.length<cr&&(this._parseBuffer=new Uint32Array(Math.min(e.length,cr))),h||this._dirtyRowTracker.clearRange(),e.length>cr)for(let p=c;p<e.length;p+=cr){let b=p+cr<e.length?p+cr:e.length,y=typeof e=="string"?this._stringDecoder.decode(e.substring(p,b),this._parseBuffer):this._utf8Decoder.decode(e.subarray(p,b),this._parseBuffer);if(n=this._parser.parse(this._parseBuffer,y))return this._preserveStack(a,o,y,p),this._logSlowResolvingAsync(n),n}else if(!h){let p=typeof e=="string"?this._stringDecoder.decode(e,this._parseBuffer):this._utf8Decoder.decode(e,this._parseBuffer);if(n=this._parser.parse(this._parseBuffer,p))return this._preserveStack(a,o,p,0),this._logSlowResolvingAsync(n),n}(this._activeBuffer.x!==a||this._activeBuffer.y!==o)&&this._onCursorMove.fire();let f=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),_=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);_<this._bufferService.rows&&this._onRequestRefreshRows.fire({start:Math.min(_,this._bufferService.rows-1),end:Math.min(f,this._bufferService.rows-1)})}print(e,t,n){let a,o,c=this._charsetService.charset,h=this._optionsService.rawOptions.screenReaderMode,f=this._bufferService.cols,_=this._coreService.decPrivateModes.wraparound,p=this._coreService.modes.insertMode,b=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,b);let w=this._parser.precedingJoinState;for(let x=t;x<n;++x){if(a=e[x],a<127&&c){let T=c[String.fromCharCode(a)];T&&(a=T.charCodeAt(0))}let C=this._unicodeService.charProperties(a,w);o=Xr.extractWidth(C);let E=Xr.extractShouldJoin(C),B=E?Xr.extractWidth(w):0;if(w=C,h&&this._onA11yChar.fire(dr(a)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+o-B>f){if(_){let T=y,Y=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 co&&y.copyCellsFrom(T,Y,0,B,!1);Y<f;)T.setCellFromCodepoint(Y++,0,1,b)}else if(this._activeBuffer.x=f-1,o===2)continue}if(E&&this._activeBuffer.x){let T=y.getWidth(this._activeBuffer.x-1)?1:2;y.addCodepointToCell(this._activeBuffer.x-T,a,o);for(let Y=o-B;--Y>=0;)y.setCellFromCodepoint(this._activeBuffer.x++,0,0,b);continue}if(p&&(y.insertCells(this._activeBuffer.x,o-B,this._activeBuffer.getNullCell(b)),y.getWidth(f-1)===2&&y.setCellFromCodepoint(f-1,0,1,b)),y.setCellFromCodepoint(this._activeBuffer.x++,a,o,b),o>0)for(;--o;)y.setCellFromCodepoint(this._activeBuffer.x++,0,0,b)}this._parser.precedingJoinState=w,this._activeBuffer.x<f&&n-t>0&&y.getWidth(this._activeBuffer.x)===0&&!y.hasContent(this._activeBuffer.x)&&y.setCellFromCodepoint(this._activeBuffer.x,0,1,b),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(e,t){return e.final==="t"&&!e.prefix&&!e.intermediates?this._parser.registerCsiHandler(e,n=>lS(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 ys(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(ei));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=Xr.extractWidth(t),o=this._activeBuffer.x-a,c=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(o),h=new Uint32Array(c.length*n),f=0;for(let p=0;p<c.length;){let b=c.codePointAt(p)||0;h[f++]=b,p+=b>65535?2:1}let _=f;for(let p=1;p<n;++p)h.copyWithin(_,0,f),_+=f;return this.print(h,0,_),!0}sendDeviceAttributesPrimary(e){return e.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(ue.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(ue.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(e){return e.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(ue.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(ue.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(e.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(ue.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,Vr),this._charsetService.setgCharset(1,Vr),this._charsetService.setgCharset(2,Vr),this._charsetService.setgCharset(3,Vr);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;(E=>(E[E.NOT_RECOGNIZED=0]="NOT_RECOGNIZED",E[E.SET=1]="SET",E[E.RESET=2]="RESET",E[E.PERMANENTLY_SET=3]="PERMANENTLY_SET",E[E.PERMANENTLY_RESET=4]="PERMANENTLY_RESET"))(n||={});let a=this._coreService.decPrivateModes,{activeProtocol:o,activeEncoding:c}=this._coreMouseService,h=this._coreService,{buffers:f,cols:_}=this._bufferService,{active:p,alt:b}=f,y=this._optionsService.rawOptions,w=(E,B)=>(h.triggerDataEvent(`${ue.ESC}[${t?"":"?"}${E};${B}$y`),!0),x=E=>E?1:2,C=e.params[0];return t?C===2?w(C,4):C===4?w(C,x(h.modes.insertMode)):C===12?w(C,3):C===20?w(C,x(y.convertEol)):w(C,0):C===1?w(C,x(a.applicationCursorKeys)):C===3?w(C,y.windowOptions.setWinLines?_===80?2:_===132?1:0:0):C===6?w(C,x(a.origin)):C===7?w(C,x(a.wraparound)):C===8?w(C,3):C===9?w(C,x(o==="X10")):C===12?w(C,x(y.cursorBlink)):C===25?w(C,x(!h.isCursorHidden)):C===45?w(C,x(a.reverseWraparound)):C===66?w(C,x(a.applicationKeypad)):C===67?w(C,4):C===1e3?w(C,x(o==="VT200")):C===1002?w(C,x(o==="DRAG")):C===1003?w(C,x(o==="ANY")):C===1004?w(C,x(a.sendFocus)):C===1005?w(C,4):C===1006?w(C,x(c==="SGR")):C===1015?w(C,4):C===1016?w(C,x(c==="SGR_PIXELS")):C===1048?w(C,1):C===47||C===1047||C===1049?w(C,x(p===b)):C===2004?w(C,x(a.bracketedPasteMode)):C===2026?w(C,x(a.synchronizedOutput)):w(C,0)}_updateAttrColor(e,t,n,a,o){return t===2?(e|=50331648,e&=-16777216,e|=Ho.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 h=e.getSubParams(t+c),f=0;do a[1]===5&&(o=1),a[c+f+1+o]=h[f];while(++f<h.length&&f+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 h=2;h<a.length;++h)a[h]===-1&&(a[h]=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=ei.fg,e.bg=ei.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|=ei.fg&16777215):n===49?(a.bg&=-67108864,a.bg|=ei.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|=ei.fg&16777215,a.bg&=-67108864,a.bg|=ei.bg&16777215):this._logService.debug("Unknown SGR attribute: %d.",n);return!0}deviceStatus(e){switch(e.params[0]){case 5:this._coreService.triggerDataEvent(`${ue.ESC}[0n`);break;case 6:let t=this._activeBuffer.y+1,n=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${ue.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(`${ue.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=ei.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(!lS(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(`${ue.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:(t===0||t===2)&&(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>aS&&this._windowTitleStack.shift()),(t===0||t===1)&&(this._iconNameStack.push(this._iconName),this._iconNameStack.length>aS&&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(uS(c))if(o==="?")t.push({type:0,index:c});else{let h=rS(o);h&&t.push({type:1,index:c,color:h})}}}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=rS(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]);uS(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,Vr),!0}selectCharset(e){return e.length!==2?(this.selectDefaultCharset(),!0):(e[0]==="/"||this._charsetService.setgCharset(JD[e[0]],di[e[1]]||Vr),!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=ei.clone(),this._eraseAttrDataInternal=ei.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 Us;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=h=>(this._coreService.triggerDataEvent(`${ue.ESC}${h}${ue.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)}},Wp=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&&(cS=e,e=t,t=cS),e<this.start&&(this.start=e),t>this.end&&(this.end=t)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};Wp=Pt([ye(0,Yi)],Wp);function uS(e){return 0<=e&&e<256}var tR=5e7,hS=12,iR=50,sR=class extends Ge{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 ge),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>tR)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 h=f=>performance.now()-n>=hS?setTimeout(()=>this._innerWrite(0,f)):this._innerWrite(n,f);o.catch(f=>(queueMicrotask(()=>{throw f}),Promise.resolve(!1))).then(h);return}let c=this._callbacks[this._bufferOffset];if(c&&c(),this._bufferOffset++,this._pendingData-=a.length,performance.now()-n>=hS)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>iR&&(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()}},$p=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 f=t.addMarker(t.ybase+t.y),_={data:e,id:this._nextId++,lines:[f]};return f.onDispose(()=>this._removeMarkerFromLink(_,f)),this._dataByLinkId.set(_.id,_),_.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),h={id:this._nextId++,key:this._getEntryIdKey(n),data:n,lines:[c]};return c.onDispose(()=>this._removeMarkerFromLink(h,c)),this._entriesWithId.set(h.key,h),this._dataByLinkId.set(h.id,h),h.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)))}};$p=Pt([ye(0,Yi)],$p);var dS=!1,nR=class extends Ge{constructor(e){super(),this._windowsWrappingHeuristics=this._register(new Ga),this._onBinary=this._register(new ge),this.onBinary=this._onBinary.event,this._onData=this._register(new ge),this.onData=this._onData.event,this._onLineFeed=this._register(new ge),this.onLineFeed=this._onLineFeed.event,this._onResize=this._register(new ge),this.onResize=this._onResize.event,this._onWriteParsed=this._register(new ge),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this._register(new ge),this._instantiationService=new DD,this.optionsService=this._register(new HD(e)),this._instantiationService.setService(Vi,this.optionsService),this._bufferService=this._register(this._instantiationService.createInstance(Kp)),this._instantiationService.setService(Yi,this._bufferService),this._logService=this._register(this._instantiationService.createInstance(Pp)),this._instantiationService.setService(J0,this._logService),this.coreService=this._register(this._instantiationService.createInstance(Ip)),this._instantiationService.setService(ia,this.coreService),this.coreMouseService=this._register(this._instantiationService.createInstance(Fp)),this._instantiationService.setService(Q0,this.coreMouseService),this.unicodeService=this._register(this._instantiationService.createInstance(Xr)),this._instantiationService.setService(xT,this.unicodeService),this._charsetService=this._instantiationService.createInstance(FD),this._instantiationService.setService(CT,this._charsetService),this._oscLinkService=this._instantiationService.createInstance($p),this._instantiationService.setService(ew,this._oscLinkService),this._inputHandler=this._register(new eR(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this._register(Ai.forward(this._inputHandler.onLineFeed,this._onLineFeed)),this._register(this._inputHandler),this._register(Ai.forward(this._bufferService.onResize,this._onResize)),this._register(Ai.forward(this.coreService.onData,this._onData)),this._register(Ai.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 sR((t,n)=>this._inputHandler.parse(t,n))),this._register(Ai.forward(this._writeBuffer.onWriteParsed,this._onWriteParsed))}get onScroll(){return this._onScrollApi||(this._onScrollApi=this._register(new ge),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&&!dS&&(this._logService.warn("writeSync is unreliable and will be removed soon."),dS=!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,Aw),t=Math.max(t,Lw),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(sS.bind(null,this._bufferService))),e.push(this.registerCsiHandler({final:"H"},()=>(sS(this._bufferService),!1))),this._windowsWrappingHeuristics.value=Mt(()=>{for(let t of e)t.dispose()})}}},rR={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 aR(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=ue.ESC+"OA":o.key=ue.ESC+"[A":e.key==="UIKeyInputLeftArrow"?t?o.key=ue.ESC+"OD":o.key=ue.ESC+"[D":e.key==="UIKeyInputRightArrow"?t?o.key=ue.ESC+"OC":o.key=ue.ESC+"[C":e.key==="UIKeyInputDownArrow"&&(t?o.key=ue.ESC+"OB":o.key=ue.ESC+"[B");break;case 8:o.key=e.ctrlKey?"\b":ue.DEL,e.altKey&&(o.key=ue.ESC+o.key);break;case 9:if(e.shiftKey){o.key=ue.ESC+"[Z";break}o.key=ue.HT,o.cancel=!0;break;case 13:o.key=e.altKey?ue.ESC+ue.CR:ue.CR,o.cancel=!0;break;case 27:o.key=ue.ESC,e.altKey&&(o.key=ue.ESC+ue.ESC),o.cancel=!0;break;case 37:if(e.metaKey)break;c?o.key=ue.ESC+"[1;"+(c+1)+"D":t?o.key=ue.ESC+"OD":o.key=ue.ESC+"[D";break;case 39:if(e.metaKey)break;c?o.key=ue.ESC+"[1;"+(c+1)+"C":t?o.key=ue.ESC+"OC":o.key=ue.ESC+"[C";break;case 38:if(e.metaKey)break;c?o.key=ue.ESC+"[1;"+(c+1)+"A":t?o.key=ue.ESC+"OA":o.key=ue.ESC+"[A";break;case 40:if(e.metaKey)break;c?o.key=ue.ESC+"[1;"+(c+1)+"B":t?o.key=ue.ESC+"OB":o.key=ue.ESC+"[B";break;case 45:!e.shiftKey&&!e.ctrlKey&&(o.key=ue.ESC+"[2~");break;case 46:c?o.key=ue.ESC+"[3;"+(c+1)+"~":o.key=ue.ESC+"[3~";break;case 36:c?o.key=ue.ESC+"[1;"+(c+1)+"H":t?o.key=ue.ESC+"OH":o.key=ue.ESC+"[H";break;case 35:c?o.key=ue.ESC+"[1;"+(c+1)+"F":t?o.key=ue.ESC+"OF":o.key=ue.ESC+"[F";break;case 33:e.shiftKey?o.type=2:e.ctrlKey?o.key=ue.ESC+"[5;"+(c+1)+"~":o.key=ue.ESC+"[5~";break;case 34:e.shiftKey?o.type=3:e.ctrlKey?o.key=ue.ESC+"[6;"+(c+1)+"~":o.key=ue.ESC+"[6~";break;case 112:c?o.key=ue.ESC+"[1;"+(c+1)+"P":o.key=ue.ESC+"OP";break;case 113:c?o.key=ue.ESC+"[1;"+(c+1)+"Q":o.key=ue.ESC+"OQ";break;case 114:c?o.key=ue.ESC+"[1;"+(c+1)+"R":o.key=ue.ESC+"OR";break;case 115:c?o.key=ue.ESC+"[1;"+(c+1)+"S":o.key=ue.ESC+"OS";break;case 116:c?o.key=ue.ESC+"[15;"+(c+1)+"~":o.key=ue.ESC+"[15~";break;case 117:c?o.key=ue.ESC+"[17;"+(c+1)+"~":o.key=ue.ESC+"[17~";break;case 118:c?o.key=ue.ESC+"[18;"+(c+1)+"~":o.key=ue.ESC+"[18~";break;case 119:c?o.key=ue.ESC+"[19;"+(c+1)+"~":o.key=ue.ESC+"[19~";break;case 120:c?o.key=ue.ESC+"[20;"+(c+1)+"~":o.key=ue.ESC+"[20~";break;case 121:c?o.key=ue.ESC+"[21;"+(c+1)+"~":o.key=ue.ESC+"[21~";break;case 122:c?o.key=ue.ESC+"[23;"+(c+1)+"~":o.key=ue.ESC+"[23~";break;case 123:c?o.key=ue.ESC+"[24;"+(c+1)+"~":o.key=ue.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=ue.NUL:e.keyCode>=51&&e.keyCode<=55?o.key=String.fromCharCode(e.keyCode-51+27):e.keyCode===56?o.key=ue.DEL:e.keyCode===219?o.key=ue.ESC:e.keyCode===220?o.key=ue.FS:e.keyCode===221&&(o.key=ue.GS);else if((!n||a)&&e.altKey&&!e.metaKey){let h=rR[e.keyCode]?.[e.shiftKey?1:0];if(h)o.key=ue.ESC+h;else if(e.keyCode>=65&&e.keyCode<=90){let f=e.ctrlKey?e.keyCode-64:e.keyCode+32,_=String.fromCharCode(f);e.shiftKey&&(_=_.toUpperCase()),o.key=ue.ESC+_}else if(e.keyCode===32)o.key=ue.ESC+(e.ctrlKey?ue.NUL:" ");else if(e.key==="Dead"&&e.code.startsWith("Key")){let f=e.code.slice(3,4);e.shiftKey||(f=f.toLowerCase()),o.key=ue.ESC+f,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=ue.US),e.key==="@"&&(o.key=ue.NUL));break}return o}var Wt=0,lR=class{constructor(e){this._getKey=e,this._array=[],this._insertedValues=[],this._flushInsertedTask=new zu,this._isFlushingInserted=!1,this._deletedIndices=[],this._flushDeletedTask=new zu,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||(Wt=this._search(t),Wt===-1)||this._getKey(this._array[Wt])!==t)return!1;do if(this._array[Wt]===e)return this._deletedIndices.length===0&&this._flushDeletedTask.enqueue(()=>this._flushDeleted()),this._deletedIndices.push(Wt),!0;while(++Wt<this._array.length&&this._getKey(this._array[Wt])===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&&(Wt=this._search(e),!(Wt<0||Wt>=this._array.length)&&this._getKey(this._array[Wt])===e))do yield this._array[Wt];while(++Wt<this._array.length&&this._getKey(this._array[Wt])===e)}forEachByKey(e,t){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(Wt=this._search(e),!(Wt<0||Wt>=this._array.length)&&this._getKey(this._array[Wt])===e))do t(this._array[Wt]);while(++Wt<this._array.length&&this._getKey(this._array[Wt])===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}},zf=0,fS=0,oR=class extends Ge{constructor(){super(),this._decorations=new lR(e=>e?.marker.line),this._onDecorationRegistered=this._register(new ge),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this._register(new ge),this.onDecorationRemoved=this._onDecorationRemoved.event,this._register(Mt(()=>this.reset()))}get decorations(){return this._decorations.values()}registerDecoration(e){if(e.marker.isDisposed)return;let t=new cR(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=>{zf=o.options.x??0,fS=zf+(o.options.width??1),e>=zf&&e<fS&&(!n||(o.options.layer??"bottom")===n)&&a(o)})}},cR=class extends mr{constructor(e){super(),this.options=e,this.onRenderEmitter=this.add(new ge),this.onRender=this.onRenderEmitter.event,this._onDispose=this.add(new ge),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=Lt.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this.options.foregroundColor?this._cachedFg=Lt.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}dispose(){this._onDispose.fire(),super.dispose()}},uR=1e3,hR=class{constructor(e,t=uR){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)}},pS=20,ju=class extends Ge{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 hR(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(`
|
|
28
|
+
`))),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(He(o,"selectionchange",()=>this._handleSelectionChange())),this._register(this._coreBrowserService.onDprChange(()=>this._refreshRowsDimensions())),this._refreshRowsDimensions(),this._refreshRows(),this._register(Mt(()=>{this._accessibilityContainer.remove(),this._rowElements.length=0}))}_handleTab(e){for(let t=0;t<e;t++)this._handleChar(" ")}_handleChar(e){this._liveRegionLineCount<pS+1&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==e&&(this._charsToAnnounce+=e):this._charsToAnnounce+=e,e===`
|
|
29
|
+
`&&(this._liveRegionLineCount++,this._liveRegionLineCount===pS+1&&(this._liveRegion.textContent+=dp.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),h=[],f=c?.translateToString(!0,void 0,void 0,h)||"",_=(n.ydisp+o+1).toString(),p=this._rowElements[o];p&&(f.length===0?(p.textContent=" ",this._rowColumns.set(p,[0,1])):(p.textContent=f,this._rowColumns.set(p,h)),p.setAttribute("aria-posinset",_),p.setAttribute("aria-setsize",a),this._alignRowWidth(p))}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 h,f;if(t===0?(h=n,f=this._rowElements.pop(),this._rowContainer.removeChild(f)):(h=this._rowElements.shift(),f=n,this._rowContainer.removeChild(h)),h.removeEventListener("focus",this._topBoundaryFocusListener),f.removeEventListener("focus",this._bottomBoundaryFocusListener),t===0){let _=this._createAccessibilityTreeNode();this._rowElements.unshift(_),this._rowContainer.insertAdjacentElement("afterbegin",_)}else{let _=this._createAccessibilityTreeNode();this._rowElements.push(_),this._rowContainer.appendChild(_)}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:f,offset:_})=>{let p=f instanceof Text?f.parentNode:f,b=parseInt(p?.getAttribute("aria-posinset"),10)-1;if(isNaN(b))return console.warn("row is invalid. Race condition?"),null;let y=this._rowColumns.get(p);if(!y)return console.warn("columns is null. Race condition?"),null;let w=_<y.length?y[_]:y.slice(-1)[0]+1;return w>=this._terminal.cols&&(++b,w=0),{row:b,column:w}},c=o(t),h=o(n);if(!(!c||!h)){if(c.row>h.row||c.row===h.row&&c.column>=h.column)throw new Error("invalid range");this._terminal.select(c.column,c.row,(h.row-c.row)*this._terminal.cols-c.column+h.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})`}};ju=Pt([ye(1,Fm),ye(2,Ln),ye(3,Bn)],ju);var Yp=class extends Ge{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 ge),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this._register(new ge),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this._register(Mt(()=>{ea(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(He(this._element,"mouseleave",()=>{this._isMouseOut=!0,this._clearCurrentLink()})),this._register(He(this._element,"mousemove",this._handleMouseMove.bind(this))),this._register(He(this._element,"mousedown",this._handleMouseDown.bind(this))),this._register(He(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 h=c?.map(f=>({link:f}));this._activeProviderReplies?.set(a,h),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 h=o[c],f=h.link.range.start.y<e?0:h.link.range.start.x,_=h.link.range.end.y>e?this._bufferService.cols:h.link.range.end.x;for(let p=f;p<=_;p++){if(n.has(p)){o.splice(c--,1);break}n.add(p)}}}}_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(h=>this._linkAtPosition(h.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 h=this._activeProviderReplies.get(c)?.find(f=>this._linkAtPosition(f.link,t));if(h){n=!0,this._handleNewLink(h);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&&dR(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,ea(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}}};Yp=Pt([ye(1,qm),ye(2,Bn),ye(3,Yi),ye(4,iw)],Yp);function dR(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 fR=class extends nR{constructor(e={}){super(e),this._linkifier=this._register(new Ga),this.browser=Sw,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this._register(new Ga),this._onCursorMove=this._register(new ge),this.onCursorMove=this._onCursorMove.event,this._onKey=this._register(new ge),this.onKey=this._onKey.event,this._onRender=this._register(new ge),this.onRender=this._onRender.event,this._onSelectionChange=this._register(new ge),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this._register(new ge),this.onTitleChange=this._onTitleChange.event,this._onBell=this._register(new ge),this.onBell=this._onBell.event,this._onFocus=this._register(new ge),this._onBlur=this._register(new ge),this._onA11yCharEmitter=this._register(new ge),this._onA11yTabEmitter=this._register(new ge),this._onWillOpen=this._register(new ge),this._setup(),this._decorationService=this._instantiationService.createInstance(oR),this._instantiationService.setService(Uo,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(iD),this._instantiationService.setService(iw,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(pp)),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(Ai.forward(this._inputHandler.onCursorMove,this._onCursorMove)),this._register(Ai.forward(this._inputHandler.onTitleChange,this._onTitleChange)),this._register(Ai.forward(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this._register(Ai.forward(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this._register(this._bufferService.onResize(t=>this._afterResize(t.cols,t.rows))),this._register(Mt(()=>{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=Tt.toColorRGB(n==="ansi"?this._themeService.colors.ansi[t.index]:this._themeService.colors[n]);this.coreService.triggerDataEvent(`${ue.ESC}]${a};${QD(o)}${yw.ST}`);break;case 1:if(n==="ansi")this._themeService.modifyColors(c=>c.ansi[t.index]=ti.toColor(...t.color));else{let c=n;this._themeService.modifyColors(h=>h[c]=ti.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(ju,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(e){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(ue.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(ue.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,h=this.buffer.y*this._renderService.dimensions.css.cell.height,f=n*this._renderService.dimensions.css.cell.width;this.textarea.style.left=f+"px",this.textarea.style.top=h+"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(He(this.element,"copy",t=>{this.hasSelection()&&gT(t,this._selectionService)}));let e=t=>vT(t,this.textarea,this.coreService,this.optionsService);this._register(He(this.textarea,"paste",e)),this._register(He(this.element,"paste",e)),ww?this._register(He(this.element,"mousedown",t=>{t.button===2&&xb(t,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})):this._register(He(this.element,"contextmenu",t=>{xb(t,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})),Qm&&this._register(He(this.element,"auxclick",t=>{t.button===1&&Y0(t,this.textarea,this.screenElement)}))}_bindKeys(){this._register(He(this.textarea,"keyup",e=>this._keyUp(e),!0)),this._register(He(this.textarea,"keydown",e=>this._keyDown(e),!0)),this._register(He(this.textarea,"keypress",e=>this._keyPress(e),!0)),this._register(He(this.textarea,"compositionstart",()=>this._compositionHelper.compositionstart())),this._register(He(this.textarea,"compositionupdate",e=>this._compositionHelper.compositionupdate(e))),this._register(He(this.textarea,"compositionend",()=>this._compositionHelper.compositionend())),this._register(He(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(He(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",hp.get()),Ew||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(eD,this.textarea,e.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(Ln,this._coreBrowserService),this._register(He(this.textarea,"focus",o=>this._handleTextAreaFocus(o))),this._register(He(this.textarea,"blur",()=>this._handleTextAreaBlur())),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(Op,this._document,this._helperContainer),this._instantiationService.setService(Zu,this._charSizeService),this._themeService=this._instantiationService.createInstance(Up),this._instantiationService.setService(tl,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(Bu),this._instantiationService.setService(tw,this._characterJoinerService),this._renderService=this._register(this._instantiationService.createInstance(jp,this.rows,this.screenElement)),this._instantiationService.setService(Bn,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(Ap,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(zp),this._instantiationService.setService(qm,this._mouseService);let a=this._linkifier.value=this._register(this._instantiationService.createInstance(Yp,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(Mp,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(Hp,this.element,this.screenElement,a)),this._instantiationService.setService(TT,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(Ai.any(this._onScroll.event,this._inputHandler.onScroll)(()=>{this._selectionService.refresh(),this._viewport?.queueSync()})),this._register(this._instantiationService.createInstance(Np,this.screenElement)),this._register(He(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(ju,this)),this._register(this.optionsService.onSpecificOptionChange("screenReaderMode",o=>this._handleScreenReaderModeOptionChange(o))),this.options.overviewRuler.width&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(Lu,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRuler",o=>{!this._overviewRulerRenderer&&o&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(Lu,this._viewportElement,this.screenElement)))}),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(Bp,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){let e=this,t=this.element;function n(c){let h=e._mouseService.getMouseReportCoords(c,e.screenElement);if(!h)return!1;let f,_;switch(c.overrideType||c.type){case"mousemove":_=32,c.buttons===void 0?(f=3,c.button!==void 0&&(f=c.button<3?c.button:3)):f=c.buttons&1?0:c.buttons&4?1:c.buttons&2?2:3;break;case"mouseup":_=0,f=c.button<3?c.button:3;break;case"mousedown":_=1,f=c.button<3?c.button:3;break;case"wheel":if(e._customWheelEventHandler&&e._customWheelEventHandler(c)===!1)return!1;let p=c.deltaY;if(p===0||e.coreMouseService.consumeWheelEvent(c,e._renderService?.dimensions?.device?.cell?.height,e._coreBrowserService?.dpr)===0)return!1;_=p<0?0:1,f=4;break;default:return!1}return _===void 0||f===void 0||f>4?!1:e.coreMouseService.triggerMouseEvent({col:h.col,row:h.row,x:h.x,y:h.y,button:f,action:_,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(He(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(He(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 h=ue.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(c.deltaY<0?"A":"B");return this.coreService.triggerDataEvent(h,!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){$0(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=aR(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===ue.ETX||n.key===ue.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)&&(pR(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(ei));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(ue.ESC+"[I"):this.coreService.triggerDataEvent(ue.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(`${ue.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(`${ue.ESC}[6;${o};${a}t`);break}}cancel(e,t){if(!(!this.options.cancelEvents&&!t))return e.preventDefault(),e.stopPropagation(),!1}};function pR(e){return e.keyCode===16||e.keyCode===17||e.keyCode===18}var mR=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)}},_R=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 Us)}translateToString(e,t,n){return this._line.translateToString(e,t,n)}},mS=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 _R(t)}getNullCell(){return new Us}},gR=class extends Ge{constructor(e){super(),this._core=e,this._onBufferChange=this._register(new ge),this.onBufferChange=this._onBufferChange.event,this._normal=new mS(this._core.buffers.normal,"normal"),this._alternate=new mS(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)}},vR=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)}},yR=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}},bR=["cols","rows"],sn=0,SR=class extends Ge{constructor(e){super(),this._core=this._register(new fR(e)),this._addonManager=this._register(new mR),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(bR.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 vR(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new yR(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 gR(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
|
|
30
|
+
`,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 hp.get()},set promptLabel(e){hp.set(e)},get tooMuchOutput(){return dp.get()},set tooMuchOutput(e){dp.set(e)}}}_verifyIntegers(...e){for(sn of e)if(sn===1/0||isNaN(sn)||sn%1!==0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...e){for(sn of e)if(sn&&(sn===1/0||isNaN(sn)||sn%1!==0||sn<0))throw new Error("This API only accepts positive integers")}};class wR{pending=null;accept(t){let n="";for(const a of t)n+=this.acceptChar(a);return n}acceptChar(t){return t===""?this.acceptBackspace():Hw.has(t)?this.acceptConsonant(t):Uw.has(t)?this.acceptVowel(t):TR(t)&&this.canReplacePendingWith(t)?(this.pending=gS(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(Pw.has(t))return this.pending.final=t,"";const o=this.flushPending();return this.pending={initial:t},o}const n=ER.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=xR.get(`${this.pending.vowel}${t}`);return c?(this.pending.vowel=c,""):this.flushPending()+t}const n=_S.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=vS({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=_S.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=gS(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=vS(this.pending);return this.pending=null,t}}const Hu=44032,Uu=21,Ia=28,CR=19*Uu*Ia,Ow=["ㄱ","ㄲ","ㄴ","ㄷ","ㄸ","ㄹ","ㅁ","ㅂ","ㅃ","ㅅ","ㅆ","ㅇ","ㅈ","ㅉ","ㅊ","ㅋ","ㅌ","ㅍ","ㅎ"],zw=["ㅏ","ㅐ","ㅑ","ㅒ","ㅓ","ㅔ","ㅕ","ㅖ","ㅗ","ㅘ","ㅙ","ㅚ","ㅛ","ㅜ","ㅝ","ㅞ","ㅟ","ㅠ","ㅡ","ㅢ","ㅣ"],jw=["","ㄱ","ㄲ","ㄳ","ㄴ","ㄵ","ㄶ","ㄷ","ㄹ","ㄺ","ㄻ","ㄼ","ㄽ","ㄾ","ㄿ","ㅀ","ㅁ","ㅂ","ㅄ","ㅅ","ㅆ","ㅇ","ㅈ","ㅊ","ㅋ","ㅌ","ㅍ","ㅎ"],Hw=Jm(Ow),Uw=Jm(zw),Pw=Jm(jw),xR=new Map([["ㅗㅏ","ㅘ"],["ㅗㅐ","ㅙ"],["ㅗㅣ","ㅚ"],["ㅜㅓ","ㅝ"],["ㅜㅔ","ㅞ"],["ㅜㅣ","ㅟ"],["ㅡㅣ","ㅢ"]]),Kw=[["ㄱㅅ","ㄳ"],["ㄴㅈ","ㄵ"],["ㄴㅎ","ㄶ"],["ㄹㄱ","ㄺ"],["ㄹㅁ","ㄻ"],["ㄹㅂ","ㄼ"],["ㄹㅅ","ㄽ"],["ㄹㅌ","ㄾ"],["ㄹㅍ","ㄿ"],["ㄹㅎ","ㅀ"],["ㅂㅅ","ㅄ"]],ER=new Map(Kw),_S=new Map(Kw.map(([e,t])=>[t,[e[0],e[1]]]));function Jm(e){return new Map(e.map((t,n)=>[t,n]))}function TR(e){const t=e.codePointAt(0);return t!==void 0&&t>=Hu&&t<Hu+CR}function gS(e){const t=e.codePointAt(0)-Hu,n=Math.floor(t/(Uu*Ia)),a=Math.floor(t%(Uu*Ia)/Ia),o=t%Ia,c={initial:Ow[n],vowel:zw[a]};return o===0?c:{...c,final:jw[o]}}function vS(e){if(!e.vowel)return e.initial;const t=Hw.get(e.initial),n=Uw.get(e.vowel),a=e.final?Pw.get(e.final):0;return t===void 0||n===void 0||a===void 0?`${e.initial}${e.vowel}${e.final??""}`:String.fromCodePoint(Hu+(t*Uu+n)*Ia+a)}const kR=[{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 DR({ctrlActive:e,onCtrl:t,onStandaloneKey:n,onPreserveFocus:a,onHide:o}){function c(h){h.stopPropagation(),a()}return m.jsxs("div",{className:"mobile-terminal-key-bar",role:"toolbar","aria-label":"Mobile terminal keys",onMouseDown:c,onPointerDown:c,children:[m.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"}),kR.map(h=>m.jsx("button",{type:"button",className:"mobile-terminal-key","aria-label":h.ariaLabel,onClick:()=>n(h.key),children:h.label},h.key)),m.jsx("button",{type:"button",className:"mobile-terminal-key mobile-terminal-key-hide","aria-label":"Hide terminal control keys",title:"Hide",onClick:o,children:"×"})]})}const RR={escape:"\x1B",tab:" ",arrowUp:"\x1B[A",arrowDown:"\x1B[B",arrowRight:"\x1B[C",arrowLeft:"\x1B[D"};function MR(e){return RR[e]}function NR(e){return/^[a-z]$/i.test(e)?String.fromCharCode(e.toUpperCase().charCodeAt(0)-64):null}const yS="--nterminal-viewport-height",bS="--nterminal-keyboard-inset-bottom",SS="data-nterminal-keyboard-visible",e_="data-nterminal-compose-open",Vp="nterminal:viewport-refresh",AR=120;function LR(e=window){const t=e.document.documentElement,n=e.visualViewport;function a(){const o=BR(e);o!==null&&t.style.setProperty(yS,`${o}px`),t.style.setProperty(bS,`${Iw(e)}px`),t.setAttribute(SS,String(OR(e)))}return a(),n?.addEventListener("resize",a),n?.addEventListener("scroll",a),e.addEventListener("resize",a),e.addEventListener(Vp,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(Vp,a),e.removeEventListener("orientationchange",a),e.removeEventListener("pageshow",a),e.document.removeEventListener("visibilitychange",a),t.style.removeProperty(yS),t.style.removeProperty(bS),t.removeAttribute(SS)}}function BR(e){if(e.document.documentElement.hasAttribute(e_)&&So(e.innerHeight))return e.innerHeight;const t=e.visualViewport?.height;return So(t)?t:So(e.innerHeight)?e.innerHeight:null}function So(e){return typeof e=="number"&&Number.isFinite(e)&&e>0}function OR(e){return Iw(e)>AR}function Iw(e){const t=e.visualViewport?.height;if(!So(t)||!So(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))}const Io=new Map,Ro=new Map,zR=Object.freeze({open:!1,text:""});function jR(e){let t=Ro.get(e);return t||(t=new Set,Ro.set(e,t)),t}function Fw(e){const t=Ro.get(e);if(t)for(const n of Array.from(t))n()}function t_(e){return Io.get(e)??zR}function HR(e,t){const n=jR(e);return n.add(t),()=>{n.delete(t)}}function UR(e,t){const n=t_(e);n.open!==t&&(Io.set(e,{...n,open:t}),Fw(e))}function PR(e,t){const n=t_(e);n.text!==t&&(Io.set(e,{...n,text:t}),Fw(e))}function wS(e){Io.delete(e),Ro.delete(e)}function KR(){Io.clear(),Ro.clear()}const CS=120,IR=420,bu=new Set;let $a=null;function FR({terminalId:e,onSubmit:t,disabled:n=!1}){const a=v.useMemo(()=>E=>HR(e,E),[e]),o=v.useMemo(()=>()=>t_(e),[e]),c=v.useSyncExternalStore(a,o,o),{open:h,text:f}=c,_=v.useRef(null),p=v.useRef(null),b=v.useRef(null);v.useLayoutEffect(()=>{if(!(!h||!Xp()))return WR(e),()=>$R(e)},[h,e]),v.useLayoutEffect(()=>{const E=_.current?.closest(".terminal-pane");if(!E)return;function B(){E?.removeAttribute("data-compose-open"),E?.style.removeProperty("--compose-drawer-panel-height")}if(!h){B();return}const T=p.current;E.setAttribute("data-compose-open","true");function Y(){const te=T?.getBoundingClientRect().height??0;te>0&&E?.style.setProperty("--compose-drawer-panel-height",`${Math.ceil(te)}px`)}Y();const P=[window.setTimeout(Y,0),window.setTimeout(Y,180),window.setTimeout(Y,260)],X=window.requestAnimationFrame?.(Y)??null,ee=typeof ResizeObserver=="function"&&T?new ResizeObserver(Y):null;return ee&&T&&ee.observe(T),()=>{for(const te of P)window.clearTimeout(te);X!==null&&window.cancelAnimationFrame?.(X),ee?.disconnect(),B()}},[h]),v.useEffect(()=>{h&&b.current?.focus()},[h]);function y(E){UR(e,E)}function w(E){PR(e,E)}function x(){qR(_.current),y(!1),xS()}function C(){if(n||!f)return;const E=f.replace(/\r\n/g,`
|
|
31
|
+
`).replace(/\n/g,"\r");if(E&&t(E),window.setTimeout(()=>t("\r"),CS),w(""),Xp()){b.current?.blur(),xS();return}window.setTimeout(()=>b.current?.focus(),CS+20)}return m.jsxs("div",{ref:_,className:"compose-drawer","data-open":h?"true":"false",children:[m.jsxs("button",{type:"button",className:"compose-drawer-handle","aria-label":"Open compose drawer","aria-hidden":h?"true":void 0,tabIndex:h?-1:0,title:"Compose long input — type without per-keystroke latency, send with Cmd/Ctrl+Enter",onClick:()=>y(!0),children:[m.jsx("span",{"aria-hidden":"true",children:"▴"}),m.jsx("span",{children:"compose"}),f?m.jsx("span",{className:"compose-drawer-handle-dot","aria-label":"draft saved"}):null]}),m.jsxs("div",{ref:p,className:"compose-drawer-panel","aria-hidden":h?void 0:"true",children:[m.jsxs("button",{type:"button",className:"compose-drawer-header","aria-label":"Collapse compose drawer",tabIndex:h?0:-1,title:"Click to collapse — Esc also closes when focus is in the textarea",onClick:x,children:[m.jsx("span",{"aria-hidden":"true",children:"▾"}),m.jsx("span",{className:"compose-drawer-title",children:"compose"}),m.jsx("span",{className:"compose-drawer-hint","aria-hidden":"true",children:"Cmd/Ctrl+Enter to send · Enter for newline · Esc to close"}),m.jsx("span",{className:"compose-drawer-close","aria-hidden":"true",children:"×"})]}),m.jsx("textarea",{ref:b,className:"compose-drawer-input","aria-label":"Compose input",tabIndex:h?0:-1,spellCheck:!1,autoCorrect:"off",autoCapitalize:"off",value:f,onChange:E=>w(E.target.value),onKeyDown:E=>{if(E.key==="Enter"&&(E.metaKey||E.ctrlKey)){E.preventDefault(),C();return}E.key==="Escape"&&(E.preventDefault(),x())},placeholder:"Type a longer command here, then Cmd/Ctrl+Enter to send."}),m.jsxs("div",{className:"compose-drawer-actions",children:[m.jsx("button",{type:"button",className:"compose-drawer-clear",tabIndex:h?0:-1,onClick:()=>{w(""),b.current?.focus()},disabled:!f,children:"Clear"}),m.jsx("button",{type:"button",className:"compose-drawer-send",tabIndex:h?0:-1,onClick:C,disabled:n||!f,children:"Send"})]})]})]})}function qR(e){const t=document.activeElement;t instanceof HTMLElement&&(!e||e.contains(t))&&t.blur()}function Xp(){return navigator.maxTouchPoints>0?!0:typeof window.matchMedia=="function"&&window.matchMedia("(pointer: coarse)").matches}function xS(){if(!Xp())return;const e=()=>{window.scrollTo(0,0),document.documentElement.scrollTop=0,document.body.scrollTop=0,Fa()};e(),window.requestAnimationFrame?.(e),window.setTimeout(e,120),window.setTimeout(e,320)}function WR(e){$a!==null&&(window.clearTimeout($a),$a=null),bu.add(e),document.documentElement.setAttribute(e_,"true"),Fa()}function $R(e){if(bu.delete(e),bu.size>0||$a!==null){Fa();return}$a=window.setTimeout(()=>{if($a=null,bu.size>0){Fa();return}document.documentElement.removeAttribute(e_),Fa()},IR),Fa()}function Fa(){window.dispatchEvent(new Event(Vp))}function YR(e){e.attachCustomKeyEventHandler(o=>{if(VR(o)){const c=ES(e);return c?(o.preventDefault(),o.stopPropagation(),TS(c),!1):!0}return XR(o)?(o.preventDefault(),o.stopPropagation(),GR(e),!1):!0});const t=e.element;if(!t)return{dispose(){e.attachCustomKeyEventHandler(()=>!0)}};const n=o=>{const c=ES(e);if(c){if(o.clipboardData){o.clipboardData.setData("text/plain",c),o.preventDefault();return}o.preventDefault(),TS(c)}},a=o=>{const c=o.clipboardData?.getData("text/plain");if(c===void 0)return;const h=qw(c);h!==c&&(o.preventDefault(),o.stopImmediatePropagation(),e.paste(h))};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 VR(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 XR(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 GR(e){if(navigator.clipboard?.readText)try{const t=await navigator.clipboard.readText();if(!t)return;e.paste(qw(t))}catch{}}function ES(e){return e.hasSelection()?e.getSelection():""}function qw(e){return e.replace(/(?:\r\n|\r|\n)+$/,"")}async function TS(e){if(navigator.clipboard?.writeText)try{await navigator.clipboard.writeText(e);return}catch{}ZR(e)}function ZR(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 QR=[4,10,11,12];function JR(e,t){const n=[e.parser.registerCsiHandler({final:"c"},a=>kS(a)),e.parser.registerCsiHandler({prefix:">",final:"c"},a=>kS(a)),e.parser.registerCsiHandler({final:"n"},a=>eM(a)),e.parser.registerCsiHandler({prefix:"?",final:"n"},a=>tM(a)),e.parser.registerCsiHandler({final:"t"},a=>iM(a)),e.parser.registerDcsHandler({intermediates:"$",final:"q"},()=>!0),...QR.map(a=>e.parser.registerOscHandler(a,o=>sM(o)))];return{dispose(){for(const a of n)a.dispose()}}}function kS(e){return eh(e)===0}function eM(e){const t=eh(e);return t===5||t===6}function tM(e){return eh(e)===6}function iM(e){const t=eh(e);return t===14||t===16||t===18}function sM(e){return e.split(";").some(t=>t==="?")}function eh(e){const t=e[0];return typeof t=="number"?t:0}const Za=new Map,nM=2*1024*1024,rM=1500,aM=25e3;function lM(e,t){let n=Za.get(e);n||(n=cM(e),Za.set(e,n),i_(n)),n.listeners.add(t);const a=c=>dM(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 Gp(e){const t=Za.get(e);t&&(fM(t),Za.delete(e))}function oM(e){const t=Za.get(e);if(!t)return!1;t.exited=!1,t.reconnectEnabled=!0,t.reconnectTimer!==null&&(window.clearTimeout(t.reconnectTimer),t.reconnectTimer=null),th(t);const n=t.socket;return t.socket=null,Pa(t,"reconnecting"),n&&(n.readyState===WebSocket.OPEN||n.readyState===WebSocket.CONNECTING)&&n.close(),i_(t),!0}function DS(){for(const e of Array.from(Za.keys()))Gp(e)}function cM(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 i_(e){if(!e.reconnectEnabled)return;Pa(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){Pa(e,"connected");for(const n of e.pendingOut)t.send(JSON.stringify(n));e.pendingOut.length=0,e.isAlive=!0,uM(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}hM(e,o),Ww(e,{type:"message",message:o})}}),t.addEventListener("close",n=>{if(e.socket===t){if(e.socket=null,th(e),n.code===1008){e.reconnectEnabled=!1,Pa(e,"unauthorized");return}if(e.exited||!e.reconnectEnabled){Pa(e,"closed");return}Pa(e,"reconnecting"),e.reconnectTimer=window.setTimeout(()=>{e.reconnectTimer=null,i_(e)},rM)}}),t.addEventListener("error",()=>{})}function uM(e){th(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)}))}},aM)}function th(e){e.heartbeat!==null&&(window.clearInterval(e.heartbeat),e.heartbeat=null)}function hM(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",RS(e);return}if(t.type==="output"){e.output.push(t.data),e.outputBytes+=t.data.length,RS(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 RS(e){for(;e.outputBytes>nM&&e.output.length>1;){const t=e.output.shift();e.outputBytes-=t.length}}function Pa(e,t){e.status!==t&&(e.status=t,Ww(e,{type:"status",status:t}))}function Ww(e,t){for(const n of Array.from(e.listeners))n(t)}function dM(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 fM(e){e.reconnectEnabled=!1,e.reconnectTimer!==null&&(window.clearTimeout(e.reconnectTimer),e.reconnectTimer=null),th(e);const t=e.socket;e.socket=null,t&&(t.readyState===WebSocket.OPEN||t.readyState===WebSocket.CONNECTING)&&t.close(),e.listeners.clear()}const pM=[0,50,150,350],mM=[300,1200,2500],MS=1e3,_M=1e5,Zp="\x1B[?1049l\x1B[?1047l\x1B[?47l",gM=new Set(["47","1047","1049"]),$w=400,vM=6,NS=[500,1500,3e3,5e3,8e3],yM=hi.lazy(()=>Im(()=>import("./TranscriptMarkdownBody-JBbhBMv8.js"),__vite__mapDeps([2,1])));function AS({terminal:e,serverApi:t,active:n,visible:a=!0,canClose:o,refreshCwdOnEnter:c=!1,tabId:h,onSelect:f,onClose:_,onExit:p,onSnapshot:b,onAuthClose:y}){const w=v.useSyncExternalStore(L0,np,()=>Gr),x=v.useSyncExternalStore(B0,rp,()=>Va),C=v.useSyncExternalStore(O0,lp,()=>!0),E=v.useSyncExternalStore(bm,_r,()=>Ya),B=v.useRef(null),T=v.useRef(null),Y=v.useRef(null),P=v.useRef(null),X=v.useRef({onExit:p,onSnapshot:b}),ee=v.useRef(t.createWebSocketUrl),te=v.useRef(y),se=v.useRef(null),le=v.useRef(new Map),de=v.useRef([]),N=v.useRef([]),U=v.useRef([]),K=v.useRef(0),j=v.useRef(!1),z=v.useRef(null),G=v.useRef(0),M=v.useRef(null),q=v.useRef(null),V=v.useRef(!1),_e=v.useRef(!1),be=v.useRef(!1),D=v.useRef(0),W=v.useRef(null),re=v.useRef(null),he=v.useRef(null),ve=v.useRef(null),pe=v.useRef(!1),ke=v.useRef(!1),me=v.useRef(!1),Se=v.useRef(!1),Me=v.useRef(!1),Ue=v.useRef(!1),Ke=v.useRef(!1),we=v.useRef(n),ie=v.useRef(a),De=v.useRef(c),Ce=v.useRef(w),Pe=v.useRef(x),$e=v.useRef(!1),St=v.useRef(null),dt=v.useRef(!1),wi=v.useRef(null),[,Q]=v.useState("connecting"),[Fe,Oe]=v.useState(!1),[kt,Ui]=v.useState(null),[Li,Yt]=v.useState(!1),[Xi,Bi]=v.useState(null),[Gi,Xs]=v.useState(!1),[ls,Kt]=v.useState(!1),[Ci,Bt]=v.useState(!1),[xi,Pi]=v.useState(null),[on,Ss]=v.useState(!1),ws=!!xi||Qp(e.currentCommand),[gt,wt]=v.useState(!1);v.useLayoutEffect(()=>{we.current=n},[n]),v.useLayoutEffect(()=>{ie.current=a},[a]),v.useLayoutEffect(()=>{De.current=c},[c]),v.useLayoutEffect(()=>{Ce.current=w},[w]),v.useLayoutEffect(()=>{Pe.current=x},[x]),v.useLayoutEffect(()=>{$e.current=on},[on]),v.useLayoutEffect(()=>{dt.current=ws},[ws]),v.useEffect(()=>{a&&n&&e.status==="running"&&(nt(),Ne())},[n,a,e.status]),v.useEffect(()=>{X.current={onExit:p,onSnapshot:b}},[p,b]),v.useEffect(()=>{ee.current=t.createWebSocketUrl,te.current=y},[t,y]),v.useEffect(()=>{let A=!1,oe=null,Le=0;const ze=MM(e.currentCommand);function Ye(){oe!==null&&(window.clearTimeout(oe),oe=null)}function st(){if(!ze||Le>=NS.length||A)return;const ai=NS[Le++];oe=window.setTimeout(()=>{oe=null,pi()},ai)}async function pi(){try{const ai=await t.getTerminalTranscriptSource(e.id);if(A)return;Pi(ai.source),ai.source||st()}catch(ai){if(A)return;Pi(null),jf(ai)&&st()}}return Pi(null),e.status!=="running"?()=>{A=!0,Ye()}:(pi(),()=>{A=!0,Ye()})},[t,e.currentCommand,e.id,e.status]),v.useEffect(()=>{const A=xi?`${e.id}:${xi.provider}:${xi.sessionId}`:null,oe=St.current;oe!==null&&oe!==A&&$e.current&&Ss(!1),St.current=A},[e.id,xi?.provider,xi?.sessionId]),v.useEffect(()=>{const A=T.current;A&&(A.options.disableStdin=e.status==="exited"),e.status==="exited"&&Q("closed")},[e.status]),v.useEffect(()=>{const A=T.current;A&&(A.options.fontSize=w,yf(w,Pe.current).then(()=>{Ce.current===w&&nt()}))},[w]),v.useEffect(()=>{const A=T.current;A&&(A.options.fontFamily=sp(x),yf(Ce.current,x).then(()=>{Pe.current===x&&nt()}))},[x]),v.useEffect(()=>{const A=T.current;A&&(A.options.theme=LS(E))},[E]),v.useEffect(()=>{const A=B.current;if(!A)return;let oe=!1,Le=null,ze=null,Ye=null,st=null,pi=null,ai=null,Qi=null;se.current=null,Me.current=!1,Ue.current=!1,W.current=null,re.current=null,zt(),ii();const Is=Ce.current,Er=Pe.current,us=new SR({cursorBlink:!0,convertEol:!1,disableStdin:e.status==="exited",fontFamily:sp(Er),fontSize:Is,fontWeight:400,fontWeightBold:700,macOptionClickForcesSelection:!0,scrollback:_M,theme:{...LS(_r())}}),Tr=new dT;return us.loadAddon(Tr),st=JR(us),T.current=us,Y.current=Tr,yf(Is,Er).then(()=>{if(oe)return;us.open(A),Me.current=!0,Le=YR(us),ie.current&&we.current&&e.status==="running"&&Ne(),nt(),pi=PM(A,us,()=>Ce.current*1.2,Zi,Es=>{Ct(Es)},cs,xs),ai=jM(A,us,Zi,Es=>{Ct(Es)},cs,xs);const Fs=new wR;ze=us.onData(Es=>{if(Ke.current){const cn=NR(Es);if(cn){ct(!1),fe(cn);return}}const aa=Fs.accept(Es);aa&&fe(aa)}),Ye=us.onScroll(Es=>{if(ke.current||Se.current||me.current){Xt();return}Sr(),Ys(us)&&ri({scrollToBottom:!0}),Zi(),Es<=3&&Ct()}),Qi=new ResizeObserver(()=>{ki()}),Qi.observe(A),Ue.current&&(si(),Ue.current=!1,nt()),Fi()}),()=>{oe=!0,Me.current=!1,Ue.current=!1,zt(),ni(),na(),me.current=!1,pi?.(),ai?.(),Qi?.disconnect(),Le?.dispose(),ze?.dispose(),Ye?.dispose(),st?.dispose(),us.dispose(),T.current=null,Y.current=null}},[e.id]),v.useEffect(()=>{const A=ee.current(e.id),oe=lM(A,Ot);return P.current=oe.send,Q(oe.status),oe.status==="connected"&&nt(),oe.snapshot&&(X.current.onSnapshot(oe.snapshot,{notifyCompletion:!1}),T.current&&(nt(),Dt(oe.output,oe.history),nt())),()=>{oe.detach(),P.current=null}},[e.id,e.status]);function Ot(A){if(A.type==="status"){Q(A.status),A.status==="unauthorized"&&te.current?.(),A.status==="connected"&&nt();return}Ii(A.message)}function ii(A=[],oe=null){N.current=[],U.current=ou(A),K.current=0,j.current=!1,z.current=null,me.current=!1,G.current+=1,M.current=oe,q.current=null,V.current=!1,_e.current=!1,be.current=!1,Ue.current=!1,wi.current=null,he.current=null,pe.current=!1,Oe(!1),Ui(null),Yt(!1),Bi(null),Xs(!1),Kt(!1)}function Dt(A=[],oe=null){ii(A,oe),Vt()}function Vt(){if(!T.current||!Me.current){Ue.current=!0;return}Ue.current=!1,si()}async function si(){const A=T.current;if(!A)return;const oe=cu(A,pe.current),Le=oe?U.current.length:K.current;await Ei(A,{liveOutputLimit:Le,scrollToBottom:oe}),T.current===A&&Xt()}function Ei(A,oe={}){return new Promise(Le=>{me.current=!0,j.current=!1;const ze=G.current+1;G.current=ze;const Ye=Math.max(0,Math.min(oe.liveOutputLimit??U.current.length,U.current.length)),st=oe.historyPages??N.current,pi=()=>{if(T.current!==A||G.current!==ze){Le(!1);return}try{K.current=Ye,oe.scrollToBottom&&Cr(A)}finally{me.current=!1;const Qi=fi();Qi?ri(Qi):oe.applyDeferredSnapshot!==!1&&wr(),Le(!0)}},ai=()=>{if(T.current!==A||G.current!==ze){Le(!1);return}A.clear();const Qi=ou([...st,...U.current.slice(0,Ye)]);if(Qi.length===0){pi();return}for(let Is=0;Is<Qi.length;Is+=1){const Er=Qi[Is];Is===Qi.length-1?A.write(Er,pi):A.write(Er)}};if(A.buffer.active.type==="alternate"){A.write(Zp,ai);return}ai()})}async function Ct(A=0){const oe=T.current;if(be.current||!oe)return;if(Cs(oe)){Xt();return}const Le=M.current;be.current=!0,Oe(!0);const ze=oe.buffer.active.viewportY;try{let Ye=!!(Le&&!Le.hasMore);if(!Ye)try{const st=await t.getTerminalHistory(e.id,{beforeLine:Le?.startLine??0,limit:MS}),pi={startLine:st.startLine,endLine:st.endLine,hasMore:st.hasMore};if(st.output.length>0){await It(oe,st.output,ze,A)&&(M.current=pi);return}M.current=pi,Ye=!st.hasMore}catch(st){Ye=jf(st)}if(Ye){if(Cs(oe)){Xt();return}await Ki(oe,ze,A)}}catch{}finally{be.current=!1,Oe(!1)}}async function Ki(A,oe,Le){if(!(V.current||_e.current))try{const ze=q.current,Ye=await t.getTerminalTranscriptHistory(e.id,{...ze?{cursor:ze}:{},limit:$w}),st=Ye.output.map(Vw);if(st.length===0){Pi(Ye.source),q.current=Ye.cursor,_e.current=!Ye.hasMore||!Ye.cursor;return}await It(A,st,oe,Le)&&(Pi(Ye.source),q.current=Ye.cursor,_e.current=!Ye.hasMore||!Ye.cursor)}catch(ze){jf(ze)&&(V.current=!0)}}async function It(A,oe,Le,ze){if(Cs(A))return Xt(),!1;const Ye=[...oe,...N.current],st=OM(oe);return!await Ei(A,{liveOutputLimit:K.current,scrollToBottom:!1,historyPages:Ye,applyDeferredSnapshot:!1})||T.current!==A?!1:(N.current=Ye,zn(A,Math.max(0,Le+st+Math.min(0,ze))),pe.current=!Ys(A),Zi(),!0)}v.useEffect(()=>{const A=window.visualViewport;function oe(){document.visibilityState==="visible"&&nt()}function Le(){nt()}function ze(){Fi()}return document.addEventListener("visibilitychange",oe),window.addEventListener("pageshow",Le),window.addEventListener("resize",ze),A?.addEventListener("resize",ze),A?.addEventListener("scroll",ze),()=>{document.removeEventListener("visibilitychange",oe),window.removeEventListener("pageshow",Le),window.removeEventListener("resize",ze),A?.removeEventListener("resize",ze),A?.removeEventListener("scroll",ze)}},[e.id]);function Ti(){const A=ee.current(e.id),oe=D.current+1;D.current=oe,W.current={generation:oe,snapshot:null},re.current=oe,Q("reconnecting"),oM(A),ot(oe)}async function ot(A){try{const oe=await t.getTerminalHistory(e.id,{limit:MS});if(D.current!==A)return;const Le=W.current,ze=Le?.generation===A?Le.snapshot:null;W.current=null,ze&&(re.current=null);const Ye={startLine:oe.startLine,endLine:oe.endLine,hasMore:oe.hasMore};if(oe.output.length>0){Dt(oe.output,Ye);return}ze?Dt(ze.output,ze.history):re.current=null}catch{if(D.current!==A)return;const oe=W.current,Le=oe?.generation===A?oe.snapshot:null;W.current=null,re.current=null,Le&&Dt(Le.output,Le.history)}}function Ii(A){if(A.type==="snapshot"&&A.terminal.id===e.id){X.current.onSnapshot(A.terminal,{notifyCompletion:!1});const Le=T.current;if(!Le)return;nt();const ze=W.current;if(ze){ze.snapshot={output:A.output,history:A.history??null},nt();return}if(re.current!==null){re.current=null,nt();return}if(Gs(Le,A.terminal)){ra(A.output,A.history??null),Xt(),nt();return}Dt(A.output,A.history??null),nt();return}if(A.type==="terminal_updated"&&A.terminal.id===e.id){X.current.onSnapshot(A.terminal,{notifyCompletion:!0});return}if(A.type==="output"&&A.terminalId===e.id){const Le=Zw(A.data);if(!Le)return;U.current.push(Le),T.current&&Me.current?ri({scrollToBottom:!0}):Ue.current=!0;return}const oe=T.current;if(oe){if(A.type==="exit"&&A.terminalId===e.id){X.current.onExit(A.exitCode),Q("closed");return}A.type==="error"&&oe.writeln(`\r
|
|
32
|
+
[nterminal] ${A.message}`)}}function ki(A=25){if(document.visibilityState==="hidden"||!ie.current||le.current.has(A))return;const oe=window.setTimeout(()=>{le.current.delete(A),O()},A);le.current.set(A,oe)}function Fi(){for(const A of pM)ki(A)}function nt(){se.current=null,Fi()}function zt(){for(const A of le.current.values())window.clearTimeout(A);le.current.clear()}function ni(){for(const A of de.current)window.clearTimeout(A);de.current=[]}function Zi(){if(Xt(),!he.current){Yt(!1);return}Yt(!0),na(),ve.current=window.setTimeout(()=>{ve.current=null,Yt(!1)},1200)}function Xt(){const A=T.current,oe=A?zM(A):null;if(he.current=oe,Ui(oe),Kt(!!(A&&oe)),Xs(!!(A&&oe&&!Ys(A))),oe||!A||!rl()){Bi(null);return}Bi({alternate:A.buffer.active.type==="alternate"})}function rl(){const A=M.current;return N.current.length>0||!!A?.hasMore}function na(){ve.current!==null&&(window.clearTimeout(ve.current),ve.current=null)}function Sr(){const A=T.current;A&&(pe.current=!Ys(A),Xt())}function os(A){z.current=Hf(z.current,A)}function On(A){const oe=z.current;return z.current=null,Hf(oe,A)}function fi(){const A=z.current;return z.current=null,A}function ri(A={}){const oe=T.current;if(!oe||!Me.current){Ue.current=!0;return}if(me.current){os(A);return}if(j.current){os(A);return}const Le=On(A);if(!Le.force&&!cu(oe,pe.current)){Xt();return}j.current=!0;const ze=G.current,Ye=()=>{if(T.current!==oe||G.current!==ze){j.current=!1;return}if(!Le.force&&!cu(oe,pe.current)){j.current=!1,Xt();return}const st=K.current,pi=U.current[st];if(pi===void 0){j.current=!1,Le.scrollToBottom&&Cr(oe),Xt();const ai=fi();ai?ri(Hf(Le,ai)):wr();return}oe.write(pi,()=>{if(T.current!==oe||G.current!==ze){j.current=!1;return}K.current=st+1,Ye()})};Ye()}function Cs(A){return!Ys(A)&&(Nt()||j.current||me.current)}function Gs(A,oe){return(dt.current||Qp(oe?.currentCommand))&&!Ys(A)}function Nt(){return K.current<U.current.length}function ra(A,oe){wi.current={output:A,history:oe,appendFromLiveOutputIndex:K.current}}function wr(){const A=T.current,oe=wi.current;if(!A||!oe||!Ys(A)||Nt()||j.current||me.current)return;const Le=ou(oe.output),ze=ou(U.current.slice(oe.appendFromLiveOutputIndex));wi.current=null,Dt(BM(Le,ze),oe.history),nt()}function cs(){Se.current=!0}function xs(){Sr(),Se.current=!1;const A=T.current;A&&Ys(A)&&ri({scrollToBottom:!0})}function Cr(A){xr(()=>zS(A))&&(pe.current=!1)}function zn(A,oe){xr(()=>(A.scrollToLine(oe),!0))}function xr(A){ke.current=!0;try{return A()}finally{ke.current=!1}}function al(){const A=T.current;if(!A)return;const oe=()=>{zS(A),pe.current=!1,Xt(),ri({force:!0,scrollToBottom:!0}),Ne()};if(A.buffer.active.type==="alternate"){A.write(Zp,oe);return}oe()}function Oi(A){const oe=T.current,Le=B.current;if(!oe||!Le)return;const ze=Le.getBoundingClientRect();if(ze.height<=0)return;const Ye=Math.max(0,Math.min(1,(A-ze.top)/ze.height)),st=Math.round(oe.buffer.active.baseY*Ye);cs();try{oe.scrollToLine(st)}finally{xs()}pe.current=!Ys(oe),Xt(),Zi(),st<=3&&Ct()}function Ks(A){A.preventDefault(),A.stopPropagation(),A.currentTarget.setPointerCapture?.(A.pointerId),Oi(A.clientY)}function k(A){(A.buttons&1)!==0&&(A.preventDefault(),A.stopPropagation(),Oi(A.clientY))}function O(){const A=T.current,oe=Y.current;if(!(!A||!oe)&&!(document.visibilityState==="hidden"||!ie.current||B.current?.isConnected===!1))try{const Le=cu(A,pe.current);oe.fit(),Le&&Cr(A),A.refresh(0,Math.max(0,A.rows-1)),Xt();const ze={cols:A.cols,rows:A.rows},Ye=se.current;if(Ye&&Ye.cols===ze.cols&&Ye.rows===ze.rows)return;J({type:"resize",terminalId:e.id,cols:ze.cols,rows:ze.rows})&&(se.current=ze)}catch{}}function J(A){const oe=P.current;return oe?oe(A):!1}function fe(A){ri({force:!0,scrollToBottom:!0}),J({type:"input",terminalId:e.id,data:A})&&RM(A)&&xe()}function xe(){!De.current||!we.current||(ni(),de.current=mM.map(A=>{const oe=window.setTimeout(()=>{de.current=de.current.filter(Le=>Le!==oe),De.current&&we.current&&J({type:"refresh_cwd",terminalId:e.id})},A);return oe}))}function Ne(){$e.current||T.current?.focus()}const Ae=v.useCallback(()=>{Ss(!1)},[]);function vt(){Bt(A=>{const oe=!A;return Ke.current=oe,oe}),Ne()}function ct(A){Ke.current=A,Bt(A)}function qi(A){Ke.current&&ct(!1),fe(MR(A)),Ne()}return m.jsxs("section",{className:"terminal-pane","data-active":n,onMouseDown:()=>{n||f()},children:[m.jsx(bM,{terminal:e,canClose:o,tabId:h,transcriptSource:xi,onOpenTranscript:()=>Ss(!0),onReload:Ti,onClose:_}),m.jsx("div",{className:"xterm-container",ref:B}),Fe?m.jsx("div",{className:"terminal-history-loader",role:"status","aria-label":"Loading older terminal output",children:m.jsx("span",{"aria-hidden":"true"})}):null,C&&kt?m.jsxs("div",{className:"terminal-scroll-progress","data-active":Li,"aria-hidden":"true",children:[kt.current,"/",kt.total]}):C&&Xi?m.jsxs("div",{className:"terminal-scroll-progress","data-active":!1,"data-pending":"true","data-buffer":Xi.alternate?"alternate":"normal","aria-hidden":"true",children:[Xi.alternate?"alt ":"","0/?"]}):null,Gi?m.jsx("button",{type:"button",className:"terminal-scroll-bottom-button","aria-label":"Scroll terminal to bottom",title:"Scroll to bottom",onPointerDown:A=>A.stopPropagation(),onMouseDown:A=>A.stopPropagation(),onClick:A=>{A.stopPropagation(),al()},children:"↓"}):null,ls?m.jsx("button",{type:"button",className:"terminal-scroll-handle","aria-label":"Drag terminal scroll handle",title:"Drag to scroll",onPointerDown:Ks,onPointerMove:k,children:m.jsx("span",{"aria-hidden":"true"})}):null,n&&e.status==="running"?gt?m.jsx(DR,{ctrlActive:Ci,onCtrl:vt,onStandaloneKey:qi,onPreserveFocus:Ne,onHide:()=>wt(!1)}):m.jsx("button",{type:"button",className:"mobile-terminal-key-toggle","aria-label":"Show terminal control keys",title:"Show Ctrl / Esc / Tab / arrows",onMouseDown:A=>{A.stopPropagation(),Ne()},onPointerDown:A=>{A.stopPropagation(),Ne()},onClick:()=>wt(!0),children:"⌨"}):null,m.jsx(FR,{terminalId:e.id,onSubmit:fe,disabled:e.status!=="running"}),on&&xi?m.jsx(SM,{terminalId:e.id,serverApi:t,source:xi,fontSize:w,onClose:Ae}):null]})}function LS(e){return Nx(e)}function bM({terminal:e,canClose:t,tabId:n,transcriptSource:a,onOpenTranscript:o,onReload:c,onClose:h}){const f=S0({id:`pane-${e.id}`,disabled:!n,...n?{data:{kind:"pane",sourceTabId:n,terminalId:e.id}}:{}}),_={cursor:n?"grab":"default",opacity:f.isDragging?.5:void 0};return m.jsxs("header",{ref:f.setNodeRef,className:"terminal-pane-header",style:_,"data-dragging":f.isDragging,...f.attributes,...f.listeners,children:[m.jsx("span",{className:"terminal-pane-dot","aria-hidden":"true"}),m.jsx("span",{className:"terminal-pane-cwd",title:e.cwd,children:e.cwd}),m.jsx("span",{className:"terminal-pane-spacer"}),a?m.jsx("button",{type:"button",className:"terminal-pane-transcript","data-provider":a.provider,title:`View ${Pu(a.provider)} transcript history`,"aria-label":`View ${Pu(a.provider)} transcript history`,onPointerDown:p=>p.stopPropagation(),onMouseDown:p=>p.stopPropagation(),onClick:p=>{p.stopPropagation(),o()},children:"View history"}):null,m.jsx("span",{className:`terminal-pane-state terminal-pane-state-${e.status}`,children:e.status}),e.status==="running"?m.jsx("button",{type:"button",className:"terminal-pane-reload","aria-label":`Reload pane ${e.title}`,title:"Reload pane output",onPointerDown:p=>p.stopPropagation(),onMouseDown:p=>p.stopPropagation(),onClick:p=>{p.stopPropagation(),c()},children:"↻"}):null,t?m.jsx("button",{type:"button",className:"terminal-pane-close","aria-label":`Close pane ${e.title}`,title:"Close pane",onPointerDown:p=>p.stopPropagation(),onMouseDown:p=>p.stopPropagation(),onClick:p=>{p.stopPropagation(),h()},children:"x"}):null]})}const SM=hi.memo(function({terminalId:t,serverApi:n,source:a,fontSize:o,onClose:c}){const h=v.useRef(null),f=v.useRef(0),_=v.useRef(!1),p=v.useRef(!1),b=v.useRef(null),y=v.useRef(""),[w,x]=v.useState([]),[C,E]=v.useState(!1),[B,T]=v.useState(""),[Y,P]=v.useState(-1),[X,ee]=v.useState(null),[te,se]=v.useState(!1),[le,de]=v.useState(!0),[N,U]=v.useState(!1),[K,j]=v.useState(null);v.useEffect(()=>{function me(Se){Se.key==="Escape"&&(Se.preventDefault(),Se.stopPropagation(),c())}return document.addEventListener("keydown",me,!0),()=>document.removeEventListener("keydown",me,!0)},[c]),v.useEffect(()=>{f.current+=1;const me=f.current;return _.current=!1,p.current=!0,b.current=null,x([]),ee(null),se(!1),j(null),he(null,"initial",me),()=>{f.current===me&&(f.current+=1)}},[n,C,a.provider,a.sessionId,t]),v.useLayoutEffect(()=>{const me=h.current;if(!me)return;if(p.current){if(le||w.length===0)return;p.current=!1;const Me=()=>{me.scrollTop=me.scrollHeight};Me(),window.requestAnimationFrame?.(Me);return}const Se=b.current;Se!==null&&(b.current=null,me.scrollTop+=me.scrollHeight-Se)},[w,le,C]);const z=Pu(a.provider),G=OS(w,C),M=xM(G),q=kM(M,B),V=q.length,_e=V>0?Y>=0&&Y<V?Y:0:-1,be=_e>=0?q[_e]?.entryIndex??null:null,D=_e>=0?q[_e]??null:null,W=G?G.split(`
|
|
33
|
+
`).length-1:0,re=B.trim()?V>0?`${_e+1}/${V} ${V===1?"match":"matches"} · ${W} ${W===1?"line":"lines"}`:`0 matches · ${W} ${W===1?"line":"lines"}`:W>0?`${W} lines`:"0 lines";v.useEffect(()=>{const me=B.trim().toLowerCase();P(Se=>!me||V===0?-1:y.current!==me?0:Se>=0&&Se<V?Se:0),y.current=me},[B,V]);async function he(me,Se,Me=f.current){if(!_.current){_.current=!0,Se==="initial"?de(!0):(U(!0),b.current=h.current?.scrollHeight??null),j(null);try{await ve(me,Se,Me)}catch(Ue){if(f.current!==Me)return;j(Ue instanceof Error?Ue.message:"Failed to load transcript history.")}finally{f.current===Me&&(_.current=!1,de(!1),U(!1))}}}async function ve(me,Se,Me){let Ue=me,Ke=0,we=[];for(;f.current===Me;){const ie=await n.getTerminalTranscriptHistory(t,{...Ue?{cursor:Ue}:{},limit:$w,includeTools:C});if(f.current!==Me)return;const De=NM(ie.output,a.provider,{includeTools:C});if(ee(ie.cursor),se(!!(ie.hasMore&&ie.cursor)),De&&(we=[De,...we],OS(we,C))){x(Ce=>Se==="older"?[...we,...Ce]:we);return}if(!ie.hasMore||!ie.cursor||Ke>=vM){we.length>0&&x(Ce=>Se==="older"?[...we,...Ce]:we);return}Ue=ie.cursor,Ke+=1}}function pe(){const me=h.current;!me||me.scrollTop>72||!te||!X||_.current||he(X,"older")}function ke(me){V!==0&&P(Se=>{const Me=_e>=0?_e:me>0?-1:0;return((Se>=0&&Se<V?Se:Me)+me+V)%V})}return m.jsx("div",{className:"security-overlay transcript-overlay",role:"dialog","aria-modal":"true","aria-labelledby":"transcript-dialog-title",onPointerDown:me=>me.stopPropagation(),onMouseDown:me=>me.stopPropagation(),onClick:me=>{me.stopPropagation(),c()},children:m.jsxs("div",{className:"security-panel transcript-dialog",onPointerDown:me=>me.stopPropagation(),onMouseDown:me=>me.stopPropagation(),onClick:me=>me.stopPropagation(),children:[m.jsxs("header",{className:"security-panel-header",children:[m.jsxs("div",{className:"transcript-dialog-title",children:[m.jsxs("h2",{id:"transcript-dialog-title",children:[z," JSONL"]}),m.jsx("span",{title:a.sessionId,children:a.sessionId})]}),m.jsx("button",{type:"button",className:"security-close","aria-label":"Close",onClick:c,children:"×"})]}),m.jsxs("div",{className:"transcript-dialog-controls",children:[m.jsxs("label",{className:"auth-checkbox transcript-tool-toggle",children:[m.jsx("input",{type:"checkbox",checked:C,onChange:me=>E(me.currentTarget.checked)}),"Show tool output"]}),m.jsxs("label",{className:"transcript-search",children:[m.jsx("span",{children:"Search"}),m.jsx("input",{type:"search",value:B,"aria-label":"Search JSONL transcript",placeholder:"Find in history",onChange:me=>T(me.currentTarget.value),onKeyDown:me=>{me.key==="Enter"&&(me.preventDefault(),ke(me.shiftKey?-1:1))}})]}),m.jsxs("div",{className:"transcript-search-actions","aria-label":"Search result navigation",children:[m.jsx("button",{type:"button",onClick:()=>ke(-1),disabled:V===0,children:"Prev"}),m.jsx("button",{type:"button",onClick:()=>ke(1),disabled:V===0,children:"Next"})]}),m.jsx("span",{className:"transcript-result-count",children:re})]}),m.jsxs("div",{ref:h,className:"transcript-dialog-scroll","aria-label":"JSONL transcript output",onScroll:pe,children:[N?m.jsx("div",{className:"transcript-dialog-status",children:"Loading older entries..."}):null,!le&&te?m.jsx("div",{className:"transcript-dialog-hint",children:"Scroll up for older entries"}):null,G?m.jsx(wM,{entries:M,searchQuery:B,activeEntryIndex:be,activeSearchMatch:D,fontSize:o}):null,le?m.jsx("div",{className:"transcript-dialog-status",children:"Loading transcript..."}):null,!le&&!G&&!K?m.jsx("div",{className:"transcript-dialog-status",children:"No transcript entries found."}):null,K?m.jsx("div",{className:"transcript-dialog-error",children:K}):null]})]})})});function wM({entries:e,searchQuery:t,activeEntryIndex:n,activeSearchMatch:a,fontSize:o}){const c=v.useRef(new Map);return v.useEffect(()=>{if(n===null)return;const h=c.current.get(n);if(!h||typeof h.scrollIntoView!="function")return;const f=h.querySelectorAll(".transcript-search-hit");((a?.entryIndex===n?f[a.matchIndexInEntry]:null)??h).scrollIntoView({block:"center",inline:"nearest"})},[n,a,t]),m.jsx("div",{className:"transcript-output transcript-formatted-output",style:{fontSize:o},children:e.map((h,f)=>m.jsxs("section",{ref:_=>{_?c.current.set(f,_):c.current.delete(f)},className:`transcript-entry transcript-entry-${h.kind}${n===f?" transcript-entry-search-active":""}`,children:[h.header?m.jsx("div",{className:"transcript-entry-header",children:Yw(h.header,t)}):null,h.body?m.jsx("div",{className:"transcript-entry-body",children:h.kind==="tool"?m.jsx(BS,{text:h.body,searchQuery:t}):m.jsx(hi.Suspense,{fallback:m.jsx(BS,{text:h.body,searchQuery:t}),children:m.jsx(yM,{text:h.body,searchQuery:t})})}):null]},`${h.header??"plain"}-${f}`))})}function BS({text:e,searchQuery:t}){const n=e.endsWith(`
|
|
34
34
|
`)?e.slice(0,-1).split(`
|
|
35
35
|
`):e.split(`
|
|
36
|
-
`);return
|
|
37
|
-
`)?e.slice(0,-1):e;if(!t)return[];const n=[];let a=null,o="plain",c=[];function h(){const f=
|
|
36
|
+
`);return m.jsx("pre",{className:"transcript-entry-pre",children:n.map((a,o)=>m.jsx("span",{className:`transcript-line transcript-line-${DM(a,o===0||n[o-1]?.trim()==="")}`,children:Yw(a,t)},o))})}function Yw(e,t){const n=t.trim();if(!n)return e||" ";const a=e.toLowerCase(),o=n.toLowerCase(),c=[];let h=0,f=a.indexOf(o);for(;f!==-1;){f>h&&c.push(e.slice(h,f));const _=f+n.length;c.push(m.jsx("mark",{className:"transcript-search-hit",children:e.slice(f,_)},`${f}-${_}`)),h=_,f=a.indexOf(o,h)}return h<e.length&&c.push(e.slice(h)),c.length>0?c:e||" "}function CM(e,t){const n=t.trim().toLowerCase();if(!n)return 0;const a=e.toLowerCase();let o=0,c=a.indexOf(n);for(;c!==-1;)o+=1,c=a.indexOf(n,c+n.length);return o}function xM(e){const t=e.endsWith(`
|
|
37
|
+
`)?e.slice(0,-1):e;if(!t)return[];const n=[];let a=null,o="plain",c=[];function h(){const f=EM(c).join(`
|
|
38
38
|
`);(a||f)&&n.push({header:a,body:f,kind:o}),a=null,o="plain",c=[]}for(const f of t.split(`
|
|
39
|
-
`)){const
|
|
40
|
-
${o.body}`:o.body,h=
|
|
41
|
-
`)}function
|
|
39
|
+
`)){const _=TM(f);_?(h(),a=f,o=_):c.push(f)}return h(),n}function EM(e){let t=e.length;for(;t>0&&(e[t-1]??"").trim()==="";)t-=1;return e.slice(0,t)}function TM(e){const t=/^\[[^\]]+\]\s+(.+)$/.exec(e.trimEnd());if(!t)return null;const n=t[1]??"";return n==="User"?"user":n==="Codex"||n==="Claude"?"assistant":n==="System"?"system":/^Tool (?:call(?::|$)|output$)/.test(n)?"tool":null}function kM(e,t){const n=[];for(let a=0;a<e.length;a+=1){const o=e[a];if(!o)continue;const c=o.header?`${o.header}
|
|
40
|
+
${o.body}`:o.body,h=CM(c,t);for(let f=0;f<h;f+=1)n.push({entryIndex:a,matchIndexInEntry:f})}return n}function DM(e,t){const n=e.trim();if(!n)return"blank";const a=n.replace(/^\[[^\]]+\]\s+/,""),o=/^\[[^\]]+\]\s+/.test(n);return(o||t)&&/^User$/.test(a)?"user":(o||t)&&/^(?:Codex|Claude)$/.test(a)?"assistant":(o||t)&&/^System$/.test(a)?"system":(o||t)&&(/^Tool (?:call(?::|$)|output$)/.test(a)||Gw(n))?"tool":/^(?:\$|>|❯|➜)\s+/.test(n)?"command":/^(?:✓|✔|PASS|passed\b|success\b)/i.test(n)?"success":/^(?:✗|✘|FAIL|failed\b|error\b|traceback\b)/i.test(n)?"error":/^\[[^\]]+\]/.test(n)||/^(?:info|debug|warn)\b/i.test(n)?"dim":"plain"}function RM(e){return e.includes("\r")||e.includes(`
|
|
41
|
+
`)}function jf(e){return e instanceof Nn&&e.status===404}function Qp(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 MM(e){if(Qp(e))return!0;if(!e)return!1;const t=e.replace(/^.*[\\/]/,"").toLowerCase();return t==="node"||t==="nodejs"}function Pu(e){return e==="codex"?"Codex":"Claude"}function NM(e,t,n={}){const a=`[nterminal] ${Pu(t)} transcript archive ends here. Live terminal screen continues below.`,o=e.join("").replace(/\r\n/g,`
|
|
42
42
|
`).replace(/\r/g,`
|
|
43
43
|
`).replace(a,"").replace(/\n{3,}/g,`
|
|
44
44
|
|
|
45
|
-
`).trimEnd(),c=
|
|
46
|
-
`:""}function
|
|
45
|
+
`).trimEnd(),c=Vw(o),h=n.includeTools?c:Xw(c);return h?`${h}
|
|
46
|
+
`:""}function Vw(e){return e.replace(/^\[(\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d{1,3})?Z)\]/gm,(t,n)=>{const a=AM(n);return a?`[${a}]`:t})}function AM(e){const t=new Date(e);if(!Number.isFinite(t.getTime()))return null;const n=t.getFullYear(),a=io(t.getMonth()+1),o=io(t.getDate()),c=io(t.getHours()),h=io(t.getMinutes()),f=io(t.getSeconds());return`${n}-${a}-${o} ${c}:${h}:${f}`}function io(e){return e.toString().padStart(2,"0")}function OS(e,t){return e.map(n=>t?n:Xw(n)).filter(Boolean).map(n=>n.endsWith(`
|
|
47
47
|
`)?n:`${n}
|
|
48
|
-
`).join("")}function
|
|
49
|
-
`),n=[];let a=!1,o=!1,c=!0;for(const h of t){const f=h.trim()==="",
|
|
48
|
+
`).join("")}function Xw(e){if(!e)return"";const t=e.split(`
|
|
49
|
+
`),n=[];let a=!1,o=!1,c=!0;for(const h of t){const f=h.trim()==="",_=c?LM(h):null;if(_&&(a=_==="tool",o=!1),Gw(h)){o=!0,c=!1;continue}if(o){f?(o=!1,a||n.push(h),c=!0):c=!1;continue}a||n.push(h),c=f}return n.join(`
|
|
50
50
|
`).replace(/\n{3,}/g,`
|
|
51
51
|
|
|
52
|
-
`).trimEnd()}function EM(e){const t=e.replace(/^\[[^\]]+\]\s+/,"");return/^Tool (?:call(?::|$)|output$)/.test(t)?"tool":/^(?:User|Codex|Claude|System)$/.test(t)?"message":null}function qw(e){return/^\[tool (?:call(?::|])|output\])/.test(e.trim())}function TM(e,t){if(t.length===0)return e;let n=0;const a=Math.min(e.length,t.length);for(let o=a;o>0;o-=1){let c=!0;for(let h=0;h<o;h+=1)if(e[e.length-o+h]!==t[h]){c=!1;break}if(c){n=o;break}}return[...e,...t.slice(n)]}function kM(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 ou(e){const t=[];for(const n of e){const a=Ww(n);a&&t.push(a)}return t}function Ww(e){return e.replace(/\x1b\[\?([0-9;:]*)([hl])/g,(t,n,a)=>{const o=n.split(";").filter(Boolean).filter(c=>!cM.has(c.split(":")[0]??""));return o.length>0?`\x1B[?${o.join(";")}${a}`:""})}function zf(e,t={}){const n={};return(e?.force||t.force)&&(n.force=!0),(e?.scrollToBottom||t.scrollToBottom)&&(n.scrollToBottom=!0),n}function DM(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 $s(e){return e.buffer.active.viewportY>=Math.max(0,e.buffer.active.baseY-1)}function cu(e,t){return!t||$s(e)}function NS(e){return $s(e)?!1:(e.scrollToLine(Math.max(0,e.buffer.active.baseY)),!0)}function RM(e,t,n,a,o,c){const h=f=>{const m=NM(f);m!==0&&(f.cancelable&&f.preventDefault(),f.stopPropagation(),MM(t,m,n,a,o,c))};return e.addEventListener("wheel",h,{capture:!0,passive:!1}),()=>{e.removeEventListener("wheel",h,{capture:!0})}}function MM(e,t,n,a,o,c){const h=()=>{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(Xp,h);return}h()}function NM(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 AM(e,t,n,a,o,c,h){let f=null,m=0;const p={passive:!1};function b(x){f=jf(x),m=0}function y(x){const C=jf(x);if(C===null){f=null,m=0;return}if(f===null){f=C;return}const E=C.clientY-f.clientY;if(f=C,x.cancelable&&x.preventDefault(),E===0)return;if(LM(t)&&BM(t,C,-E)){m=0;return}m-=E/n();const B=m<0?Math.ceil(m):Math.floor(m);if(B!==0){m-=B,c();try{t.scrollLines(B)}finally{h()}a(),B<0&&t.buffer.active.viewportY<=3&&o(B)}}function w(x){if(x.touches.length>0){f=jf(x);return}f=null,m=0}return e.addEventListener("touchstart",b,p),e.addEventListener("touchmove",y,p),e.addEventListener("touchend",w),e.addEventListener("touchcancel",w),()=>{e.removeEventListener("touchstart",b,p),e.removeEventListener("touchmove",y,p),e.removeEventListener("touchend",w),e.removeEventListener("touchcancel",w)}}function jf(e){if(e.touches.length!==1)return null;const t=e.touches[0];return t?{clientX:t.clientX,clientY:t.clientY}:null}function LM(e){return e.buffer.active.type==="alternate"||e.modes.mouseTrackingMode!=="none"}function BM(e,t,n){const a=e.element;return a?(a.dispatchEvent(OM(t,n)),!0):!1}function OM(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 Zp({node:e,terminals:t,editors:n,api:a,activeTerminalId:o,visible:c=!0,refreshCwdOnEnter:h=!1,tabId:f,dropZoneActive:m=!1,draggingTerminalId:p=null,mobileFocusLeafKey:b=null,path:y=[],totalPanes:w,onSelect:x,onClose:C,onResize:E,onExit:B,onSnapshot:T,onCloseEditor:Y,onAuthClose:K}){const X=w??Qp(e);if(y.length===0&&b){const le=Jp(e),de=le.some(N=>N.key===b)?b:le[0]?.key;if(le.length>1&&de)return _.jsx("div",{className:"mobile-focused-split",children:le.map(N=>{const U=N.key===de;if(N.type==="editor"){const j=n[N.editorId];return _.jsx("div",{className:"mobile-focused-pane","data-active":U,"aria-hidden":!U,children:j?_.jsx(_b,{api:a,editor:j,canClose:X>1,onClose:()=>Y(N.editorId)}):_.jsx("div",{className:"missing-pane",children:"Editor unavailable"})},N.key)}const P=t[N.terminalId];return P?_.jsx("div",{className:"mobile-focused-pane","data-active":U,"aria-hidden":!U,children:_.jsx(kS,{terminal:P,serverApi:a,active:U,visible:c&&U,canClose:X>1,refreshCwdOnEnter:h&&U,tabId:f,onSelect:()=>x(N.terminalId),onClose:()=>C(N.terminalId),onExit:j=>B(N.terminalId,j),onSnapshot:T,...K?{onAuthClose:K}:{}})},N.key):_.jsx("div",{className:"mobile-focused-pane","data-active":U,"aria-hidden":!U,children:_.jsx("div",{className:"missing-pane",children:"Terminal unavailable"})},N.key)})})}if(e.type==="pane"){const le=t[e.terminalId];if(!le)return _.jsx("div",{className:"missing-pane",children:"Terminal unavailable"});const de=_.jsx(kS,{terminal:le,serverApi:a,active:e.terminalId===o,visible:c,canClose:X>1,refreshCwdOnEnter:h&&e.terminalId===o,tabId:f,onSelect:()=>x(e.terminalId),onClose:()=>C(e.terminalId),onExit:U=>B(e.terminalId,U),onSnapshot:T,...K?{onAuthClose:K}:{}});return m&&p!==e.terminalId?_.jsxs("div",{className:"pane-drop-host",children:[de,_.jsx(uu,{terminalId:e.terminalId,side:"top"}),_.jsx(uu,{terminalId:e.terminalId,side:"right"}),_.jsx(uu,{terminalId:e.terminalId,side:"bottom"}),_.jsx(uu,{terminalId:e.terminalId,side:"left"})]}):de}if(e.type==="editor"){const le=n[e.editorId];return le?_.jsx(_b,{api:a,editor:le,canClose:X>1,onClose:()=>Y(e.editorId)}):_.jsx("div",{className:"missing-pane",children:"Editor unavailable"})}const re=Math.max(.1,Math.min(.9,e.ratio)),ee=1-re,ie=e.direction==="vertical"?{gridTemplateColumns:`minmax(0, ${re}fr) 1px minmax(0, ${ee}fr)`}:{gridTemplateRows:`minmax(0, ${re}fr) 1px minmax(0, ${ee}fr)`};return _.jsxs("div",{className:"split-pane","data-direction":e.direction,style:ie,children:[_.jsx("div",{className:"split-cell",children:_.jsx(Zp,{node:e.first,terminals:t,editors:n,api:a,activeTerminalId:o,visible:c,refreshCwdOnEnter:h,tabId:f,dropZoneActive:m,draggingTerminalId:p,mobileFocusLeafKey:b,path:[...y,0],totalPanes:X,onSelect:x,onClose:C,onResize:E,onExit:B,onSnapshot:T,onCloseEditor:Y,...K?{onAuthClose:K}:{}})}),_.jsx(zM,{direction:e.direction,path:y,onResize:E}),_.jsx("div",{className:"split-cell",children:_.jsx(Zp,{node:e.second,terminals:t,editors:n,api:a,activeTerminalId:o,visible:c,refreshCwdOnEnter:h,tabId:f,dropZoneActive:m,draggingTerminalId:p,mobileFocusLeafKey:b,path:[...y,1],totalPanes:X,onSelect:x,onClose:C,onResize:E,onExit:B,onSnapshot:T,onCloseEditor:Y,...K?{onAuthClose:K}:{}})})]})}function uu({terminalId:e,side:t}){const{setNodeRef:n,isOver:a}=m0({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 zM({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 h=c.parentElement;if(!h)return;const f=h.getBoundingClientRect();function m(b){const y=e==="vertical"?(b.clientX-f.left)/f.width:(b.clientY-f.top)/f.height;n(t,Math.min(.9,Math.max(.1,y)))}function p(){window.removeEventListener("pointermove",m),window.removeEventListener("pointerup",p),c.classList.remove("is-dragging"),document.body.style.cursor=""}window.addEventListener("pointermove",m),window.addEventListener("pointerup",p)}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 Qp(e){return e.type==="pane"||e.type==="editor"?1:Qp(e.first)+Qp(e.second)}function Jp(e){return e.type==="pane"?[{key:jM(e.terminalId),type:"terminal",terminalId:e.terminalId}]:e.type==="editor"?[{key:HM(e.editorId),type:"editor",editorId:e.editorId}]:[...Jp(e.first),...Jp(e.second)]}function jM(e){return`terminal:${e}`}function HM(e){return`editor:${e}`}const e_="workspace-default",UM="NTerminal";function PM(){return{workspaces:[],activeWorkspaceId:null,terminals:{}}}function KM(e,t){switch(t.type){case"workspace.hydrated":return em(t.terminals,t.savedTabs,t.savedWorkspaces,t.savedActiveWorkspaceId);case"workspace.created":return IM(e,{id:t.workspaceId,title:t.title});case"workspace.closed":return qM(e,t.workspaceId);case"workspace.selected":return $w(e,t.workspaceId);case"workspace.renamed":return FM(e,t.workspaceId,t.title);case"terminal.created":return Yw(e,t.terminal);case"terminal.split":return WM(e,t.terminal,t.direction);case"terminal.updated":return iN(e,t.terminal);case"terminal.exited":return sN(e,t.terminalId,t.exitCode);case"terminal.closed":return Xw(e,t.terminalId);case"terminal.detached":return nN(e,t.terminalId);case"editor.split":return $M(e,t.editorId,t.title,t.direction);case"editor.closed":return rN(e,t.editorId);case"pane.selected":return JM(e,t.terminalId);case"pane.resized":return eN(e,t.path,t.ratio);case"tab.selected":return VM(e,t.tabId);case"tab.renamed":return QM(e,t.tabId,t.title);case"tab.reordered":return Vw(e,t.sourceTabId,t.targetIndex);case"tab.dropped_into_pane":return XM(e,t.sourceTabId,t.sourceTerminalId,t.targetTerminalId,t.side);case"terminal.extracted_to_tab":return GM(e,t.sourceTabId,t.sourceTerminalId,t.targetIndex);case"activePane.closed":return YM(e);default:return e}}function IM(e,t){if(e.workspaces.some(a=>a.id===t.id))return $w(e,t.id);const n={id:t.id,title:t.title,tabs:[],activeTabId:null};return{...e,workspaces:[...e.workspaces,n],activeWorkspaceId:n.id}}function $w(e,t){return e.workspaces.some(n=>n.id===t)?{...e,activeWorkspaceId:t}:e}function FM(e,t,n){const a=n.trim();if(!a)return e;let o=!1;const c=e.workspaces.map(h=>h.id!==t||h.title===a?h:(o=!0,{...h,title:a}));return o?{...e,workspaces:c}:e}function qM(e,t){if(e.workspaces.length<=1||!e.workspaces.some(f=>f.id===t))return e;const n=e.workspaces.find(f=>f.id===t),a=new Set(n?tN(n):[]),o={...e.terminals};for(const f of a)delete o[f];const c=e.workspaces.filter(f=>f.id!==t),h=e.activeWorkspaceId===t?c[0]?.id??null:e.activeWorkspaceId;return{workspaces:c,activeWorkspaceId:h,terminals:o}}function Yw(e,t){const n=Zw(e),a=ia(n)??sh(),o=Qw(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 WM(e,t,n){const a=ia(e),o=a?ih(a):void 0;if(!a||!o)return Yw(e,t);const c=o.activeTerminalId,h=Do(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(f=>f.id===a.id?{...f,tabs:f.tabs.map(m=>m.id===o.id?{...m,root:h,activeTerminalId:t.id}:m)}:f)}}function $M(e,t,n,a){const o=ia(e),c=o?ih(o):void 0;if(!o||!c)return e;const h=c.activeTerminalId,f=Do(c.root,h,{type:"split",direction:a,ratio:.5,first:{type:"pane",terminalId:h},second:{type:"editor",editorId:t,title:n}});return{...e,workspaces:e.workspaces.map(m=>m.id===o.id?{...m,tabs:m.tabs.map(p=>p.id===c.id?{...p,root:f,activeTerminalId:h}:p)}:m)}}function YM(e){const t=ia(e),n=t?ih(t):void 0;return n?Xw(e,n.activeTerminalId):e}function VM(e,t){const n=ia(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 Vw(e,t,n){const a=e.workspaces.map(o=>{const c=o.tabs.findIndex(b=>b.id===t);if(c<0)return o;const h=o.tabs.slice(),[f]=h.splice(c,1);if(!f)return o;const m=Math.max(0,Math.min(h.length,n)),p=h.slice();return p.splice(m,0,f),ZM(o.tabs,p)?o:{...o,tabs:p}});return a.every((o,c)=>o===e.workspaces[c])?e:{...e,workspaces:a}}function XM(e,t,n,a,o){if(n===a||!e.terminals[n]||!e.terminals[a])return e;let c=e.workspaces.map(m=>{const p=m.tabs.findIndex(C=>C.id===t);if(p<0)return m;const b=m.tabs[p];if(!b)return m;const y=Ro(b.root,n);if(!y){const C=m.tabs.filter((E,B)=>B!==p);return{...m,tabs:C}}const w={...b,root:y,activeTerminalId:Us(y)[0]??b.activeTerminalId},x=m.tabs.slice();return x[p]=w,{...m,tabs:x}});const h=o==="left"||o==="right"?"vertical":"horizontal",f=o==="left"||o==="top";return c=c.map(m=>{const p=m.tabs.findIndex(E=>Us(E.root).includes(a));if(p<0)return m;const b=m.tabs[p];if(!b)return m;const y={type:"pane",terminalId:n},w={type:"split",direction:h,ratio:.5,first:f?y:{type:"pane",terminalId:a},second:f?{type:"pane",terminalId:a}:y},x=Do(b.root,a,w),C=m.tabs.slice();return C[p]={...b,root:x,activeTerminalId:n},{...m,tabs:C,activeTabId:b.id}}),Zw({...e,workspaces:c})}function GM(e,t,n,a){let o=-1,c=-1;for(let B=0;B<e.workspaces.length;B+=1){const T=e.workspaces[B].tabs.findIndex(Y=>Y.id===t);if(T>=0){o=B,c=T;break}}if(o<0)return e;const h=e.workspaces[o],f=h.tabs[c],m=Us(f.root);if(!m.includes(n))return e;if(m.length===1)return Vw(e,t,a);const p=Ro(f.root,n);if(!p)return e;const b={...f,root:p,activeTerminalId:Us(p)[0]??f.activeTerminalId},y=e.terminals[n],w={id:`tab-${Date.now().toString(36)}-${n.slice(0,8)}`,title:y?.title??"",activeTerminalId:n,root:{type:"pane",terminalId:n}},x=h.tabs.slice();x[c]=b;const C=Math.max(0,Math.min(x.length,a));x.splice(C,0,w);const E=e.workspaces.slice();return E[o]={...h,tabs:x,activeTabId:w.id},{...e,workspaces:E}}function ZM(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 QM(e,t,n){const a=n.trim();if(!a)return e;let o=!1;const c=e.workspaces.map(h=>{let f=!1;const m=h.tabs.map(p=>p.id!==t||p.title===a?p:(o=!0,f=!0,{...p,title:a}));return f?{...h,tabs:m}:h});return o?{...e,workspaces:c}:e}function JM(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 eN(e,t,n){const a=ia(e),o=a?ih(a):void 0;if(!a||!o)return e;const c=am(o.root,t,Jw(n));return c===o.root?e:{...e,workspaces:e.workspaces.map(h=>h.id===a.id?{...h,tabs:h.tabs.map(f=>f.id===o.id?{...f,root:c}:f)}:h)}}function em(e,t,n,a){const o=Object.fromEntries(e.map(b=>[b.id,b])),c=new Set(e.map(b=>b.id)),h=new Set;let f=aN(t,n,c,h);f.length===0&&(f=[sh()]);const m=typeof a=="string"&&f.some(b=>b.id===a)?a:f[0]?.id??null,p=m??f[0]?.id??e_;for(const b of e){if(h.has(b.id))continue;const y=Qw(b);f=lN(f,p,y),h.add(b.id)}return{workspaces:f.map(Fo),activeWorkspaceId:m,terminals:o}}function th(e){return Us(e.root)}function tm(e){return lm(e.root)}function tN(e){return e.tabs.flatMap(t=>Us(t.root))}function Hf(e){const t=e.workspaces.map(n=>{const a=n.tabs.flatMap(o=>{const c=nm(o.root);return c?[{...o,root:c}]:[]});return Fo({...n,tabs:a})});return{activeWorkspaceId:t.some(n=>n.id===e.activeWorkspaceId)?e.activeWorkspaceId:t[0]?.id??null,workspaces:t}}function iN(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 sN(e,t,n){const a=e.terminals[t];return a?{...e,terminals:{...e.terminals,[t]:{...a,status:"exited",exitCode:n}}}:e}function Xw(e,t){const n={...e.terminals};return delete n[t],Gw(e,t,n)}function nN(e,t){return e.terminals[t]?Gw(e,t,{...e.terminals}):e}function Gw(e,t,n){const a=e.workspaces.map(c=>{const h=[];for(const f of c.tabs){const m=Ro(f.root,t);if(!m)continue;const p=Us(m),b=p.includes(f.activeTerminalId)?f.activeTerminalId:p[0];b&&h.push({...f,root:m,activeTerminalId:b})}return Fo({...c,tabs:h})}),o=a.some(c=>c.id===e.activeWorkspaceId);return{workspaces:a,activeWorkspaceId:o?e.activeWorkspaceId:a[0]?.id??null,terminals:n}}function rN(e,t){const n=e.workspaces.map(o=>{const c=[];for(const h of o.tabs){const f=im(h.root,t);if(!f)continue;const m=Us(f),p=m.includes(h.activeTerminalId)?h.activeTerminalId:m[0];p&&c.push({...h,root:f,activeTerminalId:p})}return Fo({...o,tabs:c})}),a=n.some(o=>o.id===e.activeWorkspaceId);return{...e,workspaces:n,activeWorkspaceId:a?e.activeWorkspaceId:n[0]?.id??null}}function aN(e,t,n,a){if(t&&t.length>0){const o=[];for(const c of t)oN(c)&&o.push(AS(c,n,a));if(o.length>0)return o}return[AS({...sh(),tabs:e??[]},n,a)]}function AS(e,t,n){const a=[];for(const o of e.tabs){if(!cN(o))continue;const c=sm(o.root,t);if(!c)continue;const h=Us(c);for(const m of h)n.add(m);const f=h.includes(o.activeTerminalId)?o.activeTerminalId:h[0];f&&a.push({...o,root:c,activeTerminalId:f})}return Fo({...e,tabs:a})}function Zw(e){return ia(e)?e:{...e,workspaces:[sh()],activeWorkspaceId:e_}}function ia(e){return e.workspaces.find(t=>t.id===e.activeWorkspaceId)??e.workspaces[0]}function ih(e){return e.tabs.find(t=>t.id===e.activeTabId)??e.tabs[0]}function sh(){return{id:e_,title:UM,tabs:[],activeTabId:null}}function Fo(e){const t=e.tabs.some(n=>n.id===e.activeTabId);return{...e,activeTabId:t?e.activeTabId:e.tabs[0]?.id??null}}function lN(e,t,n){return e.map(a=>a.id===t?{...a,tabs:[...a.tabs,n],activeTabId:a.activeTabId??n.id}:a)}function Qw(e){return{id:`tab-${e.id}`,title:e.title||e.id,root:{type:"pane",terminalId:e.id},activeTerminalId:e.id}}function Do(e,t,n){return e.type==="pane"?e.terminalId===t?n:e:e.type==="editor"?e:{...e,first:Do(e.first,t,n),second:Do(e.second,t,n)}}function Ro(e,t){if(e.type==="pane")return e.terminalId===t?null:e;if(e.type==="editor")return e;const n=Ro(e.first,t),a=Ro(e.second,t);return n&&a?{...e,first:n,second:a}:n??a}function im(e,t){if(e.type==="editor")return e.editorId===t?null:e;if(e.type==="pane")return e;const n=im(e.first,t),a=im(e.second,t);return n&&a?{...e,first:n,second:a}:n??a}function sm(e,t){if(e.type==="pane")return t.has(e.terminalId)?e:null;if(e.type==="editor")return null;const n=sm(e.first,t),a=sm(e.second,t);return n&&a?{...e,ratio:Jw(e.ratio),first:n,second:a}:n??a}function nm(e){if(e.type==="editor")return null;if(e.type==="pane")return e;const t=nm(e.first),n=nm(e.second);return t&&n?{...e,first:t,second:n}:t??n}function oN(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 cN(e){if(!e||typeof e!="object")return!1;const t=e;return typeof t.id=="string"&&typeof t.title=="string"&&typeof t.activeTerminalId=="string"&&rm(t.root)}function rm(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")&&rm(t.first)&&rm(t.second):!1}function am(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=am(e.first,o,n);return c===e.first?e:{...e,first:c}}if(a===1){const c=am(e.second,o,n);return c===e.second?e:{...e,second:c}}return e}function Jw(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 Us(e){return e.type==="pane"?[e.terminalId]:e.type==="editor"?[]:[...Us(e.first),...Us(e.second)]}function lm(e){return e.type==="pane"||e.type==="editor"?1:lm(e.first)+lm(e.second)}const yr=new Map,No=new Map,Ao=new Map;function el(e){return e??"__local__"}function uN(e){return{agentId:e,state:PM(),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 Wt(e){const t=el(e);let n=yr.get(t);return n||(n=uN(e),yr.set(t,n)),n}function e1(e,t){const n=el(e);let a=No.get(n);return a||(a=new Set,No.set(n,a)),a.add(t),()=>{a.delete(t)}}function hN(e){const t=el(e),n=No.get(t);if(n)for(const a of Array.from(n))a()}function tl(e,t){yr.set(el(e),t),hN(e)}const om=new Set;function dN(e){return om.add(e),()=>{om.delete(e)}}function eo(e,t){const n=Wt(e),a=el(e);t.type==="workspace.hydrated"&&Ao.delete(a);const o=KM(n.state,t);let c=n.unreadCompletions,h=null;if(t.type==="terminal.updated"){const p=n.state.terminals[t.terminal.id],b=p?.activity==="busy",y=t.terminal.activity==="busy",w=t.terminal.activity==="idle",x=yN(a);if(t.notifyCompletion===!0&&y&&x.add(t.terminal.id),t.notifyCompletion===!0&&b&&w&&x.has(t.terminal.id)){const C=fN(o,t.terminal.id);C&&(h={terminalId:t.terminal.id,tabId:C.tab.id,commandName:p?.currentCommand??null},C.workspace.activeTabId!==C.tab.id&&(c.has(C.tab.id)||(c=new Set(c),c.add(C.tab.id))))}(w||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 f=o!==n.state,m=c!==n.unreadCompletions;if((f||m)&&tl(e,{...n,state:o,unreadCompletions:c}),m&&t_(),h)for(const p of Array.from(om))p({agentId:e,...h})}function fN(e,t){for(const n of e.workspaces)for(const a of n.tabs)if(Us(a.root).includes(t))return{workspace:n,tab:a};return null}const cm=new Set;function pN(e){return cm.add(e),()=>{cm.delete(e)}}function mN(){let e=0;for(const t of yr.values())e+=t.unreadCompletions.size;return e}function t_(){for(const e of Array.from(cm))e()}function _N(e,t){const n=Wt(e);if(!n.unreadCompletions.has(t))return;const a=new Set(n.unreadCompletions);a.delete(t),tl(e,{...n,unreadCompletions:a}),t_()}function LS(e,t){const n=Wt(e);t!==n.state&&tl(e,{...n,state:t})}function BS(e,t){const n=Wt(e),a=t(n.editors);a!==n.editors&&tl(e,{...n,editors:a})}function Wr(e,t,n){const a=Wt(e);a.loaded===t&&a.error===n||tl(e,{...a,loaded:t,error:n})}function hu(e,t,n){const a=Wt(e);a.layoutRevision===t&&a.lastPersistedLayoutJson===n||tl(e,{...a,layoutRevision:t,lastPersistedLayoutJson:n})}function vN(e){const t=Wt(e);return t.mutable.editorIdCounter+=1,t.mutable.editorIdCounter}function gN(e){const t=el(e),n=yr.get(t);n&&n.mutable.saveCoord.saveTimer!==null&&window.clearTimeout(n.mutable.saveCoord.saveTimer);const a=n?n.unreadCompletions.size>0:!1;yr.delete(t),No.delete(t),Ao.delete(t),a&&t_()}function OS(){for(const e of yr.values()){const t=e.mutable.saveCoord.saveTimer;t!==null&&window.clearTimeout(t),e.unreadCompletions.size>0}yr.clear(),No.clear(),Ao.clear()}function yN(e){let t=Ao.get(e);return t||(t=new Set,Ao.set(e,t)),t}function um(e,t){let n=!1,a=!1,o=null,c=!1;for(const h of th(e)){const f=t[h];if(f){if(f.status==="exited"){c=!0,n=!0;continue}f.activity==="busy"?(a=!0,n=!0,!o&&f.currentCommand&&(o=f.currentCommand)):f.activity==="idle"&&(n=!0)}}return n?c?{state:"exited",commandName:null}:a?{state:"busy",commandName:o}:{state:"idle",commandName:null}:null}function i_(e){return e?e.state==="busy"?e.commandName?`running: ${e.commandName}`:"running":e.state==="exited"?"exited":"idle":""}function hm(e,t){const n=t[e.activeTerminalId];return e.title||n?.title||e.activeTerminalId}function bN(e,t,n,a){return a?.state==="busy"?a.commandName?`running: ${a.commandName}`:"running":a?.state==="exited"?"exited":t[e.activeTerminalId]?.cwd||`${n} pane${n===1?"":"s"}`}function SN({tabs:e,activeTabId:t,terminals:n,unreadCompletionTabIds:a,detachedTerminals:o,onSelectTab:c,onCreateTab:h,onToggleWorkspaces:f,onCloseTerminals:m,onReattachTerminal:p,onDeleteTerminal:b,onSplitVertical:y,onSplitHorizontal:w,onRenameTab:x,activePaneAvailable:C}){const[E,B]=g.useState(null),[T,Y]=g.useState(!1),[K,X]=g.useState(null),re=g.useRef(null),ee=e.findIndex(z=>z.id===t),ie=ee>=0?e[ee]:e[0]??null,le=ie?um(ie,n):null,de=ie?tm(ie):0,N=ie?hm(ie,n):"No tab";g.useEffect(()=>{re.current?.focus(),re.current?.select()},[E?.tabId]),g.useEffect(()=>{if(!T)return;const z=G=>{G.key==="Escape"&&Y(!1)};return window.addEventListener("keydown",z),()=>window.removeEventListener("keydown",z)},[T]),g.useEffect(()=>{T&&e.length===0&&Y(!1)},[T,e.length]);function U(z,G){B({tabId:z,title:G})}function P(){if(!E)return;const z=E.title.trim();z&&x(E.tabId,z),B(null)}function j(){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 - ${y2()}`,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 - ${b2()}`,onClick:w,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:f,children:_.jsxs("span",{className:"hamburger-lines","aria-hidden":"true",children:[_.jsx("span",{}),_.jsx("span",{}),_.jsx("span",{})]})}),_.jsxs("button",{type:"button",className:"mobile-tab-current-button","aria-label":"Open tab switcher",title:N,onClick:()=>Y(!0),disabled:e.length===0,children:[le?_.jsx("span",{className:"terminal-tab-status-dot","data-activity":le.state,"aria-hidden":"true",title:i_(le)}):null,_.jsx("span",{children:N}),_.jsxs("small",{children:[ee>=0?ee+1:0,"/",e.length||0,de>1?` / ${de}`:""]})]}),_.jsxs("div",{className:"terminal-tab-list",children:[e.map((z,G)=>{const M=th(z),q=tm(z),V=hm(z,n),_e=z.id===t,be=E?.tabId===z.id,D=um(z,n),W=a?.has(z.id)??!1;return _.jsxs(ei.Fragment,{children:[_.jsx(zS,{index:G}),_.jsx(wN,{tab:z,active:_e,editing:be,title:V,paneCount:q,terminalIds:M,canClose:e.length>1,editValue:be?E.title:null,editInputRef:be?re:null,activity:D,unread:W,onSelect:()=>c(z.id),onBeginRename:()=>U(z.id,V),onCloseAll:()=>m(M),onCommitRename:P,onCancelRename:()=>B(null),onRenameChange:ne=>B({tabId:z.id,title:ne})})]},z.id)}),_.jsx(zS,{index:e.length}),_.jsx("button",{type:"button",className:"tab-add-button","aria-label":"New tab",title:"New tab",onClick:h,children:"+"}),(o?.length??0)>0?_.jsx("div",{className:"terminal-detached-pills","aria-label":"Detached terminals",children:(o??[]).map(z=>_.jsx(xN,{terminal:z,onReattach:()=>p?.(z.id),onDelete:()=>X(z)},z.id))}):null]}),_.jsx("button",{type:"button",className:"mobile-tab-add-button","aria-label":"Create new tab",title:"New tab",onClick:h,children:"+"}),C?j():null]}),T?_.jsx(CN,{tabs:e,activeTabId:t,terminals:n,unreadCompletionTabIds:a,detachedTerminals:o,editingTab:E,editInputRef:re,onClose:()=>Y(!1),onSelectTab:z=>{c(z),Y(!1)},onCreateTab:()=>{h(),Y(!1)},onBeginRename:U,onCloseTerminals:z=>{m(z),Y(!1)},onCommitRename:P,onCancelRename:()=>B(null),onRenameChange:(z,G)=>B({tabId:z,title:G}),onReattachTerminal:z=>{p?.(z),Y(!1)},onDeleteTerminal:z=>{X(z),Y(!1)}}):null,K?_.jsx(EN,{terminal:K,onCancel:()=>X(null),onConfirm:()=>{b?.(K.id),X(null)}}):null]})}function wN({tab:e,active:t,editing:n,title:a,paneCount:o,canClose:c,editValue:h,editInputRef:f,activity:m,unread:p,onSelect:b,onBeginRename:y,onCloseAll:w,onCommitRename:x,onCancelRename:C,onRenameChange:E}){const{attributes:B,listeners:T,setNodeRef:Y,transform:K,isDragging:X}=p0({id:`tab-${e.id}`,data:{kind:"tab",tabId:e.id,terminalId:e.activeTerminalId},disabled:n}),re={transform:Kf.Translate.toString(K),opacity:X?.4:void 0,zIndex:X?2:void 0};return _.jsxs("div",{ref:Y,className:"terminal-tab","data-active":t,"data-dragging":X,"data-unread":p?"true":void 0,style:re,...B,...T,children:[m?_.jsx("span",{className:"terminal-tab-status-dot","data-activity":m.state,"aria-hidden":"true",title:i_(m)}):null,n&&f&&h!==null?_.jsxs("form",{className:"terminal-tab-editor",onSubmit:ee=>{ee.preventDefault(),x()},children:[_.jsx("input",{ref:f,"aria-label":`Rename ${a}`,value:h,onBlur:x,onChange:ee=>E(ee.target.value),onKeyDown:ee=>{if(ee.key==="Enter"){ee.preventDefault(),x();return}ee.key==="Escape"&&(ee.preventDefault(),C())}}),_.jsx("small",{children:o})]}):_.jsxs("button",{type:"button",className:"terminal-tab-select","aria-label":`Select ${a}`,title:a,onClick:b,onDoubleClick:ee=>{ee.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:ee=>ee.stopPropagation(),onClick:ee=>{ee.stopPropagation(),w()},children:"x"}):null]})}function CN({tabs:e,activeTabId:t,terminals:n,unreadCompletionTabIds:a,detachedTerminals:o,editingTab:c,editInputRef:h,onClose:f,onSelectTab:m,onCreateTab:p,onBeginRename:b,onCloseTerminals:y,onCommitRename:w,onCancelRename:x,onRenameChange:C,onReattachTerminal:E,onDeleteTerminal:B}){const T=g.useRef(null);return g.useEffect(()=>{T.current?.scrollIntoView?.({block:"nearest"})},[t]),_.jsx("div",{className:"mobile-tab-sheet-backdrop",role:"dialog","aria-modal":"true","aria-labelledby":"mobile-tab-sheet-title",onClick:f,children:_.jsxs("section",{className:"mobile-tab-sheet",onClick:Y=>Y.stopPropagation(),children:[_.jsxs("header",{children:[_.jsxs("div",{children:[_.jsx("strong",{id:"mobile-tab-sheet-title",children:"Switch Tabs"}),_.jsxs("small",{children:[e.length," open"]})]}),_.jsxs("div",{className:"mobile-tab-sheet-header-actions",children:[_.jsx("button",{type:"button","aria-label":"New tab",title:"New tab",onClick:p,children:"+"}),_.jsx("button",{type:"button","aria-label":"Close tab switcher",title:"Close",onClick:f,children:"×"})]})]}),_.jsxs("div",{className:"mobile-tab-sheet-list",children:[e.map((Y,K)=>{const X=th(Y),re=tm(Y),ee=hm(Y,n),ie=Y.id===t,le=c?.tabId===Y.id,de=um(Y,n),N=a?.has(Y.id)??!1;return _.jsxs("div",{ref:ie?T:null,className:"mobile-tab-sheet-row","data-active":ie,"data-unread":N?"true":void 0,children:[le&&c?_.jsx("form",{className:"mobile-tab-sheet-editor",onSubmit:U=>{U.preventDefault(),w()},children:_.jsx("input",{ref:h,"aria-label":`Rename ${ee}`,value:c.title,onBlur:w,onChange:U=>C(Y.id,U.target.value),onKeyDown:U=>{if(U.key==="Enter"){U.preventDefault(),w();return}U.key==="Escape"&&(U.preventDefault(),x())}})}):_.jsxs("button",{type:"button",className:"mobile-tab-sheet-select","aria-label":`Switch to ${ee}`,onClick:()=>m(Y.id),children:[_.jsx("span",{className:"mobile-tab-sheet-index",children:K+1}),_.jsxs("span",{className:"mobile-tab-sheet-copy",children:[_.jsx("strong",{children:ee}),_.jsx("small",{children:bN(Y,n,re,de)})]}),_.jsxs("span",{className:"mobile-tab-sheet-meta",children:[de?_.jsx("span",{className:"terminal-tab-status-dot","data-activity":de.state,"aria-hidden":"true",title:i_(de)}):null,_.jsx("span",{children:re})]})]}),_.jsxs("div",{className:"mobile-tab-sheet-actions",children:[le?_.jsx("button",{type:"button","aria-label":`Done renaming ${ee}`,onClick:w,children:"Done"}):_.jsx("button",{type:"button","aria-label":`Rename ${ee}`,onClick:()=>b(Y.id,ee),children:"Rename"}),e.length>1?_.jsx("button",{type:"button",className:"mobile-tab-sheet-close","aria-label":`Close ${ee}`,onClick:()=>y(X),children:"×"}):null]})]},Y.id)}),(o?.length??0)>0?_.jsxs("div",{className:"mobile-tab-sheet-detached","aria-label":"Detached terminals",children:[_.jsx("span",{children:"Detached"}),(o??[]).map(Y=>{const K=Y.title||Y.cwd||Y.id.slice(0,8);return _.jsxs("div",{className:"mobile-tab-sheet-row mobile-tab-sheet-row-detached",children:[_.jsxs("button",{type:"button",className:"mobile-tab-sheet-select","aria-label":`Re-open ${K}`,onClick:()=>E(Y.id),children:[_.jsx("span",{className:"mobile-tab-sheet-index",children:"+"}),_.jsxs("span",{className:"mobile-tab-sheet-copy",children:[_.jsx("strong",{children:K}),_.jsx("small",{children:Y.cwd})]}),_.jsx("span",{className:"mobile-tab-sheet-type",children:"detached"})]}),_.jsx("div",{className:"mobile-tab-sheet-actions",children:_.jsx("button",{type:"button",className:"mobile-tab-sheet-close","aria-label":`Delete ${K}`,onClick:()=>B(Y),children:"×"})})]},Y.id)})]}):null]})]})})}function zS({index:e}){const{setNodeRef:t,isOver:n}=m0({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 xN({terminal:e,onReattach:t,onDelete:n}){const a=e.title||e.cwd||e.id.slice(0,8),o=`${e.title||"Terminal"}
|
|
52
|
+
`).trimEnd()}function LM(e){const t=e.replace(/^\[[^\]]+\]\s+/,"");return/^Tool (?:call(?::|$)|output$)/.test(t)?"tool":/^(?:User|Codex|Claude|System)$/.test(t)?"message":null}function Gw(e){return/^\[tool (?:call(?::|])|output\])/.test(e.trim())}function BM(e,t){if(t.length===0)return e;let n=0;const a=Math.min(e.length,t.length);for(let o=a;o>0;o-=1){let c=!0;for(let h=0;h<o;h+=1)if(e[e.length-o+h]!==t[h]){c=!1;break}if(c){n=o;break}}return[...e,...t.slice(n)]}function OM(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 ou(e){const t=[];for(const n of e){const a=Zw(n);a&&t.push(a)}return t}function Zw(e){return e.replace(/\x1b\[\?([0-9;:]*)([hl])/g,(t,n,a)=>{const o=n.split(";").filter(Boolean).filter(c=>!gM.has(c.split(":")[0]??""));return o.length>0?`\x1B[?${o.join(";")}${a}`:""})}function Hf(e,t={}){const n={};return(e?.force||t.force)&&(n.force=!0),(e?.scrollToBottom||t.scrollToBottom)&&(n.scrollToBottom=!0),n}function zM(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 Ys(e){return e.buffer.active.viewportY>=Math.max(0,e.buffer.active.baseY-1)}function cu(e,t){return!t||Ys(e)}function zS(e){return Ys(e)?!1:(e.scrollToLine(Math.max(0,e.buffer.active.baseY)),!0)}function jM(e,t,n,a,o,c){const h=f=>{const _=UM(f);_!==0&&(f.cancelable&&f.preventDefault(),f.stopPropagation(),HM(t,_,n,a,o,c))};return e.addEventListener("wheel",h,{capture:!0,passive:!1}),()=>{e.removeEventListener("wheel",h,{capture:!0})}}function HM(e,t,n,a,o,c){const h=()=>{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(Zp,h);return}h()}function UM(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 PM(e,t,n,a,o,c,h){let f=null,_=0;const p={passive:!1};function b(x){f=Uf(x),_=0}function y(x){const C=Uf(x);if(C===null){f=null,_=0;return}if(f===null){f=C;return}const E=C.clientY-f.clientY;if(f=C,x.cancelable&&x.preventDefault(),E===0)return;if(KM(t)&&IM(t,C,-E)){_=0;return}_-=E/n();const B=_<0?Math.ceil(_):Math.floor(_);if(B!==0){_-=B,c();try{t.scrollLines(B)}finally{h()}a(),B<0&&t.buffer.active.viewportY<=3&&o(B)}}function w(x){if(x.touches.length>0){f=Uf(x);return}f=null,_=0}return e.addEventListener("touchstart",b,p),e.addEventListener("touchmove",y,p),e.addEventListener("touchend",w),e.addEventListener("touchcancel",w),()=>{e.removeEventListener("touchstart",b,p),e.removeEventListener("touchmove",y,p),e.removeEventListener("touchend",w),e.removeEventListener("touchcancel",w)}}function Uf(e){if(e.touches.length!==1)return null;const t=e.touches[0];return t?{clientX:t.clientX,clientY:t.clientY}:null}function KM(e){return e.buffer.active.type==="alternate"||e.modes.mouseTrackingMode!=="none"}function IM(e,t,n){const a=e.element;return a?(a.dispatchEvent(FM(t,n)),!0):!1}function FM(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 Jp({node:e,terminals:t,editors:n,api:a,activeTerminalId:o,visible:c=!0,refreshCwdOnEnter:h=!1,tabId:f,dropZoneActive:_=!1,draggingTerminalId:p=null,mobileFocusLeafKey:b=null,path:y=[],totalPanes:w,onSelect:x,onClose:C,onResize:E,onExit:B,onSnapshot:T,onCloseEditor:Y,onAuthClose:P}){const X=w??em(e);if(y.length===0&&b){const le=tm(e),de=le.some(N=>N.key===b)?b:le[0]?.key;if(le.length>1&&de)return m.jsx("div",{className:"mobile-focused-split",children:le.map(N=>{const U=N.key===de;if(N.type==="editor"){const j=n[N.editorId];return m.jsx("div",{className:"mobile-focused-pane","data-active":U,"aria-hidden":!U,children:j?m.jsx(Sb,{api:a,editor:j,canClose:X>1,onClose:()=>Y(N.editorId)}):m.jsx("div",{className:"missing-pane",children:"Editor unavailable"})},N.key)}const K=t[N.terminalId];return K?m.jsx("div",{className:"mobile-focused-pane","data-active":U,"aria-hidden":!U,children:m.jsx(AS,{terminal:K,serverApi:a,active:U,visible:c&&U,canClose:X>1,refreshCwdOnEnter:h&&U,tabId:f,onSelect:()=>x(N.terminalId),onClose:()=>C(N.terminalId),onExit:j=>B(N.terminalId,j),onSnapshot:T,...P?{onAuthClose:P}:{}})},N.key):m.jsx("div",{className:"mobile-focused-pane","data-active":U,"aria-hidden":!U,children:m.jsx("div",{className:"missing-pane",children:"Terminal unavailable"})},N.key)})})}if(e.type==="pane"){const le=t[e.terminalId];if(!le)return m.jsx("div",{className:"missing-pane",children:"Terminal unavailable"});const de=m.jsx(AS,{terminal:le,serverApi:a,active:e.terminalId===o,visible:c,canClose:X>1,refreshCwdOnEnter:h&&e.terminalId===o,tabId:f,onSelect:()=>x(e.terminalId),onClose:()=>C(e.terminalId),onExit:U=>B(e.terminalId,U),onSnapshot:T,...P?{onAuthClose:P}:{}});return _&&p!==e.terminalId?m.jsxs("div",{className:"pane-drop-host",children:[de,m.jsx(uu,{terminalId:e.terminalId,side:"top"}),m.jsx(uu,{terminalId:e.terminalId,side:"right"}),m.jsx(uu,{terminalId:e.terminalId,side:"bottom"}),m.jsx(uu,{terminalId:e.terminalId,side:"left"})]}):de}if(e.type==="editor"){const le=n[e.editorId];return le?m.jsx(Sb,{api:a,editor:le,canClose:X>1,onClose:()=>Y(e.editorId)}):m.jsx("div",{className:"missing-pane",children:"Editor unavailable"})}const ee=Math.max(.1,Math.min(.9,e.ratio)),te=1-ee,se=e.direction==="vertical"?{gridTemplateColumns:`minmax(0, ${ee}fr) 1px minmax(0, ${te}fr)`}:{gridTemplateRows:`minmax(0, ${ee}fr) 1px minmax(0, ${te}fr)`};return m.jsxs("div",{className:"split-pane","data-direction":e.direction,style:se,children:[m.jsx("div",{className:"split-cell",children:m.jsx(Jp,{node:e.first,terminals:t,editors:n,api:a,activeTerminalId:o,visible:c,refreshCwdOnEnter:h,tabId:f,dropZoneActive:_,draggingTerminalId:p,mobileFocusLeafKey:b,path:[...y,0],totalPanes:X,onSelect:x,onClose:C,onResize:E,onExit:B,onSnapshot:T,onCloseEditor:Y,...P?{onAuthClose:P}:{}})}),m.jsx(qM,{direction:e.direction,path:y,onResize:E}),m.jsx("div",{className:"split-cell",children:m.jsx(Jp,{node:e.second,terminals:t,editors:n,api:a,activeTerminalId:o,visible:c,refreshCwdOnEnter:h,tabId:f,dropZoneActive:_,draggingTerminalId:p,mobileFocusLeafKey:b,path:[...y,1],totalPanes:X,onSelect:x,onClose:C,onResize:E,onExit:B,onSnapshot:T,onCloseEditor:Y,...P?{onAuthClose:P}:{}})})]})}function uu({terminalId:e,side:t}){const{setNodeRef:n,isOver:a}=w0({id:`pane-${e}-${t}`,data:{kind:"pane-zone",terminalId:e,side:t}});return m.jsx("div",{ref:n,className:`pane-drop-zone pane-drop-zone--${t}`,"data-over":a,"aria-hidden":"true"})}function qM({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 h=c.parentElement;if(!h)return;const f=h.getBoundingClientRect();function _(b){const y=e==="vertical"?(b.clientX-f.left)/f.width:(b.clientY-f.top)/f.height;n(t,Math.min(.9,Math.max(.1,y)))}function p(){window.removeEventListener("pointermove",_),window.removeEventListener("pointerup",p),c.classList.remove("is-dragging"),document.body.style.cursor=""}window.addEventListener("pointermove",_),window.addEventListener("pointerup",p)}return m.jsx("div",{"aria-label":"Resize panes","aria-orientation":e==="vertical"?"vertical":"horizontal",className:"split-divider","data-direction":e,onPointerDown:a,role:"separator",children:m.jsx("span",{className:"split-divider-handle","aria-hidden":"true"})})}function em(e){return e.type==="pane"||e.type==="editor"?1:em(e.first)+em(e.second)}function tm(e){return e.type==="pane"?[{key:WM(e.terminalId),type:"terminal",terminalId:e.terminalId}]:e.type==="editor"?[{key:$M(e.editorId),type:"editor",editorId:e.editorId}]:[...tm(e.first),...tm(e.second)]}function WM(e){return`terminal:${e}`}function $M(e){return`editor:${e}`}const s_="workspace-default",YM="NTerminal";function VM(){return{workspaces:[],activeWorkspaceId:null,terminals:{}}}function XM(e,t){switch(t.type){case"workspace.hydrated":return im(t.terminals,t.savedTabs,t.savedWorkspaces,t.savedActiveWorkspaceId);case"workspace.created":return GM(e,{id:t.workspaceId,title:t.title});case"workspace.closed":return QM(e,t.workspaceId);case"workspace.selected":return Qw(e,t.workspaceId);case"workspace.renamed":return ZM(e,t.workspaceId,t.title);case"terminal.created":return Jw(e,t.terminal);case"terminal.split":return JM(e,t.terminal,t.direction);case"terminal.updated":return uN(e,t.terminal);case"terminal.exited":return hN(e,t.terminalId,t.exitCode);case"terminal.closed":return t1(e,t.terminalId);case"terminal.detached":return dN(e,t.terminalId);case"editor.split":return eN(e,t.editorId,t.title,t.direction);case"editor.closed":return fN(e,t.editorId);case"pane.selected":return lN(e,t.terminalId);case"pane.resized":return oN(e,t.path,t.ratio);case"tab.selected":return iN(e,t.tabId);case"tab.renamed":return aN(e,t.tabId,t.title);case"tab.reordered":return e1(e,t.sourceTabId,t.targetIndex);case"tab.dropped_into_pane":return sN(e,t.sourceTabId,t.sourceTerminalId,t.targetTerminalId,t.side);case"terminal.extracted_to_tab":return nN(e,t.sourceTabId,t.sourceTerminalId,t.targetIndex);case"activePane.closed":return tN(e);default:return e}}function GM(e,t){if(e.workspaces.some(a=>a.id===t.id))return Qw(e,t.id);const n={id:t.id,title:t.title,tabs:[],activeTabId:null};return{...e,workspaces:[...e.workspaces,n],activeWorkspaceId:n.id}}function Qw(e,t){return e.workspaces.some(n=>n.id===t)?{...e,activeWorkspaceId:t}:e}function ZM(e,t,n){const a=n.trim();if(!a)return e;let o=!1;const c=e.workspaces.map(h=>h.id!==t||h.title===a?h:(o=!0,{...h,title:a}));return o?{...e,workspaces:c}:e}function QM(e,t){if(e.workspaces.length<=1||!e.workspaces.some(f=>f.id===t))return e;const n=e.workspaces.find(f=>f.id===t),a=new Set(n?cN(n):[]),o={...e.terminals};for(const f of a)delete o[f];const c=e.workspaces.filter(f=>f.id!==t),h=e.activeWorkspaceId===t?c[0]?.id??null:e.activeWorkspaceId;return{workspaces:c,activeWorkspaceId:h,terminals:o}}function Jw(e,t){const n=s1(e),a=sa(n)??nh(),o=n1(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 JM(e,t,n){const a=sa(e),o=a?sh(a):void 0;if(!a||!o)return Jw(e,t);const c=o.activeTerminalId,h=Mo(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(f=>f.id===a.id?{...f,tabs:f.tabs.map(_=>_.id===o.id?{..._,root:h,activeTerminalId:t.id}:_)}:f)}}function eN(e,t,n,a){const o=sa(e),c=o?sh(o):void 0;if(!o||!c)return e;const h=c.activeTerminalId,f=Mo(c.root,h,{type:"split",direction:a,ratio:.5,first:{type:"pane",terminalId:h},second:{type:"editor",editorId:t,title:n}});return{...e,workspaces:e.workspaces.map(_=>_.id===o.id?{..._,tabs:_.tabs.map(p=>p.id===c.id?{...p,root:f,activeTerminalId:h}:p)}:_)}}function tN(e){const t=sa(e),n=t?sh(t):void 0;return n?t1(e,n.activeTerminalId):e}function iN(e,t){const n=sa(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 e1(e,t,n){const a=e.workspaces.map(o=>{const c=o.tabs.findIndex(b=>b.id===t);if(c<0)return o;const h=o.tabs.slice(),[f]=h.splice(c,1);if(!f)return o;const _=Math.max(0,Math.min(h.length,n)),p=h.slice();return p.splice(_,0,f),rN(o.tabs,p)?o:{...o,tabs:p}});return a.every((o,c)=>o===e.workspaces[c])?e:{...e,workspaces:a}}function sN(e,t,n,a,o){if(n===a||!e.terminals[n]||!e.terminals[a])return e;let c=e.workspaces.map(_=>{const p=_.tabs.findIndex(C=>C.id===t);if(p<0)return _;const b=_.tabs[p];if(!b)return _;const y=No(b.root,n);if(!y){const C=_.tabs.filter((E,B)=>B!==p);return{..._,tabs:C}}const w={...b,root:y,activeTerminalId:Ps(y)[0]??b.activeTerminalId},x=_.tabs.slice();return x[p]=w,{..._,tabs:x}});const h=o==="left"||o==="right"?"vertical":"horizontal",f=o==="left"||o==="top";return c=c.map(_=>{const p=_.tabs.findIndex(E=>Ps(E.root).includes(a));if(p<0)return _;const b=_.tabs[p];if(!b)return _;const y={type:"pane",terminalId:n},w={type:"split",direction:h,ratio:.5,first:f?y:{type:"pane",terminalId:a},second:f?{type:"pane",terminalId:a}:y},x=Mo(b.root,a,w),C=_.tabs.slice();return C[p]={...b,root:x,activeTerminalId:n},{..._,tabs:C,activeTabId:b.id}}),s1({...e,workspaces:c})}function nN(e,t,n,a){let o=-1,c=-1;for(let B=0;B<e.workspaces.length;B+=1){const T=e.workspaces[B].tabs.findIndex(Y=>Y.id===t);if(T>=0){o=B,c=T;break}}if(o<0)return e;const h=e.workspaces[o],f=h.tabs[c],_=Ps(f.root);if(!_.includes(n))return e;if(_.length===1)return e1(e,t,a);const p=No(f.root,n);if(!p)return e;const b={...f,root:p,activeTerminalId:Ps(p)[0]??f.activeTerminalId},y=e.terminals[n],w={id:`tab-${Date.now().toString(36)}-${n.slice(0,8)}`,title:y?.title??"",activeTerminalId:n,root:{type:"pane",terminalId:n}},x=h.tabs.slice();x[c]=b;const C=Math.max(0,Math.min(x.length,a));x.splice(C,0,w);const E=e.workspaces.slice();return E[o]={...h,tabs:x,activeTabId:w.id},{...e,workspaces:E}}function rN(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 aN(e,t,n){const a=n.trim();if(!a)return e;let o=!1;const c=e.workspaces.map(h=>{let f=!1;const _=h.tabs.map(p=>p.id!==t||p.title===a?p:(o=!0,f=!0,{...p,title:a}));return f?{...h,tabs:_}:h});return o?{...e,workspaces:c}:e}function lN(e,t){const n=e.workspaces.find(o=>o.tabs.some(c=>Ao(c.root,t))),a=n?.tabs.find(o=>Ao(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 oN(e,t,n){const a=sa(e),o=a?sh(a):void 0;if(!a||!o)return e;const c=om(o.root,t,r1(n));return c===o.root?e:{...e,workspaces:e.workspaces.map(h=>h.id===a.id?{...h,tabs:h.tabs.map(f=>f.id===o.id?{...f,root:c}:f)}:h)}}function im(e,t,n,a){const o=Object.fromEntries(e.map(b=>[b.id,b])),c=new Set(e.map(b=>b.id)),h=new Set;let f=pN(t,n,c,h);f.length===0&&(f=[nh()]);const _=typeof a=="string"&&f.some(b=>b.id===a)?a:f[0]?.id??null,p=_??f[0]?.id??s_;for(const b of e){if(h.has(b.id))continue;const y=n1(b);f=mN(f,p,y),h.add(b.id)}return{workspaces:f.map(Fo),activeWorkspaceId:_,terminals:o}}function ih(e){return Ps(e.root)}function sm(e){return cm(e.root)}function cN(e){return e.tabs.flatMap(t=>Ps(t.root))}function Pf(e){const t=e.workspaces.map(n=>{const a=n.tabs.flatMap(o=>{const c=am(o.root);return c?[{...o,root:c}]:[]});return Fo({...n,tabs:a})});return{activeWorkspaceId:t.some(n=>n.id===e.activeWorkspaceId)?e.activeWorkspaceId:t[0]?.id??null,workspaces:t}}function uN(e,t){return{...e,terminals:{...e.terminals,[t.id]:t},workspaces:e.workspaces.map(n=>({...n,tabs:n.tabs.map(a=>Ao(a.root,t.id)?{...a,title:a.title||t.title}:a)}))}}function hN(e,t,n){const a=e.terminals[t];return a?{...e,terminals:{...e.terminals,[t]:{...a,status:"exited",exitCode:n}}}:e}function t1(e,t){const n={...e.terminals};return delete n[t],i1(e,t,n)}function dN(e,t){return e.terminals[t]?i1(e,t,{...e.terminals}):e}function i1(e,t,n){const a=e.workspaces.map(c=>{const h=[];for(const f of c.tabs){const _=No(f.root,t);if(!_)continue;const p=Ps(_),b=p.includes(f.activeTerminalId)?f.activeTerminalId:p[0];b&&h.push({...f,root:_,activeTerminalId:b})}return Fo({...c,tabs:h})}),o=a.some(c=>c.id===e.activeWorkspaceId);return{workspaces:a,activeWorkspaceId:o?e.activeWorkspaceId:a[0]?.id??null,terminals:n}}function fN(e,t){const n=e.workspaces.map(o=>{const c=[];for(const h of o.tabs){const f=nm(h.root,t);if(!f)continue;const _=Ps(f),p=_.includes(h.activeTerminalId)?h.activeTerminalId:_[0];p&&c.push({...h,root:f,activeTerminalId:p})}return Fo({...o,tabs:c})}),a=n.some(o=>o.id===e.activeWorkspaceId);return{...e,workspaces:n,activeWorkspaceId:a?e.activeWorkspaceId:n[0]?.id??null}}function pN(e,t,n,a){if(t&&t.length>0){const o=[];for(const c of t)_N(c)&&o.push(jS(c,n,a));if(o.length>0)return o}return[jS({...nh(),tabs:e??[]},n,a)]}function jS(e,t,n){const a=[];for(const o of e.tabs){if(!gN(o))continue;const c=rm(o.root,t);if(!c)continue;const h=Ps(c);for(const _ of h)n.add(_);const f=h.includes(o.activeTerminalId)?o.activeTerminalId:h[0];f&&a.push({...o,root:c,activeTerminalId:f})}return Fo({...e,tabs:a})}function s1(e){return sa(e)?e:{...e,workspaces:[nh()],activeWorkspaceId:s_}}function sa(e){return e.workspaces.find(t=>t.id===e.activeWorkspaceId)??e.workspaces[0]}function sh(e){return e.tabs.find(t=>t.id===e.activeTabId)??e.tabs[0]}function nh(){return{id:s_,title:YM,tabs:[],activeTabId:null}}function Fo(e){const t=e.tabs.some(n=>n.id===e.activeTabId);return{...e,activeTabId:t?e.activeTabId:e.tabs[0]?.id??null}}function mN(e,t,n){return e.map(a=>a.id===t?{...a,tabs:[...a.tabs,n],activeTabId:a.activeTabId??n.id}:a)}function n1(e){return{id:`tab-${e.id}`,title:e.title||e.id,root:{type:"pane",terminalId:e.id},activeTerminalId:e.id}}function Mo(e,t,n){return e.type==="pane"?e.terminalId===t?n:e:e.type==="editor"?e:{...e,first:Mo(e.first,t,n),second:Mo(e.second,t,n)}}function No(e,t){if(e.type==="pane")return e.terminalId===t?null:e;if(e.type==="editor")return e;const n=No(e.first,t),a=No(e.second,t);return n&&a?{...e,first:n,second:a}:n??a}function nm(e,t){if(e.type==="editor")return e.editorId===t?null:e;if(e.type==="pane")return e;const n=nm(e.first,t),a=nm(e.second,t);return n&&a?{...e,first:n,second:a}:n??a}function rm(e,t){if(e.type==="pane")return t.has(e.terminalId)?e:null;if(e.type==="editor")return null;const n=rm(e.first,t),a=rm(e.second,t);return n&&a?{...e,ratio:r1(e.ratio),first:n,second:a}:n??a}function am(e){if(e.type==="editor")return null;if(e.type==="pane")return e;const t=am(e.first),n=am(e.second);return t&&n?{...e,first:t,second:n}:t??n}function _N(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 gN(e){if(!e||typeof e!="object")return!1;const t=e;return typeof t.id=="string"&&typeof t.title=="string"&&typeof t.activeTerminalId=="string"&&lm(t.root)}function lm(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")&&lm(t.first)&&lm(t.second):!1}function om(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=om(e.first,o,n);return c===e.first?e:{...e,first:c}}if(a===1){const c=om(e.second,o,n);return c===e.second?e:{...e,second:c}}return e}function r1(e){return Number.isFinite(e)?Math.min(.9,Math.max(.1,e)):.5}function Ao(e,t){return e.type==="pane"?e.terminalId===t:e.type==="editor"?!1:Ao(e.first,t)||Ao(e.second,t)}function Ps(e){return e.type==="pane"?[e.terminalId]:e.type==="editor"?[]:[...Ps(e.first),...Ps(e.second)]}function cm(e){return e.type==="pane"||e.type==="editor"?1:cm(e.first)+cm(e.second)}const br=new Map,Lo=new Map,Bo=new Map;function sl(e){return e??"__local__"}function vN(e){return{agentId:e,state:VM(),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 $t(e){const t=sl(e);let n=br.get(t);return n||(n=vN(e),br.set(t,n)),n}function a1(e,t){const n=sl(e);let a=Lo.get(n);return a||(a=new Set,Lo.set(n,a)),a.add(t),()=>{a.delete(t)}}function yN(e){const t=sl(e),n=Lo.get(t);if(n)for(const a of Array.from(n))a()}function nl(e,t){br.set(sl(e),t),yN(e)}const um=new Set;function bN(e){return um.add(e),()=>{um.delete(e)}}function so(e,t){const n=$t(e),a=sl(e);t.type==="workspace.hydrated"&&Bo.delete(a);const o=XM(n.state,t);let c=n.unreadCompletions,h=null;if(t.type==="terminal.updated"){const p=n.state.terminals[t.terminal.id],b=p?.activity==="busy",y=t.terminal.activity==="busy",w=t.terminal.activity==="idle",x=kN(a);if(t.notifyCompletion===!0&&y&&x.add(t.terminal.id),t.notifyCompletion===!0&&b&&w&&x.has(t.terminal.id)){const C=SN(o,t.terminal.id);C&&(h={terminalId:t.terminal.id,tabId:C.tab.id,commandName:p?.currentCommand??null},C.workspace.activeTabId!==C.tab.id&&(c.has(C.tab.id)||(c=new Set(c),c.add(C.tab.id))))}(w||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 f=o!==n.state,_=c!==n.unreadCompletions;if((f||_)&&nl(e,{...n,state:o,unreadCompletions:c}),_&&n_(),h)for(const p of Array.from(um))p({agentId:e,...h})}function SN(e,t){for(const n of e.workspaces)for(const a of n.tabs)if(Ps(a.root).includes(t))return{workspace:n,tab:a};return null}const hm=new Set;function wN(e){return hm.add(e),()=>{hm.delete(e)}}function CN(){let e=0;for(const t of br.values())e+=t.unreadCompletions.size;return e}function n_(){for(const e of Array.from(hm))e()}function xN(e,t){const n=$t(e);if(!n.unreadCompletions.has(t))return;const a=new Set(n.unreadCompletions);a.delete(t),nl(e,{...n,unreadCompletions:a}),n_()}function HS(e,t){const n=$t(e);t!==n.state&&nl(e,{...n,state:t})}function US(e,t){const n=$t(e),a=t(n.editors);a!==n.editors&&nl(e,{...n,editors:a})}function $r(e,t,n){const a=$t(e);a.loaded===t&&a.error===n||nl(e,{...a,loaded:t,error:n})}function hu(e,t,n){const a=$t(e);a.layoutRevision===t&&a.lastPersistedLayoutJson===n||nl(e,{...a,layoutRevision:t,lastPersistedLayoutJson:n})}function EN(e){const t=$t(e);return t.mutable.editorIdCounter+=1,t.mutable.editorIdCounter}function TN(e){const t=sl(e),n=br.get(t);n&&n.mutable.saveCoord.saveTimer!==null&&window.clearTimeout(n.mutable.saveCoord.saveTimer);const a=n?n.unreadCompletions.size>0:!1;br.delete(t),Lo.delete(t),Bo.delete(t),a&&n_()}function PS(){for(const e of br.values()){const t=e.mutable.saveCoord.saveTimer;t!==null&&window.clearTimeout(t),e.unreadCompletions.size>0}br.clear(),Lo.clear(),Bo.clear()}function kN(e){let t=Bo.get(e);return t||(t=new Set,Bo.set(e,t)),t}function dm(e,t){let n=!1,a=!1,o=null,c=!1;for(const h of ih(e)){const f=t[h];if(f){if(f.status==="exited"){c=!0,n=!0;continue}f.activity==="busy"?(a=!0,n=!0,!o&&f.currentCommand&&(o=f.currentCommand)):f.activity==="idle"&&(n=!0)}}return n?c?{state:"exited",commandName:null}:a?{state:"busy",commandName:o}:{state:"idle",commandName:null}:null}function r_(e){return e?e.state==="busy"?e.commandName?`running: ${e.commandName}`:"running":e.state==="exited"?"exited":"idle":""}function fm(e,t){const n=t[e.activeTerminalId];return e.title||n?.title||e.activeTerminalId}function DN(e,t,n,a){return a?.state==="busy"?a.commandName?`running: ${a.commandName}`:"running":a?.state==="exited"?"exited":t[e.activeTerminalId]?.cwd||`${n} pane${n===1?"":"s"}`}function RN({tabs:e,activeTabId:t,terminals:n,unreadCompletionTabIds:a,detachedTerminals:o,onSelectTab:c,onCreateTab:h,onToggleWorkspaces:f,onCloseTerminals:_,onReattachTerminal:p,onDeleteTerminal:b,onSplitVertical:y,onSplitHorizontal:w,onRenameTab:x,activePaneAvailable:C}){const[E,B]=v.useState(null),[T,Y]=v.useState(!1),[P,X]=v.useState(null),ee=v.useRef(null),te=e.findIndex(z=>z.id===t),se=te>=0?e[te]:e[0]??null,le=se?dm(se,n):null,de=se?sm(se):0,N=se?fm(se,n):"No tab";v.useEffect(()=>{ee.current?.focus(),ee.current?.select()},[E?.tabId]),v.useEffect(()=>{if(!T)return;const z=G=>{G.key==="Escape"&&Y(!1)};return window.addEventListener("keydown",z),()=>window.removeEventListener("keydown",z)},[T]),v.useEffect(()=>{T&&e.length===0&&Y(!1)},[T,e.length]);function U(z,G){B({tabId:z,title:G})}function K(){if(!E)return;const z=E.title.trim();z&&x(E.tabId,z),B(null)}function j(){return m.jsxs("div",{className:"terminal-pane-actions","aria-label":"Pane actions",children:[m.jsx("button",{type:"button",className:"pane-action-button","aria-label":"Split right",title:`Split right - ${ME()}`,onClick:y,disabled:!C,children:m.jsx("span",{className:"split-icon split-icon-right","aria-hidden":"true"})}),m.jsx("button",{type:"button",className:"pane-action-button","aria-label":"Split down",title:`Split down - ${NE()}`,onClick:w,disabled:!C,children:m.jsx("span",{className:"split-icon split-icon-down","aria-hidden":"true"})})]})}return m.jsxs(m.Fragment,{children:[m.jsxs("nav",{className:"terminal-tabs","aria-label":"Terminal tabs",children:[m.jsx("button",{type:"button",className:"mobile-menu-button","aria-label":"Toggle workspaces",title:"Workspaces",onClick:f,children:m.jsxs("span",{className:"hamburger-lines","aria-hidden":"true",children:[m.jsx("span",{}),m.jsx("span",{}),m.jsx("span",{})]})}),m.jsxs("button",{type:"button",className:"mobile-tab-current-button","aria-label":"Open tab switcher",title:N,onClick:()=>Y(!0),disabled:e.length===0,children:[le?m.jsx("span",{className:"terminal-tab-status-dot","data-activity":le.state,"aria-hidden":"true",title:r_(le)}):null,m.jsx("span",{children:N}),m.jsxs("small",{children:[te>=0?te+1:0,"/",e.length||0,de>1?` / ${de}`:""]})]}),m.jsxs("div",{className:"terminal-tab-list",children:[e.map((z,G)=>{const M=ih(z),q=sm(z),V=fm(z,n),_e=z.id===t,be=E?.tabId===z.id,D=dm(z,n),W=a?.has(z.id)??!1;return m.jsxs(hi.Fragment,{children:[m.jsx(KS,{index:G}),m.jsx(MN,{tab:z,active:_e,editing:be,title:V,paneCount:q,terminalIds:M,canClose:e.length>1,editValue:be?E.title:null,editInputRef:be?ee:null,activity:D,unread:W,onSelect:()=>c(z.id),onBeginRename:()=>U(z.id,V),onCloseAll:()=>_(M),onCommitRename:K,onCancelRename:()=>B(null),onRenameChange:re=>B({tabId:z.id,title:re})})]},z.id)}),m.jsx(KS,{index:e.length}),m.jsx("button",{type:"button",className:"tab-add-button","aria-label":"New tab",title:"New tab",onClick:h,children:"+"}),(o?.length??0)>0?m.jsx("div",{className:"terminal-detached-pills","aria-label":"Detached terminals",children:(o??[]).map(z=>m.jsx(AN,{terminal:z,onReattach:()=>p?.(z.id),onDelete:()=>X(z)},z.id))}):null]}),m.jsx("button",{type:"button",className:"mobile-tab-add-button","aria-label":"Create new tab",title:"New tab",onClick:h,children:"+"}),C?j():null]}),T?m.jsx(NN,{tabs:e,activeTabId:t,terminals:n,unreadCompletionTabIds:a,detachedTerminals:o,editingTab:E,editInputRef:ee,onClose:()=>Y(!1),onSelectTab:z=>{c(z),Y(!1)},onCreateTab:()=>{h(),Y(!1)},onBeginRename:U,onCloseTerminals:z=>{_(z),Y(!1)},onCommitRename:K,onCancelRename:()=>B(null),onRenameChange:(z,G)=>B({tabId:z,title:G}),onReattachTerminal:z=>{p?.(z),Y(!1)},onDeleteTerminal:z=>{X(z),Y(!1)}}):null,P?m.jsx(LN,{terminal:P,onCancel:()=>X(null),onConfirm:()=>{b?.(P.id),X(null)}}):null]})}function MN({tab:e,active:t,editing:n,title:a,paneCount:o,canClose:c,editValue:h,editInputRef:f,activity:_,unread:p,onSelect:b,onBeginRename:y,onCloseAll:w,onCommitRename:x,onCancelRename:C,onRenameChange:E}){const{attributes:B,listeners:T,setNodeRef:Y,transform:P,isDragging:X}=S0({id:`tab-${e.id}`,data:{kind:"tab",tabId:e.id,terminalId:e.activeTerminalId},disabled:n}),ee={transform:qf.Translate.toString(P),opacity:X?.4:void 0,zIndex:X?2:void 0};return m.jsxs("div",{ref:Y,className:"terminal-tab","data-active":t,"data-dragging":X,"data-unread":p?"true":void 0,style:ee,...B,...T,children:[_?m.jsx("span",{className:"terminal-tab-status-dot","data-activity":_.state,"aria-hidden":"true",title:r_(_)}):null,n&&f&&h!==null?m.jsxs("form",{className:"terminal-tab-editor",onSubmit:te=>{te.preventDefault(),x()},children:[m.jsx("input",{ref:f,"aria-label":`Rename ${a}`,value:h,onBlur:x,onChange:te=>E(te.target.value),onKeyDown:te=>{if(te.key==="Enter"){te.preventDefault(),x();return}te.key==="Escape"&&(te.preventDefault(),C())}}),m.jsx("small",{children:o})]}):m.jsxs("button",{type:"button",className:"terminal-tab-select","aria-label":`Select ${a}`,title:a,onClick:b,onDoubleClick:te=>{te.preventDefault(),y()},children:[m.jsx("span",{children:a}),m.jsxs("small",{children:[o," pane",o===1?"":"s"]})]}),c&&!n?m.jsx("button",{type:"button",className:"icon-button","aria-label":`Close ${a}`,title:`Close ${a}`,onPointerDown:te=>te.stopPropagation(),onClick:te=>{te.stopPropagation(),w()},children:"x"}):null]})}function NN({tabs:e,activeTabId:t,terminals:n,unreadCompletionTabIds:a,detachedTerminals:o,editingTab:c,editInputRef:h,onClose:f,onSelectTab:_,onCreateTab:p,onBeginRename:b,onCloseTerminals:y,onCommitRename:w,onCancelRename:x,onRenameChange:C,onReattachTerminal:E,onDeleteTerminal:B}){const T=v.useRef(null);return v.useEffect(()=>{T.current?.scrollIntoView?.({block:"nearest"})},[t]),m.jsx("div",{className:"mobile-tab-sheet-backdrop",role:"dialog","aria-modal":"true","aria-labelledby":"mobile-tab-sheet-title",onClick:f,children:m.jsxs("section",{className:"mobile-tab-sheet",onClick:Y=>Y.stopPropagation(),children:[m.jsxs("header",{children:[m.jsxs("div",{children:[m.jsx("strong",{id:"mobile-tab-sheet-title",children:"Switch Tabs"}),m.jsxs("small",{children:[e.length," open"]})]}),m.jsxs("div",{className:"mobile-tab-sheet-header-actions",children:[m.jsx("button",{type:"button","aria-label":"New tab",title:"New tab",onClick:p,children:"+"}),m.jsx("button",{type:"button","aria-label":"Close tab switcher",title:"Close",onClick:f,children:"×"})]})]}),m.jsxs("div",{className:"mobile-tab-sheet-list",children:[e.map((Y,P)=>{const X=ih(Y),ee=sm(Y),te=fm(Y,n),se=Y.id===t,le=c?.tabId===Y.id,de=dm(Y,n),N=a?.has(Y.id)??!1;return m.jsxs("div",{ref:se?T:null,className:"mobile-tab-sheet-row","data-active":se,"data-unread":N?"true":void 0,children:[le&&c?m.jsx("form",{className:"mobile-tab-sheet-editor",onSubmit:U=>{U.preventDefault(),w()},children:m.jsx("input",{ref:h,"aria-label":`Rename ${te}`,value:c.title,onBlur:w,onChange:U=>C(Y.id,U.target.value),onKeyDown:U=>{if(U.key==="Enter"){U.preventDefault(),w();return}U.key==="Escape"&&(U.preventDefault(),x())}})}):m.jsxs("button",{type:"button",className:"mobile-tab-sheet-select","aria-label":`Switch to ${te}`,onClick:()=>_(Y.id),children:[m.jsx("span",{className:"mobile-tab-sheet-index",children:P+1}),m.jsxs("span",{className:"mobile-tab-sheet-copy",children:[m.jsx("strong",{children:te}),m.jsx("small",{children:DN(Y,n,ee,de)})]}),m.jsxs("span",{className:"mobile-tab-sheet-meta",children:[de?m.jsx("span",{className:"terminal-tab-status-dot","data-activity":de.state,"aria-hidden":"true",title:r_(de)}):null,m.jsx("span",{children:ee})]})]}),m.jsxs("div",{className:"mobile-tab-sheet-actions",children:[le?m.jsx("button",{type:"button","aria-label":`Done renaming ${te}`,onClick:w,children:"Done"}):m.jsx("button",{type:"button","aria-label":`Rename ${te}`,onClick:()=>b(Y.id,te),children:"Rename"}),e.length>1?m.jsx("button",{type:"button",className:"mobile-tab-sheet-close","aria-label":`Close ${te}`,onClick:()=>y(X),children:"×"}):null]})]},Y.id)}),(o?.length??0)>0?m.jsxs("div",{className:"mobile-tab-sheet-detached","aria-label":"Detached terminals",children:[m.jsx("span",{children:"Detached"}),(o??[]).map(Y=>{const P=Y.title||Y.cwd||Y.id.slice(0,8);return m.jsxs("div",{className:"mobile-tab-sheet-row mobile-tab-sheet-row-detached",children:[m.jsxs("button",{type:"button",className:"mobile-tab-sheet-select","aria-label":`Re-open ${P}`,onClick:()=>E(Y.id),children:[m.jsx("span",{className:"mobile-tab-sheet-index",children:"+"}),m.jsxs("span",{className:"mobile-tab-sheet-copy",children:[m.jsx("strong",{children:P}),m.jsx("small",{children:Y.cwd})]}),m.jsx("span",{className:"mobile-tab-sheet-type",children:"detached"})]}),m.jsx("div",{className:"mobile-tab-sheet-actions",children:m.jsx("button",{type:"button",className:"mobile-tab-sheet-close","aria-label":`Delete ${P}`,onClick:()=>B(Y),children:"×"})})]},Y.id)})]}):null]})]})})}function KS({index:e}){const{setNodeRef:t,isOver:n}=w0({id:`tab-position-${e}`,data:{kind:"tab-position",index:e}});return m.jsx("div",{ref:t,className:"terminal-tab-drop-slot","data-over":n,"aria-hidden":"true"})}function AN({terminal:e,onReattach:t,onDelete:n}){const a=e.title||e.cwd||e.id.slice(0,8),o=`${e.title||"Terminal"}
|
|
53
53
|
${e.cwd}
|
|
54
|
-
(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 EN({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 TN({uploads:e,onDismiss:t,onDismissAll:n,onRetry:a,onCancel:o}){if(e.length===0)return null;const h=e.some(m=>m.status==="failed"||m.status==="partial")?"alert":"status",f=e.filter(m=>m.status==="queued"||m.status==="uploading").length;return _.jsxs("aside",{className:`upload-toast upload-toast-${NN(e)}`,role:h,"aria-live":h==="alert"?"assertive":"polite",children:[_.jsxs("header",{className:"upload-toast-header",children:[_.jsx("strong",{children:e.length===1?Su(e[0]):`Uploads ${f>0?`(${f} 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(kN,{upload:m,compact:e.length>1,onDismiss:()=>t(m.id),onRetry:()=>a(m.id),onCancel:()=>o(m.id)},m.id))})]})}function kN({upload:e,compact:t,onDismiss:n,onRetry:a,onCancel:o}){const c="response"in e?e.response:void 0,h=e.status==="failed"||e.status==="partial",f=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:[f?_.jsx("button",{type:"button",onClick:o,children:"Cancel"}):null,h?_.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(DN,{toast:e}):null,c&&"message"in e&&e.message?_.jsx("p",{className:"upload-toast-muted",children:e.message}):null,c?_.jsx(RN,{response:c,compact:t}):null,e.status==="failed"&&!c&&e.message?_.jsx("p",{children:e.message}):null]})}function DN({toast:e}){const t=e.percent===null?AN(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 RN({response:e,compact:t}){const n=e.results.filter(h=>h.status==="failed"),a=e.results.filter(h=>h.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((h,f)=>_.jsx(MN,{result:h},`${h.relativePath}-${f}`))}):null,e.results.length>c.length?_.jsxs("p",{className:"upload-toast-muted",children:["+",e.results.length-c.length," more"]}):null]})}function MN({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 NN(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 AN(e){return e<1024?`${e} B`:e<1024*1024?`${Math.round(e/1024)} KB`:`${Math.round(e/(1024*1024))} MB`}function LN({toast:e,onActivate:t,onDismiss:n}){if(!e)return null;const a=e,o=a.commandName?`${a.commandName} finished`:"Command finished";function c(f){f.stopPropagation(),n()}function h(f){f.key!=="Enter"&&f.key!==" "||(f.preventDefault(),t(a))}return _.jsxs("aside",{className:"completion-toast",role:"status","aria-live":"polite",tabIndex:0,onClick:()=>t(a),onKeyDown:h,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 BN=uo(0,0,1,1),Dn=1e-6;function ON(e){return t1(e).map(t=>t.terminalId)}function t1(e){return co(e,BN).sort(UN).map((t,n)=>({...t,index:n+1}))}function zN(e,t,n){const a=t1(e),o=a.find(h=>h.terminalId===t);return o?a.filter(h=>h.terminalId!==t).map(h=>HN(o,h,n)).filter(h=>h!==null).sort(PN)[0]?.entry.terminalId??null:null}function jN(e,t){return!Number.isInteger(t)||t<1?null:ON(e)[t-1]??null}function co(e,t){if(e.type==="pane")return[{terminalId:e.terminalId,bounds:t}];if(e.type==="editor")return[];const n=KN(e.ratio);if(e.direction==="vertical"){const o=t.left+(t.right-t.left)*n;return[...co(e.first,uo(t.left,t.top,o,t.bottom)),...co(e.second,uo(o,t.top,t.right,t.bottom))]}const a=t.top+(t.bottom-t.top)*n;return[...co(e.first,uo(t.left,t.top,t.right,a)),...co(e.second,uo(t.left,a,t.right,t.bottom))]}function HN(e,t,n){const a=e.bounds,o=t.bounds,c=jS(a.left,a.right,o.left,o.right),h=jS(a.top,a.bottom,o.top,o.bottom);switch(n){case"left":return o.centerX>=a.centerX-Dn||h<=Dn?null:{entry:t,primaryDistance:Math.max(0,a.left-o.right),perpendicularDistance:Math.abs(a.centerY-o.centerY),overlap:h};case"right":return o.centerX<=a.centerX+Dn||h<=Dn?null:{entry:t,primaryDistance:Math.max(0,o.left-a.right),perpendicularDistance:Math.abs(a.centerY-o.centerY),overlap:h};case"up":return o.centerY>=a.centerY-Dn||c<=Dn?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+Dn||c<=Dn?null:{entry:t,primaryDistance:Math.max(0,o.top-a.bottom),perpendicularDistance:Math.abs(a.centerX-o.centerX),overlap:c};default:return null}}function UN(e,t){return Fa(e.bounds.top,t.bounds.top)||Fa(e.bounds.left,t.bounds.left)}function PN(e,t){return Fa(e.primaryDistance,t.primaryDistance)||Fa(e.perpendicularDistance,t.perpendicularDistance)||Fa(t.overlap,e.overlap)||Fa(e.entry.index,t.entry.index)}function Fa(e,t){const n=e-t;return Math.abs(n)<=Dn?0:n}function jS(e,t,n,a){return Math.max(0,Math.min(t,a)-Math.max(e,n))}function uo(e,t,n,a){return{left:e,top:t,right:n,bottom:a,centerX:e+(n-e)/2,centerY:t+(a-t)/2}}function KN(e){return Number.isFinite(e)?Math.min(.9,Math.max(.1,e)):.5}class IN extends Error{constructor(t){super(t),this.name="UploadDropError"}}function HS(e){return e?Array.from(e.types??[]).includes("Files")||r1(e.items).some(n=>n.kind==="file")?!0:a1(e.files).length>0:!1}async function FN(e){const t=r1(e.items).filter(n=>n.kind==="file");return t.length>0?qN(t):WN(e.files)}async function qN(e){const t=[];for(const n of e){const a=XN(n);if(a){await i1(a,"",t);continue}const o=n.getAsFile();if(o){t.push({relativePath:s1(o),file:o});continue}throw new IN("Folder upload is not supported by this browser.")}return t}function WN(e){return a1(e).map(t=>({relativePath:s1(t),file:t}))}async function i1(e,t,n){const a=ZN(t,e.name);if(e.isFile){const h=await $N(e);n.push({relativePath:a,file:h});return}if(!e.isDirectory)return;const o=e.createReader(),c=await YN(o);for(const h of c)await i1(h,a,n)}function $N(e){return new Promise((t,n)=>{e.file(t,a=>n(a))})}async function YN(e){const t=[];for(;;){const n=await VN(e);if(n.length===0)return t;t.push(...n)}}function VN(e){return new Promise((t,n)=>{e.readEntries(t,a=>n(a))})}function s1(e){const t=e.webkitRelativePath;return n1(typeof t=="string"&&t?t:e.name)}function XN(e){const t=e.webkitGetAsEntry?.();return GN(t)?t:null}function GN(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 ZN(e,t){return n1(e?`${e}/${t}`:t)}function n1(e){return e.replace(/\\/g,"/").replace(/^\/+/,"").split("/").filter(Boolean).join("/")}function r1(e){return e?Array.from(e):[]}function a1(e){return e?Array.from(e):[]}const US="nterminal.terminalWorkspaces.v2",l1="nterminal.sidebarCollapsed.v1",QN=75,PS=v0.map(e=>e.url),JN=v0[0].url;function eA({api:e,serverApi:t,activeAgentId:n=null,onSelectServer:a,sessionExpiresAt:o=null,onLogout:c=async()=>{},onSessionInvalid:h}){const f=g.useMemo(()=>e??Fu(),[e]),m=g.useMemo(()=>t??yo(null),[t]),p=g.useMemo(()=>fA(n),[n]),b=g.useMemo(()=>k=>e1(n,k),[n]),y=g.useMemo(()=>()=>Wt(n),[n]),w=g.useSyncExternalStore(b,y,y),x=w.state,C=w.editors,E=!w.loaded,B=w.error,[T,Y]=g.useState(!1),[K,X]=g.useState(()=>gA()),[re,ee]=g.useState("servers"),[ie,le]=g.useState(!1),de=g.useSyncExternalStore(L2,db,db);g.useSyncExternalStore(R0,hb,hb);const[N,U]=g.useState(0),[P,j]=g.useState(()=>[null]),[z,G]=g.useState(0),[M,q]=g.useState(()=>[n]),[V,_e]=g.useState(()=>new Set),[be,D]=g.useState({}),[W,ne]=g.useState(null),he=g.useRef(null);g.useRef(!1);const ge=g.useRef(0),[pe,ke]=g.useState(null),me=jx($y(c0,{activationConstraint:{distance:8}}),$y(u0,{activationConstraint:{delay:250,tolerance:5}}));g.useEffect(()=>B2(f),[f]);function Se(k){const O=k.active.data.current;if(O){if(O.kind==="tab"&&typeof O.tabId=="string"&&typeof O.terminalId=="string"){ke({tabId:O.tabId,terminalId:O.terminalId});return}O.kind==="pane"&&typeof O.sourceTabId=="string"&&typeof O.terminalId=="string"&&ke({tabId:O.sourceTabId,terminalId:O.terminalId})}}function Me(k){ke(null);const O=k.active.data.current,Q=k.over?.data.current;if(!(!O||!Q||typeof O.terminalId!="string")){if(O.kind==="tab"&&typeof O.tabId=="string"){if(Q.kind==="tab-position"&&typeof Q.index=="number"){lt({type:"tab.reordered",sourceTabId:O.tabId,targetIndex:Q.index});return}Q.kind==="pane-zone"&&typeof Q.terminalId=="string"&&(Q.side==="top"||Q.side==="right"||Q.side==="bottom"||Q.side==="left")&<({type:"tab.dropped_into_pane",sourceTabId:O.tabId,sourceTerminalId:O.terminalId,targetTerminalId:Q.terminalId,side:Q.side});return}if(O.kind==="pane"&&typeof O.sourceTabId=="string"){if(Q.kind==="tab-position"&&typeof Q.index=="number"){lt({type:"terminal.extracted_to_tab",sourceTabId:O.sourceTabId,sourceTerminalId:O.terminalId,targetIndex:Q.index});return}Q.kind==="pane-zone"&&typeof Q.terminalId=="string"&&(Q.side==="top"||Q.side==="right"||Q.side==="bottom"||Q.side==="left")&<({type:"tab.dropped_into_pane",sourceTabId:O.sourceTabId,sourceTerminalId:O.terminalId,targetTerminalId:Q.terminalId,side:Q.side})}}}function Ue(){ke(null)}const Ke=x.workspaces.find(k=>k.id===x.activeWorkspaceId)??x.workspaces[0],we=Ke?.tabs.find(k=>k.id===Ke.activeTabId)??Ke?.tabs[0],te=we?.activeTerminalId??null,De=te?x.terminals[te]:void 0,Ce=uA("(max-width: 760px)"),Pe=g.useMemo(()=>we?Ku(we.root):[],[we]),$e=Ke&&we?Cu(n,Ke.id,we.id):null,bt=we?o1(Pe,we.activeTerminalId,$e?be[$e]:void 0):null,ht=Ce&&Pe.length>1,Si=g.useMemo(()=>{const k=new Set;for(const O of x.workspaces)for(const Q of O.tabs)for(const fe of th(Q))k.add(fe);return Object.values(x.terminals).filter(O=>!k.has(O.id))},[x.terminals,x.workspaces]),[J,Fe]=g.useState([]),Oe=g.useRef([]),Tt=g.useRef(null),[ji,Ai]=g.useState(null),[$t,Vi]=g.useState([]),[Li,Xi]=g.useState(()=>Zr()),Vs=g.useRef(0),as=g.useRef(n),Pt=g.useRef(PS),wi=g.useRef(Li),Lt=g.useRef(()=>{});Lt.current=ni;const Ci=g.useCallback(async()=>{try{const k=await f.listNotificationAssets();Vi(k.assets.filter(O=>O.enabled).map(O=>O.url))}catch{Vi([])}},[f]);g.useEffect(()=>{q(k=>k.some(O=>Tn(O,n))?k:[...k,n])},[n]);const Hi=g.useCallback(k=>{const O=Wt(k),Q=yo(k);for(const fe of Object.keys(O.state.terminals))Vp(Q.createWebSocketUrl(fe)),vS(fe);gN(k),q(fe=>fe.filter(xe=>!Tn(xe,k))),_e(fe=>{const xe=`${wu(k)}:`;let Ne=!1;const Ae=new Set;for(const vt of fe){if(vt.startsWith(xe)){Ne=!0;continue}Ae.add(vt)}return Ne?Ae:fe}),D(fe=>{const xe=`${wu(k)}:`;let Ne=!1;const Ae={};for(const[vt,ot]of Object.entries(fe)){if(vt.startsWith(xe)){Ne=!0;continue}Ae[vt]=ot}return Ne?Ae:fe})},[]);g.useEffect(()=>{let k=!1;return f.listAgents().then(O=>{if(!k){const Q=O.agents.map(xe=>xe.id),fe=[null,...Q];n!==null&&!Q.includes(n)&&(Hi(n),a?.(null)),j(fe)}}).catch(()=>{}),()=>{k=!0}},[n,f,Hi,a,z]);const ln=g.useCallback(k=>{Hi(k),G(O=>O+1),Tn(k,as.current)&&a?.(null)},[Hi,a]);g.useEffect(()=>{j(k=>k.some(O=>Tn(O,n))?k:[...k,n])},[n]),g.useEffect(()=>{as.current=n},[n]),g.useEffect(()=>{Ci()},[Ci]),g.useEffect(()=>S0(()=>Xi(Zr())),[]),g.useEffect(()=>{const k=O=>{Lt.current(O)};return window.addEventListener("keydown",k,!0),()=>window.removeEventListener("keydown",k,!0)},[]),g.useEffect(()=>{Pt.current=$t.length>0?$t:PS},[$t]),g.useEffect(()=>{wi.current=Li},[Li]),g.useEffect(()=>{if(!w.loaded||!Ke||!we)return;const k=Cu(n,Ke.id,we.id);_e(O=>{if(O.has(k))return O;const Q=new Set(O);return Q.add(k),Q})},[n,w.loaded,Ke?.id,we?.id]),g.useEffect(()=>()=>{wr()},[]),g.useEffect(()=>dN(k=>{const O=Wt(k.agentId).state,Q=O.workspaces.flatMap(Ae=>Ae.tabs).find(Ae=>Ae.id===k.tabId),fe=O.terminals[k.terminalId],xe=Q?.title?.trim()||fe?.title||k.commandName||"terminal",Ne=document.visibilityState==="visible"&&Tn(k.agentId,as.current)&&k.tabId===dA(O);if(Ne||c2({tabTitle:xe,commandName:k.commandName,terminalId:k.terminalId}),!Ne&&document.visibilityState==="visible"&&wi.current.enabled){const Ae=Vs.current+1;Vs.current=Ae;const vt=Pt.current;Ai({id:Ae,agentId:k.agentId,terminalId:k.terminalId,tabId:k.tabId,tabTitle:xe,commandName:k.commandName,assetSrc:vt[Math.floor(Math.random()*vt.length)]??JN})}}),[]),g.useEffect(()=>{if(!ji||Li.persistUntilDismissed)return;const k=window.setTimeout(()=>{Ai(O=>O?.id===ji.id?null:O)},Li.durationSeconds*1e3);return()=>window.clearTimeout(k)},[ji,Li]),g.useEffect(()=>{he.current?.focus(),he.current?.select()},[W?.workspaceId]),g.useEffect(()=>{yA(K),K&&ne(null)},[K]),g.useEffect(()=>{let k=!1;async function O(){if(!Wt(n).loaded){Wr(n,!1,null);try{const fe=pA(p),[xe,Ne]=await Promise.all([m.listTerminals(),m.getTerminalLayout()]),Ae=xe.terminals.length>0?xe.terminals:[(await m.createTerminal({cols:80,rows:24})).terminal];if(!k){const vt=Ne.layout?u1(Ne.layout):null,ot=vt??fe??{},Fi=em(Ae,void 0,ot.savedWorkspaces,ot.savedActiveWorkspaceId),A=Hf(Fi);LS(n,Fi),hu(n,Ne.revision,JSON.stringify(A)),Wr(n,!0,null),!vt&&fe&&On(A,{baseRevision:Ne.revision})}}catch(fe){!k&&!Ei(fe)&&Wr(n,!0,io(fe))}}}return O(),()=>{k=!0}},[n,m,N]);function bs(){Wr(n,!1,null),U(k=>k+1)}async function Ss(){await Kt(async()=>{const k=await m.createTerminal({cols:80,rows:24});lt({type:"terminal.created",terminal:k.terminal})})}async function _t(k){await Kt(async()=>{const O=te?{parentTerminalId:te,cols:80,rows:24}:{cols:80,rows:24},Q=await m.createTerminal(O);lt({type:"terminal.split",terminal:Q.terminal,direction:k})})}async function St(k){if(!te)throw new Error("No active pane is available.");const O=await m.readFile(k),Q=`editor-${Date.now().toString(36)}-${vN(n)}`,fe=vA(O.path);BS(n,xe=>({...xe,[Q]:{id:Q,title:fe,rootToken:k.rootToken,path:O.path,read:O}})),$e&&D(xe=>({...xe,[$e]:c1(Q)})),lt({type:"editor.split",editorId:Q,title:fe,direction:"vertical"})}function Bt(k){BS(n,O=>{const Q={...O};return delete Q[k],Q}),lt({type:"editor.closed",editorId:k})}function ii(k){kt([k])}function kt(k){for(const O of k)lt({type:"terminal.detached",terminalId:O})}async function Yt(k){await Kt(async()=>{await wt(k),Vp(m.createWebSocketUrl(k)),vS(k),lt({type:"terminal.closed",terminalId:k})})}async function si(k,O){const Q=O.trim();if(!Q)return;let fe=null;for(const xe of x.workspaces){const Ne=xe.tabs.find(Ae=>Ae.id===k);if(Ne){fe=Ne.activeTerminalId;break}}if(lt({type:"tab.renamed",tabId:k,title:Q}),!!fe)try{const xe=await m.renameTerminal(fe,Q);Pi({type:"terminal.updated",terminal:xe.terminal})}catch(xe){Wr(n,!0,io(xe))}}function xi(k){const O=x.terminals[k];O&<({type:"terminal.created",terminal:O})}async function wt(k){try{await m.closeTerminal(k)}catch(O){if(O instanceof Mn&&O.status===404)return;throw O}}async function Ui(){await Kt(async()=>{await c()})}async function Kt(k){Wr(n,!0,null);try{await k()}catch(O){if(Ei(O))return;Wr(n,!0,io(O))}}function Ei(k){return k instanceof Mn&&k.status===401&&!m.isAgent&&h?(h(),!0):!1}function lt(k){eo(n,k);const O=Wt(n),Q=O.state;if(!O.loaded||Q.workspaces.length===0)return;const fe=Hf(Q);JSON.stringify(fe)!==O.lastPersistedLayoutJson&&Cs(fe)}function Pi(k){eo(n,k)}function Ti(k,O,Q,fe){const xe=Cu(k,O,Q);D(Ne=>({...Ne,[xe]:fe}))}function Ki(k){$e&&D(O=>({...O,[$e]:k}))}function st(k,O){const Q=Iu(k);O?Ti(n,O.workspaceId,O.tabId,Q):Ki(Q),lt({type:"pane.selected",terminalId:k})}function Ot(k){Ki(k.key),k.type==="terminal"&<({type:"pane.selected",terminalId:k.terminalId})}function ni(k){if(ie||k.isComposing||k.key==="Process"||aA(k.target))return;const O=iA(k);if(!O)return;if(k.preventDefault(),k.stopPropagation(),O.type==="server.previous"||O.type==="server.next"){Gi(O.type==="server.next"?1:-1);return}const Q=Wt(n).state,fe=Q.workspaces.find(Ae=>Ae.id===Q.activeWorkspaceId)??Q.workspaces[0],xe=fe?.tabs.find(Ae=>Ae.id===fe.activeTabId)??fe?.tabs[0];if(O.type==="split"){if(!xe)return;_t(O.direction);return}if(!fe||!xe)return;if(O.type==="tab.previous"||O.type==="tab.next"){const Ae=rA(fe.tabs,xe.id,O.type==="tab.next"?1:-1);Ae&<({type:"tab.selected",tabId:Ae.id});return}if(O.type==="tab.index"){const Ae=fe.tabs[O.index-1];Ae&<({type:"tab.selected",tabId:Ae.id});return}const Ne=sA(xe.root,xe.activeTerminalId,O);Ne&&st(Ne,{workspaceId:fe.id,tabId:xe.id})}function Gi(k){if(!a||P.length===0)return;const O=P.findIndex(Ne=>Tn(Ne,n)),fe=((O===-1?0:O)+k+P.length)%P.length,xe=P[fe]??null;Tn(xe,n)||a(xe)}function Vt(k){HS(k.dataTransfer)&&(k.preventDefault(),k.dataTransfer.dropEffect="copy")}function il(k){if(!HS(k.dataTransfer))return;k.preventDefault();const O=mA(Wt(n).state),Q=ge.current+1;if(ge.current=Q,!O){Bn({id:Q,status:"failed",fileCount:0,message:"No active running terminal is available for upload."});return}Bn({id:Q,status:"queued",fileCount:0,terminalId:O.id,message:"Preparing upload..."}),sa(Q,O.id,k.dataTransfer)}async function sa(k,O,Q){try{const fe=await FN(Q);if(fe.length===0)throw new Error("No files were found in the drop.");di(k,{id:k,status:"queued",fileCount:fe.length,message:"Queued"},{terminalId:O,files:fe})}catch(fe){di(k,{id:k,status:"failed",fileCount:0,message:io(fe)},{terminalId:O})}finally{ls()}}async function br(k){const O=Oe.current.find(Ne=>Ne.id===k);if(!O?.terminalId||!O.files||O.files.length===0)return;const Q=O.terminalId,fe=O.files,xe=new AbortController;Tt.current=k,di(k,{id:k,status:"uploading",fileCount:fe.length,loaded:0,total:null,percent:null},{terminalId:Q,files:fe,abortController:xe});try{const Ne=await W2({terminalId:Q,files:fe,signal:xe.signal,onProgress:Fi=>{di(k,{id:k,status:"uploading",fileCount:fe.length,loaded:Fi.loaded,total:Fi.total,percent:Fi.percent},{terminalId:Q,files:fe,abortController:xe})}}),Ae=Ne.failed>0?Ne.uploaded>0?"partial":"failed":"success",vt=Ne.failed>0?_A(Ne):void 0,ot={id:k,status:Ae,fileCount:fe.length,response:Ne};vt&&(ot.message=vt),di(k,ot,{terminalId:Q,files:fe})}catch(Ne){di(k,{id:k,status:"failed",fileCount:fe.length,message:xe.signal.aborted?"Upload canceled.":io(Ne)},{terminalId:Q,files:fe})}finally{Tt.current===k&&(Tt.current=null),ls()}}function ls(){if(Tt.current!==null)return;const k=Oe.current.find(O=>O.status==="queued");k?.terminalId&&k.files&&k.files.length>0&&br(k.id)}function Bn(k){ri(O=>[...O,k])}function di(k,O,Q={}){ri(fe=>fe.map(xe=>{if(xe.id!==k)return xe;const Ne={...O},Ae=Q.terminalId??xe.terminalId,vt=Q.files??xe.files;return Ae!==void 0&&(Ne.terminalId=Ae),vt!==void 0&&(Ne.files=vt),Q.abortController!==void 0&&(Ne.abortController=Q.abortController),Ne}))}function ri(k){const O=k(Oe.current);Oe.current=O,Fe(O)}function ws(k){Oe.current.find(Q=>Q.id===k)?.abortController?.abort(),Tt.current===k&&(Tt.current=null),ri(Q=>Q.filter(fe=>fe.id!==k)),ls()}function Xs(){for(const k of Oe.current)k.abortController?.abort();Tt.current=null,ri(()=>[])}function Mt(k){const O=Oe.current.find(Q=>Q.id===k);if(O){if(O.status==="queued"){ws(k);return}O.abortController?.abort()}}function na(k){const O=Oe.current.find(fe=>fe.id===k);if(!O?.terminalId||!O.files||O.files.length===0)return;const Q=Sr(O);if(Q.length===0){di(k,{id:k,status:"failed",fileCount:O.fileCount,message:"No failed files are available to retry."},{terminalId:O.terminalId,files:O.files});return}di(k,{id:k,status:"queued",fileCount:Q.length,message:"Queued"},{terminalId:O.terminalId,files:Q}),ls()}function Sr(k){const O=k.files??[],Q="response"in k?k.response:void 0;if(!Q)return O;const fe=Q.results.filter(Ae=>Ae.status==="failed").map(Ae=>Ae.relativePath);if(fe.length===0)return[];const xe=new Map;for(const Ae of O){const vt=xe.get(Ae.relativePath)??[];vt.push(Ae),xe.set(Ae.relativePath,vt)}const Ne=[];for(const Ae of fe){const ot=xe.get(Ae)?.shift();ot&&Ne.push(ot)}return Ne}function os(k){const Q=Wt(k.agentId).state.workspaces.find(fe=>fe.tabs.some(xe=>xe.id===k.tabId));Q&&Ti(k.agentId,Q.id,k.tabId,Iu(k.terminalId)),eo(k.agentId,{type:"pane.selected",terminalId:k.terminalId}),_N(k.agentId,k.tabId),Tn(k.agentId,n)||a?.(k.agentId),Ai(null)}function Cs(k){const O=Wt(n).mutable.saveCoord;O.pendingLayoutSave=k,to(k,p),O.saveTimer!==null&&window.clearTimeout(O.saveTimer),O.saveTimer=window.setTimeout(()=>{O.saveTimer=null;const Q=O.pendingLayoutSave;O.pendingLayoutSave=null,Q&&On(Q)},QN)}function wr(){const k=Wt(n).mutable.saveCoord;k.saveTimer!==null&&(window.clearTimeout(k.saveTimer),k.saveTimer=null);const O=k.pendingLayoutSave;k.pendingLayoutSave=null,O&&(to(O,p),On(O))}function On(k,O={}){const Q=Wt(n).mutable.saveCoord;Q.nextPersistLayout=k,O.baseRevision!==void 0&&(Q.queuedBaseRevision=O.baseRevision),!Q.nextPersistQueued&&(Q.nextPersistQueued=!0,Q.persistChain=Q.persistChain.then(async()=>{Q.nextPersistQueued=!1;const fe=Q.nextPersistLayout,xe=Q.queuedBaseRevision;Q.nextPersistLayout=null,Q.queuedBaseRevision=void 0,fe&&await Cr(fe,xe!==void 0?{baseRevision:xe}:{})}))}async function Cr(k,O={}){const Q=Wt(n),fe=O.baseRevision??Q.layoutRevision,xe={layout:k,...typeof fe=="number"?{baseRevision:fe}:{}};try{const Ne=await m.saveTerminalLayout(xe),Ae=Ne.layout??k;hu(n,Ne.revision,JSON.stringify(Ae)),to(Ae,p);return}catch(Ne){if(Ne instanceof Mn&&Ne.status===409)try{const Ae=await m.getTerminalLayout();if(Ae.layout){const vt=Wt(n).state,ot=em(Object.values(vt.terminals),void 0,Ae.layout.workspaces,Ae.layout.activeWorkspaceId),Fi=Hf(ot);LS(n,ot),hu(n,Ae.revision,JSON.stringify(Fi)),to(Fi,p)}else hu(n,Ae.revision,Q.lastPersistedLayoutJson);return}catch{}to(k,p)}}const sl=bA(o),Ii=!K||T,Ps=Ii?re:"servers";return _.jsx(jE,{sensors:me,onDragStart:Se,onDragEnd:Me,onDragCancel:Ue,children:_.jsxs("main",{className:"terminal-shell","data-collapsed":K,"data-sidebar-open":T,onDragOver:Vt,onDrop:il,children:[_.jsx("button",{type:"button",className:"workspace-backdrop","aria-label":"Close workspaces",onClick:()=>Y(!1)}),_.jsxs("aside",{className:"workspace-sidebar",children:[_.jsxs("header",{className:"workspace-brand",children:[Ii?_.jsx(VS,{height:20}):_.jsx(YS,{size:24}),_.jsx("button",{type:"button",className:"sidebar-collapse-button","aria-label":K?"Expand sidebar":"Collapse sidebar",title:K?"Expand sidebar":"Collapse sidebar",onClick:()=>X(k=>!k),children:K?">":"<"}),_.jsx("button",{type:"button",className:"sidebar-drawer-close-button","aria-label":"Close workspaces",title:"Close workspaces",onClick:()=>Y(!1),children:"x"})]}),_.jsxs("div",{className:`workspace-sidebar-content workspace-sidebar-content--${Ps==="files"?"files":"servers"}`,children:[Ii?_.jsxs("div",{className:"workspace-sidebar-tabs",role:"tablist","aria-label":"Sidebar mode",children:[_.jsx("button",{type:"button",role:"tab","aria-selected":re==="servers",onClick:()=>{ee("servers"),ne(null)},children:"Servers"}),_.jsx("button",{type:"button",role:"tab","aria-selected":re==="files",onClick:()=>{ee("files"),ne(null)},children:"Files"})]}):null,Ps==="servers"&&Ii?_.jsx("nav",{className:"workspace-nav","aria-label":"Servers",children:_.jsx(_f,{api:f,activeAgentId:n,onSelectServer:a??(()=>{}),onSessionInvalid:h,refreshToken:z})}):null,Ii?null:_.jsx("nav",{className:"workspace-nav workspace-nav--collapsed","aria-label":"Servers",children:_.jsx(_f,{api:f,activeAgentId:n,onSelectServer:a??(()=>{}),onSessionInvalid:h,refreshToken:z,compact:!0})}),Ps==="files"?_.jsxs(_.Fragment,{children:[Ii?_.jsx("nav",{className:"workspace-nav workspace-nav--compact","aria-label":"Servers",children:_.jsx(_f,{api:f,activeAgentId:n,onSelectServer:a??(()=>{}),onSessionInvalid:h,refreshToken:z})}):null,_.jsx(G2,{api:m,activeTerminalId:te,activeTerminalCwd:De?.cwd??null,onOpenFile:St})]}):null]}),Ii?_.jsxs("div",{className:"workspace-sidebar-footer",children:[_.jsx("span",{children:sl}),_.jsxs("div",{className:"workspace-sidebar-footer-actions",children:[_.jsxs("button",{type:"button",className:"workspace-footer-icon-button","aria-label":"settings",title:"Settings",onClick:()=>le(!0),children:[_.jsx(IS,{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:()=>{Ui()},children:_.jsx(IS,{name:"logout"})})]})]}):null]}),ie?_.jsx(F2,{api:f,onClose:()=>le(!1),updateAvailable:de.hasUpdates,onNotificationAssetsChanged:()=>{Ci()},onAgentRemoved:ln}):null,_.jsxs("section",{className:"terminal-main","aria-label":"Terminal workspace","data-mobile-pane-switcher":ht?"true":void 0,children:[_.jsx(SN,{tabs:Ke?.tabs??[],activeTabId:Ke?.activeTabId??null,terminals:x.terminals,unreadCompletionTabIds:w.unreadCompletions,detachedTerminals:Si,onSelectTab:k=>lt({type:"tab.selected",tabId:k}),onCreateTab:()=>{Ss()},onToggleWorkspaces:()=>Y(k=>!k),onCloseTerminals:k=>kt(k),onReattachTerminal:k=>xi(k),onDeleteTerminal:k=>{Yt(k)},onSplitVertical:()=>{_t("vertical")},onSplitHorizontal:()=>{_t("horizontal")},onRenameTab:(k,O)=>{si(k,O)},activePaneAvailable:!!te}),ht?_.jsx(oA,{targets:Pe,activeLeafKey:bt,terminals:x.terminals,editors:C,onSelect:Ot}):null,B?_.jsxs("div",{className:"workspace-error",role:"alert",children:[_.jsx("span",{children:B}),_.jsxs("div",{className:"workspace-error-actions",children:[_.jsx("button",{type:"button",onClick:bs,children:"Retry"}),n!==null&&a?_.jsx("button",{type:"button",onClick:()=>a(null),children:"Main server"}):null]})]}):null,_.jsxs("section",{className:"workspace-body","aria-busy":E,children:[E?_.jsx("div",{className:"workspace-placeholder",children:"Opening shell..."}):null,!E&&!we?_.jsx(lA,{onCreate:()=>{Ss()}}):null,M.map(k=>{const O=Tn(k,n);return _.jsx(tA,{agentId:k,active:O,activeServerApi:O?m:void 0,visitedTabKeys:V,refreshCwdOnEnter:O&&Ps==="files",draggingTab:O?pe:null,mobileSplitFocus:Ce,mobileFocusedLeafByTabKey:be,onSelect:Q=>{O&&st(Q)},onClose:Q=>{O&&ii(Q)},onCloseEditor:Q=>{O&&Bt(Q)},onResize:(Q,fe)=>{O&<({type:"pane.resized",path:Q,ratio:fe})},onExit:(Q,fe)=>{O?Pi({type:"terminal.exited",terminalId:Q,exitCode:fe}):eo(k,{type:"terminal.exited",terminalId:Q,exitCode:fe})},onSnapshot:(Q,fe)=>{const xe={type:"terminal.updated",terminal:Q,notifyCompletion:fe?.notifyCompletion===!0};O?Pi(xe):eo(k,xe)},...k===null&&h?{onAuthClose:h}:{}},wu(k))})]}),_.jsx(LN,{toast:ji,onActivate:os,onDismiss:()=>Ai(null)}),_.jsx(TN,{uploads:J,onDismiss:ws,onDismissAll:Xs,onRetry:na,onCancel:Mt})]})]})})}function tA({agentId:e,active:t,activeServerApi:n,visitedTabKeys:a,refreshCwdOnEnter:o,draggingTab:c,mobileSplitFocus:h,mobileFocusedLeafByTabKey:f,onSelect:m,onClose:p,onCloseEditor:b,onResize:y,onExit:w,onSnapshot:x,onAuthClose:C}){const E=g.useMemo(()=>de=>e1(e,de),[e]),B=g.useMemo(()=>()=>Wt(e),[e]),T=g.useSyncExternalStore(E,B,B),Y=g.useMemo(()=>yo(e),[e]),K=n??Y,X=T.state,re=X.workspaces.find(de=>de.id===X.activeWorkspaceId)??X.workspaces[0],ee=re?.id??null,le=(re?.tabs.find(de=>de.id===re.activeTabId)??re?.tabs[0])?.id??null;return!T.loaded||X.workspaces.length===0?null:_.jsx("div",{className:"workspace-server-surface","data-active":t,"aria-hidden":!t,children:X.workspaces.flatMap(de=>de.tabs.map(N=>{const U=t&&de.id===ee&&N.id===le,P=Cu(e,de.id,N.id),j=Ku(N.root),z=h&&j.length>1?o1(j,N.activeTerminalId,f[P]):null;return!U&&!a.has(P)?null:_.jsx("div",{className:"workspace-tab-surface","data-active":U,"aria-hidden":!U,children:_.jsx(Zp,{node:N.root,terminals:X.terminals,editors:T.editors,api:K,activeTerminalId:N.activeTerminalId,visible:U,refreshCwdOnEnter:U&&o,tabId:N.id,dropZoneActive:U&&c!==null,draggingTerminalId:U?c?.terminalId??null:null,mobileFocusLeafKey:z,onSelect:m,onClose:p,onCloseEditor:b,onResize:y,onExit:w,onSnapshot:x,...C?{onAuthClose:C}:{}})},`${de.id}:${N.id}`)}))})}function iA(e){const t=g2(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=nA(e.key);return n?{type:"pane.direction",direction:n}:null}return null}function sA(e,t,n){switch(n.type){case"pane.direction":return zN(e,t,n.direction);case"pane.index":return jN(e,n.index);default:return null}}function nA(e){switch(e){case"ArrowLeft":return"left";case"ArrowRight":return"right";case"ArrowUp":return"up";case"ArrowDown":return"down";default:return null}}function rA(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 Ku(e){return e.type==="pane"?[{key:Iu(e.terminalId),type:"terminal",terminalId:e.terminalId}]:e.type==="editor"?[{key:c1(e.editorId),type:"editor",editorId:e.editorId,title:e.title}]:[...Ku(e.first),...Ku(e.second)]}function o1(e,t,n){if(n&&e.some(o=>o.key===n))return n;const a=t?Iu(t):null;return a&&e.some(o=>o.key===a)?a:e[0]?.key??null}function Iu(e){return`terminal:${e}`}function c1(e){return`editor:${e}`}function aA(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 lA({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 oA({targets:e,activeLeafKey:t,terminals:n,editors:a,onSelect:o}){const[c,h]=g.useState(!1);if(e.length<=1)return null;const f=t?e.findIndex(w=>w.key===t):-1,m=f>=0?f:0,p=e[m]??e[0],b=KS(p,n,a);function y(w){const x=(m+w+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:b,onClick:()=>h(!0),children:["Pane ",m+1,"/",e.length," | ",b]}),_.jsx("button",{type:"button","aria-label":"Next pane",onClick:()=>y(1),children:">"}),c?_.jsx("div",{className:"mobile-pane-sheet-backdrop",onClick:()=>h(!1),children:_.jsxs("section",{className:"mobile-pane-sheet",role:"dialog","aria-modal":"true","aria-label":"Pane switcher",onClick:w=>w.stopPropagation(),children:[_.jsxs("header",{children:[_.jsx("strong",{children:"Panes"}),_.jsx("button",{type:"button","aria-label":"Close pane switcher",onClick:()=>h(!1),children:"x"})]}),_.jsx("div",{className:"mobile-pane-sheet-list",children:e.map((w,x)=>{const C=KS(w,n,a),E=cA(w,n,a),B=w.key===p.key;return _.jsxs("button",{type:"button","data-active":B,onClick:()=>{o(w),h(!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:E})]}),_.jsx("span",{className:"mobile-pane-sheet-type",children:w.type})]},w.key)})})]})}):null]})}function KS(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 cA(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 uA(e){const[t,n]=g.useState(()=>hA(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 hA(e){return typeof window>"u"||typeof window.matchMedia!="function"?!1:window.matchMedia(e).matches}function Tn(e,t){return e===t}function dA(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 wu(e){return e??"__local__"}function Cu(e,t,n){return`${wu(e)}:${t}:${n}`}function fA(e){return e?{workspaceKey:`${US}:${e}`}:{workspaceKey:US}}function pA(e){const t=localStorage.getItem(e.workspaceKey);if(!t)return null;try{const n=JSON.parse(t),a=_0(n);return a?u1(a):null}catch{return null}}function u1(e){const t=_0(e);return t?{savedWorkspaces:t.workspaces,savedActiveWorkspaceId:t.activeWorkspaceId}:null}function to(e,t){if(e.workspaces.length>0){localStorage.setItem(t.workspaceKey,JSON.stringify(e));return}localStorage.removeItem(t.workspaceKey)}function mA(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 _A(e){return e.results.find(t=>t.status==="failed"&&t.error)?.error}function vA(e){return e.split("/").filter(Boolean).pop()??e}function gA(){try{return localStorage.getItem(l1)==="true"}catch{return!1}}function yA(e){try{localStorage.setItem(l1,e?"true":"false")}catch{}}function bA(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 IS({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 io(e){return e instanceof Error?e.message:"Request failed"}function SA({api:e,onDone:t}){const[n,a]=g.useState(null),[o,c]=g.useState(null),[h,f]=g.useState(""),[m,p]=g.useState(!1),[b,y]=g.useState(null),[w,x]=g.useState(null);g.useEffect(()=>{let E=!1;return e.setupTotp().then(B=>{E||(a(B.qrDataUrl),c(B.secret))}).catch(B=>{E||x(B instanceof Error?B.message:"Failed to generate QR code")}),()=>{E=!0}},[e]);async function C(E){if(E.preventDefault(),!!o){p(!0),y(null);try{await e.activateTotp({secret:o,otp:h}),t()}catch(B){y(B instanceof Error?B.message:"Verification failed")}finally{p(!1)}}}return w?_.jsx("p",{className:"form-error",children:w}):!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:h,onChange:E=>f(E.currentTarget.value.replace(/\D/g,"")),placeholder:"000000",required:!0})]}),b?_.jsx("p",{className:"form-error",children:b}):null,_.jsx("button",{type:"submit",disabled:m||h.length!==6,children:"Activate 2FA"})]})]})}function wA({api:e,serverApi:t,activeAgentId:n=null,onSelectServer:a}){const o=g.useMemo(()=>e??Fu(),[e]),c=g.useMemo(()=>t??yo(null),[t]),[h,f]=g.useState(null),[m,p]=g.useState(null);g.useEffect(()=>{let C=!1;return o.getSession().then(E=>{C||(f(E),p(null))}).catch(E=>{C||(p(Lo(E)),f(null))}),()=>{C=!0}},[o]);const b=TA(h);async function y(){const C=await o.getSession();f(C),p(null)}async function w(){CS(),OS(),LR(),p(null),f(null);try{await y()}catch(C){p(Lo(C))}}if(b==="workspace")return _.jsx(eA,{api:o,serverApi:c,activeAgentId:n,onSelectServer:a,sessionExpiresAt:h?.expiresAt??null,onSessionInvalid:()=>{w()},onLogout:async()=>{CS(),OS();const C=await o.logout();f(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":b==="loading",children:[_.jsxs("header",{className:"auth-header",children:[_.jsxs("div",{className:"auth-brand",children:[_.jsx(YS,{size:26}),_.jsxs("div",{children:[_.jsx(VS,{height:17}),_.jsx("p",{className:"auth-host",children:"local terminal"})]})]}),_.jsx("h1",{children:x[b]})]}),m?_.jsx("p",{className:"form-error",children:m}):null,b==="loading"?_.jsx("p",{className:"muted",children:"Checking session..."}):null,b==="loading"&&m?_.jsx("button",{type:"button",className:"secondary-button",onClick:()=>{w()},children:"Retry"}):null,b==="setup_password"?_.jsx(CA,{api:o,onSession:C=>{f(C)}}):null,b==="setup_totp"?_.jsx(SA,{api:o,onDone:()=>{y()}}):null,b==="login"?_.jsx(xA,{api:o,session:h,onSession:f,onRefresh:y}):null,b==="reauth"?_.jsx(EA,{api:o,session:h,onSession:f,onFullLogin:()=>f(C=>C&&{...C,deviceTrusted:!1})}):null]})]})}function CA({api:e,onSession:t}){const[n,a]=g.useState(""),[o,c]=g.useState(""),[h,f]=g.useState(!1),[m,p]=g.useState(null);async function b(y){y.preventDefault(),f(!0),p(null);try{if(n!==o){p("Passwords do not match");return}t(await e.setupPassword({password:n}))}catch(w){p(Lo(w))}finally{f(!1)}}return _.jsxs("form",{className:"auth-form",onSubmit:b,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:h||n.length<8||o.length<8,children:"Set password"})]})}function xA({api:e,session:t,onSession:n,onRefresh:a}){const[o,c]=g.useState(""),[h,f]=g.useState(""),[m,p]=g.useState(!1),[b,y]=g.useState(!1),[w,x]=g.useState(null),C=t?.totpEnabled??!1,E=t?.currentIpWhitelisted??!1;async function B(T){T.preventDefault(),y(!0),x(null);try{n(await e.login({password:o,...C?{otp:h}:{},rememberNetwork:m}))}catch(Y){x(Lo(Y))}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:T=>c(T.currentTarget.value),required:!0})]}),C?_.jsxs("label",{children:["Authenticator code",_.jsx("input",{type:"text",inputMode:"numeric",pattern:"[0-9]{6}",maxLength:6,value:h,onChange:T=>f(T.currentTarget.value.replace(/\D/g,"")),placeholder:"000000",required:!0})]}):null,E?null:_.jsxs("label",{className:"auth-checkbox",children:[_.jsx("input",{type:"checkbox",checked:m,onChange:T=>p(T.currentTarget.checked)}),"Remember this network (skip 2FA here next time)"]}),w?_.jsx("p",{className:"form-error",children:w}):null,_.jsxs("div",{className:"button-row",children:[_.jsx("button",{type:"submit",disabled:b||o.length===0||C&&h.length!==6,children:"Unlock"}),_.jsx("button",{type:"button",className:"secondary-button",onClick:()=>{a()},disabled:b,children:"Refresh"})]})]})}function EA({api:e,session:t,onSession:n,onFullLogin:a}){const o=t?.currentIpWhitelisted??!1,[c,h]=g.useState(""),[f,m]=g.useState(!1),[p,b]=g.useState(!1),[y,w]=g.useState(null),x=ei.useRef(!1),C=ei.useCallback(async(B,T)=>{b(!0),w(null);try{n(await e.reauth({...B?{otp:B}:{},rememberNetwork:T}))}catch(Y){w(Lo(Y))}finally{b(!1)}},[e,n]);g.useEffect(()=>{o&&!x.current&&(x.current=!0,C(void 0,!1))},[o,C]);async function E(B){B.preventDefault(),await C(c,f)}return o&&!y?_.jsx("p",{className:"muted",children:"Reconnecting from a trusted network…"}):_.jsxs("form",{className:"auth-form",onSubmit:E,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=>h(B.currentTarget.value.replace(/\D/g,"")),placeholder:"000000",required:!0})]}),_.jsxs("label",{className:"auth-checkbox",children:[_.jsx("input",{type:"checkbox",checked:f,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:p||c.length!==6,children:"Continue"}),_.jsx("button",{type:"button",className:"secondary-button",onClick:a,disabled:p,children:"Use password instead"})]})]})}function TA(e){return e?e.passwordSet?e.authenticated&&!e.totpEnabled?"setup_totp":e.authenticated?"workspace":e.deviceTrusted&&e.totpEnabled?"reauth":"login":"setup_password":"loading"}function Lo(e){return e instanceof Error?e.message:"Request failed"}const FS="NTerminal",dm="nterminal.activeAgentId";function kA(){const[e,t]=g.useState(()=>DA()),n=g.useMemo(()=>Fu(),[]),a=g.useMemo(()=>yo(e),[e]);g.useEffect(()=>{const c=()=>{const h=mN();document.title=h>0?`(${h}) ${FS}`:FS};return c(),pN(c)},[]);function o(c){RA(c),t(c)}return _.jsx(wA,{api:n,activeAgentId:e,serverApi:a,onSelectServer:o})}function DA(){if(typeof window>"u")return null;try{const e=window.localStorage.getItem(dm);return e&&e.trim()?e:null}catch{return null}}function RA(e){if(!(typeof window>"u"))try{if(e){window.localStorage.setItem(dm,e);return}window.localStorage.removeItem(dm)}catch{}}const qS=["gesturestart","gesturechange","gestureend"],MA=[".workspace-list",".workspace-nav",".server-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 NA(e=window){if(!LA(e))return()=>{};const t={passive:!1},n=e.document;function a(c){c.cancelable&&c.preventDefault()}function o(c){if(c.defaultPrevented)return;const h=c.touches;!h||h.length===0||(h.length>1||!AA(c.target))&&a(c)}for(const c of qS)n.addEventListener(c,a,t);return n.addEventListener("touchmove",o,t),n.addEventListener("dblclick",a,t),()=>{for(const c of qS)n.removeEventListener(c,a,t);n.removeEventListener("touchmove",o,t),n.removeEventListener("dblclick",a,t)}}function AA(e){return e instanceof Element&&e.closest(MA)!==null}function LA(e){return e.navigator.maxTouchPoints>0?!0:typeof e.matchMedia=="function"&&e.matchMedia("(pointer: coarse)").matches}ER();NA();Om();wx.createRoot(document.getElementById("root")).render(_.jsx(ei.StrictMode,{children:_.jsx(kA,{})}));export{ei as R,fx as g,_ as j};
|
|
54
|
+
(detached — click to re-open, × to delete)`;return m.jsxs("span",{className:"terminal-detached-pill",title:o,children:[m.jsx("button",{type:"button",className:"terminal-detached-pill-open","aria-label":`Re-open ${a}`,onClick:t,children:a}),m.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 LN({terminal:e,onCancel:t,onConfirm:n}){const a=e.title||e.cwd||e.id.slice(0,8);return m.jsx("div",{className:"security-overlay",role:"dialog","aria-modal":"true","aria-labelledby":"delete-terminal-title",onClick:t,children:m.jsxs("div",{className:"security-panel terminal-delete-dialog",onClick:o=>o.stopPropagation(),children:[m.jsxs("header",{className:"security-panel-header",children:[m.jsx("h2",{id:"delete-terminal-title",children:"Delete Terminal"}),m.jsx("button",{type:"button",className:"security-close","aria-label":"Close",onClick:t,children:"×"})]}),m.jsxs("section",{className:"terminal-delete-dialog-body",children:[m.jsx("p",{children:"Delete this terminal?"}),m.jsx("span",{children:a}),m.jsx("small",{children:"The shell session and scrollback will be destroyed."})]}),m.jsxs("div",{className:"terminal-delete-dialog-actions",children:[m.jsx("button",{type:"button",className:"secondary-button",onClick:t,children:"Cancel"}),m.jsx("button",{type:"button",className:"terminal-delete-confirm",onClick:n,children:"Delete"})]})]})})}function BN({uploads:e,onDismiss:t,onDismissAll:n,onRetry:a,onCancel:o}){if(e.length===0)return null;const h=e.some(_=>_.status==="failed"||_.status==="partial")?"alert":"status",f=e.filter(_=>_.status==="queued"||_.status==="uploading").length;return m.jsxs("aside",{className:`upload-toast upload-toast-${UN(e)}`,role:h,"aria-live":h==="alert"?"assertive":"polite",children:[m.jsxs("header",{className:"upload-toast-header",children:[m.jsx("strong",{children:e.length===1?Su(e[0]):`Uploads ${f>0?`(${f} active)`:`(${e.length})`}`}),m.jsx("button",{type:"button","aria-label":"Dismiss upload status",onClick:n,children:"x"})]}),m.jsx("div",{className:"upload-toast-body upload-queue-body",children:e.map(_=>m.jsx(ON,{upload:_,compact:e.length>1,onDismiss:()=>t(_.id),onRetry:()=>a(_.id),onCancel:()=>o(_.id)},_.id))})]})}function ON({upload:e,compact:t,onDismiss:n,onRetry:a,onCancel:o}){const c="response"in e?e.response:void 0,h=e.status==="failed"||e.status==="partial",f=e.status==="queued"||e.status==="uploading";return m.jsxs("section",{className:"upload-queue-item","data-status":e.status,"aria-label":Su(e),children:[m.jsxs("div",{className:"upload-queue-item-header",children:[m.jsx("strong",{children:Su(e)}),m.jsxs("div",{className:"upload-queue-actions",children:[f?m.jsx("button",{type:"button",onClick:o,children:"Cancel"}):null,h?m.jsx("button",{type:"button",onClick:a,children:"Retry"}):null,m.jsx("button",{type:"button","aria-label":`Dismiss ${Su(e)}`,onClick:n,children:"x"})]})]}),e.status==="queued"?m.jsx("p",{children:e.message??"Queued"}):null,e.status==="uploading"?m.jsx(zN,{toast:e}):null,c&&"message"in e&&e.message?m.jsx("p",{className:"upload-toast-muted",children:e.message}):null,c?m.jsx(jN,{response:c,compact:t}):null,e.status==="failed"&&!c&&e.message?m.jsx("p",{children:e.message}):null]})}function zN({toast:e}){const t=e.percent===null?PN(e.loaded):`${e.percent}%`;return m.jsxs(m.Fragment,{children:[m.jsxs("div",{className:"upload-progress-row",children:[m.jsxs("span",{children:[e.fileCount," file",e.fileCount===1?"":"s"]}),m.jsx("span",{children:t})]}),m.jsx("div",{className:"upload-progress-track","aria-hidden":"true",children:m.jsx("span",{style:{width:e.percent===null?"100%":`${e.percent}%`}})})]})}function jN({response:e,compact:t}){const n=e.results.filter(h=>h.status==="failed"),a=e.results.filter(h=>h.status==="uploaded"),o=t?3:6,c=[...n,...a].slice(0,o);return m.jsxs(m.Fragment,{children:[m.jsx("p",{className:"upload-toast-destination",children:e.destinationCwd}),c.length>0?m.jsx("ul",{className:"upload-result-list",children:c.map((h,f)=>m.jsx(HN,{result:h},`${h.relativePath}-${f}`))}):null,e.results.length>c.length?m.jsxs("p",{className:"upload-toast-muted",children:["+",e.results.length-c.length," more"]}):null]})}function HN({result:e}){const t=e.savedRelativePath??e.relativePath,n=e.status==="uploaded"&&e.savedRelativePath!==void 0&&e.savedRelativePath!==e.relativePath;return m.jsxs("li",{"data-status":e.status,children:[m.jsx("span",{className:"upload-result-path",children:t}),n?m.jsx("span",{className:"upload-result-renamed",children:"renamed"}):null,e.status==="failed"&&e.error?m.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 UN(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 PN(e){return e<1024?`${e} B`:e<1024*1024?`${Math.round(e/1024)} KB`:`${Math.round(e/(1024*1024))} MB`}function KN({toast:e,onActivate:t,onDismiss:n}){if(!e)return null;const a=e,o=a.commandName?`${a.commandName} finished`:"Command finished";function c(f){f.stopPropagation(),n()}function h(f){f.key!=="Enter"&&f.key!==" "||(f.preventDefault(),t(a))}return m.jsxs("aside",{className:"completion-toast",role:"status","aria-live":"polite",tabIndex:0,onClick:()=>t(a),onKeyDown:h,children:[m.jsx("video",{className:"completion-toast-character",src:a.assetSrc,muted:!0,autoPlay:!0,loop:!0,playsInline:!0,"aria-hidden":"true"}),m.jsxs("div",{className:"completion-toast-copy",children:[m.jsx("strong",{children:a.tabTitle}),m.jsx("span",{children:o})]}),m.jsx("button",{type:"button","aria-label":"Dismiss completion alert",onClick:c,children:"x"})]})}const IN=po(0,0,1,1),Rn=1e-6;function FN(e){return l1(e).map(t=>t.terminalId)}function l1(e){return fo(e,IN).sort(YN).map((t,n)=>({...t,index:n+1}))}function qN(e,t,n){const a=l1(e),o=a.find(h=>h.terminalId===t);return o?a.filter(h=>h.terminalId!==t).map(h=>$N(o,h,n)).filter(h=>h!==null).sort(VN)[0]?.entry.terminalId??null:null}function WN(e,t){return!Number.isInteger(t)||t<1?null:FN(e)[t-1]??null}function fo(e,t){if(e.type==="pane")return[{terminalId:e.terminalId,bounds:t}];if(e.type==="editor")return[];const n=XN(e.ratio);if(e.direction==="vertical"){const o=t.left+(t.right-t.left)*n;return[...fo(e.first,po(t.left,t.top,o,t.bottom)),...fo(e.second,po(o,t.top,t.right,t.bottom))]}const a=t.top+(t.bottom-t.top)*n;return[...fo(e.first,po(t.left,t.top,t.right,a)),...fo(e.second,po(t.left,a,t.right,t.bottom))]}function $N(e,t,n){const a=e.bounds,o=t.bounds,c=IS(a.left,a.right,o.left,o.right),h=IS(a.top,a.bottom,o.top,o.bottom);switch(n){case"left":return o.centerX>=a.centerX-Rn||h<=Rn?null:{entry:t,primaryDistance:Math.max(0,a.left-o.right),perpendicularDistance:Math.abs(a.centerY-o.centerY),overlap:h};case"right":return o.centerX<=a.centerX+Rn||h<=Rn?null:{entry:t,primaryDistance:Math.max(0,o.left-a.right),perpendicularDistance:Math.abs(a.centerY-o.centerY),overlap:h};case"up":return o.centerY>=a.centerY-Rn||c<=Rn?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+Rn||c<=Rn?null:{entry:t,primaryDistance:Math.max(0,o.top-a.bottom),perpendicularDistance:Math.abs(a.centerX-o.centerX),overlap:c};default:return null}}function YN(e,t){return qa(e.bounds.top,t.bounds.top)||qa(e.bounds.left,t.bounds.left)}function VN(e,t){return qa(e.primaryDistance,t.primaryDistance)||qa(e.perpendicularDistance,t.perpendicularDistance)||qa(t.overlap,e.overlap)||qa(e.entry.index,t.entry.index)}function qa(e,t){const n=e-t;return Math.abs(n)<=Rn?0:n}function IS(e,t,n,a){return Math.max(0,Math.min(t,a)-Math.max(e,n))}function po(e,t,n,a){return{left:e,top:t,right:n,bottom:a,centerX:e+(n-e)/2,centerY:t+(a-t)/2}}function XN(e){return Number.isFinite(e)?Math.min(.9,Math.max(.1,e)):.5}class GN extends Error{constructor(t){super(t),this.name="UploadDropError"}}function FS(e){return e?Array.from(e.types??[]).includes("Files")||h1(e.items).some(n=>n.kind==="file")?!0:d1(e.files).length>0:!1}async function ZN(e){const t=h1(e.items).filter(n=>n.kind==="file");return t.length>0?QN(t):JN(e.files)}async function QN(e){const t=[];for(const n of e){const a=s3(n);if(a){await o1(a,"",t);continue}const o=n.getAsFile();if(o){t.push({relativePath:c1(o),file:o});continue}throw new GN("Folder upload is not supported by this browser.")}return t}function JN(e){return d1(e).map(t=>({relativePath:c1(t),file:t}))}async function o1(e,t,n){const a=r3(t,e.name);if(e.isFile){const h=await e3(e);n.push({relativePath:a,file:h});return}if(!e.isDirectory)return;const o=e.createReader(),c=await t3(o);for(const h of c)await o1(h,a,n)}function e3(e){return new Promise((t,n)=>{e.file(t,a=>n(a))})}async function t3(e){const t=[];for(;;){const n=await i3(e);if(n.length===0)return t;t.push(...n)}}function i3(e){return new Promise((t,n)=>{e.readEntries(t,a=>n(a))})}function c1(e){const t=e.webkitRelativePath;return u1(typeof t=="string"&&t?t:e.name)}function s3(e){const t=e.webkitGetAsEntry?.();return n3(t)?t:null}function n3(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 r3(e,t){return u1(e?`${e}/${t}`:t)}function u1(e){return e.replace(/\\/g,"/").replace(/^\/+/,"").split("/").filter(Boolean).join("/")}function h1(e){return e?Array.from(e):[]}function d1(e){return e?Array.from(e):[]}const qS="nterminal.terminalWorkspaces.v2",f1="nterminal.sidebarCollapsed.v1",a3=75,WS=x0.map(e=>e.url),l3=x0[0].url;function o3({api:e,serverApi:t,activeAgentId:n=null,onSelectServer:a,sessionExpiresAt:o=null,onLogout:c=async()=>{},onSessionInvalid:h}){const f=v.useMemo(()=>e??Fu(),[e]),_=v.useMemo(()=>t??wo(null),[t]),p=v.useMemo(()=>S3(n),[n]),b=v.useMemo(()=>k=>a1(n,k),[n]),y=v.useMemo(()=>()=>$t(n),[n]),w=v.useSyncExternalStore(b,y,y),x=w.state,C=w.editors,E=!w.loaded,B=w.error,[T,Y]=v.useState(!1),[P,X]=v.useState(()=>T3()),[ee,te]=v.useState("servers"),[se,le]=v.useState(!1),de=v.useSyncExternalStore(KE,gb,gb);v.useSyncExternalStore(z0,_b,_b);const[N,U]=v.useState(0),[K,j]=v.useState(()=>[null]),[z,G]=v.useState(0),[M,q]=v.useState(()=>[n]),[V,_e]=v.useState(()=>new Set),[be,D]=v.useState({}),[W,re]=v.useState(null),he=v.useRef(null);v.useRef(!1);const ve=v.useRef(0),[pe,ke]=v.useState(null),me=Vx(Zy(_0,{activationConstraint:{distance:8}}),Zy(g0,{activationConstraint:{delay:250,tolerance:5}}));v.useEffect(()=>IE(f),[f]);function Se(k){const O=k.active.data.current;if(O){if(O.kind==="tab"&&typeof O.tabId=="string"&&typeof O.terminalId=="string"){ke({tabId:O.tabId,terminalId:O.terminalId});return}O.kind==="pane"&&typeof O.sourceTabId=="string"&&typeof O.terminalId=="string"&&ke({tabId:O.sourceTabId,terminalId:O.terminalId})}}function Me(k){ke(null);const O=k.active.data.current,J=k.over?.data.current;if(!(!O||!J||typeof O.terminalId!="string")){if(O.kind==="tab"&&typeof O.tabId=="string"){if(J.kind==="tab-position"&&typeof J.index=="number"){ot({type:"tab.reordered",sourceTabId:O.tabId,targetIndex:J.index});return}J.kind==="pane-zone"&&typeof J.terminalId=="string"&&(J.side==="top"||J.side==="right"||J.side==="bottom"||J.side==="left")&&ot({type:"tab.dropped_into_pane",sourceTabId:O.tabId,sourceTerminalId:O.terminalId,targetTerminalId:J.terminalId,side:J.side});return}if(O.kind==="pane"&&typeof O.sourceTabId=="string"){if(J.kind==="tab-position"&&typeof J.index=="number"){ot({type:"terminal.extracted_to_tab",sourceTabId:O.sourceTabId,sourceTerminalId:O.terminalId,targetIndex:J.index});return}J.kind==="pane-zone"&&typeof J.terminalId=="string"&&(J.side==="top"||J.side==="right"||J.side==="bottom"||J.side==="left")&&ot({type:"tab.dropped_into_pane",sourceTabId:O.sourceTabId,sourceTerminalId:O.terminalId,targetTerminalId:J.terminalId,side:J.side})}}}function Ue(){ke(null)}const Ke=x.workspaces.find(k=>k.id===x.activeWorkspaceId)??x.workspaces[0],we=Ke?.tabs.find(k=>k.id===Ke.activeTabId)??Ke?.tabs[0],ie=we?.activeTerminalId??null,De=ie?x.terminals[ie]:void 0,Ce=v3("(max-width: 760px)"),Pe=v.useMemo(()=>we?Ku(we.root):[],[we]),$e=Ke&&we?Cu(n,Ke.id,we.id):null,St=we?p1(Pe,we.activeTerminalId,$e?be[$e]:void 0):null,dt=Ce&&Pe.length>1,wi=v.useMemo(()=>{const k=new Set;for(const O of x.workspaces)for(const J of O.tabs)for(const fe of ih(J))k.add(fe);return Object.values(x.terminals).filter(O=>!k.has(O.id))},[x.terminals,x.workspaces]),[Q,Fe]=v.useState([]),Oe=v.useRef([]),kt=v.useRef(null),[Ui,Li]=v.useState(null),[Yt,Xi]=v.useState([]),[Bi,Gi]=v.useState(()=>Qr()),Xs=v.useRef(0),ls=v.useRef(n),Kt=v.useRef(WS),Ci=v.useRef(Bi),Bt=v.useRef(()=>{});Bt.current=ni;const xi=v.useCallback(async()=>{try{const k=await f.listNotificationAssets();Xi(k.assets.filter(O=>O.enabled).map(O=>O.url))}catch{Xi([])}},[f]);v.useEffect(()=>{q(k=>k.some(O=>kn(O,n))?k:[...k,n])},[n]);const Pi=v.useCallback(k=>{const O=$t(k),J=wo(k);for(const fe of Object.keys(O.state.terminals))Gp(J.createWebSocketUrl(fe)),wS(fe);TN(k),q(fe=>fe.filter(xe=>!kn(xe,k))),_e(fe=>{const xe=`${wu(k)}:`;let Ne=!1;const Ae=new Set;for(const vt of fe){if(vt.startsWith(xe)){Ne=!0;continue}Ae.add(vt)}return Ne?Ae:fe}),D(fe=>{const xe=`${wu(k)}:`;let Ne=!1;const Ae={};for(const[vt,ct]of Object.entries(fe)){if(vt.startsWith(xe)){Ne=!0;continue}Ae[vt]=ct}return Ne?Ae:fe})},[]);v.useEffect(()=>{let k=!1;return f.listAgents().then(O=>{if(!k){const J=O.agents.map(xe=>xe.id),fe=[null,...J];n!==null&&!J.includes(n)&&(Pi(n),a?.(null)),j(fe)}}).catch(()=>{}),()=>{k=!0}},[n,f,Pi,a,z]);const on=v.useCallback(k=>{Pi(k),G(O=>O+1),kn(k,ls.current)&&a?.(null)},[Pi,a]);v.useEffect(()=>{j(k=>k.some(O=>kn(O,n))?k:[...k,n])},[n]),v.useEffect(()=>{ls.current=n},[n]),v.useEffect(()=>{xi()},[xi]),v.useEffect(()=>D0(()=>Gi(Qr())),[]),v.useEffect(()=>{const k=O=>{Bt.current(O)};return window.addEventListener("keydown",k,!0),()=>window.removeEventListener("keydown",k,!0)},[]),v.useEffect(()=>{Kt.current=Yt.length>0?Yt:WS},[Yt]),v.useEffect(()=>{Ci.current=Bi},[Bi]),v.useEffect(()=>{if(!w.loaded||!Ke||!we)return;const k=Cu(n,Ke.id,we.id);_e(O=>{if(O.has(k))return O;const J=new Set(O);return J.add(k),J})},[n,w.loaded,Ke?.id,we?.id]),v.useEffect(()=>()=>{Cr()},[]),v.useEffect(()=>bN(k=>{const O=$t(k.agentId).state,J=O.workspaces.flatMap(Ae=>Ae.tabs).find(Ae=>Ae.id===k.tabId),fe=O.terminals[k.terminalId],xe=J?.title?.trim()||fe?.title||k.commandName||"terminal",Ne=document.visibilityState==="visible"&&kn(k.agentId,ls.current)&&k.tabId===b3(O);if(Ne||bE({tabTitle:xe,commandName:k.commandName,terminalId:k.terminalId}),!Ne&&document.visibilityState==="visible"&&Ci.current.enabled){const Ae=Xs.current+1;Xs.current=Ae;const vt=Kt.current;Li({id:Ae,agentId:k.agentId,terminalId:k.terminalId,tabId:k.tabId,tabTitle:xe,commandName:k.commandName,assetSrc:vt[Math.floor(Math.random()*vt.length)]??l3})}}),[]),v.useEffect(()=>{if(!Ui||Bi.persistUntilDismissed)return;const k=window.setTimeout(()=>{Li(O=>O?.id===Ui.id?null:O)},Bi.durationSeconds*1e3);return()=>window.clearTimeout(k)},[Ui,Bi]),v.useEffect(()=>{he.current?.focus(),he.current?.select()},[W?.workspaceId]),v.useEffect(()=>{k3(P),P&&re(null)},[P]),v.useEffect(()=>{let k=!1;async function O(){if(!$t(n).loaded){$r(n,!1,null);try{const fe=w3(p),[xe,Ne]=await Promise.all([_.listTerminals(),_.getTerminalLayout()]),Ae=xe.terminals.length>0?xe.terminals:[(await _.createTerminal({cols:80,rows:24})).terminal];if(!k){const vt=Ne.layout?_1(Ne.layout):null,ct=vt??fe??{},qi=im(Ae,void 0,ct.savedWorkspaces,ct.savedActiveWorkspaceId),A=Pf(qi);HS(n,qi),hu(n,Ne.revision,JSON.stringify(A)),$r(n,!0,null),!vt&&fe&&zn(A,{baseRevision:Ne.revision})}}catch(fe){!k&&!Ti(fe)&&$r(n,!0,ro(fe))}}}return O(),()=>{k=!0}},[n,_,N]);function Ss(){$r(n,!1,null),U(k=>k+1)}async function ws(){await It(async()=>{const k=await _.createTerminal({cols:80,rows:24});ot({type:"terminal.created",terminal:k.terminal})})}async function gt(k){await It(async()=>{const O=ie?{parentTerminalId:ie,cols:80,rows:24}:{cols:80,rows:24},J=await _.createTerminal(O);ot({type:"terminal.split",terminal:J.terminal,direction:k})})}async function wt(k){if(!ie)throw new Error("No active pane is available.");const O=await _.readFile(k),J=`editor-${Date.now().toString(36)}-${EN(n)}`,fe=E3(O.path);US(n,xe=>({...xe,[J]:{id:J,title:fe,rootToken:k.rootToken,path:O.path,read:O}})),$e&&D(xe=>({...xe,[$e]:m1(J)})),ot({type:"editor.split",editorId:J,title:fe,direction:"vertical"})}function Ot(k){US(n,O=>{const J={...O};return delete J[k],J}),ot({type:"editor.closed",editorId:k})}function ii(k){Dt([k])}function Dt(k){for(const O of k)ot({type:"terminal.detached",terminalId:O})}async function Vt(k){await It(async()=>{await Ct(k),Gp(_.createWebSocketUrl(k)),wS(k),ot({type:"terminal.closed",terminalId:k})})}async function si(k,O){const J=O.trim();if(!J)return;let fe=null;for(const xe of x.workspaces){const Ne=xe.tabs.find(Ae=>Ae.id===k);if(Ne){fe=Ne.activeTerminalId;break}}if(ot({type:"tab.renamed",tabId:k,title:J}),!!fe)try{const xe=await _.renameTerminal(fe,J);Ii({type:"terminal.updated",terminal:xe.terminal})}catch(xe){$r(n,!0,ro(xe))}}function Ei(k){const O=x.terminals[k];O&&ot({type:"terminal.created",terminal:O})}async function Ct(k){try{await _.closeTerminal(k)}catch(O){if(O instanceof Nn&&O.status===404)return;throw O}}async function Ki(){await It(async()=>{await c()})}async function It(k){$r(n,!0,null);try{await k()}catch(O){if(Ti(O))return;$r(n,!0,ro(O))}}function Ti(k){return k instanceof Nn&&k.status===401&&!_.isAgent&&h?(h(),!0):!1}function ot(k){so(n,k);const O=$t(n),J=O.state;if(!O.loaded||J.workspaces.length===0)return;const fe=Pf(J);JSON.stringify(fe)!==O.lastPersistedLayoutJson&&xs(fe)}function Ii(k){so(n,k)}function ki(k,O,J,fe){const xe=Cu(k,O,J);D(Ne=>({...Ne,[xe]:fe}))}function Fi(k){$e&&D(O=>({...O,[$e]:k}))}function nt(k,O){const J=Iu(k);O?ki(n,O.workspaceId,O.tabId,J):Fi(J),ot({type:"pane.selected",terminalId:k})}function zt(k){Fi(k.key),k.type==="terminal"&&ot({type:"pane.selected",terminalId:k.terminalId})}function ni(k){if(se||k.isComposing||k.key==="Process"||p3(k.target))return;const O=u3(k);if(!O)return;if(k.preventDefault(),k.stopPropagation(),O.type==="server.previous"||O.type==="server.next"){Zi(O.type==="server.next"?1:-1);return}const J=$t(n).state,fe=J.workspaces.find(Ae=>Ae.id===J.activeWorkspaceId)??J.workspaces[0],xe=fe?.tabs.find(Ae=>Ae.id===fe.activeTabId)??fe?.tabs[0];if(O.type==="split"){if(!xe)return;gt(O.direction);return}if(!fe||!xe)return;if(O.type==="tab.previous"||O.type==="tab.next"){const Ae=f3(fe.tabs,xe.id,O.type==="tab.next"?1:-1);Ae&&ot({type:"tab.selected",tabId:Ae.id});return}if(O.type==="tab.index"){const Ae=fe.tabs[O.index-1];Ae&&ot({type:"tab.selected",tabId:Ae.id});return}const Ne=h3(xe.root,xe.activeTerminalId,O);Ne&&nt(Ne,{workspaceId:fe.id,tabId:xe.id})}function Zi(k){if(!a||K.length===0)return;const O=K.findIndex(Ne=>kn(Ne,n)),fe=((O===-1?0:O)+k+K.length)%K.length,xe=K[fe]??null;kn(xe,n)||a(xe)}function Xt(k){FS(k.dataTransfer)&&(k.preventDefault(),k.dataTransfer.dropEffect="copy")}function rl(k){if(!FS(k.dataTransfer))return;k.preventDefault();const O=C3($t(n).state),J=ve.current+1;if(ve.current=J,!O){On({id:J,status:"failed",fileCount:0,message:"No active running terminal is available for upload."});return}On({id:J,status:"queued",fileCount:0,terminalId:O.id,message:"Preparing upload..."}),na(J,O.id,k.dataTransfer)}async function na(k,O,J){try{const fe=await ZN(J);if(fe.length===0)throw new Error("No files were found in the drop.");fi(k,{id:k,status:"queued",fileCount:fe.length,message:"Queued"},{terminalId:O,files:fe})}catch(fe){fi(k,{id:k,status:"failed",fileCount:0,message:ro(fe)},{terminalId:O})}finally{os()}}async function Sr(k){const O=Oe.current.find(Ne=>Ne.id===k);if(!O?.terminalId||!O.files||O.files.length===0)return;const J=O.terminalId,fe=O.files,xe=new AbortController;kt.current=k,fi(k,{id:k,status:"uploading",fileCount:fe.length,loaded:0,total:null,percent:null},{terminalId:J,files:fe,abortController:xe});try{const Ne=await JE({terminalId:J,files:fe,signal:xe.signal,onProgress:qi=>{fi(k,{id:k,status:"uploading",fileCount:fe.length,loaded:qi.loaded,total:qi.total,percent:qi.percent},{terminalId:J,files:fe,abortController:xe})}}),Ae=Ne.failed>0?Ne.uploaded>0?"partial":"failed":"success",vt=Ne.failed>0?x3(Ne):void 0,ct={id:k,status:Ae,fileCount:fe.length,response:Ne};vt&&(ct.message=vt),fi(k,ct,{terminalId:J,files:fe})}catch(Ne){fi(k,{id:k,status:"failed",fileCount:fe.length,message:xe.signal.aborted?"Upload canceled.":ro(Ne)},{terminalId:J,files:fe})}finally{kt.current===k&&(kt.current=null),os()}}function os(){if(kt.current!==null)return;const k=Oe.current.find(O=>O.status==="queued");k?.terminalId&&k.files&&k.files.length>0&&Sr(k.id)}function On(k){ri(O=>[...O,k])}function fi(k,O,J={}){ri(fe=>fe.map(xe=>{if(xe.id!==k)return xe;const Ne={...O},Ae=J.terminalId??xe.terminalId,vt=J.files??xe.files;return Ae!==void 0&&(Ne.terminalId=Ae),vt!==void 0&&(Ne.files=vt),J.abortController!==void 0&&(Ne.abortController=J.abortController),Ne}))}function ri(k){const O=k(Oe.current);Oe.current=O,Fe(O)}function Cs(k){Oe.current.find(J=>J.id===k)?.abortController?.abort(),kt.current===k&&(kt.current=null),ri(J=>J.filter(fe=>fe.id!==k)),os()}function Gs(){for(const k of Oe.current)k.abortController?.abort();kt.current=null,ri(()=>[])}function Nt(k){const O=Oe.current.find(J=>J.id===k);if(O){if(O.status==="queued"){Cs(k);return}O.abortController?.abort()}}function ra(k){const O=Oe.current.find(fe=>fe.id===k);if(!O?.terminalId||!O.files||O.files.length===0)return;const J=wr(O);if(J.length===0){fi(k,{id:k,status:"failed",fileCount:O.fileCount,message:"No failed files are available to retry."},{terminalId:O.terminalId,files:O.files});return}fi(k,{id:k,status:"queued",fileCount:J.length,message:"Queued"},{terminalId:O.terminalId,files:J}),os()}function wr(k){const O=k.files??[],J="response"in k?k.response:void 0;if(!J)return O;const fe=J.results.filter(Ae=>Ae.status==="failed").map(Ae=>Ae.relativePath);if(fe.length===0)return[];const xe=new Map;for(const Ae of O){const vt=xe.get(Ae.relativePath)??[];vt.push(Ae),xe.set(Ae.relativePath,vt)}const Ne=[];for(const Ae of fe){const ct=xe.get(Ae)?.shift();ct&&Ne.push(ct)}return Ne}function cs(k){const J=$t(k.agentId).state.workspaces.find(fe=>fe.tabs.some(xe=>xe.id===k.tabId));J&&ki(k.agentId,J.id,k.tabId,Iu(k.terminalId)),so(k.agentId,{type:"pane.selected",terminalId:k.terminalId}),xN(k.agentId,k.tabId),kn(k.agentId,n)||a?.(k.agentId),Li(null)}function xs(k){const O=$t(n).mutable.saveCoord;O.pendingLayoutSave=k,no(k,p),O.saveTimer!==null&&window.clearTimeout(O.saveTimer),O.saveTimer=window.setTimeout(()=>{O.saveTimer=null;const J=O.pendingLayoutSave;O.pendingLayoutSave=null,J&&zn(J)},a3)}function Cr(){const k=$t(n).mutable.saveCoord;k.saveTimer!==null&&(window.clearTimeout(k.saveTimer),k.saveTimer=null);const O=k.pendingLayoutSave;k.pendingLayoutSave=null,O&&(no(O,p),zn(O))}function zn(k,O={}){const J=$t(n).mutable.saveCoord;J.nextPersistLayout=k,O.baseRevision!==void 0&&(J.queuedBaseRevision=O.baseRevision),!J.nextPersistQueued&&(J.nextPersistQueued=!0,J.persistChain=J.persistChain.then(async()=>{J.nextPersistQueued=!1;const fe=J.nextPersistLayout,xe=J.queuedBaseRevision;J.nextPersistLayout=null,J.queuedBaseRevision=void 0,fe&&await xr(fe,xe!==void 0?{baseRevision:xe}:{})}))}async function xr(k,O={}){const J=$t(n),fe=O.baseRevision??J.layoutRevision,xe={layout:k,...typeof fe=="number"?{baseRevision:fe}:{}};try{const Ne=await _.saveTerminalLayout(xe),Ae=Ne.layout??k;hu(n,Ne.revision,JSON.stringify(Ae)),no(Ae,p);return}catch(Ne){if(Ne instanceof Nn&&Ne.status===409)try{const Ae=await _.getTerminalLayout();if(Ae.layout){const vt=$t(n).state,ct=im(Object.values(vt.terminals),void 0,Ae.layout.workspaces,Ae.layout.activeWorkspaceId),qi=Pf(ct);HS(n,ct),hu(n,Ae.revision,JSON.stringify(qi)),no(qi,p)}else hu(n,Ae.revision,J.lastPersistedLayoutJson);return}catch{}no(k,p)}}const al=D3(o),Oi=!P||T,Ks=Oi?ee:"servers";return m.jsx(V2,{sensors:me,onDragStart:Se,onDragEnd:Me,onDragCancel:Ue,children:m.jsxs("main",{className:"terminal-shell","data-collapsed":P,"data-sidebar-open":T,onDragOver:Xt,onDrop:rl,children:[m.jsx("button",{type:"button",className:"workspace-backdrop","aria-label":"Close workspaces",onClick:()=>Y(!1)}),m.jsxs("aside",{className:"workspace-sidebar",children:[m.jsxs("header",{className:"workspace-brand",children:[Oi?m.jsx(t0,{height:20}):m.jsx(e0,{size:24}),m.jsx("button",{type:"button",className:"sidebar-collapse-button","aria-label":P?"Expand sidebar":"Collapse sidebar",title:P?"Expand sidebar":"Collapse sidebar",onClick:()=>X(k=>!k),children:P?">":"<"}),m.jsx("button",{type:"button",className:"sidebar-drawer-close-button","aria-label":"Close workspaces",title:"Close workspaces",onClick:()=>Y(!1),children:"x"})]}),m.jsxs("div",{className:`workspace-sidebar-content workspace-sidebar-content--${Ks==="files"?"files":"servers"}`,children:[Oi?m.jsxs("div",{className:"workspace-sidebar-tabs",role:"tablist","aria-label":"Sidebar mode",children:[m.jsx("button",{type:"button",role:"tab","aria-selected":ee==="servers",onClick:()=>{te("servers"),re(null)},children:"Servers"}),m.jsx("button",{type:"button",role:"tab","aria-selected":ee==="files",onClick:()=>{te("files"),re(null)},children:"Files"})]}):null,Ks==="servers"&&Oi?m.jsx("nav",{className:"workspace-nav","aria-label":"Servers",children:m.jsx(vf,{api:f,activeAgentId:n,onSelectServer:a??(()=>{}),onSessionInvalid:h,refreshToken:z})}):null,Oi?null:m.jsx("nav",{className:"workspace-nav workspace-nav--collapsed","aria-label":"Servers",children:m.jsx(vf,{api:f,activeAgentId:n,onSelectServer:a??(()=>{}),onSessionInvalid:h,refreshToken:z,compact:!0})}),Ks==="files"?m.jsxs(m.Fragment,{children:[Oi?m.jsx("nav",{className:"workspace-nav workspace-nav--compact","aria-label":"Servers",children:m.jsx(vf,{api:f,activeAgentId:n,onSelectServer:a??(()=>{}),onSessionInvalid:h,refreshToken:z})}):null,m.jsx(nT,{api:_,activeTerminalId:ie,activeTerminalCwd:De?.cwd??null,onOpenFile:wt})]}):null]}),m.jsxs("div",{className:"workspace-sidebar-footer",children:[Oi?m.jsx("span",{children:al}):null,m.jsxs("div",{className:"workspace-sidebar-footer-actions",children:[m.jsxs("button",{type:"button",className:"workspace-footer-icon-button","aria-label":"settings",title:"Settings",onClick:()=>le(!0),children:[m.jsx(YS,{name:"settings"}),de.hasUpdates?m.jsx("span",{className:"update-pulse-dot","aria-hidden":"true"}):null]}),Oi?m.jsx("button",{type:"button",className:"workspace-footer-icon-button","aria-label":"logout",title:"Logout",onClick:()=>{Ki()},children:m.jsx(YS,{name:"logout"})}):null]})]})]}),se?m.jsx(ZE,{api:f,onClose:()=>le(!1),updateAvailable:de.hasUpdates,onNotificationAssetsChanged:()=>{xi()},onAgentRemoved:on}):null,m.jsxs("section",{className:"terminal-main","aria-label":"Terminal workspace","data-mobile-pane-switcher":dt?"true":void 0,children:[m.jsx(RN,{tabs:Ke?.tabs??[],activeTabId:Ke?.activeTabId??null,terminals:x.terminals,unreadCompletionTabIds:w.unreadCompletions,detachedTerminals:wi,onSelectTab:k=>ot({type:"tab.selected",tabId:k}),onCreateTab:()=>{ws()},onToggleWorkspaces:()=>Y(k=>!k),onCloseTerminals:k=>Dt(k),onReattachTerminal:k=>Ei(k),onDeleteTerminal:k=>{Vt(k)},onSplitVertical:()=>{gt("vertical")},onSplitHorizontal:()=>{gt("horizontal")},onRenameTab:(k,O)=>{si(k,O)},activePaneAvailable:!!ie}),dt?m.jsx(_3,{targets:Pe,activeLeafKey:St,terminals:x.terminals,editors:C,onSelect:zt}):null,B?m.jsxs("div",{className:"workspace-error",role:"alert",children:[m.jsx("span",{children:B}),m.jsxs("div",{className:"workspace-error-actions",children:[m.jsx("button",{type:"button",onClick:Ss,children:"Retry"}),n!==null&&a?m.jsx("button",{type:"button",onClick:()=>a(null),children:"Main server"}):null]})]}):null,m.jsxs("section",{className:"workspace-body","aria-busy":E,children:[E?m.jsx("div",{className:"workspace-placeholder",children:"Opening shell..."}):null,!E&&!we?m.jsx(m3,{onCreate:()=>{ws()}}):null,M.map(k=>{const O=kn(k,n);return m.jsx(c3,{agentId:k,active:O,activeServerApi:O?_:void 0,visitedTabKeys:V,refreshCwdOnEnter:O&&Ks==="files",draggingTab:O?pe:null,mobileSplitFocus:Ce,mobileFocusedLeafByTabKey:be,onSelect:J=>{O&&nt(J)},onClose:J=>{O&&ii(J)},onCloseEditor:J=>{O&&Ot(J)},onResize:(J,fe)=>{O&&ot({type:"pane.resized",path:J,ratio:fe})},onExit:(J,fe)=>{O?Ii({type:"terminal.exited",terminalId:J,exitCode:fe}):so(k,{type:"terminal.exited",terminalId:J,exitCode:fe})},onSnapshot:(J,fe)=>{const xe={type:"terminal.updated",terminal:J,notifyCompletion:fe?.notifyCompletion===!0};O?Ii(xe):so(k,xe)},...k===null&&h?{onAuthClose:h}:{}},wu(k))})]}),m.jsx(KN,{toast:Ui,onActivate:cs,onDismiss:()=>Li(null)}),m.jsx(BN,{uploads:Q,onDismiss:Cs,onDismissAll:Gs,onRetry:ra,onCancel:Nt})]})]})})}function c3({agentId:e,active:t,activeServerApi:n,visitedTabKeys:a,refreshCwdOnEnter:o,draggingTab:c,mobileSplitFocus:h,mobileFocusedLeafByTabKey:f,onSelect:_,onClose:p,onCloseEditor:b,onResize:y,onExit:w,onSnapshot:x,onAuthClose:C}){const E=v.useMemo(()=>de=>a1(e,de),[e]),B=v.useMemo(()=>()=>$t(e),[e]),T=v.useSyncExternalStore(E,B,B),Y=v.useMemo(()=>wo(e),[e]),P=n??Y,X=T.state,ee=X.workspaces.find(de=>de.id===X.activeWorkspaceId)??X.workspaces[0],te=ee?.id??null,le=(ee?.tabs.find(de=>de.id===ee.activeTabId)??ee?.tabs[0])?.id??null;return!T.loaded||X.workspaces.length===0?null:m.jsx("div",{className:"workspace-server-surface","data-active":t,"aria-hidden":!t,children:X.workspaces.flatMap(de=>de.tabs.map(N=>{const U=t&&de.id===te&&N.id===le,K=Cu(e,de.id,N.id),j=Ku(N.root),z=h&&j.length>1?p1(j,N.activeTerminalId,f[K]):null;return!U&&!a.has(K)?null:m.jsx("div",{className:"workspace-tab-surface","data-active":U,"aria-hidden":!U,children:m.jsx(Jp,{node:N.root,terminals:X.terminals,editors:T.editors,api:P,activeTerminalId:N.activeTerminalId,visible:U,refreshCwdOnEnter:U&&o,tabId:N.id,dropZoneActive:U&&c!==null,draggingTerminalId:U?c?.terminalId??null:null,mobileFocusLeafKey:z,onSelect:_,onClose:p,onCloseEditor:b,onResize:y,onExit:w,onSnapshot:x,...C?{onAuthClose:C}:{}})},`${de.id}:${N.id}`)}))})}function u3(e){const t=RE(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=d3(e.key);return n?{type:"pane.direction",direction:n}:null}return null}function h3(e,t,n){switch(n.type){case"pane.direction":return qN(e,t,n.direction);case"pane.index":return WN(e,n.index);default:return null}}function d3(e){switch(e){case"ArrowLeft":return"left";case"ArrowRight":return"right";case"ArrowUp":return"up";case"ArrowDown":return"down";default:return null}}function f3(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 Ku(e){return e.type==="pane"?[{key:Iu(e.terminalId),type:"terminal",terminalId:e.terminalId}]:e.type==="editor"?[{key:m1(e.editorId),type:"editor",editorId:e.editorId,title:e.title}]:[...Ku(e.first),...Ku(e.second)]}function p1(e,t,n){if(n&&e.some(o=>o.key===n))return n;const a=t?Iu(t):null;return a&&e.some(o=>o.key===a)?a:e[0]?.key??null}function Iu(e){return`terminal:${e}`}function m1(e){return`editor:${e}`}function p3(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 m3({onCreate:e}){return m.jsxs("div",{className:"empty-workspace",children:[m.jsx("span",{children:"No terminal is open."}),m.jsx("button",{type:"button",onClick:e,children:"New tab"})]})}function _3({targets:e,activeLeafKey:t,terminals:n,editors:a,onSelect:o}){const[c,h]=v.useState(!1);if(e.length<=1)return null;const f=t?e.findIndex(w=>w.key===t):-1,_=f>=0?f:0,p=e[_]??e[0],b=$S(p,n,a);function y(w){const x=(_+w+e.length)%e.length,C=e[x];C&&o(C)}return m.jsxs("div",{className:"mobile-pane-switcher",role:"group","aria-label":"Pane switcher",children:[m.jsx("button",{type:"button","aria-label":"Previous pane",onClick:()=>y(-1),children:"<"}),m.jsxs("button",{type:"button",className:"mobile-pane-current","aria-label":"Open pane switcher","aria-haspopup":"dialog","aria-expanded":c,title:b,onClick:()=>h(!0),children:["Pane ",_+1,"/",e.length," | ",b]}),m.jsx("button",{type:"button","aria-label":"Next pane",onClick:()=>y(1),children:">"}),c?m.jsx("div",{className:"mobile-pane-sheet-backdrop",onClick:()=>h(!1),children:m.jsxs("section",{className:"mobile-pane-sheet",role:"dialog","aria-modal":"true","aria-label":"Pane switcher",onClick:w=>w.stopPropagation(),children:[m.jsxs("header",{children:[m.jsx("strong",{children:"Panes"}),m.jsx("button",{type:"button","aria-label":"Close pane switcher",onClick:()=>h(!1),children:"x"})]}),m.jsx("div",{className:"mobile-pane-sheet-list",children:e.map((w,x)=>{const C=$S(w,n,a),E=g3(w,n,a),B=w.key===p.key;return m.jsxs("button",{type:"button","data-active":B,onClick:()=>{o(w),h(!1)},children:[m.jsx("span",{className:"mobile-pane-sheet-index",children:x+1}),m.jsxs("span",{className:"mobile-pane-sheet-copy",children:[m.jsx("strong",{children:C}),m.jsx("small",{children:E})]}),m.jsx("span",{className:"mobile-pane-sheet-type",children:w.type})]},w.key)})})]})}):null]})}function $S(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 g3(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 v3(e){const[t,n]=v.useState(()=>y3(e));return v.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 y3(e){return typeof window>"u"||typeof window.matchMedia!="function"?!1:window.matchMedia(e).matches}function kn(e,t){return e===t}function b3(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 wu(e){return e??"__local__"}function Cu(e,t,n){return`${wu(e)}:${t}:${n}`}function S3(e){return e?{workspaceKey:`${qS}:${e}`}:{workspaceKey:qS}}function w3(e){const t=localStorage.getItem(e.workspaceKey);if(!t)return null;try{const n=JSON.parse(t),a=C0(n);return a?_1(a):null}catch{return null}}function _1(e){const t=C0(e);return t?{savedWorkspaces:t.workspaces,savedActiveWorkspaceId:t.activeWorkspaceId}:null}function no(e,t){if(e.workspaces.length>0){localStorage.setItem(t.workspaceKey,JSON.stringify(e));return}localStorage.removeItem(t.workspaceKey)}function C3(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 x3(e){return e.results.find(t=>t.status==="failed"&&t.error)?.error}function E3(e){return e.split("/").filter(Boolean).pop()??e}function T3(){try{return localStorage.getItem(f1)==="true"}catch{return!1}}function k3(e){try{localStorage.setItem(f1,e?"true":"false")}catch{}}function D3(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 YS({name:e}){return m.jsxs("svg",{className:"workspace-footer-icon",viewBox:"0 0 24 24","aria-hidden":"true",focusable:"false",children:[e==="settings"?m.jsxs(m.Fragment,{children:[m.jsx("path",{d:"M4 7h9"}),m.jsx("path",{d:"M17 7h3"}),m.jsx("circle",{cx:"15",cy:"7",r:"2"}),m.jsx("path",{d:"M4 12h3"}),m.jsx("path",{d:"M11 12h9"}),m.jsx("circle",{cx:"9",cy:"12",r:"2"}),m.jsx("path",{d:"M4 17h9"}),m.jsx("path",{d:"M17 17h3"}),m.jsx("circle",{cx:"15",cy:"17",r:"2"})]}):null,e==="logout"?m.jsxs(m.Fragment,{children:[m.jsx("path",{d:"M10 6H6v12h4"}),m.jsx("path",{d:"M13 8l4 4-4 4"}),m.jsx("path",{d:"M8 12h9"})]}):null]})}function ro(e){return e instanceof Error?e.message:"Request failed"}function R3({api:e,onDone:t}){const[n,a]=v.useState(null),[o,c]=v.useState(null),[h,f]=v.useState(""),[_,p]=v.useState(!1),[b,y]=v.useState(null),[w,x]=v.useState(null);v.useEffect(()=>{let E=!1;return e.setupTotp().then(B=>{E||(a(B.qrDataUrl),c(B.secret))}).catch(B=>{E||x(B instanceof Error?B.message:"Failed to generate QR code")}),()=>{E=!0}},[e]);async function C(E){if(E.preventDefault(),!!o){p(!0),y(null);try{await e.activateTotp({secret:o,otp:h}),t()}catch(B){y(B instanceof Error?B.message:"Verification failed")}finally{p(!1)}}}return w?m.jsx("p",{className:"form-error",children:w}):!n||!o?m.jsx("p",{className:"muted",children:"Generating authenticator setup..."}):m.jsxs("div",{className:"totp-setup",children:[m.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."}),m.jsx("div",{className:"totp-qr-container",children:m.jsx("img",{src:n,alt:"TOTP QR code",width:192,height:192})}),m.jsxs("details",{className:"totp-secret-details",children:[m.jsx("summary",{children:"Can't scan? Enter manually"}),m.jsx("p",{className:"totp-secret-text",children:o})]}),m.jsxs("form",{className:"auth-form",onSubmit:C,children:[m.jsxs("label",{children:["Verification code",m.jsx("input",{autoFocus:!0,type:"text",inputMode:"numeric",pattern:"[0-9]{6}",maxLength:6,value:h,onChange:E=>f(E.currentTarget.value.replace(/\D/g,"")),placeholder:"000000",required:!0})]}),b?m.jsx("p",{className:"form-error",children:b}):null,m.jsx("button",{type:"submit",disabled:_||h.length!==6,children:"Activate 2FA"})]})]})}function M3({api:e,serverApi:t,activeAgentId:n=null,onSelectServer:a}){const o=v.useMemo(()=>e??Fu(),[e]),c=v.useMemo(()=>t??wo(null),[t]),[h,f]=v.useState(null),[_,p]=v.useState(null);v.useEffect(()=>{let C=!1;return o.getSession().then(E=>{C||(f(E),p(null))}).catch(E=>{C||(p(Qa(E)),f(null))}),()=>{C=!0}},[o]);const b=B3(h);async function y(){const C=await o.getSession();f(C),p(null)}async function w(){DS(),PS(),KR(),p(null),f(null);try{await y()}catch(C){p(Qa(C))}}if(b==="workspace")return m.jsx(o3,{api:o,serverApi:c,activeAgentId:n,onSelectServer:a,sessionExpiresAt:h?.expiresAt??null,onSessionInvalid:()=>{w()},onLogout:async()=>{DS(),PS();const C=await o.logout();f(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 m.jsxs("main",{className:"auth-screen",children:[m.jsxs("div",{className:"auth-background","aria-hidden":"true",children:[m.jsx("div",{className:"auth-grid"}),m.jsx("div",{className:"auth-glow"})]}),m.jsxs("section",{className:"auth-panel","aria-busy":b==="loading",children:[m.jsxs("header",{className:"auth-header",children:[m.jsxs("div",{className:"auth-brand",children:[m.jsx(e0,{size:26}),m.jsxs("div",{children:[m.jsx(t0,{height:17}),m.jsx("p",{className:"auth-host",children:"local terminal"})]})]}),m.jsx("h1",{children:x[b]})]}),_?m.jsx("p",{className:"form-error",children:_}):null,b==="loading"?m.jsx("p",{className:"muted",children:"Checking session..."}):null,b==="loading"&&_?m.jsx("button",{type:"button",className:"secondary-button",onClick:()=>{w()},children:"Retry"}):null,b==="setup_password"?m.jsx(N3,{api:o,onSession:C=>{f(C)}}):null,b==="setup_totp"?m.jsx(R3,{api:o,onDone:()=>{y()}}):null,b==="login"?m.jsx(A3,{api:o,session:h,onSession:f,onRefresh:y}):null,b==="reauth"?m.jsx(L3,{api:o,session:h,onSession:f,onFullLogin:()=>f(C=>C&&{...C,deviceTrusted:!1})}):null]})]})}function N3({api:e,onSession:t}){const[n,a]=v.useState(""),[o,c]=v.useState(""),[h,f]=v.useState(!1),[_,p]=v.useState(null);async function b(y){y.preventDefault(),f(!0),p(null);try{if(n!==o){p("Passwords do not match");return}t(await e.setupPassword({password:n}))}catch(w){p(Qa(w))}finally{f(!1)}}return m.jsxs("form",{className:"auth-form",onSubmit:b,children:[m.jsxs("label",{children:["Password",m.jsx("input",{autoFocus:!0,value:n,onChange:y=>a(y.currentTarget.value),type:"password",minLength:8,required:!0})]}),m.jsxs("label",{children:["Confirm password",m.jsx("input",{value:o,onChange:y=>c(y.currentTarget.value),type:"password",minLength:8,required:!0})]}),_?m.jsx("p",{className:"form-error",children:_}):null,m.jsx("button",{type:"submit",disabled:h||n.length<8||o.length<8,children:"Set password"})]})}function A3({api:e,session:t,onSession:n,onRefresh:a}){const[o,c]=v.useState(""),[h,f]=v.useState(""),[_,p]=v.useState(!1),[b,y]=v.useState(!1),[w,x]=v.useState(null),C=t?.totpEnabled??!1,E=t?.currentIpWhitelisted??!1;async function B(T){T.preventDefault(),y(!0),x(null);try{n(await e.login({password:o,...C?{otp:h}:{},rememberNetwork:_}))}catch(Y){x(Qa(Y))}finally{y(!1)}}return m.jsxs("form",{className:"auth-form",onSubmit:B,children:[m.jsxs("label",{children:["Password",m.jsx("input",{autoFocus:!0,type:"password",value:o,onChange:T=>c(T.currentTarget.value),required:!0})]}),C?m.jsxs("label",{children:["Authenticator code",m.jsx("input",{type:"text",inputMode:"numeric",pattern:"[0-9]{6}",maxLength:6,value:h,onChange:T=>f(T.currentTarget.value.replace(/\D/g,"")),placeholder:"000000",required:!0})]}):null,E?null:m.jsxs("label",{className:"auth-checkbox",children:[m.jsx("input",{type:"checkbox",checked:_,onChange:T=>p(T.currentTarget.checked)}),"Remember this network (skip 2FA here next time)"]}),w?m.jsx("p",{className:"form-error",children:w}):null,m.jsxs("div",{className:"button-row",children:[m.jsx("button",{type:"submit",disabled:b||o.length===0||C&&h.length!==6,children:"Unlock"}),m.jsx("button",{type:"button",className:"secondary-button",onClick:()=>{a()},disabled:b,children:"Refresh"})]})]})}function L3({api:e,session:t,onSession:n,onFullLogin:a}){const o=t?.currentIpWhitelisted??!1,[c,h]=v.useState(""),[f,_]=v.useState(!1),[p,b]=v.useState(!1),[y,w]=v.useState(!1),[x,C]=v.useState(!1),[E,B]=v.useState(null),T=hi.useCallback(async(P,X)=>{b(!0),B(null);try{n(await e.reauth({...P?{otp:P}:{},rememberNetwork:X}))}catch(ee){B(Qa(ee))}finally{b(!1)}},[e,n]);v.useEffect(()=>{if(o){let P=!1;w(!0),C(!1),B(null);const X=window.setTimeout(()=>{P||C(!0)},6e3);return e.reauth({rememberNetwork:!1}).then(ee=>{P||n(ee)}).catch(ee=>{P||(B(Qa(ee)),C(!0))}).finally(()=>{window.clearTimeout(X),P||w(!1)}),()=>{P=!0,window.clearTimeout(X)}}},[e,o,n]);async function Y(P){P.preventDefault(),await T(c,f)}return o&&y&&!x&&!E?m.jsx("p",{className:"muted",children:"Reconnecting from a trusted network…"}):m.jsxs("form",{className:"auth-form",onSubmit:Y,children:[o&&x&&!E?m.jsx("p",{className:"muted",children:"Automatic verification is taking longer than expected. You can enter a code or use password login."}):null,m.jsx("p",{className:"muted",children:"This device is remembered. Enter your authenticator code to continue."}),m.jsxs("label",{children:["Authenticator code",m.jsx("input",{autoFocus:!0,type:"text",inputMode:"numeric",pattern:"[0-9]{6}",maxLength:6,value:c,onChange:P=>h(P.currentTarget.value.replace(/\D/g,"")),placeholder:"000000",required:!0})]}),m.jsxs("label",{className:"auth-checkbox",children:[m.jsx("input",{type:"checkbox",checked:f,onChange:P=>_(P.currentTarget.checked)}),"Remember this network (skip 2FA here next time)"]}),E?m.jsx("p",{className:"form-error",children:E}):null,m.jsxs("div",{className:"button-row",children:[m.jsx("button",{type:"submit",disabled:p||c.length!==6,children:"Continue"}),m.jsx("button",{type:"button",className:"secondary-button",onClick:a,disabled:p,children:"Use password instead"})]})]})}function B3(e){return e?e.passwordSet?e.authenticated&&!e.totpEnabled?"setup_totp":e.authenticated?"workspace":e.deviceTrusted&&e.totpEnabled?"reauth":"login":"setup_password":"loading"}function Qa(e){return e instanceof Error?e.message:"Request failed"}const VS="NTerminal",pm="nterminal.activeAgentId";function O3(){const[e,t]=v.useState(()=>z3()),n=v.useMemo(()=>Fu(),[]),a=v.useMemo(()=>wo(e),[e]);v.useEffect(()=>{const c=()=>{const h=CN();document.title=h>0?`(${h}) ${VS}`:VS};return c(),wN(c)},[]);function o(c){j3(c),t(c)}return m.jsx(M3,{api:n,activeAgentId:e,serverApi:a,onSelectServer:o})}function z3(){if(typeof window>"u")return null;try{const e=window.localStorage.getItem(pm);return e&&e.trim()?e:null}catch{return null}}function j3(e){if(!(typeof window>"u"))try{if(e){window.localStorage.setItem(pm,e);return}window.localStorage.removeItem(pm)}catch{}}const XS=["gesturestart","gesturechange","gestureend"],H3=[".workspace-list",".workspace-nav",".server-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 U3(e=window){if(!K3(e))return()=>{};const t={passive:!1},n=e.document;function a(c){c.cancelable&&c.preventDefault()}function o(c){if(c.defaultPrevented)return;const h=c.touches;!h||h.length===0||(h.length>1||!P3(c.target))&&a(c)}for(const c of XS)n.addEventListener(c,a,t);return n.addEventListener("touchmove",o,t),n.addEventListener("dblclick",a,t),()=>{for(const c of XS)n.removeEventListener(c,a,t);n.removeEventListener("touchmove",o,t),n.removeEventListener("dblclick",a,t)}}function P3(e){return e instanceof Element&&e.closest(H3)!==null}function K3(e){return e.navigator.maxTouchPoints>0?!0:typeof e.matchMedia=="function"&&e.matchMedia("(pointer: coarse)").matches}LR();U3();ym();Dx.createRoot(document.getElementById("root")).render(m.jsx(hi.StrictMode,{children:m.jsx(O3,{})}));export{hi as R,yx as g,m as j};
|