nterminal 1.2.51 → 1.2.53
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/dist/client/assets/MarkdownPreview-DvW1iSJP.js +1 -0
- package/dist/client/assets/{TranscriptMarkdownBody-jREm5Kmh.js → TranscriptMarkdownBody-DJbLRp61.js} +1 -1
- package/dist/client/assets/index-BEv9DwQ7.css +1 -0
- package/dist/client/assets/{index-BeRk4E5k.js → index-Bj8e-m7A.js} +1 -1
- package/dist/client/assets/index-DaKyipYG.js +54 -0
- package/dist/client/index.html +2 -2
- package/dist/server/routes/agentManagementRoutes.d.ts +1 -1
- package/dist/server/routes/agentManagementRoutes.js +59 -5
- package/dist/server/routes/agentManagementRoutes.js.map +1 -1
- package/dist/server/storage/fileStore.d.ts +3 -1
- package/dist/server/storage/fileStore.js +24 -0
- package/dist/server/storage/fileStore.js.map +1 -1
- package/dist/shared/protocol.d.ts +6 -0
- package/dist/shared/protocol.js +1 -0
- package/dist/shared/protocol.js.map +1 -1
- package/package.json +1 -1
- package/dist/client/assets/MarkdownPreview-BxmYRWHQ.js +0 -1
- package/dist/client/assets/index-1YWtah1S.js +0 -54
- package/dist/client/assets/index-B-cLQ2bs.css +0 -1
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/MarkdownPreview-BxmYRWHQ.js","assets/index-BeRk4E5k.js","assets/TranscriptMarkdownBody-jREm5Kmh.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 Bx(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var pf={exports:{}},Gl={};var Gy;function Ox(){if(Gy)return Gl;Gy=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 Gl.Fragment=t,Gl.jsx=n,Gl.jsxs=n,Gl}var Zy;function zx(){return Zy||(Zy=1,pf.exports=Ox()),pf.exports}var m=zx(),mf={exports:{}},Ie={};var Qy;function jx(){if(Qy)return Ie;Qy=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"),y=Symbol.for("react.lazy"),b=Symbol.for("react.activity"),S=Symbol.iterator;function C(R){return R===null||typeof R!="object"?null:(R=S&&R[S]||R["@@iterator"],typeof R=="function"?R:null)}var x={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},E=Object.assign,B={};function k(R,G,ae){this.props=R,this.context=G,this.refs=B,this.updater=ae||x}k.prototype.isReactComponent={},k.prototype.setState=function(R,G){if(typeof R!="object"&&typeof R!="function"&&R!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,R,G,"setState")},k.prototype.forceUpdate=function(R){this.updater.enqueueForceUpdate(this,R,"forceUpdate")};function H(){}H.prototype=k.prototype;function U(R,G,ae){this.props=R,this.context=G,this.refs=B,this.updater=ae||x}var X=U.prototype=new H;X.constructor=U,E(X,k.prototype),X.isPureReactComponent=!0;var ee=Array.isArray;function te(){}var ne={H:null,A:null,T:null,S:null},re=Object.prototype.hasOwnProperty;function fe(R,G,ae){var de=ae.ref;return{$$typeof:e,type:R,key:G,ref:de!==void 0?de:null,props:ae}}function K(R,G){return fe(R.type,G,R.props)}function A(R){return typeof R=="object"&&R!==null&&R.$$typeof===e}function I(R){var G={"=":"=0",":":"=2"};return"$"+R.replace(/[=:]/g,function(ae){return G[ae]})}var O=/\/+/g;function j(R,G){return typeof R=="object"&&R!==null&&R.key!=null?I(""+R.key):G.toString(36)}function J(R){switch(R.status){case"fulfilled":return R.value;case"rejected":throw R.reason;default:switch(typeof R.status=="string"?R.then(te,te):(R.status="pending",R.then(function(G){R.status==="pending"&&(R.status="fulfilled",R.value=G)},function(G){R.status==="pending"&&(R.status="rejected",R.reason=G)})),R.status){case"fulfilled":return R.value;case"rejected":throw R.reason}}throw R}function T(R,G,ae,de,ge){var ye=typeof R;(ye==="undefined"||ye==="boolean")&&(R=null);var xe=!1;if(R===null)xe=!0;else switch(ye){case"bigint":case"string":case"number":xe=!0;break;case"object":switch(R.$$typeof){case e:case t:xe=!0;break;case y:return xe=R._init,T(xe(R._payload),G,ae,de,ge)}}if(xe)return ge=ge(R),xe=de===""?"."+j(R,0):de,ee(ge)?(ae="",xe!=null&&(ae=xe.replace(O,"$&/")+"/"),T(ge,G,ae,"",function(ve){return ve})):ge!=null&&(A(ge)&&(ge=K(ge,ae+(ge.key==null||R&&R.key===ge.key?"":(""+ge.key).replace(O,"$&/")+"/")+xe)),G.push(ge)),1;xe=0;var Fe=de===""?".":de+":";if(ee(R))for(var he=0;he<R.length;he++)de=R[he],ye=Fe+j(de,he),xe+=T(de,G,ae,ye,ge);else if(he=C(R),typeof he=="function")for(R=he.call(R),he=0;!(de=R.next()).done;)de=de.value,ye=Fe+j(de,he++),xe+=T(de,G,ae,ye,ge);else if(ye==="object"){if(typeof R.then=="function")return T(J(R),G,ae,de,ge);throw G=String(R),Error("Objects are not valid as a React child (found: "+(G==="[object Object]"?"object with keys {"+Object.keys(R).join(", ")+"}":G)+"). If you meant to render a collection of children, use an array instead.")}return xe}function W(R,G,ae){if(R==null)return R;var de=[],ge=0;return T(R,de,"","",function(ye){return G.call(ae,ye,ge++)}),de}function F(R){if(R._status===-1){var G=R._result;G=G(),G.then(function(ae){(R._status===0||R._status===-1)&&(R._status=1,R._result=ae)},function(ae){(R._status===0||R._status===-1)&&(R._status=2,R._result=ae)}),R._status===-1&&(R._status=0,R._result=G)}if(R._status===1)return R._result.default;throw R._result}var me=typeof reportError=="function"?reportError:function(R){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var G=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof R=="object"&&R!==null&&typeof R.message=="string"?String(R.message):String(R),error:R});if(!window.dispatchEvent(G))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",R);return}console.error(R)},we={map:W,forEach:function(R,G,ae){W(R,function(){G.apply(this,arguments)},ae)},count:function(R){var G=0;return W(R,function(){G++}),G},toArray:function(R){return W(R,function(G){return G})||[]},only:function(R){if(!A(R))throw Error("React.Children.only expected to receive a single React element child.");return R}};return Ie.Activity=b,Ie.Children=we,Ie.Component=k,Ie.Fragment=n,Ie.Profiler=o,Ie.PureComponent=U,Ie.StrictMode=a,Ie.Suspense=_,Ie.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=ne,Ie.__COMPILER_RUNTIME={__proto__:null,c:function(R){return ne.H.useMemoCache(R)}},Ie.cache=function(R){return function(){return R.apply(null,arguments)}},Ie.cacheSignal=function(){return null},Ie.cloneElement=function(R,G,ae){if(R==null)throw Error("The argument must be a React element, but you passed "+R+".");var de=E({},R.props),ge=R.key;if(G!=null)for(ye in G.key!==void 0&&(ge=""+G.key),G)!re.call(G,ye)||ye==="key"||ye==="__self"||ye==="__source"||ye==="ref"&&G.ref===void 0||(de[ye]=G[ye]);var ye=arguments.length-2;if(ye===1)de.children=ae;else if(1<ye){for(var xe=Array(ye),Fe=0;Fe<ye;Fe++)xe[Fe]=arguments[Fe+2];de.children=xe}return fe(R.type,ge,de)},Ie.createContext=function(R){return R={$$typeof:h,_currentValue:R,_currentValue2:R,_threadCount:0,Provider:null,Consumer:null},R.Provider=R,R.Consumer={$$typeof:c,_context:R},R},Ie.createElement=function(R,G,ae){var de,ge={},ye=null;if(G!=null)for(de in G.key!==void 0&&(ye=""+G.key),G)re.call(G,de)&&de!=="key"&&de!=="__self"&&de!=="__source"&&(ge[de]=G[de]);var xe=arguments.length-2;if(xe===1)ge.children=ae;else if(1<xe){for(var Fe=Array(xe),he=0;he<xe;he++)Fe[he]=arguments[he+2];ge.children=Fe}if(R&&R.defaultProps)for(de in xe=R.defaultProps,xe)ge[de]===void 0&&(ge[de]=xe[de]);return fe(R,ye,ge)},Ie.createRef=function(){return{current:null}},Ie.forwardRef=function(R){return{$$typeof:f,render:R}},Ie.isValidElement=A,Ie.lazy=function(R){return{$$typeof:y,_payload:{_status:-1,_result:R},_init:F}},Ie.memo=function(R,G){return{$$typeof:p,type:R,compare:G===void 0?null:G}},Ie.startTransition=function(R){var G=ne.T,ae={};ne.T=ae;try{var de=R(),ge=ne.S;ge!==null&&ge(ae,de),typeof de=="object"&&de!==null&&typeof de.then=="function"&&de.then(te,me)}catch(ye){me(ye)}finally{G!==null&&ae.types!==null&&(G.types=ae.types),ne.T=G}},Ie.unstable_useCacheRefresh=function(){return ne.H.useCacheRefresh()},Ie.use=function(R){return ne.H.use(R)},Ie.useActionState=function(R,G,ae){return ne.H.useActionState(R,G,ae)},Ie.useCallback=function(R,G){return ne.H.useCallback(R,G)},Ie.useContext=function(R){return ne.H.useContext(R)},Ie.useDebugValue=function(){},Ie.useDeferredValue=function(R,G){return ne.H.useDeferredValue(R,G)},Ie.useEffect=function(R,G){return ne.H.useEffect(R,G)},Ie.useEffectEvent=function(R){return ne.H.useEffectEvent(R)},Ie.useId=function(){return ne.H.useId()},Ie.useImperativeHandle=function(R,G,ae){return ne.H.useImperativeHandle(R,G,ae)},Ie.useInsertionEffect=function(R,G){return ne.H.useInsertionEffect(R,G)},Ie.useLayoutEffect=function(R,G){return ne.H.useLayoutEffect(R,G)},Ie.useMemo=function(R,G){return ne.H.useMemo(R,G)},Ie.useOptimistic=function(R,G){return ne.H.useOptimistic(R,G)},Ie.useReducer=function(R,G,ae){return ne.H.useReducer(R,G,ae)},Ie.useRef=function(R){return ne.H.useRef(R)},Ie.useState=function(R){return ne.H.useState(R)},Ie.useSyncExternalStore=function(R,G,ae){return ne.H.useSyncExternalStore(R,G,ae)},Ie.useTransition=function(){return ne.H.useTransition()},Ie.version="19.2.6",Ie}var Jy;function Tm(){return Jy||(Jy=1,mf.exports=jx()),mf.exports}var v=Tm();const mi=Bx(v);var _f={exports:{}},Zl={},gf={exports:{}},vf={};var eb;function Hx(){return eb||(eb=1,(function(e){function t(T,W){var F=T.length;T.push(W);e:for(;0<F;){var me=F-1>>>1,we=T[me];if(0<o(we,W))T[me]=W,T[F]=we,F=me;else break e}}function n(T){return T.length===0?null:T[0]}function a(T){if(T.length===0)return null;var W=T[0],F=T.pop();if(F!==W){T[0]=F;e:for(var me=0,we=T.length,R=we>>>1;me<R;){var G=2*(me+1)-1,ae=T[G],de=G+1,ge=T[de];if(0>o(ae,F))de<we&&0>o(ge,ae)?(T[me]=ge,T[de]=F,me=de):(T[me]=ae,T[G]=F,me=G);else if(de<we&&0>o(ge,F))T[me]=ge,T[de]=F,me=de;else break e}}return W}function o(T,W){var F=T.sortIndex-W.sortIndex;return F!==0?F:T.id-W.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=[],y=1,b=null,S=3,C=!1,x=!1,E=!1,B=!1,k=typeof setTimeout=="function"?setTimeout:null,H=typeof clearTimeout=="function"?clearTimeout:null,U=typeof setImmediate<"u"?setImmediate:null;function X(T){for(var W=n(p);W!==null;){if(W.callback===null)a(p);else if(W.startTime<=T)a(p),W.sortIndex=W.expirationTime,t(_,W);else break;W=n(p)}}function ee(T){if(E=!1,X(T),!x)if(n(_)!==null)x=!0,te||(te=!0,I());else{var W=n(p);W!==null&&J(ee,W.startTime-T)}}var te=!1,ne=-1,re=5,fe=-1;function K(){return B?!0:!(e.unstable_now()-fe<re)}function A(){if(B=!1,te){var T=e.unstable_now();fe=T;var W=!0;try{e:{x=!1,E&&(E=!1,H(ne),ne=-1),C=!0;var F=S;try{t:{for(X(T),b=n(_);b!==null&&!(b.expirationTime>T&&K());){var me=b.callback;if(typeof me=="function"){b.callback=null,S=b.priorityLevel;var we=me(b.expirationTime<=T);if(T=e.unstable_now(),typeof we=="function"){b.callback=we,X(T),W=!0;break t}b===n(_)&&a(_),X(T)}else a(_);b=n(_)}if(b!==null)W=!0;else{var R=n(p);R!==null&&J(ee,R.startTime-T),W=!1}}break e}finally{b=null,S=F,C=!1}W=void 0}}finally{W?I():te=!1}}}var I;if(typeof U=="function")I=function(){U(A)};else if(typeof MessageChannel<"u"){var O=new MessageChannel,j=O.port2;O.port1.onmessage=A,I=function(){j.postMessage(null)}}else I=function(){k(A,0)};function J(T,W){ne=k(function(){T(e.unstable_now())},W)}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(T){T.callback=null},e.unstable_forceFrameRate=function(T){0>T||125<T?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):re=0<T?Math.floor(1e3/T):5},e.unstable_getCurrentPriorityLevel=function(){return S},e.unstable_next=function(T){switch(S){case 1:case 2:case 3:var W=3;break;default:W=S}var F=S;S=W;try{return T()}finally{S=F}},e.unstable_requestPaint=function(){B=!0},e.unstable_runWithPriority=function(T,W){switch(T){case 1:case 2:case 3:case 4:case 5:break;default:T=3}var F=S;S=T;try{return W()}finally{S=F}},e.unstable_scheduleCallback=function(T,W,F){var me=e.unstable_now();switch(typeof F=="object"&&F!==null?(F=F.delay,F=typeof F=="number"&&0<F?me+F:me):F=me,T){case 1:var we=-1;break;case 2:we=250;break;case 5:we=1073741823;break;case 4:we=1e4;break;default:we=5e3}return we=F+we,T={id:y++,callback:W,priorityLevel:T,startTime:F,expirationTime:we,sortIndex:-1},F>me?(T.sortIndex=F,t(p,T),n(_)===null&&T===n(p)&&(E?(H(ne),ne=-1):E=!0,J(ee,F-me))):(T.sortIndex=we,t(_,T),x||C||(x=!0,te||(te=!0,I()))),T},e.unstable_shouldYield=K,e.unstable_wrapCallback=function(T){var W=S;return function(){var F=S;S=W;try{return T.apply(this,arguments)}finally{S=F}}}})(vf)),vf}var tb;function Ux(){return tb||(tb=1,gf.exports=Hx()),gf.exports}var yf={exports:{}},Ii={};var ib;function Px(){if(ib)return Ii;ib=1;var e=Tm();function t(_){var p="https://react.dev/errors/"+_;if(1<arguments.length){p+="?args[]="+encodeURIComponent(arguments[1]);for(var y=2;y<arguments.length;y++)p+="&args[]="+encodeURIComponent(arguments[y])}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,y){var b=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:o,key:b==null?null:""+b,children:_,containerInfo:p,implementation:y}}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 Ii.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=a,Ii.createPortal=function(_,p){var y=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,y)},Ii.flushSync=function(_){var p=h.T,y=a.p;try{if(h.T=null,a.p=2,_)return _()}finally{h.T=p,a.p=y,a.d.f()}},Ii.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))},Ii.prefetchDNS=function(_){typeof _=="string"&&a.d.D(_)},Ii.preinit=function(_,p){if(typeof _=="string"&&p&&typeof p.as=="string"){var y=p.as,b=f(y,p.crossOrigin),S=typeof p.integrity=="string"?p.integrity:void 0,C=typeof p.fetchPriority=="string"?p.fetchPriority:void 0;y==="style"?a.d.S(_,typeof p.precedence=="string"?p.precedence:void 0,{crossOrigin:b,integrity:S,fetchPriority:C}):y==="script"&&a.d.X(_,{crossOrigin:b,integrity:S,fetchPriority:C,nonce:typeof p.nonce=="string"?p.nonce:void 0})}},Ii.preinitModule=function(_,p){if(typeof _=="string")if(typeof p=="object"&&p!==null){if(p.as==null||p.as==="script"){var y=f(p.as,p.crossOrigin);a.d.M(_,{crossOrigin:y,integrity:typeof p.integrity=="string"?p.integrity:void 0,nonce:typeof p.nonce=="string"?p.nonce:void 0})}}else p==null&&a.d.M(_)},Ii.preload=function(_,p){if(typeof _=="string"&&typeof p=="object"&&p!==null&&typeof p.as=="string"){var y=p.as,b=f(y,p.crossOrigin);a.d.L(_,y,{crossOrigin:b,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})}},Ii.preloadModule=function(_,p){if(typeof _=="string")if(p){var y=f(p.as,p.crossOrigin);a.d.m(_,{as:typeof p.as=="string"&&p.as!=="script"?p.as:void 0,crossOrigin:y,integrity:typeof p.integrity=="string"?p.integrity:void 0})}else a.d.m(_)},Ii.requestFormReset=function(_){a.d.r(_)},Ii.unstable_batchedUpdates=function(_,p){return _(p)},Ii.useFormState=function(_,p,y){return h.H.useFormState(_,p,y)},Ii.useFormStatus=function(){return h.H.useHostTransitionStatus()},Ii.version="19.2.6",Ii}var sb;function o0(){if(sb)return yf.exports;sb=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(),yf.exports=Px(),yf.exports}var nb;function Ix(){if(nb)return Zl;nb=1;var e=Ux(),t=Tm(),n=o0();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,w=u.child;w;){if(w===r){g=!0,r=u,l=d;break}if(w===l){g=!0,l=u,r=d;break}w=w.sibling}if(!g){for(w=d.child;w;){if(w===r){g=!0,r=d,l=u;break}if(w===l){g=!0,l=d,r=u;break}w=w.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 y(i){var s=i.tag;if(s===5||s===26||s===27||s===6)return i;for(i=i.child;i!==null;){if(s=y(i),s!==null)return s;i=i.sibling}return null}var b=Object.assign,S=Symbol.for("react.element"),C=Symbol.for("react.transitional.element"),x=Symbol.for("react.portal"),E=Symbol.for("react.fragment"),B=Symbol.for("react.strict_mode"),k=Symbol.for("react.profiler"),H=Symbol.for("react.consumer"),U=Symbol.for("react.context"),X=Symbol.for("react.forward_ref"),ee=Symbol.for("react.suspense"),te=Symbol.for("react.suspense_list"),ne=Symbol.for("react.memo"),re=Symbol.for("react.lazy"),fe=Symbol.for("react.activity"),K=Symbol.for("react.memo_cache_sentinel"),A=Symbol.iterator;function I(i){return i===null||typeof i!="object"?null:(i=A&&i[A]||i["@@iterator"],typeof i=="function"?i:null)}var O=Symbol.for("react.client.reference");function j(i){if(i==null)return null;if(typeof i=="function")return i.$$typeof===O?null:i.displayName||i.name||null;if(typeof i=="string")return i;switch(i){case E:return"Fragment";case k:return"Profiler";case B:return"StrictMode";case ee:return"Suspense";case te:return"SuspenseList";case fe:return"Activity"}if(typeof i=="object")switch(i.$$typeof){case x:return"Portal";case U:return i.displayName||"Context";case H: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 ne:return s=i.displayName||null,s!==null?s:j(i.type)||"Memo";case re:s=i._payload,i=i._init;try{return j(i(s))}catch{}}return null}var J=Array.isArray,T=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,W=n.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,F={pending:!1,data:null,method:null,action:null},me=[],we=-1;function R(i){return{current:i}}function G(i){0>we||(i.current=me[we],me[we]=null,we--)}function ae(i,s){we++,me[we]=i.current,i.current=s}var de=R(null),ge=R(null),ye=R(null),xe=R(null);function Fe(i,s){switch(ae(ye,s),ae(ge,i),ae(de,null),s.nodeType){case 9:case 11:i=(i=s.documentElement)&&(i=i.namespaceURI)?yy(i):0;break;default:if(i=s.tagName,s=s.namespaceURI)s=yy(s),i=by(s,i);else switch(i){case"svg":i=1;break;case"math":i=2;break;default:i=0}}G(de),ae(de,i)}function he(){G(de),G(ge),G(ye)}function ve(i){i.memoizedState!==null&&ae(xe,i);var s=de.current,r=by(s,i.type);s!==r&&(ae(ge,i),ae(de,r))}function ze(i){ge.current===i&&(G(de),G(ge)),xe.current===i&&(G(xe),$l._currentValue=F)}var Re,Ee;function ie(i){if(Re===void 0)try{throw Error()}catch(r){var s=r.stack.trim().match(/\n( *(at )?)/);Re=s&&s[1]||"",Ee=-1<r.stack.indexOf(`
|
|
3
|
-
at`)?" (<anonymous>)":-1<r.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
4
|
-
`+Re+i+Ee}var Me=!1;function Ce(i,s){if(!i||Me)return"";Me=!0;var r=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var l={DetermineComponentFrameRoot:function(){try{if(s){var oe=function(){throw Error()};if(Object.defineProperty(oe.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(oe,[])}catch(Z){var V=Z}Reflect.construct(i,[],oe)}else{try{oe.call()}catch(Z){V=Z}i.call(oe.prototype)}}else{try{throw Error()}catch(Z){V=Z}(oe=i())&&typeof oe.catch=="function"&&oe.catch(function(){})}}catch(Z){if(Z&&V&&typeof Z.stack=="string")return[Z.stack,V.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],w=d[1];if(g&&w){var M=g.split(`
|
|
5
|
-
`),Y=w.split(`
|
|
6
|
-
`);for(u=l=0;l<M.length&&!M[l].includes("DetermineComponentFrameRoot");)l++;for(;u<Y.length&&!Y[u].includes("DetermineComponentFrameRoot");)u++;if(l===M.length||u===Y.length)for(l=M.length-1,u=Y.length-1;1<=l&&0<=u&&M[l]!==Y[u];)u--;for(;1<=l&&0<=u;l--,u--)if(M[l]!==Y[u]){if(l!==1||u!==1)do if(l--,u--,0>u||M[l]!==Y[u]){var se=`
|
|
7
|
-
`+M[l].replace(" at new "," at ");return i.displayName&&se.includes("<anonymous>")&&(se=se.replace("<anonymous>",i.displayName)),se}while(1<=l&&0<=u);break}}}finally{Me=!1,Error.prepareStackTrace=r}return(r=i?i.displayName||i.name:"")?ie(r):""}function je(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 qe(i){try{var s="",r=null;do s+=je(i,r),r=i,i=i.return;while(i);return s}catch(l){return`
|
|
8
|
-
Error generating stack: `+l.message+`
|
|
9
|
-
`+l.stack}}var Ct=Object.prototype.hasOwnProperty,ft=e.unstable_scheduleCallback,$t=e.unstable_cancelCallback,Hi=e.unstable_shouldYield,$s=e.unstable_requestPaint,rt=e.unstable_now,li=e.unstable_getCurrentPriorityLevel,Zi=e.unstable_ImmediatePriority,gi=e.unstable_UserBlockingPriority,zt=e.unstable_NormalPriority,Ui=e.unstable_LowPriority,vi=e.unstable_IdlePriority,$=e.log,He=e.unstable_setDisableYieldValue,Qe=null,lt=null;function Jt(i){if(typeof $=="function"&&He(i),lt&&typeof lt.setStrictMode=="function")try{lt.setStrictMode(Qe,i)}catch{}}var jt=Math.clz32?Math.clz32:an,oi=Math.log,Fi=Math.LN2;function an(i){return i>>>=0,i===0?32:31-(oi(i)/Fi|0)|0}var ls=256,Ss=262144,bt=4194304;function xt(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 Ht(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 w=l&134217727;return w!==0?(l=w&~d,l!==0?u=xt(l):(g&=w,g!==0?u=xt(g):r||(r=w&~i,r!==0&&(u=xt(r))))):(w=l&~d,w!==0?u=xt(w):g!==0?u=xt(g):r||(r=l&~i,r!==0&&(u=xt(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 ci(i,s){return(i.pendingLanes&~(i.suspendedLanes&~i.pingedLanes)&s)===0}function Yt(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 ei(){var i=bt;return bt<<=1,(bt&62914560)===0&&(bt=4194304),i}function ui(i){for(var s=[],r=0;31>r;r++)s.push(i);return s}function Ni(i,s){i.pendingLanes|=s,s!==268435456&&(i.suspendedLanes=0,i.pingedLanes=0,i.warmLanes=0)}function Et(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 w=i.entanglements,M=i.expirationTimes,Y=i.hiddenUpdates;for(r=g&~r;0<r;){var se=31-jt(r),oe=1<<se;w[se]=0,M[se]=-1;var V=Y[se];if(V!==null)for(Y[se]=null,se=0;se<V.length;se++){var Z=V[se];Z!==null&&(Z.lane&=-536870913)}r&=~oe}l!==0&&qi(i,l,0),d!==0&&u===0&&i.tag!==0&&(i.suspendedLanes|=d&~(g&~s))}function qi(i,s,r){i.pendingLanes|=s,i.suspendedLanes&=~s;var l=31-jt(s);i.entangledLanes|=s,i.entanglements[l]=i.entanglements[l]|1073741824|r&261930}function Vt(i,s){var r=i.entangledLanes|=s;for(i=i.entanglements;r;){var l=31-jt(r),u=1<<l;u&s|i[l]&s&&(i[l]|=s),r&=~u}}function Ai(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 Pi(i){return i&=-i,2<i?8<i?(i&134217727)!==0?32:268435456:8:2}function yi(){var i=W.p;return i!==0?i:(i=window.event,i===void 0?32:Fy(i.type))}function ut(i,s){var r=W.p;try{return W.p=i,s()}finally{W.p=r}}var bi=Math.random().toString(36).slice(2),Ut="__reactFiber$"+bi,Pt="__reactProps$"+bi,Rt="__reactContainer$"+bi,br="__reactEvents$"+bi,na="__reactListeners$"+bi,ra="__reactHandles$"+bi,Sr="__reactResources$"+bi,ws="__reactMarker$"+bi;function ln(i){delete i[Ut],delete i[Pt],delete i[br],delete i[na],delete i[ra]}function At(i){var s=i[Ut];if(s)return s;for(var r=i.parentNode;r;){if(s=r[Rt]||r[Ut]){if(r=s.alternate,s.child!==null||r!==null&&r.child!==null)for(i=ky(i);i!==null;){if(r=i[Ut])return r;i=ky(i)}return s}i=r,r=i.parentNode}return null}function Wi(i){if(i=i[Ut]||i[Rt]){var s=i.tag;if(s===5||s===6||s===13||s===31||s===26||s===27||s===3)return i}return null}function Ys(i){var s=i.tag;if(s===5||s===26||s===27||s===6)return i.stateNode;throw Error(a(33))}function Us(i){var s=i[Sr];return s||(s=i[Sr]={hoistableStyles:new Map,hoistableScripts:new Map}),s}function It(i){i[ws]=!0}var wr=new Set,On={};function os(i,s){Cs(i,s),Cs(i+"Capture",s)}function Cs(i,s){for(On[i]=s,i=0;i<s.length;i++)wr.add(s[i])}var ol=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={},aa={};function la(i){return Ct.call(aa,i)?!0:Ct.call(on,i)?!1:ol.test(i)?aa[i]=!0:(on[i]=!0,!1)}function $i(i,s,r){if(la(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 D(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 z(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 pe(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 be(i){if(!i._valueTracker){var s=Q(i)?"checked":"value";i._valueTracker=pe(i,s,""+i[s])}}function Le(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 Ne(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 pt=/[\n"\\]/g;function mt(i){return i.replace(pt,function(s){return"\\"+s.charCodeAt(0).toString(16)+" "})}function N(i,s,r,l,u,d,g,w){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=""+z(s)):i.value!==""+z(s)&&(i.value=""+z(s)):g!=="submit"&&g!=="reset"||i.removeAttribute("value"),s!=null?Ue(i,g,z(s)):r!=null?Ue(i,g,z(r)):l!=null&&i.removeAttribute("value"),u==null&&d!=null&&(i.defaultChecked=!!d),u!=null&&(i.checked=u&&typeof u!="function"&&typeof u!="symbol"),w!=null&&typeof w!="function"&&typeof w!="symbol"&&typeof w!="boolean"?i.name=""+z(w):i.removeAttribute("name")}function ue(i,s,r,l,u,d,g,w){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)){be(i);return}r=r!=null?""+z(r):"",s=s!=null?""+z(s):r,w||s===i.value||(i.value=s),i.defaultValue=s}l=l??u,l=typeof l!="function"&&typeof l!="symbol"&&!!l,i.checked=w?i.checked:!!l,i.defaultChecked=!!l,g!=null&&typeof g!="function"&&typeof g!="symbol"&&typeof g!="boolean"&&(i.name=g),be(i)}function Ue(i,s,r){s==="number"&&Ne(i.ownerDocument)===i||i.defaultValue===""+r||(i.defaultValue=""+r)}function Be(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=""+z(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 Xe(i,s,r){if(s!=null&&(s=""+z(s),s!==i.value&&(i.value=s),r==null)){i.defaultValue!==s&&(i.defaultValue=s);return}i.defaultValue=r!=null?""+z(r):""}function ct(i,s,r,l){if(s==null){if(l!=null){if(r!=null)throw Error(a(92));if(J(l)){if(1<l.length)throw Error(a(93));l=l[0]}r=l}r==null&&(r=""),s=r}r=z(s),i.defaultValue=r,l=i.textContent,l===r&&l!==""&&l!==null&&(i.value=l),be(i)}function Lt(i,s){if(s){var r=i.firstChild;if(r&&r===i.lastChild&&r.nodeType===3){r.nodeValue=s;return}}i.textContent=s}var Si=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 Qi(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||Si.has(s)?s==="float"?i.cssFloat=r:i[s]=(""+r).trim():i[s]=r+"px"}function Vs(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&&Qi(i,u,l)}else for(var d in s)s.hasOwnProperty(d)&&Qi(i,d,s[d])}function cn(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 cs=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"]]),Xo=/^[\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 oa(i){return Xo.test(""+i)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":i}function wi(){}var ca=null;function ua(i){return i=i.target||i.srcElement||window,i.correspondingUseElement&&(i=i.correspondingUseElement),i.nodeType===3?i.parentNode:i}var ha=null,da=null;function v_(i){var s=Wi(i);if(s&&(i=s.stateNode)){var r=i[Pt]||null;e:switch(i=s.stateNode,s.type){case"input":if(N(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="'+mt(""+s)+'"][type="radio"]'),s=0;s<r.length;s++){var l=r[s];if(l!==i&&l.form===i.form){var u=l[Pt]||null;if(!u)throw Error(a(90));N(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&&Le(l)}break e;case"textarea":Xe(i,r.value,r.defaultValue);break e;case"select":s=r.value,s!=null&&Be(i,!!r.multiple,s,!1)}}}var dh=!1;function y_(i,s,r){if(dh)return i(s,r);dh=!0;try{var l=i(s);return l}finally{if(dh=!1,(ha!==null||da!==null)&&(zc(),ha&&(s=ha,i=da,da=ha=null,v_(s),i)))for(s=0;s<i.length;s++)v_(i[s])}}function cl(i,s){var r=i.stateNode;if(r===null)return null;var l=r[Pt]||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"),fh=!1;if(un)try{var ul={};Object.defineProperty(ul,"passive",{get:function(){fh=!0}}),window.addEventListener("test",ul,ul),window.removeEventListener("test",ul,ul)}catch{fh=!1}var zn=null,ph=null,Go=null;function b_(){if(Go)return Go;var i,s=ph,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 g=r-i;for(l=1;l<=g&&s[r-l]===u[d-l];l++);return Go=u.slice(i,1<l?1-l:void 0)}function Zo(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 Qo(){return!0}function S_(){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 w in i)i.hasOwnProperty(w)&&(r=i[w],this[w]=r?r(d):d[w]);return this.isDefaultPrevented=(d.defaultPrevented!=null?d.defaultPrevented:d.returnValue===!1)?Qo:S_,this.isPropagationStopped=S_,this}return b(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=Qo)},stopPropagation:function(){var r=this.nativeEvent;r&&(r.stopPropagation?r.stopPropagation():typeof r.cancelBubble!="unknown"&&(r.cancelBubble=!0),this.isPropagationStopped=Qo)},persist:function(){},isPersistent:Qo}),s}var Cr={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(i){return i.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Jo=Ji(Cr),hl=b({},Cr,{view:0,detail:0}),A1=Ji(hl),mh,_h,dl,ec=b({},hl,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:vh,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!==dl&&(dl&&i.type==="mousemove"?(mh=i.screenX-dl.screenX,_h=i.screenY-dl.screenY):_h=mh=0,dl=i),mh)},movementY:function(i){return"movementY"in i?i.movementY:_h}}),w_=Ji(ec),L1=b({},ec,{dataTransfer:0}),B1=Ji(L1),O1=b({},hl,{relatedTarget:0}),gh=Ji(O1),z1=b({},Cr,{animationName:0,elapsedTime:0,pseudoElement:0}),j1=Ji(z1),H1=b({},Cr,{clipboardData:function(i){return"clipboardData"in i?i.clipboardData:window.clipboardData}}),U1=Ji(H1),P1=b({},Cr,{data:0}),C_=Ji(P1),I1={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"},F1={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function q1(i){var s=this.nativeEvent;return s.getModifierState?s.getModifierState(i):(i=F1[i])?!!s[i]:!1}function vh(){return q1}var W1=b({},hl,{key:function(i){if(i.key){var s=I1[i.key]||i.key;if(s!=="Unidentified")return s}return i.type==="keypress"?(i=Zo(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:vh,charCode:function(i){return i.type==="keypress"?Zo(i):0},keyCode:function(i){return i.type==="keydown"||i.type==="keyup"?i.keyCode:0},which:function(i){return i.type==="keypress"?Zo(i):i.type==="keydown"||i.type==="keyup"?i.keyCode:0}}),$1=Ji(W1),Y1=b({},ec,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),x_=Ji(Y1),V1=b({},hl,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:vh}),X1=Ji(V1),G1=b({},Cr,{propertyName:0,elapsedTime:0,pseudoElement:0}),Z1=Ji(G1),Q1=b({},ec,{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}),J1=Ji(Q1),eC=b({},Cr,{newState:0,oldState:0}),tC=Ji(eC),iC=[9,13,27,32],yh=un&&"CompositionEvent"in window,fl=null;un&&"documentMode"in document&&(fl=document.documentMode);var sC=un&&"TextEvent"in window&&!fl,E_=un&&(!yh||fl&&8<fl&&11>=fl),T_=" ",k_=!1;function D_(i,s){switch(i){case"keyup":return iC.indexOf(s.keyCode)!==-1;case"keydown":return s.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function R_(i){return i=i.detail,typeof i=="object"&&"data"in i?i.data:null}var fa=!1;function nC(i,s){switch(i){case"compositionend":return R_(s);case"keypress":return s.which!==32?null:(k_=!0,T_);case"textInput":return i=s.data,i===T_&&k_?null:i;default:return null}}function rC(i,s){if(fa)return i==="compositionend"||!yh&&D_(i,s)?(i=b_(),Go=ph=zn=null,fa=!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 E_&&s.locale!=="ko"?null:s.data;default:return null}}var aC={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"?!!aC[i.type]:s==="textarea"}function N_(i,s,r,l){ha?da?da.push(l):da=[l]:ha=l,s=Fc(s,"onChange"),0<s.length&&(r=new Jo("onChange","change",null,r,l),i.push({event:r,listeners:s}))}var pl=null,ml=null;function lC(i){fy(i,0)}function tc(i){var s=Ys(i);if(Le(s))return i}function A_(i,s){if(i==="change")return s}var L_=!1;if(un){var bh;if(un){var Sh="oninput"in document;if(!Sh){var B_=document.createElement("div");B_.setAttribute("oninput","return;"),Sh=typeof B_.oninput=="function"}bh=Sh}else bh=!1;L_=bh&&(!document.documentMode||9<document.documentMode)}function O_(){pl&&(pl.detachEvent("onpropertychange",z_),ml=pl=null)}function z_(i){if(i.propertyName==="value"&&tc(ml)){var s=[];N_(s,ml,i,ua(i)),y_(lC,s)}}function oC(i,s,r){i==="focusin"?(O_(),pl=s,ml=r,pl.attachEvent("onpropertychange",z_)):i==="focusout"&&O_()}function cC(i){if(i==="selectionchange"||i==="keyup"||i==="keydown")return tc(ml)}function uC(i,s){if(i==="click")return tc(s)}function hC(i,s){if(i==="input"||i==="change")return tc(s)}function dC(i,s){return i===s&&(i!==0||1/i===1/s)||i!==i&&s!==s}var us=typeof Object.is=="function"?Object.is:dC;function _l(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(!Ct.call(s,u)||!us(i[u],s[u]))return!1}return!0}function j_(i){for(;i&&i.firstChild;)i=i.firstChild;return i}function H_(i,s){var r=j_(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=j_(r)}}function U_(i,s){return i&&s?i===s?!0:i&&i.nodeType===3?!1:s&&s.nodeType===3?U_(i,s.parentNode):"contains"in i?i.contains(s):i.compareDocumentPosition?!!(i.compareDocumentPosition(s)&16):!1:!1}function P_(i){i=i!=null&&i.ownerDocument!=null&&i.ownerDocument.defaultView!=null?i.ownerDocument.defaultView:window;for(var s=Ne(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=Ne(i.document)}return s}function wh(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 fC=un&&"documentMode"in document&&11>=document.documentMode,pa=null,Ch=null,gl=null,xh=!1;function I_(i,s,r){var l=r.window===r?r.document:r.nodeType===9?r:r.ownerDocument;xh||pa==null||pa!==Ne(l)||(l=pa,"selectionStart"in l&&wh(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}),gl&&_l(gl,l)||(gl=l,l=Fc(Ch,"onSelect"),0<l.length&&(s=new Jo("onSelect","select",null,s,r),i.push({event:s,listeners:l}),s.target=pa)))}function xr(i,s){var r={};return r[i.toLowerCase()]=s.toLowerCase(),r["Webkit"+i]="webkit"+s,r["Moz"+i]="moz"+s,r}var ma={animationend:xr("Animation","AnimationEnd"),animationiteration:xr("Animation","AnimationIteration"),animationstart:xr("Animation","AnimationStart"),transitionrun:xr("Transition","TransitionRun"),transitionstart:xr("Transition","TransitionStart"),transitioncancel:xr("Transition","TransitionCancel"),transitionend:xr("Transition","TransitionEnd")},Eh={},K_={};un&&(K_=document.createElement("div").style,"AnimationEvent"in window||(delete ma.animationend.animation,delete ma.animationiteration.animation,delete ma.animationstart.animation),"TransitionEvent"in window||delete ma.transitionend.transition);function Er(i){if(Eh[i])return Eh[i];if(!ma[i])return i;var s=ma[i],r;for(r in s)if(s.hasOwnProperty(r)&&r in K_)return Eh[i]=s[r];return i}var F_=Er("animationend"),q_=Er("animationiteration"),W_=Er("animationstart"),pC=Er("transitionrun"),mC=Er("transitionstart"),_C=Er("transitioncancel"),$_=Er("transitionend"),Y_=new Map,Th="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(" ");Th.push("scrollEnd");function Is(i,s){Y_.set(i,s),os(s,[i])}var ic=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)},xs=[],_a=0,kh=0;function sc(){for(var i=_a,s=kh=_a=0;s<i;){var r=xs[s];xs[s++]=null;var l=xs[s];xs[s++]=null;var u=xs[s];xs[s++]=null;var d=xs[s];if(xs[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&&V_(r,u,d)}}function nc(i,s,r,l){xs[_a++]=i,xs[_a++]=s,xs[_a++]=r,xs[_a++]=l,kh|=l,i.lanes|=l,i=i.alternate,i!==null&&(i.lanes|=l)}function Dh(i,s,r,l){return nc(i,s,r,l),rc(i)}function Tr(i,s){return nc(i,null,null,s),rc(i)}function V_(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-jt(r),i=d.hiddenUpdates,l=i[u],l===null?i[u]=[s]:l.push(s),s.lane=r|536870912),d):null}function rc(i){if(50<Ul)throw Ul=0,jd=null,Error(a(185));for(var s=i.return;s!==null;)i=s,s=i.return;return i.tag===3?i.stateNode:null}var ga={};function gC(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 gC(i,s,r,l)}function Rh(i){return i=i.prototype,!(!i||!i.isReactComponent)}function hn(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 X_(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 ac(i,s,r,l,u,d){var g=0;if(l=i,typeof i=="function")Rh(i)&&(g=1);else if(typeof i=="string")g=wx(i,r,de.current)?26:i==="html"||i==="head"||i==="body"?27:5;else e:switch(i){case fe:return i=hs(31,r,s,u),i.elementType=fe,i.lanes=d,i;case E:return kr(r.children,u,d,s);case B:g=8,u|=24;break;case k:return i=hs(12,r,s,u|2),i.elementType=k,i.lanes=d,i;case ee:return i=hs(13,r,s,u),i.elementType=ee,i.lanes=d,i;case te:return i=hs(19,r,s,u),i.elementType=te,i.lanes=d,i;default:if(typeof i=="object"&&i!==null)switch(i.$$typeof){case U:g=10;break e;case H:g=9;break e;case X:g=11;break e;case ne:g=14;break e;case re:g=16,l=null;break e}g=29,r=Error(a(130,i===null?"null":typeof i,"")),l=null}return s=hs(g,r,s,u),s.elementType=i,s.type=l,s.lanes=d,s}function kr(i,s,r,l){return i=hs(7,i,l,s),i.lanes=r,i}function Mh(i,s,r){return i=hs(6,i,null,s),i.lanes=r,i}function G_(i){var s=hs(18,null,null,0);return s.stateNode=i,s}function Nh(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 Es(i,s){if(typeof i=="object"&&i!==null){var r=Z_.get(i);return r!==void 0?r:(s={value:i,source:s,stack:qe(s)},Z_.set(i,s),s)}return{value:i,source:s,stack:qe(s)}}var va=[],ya=0,lc=null,vl=0,Ts=[],ks=0,jn=null,Xs=1,Gs="";function dn(i,s){va[ya++]=vl,va[ya++]=lc,lc=i,vl=s}function Q_(i,s,r){Ts[ks++]=Xs,Ts[ks++]=Gs,Ts[ks++]=jn,jn=i;var l=Xs;i=Gs;var u=32-jt(l)-1;l&=~(1<<u),r+=1;var d=32-jt(s)+u;if(30<d){var g=u-u%5;d=(l&(1<<g)-1).toString(32),l>>=g,u-=g,Xs=1<<32-jt(s)+u|r<<u|l,Gs=d+i}else Xs=1<<d|r<<u|l,Gs=i}function Ah(i){i.return!==null&&(dn(i,1),Q_(i,1,0))}function Lh(i){for(;i===lc;)lc=va[--ya],va[ya]=null,vl=va[--ya],va[ya]=null;for(;i===jn;)jn=Ts[--ks],Ts[ks]=null,Gs=Ts[--ks],Ts[ks]=null,Xs=Ts[--ks],Ts[ks]=null}function J_(i,s){Ts[ks++]=Xs,Ts[ks++]=Gs,Ts[ks++]=jn,Xs=s.id,Gs=s.overflow,jn=i}var Li=null,Tt=null,it=!1,Hn=null,Ds=!1,Bh=Error(a(519));function Un(i){var s=Error(a(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw yl(Es(s,i)),Bh}function eg(i){var s=i.stateNode,r=i.type,l=i.memoizedProps;switch(s[Ut]=i,s[Pt]=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<Il.length;r++)Ze(Il[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),ue(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),ct(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||gy(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=wi),s=!0):s=!1,s||Un(i,!0)}function tg(i){for(Li=i.return;Li;)switch(Li.tag){case 5:case 31:case 13:Ds=!1;return;case 27:case 3:Ds=!0;return;default:Li=Li.return}}function ba(i){if(i!==Li)return!1;if(!it)return tg(i),it=!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&&Tt&&Un(i),tg(i),s===13){if(i=i.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(a(317));Tt=Ty(i)}else if(s===31){if(i=i.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(a(317));Tt=Ty(i)}else s===27?(s=Tt,Jn(i.type)?(i=nf,nf=null,Tt=i):Tt=s):Tt=Li?Ms(i.stateNode.nextSibling):null;return!0}function Dr(){Tt=Li=null,it=!1}function Oh(){var i=Hn;return i!==null&&(ss===null?ss=i:ss.push.apply(ss,i),Hn=null),i}function yl(i){Hn===null?Hn=[i]:Hn.push(i)}var zh=R(null),Rr=null,fn=null;function Pn(i,s,r){ae(zh,s._currentValue),s._currentValue=r}function pn(i){i._currentValue=zh.current,G(zh)}function jh(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 Hh(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 w=d;d=u;for(var M=0;M<s.length;M++)if(w.context===s[M]){d.lanes|=r,w=d.alternate,w!==null&&(w.lanes|=r),jh(d.return,r,i),l||(g=null);break e}d=w.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),jh(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 Sa(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 w=u.type;us(u.pendingProps.value,g.value)||(i!==null?i.push(w):i=[w])}}else if(u===xe.current){if(g=u.alternate,g===null)throw Error(a(387));g.memoizedState.memoizedState!==u.memoizedState.memoizedState&&(i!==null?i.push($l):i=[$l])}u=u.return}i!==null&&Hh(s,i,r,l),s.flags|=262144}function oc(i){for(i=i.firstContext;i!==null;){if(!us(i.context._currentValue,i.memoizedValue))return!0;i=i.next}return!1}function Mr(i){Rr=i,fn=null,i=i.dependencies,i!==null&&(i.firstContext=null)}function Bi(i){return ig(Rr,i)}function cc(i,s){return Rr===null&&Mr(i),ig(i,s)}function ig(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 vC=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()})}},yC=e.unstable_scheduleCallback,bC=e.unstable_NormalPriority,ti={$$typeof:U,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Uh(){return{controller:new vC,data:new Map,refCount:0}}function bl(i){i.refCount--,i.refCount===0&&yC(bC,function(){i.controller.abort()})}var Sl=null,Ph=0,wa=0,Ca=null;function SC(i,s){if(Sl===null){var r=Sl=[];Ph=0,wa=Fd(),Ca={status:"pending",value:void 0,then:function(l){r.push(l)}}}return Ph++,s.then(sg,sg),s}function sg(){if(--Ph===0&&Sl!==null){Ca!==null&&(Ca.status="fulfilled");var i=Sl;Sl=null,wa=0,Ca=null;for(var s=0;s<i.length;s++)(0,i[s])()}}function wC(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 ng=T.S;T.S=function(i,s){Iv=rt(),typeof s=="object"&&s!==null&&typeof s.then=="function"&&SC(i,s),ng!==null&&ng(i,s)};var Nr=R(null);function Ih(){var i=Nr.current;return i!==null?i:St.pooledCache}function uc(i,s){s===null?ae(Nr,Nr.current):ae(Nr,s.pool)}function rg(){var i=Ih();return i===null?null:{parent:ti._currentValue,pool:i}}var xa=Error(a(460)),Kh=Error(a(474)),hc=Error(a(542)),dc={then:function(){}};function ag(i){return i=i.status,i==="fulfilled"||i==="rejected"}function lg(i,s,r){switch(r=i[r],r===void 0?i.push(s):r!==s&&(s.then(wi,wi),s=r),s.status){case"fulfilled":return s.value;case"rejected":throw i=s.reason,cg(i),i;default:if(typeof s.status=="string")s.then(wi,wi);else{if(i=St,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,cg(i),i}throw Lr=s,xa}}function Ar(i){try{var s=i._init;return s(i._payload)}catch(r){throw r!==null&&typeof r=="object"&&typeof r.then=="function"?(Lr=r,xa):r}}var Lr=null;function og(){if(Lr===null)throw Error(a(459));var i=Lr;return Lr=null,i}function cg(i){if(i===xa||i===hc)throw Error(a(483))}var Ea=null,wl=0;function fc(i){var s=wl;return wl+=1,Ea===null&&(Ea=[]),lg(Ea,i,s)}function Cl(i,s){s=s.props.ref,i.ref=s!==void 0?s:null}function pc(i,s){throw s.$$typeof===S?Error(a(525)):(i=Object.prototype.toString.call(s),Error(a(31,i==="[object Object]"?"object with keys {"+Object.keys(s).join(", ")+"}":i)))}function ug(i){function s(P,L){if(i){var q=P.deletions;q===null?(P.deletions=[L],P.flags|=16):q.push(L)}}function r(P,L){if(!i)return null;for(;L!==null;)s(P,L),L=L.sibling;return null}function l(P){for(var L=new Map;P!==null;)P.key!==null?L.set(P.key,P):L.set(P.index,P),P=P.sibling;return L}function u(P,L){return P=hn(P,L),P.index=0,P.sibling=null,P}function d(P,L,q){return P.index=q,i?(q=P.alternate,q!==null?(q=q.index,q<L?(P.flags|=67108866,L):q):(P.flags|=67108866,L)):(P.flags|=1048576,L)}function g(P){return i&&P.alternate===null&&(P.flags|=67108866),P}function w(P,L,q,le){return L===null||L.tag!==6?(L=Mh(q,P.mode,le),L.return=P,L):(L=u(L,q),L.return=P,L)}function M(P,L,q,le){var Ae=q.type;return Ae===E?se(P,L,q.props.children,le,q.key):L!==null&&(L.elementType===Ae||typeof Ae=="object"&&Ae!==null&&Ae.$$typeof===re&&Ar(Ae)===L.type)?(L=u(L,q.props),Cl(L,q),L.return=P,L):(L=ac(q.type,q.key,q.props,null,P.mode,le),Cl(L,q),L.return=P,L)}function Y(P,L,q,le){return L===null||L.tag!==4||L.stateNode.containerInfo!==q.containerInfo||L.stateNode.implementation!==q.implementation?(L=Nh(q,P.mode,le),L.return=P,L):(L=u(L,q.children||[]),L.return=P,L)}function se(P,L,q,le,Ae){return L===null||L.tag!==7?(L=kr(q,P.mode,le,Ae),L.return=P,L):(L=u(L,q),L.return=P,L)}function oe(P,L,q){if(typeof L=="string"&&L!==""||typeof L=="number"||typeof L=="bigint")return L=Mh(""+L,P.mode,q),L.return=P,L;if(typeof L=="object"&&L!==null){switch(L.$$typeof){case C:return q=ac(L.type,L.key,L.props,null,P.mode,q),Cl(q,L),q.return=P,q;case x:return L=Nh(L,P.mode,q),L.return=P,L;case re:return L=Ar(L),oe(P,L,q)}if(J(L)||I(L))return L=kr(L,P.mode,q,null),L.return=P,L;if(typeof L.then=="function")return oe(P,fc(L),q);if(L.$$typeof===U)return oe(P,cc(P,L),q);pc(P,L)}return null}function V(P,L,q,le){var Ae=L!==null?L.key:null;if(typeof q=="string"&&q!==""||typeof q=="number"||typeof q=="bigint")return Ae!==null?null:w(P,L,""+q,le);if(typeof q=="object"&&q!==null){switch(q.$$typeof){case C:return q.key===Ae?M(P,L,q,le):null;case x:return q.key===Ae?Y(P,L,q,le):null;case re:return q=Ar(q),V(P,L,q,le)}if(J(q)||I(q))return Ae!==null?null:se(P,L,q,le,null);if(typeof q.then=="function")return V(P,L,fc(q),le);if(q.$$typeof===U)return V(P,L,cc(P,q),le);pc(P,q)}return null}function Z(P,L,q,le,Ae){if(typeof le=="string"&&le!==""||typeof le=="number"||typeof le=="bigint")return P=P.get(q)||null,w(L,P,""+le,Ae);if(typeof le=="object"&&le!==null){switch(le.$$typeof){case C:return P=P.get(le.key===null?q:le.key)||null,M(L,P,le,Ae);case x:return P=P.get(le.key===null?q:le.key)||null,Y(L,P,le,Ae);case re:return le=Ar(le),Z(P,L,q,le,Ae)}if(J(le)||I(le))return P=P.get(q)||null,se(L,P,le,Ae,null);if(typeof le.then=="function")return Z(P,L,q,fc(le),Ae);if(le.$$typeof===U)return Z(P,L,q,cc(L,le),Ae);pc(L,le)}return null}function Te(P,L,q,le){for(var Ae=null,st=null,De=L,We=L=0,et=null;De!==null&&We<q.length;We++){De.index>We?(et=De,De=null):et=De.sibling;var nt=V(P,De,q[We],le);if(nt===null){De===null&&(De=et);break}i&&De&&nt.alternate===null&&s(P,De),L=d(nt,L,We),st===null?Ae=nt:st.sibling=nt,st=nt,De=et}if(We===q.length)return r(P,De),it&&dn(P,We),Ae;if(De===null){for(;We<q.length;We++)De=oe(P,q[We],le),De!==null&&(L=d(De,L,We),st===null?Ae=De:st.sibling=De,st=De);return it&&dn(P,We),Ae}for(De=l(De);We<q.length;We++)et=Z(De,P,We,q[We],le),et!==null&&(i&&et.alternate!==null&&De.delete(et.key===null?We:et.key),L=d(et,L,We),st===null?Ae=et:st.sibling=et,st=et);return i&&De.forEach(function(nr){return s(P,nr)}),it&&dn(P,We),Ae}function Oe(P,L,q,le){if(q==null)throw Error(a(151));for(var Ae=null,st=null,De=L,We=L=0,et=null,nt=q.next();De!==null&&!nt.done;We++,nt=q.next()){De.index>We?(et=De,De=null):et=De.sibling;var nr=V(P,De,nt.value,le);if(nr===null){De===null&&(De=et);break}i&&De&&nr.alternate===null&&s(P,De),L=d(nr,L,We),st===null?Ae=nr:st.sibling=nr,st=nr,De=et}if(nt.done)return r(P,De),it&&dn(P,We),Ae;if(De===null){for(;!nt.done;We++,nt=q.next())nt=oe(P,nt.value,le),nt!==null&&(L=d(nt,L,We),st===null?Ae=nt:st.sibling=nt,st=nt);return it&&dn(P,We),Ae}for(De=l(De);!nt.done;We++,nt=q.next())nt=Z(De,P,We,nt.value,le),nt!==null&&(i&&nt.alternate!==null&&De.delete(nt.key===null?We:nt.key),L=d(nt,L,We),st===null?Ae=nt:st.sibling=nt,st=nt);return i&&De.forEach(function(Lx){return s(P,Lx)}),it&&dn(P,We),Ae}function vt(P,L,q,le){if(typeof q=="object"&&q!==null&&q.type===E&&q.key===null&&(q=q.props.children),typeof q=="object"&&q!==null){switch(q.$$typeof){case C:e:{for(var Ae=q.key;L!==null;){if(L.key===Ae){if(Ae=q.type,Ae===E){if(L.tag===7){r(P,L.sibling),le=u(L,q.props.children),le.return=P,P=le;break e}}else if(L.elementType===Ae||typeof Ae=="object"&&Ae!==null&&Ae.$$typeof===re&&Ar(Ae)===L.type){r(P,L.sibling),le=u(L,q.props),Cl(le,q),le.return=P,P=le;break e}r(P,L);break}else s(P,L);L=L.sibling}q.type===E?(le=kr(q.props.children,P.mode,le,q.key),le.return=P,P=le):(le=ac(q.type,q.key,q.props,null,P.mode,le),Cl(le,q),le.return=P,P=le)}return g(P);case x:e:{for(Ae=q.key;L!==null;){if(L.key===Ae)if(L.tag===4&&L.stateNode.containerInfo===q.containerInfo&&L.stateNode.implementation===q.implementation){r(P,L.sibling),le=u(L,q.children||[]),le.return=P,P=le;break e}else{r(P,L);break}else s(P,L);L=L.sibling}le=Nh(q,P.mode,le),le.return=P,P=le}return g(P);case re:return q=Ar(q),vt(P,L,q,le)}if(J(q))return Te(P,L,q,le);if(I(q)){if(Ae=I(q),typeof Ae!="function")throw Error(a(150));return q=Ae.call(q),Oe(P,L,q,le)}if(typeof q.then=="function")return vt(P,L,fc(q),le);if(q.$$typeof===U)return vt(P,L,cc(P,q),le);pc(P,q)}return typeof q=="string"&&q!==""||typeof q=="number"||typeof q=="bigint"?(q=""+q,L!==null&&L.tag===6?(r(P,L.sibling),le=u(L,q),le.return=P,P=le):(r(P,L),le=Mh(q,P.mode,le),le.return=P,P=le),g(P)):r(P,L)}return function(P,L,q,le){try{wl=0;var Ae=vt(P,L,q,le);return Ea=null,Ae}catch(De){if(De===xa||De===hc)throw De;var st=hs(29,De,null,P.mode);return st.lanes=le,st.return=P,st}}}var Br=ug(!0),hg=ug(!1),In=!1;function Fh(i){i.updateQueue={baseState:i.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function qh(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 Kn(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=rc(i),V_(i,null,r),s}return nc(i,l,s,r),rc(i)}function xl(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,Vt(i,r)}}function Wh(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 $h=!1;function El(){if($h){var i=Ca;if(i!==null)throw i}}function Tl(i,s,r,l){$h=!1;var u=i.updateQueue;In=!1;var d=u.firstBaseUpdate,g=u.lastBaseUpdate,w=u.shared.pending;if(w!==null){u.shared.pending=null;var M=w,Y=M.next;M.next=null,g===null?d=Y:g.next=Y,g=M;var se=i.alternate;se!==null&&(se=se.updateQueue,w=se.lastBaseUpdate,w!==g&&(w===null?se.firstBaseUpdate=Y:w.next=Y,se.lastBaseUpdate=M))}if(d!==null){var oe=u.baseState;g=0,se=Y=M=null,w=d;do{var V=w.lane&-536870913,Z=V!==w.lane;if(Z?(Je&V)===V:(l&V)===V){V!==0&&V===wa&&($h=!0),se!==null&&(se=se.next={lane:0,tag:w.tag,payload:w.payload,callback:null,next:null});e:{var Te=i,Oe=w;V=s;var vt=r;switch(Oe.tag){case 1:if(Te=Oe.payload,typeof Te=="function"){oe=Te.call(vt,oe,V);break e}oe=Te;break e;case 3:Te.flags=Te.flags&-65537|128;case 0:if(Te=Oe.payload,V=typeof Te=="function"?Te.call(vt,oe,V):Te,V==null)break e;oe=b({},oe,V);break e;case 2:In=!0}}V=w.callback,V!==null&&(i.flags|=64,Z&&(i.flags|=8192),Z=u.callbacks,Z===null?u.callbacks=[V]:Z.push(V))}else Z={lane:V,tag:w.tag,payload:w.payload,callback:w.callback,next:null},se===null?(Y=se=Z,M=oe):se=se.next=Z,g|=V;if(w=w.next,w===null){if(w=u.shared.pending,w===null)break;Z=w,w=Z.next,Z.next=null,u.lastBaseUpdate=Z,u.shared.pending=null}}while(!0);se===null&&(M=oe),u.baseState=M,u.firstBaseUpdate=Y,u.lastBaseUpdate=se,d===null&&(u.shared.lanes=0),Vn|=g,i.lanes=g,i.memoizedState=oe}}function dg(i,s){if(typeof i!="function")throw Error(a(191,i));i.call(s)}function fg(i,s){var r=i.callbacks;if(r!==null)for(i.callbacks=null,i=0;i<r.length;i++)dg(r[i],s)}var Ta=R(null),mc=R(0);function pg(i,s){i=Cn,ae(mc,i),ae(Ta,s),Cn=i|s.baseLanes}function Yh(){ae(mc,Cn),ae(Ta,Ta.current)}function Vh(){Cn=mc.current,G(Ta),G(mc)}var ds=R(null),Rs=null;function qn(i){var s=i.alternate;ae(Xt,Xt.current&1),ae(ds,i),Rs===null&&(s===null||Ta.current!==null||s.memoizedState!==null)&&(Rs=i)}function Xh(i){ae(Xt,Xt.current),ae(ds,i),Rs===null&&(Rs=i)}function mg(i){i.tag===22?(ae(Xt,Xt.current),ae(ds,i),Rs===null&&(Rs=i)):Wn()}function Wn(){ae(Xt,Xt.current),ae(ds,ds.current)}function fs(i){G(ds),Rs===i&&(Rs=null),G(Xt)}var Xt=R(0);function _c(i){for(var s=i;s!==null;){if(s.tag===13){var r=s.memoizedState;if(r!==null&&(r=r.dehydrated,r===null||tf(r)||sf(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,Ke=null,_t=null,ii=null,gc=!1,ka=!1,Or=!1,vc=0,kl=0,Da=null,CC=0;function Kt(){throw Error(a(321))}function Gh(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 Zh(i,s,r,l,u,d){return mn=d,Ke=s,s.memoizedState=null,s.updateQueue=null,s.lanes=0,T.H=i===null||i.memoizedState===null?Qg:dd,Or=!1,d=r(l,u),Or=!1,ka&&(d=gg(s,r,l,u)),_g(i),d}function _g(i){T.H=Ml;var s=_t!==null&&_t.next!==null;if(mn=0,ii=_t=Ke=null,gc=!1,kl=0,Da=null,s)throw Error(a(300));i===null||si||(i=i.dependencies,i!==null&&oc(i)&&(si=!0))}function gg(i,s,r,l){Ke=i;var u=0;do{if(ka&&(Da=null),kl=0,ka=!1,25<=u)throw Error(a(301));if(u+=1,ii=_t=null,i.updateQueue!=null){var d=i.updateQueue;d.lastEffect=null,d.events=null,d.stores=null,d.memoCache!=null&&(d.memoCache.index=0)}T.H=Jg,d=s(r,l)}while(ka);return d}function xC(){var i=T.H,s=i.useState()[0];return s=typeof s.then=="function"?Dl(s):s,i=i.useState()[0],(_t!==null?_t.memoizedState:null)!==i&&(Ke.flags|=1024),s}function Qh(){var i=vc!==0;return vc=0,i}function Jh(i,s,r){s.updateQueue=i.updateQueue,s.flags&=-2053,i.lanes&=~r}function ed(i){if(gc){for(i=i.memoizedState;i!==null;){var s=i.queue;s!==null&&(s.pending=null),i=i.next}gc=!1}mn=0,ii=_t=Ke=null,ka=!1,kl=vc=0,Da=null}function Yi(){var i={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return ii===null?Ke.memoizedState=ii=i:ii=ii.next=i,ii}function Gt(){if(_t===null){var i=Ke.alternate;i=i!==null?i.memoizedState:null}else i=_t.next;var s=ii===null?Ke.memoizedState:ii.next;if(s!==null)ii=s,_t=i;else{if(i===null)throw Ke.alternate===null?Error(a(467)):Error(a(310));_t=i,i={memoizedState:_t.memoizedState,baseState:_t.baseState,baseQueue:_t.baseQueue,queue:_t.queue,next:null},ii===null?Ke.memoizedState=ii=i:ii=ii.next=i}return ii}function yc(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Dl(i){var s=kl;return kl+=1,Da===null&&(Da=[]),i=lg(Da,i,s),s=Ke,(ii===null?s.memoizedState:ii.next)===null&&(s=s.alternate,T.H=s===null||s.memoizedState===null?Qg:dd),i}function bc(i){if(i!==null&&typeof i=="object"){if(typeof i.then=="function")return Dl(i);if(i.$$typeof===U)return Bi(i)}throw Error(a(438,String(i)))}function td(i){var s=null,r=Ke.updateQueue;if(r!==null&&(s=r.memoCache),s==null){var l=Ke.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=yc(),Ke.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]=K;return s.index++,r}function _n(i,s){return typeof s=="function"?s(i):s}function Sc(i){var s=Gt();return id(s,_t,i)}function id(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 w=g=null,M=null,Y=s,se=!1;do{var oe=Y.lane&-536870913;if(oe!==Y.lane?(Je&oe)===oe:(mn&oe)===oe){var V=Y.revertLane;if(V===0)M!==null&&(M=M.next={lane:0,revertLane:0,gesture:null,action:Y.action,hasEagerState:Y.hasEagerState,eagerState:Y.eagerState,next:null}),oe===wa&&(se=!0);else if((mn&V)===V){Y=Y.next,V===wa&&(se=!0);continue}else oe={lane:0,revertLane:Y.revertLane,gesture:null,action:Y.action,hasEagerState:Y.hasEagerState,eagerState:Y.eagerState,next:null},M===null?(w=M=oe,g=d):M=M.next=oe,Ke.lanes|=V,Vn|=V;oe=Y.action,Or&&r(d,oe),d=Y.hasEagerState?Y.eagerState:r(d,oe)}else V={lane:oe,revertLane:Y.revertLane,gesture:Y.gesture,action:Y.action,hasEagerState:Y.hasEagerState,eagerState:Y.eagerState,next:null},M===null?(w=M=V,g=d):M=M.next=V,Ke.lanes|=oe,Vn|=oe;Y=Y.next}while(Y!==null&&Y!==s);if(M===null?g=d:M.next=w,!us(d,i.memoizedState)&&(si=!0,se&&(r=Ca,r!==null)))throw r;i.memoizedState=d,i.baseState=g,i.baseQueue=M,l.lastRenderedState=d}return u===null&&(l.lanes=0),[i.memoizedState,l.dispatch]}function sd(i){var s=Gt(),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);us(d,s.memoizedState)||(si=!0),s.memoizedState=d,s.baseQueue===null&&(s.baseState=d),r.lastRenderedState=d}return[d,l]}function vg(i,s,r){var l=Ke,u=Gt(),d=it;if(d){if(r===void 0)throw Error(a(407));r=r()}else r=s();var g=!us((_t||u).memoizedState,r);if(g&&(u.memoizedState=r,si=!0),u=u.queue,ad(Sg.bind(null,l,u,i),[i]),u.getSnapshot!==s||g||ii!==null&&ii.memoizedState.tag&1){if(l.flags|=2048,Ra(9,{destroy:void 0},bg.bind(null,l,u,r,s),null),St===null)throw Error(a(349));d||(mn&127)!==0||yg(l,s,r)}return r}function yg(i,s,r){i.flags|=16384,i={getSnapshot:s,value:r},s=Ke.updateQueue,s===null?(s=yc(),Ke.updateQueue=s,s.stores=[i]):(r=s.stores,r===null?s.stores=[i]:r.push(i))}function bg(i,s,r,l){s.value=r,s.getSnapshot=l,wg(s)&&Cg(i)}function Sg(i,s,r){return r(function(){wg(s)&&Cg(i)})}function wg(i){var s=i.getSnapshot;i=i.value;try{var r=s();return!us(i,r)}catch{return!0}}function Cg(i){var s=Tr(i,2);s!==null&&ns(s,i,2)}function nd(i){var s=Yi();if(typeof i=="function"){var r=i;if(i=r(),Or){Jt(!0);try{r()}finally{Jt(!1)}}}return s.memoizedState=s.baseState=i,s.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:_n,lastRenderedState:i},s}function xg(i,s,r,l){return i.baseState=r,id(i,_t,typeof l=="function"?l:_n)}function EC(i,s,r,l,u){if(xc(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)}};T.T!==null?r(!0):d.isTransition=!1,l(d),r=s.pending,r===null?(d.next=s.pending=d,Eg(s,d)):(d.next=r.next,s.pending=r.next=d)}}function Eg(i,s){var r=s.action,l=s.payload,u=i.state;if(s.isTransition){var d=T.T,g={};T.T=g;try{var w=r(u,l),M=T.S;M!==null&&M(g,w),Tg(i,s,w)}catch(Y){rd(i,s,Y)}finally{d!==null&&g.types!==null&&(d.types=g.types),T.T=d}}else try{d=r(u,l),Tg(i,s,d)}catch(Y){rd(i,s,Y)}}function Tg(i,s,r){r!==null&&typeof r=="object"&&typeof r.then=="function"?r.then(function(l){kg(i,s,l)},function(l){return rd(i,s,l)}):kg(i,s,r)}function kg(i,s,r){s.status="fulfilled",s.value=r,Dg(s),i.state=r,s=i.pending,s!==null&&(r=s.next,r===s?i.pending=null:(r=r.next,s.next=r,Eg(i,r)))}function rd(i,s,r){var l=i.pending;if(i.pending=null,l!==null){l=l.next;do s.status="rejected",s.reason=r,Dg(s),s=s.next;while(s!==l)}i.action=null}function Dg(i){i=i.listeners;for(var s=0;s<i.length;s++)(0,i[s])()}function Rg(i,s){return s}function Mg(i,s){if(it){var r=St.formState;if(r!==null){e:{var l=Ke;if(it){if(Tt){t:{for(var u=Tt,d=Ds;u.nodeType!==8;){if(!d){u=null;break t}if(u=Ms(u.nextSibling),u===null){u=null;break t}}d=u.data,u=d==="F!"||d==="F"?u:null}if(u){Tt=Ms(u.nextSibling),l=u.data==="F!";break e}}Un(l)}l=!1}l&&(s=r[0])}}return r=Yi(),r.memoizedState=r.baseState=s,l={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Rg,lastRenderedState:s},r.queue=l,r=Xg.bind(null,Ke,l),l.dispatch=r,l=nd(!1),d=hd.bind(null,Ke,!1,l.queue),l=Yi(),u={state:s,dispatch:null,action:i,pending:null},l.queue=u,r=EC.bind(null,Ke,u,d,r),u.dispatch=r,l.memoizedState=i,[s,r,!1]}function Ng(i){var s=Gt();return Ag(s,_t,i)}function Ag(i,s,r){if(s=id(i,s,Rg)[0],i=Sc(_n)[0],typeof s=="object"&&s!==null&&typeof s.then=="function")try{var l=Dl(s)}catch(g){throw g===xa?hc:g}else l=s;s=Gt();var u=s.queue,d=u.dispatch;return r!==s.memoizedState&&(Ke.flags|=2048,Ra(9,{destroy:void 0},TC.bind(null,u,r),null)),[l,d,i]}function TC(i,s){i.action=s}function Lg(i){var s=Gt(),r=_t;if(r!==null)return Ag(s,r,i);Gt(),s=s.memoizedState,r=Gt();var l=r.queue.dispatch;return r.memoizedState=i,[s,l,!1]}function Ra(i,s,r,l){return i={tag:i,create:r,deps:l,inst:s,next:null},s=Ke.updateQueue,s===null&&(s=yc(),Ke.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 Bg(){return Gt().memoizedState}function wc(i,s,r,l){var u=Yi();Ke.flags|=i,u.memoizedState=Ra(1|s,{destroy:void 0},r,l===void 0?null:l)}function Cc(i,s,r,l){var u=Gt();l=l===void 0?null:l;var d=u.memoizedState.inst;_t!==null&&l!==null&&Gh(l,_t.memoizedState.deps)?u.memoizedState=Ra(s,d,r,l):(Ke.flags|=i,u.memoizedState=Ra(1|s,d,r,l))}function Og(i,s){wc(8390656,8,i,s)}function ad(i,s){Cc(2048,8,i,s)}function kC(i){Ke.flags|=4;var s=Ke.updateQueue;if(s===null)s=yc(),Ke.updateQueue=s,s.events=[i];else{var r=s.events;r===null?s.events=[i]:r.push(i)}}function zg(i){var s=Gt().memoizedState;return kC({ref:s,nextImpl:i}),function(){if((at&2)!==0)throw Error(a(440));return s.impl.apply(void 0,arguments)}}function jg(i,s){return Cc(4,2,i,s)}function Hg(i,s){return Cc(4,4,i,s)}function Ug(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 Pg(i,s,r){r=r!=null?r.concat([i]):null,Cc(4,4,Ug.bind(null,s,i),r)}function ld(){}function Ig(i,s){var r=Gt();s=s===void 0?null:s;var l=r.memoizedState;return s!==null&&Gh(s,l[1])?l[0]:(r.memoizedState=[i,s],i)}function Kg(i,s){var r=Gt();s=s===void 0?null:s;var l=r.memoizedState;if(s!==null&&Gh(s,l[1]))return l[0];if(l=i(),Or){Jt(!0);try{i()}finally{Jt(!1)}}return r.memoizedState=[l,s],l}function od(i,s,r){return r===void 0||(mn&1073741824)!==0&&(Je&261930)===0?i.memoizedState=s:(i.memoizedState=r,i=Fv(),Ke.lanes|=i,Vn|=i,r)}function Fg(i,s,r,l){return us(r,s)?r:Ta.current!==null?(i=od(i,r,l),us(i,s)||(si=!0),i):(mn&42)===0||(mn&1073741824)!==0&&(Je&261930)===0?(si=!0,i.memoizedState=r):(i=Fv(),Ke.lanes|=i,Vn|=i,s)}function qg(i,s,r,l,u){var d=W.p;W.p=d!==0&&8>d?d:8;var g=T.T,w={};T.T=w,hd(i,!1,s,r);try{var M=u(),Y=T.S;if(Y!==null&&Y(w,M),M!==null&&typeof M=="object"&&typeof M.then=="function"){var se=wC(M,l);Rl(i,s,se,_s(i))}else Rl(i,s,l,_s(i))}catch(oe){Rl(i,s,{then:function(){},status:"rejected",reason:oe},_s())}finally{W.p=d,g!==null&&w.types!==null&&(g.types=w.types),T.T=g}}function DC(){}function cd(i,s,r,l){if(i.tag!==5)throw Error(a(476));var u=Wg(i).queue;qg(i,u,s,F,r===null?DC:function(){return $g(i),r(l)})}function Wg(i){var s=i.memoizedState;if(s!==null)return s;s={memoizedState:F,baseState:F,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:_n,lastRenderedState:F},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 $g(i){var s=Wg(i);s.next===null&&(s=i.alternate.memoizedState),Rl(i,s.next.queue,{},_s())}function ud(){return Bi($l)}function Yg(){return Gt().memoizedState}function Vg(){return Gt().memoizedState}function RC(i){for(var s=i.return;s!==null;){switch(s.tag){case 24:case 3:var r=_s();i=Kn(r);var l=Fn(s,i,r);l!==null&&(ns(l,s,r),xl(l,s,r)),s={cache:Uh()},i.payload=s;return}s=s.return}}function MC(i,s,r){var l=_s();r={lane:l,revertLane:0,gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null},xc(i)?Gg(s,r):(r=Dh(i,s,r,l),r!==null&&(ns(r,i,l),Zg(r,s,l)))}function Xg(i,s,r){var l=_s();Rl(i,s,r,l)}function Rl(i,s,r,l){var u={lane:l,revertLane:0,gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null};if(xc(i))Gg(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,w=d(g,r);if(u.hasEagerState=!0,u.eagerState=w,us(w,g))return nc(i,s,u,0),St===null&&sc(),!1}catch{}if(r=Dh(i,s,u,l),r!==null)return ns(r,i,l),Zg(r,s,l),!0}return!1}function hd(i,s,r,l){if(l={lane:2,revertLane:Fd(),gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null},xc(i)){if(s)throw Error(a(479))}else s=Dh(i,r,l,2),s!==null&&ns(s,i,2)}function xc(i){var s=i.alternate;return i===Ke||s!==null&&s===Ke}function Gg(i,s){ka=gc=!0;var r=i.pending;r===null?s.next=s:(s.next=r.next,r.next=s),i.pending=s}function Zg(i,s,r){if((r&4194048)!==0){var l=s.lanes;l&=i.pendingLanes,r|=l,s.lanes=r,Vt(i,r)}}var Ml={readContext:Bi,use:bc,useCallback:Kt,useContext:Kt,useEffect:Kt,useImperativeHandle:Kt,useLayoutEffect:Kt,useInsertionEffect:Kt,useMemo:Kt,useReducer:Kt,useRef:Kt,useState:Kt,useDebugValue:Kt,useDeferredValue:Kt,useTransition:Kt,useSyncExternalStore:Kt,useId:Kt,useHostTransitionStatus:Kt,useFormState:Kt,useActionState:Kt,useOptimistic:Kt,useMemoCache:Kt,useCacheRefresh:Kt};Ml.useEffectEvent=Kt;var Qg={readContext:Bi,use:bc,useCallback:function(i,s){return Yi().memoizedState=[i,s===void 0?null:s],i},useContext:Bi,useEffect:Og,useImperativeHandle:function(i,s,r){r=r!=null?r.concat([i]):null,wc(4194308,4,Ug.bind(null,s,i),r)},useLayoutEffect:function(i,s){return wc(4194308,4,i,s)},useInsertionEffect:function(i,s){wc(4,2,i,s)},useMemo:function(i,s){var r=Yi();s=s===void 0?null:s;var l=i();if(Or){Jt(!0);try{i()}finally{Jt(!1)}}return r.memoizedState=[l,s],l},useReducer:function(i,s,r){var l=Yi();if(r!==void 0){var u=r(s);if(Or){Jt(!0);try{r(s)}finally{Jt(!1)}}}else u=s;return l.memoizedState=l.baseState=u,i={pending:null,lanes:0,dispatch:null,lastRenderedReducer:i,lastRenderedState:u},l.queue=i,i=i.dispatch=MC.bind(null,Ke,i),[l.memoizedState,i]},useRef:function(i){var s=Yi();return i={current:i},s.memoizedState=i},useState:function(i){i=nd(i);var s=i.queue,r=Xg.bind(null,Ke,s);return s.dispatch=r,[i.memoizedState,r]},useDebugValue:ld,useDeferredValue:function(i,s){var r=Yi();return od(r,i,s)},useTransition:function(){var i=nd(!1);return i=qg.bind(null,Ke,i.queue,!0,!1),Yi().memoizedState=i,[!1,i]},useSyncExternalStore:function(i,s,r){var l=Ke,u=Yi();if(it){if(r===void 0)throw Error(a(407));r=r()}else{if(r=s(),St===null)throw Error(a(349));(Je&127)!==0||yg(l,s,r)}u.memoizedState=r;var d={value:r,getSnapshot:s};return u.queue=d,Og(Sg.bind(null,l,d,i),[i]),l.flags|=2048,Ra(9,{destroy:void 0},bg.bind(null,l,d,r,s),null),r},useId:function(){var i=Yi(),s=St.identifierPrefix;if(it){var r=Gs,l=Xs;r=(l&~(1<<32-jt(l)-1)).toString(32)+r,s="_"+s+"R_"+r,r=vc++,0<r&&(s+="H"+r.toString(32)),s+="_"}else r=CC++,s="_"+s+"r_"+r.toString(32)+"_";return i.memoizedState=s},useHostTransitionStatus:ud,useFormState:Mg,useActionState:Mg,useOptimistic:function(i){var s=Yi();s.memoizedState=s.baseState=i;var r={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return s.queue=r,s=hd.bind(null,Ke,!0,r),r.dispatch=s,[i,s]},useMemoCache:td,useCacheRefresh:function(){return Yi().memoizedState=RC.bind(null,Ke)},useEffectEvent:function(i){var s=Yi(),r={impl:i};return s.memoizedState=r,function(){if((at&2)!==0)throw Error(a(440));return r.impl.apply(void 0,arguments)}}},dd={readContext:Bi,use:bc,useCallback:Ig,useContext:Bi,useEffect:ad,useImperativeHandle:Pg,useInsertionEffect:jg,useLayoutEffect:Hg,useMemo:Kg,useReducer:Sc,useRef:Bg,useState:function(){return Sc(_n)},useDebugValue:ld,useDeferredValue:function(i,s){var r=Gt();return Fg(r,_t.memoizedState,i,s)},useTransition:function(){var i=Sc(_n)[0],s=Gt().memoizedState;return[typeof i=="boolean"?i:Dl(i),s]},useSyncExternalStore:vg,useId:Yg,useHostTransitionStatus:ud,useFormState:Ng,useActionState:Ng,useOptimistic:function(i,s){var r=Gt();return xg(r,_t,i,s)},useMemoCache:td,useCacheRefresh:Vg};dd.useEffectEvent=zg;var Jg={readContext:Bi,use:bc,useCallback:Ig,useContext:Bi,useEffect:ad,useImperativeHandle:Pg,useInsertionEffect:jg,useLayoutEffect:Hg,useMemo:Kg,useReducer:sd,useRef:Bg,useState:function(){return sd(_n)},useDebugValue:ld,useDeferredValue:function(i,s){var r=Gt();return _t===null?od(r,i,s):Fg(r,_t.memoizedState,i,s)},useTransition:function(){var i=sd(_n)[0],s=Gt().memoizedState;return[typeof i=="boolean"?i:Dl(i),s]},useSyncExternalStore:vg,useId:Yg,useHostTransitionStatus:ud,useFormState:Lg,useActionState:Lg,useOptimistic:function(i,s){var r=Gt();return _t!==null?xg(r,_t,i,s):(r.baseState=i,[i,r.queue.dispatch])},useMemoCache:td,useCacheRefresh:Vg};Jg.useEffectEvent=zg;function fd(i,s,r,l){s=i.memoizedState,r=r(l,s),r=r==null?s:b({},s,r),i.memoizedState=r,i.lanes===0&&(i.updateQueue.baseState=r)}var pd={enqueueSetState:function(i,s,r){i=i._reactInternals;var l=_s(),u=Kn(l);u.payload=s,r!=null&&(u.callback=r),s=Fn(i,u,l),s!==null&&(ns(s,i,l),xl(s,i,l))},enqueueReplaceState:function(i,s,r){i=i._reactInternals;var l=_s(),u=Kn(l);u.tag=1,u.payload=s,r!=null&&(u.callback=r),s=Fn(i,u,l),s!==null&&(ns(s,i,l),xl(s,i,l))},enqueueForceUpdate:function(i,s){i=i._reactInternals;var r=_s(),l=Kn(r);l.tag=2,s!=null&&(l.callback=s),s=Fn(i,l,r),s!==null&&(ns(s,i,r),xl(s,i,r))}};function ev(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?!_l(r,l)||!_l(u,d):!0}function tv(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&&pd.enqueueReplaceState(s,s.state,null)}function zr(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=b({},r));for(var u in i)r[u]===void 0&&(r[u]=i[u])}return r}function iv(i){ic(i)}function sv(i){console.error(i)}function nv(i){ic(i)}function Ec(i,s){try{var r=i.onUncaughtError;r(s.value,{componentStack:s.stack})}catch(l){setTimeout(function(){throw l})}}function rv(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 md(i,s,r){return r=Kn(r),r.tag=3,r.payload={element:null},r.callback=function(){Ec(i,s)},r}function av(i){return i=Kn(i),i.tag=3,i}function lv(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(){rv(s,r,l)}}var g=r.stateNode;g!==null&&typeof g.componentDidCatch=="function"&&(i.callback=function(){rv(s,r,l),typeof u!="function"&&(Xn===null?Xn=new Set([this]):Xn.add(this));var w=l.stack;this.componentDidCatch(l.value,{componentStack:w!==null?w:""})})}function NC(i,s,r,l,u){if(r.flags|=32768,l!==null&&typeof l=="object"&&typeof l.then=="function"){if(s=r.alternate,s!==null&&Sa(s,r,u,!0),r=ds.current,r!==null){switch(r.tag){case 31:case 13:return Rs===null?jc():r.alternate===null&&Ft===0&&(Ft=3),r.flags&=-257,r.flags|=65536,r.lanes=u,l===dc?r.flags|=16384:(s=r.updateQueue,s===null?r.updateQueue=new Set([l]):s.add(l),Pd(i,l,u)),!1;case 22:return r.flags|=65536,l===dc?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)),Pd(i,l,u)),!1}throw Error(a(435,r.tag))}return Pd(i,l,u),jc(),!1}if(it)return s=ds.current,s!==null?((s.flags&65536)===0&&(s.flags|=256),s.flags|=65536,s.lanes=u,l!==Bh&&(i=Error(a(422),{cause:l}),yl(Es(i,r)))):(l!==Bh&&(s=Error(a(423),{cause:l}),yl(Es(s,r))),i=i.current.alternate,i.flags|=65536,u&=-u,i.lanes|=u,l=Es(l,r),u=md(i.stateNode,l,u),Wh(i,u),Ft!==4&&(Ft=2)),!1;var d=Error(a(520),{cause:l});if(d=Es(d,r),Hl===null?Hl=[d]:Hl.push(d),Ft!==4&&(Ft=2),s===null)return!0;l=Es(l,r),r=s;do{switch(r.tag){case 3:return r.flags|=65536,i=u&-u,r.lanes|=i,i=md(r.stateNode,l,i),Wh(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=av(u),lv(u,i,r,l),Wh(r,u),!1}r=r.return}while(r!==null);return!1}var _d=Error(a(461)),si=!1;function Oi(i,s,r,l){s.child=i===null?hg(s,null,r,l):Br(s,i.child,r,l)}function ov(i,s,r,l,u){r=r.render;var d=s.ref;if("ref"in l){var g={};for(var w in l)w!=="ref"&&(g[w]=l[w])}else g=l;return Mr(s),l=Zh(i,s,r,g,d,u),w=Qh(),i!==null&&!si?(Jh(i,s,u),gn(i,s,u)):(it&&w&&Ah(s),s.flags|=1,Oi(i,s,l,u),s.child)}function cv(i,s,r,l,u){if(i===null){var d=r.type;return typeof d=="function"&&!Rh(d)&&d.defaultProps===void 0&&r.compare===null?(s.tag=15,s.type=d,uv(i,s,d,l,u)):(i=ac(r.type,null,l,s,s.mode,u),i.ref=s.ref,i.return=s,s.child=i)}if(d=i.child,!xd(i,u)){var g=d.memoizedProps;if(r=r.compare,r=r!==null?r:_l,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 uv(i,s,r,l,u){if(i!==null){var d=i.memoizedProps;if(_l(d,l)&&i.ref===s.ref)if(si=!1,s.pendingProps=l=d,xd(i,u))(i.flags&131072)!==0&&(si=!0);else return s.lanes=i.lanes,gn(i,s,u)}return gd(i,s,r,l,u)}function hv(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 dv(i,s,d,r,l)}if((r&536870912)!==0)s.memoizedState={baseLanes:0,cachePool:null},i!==null&&uc(s,d!==null?d.cachePool:null),d!==null?pg(s,d):Yh(),mg(s);else return l=s.lanes=536870912,dv(i,s,d!==null?d.baseLanes|r:r,r,l)}else d!==null?(uc(s,d.cachePool),pg(s,d),Wn(),s.memoizedState=null):(i!==null&&uc(s,null),Yh(),Wn());return Oi(i,s,u,r),s.child}function Nl(i,s){return i!==null&&i.tag===22||s.stateNode!==null||(s.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),s.sibling}function dv(i,s,r,l,u){var d=Ih();return d=d===null?null:{parent:ti._currentValue,pool:d},s.memoizedState={baseLanes:r,cachePool:d},i!==null&&uc(s,null),Yh(),mg(s),i!==null&&Sa(i,s,l,!0),s.childLanes=u,null}function Tc(i,s){return s=Dc({mode:s.mode,children:s.children},i.mode),s.ref=i.ref,i.child=s,s.return=i,s}function fv(i,s,r){return Br(s,i.child,null,r),i=Tc(s,s.pendingProps),i.flags|=2,fs(s),s.memoizedState=null,i}function AC(i,s,r){var l=s.pendingProps,u=(s.flags&128)!==0;if(s.flags&=-129,i===null){if(it){if(l.mode==="hidden")return i=Tc(s,l),s.lanes=536870912,Nl(null,i);if(Xh(s),(i=Tt)?(i=Ey(i,Ds),i=i!==null&&i.data==="&"?i:null,i!==null&&(s.memoizedState={dehydrated:i,treeContext:jn!==null?{id:Xs,overflow:Gs}:null,retryLane:536870912,hydrationErrors:null},r=G_(i),r.return=s,s.child=r,Li=s,Tt=null)):i=null,i===null)throw Un(s);return s.lanes=536870912,null}return Tc(s,l)}var d=i.memoizedState;if(d!==null){var g=d.dehydrated;if(Xh(s),u)if(s.flags&256)s.flags&=-257,s=fv(i,s,r);else if(s.memoizedState!==null)s.child=i.child,s.flags|=128,s=null;else throw Error(a(558));else if(si||Sa(i,s,r,!1),u=(r&i.childLanes)!==0,si||u){if(l=St,l!==null&&(g=Ai(l,r),g!==0&&g!==d.retryLane))throw d.retryLane=g,Tr(i,g),ns(l,i,g),_d;jc(),s=fv(i,s,r)}else i=d.treeContext,Tt=Ms(g.nextSibling),Li=s,it=!0,Hn=null,Ds=!1,i!==null&&J_(s,i),s=Tc(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 kc(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 gd(i,s,r,l,u){return Mr(s),r=Zh(i,s,r,l,void 0,u),l=Qh(),i!==null&&!si?(Jh(i,s,u),gn(i,s,u)):(it&&l&&Ah(s),s.flags|=1,Oi(i,s,r,u),s.child)}function pv(i,s,r,l,u,d){return Mr(s),s.updateQueue=null,r=gg(s,l,r,u),_g(i),l=Qh(),i!==null&&!si?(Jh(i,s,d),gn(i,s,d)):(it&&l&&Ah(s),s.flags|=1,Oi(i,s,r,d),s.child)}function mv(i,s,r,l,u){if(Mr(s),s.stateNode===null){var d=ga,g=r.contextType;typeof g=="object"&&g!==null&&(d=Bi(g)),d=new r(l,d),s.memoizedState=d.state!==null&&d.state!==void 0?d.state:null,d.updater=pd,s.stateNode=d,d._reactInternals=s,d=s.stateNode,d.props=l,d.state=s.memoizedState,d.refs={},Fh(s),g=r.contextType,d.context=typeof g=="object"&&g!==null?Bi(g):ga,d.state=s.memoizedState,g=r.getDerivedStateFromProps,typeof g=="function"&&(fd(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&&pd.enqueueReplaceState(d,d.state,null),Tl(s,l,d,u),El(),d.state=s.memoizedState),typeof d.componentDidMount=="function"&&(s.flags|=4194308),l=!0}else if(i===null){d=s.stateNode;var w=s.memoizedProps,M=zr(r,w);d.props=M;var Y=d.context,se=r.contextType;g=ga,typeof se=="object"&&se!==null&&(g=Bi(se));var oe=r.getDerivedStateFromProps;se=typeof oe=="function"||typeof d.getSnapshotBeforeUpdate=="function",w=s.pendingProps!==w,se||typeof d.UNSAFE_componentWillReceiveProps!="function"&&typeof d.componentWillReceiveProps!="function"||(w||Y!==g)&&tv(s,d,l,g),In=!1;var V=s.memoizedState;d.state=V,Tl(s,l,d,u),El(),Y=s.memoizedState,w||V!==Y||In?(typeof oe=="function"&&(fd(s,r,oe,l),Y=s.memoizedState),(M=In||ev(s,r,M,l,V,Y,g))?(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=Y),d.props=l,d.state=Y,d.context=g,l=M):(typeof d.componentDidMount=="function"&&(s.flags|=4194308),l=!1)}else{d=s.stateNode,qh(i,s),g=s.memoizedProps,se=zr(r,g),d.props=se,oe=s.pendingProps,V=d.context,Y=r.contextType,M=ga,typeof Y=="object"&&Y!==null&&(M=Bi(Y)),w=r.getDerivedStateFromProps,(Y=typeof w=="function"||typeof d.getSnapshotBeforeUpdate=="function")||typeof d.UNSAFE_componentWillReceiveProps!="function"&&typeof d.componentWillReceiveProps!="function"||(g!==oe||V!==M)&&tv(s,d,l,M),In=!1,V=s.memoizedState,d.state=V,Tl(s,l,d,u),El();var Z=s.memoizedState;g!==oe||V!==Z||In||i!==null&&i.dependencies!==null&&oc(i.dependencies)?(typeof w=="function"&&(fd(s,r,w,l),Z=s.memoizedState),(se=In||ev(s,r,se,l,V,Z,M)||i!==null&&i.dependencies!==null&&oc(i.dependencies))?(Y||typeof d.UNSAFE_componentWillUpdate!="function"&&typeof d.componentWillUpdate!="function"||(typeof d.componentWillUpdate=="function"&&d.componentWillUpdate(l,Z,M),typeof d.UNSAFE_componentWillUpdate=="function"&&d.UNSAFE_componentWillUpdate(l,Z,M)),typeof d.componentDidUpdate=="function"&&(s.flags|=4),typeof d.getSnapshotBeforeUpdate=="function"&&(s.flags|=1024)):(typeof d.componentDidUpdate!="function"||g===i.memoizedProps&&V===i.memoizedState||(s.flags|=4),typeof d.getSnapshotBeforeUpdate!="function"||g===i.memoizedProps&&V===i.memoizedState||(s.flags|=1024),s.memoizedProps=l,s.memoizedState=Z),d.props=l,d.state=Z,d.context=M,l=se):(typeof d.componentDidUpdate!="function"||g===i.memoizedProps&&V===i.memoizedState||(s.flags|=4),typeof d.getSnapshotBeforeUpdate!="function"||g===i.memoizedProps&&V===i.memoizedState||(s.flags|=1024),l=!1)}return d=l,kc(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=Br(s,i.child,null,u),s.child=Br(s,null,r,u)):Oi(i,s,r,u),s.memoizedState=d.state,i=s.child):i=gn(i,s,u),i}function _v(i,s,r,l){return Dr(),s.flags|=256,Oi(i,s,r,l),s.child}var vd={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function yd(i){return{baseLanes:i,cachePool:rg()}}function bd(i,s,r){return i=i!==null?i.childLanes&~r:0,s&&(i|=ms),i}function gv(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:(Xt.current&2)!==0),g&&(u=!0,s.flags&=-129),g=(s.flags&32)!==0,s.flags&=-33,i===null){if(it){if(u?qn(s):Wn(),(i=Tt)?(i=Ey(i,Ds),i=i!==null&&i.data!=="&"?i:null,i!==null&&(s.memoizedState={dehydrated:i,treeContext:jn!==null?{id:Xs,overflow:Gs}:null,retryLane:536870912,hydrationErrors:null},r=G_(i),r.return=s,s.child=r,Li=s,Tt=null)):i=null,i===null)throw Un(s);return sf(i)?s.lanes=32:s.lanes=536870912,null}var w=l.children;return l=l.fallback,u?(Wn(),u=s.mode,w=Dc({mode:"hidden",children:w},u),l=kr(l,u,r,null),w.return=s,l.return=s,w.sibling=l,s.child=w,l=s.child,l.memoizedState=yd(r),l.childLanes=bd(i,g,r),s.memoizedState=vd,Nl(null,l)):(qn(s),Sd(s,w))}var M=i.memoizedState;if(M!==null&&(w=M.dehydrated,w!==null)){if(d)s.flags&256?(qn(s),s.flags&=-257,s=wd(i,s,r)):s.memoizedState!==null?(Wn(),s.child=i.child,s.flags|=128,s=null):(Wn(),w=l.fallback,u=s.mode,l=Dc({mode:"visible",children:l.children},u),w=kr(w,u,r,null),w.flags|=2,l.return=s,w.return=s,l.sibling=w,s.child=l,Br(s,i.child,null,r),l=s.child,l.memoizedState=yd(r),l.childLanes=bd(i,g,r),s.memoizedState=vd,s=Nl(null,l));else if(qn(s),sf(w)){if(g=w.nextSibling&&w.nextSibling.dataset,g)var Y=g.dgst;g=Y,l=Error(a(419)),l.stack="",l.digest=g,yl({value:l,source:null,stack:null}),s=wd(i,s,r)}else if(si||Sa(i,s,r,!1),g=(r&i.childLanes)!==0,si||g){if(g=St,g!==null&&(l=Ai(g,r),l!==0&&l!==M.retryLane))throw M.retryLane=l,Tr(i,l),ns(g,i,l),_d;tf(w)||jc(),s=wd(i,s,r)}else tf(w)?(s.flags|=192,s.child=i.child,s=null):(i=M.treeContext,Tt=Ms(w.nextSibling),Li=s,it=!0,Hn=null,Ds=!1,i!==null&&J_(s,i),s=Sd(s,l.children),s.flags|=4096);return s}return u?(Wn(),w=l.fallback,u=s.mode,M=i.child,Y=M.sibling,l=hn(M,{mode:"hidden",children:l.children}),l.subtreeFlags=M.subtreeFlags&65011712,Y!==null?w=hn(Y,w):(w=kr(w,u,r,null),w.flags|=2),w.return=s,l.return=s,l.sibling=w,s.child=l,Nl(null,l),l=s.child,w=i.child.memoizedState,w===null?w=yd(r):(u=w.cachePool,u!==null?(M=ti._currentValue,u=u.parent!==M?{parent:M,pool:M}:u):u=rg(),w={baseLanes:w.baseLanes|r,cachePool:u}),l.memoizedState=w,l.childLanes=bd(i,g,r),s.memoizedState=vd,Nl(i.child,l)):(qn(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 Sd(i,s){return s=Dc({mode:"visible",children:s},i.mode),s.return=i,i.child=s}function Dc(i,s){return i=hs(22,i,null,s),i.lanes=0,i}function wd(i,s,r){return Br(s,i.child,null,r),i=Sd(s,s.pendingProps.children),i.flags|=2,s.memoizedState=null,i}function vv(i,s,r){i.lanes|=s;var l=i.alternate;l!==null&&(l.lanes|=s),jh(i.return,s,r)}function Cd(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 yv(i,s,r){var l=s.pendingProps,u=l.revealOrder,d=l.tail;l=l.children;var g=Xt.current,w=(g&2)!==0;if(w?(g=g&1|2,s.flags|=128):g&=1,ae(Xt,g),Oi(i,s,l,r),l=it?vl:0,!w&&i!==null&&(i.flags&128)!==0)e:for(i=s.child;i!==null;){if(i.tag===13)i.memoizedState!==null&&vv(i,r,s);else if(i.tag===19)vv(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&&_c(i)===null&&(u=r),r=r.sibling;r=u,r===null?(u=s.child,s.child=null):(u=r.sibling,r.sibling=null),Cd(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&&_c(i)===null){s.child=u;break}i=u.sibling,u.sibling=r,r=u,u=i}Cd(s,!0,r,null,d,l);break;case"together":Cd(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),Vn|=s.lanes,(r&s.childLanes)===0)if(i!==null){if(Sa(i,s,r,!1),(r&s.childLanes)===0)return null}else return null;if(i!==null&&s.child!==i.child)throw Error(a(153));if(s.child!==null){for(i=s.child,r=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 xd(i,s){return(i.lanes&s)!==0?!0:(i=i.dependencies,!!(i!==null&&oc(i)))}function LC(i,s,r){switch(s.tag){case 3:Fe(s,s.stateNode.containerInfo),Pn(s,ti,i.memoizedState.cache),Dr();break;case 27:case 5:ve(s);break;case 4:Fe(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,Xh(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?gv(i,s,r):(qn(s),i=gn(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||(Sa(i,s,r,!1),l=(r&s.childLanes)!==0),u){if(l)return yv(i,s,r);s.flags|=128}if(u=s.memoizedState,u!==null&&(u.rendering=null,u.tail=null,u.lastEffect=null),ae(Xt,Xt.current),l)break;return null;case 22:return s.lanes=0,hv(i,s,r,s.pendingProps);case 24:Pn(s,ti,i.memoizedState.cache)}return gn(i,s,r)}function bv(i,s,r){if(i!==null)if(i.memoizedProps!==s.pendingProps)si=!0;else{if(!xd(i,r)&&(s.flags&128)===0)return si=!1,LC(i,s,r);si=(i.flags&131072)!==0}else si=!1,it&&(s.flags&1048576)!==0&&Q_(s,vl,s.index);switch(s.lanes=0,s.tag){case 16:e:{var l=s.pendingProps;if(i=Ar(s.elementType),s.type=i,typeof i=="function")Rh(i)?(l=zr(i,l),s.tag=1,s=mv(null,s,i,l,r)):(s.tag=0,s=gd(null,s,i,l,r));else{if(i!=null){var u=i.$$typeof;if(u===X){s.tag=11,s=ov(null,s,i,l,r);break e}else if(u===ne){s.tag=14,s=cv(null,s,i,l,r);break e}}throw s=j(i)||i,Error(a(306,s,""))}}return s;case 0:return gd(i,s,s.type,s.pendingProps,r);case 1:return l=s.type,u=zr(l,s.pendingProps),mv(i,s,l,u,r);case 3:e:{if(Fe(s,s.stateNode.containerInfo),i===null)throw Error(a(387));l=s.pendingProps;var d=s.memoizedState;u=d.element,qh(i,s),Tl(s,l,null,r);var g=s.memoizedState;if(l=g.cache,Pn(s,ti,l),l!==d.cache&&Hh(s,[ti],r,!0),El(),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=_v(i,s,l,r);break e}else if(l!==u){u=Es(Error(a(424)),s),yl(u),s=_v(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,Tt=Ms(i.firstChild),Li=s,it=!0,Hn=null,Ds=!0,r=hg(s,null,l,r),s.child=r;r;)r.flags=r.flags&-3|4096,r=r.sibling;else{if(Dr(),l===u){s=gn(i,s,r);break e}Oi(i,s,l,r)}s=s.child}return s;case 26:return kc(i,s),i===null?(r=Ny(s.type,null,s.pendingProps,null))?s.memoizedState=r:it||(r=s.type,i=s.pendingProps,l=qc(ye.current).createElement(r),l[Ut]=s,l[Pt]=i,zi(l,r,i),It(l),s.stateNode=l):s.memoizedState=Ny(s.type,i.memoizedProps,s.pendingProps,i.memoizedState),null;case 27:return ve(s),i===null&&it&&(l=s.stateNode=Dy(s.type,s.pendingProps,ye.current),Li=s,Ds=!0,u=Tt,Jn(s.type)?(nf=u,Tt=Ms(l.firstChild)):Tt=u),Oi(i,s,s.pendingProps.children,r),kc(i,s),i===null&&(s.flags|=4194304),s.child;case 5:return i===null&&it&&((u=l=Tt)&&(l=cx(l,s.type,s.pendingProps,Ds),l!==null?(s.stateNode=l,Li=s,Tt=Ms(l.firstChild),Ds=!1,u=!0):u=!1),u||Un(s)),ve(s),u=s.type,d=s.pendingProps,g=i!==null?i.memoizedProps:null,l=d.children,Qd(u,d)?l=null:g!==null&&Qd(u,g)&&(s.flags|=32),s.memoizedState!==null&&(u=Zh(i,s,xC,null,null,r),$l._currentValue=u),kc(i,s),Oi(i,s,l,r),s.child;case 6:return i===null&&it&&((i=r=Tt)&&(r=ux(r,s.pendingProps,Ds),r!==null?(s.stateNode=r,Li=s,Tt=null,i=!0):i=!1),i||Un(s)),null;case 13:return gv(i,s,r);case 4:return Fe(s,s.stateNode.containerInfo),l=s.pendingProps,i===null?s.child=Br(s,null,l,r):Oi(i,s,l,r),s.child;case 11:return ov(i,s,s.type,s.pendingProps,r);case 7:return Oi(i,s,s.pendingProps,r),s.child;case 8:return Oi(i,s,s.pendingProps.children,r),s.child;case 12:return Oi(i,s,s.pendingProps.children,r),s.child;case 10:return l=s.pendingProps,Pn(s,s.type,l.value),Oi(i,s,l.children,r),s.child;case 9:return u=s.type._context,l=s.pendingProps.children,Mr(s),u=Bi(u),l=l(u),s.flags|=1,Oi(i,s,l,r),s.child;case 14:return cv(i,s,s.type,s.pendingProps,r);case 15:return uv(i,s,s.type,s.pendingProps,r);case 19:return yv(i,s,r);case 31:return AC(i,s,r);case 22:return hv(i,s,r,s.pendingProps);case 24:return Mr(s),l=Bi(ti),i===null?(u=Ih(),u===null&&(u=St,d=Uh(),u.pooledCache=d,d.refCount++,d!==null&&(u.pooledCacheLanes|=r),u=d),s.memoizedState={parent:l,cache:u},Fh(s),Pn(s,ti,u)):((i.lanes&r)!==0&&(qh(i,s),Tl(s,null,null,r),El()),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,ti,l)):(l=d.cache,Pn(s,ti,l),l!==u.cache&&Hh(s,[ti],r,!0))),Oi(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 Ed(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(Yv())i.flags|=8192;else throw Lr=dc,Kh}else i.flags&=-16777217}function Sv(i,s){if(s.type!=="stylesheet"||(s.state.loading&4)!==0)i.flags&=-16777217;else if(i.flags|=16777216,!zy(s))if(Yv())i.flags|=8192;else throw Lr=dc,Kh}function Rc(i,s){s!==null&&(i.flags|=4),i.flags&16384&&(s=i.tag!==22?ei():536870912,i.lanes|=s,La|=s)}function Al(i,s){if(!it)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 kt(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 BC(i,s,r){var l=s.pendingProps;switch(Lh(s),s.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return kt(s),null;case 1:return kt(s),null;case 3:return r=s.stateNode,l=null,i!==null&&(l=i.memoizedState.cache),s.memoizedState.cache!==l&&(s.flags|=2048),pn(ti),he(),r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),(i===null||i.child===null)&&(ba(s)?vn(s):i===null||i.memoizedState.isDehydrated&&(s.flags&256)===0||(s.flags|=1024,Oh())),kt(s),null;case 26:var u=s.type,d=s.memoizedState;return i===null?(vn(s),d!==null?(kt(s),Sv(s,d)):(kt(s),Ed(s,u,null,l,r))):d?d!==i.memoizedState?(vn(s),kt(s),Sv(s,d)):(kt(s),s.flags&=-16777217):(i=i.memoizedProps,i!==l&&vn(s),kt(s),Ed(s,u,i,l,r)),null;case 27:if(ze(s),r=ye.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 kt(s),null}i=de.current,ba(s)?eg(s):(i=Dy(u,l,r),s.stateNode=i,vn(s))}return kt(s),null;case 5:if(ze(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 kt(s),null}if(d=de.current,ba(s))eg(s);else{var g=qc(ye.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[Ut]=s,d[Pt]=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(zi(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 kt(s),Ed(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=ye.current,ba(s)){if(i=s.stateNode,r=s.memoizedProps,l=null,u=Li,u!==null)switch(u.tag){case 27:case 5:l=u.memoizedProps}i[Ut]=s,i=!!(i.nodeValue===r||l!==null&&l.suppressHydrationWarning===!0||gy(i.nodeValue,r)),i||Un(s,!0)}else i=qc(i).createTextNode(l),i[Ut]=s,s.stateNode=i}return kt(s),null;case 31:if(r=s.memoizedState,i===null||i.memoizedState!==null){if(l=ba(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[Ut]=s}else Dr(),(s.flags&128)===0&&(s.memoizedState=null),s.flags|=4;kt(s),i=!1}else r=Oh(),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 kt(s),null;case 13:if(l=s.memoizedState,i===null||i.memoizedState!==null&&i.memoizedState.dehydrated!==null){if(u=ba(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[Ut]=s}else Dr(),(s.flags&128)===0&&(s.memoizedState=null),s.flags|=4;kt(s),u=!1}else u=Oh(),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),Rc(s,s.updateQueue),kt(s),null);case 4:return he(),i===null&&Yd(s.stateNode.containerInfo),kt(s),null;case 10:return pn(s.type),kt(s),null;case 19:if(G(Xt),l=s.memoizedState,l===null)return kt(s),null;if(u=(s.flags&128)!==0,d=l.rendering,d===null)if(u)Al(l,!1);else{if(Ft!==0||i!==null&&(i.flags&128)!==0)for(i=s.child;i!==null;){if(d=_c(i),d!==null){for(s.flags|=128,Al(l,!1),i=d.updateQueue,s.updateQueue=i,Rc(s,i),s.subtreeFlags=0,i=r,r=s.child;r!==null;)X_(r,i),r=r.sibling;return ae(Xt,Xt.current&1|2),it&&dn(s,l.treeForkCount),s.child}i=i.sibling}l.tail!==null&&rt()>Bc&&(s.flags|=128,u=!0,Al(l,!1),s.lanes=4194304)}else{if(!u)if(i=_c(d),i!==null){if(s.flags|=128,u=!0,i=i.updateQueue,s.updateQueue=i,Rc(s,i),Al(l,!0),l.tail===null&&l.tailMode==="hidden"&&!d.alternate&&!it)return kt(s),null}else 2*rt()-l.renderingStartTime>Bc&&r!==536870912&&(s.flags|=128,u=!0,Al(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=rt(),i.sibling=null,r=Xt.current,ae(Xt,u?r&1|2:r&1),it&&dn(s,l.treeForkCount),i):(kt(s),null);case 22:case 23:return fs(s),Vh(),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&&(kt(s),s.subtreeFlags&6&&(s.flags|=8192)):kt(s),r=s.updateQueue,r!==null&&Rc(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&&G(Nr),null;case 24:return r=null,i!==null&&(r=i.memoizedState.cache),s.memoizedState.cache!==r&&(s.flags|=2048),pn(ti),kt(s),null;case 25:return null;case 30:return null}throw Error(a(156,s.tag))}function OC(i,s){switch(Lh(s),s.tag){case 1:return i=s.flags,i&65536?(s.flags=i&-65537|128,s):null;case 3:return pn(ti),he(),i=s.flags,(i&65536)!==0&&(i&128)===0?(s.flags=i&-65537|128,s):null;case 26:case 27:case 5:return ze(s),null;case 31:if(s.memoizedState!==null){if(fs(s),s.alternate===null)throw Error(a(340));Dr()}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));Dr()}return i=s.flags,i&65536?(s.flags=i&-65537|128,s):null;case 19:return G(Xt),null;case 4:return he(),null;case 10:return pn(s.type),null;case 22:case 23:return fs(s),Vh(),i!==null&&G(Nr),i=s.flags,i&65536?(s.flags=i&-65537|128,s):null;case 24:return pn(ti),null;case 25:return null;default:return null}}function wv(i,s){switch(Lh(s),s.tag){case 3:pn(ti),he();break;case 26:case 27:case 5:ze(s);break;case 4:he();break;case 31:s.memoizedState!==null&&fs(s);break;case 13:fs(s);break;case 19:G(Xt);break;case 10:pn(s.type);break;case 22:case 23:fs(s),Vh(),i!==null&&G(Nr);break;case 24:pn(ti)}}function Ll(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(w){dt(s,s.return,w)}}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 g=l.inst,w=g.destroy;if(w!==void 0){g.destroy=void 0,u=s;var M=r,Y=w;try{Y()}catch(se){dt(u,M,se)}}}l=l.next}while(l!==d)}}catch(se){dt(s,s.return,se)}}function Cv(i){var s=i.updateQueue;if(s!==null){var r=i.stateNode;try{fg(s,r)}catch(l){dt(i,i.return,l)}}}function xv(i,s,r){r.props=zr(i.type,i.memoizedProps),r.state=i.memoizedState;try{r.componentWillUnmount()}catch(l){dt(i,s,l)}}function Bl(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){dt(i,s,u)}}function Zs(i,s){var r=i.ref,l=i.refCleanup;if(r!==null)if(typeof l=="function")try{l()}catch(u){dt(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){dt(i,s,u)}else r.current=null}function Ev(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){dt(i,i.return,u)}}function Td(i,s,r){try{var l=i.stateNode;sx(l,i.type,r,s),l[Pt]=s}catch(u){dt(i,i.return,u)}}function Tv(i){return i.tag===5||i.tag===3||i.tag===26||i.tag===27&&Jn(i.type)||i.tag===4}function kd(i){e:for(;;){for(;i.sibling===null;){if(i.return===null||Tv(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 Dd(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=wi));else if(l!==4&&(l===27&&Jn(i.type)&&(r=i.stateNode,s=null),i=i.child,i!==null))for(Dd(i,s,r),i=i.sibling;i!==null;)Dd(i,s,r),i=i.sibling}function Mc(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(Mc(i,s,r),i=i.sibling;i!==null;)Mc(i,s,r),i=i.sibling}function kv(i){var s=i.stateNode,r=i.memoizedProps;try{for(var l=i.type,u=s.attributes;u.length;)s.removeAttributeNode(u[0]);zi(s,l,r),s[Ut]=i,s[Pt]=r}catch(d){dt(i,i.return,d)}}var yn=!1,ni=!1,Rd=!1,Dv=typeof WeakSet=="function"?WeakSet:Set,Ci=null;function zC(i,s){if(i=i.containerInfo,Gd=Zc,i=P_(i),wh(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,w=-1,M=-1,Y=0,se=0,oe=i,V=null;t:for(;;){for(var Z;oe!==r||u!==0&&oe.nodeType!==3||(w=g+u),oe!==d||l!==0&&oe.nodeType!==3||(M=g+l),oe.nodeType===3&&(g+=oe.nodeValue.length),(Z=oe.firstChild)!==null;)V=oe,oe=Z;for(;;){if(oe===i)break t;if(V===r&&++Y===u&&(w=g),V===d&&++se===l&&(M=g),(Z=oe.nextSibling)!==null)break;oe=V,V=oe.parentNode}oe=Z}r=w===-1||M===-1?null:{start:w,end:M}}else r=null}r=r||{start:0,end:0}}else r=null;for(Zd={focusedElem:i,selectionRange:r},Zc=!1,Ci=s;Ci!==null;)if(s=Ci,i=s.child,(s.subtreeFlags&1028)!==0&&i!==null)i.return=s,Ci=i;else for(;Ci!==null;){switch(s=Ci,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 Te=zr(r.type,u);i=l.getSnapshotBeforeUpdate(Te,d),l.__reactInternalSnapshotBeforeUpdate=i}catch(Oe){dt(r,r.return,Oe)}}break;case 3:if((i&1024)!==0){if(i=s.stateNode.containerInfo,r=i.nodeType,r===9)ef(i);else if(r===1)switch(i.nodeName){case"HEAD":case"HTML":case"BODY":ef(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,Ci=i;break}Ci=s.return}}function Rv(i,s,r){var l=r.flags;switch(r.tag){case 0:case 11:case 15:Sn(i,r),l&4&&Ll(5,r);break;case 1:if(Sn(i,r),l&4)if(i=r.stateNode,s===null)try{i.componentDidMount()}catch(g){dt(r,r.return,g)}else{var u=zr(r.type,s.memoizedProps);s=s.memoizedState;try{i.componentDidUpdate(u,s,i.__reactInternalSnapshotBeforeUpdate)}catch(g){dt(r,r.return,g)}}l&64&&Cv(r),l&512&&Bl(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{fg(i,s)}catch(g){dt(r,r.return,g)}}break;case 27:s===null&&l&4&&kv(r);case 26:case 5:Sn(i,r),s===null&&l&4&&Ev(r),l&512&&Bl(r,r.return);break;case 12:Sn(i,r);break;case 31:Sn(i,r),l&4&&Av(i,r);break;case 13:Sn(i,r),l&4&&Lv(i,r),l&64&&(i=r.memoizedState,i!==null&&(i=i.dehydrated,i!==null&&(r=WC.bind(null,r),hx(i,r))));break;case 22:if(l=r.memoizedState!==null||yn,!l){s=s!==null&&s.memoizedState!==null||ni,u=yn;var d=ni;yn=l,(ni=s)&&!d?wn(i,r,(r.subtreeFlags&8772)!==0):Sn(i,r),yn=u,ni=d}break;case 30:break;default:Sn(i,r)}}function Mv(i){var s=i.alternate;s!==null&&(i.alternate=null,Mv(s)),i.child=null,i.deletions=null,i.sibling=null,i.tag===5&&(s=i.stateNode,s!==null&&ln(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 Mt=null,es=!1;function bn(i,s,r){for(r=r.child;r!==null;)Nv(i,s,r),r=r.sibling}function Nv(i,s,r){if(lt&&typeof lt.onCommitFiberUnmount=="function")try{lt.onCommitFiberUnmount(Qe,r)}catch{}switch(r.tag){case 26:ni||Zs(r,s),bn(i,s,r),r.memoizedState?r.memoizedState.count--:r.stateNode&&(r=r.stateNode,r.parentNode.removeChild(r));break;case 27:ni||Zs(r,s);var l=Mt,u=es;Jn(r.type)&&(Mt=r.stateNode,es=!1),bn(i,s,r),Fl(r.stateNode),Mt=l,es=u;break;case 5:ni||Zs(r,s);case 6:if(l=Mt,u=es,Mt=null,bn(i,s,r),Mt=l,es=u,Mt!==null)if(es)try{(Mt.nodeType===9?Mt.body:Mt.nodeName==="HTML"?Mt.ownerDocument.body:Mt).removeChild(r.stateNode)}catch(d){dt(r,s,d)}else try{Mt.removeChild(r.stateNode)}catch(d){dt(r,s,d)}break;case 18:Mt!==null&&(es?(i=Mt,Cy(i.nodeType===9?i.body:i.nodeName==="HTML"?i.ownerDocument.body:i,r.stateNode),Ia(i)):Cy(Mt,r.stateNode));break;case 4:l=Mt,u=es,Mt=r.stateNode.containerInfo,es=!0,bn(i,s,r),Mt=l,es=u;break;case 0:case 11:case 14:case 15:$n(2,r,s),ni||$n(4,r,s),bn(i,s,r);break;case 1:ni||(Zs(r,s),l=r.stateNode,typeof l.componentWillUnmount=="function"&&xv(r,s,l)),bn(i,s,r);break;case 21:bn(i,s,r);break;case 22:ni=(l=ni)||r.memoizedState!==null,bn(i,s,r),ni=l;break;default:bn(i,s,r)}}function Av(i,s){if(s.memoizedState===null&&(i=s.alternate,i!==null&&(i=i.memoizedState,i!==null))){i=i.dehydrated;try{Ia(i)}catch(r){dt(s,s.return,r)}}}function Lv(i,s){if(s.memoizedState===null&&(i=s.alternate,i!==null&&(i=i.memoizedState,i!==null&&(i=i.dehydrated,i!==null))))try{Ia(i)}catch(r){dt(s,s.return,r)}}function jC(i){switch(i.tag){case 31:case 13:case 19:var s=i.stateNode;return s===null&&(s=i.stateNode=new Dv),s;case 22:return i=i.stateNode,s=i._retryCache,s===null&&(s=i._retryCache=new Dv),s;default:throw Error(a(435,i.tag))}}function Nc(i,s){var r=jC(i);s.forEach(function(l){if(!r.has(l)){r.add(l);var u=$C.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,w=g;e:for(;w!==null;){switch(w.tag){case 27:if(Jn(w.type)){Mt=w.stateNode,es=!1;break e}break;case 5:Mt=w.stateNode,es=!1;break e;case 3:case 4:Mt=w.stateNode.containerInfo,es=!0;break e}w=w.return}if(Mt===null)throw Error(a(160));Nv(d,g,u),Mt=null,es=!1,d=u.alternate,d!==null&&(d.return=null),u.return=null}if(s.subtreeFlags&13886)for(s=s.child;s!==null;)Bv(s,i),s=s.sibling}var Ks=null;function Bv(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&&($n(3,i,i.return),Ll(3,i),$n(5,i,i.return));break;case 1:ts(s,i),is(i),l&512&&(ni||r===null||Zs(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=Ks;if(ts(s,i),is(i),l&512&&(ni||r===null||Zs(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[ws]||d[Ut]||d.namespaceURI==="http://www.w3.org/2000/svg"||d.hasAttribute("itemprop"))&&(d=u.createElement(l),u.head.insertBefore(d,u.querySelector("head > title"))),zi(d,l,r),d[Ut]=i,It(d),l=d;break e;case"link":var g=By("link","href",u).get(l+(r.href||""));if(g){for(var w=0;w<g.length;w++)if(d=g[w],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(w,1);break t}}d=u.createElement(l),zi(d,l,r),u.head.appendChild(d);break;case"meta":if(g=By("meta","content",u).get(l+(r.content||""))){for(w=0;w<g.length;w++)if(d=g[w],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(w,1);break t}}d=u.createElement(l),zi(d,l,r),u.head.appendChild(d);break;default:throw Error(a(468,l))}d[Ut]=i,It(d),l=d}i.stateNode=l}else Oy(u,i.type,i.stateNode);else i.stateNode=Ly(u,l,i.memoizedProps);else d!==l?(d===null?r.stateNode!==null&&(r=r.stateNode,r.parentNode.removeChild(r)):d.count--,l===null?Oy(u,i.type,i.stateNode):Ly(u,l,i.memoizedProps)):l===null&&i.stateNode!==null&&Td(i,i.memoizedProps,r.memoizedProps)}break;case 27:ts(s,i),is(i),l&512&&(ni||r===null||Zs(r,r.return)),r!==null&&l&4&&Td(i,i.memoizedProps,r.memoizedProps);break;case 5:if(ts(s,i),is(i),l&512&&(ni||r===null||Zs(r,r.return)),i.flags&32){u=i.stateNode;try{Lt(u,"")}catch(Te){dt(i,i.return,Te)}}l&4&&i.stateNode!=null&&(u=i.memoizedProps,Td(i,u,r!==null?r.memoizedProps:u)),l&1024&&(Rd=!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(Te){dt(i,i.return,Te)}}break;case 3:if(Yc=null,u=Ks,Ks=Wc(s.containerInfo),ts(s,i),Ks=u,is(i),l&4&&r!==null&&r.memoizedState.isDehydrated)try{Ia(s.containerInfo)}catch(Te){dt(i,i.return,Te)}Rd&&(Rd=!1,Ov(i));break;case 4:l=Ks,Ks=Wc(i.stateNode.containerInfo),ts(s,i),is(i),Ks=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,Nc(i,l)));break;case 13:ts(s,i),is(i),i.child.flags&8192&&i.memoizedState!==null!=(r!==null&&r.memoizedState!==null)&&(Lc=rt()),l&4&&(l=i.updateQueue,l!==null&&(i.updateQueue=null,Nc(i,l)));break;case 22:u=i.memoizedState!==null;var M=r!==null&&r.memoizedState!==null,Y=yn,se=ni;if(yn=Y||u,ni=se||M,ts(s,i),ni=se,yn=Y,is(i),l&8192)e:for(s=i.stateNode,s._visibility=u?s._visibility&-2:s._visibility|1,u&&(r===null||M||yn||ni||jr(i)),r=null,s=i;;){if(s.tag===5||s.tag===26){if(r===null){M=r=s;try{if(d=M.stateNode,u)g=d.style,typeof g.setProperty=="function"?g.setProperty("display","none","important"):g.display="none";else{w=M.stateNode;var oe=M.memoizedProps.style,V=oe!=null&&oe.hasOwnProperty("display")?oe.display:null;w.style.display=V==null||typeof V=="boolean"?"":(""+V).trim()}}catch(Te){dt(M,M.return,Te)}}}else if(s.tag===6){if(r===null){M=s;try{M.stateNode.nodeValue=u?"":M.memoizedProps}catch(Te){dt(M,M.return,Te)}}}else if(s.tag===18){if(r===null){M=s;try{var Z=M.stateNode;u?xy(Z,!0):xy(M.stateNode,!1)}catch(Te){dt(M,M.return,Te)}}}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,Nc(i,r))));break;case 19:ts(s,i),is(i),l&4&&(l=i.updateQueue,l!==null&&(i.updateQueue=null,Nc(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(Tv(l)){r=l;break}l=l.return}if(r==null)throw Error(a(160));switch(r.tag){case 27:var u=r.stateNode,d=kd(i);Mc(i,d,u);break;case 5:var g=r.stateNode;r.flags&32&&(Lt(g,""),r.flags&=-33);var w=kd(i);Mc(i,w,g);break;case 3:case 4:var M=r.stateNode.containerInfo,Y=kd(i);Dd(i,Y,M);break;default:throw Error(a(161))}}catch(se){dt(i,i.return,se)}i.flags&=-3}s&4096&&(i.flags&=-4097)}function Ov(i){if(i.subtreeFlags&1024)for(i=i.child;i!==null;){var s=i;Ov(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;)Rv(i,s.alternate,s),s=s.sibling}function jr(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),jr(s);break;case 1:Zs(s,s.return);var r=s.stateNode;typeof r.componentWillUnmount=="function"&&xv(s,s.return,r),jr(s);break;case 27:Fl(s.stateNode);case 26:case 5:Zs(s,s.return),jr(s);break;case 22:s.memoizedState===null&&jr(s);break;case 30:jr(s);break;default:jr(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),Ll(4,d);break;case 1:if(wn(u,d,r),l=d,u=l.stateNode,typeof u.componentDidMount=="function")try{u.componentDidMount()}catch(Y){dt(l,l.return,Y)}if(l=d,u=l.updateQueue,u!==null){var w=l.stateNode;try{var M=u.shared.hiddenCallbacks;if(M!==null)for(u.shared.hiddenCallbacks=null,u=0;u<M.length;u++)dg(M[u],w)}catch(Y){dt(l,l.return,Y)}}r&&g&64&&Cv(d),Bl(d,d.return);break;case 27:kv(d);case 26:case 5:wn(u,d,r),r&&l===null&&g&4&&Ev(d),Bl(d,d.return);break;case 12:wn(u,d,r);break;case 31:wn(u,d,r),r&&g&4&&Av(u,d);break;case 13:wn(u,d,r),r&&g&4&&Lv(u,d);break;case 22:d.memoizedState===null&&wn(u,d,r),Bl(d,d.return);break;case 30:break;default:wn(u,d,r)}s=s.sibling}}function Md(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&&bl(r))}function Nd(i,s){i=null,s.alternate!==null&&(i=s.alternate.memoizedState.cache),s=s.memoizedState.cache,s!==i&&(s.refCount++,i!=null&&bl(i))}function Fs(i,s,r,l){if(s.subtreeFlags&10256)for(s=s.child;s!==null;)zv(i,s,r,l),s=s.sibling}function zv(i,s,r,l){var u=s.flags;switch(s.tag){case 0:case 11:case 15:Fs(i,s,r,l),u&2048&&Ll(9,s);break;case 1:Fs(i,s,r,l);break;case 3:Fs(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&&bl(i)));break;case 12:if(u&2048){Fs(i,s,r,l),i=s.stateNode;try{var d=s.memoizedProps,g=d.id,w=d.onPostCommit;typeof w=="function"&&w(g,s.alternate===null?"mount":"update",i.passiveEffectDuration,-0)}catch(M){dt(s,s.return,M)}}else Fs(i,s,r,l);break;case 31:Fs(i,s,r,l);break;case 13:Fs(i,s,r,l);break;case 23:break;case 22:d=s.stateNode,g=s.alternate,s.memoizedState!==null?d._visibility&2?Fs(i,s,r,l):Ol(i,s):d._visibility&2?Fs(i,s,r,l):(d._visibility|=2,Ma(i,s,r,l,(s.subtreeFlags&10256)!==0||!1)),u&2048&&Md(g,s);break;case 24:Fs(i,s,r,l),u&2048&&Nd(s.alternate,s);break;default:Fs(i,s,r,l)}}function Ma(i,s,r,l,u){for(u=u&&((s.subtreeFlags&10256)!==0||!1),s=s.child;s!==null;){var d=i,g=s,w=r,M=l,Y=g.flags;switch(g.tag){case 0:case 11:case 15:Ma(d,g,w,M,u),Ll(8,g);break;case 23:break;case 22:var se=g.stateNode;g.memoizedState!==null?se._visibility&2?Ma(d,g,w,M,u):Ol(d,g):(se._visibility|=2,Ma(d,g,w,M,u)),u&&Y&2048&&Md(g.alternate,g);break;case 24:Ma(d,g,w,M,u),u&&Y&2048&&Nd(g.alternate,g);break;default:Ma(d,g,w,M,u)}s=s.sibling}}function Ol(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:Ol(r,l),u&2048&&Md(l.alternate,l);break;case 24:Ol(r,l),u&2048&&Nd(l.alternate,l);break;default:Ol(r,l)}s=s.sibling}}var zl=8192;function Na(i,s,r){if(i.subtreeFlags&zl)for(i=i.child;i!==null;)jv(i,s,r),i=i.sibling}function jv(i,s,r){switch(i.tag){case 26:Na(i,s,r),i.flags&zl&&i.memoizedState!==null&&Cx(r,Ks,i.memoizedState,i.memoizedProps);break;case 5:Na(i,s,r);break;case 3:case 4:var l=Ks;Ks=Wc(i.stateNode.containerInfo),Na(i,s,r),Ks=l;break;case 22:i.memoizedState===null&&(l=i.alternate,l!==null&&l.memoizedState!==null?(l=zl,zl=16777216,Na(i,s,r),zl=l):Na(i,s,r));break;default:Na(i,s,r)}}function Hv(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 jl(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];Ci=l,Pv(l,i)}Hv(i)}if(i.subtreeFlags&10256)for(i=i.child;i!==null;)Uv(i),i=i.sibling}function Uv(i){switch(i.tag){case 0:case 11:case 15:jl(i),i.flags&2048&&$n(9,i,i.return);break;case 3:jl(i);break;case 12:jl(i);break;case 22:var s=i.stateNode;i.memoizedState!==null&&s._visibility&2&&(i.return===null||i.return.tag!==13)?(s._visibility&=-3,Ac(i)):jl(i);break;default:jl(i)}}function Ac(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];Ci=l,Pv(l,i)}Hv(i)}for(i=i.child;i!==null;){switch(s=i,s.tag){case 0:case 11:case 15:$n(8,s,s.return),Ac(s);break;case 22:r=s.stateNode,r._visibility&2&&(r._visibility&=-3,Ac(s));break;default:Ac(s)}i=i.sibling}}function Pv(i,s){for(;Ci!==null;){var r=Ci;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:bl(r.memoizedState.cache)}if(l=r.child,l!==null)l.return=r,Ci=l;else e:for(r=i;Ci!==null;){l=Ci;var u=l.sibling,d=l.return;if(Mv(l),l===r){Ci=null;break e}if(u!==null){u.return=d,Ci=u;break e}Ci=d}}}var HC={getCacheForType:function(i){var s=Bi(ti),r=s.data.get(i);return r===void 0&&(r=i(),s.data.set(i,r)),r},cacheSignal:function(){return Bi(ti).controller.signal}},UC=typeof WeakMap=="function"?WeakMap:Map,at=0,St=null,Ge=null,Je=0,ht=0,ps=null,Yn=!1,Aa=!1,Ad=!1,Cn=0,Ft=0,Vn=0,Hr=0,Ld=0,ms=0,La=0,Hl=null,ss=null,Bd=!1,Lc=0,Iv=0,Bc=1/0,Oc=null,Xn=null,hi=0,Gn=null,Ba=null,xn=0,Od=0,zd=null,Kv=null,Ul=0,jd=null;function _s(){return(at&2)!==0&&Je!==0?Je&-Je:T.T!==null?Fd():yi()}function Fv(){if(ms===0)if((Je&536870912)===0||it){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 ns(i,s,r){(i===St&&(ht===2||ht===9)||i.cancelPendingCommit!==null)&&(Oa(i,0),Zn(i,Je,ms,!1)),Ni(i,r),((at&2)===0||i!==St)&&(i===St&&((at&2)===0&&(Hr|=r),Ft===4&&Zn(i,Je,ms,!1)),Qs(i))}function qv(i,s,r){if((at&6)!==0)throw Error(a(327));var l=!r&&(s&127)===0&&(s&i.expiredLanes)===0||ci(i,s),u=l?KC(i,s):Ud(i,s,!0),d=l;do{if(u===0){Aa&&!l&&Zn(i,s,0,!1);break}else{if(r=i.current.alternate,d&&!PC(r)){u=Ud(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 w=i;u=Hl;var M=w.current.memoizedState.isDehydrated;if(M&&(Oa(w,g).flags|=256),g=Ud(w,g,!1),g!==2){if(Ad&&!M){w.errorRecoveryDisabledLanes|=d,Hr|=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){Oa(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:ss=null;break;case 3:case 5:break;default:throw Error(a(329))}if((s&62914560)===s&&(u=Lc+300-rt(),10<u)){if(Zn(l,s,ms,!Yn),Ht(l,0,!0)!==0)break e;xn=s,l.timeoutHandle=Sy(Wv.bind(null,l,r,ss,Oc,Bd,s,ms,Hr,La,Yn,d,"Throttled",-0,0),u);break e}Wv(l,r,ss,Oc,Bd,s,ms,Hr,La,Yn,d,null,-0,0)}}break}while(!0);Qs(i)}function Wv(i,s,r,l,u,d,g,w,M,Y,se,oe,V,Z){if(i.timeoutHandle=-1,oe=s.subtreeFlags,oe&8192||(oe&16785408)===16785408){oe={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:wi},jv(s,d,oe);var Te=(d&62914560)===d?Lc-rt():(d&4194048)===d?Iv-rt():0;if(Te=xx(oe,Te),Te!==null){xn=d,i.cancelPendingCommit=Te(Jv.bind(null,i,s,d,r,l,u,g,w,M,se,oe,null,V,Z)),Zn(i,d,g,!Y);return}}Jv(i,s,d,r,l,u,g,w,M)}function PC(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&=~Ld,s&=~Hr,i.suspendedLanes|=s,i.pingedLanes&=~s,l&&(i.warmLanes|=s),l=i.expirationTimes;for(var u=s;0<u;){var d=31-jt(u),g=1<<d;l[d]=-1,u&=~g}r!==0&&qi(i,r,s)}function zc(){return(at&6)===0?(Pl(0),!1):!0}function Hd(){if(Ge!==null){if(ht===0)var i=Ge.return;else i=Ge,fn=Rr=null,ed(i),Ea=null,wl=0,i=Ge;for(;i!==null;)wv(i.alternate,i),i=i.return;Ge=null}}function Oa(i,s){var r=i.timeoutHandle;r!==-1&&(i.timeoutHandle=-1,ax(r)),r=i.cancelPendingCommit,r!==null&&(i.cancelPendingCommit=null,r()),xn=0,Hd(),St=i,Ge=r=hn(i.current,null),Je=s,ht=0,ps=null,Yn=!1,Aa=ci(i,s),Ad=!1,La=ms=Ld=Hr=Vn=Ft=0,ss=Hl=null,Bd=!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-jt(l),d=1<<u;s|=i[u],l&=~d}return Cn=s,sc(),r}function $v(i,s){Ke=null,T.H=Ml,s===xa||s===hc?(s=og(),ht=3):s===Kh?(s=og(),ht=4):ht=s===_d?8:s!==null&&typeof s=="object"&&typeof s.then=="function"?6:1,ps=s,Ge===null&&(Ft=1,Ec(i,Es(s,i.current)))}function Yv(){var i=ds.current;return i===null?!0:(Je&4194048)===Je?Rs===null:(Je&62914560)===Je||(Je&536870912)!==0?i===Rs:!1}function Vv(){var i=T.H;return T.H=Ml,i===null?Ml:i}function Xv(){var i=T.A;return T.A=HC,i}function jc(){Ft=4,Yn||(Je&4194048)!==Je&&ds.current!==null||(Aa=!0),(Vn&134217727)===0&&(Hr&134217727)===0||St===null||Zn(St,Je,ms,!1)}function Ud(i,s,r){var l=at;at|=2;var u=Vv(),d=Xv();(St!==i||Je!==s)&&(Oc=null,Oa(i,s)),s=!1;var g=Ft;e:do try{if(ht!==0&&Ge!==null){var w=Ge,M=ps;switch(ht){case 8:Hd(),g=6;break e;case 3:case 2:case 9:case 6:ds.current===null&&(s=!0);var Y=ht;if(ht=0,ps=null,za(i,w,M,Y),r&&Aa){g=0;break e}break;default:Y=ht,ht=0,ps=null,za(i,w,M,Y)}}IC(),g=Ft;break}catch(se){$v(i,se)}while(!0);return s&&i.shellSuspendCounter++,fn=Rr=null,at=l,T.H=u,T.A=d,Ge===null&&(St=null,Je=0,sc()),g}function IC(){for(;Ge!==null;)Gv(Ge)}function KC(i,s){var r=at;at|=2;var l=Vv(),u=Xv();St!==i||Je!==s?(Oc=null,Bc=rt()+500,Oa(i,s)):Aa=ci(i,s);e:do try{if(ht!==0&&Ge!==null){s=Ge;var d=ps;t:switch(ht){case 1:ht=0,ps=null,za(i,s,d,1);break;case 2:case 9:if(ag(d)){ht=0,ps=null,Zv(s);break}s=function(){ht!==2&&ht!==9||St!==i||(ht=7),Qs(i)},d.then(s,s);break e;case 3:ht=7;break e;case 4:ht=5;break e;case 7:ag(d)?(ht=0,ps=null,Zv(s)):(ht=0,ps=null,za(i,s,d,7));break;case 5:var g=null;switch(Ge.tag){case 26:g=Ge.memoizedState;case 5:case 27:var w=Ge;if(g?zy(g):w.stateNode.complete){ht=0,ps=null;var M=w.sibling;if(M!==null)Ge=M;else{var Y=w.return;Y!==null?(Ge=Y,Hc(Y)):Ge=null}break t}}ht=0,ps=null,za(i,s,d,5);break;case 6:ht=0,ps=null,za(i,s,d,6);break;case 8:Hd(),Ft=6;break e;default:throw Error(a(462))}}FC();break}catch(se){$v(i,se)}while(!0);return fn=Rr=null,T.H=l,T.A=u,at=r,Ge!==null?0:(St=null,Je=0,sc(),Ft)}function FC(){for(;Ge!==null&&!Hi();)Gv(Ge)}function Gv(i){var s=bv(i.alternate,i,Cn);i.memoizedProps=i.pendingProps,s===null?Hc(i):Ge=s}function Zv(i){var s=i,r=s.alternate;switch(s.tag){case 15:case 0:s=pv(r,s,s.pendingProps,s.type,void 0,Je);break;case 11:s=pv(r,s,s.pendingProps,s.type.render,s.ref,Je);break;case 5:ed(s);default:wv(r,s),s=Ge=X_(s,Cn),s=bv(r,s,Cn)}i.memoizedProps=i.pendingProps,s===null?Hc(i):Ge=s}function za(i,s,r,l){fn=Rr=null,ed(s),Ea=null,wl=0;var u=s.return;try{if(NC(i,u,s,r,Je)){Ft=1,Ec(i,Es(r,i.current)),Ge=null;return}}catch(d){if(u!==null)throw Ge=u,d;Ft=1,Ec(i,Es(r,i.current)),Ge=null;return}s.flags&32768?(it||l===1?i=!0:Aa||(Je&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))),Qv(s,i)):Hc(s)}function Hc(i){var s=i;do{if((s.flags&32768)!==0){Qv(s,Yn);return}i=s.return;var r=BC(s.alternate,s,Cn);if(r!==null){Ge=r;return}if(s=s.sibling,s!==null){Ge=s;return}Ge=s=i}while(s!==null);Ft===0&&(Ft=5)}function Qv(i,s){do{var r=OC(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);Ft=6,Ge=null}function Jv(i,s,r,l,u,d,g,w,M){i.cancelPendingCommit=null;do Uc();while(hi!==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|=kh,Et(i,r,d,g,w,M),i===St&&(Ge=St=null,Je=0),Ba=s,Gn=i,xn=r,Od=d,zd=u,Kv=l,(s.subtreeFlags&10256)!==0||(s.flags&10256)!==0?(i.callbackNode=null,i.callbackPriority=0,YC(zt,function(){return ny(),null})):(i.callbackNode=null,i.callbackPriority=0),l=(s.flags&13878)!==0,(s.subtreeFlags&13878)!==0||l){l=T.T,T.T=null,u=W.p,W.p=2,g=at,at|=4;try{zC(i,s,r)}finally{at=g,W.p=u,T.T=l}}hi=1,ey(),ty(),iy()}}function ey(){if(hi===1){hi=0;var i=Gn,s=Ba,r=(s.flags&13878)!==0;if((s.subtreeFlags&13878)!==0||r){r=T.T,T.T=null;var l=W.p;W.p=2;var u=at;at|=4;try{Bv(s,i);var d=Zd,g=P_(i.containerInfo),w=d.focusedElem,M=d.selectionRange;if(g!==w&&w&&w.ownerDocument&&U_(w.ownerDocument.documentElement,w)){if(M!==null&&wh(w)){var Y=M.start,se=M.end;if(se===void 0&&(se=Y),"selectionStart"in w)w.selectionStart=Y,w.selectionEnd=Math.min(se,w.value.length);else{var oe=w.ownerDocument||document,V=oe&&oe.defaultView||window;if(V.getSelection){var Z=V.getSelection(),Te=w.textContent.length,Oe=Math.min(M.start,Te),vt=M.end===void 0?Oe:Math.min(M.end,Te);!Z.extend&&Oe>vt&&(g=vt,vt=Oe,Oe=g);var P=H_(w,Oe),L=H_(w,vt);if(P&&L&&(Z.rangeCount!==1||Z.anchorNode!==P.node||Z.anchorOffset!==P.offset||Z.focusNode!==L.node||Z.focusOffset!==L.offset)){var q=oe.createRange();q.setStart(P.node,P.offset),Z.removeAllRanges(),Oe>vt?(Z.addRange(q),Z.extend(L.node,L.offset)):(q.setEnd(L.node,L.offset),Z.addRange(q))}}}}for(oe=[],Z=w;Z=Z.parentNode;)Z.nodeType===1&&oe.push({element:Z,left:Z.scrollLeft,top:Z.scrollTop});for(typeof w.focus=="function"&&w.focus(),w=0;w<oe.length;w++){var le=oe[w];le.element.scrollLeft=le.left,le.element.scrollTop=le.top}}Zc=!!Gd,Zd=Gd=null}finally{at=u,W.p=l,T.T=r}}i.current=s,hi=2}}function ty(){if(hi===2){hi=0;var i=Gn,s=Ba,r=(s.flags&8772)!==0;if((s.subtreeFlags&8772)!==0||r){r=T.T,T.T=null;var l=W.p;W.p=2;var u=at;at|=4;try{Rv(i,s.alternate,s)}finally{at=u,W.p=l,T.T=r}}hi=3}}function iy(){if(hi===4||hi===3){hi=0,$s();var i=Gn,s=Ba,r=xn,l=Kv;(s.subtreeFlags&10256)!==0||(s.flags&10256)!==0?hi=5:(hi=0,Ba=Gn=null,sy(i,i.pendingLanes));var u=i.pendingLanes;if(u===0&&(Xn=null),Pi(r),s=s.stateNode,lt&&typeof lt.onCommitFiberRoot=="function")try{lt.onCommitFiberRoot(Qe,s,void 0,(s.current.flags&128)===128)}catch{}if(l!==null){s=T.T,u=W.p,W.p=2,T.T=null;try{for(var d=i.onRecoverableError,g=0;g<l.length;g++){var w=l[g];d(w.value,{componentStack:w.stack})}}finally{T.T=s,W.p=u}}(xn&3)!==0&&Uc(),Qs(i),u=i.pendingLanes,(r&261930)!==0&&(u&42)!==0?i===jd?Ul++:(Ul=0,jd=i):Ul=0,Pl(0)}}function sy(i,s){(i.pooledCacheLanes&=s)===0&&(s=i.pooledCache,s!=null&&(i.pooledCache=null,bl(s)))}function Uc(){return ey(),ty(),iy(),ny()}function ny(){if(hi!==5)return!1;var i=Gn,s=Od;Od=0;var r=Pi(xn),l=T.T,u=W.p;try{W.p=32>r?32:r,T.T=null,r=zd,zd=null;var d=Gn,g=xn;if(hi=0,Ba=Gn=null,xn=0,(at&6)!==0)throw Error(a(331));var w=at;if(at|=4,Uv(d.current),zv(d,d.current,g,r),at=w,Pl(0,!1),lt&&typeof lt.onPostCommitFiberRoot=="function")try{lt.onPostCommitFiberRoot(Qe,d)}catch{}return!0}finally{W.p=u,T.T=l,sy(i,s)}}function ry(i,s,r){s=Es(r,s),s=md(i.stateNode,s,2),i=Fn(i,s,2),i!==null&&(Ni(i,2),Qs(i))}function dt(i,s,r){if(i.tag===3)ry(i,i,r);else for(;s!==null;){if(s.tag===3){ry(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=Es(r,i),r=av(2),l=Fn(s,r,2),l!==null&&(lv(r,l,s,i),Ni(l,2),Qs(l));break}}s=s.return}}function Pd(i,s,r){var l=i.pingCache;if(l===null){l=i.pingCache=new UC;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)||(Ad=!0,u.add(r),i=qC.bind(null,i,s,r),s.then(i,i))}function qC(i,s,r){var l=i.pingCache;l!==null&&l.delete(s),i.pingedLanes|=i.suspendedLanes&r,i.warmLanes&=~r,St===i&&(Je&r)===r&&(Ft===4||Ft===3&&(Je&62914560)===Je&&300>rt()-Lc?(at&2)===0&&Oa(i,0):Ld|=r,La===Je&&(La=0)),Qs(i)}function ay(i,s){s===0&&(s=ei()),i=Tr(i,s),i!==null&&(Ni(i,s),Qs(i))}function WC(i){var s=i.memoizedState,r=0;s!==null&&(r=s.retryLane),ay(i,r)}function $C(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),ay(i,r)}function YC(i,s){return ft(i,s)}var Pc=null,ja=null,Id=!1,Ic=!1,Kd=!1,Qn=0;function Qs(i){i!==ja&&i.next===null&&(ja===null?Pc=ja=i:ja=ja.next=i),Ic=!0,Id||(Id=!0,XC())}function Pl(i,s){if(!Kd&&Ic){Kd=!0;do for(var r=!1,l=Pc;l!==null;){if(i!==0){var u=l.pendingLanes;if(u===0)var d=0;else{var g=l.suspendedLanes,w=l.pingedLanes;d=(1<<31-jt(42|i)+1)-1,d&=u&~(g&~w),d=d&201326741?d&201326741|1:d?d|2:0}d!==0&&(r=!0,uy(l,d))}else d=Je,d=Ht(l,l===St?d:0,l.cancelPendingCommit!==null||l.timeoutHandle!==-1),(d&3)===0||ci(l,d)||(r=!0,uy(l,d));l=l.next}while(r);Kd=!1}}function VC(){ly()}function ly(){Ic=Id=!1;var i=0;Qn!==0&&rx()&&(i=Qn);for(var s=rt(),r=null,l=Pc;l!==null;){var u=l.next,d=oy(l,s);d===0?(l.next=null,r===null?Pc=u:r.next=u,u===null&&(ja=r)):(r=l,(i!==0||(d&3)!==0)&&(Ic=!0)),l=u}hi!==0&&hi!==5||Pl(i),Qn!==0&&(Qn=0)}function oy(i,s){for(var r=i.suspendedLanes,l=i.pingedLanes,u=i.expirationTimes,d=i.pendingLanes&-62914561;0<d;){var g=31-jt(d),w=1<<g,M=u[g];M===-1?((w&r)===0||(w&l)!==0)&&(u[g]=Yt(w,s)):M<=s&&(i.expiredLanes|=w),d&=~w}if(s=St,r=Je,r=Ht(i,i===s?r:0,i.cancelPendingCommit!==null||i.timeoutHandle!==-1),l=i.callbackNode,r===0||i===s&&(ht===2||ht===9)||i.cancelPendingCommit!==null)return l!==null&&l!==null&&$t(l),i.callbackNode=null,i.callbackPriority=0;if((r&3)===0||ci(i,r)){if(s=r&-r,s===i.callbackPriority)return s;switch(l!==null&&$t(l),Pi(r)){case 2:case 8:r=gi;break;case 32:r=zt;break;case 268435456:r=vi;break;default:r=zt}return l=cy.bind(null,i),r=ft(r,l),i.callbackPriority=s,i.callbackNode=r,s}return l!==null&&l!==null&&$t(l),i.callbackPriority=2,i.callbackNode=null,2}function cy(i,s){if(hi!==0&&hi!==5)return i.callbackNode=null,i.callbackPriority=0,null;var r=i.callbackNode;if(Uc()&&i.callbackNode!==r)return null;var l=Je;return l=Ht(i,i===St?l:0,i.cancelPendingCommit!==null||i.timeoutHandle!==-1),l===0?null:(qv(i,l,s),oy(i,rt()),i.callbackNode!=null&&i.callbackNode===r?cy.bind(null,i):null)}function uy(i,s){if(Uc())return null;qv(i,s,!0)}function XC(){lx(function(){(at&6)!==0?ft(Zi,VC):ly()})}function Fd(){if(Qn===0){var i=wa;i===0&&(i=ls,ls<<=1,(ls&261888)===0&&(ls=256)),Qn=i}return Qn}function hy(i){return i==null||typeof i=="symbol"||typeof i=="boolean"?null:typeof i=="function"?i:oa(""+i)}function dy(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 GC(i,s,r,l,u){if(s==="submit"&&r&&r.stateNode===u){var d=hy((u[Pt]||null).action),g=l.submitter;g&&(s=(s=g[Pt]||null)?hy(s.formAction):g.getAttribute("formAction"),s!==null&&(d=s,g=null));var w=new Jo("action","action",null,l,u);i.push({event:w,listeners:[{instance:null,listener:function(){if(l.defaultPrevented){if(Qn!==0){var M=g?dy(u,g):new FormData(u);cd(r,{pending:!0,data:M,method:u.method,action:d},null,M)}}else typeof d=="function"&&(w.preventDefault(),M=g?dy(u,g):new FormData(u),cd(r,{pending:!0,data:M,method:u.method,action:d},d,M))},currentTarget:u}]})}}for(var qd=0;qd<Th.length;qd++){var Wd=Th[qd],ZC=Wd.toLowerCase(),QC=Wd[0].toUpperCase()+Wd.slice(1);Is(ZC,"on"+QC)}Is(F_,"onAnimationEnd"),Is(q_,"onAnimationIteration"),Is(W_,"onAnimationStart"),Is("dblclick","onDoubleClick"),Is("focusin","onFocus"),Is("focusout","onBlur"),Is(pC,"onTransitionRun"),Is(mC,"onTransitionStart"),Is(_C,"onTransitionCancel"),Is($_,"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 Il="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(" "),JC=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Il));function fy(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 w=l[g],M=w.instance,Y=w.currentTarget;if(w=w.listener,M!==d&&u.isPropagationStopped())break e;d=w,u.currentTarget=Y;try{d(u)}catch(se){ic(se)}u.currentTarget=null,d=M}else for(g=0;g<l.length;g++){if(w=l[g],M=w.instance,Y=w.currentTarget,w=w.listener,M!==d&&u.isPropagationStopped())break e;d=w,u.currentTarget=Y;try{d(u)}catch(se){ic(se)}u.currentTarget=null,d=M}}}}function Ze(i,s){var r=s[br];r===void 0&&(r=s[br]=new Set);var l=i+"__bubble";r.has(l)||(py(s,i,2,!1),r.add(l))}function $d(i,s,r){var l=0;s&&(l|=4),py(r,i,l,s)}var Kc="_reactListening"+Math.random().toString(36).slice(2);function Yd(i){if(!i[Kc]){i[Kc]=!0,wr.forEach(function(r){r!=="selectionchange"&&(JC.has(r)||$d(r,!1,i),$d(r,!0,i))});var s=i.nodeType===9?i:i.ownerDocument;s===null||s[Kc]||(s[Kc]=!0,$d("selectionchange",!1,s))}}function py(i,s,r,l){switch(Fy(s)){case 2:var u=kx;break;case 8:u=Dx;break;default:u=cf}r=u.bind(null,s,r,i),u=void 0,!fh||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 Vd(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 w=l.stateNode.containerInfo;if(w===u)break;if(g===4)for(g=l.return;g!==null;){var M=g.tag;if((M===3||M===4)&&g.stateNode.containerInfo===u)return;g=g.return}for(;w!==null;){if(g=At(w),g===null)return;if(M=g.tag,M===5||M===6||M===26||M===27){l=d=g;continue e}w=w.parentNode}}l=l.return}y_(function(){var Y=d,se=ua(r),oe=[];e:{var V=Y_.get(i);if(V!==void 0){var Z=Jo,Te=i;switch(i){case"keypress":if(Zo(r)===0)break e;case"keydown":case"keyup":Z=$1;break;case"focusin":Te="focus",Z=gh;break;case"focusout":Te="blur",Z=gh;break;case"beforeblur":case"afterblur":Z=gh;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=w_;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":Z=B1;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":Z=X1;break;case F_:case q_:case W_:Z=j1;break;case $_:Z=Z1;break;case"scroll":case"scrollend":Z=A1;break;case"wheel":Z=J1;break;case"copy":case"cut":case"paste":Z=U1;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":Z=x_;break;case"toggle":case"beforetoggle":Z=tC}var Oe=(s&4)!==0,vt=!Oe&&(i==="scroll"||i==="scrollend"),P=Oe?V!==null?V+"Capture":null:V;Oe=[];for(var L=Y,q;L!==null;){var le=L;if(q=le.stateNode,le=le.tag,le!==5&&le!==26&&le!==27||q===null||P===null||(le=cl(L,P),le!=null&&Oe.push(Kl(L,le,q))),vt)break;L=L.return}0<Oe.length&&(V=new Z(V,Te,null,r,se),oe.push({event:V,listeners:Oe}))}}if((s&7)===0){e:{if(V=i==="mouseover"||i==="pointerover",Z=i==="mouseout"||i==="pointerout",V&&r!==ca&&(Te=r.relatedTarget||r.fromElement)&&(At(Te)||Te[Rt]))break e;if((Z||V)&&(V=se.window===se?se:(V=se.ownerDocument)?V.defaultView||V.parentWindow:window,Z?(Te=r.relatedTarget||r.toElement,Z=Y,Te=Te?At(Te):null,Te!==null&&(vt=c(Te),Oe=Te.tag,Te!==vt||Oe!==5&&Oe!==27&&Oe!==6)&&(Te=null)):(Z=null,Te=Y),Z!==Te)){if(Oe=w_,le="onMouseLeave",P="onMouseEnter",L="mouse",(i==="pointerout"||i==="pointerover")&&(Oe=x_,le="onPointerLeave",P="onPointerEnter",L="pointer"),vt=Z==null?V:Ys(Z),q=Te==null?V:Ys(Te),V=new Oe(le,L+"leave",Z,r,se),V.target=vt,V.relatedTarget=q,le=null,At(se)===Y&&(Oe=new Oe(P,L+"enter",Te,r,se),Oe.target=q,Oe.relatedTarget=vt,le=Oe),vt=le,Z&&Te)t:{for(Oe=ex,P=Z,L=Te,q=0,le=P;le;le=Oe(le))q++;le=0;for(var Ae=L;Ae;Ae=Oe(Ae))le++;for(;0<q-le;)P=Oe(P),q--;for(;0<le-q;)L=Oe(L),le--;for(;q--;){if(P===L||L!==null&&P===L.alternate){Oe=P;break t}P=Oe(P),L=Oe(L)}Oe=null}else Oe=null;Z!==null&&my(oe,V,Z,Oe,!1),Te!==null&&vt!==null&&my(oe,vt,Te,Oe,!0)}}e:{if(V=Y?Ys(Y):window,Z=V.nodeName&&V.nodeName.toLowerCase(),Z==="select"||Z==="input"&&V.type==="file")var st=A_;else if(M_(V))if(L_)st=hC;else{st=cC;var De=oC}else Z=V.nodeName,!Z||Z.toLowerCase()!=="input"||V.type!=="checkbox"&&V.type!=="radio"?Y&&cn(Y.elementType)&&(st=A_):st=uC;if(st&&(st=st(i,Y))){N_(oe,st,r,se);break e}De&&De(i,V,Y),i==="focusout"&&Y&&V.type==="number"&&Y.memoizedProps.value!=null&&Ue(V,"number",V.value)}switch(De=Y?Ys(Y):window,i){case"focusin":(M_(De)||De.contentEditable==="true")&&(pa=De,Ch=Y,gl=null);break;case"focusout":gl=Ch=pa=null;break;case"mousedown":xh=!0;break;case"contextmenu":case"mouseup":case"dragend":xh=!1,I_(oe,r,se);break;case"selectionchange":if(fC)break;case"keydown":case"keyup":I_(oe,r,se)}var We;if(yh)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 fa?D_(i,r)&&(et="onCompositionEnd"):i==="keydown"&&r.keyCode===229&&(et="onCompositionStart");et&&(E_&&r.locale!=="ko"&&(fa||et!=="onCompositionStart"?et==="onCompositionEnd"&&fa&&(We=b_()):(zn=se,ph="value"in zn?zn.value:zn.textContent,fa=!0)),De=Fc(Y,et),0<De.length&&(et=new C_(et,i,null,r,se),oe.push({event:et,listeners:De}),We?et.data=We:(We=R_(r),We!==null&&(et.data=We)))),(We=sC?nC(i,r):rC(i,r))&&(et=Fc(Y,"onBeforeInput"),0<et.length&&(De=new C_("onBeforeInput","beforeinput",null,r,se),oe.push({event:De,listeners:et}),De.data=We)),GC(oe,i,Y,r,se)}fy(oe,s)})}function Kl(i,s,r){return{instance:i,listener:s,currentTarget:r}}function Fc(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=cl(i,r),u!=null&&l.unshift(Kl(i,u,d)),u=cl(i,s),u!=null&&l.push(Kl(i,u,d))),i.tag===3)return l;i=i.return}return[]}function ex(i){if(i===null)return null;do i=i.return;while(i&&i.tag!==5&&i.tag!==27);return i||null}function my(i,s,r,l,u){for(var d=s._reactName,g=[];r!==null&&r!==l;){var w=r,M=w.alternate,Y=w.stateNode;if(w=w.tag,M!==null&&M===l)break;w!==5&&w!==26&&w!==27||Y===null||(M=Y,u?(Y=cl(r,d),Y!=null&&g.unshift(Kl(r,Y,M))):u||(Y=cl(r,d),Y!=null&&g.push(Kl(r,Y,M)))),r=r.return}g.length!==0&&i.push({event:s,listeners:g})}var tx=/\r\n?/g,ix=/\u0000|\uFFFD/g;function _y(i){return(typeof i=="string"?i:""+i).replace(tx,`
|
|
10
|
-
`).replace(ix,"")}function gy(i,s){return s=_y(s),_y(i)===s}function gt(i,s,r,l,u,d){switch(r){case"children":typeof l=="string"?s==="body"||s==="textarea"&&l===""||Lt(i,l):(typeof l=="number"||typeof l=="bigint")&&s!=="body"&&Lt(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":Vs(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=oa(""+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"&>(i,s,"name",u.name,u,null),gt(i,s,"formEncType",u.formEncType,u,null),gt(i,s,"formMethod",u.formMethod,u,null),gt(i,s,"formTarget",u.formTarget,u,null)):(gt(i,s,"encType",u.encType,u,null),gt(i,s,"method",u.method,u,null),gt(i,s,"target",u.target,u,null)));if(l==null||typeof l=="symbol"||typeof l=="boolean"){i.removeAttribute(r);break}l=oa(""+l),i.setAttribute(r,l);break;case"onClick":l!=null&&(i.onclick=wi);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=oa(""+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),$i(i,"popover",l);break;case"xlinkActuate":D(i,"http://www.w3.org/1999/xlink","xlink:actuate",l);break;case"xlinkArcrole":D(i,"http://www.w3.org/1999/xlink","xlink:arcrole",l);break;case"xlinkRole":D(i,"http://www.w3.org/1999/xlink","xlink:role",l);break;case"xlinkShow":D(i,"http://www.w3.org/1999/xlink","xlink:show",l);break;case"xlinkTitle":D(i,"http://www.w3.org/1999/xlink","xlink:title",l);break;case"xlinkType":D(i,"http://www.w3.org/1999/xlink","xlink:type",l);break;case"xmlBase":D(i,"http://www.w3.org/XML/1998/namespace","xml:base",l);break;case"xmlLang":D(i,"http://www.w3.org/XML/1998/namespace","xml:lang",l);break;case"xmlSpace":D(i,"http://www.w3.org/XML/1998/namespace","xml:space",l);break;case"is":$i(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=cs.get(r)||r,$i(i,r,l))}}function Xd(i,s,r,l,u,d){switch(r){case"style":Vs(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"?Lt(i,l):(typeof l=="number"||typeof l=="bigint")&&Lt(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=wi);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!On.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[Pt]||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,""):$i(i,r,l)}}}function zi(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 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:gt(i,s,d,g,r,null)}}u&>(i,s,"srcSet",r.srcSet,r,null),l&>(i,s,"src",r.src,r,null);return;case"input":Ze("invalid",i);var w=d=g=u=null,M=null,Y=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":g=se;break;case"checked":M=se;break;case"defaultChecked":Y=se;break;case"value":d=se;break;case"defaultValue":w=se;break;case"children":case"dangerouslySetInnerHTML":if(se!=null)throw Error(a(137,s));break;default:gt(i,s,l,se,r,null)}}ue(i,d,w,M,Y,g,u,!1);return;case"select":Ze("invalid",i),l=g=d=null;for(u in r)if(r.hasOwnProperty(u)&&(w=r[u],w!=null))switch(u){case"value":d=w;break;case"defaultValue":g=w;break;case"multiple":l=w;default:gt(i,s,u,w,r,null)}s=d,r=g,i.multiple=!!l,s!=null?Be(i,!!l,s,!1):r!=null&&Be(i,!!l,r,!0);return;case"textarea":Ze("invalid",i),d=u=l=null;for(g in r)if(r.hasOwnProperty(g)&&(w=r[g],w!=null))switch(g){case"value":l=w;break;case"defaultValue":u=w;break;case"children":d=w;break;case"dangerouslySetInnerHTML":if(w!=null)throw Error(a(91));break;default:gt(i,s,g,w,r,null)}ct(i,l,u,d);return;case"option":for(M in r)r.hasOwnProperty(M)&&(l=r[M],l!=null)&&(M==="selected"?i.selected=l&&typeof l!="function"&&typeof l!="symbol":gt(i,s,M,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<Il.length;l++)Ze(Il[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(Y in r)if(r.hasOwnProperty(Y)&&(l=r[Y],l!=null))switch(Y){case"children":case"dangerouslySetInnerHTML":throw Error(a(137,s));default:gt(i,s,Y,l,r,null)}return;default:if(cn(s)){for(se in r)r.hasOwnProperty(se)&&(l=r[se],l!==void 0&&Xd(i,s,se,l,r,void 0));return}}for(w in r)r.hasOwnProperty(w)&&(l=r[w],l!=null&>(i,s,w,l,r,null))}function sx(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,w=null,M=null,Y=null,se=null;for(Z in r){var oe=r[Z];if(r.hasOwnProperty(Z)&&oe!=null)switch(Z){case"checked":break;case"value":break;case"defaultValue":M=oe;default:l.hasOwnProperty(Z)||gt(i,s,Z,null,l,oe)}}for(var V in l){var Z=l[V];if(oe=r[V],l.hasOwnProperty(V)&&(Z!=null||oe!=null))switch(V){case"type":d=Z;break;case"name":u=Z;break;case"checked":Y=Z;break;case"defaultChecked":se=Z;break;case"value":g=Z;break;case"defaultValue":w=Z;break;case"children":case"dangerouslySetInnerHTML":if(Z!=null)throw Error(a(137,s));break;default:Z!==oe&>(i,s,V,Z,l,oe)}}N(i,g,w,M,Y,se,d,u);return;case"select":Z=g=w=V=null;for(d in r)if(M=r[d],r.hasOwnProperty(d)&&M!=null)switch(d){case"value":break;case"multiple":Z=M;default:l.hasOwnProperty(d)||gt(i,s,d,null,l,M)}for(u in l)if(d=l[u],M=r[u],l.hasOwnProperty(u)&&(d!=null||M!=null))switch(u){case"value":V=d;break;case"defaultValue":w=d;break;case"multiple":g=d;default:d!==M&>(i,s,u,d,l,M)}s=w,r=g,l=Z,V!=null?Be(i,!!r,V,!1):!!l!=!!r&&(s!=null?Be(i,!!r,s,!0):Be(i,!!r,r?[]:"",!1));return;case"textarea":Z=V=null;for(w in r)if(u=r[w],r.hasOwnProperty(w)&&u!=null&&!l.hasOwnProperty(w))switch(w){case"value":break;case"children":break;default:gt(i,s,w,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":V=u;break;case"defaultValue":Z=u;break;case"children":break;case"dangerouslySetInnerHTML":if(u!=null)throw Error(a(91));break;default:u!==d&>(i,s,g,u,l,d)}Xe(i,V,Z);return;case"option":for(var Te in r)V=r[Te],r.hasOwnProperty(Te)&&V!=null&&!l.hasOwnProperty(Te)&&(Te==="selected"?i.selected=!1:gt(i,s,Te,null,l,V));for(M in l)V=l[M],Z=r[M],l.hasOwnProperty(M)&&V!==Z&&(V!=null||Z!=null)&&(M==="selected"?i.selected=V&&typeof V!="function"&&typeof V!="symbol":gt(i,s,M,V,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 Oe in r)V=r[Oe],r.hasOwnProperty(Oe)&&V!=null&&!l.hasOwnProperty(Oe)&>(i,s,Oe,null,l,V);for(Y in l)if(V=l[Y],Z=r[Y],l.hasOwnProperty(Y)&&V!==Z&&(V!=null||Z!=null))switch(Y){case"children":case"dangerouslySetInnerHTML":if(V!=null)throw Error(a(137,s));break;default:gt(i,s,Y,V,l,Z)}return;default:if(cn(s)){for(var vt in r)V=r[vt],r.hasOwnProperty(vt)&&V!==void 0&&!l.hasOwnProperty(vt)&&Xd(i,s,vt,void 0,l,V);for(se in l)V=l[se],Z=r[se],!l.hasOwnProperty(se)||V===Z||V===void 0&&Z===void 0||Xd(i,s,se,V,l,Z);return}}for(var P in r)V=r[P],r.hasOwnProperty(P)&&V!=null&&!l.hasOwnProperty(P)&>(i,s,P,null,l,V);for(oe in l)V=l[oe],Z=r[oe],!l.hasOwnProperty(oe)||V===Z||V==null&&Z==null||gt(i,s,oe,V,l,Z)}function vy(i){switch(i){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function nx(){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,w=u.duration;if(d&&w&&vy(g)){for(g=0,w=u.responseEnd,l+=1;l<r.length;l++){var M=r[l],Y=M.startTime;if(Y>w)break;var se=M.transferSize,oe=M.initiatorType;se&&vy(oe)&&(M=M.responseEnd,g+=se*(M<w?1:(w-Y)/(M-Y)))}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 Gd=null,Zd=null;function qc(i){return i.nodeType===9?i:i.ownerDocument}function yy(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 by(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 Jd=null;function rx(){var i=window.event;return i&&i.type==="popstate"?i===Jd?!1:(Jd=i,!0):(Jd=null,!1)}var Sy=typeof setTimeout=="function"?setTimeout:void 0,ax=typeof clearTimeout=="function"?clearTimeout:void 0,wy=typeof Promise=="function"?Promise:void 0,lx=typeof queueMicrotask=="function"?queueMicrotask:typeof wy<"u"?function(i){return wy.resolve(null).then(i).catch(ox)}:Sy;function ox(i){setTimeout(function(){throw i})}function Jn(i){return i==="head"}function Cy(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),Ia(s);return}l--}else if(r==="$"||r==="$?"||r==="$~"||r==="$!"||r==="&")l++;else if(r==="html")Fl(i.ownerDocument.documentElement);else if(r==="head"){r=i.ownerDocument.head,Fl(r);for(var d=r.firstChild;d;){var g=d.nextSibling,w=d.nodeName;d[ws]||w==="SCRIPT"||w==="STYLE"||w==="LINK"&&d.rel.toLowerCase()==="stylesheet"||r.removeChild(d),d=g}}else r==="body"&&Fl(i.ownerDocument.body);r=u}while(r);Ia(s)}function xy(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 ef(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":ef(r),ln(r);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(r.rel.toLowerCase()==="stylesheet")continue}i.removeChild(r)}}function cx(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[ws])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=Ms(i.nextSibling),i===null)break}return null}function ux(i,s,r){if(s==="")return null;for(;i.nodeType!==3;)if((i.nodeType!==1||i.nodeName!=="INPUT"||i.type!=="hidden")&&!r||(i=Ms(i.nextSibling),i===null))return null;return i}function Ey(i,s){for(;i.nodeType!==8;)if((i.nodeType!==1||i.nodeName!=="INPUT"||i.type!=="hidden")&&!s||(i=Ms(i.nextSibling),i===null))return null;return i}function tf(i){return i.data==="$?"||i.data==="$~"}function sf(i){return i.data==="$!"||i.data==="$?"&&i.ownerDocument.readyState!=="loading"}function hx(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 Ms(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 nf=null;function Ty(i){i=i.nextSibling;for(var s=0;i;){if(i.nodeType===8){var r=i.data;if(r==="/$"||r==="/&"){if(s===0)return Ms(i.nextSibling);s--}else r!=="$"&&r!=="$!"&&r!=="$?"&&r!=="$~"&&r!=="&"||s++}i=i.nextSibling}return null}function ky(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 Dy(i,s,r){switch(s=qc(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 Fl(i){for(var s=i.attributes;s.length;)i.removeAttributeNode(s[0]);ln(i)}var Ns=new Map,Ry=new Set;function Wc(i){return typeof i.getRootNode=="function"?i.getRootNode():i.nodeType===9?i:i.ownerDocument}var En=W.d;W.d={f:dx,r:fx,D:px,C:mx,L:_x,m:gx,X:yx,S:vx,M:bx};function dx(){var i=En.f(),s=zc();return i||s}function fx(i){var s=Wi(i);s!==null&&s.tag===5&&s.type==="form"?$g(s):En.r(i)}var Ha=typeof document>"u"?null:document;function My(i,s,r){var l=Ha;if(l&&typeof s=="string"&&s){var u=mt(s);u='link[rel="'+i+'"][href="'+u+'"]',typeof r=="string"&&(u+='[crossorigin="'+r+'"]'),Ry.has(u)||(Ry.add(u),i={rel:i,crossOrigin:r,href:s},l.querySelector(u)===null&&(s=l.createElement("link"),zi(s,"link",i),It(s),l.head.appendChild(s)))}}function px(i){En.D(i),My("dns-prefetch",i,null)}function mx(i,s){En.C(i,s),My("preconnect",i,s)}function _x(i,s,r){En.L(i,s,r);var l=Ha;if(l&&i&&s){var u='link[rel="preload"][as="'+mt(s)+'"]';s==="image"&&r&&r.imageSrcSet?(u+='[imagesrcset="'+mt(r.imageSrcSet)+'"]',typeof r.imageSizes=="string"&&(u+='[imagesizes="'+mt(r.imageSizes)+'"]')):u+='[href="'+mt(i)+'"]';var d=u;switch(s){case"style":d=Ua(i);break;case"script":d=Pa(i)}Ns.has(d)||(i=b({rel:"preload",href:s==="image"&&r&&r.imageSrcSet?void 0:i,as:s},r),Ns.set(d,i),l.querySelector(u)!==null||s==="style"&&l.querySelector(ql(d))||s==="script"&&l.querySelector(Wl(d))||(s=l.createElement("link"),zi(s,"link",i),It(s),l.head.appendChild(s)))}}function gx(i,s){En.m(i,s);var r=Ha;if(r&&i){var l=s&&typeof s.as=="string"?s.as:"script",u='link[rel="modulepreload"][as="'+mt(l)+'"][href="'+mt(i)+'"]',d=u;switch(l){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":d=Pa(i)}if(!Ns.has(d)&&(i=b({rel:"modulepreload",href:i},s),Ns.set(d,i),r.querySelector(u)===null)){switch(l){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(r.querySelector(Wl(d)))return}l=r.createElement("link"),zi(l,"link",i),It(l),r.head.appendChild(l)}}}function vx(i,s,r){En.S(i,s,r);var l=Ha;if(l&&i){var u=Us(l).hoistableStyles,d=Ua(i);s=s||"default";var g=u.get(d);if(!g){var w={loading:0,preload:null};if(g=l.querySelector(ql(d)))w.loading=5;else{i=b({rel:"stylesheet",href:i,"data-precedence":s},r),(r=Ns.get(d))&&rf(i,r);var M=g=l.createElement("link");It(M),zi(M,"link",i),M._p=new Promise(function(Y,se){M.onload=Y,M.onerror=se}),M.addEventListener("load",function(){w.loading|=1}),M.addEventListener("error",function(){w.loading|=2}),w.loading|=4,$c(g,s,l)}g={type:"stylesheet",instance:g,count:1,state:w},u.set(d,g)}}}function yx(i,s){En.X(i,s);var r=Ha;if(r&&i){var l=Us(r).hoistableScripts,u=Pa(i),d=l.get(u);d||(d=r.querySelector(Wl(u)),d||(i=b({src:i,async:!0},s),(s=Ns.get(u))&&af(i,s),d=r.createElement("script"),It(d),zi(d,"link",i),r.head.appendChild(d)),d={type:"script",instance:d,count:1,state:null},l.set(u,d))}}function bx(i,s){En.M(i,s);var r=Ha;if(r&&i){var l=Us(r).hoistableScripts,u=Pa(i),d=l.get(u);d||(d=r.querySelector(Wl(u)),d||(i=b({src:i,async:!0,type:"module"},s),(s=Ns.get(u))&&af(i,s),d=r.createElement("script"),It(d),zi(d,"link",i),r.head.appendChild(d)),d={type:"script",instance:d,count:1,state:null},l.set(u,d))}}function Ny(i,s,r,l){var u=(u=ye.current)?Wc(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=Ua(r.href),r=Us(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=Ua(r.href);var d=Us(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(ql(i)))&&!d._p&&(g.instance=d,g.state.loading=5),Ns.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},Ns.set(i,r),d||Sx(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=Pa(r),r=Us(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 Ua(i){return'href="'+mt(i)+'"'}function ql(i){return'link[rel="stylesheet"]['+i+"]"}function Ay(i){return b({},i,{"data-precedence":i.precedence,precedence:null})}function Sx(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}),zi(s,"link",r),It(s),i.head.appendChild(s))}function Pa(i){return'[src="'+mt(i)+'"]'}function Wl(i){return"script[async]"+i}function Ly(i,s,r){if(s.count++,s.instance===null)switch(s.type){case"style":var l=i.querySelector('style[data-href~="'+mt(r.href)+'"]');if(l)return s.instance=l,It(l),l;var u=b({},r,{"data-href":r.href,"data-precedence":r.precedence,href:null,precedence:null});return l=(i.ownerDocument||i).createElement("style"),It(l),zi(l,"style",u),$c(l,r.precedence,i),s.instance=l;case"stylesheet":u=Ua(r.href);var d=i.querySelector(ql(u));if(d)return s.state.loading|=4,s.instance=d,It(d),d;l=Ay(r),(u=Ns.get(u))&&rf(l,u),d=(i.ownerDocument||i).createElement("link"),It(d);var g=d;return g._p=new Promise(function(w,M){g.onload=w,g.onerror=M}),zi(d,"link",l),s.state.loading|=4,$c(d,r.precedence,i),s.instance=d;case"script":return d=Pa(r.src),(u=i.querySelector(Wl(d)))?(s.instance=u,It(u),u):(l=r,(u=Ns.get(d))&&(l=b({},r),af(l,u)),i=i.ownerDocument||i,u=i.createElement("script"),It(u),zi(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,$c(l,r.precedence,i));return s.instance}function $c(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 w=l[g];if(w.dataset.precedence===s)d=w;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 rf(i,s){i.crossOrigin==null&&(i.crossOrigin=s.crossOrigin),i.referrerPolicy==null&&(i.referrerPolicy=s.referrerPolicy),i.title==null&&(i.title=s.title)}function af(i,s){i.crossOrigin==null&&(i.crossOrigin=s.crossOrigin),i.referrerPolicy==null&&(i.referrerPolicy=s.referrerPolicy),i.integrity==null&&(i.integrity=s.integrity)}var Yc=null;function By(i,s,r){if(Yc===null){var l=new Map,u=Yc=new Map;u.set(r,l)}else u=Yc,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[ws]||d[Ut]||i==="link"&&d.getAttribute("rel")==="stylesheet")&&d.namespaceURI!=="http://www.w3.org/2000/svg"){var g=d.getAttribute(s)||"";g=i+g;var w=l.get(g);w?w.push(d):l.set(g,[d])}}return l}function Oy(i,s,r){i=i.ownerDocument||i,i.head.insertBefore(r,s==="title"?i.querySelector("head > title"):null)}function wx(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 zy(i){return!(i.type==="stylesheet"&&(i.state.loading&3)===0)}function Cx(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=Ua(l.href),d=s.querySelector(ql(u));if(d){s=d._p,s!==null&&typeof s=="object"&&typeof s.then=="function"&&(i.count++,i=Vc.bind(i),s.then(i,i)),r.state.loading|=4,r.instance=d,It(d);return}d=s.ownerDocument||s,l=Ay(l),(u=Ns.get(u))&&rf(l,u),d=d.createElement("link"),It(d);var g=d;g._p=new Promise(function(w,M){g.onload=w,g.onerror=M}),zi(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=Vc.bind(i),s.addEventListener("load",r),s.addEventListener("error",r))}}var lf=0;function xx(i,s){return i.stylesheets&&i.count===0&&Gc(i,i.stylesheets),0<i.count||0<i.imgCount?function(r){var l=setTimeout(function(){if(i.stylesheets&&Gc(i,i.stylesheets),i.unsuspend){var d=i.unsuspend;i.unsuspend=null,d()}},6e4+s);0<i.imgBytes&&lf===0&&(lf=62500*nx());var u=setTimeout(function(){if(i.waitingForImages=!1,i.count===0&&(i.stylesheets&&Gc(i,i.stylesheets),i.unsuspend)){var d=i.unsuspend;i.unsuspend=null,d()}},(i.imgBytes>lf?50:800)+s);return i.unsuspend=r,function(){i.unsuspend=null,clearTimeout(l),clearTimeout(u)}}:null}function Vc(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Gc(this,this.stylesheets);else if(this.unsuspend){var i=this.unsuspend;this.unsuspend=null,i()}}}var Xc=null;function Gc(i,s){i.stylesheets=null,i.unsuspend!==null&&(i.count++,Xc=new Map,s.forEach(Ex,i),Xc=null,Vc.call(i))}function Ex(i,s){if(!(s.state.loading&4)){var r=Xc.get(i);if(r)var l=r.get(null);else{r=new Map,Xc.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=Vc.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 $l={$$typeof:U,Provider:null,Consumer:null,_currentValue:F,_currentValue2:F,_threadCount:0};function Tx(i,s,r,l,u,d,g,w,M){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=ui(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=ui(0),this.hiddenUpdates=ui(null),this.identifierPrefix=l,this.onUncaughtError=u,this.onCaughtError=d,this.onRecoverableError=g,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=M,this.incompleteTransitions=new Map}function jy(i,s,r,l,u,d,g,w,M,Y,se,oe){return i=new Tx(i,s,r,g,M,Y,se,oe,w),s=1,d===!0&&(s|=24),d=hs(3,null,null,s),i.current=d,d.stateNode=i,s=Uh(),s.refCount++,i.pooledCache=s,s.refCount++,d.memoizedState={element:l,isDehydrated:r,cache:s},Fh(d),i}function Hy(i){return i?(i=ga,i):ga}function Uy(i,s,r,l,u,d){u=Hy(u),l.context===null?l.context=u:l.pendingContext=u,l=Kn(s),l.payload={element:r},d=d===void 0?null:d,d!==null&&(l.callback=d),r=Fn(i,l,s),r!==null&&(ns(r,i,s),xl(r,i,s))}function Py(i,s){if(i=i.memoizedState,i!==null&&i.dehydrated!==null){var r=i.retryLane;i.retryLane=r!==0&&r<s?r:s}}function of(i,s){Py(i,s),(i=i.alternate)&&Py(i,s)}function Iy(i){if(i.tag===13||i.tag===31){var s=Tr(i,67108864);s!==null&&ns(s,i,67108864),of(i,67108864)}}function Ky(i){if(i.tag===13||i.tag===31){var s=_s();s=ot(s);var r=Tr(i,s);r!==null&&ns(r,i,s),of(i,s)}}var Zc=!0;function kx(i,s,r,l){var u=T.T;T.T=null;var d=W.p;try{W.p=2,cf(i,s,r,l)}finally{W.p=d,T.T=u}}function Dx(i,s,r,l){var u=T.T;T.T=null;var d=W.p;try{W.p=8,cf(i,s,r,l)}finally{W.p=d,T.T=u}}function cf(i,s,r,l){if(Zc){var u=uf(l);if(u===null)Vd(i,s,l,Qc,r),qy(i,l);else if(Mx(u,i,s,r,l))l.stopPropagation();else if(qy(i,l),s&4&&-1<Rx.indexOf(i)){for(;u!==null;){var d=Wi(u);if(d!==null)switch(d.tag){case 3:if(d=d.stateNode,d.current.memoizedState.isDehydrated){var g=xt(d.pendingLanes);if(g!==0){var w=d;for(w.pendingLanes|=2,w.entangledLanes|=2;g;){var M=1<<31-jt(g);w.entanglements[1]|=M,g&=~M}Qs(d),(at&6)===0&&(Bc=rt()+500,Pl(0))}}break;case 31:case 13:w=Tr(d,2),w!==null&&ns(w,d,2),zc(),of(d,2)}if(d=uf(l),d===null&&Vd(i,s,l,Qc,r),d===u)break;u=d}u!==null&&l.stopPropagation()}else Vd(i,s,l,null,r)}}function uf(i){return i=ua(i),hf(i)}var Qc=null;function hf(i){if(Qc=null,i=At(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 Qc=i,null}function Fy(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(li()){case Zi:return 2;case gi:return 8;case zt:case Ui:return 32;case vi:return 268435456;default:return 32}default:return 32}}var df=!1,er=null,tr=null,ir=null,Yl=new Map,Vl=new Map,sr=[],Rx="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 qy(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":Yl.delete(s.pointerId);break;case"gotpointercapture":case"lostpointercapture":Vl.delete(s.pointerId)}}function Xl(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=Wi(s),s!==null&&Iy(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 er=Xl(er,i,s,r,l,u),!0;case"dragenter":return tr=Xl(tr,i,s,r,l,u),!0;case"mouseover":return ir=Xl(ir,i,s,r,l,u),!0;case"pointerover":var d=u.pointerId;return Yl.set(d,Xl(Yl.get(d)||null,i,s,r,l,u)),!0;case"gotpointercapture":return d=u.pointerId,Vl.set(d,Xl(Vl.get(d)||null,i,s,r,l,u)),!0}return!1}function Wy(i){var s=At(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,ut(i.priority,function(){Ky(r)});return}}else if(s===31){if(s=f(r),s!==null){i.blockedOn=s,ut(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 Jc(i){if(i.blockedOn!==null)return!1;for(var s=i.targetContainers;0<s.length;){var r=uf(i.nativeEvent);if(r===null){r=i.nativeEvent;var l=new r.constructor(r.type,r);ca=l,r.target.dispatchEvent(l),ca=null}else return s=Wi(r),s!==null&&Iy(s),i.blockedOn=r,!1;s.shift()}return!0}function $y(i,s,r){Jc(i)&&r.delete(s)}function Nx(){df=!1,er!==null&&Jc(er)&&(er=null),tr!==null&&Jc(tr)&&(tr=null),ir!==null&&Jc(ir)&&(ir=null),Yl.forEach($y),Vl.forEach($y)}function eu(i,s){i.blockedOn===s&&(i.blockedOn=null,df||(df=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,Nx)))}var tu=null;function Yy(i){tu!==i&&(tu=i,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){tu===i&&(tu=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(hf(l||r)===null)continue;break}var d=Wi(r);d!==null&&(i.splice(s,3),s-=3,cd(d,{pending:!0,data:u,method:r.method,action:l},l,u))}}))}function Ia(i){function s(M){return eu(M,i)}er!==null&&eu(er,i),tr!==null&&eu(tr,i),ir!==null&&eu(ir,i),Yl.forEach(s),Vl.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);)Wy(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],g=u[Pt]||null;if(typeof d=="function")g||Yy(r);else if(g){var w=null;if(d&&d.hasAttribute("formAction")){if(u=d,g=d[Pt]||null)w=g.formAction;else if(hf(u)!==null)continue}else w=g.action;typeof w=="function"?r[l+1]=w:(r.splice(l,3),l-=3),Yy(r)}}}function Vy(){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 ff(i){this._internalRoot=i}iu.prototype.render=ff.prototype.render=function(i){var s=this._internalRoot;if(s===null)throw Error(a(409));var r=s.current,l=_s();Uy(r,l,i,s,null,null)},iu.prototype.unmount=ff.prototype.unmount=function(){var i=this._internalRoot;if(i!==null){this._internalRoot=null;var s=i.containerInfo;Uy(i.current,2,null,i,null,null),zc(),s[Rt]=null}};function iu(i){this._internalRoot=i}iu.prototype.unstable_scheduleHydration=function(i){if(i){var s=yi();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&&Wy(i)}};var Xy=t.version;if(Xy!=="19.2.6")throw Error(a(527,Xy,"19.2.6"));W.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?y(i):null,i=i===null?null:i.stateNode,i};var Ax={bundleType:0,version:"19.2.6",rendererPackageName:"react-dom",currentDispatcherRef:T,reconcilerVersion:"19.2.6"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var su=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!su.isDisabled&&su.supportsFiber)try{Qe=su.inject(Ax),lt=su}catch{}}return Zl.createRoot=function(i,s){if(!o(i))throw Error(a(299));var r=!1,l="",u=iv,d=sv,g=nv;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=jy(i,1,!1,null,null,r,l,null,u,d,g,Vy),i[Rt]=s.current,Yd(i),new ff(s)},Zl.hydrateRoot=function(i,s,r){if(!o(i))throw Error(a(299));var l=!1,u="",d=iv,g=sv,w=nv,M=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&&(w=r.onRecoverableError),r.formState!==void 0&&(M=r.formState)),s=jy(i,1,!0,s,r??null,l,u,M,d,g,w,Vy),s.context=Hy(null),r=s.current,l=_s(),l=ot(l),u=Kn(l),u.callback=null,Fn(r,u,l),r=l,s.current.lanes=r,Ni(s,r),Qs(s),i[Rt]=s.current,Yd(i),new iu(s)},Zl.version="19.2.6",Zl}var rb;function Kx(){if(rb)return _f.exports;rb=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(),_f.exports=Ix(),_f.exports}var Fx=Kx();class Nn extends Error{constructor(t,n){super(n),this.status=t,this.name="ApiError"}status}function Yu(e=fetch){return{getSession:(t={})=>ke(e,`/api/auth/session${vo(t)}`),setupPassword:t=>ke(e,"/api/auth/password",tt("POST",t)),login:t=>ke(e,"/api/auth/login",tt("POST",t)),reauth:t=>ke(e,"/api/auth/reauth",tt("POST",t)),logout:()=>ke(e,"/api/auth/logout",{method:"POST",credentials:"same-origin"}),sendClientDiagnostics:t=>ke(e,"/api/client-diagnostics",tt("POST",t)),setupTotp:()=>ke(e,"/api/auth/totp/setup",{method:"POST",credentials:"same-origin"}),activateTotp:t=>ke(e,"/api/auth/totp/activate",tt("POST",t)),disableTotp:()=>ke(e,"/api/auth/totp",{method:"DELETE",credentials:"same-origin"}),listDevices:()=>ke(e,"/api/auth/devices"),revokeDevice:async t=>{await Wa(e,`/api/auth/devices/${encodeURIComponent(t)}`,{method:"DELETE",credentials:"same-origin"})},listNetworks:()=>ke(e,"/api/auth/networks"),addNetwork:t=>ke(e,"/api/auth/networks",tt("POST",t)),removeNetwork:async t=>{await Wa(e,`/api/auth/networks/${encodeURIComponent(t)}`,{method:"DELETE",credentials:"same-origin"})},listAgents:()=>ke(e,"/api/agents"),addAgent:t=>ke(e,"/api/agents",tt("POST",t)),renameAgent:(t,n)=>ke(e,`/api/agents/${encodeURIComponent(t)}`,tt("PATCH",{name:n})),getMainInfo:()=>ke(e,"/api/main"),renameMain:t=>ke(e,"/api/main",tt("PATCH",{name:t})),removeAgent:async t=>{await Wa(e,`/api/agents/${encodeURIComponent(t)}`,{method:"DELETE",credentials:"same-origin"})},uninstallAgent:t=>ke(e,`/api/agents/${encodeURIComponent(t)}/uninstall`,{method:"POST",credentials:"same-origin"}),pingAgent:t=>ke(e,`/api/agents/${encodeURIComponent(t)}/ping`),getMainStats:()=>ke(e,"/api/stats"),getAgentStats:t=>ke(e,`/api/agents/${encodeURIComponent(t)}/stats`),getVersion:()=>ke(e,"/api/version"),checkUpdate:()=>ke(e,"/api/update/check",{method:"POST",credentials:"same-origin"}),runUpdate:()=>ke(e,"/api/update",{method:"POST",credentials:"same-origin"}),getAgentVersion:t=>ke(e,`/api/agents/${encodeURIComponent(t)}/version`),checkAgentUpdate:t=>ke(e,`/api/agents/${encodeURIComponent(t)}/update/check`,{method:"POST",credentials:"same-origin"}),runAgentUpdate:t=>ke(e,`/api/agents/${encodeURIComponent(t)}/update`,{method:"POST",credentials:"same-origin"}),listTerminals:()=>ke(e,"/api/terminals"),getTerminalLayout:()=>ke(e,"/api/terminal-layout"),saveTerminalLayout:t=>ke(e,"/api/terminal-layout",tt("PUT",t)),createFileRoot:t=>ke(e,"/api/files/root",tt("POST",t)),listFiles:t=>ke(e,"/api/files/list",tt("POST",t)),readFile:t=>ke(e,"/api/files/read",tt("POST",t)),writeFile:t=>ke(e,"/api/files/write",tt("POST",t)),createFileEntry:t=>ke(e,"/api/files/create",tt("POST",t)),moveFileEntry:t=>ke(e,"/api/files/move",tt("POST",t)),previewDeleteFileEntry:t=>ke(e,"/api/files/delete-preview",tt("POST",t)),deleteFileEntry:t=>ke(e,"/api/files/delete",tt("POST",t)),openFileInTerminal:t=>ke(e,"/api/files/open",tt("POST",t)),previewFile:t=>c0(e,"/api/files/preview",tt("POST",t)),createTerminal:(t={})=>ke(e,"/api/terminals",tt("POST",t)),closeTerminal:async t=>{await Wa(e,`/api/terminals/${encodeURIComponent(t)}`,{method:"DELETE",credentials:"same-origin"})},renameTerminal:(t,n)=>ke(e,`/api/terminals/${encodeURIComponent(t)}`,tt("PATCH",{title:n})),getTerminalHistory:(t,n={})=>ke(e,`/api/terminals/${encodeURIComponent(t)}/history${vo(n)}`),getTerminalTranscriptHistory:(t,n={})=>ke(e,`/api/terminals/${encodeURIComponent(t)}/transcript-history${vo(n)}`),getTerminalTranscriptSource:t=>ke(e,`/api/terminals/${encodeURIComponent(t)}/transcript-source`),listNotificationAssets:()=>ke(e,"/api/notification-assets"),uploadNotificationAsset:t=>{const n=new FormData;return n.append("asset",t),ke(e,"/api/notification-assets",{method:"POST",credentials:"same-origin",body:n})},updateNotificationAssetSelection:t=>ke(e,"/api/notification-assets/selection",tt("PUT",t)),deleteNotificationAsset:async t=>{await Wa(e,`/api/notification-assets/${encodeURIComponent(t)}`,{method:"DELETE",credentials:"same-origin"})}}}function To(e,t=fetch){const n=a=>e?`/api/agents/${encodeURIComponent(e)}/${a}`:`/api/${a}`;return{isAgent:e!==null,listTerminals:()=>ke(t,n("terminals")),createTerminal:(a={})=>ke(t,n("terminals"),tt("POST",a)),closeTerminal:async a=>{await Wa(t,n(`terminals/${encodeURIComponent(a)}`),{method:"DELETE",credentials:"same-origin"})},renameTerminal:(a,o)=>ke(t,n(`terminals/${encodeURIComponent(a)}`),tt("PATCH",{title:o})),getTerminalHistory:(a,o={})=>ke(t,`${n(`terminals/${encodeURIComponent(a)}/history`)}${vo(o)}`),getTerminalTranscriptHistory:(a,o={})=>ke(t,`${n(`terminals/${encodeURIComponent(a)}/transcript-history`)}${vo(o)}`),getTerminalTranscriptSource:a=>ke(t,n(`terminals/${encodeURIComponent(a)}/transcript-source`)),getTerminalLayout:()=>ke(t,n("terminal-layout")),saveTerminalLayout:a=>ke(t,n("terminal-layout"),tt("PUT",a)),createFileRoot:a=>ke(t,n("files/root"),tt("POST",a)),listFiles:a=>ke(t,n("files/list"),tt("POST",a)),readFile:a=>ke(t,n("files/read"),tt("POST",a)),writeFile:a=>ke(t,n("files/write"),tt("POST",a)),createFileEntry:a=>ke(t,n("files/create"),tt("POST",a)),moveFileEntry:a=>ke(t,n("files/move"),tt("POST",a)),previewDeleteFileEntry:a=>ke(t,n("files/delete-preview"),tt("POST",a)),deleteFileEntry:a=>ke(t,n("files/delete"),tt("POST",a)),openFileInTerminal:a=>ke(t,n("files/open"),tt("POST",a)),previewFile:a=>c0(t,n("files/preview"),tt("POST",a)),createWebSocketUrl:(a,o=window.location.href)=>qx(n(`terminals/${encodeURIComponent(a)}/ws`),o)}}function qx(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 vo(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.maxLines!==void 0&&t.set("maxLines",String(e.maxLines)),e.includeTools!==void 0&&t.set("includeTools",e.includeTools?"true":"false"),e.invalidationSource!==void 0&&t.set("invalidationSource",e.invalidationSource);const n=t.toString();return n?`?${n}`:""}async function ke(e,t,n){const a=await e(t,n??{credentials:"same-origin"});await km(a);try{return await a.json()}catch{throw new Nn(a.status,"invalid_json_response")}}async function Wa(e,t,n){const a=await e(t,n);await km(a)}async function c0(e,t,n){const a=await e(t,n);return await km(a),a.blob()}async function km(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 Dm="nterminal.theme.id",u0="nterminal.theme.accent",Qf="nterminal:theme",Ru=[{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",transcriptAssistant:"#5eead4",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:"#8b3f75",transcriptAssistant:"#0f8f83",transcriptTool:"#66717d",transcriptCommand:"#0b6fa4",transcriptCode:"#075985",transcriptSearch:"#f0c14b",transcriptOnSearch:"#1f1a10",qrBg:"#ffffff"},xterm:{background:"#ffffff",foreground:"#17212b",cursor:"#0f8f83",selectionBackground:"#cdeee9",...ab({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",transcriptAssistant:"#ff2a3d",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",transcriptAssistant:"#7dd3fc",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:"#7b3f8c",transcriptAssistant:"#a35d00",transcriptTool:"#776d63",transcriptCommand:"#176a94",transcriptCode:"#6f4b00",transcriptSearch:"#e9c46a",transcriptOnSearch:"#241b0a",qrBg:"#ffffff"},xterm:{background:"#fffdf9",foreground:"#25211d",cursor:"#a35d00",selectionBackground:"#f2dfc5",...ab({foreground:"#25211d",foregroundMuted:"#62584e",line:"#e2ddd4",red:"#a8323d",green:"#26744d",yellow:"#875600",blue:"#176a94",magenta:"#8b4b80",cyan:"#276f68"})}}],Qa="midnight";function Vu(e){return Ru.some(t=>t.id===e)?e:Qa}function Rm(e){return Ru.find(t=>t.id===e)??Ru[0]}function mr(){if(typeof window>"u")return Qa;try{const e=window.localStorage.getItem(Dm);return e?Vu(e):Xx(window.localStorage.getItem(u0))}catch{return Qa}}function Wx(e){const t=Vu(e);if(typeof window<"u"){try{window.localStorage.setItem(Dm,t)}catch{}Mm(t),window.dispatchEvent(new CustomEvent(Qf,{detail:t}))}return t}function Mm(e=mr()){if(typeof document>"u")return;const t=Rm(Vu(e)),n=document.documentElement;n.dataset.ntTheme=t.id,n.style.setProperty("color-scheme",t.mode),$e(n,"--nt-bg",t.tokens.bg),$e(n,"--nt-bg-2",t.tokens.bg2),$e(n,"--nt-bg-sidebar",t.tokens.bgSidebar),$e(n,"--nt-line",t.tokens.line),$e(n,"--nt-line-2",t.tokens.line2),$e(n,"--nt-fg",t.tokens.fg),$e(n,"--nt-fg-2",t.tokens.fg2),$e(n,"--nt-fg-3",t.tokens.fg3),$e(n,"--nt-fg-4",t.tokens.fg4),$e(n,"--nt-accent",t.tokens.accent),$e(n,"--nt-accent-soft",t.tokens.accentSoft),$e(n,"--nt-accent-glow",t.tokens.accentGlow),$e(n,"--nt-on-accent",t.tokens.onAccent),$e(n,"--nt-ok",t.tokens.ok),$e(n,"--nt-danger",t.tokens.danger),$e(n,"--nt-on-danger",t.tokens.onDanger),$e(n,"--nt-danger-soft",t.tokens.dangerSoft),$e(n,"--nt-danger-line",t.tokens.dangerLine),$e(n,"--nt-warning",t.tokens.warning),$e(n,"--nt-warn",t.tokens.warning),$e(n,"--nt-warning-soft",t.tokens.warningSoft),$e(n,"--nt-warning-glow",t.tokens.warningGlow),$e(n,"--nt-scrim",t.tokens.scrim),$e(n,"--nt-scrim-soft",t.tokens.scrimSoft),$e(n,"--nt-shadow",t.tokens.shadow),$e(n,"--nt-shadow-strong",t.tokens.shadowStrong),$e(n,"--nt-floating-bg",t.tokens.floatingBg),$e(n,"--nt-floating-bg-strong",t.tokens.floatingBgStrong),$e(n,"--nt-floating-bg-hover",t.tokens.floatingBgHover),$e(n,"--nt-subtle-fill",t.tokens.subtleFill),$e(n,"--nt-hover-fill",t.tokens.hoverFill),$e(n,"--nt-scrollbar-thumb",t.tokens.scrollbarThumb),$e(n,"--nt-scrollbar-thumb-hover",t.tokens.scrollbarThumbHover),$e(n,"--nt-transcript-user",t.tokens.transcriptUser),$e(n,"--nt-transcript-assistant",t.tokens.transcriptAssistant),$e(n,"--nt-transcript-tool",t.tokens.transcriptTool),$e(n,"--nt-transcript-command",t.tokens.transcriptCommand),$e(n,"--nt-transcript-code",t.tokens.transcriptCode),$e(n,"--nt-transcript-search",t.tokens.transcriptSearch),$e(n,"--nt-transcript-on-search",t.tokens.transcriptOnSearch),$e(n,"--nt-qr-bg",t.tokens.qrBg)}function $x(e=mr()){return Rm(Vu(e)).xterm}function Nm(e){if(typeof window>"u")return()=>{};const t=n=>{(n.key===Dm||n.key===u0)&&(Mm(mr()),e())};return window.addEventListener(Qf,e),window.addEventListener("storage",t),()=>{window.removeEventListener(Qf,e),window.removeEventListener("storage",t)}}function $e(e,t,n){e.style.setProperty(t,n)}function ab(e){const t=Yx(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 Yx(e){const t=[];for(let n=16;n<=e;n+=1)t.push(Vx(n));return t}function Vx(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 lb(a,o,c)}if(e>=232&&e<=255){const t=8+(e-232)*10;return lb(t,t,t)}return"#000000"}function lb(e,t,n){return`#${bf(e)}${bf(t)}${bf(n)}`}function bf(e){return e.toString(16).padStart(2,"0")}function Xx(e){return e==="signal-red"?"signal-red":Qa}function h0(){const e=v.useSyncExternalStore(Nm,mr,()=>Qa);return Rm(e).mode==="light"?"-light":""}function d0({size:e=22}){const t=h0();return m.jsx("img",{className:"nterminal-mark",src:`/brand/nterminal-mark${t}.svg`,width:e,height:e,alt:"","aria-hidden":"true"})}function f0({height:e=18}){const t=h0(),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 co=o0();const Xu=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function il(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function Am(e){return"nodeType"in e}function as(e){var t,n;return e?il(e)?e:Am(e)&&(t=(n=e.ownerDocument)==null?void 0:n.defaultView)!=null?t:window:window}function Lm(e){const{Document:t}=as(e);return e instanceof t}function Uo(e){return il(e)?!1:e instanceof as(e).HTMLElement}function p0(e){return e instanceof as(e).SVGElement}function sl(e){return e?il(e)?e.document:Am(e)?Lm(e)?e:Uo(e)||p0(e)?e.ownerDocument:document:document:document}const _r=Xu?v.useLayoutEffect:v.useEffect;function Bm(e){const t=v.useRef(e);return _r(()=>{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 Gx(){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 ko(e,t){t===void 0&&(t=[e]);const n=v.useRef(e);return _r(()=>{n.current!==e&&(n.current=e)},t),n}function Po(e,t){const n=v.useRef();return v.useMemo(()=>{const a=e(n.current);return n.current=a,a},[...t])}function Mu(e){const t=Bm(e),n=v.useRef(null),a=v.useCallback(o=>{o!==n.current&&t?.(o,n.current),n.current=o},[]);return[n,a]}function Jf(e){const t=v.useRef();return v.useEffect(()=>{t.current=e},[e]),t.current}let Sf={};function Gu(e,t){return v.useMemo(()=>{if(t)return t;const n=Sf[e]==null?0:Sf[e]+1;return Sf[e]=n,e+"-"+n},[e,t])}function m0(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 y=c[_];y!=null&&(c[_]=y+e*p)}return c},{...t})}}const Ga=m0(1),Nu=m0(-1);function Zx(e){return"clientX"in e&&"clientY"in e}function _0(e){if(!e)return!1;const{KeyboardEvent:t}=as(e.target);return t&&e instanceof t}function Qx(e){if(!e)return!1;const{TouchEvent:t}=as(e.target);return t&&e instanceof t}function ep(e){if(Qx(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 tp=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[tp.Translate.toString(e),tp.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:n,easing:a}=e;return t+" "+n+"ms "+a}}}),ob="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function Jx(e){return e.matches(ob)?e:e.querySelector(ob)}const e2={display:"none"};function t2(e){let{id:t,value:n}=e;return mi.createElement("div",{id:t,style:e2},n)}function i2(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 mi.createElement("div",{id:t,style:o,role:"status","aria-live":a,"aria-atomic":!0},n)}function s2(){const[e,t]=v.useState("");return{announce:v.useCallback(a=>{a!=null&&t(a)},[]),announcement:e}}const g0=v.createContext(null);function n2(e){const t=v.useContext(g0);v.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}function r2(){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 a2={draggable:`
|
|
11
|
-
To pick up a draggable item, press the space bar.
|
|
12
|
-
While dragging, use the arrow keys to move the item.
|
|
13
|
-
Press space again to drop the item in its new position, or press escape to cancel.
|
|
14
|
-
`},l2={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 o2(e){let{announcements:t=l2,container:n,hiddenTextDescribedById:a,screenReaderInstructions:o=a2}=e;const{announce:c,announcement:h}=s2(),f=Gu("DndLiveRegion"),[_,p]=v.useState(!1);if(v.useEffect(()=>{p(!0)},[]),n2(v.useMemo(()=>({onDragStart(b){let{active:S}=b;c(t.onDragStart({active:S}))},onDragMove(b){let{active:S,over:C}=b;t.onDragMove&&c(t.onDragMove({active:S,over:C}))},onDragOver(b){let{active:S,over:C}=b;c(t.onDragOver({active:S,over:C}))},onDragEnd(b){let{active:S,over:C}=b;c(t.onDragEnd({active:S,over:C}))},onDragCancel(b){let{active:S,over:C}=b;c(t.onDragCancel({active:S,over:C}))}}),[c,t])),!_)return null;const y=mi.createElement(mi.Fragment,null,mi.createElement(t2,{id:a,value:o.draggable}),mi.createElement(i2,{id:f,announcement:h}));return n?co.createPortal(y,n):y}var pi;(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"})(pi||(pi={}));function Au(){}function cb(e,t){return v.useMemo(()=>({sensor:e,options:t??{}}),[e,t])}function c2(){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 Ws=Object.freeze({x:0,y:0});function u2(e,t){let{data:{value:n}}=e,{data:{value:a}}=t;return a-n}function h2(e,t){if(!e||e.length===0)return null;const[n]=e;return n[t]}function d2(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,y=h*f,b=y/(_+p-y);return Number(b.toFixed(4))}return 0}const f2=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 _=d2(f,t);_>0&&o.push({id:h,data:{droppableContainer:c,value:_}})}}return o.sort(u2)};function p2(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function v0(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:Ws}function m2(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 _2=m2(1);function g2(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 v2(e,t,n){const a=g2(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)),y=o?e.width/o:e.width,b=c?e.height/c:e.height;return{width:y,height:b,top:p,right:_+y,bottom:p+b,left:_}}const y2={ignoreTransform:!1};function Io(e,t){t===void 0&&(t=y2);let n=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:p,transformOrigin:y}=as(e).getComputedStyle(e);p&&(n=v2(n,p,y))}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 ub(e){return Io(e,{ignoreTransform:!0})}function b2(e){const t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function S2(e,t){return t===void 0&&(t=as(e).getComputedStyle(e)),t.position==="fixed"}function w2(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 Om(e,t){const n=[];function a(o){if(t!=null&&n.length>=t||!o)return n;if(Lm(o)&&o.scrollingElement!=null&&!n.includes(o.scrollingElement))return n.push(o.scrollingElement),n;if(!Uo(o)||p0(o)||n.includes(o))return n;const c=as(e).getComputedStyle(o);return o!==e&&w2(o,c)&&n.push(o),S2(o,c)?n:a(o.parentNode)}return e?a(e):n}function y0(e){const[t]=Om(e,1);return t??null}function wf(e){return!Xu||!e?null:il(e)?e:Am(e)?Lm(e)||e===sl(e).scrollingElement?window:Uo(e)?e:null:null}function b0(e){return il(e)?e.scrollX:e.scrollLeft}function S0(e){return il(e)?e.scrollY:e.scrollTop}function ip(e){return{x:b0(e),y:S0(e)}}var Ti;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(Ti||(Ti={}));function w0(e){return!Xu||!e?!1:e===document.scrollingElement}function C0(e){const t={x:0,y:0},n=w0(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 C2={x:.2,y:.2};function x2(e,t,n,a,o){let{top:c,left:h,right:f,bottom:_}=n;a===void 0&&(a=10),o===void 0&&(o=C2);const{isTop:p,isBottom:y,isLeft:b,isRight:S}=C0(e),C={x:0,y:0},x={x:0,y:0},E={height:t.height*o.y,width:t.width*o.x};return!p&&c<=t.top+E.height?(C.y=Ti.Backward,x.y=a*Math.abs((t.top+E.height-c)/E.height)):!y&&_>=t.bottom-E.height&&(C.y=Ti.Forward,x.y=a*Math.abs((t.bottom-E.height-_)/E.height)),!S&&f>=t.right-E.width?(C.x=Ti.Forward,x.x=a*Math.abs((t.right-E.width-f)/E.width)):!b&&h<=t.left+E.width&&(C.x=Ti.Backward,x.x=a*Math.abs((t.left+E.width-h)/E.width)),{direction:C,speed:x}}function E2(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 x0(e){return e.reduce((t,n)=>Ga(t,ip(n)),Ws)}function T2(e){return e.reduce((t,n)=>t+b0(n),0)}function k2(e){return e.reduce((t,n)=>t+S0(n),0)}function D2(e,t){if(t===void 0&&(t=Io),!e)return;const{top:n,left:a,bottom:o,right:c}=t(e);y0(e)&&(o<=0||c<=0||n>=window.innerHeight||a>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const R2=[["x",["left","right"],T2],["y",["top","bottom"],k2]];class zm{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=Om(n),o=x0(a);this.rect={...t},this.width=t.width,this.height=t.height;for(const[c,h,f]of R2)for(const _ of h)Object.defineProperty(this,_,{get:()=>{const p=f(a),y=o[c]-p;return this.rect[_]+y},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class yo{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:sl(e)}function Cf(e,t){const n=Math.abs(e.x),a=Math.abs(e.y);return typeof t=="number"?Math.sqrt(n**2+a**2)>t:"x"in t&&"y"in t?n>t.x&&a>t.y:"x"in t?n>t.x:"y"in t?a>t.y:!1}var Bs;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(Bs||(Bs={}));function hb(e){e.preventDefault()}function N2(e){e.stopPropagation()}var wt;(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"})(wt||(wt={}));const E0={start:[wt.Space,wt.Enter],cancel:[wt.Esc],end:[wt.Space,wt.Enter,wt.Tab]},A2=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case wt.Right:return{...n,x:n.x+25};case wt.Left:return{...n,x:n.x-25};case wt.Down:return{...n,y:n.y+25};case wt.Up:return{...n,y:n.y-25}}};class T0{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 yo(sl(n)),this.windowListeners=new yo(as(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(Bs.Resize,this.handleCancel),this.windowListeners.add(Bs.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(Bs.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:n}=this.props,a=t.node.current;a&&D2(a),n(Ws)}handleKeyDown(t){if(_0(t)){const{active:n,context:a,options:o}=this.props,{keyboardCodes:c=E0,coordinateGetter:h=A2,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,y=p?{x:p.left,y:p.top}:Ws;this.referenceCoordinates||(this.referenceCoordinates=y);const b=h(t,{active:n,context:a.current,currentCoordinates:y});if(b){const S=Nu(b,y),C={x:0,y:0},{scrollableAncestors:x}=a.current;for(const E of x){const B=t.code,{isTop:k,isRight:H,isLeft:U,isBottom:X,maxScroll:ee,minScroll:te}=C0(E),ne=E2(E),re={x:Math.min(B===wt.Right?ne.right-ne.width/2:ne.right,Math.max(B===wt.Right?ne.left:ne.left+ne.width/2,b.x)),y:Math.min(B===wt.Down?ne.bottom-ne.height/2:ne.bottom,Math.max(B===wt.Down?ne.top:ne.top+ne.height/2,b.y))},fe=B===wt.Right&&!H||B===wt.Left&&!U,K=B===wt.Down&&!X||B===wt.Up&&!k;if(fe&&re.x!==b.x){const A=E.scrollLeft+S.x,I=B===wt.Right&&A<=ee.x||B===wt.Left&&A>=te.x;if(I&&!S.y){E.scrollTo({left:A,behavior:f});return}I?C.x=E.scrollLeft-A:C.x=B===wt.Right?E.scrollLeft-ee.x:E.scrollLeft-te.x,C.x&&E.scrollBy({left:-C.x,behavior:f});break}else if(K&&re.y!==b.y){const A=E.scrollTop+S.y,I=B===wt.Down&&A<=ee.y||B===wt.Up&&A>=te.y;if(I&&!S.x){E.scrollTo({top:A,behavior:f});return}I?C.y=E.scrollTop-A:C.y=B===wt.Down?E.scrollTop-ee.y:E.scrollTop-te.y,C.y&&E.scrollBy({top:-C.y,behavior:f});break}}this.handleMove(t,Ga(Nu(b,this.referenceCoordinates),C))}}}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()}}T0.activators=[{eventName:"onKeyDown",handler:(e,t,n)=>{let{keyboardCodes:a=E0,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 db(e){return!!(e&&"distance"in e)}function fb(e){return!!(e&&"delay"in e)}class jm{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=sl(h),this.documentListeners=new yo(this.document),this.listeners=new yo(a),this.windowListeners=new yo(as(h)),this.initialCoordinates=(o=ep(c))!=null?o:Ws,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:t,props:{options:{activationConstraint:n,bypassActivationConstraint:a}}}=this;if(this.listeners.add(t.move.name,this.handleMove,{passive:!1}),this.listeners.add(t.end.name,this.handleEnd),t.cancel&&this.listeners.add(t.cancel.name,this.handleCancel),this.windowListeners.add(Bs.Resize,this.handleCancel),this.windowListeners.add(Bs.DragStart,hb),this.windowListeners.add(Bs.VisibilityChange,this.handleCancel),this.windowListeners.add(Bs.ContextMenu,hb),this.documentListeners.add(Bs.Keydown,this.handleKeydown),n){if(a!=null&&a({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(fb(n)){this.timeoutId=setTimeout(this.handleStart,n.delay),this.handlePending(n);return}if(db(n)){this.handlePending(n);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(t,n){const{active:a,onPending:o}=this.props;o(a,t,this.initialCoordinates,n)}handleStart(){const{initialCoordinates:t}=this,{onStart:n}=this.props;t&&(this.activated=!0,this.documentListeners.add(Bs.Click,N2,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(Bs.SelectionChange,this.removeTextSelection),n(t))}handleMove(t){var n;const{activated:a,initialCoordinates:o,props:c}=this,{onMove:h,options:{activationConstraint:f}}=c;if(!o)return;const _=(n=ep(t))!=null?n:Ws,p=Nu(o,_);if(!a&&f){if(db(f)){if(f.tolerance!=null&&Cf(p,f.tolerance))return this.handleCancel();if(Cf(p,f.distance))return this.handleStart()}if(fb(f)&&Cf(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===wt.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const L2={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class k0 extends jm{constructor(t){const{event:n}=t,a=sl(n.target);super(t,L2,a)}}k0.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 B2={move:{name:"mousemove"},end:{name:"mouseup"}};var sp;(function(e){e[e.RightClick=2]="RightClick"})(sp||(sp={}));class D0 extends jm{constructor(t){super(t,B2,sl(t.event.target))}}D0.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:a}=t;return n.button===sp.RightClick?!1:(a?.({event:n}),!0)}}];const xf={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class R0 extends jm{constructor(t){super(t,xf)}static setup(){return window.addEventListener(xf.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(xf.move.name,t)};function t(){}}}R0.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 bo;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(bo||(bo={}));var Lu;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(Lu||(Lu={}));function O2(e){let{acceleration:t,activator:n=bo.Pointer,canScroll:a,draggingRect:o,enabled:c,interval:h=5,order:f=Lu.TreeOrder,pointerCoordinates:_,scrollableAncestors:p,scrollableAncestorRects:y,delta:b,threshold:S}=e;const C=j2({delta:b,disabled:!c}),[x,E]=Gx(),B=v.useRef({x:0,y:0}),k=v.useRef({x:0,y:0}),H=v.useMemo(()=>{switch(n){case bo.Pointer:return _?{top:_.y,bottom:_.y,left:_.x,right:_.x}:null;case bo.DraggableRect:return o}},[n,o,_]),U=v.useRef(null),X=v.useCallback(()=>{const te=U.current;if(!te)return;const ne=B.current.x*k.current.x,re=B.current.y*k.current.y;te.scrollBy(ne,re)},[]),ee=v.useMemo(()=>f===Lu.TreeOrder?[...p].reverse():p,[f,p]);v.useEffect(()=>{if(!c||!p.length||!H){E();return}for(const te of ee){if(a?.(te)===!1)continue;const ne=p.indexOf(te),re=y[ne];if(!re)continue;const{direction:fe,speed:K}=x2(te,re,H,t,S);for(const A of["x","y"])C[A][fe[A]]||(K[A]=0,fe[A]=0);if(K.x>0||K.y>0){E(),U.current=te,x(X,h),B.current=K,k.current=fe;return}}B.current={x:0,y:0},k.current={x:0,y:0},E()},[t,X,a,E,c,h,JSON.stringify(H),JSON.stringify(C),x,p,ee,y,JSON.stringify(S)])}const z2={x:{[Ti.Backward]:!1,[Ti.Forward]:!1},y:{[Ti.Backward]:!1,[Ti.Forward]:!1}};function j2(e){let{delta:t,disabled:n}=e;const a=Jf(t);return Po(o=>{if(n||!a||!o)return z2;const c={x:Math.sign(t.x-a.x),y:Math.sign(t.y-a.y)};return{x:{[Ti.Backward]:o.x[Ti.Backward]||c.x===-1,[Ti.Forward]:o.x[Ti.Forward]||c.x===1},y:{[Ti.Backward]:o.y[Ti.Backward]||c.y===-1,[Ti.Forward]:o.y[Ti.Forward]||c.y===1}}},[n,t,a])}function H2(e,t){const n=t!=null?e.get(t):void 0,a=n?n.node.current:null;return Po(o=>{var c;return t==null?null:(c=a??o)!=null?c:null},[a,t])}function U2(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 Do;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(Do||(Do={}));var np;(function(e){e.Optimized="optimized"})(np||(np={}));const pb=new Map;function P2(e,t){let{dragging:n,dependencies:a,config:o}=t;const[c,h]=v.useState(null),{frequency:f,measure:_,strategy:p}=o,y=v.useRef(e),b=B(),S=ko(b),C=v.useCallback(function(k){k===void 0&&(k=[]),!S.current&&h(H=>H===null?k:H.concat(k.filter(U=>!H.includes(U))))},[S]),x=v.useRef(null),E=Po(k=>{if(b&&!n)return pb;if(!k||k===pb||y.current!==e||c!=null){const H=new Map;for(let U of e){if(!U)continue;if(c&&c.length>0&&!c.includes(U.id)&&U.rect.current){H.set(U.id,U.rect.current);continue}const X=U.node.current,ee=X?new zm(_(X),X):null;U.rect.current=ee,ee&&H.set(U.id,ee)}return H}return k},[e,c,n,b,_]);return v.useEffect(()=>{y.current=e},[e]),v.useEffect(()=>{b||C()},[n,b]),v.useEffect(()=>{c&&c.length>0&&h(null)},[JSON.stringify(c)]),v.useEffect(()=>{b||typeof f!="number"||x.current!==null||(x.current=setTimeout(()=>{C(),x.current=null},f))},[f,b,C,...a]),{droppableRects:E,measureDroppableContainers:C,measuringScheduled:c!=null};function B(){switch(p){case Do.Always:return!1;case Do.BeforeDragging:return n;default:return!n}}}function M0(e,t){return Po(n=>e?n||(typeof t=="function"?t(e):e):null,[t,e])}function I2(e,t){return M0(e,t)}function K2(e){let{callback:t,disabled:n}=e;const a=Bm(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 Zu(e){let{callback:t,disabled:n}=e;const a=Bm(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 F2(e){return new zm(Io(e),e)}function mb(e,t,n){t===void 0&&(t=F2);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 y=t(e);return JSON.stringify(_)===JSON.stringify(y)?_:y})}const h=K2({callback(_){if(e)for(const p of _){const{type:y,target:b}=p;if(y==="childList"&&b instanceof HTMLElement&&b.contains(e)){c();break}}}}),f=Zu({callback:c});return _r(()=>{c(),e?(f?.observe(e),h?.observe(document.body,{childList:!0,subtree:!0})):(f?.disconnect(),h?.disconnect())},[e]),a}function q2(e){const t=M0(e);return v0(e,t)}const _b=[];function W2(e){const t=v.useRef(e),n=Po(a=>e?a&&a!==_b&&e&&t.current&&e.parentNode===t.current.parentNode?a:Om(e):_b,[e]);return v.useEffect(()=>{t.current=e},[e]),n}function $2(e){const[t,n]=v.useState(null),a=v.useRef(e),o=v.useCallback(c=>{const h=wf(c.target);h&&n(f=>f?(f.set(h,ip(h)),new Map(f)):null)},[]);return v.useEffect(()=>{const c=a.current;if(e!==c){h(c);const f=e.map(_=>{const p=wf(_);return p?(p.addEventListener("scroll",o,{passive:!0}),[p,ip(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=wf(_);p?.removeEventListener("scroll",o)})}},[o,e]),v.useMemo(()=>e.length?t?Array.from(t.values()).reduce((c,h)=>Ga(c,h),Ws):x0(e):Ws,[e,t])}function gb(e,t){t===void 0&&(t=[]);const n=v.useRef(null);return v.useEffect(()=>{n.current=null},t),v.useEffect(()=>{const a=e!==Ws;a&&!n.current&&(n.current=e),!a&&n.current&&(n.current=null)},[e]),n.current?Nu(e,n.current):Ws}function Y2(e){v.useEffect(()=>{if(!Xu)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 V2(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 N0(e){return v.useMemo(()=>e?b2(e):null,[e])}const vb=[];function X2(e,t){t===void 0&&(t=Io);const[n]=e,a=N0(n?as(n):null),[o,c]=v.useState(vb);function h(){c(()=>e.length?e.map(_=>w0(_)?a:new zm(t(_),_)):vb)}const f=Zu({callback:h});return _r(()=>{f?.disconnect(),h(),e.forEach(_=>f?.observe(_))},[e]),o}function G2(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return Uo(t)?t:e}function Z2(e){let{measure:t}=e;const[n,a]=v.useState(null),o=v.useCallback(p=>{for(const{target:y}of p)if(Uo(y)){a(b=>{const S=t(y);return b?{...b,width:S.width,height:S.height}:S});break}},[t]),c=Zu({callback:o}),h=v.useCallback(p=>{const y=G2(p);c?.disconnect(),y&&c?.observe(y),a(y?t(y):null)},[t,c]),[f,_]=Mu(h);return v.useMemo(()=>({nodeRef:f,rect:n,setRef:_}),[n,f,_])}const Q2=[{sensor:k0,options:{}},{sensor:T0,options:{}}],J2={current:{}},gu={draggable:{measure:ub},droppable:{measure:ub,strategy:Do.WhileDragging,frequency:np.Optimized},dragOverlay:{measure:Io}};class So 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 eE={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new So,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:Au},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:gu,measureDroppableContainers:Au,windowRect:null,measuringScheduled:!1},tE={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:Au,draggableNodes:new Map,over:null,measureDroppableContainers:Au},Qu=v.createContext(tE),iE=v.createContext(eE);function sE(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new So}}}function nE(e,t){switch(t.type){case pi.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case pi.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 pi.DragEnd:case pi.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case pi.RegisterDroppable:{const{element:n}=t,{id:a}=n,o=new So(e.droppable.containers);return o.set(a,n),{...e,droppable:{...e.droppable,containers:o}}}case pi.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 So(e.droppable.containers);return h.set(n,{...c,disabled:o}),{...e,droppable:{...e.droppable,containers:h}}}case pi.UnregisterDroppable:{const{id:n,key:a}=t,o=e.droppable.containers.get(n);if(!o||a!==o.key)return e;const c=new So(e.droppable.containers);return c.delete(n),{...e,droppable:{...e.droppable,containers:c}}}default:return e}}function rE(e){let{disabled:t}=e;const{active:n,activatorEvent:a,draggableNodes:o}=v.useContext(Qu),c=Jf(a),h=Jf(n?.id);return v.useEffect(()=>{if(!t&&!a&&c&&h!=null){if(!_0(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 y of[_.current,p.current]){if(!y)continue;const b=Jx(y);if(b){b.focus();break}}})}},[a,t,o,h,c]),null}function aE(e,t){let{transform:n,...a}=t;return e!=null&&e.length?e.reduce((o,c)=>c({transform:o,...a}),n):n}function lE(e){return v.useMemo(()=>({draggable:{...gu.draggable,...e?.draggable},droppable:{...gu.droppable,...e?.droppable},dragOverlay:{...gu.dragOverlay,...e?.dragOverlay}}),[e?.draggable,e?.droppable,e?.dragOverlay])}function oE(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;_r(()=>{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 y=n(p),b=v0(y,a);if(h||(b.x=0),f||(b.y=0),c.current=!0,Math.abs(b.x)>0||Math.abs(b.y)>0){const S=y0(p);S&&S.scrollBy({top:b.y,left:b.x})}},[t,h,f,a,n])}const A0=v.createContext({...Ws,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 cE=v.memo(function(t){var n,a,o,c;let{id:h,accessibility:f,autoScroll:_=!0,children:p,sensors:y=Q2,collisionDetection:b=f2,measuring:S,modifiers:C,...x}=t;const E=v.useReducer(nE,void 0,sE),[B,k]=E,[H,U]=r2(),[X,ee]=v.useState(ur.Uninitialized),te=X===ur.Initialized,{draggable:{active:ne,nodes:re,translate:fe},droppable:{containers:K}}=B,A=ne!=null?re.get(ne):null,I=v.useRef({initial:null,translated:null}),O=v.useMemo(()=>{var bt;return ne!=null?{id:ne,data:(bt=A?.data)!=null?bt:J2,rect:I}:null},[ne,A]),j=v.useRef(null),[J,T]=v.useState(null),[W,F]=v.useState(null),me=ko(x,Object.values(x)),we=Gu("DndDescribedBy",h),R=v.useMemo(()=>K.getEnabled(),[K]),G=lE(S),{droppableRects:ae,measureDroppableContainers:de,measuringScheduled:ge}=P2(R,{dragging:te,dependencies:[fe.x,fe.y],config:G.droppable}),ye=H2(re,ne),xe=v.useMemo(()=>W?ep(W):null,[W]),Fe=Ss(),he=I2(ye,G.draggable.measure);oE({activeNode:ne!=null?re.get(ne):null,config:Fe.layoutShiftCompensation,initialRect:he,measure:G.draggable.measure});const ve=mb(ye,G.draggable.measure,he),ze=mb(ye?ye.parentElement:null),Re=v.useRef({activatorEvent:null,active:null,activeNode:ye,collisionRect:null,collisions:null,droppableRects:ae,draggableNodes:re,draggingNode:null,draggingNodeRect:null,droppableContainers:K,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),Ee=K.getNodeFor((n=Re.current.over)==null?void 0:n.id),ie=Z2({measure:G.dragOverlay.measure}),Me=(a=ie.nodeRef.current)!=null?a:ye,Ce=te?(o=ie.rect)!=null?o:ve:null,je=!!(ie.nodeRef.current&&ie.rect),qe=q2(je?null:ve),Ct=N0(Me?as(Me):null),ft=W2(te?Ee??ye:null),$t=X2(ft),Hi=aE(C,{transform:{x:fe.x-qe.x,y:fe.y-qe.y,scaleX:1,scaleY:1},activatorEvent:W,active:O,activeNodeRect:ve,containerNodeRect:ze,draggingNodeRect:Ce,over:Re.current.over,overlayNodeRect:ie.rect,scrollableAncestors:ft,scrollableAncestorRects:$t,windowRect:Ct}),$s=xe?Ga(xe,fe):null,rt=$2(ft),li=gb(rt),Zi=gb(rt,[ve]),gi=Ga(Hi,li),zt=Ce?_2(Ce,Hi):null,Ui=O&&zt?b({active:O,collisionRect:zt,droppableRects:ae,droppableContainers:R,pointerCoordinates:$s}):null,vi=h2(Ui,"id"),[$,He]=v.useState(null),Qe=je?Hi:Ga(Hi,Zi),lt=p2(Qe,(c=$?.rect)!=null?c:null,ve),Jt=v.useRef(null),jt=v.useCallback((bt,xt)=>{let{sensor:Ht,options:ci}=xt;if(j.current==null)return;const Yt=re.get(j.current);if(!Yt)return;const ei=bt.nativeEvent,ui=new Ht({active:j.current,activeNode:Yt,event:ei,options:ci,context:Re,onAbort(Et){if(!re.get(Et))return;const{onDragAbort:Vt}=me.current,Ai={id:Et};Vt?.(Ai),H({type:"onDragAbort",event:Ai})},onPending(Et,qi,Vt,Ai){if(!re.get(Et))return;const{onDragPending:Pi}=me.current,yi={id:Et,constraint:qi,initialCoordinates:Vt,offset:Ai};Pi?.(yi),H({type:"onDragPending",event:yi})},onStart(Et){const qi=j.current;if(qi==null)return;const Vt=re.get(qi);if(!Vt)return;const{onDragStart:Ai}=me.current,ot={activatorEvent:ei,active:{id:qi,data:Vt.data,rect:I}};co.unstable_batchedUpdates(()=>{Ai?.(ot),ee(ur.Initializing),k({type:pi.DragStart,initialCoordinates:Et,active:qi}),H({type:"onDragStart",event:ot}),T(Jt.current),F(ei)})},onMove(Et){k({type:pi.DragMove,coordinates:Et})},onEnd:Ni(pi.DragEnd),onCancel:Ni(pi.DragCancel)});Jt.current=ui;function Ni(Et){return async function(){const{active:Vt,collisions:Ai,over:ot,scrollAdjustedTranslate:Pi}=Re.current;let yi=null;if(Vt&&Pi){const{cancelDrop:ut}=me.current;yi={activatorEvent:ei,active:Vt,collisions:Ai,delta:Pi,over:ot},Et===pi.DragEnd&&typeof ut=="function"&&await Promise.resolve(ut(yi))&&(Et=pi.DragCancel)}j.current=null,co.unstable_batchedUpdates(()=>{k({type:Et}),ee(ur.Uninitialized),He(null),T(null),F(null),Jt.current=null;const ut=Et===pi.DragEnd?"onDragEnd":"onDragCancel";if(yi){const bi=me.current[ut];bi?.(yi),H({type:ut,event:yi})}})}}},[re]),oi=v.useCallback((bt,xt)=>(Ht,ci)=>{const Yt=Ht.nativeEvent,ei=re.get(ci);if(j.current!==null||!ei||Yt.dndKit||Yt.defaultPrevented)return;const ui={active:ei};bt(Ht,xt.options,ui)===!0&&(Yt.dndKit={capturedBy:xt.sensor},j.current=ci,jt(Ht,xt))},[re,jt]),Fi=U2(y,oi);Y2(y),_r(()=>{ve&&X===ur.Initializing&&ee(ur.Initialized)},[ve,X]),v.useEffect(()=>{const{onDragMove:bt}=me.current,{active:xt,activatorEvent:Ht,collisions:ci,over:Yt}=Re.current;if(!xt||!Ht)return;const ei={active:xt,activatorEvent:Ht,collisions:ci,delta:{x:gi.x,y:gi.y},over:Yt};co.unstable_batchedUpdates(()=>{bt?.(ei),H({type:"onDragMove",event:ei})})},[gi.x,gi.y]),v.useEffect(()=>{const{active:bt,activatorEvent:xt,collisions:Ht,droppableContainers:ci,scrollAdjustedTranslate:Yt}=Re.current;if(!bt||j.current==null||!xt||!Yt)return;const{onDragOver:ei}=me.current,ui=ci.get(vi),Ni=ui&&ui.rect.current?{id:ui.id,rect:ui.rect.current,data:ui.data,disabled:ui.disabled}:null,Et={active:bt,activatorEvent:xt,collisions:Ht,delta:{x:Yt.x,y:Yt.y},over:Ni};co.unstable_batchedUpdates(()=>{He(Ni),ei?.(Et),H({type:"onDragOver",event:Et})})},[vi]),_r(()=>{Re.current={activatorEvent:W,active:O,activeNode:ye,collisionRect:zt,collisions:Ui,droppableRects:ae,draggableNodes:re,draggingNode:Me,draggingNodeRect:Ce,droppableContainers:K,over:$,scrollableAncestors:ft,scrollAdjustedTranslate:gi},I.current={initial:Ce,translated:zt}},[O,ye,Ui,zt,re,Me,Ce,ae,K,$,ft,gi]),O2({...Fe,delta:fe,draggingRect:zt,pointerCoordinates:$s,scrollableAncestors:ft,scrollableAncestorRects:$t});const an=v.useMemo(()=>({active:O,activeNode:ye,activeNodeRect:ve,activatorEvent:W,collisions:Ui,containerNodeRect:ze,dragOverlay:ie,draggableNodes:re,droppableContainers:K,droppableRects:ae,over:$,measureDroppableContainers:de,scrollableAncestors:ft,scrollableAncestorRects:$t,measuringConfiguration:G,measuringScheduled:ge,windowRect:Ct}),[O,ye,ve,W,Ui,ze,ie,re,K,ae,$,de,ft,$t,G,ge,Ct]),ls=v.useMemo(()=>({activatorEvent:W,activators:Fi,active:O,activeNodeRect:ve,ariaDescribedById:{draggable:we},dispatch:k,draggableNodes:re,over:$,measureDroppableContainers:de}),[W,Fi,O,ve,k,we,re,$,de]);return mi.createElement(g0.Provider,{value:U},mi.createElement(Qu.Provider,{value:ls},mi.createElement(iE.Provider,{value:an},mi.createElement(A0.Provider,{value:lt},p)),mi.createElement(rE,{disabled:f?.restoreFocus===!1})),mi.createElement(o2,{...f,hiddenTextDescribedById:we}));function Ss(){const bt=J?.autoScrollEnabled===!1,xt=typeof _=="object"?_.enabled===!1:_===!1,Ht=te&&!bt&&!xt;return typeof _=="object"?{..._,enabled:Ht}:{enabled:Ht}}}),uE=v.createContext(null),yb="button",hE="Draggable";function L0(e){let{id:t,data:n,disabled:a=!1,attributes:o}=e;const c=Gu(hE),{activators:h,activatorEvent:f,active:_,activeNodeRect:p,ariaDescribedById:y,draggableNodes:b,over:S}=v.useContext(Qu),{role:C=yb,roleDescription:x="draggable",tabIndex:E=0}=o??{},B=_?.id===t,k=v.useContext(B?A0:uE),[H,U]=Mu(),[X,ee]=Mu(),te=V2(h,t),ne=ko(n);_r(()=>(b.set(t,{id:t,key:c,node:H,activatorNode:X,data:ne}),()=>{const fe=b.get(t);fe&&fe.key===c&&b.delete(t)}),[b,t]);const re=v.useMemo(()=>({role:C,tabIndex:E,"aria-disabled":a,"aria-pressed":B&&C===yb?!0:void 0,"aria-roledescription":x,"aria-describedby":y.draggable}),[a,C,E,B,x,y.draggable]);return{active:_,activatorEvent:f,activeNodeRect:p,attributes:re,isDragging:B,listeners:a?void 0:te,node:H,over:S,setNodeRef:U,setActivatorNodeRef:ee,transform:k}}const dE="Droppable",fE={timeout:25};function B0(e){let{data:t,disabled:n=!1,id:a,resizeObserverConfig:o}=e;const c=Gu(dE),{active:h,dispatch:f,over:_,measureDroppableContainers:p}=v.useContext(Qu),y=v.useRef({disabled:n}),b=v.useRef(!1),S=v.useRef(null),C=v.useRef(null),{disabled:x,updateMeasurementsFor:E,timeout:B}={...fE,...o},k=ko(E??a),H=v.useCallback(()=>{if(!b.current){b.current=!0;return}C.current!=null&&clearTimeout(C.current),C.current=setTimeout(()=>{p(Array.isArray(k.current)?k.current:[k.current]),C.current=null},B)},[B]),U=Zu({callback:H,disabled:x||!h}),X=v.useCallback((re,fe)=>{U&&(fe&&(U.unobserve(fe),b.current=!1),re&&U.observe(re))},[U]),[ee,te]=Mu(X),ne=ko(t);return v.useEffect(()=>{!U||!ee.current||(U.disconnect(),b.current=!1,U.observe(ee.current))},[ee,U]),v.useEffect(()=>(f({type:pi.RegisterDroppable,element:{id:a,key:c,disabled:n,node:ee,rect:S,data:ne}}),()=>f({type:pi.UnregisterDroppable,key:c,id:a})),[a]),v.useEffect(()=>{n!==y.current.disabled&&(f({type:pi.SetDroppableDisabled,id:a,key:c,disabled:n}),y.current.disabled=n)},[a,c,n,f]),{active:h,rect:S,isOver:_?.id===a,node:ee,over:_,setNodeRef:te}}const pE=128,mE=512,_E=64,gE=4096;function O0(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>pE)return null;const n=t.workspaces.map(vE);return n.some(a=>a===null)?null:{activeWorkspaceId:t.activeWorkspaceId,workspaces:n}}function vE(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>mE)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=bE(t.root);return n?{id:t.id,title:t.title,activeTerminalId:t.activeTerminalId,root:n}:null}function bE(e){if(!e||typeof e!="object")return null;let t=0;return rp(e,1,()=>(t+=1,t<=gE))}function rp(e,t,n){if(!e||typeof e!="object"||t>_E||!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=rp(a.first,t+1,n),c=rp(a.second,t+1,n);return!o||!c?null:{type:"split",direction:a.direction,ratio:SE(a.ratio),first:o,second:c}}function SE(e){return typeof e=="number"&&Number.isFinite(e)?Math.min(.9,Math.max(.1,e)):.5}const z0=[{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 bb(e){return e===void 0?"unknown":e==="error"?"offline":"ok"}function Sb(e){const t=e.trim();return t?t.charAt(0).toUpperCase():"?"}const wb="Local",wE=3e4,CE=2,j0="nterminal.serverList.viewMode.v1";function xE(){try{return window.localStorage.getItem(j0)==="list"?"list":"stats"}catch{return"stats"}}function EE(e){try{window.localStorage.setItem(j0,e)}catch{}}function vu(e){return e===void 0?"":e==="error"?"offline":[`CPU ${zs(e.cpuPercent)} ${Hm(e)}`,`MEM ${zs(e.memoryPercent)} ${An(e.memoryUsedBytes,e.memoryTotalBytes)}`,`DISK ${zs(e.diskPercent)} ${An(e.diskUsedBytes,e.diskTotalBytes)}`,`SWAP ${zs(e.swapPercent)} ${An(e.swapUsedBytes,e.swapTotalBytes)}`].join(" · ")}function TE(e){if(!(e===void 0||e==="error"))return[`CPU ${zs(e.cpuPercent)} (${Hm(e)})`,`RAM ${zs(e.memoryPercent)} (${An(e.memoryUsedBytes,e.memoryTotalBytes)})`,`Disk ${zs(e.diskPercent)} (${An(e.diskUsedBytes,e.diskTotalBytes)})`,`Swap ${zs(e.swapPercent)} (${An(e.swapUsedBytes,e.swapTotalBytes)})`].join(" · ")}function Cb(e,t){const n=vu(t);return`${e}${n?` — ${n}`:""}. Double-click to rename.`}function zs(e){return typeof e=="number"&&Number.isFinite(e)?`${Math.round(e)}%`:"–"}function Hm(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`:`${ap(e.cpuPercent/100*t)}/${t} cores`}function An(e,t){return!xb(e)||!xb(t)?"–/–":kE(e,t)}function kE(e,t){const n=t>=1073741824?"GB":t>=1048576?"MB":"KB",a=n==="GB"?1024**3:n==="MB"?1024**2:1024;return`${ap(e/a)}/${ap(t/a)} ${n}`}function ap(e){return e>=10||Number.isInteger(e)?e.toFixed(0):e.toFixed(1)}function xb(e){return typeof e=="number"&&Number.isFinite(e)&&e>=0}function nu(e){return typeof e!="number"||!Number.isFinite(e)?"normal":e>95?"danger":e>90?"warning":"normal"}function DE(e){return[{label:"CPU",percent:zs(e.cpuPercent),detail:Hm(e),tone:nu(e.cpuPercent)},{label:"MEM",percent:zs(e.memoryPercent),detail:An(e.memoryUsedBytes,e.memoryTotalBytes),tone:nu(e.memoryPercent)},{label:"DISK",percent:zs(e.diskPercent),detail:An(e.diskUsedBytes,e.diskTotalBytes),tone:nu(e.diskPercent)},{label:"SWAP",percent:zs(e.swapPercent),detail:An(e.swapUsedBytes,e.swapTotalBytes),tone:nu(e.swapPercent)}]}function Eb({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:TE(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 Ef({api:e,activeAgentId:t,onSelectServer:n,onSessionInvalid:a,refreshToken:o=0,compact:c=!1}){const[h,f]=v.useState([]),[_,p]=v.useState(null),[y,b]=v.useState(null),[S,C]=v.useState(""),x=v.useRef(null),[E,B]=v.useState(()=>xE()),[k,H]=v.useState({}),U=v.useRef({});v.useEffect(()=>{let A=!1;return e.listAgents().then(I=>{A||f(I.agents)}).catch(()=>{}),e.getMainInfo().then(I=>{A||p(I.name)}).catch(()=>{}),()=>{A=!0}},[e,o]),v.useEffect(()=>{y&&(x.current?.focus(),x.current?.select())},[y]),v.useEffect(()=>{let A=!1;function I(){const j=[{key:"__main__",load:()=>e.getMainStats()},...h.map(T=>({key:T.id,load:()=>e.getAgentStats(T.id)}))],J=new Set(j.map(T=>T.key));for(const T of Object.keys(U.current))J.has(T)||delete U.current[T];H(T=>{const W={};for(const F of J)F in T&&(W[F]=T[F]);return W});for(const T of j)T.load().then(W=>{A||(U.current[T.key]=0,H(F=>J.has(T.key)?{...F,[T.key]:W}:F))}).catch(W=>{if(A)return;if(W instanceof Nn&&W.status===401&&T.key==="__main__"){a?.({source:"main-stats-401",status:401,activeAgentId:null});return}const F=(U.current[T.key]??0)+1;U.current[T.key]=F,F>=CE&&H(me=>J.has(T.key)?{...me,[T.key]:"error"}:me)})}I();const O=window.setInterval(I,wE);return()=>{A=!0,window.clearInterval(O)}},[e,h,a]);function X(A){A==="main"?(C(_??""),b({kind:"main"})):(C(A.name),b({kind:"agent",id:A.id}))}async function ee(){if(!y)return;const A=S.trim(),I=y;if(b(null),I.kind==="main"){const O=A||"";try{const j=await e.renameMain(O);p(j.name)}catch{}}else{if(!A)return;const O=h.find(j=>j.id===I.id)?.name;f(j=>j.map(J=>J.id===I.id?{...J,name:A}:J));try{await e.renameAgent(I.id,A)}catch{O!==void 0&&f(j=>j.map(J=>J.id===I.id?{...J,name:O}:J))}}}function te(){b(null)}function ne(A){B(A),EE(A)}const re=_?.trim()||wb,fe=y?.kind==="main",K=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":re,title:`${re}${vu(k.__main__)?` — ${vu(k.__main__)}`:""}`,children:[m.jsx("span",{className:"server-list-chip-initial",children:Sb(re)}),m.jsx("span",{className:"server-list-chip-pip","data-status":bb(k.__main__)})]}),h.map(A=>{const I=k[A.id],O=vu(I);return m.jsxs("button",{type:"button",className:`server-list-chip${t===A.id?" server-list-chip--active":""}`,onClick:()=>n(A.id),"aria-label":A.name,title:`${A.name}${O?` — ${O}`:""}`,children:[m.jsx("span",{className:"server-list-chip-initial",children:Sb(A.name)}),m.jsx("span",{className:"server-list-chip-pip","data-status":bb(I)})]},A.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:()=>ne("list"),title:"Show server names only",children:"List"}),m.jsx("button",{type:"button",className:"server-list-view-button","aria-pressed":E==="stats",onClick:()=>ne("stats"),title:"Show resource usage",children:"Stats"})]}),m.jsx("div",{className:"server-list-row",children:fe?m.jsx("form",{className:"server-list-editor",onSubmit:A=>{A.preventDefault(),ee()},children:m.jsx("input",{ref:x,"aria-label":"Rename main server",value:S,onChange:A=>C(A.target.value),onBlur:()=>{ee()},onKeyDown:A=>{A.key==="Escape"&&(A.preventDefault(),te())},placeholder:wb})}):m.jsxs("button",{type:"button",className:`server-list-item${t===null?" server-list-item--active":""}`,onClick:()=>n(null),onDoubleClick:A=>{A.preventDefault(),X("main")},title:Cb(re,k.__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:re})]}),K?m.jsx(Eb,{entry:k.__main__}):null]})}),h.map(A=>{const I=y?.kind==="agent"&&y.id===A.id;return m.jsx("div",{className:"server-list-row",children:I?m.jsx("form",{className:"server-list-editor",onSubmit:O=>{O.preventDefault(),ee()},children:m.jsx("input",{ref:x,"aria-label":`Rename ${A.name}`,value:S,onChange:O=>C(O.target.value),onBlur:()=>{ee()},onKeyDown:O=>{O.key==="Escape"&&(O.preventDefault(),te())}})}):m.jsxs("button",{type:"button",className:`server-list-item${t===A.id?" server-list-item--active":""}`,onClick:()=>n(A.id),onDoubleClick:O=>{O.preventDefault(),X({id:A.id,name:A.name})},title:Cb(A.name,k[A.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:A.url,children:A.name})]}),K?m.jsx(Eb,{entry:k[A.id]}):null]})},A.id)})]})}function RE({api:e}){const[t,n]=v.useState([]),[a,o]=v.useState([]),[c,h]=v.useState(!1),[f,_]=v.useState(null),[p,y]=v.useState(""),[b,S]=v.useState("");async function C(){try{const[k,H,U]=await Promise.all([e.listDevices(),e.listNetworks(),e.getSession()]);n(k.devices),o(H.networks),h(U.totpEnabled),_(null)}catch(k){_(k instanceof Error?k.message:"Failed to load")}}v.useEffect(()=>{C()},[]);async function x(k){await e.revokeDevice(k),await C()}async function E(k){await e.removeNetwork(k),await C()}async function B(k){k.preventDefault(),_(null);try{await e.addNetwork({value:p.trim(),label:b.trim()}),y(""),S(""),await C()}catch(H){_(H instanceof Error?H.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(k=>m.jsxs("li",{children:[m.jsxs("div",{children:[m.jsxs("span",{className:"security-item-label",children:[k.label,k.current?m.jsx("span",{className:"security-badge",children:"this device"}):null]}),m.jsxs("span",{className:"security-item-meta",children:["last seen ",new Date(k.lastSeenAt).toLocaleString()]})]}),m.jsx("button",{type:"button",className:"security-remove",onClick:()=>{x(k.id)},children:"revoke"})]},k.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(k=>m.jsxs("li",{children:[m.jsxs("div",{children:[m.jsx("span",{className:"security-item-label",children:k.value}),k.label!==k.value?m.jsx("span",{className:"security-item-meta",children:k.label}):null]}),m.jsx("button",{type:"button",className:"security-remove",onClick:()=>{E(k.id)},children:"remove"})]},k.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:k=>y(k.currentTarget.value),required:!0}),m.jsx("input",{type:"text",placeholder:"Label (optional)",value:b,onChange:k=>S(k.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 C()},children:"Disable 2FA"})]}):null]})}const Um="nterminal.clientDiagnostics.v1",H0=150,ME=24,NE=160;let Tb=!1,Ql=null;function AE(){Tb||typeof window>"u"||(Tb=!0,ys("page.load",{navigation:WE(),visibility:document.visibilityState,online:navigator.onLine,viewport:P0(),standalone:qE()}),document.addEventListener("visibilitychange",()=>{ys("page.visibility",{visibility:document.visibilityState,online:navigator.onLine})}),window.addEventListener("pageshow",e=>{ys("page.show",{persisted:e.persisted,visibility:document.visibilityState,online:navigator.onLine})}),window.addEventListener("pagehide",e=>{ys("page.hide",{persisted:e.persisted,visibility:document.visibilityState,online:navigator.onLine})}),window.addEventListener("online",()=>ys("network.online")),window.addEventListener("offline",()=>ys("network.offline")),window.addEventListener("focus",()=>ys("window.focus")),window.addEventListener("blur",()=>ys("window.blur")),window.addEventListener("error",e=>{ys("runtime.error",{message:e.message,source:$E(e.filename),line:e.lineno||null})}),window.addEventListener("unhandledrejection",e=>{ys("runtime.unhandledrejection",{reason:YE(e.reason)})}))}function ys(e,t={}){const n={at:new Date().toISOString(),event:eh(e,80),data:U0({...t,visibility:t.visibility??KE(),online:t.online??FE(),viewport:t.viewport??P0()})},a=$r();return a.push(n),zE(a.slice(-H0)),n}function $r(){try{const e=window.localStorage.getItem(Um);if(!e)return[];const t=JSON.parse(e);return Array.isArray(t)?t.map(jE).filter(n=>n!==null).slice(-H0):[]}catch{return[]}}function LE(){try{window.localStorage.removeItem(Um)}catch{}}function BE(){const e=$r();return JSON.stringify({generatedAt:new Date().toISOString(),eventCount:e.length,events:e},null,2)}async function OE(){const e=BE();return navigator.clipboard?.writeText?(await navigator.clipboard.writeText(e),!0):VE(e)}async function Ju(e,t=fetch){if(Ql)return Ql;const n=$r(),a={reason:eh(e,80),events:n},o=JSON.stringify(a);Ql=(async()=>{const c=await t("/api/client-diagnostics",{method:"POST",headers:{"content-type":"application/json"},credentials:"same-origin",keepalive:o.length<48e3,body:o});if(!c.ok)throw new Error(`diagnostics_send_failed_${c.status}`);return c.json()})();try{return await Ql}finally{Ql=null}}function zE(e){try{window.localStorage.setItem(Um,JSON.stringify(e))}catch{}}function jE(e){if(!e||typeof e!="object")return null;const t=e;return typeof t.at!="string"||typeof t.event!="string"?null:{at:t.at.slice(0,40),event:eh(t.event,80),...t.data&&typeof t.data=="object"?{data:U0(t.data)}:{}}}function U0(e){const t={};for(const[n,a]of Object.entries(e).slice(0,ME)){const o=eh(n,64);if(!o||HE(o))continue;const c=UE(a);c!==void 0&&(t[o]=c)}return t}function HE(e){return/(?:password|secret|token|cookie|authorization|sessionid|session_id|nterminal_session|nterminal_device)/i.test(e)}function UE(e){if(typeof e=="string")return PE(e,NE);if(typeof e=="number")return Number.isFinite(e)?e:null;if(typeof e=="boolean"||e===null)return e}function eh(e,t){return e.replace(/[^a-zA-Z0-9_.:-]/g,"_").slice(0,t)}function PE(e,t){return IE(e).replace(/[\r\n\t]+/g," ").replace(/[^\x20-\x7E]/g,"_").slice(0,t)}function IE(e){return e.replace(/https?:\/\/[^\s"'<>]+/gi,"[url]").replace(/\bBearer\s+[A-Za-z0-9._~+/=-]+/gi,"Bearer [redacted]").replace(/\b[A-Za-z0-9_-]{10,}\.[A-Za-z0-9_-]{10,}\.[A-Za-z0-9_-]{10,}\b/g,"[redacted]").replace(/\b((?:auth|authorization|cookie|password|secret|session|sessionid|session_id|token)[a-z0-9_.:-]*\s*[:=]\s*)[^\s&,;]+/gi,"$1[redacted]").replace(/\b(nterminal_session|nterminal_device)\s*=\s*[^\s;,]+/gi,"$1=[redacted]").replace(/\b[A-Za-z0-9+/_=-]{48,}\b/g,"[redacted]")}function KE(){return typeof document>"u"?void 0:document.visibilityState}function FE(){return typeof navigator>"u"?void 0:navigator.onLine}function P0(){if(typeof window>"u")return;const e=window.innerWidth||0;return e<640?"mobile":e<1024?"tablet":"desktop"}function qE(){return typeof window>"u"?!1:window.matchMedia?.("(display-mode: standalone)").matches===!0||navigator.standalone===!0}function WE(){return performance.getEntriesByType?.("navigation")?.[0]?.type??"unknown"}function $E(e){if(!e)return null;try{const t=new URL(e);return t.pathname.split("/").pop()||t.pathname}catch{return e.split("/").pop()??e}}function YE(e){return e instanceof Error?e.message||e.name:typeof e=="string"?e:typeof e}function VE(e){const t=document.createElement("textarea");t.value=e,t.setAttribute("readonly","true"),t.style.position="fixed",t.style.left="-9999px",document.body.appendChild(t),t.select();let n=!1;try{n=document.execCommand("copy")}finally{document.body.removeChild(t)}return n}const I0="nterminal.notifications.completionEnabled",Pm="nterminal.notifications.completionToastEnabled",Im="nterminal.notifications.completionToastDurationSeconds",Km="nterminal.notifications.completionToastPersistent",lp="nterminal:completion-toast-display",wo=6.5,op=2,cp=60;function th(){return typeof window<"u"&&"Notification"in window}function K0(){try{return window.localStorage.getItem(I0)==="true"}catch{return!1}}function kb(e){try{window.localStorage.setItem(I0,e?"true":"false")}catch{}}function Zr(){return{enabled:QE(),durationSeconds:ZE(),persistUntilDismissed:JE()}}function XE(e){if(typeof window<"u"){try{window.localStorage.setItem(Pm,e?"true":"false")}catch{}qm()}return Zr()}function Db(e){const t=q0(e);if(typeof window<"u"){try{window.localStorage.setItem(Im,String(t))}catch{}qm()}return Zr()}function GE(e){if(typeof window<"u"){try{window.localStorage.setItem(Km,e?"true":"false")}catch{}qm()}return Zr()}function F0(e){if(typeof window>"u")return()=>{};const t=n=>{(n.key===Pm||n.key===Im||n.key===Km)&&e()};return window.addEventListener(lp,e),window.addEventListener("storage",t),()=>{window.removeEventListener(lp,e),window.removeEventListener("storage",t)}}function Fm(){return th()?window.Notification.permission:"unsupported"}function ZE(){if(typeof window>"u")return wo;try{const e=window.localStorage.getItem(Im);return e===null?wo:q0(Number(e))}catch{return wo}}function QE(){if(typeof window>"u")return!0;try{return window.localStorage.getItem(Pm)!=="false"}catch{return!0}}function JE(){if(typeof window>"u")return!1;try{return window.localStorage.getItem(Km)==="true"}catch{return!1}}function q0(e){if(!Number.isFinite(e))return wo;const t=Math.round(e*2)/2;return Math.max(op,Math.min(cp,t))}function qm(){typeof window<"u"&&window.dispatchEvent(new CustomEvent(lp))}async function eT(){if(!th())return"unsupported";try{return await window.Notification.requestPermission()}catch{return Fm()}}function tT(e){if(!th()||Fm()!=="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 iT=1500,Wm="nterminal.terminal.fontSize",$m="nterminal.terminal.fontFamily",up="nterminal:terminal-font-size",hp="nterminal:terminal-font-family",dp=11,fp=20,Vr=14,Bu=[{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:[]}],Ja="meslo";pp(Ja);async function Tf(e=Vr,t=Ja){if(typeof document>"u"||!document.fonts)return;const n=Y0(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,iT)})])}function W0(e){const t=typeof e=="number"?e:Number(e);if(!Number.isFinite(t))return Vr;const n=Math.round(t);return Math.max(dp,Math.min(fp,n))}function $0(e){return Bu.some(t=>t.id===e)?e:Ja}function pp(e){return Y0(e).cssFamily}function Y0(e){return Bu.find(t=>t.id===e)??Bu[0]}function mp(){if(typeof window>"u")return Vr;try{const e=window.localStorage.getItem(Wm);return e?W0(e):Vr}catch{return Vr}}function _p(){if(typeof window>"u")return Ja;try{return $0(window.localStorage.getItem($m))}catch{return Ja}}function ru(e){const t=W0(e);if(typeof window>"u")return t;try{window.localStorage.setItem(Wm,String(t))}catch{}return window.dispatchEvent(new CustomEvent(up,{detail:t})),t}function sT(e){const t=$0(e);if(typeof window>"u")return t;try{window.localStorage.setItem($m,t)}catch{}return window.dispatchEvent(new CustomEvent(hp,{detail:t})),t}function V0(e){if(typeof window>"u")return()=>{};const t=n=>{n.key===Wm&&e()};return window.addEventListener(up,e),window.addEventListener("storage",t),()=>{window.removeEventListener(up,e),window.removeEventListener("storage",t)}}function X0(e){if(typeof window>"u")return()=>{};const t=n=>{n.key===$m&&e()};return window.addEventListener(hp,e),window.addEventListener("storage",t),()=>{window.removeEventListener(hp,e),window.removeEventListener("storage",t)}}const Ym="nterminal.terminal.showScrollProgress",gp="nterminal:terminal-scroll-progress";function vp(){if(typeof window>"u")return!0;try{return window.localStorage.getItem(Ym)!=="false"}catch{return!0}}function nT(e){if(typeof window<"u"){try{window.localStorage.setItem(Ym,e?"true":"false")}catch{}window.dispatchEvent(new CustomEvent(gp,{detail:e}))}return e}function G0(e){if(typeof window>"u")return()=>{};const t=n=>{n.key===Ym&&e()};return window.addEventListener(gp,e),window.addEventListener("storage",t),()=>{window.removeEventListener(gp,e),window.removeEventListener("storage",t)}}const Vm="nterminal.shortcuts.workspace.v1",yp="nterminal:workspace-shortcuts",Ro=[{id:"server.previous",label:"Previous server",group:"Servers"},{id:"server.next",label:"Next server",group:"Servers"},{id:"tab.previous",label:"Previous tab",group:"Tabs"},{id:"tab.next",label:"Next tab",group:"Tabs"},{id:"tab.index",label:"Select tab 1-9",group:"Tabs",indexed:!0},{id:"pane.index",label:"Select pane 1-9",group:"Panes",indexed:!0},{id:"split.right",label:"Split right",group:"Panes"},{id:"split.down",label:"Split down",group:"Panes"},{id:"history.toggle",label:"Toggle view history",group:"Panes",requiresPrimaryModifier:!0}],ih={"server.previous":Ei("ArrowUp",{ctrlKey:!0}),"server.next":Ei("ArrowDown",{ctrlKey:!0}),"tab.previous":Ei("ArrowLeft",{ctrlKey:!0}),"tab.next":Ei("ArrowRight",{ctrlKey:!0}),"tab.index":Ei("Digit",{ctrlKey:!0,altKey:!0}),"pane.index":Ei("Digit",{ctrlKey:!0,altKey:!0,shiftKey:!0}),"split.right":Ei("ArrowRight",{ctrlKey:!0,altKey:!0,shiftKey:!0}),"split.down":Ei("ArrowDown",{ctrlKey:!0,altKey:!0,shiftKey:!0}),"history.toggle":Ei("KeyH",{altKey:!0})},rT={"server.previous":Ei("BracketLeft",{ctrlKey:!0,altKey:!0,shiftKey:!0}),"server.next":Ei("BracketRight",{ctrlKey:!0,altKey:!0,shiftKey:!0}),"tab.previous":Ei("BracketLeft",{ctrlKey:!0,altKey:!0}),"tab.next":Ei("BracketRight",{ctrlKey:!0,altKey:!0}),"tab.index":Ei("Digit",{ctrlKey:!0,altKey:!0,shiftKey:!0}),"pane.index":Ei("Digit",{ctrlKey:!0,altKey:!0}),"split.right":Ei("ArrowRight",{ctrlKey:!0,altKey:!0,shiftKey:!0}),"split.down":Ei("ArrowDown",{ctrlKey:!0,altKey:!0,shiftKey:!0}),"history.toggle":Ei("KeyH",{altKey:!0})};function Qr(){const e=J0(ih);if(typeof window>"u")return e;try{const t=window.localStorage.getItem(Vm);if(!t)return e;const n=JSON.parse(t);for(const a of Ro){const o=n[a.id];if(fT(o)){const c=ew(o,a);dT(c,rT[a.id])||(e[a.id]=c)}}}catch{return e}return e}function Rb(){return JSON.stringify(Qr())}function aT(e,t){const n=Qr(),a=Ro.find(o=>o.id===e);return a&&(n[e]=ew(t,a),Zm(n)),n}function lT(e){const t=Qr();return t[e]={...ih[e]},Zm(t),t}function oT(){const e=J0(ih);return Zm(e),e}function Xm(e){if(typeof window>"u")return()=>{};const t=n=>{n.key===Vm&&e()};return window.addEventListener(yp,e),window.addEventListener("storage",t),()=>{window.removeEventListener(yp,e),window.removeEventListener("storage",t)}}function cT(e,t){const n=sw(e);return!n||mT(n)||t.indexed&&iw(e)===null||t.requiresPrimaryModifier&&!tw(e)?null:{ctrlKey:e.ctrlKey,altKey:e.altKey,shiftKey:e.shiftKey,metaKey:e.metaKey,code:t.indexed?"Digit":n}}function Z0(e){const t=Qr();for(const n of Ro){const a=t[n.id];if(!(!a||!pT(e,a))){if(n.indexed){if(a.code!=="Digit")continue;const o=iw(e);if(o!==null)return{id:n.id,index:o};continue}if(sw(e)===a.code)return{id:n.id,index:null}}}return null}function Gm(e){return Q0(Qr()[e])}function Q0(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(_T(e.code)),t.join("+")}const uT=()=>Gm("split.right"),hT=()=>Gm("split.down");function Ei(e,t){return{ctrlKey:t.ctrlKey??!1,altKey:t.altKey??!1,shiftKey:t.shiftKey??!1,metaKey:t.metaKey??!1,code:e}}function J0(e){return Object.fromEntries(Object.entries(e).map(([t,n])=>[t,{...n}]))}function dT(e,t){return e.ctrlKey===t.ctrlKey&&e.altKey===t.altKey&&e.shiftKey===t.shiftKey&&e.metaKey===t.metaKey&&e.code===t.code}function Zm(e){if(!(typeof window>"u")){try{window.localStorage.setItem(Vm,JSON.stringify(e))}catch{}window.dispatchEvent(new CustomEvent(yp))}}function ew(e,t){return t.requiresPrimaryModifier&&!tw(e)?{...ih[t.id]}:{ctrlKey:!!e.ctrlKey,altKey:!!e.altKey,shiftKey:!!e.shiftKey,metaKey:!!e.metaKey,code:t.indexed?"Digit":e.code}}function tw(e){return e.ctrlKey||e.altKey||e.metaKey}function fT(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 pT(e,t){return e.ctrlKey===t.ctrlKey&&e.altKey===t.altKey&&e.shiftKey===t.shiftKey&&e.metaKey===t.metaKey}function iw(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 sw(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 mT(e){return e==="ControlLeft"||e==="ControlRight"||e==="AltLeft"||e==="AltRight"||e==="ShiftLeft"||e==="ShiftRight"||e==="MetaLeft"||e==="MetaRight"}function _T(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 gT="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 vT(e="nterminal",t=new Date){return{reason:"permission",message:gT,command:`sudo npm i -g ${e}@latest --prefer-online && nterminal restart-after-update`,detectedAt:t.toISOString()}}function yT(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 nw=3600*1e3,bT="local",bp=new Set,fr=new Map;let gr={checking:!1,hasUpdates:!1,lastCheckedAt:null},Qm=null,Co=null,Ou=0,cr=null;function ST(e){return bp.add(e),()=>{bp.delete(e)}}function Mb(){return gr}function wT(e){const t=kT();Qm=e,Jm(),Sp(e,t);const n=()=>{if(document.visibilityState!=="visible"||!vr(e,t))return;const a=gr.lastCheckedAt;(a===null||Date.now()-a>=nw)&&Sp(e,t)};return document.addEventListener("visibilitychange",n),()=>{document.removeEventListener("visibilitychange",n),vr(e,t)&&TT()}}function CT(e,t){fr.set(e,rw(t)),el({...gr,hasUpdates:e_(),lastCheckedAt:Date.now()})}function kf(e){e===void 0?fr.clear():fr.set(e,!1),el({...gr,hasUpdates:e_()})}async function Sp(e,t){if(!vr(e,t))return;if(cr&&cr.api===e&&cr.runId===t)return cr.promise;el({...gr,checking:!0});const n=xT(e,t).finally(()=>{cr?.promise===n&&(cr=null),vr(e,t)&&(el({...gr,checking:!1,lastCheckedAt:Date.now()}),ET(e,t))});return cr={api:e,runId:t,promise:n},n}async function xT(e,t){try{const n=await e.listAgents();if(!vr(e,t))return;const a=[{key:bT,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,rw(h))}catch{o.set(c.key,fr.get(c.key)??!1)}})),!vr(e,t))return;fr.clear();for(const[c,h]of o)fr.set(c,h);el({...gr,hasUpdates:e_()})}catch{}}function ET(e,t){vr(e,t)&&(Jm(),Co=window.setTimeout(()=>{Co=null,vr(e,t)&&Sp(e,t)},nw))}function TT(){Ou+=1,Jm(),Qm=null,cr=null,fr.clear(),el({checking:!1,hasUpdates:!1,lastCheckedAt:null})}function Jm(){Co!==null&&(window.clearTimeout(Co),Co=null)}function kT(){return Ou+=1,Ou}function vr(e,t){return Qm===e&&Ou===t}function rw(e){return e.updateAvailable===!0}function e_(){return Array.from(fr.values()).some(Boolean)}function el(e){gr=e;for(const t of Array.from(bp))t()}const DT=e=>new Promise(t=>setTimeout(t,e));function RT({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),[y,b]=v.useState(!1);function S(K,A){c(I=>({...I,[K]:{...I[K],...A}}))}const C=K=>K.id===null?e.getVersion():e.getAgentVersion(K.id),x=K=>K.id===null?e.checkUpdate():e.checkAgentUpdate(K.id),E=K=>K.id===null?e.runUpdate():e.runAgentUpdate(K.id);v.useEffect(()=>{let K=!1;return e.listAgents().then(A=>{if(K)return;const I=[{key:"local",id:null,name:"Local (main)"},...A.agents.map(O=>({key:O.id,id:O.id,name:O.name}))];a(I);for(const O of I)C(O).then(j=>S(O.key,{version:j,manualUpdate:j.manualUpdate??null})).catch(j=>S(O.key,{error:j instanceof Error?j.message:"unreachable"}))}).catch(()=>{}),()=>{K=!0}},[]);async function B(K){S(K.key,{busy:!0,status:"checking…",error:void 0});try{const A=await x(K);CT(K.key,A),S(K.key,{latestVersion:A.latestVersion,updateAvailable:A.updateAvailable,status:ne(A),...A.updateAvailable===!1?{manualUpdate:null}:{},busy:!1})}catch(A){S(K.key,{busy:!1,error:A instanceof Error?A.message:"check failed"})}}async function k(){f(!0),await Promise.all(n.map(K=>B(K))),f(!1)}async function H(K,A){const I=Date.now()+18e4;for(;Date.now()<I;){await DT(3e3);try{const O=await C(K);if(A&&O.runningVersion!==A.runningVersion)return O}catch{}}return null}async function U(K){let A=o[K.key]?.version;if(!A)try{A=await C(K),S(K.key,{version:A,manualUpdate:A.manualUpdate??null})}catch(j){return S(K.key,{busy:!1,error:j instanceof Error?j.message:"version check failed"}),"failed"}S(K.key,{busy:!0,status:"updating…",error:void 0});let I;try{I=await E(K)}catch(j){return S(K.key,{busy:!1,error:j instanceof Error?j.message:"update failed"}),"failed"}if(!I.ok){const j=I.manualUpdate??(yT(I.message)?vT():null);return j?(S(K.key,{busy:!1,status:"manual update required",error:void 0,manualUpdate:j}),"manual"):(S(K.key,{busy:!1,status:void 0,error:I.message}),"failed")}if(!I.changed)return S(K.key,{busy:!1,status:"already up to date",updateAvailable:!1,manualUpdate:null}),kf(K.key),"unchanged";S(K.key,{status:"restarting…"});const O=await H(K,A);return O?(S(K.key,{busy:!1,version:O,updateAvailable:!1,status:"updated",manualUpdate:O.manualUpdate??null}),kf(K.key),K.id===null&&(b(!0),p("Main server updated. Reload the page to use the new client.")),"updated"):(S(K.key,{busy:!1,status:void 0,error:"timed out — check the server log"}),"failed")}async function X(K){if(!(K.id===null||!window.confirm([`Delete secondary server "${K.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
|
-
`)))){S(K.key,{busy:!0,status:"deleting…",error:void 0}),p(null);try{const I=await e.uninstallAgent(K.id);a(O=>O.filter(j=>j.key!==K.key)),c(O=>{const j={...O};return delete j[K.key],j}),kf(K.key),t?.(K.id),p(I.message)}catch(I){S(K.key,{busy:!1,status:void 0,error:I instanceof Error?I.message:"delete failed"})}}}async function ee(){f(!0),p(null);const K=n.filter(T=>T.id!==null),A=n.find(T=>T.id===null),I=await Promise.all(K.map(T=>U(T))),O=I.filter(T=>T==="failed").length;let j=I.filter(T=>T==="manual").length,J=null;if(A&&(J=await U(A),J==="manual"&&(j+=1),J==="updated")){O>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}O>0&&j>0?p("Some servers failed and some need manual update. Check each marked row."):O>0?p("Some secondary servers failed to update. Check their rows and retry."):j>0&&p("Some servers need manual update. Copy and run the command shown on each marked server."),f(!1)}function te(K){return K?K.error?K.error:K.status?K.status:K.manualUpdate?"manual update required":K.version?`v${K.version.version}`:"…":"…"}function ne(K){return K.error?K.error:typeof K.updateAvailable=="boolean"?K.updateAvailable?`latest v${K.latestVersion??"available"}`:"up to date":"unknown"}function re(K){const A=K?.version;return A?`npm package v${A.runningVersion}`:""}async function fe(K,A){try{await MT(A),S(K,{copiedCommand:!0}),window.setTimeout(()=>S(K,{copiedCommand:!1}),1800)}catch(I){S(K,{error:I instanceof Error?I.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:()=>{k()},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,y?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(K=>{const A=o[K.key],I=re(A),O=A?.manualUpdate??null,j=A?.version!==void 0&&A?.updateAvailable!==!1&&!A?.busy&&!h,J=K.id!==null&&!A?.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:K.name}),m.jsxs("span",{className:"security-item-meta",children:[I?`${I} — `:"",te(A)]})]}),O?m.jsxs("div",{className:"server-manual-update",children:[m.jsx("span",{children:O.message}),m.jsxs("div",{className:"server-manual-command",children:[m.jsx("code",{children:O.command}),m.jsx("button",{type:"button",className:"secondary-button",onClick:()=>{fe(K.key,O.command)},children:A?.copiedCommand?"Copied":"Copy"})]})]}):null]}),m.jsxs("div",{className:"server-row-actions",children:[m.jsx("button",{type:"button",className:"secondary-button",onClick:()=>{U(K)},disabled:!j,children:A?.busy?"…":"Update"}),K.id!==null?m.jsx("button",{type:"button",className:"server-delete-button",onClick:()=>{X(K)},disabled:!J,children:"Delete"}):null]})]},K.key)})})]})}async function MT(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 au=[{id:"appearance",label:"Appearance"},{id:"shortcuts",label:"Shortcuts"},{id:"notifications",label:"Notifications"},{id:"security",label:"Security"},{id:"diagnostics",label:"Diagnostics"},{id:"servers",label:"Servers"}];function NT({onClose:e,api:t,updateAvailable:n=!1,onNotificationAssetsChanged:a,onAgentRemoved:o}){const c=v.useMemo(()=>t??Yu(),[t]),[h,f]=v.useState(()=>mp()),[_,p]=v.useState(()=>_p()),[y,b]=v.useState(()=>vp()),[S,C]=v.useState(()=>mr()),[x,E]=v.useState(()=>Qr()),[B,k]=v.useState(null),[H,U]=v.useState(null),[X,ee]=v.useState("appearance"),[te,ne]=v.useState(()=>K0()),[re,fe]=v.useState(()=>Zr()),[K,A]=v.useState(()=>Fm()),[I,O]=v.useState([]),[j,J]=v.useState([]),[T,W]=v.useState([]),[F,me]=v.useState(5*1024*1024),[we,R]=v.useState(!1),[G,ae]=v.useState(null),[de,ge]=v.useState(()=>$r()),[ye,xe]=v.useState(!1),[Fe,he]=v.useState(null),ve=v.useRef(null),ze=v.useRef(null),Re=v.useRef({appearance:null,shortcuts:null,notifications:null,security:null,diagnostics:null,servers:null}),Ee=v.useMemo(()=>new Set(j),[j]),ie=!OT(j,T);v.useEffect(()=>V0(()=>f(mp())),[]),v.useEffect(()=>X0(()=>p(_p())),[]),v.useEffect(()=>G0(()=>b(vp())),[]),v.useEffect(()=>Nm(()=>C(mr())),[]),v.useEffect(()=>Xm(()=>E(Qr())),[]),v.useEffect(()=>F0(()=>fe(Zr())),[]),v.useEffect(()=>{const $=()=>ge($r());$();const He=window.setInterval($,1500);return()=>window.clearInterval(He)},[]),v.useEffect(()=>{if(!B)return;const $=Ro.find(Qe=>Qe.id===B);if(!$)return;const He=Qe=>{if(Qe.preventDefault(),Qe.stopPropagation(),Qe.key==="Escape"){k(null),U(null);return}const lt=cT(Qe,$);if(!lt){U(BT($));return}E(aT(B,lt)),k(null),U(null)};return window.addEventListener("keydown",He,!0),()=>window.removeEventListener("keydown",He,!0)},[B]),v.useEffect(()=>{let $=!1;return c.listNotificationAssets().then(He=>{$||$t(He)}).catch(He=>{$||ae(Ka(He))}),()=>{$=!0}},[c]);function Me($){f(ru(Number($)))}function Ce($){fe(Db(Number($)))}function je($){ee($);const He=ze.current,Qe=Re.current[$];if(!He||!Qe)return;const lt=Math.max(0,Nb(Qe,He)-12);typeof He.scrollTo=="function"?He.scrollTo({top:lt,behavior:"smooth"}):He.scrollTop=lt}function qe(){const $=ze.current;if(!$)return;if($.scrollTop+$.clientHeight>=$.scrollHeight-2){ee(au[au.length-1].id);return}let He="appearance";const Qe=$.scrollTop+Math.min(180,Math.max(48,$.clientHeight*.28));for(const lt of au){const Jt=Re.current[lt.id];Jt&&Nb(Jt,$)<=Qe&&(He=lt.id)}ee(He)}function Ct($){E(lT($)),k(null),U(null)}function ft(){E(oT()),k(null),U(null)}function $t($){const He=$.assets.filter(Qe=>Qe.enabled).map(Qe=>Qe.id);O($.assets),J(He),W(He),me($.maxFileBytes),ae(null)}async function Hi(){if(te){kb(!1),ne(!1);return}let $=K;$==="default"&&($=await eT(),A($)),$==="granted"&&(kb(!0),ne(!0))}async function $s($){const He=$?.[0];if(He){if(He.size>F){ae(`File must be ${Df(F)} or smaller.`),li();return}if(He.type!=="video/mp4"&&He.type!=="video/webm"){ae("Upload an MP4 or WebM video."),li();return}R(!0),ae(null);try{await c.uploadNotificationAsset(He),$t(await c.listNotificationAssets()),a?.()}catch(Qe){ae(Ka(Qe))}finally{R(!1),li()}}}async function rt($){R(!0),ae(null);try{await c.deleteNotificationAsset($),$t(await c.listNotificationAssets()),a?.()}catch(He){ae(Ka(He))}finally{R(!1)}}function li(){ve.current&&(ve.current.value="")}function Zi($,He){const Qe=new Set(j);if(He?Qe.add($):Qe.delete($),Qe.size===0){ae("Keep at least one toast video selected.");return}ae(null),J(Array.from(Qe))}async function gi(){if(j.length===0){ae("Keep at least one toast video selected.");return}R(!0),ae(null);try{const $=await c.updateNotificationAssetSelection({enabledAssetIds:j});$t($),a?.()}catch($){ae(Ka($))}finally{R(!1)}}async function zt(){he(null),xe(!0);try{const $=await OE();he($?"Diagnostics copied.":"Copy failed in this browser."),ge($r())}catch($){he(Ka($))}finally{xe(!1)}}async function Ui(){he(null),xe(!0);try{const $=await Ju("manual-settings");he(`Sent ${$.accepted} diagnostic events.`),ge($r())}catch($){he(Ka($))}finally{xe(!1)}}function vi(){LE(),ge([]),he("Diagnostics cleared.")}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:$=>$.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:au.map($=>m.jsxs("button",{type:"button","data-active":X===$.id?"true":"false","aria-current":X===$.id?"true":void 0,onClick:()=>je($.id),children:[$.label,$.id==="servers"&&n?m.jsx("span",{className:"update-pulse-dot settings-update-dot","aria-hidden":"true"}):null]},$.id))}),m.jsxs("div",{ref:ze,className:"settings-content",onScroll:qe,children:[m.jsxs("section",{id:"settings-appearance",ref:$=>{Re.current.appearance=$},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:Ru.map($=>m.jsxs("button",{type:"button",className:"settings-theme-card",role:"radio","aria-checked":S===$.id,"data-active":S===$.id?"true":"false",onClick:()=>C(Wx($.id)),style:{"--settings-theme-bg":$.tokens.bg,"--settings-theme-bg-2":$.tokens.bg2,"--settings-theme-sidebar":$.tokens.bgSidebar,"--settings-theme-line":$.tokens.line,"--settings-theme-fg":$.tokens.fg,"--settings-theme-fg-2":$.tokens.fg2,"--settings-theme-accent":$.tokens.accent,"--settings-theme-xterm-bg":$.xterm.background,"--settings-theme-xterm-fg":$.xterm.foreground,"--settings-theme-xterm-selection":$.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:$.label}),m.jsx("small",{children:$.description})]})]},$.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:dp,max:fp,step:1,value:h,"aria-label":"Terminal font size",onChange:$=>Me($.currentTarget.value)})]}),m.jsxs("div",{className:"settings-stepper-row",children:[m.jsx("button",{type:"button",className:"secondary-button settings-stepper-button",onClick:()=>f(ru(h-1)),children:"-"}),m.jsx("input",{type:"number",min:dp,max:fp,step:1,value:h,"aria-label":"Terminal font size value",onChange:$=>Me($.currentTarget.value)}),m.jsx("button",{type:"button",className:"secondary-button settings-stepper-button",onClick:()=>f(ru(h+1)),children:"+"}),m.jsx("button",{type:"button",className:"secondary-button settings-reset-button",onClick:()=>f(ru(Vr)),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:$=>p(sT($.currentTarget.value)),children:Bu.map($=>m.jsx("option",{value:$.id,children:$.label},$.id))})]}),m.jsxs("label",{className:"auth-checkbox settings-checkbox",children:[m.jsx("input",{type:"checkbox",checked:y,onChange:$=>b(nT($.currentTarget.checked))}),"Show scroll progress"]})]}),m.jsxs("section",{id:"settings-shortcuts",ref:$=>{Re.current.shortcuts=$},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:ft,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."}),H?m.jsx("p",{className:"settings-error",children:H}):null,m.jsx("ul",{className:"settings-shortcut-list","aria-label":"Workspace shortcuts",children:Ro.map($=>{const He=B===$.id;return m.jsxs("li",{children:[m.jsxs("div",{children:[m.jsx("span",{className:"settings-shortcut-label",children:$.label}),m.jsx("span",{className:"settings-shortcut-group",children:$.group})]}),m.jsxs("div",{className:"settings-shortcut-actions",children:[m.jsx("button",{type:"button",className:"settings-shortcut-recorder","data-recording":He?"true":"false",onClick:()=>{k($.id),U(null)},children:He?"Press keys…":Q0(x[$.id])}),m.jsx("button",{type:"button",className:"secondary-button settings-shortcut-reset",onClick:()=>Ct($.id),children:"Reset"})]})]},$.id)})})]}),m.jsxs("section",{id:"settings-notifications",ref:$=>{Re.current.notifications=$},className:"security-section settings-section",children:[m.jsx("h3",{children:"Notifications"}),th()?m.jsxs(m.Fragment,{children:[m.jsxs("label",{className:"auth-checkbox",children:[m.jsx("input",{type:"checkbox",checked:te&&K==="granted",onChange:()=>{Hi()},disabled:K==="denied"}),"System notification when page is hidden"]}),K==="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:re.enabled,onChange:$=>fe(XE($.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:re.persistUntilDismissed?"Until closed":`${re.durationSeconds}s`}),m.jsx("input",{type:"range",min:op,max:cp,step:.5,value:re.durationSeconds,disabled:!re.enabled||re.persistUntilDismissed,"aria-label":"Completion toast duration",onChange:$=>Ce($.currentTarget.value)})]}),m.jsxs("div",{className:"settings-stepper-row settings-duration-row",children:[m.jsx("input",{type:"number",min:op,max:cp,step:.5,value:re.durationSeconds,disabled:!re.enabled||re.persistUntilDismissed,"aria-label":"Completion toast duration value",onChange:$=>Ce($.currentTarget.value)}),m.jsx("button",{type:"button",className:"secondary-button settings-reset-button",disabled:!re.enabled||re.persistUntilDismissed,onClick:()=>fe(Db(wo)),children:"Reset"})]}),m.jsxs("label",{className:"auth-checkbox settings-checkbox",children:[m.jsx("input",{type:"checkbox",checked:re.persistUntilDismissed,disabled:!re.enabled,onChange:$=>fe(GE($.currentTarget.checked))}),"Keep toast until dismissed"]}),m.jsxs("div",{className:"settings-assets-header",children:[m.jsx("span",{children:"Toast videos"}),m.jsxs("span",{children:[Df(F)," max"]})]}),m.jsx("input",{ref:ve,type:"file",accept:"video/mp4,video/webm",className:"settings-asset-input","aria-label":"Upload toast video",onChange:$=>{$s($.currentTarget.files)}}),m.jsx("button",{type:"button",className:"secondary-button settings-upload-button",disabled:we,onClick:()=>ve.current?.click(),children:"Upload video"}),G?m.jsx("p",{className:"settings-error",children:G}):null,I.length>0?m.jsx("ul",{className:"settings-asset-list","aria-label":"Toast videos",children:I.map($=>m.jsxs("li",{"data-enabled":Ee.has($.id)?"true":"false",children:[m.jsxs("label",{className:"settings-asset-choice",children:[m.jsx("input",{type:"checkbox",checked:Ee.has($.id),disabled:we,"aria-label":`Use ${$.filename}`,onChange:He=>Zi($.id,He.currentTarget.checked)}),m.jsx("video",{src:$.url,muted:!0,autoPlay:!0,loop:!0,playsInline:!0,"aria-hidden":"true"}),m.jsxs("span",{className:"settings-asset-copy",children:[m.jsx("span",{children:$.filename}),m.jsx("small",{children:$.source==="built-in"?"Built-in":Df($.size)})]})]}),$.source==="uploaded"?m.jsx("button",{type:"button",className:"secondary-button settings-asset-delete",disabled:we,"aria-label":`Delete ${$.filename}`,onClick:()=>{rt($.id)},children:"x"}):null]},$.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:we||I.length===0||!ie,onClick:()=>{gi()},children:"Save selected videos"})]}),m.jsx("div",{id:"settings-security",ref:$=>{Re.current.security=$},className:"settings-section-group",children:m.jsx(RE,{api:c})}),m.jsxs("section",{id:"settings-diagnostics",ref:$=>{Re.current.diagnostics=$},className:"security-section settings-section",children:[m.jsxs("div",{className:"settings-section-heading",children:[m.jsxs("div",{children:[m.jsx("h3",{children:"Diagnostics"}),m.jsx("p",{className:"muted settings-control-description",children:"Recent browser lifecycle and auth transition events for troubleshooting."})]}),m.jsx("span",{className:"settings-diagnostics-count",children:de.length})]}),m.jsxs("div",{className:"settings-diagnostics-actions",children:[m.jsx("button",{type:"button",className:"secondary-button",disabled:ye||de.length===0,onClick:()=>{zt()},children:"Copy"}),m.jsx("button",{type:"button",className:"secondary-button",disabled:ye||de.length===0,onClick:()=>{Ui()},children:"Send"}),m.jsx("button",{type:"button",className:"secondary-button",disabled:ye||de.length===0,onClick:vi,children:"Clear"})]}),Fe?m.jsx("p",{className:"settings-status",children:Fe}):null,de.length>0?m.jsx("ol",{className:"settings-diagnostics-list","aria-label":"Recent diagnostics",children:de.slice(-8).reverse().map(($,He)=>m.jsxs("li",{children:[m.jsx("span",{children:AT($.at)}),m.jsx("strong",{children:$.event}),$.data?m.jsx("code",{children:LT($.data)}):null]},`${$.at}:${$.event}:${He}`))}):m.jsx("p",{className:"muted",children:"No diagnostics recorded yet."})]}),m.jsx("div",{id:"settings-servers",ref:$=>{Re.current.servers=$},className:"settings-section-group",children:m.jsx(RT,{api:c,...o?{onAgentRemoved:o}:{}})})]})]})]})})}function Nb(e,t){const n=e.getBoundingClientRect(),a=t.getBoundingClientRect();return n.top-a.top+t.scrollTop}function Df(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 Ka(e){return e instanceof Error?e.message:"Request failed."}function AT(e){const t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit"})}function LT(e){return Object.entries(e).slice(0,5).map(([t,n])=>`${t}=${String(n)}`).join(" ")}function BT(e){return e.indexed?"Press a shortcut ending in a number from 1 to 9.":e.requiresPrimaryModifier?"Use Ctrl, Alt, or Meta with another key.":"Press a complete shortcut."}function OT(e,t){if(e.length!==t.length)return!1;const n=new Set(t);return e.every(a=>n.has(a))}class Ur extends Error{constructor(t,n){super(n),this.status=t,this.name="UploadClientError"}status}function zT(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",y)},_=b=>{h||(h=!0,f(),o(b))},p=b=>{h||(h=!0,f(),c(b))},y=()=>{t.abort(),p(new Ur(0,"Upload aborted."))};if(e.signal?.aborted){p(new Ur(0,"Upload aborted."));return}e.signal?.addEventListener("abort",y,{once:!0}),t.open("POST","/api/uploads"),t.withCredentials=!0,t.upload.onprogress=b=>{if(e.onProgress){if(b.lengthComputable&&b.total>0){e.onProgress({loaded:b.loaded,total:b.total,percent:Math.round(b.loaded/b.total*100)});return}e.onProgress({loaded:b.loaded,total:null,percent:null})}},t.onload=()=>{if(t.status>=200&&t.status<300){try{_(JSON.parse(t.responseText))}catch{p(new Ur(t.status,"Invalid upload response."))}return}p(new Ur(t.status,jT(t.responseText,t.statusText||`HTTP ${t.status}`)))},t.onerror=()=>p(new Ur(0,"Upload failed.")),t.onabort=()=>p(new Ur(0,"Upload aborted.")),t.ontimeout=()=>p(new Ur(0,"Upload timed out.")),t.send(n)})}function jT(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 HT="modulepreload",UT=function(e){return"/"+e},Ab={},t_=function(t,n,a){let o=Promise.resolve();if(n&&n.length>0){let _=function(p){return Promise.all(p.map(y=>Promise.resolve(y).then(b=>({status:"fulfilled",value:b}),b=>({status:"rejected",reason:b}))))};document.getElementsByTagName("link");const h=document.querySelector("meta[property=csp-nonce]"),f=h?.nonce||h?.getAttribute("nonce");o=_(n.map(p=>{if(p=UT(p),p in Ab)return;Ab[p]=!0;const y=p.endsWith(".css"),b=y?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${p}"]${b}`))return;const S=document.createElement("link");if(S.rel=y?"stylesheet":HT,y||(S.as="script"),S.crossOrigin="",S.href=p,f&&S.setAttribute("nonce",f),document.head.appendChild(S),y)return new Promise((C,x)=>{S.addEventListener("load",C),S.addEventListener("error",()=>x(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)})},PT=v.lazy(()=>t_(()=>import("./MarkdownPreview-BxmYRWHQ.js"),__vite__mapDeps([0,1])));function IT({api:e,activeTerminalId:t,activeTerminalCwd:n,onOpenFile:a}){const[o,c]=v.useState(null),[h,f]=v.useState(""),[_,p]=v.useState({}),[y,b]=v.useState(()=>new Set),[S,C]=v.useState(null),[x,E]=v.useState({type:"empty"}),[B,k]=v.useState("idle"),[H,U]=v.useState(null),X=v.useRef(null),ee=v.useRef(null),te=v.useRef(!1),ne=v.useRef(0),re=v.useRef(null);re.current===null&&t&&(re.current=t);const fe=re.current,K=t?Mf(t,n):null,A=o?[o.rootPath,h].filter(Boolean).join("/"):"",I=S?.path??null;v.useEffect(()=>(te.current=!0,()=>{te.current=!1,ne.current+=1,Fe()}),[]),v.useEffect(()=>{re.current=t,ee.current=null;const ie=t?Mf(t,n):null;O(t,ie)},[e]),v.useEffect(()=>{if(!fe||t!==fe)return;const ie=Mf(fe,n);ie!==ee.current&&O(fe,ie)},[fe,t,n]);async function O(ie,Me=K){const Ce=he();if(ee.current=Me,Fe(),c(null),f(""),p({}),b(new Set),C(null),E({type:"empty"}),U(null),!ie){k("idle");return}k("loading");try{const je=await e.createFileRoot({terminalId:ie});if(!ve(Ce))return;c({rootToken:je.rootToken,rootPath:je.rootPath});const qe=await e.listFiles({rootToken:je.rootToken,path:""});if(!ve(Ce))return;T(qe),k("idle")}catch(je){if(await ze(je,Ce))return;ve(Ce)&&(U(rr(je)),k("idle"))}}async function j(ie=h,Me=o){if(!Me)return;const Ce=he();k("loading"),U(null);try{const je=await e.listFiles({rootToken:Me.rootToken,path:ie});if(!ve(Ce))return;T(je),k("idle")}catch(je){if(await ze(je,Ce))return;ve(Ce)&&(U(rr(je)),k("idle"))}}async function J(){re.current=t,await O(t,K)}function T(ie){p(Me=>({...Me,[ie.path]:FT(ie.entries)}))}async function W(ie){if(!(!Rf(ie)||!o)){if(C(ie),U(null),ie.kind==="directory"){f(ie.path),xe(),await me(ie);return}if(f(Pr(ie.path)),ie.editable){await R(ie);return}ie.previewKind!=="none"&&await ae(ie,ie.previewKind)}}async function F(ie){if(!(!Rf(ie)||!o)){if(C(ie),U(null),ie.kind==="directory"){f(ie.path),xe(),await me(ie);return}if(f(Pr(ie.path)),ie.editable){await G(ie);return}ie.previewKind!=="none"&&await ae(ie,ie.previewKind)}}async function me(ie){if(y.has(ie.path)){b(Me=>{const Ce=new Set(Me);return Ce.delete(ie.path),Ce});return}b(Me=>new Set(Me).add(ie.path)),await j(ie.path)}function we(ie,Me){ie.key==="Enter"&&(ie.preventDefault(),F(Me))}async function R(ie){if(!o)return;const Me=he();k("loading"),Fe();try{const Ce=await e.readFile({rootToken:o.rootToken,path:ie.path});if(!ve(Me))return;E({type:"text-preview",file:ie,read:Ce}),k("idle")}catch(Ce){if(await ze(Ce,Me))return;ve(Me)&&(U(rr(Ce)),k("idle"))}}async function G(ie){if(!o)return;const Me=he();k("loading");try{await a({rootToken:o.rootToken,path:ie.path}),ve(Me)&&k("idle")}catch(Ce){if(await ze(Ce,Me))return;ve(Me)&&(U(rr(Ce)),k("idle"))}}async function ae(ie,Me){if(!o)return;const Ce=he();k("loading"),Fe();try{const je=await e.previewFile({rootToken:o.rootToken,path:ie.path});if(!ve(Ce))return;const qe=URL.createObjectURL(je);if(!ve(Ce)){URL.revokeObjectURL(qe);return}X.current=qe,E({type:"preview",file:ie,previewKind:Me,url:qe}),k("idle")}catch(je){if(await ze(je,Ce))return;ve(Ce)&&(U(rr(je)),k("idle"))}}async function de(ie){if(!o)return;const Me=ie==="file"?"New file":"New folder",Ce=window.prompt(Me,""),je=S?S.kind==="directory"?S.path:Pr(S.path):h,qe=Lb(Ce,je);if(qe){U(null);try{const Ct=await e.createFileEntry({rootToken:o.rootToken,path:qe,kind:ie});C(Ct.entry),await j(je)}catch(Ct){if(await ze(Ct))return;U(rr(Ct))}}}async function ge(){if(!o||!S)return;const ie=window.prompt("Move selected entry",S.path),Me=Lb(ie,"");if(!Me||Me===S.path)return;const Ce=Pr(S.path),je=Pr(Me);U(null);try{const qe=await e.moveFileEntry({rootToken:o.rootToken,sourcePath:S.path,destinationPath:Me});C(qe.entry),f(qe.entry.kind==="directory"?qe.entry.path:Pr(qe.entry.path)),xe(),await j(Ce),je!==Ce&&await j(je)}catch(qe){if(await ze(qe))return;U(rr(qe))}}async function ye(){if(!o||!S)return;const ie=S.path,Me=Pr(ie);U(null);try{const Ce=await e.previewDeleteFileEntry({rootToken:o.rootToken,path:S.path}),je=Ce.descendantCount>0?` and ${Ce.descendantCount} nested item${Ce.descendantCount===1?"":"s"}`:"";if(!window.confirm(`Delete ${Ce.path}${je}?`))return;await e.deleteFileEntry({rootToken:o.rootToken,path:S.path,previewToken:Ce.previewToken}),C(null),f(Me),b(qe=>{const Ct=new Set(qe);for(const ft of qe)(ft===ie||ft.startsWith(`${ie}/`))&&Ct.delete(ft);return Ct}),xe(),await j(Me)}catch(Ce){if(await ze(Ce))return;U(rr(Ce))}}function xe(){ne.current+=1,Fe(),E({type:"empty"})}function Fe(){X.current&&(URL.revokeObjectURL(X.current),X.current=null)}function he(){return ne.current+=1,ne.current}function ve(ie){return te.current&&ie===ne.current}async function ze(ie,Me){return qT(ie)?(Me!==void 0&&!ve(Me)||await O(t,K),!0):!1}function Re(ie,Me){const Ce=Rf(ie),je=ie.kind==="directory"&&y.has(ie.path),qe=_[ie.path]??[],Ct={"--file-tree-depth":Me};return m.jsxs(mi.Fragment,{children:[m.jsxs("button",{type:"button",className:"file-entry-button","data-kind":ie.kind,"data-expanded":je,"data-active":I===ie.path,disabled:!Ce,style:Ct,"aria-expanded":ie.kind==="directory"?je: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:()=>{W(ie)},onDoubleClick:()=>{F(ie)},onKeyDown:ft=>we(ft,ie),children:[m.jsx("span",{className:"file-entry-disclosure","aria-hidden":"true",children:ie.kind==="directory"?je?"▾":"▸":""}),m.jsx("span",{className:"file-entry-name",children:ie.name}),m.jsx("small",{children:KT(ie)})]}),je?m.jsx("div",{className:"file-tree-children",role:"group",children:qe.map(ft=>Re(ft,Me+1))}):null]},ie.path)}const Ee=_[""]??[];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:A,children:A||"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:()=>{J()},children:"↻"}),m.jsx("button",{type:"button","aria-label":"New file",title:"New file",disabled:!o,onClick:()=>{de("file")},children:"+"}),m.jsx("button",{type:"button","aria-label":"New folder",title:"New folder",disabled:!o,onClick:()=>{de("directory")},children:"▣"})]})]}),H?m.jsx("div",{className:"file-explorer-alert",role:"alert",children:H}):null,m.jsxs("div",{className:"file-explorer-layout",children:[m.jsx("div",{className:"file-tree","aria-label":A?`Files in ${A}`:"Files",children:Ee.map(ie=>Re(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:S?.name??"detail"}),m.jsxs("div",{className:"file-detail-actions",children:[m.jsx("button",{type:"button","aria-label":"Move selected entry",disabled:!S,onClick:()=>{ge()},children:"Move"}),m.jsx("button",{type:"button","aria-label":"Delete selected entry",disabled:!S,onClick:()=>{ye()},children:"Delete"})]})]}),B==="loading"?m.jsx("div",{className:"file-detail-empty",children:"loading"}):null,x.type==="empty"&&B!=="loading"?m.jsx("div",{className:"file-detail-empty",children:"No file selected"}):null,x.type==="preview"?m.jsxs("div",{className:"file-preview-frame",children:[x.previewKind==="image"?m.jsx("img",{src:x.url,alt:x.file.name}):null,x.previewKind==="pdf"?m.jsx("iframe",{src:x.url,title:x.file.name}):null]}):null,x.type==="text-preview"&&x.read.language==="markdown"?m.jsx("div",{className:"file-markdown-preview","aria-label":`Preview for ${x.file.name}`,children:m.jsx(v.Suspense,{fallback:m.jsx("div",{className:"file-markdown-preview-loading",children:"loading preview"}),children:m.jsx(PT,{content:x.read.content})})}):null,x.type==="text-preview"&&x.read.language==="text"?m.jsx("pre",{className:"file-text-preview","aria-label":`Preview for ${x.file.name}`,children:x.read.content}):null]})]})]})}function Rf(e){return e.kind==="directory"||e.editable||e.previewKind!=="none"}function KT(e){return e.kind==="directory"?"dir":e.editable?"edit":e.previewKind!=="none"?e.previewKind:"unsupported"}function Mf(e,t){return`${e}\0${t??""}`}function FT(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 Pr(e){const t=e.split("/").filter(Boolean);return t.pop(),t.join("/")}function Lb(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 qT(e){return e instanceof Nn&&e.status===409&&e.message==="terminal_cwd_changed"}const WT=v.lazy(()=>t_(()=>import("./MarkdownPreview-BxmYRWHQ.js"),__vite__mapDeps([0,1])));function Bb({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"),[y,b]=v.useState(null),[S,C]=v.useState(!1),[x,E]=v.useState("edit"),B=v.useRef(t),k=v.useRef(t.read),H=v.useRef(t.read.content),U=v.useRef(!1),X=v.useRef(!1),ee=v.useRef(0),te=h!==o.content&&_!=="saving"&&!S;v.useEffect(()=>(X.current=!0,()=>{X.current=!1,ee.current+=1}),[]),v.useEffect(()=>{ee.current+=1,U.current=!1,B.current=t,k.current=t.read,H.current=t.read.content,c(t.read),f(t.read.content),p("idle"),b(null),C(!1),E("edit")},[t.id,t.read]),v.useEffect(()=>{B.current=t},[t]),v.useEffect(()=>{k.current=o},[o]),v.useEffect(()=>{H.current=h},[h]),v.useEffect(()=>{if(h===o.content||S)return;const A=window.setInterval(()=>{!U.current&&H.current!==k.current.content&&ne()},1e3);return()=>window.clearInterval(A)},[h===o.content,S,t.id]);async function ne(){if(U.current)return;const A=H.current,I=k.current;if(A===I.content)return;const O=B.current,j=ee.current;U.current=!0,p("saving"),b(null),C(!1);try{const J=await e.writeFile({rootToken:O.rootToken,path:O.path,content:A,expectedVersion:I.version});if(!X.current||j!==ee.current)return;const T={...I,content:A,version:J.version};k.current=T,c(T),p(H.current===A?"saved":"idle")}catch(J){if(!X.current||j!==ee.current)return;if(J instanceof Nn&&J.status===409){C(!0),p("idle");return}b($T(J)),p("idle")}finally{j===ee.current&&(U.current=!1)}}const re=_==="saving"?"saving":_==="saved"?"saved":o.language,fe=o.language==="markdown",K=fe&&x==="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:re}),m.jsx("button",{type:"button","aria-label":`Save ${t.title}`,disabled:!te,onClick:()=>{ne()},children:"Save"}),fe?m.jsx("button",{type:"button","aria-label":`${K?"Edit":"Preview"} ${t.title}`,onClick:()=>E(A=>A==="preview"?"edit":"preview"),children:K?"Edit":"Preview"}):null,n?m.jsx("button",{type:"button",className:"terminal-pane-close","aria-label":`Close editor ${t.title}`,onClick:a,children:"x"}):null]}),y?m.jsx("div",{className:"editor-pane-alert",role:"alert",children:y}):null,S?m.jsx("div",{className:"editor-pane-alert",role:"alert",children:"File changed on disk."}):null,K?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(WT,{content:h})})}):m.jsx("textarea",{className:"editor-pane-textarea","aria-label":`Editor for ${t.title}`,spellCheck:!1,value:h,onChange:A=>{const I=A.target.value;H.current=I,f(I),p("idle"),b(null),C(!1)}})]})}function $T(e){return e instanceof Error?e.message:"Request failed"}var YT=2,VT=1,XT=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,y=o-_-t;return{cols:Math.max(YT,Math.floor(y/e.css.cell.width)),rows:Math.max(VT,Math.floor(p/e.css.cell.height))}}};var aw=Object.defineProperty,GT=Object.getOwnPropertyDescriptor,ZT=(e,t)=>{for(var n in t)aw(e,n,{get:t[n],enumerable:!0})},Wt=(e,t,n,a)=>{for(var o=a>1?void 0:a?GT(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&&aw(t,n,o),o},Se=(e,t)=>(n,a)=>t(n,a,e),Ob="Terminal input",wp={get:()=>Ob,set:e=>Ob=e},zb="Too much output to announce, navigate to rows manually to read",Cp={get:()=>zb,set:e=>zb=e};function QT(e){return e.replace(/\r?\n/g,"\r")}function JT(e,t){return t?"\x1B[200~"+e+"\x1B[201~":e}function ek(e,t){e.clipboardData&&e.clipboardData.setData("text/plain",t.selectionText),e.preventDefault()}function tk(e,t,n,a){if(e.stopPropagation(),e.clipboardData){let o=e.clipboardData.getData("text/plain");lw(o,t,n,a)}}function lw(e,t,n,a){e=QT(e),e=JT(e,n.decPrivateModes.bracketedPasteMode&&a.rawOptions.ignoreBracketedPasteMode!==!0),n.triggerDataEvent(e,!0),t.value=""}function ow(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 jb(e,t,n,a,o){ow(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 sh(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 ik=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}},sk=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 S=!1,C=this.interim[0];C&=(C&224)===192?31:(C&240)===224?15:7;let x=0,E;for(;(E=this.interim[++x]&63)&&x<4;)C<<=6,C|=E;let B=(this.interim[0]&224)===192?2:(this.interim[0]&240)===224?3:4,k=B-x;for(;p<k;){if(p>=n)return 0;if(E=e[p++],(E&192)!==128){p--,S=!0;break}else this.interim[x++]=E,C<<=6,C|=E&63}S||(B===2?C<128?p--:t[a++]=C:B===3?C<2048||C>=55296&&C<=57343||C===65279||(t[a++]=C):C<65536||C>1114111||(t[a++]=C)),this.interim.fill(0)}let y=n-4,b=p;for(;b<n;){for(;b<y&&!((o=e[b])&128)&&!((c=e[b+1])&128)&&!((h=e[b+2])&128)&&!((f=e[b+3])&128);)t[a++]=o,t[a++]=c,t[a++]=h,t[a++]=f,b+=4;if(o=e[b++],o<128)t[a++]=o;else if((o&224)===192){if(b>=n)return this.interim[0]=o,a;if(c=e[b++],(c&192)!==128){b--;continue}if(_=(o&31)<<6|c&63,_<128){b--;continue}t[a++]=_}else if((o&240)===224){if(b>=n)return this.interim[0]=o,a;if(c=e[b++],(c&192)!==128){b--;continue}if(b>=n)return this.interim[0]=o,this.interim[1]=c,a;if(h=e[b++],(h&192)!==128){b--;continue}if(_=(o&15)<<12|(c&63)<<6|h&63,_<2048||_>=55296&&_<=57343||_===65279)continue;t[a++]=_}else if((o&248)===240){if(b>=n)return this.interim[0]=o,a;if(c=e[b++],(c&192)!==128){b--;continue}if(b>=n)return this.interim[0]=o,this.interim[1]=c,a;if(h=e[b++],(h&192)!==128){b--;continue}if(b>=n)return this.interim[0]=o,this.interim[1]=c,this.interim[2]=h,a;if(f=e[b++],(f&192)!==128){b--;continue}if(_=(o&7)<<18|(c&63)<<12|(h&63)<<6|f&63,_<65536||_>1114111)continue;t[a++]=_}}return a}},cw="",dr=" ",Ko=class uw{constructor(){this.fg=0,this.bg=0,this.extended=new zu}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 uw;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}},zu=class hw{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 hw(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},js=class dw extends Ko{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new zu,this.combinedData=""}static fromCharData(t){let n=new dw;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()]}},Hb="di$target",xp="di$dependencies",Nf=new Map;function nk(e){return e[xp]||[]}function Mi(e){if(Nf.has(e))return Nf.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");rk(t,n,o)};return t._id=e,Nf.set(e,t),t}function rk(e,t,n){t[Hb]===t?t[xp].push({id:e,index:n}):(t[xp]=[{id:e,index:n}],t[Hb]=t)}var Xi=Mi("BufferService"),fw=Mi("CoreMouseService"),ia=Mi("CoreService"),ak=Mi("CharsetService"),i_=Mi("InstantiationService"),pw=Mi("LogService"),Gi=Mi("OptionsService"),mw=Mi("OscLinkService"),lk=Mi("UnicodeService"),Fo=Mi("DecorationService"),Ep=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 js,h=n.getTrimmedLength(),f=-1,_=-1,p=!1;for(let y=0;y<h;y++)if(!(_===-1&&!n.hasContent(y))){if(n.loadCell(y,c),c.hasExtendedAttrs()&&c.extended.urlId)if(_===-1){_=y,f=c.extended.urlId;continue}else p=c.extended.urlId!==f;else _!==-1&&(p=!0);if(p||_!==-1&&y===h-1){let b=this._oscLinkService.getLinkData(f)?.uri;if(b){let S={start:{x:_+1,y:e},end:{x:y+(!p&&y===h-1?1:0),y:e}},C=!1;if(!o?.allowNonHttpProtocols)try{let x=new URL(b);["http:","https:"].includes(x.protocol)||(C=!0)}catch{C=!0}C||a.push({text:b,range:S,activate:(x,E)=>o?o.activate(x,E,S):ok(x,E),hover:(x,E)=>o?.hover?.(x,E,S),leave:(x,E)=>o?.leave?.(x,E,S)})}p=!1,c.hasExtendedAttrs()&&c.extended.urlId?(_=y,f=c.extended.urlId):(_=-1,f=-1)}}t(a)}};Ep=Wt([Se(0,Xi),Se(1,Gi),Se(2,mw)],Ep);function ok(e,t){if(confirm(`Do you want to navigate to ${t}?
|
|
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 nh=Mi("CharSizeService"),Ln=Mi("CoreBrowserService"),s_=Mi("MouseService"),Bn=Mi("RenderService"),ck=Mi("SelectionService"),_w=Mi("CharacterJoinerService"),nl=Mi("ThemeService"),gw=Mi("LinkProviderService"),uk=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?Ub.isErrorNoTelemetry(e)?new Ub(e.message+`
|
|
18
|
-
|
|
19
|
-
`+e.stack):new Error(e.message+`
|
|
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)}},hk=new uk;function yu(e){dk(e)||hk.onUnexpectedError(e)}var Tp="Canceled";function dk(e){return e instanceof fk?!0:e instanceof Error&&e.name===Tp&&e.message===Tp}var fk=class extends Error{constructor(){super(Tp),this.name=this.message}};function pk(e){return new Error(`Illegal argument: ${e}`)}var Ub=class kp extends Error{constructor(t){super(t),this.name="CodeExpectedError"}static fromError(t){if(t instanceof kp)return t;let n=new kp;return n.message=t.message,n.stack=t.stack,n}static isErrorNoTelemetry(t){return t.name==="CodeExpectedError"}},Dp=class vw extends Error{constructor(t){super(t||"An unexpected bug occurred."),Object.setPrototypeOf(this,vw.prototype)}};function gs(e,t=0){return e[e.length-(1+t)]}var mk;(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})(mk||={});function _k(e,t){let n=this,a=!1,o;return function(){return a||(a=!0,t||(o=e.apply(n,arguments))),o}}var yw;(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 y(X,ee){let te=0;for(let ne of X)if(ee(ne,te++))return!0;return!1}e.some=y;function b(X,ee){for(let te of X)if(ee(te))return te}e.find=b;function*S(X,ee){for(let te of X)ee(te)&&(yield te)}e.filter=S;function*C(X,ee){let te=0;for(let ne of X)yield ee(ne,te++)}e.map=C;function*x(X,ee){let te=0;for(let ne of X)yield*ee(ne,te++)}e.flatMap=x;function*E(...X){for(let ee of X)yield*ee}e.concat=E;function B(X,ee,te){let ne=te;for(let re of X)ne=ee(ne,re);return ne}e.reduce=B;function*k(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=k;function H(X,ee=Number.POSITIVE_INFINITY){let te=[];if(ee===0)return[te,X];let ne=X[Symbol.iterator]();for(let re=0;re<ee;re++){let fe=ne.next();if(fe.done)return[te,e.empty()];te.push(fe.value)}return[te,{[Symbol.iterator](){return ne}}]}e.consume=H;async function U(X){let ee=[];for await(let te of X)ee.push(te);return Promise.resolve(ee)}e.asyncToArray=U})(yw||={});function Jr(e){if(yw.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 gk(...e){return Nt(()=>Jr(e))}function Nt(e){return{dispose:_k(()=>{e()})}}var bw=class Sw{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?Sw.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)}};bw.DISABLE_DISPOSED_WARNING=!1;var pr=bw,Ve=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)}};Ve.None=Object.freeze({dispose(){}});var tl=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,Rp=class Mp{constructor(t){this.element=t,this.next=Mp.Undefined,this.prev=Mp.Undefined}};Rp.Undefined=new Rp(void 0);var Bt=Rp,Pb=class{constructor(){this._first=Bt.Undefined,this._last=Bt.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===Bt.Undefined}clear(){let e=this._first;for(;e!==Bt.Undefined;){let t=e.next;e.prev=Bt.Undefined,e.next=Bt.Undefined,e=t}this._first=Bt.Undefined,this._last=Bt.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){let n=new Bt(e);if(this._first===Bt.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!==Bt.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==Bt.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==Bt.Undefined&&e.next!==Bt.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===Bt.Undefined&&e.next===Bt.Undefined?(this._first=Bt.Undefined,this._last=Bt.Undefined):e.next===Bt.Undefined?(this._last=this._last.prev,this._last.next=Bt.Undefined):e.prev===Bt.Undefined&&(this._first=this._first.next,this._first.prev=Bt.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==Bt.Undefined;)yield e.element,e=e.next}},vk=globalThis.performance&&typeof globalThis.performance.now=="function",yk=class ww{static create(t){return new ww(t)}constructor(t){this._now=vk&&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}},ji;(e=>{e.None=()=>Ve.None;function t(I,O){return b(I,()=>{},0,void 0,!0,void 0,O)}e.defer=t;function n(I){return(O,j=null,J)=>{let T=!1,W;return W=I(F=>{if(!T)return W?W.dispose():T=!0,O.call(j,F)},null,J),T&&W.dispose(),W}}e.once=n;function a(I,O,j){return p((J,T=null,W)=>I(F=>J.call(T,O(F)),null,W),j)}e.map=a;function o(I,O,j){return p((J,T=null,W)=>I(F=>{O(F),J.call(T,F)},null,W),j)}e.forEach=o;function c(I,O,j){return p((J,T=null,W)=>I(F=>O(F)&&J.call(T,F),null,W),j)}e.filter=c;function h(I){return I}e.signal=h;function f(...I){return(O,j=null,J)=>{let T=gk(...I.map(W=>W(F=>O.call(j,F))));return y(T,J)}}e.any=f;function _(I,O,j,J){let T=j;return a(I,W=>(T=O(T,W),T),J)}e.reduce=_;function p(I,O){let j,J={onWillAddFirstListener(){j=I(T.fire,T)},onDidRemoveLastListener(){j?.dispose()}},T=new _e(J);return O?.add(T),T.event}function y(I,O){return O instanceof Array?O.push(I):O&&O.add(I),I}function b(I,O,j=100,J=!1,T=!1,W,F){let me,we,R,G=0,ae,de={leakWarningThreshold:W,onWillAddFirstListener(){me=I(ye=>{G++,we=O(we,ye),J&&!R&&(ge.fire(we),we=void 0),ae=()=>{let xe=we;we=void 0,R=void 0,(!J||G>1)&&ge.fire(xe),G=0},typeof j=="number"?(clearTimeout(R),R=setTimeout(ae,j)):R===void 0&&(R=0,queueMicrotask(ae))})},onWillRemoveListener(){T&&G>0&&ae?.()},onDidRemoveLastListener(){ae=void 0,me.dispose()}},ge=new _e(de);return F?.add(ge),ge.event}e.debounce=b;function S(I,O=0,j){return e.debounce(I,(J,T)=>J?(J.push(T),J):[T],O,void 0,!0,void 0,j)}e.accumulate=S;function C(I,O=(J,T)=>J===T,j){let J=!0,T;return c(I,W=>{let F=J||!O(W,T);return J=!1,T=W,F},j)}e.latch=C;function x(I,O,j){return[e.filter(I,O,j),e.filter(I,J=>!O(J),j)]}e.split=x;function E(I,O=!1,j=[],J){let T=j.slice(),W=I(we=>{T?T.push(we):me.fire(we)});J&&J.add(W);let F=()=>{T?.forEach(we=>me.fire(we)),T=null},me=new _e({onWillAddFirstListener(){W||(W=I(we=>me.fire(we)),J&&J.add(W))},onDidAddFirstListener(){T&&(O?setTimeout(F):F())},onDidRemoveLastListener(){W&&W.dispose(),W=null}});return J&&J.add(me),me.event}e.buffer=E;function B(I,O){return(j,J,T)=>{let W=O(new H);return I(function(F){let me=W.evaluate(F);me!==k&&j.call(J,me)},void 0,T)}}e.chain=B;let k=Symbol("HaltChainable");class H{constructor(){this.steps=[]}map(O){return this.steps.push(O),this}forEach(O){return this.steps.push(j=>(O(j),j)),this}filter(O){return this.steps.push(j=>O(j)?j:k),this}reduce(O,j){let J=j;return this.steps.push(T=>(J=O(J,T),J)),this}latch(O=(j,J)=>j===J){let j=!0,J;return this.steps.push(T=>{let W=j||!O(T,J);return j=!1,J=T,W?T:k}),this}evaluate(O){for(let j of this.steps)if(O=j(O),O===k)break;return O}}function U(I,O,j=J=>J){let J=(...me)=>F.fire(j(...me)),T=()=>I.on(O,J),W=()=>I.removeListener(O,J),F=new _e({onWillAddFirstListener:T,onDidRemoveLastListener:W});return F.event}e.fromNodeEventEmitter=U;function X(I,O,j=J=>J){let J=(...me)=>F.fire(j(...me)),T=()=>I.addEventListener(O,J),W=()=>I.removeEventListener(O,J),F=new _e({onWillAddFirstListener:T,onDidRemoveLastListener:W});return F.event}e.fromDOMEventEmitter=X;function ee(I){return new Promise(O=>n(I)(O))}e.toPromise=ee;function te(I){let O=new _e;return I.then(j=>{O.fire(j)},()=>{O.fire(void 0)}).finally(()=>{O.dispose()}),O.event}e.fromPromise=te;function ne(I,O){return I(j=>O.fire(j))}e.forward=ne;function re(I,O,j){return O(j),I(J=>O(J))}e.runAndSubscribe=re;class fe{constructor(O,j){this._observable=O,this._counter=0,this._hasChanged=!1;let J={onWillAddFirstListener:()=>{O.addObserver(this)},onDidRemoveLastListener:()=>{O.removeObserver(this)}};this.emitter=new _e(J),j&&j.add(this.emitter)}beginUpdate(O){this._counter++}handlePossibleChange(O){}handleChange(O,j){this._hasChanged=!0}endUpdate(O){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function K(I,O){return new fe(I,O).emitter.event}e.fromObservable=K;function A(I){return(O,j,J)=>{let T=0,W=!1,F={beginUpdate(){T++},endUpdate(){T--,T===0&&(I.reportChanges(),W&&(W=!1,O.call(j)))},handlePossibleChange(){},handleChange(){W=!0}};I.addObserver(F),I.reportChanges();let me={dispose(){I.removeObserver(F)}};return J instanceof pr?J.add(me):Array.isArray(J)&&J.push(me),me}}e.fromObservableLight=A})(ji||={});var Np=class Ap{constructor(t){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${t}_${Ap._idPool++}`,Ap.all.add(this)}start(t){this._stopWatch=new yk,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}}};Np.all=new Set,Np._idPool=0;var bk=Np,Sk=-1,Cw=class xw{constructor(t,n,a=(xw._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 xk(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}};Cw._idPool=1;var wk=Cw,Ck=class Ew{constructor(t){this.value=t}static create(){let t=new Error;return new Ew(t.stack??"")}print(){console.warn(this.value.split(`
|
|
22
|
-
`).slice(2).join(`
|
|
23
|
-
`))}},xk=class extends Error{constructor(e,t){super(e),this.name="ListenerLeakError",this.stack=t}},Ek=class extends Error{constructor(e,t){super(e),this.name="ListenerRefusalError",this.stack=t}},Tk=0,Af=class{constructor(e){this.value=e,this.id=Tk++}},kk=2,Dk,_e=class{constructor(e){this._size=0,this._options=e,this._leakageMon=this._options?.leakWarningThreshold?new wk(e?.onListenerError??yu,this._options?.leakWarningThreshold??Sk):void 0,this._perfMon=this._options?._profName?new bk(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 Ek(`${h}. HINT: Stack shows most frequent listener (${f[1]}-times)`,f[0]);return(this._options?.onListenerError||yu)(_),Ve.None}if(this._disposed)return Ve.None;t&&(e=e.bind(t));let a=new Af(e),o;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(a.stack=Ck.create(),o=this._leakageMon.check(a.stack,this._size+1)),this._listeners?this._listeners instanceof Af?(this._deliveryQueue??=new Rk,this._listeners=[this._listeners,a]):this._listeners.push(a):(this._options?.onWillAddFirstListener?.(this),this._listeners=a,this._options?.onDidAddFirstListener?.(this)),this._size++;let c=Nt(()=>{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*kk<=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||yu;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 Af)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}},Rk=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}},Lp=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new _e,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new _e,this.onDidChangeFullscreen=this._onDidChangeFullscreen.event,this.mapWindowIdToFullScreen=new Map}getZoomLevel(t){return this.mapWindowIdToZoomLevel.get(this.getWindowId(t))??0}setZoomLevel(t,n){if(this.getZoomLevel(n)===t)return;let a=this.getWindowId(n);this.mapWindowIdToZoomLevel.set(a,t),this._onDidChangeZoomLevel.fire(a)}getZoomFactor(t){return this.mapWindowIdToZoomFactor.get(this.getWindowId(t))??1}setZoomFactor(t,n){this.mapWindowIdToZoomFactor.set(this.getWindowId(n),t)}setFullscreen(t,n){if(this.isFullscreen(n)===t)return;let a=this.getWindowId(n);this.mapWindowIdToFullScreen.set(a,t),this._onDidChangeFullscreen.fire(a)}isFullscreen(t){return!!this.mapWindowIdToFullScreen.get(this.getWindowId(t))}getWindowId(t){return t.vscodeWindowId}};Lp.INSTANCE=new Lp;var n_=Lp;function Mk(e,t,n){typeof t=="string"&&(t=e.matchMedia(t)),t.addEventListener("change",n)}n_.INSTANCE.onDidChangeZoomLevel;function Nk(e){return n_.INSTANCE.getZoomFactor(e)}n_.INSTANCE.onDidChangeFullscreen;var rl=typeof navigator=="object"?navigator.userAgent:"",Bp=rl.indexOf("Firefox")>=0,Ak=rl.indexOf("AppleWebKit")>=0,r_=rl.indexOf("Chrome")>=0,Lk=!r_&&rl.indexOf("Safari")>=0;rl.indexOf("Electron/")>=0;rl.indexOf("Android")>=0;var Lf=!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)");Lf=e.matches,Mk(Mn,e,({matches:n})=>{Lf&&t.matches||(Lf=n)})}var $a="en",Op=!1,zp=!1,bu=!1,Tw=!1,lu,Su=$a,Ib=$a,Bk,Dn,Xr=globalThis,bs;typeof Xr.vscode<"u"&&typeof Xr.vscode.process<"u"?bs=Xr.vscode.process:typeof process<"u"&&typeof process?.versions?.node=="string"&&(bs=process);var Ok=typeof bs?.versions?.electron=="string",zk=Ok&&bs?.type==="renderer";if(typeof bs=="object"){Op=bs.platform==="win32",zp=bs.platform==="darwin",bu=bs.platform==="linux",bu&&bs.env.SNAP&&bs.env.SNAP_REVISION,bs.env.CI||bs.env.BUILD_ARTIFACTSTAGINGDIRECTORY,lu=$a,Su=$a;let e=bs.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);lu=t.userLocale,Ib=t.osLocale,Su=t.resolvedLanguage||$a,Bk=t.languagePack?.translationsConfigFile}catch{}Tw=!0}else typeof navigator=="object"&&!zk?(Dn=navigator.userAgent,Op=Dn.indexOf("Windows")>=0,zp=Dn.indexOf("Macintosh")>=0,(Dn.indexOf("Macintosh")>=0||Dn.indexOf("iPad")>=0||Dn.indexOf("iPhone")>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints>0,bu=Dn.indexOf("Linux")>=0,Dn?.indexOf("Mobi")>=0,Su=globalThis._VSCODE_NLS_LANGUAGE||$a,lu=navigator.language.toLowerCase(),Ib=lu):console.error("Unable to resolve platform.");var kw=Op,nn=zp,jk=bu,Kb=Tw,rn=Dn,ar=Su,Hk;(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})(Hk||={});var Uk=typeof Xr.postMessage=="function"&&!Xr.importScripts;(()=>{if(Uk){let e=[];Xr.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}),Xr.postMessage({vscodeScheduleAsyncWork:a},"*")}}return e=>setTimeout(e)})();var Pk=!!(rn&&rn.indexOf("Chrome")>=0);rn&&rn.indexOf("Firefox")>=0;!Pk&&rn&&rn.indexOf("Safari")>=0;rn&&rn.indexOf("Edg/")>=0;rn&&rn.indexOf("Android")>=0;var Fa=typeof navigator=="object"?navigator:{};Kb||document.queryCommandSupported&&document.queryCommandSupported("copy")||Fa&&Fa.clipboard&&Fa.clipboard.writeText,Kb||Fa&&Fa.clipboard&&Fa.clipboard.readText;var a_=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}},Bf=new a_,Fb=new a_,qb=new a_,Ik=new Array(230),Dw;(e=>{function t(f){return Bf.keyCodeToStr(f)}e.toString=t;function n(f){return Bf.strToKeyCode(f)}e.fromString=n;function a(f){return Fb.keyCodeToStr(f)}e.toUserSettingsUS=a;function o(f){return qb.keyCodeToStr(f)}e.toUserSettingsGeneral=o;function c(f){return Fb.strToKeyCode(f)||qb.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 Bf.keyCodeToStr(f)}e.toElectronAccelerator=h})(Dw||={});var Kk=class Rw{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 Rw&&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 Fk([this])}isDuplicateModifierCase(){return this.ctrlKey&&this.keyCode===5||this.shiftKey&&this.keyCode===4||this.altKey&&this.keyCode===6||this.metaKey&&this.keyCode===57}},Fk=class{constructor(e){if(e.length===0)throw pk("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 qk(e){if(e.charCode){let n=String.fromCharCode(e.charCode).toUpperCase();return Dw.fromString(n)}let t=e.keyCode;if(t===3)return 7;if(Bp)switch(t){case 59:return 85;case 60:if(jk)return 97;break;case 61:return 86;case 107:return 109;case 109:return 111;case 173:return 88;case 224:if(nn)return 57;break}else if(Ak&&(nn&&t===93||!nn&&t===92))return 57;return Ik[t]||0}var Wk=nn?256:2048,$k=512,Yk=1024,Vk=nn?2048:256,Wb=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=qk(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|=Wk),this.altKey&&(t|=$k),this.shiftKey&&(t|=Yk),this.metaKey&&(t|=Vk),t|=e,t}_computeKeyCodeChord(){let e=0;return this.keyCode!==5&&this.keyCode!==4&&this.keyCode!==6&&this.keyCode!==57&&(e=this.keyCode),new Kk(this.ctrlKey,this.shiftKey,this.altKey,this.metaKey,e)}},$b=new WeakMap;function Xk(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 Gk=class{static getSameOriginWindowChain(e){let t=$b.get(e);if(!t){t=[],$b.set(e,t);let n=e,a;do a=Xk(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}}},ou=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=Gk.getPositionOfChildWindowRelativeToAncestorWindow(e,t.view);this.posx-=n.left,this.posy-=n.top}preventDefault(){this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent.stopPropagation()}},Yb=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(r_){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?Bp&&!nn?this.deltaY=-e.deltaY/3:this.deltaY=-e.deltaY:this.deltaY=-e.deltaY/40}if(typeof o.wheelDeltaX<"u")Lk&&kw?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?Bp&&!nn?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)}}}),Zk;(e=>{function t(n){return n===e.None||n===e.Cancelled||n instanceof Qk?!0:!n||typeof n!="object"?!1:typeof n.isCancellationRequested=="boolean"&&typeof n.onCancellationRequested=="function"}e.isCancellationToken=t,e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:ji.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:Mw})})(Zk||={});var Qk=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 _e),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}},l_=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 Dp("Calling 'cancelAndSet' on a disposed TimeoutTimer");this.cancel(),this._token=setTimeout(()=>{this._token=-1,e()},t)}setIfNotSet(e,t){if(this._isDisposed)throw new Dp("Calling 'setIfNotSet' on a disposed TimeoutTimer");this._token===-1&&(this._token=setTimeout(()=>{this._token=-1,e()},t))}},Jk=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 Dp("Calling 'cancelAndSet' on a disposed IntervalTimer");this.cancel();let a=n.setInterval(()=>{e()},t);this.disposable=Nt(()=>{n.clearInterval(a),this.disposable=void 0})}dispose(){this.cancel(),this.isDisposed=!0}},eD;(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})(eD||={});var Vb=class Ls{static fromArray(t){return new Ls(n=>{n.emitMany(t)})}static fromPromise(t){return new Ls(async n=>{n.emitMany(await t)})}static fromPromises(t){return new Ls(async n=>{await Promise.all(t.map(async a=>n.emitOne(await a)))})}static merge(t){return new Ls(async n=>{await Promise.all(t.map(async a=>{for await(let o of a)n.emitOne(o)}))})}constructor(t,n){this._state=0,this._results=[],this._error=null,this._onReturn=n,this._onStateChanged=new _e,queueMicrotask(async()=>{let a={emitOne:o=>this.emitOne(o),emitMany:o=>this.emitMany(o),reject:o=>this.reject(o)};try{await Promise.resolve(t(a)),this.resolve()}catch(o){this.reject(o)}finally{a.emitOne=void 0,a.emitMany=void 0,a.reject=void 0}})}[Symbol.asyncIterator](){let t=0;return{next:async()=>{do{if(this._state===2)throw this._error;if(t<this._results.length)return{done:!1,value:this._results[t++]};if(this._state===1)return{done:!0,value:void 0};await ji.toPromise(this._onStateChanged.event)}while(!0)},return:async()=>(this._onReturn?.(),{done:!0,value:void 0})}}static map(t,n){return new Ls(async a=>{for await(let o of t)a.emitOne(n(o))})}map(t){return Ls.map(this,t)}static filter(t,n){return new Ls(async a=>{for await(let o of t)n(o)&&a.emitOne(o)})}filter(t){return Ls.filter(this,t)}static coalesce(t){return Ls.filter(t,n=>!!n)}coalesce(){return Ls.coalesce(this)}static async toPromise(t){let n=[];for await(let a of t)n.push(a);return n}toPromise(){return Ls.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())}};Vb.EMPTY=Vb.fromArray([]);var{getWindow:sn,getWindowId:tD,onDidRegisterWindow:iD}=(function(){let e=new Map,t={window:Mn,disposables:new pr};e.set(Mn.vscodeWindowId,t);let n=new _e,a=new _e,o=new _e;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 Ve.None;let f=new pr,_={window:h,disposables:f.add(new pr)};return e.set(h.vscodeWindowId,_),f.add(Nt(()=>{e.delete(h.vscodeWindowId),a.fire(h)})),f.add(Pe(h,xi.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 sn(h).document}}})(),sD=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 Pe(e,t,n,a){return new sD(e,t,n,a)}var Xb=function(e,t,n,a){return Pe(e,t,n,a)},o_,nD=class extends Jk{constructor(e){super(),this.defaultTarget=e&&sn(e)}cancelAndSet(e,t,n){return super.cancelAndSet(e,t,n??this.defaultTarget)}},Gb=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){yu(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(Gb.sort),h.shift().execute();a.set(c,!1)};o_=(c,h,f=0)=>{let _=tD(c),p=new Gb(h,f),y=e.get(_);return y||(y=[],e.set(_,y)),y.push(p),n.get(_)||(n.set(_,!0),c.requestAnimationFrame(()=>o(_))),p}})();function rD(e){let t=e.getBoundingClientRect(),n=sn(e);return{left:t.left+n.scrollX,top:t.top+n.scrollY,width:t.width,height:t.height}}var xi={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"},aD=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 xo(e){return new aD(e)}var Nw=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(Nt(()=>{try{e.releasePointerCapture(t)}catch{}}))}catch{c=sn(e)}this._hooks.add(Pe(c,xi.POINTER_MOVE,h=>{if(h.buttons!==n){this.stopMonitoring(!0);return}h.preventDefault(),this._pointerMoveCallback(h)})),this._hooks.add(Pe(c,xi.POINTER_UP,h=>this.stopMonitoring(!0)))}};function lD(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 tn;(e=>(e.Tap="-xterm-gesturetap",e.Change="-xterm-gesturechange",e.Start="-xterm-gesturestart",e.End="-xterm-gesturesend",e.Contextmenu="-xterm-gesturecontextmenu"))(tn||={});var uo=class Ki extends Ve{constructor(){super(),this.dispatched=!1,this.targets=new Pb,this.ignoreTargets=new Pb,this.activeTouches={},this.handle=null,this._lastSetTapCountTime=0,this._register(ji.runAndSubscribe(iD,({window:t,disposables:n})=>{n.add(Pe(t.document,"touchstart",a=>this.onTouchStart(a),{passive:!1})),n.add(Pe(t.document,"touchend",a=>this.onTouchEnd(t,a))),n.add(Pe(t.document,"touchmove",a=>this.onTouchMove(a),{passive:!1}))},{window:Mn,disposables:this._store}))}static addTarget(t){if(!Ki.isTouchDevice())return Ve.None;Ki.INSTANCE||(Ki.INSTANCE=new Ki);let n=Ki.INSTANCE.targets.push(t);return Nt(n)}static ignoreTarget(t){if(!Ki.isTouchDevice())return Ve.None;Ki.INSTANCE||(Ki.INSTANCE=new Ki);let n=Ki.INSTANCE.ignoreTargets.push(t);return Nt(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(tn.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<Ki.HOLD_DELAY&&Math.abs(_.initialPageX-gs(_.rollingPageX))<30&&Math.abs(_.initialPageY-gs(_.rollingPageY))<30){let y=this.newGestureEvent(tn.Tap,_.initialTarget);y.pageX=gs(_.rollingPageX),y.pageY=gs(_.rollingPageY),this.dispatchEvent(y)}else if(p>=Ki.HOLD_DELAY&&Math.abs(_.initialPageX-gs(_.rollingPageX))<30&&Math.abs(_.initialPageY-gs(_.rollingPageY))<30){let y=this.newGestureEvent(tn.Contextmenu,_.initialTarget);y.pageX=gs(_.rollingPageX),y.pageY=gs(_.rollingPageY),this.dispatchEvent(y)}else if(o===1){let y=gs(_.rollingPageX),b=gs(_.rollingPageY),S=gs(_.rollingTimestamps)-_.rollingTimestamps[0],C=y-_.rollingPageX[0],x=b-_.rollingPageY[0],E=[...this.targets].filter(B=>_.initialTarget instanceof Node&&B.contains(_.initialTarget));this.inertia(t,E,a,Math.abs(C)/S,C>0?1:-1,y,Math.abs(x)/S,x>0?1:-1,b)}this.dispatchEvent(this.newGestureEvent(tn.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===tn.Tap){let n=new Date().getTime(),a=0;n-this._lastSetTapCountTime>Ki.CLEAR_TAP_COUNT_TIME?a=1:a=2,this._lastSetTapCountTime=n,t.tapCount=a}else(t.type===tn.Change||t.type===tn.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=o_(t,()=>{let y=Date.now(),b=y-a,S=0,C=0,x=!0;o+=Ki.SCROLL_FRICTION*b,f+=Ki.SCROLL_FRICTION*b,o>0&&(x=!1,S=c*o*b),f>0&&(x=!1,C=_*f*b);let E=this.newGestureEvent(tn.Change);E.translationX=S,E.translationY=C,n.forEach(B=>B.dispatchEvent(E)),x||this.inertia(t,n,y,o,c,h+S,f,_,p+C)})}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(tn.Change,h.initialTarget);f.translationX=c.pageX-gs(h.rollingPageX),f.translationY=c.pageY-gs(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)}};uo.SCROLL_FRICTION=-.005,uo.HOLD_DELAY=700,uo.CLEAR_TAP_COUNT_TIME=400,Wt([lD],uo,"isTouchDevice",1);var oD=uo,c_=class extends Ve{onclick(e,t){this._register(Pe(e,xi.CLICK,n=>t(new ou(sn(e),n))))}onmousedown(e,t){this._register(Pe(e,xi.MOUSE_DOWN,n=>t(new ou(sn(e),n))))}onmouseover(e,t){this._register(Pe(e,xi.MOUSE_OVER,n=>t(new ou(sn(e),n))))}onmouseleave(e,t){this._register(Pe(e,xi.MOUSE_LEAVE,n=>t(new ou(sn(e),n))))}onkeydown(e,t){this._register(Pe(e,xi.KEY_DOWN,n=>t(new Wb(n))))}onkeyup(e,t){this._register(Pe(e,xi.KEY_UP,n=>t(new Wb(n))))}oninput(e,t){this._register(Pe(e,xi.INPUT,t))}onblur(e,t){this._register(Pe(e,xi.BLUR,t))}onfocus(e,t){this._register(Pe(e,xi.FOCUS,t))}onchange(e,t){this._register(Pe(e,xi.CHANGE,t))}ignoreGesture(e){return oD.ignoreTarget(e)}},Zb=11,cD=class extends c_{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=Zb+"px",this.domNode.style.height=Zb+"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 Nw),this._register(Xb(this.bgDomNode,xi.POINTER_DOWN,t=>this._arrowPointerDown(t))),this._register(Xb(this.domNode,xi.POINTER_DOWN,t=>this._arrowPointerDown(t))),this._pointerdownRepeatTimer=this._register(new nD),this._pointerdownScheduleRepeatTimer=this._register(new l_)}_arrowPointerDown(e){if(!e.target||!(e.target instanceof Element))return;let t=()=>{this._pointerdownRepeatTimer.cancelAndSet(()=>this._onActivate(),1e3/24,sn(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()}},uD=class jp{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 jp(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 jp(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:_}}},hD=class extends Ve{constructor(e){super(),this._scrollableBrand=void 0,this._onScroll=this._register(new _e),this.onScroll=this._onScroll.event,this._smoothScrollDuration=e.smoothScrollDuration,this._scheduleAtNextAnimationFrame=e.scheduleAtNextAnimationFrame,this._state=new uD(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 Jb(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=Jb.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)))}},Qb=class{constructor(e,t,n){this.scrollLeft=e,this.scrollTop=t,this.isDone=n}};function Of(e,t){let n=t-e;return function(a){return e+n*pD(a)}}function dD(e,t,n){return function(a){return a<n?e(a/n):t((a-n)/(1-n))}}var Jb=class Hp{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),dD(Of(t,o),Of(c,n),.33)}return Of(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 Qb(a,o,!1)}return new Qb(this.to.scrollLeft,this.to.scrollTop,!0)}combine(t,n,a){return Hp.start(t,n,a)}static start(t,n,a){a=a+10;let o=Date.now()-10;return new Hp(t,n,o,a)}};function fD(e){return Math.pow(e,3)}function pD(e){return 1-fD(1-e)}var mD=class extends Ve{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 l_)}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":"")))}},_D=140,Aw=class extends c_{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 mD(e.visibility,"visible scrollbar "+e.extraScrollbarClassName,"invisible scrollbar "+e.extraScrollbarClassName)),this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._pointerMoveMonitor=this._register(new Nw),this._shouldRender=!0,this.domNode=xo(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(Pe(this.domNode.domNode,xi.POINTER_DOWN,t=>this._domNodePointerDown(t)))}_createArrow(e){let t=this._register(new cD(e));this.domNode.domNode.appendChild(t.bgDomNode),this.domNode.domNode.appendChild(t.domNode)}_createSlider(e,t,n,a){this.slider=xo(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(Pe(this.slider.domNode,xi.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=rD(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(kw&&h>_D){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()}},Lw=class Up{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 Up(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))),y=(f-p)/(o-a),b=c*y;return{computedAvailableSize:Math.round(h),computedIsNeeded:_,computedSliderSize:Math.round(p),computedSliderRatio:y,computedSliderPosition:Math.round(b)}}_refreshComputedValues(){let t=Up._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)}},gD=class extends Aw{constructor(e,t,n){let a=e.getScrollDimensions(),o=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:n,scrollbarState:new Lw(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}},vD=class extends Aw{constructor(e,t,n){let a=e.getScrollDimensions(),o=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:n,scrollbarState:new Lw(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}},yD=500,eS=50,bD=class{constructor(e,t,n){this.timestamp=e,this.deltaX=t,this.deltaY=n,this.score=0}},Pp=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(r_){let n=sn(t.browserEvent),a=Nk(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 bD(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),y=Math.max(o,h),b=Math.max(c,f);y%_===0&&b%p===0&&(a-=.5)}return Math.min(Math.max(a,0),1)}_isAlmostInt(t){return Math.abs(Math.round(t)-t)<.01}};Pp.INSTANCE=new Pp;var SD=Pp,wD=class extends c_{constructor(e,t,n){super(),this._onScroll=this._register(new _e),this.onScroll=this._onScroll.event,this._onWillScroll=this._register(new _e),this.onWillScroll=this._onWillScroll.event,this._options=xD(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 vD(this._scrollable,this._options,a)),this._horizontalScrollbar=this._register(new gD(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=xo(document.createElement("div")),this._leftShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._leftShadowDomNode.domNode),this._topShadowDomNode=xo(document.createElement("div")),this._topShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._topShadowDomNode.domNode),this._topLeftShadowDomNode=xo(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 l_),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,nn&&(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 Yb(e))}_setListeningToMouseWheel(e){if(this._mouseWheelToDispose.length>0!==e&&(this._mouseWheelToDispose=Jr(this._mouseWheelToDispose),e)){let t=n=>{this._onMouseWheel(new Yb(n))};this._mouseWheelToDispose.push(Pe(this._listenOnDomNode,xi.MOUSE_WHEEL,t,{passive:!1}))}}_onMouseWheel(e){if(e.browserEvent?.defaultPrevented)return;let t=SD.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=!nn&&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=eS*o,y=f.scrollTop-(p<0?Math.floor(p):Math.ceil(p));this._verticalScrollbar.writeScrollPosition(_,y)}if(c){let p=eS*c,y=f.scrollLeft-(p<0?Math.floor(p):Math.ceil(p));this._horizontalScrollbar.writeScrollPosition(_,y)}_=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(),yD)}},CD=class extends wD{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 xD(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,nn&&(t.className+=" mac"),t}var Ip=class extends Ve{constructor(e,t,n,a,o,c,h,f){super(),this._bufferService=n,this._optionsService=h,this._renderService=f,this._onRequestScrollLines=this._register(new _e),this.onRequestScrollLines=this._onRequestScrollLines.event,this._isSyncing=!1,this._isHandlingScroll=!1,this._suppressOnScrollHandler=!1;let _=this._register(new hD({forceIntegerValues:!1,smoothScrollDuration:this._optionsService.rawOptions.smoothScrollDuration,scheduleAtNextAnimationFrame:p=>o_(a.window,p)}));this._register(this._optionsService.onSpecificOptionChange("smoothScrollDuration",()=>{_.setSmoothScrollDuration(this._optionsService.rawOptions.smoothScrollDuration)})),this._scrollableElement=this._register(new CD(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(ji.runAndSubscribe(c.onChangeColors,()=>{this._scrollableElement.getDomNode().style.backgroundColor=c.colors.background.css})),e.appendChild(this._scrollableElement.getDomNode()),this._register(Nt(()=>this._scrollableElement.getDomNode().remove())),this._styleElement=a.mainDocument.createElement("style"),t.appendChild(this._styleElement),this._register(Nt(()=>this._styleElement.remove())),this._register(ji.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}};Ip=Wt([Se(2,Xi),Se(3,Ln),Se(4,fw),Se(5,nl),Se(6,Gi),Se(7,Bn)],Ip);var Kp=class extends Ve{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(Nt(()=>{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()}};Kp=Wt([Se(1,Xi),Se(2,Ln),Se(3,Fo),Se(4,Bn)],Kp);var ED=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)}},Js={full:0,left:0,center:0,right:0},lr={full:0,left:0,center:0,right:0},Jl={full:0,left:0,center:0,right:0},ju=class extends Ve{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 ED,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(Nt(()=>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);lr.full=this._canvas.width,lr.left=e,lr.center=t,lr.right=e,this._refreshDrawHeightConstants(),Jl.full=1,Jl.left=1,Jl.center=1+lr.left,Jl.right=1+lr.left+lr.center}_refreshDrawHeightConstants(){Js.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);Js.left=t,Js.center=t,Js.right=t}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Js.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Js.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Js.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Js.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(Jl[e.position||"full"],Math.round((this._canvas.height-1)*(e.startBufferLine/this._bufferService.buffers.active.lines.length)-Js[e.position||"full"]/2),lr[e.position||"full"],Math.round((this._canvas.height-1)*((e.endBufferLine-e.startBufferLine)/this._bufferService.buffers.active.lines.length)+Js[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}))}};ju=Wt([Se(2,Xi),Se(3,Fo),Se(4,Bn),Se(5,Gi),Se(6,nl),Se(7,Ln)],ju);var ce;(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=""))(ce||={});var wu;(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=""))(wu||={});var Bw;(e=>e.ST=`${ce.ESC}\\`)(Bw||={});var Fp=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(`${ce.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)}}};Fp=Wt([Se(2,Xi),Se(3,Gi),Se(4,ia),Se(5,Bn)],Fp);var ki=0,Di=0,Ri=0,qt=0,tS={css:"#00000000",rgba:0},ai;(e=>{function t(o,c,h,f){return f!==void 0?`#${Ir(o)}${Ir(c)}${Ir(h)}${Ir(f)}`:`#${Ir(o)}${Ir(c)}${Ir(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})(ai||={});var Dt;(e=>{function t(_,p){if(qt=(p.rgba&255)/255,qt===1)return{css:p.css,rgba:p.rgba};let y=p.rgba>>24&255,b=p.rgba>>16&255,S=p.rgba>>8&255,C=_.rgba>>24&255,x=_.rgba>>16&255,E=_.rgba>>8&255;ki=C+Math.round((y-C)*qt),Di=x+Math.round((b-x)*qt),Ri=E+Math.round((S-E)*qt);let B=ai.toCss(ki,Di,Ri),k=ai.toRgba(ki,Di,Ri);return{css:B,rgba:k}}e.blend=t;function n(_){return(_.rgba&255)===255}e.isOpaque=n;function a(_,p,y){let b=Cu.ensureContrastRatio(_.rgba,p.rgba,y);if(b)return ai.toColor(b>>24&255,b>>16&255,b>>8&255)}e.ensureContrastRatio=a;function o(_){let p=(_.rgba|255)>>>0;return[ki,Di,Ri]=Cu.toChannels(p),{css:ai.toCss(ki,Di,Ri),rgba:p}}e.opaque=o;function c(_,p){return qt=Math.round(p*255),[ki,Di,Ri]=Cu.toChannels(_.rgba),{css:ai.toCss(ki,Di,Ri,qt),rgba:ai.toRgba(ki,Di,Ri,qt)}}e.opacity=c;function h(_,p){return qt=_.rgba&255,c(_,qt*p/255)}e.multiplyOpacity=h;function f(_){return[_.rgba>>24&255,_.rgba>>16&255,_.rgba>>8&255]}e.toColorRGB=f})(Dt||={});var Ot;(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 ki=parseInt(o.slice(1,2).repeat(2),16),Di=parseInt(o.slice(2,3).repeat(2),16),Ri=parseInt(o.slice(3,4).repeat(2),16),ai.toColor(ki,Di,Ri);case 5:return ki=parseInt(o.slice(1,2).repeat(2),16),Di=parseInt(o.slice(2,3).repeat(2),16),Ri=parseInt(o.slice(3,4).repeat(2),16),qt=parseInt(o.slice(4,5).repeat(2),16),ai.toColor(ki,Di,Ri,qt);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 ki=parseInt(c[1]),Di=parseInt(c[2]),Ri=parseInt(c[3]),qt=Math.round((c[5]===void 0?1:parseFloat(c[5]))*255),ai.toColor(ki,Di,Ri,qt);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),[ki,Di,Ri,qt]=t.getImageData(0,0,1,1).data,qt!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:ai.toRgba(ki,Di,Ri,qt),css:o}}e.toColor=a})(Ot||={});var Vi;(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),y=f<=.03928?f/12.92:Math.pow((f+.055)/1.055,2.4),b=_<=.03928?_/12.92:Math.pow((_+.055)/1.055,2.4);return p*.2126+y*.7152+b*.0722}e.relativeLuminance2=n})(Vi||={});var Cu;(e=>{function t(h,f){if(qt=(f&255)/255,qt===1)return f;let _=f>>24&255,p=f>>16&255,y=f>>8&255,b=h>>24&255,S=h>>16&255,C=h>>8&255;return ki=b+Math.round((_-b)*qt),Di=S+Math.round((p-S)*qt),Ri=C+Math.round((y-C)*qt),ai.toRgba(ki,Di,Ri)}e.blend=t;function n(h,f,_){let p=Vi.relativeLuminance(h>>8),y=Vi.relativeLuminance(f>>8);if(Tn(p,y)<_){if(y<p){let C=a(h,f,_),x=Tn(p,Vi.relativeLuminance(C>>8));if(x<_){let E=o(h,f,_),B=Tn(p,Vi.relativeLuminance(E>>8));return x>B?C:E}return C}let b=o(h,f,_),S=Tn(p,Vi.relativeLuminance(b>>8));if(S<_){let C=a(h,f,_),x=Tn(p,Vi.relativeLuminance(C>>8));return S>x?b:C}return b}}e.ensureContrastRatio=n;function a(h,f,_){let p=h>>24&255,y=h>>16&255,b=h>>8&255,S=f>>24&255,C=f>>16&255,x=f>>8&255,E=Tn(Vi.relativeLuminance2(S,C,x),Vi.relativeLuminance2(p,y,b));for(;E<_&&(S>0||C>0||x>0);)S-=Math.max(0,Math.ceil(S*.1)),C-=Math.max(0,Math.ceil(C*.1)),x-=Math.max(0,Math.ceil(x*.1)),E=Tn(Vi.relativeLuminance2(S,C,x),Vi.relativeLuminance2(p,y,b));return(S<<24|C<<16|x<<8|255)>>>0}e.reduceLuminance=a;function o(h,f,_){let p=h>>24&255,y=h>>16&255,b=h>>8&255,S=f>>24&255,C=f>>16&255,x=f>>8&255,E=Tn(Vi.relativeLuminance2(S,C,x),Vi.relativeLuminance2(p,y,b));for(;E<_&&(S<255||C<255||x<255);)S=Math.min(255,S+Math.ceil((255-S)*.1)),C=Math.min(255,C+Math.ceil((255-C)*.1)),x=Math.min(255,x+Math.ceil((255-x)*.1)),E=Tn(Vi.relativeLuminance2(S,C,x),Vi.relativeLuminance2(p,y,b));return(S<<24|C<<16|x<<8|255)>>>0}e.increaseLuminance=o;function c(h){return[h>>24&255,h>>16&255,h>>8&255,h&255]}e.toChannels=c})(Cu||={});function Ir(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 TD=class extends Ko{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()]}},Hu=class{constructor(e){this._bufferService=e,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new js}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 y=this._getJoinedRanges(a,h,c,t,o);for(let b=0;b<y.length;b++)n.push(y[b])}o=p,h=c,f=this._workCell.fg,_=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 y=0;y<p.length;y++)n.push(p[y])}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++)Hu._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||dr.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}};Hu=Wt([Se(0,Xi)],Hu);function kD(e){return 57508<=e&&e<=57558}function DD(e){return 9472<=e&&e<=9631}function RD(e){return kD(e)||DD(e)}function MD(){return{css:{canvas:cu(),cell:cu()},device:{canvas:cu(),cell:cu(),char:{width:0,height:0,left:0,top:0}}}}function cu(){return{width:0,height:0}}var qp=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 js,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,y){let b=[],S=this._characterJoinerService.getJoinedCharacters(t),C=this._themeService.colors,x=e.getNoBgTrimmedLength();n&&x<c+1&&(x=c+1);let E,B=0,k="",H=0,U=0,X=0,ee=0,te=!1,ne=0,re=!1,fe=0,K=0,A=[],I=p!==-1&&y!==-1;for(let O=0;O<x;O++){e.loadCell(O,this._workCell);let j=this._workCell.getWidth();if(j===0)continue;let J=!1,T=O>=K,W=O,F=this._workCell;if(S.length>0&&O===S[0][0]&&T){let Ee=S.shift(),ie=this._isCellInSelection(Ee[0],t);for(H=Ee[0]+1;H<Ee[1];H++)T&&=ie===this._isCellInSelection(H,t);T&&=!n||c<Ee[0]||c>=Ee[1],T?(J=!0,F=new TD(this._workCell,e.translateToString(!0,Ee[0],Ee[1]),Ee[1]-Ee[0]),W=Ee[1]-1,j=F.getWidth()):K=Ee[1]}let me=this._isCellInSelection(O,t),we=n&&O===c,R=I&&O>=p&&O<=y,G=!1;this._decorationService.forEachDecorationAtCell(O,t,void 0,Ee=>{G=!0});let ae=F.getChars()||dr;if(ae===" "&&(F.isUnderline()||F.isOverline())&&(ae=" "),fe=j*f-_.get(ae,F.isBold(),F.isItalic()),!E)E=this._document.createElement("span");else if(B&&(me&&re||!me&&!re&&F.bg===U)&&(me&&re&&C.selectionForeground||F.fg===X)&&F.extended.ext===ee&&R===te&&fe===ne&&!we&&!J&&!G&&T){F.isInvisible()?k+=dr:k+=ae,B++;continue}else B&&(E.textContent=k),E=this._document.createElement("span"),B=0,k="";if(U=F.bg,X=F.fg,ee=F.extended.ext,te=R,ne=fe,re=me,J&&c>=O&&c<=W&&(c=O),!this._coreService.isCursorHidden&&we&&this._coreService.isCursorInitialized){if(A.push("xterm-cursor"),this._coreBrowserService.isFocused)h&&A.push("xterm-cursor-blink"),A.push(a==="bar"?"xterm-cursor-bar":a==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(o)switch(o){case"outline":A.push("xterm-cursor-outline");break;case"block":A.push("xterm-cursor-block");break;case"bar":A.push("xterm-cursor-bar");break;case"underline":A.push("xterm-cursor-underline");break}}if(F.isBold()&&A.push("xterm-bold"),F.isItalic()&&A.push("xterm-italic"),F.isDim()&&A.push("xterm-dim"),F.isInvisible()?k=dr:k=F.getChars()||dr,F.isUnderline()&&(A.push(`xterm-underline-${F.extended.underlineStyle}`),k===" "&&(k=" "),!F.isUnderlineColorDefault()))if(F.isUnderlineColorRGB())E.style.textDecorationColor=`rgb(${Ko.toColorRGB(F.getUnderlineColor()).join(",")})`;else{let Ee=F.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&F.isBold()&&Ee<8&&(Ee+=8),E.style.textDecorationColor=C.ansi[Ee].css}F.isOverline()&&(A.push("xterm-overline"),k===" "&&(k=" ")),F.isStrikethrough()&&A.push("xterm-strikethrough"),R&&(E.style.textDecoration="underline");let de=F.getFgColor(),ge=F.getFgColorMode(),ye=F.getBgColor(),xe=F.getBgColorMode(),Fe=!!F.isInverse();if(Fe){let Ee=de;de=ye,ye=Ee;let ie=ge;ge=xe,xe=ie}let he,ve,ze=!1;this._decorationService.forEachDecorationAtCell(O,t,void 0,Ee=>{Ee.options.layer!=="top"&&ze||(Ee.backgroundColorRGB&&(xe=50331648,ye=Ee.backgroundColorRGB.rgba>>8&16777215,he=Ee.backgroundColorRGB),Ee.foregroundColorRGB&&(ge=50331648,de=Ee.foregroundColorRGB.rgba>>8&16777215,ve=Ee.foregroundColorRGB),ze=Ee.options.layer==="top")}),!ze&&me&&(he=this._coreBrowserService.isFocused?C.selectionBackgroundOpaque:C.selectionInactiveBackgroundOpaque,ye=he.rgba>>8&16777215,xe=50331648,ze=!0,C.selectionForeground&&(ge=50331648,de=C.selectionForeground.rgba>>8&16777215,ve=C.selectionForeground)),ze&&A.push("xterm-decoration-top");let Re;switch(xe){case 16777216:case 33554432:Re=C.ansi[ye],A.push(`xterm-bg-${ye}`);break;case 50331648:Re=ai.toColor(ye>>16,ye>>8&255,ye&255),this._addStyle(E,`background-color:#${iS((ye>>>0).toString(16),"0",6)}`);break;default:Fe?(Re=C.foreground,A.push("xterm-bg-257")):Re=C.background}switch(he||F.isDim()&&(he=Dt.multiplyOpacity(Re,.5)),ge){case 16777216:case 33554432:F.isBold()&&de<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(de+=8),this._applyMinimumContrast(E,Re,C.ansi[de],F,he,void 0)||A.push(`xterm-fg-${de}`);break;case 50331648:let Ee=ai.toColor(de>>16&255,de>>8&255,de&255);this._applyMinimumContrast(E,Re,Ee,F,he,ve)||this._addStyle(E,`color:#${iS(de.toString(16),"0",6)}`);break;default:this._applyMinimumContrast(E,Re,C.foreground,F,he,ve)||Fe&&A.push("xterm-fg-257")}A.length&&(E.className=A.join(" "),A.length=0),!we&&!J&&!G&&T?B++:E.textContent=k,fe!==this.defaultSpacing&&(E.style.letterSpacing=`${fe}px`),b.push(E),O=W}return E&&B&&(E.textContent=k),b}_applyMinimumContrast(e,t,n,a,o,c){if(this._optionsService.rawOptions.minimumContrastRatio===1||RD(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=Dt.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]}};qp=Wt([Se(1,_w),Se(2,Gi),Se(3,Ln),Se(4,ia),Se(5,Fo),Se(6,nl)],qp);function iS(e,t,n){for(;e.length<n;)e=t+e;return e}var ND=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}},AD=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 LD(){return new AD}var zf="xterm-dom-renderer-owner-",As="xterm-rows",uu="xterm-fg-",sS="xterm-bg-",eo="xterm-focus",hu="xterm-selection",BD=1,Wp=class extends Ve{constructor(e,t,n,a,o,c,h,f,_,p,y,b,S,C){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=y,this._coreService=b,this._coreBrowserService=S,this._themeService=C,this._terminalClass=BD++,this._rowElements=[],this._selectionRenderModel=LD(),this.onRequestRedraw=this._register(new _e).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(As),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(hu),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=MD(),this._updateDimensions(),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._themeService.onChangeColors(x=>this._injectCss(x))),this._injectCss(this._themeService.colors),this._rowFactory=f.createInstance(qp,document),this._element.classList.add(zf+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this._register(this._linkifier2.onShowLinkUnderline(x=>this._handleLinkHover(x))),this._register(this._linkifier2.onHideLinkUnderline(x=>this._handleLinkLeave(x))),this._register(Nt(()=>{this._element.classList.remove(zf+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()})),this._widthCache=new ND(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} .${As} 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} .${As} { 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} .${As} .xterm-dim { color: ${Dt.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} .${As}.${eo} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${n} 1s step-end infinite;}${this._terminalSelector} .${As}.${eo} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${a} 1s step-end infinite;}${this._terminalSelector} .${As}.${eo} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${o} 1s step-end infinite;}${this._terminalSelector} .${As} .xterm-cursor.xterm-cursor-block { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css};}${this._terminalSelector} .${As} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${e.cursor.css} !important; color: ${e.cursorAccent.css} !important;}${this._terminalSelector} .${As} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${e.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${As} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${e.cursor.css} inset;}${this._terminalSelector} .${As} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${e.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,t+=`${this._terminalSelector} .${hu} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${hu} div { position: absolute; background-color: ${e.selectionBackgroundOpaque.css};}${this._terminalSelector} .${hu} div { position: absolute; background-color: ${e.selectionInactiveBackgroundOpaque.css};}`;for(let[c,h]of e.ansi.entries())t+=`${this._terminalSelector} .${uu}${c} { color: ${h.css}; }${this._terminalSelector} .${uu}${c}.xterm-dim { color: ${Dt.multiplyOpacity(h,.5).css}; }${this._terminalSelector} .${sS}${c} { background-color: ${h.css}; }`;t+=`${this._terminalSelector} .${uu}257 { color: ${Dt.opaque(e.background).css}; }${this._terminalSelector} .${uu}257.xterm-dim { color: ${Dt.multiplyOpacity(Dt.opaque(e.background),.5).css}; }${this._terminalSelector} .${sS}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(eo),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(eo),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 y=h-c-1;if(f.appendChild(this._createSelectionElement(c+1,0,this._bufferService.cols,y)),c!==h){let b=o===h?t[0]:this._bufferService.cols;f.appendChild(this._createSelectionElement(h,0,b))}}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,y=this._rowElements[_],b=n.lines.get(p);if(!y||!b)break;y.replaceChildren(...this._rowFactory.createRow(b,p,p===a,h,f,o,c,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${zf}${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),y=this._optionsService.rawOptions.cursorBlink,b=this._optionsService.rawOptions.cursorStyle,S=this._optionsService.rawOptions.cursorInactiveStyle;for(let C=n;C<=a;++C){let x=C+f.ydisp,E=this._rowElements[C],B=f.lines.get(x);if(!E||!B)break;E.replaceChildren(...this._rowFactory.createRow(B,x,x===_,b,S,p,y,this.dimensions.css.cell.width,this._widthCache,c?C===n?e:0:-1,c?(C===a?t:o)-1:-1))}}};Wp=Wt([Se(7,i_),Se(8,nh),Se(9,Gi),Se(10,Xi),Se(11,ia),Se(12,Ln),Se(13,nl)],Wp);var $p=class extends Ve{constructor(e,t,n){super(),this._optionsService=n,this.width=0,this.height=0,this._onCharSizeChange=this._register(new _e),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this._register(new zD(this._optionsService))}catch{this._measureStrategy=this._register(new OD(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())}};$p=Wt([Se(2,Gi)],$p);var Ow=class extends Ve{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)}},OD=class extends Ow{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}},zD=class extends Ow{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}},jD=class extends Ve{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 HD(this._window)),this._onDprChange=this._register(new _e),this.onDprChange=this._onDprChange.event,this._onWindowChange=this._register(new _e),this.onWindowChange=this._onWindowChange.event,this._register(this.onWindowChange(a=>this._screenDprMonitor.setWindow(a))),this._register(ji.forward(this._screenDprMonitor.onDprChange,this._onDprChange)),this._register(Pe(this._textarea,"focus",()=>this._isFocused=!0)),this._register(Pe(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}},HD=class extends Ve{constructor(e){super(),this._parentWindow=e,this._windowResizeListener=this._register(new tl),this._onDprChange=this._register(new _e),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this._register(Nt(()=>this.clearListener()))}setWindow(e){this._parentWindow=e,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=Pe(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)}},UD=class extends Ve{constructor(){super(),this.linkProviders=[],this._register(Nt(()=>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 u_(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 PD(e,t,n,a,o,c,h,f,_){if(!c)return;let p=u_(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 Yp=class{constructor(e,t){this._renderService=e,this._charSizeService=t}getCoords(e,t,n,a,o){return PD(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=u_(window,e,t);if(this._charSizeService.hasValidSize)return n[0]=Math.min(Math.max(n[0],0),this._renderService.dimensions.css.canvas.width-1),n[1]=Math.min(Math.max(n[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(n[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(n[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(n[0]),y:Math.floor(n[1])}}};Yp=Wt([Se(0,Bn),Se(1,nh)],Yp);var ID=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=[]}},zw={};ZT(zw,{getSafariVersion:()=>FD,isChromeOS:()=>Pw,isFirefox:()=>jw,isIpad:()=>qD,isIphone:()=>WD,isLegacyEdge:()=>KD,isLinux:()=>h_,isMac:()=>Uu,isNode:()=>rh,isSafari:()=>Hw,isWindows:()=>Uw});var rh=typeof process<"u"&&"title"in process,qo=rh?"node":navigator.userAgent,Wo=rh?"node":navigator.platform,jw=qo.includes("Firefox"),KD=qo.includes("Edge"),Hw=/^((?!chrome|android).)*safari/i.test(qo);function FD(){if(!Hw)return 0;let e=qo.match(/Version\/(\d+)/);return e===null||e.length<2?0:parseInt(e[1])}var Uu=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(Wo),qD=Wo==="iPad",WD=Wo==="iPhone",Uw=["Windows","Win16","Win32","WinCE"].includes(Wo),h_=Wo.indexOf("Linux")>=0,Pw=/\bCrOS\b/.test(qo),Iw=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()}},$D=class extends Iw{_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())}}},YD=class extends Iw{_requestCallback(e){return requestIdleCallback(e)}_cancelCallback(e){cancelIdleCallback(e)}},Pu=!rh&&"requestIdleCallback"in window?YD:$D,VD=class{constructor(){this._queue=new Pu}set(e){this._queue.clear(),this._queue.enqueue(e)}flush(){this._queue.flush()}},Vp=class extends Ve{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 tl),this._pausedResizeTask=new VD,this._observerDisposable=this._register(new tl),this._isPaused=!1,this._needsFullRefresh=!1,this._isNextRenderRedrawOnly=!0,this._needsSelectionRefresh=!1,this._canvasWidth=0,this._canvasHeight=0,this._selectionState={start:void 0,end:void 0,columnSelectMode:!1},this._onDimensionsChange=this._register(new _e),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this._register(new _e),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this._register(new _e),this.onRender=this._onRender.event,this._onRefreshRequest=this._register(new _e),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new ID((p,y)=>this._renderRows(p,y),this._coreBrowserService),this._register(this._renderDebouncer),this._syncOutputHandler=new XD(this._coreBrowserService,this._coreService,()=>this._fullRefresh()),this._register(Nt(()=>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=Nt(()=>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()}};Vp=Wt([Se(2,Gi),Se(3,nh),Se(4,ia),Se(5,Fo),Se(6,Xi),Se(7,Ln),Se(8,nl)],Vp);var XD=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 GD(e,t,n,a){let o=n.buffer.x,c=n.buffer.y;if(!n.buffer.hasScrollback)return JD(o,c,e,t,n,a)+ah(c,t,n,a)+eR(o,c,e,t,n,a);let h;if(c===t)return h=o>e?"D":"C",No(Math.abs(o-e),Mo(h,a));h=c>t?"D":"C";let f=Math.abs(c-t),_=QD(c>t?e:o,n)+(f-1)*n.cols+1+ZD(c>t?o:e);return No(_,Mo(h,a))}function ZD(e,t){return e-1}function QD(e,t){return t.cols-e}function JD(e,t,n,a,o,c){return ah(t,a,o,c).length===0?"":No(Fw(e,t,e,t-ea(t,o),!1,o).length,Mo("D",c))}function ah(e,t,n,a){let o=e-ea(e,n),c=t-ea(t,n),h=Math.abs(o-c)-tR(e,t,n);return No(h,Mo(Kw(e,t),a))}function eR(e,t,n,a,o,c){let h;ah(t,a,o,c).length>0?h=a-ea(a,o):h=t;let f=a,_=iR(e,t,n,a,o,c);return No(Fw(e,h,n,f,_==="C",o).length,Mo(_,c))}function tR(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=Kw(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 iR(e,t,n,a,o,c){let h;return ah(n,a,o,c).length>0?h=a-ea(a,o):h=t,e<n&&h<=a||e>=n&&h<a?"C":"D"}function Kw(e,t){return e>t?"A":"B"}function Fw(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 Mo(e,t){let n=t?"O":"[";return ce.ESC+n+e}function No(e,t){e=Math.floor(e);let n="";for(let a=0;a<e;a++)n+=t;return n}var sR=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 nS(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 jf=50,nR=15,rR=50,aR=500,lR=" ",oR=new RegExp(lR,"g"),Xp=class extends Ve{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 js,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this._register(new _e),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this._register(new _e),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this._register(new _e),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this._register(new _e),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=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 sR(this._bufferService),this._activeSelectionMode=0,this._register(Nt(()=>{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(oR," ")).join(Uw?`\r
|
|
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())),h_&&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=nS(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=u_(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,-jf),jf),t/=jf,t/Math.abs(t)+Math.round(t*(nR-1)))}shouldForceSelection(e){return Uu?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(),rR)}_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&&!(Uu&&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<aR&&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=GD(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,y=0,b=0,S=0,C=0;if(h.charAt(f)===" "){for(;f>0&&h.charAt(f-1)===" ";)f--;for(;_<h.length&&h.charAt(_+1)===" ";)_++}else{let B=e[0],k=e[0];c.getWidth(B)===0&&(y++,B--),c.getWidth(k)===2&&(b++,k++);let H=c.getString(k).length;for(H>1&&(C+=H-1,_+=H-1);B>0&&f>0&&!this._isCharWordSeparator(c.loadCell(B-1,this._workCell));){c.loadCell(B-1,this._workCell);let U=this._workCell.getChars().length;this._workCell.getWidth()===0?(y++,B--):U>1&&(S+=U-1,f-=U-1),f--,B--}for(;k<c.length&&_+1<h.length&&!this._isCharWordSeparator(c.loadCell(k+1,this._workCell));){c.loadCell(k+1,this._workCell);let U=this._workCell.getChars().length;this._workCell.getWidth()===2?(b++,k++):U>1&&(C+=U-1,_+=U-1),_++,k++}}_++;let x=f+p-y+S,E=Math.min(this._bufferService.cols,_-f+y+b-S-C);if(!(!t&&h.slice(f,_).trim()==="")){if(n&&x===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 k=this._getWordAt([this._bufferService.cols-1,e[1]-1],!1,!0,!1);if(k){let H=this._bufferService.cols-k.start;x-=H,E+=H}}}if(a&&x+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 k=this._getWordAt([0,e[1]+1],!1,!1,!0);k&&(E+=k.length)}}return{start:x,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=nS(n,this._bufferService.cols)}};Xp=Wt([Se(3,Xi),Se(4,ia),Se(5,s_),Se(6,Gi),Se(7,Bn),Se(8,Ln)],Xp);var rS=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={}}},aS=class{constructor(){this._color=new rS,this._css=new rS}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()}},di=Object.freeze((()=>{let e=[Ot.toColor("#2e3436"),Ot.toColor("#cc0000"),Ot.toColor("#4e9a06"),Ot.toColor("#c4a000"),Ot.toColor("#3465a4"),Ot.toColor("#75507b"),Ot.toColor("#06989a"),Ot.toColor("#d3d7cf"),Ot.toColor("#555753"),Ot.toColor("#ef2929"),Ot.toColor("#8ae234"),Ot.toColor("#fce94f"),Ot.toColor("#729fcf"),Ot.toColor("#ad7fa8"),Ot.toColor("#34e2e2"),Ot.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:ai.toCss(a,o,c),rgba:ai.toRgba(a,o,c)})}for(let n=0;n<24;n++){let a=8+n*10;e.push({css:ai.toCss(a,a,a),rgba:ai.toRgba(a,a,a)})}return e})()),Fr=Ot.toColor("#ffffff"),ho=Ot.toColor("#000000"),lS=Ot.toColor("#ffffff"),oS=ho,to={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117},cR=Fr,Gp=class extends Ve{constructor(e){super(),this._optionsService=e,this._contrastCache=new aS,this._halfContrastCache=new aS,this._onChangeColors=this._register(new _e),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:Fr,background:ho,cursor:lS,cursorAccent:oS,selectionForeground:void 0,selectionBackgroundTransparent:to,selectionBackgroundOpaque:Dt.blend(ho,to),selectionInactiveBackgroundTransparent:to,selectionInactiveBackgroundOpaque:Dt.blend(ho,to),scrollbarSliderBackground:Dt.opacity(Fr,.2),scrollbarSliderHoverBackground:Dt.opacity(Fr,.4),scrollbarSliderActiveBackground:Dt.opacity(Fr,.5),overviewRulerBorder:Fr,ansi:di.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=yt(e.foreground,Fr),t.background=yt(e.background,ho),t.cursor=Dt.blend(t.background,yt(e.cursor,lS)),t.cursorAccent=Dt.blend(t.background,yt(e.cursorAccent,oS)),t.selectionBackgroundTransparent=yt(e.selectionBackground,to),t.selectionBackgroundOpaque=Dt.blend(t.background,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundTransparent=yt(e.selectionInactiveBackground,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundOpaque=Dt.blend(t.background,t.selectionInactiveBackgroundTransparent),t.selectionForeground=e.selectionForeground?yt(e.selectionForeground,tS):void 0,t.selectionForeground===tS&&(t.selectionForeground=void 0),Dt.isOpaque(t.selectionBackgroundTransparent)&&(t.selectionBackgroundTransparent=Dt.opacity(t.selectionBackgroundTransparent,.3)),Dt.isOpaque(t.selectionInactiveBackgroundTransparent)&&(t.selectionInactiveBackgroundTransparent=Dt.opacity(t.selectionInactiveBackgroundTransparent,.3)),t.scrollbarSliderBackground=yt(e.scrollbarSliderBackground,Dt.opacity(t.foreground,.2)),t.scrollbarSliderHoverBackground=yt(e.scrollbarSliderHoverBackground,Dt.opacity(t.foreground,.4)),t.scrollbarSliderActiveBackground=yt(e.scrollbarSliderActiveBackground,Dt.opacity(t.foreground,.5)),t.overviewRulerBorder=yt(e.overviewRulerBorder,cR),t.ansi=di.slice(),t.ansi[0]=yt(e.black,di[0]),t.ansi[1]=yt(e.red,di[1]),t.ansi[2]=yt(e.green,di[2]),t.ansi[3]=yt(e.yellow,di[3]),t.ansi[4]=yt(e.blue,di[4]),t.ansi[5]=yt(e.magenta,di[5]),t.ansi[6]=yt(e.cyan,di[6]),t.ansi[7]=yt(e.white,di[7]),t.ansi[8]=yt(e.brightBlack,di[8]),t.ansi[9]=yt(e.brightRed,di[9]),t.ansi[10]=yt(e.brightGreen,di[10]),t.ansi[11]=yt(e.brightYellow,di[11]),t.ansi[12]=yt(e.brightBlue,di[12]),t.ansi[13]=yt(e.brightMagenta,di[13]),t.ansi[14]=yt(e.brightCyan,di[14]),t.ansi[15]=yt(e.brightWhite,di[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]=yt(e.extendedAnsi[a],di[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()}}};Gp=Wt([Se(0,Gi)],Gp);function yt(e,t){if(e!==void 0)try{return Ot.toColor(e)}catch{}return t}var uR=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)}},hR=class{constructor(){this._services=new uR,this._services.set(i_,this)}setService(e,t){this._services.set(e,t)}getService(e){return this._services.get(e)}createInstance(e,...t){let n=nk(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)}},dR={trace:0,debug:1,info:2,warn:3,error:4,off:5},fR="xterm.js: ",Zp=class extends Ve{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=dR[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?"":fR)+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)}};Zp=Wt([Se(0,Gi)],Zp);var cS=class extends Ve{constructor(e){super(),this._maxLength=e,this.onDeleteEmitter=this._register(new _e),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this._register(new _e),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this._register(new _e),this.onTrim=this.onTrimEmitter.event,this._array=new Array(this._maxLength),this._startIndex=0,this._length=0}get maxLength(){return this._maxLength}set maxLength(e){if(this._maxLength===e)return;let t=new Array(e);for(let n=0;n<Math.min(e,this.length);n++)t[n]=this._array[this._getCyclicIndex(n)];this._array=t,this._maxLength=e,this._startIndex=0}get length(){return this._length}set length(e){if(e>this._length)for(let t=this._length;t<e;t++)this._array[t]=void 0;this._length=e}get(e){return this._array[this._getCyclicIndex(e)]}set(e,t){this._array[this._getCyclicIndex(e)]=t}push(e){this._array[this._getCyclicIndex(this._length)]=e,this._length===this._maxLength?(this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1)):this._length++}recycle(){if(this._length!==this._maxLength)throw new Error("Can only recycle when the buffer is full");return this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1),this._array[this._getCyclicIndex(this._length-1)]}get isFull(){return this._length===this._maxLength}pop(){return this._array[this._getCyclicIndex(this._length---1)]}splice(e,t,...n){if(t){for(let a=e;a<this._length-t;a++)this._array[this._getCyclicIndex(a)]=this._array[this._getCyclicIndex(a+t)];this._length-=t,this.onDeleteEmitter.fire({index:e,amount:t})}for(let a=this._length-1;a>=e;a--)this._array[this._getCyclicIndex(a+n.length)]=this._array[this._getCyclicIndex(a)];for(let a=0;a<n.length;a++)this._array[this._getCyclicIndex(e+a)]=n[a];if(n.length&&this.onInsertEmitter.fire({index:e,amount:n.length}),this._length+n.length>this._maxLength){let a=this._length+n.length-this._maxLength;this._startIndex+=a,this._length=this._maxLength,this.onTrimEmitter.fire(a)}else this._length+=n.length}trimStart(e){e>this._length&&(e=this._length),this._startIndex+=e,this._length-=e,this.onTrimEmitter.fire(e)}shiftElements(e,t,n){if(!(t<=0)){if(e<0||e>=this._length)throw new Error("start argument out of range");if(e+n<0)throw new Error("Cannot shift elements in list beyond index 0");if(n>0){for(let o=t-1;o>=0;o--)this.set(e+o+n,this.get(e+o));let a=e+t+n-this._length;if(a>0)for(this._length+=a;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let a=0;a<t;a++)this.set(e+a+n,this.get(e+a))}}_getCyclicIndex(e){return(this._startIndex+e)%this._maxLength}},Ye=3,ri=Object.freeze(new Ko),du=0,Hf=2,fo=class qw{constructor(t,n,a=!1){this.isWrapped=a,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(t*Ye);let o=n||js.fromCharData([0,cw,1,0]);for(let c=0;c<t;++c)this.setCell(c,o);this.length=t}get(t){let n=this._data[t*Ye+0],a=n&2097151;return[this._data[t*Ye+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*Ye+1]=n[0],n[1].length>1?(this._combined[t]=n[1],this._data[t*Ye+0]=t|2097152|n[2]<<22):this._data[t*Ye+0]=n[1].charCodeAt(0)|n[2]<<22}getWidth(t){return this._data[t*Ye+0]>>22}hasWidth(t){return this._data[t*Ye+0]&12582912}getFg(t){return this._data[t*Ye+1]}getBg(t){return this._data[t*Ye+2]}hasContent(t){return this._data[t*Ye+0]&4194303}getCodePoint(t){let n=this._data[t*Ye+0];return n&2097152?this._combined[t].charCodeAt(this._combined[t].length-1):n&2097151}isCombined(t){return this._data[t*Ye+0]&2097152}getString(t){let n=this._data[t*Ye+0];return n&2097152?this._combined[t]:n&2097151?hr(n&2097151):""}isProtected(t){return this._data[t*Ye+2]&536870912}loadCell(t,n){return du=t*Ye,n.content=this._data[du+0],n.fg=this._data[du+1],n.bg=this._data[du+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*Ye+0]=n.content,this._data[t*Ye+1]=n.fg,this._data[t*Ye+2]=n.bg}setCellFromCodepoint(t,n,a,o){o.bg&268435456&&(this._extendedAttrs[t]=o.extended),this._data[t*Ye+0]=n|a<<22,this._data[t*Ye+1]=o.fg,this._data[t*Ye+2]=o.bg}addCodepointToCell(t,n,a){let o=this._data[t*Ye+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*Ye+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 js;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 js;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*Hf<this._data.buffer.byteLength;let a=t*Ye;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*Hf<this._data.buffer.byteLength}cleanupMemory(){if(this._data.length*4*Hf<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 qw(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*Ye+0]&4194303)return t+(this._data[t*Ye+0]>>22);return 0}getNoBgTrimmedLength(){for(let t=this.length-1;t>=0;--t)if(this._data[t*Ye+0]&4194303||this._data[t*Ye+2]&50331648)return t+(this._data[t*Ye+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<Ye;p++)this._data[(a+_)*Ye+p]=h[(n+_)*Ye+p];h[(n+_)*Ye+2]&268435456&&(this._extendedAttrs[a+_]=t._extendedAttrs[n+_])}else for(let _=0;_<o;_++){for(let p=0;p<Ye;p++)this._data[(a+_)*Ye+p]=h[(n+_)*Ye+p];h[(n+_)*Ye+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*Ye+0],f=h&2097151,_=h&2097152?this._combined[n]:f?hr(f):dr;if(c+=_,o)for(let p=0;p<_.length;++p)o.push(n);n+=h>>22||1}return o&&o.push(n),c}};function pR(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 y=[e.get(f)];for(;_<e.length&&p.isWrapped;)y.push(p),p=e.get(++_);if(!c&&a>=f&&a<_){f+=y.length-1;continue}let b=0,S=Ao(y,b,t),C=1,x=0;for(;C<y.length;){let B=Ao(y,C,t),k=B-x,H=n-S,U=Math.min(k,H);y[b].copyCellsFrom(y[C],x,S,U,!1),S+=U,S===n&&(b++,S=0),x+=U,x===B&&(C++,x=0),S===0&&b!==0&&y[b-1].getWidth(n-1)===2&&(y[b].copyCellsFrom(y[b-1],n-1,S++,1,!1),y[b-1].setCell(n-1,o))}y[b].replaceCells(S,n,o);let E=0;for(let B=y.length-1;B>0&&(B>b||y[B].getTrimmedLength()===0);B--)E++;E>0&&(h.push(f+y.length-E),h.push(E)),f+=y.length-1}return h}function mR(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 _R(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 gR(e,t,n){let a=[],o=e.map((_,p)=>Ao(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 _=Ao(e,h,t);c>_&&(c-=_,h++);let p=e[h].getWidth(c-1)===2;p&&c--;let y=p?n-1:n;a.push(y),f+=y}return a}function Ao(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 Ww=class $w{constructor(t){this.line=t,this.isDisposed=!1,this._disposables=[],this._id=$w._nextId++,this._onDispose=this.register(new _e),this.onDispose=this._onDispose.event}get id(){return this._id}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),Jr(this._disposables),this._disposables.length=0)}register(t){return this._disposables.push(t),t}};Ww._nextId=1;var vR=Ww,_i={},qr=_i.B;_i[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:"≥","{":"π","|":"≠","}":"£","~":"·"};_i.A={"#":"£"};_i.B=void 0;_i[4]={"#":"£","@":"¾","[":"ij","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"};_i.C=_i[5]={"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};_i.R={"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"};_i.Q={"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"};_i.K={"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"};_i.Y={"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"};_i.E=_i[6]={"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"};_i.Z={"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"};_i.H=_i[7]={"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};_i["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"};var uS=4294967295,hS=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=ri.clone(),this.savedCharset=qr,this.markers=[],this._nullCell=js.fromCharData([0,cw,1,0]),this._whitespaceCell=js.fromCharData([0,dr,1,32]),this._isClearing=!1,this._memoryCleanupQueue=new Pu,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new cS(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 zu),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 zu),this._whitespaceCell}getBlankLine(e,t){return new fo(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>uS?uS:t}fillViewportRows(e){if(this.lines.length===0){e===void 0&&(e=ri);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 cS(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(e,t){let n=this.getNullCell(ri),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 fo(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 fo(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=pR(this.lines,this._cols,e,this.ybase+this.y,this.getNullCell(ri),n);if(a.length>0){let o=mR(this.lines,a);_R(this.lines,o.layout),this._reflowLargerAdjustViewport(e,t,o.countRemoved)}}_reflowLargerAdjustViewport(e,t,n){let a=this.getNullCell(ri),o=n;for(;o-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<t&&this.lines.push(new fo(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(ri),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 U=this.ybase+this.y;if(U>=h&&U<h+_.length)continue}let p=_[_.length-1].getTrimmedLength(),y=gR(_,this._cols,e),b=y.length-_.length,S;this.ybase===0&&this.y!==this.lines.length-1?S=Math.max(0,this.y-this.lines.maxLength+b):S=Math.max(0,this.lines.length-this.lines.maxLength+b);let C=[];for(let U=0;U<b;U++){let X=this.getBlankLine(ri,!0);C.push(X)}C.length>0&&(o.push({start:h+_.length+c,newLines:C}),c+=C.length),_.push(...C);let x=y.length-1,E=y[x];E===0&&(x--,E=y[x]);let B=_.length-b-1,k=p;for(;B>=0;){let U=Math.min(k,E);if(_[x]===void 0)break;if(_[x].copyCellsFrom(_[B],k-U,E-U,U,!0),E-=U,E===0&&(x--,E=y[x]),k-=U,k===0){B--;let X=Math.max(B,0);k=Ao(_,X,this._cols)}}for(let U=0;U<_.length;U++)y[U]<e&&_[U].setCell(y[U],a);let H=b-S;for(;H-- >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+b,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,y=0,b=o[y];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+c);let S=0;for(let E=Math.min(this.lines.maxLength-1,_+c-1);E>=0;E--)if(b&&b.start>p+S){for(let B=b.newLines.length-1;B>=0;B--)this.lines.set(E--,b.newLines[B]);E++,h.push({index:p+1,amount:b.newLines.length}),S+=b.newLines.length,b=o[++y]}else this.lines.set(E,f[p--]);let C=0;for(let E=h.length-1;E>=0;E--)h[E].index+=C,this.lines.onInsertEmitter.fire(h[E]),C+=h[E].amount;let x=Math.max(0,_+c-this.lines.maxLength);x>0&&this.lines.onTrimEmitter.fire(x)}}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 vR(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)}},yR=class extends Ve{constructor(e,t){super(),this._optionsService=e,this._bufferService=t,this._onBufferActivate=this._register(new _e),this.onBufferActivate=this._onBufferActivate.event,this.reset(),this._register(this._optionsService.onSpecificOptionChange("scrollback",()=>this.resize(this._bufferService.cols,this._bufferService.rows))),this._register(this._optionsService.onSpecificOptionChange("tabStopWidth",()=>this.setupTabStops()))}reset(){this._normal=new hS(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new hS(!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)}},Yw=2,Vw=1,Qp=class extends Ve{constructor(e){super(),this.isUserScrolling=!1,this._onResize=this._register(new _e),this.onResize=this._onResize.event,this._onScroll=this._register(new _e),this.onScroll=this._onScroll.event,this.cols=Math.max(e.rawOptions.cols||0,Yw),this.rows=Math.max(e.rawOptions.rows||0,Vw),this.buffers=this._register(new yR(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))}};Qp=Wt([Se(0,Gi)],Qp);var qa={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:Uu,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRuler:{}},bR=["normal","bold","100","200","300","400","500","600","700","800","900"],SR=class extends Ve{constructor(e){super(),this._onOptionChange=this._register(new _e),this.onOptionChange=this._onOptionChange.event;let t={...qa};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(Nt(()=>{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 qa))throw new Error(`No option with key "${n}"`);return this.rawOptions[n]},t=(n,a)=>{if(!(n in qa))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=qa[e]),!wR(t))throw new Error(`"${t}" is not a valid value for ${e}`);break;case"wordSeparator":t||(t=qa[e]);break;case"fontWeight":case"fontWeightBold":if(typeof t=="number"&&1<=t&&t<=1e3)break;t=bR.includes(t)?t:qa[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 wR(e){return e==="block"||e==="underline"||e==="bar"}function po(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]&&po(e[a],t-1);return n}var dS=Object.freeze({insertMode:!1}),fS=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,cursorBlink:void 0,cursorStyle:void 0,origin:!1,reverseWraparound:!1,sendFocus:!1,synchronizedOutput:!1,wraparound:!0}),Jp=class extends Ve{constructor(e,t,n){super(),this._bufferService=e,this._logService=t,this._optionsService=n,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this._register(new _e),this.onData=this._onData.event,this._onUserInput=this._register(new _e),this.onUserInput=this._onUserInput.event,this._onBinary=this._register(new _e),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this._register(new _e),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=po(dS),this.decPrivateModes=po(fS)}reset(){this.modes=po(dS),this.decPrivateModes=po(fS)}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))}};Jp=Wt([Se(0,Xi),Se(1,pw),Se(2,Gi)],Jp);var pS={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 Uf(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 Pf=String.fromCharCode,mS={DEFAULT:e=>{let t=[Uf(e,!1)+32,e.col+32,e.row+32];return t[0]>255||t[1]>255||t[2]>255?"":`\x1B[M${Pf(t[0])}${Pf(t[1])}${Pf(t[2])}`},SGR:e=>{let t=e.action===0&&e.button!==4?"m":"M";return`\x1B[<${Uf(e,!0)};${e.col};${e.row}${t}`},SGR_PIXELS:e=>{let t=e.action===0&&e.button!==4?"m":"M";return`\x1B[<${Uf(e,!0)};${e.x};${e.y}${t}`}},em=class extends Ve{constructor(e,t,n){super(),this._bufferService=e,this._coreService=t,this._optionsService=n,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._wheelPartialScroll=0,this._onProtocolChange=this._register(new _e),this.onProtocolChange=this._onProtocolChange.event;for(let a of Object.keys(pS))this.addProtocol(a,pS[a]);for(let a of Object.keys(mS))this.addEncoding(a,mS[a]);this.reset()}addProtocol(e,t){this._protocols[e]=t}addEncoding(e,t){this._encodings[e]=t}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return this._protocols[this._activeProtocol].events!==0}set activeProtocol(e){if(!this._protocols[e])throw new Error(`unknown protocol "${e}"`);this._activeProtocol=e,this._onProtocolChange.fire(this._protocols[e].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(e){if(!this._encodings[e])throw new Error(`unknown encoding "${e}"`);this._activeEncoding=e}reset(){this.activeProtocol="NONE",this.activeEncoding="DEFAULT",this._lastEvent=null,this._wheelPartialScroll=0}consumeWheelEvent(e,t,n){if(e.deltaY===0||e.shiftKey||t===void 0||n===void 0)return 0;let a=t/n,o=this._applyScrollModifier(e.deltaY,e);return e.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(o/=a+0,Math.abs(e.deltaY)<50&&(o*=.3),this._wheelPartialScroll+=o,o=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):e.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(o*=this._bufferService.rows),o}_applyScrollModifier(e,t){return t.altKey||t.ctrlKey||t.shiftKey?e*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:e*this._optionsService.rawOptions.scrollSensitivity}triggerMouseEvent(e){if(e.col<0||e.col>=this._bufferService.cols||e.row<0||e.row>=this._bufferService.rows||e.button===4&&e.action===32||e.button===3&&e.action!==32||e.button!==4&&(e.action===2||e.action===3)||(e.col++,e.row++,e.action===32&&this._lastEvent&&this._equalEvents(this._lastEvent,e,this._activeEncoding==="SGR_PIXELS"))||!this._protocols[this._activeProtocol].restrict(e))return!1;let t=this._encodings[this._activeEncoding](e);return t&&(this._activeEncoding==="DEFAULT"?this._coreService.triggerBinaryEvent(t):this._coreService.triggerDataEvent(t,!0)),this._lastEvent=e,!0}explainEvents(e){return{down:!!(e&1),up:!!(e&2),drag:!!(e&4),move:!!(e&8),wheel:!!(e&16)}}_equalEvents(e,t,n){if(n){if(e.x!==t.x||e.y!==t.y)return!1}else if(e.col!==t.col||e.row!==t.row)return!1;return!(e.button!==t.button||e.action!==t.action||e.ctrl!==t.ctrl||e.alt!==t.alt||e.shift!==t.shift)}};em=Wt([Se(0,Xi),Se(1,ia),Se(2,Gi)],em);var If=[[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]],CR=[[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]],fi;function xR(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 ER=class{constructor(){if(this.version="6",!fi){fi=new Uint8Array(65536),fi.fill(1),fi[0]=0,fi.fill(0,1,32),fi.fill(0,127,160),fi.fill(2,4352,4448),fi[9001]=2,fi[9002]=2,fi.fill(2,11904,42192),fi[12351]=1,fi.fill(2,44032,55204),fi.fill(2,63744,64256),fi.fill(2,65040,65050),fi.fill(2,65072,65136),fi.fill(2,65280,65377),fi.fill(2,65504,65511);for(let e=0;e<If.length;++e)fi.fill(0,If[e][0],If[e][1]+1)}}wcwidth(e){return e<32?0:e<127?1:e<65536?fi[e]:xR(e,CR)?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=Yr.extractWidth(t);o===0?a=!1:o>n&&(n=o)}return Yr.createPropertyValue(0,n,a)}},Yr=class xu{constructor(){this._providers=Object.create(null),this._active="",this._onChange=new _e,this.onChange=this._onChange.event;let t=new ER;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),_=xu.extractWidth(f);xu.extractShouldJoin(f)&&(_-=xu.extractWidth(a)),n+=_,a=f}return n}charProperties(t,n){return this._activeProvider.charProperties(t,n)}},TR=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 _S(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 io=2147483647,kR=256,Xw=class tm{constructor(t=32,n=32){if(this.maxLength=t,this.maxSubParamsLength=n,n>kR)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 tm;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 tm(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>io?io: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>io?io: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,io):t}},so=[],DR=class{constructor(){this._state=0,this._active=so,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=so}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=so,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||so,!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",sh(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=so,this._id=-1,this._state=0}}},vs=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+=sh(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}},no=[],RR=class{constructor(){this._handlers=Object.create(null),this._active=no,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=no}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=no,this._ident=0}hook(e,t){if(this.reset(),this._ident=e,this._active=this._handlers[e]||no,!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",sh(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=no,this._ident=0}},mo=new Xw;mo.addParam(0);var gS=class{constructor(e){this._handler=e,this._data="",this._params=mo,this._hitLimit=!1}hook(e){this._params=e.length>1||e.params[0]?e.clone():mo,this._data="",this._hitLimit=!1}put(e,t,n){this._hitLimit||(this._data+=sh(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=mo,this._data="",this._hitLimit=!1,n));return this._params=mo,this._data="",this._hitLimit=!1,t}},MR=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}},Os=160,NR=(function(){let e=new MR(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(Os,0,2,0),e.add(Os,8,5,8),e.add(Os,6,0,6),e.add(Os,11,0,11),e.add(Os,13,13,13),e})(),AR=class extends Ve{constructor(e=NR){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 Xw,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(Nt(()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)})),this._oscParser=this._register(new DR),this._dcsParser=this._register(new RR),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:Os)],o>>4){case 2:for(let S=f+1;;++S){if(S>=t||(a=e[S])<32||a>126&&a<Os){this._printHandler(e,f,S),f=S-1;break}if(++S>=t||(a=e[S])<32||a>126&&a<Os){this._printHandler(e,f,S),f=S-1;break}if(++S>=t||(a=e[S])<32||a>126&&a<Os){this._printHandler(e,f,S),f=S-1;break}if(++S>=t||(a=e[S])<32||a>126&&a<Os){this._printHandler(e,f,S),f=S-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 y=this._escHandlers[this._collect<<8|a],b=y?y.length-1:-1;for(;b>=0&&(h=y[b](),h!==!0);b--)if(h instanceof Promise)return this._preserveStack(4,y,b,o,f),h;b<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 S=f+1;;++S)if(S>=t||(a=e[S])===24||a===26||a===27||a>127&&a<Os){this._dcsParser.put(e,f,S),f=S-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 S=f+1;;S++)if(S>=t||(a=e[S])<32||a>127&&a<Os){this._oscParser.put(e,f,S),f=S-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}}},LR=/^([\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})$/,BR=/^[\da-f]+$/;function vS(e){if(!e)return;let t=e.toLowerCase();if(t.indexOf("rgb:")===0){t=t.slice(4);let n=LR.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),BR.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 Kf(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 OR(e,t=16){let[n,a,o]=e;return`rgb:${Kf(n,t)}/${Kf(a,t)}/${Kf(o,t)}`}var zR={"(":0,")":1,"*":2,"+":3,"-":1,".":2},or=131072,yS=10;function bS(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,wS=0,jR=class extends Ve{constructor(e,t,n,a,o,c,h,f,_=new AR){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 ik,this._utf8Decoder=new sk,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=ri.clone(),this._eraseAttrDataInternal=ri.clone(),this._onRequestBell=this._register(new _e),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this._register(new _e),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this._register(new _e),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this._register(new _e),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this._register(new _e),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this._register(new _e),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this._register(new _e),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this._register(new _e),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this._register(new _e),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this._register(new _e),this.onLineFeed=this._onLineFeed.event,this._onScroll=this._register(new _e),this.onScroll=this._onScroll.event,this._onTitleChange=this._register(new _e),this.onTitleChange=this._onTitleChange.event,this._onColor=this._register(new _e),this.onColor=this._onColor.event,this._parseStack={paused:!1,cursorStartX:0,cursorStartY:0,decodedLength:0,position:0},this._specialColors=[256,257,258],this._register(this._parser),this._dirtyRowTracker=new im(this._bufferService),this._activeBuffer=this._bufferService.buffer,this._register(this._bufferService.buffers.onBufferActivate(p=>this._activeBuffer=p.activeBuffer)),this._parser.setCsiHandlerFallback((p,y)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(p),params:y.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,y,b)=>{this._logService.debug("Unknown OSC code: ",{identifier:p,action:y,data:b})}),this._parser.setDcsHandlerFallback((p,y,b)=>{y==="HOOK"&&(b=b.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(p),action:y,payload:b})}),this._parser.setPrintHandler((p,y,b)=>this.print(p,y,b)),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(ce.BEL,()=>this.bell()),this._parser.setExecuteHandler(ce.LF,()=>this.lineFeed()),this._parser.setExecuteHandler(ce.VT,()=>this.lineFeed()),this._parser.setExecuteHandler(ce.FF,()=>this.lineFeed()),this._parser.setExecuteHandler(ce.CR,()=>this.carriageReturn()),this._parser.setExecuteHandler(ce.BS,()=>this.backspace()),this._parser.setExecuteHandler(ce.HT,()=>this.tab()),this._parser.setExecuteHandler(ce.SO,()=>this.shiftOut()),this._parser.setExecuteHandler(ce.SI,()=>this.shiftIn()),this._parser.setExecuteHandler(wu.IND,()=>this.index()),this._parser.setExecuteHandler(wu.NEL,()=>this.nextLine()),this._parser.setExecuteHandler(wu.HTS,()=>this.tabSet()),this._parser.registerOscHandler(0,new vs(p=>(this.setTitle(p),this.setIconName(p),!0))),this._parser.registerOscHandler(1,new vs(p=>this.setIconName(p))),this._parser.registerOscHandler(2,new vs(p=>this.setTitle(p))),this._parser.registerOscHandler(4,new vs(p=>this.setOrReportIndexedColor(p))),this._parser.registerOscHandler(8,new vs(p=>this.setHyperlink(p))),this._parser.registerOscHandler(10,new vs(p=>this.setOrReportFgColor(p))),this._parser.registerOscHandler(11,new vs(p=>this.setOrReportBgColor(p))),this._parser.registerOscHandler(12,new vs(p=>this.setOrReportCursorColor(p))),this._parser.registerOscHandler(104,new vs(p=>this.restoreIndexedColor(p))),this._parser.registerOscHandler(110,new vs(p=>this.restoreFgColor(p))),this._parser.registerOscHandler(111,new vs(p=>this.restoreBgColor(p))),this._parser.registerOscHandler(112,new vs(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 _i)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 gS((p,y)=>this.requestStatusString(p,y)))}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 y=p+or<e.length?p+or:e.length,b=typeof e=="string"?this._stringDecoder.decode(e.substring(p,y),this._parseBuffer):this._utf8Decoder.decode(e.subarray(p,y),this._parseBuffer);if(n=this._parser.parse(this._parseBuffer,b))return this._preserveStack(a,o,b,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,y=this._curAttrData,b=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&n-t>0&&b.getWidth(this._activeBuffer.x-1)===2&&b.setCellFromCodepoint(this._activeBuffer.x-1,0,1,y);let S=this._parser.precedingJoinState;for(let C=t;C<n;++C){if(a=e[C],a<127&&c){let k=c[String.fromCharCode(a)];k&&(a=k.charCodeAt(0))}let x=this._unicodeService.charProperties(a,S);o=Yr.extractWidth(x);let E=Yr.extractShouldJoin(x),B=E?Yr.extractWidth(S):0;if(S=x,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(_){let k=b,H=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),b=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),B>0&&b instanceof fo&&b.copyCellsFrom(k,H,0,B,!1);H<f;)k.setCellFromCodepoint(H++,0,1,y)}else if(this._activeBuffer.x=f-1,o===2)continue}if(E&&this._activeBuffer.x){let k=b.getWidth(this._activeBuffer.x-1)?1:2;b.addCodepointToCell(this._activeBuffer.x-k,a,o);for(let H=o-B;--H>=0;)b.setCellFromCodepoint(this._activeBuffer.x++,0,0,y);continue}if(p&&(b.insertCells(this._activeBuffer.x,o-B,this._activeBuffer.getNullCell(y)),b.getWidth(f-1)===2&&b.setCellFromCodepoint(f-1,0,1,y)),b.setCellFromCodepoint(this._activeBuffer.x++,a,o,y),o>0)for(;--o;)b.setCellFromCodepoint(this._activeBuffer.x++,0,0,y)}this._parser.precedingJoinState=S,this._activeBuffer.x<f&&n-t>0&&b.getWidth(this._activeBuffer.x)===0&&!b.hasContent(this._activeBuffer.x)&&b.setCellFromCodepoint(this._activeBuffer.x,0,1,y),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(e,t){return e.final==="t"&&!e.prefix&&!e.intermediates?this._parser.registerCsiHandler(e,n=>bS(n.params[0],this._optionsService.rawOptions.windowOptions)?t(n):!0):this._parser.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._parser.registerDcsHandler(e,new gS(t))}registerEscHandler(e,t){return this._parser.registerEscHandler(e,t)}registerOscHandler(e,t){return this._parser.registerOscHandler(e,new vs(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(ri));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=Yr.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 y=c.codePointAt(p)||0;h[f++]=y,p+=y>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(ce.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(ce.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(e){return e.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(ce.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(ce.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(e.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(ce.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,qr),this._charsetService.setgCharset(1,qr),this._charsetService.setgCharset(2,qr),this._charsetService.setgCharset(3,qr);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:y}=f,b=this._optionsService.rawOptions,S=(E,B)=>(h.triggerDataEvent(`${ce.ESC}[${t?"":"?"}${E};${B}$y`),!0),C=E=>E?1:2,x=e.params[0];return t?x===2?S(x,4):x===4?S(x,C(h.modes.insertMode)):x===12?S(x,3):x===20?S(x,C(b.convertEol)):S(x,0):x===1?S(x,C(a.applicationCursorKeys)):x===3?S(x,b.windowOptions.setWinLines?_===80?2:_===132?1:0:0):x===6?S(x,C(a.origin)):x===7?S(x,C(a.wraparound)):x===8?S(x,3):x===9?S(x,C(o==="X10")):x===12?S(x,C(b.cursorBlink)):x===25?S(x,C(!h.isCursorHidden)):x===45?S(x,C(a.reverseWraparound)):x===66?S(x,C(a.applicationKeypad)):x===67?S(x,4):x===1e3?S(x,C(o==="VT200")):x===1002?S(x,C(o==="DRAG")):x===1003?S(x,C(o==="ANY")):x===1004?S(x,C(a.sendFocus)):x===1005?S(x,4):x===1006?S(x,C(c==="SGR")):x===1015?S(x,4):x===1016?S(x,C(c==="SGR_PIXELS")):x===1048?S(x,1):x===47||x===1047||x===1049?S(x,C(p===y)):x===2004?S(x,C(a.bracketedPasteMode)):x===2026?S(x,C(a.synchronizedOutput)):S(x,0)}_updateAttrColor(e,t,n,a,o){return t===2?(e|=50331648,e&=-16777216,e|=Ko.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=ri.fg,e.bg=ri.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|=ri.fg&16777215):n===49?(a.bg&=-67108864,a.bg|=ri.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|=ri.fg&16777215,a.bg&=-67108864,a.bg|=ri.bg&16777215):this._logService.debug("Unknown SGR attribute: %d.",n);return!0}deviceStatus(e){switch(e.params[0]){case 5:this._coreService.triggerDataEvent(`${ce.ESC}[0n`);break;case 6:let t=this._activeBuffer.y+1,n=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${ce.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(`${ce.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=ri.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(!bS(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(`${ce.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:(t===0||t===2)&&(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>yS&&this._windowTitleStack.shift()),(t===0||t===1)&&(this._iconNameStack.push(this._iconName),this._iconNameStack.length>yS&&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(CS(c))if(o==="?")t.push({type:0,index:c});else{let h=vS(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=vS(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]);CS(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,qr),!0}selectCharset(e){return e.length!==2?(this.selectDefaultCharset(),!0):(e[0]==="/"||this._charsetService.setgCharset(zR[e[0]],_i[e[1]]||qr),!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=ri.clone(),this._eraseAttrDataInternal=ri.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 js;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(`${ce.ESC}${h}${ce.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)}},im=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&&(wS=e,e=t,t=wS),e<this.start&&(this.start=e),t>this.end&&(this.end=t)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};im=Wt([Se(0,Xi)],im);function CS(e){return 0<=e&&e<256}var HR=5e7,xS=12,UR=50,PR=class extends Ve{constructor(e){super(),this._action=e,this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0,this._isSyncWriting=!1,this._syncCalls=0,this._didUserInput=!1,this._onWriteParsed=this._register(new _e),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(e,t){if(t!==void 0&&this._syncCalls>t){this._syncCalls=0;return}if(this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;this._isSyncWriting=!0;let n;for(;n=this._writeBuffer.shift();){this._action(n);let a=this._callbacks.shift();a&&a()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(e,t){if(this._pendingData>HR)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>=xS?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>=xS)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>UR&&(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()}},sm=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)))}};sm=Wt([Se(0,Xi)],sm);var ES=!1,IR=class extends Ve{constructor(e){super(),this._windowsWrappingHeuristics=this._register(new tl),this._onBinary=this._register(new _e),this.onBinary=this._onBinary.event,this._onData=this._register(new _e),this.onData=this._onData.event,this._onLineFeed=this._register(new _e),this.onLineFeed=this._onLineFeed.event,this._onResize=this._register(new _e),this.onResize=this._onResize.event,this._onWriteParsed=this._register(new _e),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this._register(new _e),this._instantiationService=new hR,this.optionsService=this._register(new SR(e)),this._instantiationService.setService(Gi,this.optionsService),this._bufferService=this._register(this._instantiationService.createInstance(Qp)),this._instantiationService.setService(Xi,this._bufferService),this._logService=this._register(this._instantiationService.createInstance(Zp)),this._instantiationService.setService(pw,this._logService),this.coreService=this._register(this._instantiationService.createInstance(Jp)),this._instantiationService.setService(ia,this.coreService),this.coreMouseService=this._register(this._instantiationService.createInstance(em)),this._instantiationService.setService(fw,this.coreMouseService),this.unicodeService=this._register(this._instantiationService.createInstance(Yr)),this._instantiationService.setService(lk,this.unicodeService),this._charsetService=this._instantiationService.createInstance(TR),this._instantiationService.setService(ak,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(sm),this._instantiationService.setService(mw,this._oscLinkService),this._inputHandler=this._register(new jR(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this._register(ji.forward(this._inputHandler.onLineFeed,this._onLineFeed)),this._register(this._inputHandler),this._register(ji.forward(this._bufferService.onResize,this._onResize)),this._register(ji.forward(this.coreService.onData,this._onData)),this._register(ji.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 PR((t,n)=>this._inputHandler.parse(t,n))),this._register(ji.forward(this._writeBuffer.onWriteParsed,this._onWriteParsed))}get onScroll(){return this._onScrollApi||(this._onScrollApi=this._register(new _e),this._onScroll.event(e=>{this._onScrollApi?.fire(e.position)})),this._onScrollApi.event}get cols(){return this._bufferService.cols}get rows(){return this._bufferService.rows}get buffers(){return this._bufferService.buffers}get options(){return this.optionsService.options}set options(e){for(let t in e)this.optionsService.options[t]=e[t]}write(e,t){this._writeBuffer.write(e,t)}writeSync(e,t){this._logService.logLevel<=3&&!ES&&(this._logService.warn("writeSync is unreliable and will be removed soon."),ES=!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,Yw),t=Math.max(t,Vw),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(_S.bind(null,this._bufferService))),e.push(this.registerCsiHandler({final:"H"},()=>(_S(this._bufferService),!1))),this._windowsWrappingHeuristics.value=Nt(()=>{for(let t of e)t.dispose()})}}},KR={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 FR(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=ce.ESC+"OA":o.key=ce.ESC+"[A":e.key==="UIKeyInputLeftArrow"?t?o.key=ce.ESC+"OD":o.key=ce.ESC+"[D":e.key==="UIKeyInputRightArrow"?t?o.key=ce.ESC+"OC":o.key=ce.ESC+"[C":e.key==="UIKeyInputDownArrow"&&(t?o.key=ce.ESC+"OB":o.key=ce.ESC+"[B");break;case 8:o.key=e.ctrlKey?"\b":ce.DEL,e.altKey&&(o.key=ce.ESC+o.key);break;case 9:if(e.shiftKey){o.key=ce.ESC+"[Z";break}o.key=ce.HT,o.cancel=!0;break;case 13:o.key=e.altKey?ce.ESC+ce.CR:ce.CR,o.cancel=!0;break;case 27:o.key=ce.ESC,e.altKey&&(o.key=ce.ESC+ce.ESC),o.cancel=!0;break;case 37:if(e.metaKey)break;c?o.key=ce.ESC+"[1;"+(c+1)+"D":t?o.key=ce.ESC+"OD":o.key=ce.ESC+"[D";break;case 39:if(e.metaKey)break;c?o.key=ce.ESC+"[1;"+(c+1)+"C":t?o.key=ce.ESC+"OC":o.key=ce.ESC+"[C";break;case 38:if(e.metaKey)break;c?o.key=ce.ESC+"[1;"+(c+1)+"A":t?o.key=ce.ESC+"OA":o.key=ce.ESC+"[A";break;case 40:if(e.metaKey)break;c?o.key=ce.ESC+"[1;"+(c+1)+"B":t?o.key=ce.ESC+"OB":o.key=ce.ESC+"[B";break;case 45:!e.shiftKey&&!e.ctrlKey&&(o.key=ce.ESC+"[2~");break;case 46:c?o.key=ce.ESC+"[3;"+(c+1)+"~":o.key=ce.ESC+"[3~";break;case 36:c?o.key=ce.ESC+"[1;"+(c+1)+"H":t?o.key=ce.ESC+"OH":o.key=ce.ESC+"[H";break;case 35:c?o.key=ce.ESC+"[1;"+(c+1)+"F":t?o.key=ce.ESC+"OF":o.key=ce.ESC+"[F";break;case 33:e.shiftKey?o.type=2:e.ctrlKey?o.key=ce.ESC+"[5;"+(c+1)+"~":o.key=ce.ESC+"[5~";break;case 34:e.shiftKey?o.type=3:e.ctrlKey?o.key=ce.ESC+"[6;"+(c+1)+"~":o.key=ce.ESC+"[6~";break;case 112:c?o.key=ce.ESC+"[1;"+(c+1)+"P":o.key=ce.ESC+"OP";break;case 113:c?o.key=ce.ESC+"[1;"+(c+1)+"Q":o.key=ce.ESC+"OQ";break;case 114:c?o.key=ce.ESC+"[1;"+(c+1)+"R":o.key=ce.ESC+"OR";break;case 115:c?o.key=ce.ESC+"[1;"+(c+1)+"S":o.key=ce.ESC+"OS";break;case 116:c?o.key=ce.ESC+"[15;"+(c+1)+"~":o.key=ce.ESC+"[15~";break;case 117:c?o.key=ce.ESC+"[17;"+(c+1)+"~":o.key=ce.ESC+"[17~";break;case 118:c?o.key=ce.ESC+"[18;"+(c+1)+"~":o.key=ce.ESC+"[18~";break;case 119:c?o.key=ce.ESC+"[19;"+(c+1)+"~":o.key=ce.ESC+"[19~";break;case 120:c?o.key=ce.ESC+"[20;"+(c+1)+"~":o.key=ce.ESC+"[20~";break;case 121:c?o.key=ce.ESC+"[21;"+(c+1)+"~":o.key=ce.ESC+"[21~";break;case 122:c?o.key=ce.ESC+"[23;"+(c+1)+"~":o.key=ce.ESC+"[23~";break;case 123:c?o.key=ce.ESC+"[24;"+(c+1)+"~":o.key=ce.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=ce.NUL:e.keyCode>=51&&e.keyCode<=55?o.key=String.fromCharCode(e.keyCode-51+27):e.keyCode===56?o.key=ce.DEL:e.keyCode===219?o.key=ce.ESC:e.keyCode===220?o.key=ce.FS:e.keyCode===221&&(o.key=ce.GS);else if((!n||a)&&e.altKey&&!e.metaKey){let h=KR[e.keyCode]?.[e.shiftKey?1:0];if(h)o.key=ce.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=ce.ESC+_}else if(e.keyCode===32)o.key=ce.ESC+(e.ctrlKey?ce.NUL:" ");else if(e.key==="Dead"&&e.code.startsWith("Key")){let f=e.code.slice(3,4);e.shiftKey||(f=f.toLowerCase()),o.key=ce.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=ce.US),e.key==="@"&&(o.key=ce.NUL));break}return o}var Zt=0,qR=class{constructor(e){this._getKey=e,this._array=[],this._insertedValues=[],this._flushInsertedTask=new Pu,this._isFlushingInserted=!1,this._deletedIndices=[],this._flushDeletedTask=new Pu,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||(Zt=this._search(t),Zt===-1)||this._getKey(this._array[Zt])!==t)return!1;do if(this._array[Zt]===e)return this._deletedIndices.length===0&&this._flushDeletedTask.enqueue(()=>this._flushDeleted()),this._deletedIndices.push(Zt),!0;while(++Zt<this._array.length&&this._getKey(this._array[Zt])===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&&(Zt=this._search(e),!(Zt<0||Zt>=this._array.length)&&this._getKey(this._array[Zt])===e))do yield this._array[Zt];while(++Zt<this._array.length&&this._getKey(this._array[Zt])===e)}forEachByKey(e,t){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(Zt=this._search(e),!(Zt<0||Zt>=this._array.length)&&this._getKey(this._array[Zt])===e))do t(this._array[Zt]);while(++Zt<this._array.length&&this._getKey(this._array[Zt])===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}},Ff=0,TS=0,WR=class extends Ve{constructor(){super(),this._decorations=new qR(e=>e?.marker.line),this._onDecorationRegistered=this._register(new _e),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this._register(new _e),this.onDecorationRemoved=this._onDecorationRemoved.event,this._register(Nt(()=>this.reset()))}get decorations(){return this._decorations.values()}registerDecoration(e){if(e.marker.isDisposed)return;let t=new $R(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=>{Ff=o.options.x??0,TS=Ff+(o.options.width??1),e>=Ff&&e<TS&&(!n||(o.options.layer??"bottom")===n)&&a(o)})}},$R=class extends pr{constructor(e){super(),this.options=e,this.onRenderEmitter=this.add(new _e),this.onRender=this.onRenderEmitter.event,this._onDispose=this.add(new _e),this.onDispose=this._onDispose.event,this._cachedBg=null,this._cachedFg=null,this.marker=e.marker,this.options.overviewRulerOptions&&!this.options.overviewRulerOptions.position&&(this.options.overviewRulerOptions.position="full")}get backgroundColorRGB(){return this._cachedBg===null&&(this.options.backgroundColor?this._cachedBg=Ot.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this.options.foregroundColor?this._cachedFg=Ot.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}dispose(){this._onDispose.fire(),super.dispose()}},YR=1e3,VR=class{constructor(e,t=YR){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)}},kS=20,Iu=class extends Ve{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 VR(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(Pe(o,"selectionchange",()=>this._handleSelectionChange())),this._register(this._coreBrowserService.onDprChange(()=>this._refreshRowsDimensions())),this._refreshRowsDimensions(),this._refreshRows(),this._register(Nt(()=>{this._accessibilityContainer.remove(),this._rowElements.length=0}))}_handleTab(e){for(let t=0;t<e;t++)this._handleChar(" ")}_handleChar(e){this._liveRegionLineCount<kS+1&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==e&&(this._charsToAnnounce+=e):this._charsToAnnounce+=e,e===`
|
|
29
|
-
`&&(this._liveRegionLineCount++,this._liveRegionLineCount===kS+1&&(this._liveRegion.textContent+=Cp.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,y=parseInt(p?.getAttribute("aria-posinset"),10)-1;if(isNaN(y))return console.warn("row is invalid. Race condition?"),null;let b=this._rowColumns.get(p);if(!b)return console.warn("columns is null. Race condition?"),null;let S=_<b.length?b[_]:b.slice(-1)[0]+1;return S>=this._terminal.cols&&(++y,S=0),{row:y,column:S}},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})`}};Iu=Wt([Se(1,i_),Se(2,Ln),Se(3,Bn)],Iu);var nm=class extends Ve{constructor(e,t,n,a,o){super(),this._element=e,this._mouseService=t,this._renderService=n,this._bufferService=a,this._linkProviderService=o,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this._register(new _e),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this._register(new _e),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this._register(Nt(()=>{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(Pe(this._element,"mouseleave",()=>{this._isMouseOut=!0,this._clearCurrentLink()})),this._register(Pe(this._element,"mousemove",this._handleMouseMove.bind(this))),this._register(Pe(this._element,"mousedown",this._handleMouseDown.bind(this))),this._register(Pe(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&&XR(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}}};nm=Wt([Se(1,s_),Se(2,Bn),Se(3,Xi),Se(4,gw)],nm);function XR(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 GR=class extends IR{constructor(e={}){super(e),this._linkifier=this._register(new tl),this.browser=zw,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this._register(new tl),this._onCursorMove=this._register(new _e),this.onCursorMove=this._onCursorMove.event,this._onKey=this._register(new _e),this.onKey=this._onKey.event,this._onRender=this._register(new _e),this.onRender=this._onRender.event,this._onSelectionChange=this._register(new _e),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this._register(new _e),this.onTitleChange=this._onTitleChange.event,this._onBell=this._register(new _e),this.onBell=this._onBell.event,this._onFocus=this._register(new _e),this._onBlur=this._register(new _e),this._onA11yCharEmitter=this._register(new _e),this._onA11yTabEmitter=this._register(new _e),this._onWillOpen=this._register(new _e),this._setup(),this._decorationService=this._instantiationService.createInstance(WR),this._instantiationService.setService(Fo,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(UD),this._instantiationService.setService(gw,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(Ep)),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(ji.forward(this._inputHandler.onCursorMove,this._onCursorMove)),this._register(ji.forward(this._inputHandler.onTitleChange,this._onTitleChange)),this._register(ji.forward(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this._register(ji.forward(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this._register(this._bufferService.onResize(t=>this._afterResize(t.cols,t.rows))),this._register(Nt(()=>{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=Dt.toColorRGB(n==="ansi"?this._themeService.colors.ansi[t.index]:this._themeService.colors[n]);this.coreService.triggerDataEvent(`${ce.ESC}]${a};${OR(o)}${Bw.ST}`);break;case 1:if(n==="ansi")this._themeService.modifyColors(c=>c.ansi[t.index]=ai.toColor(...t.color));else{let c=n;this._themeService.modifyColors(h=>h[c]=ai.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(Iu,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(e){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(ce.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(ce.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(Pe(this.element,"copy",t=>{this.hasSelection()&&ek(t,this._selectionService)}));let e=t=>tk(t,this.textarea,this.coreService,this.optionsService);this._register(Pe(this.textarea,"paste",e)),this._register(Pe(this.element,"paste",e)),jw?this._register(Pe(this.element,"mousedown",t=>{t.button===2&&jb(t,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})):this._register(Pe(this.element,"contextmenu",t=>{jb(t,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})),h_&&this._register(Pe(this.element,"auxclick",t=>{t.button===1&&ow(t,this.textarea,this.screenElement)}))}_bindKeys(){this._register(Pe(this.textarea,"keyup",e=>this._keyUp(e),!0)),this._register(Pe(this.textarea,"keydown",e=>this._keyDown(e),!0)),this._register(Pe(this.textarea,"keypress",e=>this._keyPress(e),!0)),this._register(Pe(this.textarea,"compositionstart",()=>this._compositionHelper.compositionstart())),this._register(Pe(this.textarea,"compositionupdate",e=>this._compositionHelper.compositionupdate(e))),this._register(Pe(this.textarea,"compositionend",()=>this._compositionHelper.compositionend())),this._register(Pe(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(Pe(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",wp.get()),Pw||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(jD,this.textarea,e.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(Ln,this._coreBrowserService),this._register(Pe(this.textarea,"focus",o=>this._handleTextAreaFocus(o))),this._register(Pe(this.textarea,"blur",()=>this._handleTextAreaBlur())),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance($p,this._document,this._helperContainer),this._instantiationService.setService(nh,this._charSizeService),this._themeService=this._instantiationService.createInstance(Gp),this._instantiationService.setService(nl,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(Hu),this._instantiationService.setService(_w,this._characterJoinerService),this._renderService=this._register(this._instantiationService.createInstance(Vp,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(Fp,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(Yp),this._instantiationService.setService(s_,this._mouseService);let a=this._linkifier.value=this._register(this._instantiationService.createInstance(nm,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(Ip,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(Xp,this.element,this.screenElement,a)),this._instantiationService.setService(ck,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(ji.any(this._onScroll.event,this._inputHandler.onScroll)(()=>{this._selectionService.refresh(),this._viewport?.queueSync()})),this._register(this._instantiationService.createInstance(Kp,this.screenElement)),this._register(Pe(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(Iu,this)),this._register(this.optionsService.onSpecificOptionChange("screenReaderMode",o=>this._handleScreenReaderModeOptionChange(o))),this.options.overviewRuler.width&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(ju,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRuler",o=>{!this._overviewRulerRenderer&&o&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(ju,this._viewportElement,this.screenElement)))}),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(Wp,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(Pe(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(Pe(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=ce.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){lw(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=FR(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===ce.ETX||n.key===ce.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)&&(ZR(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(ri));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(ce.ESC+"[I"):this.coreService.triggerDataEvent(ce.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(`${ce.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(`${ce.ESC}[6;${o};${a}t`);break}}cancel(e,t){if(!(!this.options.cancelEvents&&!t))return e.preventDefault(),e.stopPropagation(),!1}};function ZR(e){return e.keyCode===16||e.keyCode===17||e.keyCode===18}var QR=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)}},JR=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 js)}translateToString(e,t,n){return this._line.translateToString(e,t,n)}},DS=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 JR(t)}getNullCell(){return new js}},eM=class extends Ve{constructor(e){super(),this._core=e,this._onBufferChange=this._register(new _e),this.onBufferChange=this._onBufferChange.event,this._normal=new DS(this._core.buffers.normal,"normal"),this._alternate=new DS(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)}},tM=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)}},iM=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}},sM=["cols","rows"],en=0,nM=class extends Ve{constructor(e){super(),this._core=this._register(new GR(e)),this._addonManager=this._register(new QR),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(sM.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 tM(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new iM(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 eM(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 wp.get()},set promptLabel(e){wp.set(e)},get tooMuchOutput(){return Cp.get()},set tooMuchOutput(e){Cp.set(e)}}}_verifyIntegers(...e){for(en of e)if(en===1/0||isNaN(en)||en%1!==0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...e){for(en of e)if(en&&(en===1/0||isNaN(en)||en%1!==0||en<0))throw new Error("This API only accepts positive integers")}};class rM{pending=null;accept(t){let n="";for(const a of t)n+=this.acceptChar(a);return n}acceptChar(t){return t===""?this.acceptBackspace():Jw.has(t)?this.acceptConsonant(t):e1.has(t)?this.acceptVowel(t):cM(t)&&this.canReplacePendingWith(t)?(this.pending=MS(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(t1.has(t))return this.pending.final=t,"";const o=this.flushPending();return this.pending={initial:t},o}const n=oM.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=lM.get(`${this.pending.vowel}${t}`);return c?(this.pending.vowel=c,""):this.flushPending()+t}const n=RS.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=NS({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=RS.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=MS(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=NS(this.pending);return this.pending=null,t}}const Ku=44032,Fu=21,Ya=28,aM=19*Fu*Ya,Gw=["ㄱ","ㄲ","ㄴ","ㄷ","ㄸ","ㄹ","ㅁ","ㅂ","ㅃ","ㅅ","ㅆ","ㅇ","ㅈ","ㅉ","ㅊ","ㅋ","ㅌ","ㅍ","ㅎ"],Zw=["ㅏ","ㅐ","ㅑ","ㅒ","ㅓ","ㅔ","ㅕ","ㅖ","ㅗ","ㅘ","ㅙ","ㅚ","ㅛ","ㅜ","ㅝ","ㅞ","ㅟ","ㅠ","ㅡ","ㅢ","ㅣ"],Qw=["","ㄱ","ㄲ","ㄳ","ㄴ","ㄵ","ㄶ","ㄷ","ㄹ","ㄺ","ㄻ","ㄼ","ㄽ","ㄾ","ㄿ","ㅀ","ㅁ","ㅂ","ㅄ","ㅅ","ㅆ","ㅇ","ㅈ","ㅊ","ㅋ","ㅌ","ㅍ","ㅎ"],Jw=d_(Gw),e1=d_(Zw),t1=d_(Qw),lM=new Map([["ㅗㅏ","ㅘ"],["ㅗㅐ","ㅙ"],["ㅗㅣ","ㅚ"],["ㅜㅓ","ㅝ"],["ㅜㅔ","ㅞ"],["ㅜㅣ","ㅟ"],["ㅡㅣ","ㅢ"]]),i1=[["ㄱㅅ","ㄳ"],["ㄴㅈ","ㄵ"],["ㄴㅎ","ㄶ"],["ㄹㄱ","ㄺ"],["ㄹㅁ","ㄻ"],["ㄹㅂ","ㄼ"],["ㄹㅅ","ㄽ"],["ㄹㅌ","ㄾ"],["ㄹㅍ","ㄿ"],["ㄹㅎ","ㅀ"],["ㅂㅅ","ㅄ"]],oM=new Map(i1),RS=new Map(i1.map(([e,t])=>[t,[e[0],e[1]]]));function d_(e){return new Map(e.map((t,n)=>[t,n]))}function cM(e){const t=e.codePointAt(0);return t!==void 0&&t>=Ku&&t<Ku+aM}function MS(e){const t=e.codePointAt(0)-Ku,n=Math.floor(t/(Fu*Ya)),a=Math.floor(t%(Fu*Ya)/Ya),o=t%Ya,c={initial:Gw[n],vowel:Zw[a]};return o===0?c:{...c,final:Qw[o]}}function NS(e){if(!e.vowel)return e.initial;const t=Jw.get(e.initial),n=e1.get(e.vowel),a=e.final?t1.get(e.final):0;return t===void 0||n===void 0||a===void 0?`${e.initial}${e.vowel}${e.final??""}`:String.fromCodePoint(Ku+(t*Fu+n)*Ya+a)}const uM=[{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 hM({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"}),uM.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 dM={escape:"\x1B",tab:" ",arrowUp:"\x1B[A",arrowDown:"\x1B[B",arrowRight:"\x1B[C",arrowLeft:"\x1B[D"};function fM(e){return dM[e]}function pM(e){return/^[a-z]$/i.test(e)?String.fromCharCode(e.toUpperCase().charCodeAt(0)-64):null}const AS="--nterminal-viewport-height",LS="--nterminal-keyboard-inset-bottom",BS="data-nterminal-keyboard-visible",f_="data-nterminal-compose-open",rm="nterminal:viewport-refresh",mM=120;function _M(e=window){const t=e.document.documentElement,n=e.visualViewport;function a(){const o=gM(e);o!==null&&t.style.setProperty(AS,`${o}px`),t.style.setProperty(LS,`${s1(e)}px`),t.setAttribute(BS,String(vM(e)))}return a(),n?.addEventListener("resize",a),n?.addEventListener("scroll",a),e.addEventListener("resize",a),e.addEventListener(rm,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(rm,a),e.removeEventListener("orientationchange",a),e.removeEventListener("pageshow",a),e.document.removeEventListener("visibilitychange",a),t.style.removeProperty(AS),t.style.removeProperty(LS),t.removeAttribute(BS)}}function gM(e){if(e.document.documentElement.hasAttribute(f_)&&Eo(e.innerHeight))return e.innerHeight;const t=e.visualViewport?.height;return Eo(t)?t:Eo(e.innerHeight)?e.innerHeight:null}function Eo(e){return typeof e=="number"&&Number.isFinite(e)&&e>0}function vM(e){return s1(e)>mM}function s1(e){const t=e.visualViewport?.height;if(!Eo(t)||!Eo(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 $o=new Map,Lo=new Map,yM=Object.freeze({open:!1,text:""});function bM(e){let t=Lo.get(e);return t||(t=new Set,Lo.set(e,t)),t}function n1(e){const t=Lo.get(e);if(t)for(const n of Array.from(t))n()}function p_(e){return $o.get(e)??yM}function SM(e,t){const n=bM(e);return n.add(t),()=>{n.delete(t)}}function wM(e,t){const n=p_(e);n.open!==t&&($o.set(e,{...n,open:t}),n1(e))}function CM(e,t){const n=p_(e);n.text!==t&&($o.set(e,{...n,text:t}),n1(e))}function OS(e){$o.delete(e),Lo.delete(e)}function zS(){$o.clear(),Lo.clear()}const jS=120,xM=420,Eu=new Set;let Za=null;function EM({terminalId:e,onSubmit:t,disabled:n=!1}){const a=v.useMemo(()=>E=>SM(e,E),[e]),o=v.useMemo(()=>()=>p_(e),[e]),c=v.useSyncExternalStore(a,o,o),{open:h,text:f}=c,_=v.useRef(null),p=v.useRef(null),y=v.useRef(null);v.useLayoutEffect(()=>{if(!(!h||!am()))return kM(e),()=>DM(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 k=p.current;E.setAttribute("data-compose-open","true");function H(){const te=k?.getBoundingClientRect().height??0;te>0&&E?.style.setProperty("--compose-drawer-panel-height",`${Math.ceil(te)}px`)}H();const U=[window.setTimeout(H,0),window.setTimeout(H,180),window.setTimeout(H,260)],X=window.requestAnimationFrame?.(H)??null,ee=typeof ResizeObserver=="function"&&k?new ResizeObserver(H):null;return ee&&k&&ee.observe(k),()=>{for(const te of U)window.clearTimeout(te);X!==null&&window.cancelAnimationFrame?.(X),ee?.disconnect(),B()}},[h]),v.useEffect(()=>{h&&y.current?.focus()},[h]);function b(E){wM(e,E)}function S(E){CM(e,E)}function C(){TM(_.current),b(!1),HS()}function x(){if(n||!f)return;const E=f.replace(/\r\n/g,`
|
|
31
|
-
`).replace(/\n/g,"\r");if(E&&t(E),window.setTimeout(()=>t("\r"),jS),S(""),am()){y.current?.blur(),HS();return}window.setTimeout(()=>y.current?.focus(),jS+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:()=>b(!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:C,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:y,className:"compose-drawer-input","aria-label":"Compose input",tabIndex:h?0:-1,spellCheck:!1,autoCorrect:"off",autoCapitalize:"off",value:f,onChange:E=>S(E.target.value),onKeyDown:E=>{if(E.key==="Enter"&&(E.metaKey||E.ctrlKey)){E.preventDefault(),x();return}E.key==="Escape"&&(E.preventDefault(),C())},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:()=>{S(""),y.current?.focus()},disabled:!f,children:"Clear"}),m.jsx("button",{type:"button",className:"compose-drawer-send",tabIndex:h?0:-1,onClick:x,disabled:n||!f,children:"Send"})]})]})]})}function TM(e){const t=document.activeElement;t instanceof HTMLElement&&(!e||e.contains(t))&&t.blur()}function am(){return navigator.maxTouchPoints>0?!0:typeof window.matchMedia=="function"&&window.matchMedia("(pointer: coarse)").matches}function HS(){if(!am())return;const e=()=>{window.scrollTo(0,0),document.documentElement.scrollTop=0,document.body.scrollTop=0,Va()};e(),window.requestAnimationFrame?.(e),window.setTimeout(e,120),window.setTimeout(e,320)}function kM(e){Za!==null&&(window.clearTimeout(Za),Za=null),Eu.add(e),document.documentElement.setAttribute(f_,"true"),Va()}function DM(e){if(Eu.delete(e),Eu.size>0||Za!==null){Va();return}Za=window.setTimeout(()=>{if(Za=null,Eu.size>0){Va();return}document.documentElement.removeAttribute(f_),Va()},xM),Va()}function Va(){window.dispatchEvent(new Event(rm))}function RM(e){e.attachCustomKeyEventHandler(o=>{if(MM(o)){const c=US(e);return c?(o.preventDefault(),o.stopPropagation(),PS(c),!1):!0}return NM(o)?(o.preventDefault(),o.stopPropagation(),AM(e),!1):!0});const t=e.element;if(!t)return{dispose(){e.attachCustomKeyEventHandler(()=>!0)}};const n=o=>{const c=US(e);if(c){if(o.clipboardData){o.clipboardData.setData("text/plain",c),o.preventDefault();return}o.preventDefault(),PS(c)}},a=o=>{const c=o.clipboardData?.getData("text/plain");if(c===void 0)return;const h=r1(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 MM(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 NM(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 AM(e){if(navigator.clipboard?.readText)try{const t=await navigator.clipboard.readText();if(!t)return;e.paste(r1(t))}catch{}}function US(e){return e.hasSelection()?e.getSelection():""}function r1(e){return e.replace(/(?:\r\n|\r|\n)+$/,"")}async function PS(e){if(navigator.clipboard?.writeText)try{await navigator.clipboard.writeText(e);return}catch{}LM(e)}function LM(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 BM=[4,10,11,12];function OM(e,t){const n=[e.parser.registerCsiHandler({final:"c"},a=>IS(a)),e.parser.registerCsiHandler({prefix:">",final:"c"},a=>IS(a)),e.parser.registerCsiHandler({final:"n"},a=>zM(a)),e.parser.registerCsiHandler({prefix:"?",final:"n"},a=>jM(a)),e.parser.registerCsiHandler({final:"t"},a=>HM(a)),e.parser.registerDcsHandler({intermediates:"$",final:"q"},()=>!0),...BM.map(a=>e.parser.registerOscHandler(a,o=>UM(o)))];return{dispose(){for(const a of n)a.dispose()}}}function IS(e){return lh(e)===0}function zM(e){const t=lh(e);return t===5||t===6}function jM(e){return lh(e)===6}function HM(e){const t=lh(e);return t===14||t===16||t===18}function UM(e){return e.split(";").some(t=>t==="?")}function lh(e){const t=e[0];return typeof t=="number"?t:0}const ta=new Map,PM=2*1024*1024,IM=1500,KM=25e3;function FM(e,t){let n=ta.get(e);n||(n=$M(e),ta.set(e,n),oh(n)),n.listeners.add(t);const a=c=>QM(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 lm(e){const t=ta.get(e);t&&(JM(t),ta.delete(e))}function qM(e,t={}){const n=ta.get(e);if(!n)return!1;n.exited=!1,n.reconnectEnabled=!0,t.preserveCachedOutputOnNextSnapshot&&(n.preserveCachedOutputOnNextSnapshot=!0),n.reconnectTimer!==null&&(window.clearTimeout(n.reconnectTimer),n.reconnectTimer=null),Yo(n);const a=n.socket;return n.socket=null,Wr(n,"reconnecting"),a&&(a.readyState===WebSocket.OPEN||a.readyState===WebSocket.CONNECTING)&&a.close(),oh(n),!0}function WM(){for(const e of ta.values()){if(e.status!=="unauthorized"||e.exited)continue;e.reconnectTimer!==null&&(window.clearTimeout(e.reconnectTimer),e.reconnectTimer=null),Yo(e);const t=e.socket;e.socket=null,e.reconnectEnabled=!0,Wr(e,"reconnecting"),t&&(t.readyState===WebSocket.OPEN||t.readyState===WebSocket.CONNECTING)&&t.close(),oh(e)}}function qf(){for(const e of Array.from(ta.keys()))lm(e)}function $M(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,preserveCachedOutputOnNextSnapshot:!1}}function oh(e){if(!e.reconnectEnabled)return;Wr(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){Wr(e,"connected");for(const n of e.pendingOut)t.send(JSON.stringify(n));e.pendingOut.length=0,e.isAlive=!0,YM(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")return;if(o.type==="pong"){e.isAlive=!0;return}const c=XM(e,o);a1(e,{type:"message",message:c})}),t.addEventListener("close",n=>{if(e.socket===t){if(e.socket=null,Yo(e),n.code===1008){e.reconnectEnabled=!1,Wr(e,VM(n.reason)?"unauthorized":"closed");return}if(e.exited||!e.reconnectEnabled){Wr(e,"closed");return}Wr(e,"reconnecting"),e.reconnectTimer=window.setTimeout(()=>{e.reconnectTimer=null,oh(e)},IM)}}),t.addEventListener("error",()=>{})}function YM(e){Yo(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)}))}},KM)}function Yo(e){e.heartbeat!==null&&(window.clearInterval(e.heartbeat),e.heartbeat=null)}function VM(e){return e.trim().toLowerCase()==="unauthorized"}function XM(e,t){return t.type==="snapshot"?(e.snapshot=t.terminal,e.history=t.history??null,e.exited=t.terminal.status==="exited",e.preserveCachedOutputOnNextSnapshot?(e.preserveCachedOutputOnNextSnapshot=!1,GM(e,t.output),Wf(e),{...t,output:e.output.slice(),history:e.history}):(e.output=t.output.slice(),e.outputBytes=e.output.reduce((n,a)=>n+a.length,0),Wf(e),t)):t.type==="output"?(e.output.push(t.data),e.outputBytes+=t.data.length,Wf(e),t):t.type==="terminal_updated"?(e.snapshot=t.terminal,t.terminal.status==="exited"&&(e.exited=!0),t):(t.type==="exit"&&(e.exited=!0,e.snapshot&&e.snapshot.id===t.terminalId&&(e.snapshot={...e.snapshot,status:"exited",exitCode:t.exitCode})),t)}function GM(e,t){const n=ZM(e.output,t);if(n===0)return;const a=t.slice(n);for(const o of a)e.output.push(o),e.outputBytes+=o.length}function ZM(e,t){const n=Math.min(e.length,t.length);for(let a=n;a>0;a-=1){let o=!0;for(let c=0;c<a;c+=1)if(e[e.length-a+c]!==t[c]){o=!1;break}if(o)return a}return 0}function Wf(e){for(;e.outputBytes>PM&&e.output.length>1;){const t=e.output.shift();e.outputBytes-=t.length}}function Wr(e,t){e.status!==t&&(e.status=t,a1(e,{type:"status",status:t}))}function a1(e,t){for(const n of Array.from(e.listeners))n(t)}function QM(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 JM(e){e.reconnectEnabled=!1,e.reconnectTimer!==null&&(window.clearTimeout(e.reconnectTimer),e.reconnectTimer=null),Yo(e);const t=e.socket;e.socket=null,t&&(t.readyState===WebSocket.OPEN||t.readyState===WebSocket.CONNECTING)&&t.close(),e.listeners.clear()}const eN=[0,50,150,350],tN=[300,1200,2500],iN=1e3,sN=1e5,om="\x1B[?1049l\x1B[?1047l\x1B[?47l",nN=new Set(["47","1047","1049"]),rN=400,aN=3,lN=3,oN=32,cN=1.42,uN=2,hN=24,dN=240,fN=60,pN=420,mN=6,_N=2,KS=[500,1500,3e3,5e3,8e3],gN=mi.lazy(()=>t_(()=>import("./TranscriptMarkdownBody-jREm5Kmh.js"),__vite__mapDeps([2,1])));function FS({terminal:e,serverApi:t,active:n,visible:a=!0,canClose:o,refreshCwdOnEnter:c=!1,tabId:h,onSelect:f,onClose:_,onExit:p,onSnapshot:y,onAuthClose:b}){const S=v.useSyncExternalStore(V0,mp,()=>Vr),C=v.useSyncExternalStore(X0,_p,()=>Ja),x=v.useSyncExternalStore(G0,vp,()=>!0),E=v.useSyncExternalStore(Nm,mr,()=>Qa),B=v.useSyncExternalStore(Xm,()=>Gm("history.toggle"),()=>"Alt+H"),k=v.useRef(null),H=v.useRef(null),U=v.useRef(null),X=v.useRef(null),ee=v.useRef({onExit:p,onSnapshot:y}),te=v.useRef(t.createWebSocketUrl),ne=v.useRef(b),re=v.useRef(null),fe=v.useRef(new Map),K=v.useRef([]),A=v.useRef([]),I=v.useRef([]),O=v.useRef(0),j=v.useRef(!1),J=v.useRef(null),T=v.useRef(0),W=v.useRef(null),F=v.useRef(null),me=v.useRef(!1),we=v.useRef(!1),R=v.useRef(!1),G=v.useRef(!1),ae=v.useRef(null),de=v.useRef(null),ge=v.useRef(!1),ye=v.useRef(!1),xe=v.useRef(!1),Fe=v.useRef(!1),he=v.useRef(!1),ve=v.useRef(!1),ze=v.useRef(!1),Re=v.useRef(n),Ee=v.useRef(a),ie=v.useRef(c),Me=v.useRef(S),Ce=v.useRef(C),je=v.useRef(!1),qe=v.useRef(null),Ct=v.useRef(null),ft=v.useRef(!1),$t=v.useRef(null),[,Hi]=v.useState("connecting"),[$s,rt]=v.useState(!1),[li,Zi]=v.useState(null),[gi,zt]=v.useState(!1),[Ui,vi]=v.useState(null),[$,He]=v.useState(!1),[Qe,lt]=v.useState(!1),[Jt,jt]=v.useState(!1),[oi,Fi]=v.useState(null),[an,ls]=v.useState(!1),Ss=!!oi||cm(e.currentCommand),[bt,xt]=v.useState(!1);v.useLayoutEffect(()=>{Re.current=n},[n]),v.useLayoutEffect(()=>{Ee.current=a},[a]),v.useLayoutEffect(()=>{ie.current=c},[c]),v.useLayoutEffect(()=>{Me.current=S},[S]),v.useLayoutEffect(()=>{Ce.current=C},[C]),v.useLayoutEffect(()=>{je.current=an},[an]),v.useLayoutEffect(()=>{qe.current=oi},[oi]),v.useLayoutEffect(()=>{ft.current=Ss},[Ss]),v.useEffect(()=>{a&&n&&e.status==="running"&&(ut(),be())},[n,a,e.status]),v.useEffect(()=>{ee.current={onExit:p,onSnapshot:y}},[p,y]),v.useEffect(()=>{te.current=t.createWebSocketUrl,ne.current=b},[t,b]),v.useEffect(()=>{let N=!1,ue=null,Ue=0;const Be=NN(e.currentCommand);function Xe(){ue!==null&&(window.clearTimeout(ue),ue=null)}function ct(){if(!Be||Ue>=KS.length||N)return;const Si=KS[Ue++];ue=window.setTimeout(()=>{ue=null,Lt()},Si)}async function Lt(){try{const Si=await t.getTerminalTranscriptSource(e.id);if(N)return;Fi(Si.source),Si.source||ct()}catch(Si){if(N)return;Fi(null),$f(Si)&&ct()}}return Fi(null),e.status!=="running"?()=>{N=!0,Xe()}:(Lt(),()=>{N=!0,Xe()})},[t,e.currentCommand,e.id,e.status]),v.useEffect(()=>{const N=oi?`${e.id}:${oi.provider}:${oi.sessionId}`:null,ue=Ct.current;ue!==null&&ue!==N&&je.current&&ls(!1),Ct.current=N},[e.id,oi?.provider,oi?.sessionId]),v.useEffect(()=>{function N(ue){!Re.current||!Ee.current||!qe.current||ue.isComposing||ue.key==="Process"||bN(ue.target)||Z0(ue)?.id!=="history.toggle"||(ue.preventDefault(),ue.stopPropagation(),ls(Be=>!Be))}return window.addEventListener("keydown",N,!0),()=>window.removeEventListener("keydown",N,!0)},[]),v.useEffect(()=>{const N=H.current;N&&(N.options.disableStdin=e.status==="exited"),e.status==="exited"&&Hi("closed")},[e.status]),v.useEffect(()=>{const N=H.current;N&&(N.options.fontSize=S,Tf(S,Ce.current).then(()=>{Me.current===S&&ut()}))},[S]),v.useEffect(()=>{const N=H.current;N&&(N.options.fontFamily=pp(C),Tf(Me.current,C).then(()=>{Ce.current===C&&ut()}))},[C]),v.useEffect(()=>{const N=H.current;N&&(N.options.theme=qS(E))},[E]),v.useEffect(()=>{const N=k.current;if(!N)return;let ue=!1,Ue=null,Be=null,Xe=null,ct=null,Lt=null,Si=null,Qi=null;re.current=null,he.current=!1,ve.current=!1,G.current=!1,bi(),ci();const Vs=Me.current,cn=Ce.current,cs=new nM({cursorBlink:!0,convertEol:!1,disableStdin:e.status==="exited",fontFamily:pp(cn),fontSize:Vs,fontWeight:400,fontWeightBold:700,macOptionClickForcesSelection:!0,scrollback:sN,theme:{...qS(mr())}}),Xo=new XT;return cs.loadAddon(Xo),ct=OM(cs),H.current=cs,U.current=Xo,Tf(Vs,cn).then(()=>{if(ue)return;cs.open(N),he.current=!0,Ue=RM(cs),Ee.current&&Re.current&&e.status==="running"&&be(),ut(),Lt=PN(N,cs,()=>Me.current*1.2,Pt,wi=>{Et(wi)},On,os),Si=jN(N,cs,Pt,wi=>{Et(wi)},On,os);const oa=new rM;Be=cs.onData(wi=>{if(ze.current){const ua=pM(wi);if(ua){pt(!1),Q(ua);return}}const ca=oa.accept(wi);ca&&Q(ca)}),Xe=cs.onScroll(wi=>{if(ye.current||Fe.current||xe.current){Rt();return}ra(),qs(cs)&&At({scrollToBottom:!0}),Pt(),wi<=3&&Et()}),Qi=new ResizeObserver(()=>{Pi()}),Qi.observe(N),ve.current&&(ui(),ve.current=!1,ut()),yi()}),()=>{ue=!0,he.current=!1,ve.current=!1,bi(),Ut(),na(),xe.current=!1,Lt?.(),Si?.(),Qi?.disconnect(),Ue?.dispose(),Be?.dispose(),Xe?.dispose(),ct?.dispose(),cs.dispose(),H.current=null,U.current=null}},[e.id]),v.useEffect(()=>{const N=te.current(e.id),ue=FM(N,Ht);return X.current=ue.send,Hi(ue.status),ue.status==="connected"&&ut(),ue.snapshot&&(ee.current.onSnapshot(ue.snapshot,{notifyCompletion:!1}),H.current&&(ut(),Yt(ue.output,ue.history),ut())),()=>{ue.detach(),X.current=null}},[e.id,e.status]);function Ht(N){if(N.type==="status"){Hi(N.status),N.status==="unauthorized"&&ne.current?.({source:"terminal-ws-1008",terminalId:e.id}),N.status==="connected"&&ut();return}ot(N.message)}function ci(N=[],ue=null){A.current=[],I.current=fu(N),O.current=0,j.current=!1,J.current=null,xe.current=!1,T.current+=1,W.current=ue,F.current=null,me.current=!1,we.current=!1,R.current=!1,ve.current=!1,$t.current=null,ae.current=null,ge.current=!1,rt(!1),Zi(null),zt(!1),vi(null),He(!1),lt(!1)}function Yt(N=[],ue=null){ci(N,ue),ei()}function ei(){if(!H.current||!he.current){ve.current=!0;return}ve.current=!1,ui()}async function ui(){const N=H.current;if(!N)return;const ue=pu(N,ge.current),Ue=ue?I.current.length:O.current;await Ni(N,{liveOutputLimit:Ue,scrollToBottom:ue}),H.current===N&&Rt()}function Ni(N,ue={}){return new Promise(Ue=>{xe.current=!0,j.current=!1;const Be=T.current+1;T.current=Be;const Xe=Math.max(0,Math.min(ue.liveOutputLimit??I.current.length,I.current.length)),ct=ue.historyPages??A.current,Lt=()=>{if(H.current!==N||T.current!==Be){Ue(!1);return}try{O.current=Xe,ue.scrollToBottom&&Cs(N)}finally{xe.current=!1;const Qi=ln();Qi?At(Qi):ue.applyDeferredSnapshot!==!1&&wr(),Ue(!0)}},Si=()=>{if(H.current!==N||T.current!==Be){Ue(!1);return}N.clear();const Qi=fu([...ct,...I.current.slice(0,Xe)]);if(Qi.length===0){Lt();return}for(let Vs=0;Vs<Qi.length;Vs+=1){const cn=Qi[Vs];Vs===Qi.length-1?N.write(cn,Lt):N.write(cn)}};if(N.buffer.active.type==="alternate"){N.write(om,Si);return}Si()})}async function Et(N=0){const ue=H.current;if(R.current||!ue)return;if(Wi(ue)){Rt();return}const Ue=W.current;R.current=!0,rt(!0);const Be=ue.buffer.active.viewportY;try{let Xe=!!(Ue&&!Ue.hasMore);if(!Xe)try{const ct=await t.getTerminalHistory(e.id,{beforeLine:Ue?.startLine??0,limit:iN}),Lt={startLine:ct.startLine,endLine:ct.endLine,hasMore:ct.hasMore};if(ct.output.length>0){await Vt(ue,ct.output,Be,N)&&(W.current=Lt);return}W.current=Lt,Xe=!ct.hasMore}catch(ct){Xe=$f(ct)}if(Xe){if(Wi(ue)){Rt();return}await qi(ue,Be,N)}}catch{}finally{R.current=!1,rt(!1)}}async function qi(N,ue,Ue){if(!(me.current||we.current))try{const Be=F.current,Xe=await t.getTerminalTranscriptHistory(e.id,{...Be?{cursor:Be}:{},limit:rN}),ct=Xe.output.map(o1);if(ct.length===0){Fi(Xe.source),F.current=Xe.cursor,we.current=!Xe.hasMore||!Xe.cursor;return}await Vt(N,ct,ue,Ue)&&(Fi(Xe.source),F.current=Xe.cursor,we.current=!Xe.hasMore||!Xe.cursor)}catch(Be){$f(Be)&&(me.current=!0)}}async function Vt(N,ue,Ue,Be){if(Wi(N))return Rt(),!1;const Xe=[...ue,...A.current],ct=ON(ue);return!await Ni(N,{liveOutputLimit:O.current,scrollToBottom:!1,historyPages:Xe,applyDeferredSnapshot:!1})||H.current!==N?!1:(A.current=Xe,ol(N,Math.max(0,Ue+ct+Math.min(0,Be))),ge.current=!qs(N),Pt(),!0)}v.useEffect(()=>{const N=window.visualViewport;function ue(){document.visibilityState==="visible"&&ut()}function Ue(){ut()}function Be(){yi()}return document.addEventListener("visibilitychange",ue),window.addEventListener("pageshow",Ue),window.addEventListener("resize",Be),N?.addEventListener("resize",Be),N?.addEventListener("scroll",Be),()=>{document.removeEventListener("visibilitychange",ue),window.removeEventListener("pageshow",Ue),window.removeEventListener("resize",Be),N?.removeEventListener("resize",Be),N?.removeEventListener("scroll",Be)}},[e.id]);function Ai(){const N=te.current(e.id);G.current=!0,$t.current=null,Hi("reconnecting"),ut(),qM(N,{preserveCachedOutputOnNextSnapshot:!0})}function ot(N){if(N.type==="snapshot"&&N.terminal.id===e.id){ee.current.onSnapshot(N.terminal,{notifyCompletion:!1});const Ue=H.current;if(!Ue)return;ut();const Be=G.current;if(G.current=!1,Be){W.current=N.history??W.current,Rt(),ut();return}if(Ys(Ue,N.terminal)){It(N.output,N.history??null),Rt(),ut();return}Yt(N.output,N.history??null),ut();return}if(N.type==="terminal_updated"&&N.terminal.id===e.id){ee.current.onSnapshot(N.terminal,{notifyCompletion:!0});return}if(N.type==="output"&&N.terminalId===e.id){const Ue=h1(N.data);if(!Ue)return;I.current.push(Ue),H.current&&he.current?At({scrollToBottom:!0}):ve.current=!0;return}const ue=H.current;if(ue){if(N.type==="exit"&&N.terminalId===e.id){ee.current.onExit(N.exitCode),Hi("closed");return}N.type==="error"&&ue.writeln(`\r
|
|
32
|
-
[nterminal] ${N.message}`)}}function Pi(N=25){if(document.visibilityState==="hidden"||!Ee.current||fe.current.has(N))return;const ue=window.setTimeout(()=>{fe.current.delete(N),D()},N);fe.current.set(N,ue)}function yi(){for(const N of eN)Pi(N)}function ut(){re.current=null,yi()}function bi(){for(const N of fe.current.values())window.clearTimeout(N);fe.current.clear()}function Ut(){for(const N of K.current)window.clearTimeout(N);K.current=[]}function Pt(){if(Rt(),!ae.current){zt(!1);return}zt(!0),na(),de.current=window.setTimeout(()=>{de.current=null,zt(!1)},1200)}function Rt(){const N=H.current,ue=N?zN(N):null;if(ae.current=ue,Zi(ue),lt(!!(N&&ue)),He(!!(N&&ue&&!qs(N))),ue||!N||!br()){vi(null);return}vi({alternate:N.buffer.active.type==="alternate"})}function br(){const N=W.current;return A.current.length>0||!!N?.hasMore}function na(){de.current!==null&&(window.clearTimeout(de.current),de.current=null)}function ra(){const N=H.current;N&&(ge.current=!qs(N),Rt())}function Sr(N){J.current=Yf(J.current,N)}function ws(N){const ue=J.current;return J.current=null,Yf(ue,N)}function ln(){const N=J.current;return J.current=null,N}function At(N={}){const ue=H.current;if(!ue||!he.current){ve.current=!0;return}if(xe.current){Sr(N);return}if(j.current){Sr(N);return}const Ue=ws(N);if(!Ue.force&&!pu(ue,ge.current)){Rt();return}j.current=!0;const Be=T.current,Xe=()=>{if(H.current!==ue||T.current!==Be){j.current=!1;return}if(!Ue.force&&!pu(ue,ge.current)){j.current=!1,Rt();return}const ct=O.current,Lt=I.current[ct];if(Lt===void 0){j.current=!1,Ue.scrollToBottom&&Cs(ue),Rt();const Si=ln();Si?At(Yf(Ue,Si)):wr();return}ue.write(Lt,()=>{if(H.current!==ue||T.current!==Be){j.current=!1;return}O.current=ct+1,Xe()})};Xe()}function Wi(N){return!qs(N)&&(Us()||j.current||xe.current)}function Ys(N,ue){return(ft.current||cm(ue?.currentCommand))&&!qs(N)}function Us(){return O.current<I.current.length}function It(N,ue){$t.current={output:N,history:ue,appendFromLiveOutputIndex:O.current}}function wr(){const N=H.current,ue=$t.current;if(!N||!ue||!qs(N)||Us()||j.current||xe.current)return;const Ue=fu(ue.output),Be=fu(I.current.slice(ue.appendFromLiveOutputIndex));$t.current=null,Yt(BN(Ue,Be),ue.history),ut()}function On(){Fe.current=!0}function os(){ra(),Fe.current=!1;const N=H.current;N&&qs(N)&&At({scrollToBottom:!0})}function Cs(N){on(()=>XS(N))&&(ge.current=!1)}function ol(N,ue){on(()=>(N.scrollToLine(ue),!0))}function on(N){ye.current=!0;try{return N()}finally{ye.current=!1}}function aa(){const N=H.current;if(!N)return;const ue=()=>{XS(N),ge.current=!1,Rt(),At({force:!0,scrollToBottom:!0}),be()};if(N.buffer.active.type==="alternate"){N.write(om,ue);return}ue()}function la(N){const ue=H.current,Ue=k.current;if(!ue||!Ue)return;const Be=Ue.getBoundingClientRect();if(Be.height<=0)return;const Xe=Math.max(0,Math.min(1,(N-Be.top)/Be.height)),ct=Math.round(ue.buffer.active.baseY*Xe);On();try{ue.scrollToLine(ct)}finally{os()}ge.current=!qs(ue),Rt(),Pt(),ct<=3&&Et()}function $i(N){N.preventDefault(),N.stopPropagation(),N.currentTarget.setPointerCapture?.(N.pointerId),la(N.clientY)}function Ps(N){(N.buttons&1)!==0&&(N.preventDefault(),N.stopPropagation(),la(N.clientY))}function D(){const N=H.current,ue=U.current;if(!(!N||!ue)&&!(document.visibilityState==="hidden"||!Ee.current||k.current?.isConnected===!1))try{const Ue=pu(N,ge.current);ue.fit(),Ue&&Cs(N),N.refresh(0,Math.max(0,N.rows-1)),Rt();const Be={cols:N.cols,rows:N.rows},Xe=re.current;if(Xe&&Xe.cols===Be.cols&&Xe.rows===Be.rows)return;z({type:"resize",terminalId:e.id,cols:Be.cols,rows:Be.rows})&&(re.current=Be)}catch{}}function z(N){const ue=X.current;return ue?ue(N):!1}function Q(N){At({force:!0,scrollToBottom:!0}),z({type:"input",terminalId:e.id,data:N})&&MN(N)&&pe()}function pe(){!ie.current||!Re.current||(Ut(),K.current=tN.map(N=>{const ue=window.setTimeout(()=>{K.current=K.current.filter(Ue=>Ue!==ue),ie.current&&Re.current&&z({type:"refresh_cwd",terminalId:e.id})},N);return ue}))}function be(){je.current||H.current?.focus()}const Le=v.useCallback(()=>{ls(!1)},[]);function Ne(){jt(N=>{const ue=!N;return ze.current=ue,ue}),be()}function pt(N){ze.current=N,jt(N)}function mt(N){ze.current&&pt(!1),Q(fM(N)),be()}return m.jsxs("section",{className:"terminal-pane","data-active":n,onMouseDown:()=>{n||f()},children:[m.jsx(SN,{terminal:e,canClose:o,tabId:h,transcriptSource:oi,transcriptShortcutLabel:B,onOpenTranscript:()=>ls(!0),onReload:Ai,onClose:_}),m.jsx("div",{className:"xterm-container",ref:k}),$s?m.jsx("div",{className:"terminal-history-loader",role:"status","aria-label":"Loading older terminal output",children:m.jsx("span",{"aria-hidden":"true"})}):null,x&&li?m.jsxs("div",{className:"terminal-scroll-progress","data-active":gi,"aria-hidden":"true",children:[li.current,"/",li.total]}):x&&Ui?m.jsxs("div",{className:"terminal-scroll-progress","data-active":!1,"data-pending":"true","data-buffer":Ui.alternate?"alternate":"normal","aria-hidden":"true",children:[Ui.alternate?"alt ":"","0/?"]}):null,$?m.jsx("button",{type:"button",className:"terminal-scroll-bottom-button","aria-label":"Scroll terminal to bottom",title:"Scroll to bottom",onPointerDown:N=>N.stopPropagation(),onMouseDown:N=>N.stopPropagation(),onClick:N=>{N.stopPropagation(),aa()},children:"↓"}):null,Qe?m.jsx("button",{type:"button",className:"terminal-scroll-handle","aria-label":"Drag terminal scroll handle",title:"Drag to scroll",onPointerDown:$i,onPointerMove:Ps,children:m.jsx("span",{"aria-hidden":"true"})}):null,n&&e.status==="running"?bt?m.jsx(hM,{ctrlActive:Jt,onCtrl:Ne,onStandaloneKey:mt,onPreserveFocus:be,onHide:()=>xt(!1)}):m.jsx("button",{type:"button",className:"mobile-terminal-key-toggle","aria-label":"Show terminal control keys",title:"Show Ctrl / Esc / Tab / arrows",onMouseDown:N=>{N.stopPropagation(),be()},onPointerDown:N=>{N.stopPropagation(),be()},onClick:()=>xt(!0),children:"⌨"}):null,m.jsx(EM,{terminalId:e.id,onSubmit:Q,disabled:e.status!=="running"}),an&&oi?m.jsx(wN,{terminalId:e.id,serverApi:t,source:oi,fontSize:S,onClose:Le}):null]})}function qS(e){return $x(e)}function vN(e,t,n){const a=yN(e,t),o=WS(a*Math.max(1,n),fN,pN);return{limit:WS(Math.ceil(o/uN),hN,dN),maxLines:o}}function yN(e,t){const n=e?.clientHeight??0;if(n<=0)return oN;const a=Math.max(10,t*cN);return Math.max(1,Math.floor(n/a))}function WS(e,t,n){return Math.max(t,Math.min(n,Math.floor(e)))}function bN(e){return e instanceof HTMLElement?!!e.closest(".security-panel:not(.transcript-dialog)"):!1}function SN({terminal:e,canClose:t,tabId:n,transcriptSource:a,transcriptShortcutLabel:o,onOpenTranscript:c,onReload:h,onClose:f}){const _=L0({id:`pane-${e.id}`,disabled:!n,...n?{data:{kind:"pane",sourceTabId:n,terminalId:e.id}}:{}}),p={cursor:n?"grab":"default",opacity:_.isDragging?.5:void 0};return m.jsxs("header",{ref:_.setNodeRef,className:"terminal-pane-header",style:p,"data-dragging":_.isDragging,..._.attributes,..._.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.jsxs("button",{type:"button",className:"terminal-pane-transcript","data-provider":a.provider,title:`View ${qu(a.provider)} transcript history`,"aria-label":`View ${qu(a.provider)} transcript history`,onPointerDown:y=>y.stopPropagation(),onMouseDown:y=>y.stopPropagation(),onClick:y=>{y.stopPropagation(),c()},children:[m.jsx("span",{children:"View history"}),m.jsx("kbd",{children:o})]}):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:y=>y.stopPropagation(),onMouseDown:y=>y.stopPropagation(),onClick:y=>{y.stopPropagation(),h()},children:"↻"}):null,t?m.jsx("button",{type:"button",className:"terminal-pane-close","aria-label":`Close pane ${e.title}`,title:"Close pane",onPointerDown:y=>y.stopPropagation(),onMouseDown:y=>y.stopPropagation(),onClick:y=>{y.stopPropagation(),f()},children:"x"}):null]})}const wN=mi.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),y=v.useRef(null),b=v.useRef(""),[S,C]=v.useState([]),[x,E]=v.useState(!1),[B,k]=v.useState(""),[H,U]=v.useState(-1),[X,ee]=v.useState(null),[te,ne]=v.useState(!1),[re,fe]=v.useState(!0),[K,A]=v.useState(!1),[I,O]=v.useState(null);v.useEffect(()=>{function he(ve){ve.key==="Escape"&&(ve.preventDefault(),ve.stopPropagation(),c())}return document.addEventListener("keydown",he,!0),()=>document.removeEventListener("keydown",he,!0)},[c]),v.useEffect(()=>{f.current+=1;const he=f.current;return _.current=!1,p.current=!0,y.current=null,C([]),ee(null),ne(!1),O(null),de(null,"initial",he),()=>{f.current===he&&(f.current+=1)}},[n,x,a.provider,a.sessionId,t]),v.useLayoutEffect(()=>{const he=h.current;if(!he)return;if(p.current){if(re||S.length===0)return;p.current=!1;const ze=()=>{he.scrollTop=he.scrollHeight};ze(),window.requestAnimationFrame?.(ze);return}const ve=y.current;ve!==null&&(y.current=null,he.scrollTop+=he.scrollHeight-ve)},[S,re,x]);const j=qu(a.provider),J=VS(S,x),T=EN(J),W=DN(T,B),F=W.length,me=F>0?H>=0&&H<F?H:0:-1,we=me>=0?W[me]?.entryIndex??null:null,R=me>=0?W[me]??null:null,G=J?J.split(`
|
|
33
|
-
`).length-1:0,ae=B.trim()?F>0?`${me+1}/${F} ${F===1?"match":"matches"} · ${G} ${G===1?"line":"lines"}`:`0 matches · ${G} ${G===1?"line":"lines"}`:G>0?`${G} lines`:"0 lines";v.useEffect(()=>{const he=B.trim().toLowerCase();U(ve=>!he||F===0?-1:b.current!==he?0:ve>=0&&ve<F?ve:0),b.current=he},[B,F]);async function de(he,ve,ze=f.current){if(!_.current){_.current=!0,ve==="initial"?fe(!0):(A(!0),y.current=h.current?.scrollHeight??null),O(null);try{await ge(he,ve,ze)}catch(Re){if(f.current!==ze)return;O(Re instanceof Error?Re.message:"Failed to load transcript history.")}finally{f.current===ze&&(_.current=!1,fe(!1),A(!1))}}}async function ge(he,ve,ze){let Re=he,Ee=0,ie=[];const Me=ve==="initial"?_N:mN;for(;f.current===ze;){const Ce=await n.getTerminalTranscriptHistory(t,{...Re?{cursor:Re}:{},...vN(h.current,o,ve==="initial"?aN:lN),includeTools:x});if(f.current!==ze)return;const je=YS(Ce.output,a.provider,{includeTools:x}),qe=ye(Ce,ve,ie,je);if(je&&(ie=[je,...ie],qe))return;if(!Ce.hasMore||!Ce.cursor||Ee>=Me){ie.length>0&&C(Ct=>ve==="older"?[...ie,...Ct]:ie);return}Re=Ce.cursor,Ee+=1}}function ye(he,ve,ze,Re=YS(he.output,a.provider,{includeTools:x})){if(ee(he.cursor),ne(!!(he.hasMore&&he.cursor)),!Re)return!1;const Ee=[Re,...ze];return VS(Ee,x)?(C(ie=>ve==="older"?[...Ee,...ie]:Ee),!0):!1}function xe(){const he=h.current;!he||he.scrollTop>72||!te||!X||_.current||de(X,"older")}function Fe(he){F!==0&&U(ve=>{const ze=me>=0?me:he>0?-1:0;return((ve>=0&&ve<F?ve:ze)+he+F)%F})}return m.jsx("div",{className:"security-overlay transcript-overlay",role:"dialog","aria-modal":"true","aria-labelledby":"transcript-dialog-title",onPointerDown:he=>he.stopPropagation(),onMouseDown:he=>he.stopPropagation(),onClick:he=>{he.stopPropagation(),c()},children:m.jsxs("div",{className:"security-panel transcript-dialog",onPointerDown:he=>he.stopPropagation(),onMouseDown:he=>he.stopPropagation(),onClick:he=>he.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:[j," 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:x,onChange:he=>E(he.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:he=>k(he.currentTarget.value),onKeyDown:he=>{he.key==="Enter"&&(he.preventDefault(),Fe(he.shiftKey?-1:1))}})]}),m.jsxs("div",{className:"transcript-search-actions","aria-label":"Search result navigation",children:[m.jsx("button",{type:"button",onClick:()=>Fe(-1),disabled:F===0,children:"Prev"}),m.jsx("button",{type:"button",onClick:()=>Fe(1),disabled:F===0,children:"Next"})]}),m.jsx("span",{className:"transcript-result-count",children:ae})]}),m.jsxs("div",{ref:h,className:"transcript-dialog-scroll","aria-label":"JSONL transcript output",onScroll:xe,children:[K?m.jsx("div",{className:"transcript-dialog-status",children:"Loading older entries..."}):null,!re&&te?m.jsx("div",{className:"transcript-dialog-hint",children:"Scroll up for older entries"}):null,J?m.jsx(CN,{entries:T,searchQuery:B,activeEntryIndex:we,activeSearchMatch:R,fontSize:o}):null,re?m.jsx("div",{className:"transcript-dialog-status",children:"Loading transcript..."}):null,!re&&!J&&!I?m.jsx("div",{className:"transcript-dialog-status",children:"No transcript entries found."}):null,I?m.jsx("div",{className:"transcript-dialog-error",children:I}):null]})]})})});function CN({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:l1(h.header,t)}):null,h.body?m.jsx("div",{className:"transcript-entry-body",children:h.kind==="tool"?m.jsx($S,{text:h.body,searchQuery:t}):m.jsx(mi.Suspense,{fallback:m.jsx($S,{text:h.body,searchQuery:t}),children:m.jsx(gN,{text:h.body,searchQuery:t})})}):null]},`${h.header??"plain"}-${f}`))})}function $S({text:e,searchQuery:t}){const n=e.endsWith(`
|
|
34
|
-
`)?e.slice(0,-1).split(`
|
|
35
|
-
`):e.split(`
|
|
36
|
-
`);return m.jsx("pre",{className:"transcript-entry-pre",children:n.map((a,o)=>m.jsx("span",{className:`transcript-line transcript-line-${RN(a,o===0||n[o-1]?.trim()==="")}`,children:l1(a,t)},o))})}function l1(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 xN(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 EN(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=TN(c).join(`
|
|
38
|
-
`);(a||f)&&n.push({header:a,body:f,kind:o}),a=null,o="plain",c=[]}for(const f of t.split(`
|
|
39
|
-
`)){const _=kN(f);_?(h(),a=f,o=_):c.push(f)}return h(),n}function TN(e){let t=e.length;for(;t>0&&(e[t-1]??"").trim()==="";)t-=1;return e.slice(0,t)}function kN(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 DN(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=xN(c,t);for(let f=0;f<h;f+=1)n.push({entryIndex:a,matchIndexInEntry:f})}return n}function RN(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)||u1(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 MN(e){return e.includes("\r")||e.includes(`
|
|
41
|
-
`)}function $f(e){return e instanceof Nn&&e.status===404}function cm(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 NN(e){if(cm(e))return!0;if(!e)return!1;const t=e.replace(/^.*[\\/]/,"").toLowerCase();return t==="node"||t==="nodejs"}function qu(e){return e==="codex"?"Codex":"Claude"}function YS(e,t,n={}){const a=`[nterminal] ${qu(t)} transcript archive ends here. Live terminal screen continues below.`,o=e.join("").replace(/\r\n/g,`
|
|
42
|
-
`).replace(/\r/g,`
|
|
43
|
-
`).replace(a,"").replace(/\n{3,}/g,`
|
|
44
|
-
|
|
45
|
-
`).trimEnd(),c=o1(o),h=n.includeTools?c:c1(c);return h?`${h}
|
|
46
|
-
`:""}function o1(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=AN(n);return a?`[${a}]`:t})}function AN(e){const t=new Date(e);if(!Number.isFinite(t.getTime()))return null;const n=t.getFullYear(),a=ro(t.getMonth()+1),o=ro(t.getDate()),c=ro(t.getHours()),h=ro(t.getMinutes()),f=ro(t.getSeconds());return`${n}-${a}-${o} ${c}:${h}:${f}`}function ro(e){return e.toString().padStart(2,"0")}function VS(e,t){return e.map(n=>t?n:c1(n)).filter(Boolean).map(n=>n.endsWith(`
|
|
47
|
-
`)?n:`${n}
|
|
48
|
-
`).join("")}function c1(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?LN(h):null;if(_&&(a=_==="tool",o=!1),u1(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
|
-
`).replace(/\n{3,}/g,`
|
|
51
|
-
|
|
52
|
-
`).trimEnd()}function LN(e){const t=e.replace(/^\[[^\]]+\]\s+/,"");return/^Tool (?:call(?::|$)|output$)/.test(t)?"tool":/^(?:User|Codex|Claude|System)$/.test(t)?"message":null}function u1(e){return/^\[tool (?:call(?::|])|output\])/.test(e.trim())}function BN(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 ON(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 fu(e){const t=[];for(const n of e){const a=h1(n);a&&t.push(a)}return t}function h1(e){return e.replace(/\x1b\[\?([0-9;:]*)([hl])/g,(t,n,a)=>{const o=n.split(";").filter(Boolean).filter(c=>!nN.has(c.split(":")[0]??""));return o.length>0?`\x1B[?${o.join(";")}${a}`:""})}function Yf(e,t={}){const n={};return(e?.force||t.force)&&(n.force=!0),(e?.scrollToBottom||t.scrollToBottom)&&(n.scrollToBottom=!0),n}function zN(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 qs(e){return e.buffer.active.viewportY>=Math.max(0,e.buffer.active.baseY-1)}function pu(e,t){return!t||qs(e)}function XS(e){return qs(e)?!1:(e.scrollToLine(Math.max(0,e.buffer.active.baseY)),!0)}function jN(e,t,n,a,o,c){const h=f=>{const _=UN(f);_!==0&&(f.cancelable&&f.preventDefault(),f.stopPropagation(),HN(t,_,n,a,o,c))};return e.addEventListener("wheel",h,{capture:!0,passive:!1}),()=>{e.removeEventListener("wheel",h,{capture:!0})}}function HN(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(om,h);return}h()}function UN(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 PN(e,t,n,a,o,c,h){let f=null,_=0;const p={passive:!1};function y(C){f=Vf(C),_=0}function b(C){const x=Vf(C);if(x===null){f=null,_=0;return}if(f===null){f=x;return}const E=x.clientY-f.clientY;if(f=x,C.cancelable&&C.preventDefault(),E===0)return;if(IN(t)&&KN(t,x,-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 S(C){if(C.touches.length>0){f=Vf(C);return}f=null,_=0}return e.addEventListener("touchstart",y,p),e.addEventListener("touchmove",b,p),e.addEventListener("touchend",S),e.addEventListener("touchcancel",S),()=>{e.removeEventListener("touchstart",y,p),e.removeEventListener("touchmove",b,p),e.removeEventListener("touchend",S),e.removeEventListener("touchcancel",S)}}function Vf(e){if(e.touches.length!==1)return null;const t=e.touches[0];return t?{clientX:t.clientX,clientY:t.clientY}:null}function IN(e){return e.buffer.active.type==="alternate"||e.modes.mouseTrackingMode!=="none"}function KN(e,t,n){const a=e.element;return a?(a.dispatchEvent(FN(t,n)),!0):!1}function FN(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 um({node:e,terminals:t,editors:n,api:a,activeTerminalId:o,visible:c=!0,refreshCwdOnEnter:h=!1,tabId:f,dropZoneActive:_=!1,draggingTerminalId:p=null,mobileFocusLeafKey:y=null,path:b=[],totalPanes:S,onSelect:C,onClose:x,onResize:E,onExit:B,onSnapshot:k,onCloseEditor:H,onAuthClose:U}){const X=S??hm(e);if(b.length===0&&y){const re=dm(e),fe=re.some(K=>K.key===y)?y:re[0]?.key;if(re.length>1&&fe)return m.jsx("div",{className:"mobile-focused-split",children:re.map(K=>{const A=K.key===fe;if(K.type==="editor"){const O=n[K.editorId];return m.jsx("div",{className:"mobile-focused-pane","data-active":A,"aria-hidden":!A,children:O?m.jsx(Bb,{api:a,editor:O,canClose:X>1,onClose:()=>H(K.editorId)}):m.jsx("div",{className:"missing-pane",children:"Editor unavailable"})},K.key)}const I=t[K.terminalId];return I?m.jsx("div",{className:"mobile-focused-pane","data-active":A,"aria-hidden":!A,children:m.jsx(FS,{terminal:I,serverApi:a,active:A,visible:c&&A,canClose:X>1,refreshCwdOnEnter:h&&A,tabId:f,onSelect:()=>C(K.terminalId),onClose:()=>x(K.terminalId),onExit:O=>B(K.terminalId,O),onSnapshot:k,...U?{onAuthClose:U}:{}})},K.key):m.jsx("div",{className:"mobile-focused-pane","data-active":A,"aria-hidden":!A,children:m.jsx("div",{className:"missing-pane",children:"Terminal unavailable"})},K.key)})})}if(e.type==="pane"){const re=t[e.terminalId];if(!re)return m.jsx("div",{className:"missing-pane",children:"Terminal unavailable"});const fe=m.jsx(FS,{terminal:re,serverApi:a,active:e.terminalId===o,visible:c,canClose:X>1,refreshCwdOnEnter:h&&e.terminalId===o,tabId:f,onSelect:()=>C(e.terminalId),onClose:()=>x(e.terminalId),onExit:A=>B(e.terminalId,A),onSnapshot:k,...U?{onAuthClose:U}:{}});return _&&p!==e.terminalId?m.jsxs("div",{className:"pane-drop-host",children:[fe,m.jsx(mu,{terminalId:e.terminalId,side:"top"}),m.jsx(mu,{terminalId:e.terminalId,side:"right"}),m.jsx(mu,{terminalId:e.terminalId,side:"bottom"}),m.jsx(mu,{terminalId:e.terminalId,side:"left"})]}):fe}if(e.type==="editor"){const re=n[e.editorId];return re?m.jsx(Bb,{api:a,editor:re,canClose:X>1,onClose:()=>H(e.editorId)}):m.jsx("div",{className:"missing-pane",children:"Editor unavailable"})}const ee=Math.max(.1,Math.min(.9,e.ratio)),te=1-ee,ne=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:ne,children:[m.jsx("div",{className:"split-cell",children:m.jsx(um,{node:e.first,terminals:t,editors:n,api:a,activeTerminalId:o,visible:c,refreshCwdOnEnter:h,tabId:f,dropZoneActive:_,draggingTerminalId:p,mobileFocusLeafKey:y,path:[...b,0],totalPanes:X,onSelect:C,onClose:x,onResize:E,onExit:B,onSnapshot:k,onCloseEditor:H,...U?{onAuthClose:U}:{}})}),m.jsx(qN,{direction:e.direction,path:b,onResize:E}),m.jsx("div",{className:"split-cell",children:m.jsx(um,{node:e.second,terminals:t,editors:n,api:a,activeTerminalId:o,visible:c,refreshCwdOnEnter:h,tabId:f,dropZoneActive:_,draggingTerminalId:p,mobileFocusLeafKey:y,path:[...b,1],totalPanes:X,onSelect:C,onClose:x,onResize:E,onExit:B,onSnapshot:k,onCloseEditor:H,...U?{onAuthClose:U}:{}})})]})}function mu({terminalId:e,side:t}){const{setNodeRef:n,isOver:a}=B0({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 qN({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 _(y){const b=e==="vertical"?(y.clientX-f.left)/f.width:(y.clientY-f.top)/f.height;n(t,Math.min(.9,Math.max(.1,b)))}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 hm(e){return e.type==="pane"||e.type==="editor"?1:hm(e.first)+hm(e.second)}function dm(e){return e.type==="pane"?[{key:WN(e.terminalId),type:"terminal",terminalId:e.terminalId}]:e.type==="editor"?[{key:$N(e.editorId),type:"editor",editorId:e.editorId}]:[...dm(e.first),...dm(e.second)]}function WN(e){return`terminal:${e}`}function $N(e){return`editor:${e}`}const m_="workspace-default",YN="NTerminal";function VN(){return{workspaces:[],activeWorkspaceId:null,terminals:{}}}function XN(e,t){switch(t.type){case"workspace.hydrated":return fm(t.terminals,t.savedTabs,t.savedWorkspaces,t.savedActiveWorkspaceId);case"workspace.created":return GN(e,{id:t.workspaceId,title:t.title});case"workspace.closed":return QN(e,t.workspaceId);case"workspace.selected":return d1(e,t.workspaceId);case"workspace.renamed":return ZN(e,t.workspaceId,t.title);case"terminal.created":return f1(e,t.terminal);case"terminal.split":return JN(e,t.terminal,t.direction);case"terminal.updated":return u3(e,t.terminal);case"terminal.exited":return h3(e,t.terminalId,t.exitCode);case"terminal.closed":return m1(e,t.terminalId);case"terminal.detached":return d3(e,t.terminalId);case"editor.split":return e3(e,t.editorId,t.title,t.direction);case"editor.closed":return f3(e,t.editorId);case"pane.selected":return l3(e,t.terminalId);case"pane.resized":return o3(e,t.path,t.ratio);case"tab.selected":return i3(e,t.tabId);case"tab.renamed":return a3(e,t.tabId,t.title);case"tab.reordered":return p1(e,t.sourceTabId,t.targetIndex);case"tab.dropped_into_pane":return s3(e,t.sourceTabId,t.sourceTerminalId,t.targetTerminalId,t.side);case"terminal.extracted_to_tab":return n3(e,t.sourceTabId,t.sourceTerminalId,t.targetIndex);case"activePane.closed":return t3(e);default:return e}}function GN(e,t){if(e.workspaces.some(a=>a.id===t.id))return d1(e,t.id);const n={id:t.id,title:t.title,tabs:[],activeTabId:null};return{...e,workspaces:[...e.workspaces,n],activeWorkspaceId:n.id}}function d1(e,t){return e.workspaces.some(n=>n.id===t)?{...e,activeWorkspaceId:t}:e}function ZN(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 QN(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?c3(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 f1(e,t){const n=g1(e),a=sa(n)??hh(),o=v1(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 JN(e,t,n){const a=sa(e),o=a?uh(a):void 0;if(!a||!o)return f1(e,t);const c=o.activeTerminalId,h=Bo(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 e3(e,t,n,a){const o=sa(e),c=o?uh(o):void 0;if(!o||!c)return e;const h=c.activeTerminalId,f=Bo(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 t3(e){const t=sa(e),n=t?uh(t):void 0;return n?m1(e,n.activeTerminalId):e}function i3(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 p1(e,t,n){const a=e.workspaces.map(o=>{const c=o.tabs.findIndex(y=>y.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),r3(o.tabs,p)?o:{...o,tabs:p}});return a.every((o,c)=>o===e.workspaces[c])?e:{...e,workspaces:a}}function s3(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(x=>x.id===t);if(p<0)return _;const y=_.tabs[p];if(!y)return _;const b=Oo(y.root,n);if(!b){const x=_.tabs.filter((E,B)=>B!==p);return{..._,tabs:x}}const S={...y,root:b,activeTerminalId:Hs(b)[0]??y.activeTerminalId},C=_.tabs.slice();return C[p]=S,{..._,tabs:C}});const h=o==="left"||o==="right"?"vertical":"horizontal",f=o==="left"||o==="top";return c=c.map(_=>{const p=_.tabs.findIndex(E=>Hs(E.root).includes(a));if(p<0)return _;const y=_.tabs[p];if(!y)return _;const b={type:"pane",terminalId:n},S={type:"split",direction:h,ratio:.5,first:f?b:{type:"pane",terminalId:a},second:f?{type:"pane",terminalId:a}:b},C=Bo(y.root,a,S),x=_.tabs.slice();return x[p]={...y,root:C,activeTerminalId:n},{..._,tabs:x,activeTabId:y.id}}),g1({...e,workspaces:c})}function n3(e,t,n,a){let o=-1,c=-1;for(let B=0;B<e.workspaces.length;B+=1){const k=e.workspaces[B].tabs.findIndex(H=>H.id===t);if(k>=0){o=B,c=k;break}}if(o<0)return e;const h=e.workspaces[o],f=h.tabs[c],_=Hs(f.root);if(!_.includes(n))return e;if(_.length===1)return p1(e,t,a);const p=Oo(f.root,n);if(!p)return e;const y={...f,root:p,activeTerminalId:Hs(p)[0]??f.activeTerminalId},b=e.terminals[n],S={id:`tab-${Date.now().toString(36)}-${n.slice(0,8)}`,title:b?.title??"",activeTerminalId:n,root:{type:"pane",terminalId:n}},C=h.tabs.slice();C[c]=y;const x=Math.max(0,Math.min(C.length,a));C.splice(x,0,S);const E=e.workspaces.slice();return E[o]={...h,tabs:C,activeTabId:S.id},{...e,workspaces:E}}function r3(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 a3(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 l3(e,t){const n=e.workspaces.find(o=>o.tabs.some(c=>zo(c.root,t))),a=n?.tabs.find(o=>zo(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 o3(e,t,n){const a=sa(e),o=a?uh(a):void 0;if(!a||!o)return e;const c=ym(o.root,t,y1(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 fm(e,t,n,a){const o=Object.fromEntries(e.map(y=>[y.id,y])),c=new Set(e.map(y=>y.id)),h=new Set;let f=p3(t,n,c,h);f.length===0&&(f=[hh()]);const _=typeof a=="string"&&f.some(y=>y.id===a)?a:f[0]?.id??null,p=_??f[0]?.id??m_;for(const y of e){if(h.has(y.id))continue;const b=v1(y);f=m3(f,p,b),h.add(y.id)}return{workspaces:f.map(Vo),activeWorkspaceId:_,terminals:o}}function ch(e){return Hs(e.root)}function pm(e){return bm(e.root)}function c3(e){return e.tabs.flatMap(t=>Hs(t.root))}function Xf(e){const t=e.workspaces.map(n=>{const a=n.tabs.flatMap(o=>{const c=gm(o.root);return c?[{...o,root:c}]:[]});return Vo({...n,tabs:a})});return{activeWorkspaceId:t.some(n=>n.id===e.activeWorkspaceId)?e.activeWorkspaceId:t[0]?.id??null,workspaces:t}}function u3(e,t){return{...e,terminals:{...e.terminals,[t.id]:t},workspaces:e.workspaces.map(n=>({...n,tabs:n.tabs.map(a=>zo(a.root,t.id)?{...a,title:a.title||t.title}:a)}))}}function h3(e,t,n){const a=e.terminals[t];return a?{...e,terminals:{...e.terminals,[t]:{...a,status:"exited",exitCode:n}}}:e}function m1(e,t){const n={...e.terminals};return delete n[t],_1(e,t,n)}function d3(e,t){return e.terminals[t]?_1(e,t,{...e.terminals}):e}function _1(e,t,n){const a=e.workspaces.map(c=>{const h=[];for(const f of c.tabs){const _=Oo(f.root,t);if(!_)continue;const p=Hs(_),y=p.includes(f.activeTerminalId)?f.activeTerminalId:p[0];y&&h.push({...f,root:_,activeTerminalId:y})}return Vo({...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 f3(e,t){const n=e.workspaces.map(o=>{const c=[];for(const h of o.tabs){const f=mm(h.root,t);if(!f)continue;const _=Hs(f),p=_.includes(h.activeTerminalId)?h.activeTerminalId:_[0];p&&c.push({...h,root:f,activeTerminalId:p})}return Vo({...o,tabs:c})}),a=n.some(o=>o.id===e.activeWorkspaceId);return{...e,workspaces:n,activeWorkspaceId:a?e.activeWorkspaceId:n[0]?.id??null}}function p3(e,t,n,a){if(t&&t.length>0){const o=[];for(const c of t)_3(c)&&o.push(GS(c,n,a));if(o.length>0)return o}return[GS({...hh(),tabs:e??[]},n,a)]}function GS(e,t,n){const a=[];for(const o of e.tabs){if(!g3(o))continue;const c=_m(o.root,t);if(!c)continue;const h=Hs(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 Vo({...e,tabs:a})}function g1(e){return sa(e)?e:{...e,workspaces:[hh()],activeWorkspaceId:m_}}function sa(e){return e.workspaces.find(t=>t.id===e.activeWorkspaceId)??e.workspaces[0]}function uh(e){return e.tabs.find(t=>t.id===e.activeTabId)??e.tabs[0]}function hh(){return{id:m_,title:YN,tabs:[],activeTabId:null}}function Vo(e){const t=e.tabs.some(n=>n.id===e.activeTabId);return{...e,activeTabId:t?e.activeTabId:e.tabs[0]?.id??null}}function m3(e,t,n){return e.map(a=>a.id===t?{...a,tabs:[...a.tabs,n],activeTabId:a.activeTabId??n.id}:a)}function v1(e){return{id:`tab-${e.id}`,title:e.title||e.id,root:{type:"pane",terminalId:e.id},activeTerminalId:e.id}}function Bo(e,t,n){return e.type==="pane"?e.terminalId===t?n:e:e.type==="editor"?e:{...e,first:Bo(e.first,t,n),second:Bo(e.second,t,n)}}function Oo(e,t){if(e.type==="pane")return e.terminalId===t?null:e;if(e.type==="editor")return e;const n=Oo(e.first,t),a=Oo(e.second,t);return n&&a?{...e,first:n,second:a}:n??a}function mm(e,t){if(e.type==="editor")return e.editorId===t?null:e;if(e.type==="pane")return e;const n=mm(e.first,t),a=mm(e.second,t);return n&&a?{...e,first:n,second:a}:n??a}function _m(e,t){if(e.type==="pane")return t.has(e.terminalId)?e:null;if(e.type==="editor")return null;const n=_m(e.first,t),a=_m(e.second,t);return n&&a?{...e,ratio:y1(e.ratio),first:n,second:a}:n??a}function gm(e){if(e.type==="editor")return null;if(e.type==="pane")return e;const t=gm(e.first),n=gm(e.second);return t&&n?{...e,first:t,second:n}:t??n}function _3(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 g3(e){if(!e||typeof e!="object")return!1;const t=e;return typeof t.id=="string"&&typeof t.title=="string"&&typeof t.activeTerminalId=="string"&&vm(t.root)}function vm(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")&&vm(t.first)&&vm(t.second):!1}function ym(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=ym(e.first,o,n);return c===e.first?e:{...e,first:c}}if(a===1){const c=ym(e.second,o,n);return c===e.second?e:{...e,second:c}}return e}function y1(e){return Number.isFinite(e)?Math.min(.9,Math.max(.1,e)):.5}function zo(e,t){return e.type==="pane"?e.terminalId===t:e.type==="editor"?!1:zo(e.first,t)||zo(e.second,t)}function Hs(e){return e.type==="pane"?[e.terminalId]:e.type==="editor"?[]:[...Hs(e.first),...Hs(e.second)]}function bm(e){return e.type==="pane"||e.type==="editor"?1:bm(e.first)+bm(e.second)}const yr=new Map,jo=new Map,Ho=new Map;function al(e){return e??"__local__"}function v3(e){return{agentId:e,state:VN(),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 Qt(e){const t=al(e);let n=yr.get(t);return n||(n=v3(e),yr.set(t,n)),n}function b1(e,t){const n=al(e);let a=jo.get(n);return a||(a=new Set,jo.set(n,a)),a.add(t),()=>{a.delete(t)}}function y3(e){const t=al(e),n=jo.get(t);if(n)for(const a of Array.from(n))a()}function ll(e,t){yr.set(al(e),t),y3(e)}const Sm=new Set;function b3(e){return Sm.add(e),()=>{Sm.delete(e)}}function ao(e,t){const n=Qt(e),a=al(e);t.type==="workspace.hydrated"&&Ho.delete(a);const o=XN(n.state,t);let c=n.unreadCompletions,h=null;if(t.type==="terminal.updated"){const p=n.state.terminals[t.terminal.id],y=p?.activity==="busy",b=t.terminal.activity==="busy",S=t.terminal.activity==="idle",C=k3(a);if(t.notifyCompletion===!0&&b&&C.add(t.terminal.id),t.notifyCompletion===!0&&y&&S&&C.has(t.terminal.id)){const x=S3(o,t.terminal.id);x&&(h={terminalId:t.terminal.id,tabId:x.tab.id,commandName:p?.currentCommand??null},x.workspace.activeTabId!==x.tab.id&&(c.has(x.tab.id)||(c=new Set(c),c.add(x.tab.id))))}(S||t.terminal.status==="exited")&&C.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||_)&&ll(e,{...n,state:o,unreadCompletions:c}),_&&__(),h)for(const p of Array.from(Sm))p({agentId:e,...h})}function S3(e,t){for(const n of e.workspaces)for(const a of n.tabs)if(Hs(a.root).includes(t))return{workspace:n,tab:a};return null}const wm=new Set;function w3(e){return wm.add(e),()=>{wm.delete(e)}}function C3(){let e=0;for(const t of yr.values())e+=t.unreadCompletions.size;return e}function __(){for(const e of Array.from(wm))e()}function x3(e,t){const n=Qt(e);if(!n.unreadCompletions.has(t))return;const a=new Set(n.unreadCompletions);a.delete(t),ll(e,{...n,unreadCompletions:a}),__()}function ZS(e,t){const n=Qt(e);t!==n.state&&ll(e,{...n,state:t})}function QS(e,t){const n=Qt(e),a=t(n.editors);a!==n.editors&&ll(e,{...n,editors:a})}function Kr(e,t,n){const a=Qt(e);a.loaded===t&&a.error===n||ll(e,{...a,loaded:t,error:n})}function _u(e,t,n){const a=Qt(e);a.layoutRevision===t&&a.lastPersistedLayoutJson===n||ll(e,{...a,layoutRevision:t,lastPersistedLayoutJson:n})}function E3(e){const t=Qt(e);return t.mutable.editorIdCounter+=1,t.mutable.editorIdCounter}function T3(e){const t=al(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),jo.delete(t),Ho.delete(t),a&&__()}function Gf(){for(const e of yr.values()){const t=e.mutable.saveCoord.saveTimer;t!==null&&window.clearTimeout(t),e.unreadCompletions.size>0}yr.clear(),jo.clear(),Ho.clear()}function k3(e){let t=Ho.get(e);return t||(t=new Set,Ho.set(e,t)),t}function Cm(e,t){let n=!1,a=!1,o=null,c=!1;for(const h of ch(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 g_(e){return e?e.state==="busy"?e.commandName?`running: ${e.commandName}`:"running":e.state==="exited"?"exited":"idle":""}function xm(e,t){const n=t[e.activeTerminalId];return e.title||n?.title||e.activeTerminalId}function D3(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 R3({tabs:e,activeTabId:t,terminals:n,unreadCompletionTabIds:a,detachedTerminals:o,onSelectTab:c,onCreateTab:h,onToggleWorkspaces:f,onCloseTerminals:_,onReattachTerminal:p,onDeleteTerminal:y,onSplitVertical:b,onSplitHorizontal:S,onRenameTab:C,activePaneAvailable:x}){const[E,B]=v.useState(null),[k,H]=v.useState(!1),[U,X]=v.useState(null),ee=v.useRef(null),te=e.findIndex(j=>j.id===t),ne=te>=0?e[te]:e[0]??null,re=ne?Cm(ne,n):null,fe=ne?pm(ne):0,K=ne?xm(ne,n):"No tab";v.useEffect(()=>{ee.current?.focus(),ee.current?.select()},[E?.tabId]),v.useEffect(()=>{if(!k)return;const j=J=>{J.key==="Escape"&&H(!1)};return window.addEventListener("keydown",j),()=>window.removeEventListener("keydown",j)},[k]),v.useEffect(()=>{k&&e.length===0&&H(!1)},[k,e.length]);function A(j,J){B({tabId:j,title:J})}function I(){if(!E)return;const j=E.title.trim();j&&C(E.tabId,j),B(null)}function O(){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 - ${uT()}`,onClick:b,disabled:!x,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 - ${hT()}`,onClick:S,disabled:!x,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:K,onClick:()=>H(!0),disabled:e.length===0,children:[re?m.jsx("span",{className:"terminal-tab-status-dot","data-activity":re.state,"aria-hidden":"true",title:g_(re)}):null,m.jsx("span",{children:K}),m.jsxs("small",{children:[te>=0?te+1:0,"/",e.length||0,fe>1?` / ${fe}`:""]})]}),m.jsxs("div",{className:"terminal-tab-list",children:[e.map((j,J)=>{const T=ch(j),W=pm(j),F=xm(j,n),me=j.id===t,we=E?.tabId===j.id,R=Cm(j,n),G=a?.has(j.id)??!1;return m.jsxs(mi.Fragment,{children:[m.jsx(JS,{index:J}),m.jsx(M3,{tab:j,active:me,editing:we,title:F,paneCount:W,terminalIds:T,canClose:e.length>1,editValue:we?E.title:null,editInputRef:we?ee:null,activity:R,unread:G,onSelect:()=>c(j.id),onBeginRename:()=>A(j.id,F),onCloseAll:()=>_(T),onCommitRename:I,onCancelRename:()=>B(null),onRenameChange:ae=>B({tabId:j.id,title:ae})})]},j.id)}),m.jsx(JS,{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(j=>m.jsx(A3,{terminal:j,onReattach:()=>p?.(j.id),onDelete:()=>X(j)},j.id))}):null]}),m.jsx("button",{type:"button",className:"mobile-tab-add-button","aria-label":"Create new tab",title:"New tab",onClick:h,children:"+"}),x?O():null]}),k?m.jsx(N3,{tabs:e,activeTabId:t,terminals:n,unreadCompletionTabIds:a,detachedTerminals:o,editingTab:E,editInputRef:ee,onClose:()=>H(!1),onSelectTab:j=>{c(j),H(!1)},onCreateTab:()=>{h(),H(!1)},onBeginRename:A,onCloseTerminals:j=>{_(j),H(!1)},onCommitRename:I,onCancelRename:()=>B(null),onRenameChange:(j,J)=>B({tabId:j,title:J}),onReattachTerminal:j=>{p?.(j),H(!1)},onDeleteTerminal:j=>{X(j),H(!1)}}):null,U?m.jsx(L3,{terminal:U,onCancel:()=>X(null),onConfirm:()=>{y?.(U.id),X(null)}}):null]})}function M3({tab:e,active:t,editing:n,title:a,paneCount:o,canClose:c,editValue:h,editInputRef:f,activity:_,unread:p,onSelect:y,onBeginRename:b,onCloseAll:S,onCommitRename:C,onCancelRename:x,onRenameChange:E}){const{attributes:B,listeners:k,setNodeRef:H,transform:U,isDragging:X}=L0({id:`tab-${e.id}`,data:{kind:"tab",tabId:e.id,terminalId:e.activeTerminalId},disabled:n}),ee={transform:tp.Translate.toString(U),opacity:X?.4:void 0,zIndex:X?2:void 0};return m.jsxs("div",{ref:H,className:"terminal-tab","data-active":t,"data-dragging":X,"data-unread":p?"true":void 0,style:ee,...B,...k,children:[_?m.jsx("span",{className:"terminal-tab-status-dot","data-activity":_.state,"aria-hidden":"true",title:g_(_)}):null,n&&f&&h!==null?m.jsxs("form",{className:"terminal-tab-editor",onSubmit:te=>{te.preventDefault(),C()},children:[m.jsx("input",{ref:f,"aria-label":`Rename ${a}`,value:h,onBlur:C,onChange:te=>E(te.target.value),onKeyDown:te=>{if(te.key==="Enter"){te.preventDefault(),C();return}te.key==="Escape"&&(te.preventDefault(),x())}}),m.jsx("small",{children:o})]}):m.jsxs("button",{type:"button",className:"terminal-tab-select","aria-label":`Select ${a}`,title:a,onClick:y,onDoubleClick:te=>{te.preventDefault(),b()},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(),S()},children:"x"}):null]})}function N3({tabs:e,activeTabId:t,terminals:n,unreadCompletionTabIds:a,detachedTerminals:o,editingTab:c,editInputRef:h,onClose:f,onSelectTab:_,onCreateTab:p,onBeginRename:y,onCloseTerminals:b,onCommitRename:S,onCancelRename:C,onRenameChange:x,onReattachTerminal:E,onDeleteTerminal:B}){const k=v.useRef(null);return v.useEffect(()=>{k.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:H=>H.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((H,U)=>{const X=ch(H),ee=pm(H),te=xm(H,n),ne=H.id===t,re=c?.tabId===H.id,fe=Cm(H,n),K=a?.has(H.id)??!1;return m.jsxs("div",{ref:ne?k:null,className:"mobile-tab-sheet-row","data-active":ne,"data-unread":K?"true":void 0,children:[re&&c?m.jsx("form",{className:"mobile-tab-sheet-editor",onSubmit:A=>{A.preventDefault(),S()},children:m.jsx("input",{ref:h,"aria-label":`Rename ${te}`,value:c.title,onBlur:S,onChange:A=>x(H.id,A.target.value),onKeyDown:A=>{if(A.key==="Enter"){A.preventDefault(),S();return}A.key==="Escape"&&(A.preventDefault(),C())}})}):m.jsxs("button",{type:"button",className:"mobile-tab-sheet-select","aria-label":`Switch to ${te}`,onClick:()=>_(H.id),children:[m.jsx("span",{className:"mobile-tab-sheet-index",children:U+1}),m.jsxs("span",{className:"mobile-tab-sheet-copy",children:[m.jsx("strong",{children:te}),m.jsx("small",{children:D3(H,n,ee,fe)})]}),m.jsxs("span",{className:"mobile-tab-sheet-meta",children:[fe?m.jsx("span",{className:"terminal-tab-status-dot","data-activity":fe.state,"aria-hidden":"true",title:g_(fe)}):null,m.jsx("span",{children:ee})]})]}),m.jsxs("div",{className:"mobile-tab-sheet-actions",children:[re?m.jsx("button",{type:"button","aria-label":`Done renaming ${te}`,onClick:S,children:"Done"}):m.jsx("button",{type:"button","aria-label":`Rename ${te}`,onClick:()=>y(H.id,te),children:"Rename"}),e.length>1?m.jsx("button",{type:"button",className:"mobile-tab-sheet-close","aria-label":`Close ${te}`,onClick:()=>b(X),children:"×"}):null]})]},H.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(H=>{const U=H.title||H.cwd||H.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 ${U}`,onClick:()=>E(H.id),children:[m.jsx("span",{className:"mobile-tab-sheet-index",children:"+"}),m.jsxs("span",{className:"mobile-tab-sheet-copy",children:[m.jsx("strong",{children:U}),m.jsx("small",{children:H.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 ${U}`,onClick:()=>B(H),children:"×"})})]},H.id)})]}):null]})]})})}function JS({index:e}){const{setNodeRef:t,isOver:n}=B0({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 A3({terminal:e,onReattach:t,onDelete:n}){const a=e.title||e.cwd||e.id.slice(0,8),o=`${e.title||"Terminal"}
|
|
53
|
-
${e.cwd}
|
|
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 L3({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 B3({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-${U3(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?Tu(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(O3,{upload:_,compact:e.length>1,onDismiss:()=>t(_.id),onRetry:()=>a(_.id),onCancel:()=>o(_.id)},_.id))})]})}function O3({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":Tu(e),children:[m.jsxs("div",{className:"upload-queue-item-header",children:[m.jsx("strong",{children:Tu(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 ${Tu(e)}`,onClick:n,children:"x"})]})]}),e.status==="queued"?m.jsx("p",{children:e.message??"Queued"}):null,e.status==="uploading"?m.jsx(z3,{toast:e}):null,c&&"message"in e&&e.message?m.jsx("p",{className:"upload-toast-muted",children:e.message}):null,c?m.jsx(j3,{response:c,compact:t}):null,e.status==="failed"&&!c&&e.message?m.jsx("p",{children:e.message}):null]})}function z3({toast:e}){const t=e.percent===null?P3(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 j3({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(H3,{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 H3({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 Tu(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 U3(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 P3(e){return e<1024?`${e} B`:e<1024*1024?`${Math.round(e/1024)} KB`:`${Math.round(e/(1024*1024))} MB`}function I3({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 K3=go(0,0,1,1),Rn=1e-6;function F3(e){return S1(e).map(t=>t.terminalId)}function S1(e){return _o(e,K3).sort(Y3).map((t,n)=>({...t,index:n+1}))}function q3(e,t,n){const a=S1(e),o=a.find(h=>h.terminalId===t);return o?a.filter(h=>h.terminalId!==t).map(h=>$3(o,h,n)).filter(h=>h!==null).sort(V3)[0]?.entry.terminalId??null:null}function W3(e,t){return!Number.isInteger(t)||t<1?null:F3(e)[t-1]??null}function _o(e,t){if(e.type==="pane")return[{terminalId:e.terminalId,bounds:t}];if(e.type==="editor")return[];const n=X3(e.ratio);if(e.direction==="vertical"){const o=t.left+(t.right-t.left)*n;return[..._o(e.first,go(t.left,t.top,o,t.bottom)),..._o(e.second,go(o,t.top,t.right,t.bottom))]}const a=t.top+(t.bottom-t.top)*n;return[..._o(e.first,go(t.left,t.top,t.right,a)),..._o(e.second,go(t.left,a,t.right,t.bottom))]}function $3(e,t,n){const a=e.bounds,o=t.bounds,c=e0(a.left,a.right,o.left,o.right),h=e0(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 Y3(e,t){return Xa(e.bounds.top,t.bounds.top)||Xa(e.bounds.left,t.bounds.left)}function V3(e,t){return Xa(e.primaryDistance,t.primaryDistance)||Xa(e.perpendicularDistance,t.perpendicularDistance)||Xa(t.overlap,e.overlap)||Xa(e.entry.index,t.entry.index)}function Xa(e,t){const n=e-t;return Math.abs(n)<=Rn?0:n}function e0(e,t,n,a){return Math.max(0,Math.min(t,a)-Math.max(e,n))}function go(e,t,n,a){return{left:e,top:t,right:n,bottom:a,centerX:e+(n-e)/2,centerY:t+(a-t)/2}}function X3(e){return Number.isFinite(e)?Math.min(.9,Math.max(.1,e)):.5}class G3 extends Error{constructor(t){super(t),this.name="UploadDropError"}}function t0(e){return e?Array.from(e.types??[]).includes("Files")||E1(e.items).some(n=>n.kind==="file")?!0:T1(e.files).length>0:!1}async function Z3(e){const t=E1(e.items).filter(n=>n.kind==="file");return t.length>0?Q3(t):J3(e.files)}async function Q3(e){const t=[];for(const n of e){const a=sA(n);if(a){await w1(a,"",t);continue}const o=n.getAsFile();if(o){t.push({relativePath:C1(o),file:o});continue}throw new G3("Folder upload is not supported by this browser.")}return t}function J3(e){return T1(e).map(t=>({relativePath:C1(t),file:t}))}async function w1(e,t,n){const a=rA(t,e.name);if(e.isFile){const h=await eA(e);n.push({relativePath:a,file:h});return}if(!e.isDirectory)return;const o=e.createReader(),c=await tA(o);for(const h of c)await w1(h,a,n)}function eA(e){return new Promise((t,n)=>{e.file(t,a=>n(a))})}async function tA(e){const t=[];for(;;){const n=await iA(e);if(n.length===0)return t;t.push(...n)}}function iA(e){return new Promise((t,n)=>{e.readEntries(t,a=>n(a))})}function C1(e){const t=e.webkitRelativePath;return x1(typeof t=="string"&&t?t:e.name)}function sA(e){const t=e.webkitGetAsEntry?.();return nA(t)?t:null}function nA(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 rA(e,t){return x1(e?`${e}/${t}`:t)}function x1(e){return e.replace(/\\/g,"/").replace(/^\/+/,"").split("/").filter(Boolean).join("/")}function E1(e){return e?Array.from(e):[]}function T1(e){return e?Array.from(e):[]}const i0="nterminal.terminalWorkspaces.v2",k1="nterminal.sidebarCollapsed.v1",aA=75,s0=z0.map(e=>e.url),lA=z0[0].url;function oA({api:e,serverApi:t,activeAgentId:n=null,onSelectServer:a,sessionExpiresAt:o=null,onLogout:c=async()=>{},onSessionInvalid:h}){const f=v.useMemo(()=>e??Yu(),[e]),_=v.useMemo(()=>t??To(null),[t]),p=v.useMemo(()=>SA(n),[n]),y=v.useMemo(()=>D=>b1(n,D),[n]),b=v.useMemo(()=>()=>Qt(n),[n]),S=v.useSyncExternalStore(y,b,b),C=S.state,x=S.editors,E=!S.loaded,B=S.error,[k,H]=v.useState(!1),[U,X]=v.useState(()=>TA()),[ee,te]=v.useState("servers"),[ne,re]=v.useState(!1),fe=v.useSyncExternalStore(ST,Mb,Mb);v.useSyncExternalStore(Xm,Rb,Rb);const[K,A]=v.useState(0),[I,O]=v.useState(()=>[null]),[j,J]=v.useState(0),[T,W]=v.useState(()=>[n]),[F,me]=v.useState(()=>new Set),[we,R]=v.useState({}),[G,ae]=v.useState(null),de=v.useRef(null);v.useRef(!1);const ge=v.useRef(0),[ye,xe]=v.useState(null),Fe=c2(cb(D0,{activationConstraint:{distance:8}}),cb(R0,{activationConstraint:{delay:250,tolerance:5}}));v.useEffect(()=>wT(f),[f]);function he(D){const z=D.active.data.current;if(z){if(z.kind==="tab"&&typeof z.tabId=="string"&&typeof z.terminalId=="string"){xe({tabId:z.tabId,terminalId:z.terminalId});return}z.kind==="pane"&&typeof z.sourceTabId=="string"&&typeof z.terminalId=="string"&&xe({tabId:z.sourceTabId,terminalId:z.terminalId})}}function ve(D){xe(null);const z=D.active.data.current,Q=D.over?.data.current;if(!(!z||!Q||typeof z.terminalId!="string")){if(z.kind==="tab"&&typeof z.tabId=="string"){if(Q.kind==="tab-position"&&typeof Q.index=="number"){ot({type:"tab.reordered",sourceTabId:z.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")&&ot({type:"tab.dropped_into_pane",sourceTabId:z.tabId,sourceTerminalId:z.terminalId,targetTerminalId:Q.terminalId,side:Q.side});return}if(z.kind==="pane"&&typeof z.sourceTabId=="string"){if(Q.kind==="tab-position"&&typeof Q.index=="number"){ot({type:"terminal.extracted_to_tab",sourceTabId:z.sourceTabId,sourceTerminalId:z.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")&&ot({type:"tab.dropped_into_pane",sourceTabId:z.sourceTabId,sourceTerminalId:z.terminalId,targetTerminalId:Q.terminalId,side:Q.side})}}}function ze(){xe(null)}const Re=C.workspaces.find(D=>D.id===C.activeWorkspaceId)??C.workspaces[0],Ee=Re?.tabs.find(D=>D.id===Re.activeTabId)??Re?.tabs[0],ie=Ee?.activeTerminalId??null,Me=ie?C.terminals[ie]:void 0,Ce=vA("(max-width: 760px)"),je=v.useMemo(()=>Ee?Wu(Ee.root):[],[Ee]),qe=Re&&Ee?Du(n,Re.id,Ee.id):null,Ct=Ee?D1(je,Ee.activeTerminalId,qe?we[qe]:void 0):null,ft=Ce&&je.length>1,$t=v.useMemo(()=>{const D=new Set;for(const z of C.workspaces)for(const Q of z.tabs)for(const pe of ch(Q))D.add(pe);return Object.values(C.terminals).filter(z=>!D.has(z.id))},[C.terminals,C.workspaces]),[Hi,$s]=v.useState([]),rt=v.useRef([]),li=v.useRef(null),[Zi,gi]=v.useState(null),[zt,Ui]=v.useState([]),[vi,$]=v.useState(()=>Zr()),He=v.useRef(0),Qe=v.useRef(n),lt=v.useRef(s0),Jt=v.useRef(vi),jt=v.useRef(()=>{});jt.current=Pt;const oi=v.useCallback(async()=>{try{const D=await f.listNotificationAssets();Ui(D.assets.filter(z=>z.enabled).map(z=>z.url))}catch{Ui([])}},[f]);v.useEffect(()=>{W(D=>D.some(z=>kn(z,n))?D:[...D,n])},[n]);const Fi=v.useCallback(D=>{const z=Qt(D),Q=To(D);for(const pe of Object.keys(z.state.terminals))lm(Q.createWebSocketUrl(pe)),OS(pe);T3(D),W(pe=>pe.filter(be=>!kn(be,D))),me(pe=>{const be=`${ku(D)}:`;let Le=!1;const Ne=new Set;for(const pt of pe){if(pt.startsWith(be)){Le=!0;continue}Ne.add(pt)}return Le?Ne:pe}),R(pe=>{const be=`${ku(D)}:`;let Le=!1;const Ne={};for(const[pt,mt]of Object.entries(pe)){if(pt.startsWith(be)){Le=!0;continue}Ne[pt]=mt}return Le?Ne:pe})},[]);v.useEffect(()=>{let D=!1;return f.listAgents().then(z=>{if(!D){const Q=z.agents.map(be=>be.id),pe=[null,...Q];n!==null&&!Q.includes(n)&&(Fi(n),a?.(null)),O(pe)}}).catch(()=>{}),()=>{D=!0}},[n,f,Fi,a,j]);const an=v.useCallback(D=>{Fi(D),J(z=>z+1),kn(D,Qe.current)&&a?.(null)},[Fi,a]);v.useEffect(()=>{O(D=>D.some(z=>kn(z,n))?D:[...D,n])},[n]),v.useEffect(()=>{Qe.current=n},[n]),v.useEffect(()=>{oi()},[oi]),v.useEffect(()=>F0(()=>$(Zr())),[]),v.useEffect(()=>{const D=z=>{jt.current(z)};return window.addEventListener("keydown",D,!0),()=>window.removeEventListener("keydown",D,!0)},[]),v.useEffect(()=>{lt.current=zt.length>0?zt:s0},[zt]),v.useEffect(()=>{Jt.current=vi},[vi]),v.useEffect(()=>{if(!S.loaded||!Re||!Ee)return;const D=Du(n,Re.id,Ee.id);me(z=>{if(z.has(D))return z;const Q=new Set(z);return Q.add(D),Q})},[n,S.loaded,Re?.id,Ee?.id]),v.useEffect(()=>()=>{ol()},[]),v.useEffect(()=>b3(D=>{const z=Qt(D.agentId).state,Q=z.workspaces.flatMap(Ne=>Ne.tabs).find(Ne=>Ne.id===D.tabId),pe=z.terminals[D.terminalId],be=Q?.title?.trim()||pe?.title||D.commandName||"terminal",Le=document.visibilityState==="visible"&&kn(D.agentId,Qe.current)&&D.tabId===bA(z);if(Le||tT({tabTitle:be,commandName:D.commandName,terminalId:D.terminalId}),!Le&&document.visibilityState==="visible"&&Jt.current.enabled){const Ne=He.current+1;He.current=Ne;const pt=lt.current;gi({id:Ne,agentId:D.agentId,terminalId:D.terminalId,tabId:D.tabId,tabTitle:be,commandName:D.commandName,assetSrc:pt[Math.floor(Math.random()*pt.length)]??lA})}}),[]),v.useEffect(()=>{if(!Zi||vi.persistUntilDismissed)return;const D=window.setTimeout(()=>{gi(z=>z?.id===Zi.id?null:z)},vi.durationSeconds*1e3);return()=>window.clearTimeout(D)},[Zi,vi]),v.useEffect(()=>{de.current?.focus(),de.current?.select()},[G?.workspaceId]),v.useEffect(()=>{kA(U),U&&ae(null)},[U]),v.useEffect(()=>{let D=!1;async function z(){if(!Qt(n).loaded){Kr(n,!1,null);try{const pe=wA(p),[be,Le]=await Promise.all([_.listTerminals(),_.getTerminalLayout()]),Ne=be.terminals.length>0?be.terminals:[(await _.createTerminal({cols:80,rows:24})).terminal];if(!D){const pt=Le.layout?M1(Le.layout):null,mt=pt??pe??{},N=fm(Ne,void 0,mt.savedWorkspaces,mt.savedActiveWorkspaceId),ue=Xf(N);ZS(n,N),_u(n,Le.revision,JSON.stringify(ue)),Kr(n,!0,null),!pt&&pe&&on(ue,{baseRevision:Le.revision})}}catch(pe){!D&&!Ai(pe)&&Kr(n,!0,oo(pe))}}}return z(),()=>{D=!0}},[n,_,K]);function ls(){Kr(n,!1,null),A(D=>D+1)}async function Ss(){await Vt(async()=>{const D=await _.createTerminal({cols:80,rows:24});ot({type:"terminal.created",terminal:D.terminal})})}async function bt(D){await Vt(async()=>{const z=ie?{parentTerminalId:ie,cols:80,rows:24}:{cols:80,rows:24},Q=await _.createTerminal(z);ot({type:"terminal.split",terminal:Q.terminal,direction:D})})}async function xt(D){if(!ie)throw new Error("No active pane is available.");const z=await _.readFile(D),Q=`editor-${Date.now().toString(36)}-${E3(n)}`,pe=EA(z.path);QS(n,be=>({...be,[Q]:{id:Q,title:pe,rootToken:D.rootToken,path:z.path,read:z}})),qe&&R(be=>({...be,[qe]:R1(Q)})),ot({type:"editor.split",editorId:Q,title:pe,direction:"vertical"})}function Ht(D){QS(n,z=>{const Q={...z};return delete Q[D],Q}),ot({type:"editor.closed",editorId:D})}function ci(D){Yt([D])}function Yt(D){for(const z of D)ot({type:"terminal.detached",terminalId:z})}async function ei(D){await Vt(async()=>{await Et(D),lm(_.createWebSocketUrl(D)),OS(D),ot({type:"terminal.closed",terminalId:D})})}async function ui(D,z){const Q=z.trim();if(!Q)return;let pe=null;for(const be of C.workspaces){const Le=be.tabs.find(Ne=>Ne.id===D);if(Le){pe=Le.activeTerminalId;break}}if(ot({type:"tab.renamed",tabId:D,title:Q}),!!pe)try{const be=await _.renameTerminal(pe,Q);Pi({type:"terminal.updated",terminal:be.terminal})}catch(be){Kr(n,!0,oo(be))}}function Ni(D){const z=C.terminals[D];z&&ot({type:"terminal.created",terminal:z})}async function Et(D){try{await _.closeTerminal(D)}catch(z){if(z instanceof Nn&&z.status===404)return;throw z}}async function qi(){await Vt(async()=>{await c()})}async function Vt(D){Kr(n,!0,null);try{await D()}catch(z){if(Ai(z))return;Kr(n,!0,oo(z))}}function Ai(D){return D instanceof Nn&&D.status===401&&!_.isAgent&&h?(h({source:"workspace-api-401",status:401,activeAgentId:n}),!0):!1}function ot(D){ao(n,D);const z=Qt(n),Q=z.state;if(!z.loaded||Q.workspaces.length===0)return;const pe=Xf(Q);JSON.stringify(pe)!==z.lastPersistedLayoutJson&&Cs(pe)}function Pi(D){ao(n,D)}function yi(D,z,Q,pe){const be=Du(D,z,Q);R(Le=>({...Le,[be]:pe}))}function ut(D){qe&&R(z=>({...z,[qe]:D}))}function bi(D,z){const Q=$u(D);z?yi(n,z.workspaceId,z.tabId,Q):ut(Q),ot({type:"pane.selected",terminalId:D})}function Ut(D){ut(D.key),D.type==="terminal"&&ot({type:"pane.selected",terminalId:D.terminalId})}function Pt(D){if(ne||D.isComposing||D.key==="Process"||pA(D.target))return;const z=uA(D);if(!z)return;if(D.preventDefault(),D.stopPropagation(),z.type==="server.previous"||z.type==="server.next"){Rt(z.type==="server.next"?1:-1);return}const Q=Qt(n).state,pe=Q.workspaces.find(Ne=>Ne.id===Q.activeWorkspaceId)??Q.workspaces[0],be=pe?.tabs.find(Ne=>Ne.id===pe.activeTabId)??pe?.tabs[0];if(z.type==="split"){if(!be)return;bt(z.direction);return}if(!pe||!be)return;if(z.type==="tab.previous"||z.type==="tab.next"){const Ne=fA(pe.tabs,be.id,z.type==="tab.next"?1:-1);Ne&&ot({type:"tab.selected",tabId:Ne.id});return}if(z.type==="tab.index"){const Ne=pe.tabs[z.index-1];Ne&&ot({type:"tab.selected",tabId:Ne.id});return}const Le=hA(be.root,be.activeTerminalId,z);Le&&bi(Le,{workspaceId:pe.id,tabId:be.id})}function Rt(D){if(!a||I.length===0)return;const z=I.findIndex(Le=>kn(Le,n)),pe=((z===-1?0:z)+D+I.length)%I.length,be=I[pe]??null;kn(be,n)||a(be)}function br(D){t0(D.dataTransfer)&&(D.preventDefault(),D.dataTransfer.dropEffect="copy")}function na(D){if(!t0(D.dataTransfer))return;D.preventDefault();const z=CA(Qt(n).state),Q=ge.current+1;if(ge.current=Q,!z){ln({id:Q,status:"failed",fileCount:0,message:"No active running terminal is available for upload."});return}ln({id:Q,status:"queued",fileCount:0,terminalId:z.id,message:"Preparing upload..."}),ra(Q,z.id,D.dataTransfer)}async function ra(D,z,Q){try{const pe=await Z3(Q);if(pe.length===0)throw new Error("No files were found in the drop.");At(D,{id:D,status:"queued",fileCount:pe.length,message:"Queued"},{terminalId:z,files:pe})}catch(pe){At(D,{id:D,status:"failed",fileCount:0,message:oo(pe)},{terminalId:z})}finally{ws()}}async function Sr(D){const z=rt.current.find(Le=>Le.id===D);if(!z?.terminalId||!z.files||z.files.length===0)return;const Q=z.terminalId,pe=z.files,be=new AbortController;li.current=D,At(D,{id:D,status:"uploading",fileCount:pe.length,loaded:0,total:null,percent:null},{terminalId:Q,files:pe,abortController:be});try{const Le=await zT({terminalId:Q,files:pe,signal:be.signal,onProgress:N=>{At(D,{id:D,status:"uploading",fileCount:pe.length,loaded:N.loaded,total:N.total,percent:N.percent},{terminalId:Q,files:pe,abortController:be})}}),Ne=Le.failed>0?Le.uploaded>0?"partial":"failed":"success",pt=Le.failed>0?xA(Le):void 0,mt={id:D,status:Ne,fileCount:pe.length,response:Le};pt&&(mt.message=pt),At(D,mt,{terminalId:Q,files:pe})}catch(Le){At(D,{id:D,status:"failed",fileCount:pe.length,message:be.signal.aborted?"Upload canceled.":oo(Le)},{terminalId:Q,files:pe})}finally{li.current===D&&(li.current=null),ws()}}function ws(){if(li.current!==null)return;const D=rt.current.find(z=>z.status==="queued");D?.terminalId&&D.files&&D.files.length>0&&Sr(D.id)}function ln(D){Wi(z=>[...z,D])}function At(D,z,Q={}){Wi(pe=>pe.map(be=>{if(be.id!==D)return be;const Le={...z},Ne=Q.terminalId??be.terminalId,pt=Q.files??be.files;return Ne!==void 0&&(Le.terminalId=Ne),pt!==void 0&&(Le.files=pt),Q.abortController!==void 0&&(Le.abortController=Q.abortController),Le}))}function Wi(D){const z=D(rt.current);rt.current=z,$s(z)}function Ys(D){rt.current.find(Q=>Q.id===D)?.abortController?.abort(),li.current===D&&(li.current=null),Wi(Q=>Q.filter(pe=>pe.id!==D)),ws()}function Us(){for(const D of rt.current)D.abortController?.abort();li.current=null,Wi(()=>[])}function It(D){const z=rt.current.find(Q=>Q.id===D);if(z){if(z.status==="queued"){Ys(D);return}z.abortController?.abort()}}function wr(D){const z=rt.current.find(pe=>pe.id===D);if(!z?.terminalId||!z.files||z.files.length===0)return;const Q=On(z);if(Q.length===0){At(D,{id:D,status:"failed",fileCount:z.fileCount,message:"No failed files are available to retry."},{terminalId:z.terminalId,files:z.files});return}At(D,{id:D,status:"queued",fileCount:Q.length,message:"Queued"},{terminalId:z.terminalId,files:Q}),ws()}function On(D){const z=D.files??[],Q="response"in D?D.response:void 0;if(!Q)return z;const pe=Q.results.filter(Ne=>Ne.status==="failed").map(Ne=>Ne.relativePath);if(pe.length===0)return[];const be=new Map;for(const Ne of z){const pt=be.get(Ne.relativePath)??[];pt.push(Ne),be.set(Ne.relativePath,pt)}const Le=[];for(const Ne of pe){const mt=be.get(Ne)?.shift();mt&&Le.push(mt)}return Le}function os(D){const Q=Qt(D.agentId).state.workspaces.find(pe=>pe.tabs.some(be=>be.id===D.tabId));Q&&yi(D.agentId,Q.id,D.tabId,$u(D.terminalId)),ao(D.agentId,{type:"pane.selected",terminalId:D.terminalId}),x3(D.agentId,D.tabId),kn(D.agentId,n)||a?.(D.agentId),gi(null)}function Cs(D){const z=Qt(n).mutable.saveCoord;z.pendingLayoutSave=D,lo(D,p),z.saveTimer!==null&&window.clearTimeout(z.saveTimer),z.saveTimer=window.setTimeout(()=>{z.saveTimer=null;const Q=z.pendingLayoutSave;z.pendingLayoutSave=null,Q&&on(Q)},aA)}function ol(){const D=Qt(n).mutable.saveCoord;D.saveTimer!==null&&(window.clearTimeout(D.saveTimer),D.saveTimer=null);const z=D.pendingLayoutSave;D.pendingLayoutSave=null,z&&(lo(z,p),on(z))}function on(D,z={}){const Q=Qt(n).mutable.saveCoord;Q.nextPersistLayout=D,z.baseRevision!==void 0&&(Q.queuedBaseRevision=z.baseRevision),!Q.nextPersistQueued&&(Q.nextPersistQueued=!0,Q.persistChain=Q.persistChain.then(async()=>{Q.nextPersistQueued=!1;const pe=Q.nextPersistLayout,be=Q.queuedBaseRevision;Q.nextPersistLayout=null,Q.queuedBaseRevision=void 0,pe&&await aa(pe,be!==void 0?{baseRevision:be}:{})}))}async function aa(D,z={}){const Q=Qt(n),pe=z.baseRevision??Q.layoutRevision,be={layout:D,...typeof pe=="number"?{baseRevision:pe}:{}};try{const Le=await _.saveTerminalLayout(be),Ne=Le.layout??D;_u(n,Le.revision,JSON.stringify(Ne)),lo(Ne,p);return}catch(Le){if(Le instanceof Nn&&Le.status===409)try{const Ne=await _.getTerminalLayout();if(Ne.layout){const pt=Qt(n).state,mt=fm(Object.values(pt.terminals),void 0,Ne.layout.workspaces,Ne.layout.activeWorkspaceId),N=Xf(mt);ZS(n,mt),_u(n,Ne.revision,JSON.stringify(N)),lo(N,p)}else _u(n,Ne.revision,Q.lastPersistedLayoutJson);return}catch{}lo(D,p)}}const la=DA(o),$i=!U||k,Ps=$i?ee:"servers";return m.jsx(cE,{sensors:Fe,onDragStart:he,onDragEnd:ve,onDragCancel:ze,children:m.jsxs("main",{className:"terminal-shell","data-collapsed":U,"data-sidebar-open":k,onDragOver:br,onDrop:na,children:[m.jsx("button",{type:"button",className:"workspace-backdrop","aria-label":"Close workspaces",onClick:()=>H(!1)}),m.jsxs("aside",{className:"workspace-sidebar",children:[m.jsxs("header",{className:"workspace-brand",children:[$i?m.jsx(f0,{height:20}):m.jsx(d0,{size:24}),m.jsx("button",{type:"button",className:"sidebar-collapse-button","aria-label":U?"Expand sidebar":"Collapse sidebar",title:U?"Expand sidebar":"Collapse sidebar",onClick:()=>X(D=>!D),children:U?">":"<"}),m.jsx("button",{type:"button",className:"sidebar-drawer-close-button","aria-label":"Close workspaces",title:"Close workspaces",onClick:()=>H(!1),children:"x"})]}),m.jsxs("div",{className:`workspace-sidebar-content workspace-sidebar-content--${Ps==="files"?"files":"servers"}`,children:[$i?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"),ae(null)},children:"Servers"}),m.jsx("button",{type:"button",role:"tab","aria-selected":ee==="files",onClick:()=>{te("files"),ae(null)},children:"Files"})]}):null,Ps==="servers"&&$i?m.jsx("nav",{className:"workspace-nav","aria-label":"Servers",children:m.jsx(Ef,{api:f,activeAgentId:n,onSelectServer:a??(()=>{}),onSessionInvalid:h,refreshToken:j})}):null,$i?null:m.jsx("nav",{className:"workspace-nav workspace-nav--collapsed","aria-label":"Servers",children:m.jsx(Ef,{api:f,activeAgentId:n,onSelectServer:a??(()=>{}),onSessionInvalid:h,refreshToken:j,compact:!0})}),Ps==="files"?m.jsxs(m.Fragment,{children:[$i?m.jsx("nav",{className:"workspace-nav workspace-nav--compact","aria-label":"Servers",children:m.jsx(Ef,{api:f,activeAgentId:n,onSelectServer:a??(()=>{}),onSessionInvalid:h,refreshToken:j})}):null,m.jsx(IT,{api:_,activeTerminalId:ie,activeTerminalCwd:Me?.cwd??null,onOpenFile:xt})]}):null]}),m.jsxs("div",{className:"workspace-sidebar-footer",children:[$i?m.jsx("span",{children:la}):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:()=>re(!0),children:[m.jsx(r0,{name:"settings"}),fe.hasUpdates?m.jsx("span",{className:"update-pulse-dot","aria-hidden":"true"}):null]}),$i?m.jsx("button",{type:"button",className:"workspace-footer-icon-button","aria-label":"logout",title:"Logout",onClick:()=>{qi()},children:m.jsx(r0,{name:"logout"})}):null]})]})]}),ne?m.jsx(NT,{api:f,onClose:()=>re(!1),updateAvailable:fe.hasUpdates,onNotificationAssetsChanged:()=>{oi()},onAgentRemoved:an}):null,m.jsxs("section",{className:"terminal-main","aria-label":"Terminal workspace","data-mobile-pane-switcher":ft?"true":void 0,children:[m.jsx(R3,{tabs:Re?.tabs??[],activeTabId:Re?.activeTabId??null,terminals:C.terminals,unreadCompletionTabIds:S.unreadCompletions,detachedTerminals:$t,onSelectTab:D=>ot({type:"tab.selected",tabId:D}),onCreateTab:()=>{Ss()},onToggleWorkspaces:()=>H(D=>!D),onCloseTerminals:D=>Yt(D),onReattachTerminal:D=>Ni(D),onDeleteTerminal:D=>{ei(D)},onSplitVertical:()=>{bt("vertical")},onSplitHorizontal:()=>{bt("horizontal")},onRenameTab:(D,z)=>{ui(D,z)},activePaneAvailable:!!ie}),ft?m.jsx(_A,{targets:je,activeLeafKey:Ct,terminals:C.terminals,editors:x,onSelect:Ut}):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:ls,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&&!Ee?m.jsx(mA,{onCreate:()=>{Ss()}}):null,T.map(D=>{const z=kn(D,n);return m.jsx(cA,{agentId:D,active:z,activeServerApi:z?_:void 0,visitedTabKeys:F,refreshCwdOnEnter:z&&Ps==="files",draggingTab:z?ye:null,mobileSplitFocus:Ce,mobileFocusedLeafByTabKey:we,onSelect:Q=>{z&&bi(Q)},onClose:Q=>{z&&ci(Q)},onCloseEditor:Q=>{z&&Ht(Q)},onResize:(Q,pe)=>{z&&ot({type:"pane.resized",path:Q,ratio:pe})},onExit:(Q,pe)=>{z?Pi({type:"terminal.exited",terminalId:Q,exitCode:pe}):ao(D,{type:"terminal.exited",terminalId:Q,exitCode:pe})},onSnapshot:(Q,pe)=>{const be={type:"terminal.updated",terminal:Q,notifyCompletion:pe?.notifyCompletion===!0};z?Pi(be):ao(D,be)},...D===null&&h?{onAuthClose:Q=>h({...Q,source:Q?.source??"terminal-ws-1008",activeAgentId:D})}:{}},ku(D))})]}),m.jsx(I3,{toast:Zi,onActivate:os,onDismiss:()=>gi(null)}),m.jsx(B3,{uploads:Hi,onDismiss:Ys,onDismissAll:Us,onRetry:wr,onCancel:It})]})]})})}function cA({agentId:e,active:t,activeServerApi:n,visitedTabKeys:a,refreshCwdOnEnter:o,draggingTab:c,mobileSplitFocus:h,mobileFocusedLeafByTabKey:f,onSelect:_,onClose:p,onCloseEditor:y,onResize:b,onExit:S,onSnapshot:C,onAuthClose:x}){const E=v.useMemo(()=>fe=>b1(e,fe),[e]),B=v.useMemo(()=>()=>Qt(e),[e]),k=v.useSyncExternalStore(E,B,B),H=v.useMemo(()=>To(e),[e]),U=n??H,X=k.state,ee=X.workspaces.find(fe=>fe.id===X.activeWorkspaceId)??X.workspaces[0],te=ee?.id??null,re=(ee?.tabs.find(fe=>fe.id===ee.activeTabId)??ee?.tabs[0])?.id??null;return!k.loaded||X.workspaces.length===0?null:m.jsx("div",{className:"workspace-server-surface","data-active":t,"aria-hidden":!t,children:X.workspaces.flatMap(fe=>fe.tabs.map(K=>{const A=t&&fe.id===te&&K.id===re,I=Du(e,fe.id,K.id),O=Wu(K.root),j=h&&O.length>1?D1(O,K.activeTerminalId,f[I]):null;return!A&&!a.has(I)?null:m.jsx("div",{className:"workspace-tab-surface","data-active":A,"aria-hidden":!A,children:m.jsx(um,{node:K.root,terminals:X.terminals,editors:k.editors,api:U,activeTerminalId:K.activeTerminalId,visible:A,refreshCwdOnEnter:A&&o,tabId:K.id,dropZoneActive:A&&c!==null,draggingTerminalId:A?c?.terminalId??null:null,mobileFocusLeafKey:j,onSelect:_,onClose:p,onCloseEditor:y,onResize:b,onExit:S,onSnapshot:C,...x?{onAuthClose:x}:{}})},`${fe.id}:${K.id}`)}))})}function uA(e){const t=Z0(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=dA(e.key);return n?{type:"pane.direction",direction:n}:null}return null}function hA(e,t,n){switch(n.type){case"pane.direction":return q3(e,t,n.direction);case"pane.index":return W3(e,n.index);default:return null}}function dA(e){switch(e){case"ArrowLeft":return"left";case"ArrowRight":return"right";case"ArrowUp":return"up";case"ArrowDown":return"down";default:return null}}function fA(e,t,n){if(e.length===0)return null;const a=e.findIndex(c=>c.id===t);return e[((a===-1?0:a)+n+e.length)%e.length]??null}function Wu(e){return e.type==="pane"?[{key:$u(e.terminalId),type:"terminal",terminalId:e.terminalId}]:e.type==="editor"?[{key:R1(e.editorId),type:"editor",editorId:e.editorId,title:e.title}]:[...Wu(e.first),...Wu(e.second)]}function D1(e,t,n){if(n&&e.some(o=>o.key===n))return n;const a=t?$u(t):null;return a&&e.some(o=>o.key===a)?a:e[0]?.key??null}function $u(e){return`terminal:${e}`}function R1(e){return`editor:${e}`}function pA(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 mA({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 _A({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(S=>S.key===t):-1,_=f>=0?f:0,p=e[_]??e[0],y=n0(p,n,a);function b(S){const C=(_+S+e.length)%e.length,x=e[C];x&&o(x)}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:()=>b(-1),children:"<"}),m.jsxs("button",{type:"button",className:"mobile-pane-current","aria-label":"Open pane switcher","aria-haspopup":"dialog","aria-expanded":c,title:y,onClick:()=>h(!0),children:["Pane ",_+1,"/",e.length," | ",y]}),m.jsx("button",{type:"button","aria-label":"Next pane",onClick:()=>b(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:S=>S.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((S,C)=>{const x=n0(S,n,a),E=gA(S,n,a),B=S.key===p.key;return m.jsxs("button",{type:"button","data-active":B,onClick:()=>{o(S),h(!1)},children:[m.jsx("span",{className:"mobile-pane-sheet-index",children:C+1}),m.jsxs("span",{className:"mobile-pane-sheet-copy",children:[m.jsx("strong",{children:x}),m.jsx("small",{children:E})]}),m.jsx("span",{className:"mobile-pane-sheet-type",children:S.type})]},S.key)})})]})}):null]})}function n0(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 gA(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 vA(e){const[t,n]=v.useState(()=>yA(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 yA(e){return typeof window>"u"||typeof window.matchMedia!="function"?!1:window.matchMedia(e).matches}function kn(e,t){return e===t}function bA(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 ku(e){return e??"__local__"}function Du(e,t,n){return`${ku(e)}:${t}:${n}`}function SA(e){return e?{workspaceKey:`${i0}:${e}`}:{workspaceKey:i0}}function wA(e){const t=localStorage.getItem(e.workspaceKey);if(!t)return null;try{const n=JSON.parse(t),a=O0(n);return a?M1(a):null}catch{return null}}function M1(e){const t=O0(e);return t?{savedWorkspaces:t.workspaces,savedActiveWorkspaceId:t.activeWorkspaceId}:null}function lo(e,t){if(e.workspaces.length>0){localStorage.setItem(t.workspaceKey,JSON.stringify(e));return}localStorage.removeItem(t.workspaceKey)}function CA(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 xA(e){return e.results.find(t=>t.status==="failed"&&t.error)?.error}function EA(e){return e.split("/").filter(Boolean).pop()??e}function TA(){try{return localStorage.getItem(k1)==="true"}catch{return!1}}function kA(e){try{localStorage.setItem(k1,e?"true":"false")}catch{}}function DA(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 r0({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 oo(e){return e instanceof Error?e.message:"Request failed"}function RA({api:e,onDone:t}){const[n,a]=v.useState(null),[o,c]=v.useState(null),[h,f]=v.useState(""),[_,p]=v.useState(!1),[y,b]=v.useState(null),[S,C]=v.useState(null);v.useEffect(()=>{let E=!1;return e.setupTotp().then(B=>{E||(a(B.qrDataUrl),c(B.secret))}).catch(B=>{E||C(B instanceof Error?B.message:"Failed to generate QR code")}),()=>{E=!0}},[e]);async function x(E){if(E.preventDefault(),!!o){p(!0),b(null);try{await e.activateTotp({secret:o,otp:h}),t()}catch(B){b(B instanceof Error?B.message:"Verification failed")}finally{p(!1)}}}return S?m.jsx("p",{className:"form-error",children:S}):!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:x,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})]}),y?m.jsx("p",{className:"form-error",children:y}):null,m.jsx("button",{type:"submit",disabled:_||h.length!==6,children:"Activate 2FA"})]})]})}function MA(e){return{source:Zf(e?.source)||"unknown",...typeof e?.status=="number"?{status:e.status}:{},...e?.activeAgentId!==void 0?{activeAgentId:e.activeAgentId}:{},...e?.terminalId?{terminalId:Zf(e.terminalId)}:{},...e?.detail?{detail:Zf(e.detail)}:{}}}function NA(e){return{invalidationSource:e.source}}function AA(e){ys("auth.session_invalid.request",N1(e)),!(typeof console>"u"||typeof console.warn!="function")&&(console.warn("[nterminal] session invalid requested",e),Ju("session-invalid-request").catch(()=>{}))}function LA(e,t){ys("auth.session_invalid.result",{...N1(e),authenticated:t}),!(typeof console>"u"||typeof console.warn!="function")&&(console.warn("[nterminal] session invalid check result",{...e,authenticated:t}),Ju("session-invalid-result").catch(()=>{}))}function N1(e){return{source:e.source,...typeof e.status=="number"?{status:e.status}:{},...e.activeAgentId!==void 0?{activeAgentId:e.activeAgentId}:{},...e.terminalId?{terminalId:e.terminalId}:{},...e.detail?{detail:e.detail}:{}}}function Zf(e){return e?e.replace(/[^a-zA-Z0-9_.:-]/g,"_").slice(0,96):""}function BA({api:e,serverApi:t,activeAgentId:n=null,onSelectServer:a}){const o=v.useMemo(()=>e??Yu(),[e]),c=v.useMemo(()=>t??To(null),[t]),[h,f]=v.useState(null),[_,p]=v.useState(null),y=v.useRef(null),b=v.useRef("loading");v.useEffect(()=>{let k=!1;return o.getSession().then(H=>{k||(f(H),p(null))}).catch(H=>{k||(p(Gr(H)),f(null))}),()=>{k=!0}},[o]);const S=HA(h);v.useEffect(()=>{const k=b.current;ys("auth.view",{view:S,previousView:k,authenticated:h?.authenticated??null,passwordSet:h?.passwordSet??null,totpEnabled:h?.totpEnabled??null,deviceTrusted:h?.deviceTrusted??null,currentIpWhitelisted:h?.currentIpWhitelisted??null}),k==="workspace"&&S!=="workspace"&&Ju(`auth-left-workspace-${S}`).catch(()=>{}),b.current=S},[h,S]);async function C(){const k=await o.getSession();f(k),p(null)}async function x(){qf(),Gf(),zS(),p(null),f(null);try{await C()}catch(k){p(Gr(k))}}function E(k){const H=MA(k);if(AA(H),y.current)return y.current;const U=(async()=>{p(null);try{const X=await o.getSession(NA(H));if(LA(H,X.authenticated),f(X),X.authenticated){WM();return}qf(),Gf(),zS()}catch(X){p(Gr(X))}finally{y.current=null}})();return y.current=U,U}if(S==="workspace")return m.jsx(oA,{api:o,serverApi:c,activeAgentId:n,onSelectServer:a,sessionExpiresAt:h?.expiresAt??null,onSessionInvalid:k=>{E(k)},onLogout:async()=>{qf(),Gf();const k=await o.logout();f(k)}});const B={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":S==="loading",children:[m.jsxs("header",{className:"auth-header",children:[m.jsxs("div",{className:"auth-brand",children:[m.jsx(d0,{size:26}),m.jsxs("div",{children:[m.jsx(f0,{height:17}),m.jsx("p",{className:"auth-host",children:"local terminal"})]})]}),m.jsx("h1",{children:B[S]})]}),_?m.jsx("p",{className:"form-error",children:_}):null,S==="loading"?m.jsx("p",{className:"muted",children:"Checking session..."}):null,S==="loading"&&_?m.jsx("button",{type:"button",className:"secondary-button",onClick:()=>{x()},children:"Retry"}):null,S==="setup_password"?m.jsx(OA,{api:o,onSession:k=>{f(k)}}):null,S==="setup_totp"?m.jsx(RA,{api:o,onDone:()=>{C()}}):null,S==="login"?m.jsx(zA,{api:o,session:h,onSession:f,onRefresh:C}):null,S==="reauth"?m.jsx(jA,{api:o,session:h,onSession:f,onFullLogin:()=>f(k=>k&&{...k,deviceTrusted:!1})}):null]})]})}function OA({api:e,onSession:t}){const[n,a]=v.useState(""),[o,c]=v.useState(""),[h,f]=v.useState(!1),[_,p]=v.useState(null);async function y(b){b.preventDefault(),f(!0),p(null);try{if(n!==o){p("Passwords do not match");return}t(await e.setupPassword({password:n}))}catch(S){p(Gr(S))}finally{f(!1)}}return m.jsxs("form",{className:"auth-form",onSubmit:y,children:[m.jsxs("label",{children:["Password",m.jsx("input",{autoFocus:!0,value:n,onChange:b=>a(b.currentTarget.value),type:"password",minLength:8,required:!0})]}),m.jsxs("label",{children:["Confirm password",m.jsx("input",{value:o,onChange:b=>c(b.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 zA({api:e,session:t,onSession:n,onRefresh:a}){const[o,c]=v.useState(""),[h,f]=v.useState(""),[_,p]=v.useState(!1),[y,b]=v.useState(!1),[S,C]=v.useState(null),x=t?.totpEnabled??!1,E=t?.currentIpWhitelisted??!1;async function B(k){k.preventDefault(),b(!0),C(null);try{n(await e.login({password:o,...x?{otp:h}:{},rememberNetwork:_}))}catch(H){C(Gr(H))}finally{b(!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:k=>c(k.currentTarget.value),required:!0})]}),x?m.jsxs("label",{children:["Authenticator code",m.jsx("input",{type:"text",inputMode:"numeric",pattern:"[0-9]{6}",maxLength:6,value:h,onChange:k=>f(k.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:k=>p(k.currentTarget.checked)}),"Remember this network (skip 2FA here next time)"]}),S?m.jsx("p",{className:"form-error",children:S}):null,m.jsxs("div",{className:"button-row",children:[m.jsx("button",{type:"submit",disabled:y||o.length===0||x&&h.length!==6,children:"Unlock"}),m.jsx("button",{type:"button",className:"secondary-button",onClick:()=>{a()},disabled:y,children:"Refresh"})]})]})}function jA({api:e,session:t,onSession:n,onFullLogin:a}){const o=t?.currentIpWhitelisted??!1,[c,h]=v.useState(""),[f,_]=v.useState(!1),[p,y]=v.useState(!1),[b,S]=v.useState(!1),[C,x]=v.useState(!1),[E,B]=v.useState(null),k=mi.useCallback(async(U,X)=>{y(!0),B(null);try{n(await e.reauth({...U?{otp:U}:{},rememberNetwork:X}))}catch(ee){B(Gr(ee))}finally{y(!1)}},[e,n]);v.useEffect(()=>{if(o){let U=!1;S(!0),x(!1),B(null);const X=window.setTimeout(()=>{U||x(!0)},6e3);return e.reauth({rememberNetwork:!1}).then(ee=>{U||n(ee)}).catch(ee=>{U||(B(Gr(ee)),x(!0))}).finally(()=>{window.clearTimeout(X),U||S(!1)}),()=>{U=!0,window.clearTimeout(X)}}},[e,o,n]);async function H(U){U.preventDefault(),await k(c,f)}return o&&b&&!C&&!E?m.jsx("p",{className:"muted",children:"Reconnecting from a trusted network…"}):m.jsxs("form",{className:"auth-form",onSubmit:H,children:[o&&C&&!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:U=>h(U.currentTarget.value.replace(/\D/g,"")),placeholder:"000000",required:!0})]}),m.jsxs("label",{className:"auth-checkbox",children:[m.jsx("input",{type:"checkbox",checked:f,onChange:U=>_(U.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 HA(e){return e?e.passwordSet?e.authenticated&&!e.totpEnabled?"setup_totp":e.authenticated?"workspace":e.deviceTrusted&&e.totpEnabled?"reauth":"login":"setup_password":"loading"}function Gr(e){return e instanceof Error?e.message:"Request failed"}const a0="NTerminal",Em="nterminal.activeAgentId";function UA(){const[e,t]=v.useState(()=>PA()),n=v.useMemo(()=>Yu(),[]),a=v.useMemo(()=>To(e),[e]);v.useEffect(()=>{const c=()=>{const h=C3();document.title=h>0?`(${h}) ${a0}`:a0};return c(),w3(c)},[]);function o(c){IA(c),t(c)}return m.jsx(BA,{api:n,activeAgentId:e,serverApi:a,onSelectServer:o})}function PA(){if(typeof window>"u")return null;try{const e=window.localStorage.getItem(Em);return e&&e.trim()?e:null}catch{return null}}function IA(e){if(!(typeof window>"u"))try{if(e){window.localStorage.setItem(Em,e);return}window.localStorage.removeItem(Em)}catch{}}const l0=["gesturestart","gesturechange","gestureend"],KA=[".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 FA(e=window){if(!WA(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||!qA(c.target))&&a(c)}for(const c of l0)n.addEventListener(c,a,t);return n.addEventListener("touchmove",o,t),n.addEventListener("dblclick",a,t),()=>{for(const c of l0)n.removeEventListener(c,a,t);n.removeEventListener("touchmove",o,t),n.removeEventListener("dblclick",a,t)}}function qA(e){return e instanceof Element&&e.closest(KA)!==null}function WA(e){return e.navigator.maxTouchPoints>0?!0:typeof e.matchMedia=="function"&&e.matchMedia("(pointer: coarse)").matches}AE();_M();FA();Mm();Fx.createRoot(document.getElementById("root")).render(m.jsx(mi.StrictMode,{children:m.jsx(UA,{})}));export{mi as R,Bx as g,m as j};
|