evalution 1.0.1 → 1.0.3
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/bin/evalution.js +0 -0
- package/dist/cli/index.js +139 -126
- package/dist/client/assets/{index-CORbBplP.js → index-DR7qdRRh.js} +35 -35
- package/dist/client/index.html +1 -1
- package/dist/index.d.ts +83 -55
- package/dist/index.js +92 -126
- package/dist/{vercel-ai-sdk-CareWPDM.js → vercel-ai-sdk-B5BwUGKp.js} +128 -34
- package/package.json +2 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var
|
|
1
|
+
var C0=Object.defineProperty;var x0=(e,t,i)=>t in e?C0(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i;var kd=(e,t,i)=>x0(e,typeof t!="symbol"?t+"":t,i);(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const r of document.querySelectorAll('link[rel="modulepreload"]'))s(r);new MutationObserver(r=>{for(const n of r)if(n.type==="childList")for(const l of n.addedNodes)l.tagName==="LINK"&&l.rel==="modulepreload"&&s(l)}).observe(document,{childList:!0,subtree:!0});function i(r){const n={};return r.integrity&&(n.integrity=r.integrity),r.referrerPolicy&&(n.referrerPolicy=r.referrerPolicy),r.crossOrigin==="use-credentials"?n.credentials="include":r.crossOrigin==="anonymous"?n.credentials="omit":n.credentials="same-origin",n}function s(r){if(r.ep)return;r.ep=!0;const n=i(r);fetch(r.href,n)}})();function E0(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var cp={exports:{}},io={};/**
|
|
2
2
|
* @license React
|
|
3
3
|
* react-jsx-runtime.production.js
|
|
4
4
|
*
|
|
@@ -6,7 +6,7 @@ var m0=Object.defineProperty;var g0=(e,t,i)=>t in e?m0(e,t,{enumerable:!0,config
|
|
|
6
6
|
*
|
|
7
7
|
* This source code is licensed under the MIT license found in the
|
|
8
8
|
* LICENSE file in the root directory of this source tree.
|
|
9
|
-
*/var
|
|
9
|
+
*/var k0=Symbol.for("react.transitional.element"),T0=Symbol.for("react.fragment");function hp(e,t,i){var s=null;if(i!==void 0&&(s=""+i),t.key!==void 0&&(s=""+t.key),"key"in t){i={};for(var r in t)r!=="key"&&(i[r]=t[r])}else i=t;return t=i.ref,{$$typeof:k0,type:e,key:s,ref:t!==void 0?t:null,props:i}}io.Fragment=T0;io.jsx=hp;io.jsxs=hp;cp.exports=io;var h=cp.exports,up={exports:{}},J={};/**
|
|
10
10
|
* @license React
|
|
11
11
|
* react.production.js
|
|
12
12
|
*
|
|
@@ -14,7 +14,7 @@ var m0=Object.defineProperty;var g0=(e,t,i)=>t in e?m0(e,t,{enumerable:!0,config
|
|
|
14
14
|
*
|
|
15
15
|
* This source code is licensed under the MIT license found in the
|
|
16
16
|
* LICENSE file in the root directory of this source tree.
|
|
17
|
-
*/var
|
|
17
|
+
*/var hu=Symbol.for("react.transitional.element"),D0=Symbol.for("react.portal"),M0=Symbol.for("react.fragment"),R0=Symbol.for("react.strict_mode"),B0=Symbol.for("react.profiler"),A0=Symbol.for("react.consumer"),N0=Symbol.for("react.context"),O0=Symbol.for("react.forward_ref"),L0=Symbol.for("react.suspense"),z0=Symbol.for("react.memo"),dp=Symbol.for("react.lazy"),j0=Symbol.for("react.activity"),Td=Symbol.iterator;function H0(e){return e===null||typeof e!="object"?null:(e=Td&&e[Td]||e["@@iterator"],typeof e=="function"?e:null)}var fp={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},_p=Object.assign,pp={};function Xr(e,t,i){this.props=e,this.context=t,this.refs=pp,this.updater=i||fp}Xr.prototype.isReactComponent={};Xr.prototype.setState=function(e,t){if(typeof e!="object"&&typeof e!="function"&&e!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")};Xr.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function mp(){}mp.prototype=Xr.prototype;function uu(e,t,i){this.props=e,this.context=t,this.refs=pp,this.updater=i||fp}var du=uu.prototype=new mp;du.constructor=uu;_p(du,Xr.prototype);du.isPureReactComponent=!0;var Dd=Array.isArray;function Tc(){}var be={H:null,A:null,T:null,S:null},gp=Object.prototype.hasOwnProperty;function fu(e,t,i){var s=i.ref;return{$$typeof:hu,type:e,key:t,ref:s!==void 0?s:null,props:i}}function U0(e,t){return fu(e.type,t,e.props)}function _u(e){return typeof e=="object"&&e!==null&&e.$$typeof===hu}function q0(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(i){return t[i]})}var Md=/\/+/g;function To(e,t){return typeof e=="object"&&e!==null&&e.key!=null?q0(""+e.key):t.toString(36)}function P0(e){switch(e.status){case"fulfilled":return e.value;case"rejected":throw e.reason;default:switch(typeof e.status=="string"?e.then(Tc,Tc):(e.status="pending",e.then(function(t){e.status==="pending"&&(e.status="fulfilled",e.value=t)},function(t){e.status==="pending"&&(e.status="rejected",e.reason=t)})),e.status){case"fulfilled":return e.value;case"rejected":throw e.reason}}throw e}function hr(e,t,i,s,r){var n=typeof e;(n==="undefined"||n==="boolean")&&(e=null);var l=!1;if(e===null)l=!0;else switch(n){case"bigint":case"string":case"number":l=!0;break;case"object":switch(e.$$typeof){case hu:case D0:l=!0;break;case dp:return l=e._init,hr(l(e._payload),t,i,s,r)}}if(l)return r=r(e),l=s===""?"."+To(e,0):s,Dd(r)?(i="",l!=null&&(i=l.replace(Md,"$&/")+"/"),hr(r,t,i,"",function(c){return c})):r!=null&&(_u(r)&&(r=U0(r,i+(r.key==null||e&&e.key===r.key?"":(""+r.key).replace(Md,"$&/")+"/")+l)),t.push(r)),1;l=0;var a=s===""?".":s+":";if(Dd(e))for(var o=0;o<e.length;o++)s=e[o],n=a+To(s,o),l+=hr(s,t,i,n,r);else if(o=H0(e),typeof o=="function")for(e=o.call(e),o=0;!(s=e.next()).done;)s=s.value,n=a+To(s,o++),l+=hr(s,t,i,n,r);else if(n==="object"){if(typeof e.then=="function")return hr(P0(e),t,i,s,r);throw t=String(e),Error("Objects are not valid as a React child (found: "+(t==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":t)+"). If you meant to render a collection of children, use an array instead.")}return l}function kl(e,t,i){if(e==null)return e;var s=[],r=0;return hr(e,s,"","",function(n){return t.call(i,n,r++)}),s}function K0(e){if(e._status===-1){var t=e._result;t=t(),t.then(function(i){(e._status===0||e._status===-1)&&(e._status=1,e._result=i)},function(i){(e._status===0||e._status===-1)&&(e._status=2,e._result=i)}),e._status===-1&&(e._status=0,e._result=t)}if(e._status===1)return e._result.default;throw e._result}var Rd=typeof reportError=="function"?reportError:function(e){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var t=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof e=="object"&&e!==null&&typeof e.message=="string"?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",e);return}console.error(e)},W0={map:kl,forEach:function(e,t,i){kl(e,function(){t.apply(this,arguments)},i)},count:function(e){var t=0;return kl(e,function(){t++}),t},toArray:function(e){return kl(e,function(t){return t})||[]},only:function(e){if(!_u(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};J.Activity=j0;J.Children=W0;J.Component=Xr;J.Fragment=M0;J.Profiler=B0;J.PureComponent=uu;J.StrictMode=R0;J.Suspense=L0;J.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=be;J.__COMPILER_RUNTIME={__proto__:null,c:function(e){return be.H.useMemoCache(e)}};J.cache=function(e){return function(){return e.apply(null,arguments)}};J.cacheSignal=function(){return null};J.cloneElement=function(e,t,i){if(e==null)throw Error("The argument must be a React element, but you passed "+e+".");var s=_p({},e.props),r=e.key;if(t!=null)for(n in t.key!==void 0&&(r=""+t.key),t)!gp.call(t,n)||n==="key"||n==="__self"||n==="__source"||n==="ref"&&t.ref===void 0||(s[n]=t[n]);var n=arguments.length-2;if(n===1)s.children=i;else if(1<n){for(var l=Array(n),a=0;a<n;a++)l[a]=arguments[a+2];s.children=l}return fu(e.type,r,s)};J.createContext=function(e){return e={$$typeof:N0,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null},e.Provider=e,e.Consumer={$$typeof:A0,_context:e},e};J.createElement=function(e,t,i){var s,r={},n=null;if(t!=null)for(s in t.key!==void 0&&(n=""+t.key),t)gp.call(t,s)&&s!=="key"&&s!=="__self"&&s!=="__source"&&(r[s]=t[s]);var l=arguments.length-2;if(l===1)r.children=i;else if(1<l){for(var a=Array(l),o=0;o<l;o++)a[o]=arguments[o+2];r.children=a}if(e&&e.defaultProps)for(s in l=e.defaultProps,l)r[s]===void 0&&(r[s]=l[s]);return fu(e,n,r)};J.createRef=function(){return{current:null}};J.forwardRef=function(e){return{$$typeof:O0,render:e}};J.isValidElement=_u;J.lazy=function(e){return{$$typeof:dp,_payload:{_status:-1,_result:e},_init:K0}};J.memo=function(e,t){return{$$typeof:z0,type:e,compare:t===void 0?null:t}};J.startTransition=function(e){var t=be.T,i={};be.T=i;try{var s=e(),r=be.S;r!==null&&r(i,s),typeof s=="object"&&s!==null&&typeof s.then=="function"&&s.then(Tc,Rd)}catch(n){Rd(n)}finally{t!==null&&i.types!==null&&(t.types=i.types),be.T=t}};J.unstable_useCacheRefresh=function(){return be.H.useCacheRefresh()};J.use=function(e){return be.H.use(e)};J.useActionState=function(e,t,i){return be.H.useActionState(e,t,i)};J.useCallback=function(e,t){return be.H.useCallback(e,t)};J.useContext=function(e){return be.H.useContext(e)};J.useDebugValue=function(){};J.useDeferredValue=function(e,t){return be.H.useDeferredValue(e,t)};J.useEffect=function(e,t){return be.H.useEffect(e,t)};J.useEffectEvent=function(e){return be.H.useEffectEvent(e)};J.useId=function(){return be.H.useId()};J.useImperativeHandle=function(e,t,i){return be.H.useImperativeHandle(e,t,i)};J.useInsertionEffect=function(e,t){return be.H.useInsertionEffect(e,t)};J.useLayoutEffect=function(e,t){return be.H.useLayoutEffect(e,t)};J.useMemo=function(e,t){return be.H.useMemo(e,t)};J.useOptimistic=function(e,t){return be.H.useOptimistic(e,t)};J.useReducer=function(e,t,i){return be.H.useReducer(e,t,i)};J.useRef=function(e){return be.H.useRef(e)};J.useState=function(e){return be.H.useState(e)};J.useSyncExternalStore=function(e,t,i){return be.H.useSyncExternalStore(e,t,i)};J.useTransition=function(){return be.H.useTransition()};J.version="19.2.6";up.exports=J;var k=up.exports;const Y0=E0(k);var vp={exports:{}},so={},Sp={exports:{}},yp={};/**
|
|
18
18
|
* @license React
|
|
19
19
|
* scheduler.production.js
|
|
20
20
|
*
|
|
@@ -22,7 +22,7 @@ var m0=Object.defineProperty;var g0=(e,t,i)=>t in e?m0(e,t,{enumerable:!0,config
|
|
|
22
22
|
*
|
|
23
23
|
* This source code is licensed under the MIT license found in the
|
|
24
24
|
* LICENSE file in the root directory of this source tree.
|
|
25
|
-
*/(function(e){function t(b,N){var E=b.length;b.push(N);e:for(;0<E;){var
|
|
25
|
+
*/(function(e){function t(b,N){var E=b.length;b.push(N);e:for(;0<E;){var V=E-1>>>1,F=b[V];if(0<r(F,N))b[V]=N,b[E]=F,E=V;else break e}}function i(b){return b.length===0?null:b[0]}function s(b){if(b.length===0)return null;var N=b[0],E=b.pop();if(E!==N){b[0]=E;e:for(var V=0,F=b.length,rt=F>>>1;V<rt;){var nt=2*(V+1)-1,$e=b[nt],Ce=nt+1,lt=b[Ce];if(0>r($e,E))Ce<F&&0>r(lt,$e)?(b[V]=lt,b[Ce]=E,V=Ce):(b[V]=$e,b[nt]=E,V=nt);else if(Ce<F&&0>r(lt,E))b[V]=lt,b[Ce]=E,V=Ce;else break e}}return N}function r(b,N){var E=b.sortIndex-N.sortIndex;return E!==0?E:b.id-N.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var n=performance;e.unstable_now=function(){return n.now()}}else{var l=Date,a=l.now();e.unstable_now=function(){return l.now()-a}}var o=[],c=[],u=1,_=null,f=3,d=!1,g=!1,y=!1,w=!1,m=typeof setTimeout=="function"?setTimeout:null,p=typeof clearTimeout=="function"?clearTimeout:null,v=typeof setImmediate<"u"?setImmediate:null;function S(b){for(var N=i(c);N!==null;){if(N.callback===null)s(c);else if(N.startTime<=b)s(c),N.sortIndex=N.expirationTime,t(o,N);else break;N=i(c)}}function T(b){if(y=!1,S(b),!g)if(i(o)!==null)g=!0,j||(j=!0,x());else{var N=i(c);N!==null&&D(T,N.startTime-b)}}var j=!1,O=-1,L=5,U=-1;function Y(){return w?!0:!(e.unstable_now()-U<L)}function A(){if(w=!1,j){var b=e.unstable_now();U=b;var N=!0;try{e:{g=!1,y&&(y=!1,p(O),O=-1),d=!0;var E=f;try{t:{for(S(b),_=i(o);_!==null&&!(_.expirationTime>b&&Y());){var V=_.callback;if(typeof V=="function"){_.callback=null,f=_.priorityLevel;var F=V(_.expirationTime<=b);if(b=e.unstable_now(),typeof F=="function"){_.callback=F,S(b),N=!0;break t}_===i(o)&&s(o),S(b)}else s(o);_=i(o)}if(_!==null)N=!0;else{var rt=i(c);rt!==null&&D(T,rt.startTime-b),N=!1}}break e}finally{_=null,f=E,d=!1}N=void 0}}finally{N?x():j=!1}}}var x;if(typeof v=="function")x=function(){v(A)};else if(typeof MessageChannel<"u"){var C=new MessageChannel,B=C.port2;C.port1.onmessage=A,x=function(){B.postMessage(null)}}else x=function(){m(A,0)};function D(b,N){O=m(function(){b(e.unstable_now())},N)}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(b){b.callback=null},e.unstable_forceFrameRate=function(b){0>b||125<b?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):L=0<b?Math.floor(1e3/b):5},e.unstable_getCurrentPriorityLevel=function(){return f},e.unstable_next=function(b){switch(f){case 1:case 2:case 3:var N=3;break;default:N=f}var E=f;f=N;try{return b()}finally{f=E}},e.unstable_requestPaint=function(){w=!0},e.unstable_runWithPriority=function(b,N){switch(b){case 1:case 2:case 3:case 4:case 5:break;default:b=3}var E=f;f=b;try{return N()}finally{f=E}},e.unstable_scheduleCallback=function(b,N,E){var V=e.unstable_now();switch(typeof E=="object"&&E!==null?(E=E.delay,E=typeof E=="number"&&0<E?V+E:V):E=V,b){case 1:var F=-1;break;case 2:F=250;break;case 5:F=1073741823;break;case 4:F=1e4;break;default:F=5e3}return F=E+F,b={id:u++,callback:N,priorityLevel:b,startTime:E,expirationTime:F,sortIndex:-1},E>V?(b.sortIndex=E,t(c,b),i(o)===null&&b===i(c)&&(y?(p(O),O=-1):y=!0,D(T,E-V))):(b.sortIndex=F,t(o,b),g||d||(g=!0,j||(j=!0,x()))),b},e.unstable_shouldYield=Y,e.unstable_wrapCallback=function(b){var N=f;return function(){var E=f;f=N;try{return b.apply(this,arguments)}finally{f=E}}}})(yp);Sp.exports=yp;var V0=Sp.exports,bp={exports:{}},yt={};/**
|
|
26
26
|
* @license React
|
|
27
27
|
* react-dom.production.js
|
|
28
28
|
*
|
|
@@ -30,7 +30,7 @@ var m0=Object.defineProperty;var g0=(e,t,i)=>t in e?m0(e,t,{enumerable:!0,config
|
|
|
30
30
|
*
|
|
31
31
|
* This source code is licensed under the MIT license found in the
|
|
32
32
|
* LICENSE file in the root directory of this source tree.
|
|
33
|
-
*/var
|
|
33
|
+
*/var I0=k;function wp(e){var t="https://react.dev/errors/"+e;if(1<arguments.length){t+="?args[]="+encodeURIComponent(arguments[1]);for(var i=2;i<arguments.length;i++)t+="&args[]="+encodeURIComponent(arguments[i])}return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function Fi(){}var St={d:{f:Fi,r:function(){throw Error(wp(522))},D:Fi,C:Fi,L:Fi,m:Fi,X:Fi,S:Fi,M:Fi},p:0,findDOMNode:null},X0=Symbol.for("react.portal");function $0(e,t,i){var s=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:X0,key:s==null?null:""+s,children:e,containerInfo:t,implementation:i}}var Rn=I0.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function ro(e,t){if(e==="font")return"";if(typeof t=="string")return t==="use-credentials"?t:""}yt.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=St;yt.createPortal=function(e,t){var i=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)throw Error(wp(299));return $0(e,t,null,i)};yt.flushSync=function(e){var t=Rn.T,i=St.p;try{if(Rn.T=null,St.p=2,e)return e()}finally{Rn.T=t,St.p=i,St.d.f()}};yt.preconnect=function(e,t){typeof e=="string"&&(t?(t=t.crossOrigin,t=typeof t=="string"?t==="use-credentials"?t:"":void 0):t=null,St.d.C(e,t))};yt.prefetchDNS=function(e){typeof e=="string"&&St.d.D(e)};yt.preinit=function(e,t){if(typeof e=="string"&&t&&typeof t.as=="string"){var i=t.as,s=ro(i,t.crossOrigin),r=typeof t.integrity=="string"?t.integrity:void 0,n=typeof t.fetchPriority=="string"?t.fetchPriority:void 0;i==="style"?St.d.S(e,typeof t.precedence=="string"?t.precedence:void 0,{crossOrigin:s,integrity:r,fetchPriority:n}):i==="script"&&St.d.X(e,{crossOrigin:s,integrity:r,fetchPriority:n,nonce:typeof t.nonce=="string"?t.nonce:void 0})}};yt.preinitModule=function(e,t){if(typeof e=="string")if(typeof t=="object"&&t!==null){if(t.as==null||t.as==="script"){var i=ro(t.as,t.crossOrigin);St.d.M(e,{crossOrigin:i,integrity:typeof t.integrity=="string"?t.integrity:void 0,nonce:typeof t.nonce=="string"?t.nonce:void 0})}}else t==null&&St.d.M(e)};yt.preload=function(e,t){if(typeof e=="string"&&typeof t=="object"&&t!==null&&typeof t.as=="string"){var i=t.as,s=ro(i,t.crossOrigin);St.d.L(e,i,{crossOrigin:s,integrity:typeof t.integrity=="string"?t.integrity:void 0,nonce:typeof t.nonce=="string"?t.nonce:void 0,type:typeof t.type=="string"?t.type:void 0,fetchPriority:typeof t.fetchPriority=="string"?t.fetchPriority:void 0,referrerPolicy:typeof t.referrerPolicy=="string"?t.referrerPolicy:void 0,imageSrcSet:typeof t.imageSrcSet=="string"?t.imageSrcSet:void 0,imageSizes:typeof t.imageSizes=="string"?t.imageSizes:void 0,media:typeof t.media=="string"?t.media:void 0})}};yt.preloadModule=function(e,t){if(typeof e=="string")if(t){var i=ro(t.as,t.crossOrigin);St.d.m(e,{as:typeof t.as=="string"&&t.as!=="script"?t.as:void 0,crossOrigin:i,integrity:typeof t.integrity=="string"?t.integrity:void 0})}else St.d.m(e)};yt.requestFormReset=function(e){St.d.r(e)};yt.unstable_batchedUpdates=function(e,t){return e(t)};yt.useFormState=function(e,t,i){return Rn.H.useFormState(e,t,i)};yt.useFormStatus=function(){return Rn.H.useHostTransitionStatus()};yt.version="19.2.6";function Cp(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(Cp)}catch(e){console.error(e)}}Cp(),bp.exports=yt;var xp=bp.exports;/**
|
|
34
34
|
* @license React
|
|
35
35
|
* react-dom-client.production.js
|
|
36
36
|
*
|
|
@@ -38,18 +38,18 @@ var m0=Object.defineProperty;var g0=(e,t,i)=>t in e?m0(e,t,{enumerable:!0,config
|
|
|
38
38
|
*
|
|
39
39
|
* This source code is licensed under the MIT license found in the
|
|
40
40
|
* LICENSE file in the root directory of this source tree.
|
|
41
|
-
*/var
|
|
41
|
+
*/var Ie=V0,Ep=k,G0=xp;function M(e){var t="https://react.dev/errors/"+e;if(1<arguments.length){t+="?args[]="+encodeURIComponent(arguments[1]);for(var i=2;i<arguments.length;i++)t+="&args[]="+encodeURIComponent(arguments[i])}return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function kp(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function cl(e){var t=e,i=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,t.flags&4098&&(i=t.return),e=t.return;while(e)}return t.tag===3?i:null}function Tp(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function Dp(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function Bd(e){if(cl(e)!==e)throw Error(M(188))}function F0(e){var t=e.alternate;if(!t){if(t=cl(e),t===null)throw Error(M(188));return t!==e?null:e}for(var i=e,s=t;;){var r=i.return;if(r===null)break;var n=r.alternate;if(n===null){if(s=r.return,s!==null){i=s;continue}break}if(r.child===n.child){for(n=r.child;n;){if(n===i)return Bd(r),e;if(n===s)return Bd(r),t;n=n.sibling}throw Error(M(188))}if(i.return!==s.return)i=r,s=n;else{for(var l=!1,a=r.child;a;){if(a===i){l=!0,i=r,s=n;break}if(a===s){l=!0,s=r,i=n;break}a=a.sibling}if(!l){for(a=n.child;a;){if(a===i){l=!0,i=n,s=r;break}if(a===s){l=!0,s=n,i=r;break}a=a.sibling}if(!l)throw Error(M(189))}}if(i.alternate!==s)throw Error(M(190))}if(i.tag!==3)throw Error(M(188));return i.stateNode.current===i?e:t}function Mp(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=Mp(e),t!==null)return t;e=e.sibling}return null}var we=Object.assign,Z0=Symbol.for("react.element"),Tl=Symbol.for("react.transitional.element"),yn=Symbol.for("react.portal"),fr=Symbol.for("react.fragment"),Rp=Symbol.for("react.strict_mode"),Dc=Symbol.for("react.profiler"),Bp=Symbol.for("react.consumer"),Ni=Symbol.for("react.context"),pu=Symbol.for("react.forward_ref"),Mc=Symbol.for("react.suspense"),Rc=Symbol.for("react.suspense_list"),mu=Symbol.for("react.memo"),es=Symbol.for("react.lazy"),Bc=Symbol.for("react.activity"),Q0=Symbol.for("react.memo_cache_sentinel"),Ad=Symbol.iterator;function ln(e){return e===null||typeof e!="object"?null:(e=Ad&&e[Ad]||e["@@iterator"],typeof e=="function"?e:null)}var J0=Symbol.for("react.client.reference");function Ac(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===J0?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case fr:return"Fragment";case Dc:return"Profiler";case Rp:return"StrictMode";case Mc:return"Suspense";case Rc:return"SuspenseList";case Bc:return"Activity"}if(typeof e=="object")switch(e.$$typeof){case yn:return"Portal";case Ni:return e.displayName||"Context";case Bp:return(e._context.displayName||"Context")+".Consumer";case pu:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case mu:return t=e.displayName||null,t!==null?t:Ac(e.type)||"Memo";case es:t=e._payload,e=e._init;try{return Ac(e(t))}catch{}}return null}var bn=Array.isArray,X=Ep.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,he=G0.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Hs={pending:!1,data:null,method:null,action:null},Nc=[],_r=-1;function bi(e){return{current:e}}function it(e){0>_r||(e.current=Nc[_r],Nc[_r]=null,_r--)}function ge(e,t){_r++,Nc[_r]=e.current,e.current=t}var vi=bi(null),In=bi(null),fs=bi(null),ya=bi(null);function ba(e,t){switch(ge(fs,t),ge(In,e),ge(vi,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?Uf(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Uf(t),e=Zg(t,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}it(vi),ge(vi,e)}function Lr(){it(vi),it(In),it(fs)}function Oc(e){e.memoizedState!==null&&ge(ya,e);var t=vi.current,i=Zg(t,e.type);t!==i&&(ge(In,e),ge(vi,i))}function wa(e){In.current===e&&(it(vi),it(In)),ya.current===e&&(it(ya),sl._currentValue=Hs)}var Do,Nd;function Bs(e){if(Do===void 0)try{throw Error()}catch(i){var t=i.stack.trim().match(/\n( *(at )?)/);Do=t&&t[1]||"",Nd=-1<i.stack.indexOf(`
|
|
42
42
|
at`)?" (<anonymous>)":-1<i.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
43
|
-
`+
|
|
43
|
+
`+Do+e+Nd}var Mo=!1;function Ro(e,t){if(!e||Mo)return"";Mo=!0;var i=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var s={DetermineComponentFrameRoot:function(){try{if(t){var _=function(){throw Error()};if(Object.defineProperty(_.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(_,[])}catch(d){var f=d}Reflect.construct(e,[],_)}else{try{_.call()}catch(d){f=d}e.call(_.prototype)}}else{try{throw Error()}catch(d){f=d}(_=e())&&typeof _.catch=="function"&&_.catch(function(){})}}catch(d){if(d&&f&&typeof d.stack=="string")return[d.stack,f.stack]}return[null,null]}};s.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var r=Object.getOwnPropertyDescriptor(s.DetermineComponentFrameRoot,"name");r&&r.configurable&&Object.defineProperty(s.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var n=s.DetermineComponentFrameRoot(),l=n[0],a=n[1];if(l&&a){var o=l.split(`
|
|
44
44
|
`),c=a.split(`
|
|
45
|
-
`);for(r=s=0;s<o.length&&!o[s].includes("DetermineComponentFrameRoot");)s++;for(;r<c.length&&!c[r].includes("DetermineComponentFrameRoot");)r++;if(s===o.length||r===c.length)for(s=o.length-1,r=c.length-1;1<=s&&0<=r&&o[s]!==c[r];)r--;for(;1<=s&&0<=r;s--,r--)if(o[s]!==c[r]){if(s!==1||r!==1)do if(s--,r--,0>r||o[s]!==c[r]){var
|
|
46
|
-
`+o[s].replace(" at new "," at ");return e.displayName&&
|
|
45
|
+
`);for(r=s=0;s<o.length&&!o[s].includes("DetermineComponentFrameRoot");)s++;for(;r<c.length&&!c[r].includes("DetermineComponentFrameRoot");)r++;if(s===o.length||r===c.length)for(s=o.length-1,r=c.length-1;1<=s&&0<=r&&o[s]!==c[r];)r--;for(;1<=s&&0<=r;s--,r--)if(o[s]!==c[r]){if(s!==1||r!==1)do if(s--,r--,0>r||o[s]!==c[r]){var u=`
|
|
46
|
+
`+o[s].replace(" at new "," at ");return e.displayName&&u.includes("<anonymous>")&&(u=u.replace("<anonymous>",e.displayName)),u}while(1<=s&&0<=r);break}}}finally{Mo=!1,Error.prepareStackTrace=i}return(i=e?e.displayName||e.name:"")?Bs(i):""}function eS(e,t){switch(e.tag){case 26:case 27:case 5:return Bs(e.type);case 16:return Bs("Lazy");case 13:return e.child!==t&&t!==null?Bs("Suspense Fallback"):Bs("Suspense");case 19:return Bs("SuspenseList");case 0:case 15:return Ro(e.type,!1);case 11:return Ro(e.type.render,!1);case 1:return Ro(e.type,!0);case 31:return Bs("Activity");default:return""}}function Od(e){try{var t="",i=null;do t+=eS(e,i),i=e,e=e.return;while(e);return t}catch(s){return`
|
|
47
47
|
Error generating stack: `+s.message+`
|
|
48
|
-
`+s.stack}}var Rc=Object.prototype.hasOwnProperty,du=Xe.unstable_scheduleCallback,Do=Xe.unstable_cancelCallback,G0=Xe.unstable_shouldYield,$0=Xe.unstable_requestPaint,Ht=Xe.unstable_now,F0=Xe.unstable_getCurrentPriorityLevel,kp=Xe.unstable_ImmediatePriority,Tp=Xe.unstable_UserBlockingPriority,ya=Xe.unstable_NormalPriority,Z0=Xe.unstable_LowPriority,Dp=Xe.unstable_IdlePriority,Q0=Xe.log,J0=Xe.unstable_setDisableYieldValue,ol=null,Ut=null;function ls(e){if(typeof Q0=="function"&&J0(e),Ut&&typeof Ut.setStrictMode=="function")try{Ut.setStrictMode(ol,e)}catch{}}var qt=Math.clz32?Math.clz32:iS,eS=Math.log,tS=Math.LN2;function iS(e){return e>>>=0,e===0?32:31-(eS(e)/tS|0)|0}var kl=256,Tl=262144,Dl=4194304;function Rs(e){var t=e&42;if(t!==0)return t;switch(e&-e){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 e&261888;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function io(e,t,i){var s=e.pendingLanes;if(s===0)return 0;var r=0,n=e.suspendedLanes,l=e.pingedLanes;e=e.warmLanes;var a=s&134217727;return a!==0?(s=a&~n,s!==0?r=Rs(s):(l&=a,l!==0?r=Rs(l):i||(i=a&~e,i!==0&&(r=Rs(i))))):(a=s&~n,a!==0?r=Rs(a):l!==0?r=Rs(l):i||(i=s&~e,i!==0&&(r=Rs(i)))),r===0?0:t!==0&&t!==r&&!(t&n)&&(n=r&-r,i=t&-t,n>=i||n===32&&(i&4194048)!==0)?t:r}function cl(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function sS(e,t){switch(e){case 1:case 2:case 4:case 8:case 64:return t+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 t+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 Mp(){var e=Dl;return Dl<<=1,!(Dl&62914560)&&(Dl=4194304),e}function Mo(e){for(var t=[],i=0;31>i;i++)t.push(e);return t}function hl(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function rS(e,t,i,s,r,n){var l=e.pendingLanes;e.pendingLanes=i,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=i,e.entangledLanes&=i,e.errorRecoveryDisabledLanes&=i,e.shellSuspendCounter=0;var a=e.entanglements,o=e.expirationTimes,c=e.hiddenUpdates;for(i=l&~i;0<i;){var _=31-qt(i),f=1<<_;a[_]=0,o[_]=-1;var u=c[_];if(u!==null)for(c[_]=null,_=0;_<u.length;_++){var d=u[_];d!==null&&(d.lane&=-536870913)}i&=~f}s!==0&&Bp(e,s,0),n!==0&&r===0&&e.tag!==0&&(e.suspendedLanes|=n&~(l&~t))}function Bp(e,t,i){e.pendingLanes|=t,e.suspendedLanes&=~t;var s=31-qt(t);e.entangledLanes|=t,e.entanglements[s]=e.entanglements[s]|1073741824|i&261930}function Rp(e,t){var i=e.entangledLanes|=t;for(e=e.entanglements;i;){var s=31-qt(i),r=1<<s;r&t|e[s]&t&&(e[s]|=t),i&=~r}}function Ap(e,t){var i=t&-t;return i=i&42?1:fu(i),i&(e.suspendedLanes|t)?0:i}function fu(e){switch(e){case 2:e=1;break;case 8:e=4;break;case 32:e=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:e=128;break;case 268435456:e=134217728;break;default:e=0}return e}function _u(e){return e&=-e,2<e?8<e?e&134217727?32:268435456:8:2}function Np(){var e=he.p;return e!==0?e:(e=window.event,e===void 0?32:iv(e.type))}function Md(e,t){var i=he.p;try{return he.p=e,t()}finally{he.p=i}}var ks=Math.random().toString(36).slice(2),ot="__reactFiber$"+ks,Mt="__reactProps$"+ks,Ir="__reactContainer$"+ks,Ac="__reactEvents$"+ks,nS="__reactListeners$"+ks,lS="__reactHandles$"+ks,Bd="__reactResources$"+ks,ul="__reactMarker$"+ks;function pu(e){delete e[ot],delete e[Mt],delete e[Ac],delete e[nS],delete e[lS]}function _r(e){var t=e[ot];if(t)return t;for(var i=e.parentNode;i;){if(t=i[Ir]||i[ot]){if(i=t.alternate,t.child!==null||i!==null&&i.child!==null)for(e=Hf(e);e!==null;){if(i=e[ot])return i;e=Hf(e)}return t}e=i,i=e.parentNode}return null}function Xr(e){if(e=e[ot]||e[Ir]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function yn(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(M(33))}function Er(e){var t=e[Bd];return t||(t=e[Bd]={hoistableStyles:new Map,hoistableScripts:new Map}),t}function it(e){e[ul]=!0}var Op=new Set,Lp={};function Fs(e,t){Or(e,t),Or(e+"Capture",t)}function Or(e,t){for(Lp[e]=t,e=0;e<t.length;e++)Op.add(t[e])}var aS=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]*$"),Rd={},Ad={};function oS(e){return Rc.call(Ad,e)?!0:Rc.call(Rd,e)?!1:aS.test(e)?Ad[e]=!0:(Rd[e]=!0,!1)}function Xl(e,t,i){if(oS(t))if(i===null)e.removeAttribute(t);else{switch(typeof i){case"undefined":case"function":case"symbol":e.removeAttribute(t);return;case"boolean":var s=t.toLowerCase().slice(0,5);if(s!=="data-"&&s!=="aria-"){e.removeAttribute(t);return}}e.setAttribute(t,""+i)}}function Ml(e,t,i){if(i===null)e.removeAttribute(t);else{switch(typeof i){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(t);return}e.setAttribute(t,""+i)}}function ki(e,t,i,s){if(s===null)e.removeAttribute(i);else{switch(typeof s){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(i);return}e.setAttributeNS(t,i,""+s)}}function Ft(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function zp(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function cS(e,t,i){var s=Object.getOwnPropertyDescriptor(e.constructor.prototype,t);if(!e.hasOwnProperty(t)&&typeof s<"u"&&typeof s.get=="function"&&typeof s.set=="function"){var r=s.get,n=s.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return r.call(this)},set:function(l){i=""+l,n.call(this,l)}}),Object.defineProperty(e,t,{enumerable:s.enumerable}),{getValue:function(){return i},setValue:function(l){i=""+l},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Nc(e){if(!e._valueTracker){var t=zp(e)?"checked":"value";e._valueTracker=cS(e,t,""+e[t])}}function jp(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var i=t.getValue(),s="";return e&&(s=zp(e)?e.checked?"true":"false":e.value),e=s,e!==i?(t.setValue(e),!0):!1}function ba(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}var hS=/[\n"\\]/g;function Jt(e){return e.replace(hS,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function Oc(e,t,i,s,r,n,l,a){e.name="",l!=null&&typeof l!="function"&&typeof l!="symbol"&&typeof l!="boolean"?e.type=l:e.removeAttribute("type"),t!=null?l==="number"?(t===0&&e.value===""||e.value!=t)&&(e.value=""+Ft(t)):e.value!==""+Ft(t)&&(e.value=""+Ft(t)):l!=="submit"&&l!=="reset"||e.removeAttribute("value"),t!=null?Lc(e,l,Ft(t)):i!=null?Lc(e,l,Ft(i)):s!=null&&e.removeAttribute("value"),r==null&&n!=null&&(e.defaultChecked=!!n),r!=null&&(e.checked=r&&typeof r!="function"&&typeof r!="symbol"),a!=null&&typeof a!="function"&&typeof a!="symbol"&&typeof a!="boolean"?e.name=""+Ft(a):e.removeAttribute("name")}function Hp(e,t,i,s,r,n,l,a){if(n!=null&&typeof n!="function"&&typeof n!="symbol"&&typeof n!="boolean"&&(e.type=n),t!=null||i!=null){if(!(n!=="submit"&&n!=="reset"||t!=null)){Nc(e);return}i=i!=null?""+Ft(i):"",t=t!=null?""+Ft(t):i,a||t===e.value||(e.value=t),e.defaultValue=t}s=s??r,s=typeof s!="function"&&typeof s!="symbol"&&!!s,e.checked=a?e.checked:!!s,e.defaultChecked=!!s,l!=null&&typeof l!="function"&&typeof l!="symbol"&&typeof l!="boolean"&&(e.name=l),Nc(e)}function Lc(e,t,i){t==="number"&&ba(e.ownerDocument)===e||e.defaultValue===""+i||(e.defaultValue=""+i)}function kr(e,t,i,s){if(e=e.options,t){t={};for(var r=0;r<i.length;r++)t["$"+i[r]]=!0;for(i=0;i<e.length;i++)r=t.hasOwnProperty("$"+e[i].value),e[i].selected!==r&&(e[i].selected=r),r&&s&&(e[i].defaultSelected=!0)}else{for(i=""+Ft(i),t=null,r=0;r<e.length;r++){if(e[r].value===i){e[r].selected=!0,s&&(e[r].defaultSelected=!0);return}t!==null||e[r].disabled||(t=e[r])}t!==null&&(t.selected=!0)}}function Up(e,t,i){if(t!=null&&(t=""+Ft(t),t!==e.value&&(e.value=t),i==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=i!=null?""+Ft(i):""}function qp(e,t,i,s){if(t==null){if(s!=null){if(i!=null)throw Error(M(92));if(Sn(s)){if(1<s.length)throw Error(M(93));s=s[0]}i=s}i==null&&(i=""),t=i}i=Ft(t),e.defaultValue=i,s=e.textContent,s===i&&s!==""&&s!==null&&(e.value=s),Nc(e)}function Lr(e,t){if(t){var i=e.firstChild;if(i&&i===e.lastChild&&i.nodeType===3){i.nodeValue=t;return}}e.textContent=t}var uS=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 Nd(e,t,i){var s=t.indexOf("--")===0;i==null||typeof i=="boolean"||i===""?s?e.setProperty(t,""):t==="float"?e.cssFloat="":e[t]="":s?e.setProperty(t,i):typeof i!="number"||i===0||uS.has(t)?t==="float"?e.cssFloat=i:e[t]=(""+i).trim():e[t]=i+"px"}function Pp(e,t,i){if(t!=null&&typeof t!="object")throw Error(M(62));if(e=e.style,i!=null){for(var s in i)!i.hasOwnProperty(s)||t!=null&&t.hasOwnProperty(s)||(s.indexOf("--")===0?e.setProperty(s,""):s==="float"?e.cssFloat="":e[s]="");for(var r in t)s=t[r],t.hasOwnProperty(r)&&i[r]!==s&&Nd(e,r,s)}else for(var n in t)t.hasOwnProperty(n)&&Nd(e,n,t[n])}function mu(e){if(e.indexOf("-")===-1)return!1;switch(e){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 dS=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"]]),fS=/^[\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 Gl(e){return fS.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function Li(){}var zc=null;function gu(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var pr=null,Tr=null;function Od(e){var t=Xr(e);if(t&&(e=t.stateNode)){var i=e[Mt]||null;e:switch(e=t.stateNode,t.type){case"input":if(Oc(e,i.value,i.defaultValue,i.defaultValue,i.checked,i.defaultChecked,i.type,i.name),t=i.name,i.type==="radio"&&t!=null){for(i=e;i.parentNode;)i=i.parentNode;for(i=i.querySelectorAll('input[name="'+Jt(""+t)+'"][type="radio"]'),t=0;t<i.length;t++){var s=i[t];if(s!==e&&s.form===e.form){var r=s[Mt]||null;if(!r)throw Error(M(90));Oc(s,r.value,r.defaultValue,r.defaultValue,r.checked,r.defaultChecked,r.type,r.name)}}for(t=0;t<i.length;t++)s=i[t],s.form===e.form&&jp(s)}break e;case"textarea":Up(e,i.value,i.defaultValue);break e;case"select":t=i.value,t!=null&&kr(e,!!i.multiple,t,!1)}}}var Bo=!1;function Kp(e,t,i){if(Bo)return e(t,i);Bo=!0;try{var s=e(t);return s}finally{if(Bo=!1,(pr!==null||Tr!==null)&&(po(),pr&&(t=pr,e=Tr,Tr=pr=null,Od(t),e)))for(t=0;t<e.length;t++)Od(e[t])}}function Vn(e,t){var i=e.stateNode;if(i===null)return null;var s=i[Mt]||null;if(s===null)return null;i=s[t];e:switch(t){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(s=!s.disabled)||(e=e.type,s=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!s;break e;default:e=!1}if(e)return null;if(i&&typeof i!="function")throw Error(M(231,t,typeof i));return i}var Pi=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),jc=!1;if(Pi)try{var nn={};Object.defineProperty(nn,"passive",{get:function(){jc=!0}}),window.addEventListener("test",nn,nn),window.removeEventListener("test",nn,nn)}catch{jc=!1}var as=null,vu=null,$l=null;function Wp(){if($l)return $l;var e,t=vu,i=t.length,s,r="value"in as?as.value:as.textContent,n=r.length;for(e=0;e<i&&t[e]===r[e];e++);var l=i-e;for(s=1;s<=l&&t[i-s]===r[n-s];s++);return $l=r.slice(e,1<s?1-s:void 0)}function Fl(e){var t=e.keyCode;return"charCode"in e?(e=e.charCode,e===0&&t===13&&(e=13)):e=t,e===10&&(e=13),32<=e||e===13?e:0}function Bl(){return!0}function Ld(){return!1}function Bt(e){function t(i,s,r,n,l){this._reactName=i,this._targetInst=r,this.type=s,this.nativeEvent=n,this.target=l,this.currentTarget=null;for(var a in e)e.hasOwnProperty(a)&&(i=e[a],this[a]=i?i(n):n[a]);return this.isDefaultPrevented=(n.defaultPrevented!=null?n.defaultPrevented:n.returnValue===!1)?Bl:Ld,this.isPropagationStopped=Ld,this}return Ce(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var i=this.nativeEvent;i&&(i.preventDefault?i.preventDefault():typeof i.returnValue!="unknown"&&(i.returnValue=!1),this.isDefaultPrevented=Bl)},stopPropagation:function(){var i=this.nativeEvent;i&&(i.stopPropagation?i.stopPropagation():typeof i.cancelBubble!="unknown"&&(i.cancelBubble=!0),this.isPropagationStopped=Bl)},persist:function(){},isPersistent:Bl}),t}var Zs={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},so=Bt(Zs),dl=Ce({},Zs,{view:0,detail:0}),_S=Bt(dl),Ro,Ao,ln,ro=Ce({},dl,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Su,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return"movementX"in e?e.movementX:(e!==ln&&(ln&&e.type==="mousemove"?(Ro=e.screenX-ln.screenX,Ao=e.screenY-ln.screenY):Ao=Ro=0,ln=e),Ro)},movementY:function(e){return"movementY"in e?e.movementY:Ao}}),zd=Bt(ro),pS=Ce({},ro,{dataTransfer:0}),mS=Bt(pS),gS=Ce({},dl,{relatedTarget:0}),No=Bt(gS),vS=Ce({},Zs,{animationName:0,elapsedTime:0,pseudoElement:0}),SS=Bt(vS),yS=Ce({},Zs,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),bS=Bt(yS),CS=Ce({},Zs,{data:0}),jd=Bt(CS),wS={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},xS={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"},ES={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function kS(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=ES[e])?!!t[e]:!1}function Su(){return kS}var TS=Ce({},dl,{key:function(e){if(e.key){var t=wS[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=Fl(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?xS[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Su,charCode:function(e){return e.type==="keypress"?Fl(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?Fl(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),DS=Bt(TS),MS=Ce({},ro,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Hd=Bt(MS),BS=Ce({},dl,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Su}),RS=Bt(BS),AS=Ce({},Zs,{propertyName:0,elapsedTime:0,pseudoElement:0}),NS=Bt(AS),OS=Ce({},ro,{deltaX:function(e){return"deltaX"in e?e.deltaX:"wheelDeltaX"in e?-e.wheelDeltaX:0},deltaY:function(e){return"deltaY"in e?e.deltaY:"wheelDeltaY"in e?-e.wheelDeltaY:"wheelDelta"in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0}),LS=Bt(OS),zS=Ce({},Zs,{newState:0,oldState:0}),jS=Bt(zS),HS=[9,13,27,32],yu=Pi&&"CompositionEvent"in window,Mn=null;Pi&&"documentMode"in document&&(Mn=document.documentMode);var US=Pi&&"TextEvent"in window&&!Mn,Yp=Pi&&(!yu||Mn&&8<Mn&&11>=Mn),Ud=" ",qd=!1;function Vp(e,t){switch(e){case"keyup":return HS.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Ip(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var mr=!1;function qS(e,t){switch(e){case"compositionend":return Ip(t);case"keypress":return t.which!==32?null:(qd=!0,Ud);case"textInput":return e=t.data,e===Ud&&qd?null:e;default:return null}}function PS(e,t){if(mr)return e==="compositionend"||!yu&&Vp(e,t)?(e=Wp(),$l=vu=as=null,mr=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case"compositionend":return Yp&&t.locale!=="ko"?null:t.data;default:return null}}var KS={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 Pd(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!KS[e.type]:t==="textarea"}function Xp(e,t,i,s){pr?Tr?Tr.push(s):Tr=[s]:pr=s,t=Ua(t,"onChange"),0<t.length&&(i=new so("onChange","change",null,i,s),e.push({event:i,listeners:t}))}var Bn=null,In=null;function WS(e){Kg(e,0)}function no(e){var t=yn(e);if(jp(t))return e}function Kd(e,t){if(e==="change")return t}var Gp=!1;if(Pi){var Oo;if(Pi){var Lo="oninput"in document;if(!Lo){var Wd=document.createElement("div");Wd.setAttribute("oninput","return;"),Lo=typeof Wd.oninput=="function"}Oo=Lo}else Oo=!1;Gp=Oo&&(!document.documentMode||9<document.documentMode)}function Yd(){Bn&&(Bn.detachEvent("onpropertychange",$p),In=Bn=null)}function $p(e){if(e.propertyName==="value"&&no(In)){var t=[];Xp(t,In,e,gu(e)),Kp(WS,t)}}function YS(e,t,i){e==="focusin"?(Yd(),Bn=t,In=i,Bn.attachEvent("onpropertychange",$p)):e==="focusout"&&Yd()}function VS(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return no(In)}function IS(e,t){if(e==="click")return no(t)}function XS(e,t){if(e==="input"||e==="change")return no(t)}function GS(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Kt=typeof Object.is=="function"?Object.is:GS;function Xn(e,t){if(Kt(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var i=Object.keys(e),s=Object.keys(t);if(i.length!==s.length)return!1;for(s=0;s<i.length;s++){var r=i[s];if(!Rc.call(t,r)||!Kt(e[r],t[r]))return!1}return!0}function Vd(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Id(e,t){var i=Vd(e);e=0;for(var s;i;){if(i.nodeType===3){if(s=e+i.textContent.length,e<=t&&s>=t)return{node:i,offset:t-e};e=s}e:{for(;i;){if(i.nextSibling){i=i.nextSibling;break e}i=i.parentNode}i=void 0}i=Vd(i)}}function Fp(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Fp(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Zp(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=ba(e.document);t instanceof e.HTMLIFrameElement;){try{var i=typeof t.contentWindow.location.href=="string"}catch{i=!1}if(i)e=t.contentWindow;else break;t=ba(e.document)}return t}function bu(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}var $S=Pi&&"documentMode"in document&&11>=document.documentMode,gr=null,Hc=null,Rn=null,Uc=!1;function Xd(e,t,i){var s=i.window===i?i.document:i.nodeType===9?i:i.ownerDocument;Uc||gr==null||gr!==ba(s)||(s=gr,"selectionStart"in s&&bu(s)?s={start:s.selectionStart,end:s.selectionEnd}:(s=(s.ownerDocument&&s.ownerDocument.defaultView||window).getSelection(),s={anchorNode:s.anchorNode,anchorOffset:s.anchorOffset,focusNode:s.focusNode,focusOffset:s.focusOffset}),Rn&&Xn(Rn,s)||(Rn=s,s=Ua(Hc,"onSelect"),0<s.length&&(t=new so("onSelect","select",null,t,i),e.push({event:t,listeners:s}),t.target=gr)))}function Ds(e,t){var i={};return i[e.toLowerCase()]=t.toLowerCase(),i["Webkit"+e]="webkit"+t,i["Moz"+e]="moz"+t,i}var vr={animationend:Ds("Animation","AnimationEnd"),animationiteration:Ds("Animation","AnimationIteration"),animationstart:Ds("Animation","AnimationStart"),transitionrun:Ds("Transition","TransitionRun"),transitionstart:Ds("Transition","TransitionStart"),transitioncancel:Ds("Transition","TransitionCancel"),transitionend:Ds("Transition","TransitionEnd")},zo={},Qp={};Pi&&(Qp=document.createElement("div").style,"AnimationEvent"in window||(delete vr.animationend.animation,delete vr.animationiteration.animation,delete vr.animationstart.animation),"TransitionEvent"in window||delete vr.transitionend.transition);function Qs(e){if(zo[e])return zo[e];if(!vr[e])return e;var t=vr[e],i;for(i in t)if(t.hasOwnProperty(i)&&i in Qp)return zo[e]=t[i];return e}var Jp=Qs("animationend"),em=Qs("animationiteration"),tm=Qs("animationstart"),FS=Qs("transitionrun"),ZS=Qs("transitionstart"),QS=Qs("transitioncancel"),im=Qs("transitionend"),sm=new Map,qc="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(" ");qc.push("scrollEnd");function ui(e,t){sm.set(e,t),Fs(t,[e])}var Ca=typeof reportError=="function"?reportError:function(e){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var t=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof e=="object"&&e!==null&&typeof e.message=="string"?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",e);return}console.error(e)},Gt=[],Sr=0,Cu=0;function lo(){for(var e=Sr,t=Cu=Sr=0;t<e;){var i=Gt[t];Gt[t++]=null;var s=Gt[t];Gt[t++]=null;var r=Gt[t];Gt[t++]=null;var n=Gt[t];if(Gt[t++]=null,s!==null&&r!==null){var l=s.pending;l===null?r.next=r:(r.next=l.next,l.next=r),s.pending=r}n!==0&&rm(i,r,n)}}function ao(e,t,i,s){Gt[Sr++]=e,Gt[Sr++]=t,Gt[Sr++]=i,Gt[Sr++]=s,Cu|=s,e.lanes|=s,e=e.alternate,e!==null&&(e.lanes|=s)}function wu(e,t,i,s){return ao(e,t,i,s),wa(e)}function Js(e,t){return ao(e,null,null,t),wa(e)}function rm(e,t,i){e.lanes|=i;var s=e.alternate;s!==null&&(s.lanes|=i);for(var r=!1,n=e.return;n!==null;)n.childLanes|=i,s=n.alternate,s!==null&&(s.childLanes|=i),n.tag===22&&(e=n.stateNode,e===null||e._visibility&1||(r=!0)),e=n,n=n.return;return e.tag===3?(n=e.stateNode,r&&t!==null&&(r=31-qt(i),e=n.hiddenUpdates,s=e[r],s===null?e[r]=[t]:s.push(t),t.lane=i|536870912),n):null}function wa(e){if(50<qn)throw qn=0,ah=null,Error(M(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var yr={};function JS(e,t,i,s){this.tag=e,this.key=i,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=s,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function zt(e,t,i,s){return new JS(e,t,i,s)}function xu(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Hi(e,t){var i=e.alternate;return i===null?(i=zt(e.tag,t,e.key,e.mode),i.elementType=e.elementType,i.type=e.type,i.stateNode=e.stateNode,i.alternate=e,e.alternate=i):(i.pendingProps=t,i.type=e.type,i.flags=0,i.subtreeFlags=0,i.deletions=null),i.flags=e.flags&65011712,i.childLanes=e.childLanes,i.lanes=e.lanes,i.child=e.child,i.memoizedProps=e.memoizedProps,i.memoizedState=e.memoizedState,i.updateQueue=e.updateQueue,t=e.dependencies,i.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},i.sibling=e.sibling,i.index=e.index,i.ref=e.ref,i.refCleanup=e.refCleanup,i}function nm(e,t){e.flags&=65011714;var i=e.alternate;return i===null?(e.childLanes=0,e.lanes=t,e.child=null,e.subtreeFlags=0,e.memoizedProps=null,e.memoizedState=null,e.updateQueue=null,e.dependencies=null,e.stateNode=null):(e.childLanes=i.childLanes,e.lanes=i.lanes,e.child=i.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=i.memoizedProps,e.memoizedState=i.memoizedState,e.updateQueue=i.updateQueue,e.type=i.type,t=i.dependencies,e.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),e}function Zl(e,t,i,s,r,n){var l=0;if(s=e,typeof e=="function")xu(e)&&(l=1);else if(typeof e=="string")l=ry(e,i,yi.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case Tc:return e=zt(31,i,t,r),e.elementType=Tc,e.lanes=n,e;case dr:return Hs(i.children,r,n,t);case xp:l=8,r|=24;break;case xc:return e=zt(12,i,t,r|2),e.elementType=xc,e.lanes=n,e;case Ec:return e=zt(13,i,t,r),e.elementType=Ec,e.lanes=n,e;case kc:return e=zt(19,i,t,r),e.elementType=kc,e.lanes=n,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case Oi:l=10;break e;case Ep:l=9;break e;case hu:l=11;break e;case uu:l=14;break e;case Ji:l=16,s=null;break e}l=29,i=Error(M(130,e===null?"null":typeof e,"")),s=null}return t=zt(l,i,t,r),t.elementType=e,t.type=s,t.lanes=n,t}function Hs(e,t,i,s){return e=zt(7,e,s,t),e.lanes=i,e}function jo(e,t,i){return e=zt(6,e,null,t),e.lanes=i,e}function lm(e){var t=zt(18,null,null,0);return t.stateNode=e,t}function Ho(e,t,i){return t=zt(4,e.children!==null?e.children:[],e.key,t),t.lanes=i,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var Gd=new WeakMap;function ei(e,t){if(typeof e=="object"&&e!==null){var i=Gd.get(e);return i!==void 0?i:(t={value:e,source:t,stack:Dd(t)},Gd.set(e,t),t)}return{value:e,source:t,stack:Dd(t)}}var br=[],Cr=0,xa=null,Gn=0,Zt=[],Qt=0,Cs=null,mi=1,gi="";function Ai(e,t){br[Cr++]=Gn,br[Cr++]=xa,xa=e,Gn=t}function am(e,t,i){Zt[Qt++]=mi,Zt[Qt++]=gi,Zt[Qt++]=Cs,Cs=e;var s=mi;e=gi;var r=32-qt(s)-1;s&=~(1<<r),i+=1;var n=32-qt(t)+r;if(30<n){var l=r-r%5;n=(s&(1<<l)-1).toString(32),s>>=l,r-=l,mi=1<<32-qt(t)+r|i<<r|s,gi=n+e}else mi=1<<n|i<<r|s,gi=e}function Eu(e){e.return!==null&&(Ai(e,1),am(e,1,0))}function ku(e){for(;e===xa;)xa=br[--Cr],br[Cr]=null,Gn=br[--Cr],br[Cr]=null;for(;e===Cs;)Cs=Zt[--Qt],Zt[Qt]=null,gi=Zt[--Qt],Zt[Qt]=null,mi=Zt[--Qt],Zt[Qt]=null}function om(e,t){Zt[Qt++]=mi,Zt[Qt++]=gi,Zt[Qt++]=Cs,mi=t.id,gi=t.overflow,Cs=e}var ct=null,ye=null,ae=!1,fs=null,ti=!1,Pc=Error(M(519));function ws(e){var t=Error(M(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw $n(ei(t,e)),Pc}function $d(e){var t=e.stateNode,i=e.type,s=e.memoizedProps;switch(t[ot]=e,t[Mt]=s,i){case"dialog":re("cancel",t),re("close",t);break;case"iframe":case"object":case"embed":re("load",t);break;case"video":case"audio":for(i=0;i<Jn.length;i++)re(Jn[i],t);break;case"source":re("error",t);break;case"img":case"image":case"link":re("error",t),re("load",t);break;case"details":re("toggle",t);break;case"input":re("invalid",t),Hp(t,s.value,s.defaultValue,s.checked,s.defaultChecked,s.type,s.name,!0);break;case"select":re("invalid",t);break;case"textarea":re("invalid",t),qp(t,s.value,s.defaultValue,s.children)}i=s.children,typeof i!="string"&&typeof i!="number"&&typeof i!="bigint"||t.textContent===""+i||s.suppressHydrationWarning===!0||Yg(t.textContent,i)?(s.popover!=null&&(re("beforetoggle",t),re("toggle",t)),s.onScroll!=null&&re("scroll",t),s.onScrollEnd!=null&&re("scrollend",t),s.onClick!=null&&(t.onclick=Li),t=!0):t=!1,t||ws(e,!0)}function Fd(e){for(ct=e.return;ct;)switch(ct.tag){case 5:case 31:case 13:ti=!1;return;case 27:case 3:ti=!0;return;default:ct=ct.return}}function rr(e){if(e!==ct)return!1;if(!ae)return Fd(e),ae=!0,!1;var t=e.tag,i;if((i=t!==3&&t!==27)&&((i=t===5)&&(i=e.type,i=!(i!=="form"&&i!=="button")||dh(e.type,e.memoizedProps)),i=!i),i&&ye&&ws(e),Fd(e),t===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(M(317));ye=jf(e)}else if(t===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(M(317));ye=jf(e)}else t===27?(t=ye,Ts(e.type)?(e=mh,mh=null,ye=e):ye=t):ye=ct?si(e.stateNode.nextSibling):null;return!0}function Ws(){ye=ct=null,ae=!1}function Uo(){var e=fs;return e!==null&&(Tt===null?Tt=e:Tt.push.apply(Tt,e),fs=null),e}function $n(e){fs===null?fs=[e]:fs.push(e)}var Kc=wi(null),er=null,zi=null;function is(e,t,i){ge(Kc,t._currentValue),t._currentValue=i}function Ui(e){e._currentValue=Kc.current,st(Kc)}function Wc(e,t,i){for(;e!==null;){var s=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,s!==null&&(s.childLanes|=t)):s!==null&&(s.childLanes&t)!==t&&(s.childLanes|=t),e===i)break;e=e.return}}function Yc(e,t,i,s){var r=e.child;for(r!==null&&(r.return=e);r!==null;){var n=r.dependencies;if(n!==null){var l=r.child;n=n.firstContext;e:for(;n!==null;){var a=n;n=r;for(var o=0;o<t.length;o++)if(a.context===t[o]){n.lanes|=i,a=n.alternate,a!==null&&(a.lanes|=i),Wc(n.return,i,e),s||(l=null);break e}n=a.next}}else if(r.tag===18){if(l=r.return,l===null)throw Error(M(341));l.lanes|=i,n=l.alternate,n!==null&&(n.lanes|=i),Wc(l,i,e),l=null}else l=r.child;if(l!==null)l.return=r;else for(l=r;l!==null;){if(l===e){l=null;break}if(r=l.sibling,r!==null){r.return=l.return,l=r;break}l=l.return}r=l}}function Gr(e,t,i,s){e=null;for(var r=t,n=!1;r!==null;){if(!n){if(r.flags&524288)n=!0;else if(r.flags&262144)break}if(r.tag===10){var l=r.alternate;if(l===null)throw Error(M(387));if(l=l.memoizedProps,l!==null){var a=r.type;Kt(r.pendingProps.value,l.value)||(e!==null?e.push(a):e=[a])}}else if(r===ga.current){if(l=r.alternate,l===null)throw Error(M(387));l.memoizedState.memoizedState!==r.memoizedState.memoizedState&&(e!==null?e.push(tl):e=[tl])}r=r.return}e!==null&&Yc(t,e,i,s),t.flags|=262144}function Ea(e){for(e=e.firstContext;e!==null;){if(!Kt(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function Ys(e){er=e,zi=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function ut(e){return cm(er,e)}function Rl(e,t){return er===null&&Ys(e),cm(e,t)}function cm(e,t){var i=t._currentValue;if(t={context:t,memoizedValue:i,next:null},zi===null){if(e===null)throw Error(M(308));zi=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else zi=zi.next=t;return i}var e1=typeof AbortController<"u"?AbortController:function(){var e=[],t=this.signal={aborted:!1,addEventListener:function(i,s){e.push(s)}};this.abort=function(){t.aborted=!0,e.forEach(function(i){return i()})}},t1=Xe.unstable_scheduleCallback,i1=Xe.unstable_NormalPriority,Ue={$$typeof:Oi,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Tu(){return{controller:new e1,data:new Map,refCount:0}}function fl(e){e.refCount--,e.refCount===0&&t1(i1,function(){e.controller.abort()})}var An=null,Vc=0,zr=0,Dr=null;function s1(e,t){if(An===null){var i=An=[];Vc=0,zr=Qu(),Dr={status:"pending",value:void 0,then:function(s){i.push(s)}}}return Vc++,t.then(Zd,Zd),t}function Zd(){if(--Vc===0&&An!==null){Dr!==null&&(Dr.status="fulfilled");var e=An;An=null,zr=0,Dr=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function r1(e,t){var i=[],s={status:"pending",value:null,reason:null,then:function(r){i.push(r)}};return e.then(function(){s.status="fulfilled",s.value=t;for(var r=0;r<i.length;r++)(0,i[r])(t)},function(r){for(s.status="rejected",s.reason=r,r=0;r<i.length;r++)(0,i[r])(void 0)}),s}var Qd=X.S;X.S=function(e,t){wg=Ht(),typeof t=="object"&&t!==null&&typeof t.then=="function"&&s1(e,t),Qd!==null&&Qd(e,t)};var Us=wi(null);function Du(){var e=Us.current;return e!==null?e:me.pooledCache}function Ql(e,t){t===null?ge(Us,Us.current):ge(Us,t.pool)}function hm(){var e=Du();return e===null?null:{parent:Ue._currentValue,pool:e}}var $r=Error(M(460)),Mu=Error(M(474)),oo=Error(M(542)),ka={then:function(){}};function Jd(e){return e=e.status,e==="fulfilled"||e==="rejected"}function um(e,t,i){switch(i=e[i],i===void 0?e.push(t):i!==t&&(t.then(Li,Li),t=i),t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,tf(e),e;default:if(typeof t.status=="string")t.then(Li,Li);else{if(e=me,e!==null&&100<e.shellSuspendCounter)throw Error(M(482));e=t,e.status="pending",e.then(function(s){if(t.status==="pending"){var r=t;r.status="fulfilled",r.value=s}},function(s){if(t.status==="pending"){var r=t;r.status="rejected",r.reason=s}})}switch(t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,tf(e),e}throw qs=t,$r}}function As(e){try{var t=e._init;return t(e._payload)}catch(i){throw i!==null&&typeof i=="object"&&typeof i.then=="function"?(qs=i,$r):i}}var qs=null;function ef(){if(qs===null)throw Error(M(459));var e=qs;return qs=null,e}function tf(e){if(e===$r||e===oo)throw Error(M(483))}var Mr=null,Fn=0;function Al(e){var t=Fn;return Fn+=1,Mr===null&&(Mr=[]),um(Mr,e,t)}function an(e,t){t=t.props.ref,e.ref=t!==void 0?t:null}function Nl(e,t){throw t.$$typeof===Y0?Error(M(525)):(e=Object.prototype.toString.call(t),Error(M(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e)))}function dm(e){function t(m,p){if(e){var v=m.deletions;v===null?(m.deletions=[p],m.flags|=16):v.push(p)}}function i(m,p){if(!e)return null;for(;p!==null;)t(m,p),p=p.sibling;return null}function s(m){for(var p=new Map;m!==null;)m.key!==null?p.set(m.key,m):p.set(m.index,m),m=m.sibling;return p}function r(m,p){return m=Hi(m,p),m.index=0,m.sibling=null,m}function n(m,p,v){return m.index=v,e?(v=m.alternate,v!==null?(v=v.index,v<p?(m.flags|=67108866,p):v):(m.flags|=67108866,p)):(m.flags|=1048576,p)}function l(m){return e&&m.alternate===null&&(m.flags|=67108866),m}function a(m,p,v,S){return p===null||p.tag!==6?(p=jo(v,m.mode,S),p.return=m,p):(p=r(p,v),p.return=m,p)}function o(m,p,v,S){var k=v.type;return k===dr?_(m,p,v.props.children,S,v.key):p!==null&&(p.elementType===k||typeof k=="object"&&k!==null&&k.$$typeof===Ji&&As(k)===p.type)?(p=r(p,v.props),an(p,v),p.return=m,p):(p=Zl(v.type,v.key,v.props,null,m.mode,S),an(p,v),p.return=m,p)}function c(m,p,v,S){return p===null||p.tag!==4||p.stateNode.containerInfo!==v.containerInfo||p.stateNode.implementation!==v.implementation?(p=Ho(v,m.mode,S),p.return=m,p):(p=r(p,v.children||[]),p.return=m,p)}function _(m,p,v,S,k){return p===null||p.tag!==7?(p=Hs(v,m.mode,S,k),p.return=m,p):(p=r(p,v),p.return=m,p)}function f(m,p,v){if(typeof p=="string"&&p!==""||typeof p=="number"||typeof p=="bigint")return p=jo(""+p,m.mode,v),p.return=m,p;if(typeof p=="object"&&p!==null){switch(p.$$typeof){case El:return v=Zl(p.type,p.key,p.props,null,m.mode,v),an(v,p),v.return=m,v;case vn:return p=Ho(p,m.mode,v),p.return=m,p;case Ji:return p=As(p),f(m,p,v)}if(Sn(p)||rn(p))return p=Hs(p,m.mode,v,null),p.return=m,p;if(typeof p.then=="function")return f(m,Al(p),v);if(p.$$typeof===Oi)return f(m,Rl(m,p),v);Nl(m,p)}return null}function u(m,p,v,S){var k=p!==null?p.key:null;if(typeof v=="string"&&v!==""||typeof v=="number"||typeof v=="bigint")return k!==null?null:a(m,p,""+v,S);if(typeof v=="object"&&v!==null){switch(v.$$typeof){case El:return v.key===k?o(m,p,v,S):null;case vn:return v.key===k?c(m,p,v,S):null;case Ji:return v=As(v),u(m,p,v,S)}if(Sn(v)||rn(v))return k!==null?null:_(m,p,v,S,null);if(typeof v.then=="function")return u(m,p,Al(v),S);if(v.$$typeof===Oi)return u(m,p,Rl(m,v),S);Nl(m,v)}return null}function d(m,p,v,S,k){if(typeof S=="string"&&S!==""||typeof S=="number"||typeof S=="bigint")return m=m.get(v)||null,a(p,m,""+S,k);if(typeof S=="object"&&S!==null){switch(S.$$typeof){case El:return m=m.get(S.key===null?v:S.key)||null,o(p,m,S,k);case vn:return m=m.get(S.key===null?v:S.key)||null,c(p,m,S,k);case Ji:return S=As(S),d(m,p,v,S,k)}if(Sn(S)||rn(S))return m=m.get(v)||null,_(p,m,S,k,null);if(typeof S.then=="function")return d(m,p,v,Al(S),k);if(S.$$typeof===Oi)return d(m,p,v,Rl(p,S),k);Nl(p,S)}return null}function g(m,p,v,S){for(var k=null,j=null,O=p,q=p=0,W=null;O!==null&&q<v.length;q++){O.index>q?(W=O,O=null):W=O.sibling;var V=u(m,O,v[q],S);if(V===null){O===null&&(O=W);break}e&&O&&V.alternate===null&&t(m,O),p=n(V,p,q),j===null?k=V:j.sibling=V,j=V,O=W}if(q===v.length)return i(m,O),ae&&Ai(m,q),k;if(O===null){for(;q<v.length;q++)O=f(m,v[q],S),O!==null&&(p=n(O,p,q),j===null?k=O:j.sibling=O,j=O);return ae&&Ai(m,q),k}for(O=s(O);q<v.length;q++)W=d(O,m,q,v[q],S),W!==null&&(e&&W.alternate!==null&&O.delete(W.key===null?q:W.key),p=n(W,p,q),j===null?k=W:j.sibling=W,j=W);return e&&O.forEach(function(A){return t(m,A)}),ae&&Ai(m,q),k}function y(m,p,v,S){if(v==null)throw Error(M(151));for(var k=null,j=null,O=p,q=p=0,W=null,V=v.next();O!==null&&!V.done;q++,V=v.next()){O.index>q?(W=O,O=null):W=O.sibling;var A=u(m,O,V.value,S);if(A===null){O===null&&(O=W);break}e&&O&&A.alternate===null&&t(m,O),p=n(A,p,q),j===null?k=A:j.sibling=A,j=A,O=W}if(V.done)return i(m,O),ae&&Ai(m,q),k;if(O===null){for(;!V.done;q++,V=v.next())V=f(m,V.value,S),V!==null&&(p=n(V,p,q),j===null?k=V:j.sibling=V,j=V);return ae&&Ai(m,q),k}for(O=s(O);!V.done;q++,V=v.next())V=d(O,m,q,V.value,S),V!==null&&(e&&V.alternate!==null&&O.delete(V.key===null?q:V.key),p=n(V,p,q),j===null?k=V:j.sibling=V,j=V);return e&&O.forEach(function(w){return t(m,w)}),ae&&Ai(m,q),k}function C(m,p,v,S){if(typeof v=="object"&&v!==null&&v.type===dr&&v.key===null&&(v=v.props.children),typeof v=="object"&&v!==null){switch(v.$$typeof){case El:e:{for(var k=v.key;p!==null;){if(p.key===k){if(k=v.type,k===dr){if(p.tag===7){i(m,p.sibling),S=r(p,v.props.children),S.return=m,m=S;break e}}else if(p.elementType===k||typeof k=="object"&&k!==null&&k.$$typeof===Ji&&As(k)===p.type){i(m,p.sibling),S=r(p,v.props),an(S,v),S.return=m,m=S;break e}i(m,p);break}else t(m,p);p=p.sibling}v.type===dr?(S=Hs(v.props.children,m.mode,S,v.key),S.return=m,m=S):(S=Zl(v.type,v.key,v.props,null,m.mode,S),an(S,v),S.return=m,m=S)}return l(m);case vn:e:{for(k=v.key;p!==null;){if(p.key===k)if(p.tag===4&&p.stateNode.containerInfo===v.containerInfo&&p.stateNode.implementation===v.implementation){i(m,p.sibling),S=r(p,v.children||[]),S.return=m,m=S;break e}else{i(m,p);break}else t(m,p);p=p.sibling}S=Ho(v,m.mode,S),S.return=m,m=S}return l(m);case Ji:return v=As(v),C(m,p,v,S)}if(Sn(v))return g(m,p,v,S);if(rn(v)){if(k=rn(v),typeof k!="function")throw Error(M(150));return v=k.call(v),y(m,p,v,S)}if(typeof v.then=="function")return C(m,p,Al(v),S);if(v.$$typeof===Oi)return C(m,p,Rl(m,v),S);Nl(m,v)}return typeof v=="string"&&v!==""||typeof v=="number"||typeof v=="bigint"?(v=""+v,p!==null&&p.tag===6?(i(m,p.sibling),S=r(p,v),S.return=m,m=S):(i(m,p),S=jo(v,m.mode,S),S.return=m,m=S),l(m)):i(m,p)}return function(m,p,v,S){try{Fn=0;var k=C(m,p,v,S);return Mr=null,k}catch(O){if(O===$r||O===oo)throw O;var j=zt(29,O,null,m.mode);return j.lanes=S,j.return=m,j}finally{}}}var Vs=dm(!0),fm=dm(!1),es=!1;function Bu(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Ic(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function _s(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function ps(e,t,i){var s=e.updateQueue;if(s===null)return null;if(s=s.shared,ce&2){var r=s.pending;return r===null?t.next=t:(t.next=r.next,r.next=t),s.pending=t,t=wa(e),rm(e,null,i),t}return ao(e,s,t,i),wa(e)}function Nn(e,t,i){if(t=t.updateQueue,t!==null&&(t=t.shared,(i&4194048)!==0)){var s=t.lanes;s&=e.pendingLanes,i|=s,t.lanes=i,Rp(e,i)}}function qo(e,t){var i=e.updateQueue,s=e.alternate;if(s!==null&&(s=s.updateQueue,i===s)){var r=null,n=null;if(i=i.firstBaseUpdate,i!==null){do{var l={lane:i.lane,tag:i.tag,payload:i.payload,callback:null,next:null};n===null?r=n=l:n=n.next=l,i=i.next}while(i!==null);n===null?r=n=t:n=n.next=t}else r=n=t;i={baseState:s.baseState,firstBaseUpdate:r,lastBaseUpdate:n,shared:s.shared,callbacks:s.callbacks},e.updateQueue=i;return}e=i.lastBaseUpdate,e===null?i.firstBaseUpdate=t:e.next=t,i.lastBaseUpdate=t}var Xc=!1;function On(){if(Xc){var e=Dr;if(e!==null)throw e}}function Ln(e,t,i,s){Xc=!1;var r=e.updateQueue;es=!1;var n=r.firstBaseUpdate,l=r.lastBaseUpdate,a=r.shared.pending;if(a!==null){r.shared.pending=null;var o=a,c=o.next;o.next=null,l===null?n=c:l.next=c,l=o;var _=e.alternate;_!==null&&(_=_.updateQueue,a=_.lastBaseUpdate,a!==l&&(a===null?_.firstBaseUpdate=c:a.next=c,_.lastBaseUpdate=o))}if(n!==null){var f=r.baseState;l=0,_=c=o=null,a=n;do{var u=a.lane&-536870913,d=u!==a.lane;if(d?(le&u)===u:(s&u)===u){u!==0&&u===zr&&(Xc=!0),_!==null&&(_=_.next={lane:0,tag:a.tag,payload:a.payload,callback:null,next:null});e:{var g=e,y=a;u=t;var C=i;switch(y.tag){case 1:if(g=y.payload,typeof g=="function"){f=g.call(C,f,u);break e}f=g;break e;case 3:g.flags=g.flags&-65537|128;case 0:if(g=y.payload,u=typeof g=="function"?g.call(C,f,u):g,u==null)break e;f=Ce({},f,u);break e;case 2:es=!0}}u=a.callback,u!==null&&(e.flags|=64,d&&(e.flags|=8192),d=r.callbacks,d===null?r.callbacks=[u]:d.push(u))}else d={lane:u,tag:a.tag,payload:a.payload,callback:a.callback,next:null},_===null?(c=_=d,o=f):_=_.next=d,l|=u;if(a=a.next,a===null){if(a=r.shared.pending,a===null)break;d=a,a=d.next,d.next=null,r.lastBaseUpdate=d,r.shared.pending=null}}while(!0);_===null&&(o=f),r.baseState=o,r.firstBaseUpdate=c,r.lastBaseUpdate=_,n===null&&(r.shared.lanes=0),Es|=l,e.lanes=l,e.memoizedState=f}}function _m(e,t){if(typeof e!="function")throw Error(M(191,e));e.call(t)}function pm(e,t){var i=e.callbacks;if(i!==null)for(e.callbacks=null,e=0;e<i.length;e++)_m(i[e],t)}var jr=wi(null),Ta=wi(0);function sf(e,t){e=Vi,ge(Ta,e),ge(jr,t),Vi=e|t.baseLanes}function Gc(){ge(Ta,Vi),ge(jr,jr.current)}function Ru(){Vi=Ta.current,st(jr),st(Ta)}var Wt=wi(null),ii=null;function ss(e){var t=e.alternate;ge(Oe,Oe.current&1),ge(Wt,e),ii===null&&(t===null||jr.current!==null||t.memoizedState!==null)&&(ii=e)}function $c(e){ge(Oe,Oe.current),ge(Wt,e),ii===null&&(ii=e)}function mm(e){e.tag===22?(ge(Oe,Oe.current),ge(Wt,e),ii===null&&(ii=e)):rs()}function rs(){ge(Oe,Oe.current),ge(Wt,Wt.current)}function Lt(e){st(Wt),ii===e&&(ii=null),st(Oe)}var Oe=wi(0);function Da(e){for(var t=e;t!==null;){if(t.tag===13){var i=t.memoizedState;if(i!==null&&(i=i.dehydrated,i===null||_h(i)||ph(i)))return t}else if(t.tag===19&&(t.memoizedProps.revealOrder==="forwards"||t.memoizedProps.revealOrder==="backwards"||t.memoizedProps.revealOrder==="unstable_legacy-backwards"||t.memoizedProps.revealOrder==="together")){if(t.flags&128)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var Ki=0,ee=null,pe=null,je=null,Ma=!1,Br=!1,Is=!1,Ba=0,Zn=0,Rr=null,n1=0;function Me(){throw Error(M(321))}function Au(e,t){if(t===null)return!1;for(var i=0;i<t.length&&i<e.length;i++)if(!Kt(e[i],t[i]))return!1;return!0}function Nu(e,t,i,s,r,n){return Ki=n,ee=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,X.H=e===null||e.memoizedState===null?Xm:Yu,Is=!1,n=i(s,r),Is=!1,Br&&(n=vm(t,i,s,r)),gm(e),n}function gm(e){X.H=Qn;var t=pe!==null&&pe.next!==null;if(Ki=0,je=pe=ee=null,Ma=!1,Zn=0,Rr=null,t)throw Error(M(300));e===null||Pe||(e=e.dependencies,e!==null&&Ea(e)&&(Pe=!0))}function vm(e,t,i,s){ee=e;var r=0;do{if(Br&&(Rr=null),Zn=0,Br=!1,25<=r)throw Error(M(301));if(r+=1,je=pe=null,e.updateQueue!=null){var n=e.updateQueue;n.lastEffect=null,n.events=null,n.stores=null,n.memoCache!=null&&(n.memoCache.index=0)}X.H=Gm,n=t(i,s)}while(Br);return n}function l1(){var e=X.H,t=e.useState()[0];return t=typeof t.then=="function"?_l(t):t,e=e.useState()[0],(pe!==null?pe.memoizedState:null)!==e&&(ee.flags|=1024),t}function Ou(){var e=Ba!==0;return Ba=0,e}function Lu(e,t,i){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~i}function zu(e){if(Ma){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}Ma=!1}Ki=0,je=pe=ee=null,Br=!1,Zn=Ba=0,Rr=null}function gt(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return je===null?ee.memoizedState=je=e:je=je.next=e,je}function Le(){if(pe===null){var e=ee.alternate;e=e!==null?e.memoizedState:null}else e=pe.next;var t=je===null?ee.memoizedState:je.next;if(t!==null)je=t,pe=e;else{if(e===null)throw ee.alternate===null?Error(M(467)):Error(M(310));pe=e,e={memoizedState:pe.memoizedState,baseState:pe.baseState,baseQueue:pe.baseQueue,queue:pe.queue,next:null},je===null?ee.memoizedState=je=e:je=je.next=e}return je}function co(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function _l(e){var t=Zn;return Zn+=1,Rr===null&&(Rr=[]),e=um(Rr,e,t),t=ee,(je===null?t.memoizedState:je.next)===null&&(t=t.alternate,X.H=t===null||t.memoizedState===null?Xm:Yu),e}function ho(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return _l(e);if(e.$$typeof===Oi)return ut(e)}throw Error(M(438,String(e)))}function ju(e){var t=null,i=ee.updateQueue;if(i!==null&&(t=i.memoCache),t==null){var s=ee.alternate;s!==null&&(s=s.updateQueue,s!==null&&(s=s.memoCache,s!=null&&(t={data:s.data.map(function(r){return r.slice()}),index:0})))}if(t==null&&(t={data:[],index:0}),i===null&&(i=co(),ee.updateQueue=i),i.memoCache=t,i=t.data[t.index],i===void 0)for(i=t.data[t.index]=Array(e),s=0;s<e;s++)i[s]=V0;return t.index++,i}function Wi(e,t){return typeof t=="function"?t(e):t}function Jl(e){var t=Le();return Hu(t,pe,e)}function Hu(e,t,i){var s=e.queue;if(s===null)throw Error(M(311));s.lastRenderedReducer=i;var r=e.baseQueue,n=s.pending;if(n!==null){if(r!==null){var l=r.next;r.next=n.next,n.next=l}t.baseQueue=r=n,s.pending=null}if(n=e.baseState,r===null)e.memoizedState=n;else{t=r.next;var a=l=null,o=null,c=t,_=!1;do{var f=c.lane&-536870913;if(f!==c.lane?(le&f)===f:(Ki&f)===f){var u=c.revertLane;if(u===0)o!==null&&(o=o.next={lane:0,revertLane:0,gesture:null,action:c.action,hasEagerState:c.hasEagerState,eagerState:c.eagerState,next:null}),f===zr&&(_=!0);else if((Ki&u)===u){c=c.next,u===zr&&(_=!0);continue}else f={lane:0,revertLane:c.revertLane,gesture:null,action:c.action,hasEagerState:c.hasEagerState,eagerState:c.eagerState,next:null},o===null?(a=o=f,l=n):o=o.next=f,ee.lanes|=u,Es|=u;f=c.action,Is&&i(n,f),n=c.hasEagerState?c.eagerState:i(n,f)}else u={lane:f,revertLane:c.revertLane,gesture:c.gesture,action:c.action,hasEagerState:c.hasEagerState,eagerState:c.eagerState,next:null},o===null?(a=o=u,l=n):o=o.next=u,ee.lanes|=f,Es|=f;c=c.next}while(c!==null&&c!==t);if(o===null?l=n:o.next=a,!Kt(n,e.memoizedState)&&(Pe=!0,_&&(i=Dr,i!==null)))throw i;e.memoizedState=n,e.baseState=l,e.baseQueue=o,s.lastRenderedState=n}return r===null&&(s.lanes=0),[e.memoizedState,s.dispatch]}function Po(e){var t=Le(),i=t.queue;if(i===null)throw Error(M(311));i.lastRenderedReducer=e;var s=i.dispatch,r=i.pending,n=t.memoizedState;if(r!==null){i.pending=null;var l=r=r.next;do n=e(n,l.action),l=l.next;while(l!==r);Kt(n,t.memoizedState)||(Pe=!0),t.memoizedState=n,t.baseQueue===null&&(t.baseState=n),i.lastRenderedState=n}return[n,s]}function Sm(e,t,i){var s=ee,r=Le(),n=ae;if(n){if(i===void 0)throw Error(M(407));i=i()}else i=t();var l=!Kt((pe||r).memoizedState,i);if(l&&(r.memoizedState=i,Pe=!0),r=r.queue,Uu(Cm.bind(null,s,r,e),[e]),r.getSnapshot!==t||l||je!==null&&je.memoizedState.tag&1){if(s.flags|=2048,Hr(9,{destroy:void 0},bm.bind(null,s,r,i,t),null),me===null)throw Error(M(349));n||Ki&127||ym(s,t,i)}return i}function ym(e,t,i){e.flags|=16384,e={getSnapshot:t,value:i},t=ee.updateQueue,t===null?(t=co(),ee.updateQueue=t,t.stores=[e]):(i=t.stores,i===null?t.stores=[e]:i.push(e))}function bm(e,t,i,s){t.value=i,t.getSnapshot=s,wm(t)&&xm(e)}function Cm(e,t,i){return i(function(){wm(t)&&xm(e)})}function wm(e){var t=e.getSnapshot;e=e.value;try{var i=t();return!Kt(e,i)}catch{return!0}}function xm(e){var t=Js(e,2);t!==null&&Dt(t,e,2)}function Fc(e){var t=gt();if(typeof e=="function"){var i=e;if(e=i(),Is){ls(!0);try{i()}finally{ls(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Wi,lastRenderedState:e},t}function Em(e,t,i,s){return e.baseState=i,Hu(e,pe,typeof s=="function"?s:Wi)}function a1(e,t,i,s,r){if(fo(e))throw Error(M(485));if(e=t.action,e!==null){var n={payload:r,action:e,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(l){n.listeners.push(l)}};X.T!==null?i(!0):n.isTransition=!1,s(n),i=t.pending,i===null?(n.next=t.pending=n,km(t,n)):(n.next=i.next,t.pending=i.next=n)}}function km(e,t){var i=t.action,s=t.payload,r=e.state;if(t.isTransition){var n=X.T,l={};X.T=l;try{var a=i(r,s),o=X.S;o!==null&&o(l,a),rf(e,t,a)}catch(c){Zc(e,t,c)}finally{n!==null&&l.types!==null&&(n.types=l.types),X.T=n}}else try{n=i(r,s),rf(e,t,n)}catch(c){Zc(e,t,c)}}function rf(e,t,i){i!==null&&typeof i=="object"&&typeof i.then=="function"?i.then(function(s){nf(e,t,s)},function(s){return Zc(e,t,s)}):nf(e,t,i)}function nf(e,t,i){t.status="fulfilled",t.value=i,Tm(t),e.state=i,t=e.pending,t!==null&&(i=t.next,i===t?e.pending=null:(i=i.next,t.next=i,km(e,i)))}function Zc(e,t,i){var s=e.pending;if(e.pending=null,s!==null){s=s.next;do t.status="rejected",t.reason=i,Tm(t),t=t.next;while(t!==s)}e.action=null}function Tm(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function Dm(e,t){return t}function lf(e,t){if(ae){var i=me.formState;if(i!==null){e:{var s=ee;if(ae){if(ye){t:{for(var r=ye,n=ti;r.nodeType!==8;){if(!n){r=null;break t}if(r=si(r.nextSibling),r===null){r=null;break t}}n=r.data,r=n==="F!"||n==="F"?r:null}if(r){ye=si(r.nextSibling),s=r.data==="F!";break e}}ws(s)}s=!1}s&&(t=i[0])}}return i=gt(),i.memoizedState=i.baseState=t,s={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Dm,lastRenderedState:t},i.queue=s,i=Ym.bind(null,ee,s),s.dispatch=i,s=Fc(!1),n=Wu.bind(null,ee,!1,s.queue),s=gt(),r={state:t,dispatch:null,action:e,pending:null},s.queue=r,i=a1.bind(null,ee,r,n,i),r.dispatch=i,s.memoizedState=e,[t,i,!1]}function af(e){var t=Le();return Mm(t,pe,e)}function Mm(e,t,i){if(t=Hu(e,t,Dm)[0],e=Jl(Wi)[0],typeof t=="object"&&t!==null&&typeof t.then=="function")try{var s=_l(t)}catch(l){throw l===$r?oo:l}else s=t;t=Le();var r=t.queue,n=r.dispatch;return i!==t.memoizedState&&(ee.flags|=2048,Hr(9,{destroy:void 0},o1.bind(null,r,i),null)),[s,n,e]}function o1(e,t){e.action=t}function of(e){var t=Le(),i=pe;if(i!==null)return Mm(t,i,e);Le(),t=t.memoizedState,i=Le();var s=i.queue.dispatch;return i.memoizedState=e,[t,s,!1]}function Hr(e,t,i,s){return e={tag:e,create:i,deps:s,inst:t,next:null},t=ee.updateQueue,t===null&&(t=co(),ee.updateQueue=t),i=t.lastEffect,i===null?t.lastEffect=e.next=e:(s=i.next,i.next=e,e.next=s,t.lastEffect=e),e}function Bm(){return Le().memoizedState}function ea(e,t,i,s){var r=gt();ee.flags|=e,r.memoizedState=Hr(1|t,{destroy:void 0},i,s===void 0?null:s)}function uo(e,t,i,s){var r=Le();s=s===void 0?null:s;var n=r.memoizedState.inst;pe!==null&&s!==null&&Au(s,pe.memoizedState.deps)?r.memoizedState=Hr(t,n,i,s):(ee.flags|=e,r.memoizedState=Hr(1|t,n,i,s))}function cf(e,t){ea(8390656,8,e,t)}function Uu(e,t){uo(2048,8,e,t)}function c1(e){ee.flags|=4;var t=ee.updateQueue;if(t===null)t=co(),ee.updateQueue=t,t.events=[e];else{var i=t.events;i===null?t.events=[e]:i.push(e)}}function Rm(e){var t=Le().memoizedState;return c1({ref:t,nextImpl:e}),function(){if(ce&2)throw Error(M(440));return t.impl.apply(void 0,arguments)}}function Am(e,t){return uo(4,2,e,t)}function Nm(e,t){return uo(4,4,e,t)}function Om(e,t){if(typeof t=="function"){e=e();var i=t(e);return function(){typeof i=="function"?i():t(null)}}if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function Lm(e,t,i){i=i!=null?i.concat([e]):null,uo(4,4,Om.bind(null,t,e),i)}function qu(){}function zm(e,t){var i=Le();t=t===void 0?null:t;var s=i.memoizedState;return t!==null&&Au(t,s[1])?s[0]:(i.memoizedState=[e,t],e)}function jm(e,t){var i=Le();t=t===void 0?null:t;var s=i.memoizedState;if(t!==null&&Au(t,s[1]))return s[0];if(s=e(),Is){ls(!0);try{e()}finally{ls(!1)}}return i.memoizedState=[s,t],s}function Pu(e,t,i){return i===void 0||Ki&1073741824&&!(le&261930)?e.memoizedState=t:(e.memoizedState=i,e=Eg(),ee.lanes|=e,Es|=e,i)}function Hm(e,t,i,s){return Kt(i,t)?i:jr.current!==null?(e=Pu(e,i,s),Kt(e,t)||(Pe=!0),e):!(Ki&42)||Ki&1073741824&&!(le&261930)?(Pe=!0,e.memoizedState=i):(e=Eg(),ee.lanes|=e,Es|=e,t)}function Um(e,t,i,s,r){var n=he.p;he.p=n!==0&&8>n?n:8;var l=X.T,a={};X.T=a,Wu(e,!1,t,i);try{var o=r(),c=X.S;if(c!==null&&c(a,o),o!==null&&typeof o=="object"&&typeof o.then=="function"){var _=r1(o,s);zn(e,t,_,Pt(e))}else zn(e,t,s,Pt(e))}catch(f){zn(e,t,{then:function(){},status:"rejected",reason:f},Pt())}finally{he.p=n,l!==null&&a.types!==null&&(l.types=a.types),X.T=l}}function h1(){}function Qc(e,t,i,s){if(e.tag!==5)throw Error(M(476));var r=qm(e).queue;Um(e,r,t,js,i===null?h1:function(){return Pm(e),i(s)})}function qm(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:js,baseState:js,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Wi,lastRenderedState:js},next:null};var i={};return t.next={memoizedState:i,baseState:i,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Wi,lastRenderedState:i},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function Pm(e){var t=qm(e);t.next===null&&(t=e.alternate.memoizedState),zn(e,t.next.queue,{},Pt())}function Ku(){return ut(tl)}function Km(){return Le().memoizedState}function Wm(){return Le().memoizedState}function u1(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var i=Pt();e=_s(i);var s=ps(t,e,i);s!==null&&(Dt(s,t,i),Nn(s,t,i)),t={cache:Tu()},e.payload=t;return}t=t.return}}function d1(e,t,i){var s=Pt();i={lane:s,revertLane:0,gesture:null,action:i,hasEagerState:!1,eagerState:null,next:null},fo(e)?Vm(t,i):(i=wu(e,t,i,s),i!==null&&(Dt(i,e,s),Im(i,t,s)))}function Ym(e,t,i){var s=Pt();zn(e,t,i,s)}function zn(e,t,i,s){var r={lane:s,revertLane:0,gesture:null,action:i,hasEagerState:!1,eagerState:null,next:null};if(fo(e))Vm(t,r);else{var n=e.alternate;if(e.lanes===0&&(n===null||n.lanes===0)&&(n=t.lastRenderedReducer,n!==null))try{var l=t.lastRenderedState,a=n(l,i);if(r.hasEagerState=!0,r.eagerState=a,Kt(a,l))return ao(e,t,r,0),me===null&&lo(),!1}catch{}finally{}if(i=wu(e,t,r,s),i!==null)return Dt(i,e,s),Im(i,t,s),!0}return!1}function Wu(e,t,i,s){if(s={lane:2,revertLane:Qu(),gesture:null,action:s,hasEagerState:!1,eagerState:null,next:null},fo(e)){if(t)throw Error(M(479))}else t=wu(e,i,s,2),t!==null&&Dt(t,e,2)}function fo(e){var t=e.alternate;return e===ee||t!==null&&t===ee}function Vm(e,t){Br=Ma=!0;var i=e.pending;i===null?t.next=t:(t.next=i.next,i.next=t),e.pending=t}function Im(e,t,i){if(i&4194048){var s=t.lanes;s&=e.pendingLanes,i|=s,t.lanes=i,Rp(e,i)}}var Qn={readContext:ut,use:ho,useCallback:Me,useContext:Me,useEffect:Me,useImperativeHandle:Me,useLayoutEffect:Me,useInsertionEffect:Me,useMemo:Me,useReducer:Me,useRef:Me,useState:Me,useDebugValue:Me,useDeferredValue:Me,useTransition:Me,useSyncExternalStore:Me,useId:Me,useHostTransitionStatus:Me,useFormState:Me,useActionState:Me,useOptimistic:Me,useMemoCache:Me,useCacheRefresh:Me};Qn.useEffectEvent=Me;var Xm={readContext:ut,use:ho,useCallback:function(e,t){return gt().memoizedState=[e,t===void 0?null:t],e},useContext:ut,useEffect:cf,useImperativeHandle:function(e,t,i){i=i!=null?i.concat([e]):null,ea(4194308,4,Om.bind(null,t,e),i)},useLayoutEffect:function(e,t){return ea(4194308,4,e,t)},useInsertionEffect:function(e,t){ea(4,2,e,t)},useMemo:function(e,t){var i=gt();t=t===void 0?null:t;var s=e();if(Is){ls(!0);try{e()}finally{ls(!1)}}return i.memoizedState=[s,t],s},useReducer:function(e,t,i){var s=gt();if(i!==void 0){var r=i(t);if(Is){ls(!0);try{i(t)}finally{ls(!1)}}}else r=t;return s.memoizedState=s.baseState=r,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:r},s.queue=e,e=e.dispatch=d1.bind(null,ee,e),[s.memoizedState,e]},useRef:function(e){var t=gt();return e={current:e},t.memoizedState=e},useState:function(e){e=Fc(e);var t=e.queue,i=Ym.bind(null,ee,t);return t.dispatch=i,[e.memoizedState,i]},useDebugValue:qu,useDeferredValue:function(e,t){var i=gt();return Pu(i,e,t)},useTransition:function(){var e=Fc(!1);return e=Um.bind(null,ee,e.queue,!0,!1),gt().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,i){var s=ee,r=gt();if(ae){if(i===void 0)throw Error(M(407));i=i()}else{if(i=t(),me===null)throw Error(M(349));le&127||ym(s,t,i)}r.memoizedState=i;var n={value:i,getSnapshot:t};return r.queue=n,cf(Cm.bind(null,s,n,e),[e]),s.flags|=2048,Hr(9,{destroy:void 0},bm.bind(null,s,n,i,t),null),i},useId:function(){var e=gt(),t=me.identifierPrefix;if(ae){var i=gi,s=mi;i=(s&~(1<<32-qt(s)-1)).toString(32)+i,t="_"+t+"R_"+i,i=Ba++,0<i&&(t+="H"+i.toString(32)),t+="_"}else i=n1++,t="_"+t+"r_"+i.toString(32)+"_";return e.memoizedState=t},useHostTransitionStatus:Ku,useFormState:lf,useActionState:lf,useOptimistic:function(e){var t=gt();t.memoizedState=t.baseState=e;var i={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=i,t=Wu.bind(null,ee,!0,i),i.dispatch=t,[e,t]},useMemoCache:ju,useCacheRefresh:function(){return gt().memoizedState=u1.bind(null,ee)},useEffectEvent:function(e){var t=gt(),i={impl:e};return t.memoizedState=i,function(){if(ce&2)throw Error(M(440));return i.impl.apply(void 0,arguments)}}},Yu={readContext:ut,use:ho,useCallback:zm,useContext:ut,useEffect:Uu,useImperativeHandle:Lm,useInsertionEffect:Am,useLayoutEffect:Nm,useMemo:jm,useReducer:Jl,useRef:Bm,useState:function(){return Jl(Wi)},useDebugValue:qu,useDeferredValue:function(e,t){var i=Le();return Hm(i,pe.memoizedState,e,t)},useTransition:function(){var e=Jl(Wi)[0],t=Le().memoizedState;return[typeof e=="boolean"?e:_l(e),t]},useSyncExternalStore:Sm,useId:Km,useHostTransitionStatus:Ku,useFormState:af,useActionState:af,useOptimistic:function(e,t){var i=Le();return Em(i,pe,e,t)},useMemoCache:ju,useCacheRefresh:Wm};Yu.useEffectEvent=Rm;var Gm={readContext:ut,use:ho,useCallback:zm,useContext:ut,useEffect:Uu,useImperativeHandle:Lm,useInsertionEffect:Am,useLayoutEffect:Nm,useMemo:jm,useReducer:Po,useRef:Bm,useState:function(){return Po(Wi)},useDebugValue:qu,useDeferredValue:function(e,t){var i=Le();return pe===null?Pu(i,e,t):Hm(i,pe.memoizedState,e,t)},useTransition:function(){var e=Po(Wi)[0],t=Le().memoizedState;return[typeof e=="boolean"?e:_l(e),t]},useSyncExternalStore:Sm,useId:Km,useHostTransitionStatus:Ku,useFormState:of,useActionState:of,useOptimistic:function(e,t){var i=Le();return pe!==null?Em(i,pe,e,t):(i.baseState=e,[e,i.queue.dispatch])},useMemoCache:ju,useCacheRefresh:Wm};Gm.useEffectEvent=Rm;function Ko(e,t,i,s){t=e.memoizedState,i=i(s,t),i=i==null?t:Ce({},t,i),e.memoizedState=i,e.lanes===0&&(e.updateQueue.baseState=i)}var Jc={enqueueSetState:function(e,t,i){e=e._reactInternals;var s=Pt(),r=_s(s);r.payload=t,i!=null&&(r.callback=i),t=ps(e,r,s),t!==null&&(Dt(t,e,s),Nn(t,e,s))},enqueueReplaceState:function(e,t,i){e=e._reactInternals;var s=Pt(),r=_s(s);r.tag=1,r.payload=t,i!=null&&(r.callback=i),t=ps(e,r,s),t!==null&&(Dt(t,e,s),Nn(t,e,s))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var i=Pt(),s=_s(i);s.tag=2,t!=null&&(s.callback=t),t=ps(e,s,i),t!==null&&(Dt(t,e,i),Nn(t,e,i))}};function hf(e,t,i,s,r,n,l){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(s,n,l):t.prototype&&t.prototype.isPureReactComponent?!Xn(i,s)||!Xn(r,n):!0}function uf(e,t,i,s){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(i,s),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(i,s),t.state!==e&&Jc.enqueueReplaceState(t,t.state,null)}function Xs(e,t){var i=t;if("ref"in t){i={};for(var s in t)s!=="ref"&&(i[s]=t[s])}if(e=e.defaultProps){i===t&&(i=Ce({},i));for(var r in e)i[r]===void 0&&(i[r]=e[r])}return i}function $m(e){Ca(e)}function Fm(e){console.error(e)}function Zm(e){Ca(e)}function Ra(e,t){try{var i=e.onUncaughtError;i(t.value,{componentStack:t.stack})}catch(s){setTimeout(function(){throw s})}}function df(e,t,i){try{var s=e.onCaughtError;s(i.value,{componentStack:i.stack,errorBoundary:t.tag===1?t.stateNode:null})}catch(r){setTimeout(function(){throw r})}}function eh(e,t,i){return i=_s(i),i.tag=3,i.payload={element:null},i.callback=function(){Ra(e,t)},i}function Qm(e){return e=_s(e),e.tag=3,e}function Jm(e,t,i,s){var r=i.type.getDerivedStateFromError;if(typeof r=="function"){var n=s.value;e.payload=function(){return r(n)},e.callback=function(){df(t,i,s)}}var l=i.stateNode;l!==null&&typeof l.componentDidCatch=="function"&&(e.callback=function(){df(t,i,s),typeof r!="function"&&(ms===null?ms=new Set([this]):ms.add(this));var a=s.stack;this.componentDidCatch(s.value,{componentStack:a!==null?a:""})})}function f1(e,t,i,s,r){if(i.flags|=32768,s!==null&&typeof s=="object"&&typeof s.then=="function"){if(t=i.alternate,t!==null&&Gr(t,i,r,!0),i=Wt.current,i!==null){switch(i.tag){case 31:case 13:return ii===null?za():i.alternate===null&&Re===0&&(Re=3),i.flags&=-257,i.flags|=65536,i.lanes=r,s===ka?i.flags|=16384:(t=i.updateQueue,t===null?i.updateQueue=new Set([s]):t.add(s),Jo(e,s,r)),!1;case 22:return i.flags|=65536,s===ka?i.flags|=16384:(t=i.updateQueue,t===null?(t={transitions:null,markerInstances:null,retryQueue:new Set([s])},i.updateQueue=t):(i=t.retryQueue,i===null?t.retryQueue=new Set([s]):i.add(s)),Jo(e,s,r)),!1}throw Error(M(435,i.tag))}return Jo(e,s,r),za(),!1}if(ae)return t=Wt.current,t!==null?(!(t.flags&65536)&&(t.flags|=256),t.flags|=65536,t.lanes=r,s!==Pc&&(e=Error(M(422),{cause:s}),$n(ei(e,i)))):(s!==Pc&&(t=Error(M(423),{cause:s}),$n(ei(t,i))),e=e.current.alternate,e.flags|=65536,r&=-r,e.lanes|=r,s=ei(s,i),r=eh(e.stateNode,s,r),qo(e,r),Re!==4&&(Re=2)),!1;var n=Error(M(520),{cause:s});if(n=ei(n,i),Un===null?Un=[n]:Un.push(n),Re!==4&&(Re=2),t===null)return!0;s=ei(s,i),i=t;do{switch(i.tag){case 3:return i.flags|=65536,e=r&-r,i.lanes|=e,e=eh(i.stateNode,s,e),qo(i,e),!1;case 1:if(t=i.type,n=i.stateNode,(i.flags&128)===0&&(typeof t.getDerivedStateFromError=="function"||n!==null&&typeof n.componentDidCatch=="function"&&(ms===null||!ms.has(n))))return i.flags|=65536,r&=-r,i.lanes|=r,r=Qm(r),Jm(r,e,i,s),qo(i,r),!1}i=i.return}while(i!==null);return!1}var Vu=Error(M(461)),Pe=!1;function lt(e,t,i,s){t.child=e===null?fm(t,null,i,s):Vs(t,e.child,i,s)}function ff(e,t,i,s,r){i=i.render;var n=t.ref;if("ref"in s){var l={};for(var a in s)a!=="ref"&&(l[a]=s[a])}else l=s;return Ys(t),s=Nu(e,t,i,l,n,r),a=Ou(),e!==null&&!Pe?(Lu(e,t,r),Yi(e,t,r)):(ae&&a&&Eu(t),t.flags|=1,lt(e,t,s,r),t.child)}function _f(e,t,i,s,r){if(e===null){var n=i.type;return typeof n=="function"&&!xu(n)&&n.defaultProps===void 0&&i.compare===null?(t.tag=15,t.type=n,eg(e,t,n,s,r)):(e=Zl(i.type,null,s,t,t.mode,r),e.ref=t.ref,e.return=t,t.child=e)}if(n=e.child,!Iu(e,r)){var l=n.memoizedProps;if(i=i.compare,i=i!==null?i:Xn,i(l,s)&&e.ref===t.ref)return Yi(e,t,r)}return t.flags|=1,e=Hi(n,s),e.ref=t.ref,e.return=t,t.child=e}function eg(e,t,i,s,r){if(e!==null){var n=e.memoizedProps;if(Xn(n,s)&&e.ref===t.ref)if(Pe=!1,t.pendingProps=s=n,Iu(e,r))e.flags&131072&&(Pe=!0);else return t.lanes=e.lanes,Yi(e,t,r)}return th(e,t,i,s,r)}function tg(e,t,i,s){var r=s.children,n=e!==null?e.memoizedState:null;if(e===null&&t.stateNode===null&&(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),s.mode==="hidden"){if(t.flags&128){if(n=n!==null?n.baseLanes|i:i,e!==null){for(s=t.child=e.child,r=0;s!==null;)r=r|s.lanes|s.childLanes,s=s.sibling;s=r&~n}else s=0,t.child=null;return pf(e,t,n,i,s)}if(i&536870912)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&Ql(t,n!==null?n.cachePool:null),n!==null?sf(t,n):Gc(),mm(t);else return s=t.lanes=536870912,pf(e,t,n!==null?n.baseLanes|i:i,i,s)}else n!==null?(Ql(t,n.cachePool),sf(t,n),rs(),t.memoizedState=null):(e!==null&&Ql(t,null),Gc(),rs());return lt(e,t,r,i),t.child}function bn(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function pf(e,t,i,s,r){var n=Du();return n=n===null?null:{parent:Ue._currentValue,pool:n},t.memoizedState={baseLanes:i,cachePool:n},e!==null&&Ql(t,null),Gc(),mm(t),e!==null&&Gr(e,t,s,!0),t.childLanes=r,null}function ta(e,t){return t=Aa({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function mf(e,t,i){return Vs(t,e.child,null,i),e=ta(t,t.pendingProps),e.flags|=2,Lt(t),t.memoizedState=null,e}function _1(e,t,i){var s=t.pendingProps,r=(t.flags&128)!==0;if(t.flags&=-129,e===null){if(ae){if(s.mode==="hidden")return e=ta(t,s),t.lanes=536870912,bn(null,e);if($c(t),(e=ye)?(e=Xg(e,ti),e=e!==null&&e.data==="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Cs!==null?{id:mi,overflow:gi}:null,retryLane:536870912,hydrationErrors:null},i=lm(e),i.return=t,t.child=i,ct=t,ye=null)):e=null,e===null)throw ws(t);return t.lanes=536870912,null}return ta(t,s)}var n=e.memoizedState;if(n!==null){var l=n.dehydrated;if($c(t),r)if(t.flags&256)t.flags&=-257,t=mf(e,t,i);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(M(558));else if(Pe||Gr(e,t,i,!1),r=(i&e.childLanes)!==0,Pe||r){if(s=me,s!==null&&(l=Ap(s,i),l!==0&&l!==n.retryLane))throw n.retryLane=l,Js(e,l),Dt(s,e,l),Vu;za(),t=mf(e,t,i)}else e=n.treeContext,ye=si(l.nextSibling),ct=t,ae=!0,fs=null,ti=!1,e!==null&&om(t,e),t=ta(t,s),t.flags|=4096;return t}return e=Hi(e.child,{mode:s.mode,children:s.children}),e.ref=t.ref,t.child=e,e.return=t,e}function ia(e,t){var i=t.ref;if(i===null)e!==null&&e.ref!==null&&(t.flags|=4194816);else{if(typeof i!="function"&&typeof i!="object")throw Error(M(284));(e===null||e.ref!==i)&&(t.flags|=4194816)}}function th(e,t,i,s,r){return Ys(t),i=Nu(e,t,i,s,void 0,r),s=Ou(),e!==null&&!Pe?(Lu(e,t,r),Yi(e,t,r)):(ae&&s&&Eu(t),t.flags|=1,lt(e,t,i,r),t.child)}function gf(e,t,i,s,r,n){return Ys(t),t.updateQueue=null,i=vm(t,s,i,r),gm(e),s=Ou(),e!==null&&!Pe?(Lu(e,t,n),Yi(e,t,n)):(ae&&s&&Eu(t),t.flags|=1,lt(e,t,i,n),t.child)}function vf(e,t,i,s,r){if(Ys(t),t.stateNode===null){var n=yr,l=i.contextType;typeof l=="object"&&l!==null&&(n=ut(l)),n=new i(s,n),t.memoizedState=n.state!==null&&n.state!==void 0?n.state:null,n.updater=Jc,t.stateNode=n,n._reactInternals=t,n=t.stateNode,n.props=s,n.state=t.memoizedState,n.refs={},Bu(t),l=i.contextType,n.context=typeof l=="object"&&l!==null?ut(l):yr,n.state=t.memoizedState,l=i.getDerivedStateFromProps,typeof l=="function"&&(Ko(t,i,l,s),n.state=t.memoizedState),typeof i.getDerivedStateFromProps=="function"||typeof n.getSnapshotBeforeUpdate=="function"||typeof n.UNSAFE_componentWillMount!="function"&&typeof n.componentWillMount!="function"||(l=n.state,typeof n.componentWillMount=="function"&&n.componentWillMount(),typeof n.UNSAFE_componentWillMount=="function"&&n.UNSAFE_componentWillMount(),l!==n.state&&Jc.enqueueReplaceState(n,n.state,null),Ln(t,s,n,r),On(),n.state=t.memoizedState),typeof n.componentDidMount=="function"&&(t.flags|=4194308),s=!0}else if(e===null){n=t.stateNode;var a=t.memoizedProps,o=Xs(i,a);n.props=o;var c=n.context,_=i.contextType;l=yr,typeof _=="object"&&_!==null&&(l=ut(_));var f=i.getDerivedStateFromProps;_=typeof f=="function"||typeof n.getSnapshotBeforeUpdate=="function",a=t.pendingProps!==a,_||typeof n.UNSAFE_componentWillReceiveProps!="function"&&typeof n.componentWillReceiveProps!="function"||(a||c!==l)&&uf(t,n,s,l),es=!1;var u=t.memoizedState;n.state=u,Ln(t,s,n,r),On(),c=t.memoizedState,a||u!==c||es?(typeof f=="function"&&(Ko(t,i,f,s),c=t.memoizedState),(o=es||hf(t,i,o,s,u,c,l))?(_||typeof n.UNSAFE_componentWillMount!="function"&&typeof n.componentWillMount!="function"||(typeof n.componentWillMount=="function"&&n.componentWillMount(),typeof n.UNSAFE_componentWillMount=="function"&&n.UNSAFE_componentWillMount()),typeof n.componentDidMount=="function"&&(t.flags|=4194308)):(typeof n.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=s,t.memoizedState=c),n.props=s,n.state=c,n.context=l,s=o):(typeof n.componentDidMount=="function"&&(t.flags|=4194308),s=!1)}else{n=t.stateNode,Ic(e,t),l=t.memoizedProps,_=Xs(i,l),n.props=_,f=t.pendingProps,u=n.context,c=i.contextType,o=yr,typeof c=="object"&&c!==null&&(o=ut(c)),a=i.getDerivedStateFromProps,(c=typeof a=="function"||typeof n.getSnapshotBeforeUpdate=="function")||typeof n.UNSAFE_componentWillReceiveProps!="function"&&typeof n.componentWillReceiveProps!="function"||(l!==f||u!==o)&&uf(t,n,s,o),es=!1,u=t.memoizedState,n.state=u,Ln(t,s,n,r),On();var d=t.memoizedState;l!==f||u!==d||es||e!==null&&e.dependencies!==null&&Ea(e.dependencies)?(typeof a=="function"&&(Ko(t,i,a,s),d=t.memoizedState),(_=es||hf(t,i,_,s,u,d,o)||e!==null&&e.dependencies!==null&&Ea(e.dependencies))?(c||typeof n.UNSAFE_componentWillUpdate!="function"&&typeof n.componentWillUpdate!="function"||(typeof n.componentWillUpdate=="function"&&n.componentWillUpdate(s,d,o),typeof n.UNSAFE_componentWillUpdate=="function"&&n.UNSAFE_componentWillUpdate(s,d,o)),typeof n.componentDidUpdate=="function"&&(t.flags|=4),typeof n.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof n.componentDidUpdate!="function"||l===e.memoizedProps&&u===e.memoizedState||(t.flags|=4),typeof n.getSnapshotBeforeUpdate!="function"||l===e.memoizedProps&&u===e.memoizedState||(t.flags|=1024),t.memoizedProps=s,t.memoizedState=d),n.props=s,n.state=d,n.context=o,s=_):(typeof n.componentDidUpdate!="function"||l===e.memoizedProps&&u===e.memoizedState||(t.flags|=4),typeof n.getSnapshotBeforeUpdate!="function"||l===e.memoizedProps&&u===e.memoizedState||(t.flags|=1024),s=!1)}return n=s,ia(e,t),s=(t.flags&128)!==0,n||s?(n=t.stateNode,i=s&&typeof i.getDerivedStateFromError!="function"?null:n.render(),t.flags|=1,e!==null&&s?(t.child=Vs(t,e.child,null,r),t.child=Vs(t,null,i,r)):lt(e,t,i,r),t.memoizedState=n.state,e=t.child):e=Yi(e,t,r),e}function Sf(e,t,i,s){return Ws(),t.flags|=256,lt(e,t,i,s),t.child}var Wo={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Yo(e){return{baseLanes:e,cachePool:hm()}}function Vo(e,t,i){return e=e!==null?e.childLanes&~i:0,t&&(e|=jt),e}function ig(e,t,i){var s=t.pendingProps,r=!1,n=(t.flags&128)!==0,l;if((l=n)||(l=e!==null&&e.memoizedState===null?!1:(Oe.current&2)!==0),l&&(r=!0,t.flags&=-129),l=(t.flags&32)!==0,t.flags&=-33,e===null){if(ae){if(r?ss(t):rs(),(e=ye)?(e=Xg(e,ti),e=e!==null&&e.data!=="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Cs!==null?{id:mi,overflow:gi}:null,retryLane:536870912,hydrationErrors:null},i=lm(e),i.return=t,t.child=i,ct=t,ye=null)):e=null,e===null)throw ws(t);return ph(e)?t.lanes=32:t.lanes=536870912,null}var a=s.children;return s=s.fallback,r?(rs(),r=t.mode,a=Aa({mode:"hidden",children:a},r),s=Hs(s,r,i,null),a.return=t,s.return=t,a.sibling=s,t.child=a,s=t.child,s.memoizedState=Yo(i),s.childLanes=Vo(e,l,i),t.memoizedState=Wo,bn(null,s)):(ss(t),ih(t,a))}var o=e.memoizedState;if(o!==null&&(a=o.dehydrated,a!==null)){if(n)t.flags&256?(ss(t),t.flags&=-257,t=Io(e,t,i)):t.memoizedState!==null?(rs(),t.child=e.child,t.flags|=128,t=null):(rs(),a=s.fallback,r=t.mode,s=Aa({mode:"visible",children:s.children},r),a=Hs(a,r,i,null),a.flags|=2,s.return=t,a.return=t,s.sibling=a,t.child=s,Vs(t,e.child,null,i),s=t.child,s.memoizedState=Yo(i),s.childLanes=Vo(e,l,i),t.memoizedState=Wo,t=bn(null,s));else if(ss(t),ph(a)){if(l=a.nextSibling&&a.nextSibling.dataset,l)var c=l.dgst;l=c,s=Error(M(419)),s.stack="",s.digest=l,$n({value:s,source:null,stack:null}),t=Io(e,t,i)}else if(Pe||Gr(e,t,i,!1),l=(i&e.childLanes)!==0,Pe||l){if(l=me,l!==null&&(s=Ap(l,i),s!==0&&s!==o.retryLane))throw o.retryLane=s,Js(e,s),Dt(l,e,s),Vu;_h(a)||za(),t=Io(e,t,i)}else _h(a)?(t.flags|=192,t.child=e.child,t=null):(e=o.treeContext,ye=si(a.nextSibling),ct=t,ae=!0,fs=null,ti=!1,e!==null&&om(t,e),t=ih(t,s.children),t.flags|=4096);return t}return r?(rs(),a=s.fallback,r=t.mode,o=e.child,c=o.sibling,s=Hi(o,{mode:"hidden",children:s.children}),s.subtreeFlags=o.subtreeFlags&65011712,c!==null?a=Hi(c,a):(a=Hs(a,r,i,null),a.flags|=2),a.return=t,s.return=t,s.sibling=a,t.child=s,bn(null,s),s=t.child,a=e.child.memoizedState,a===null?a=Yo(i):(r=a.cachePool,r!==null?(o=Ue._currentValue,r=r.parent!==o?{parent:o,pool:o}:r):r=hm(),a={baseLanes:a.baseLanes|i,cachePool:r}),s.memoizedState=a,s.childLanes=Vo(e,l,i),t.memoizedState=Wo,bn(e.child,s)):(ss(t),i=e.child,e=i.sibling,i=Hi(i,{mode:"visible",children:s.children}),i.return=t,i.sibling=null,e!==null&&(l=t.deletions,l===null?(t.deletions=[e],t.flags|=16):l.push(e)),t.child=i,t.memoizedState=null,i)}function ih(e,t){return t=Aa({mode:"visible",children:t},e.mode),t.return=e,e.child=t}function Aa(e,t){return e=zt(22,e,null,t),e.lanes=0,e}function Io(e,t,i){return Vs(t,e.child,null,i),e=ih(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function yf(e,t,i){e.lanes|=t;var s=e.alternate;s!==null&&(s.lanes|=t),Wc(e.return,t,i)}function Xo(e,t,i,s,r,n){var l=e.memoizedState;l===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:s,tail:i,tailMode:r,treeForkCount:n}:(l.isBackwards=t,l.rendering=null,l.renderingStartTime=0,l.last=s,l.tail=i,l.tailMode=r,l.treeForkCount=n)}function sg(e,t,i){var s=t.pendingProps,r=s.revealOrder,n=s.tail;s=s.children;var l=Oe.current,a=(l&2)!==0;if(a?(l=l&1|2,t.flags|=128):l&=1,ge(Oe,l),lt(e,t,s,i),s=ae?Gn:0,!a&&e!==null&&e.flags&128)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&yf(e,i,t);else if(e.tag===19)yf(e,i,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;e.sibling===null;){if(e.return===null||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}switch(r){case"forwards":for(i=t.child,r=null;i!==null;)e=i.alternate,e!==null&&Da(e)===null&&(r=i),i=i.sibling;i=r,i===null?(r=t.child,t.child=null):(r=i.sibling,i.sibling=null),Xo(t,!1,r,i,n,s);break;case"backwards":case"unstable_legacy-backwards":for(i=null,r=t.child,t.child=null;r!==null;){if(e=r.alternate,e!==null&&Da(e)===null){t.child=r;break}e=r.sibling,r.sibling=i,i=r,r=e}Xo(t,!0,i,null,n,s);break;case"together":Xo(t,!1,null,null,void 0,s);break;default:t.memoizedState=null}return t.child}function Yi(e,t,i){if(e!==null&&(t.dependencies=e.dependencies),Es|=t.lanes,!(i&t.childLanes))if(e!==null){if(Gr(e,t,i,!1),(i&t.childLanes)===0)return null}else return null;if(e!==null&&t.child!==e.child)throw Error(M(153));if(t.child!==null){for(e=t.child,i=Hi(e,e.pendingProps),t.child=i,i.return=t;e.sibling!==null;)e=e.sibling,i=i.sibling=Hi(e,e.pendingProps),i.return=t;i.sibling=null}return t.child}function Iu(e,t){return e.lanes&t?!0:(e=e.dependencies,!!(e!==null&&Ea(e)))}function p1(e,t,i){switch(t.tag){case 3:va(t,t.stateNode.containerInfo),is(t,Ue,e.memoizedState.cache),Ws();break;case 27:case 5:Bc(t);break;case 4:va(t,t.stateNode.containerInfo);break;case 10:is(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,$c(t),null;break;case 13:var s=t.memoizedState;if(s!==null)return s.dehydrated!==null?(ss(t),t.flags|=128,null):i&t.child.childLanes?ig(e,t,i):(ss(t),e=Yi(e,t,i),e!==null?e.sibling:null);ss(t);break;case 19:var r=(e.flags&128)!==0;if(s=(i&t.childLanes)!==0,s||(Gr(e,t,i,!1),s=(i&t.childLanes)!==0),r){if(s)return sg(e,t,i);t.flags|=128}if(r=t.memoizedState,r!==null&&(r.rendering=null,r.tail=null,r.lastEffect=null),ge(Oe,Oe.current),s)break;return null;case 22:return t.lanes=0,tg(e,t,i,t.pendingProps);case 24:is(t,Ue,e.memoizedState.cache)}return Yi(e,t,i)}function rg(e,t,i){if(e!==null)if(e.memoizedProps!==t.pendingProps)Pe=!0;else{if(!Iu(e,i)&&!(t.flags&128))return Pe=!1,p1(e,t,i);Pe=!!(e.flags&131072)}else Pe=!1,ae&&t.flags&1048576&&am(t,Gn,t.index);switch(t.lanes=0,t.tag){case 16:e:{var s=t.pendingProps;if(e=As(t.elementType),t.type=e,typeof e=="function")xu(e)?(s=Xs(e,s),t.tag=1,t=vf(null,t,e,s,i)):(t.tag=0,t=th(null,t,e,s,i));else{if(e!=null){var r=e.$$typeof;if(r===hu){t.tag=11,t=ff(null,t,e,s,i);break e}else if(r===uu){t.tag=14,t=_f(null,t,e,s,i);break e}}throw t=Dc(e)||e,Error(M(306,t,""))}}return t;case 0:return th(e,t,t.type,t.pendingProps,i);case 1:return s=t.type,r=Xs(s,t.pendingProps),vf(e,t,s,r,i);case 3:e:{if(va(t,t.stateNode.containerInfo),e===null)throw Error(M(387));s=t.pendingProps;var n=t.memoizedState;r=n.element,Ic(e,t),Ln(t,s,null,i);var l=t.memoizedState;if(s=l.cache,is(t,Ue,s),s!==n.cache&&Yc(t,[Ue],i,!0),On(),s=l.element,n.isDehydrated)if(n={element:s,isDehydrated:!1,cache:l.cache},t.updateQueue.baseState=n,t.memoizedState=n,t.flags&256){t=Sf(e,t,s,i);break e}else if(s!==r){r=ei(Error(M(424)),t),$n(r),t=Sf(e,t,s,i);break e}else{switch(e=t.stateNode.containerInfo,e.nodeType){case 9:e=e.body;break;default:e=e.nodeName==="HTML"?e.ownerDocument.body:e}for(ye=si(e.firstChild),ct=t,ae=!0,fs=null,ti=!0,i=fm(t,null,s,i),t.child=i;i;)i.flags=i.flags&-3|4096,i=i.sibling}else{if(Ws(),s===r){t=Yi(e,t,i);break e}lt(e,t,s,i)}t=t.child}return t;case 26:return ia(e,t),e===null?(i=qf(t.type,null,t.pendingProps,null))?t.memoizedState=i:ae||(i=t.type,e=t.pendingProps,s=qa(ds.current).createElement(i),s[ot]=t,s[Mt]=e,dt(s,i,e),it(s),t.stateNode=s):t.memoizedState=qf(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return Bc(t),e===null&&ae&&(s=t.stateNode=Gg(t.type,t.pendingProps,ds.current),ct=t,ti=!0,r=ye,Ts(t.type)?(mh=r,ye=si(s.firstChild)):ye=r),lt(e,t,t.pendingProps.children,i),ia(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&ae&&((r=s=ye)&&(s=V1(s,t.type,t.pendingProps,ti),s!==null?(t.stateNode=s,ct=t,ye=si(s.firstChild),ti=!1,r=!0):r=!1),r||ws(t)),Bc(t),r=t.type,n=t.pendingProps,l=e!==null?e.memoizedProps:null,s=n.children,dh(r,n)?s=null:l!==null&&dh(r,l)&&(t.flags|=32),t.memoizedState!==null&&(r=Nu(e,t,l1,null,null,i),tl._currentValue=r),ia(e,t),lt(e,t,s,i),t.child;case 6:return e===null&&ae&&((e=i=ye)&&(i=I1(i,t.pendingProps,ti),i!==null?(t.stateNode=i,ct=t,ye=null,e=!0):e=!1),e||ws(t)),null;case 13:return ig(e,t,i);case 4:return va(t,t.stateNode.containerInfo),s=t.pendingProps,e===null?t.child=Vs(t,null,s,i):lt(e,t,s,i),t.child;case 11:return ff(e,t,t.type,t.pendingProps,i);case 7:return lt(e,t,t.pendingProps,i),t.child;case 8:return lt(e,t,t.pendingProps.children,i),t.child;case 12:return lt(e,t,t.pendingProps.children,i),t.child;case 10:return s=t.pendingProps,is(t,t.type,s.value),lt(e,t,s.children,i),t.child;case 9:return r=t.type._context,s=t.pendingProps.children,Ys(t),r=ut(r),s=s(r),t.flags|=1,lt(e,t,s,i),t.child;case 14:return _f(e,t,t.type,t.pendingProps,i);case 15:return eg(e,t,t.type,t.pendingProps,i);case 19:return sg(e,t,i);case 31:return _1(e,t,i);case 22:return tg(e,t,i,t.pendingProps);case 24:return Ys(t),s=ut(Ue),e===null?(r=Du(),r===null&&(r=me,n=Tu(),r.pooledCache=n,n.refCount++,n!==null&&(r.pooledCacheLanes|=i),r=n),t.memoizedState={parent:s,cache:r},Bu(t),is(t,Ue,r)):(e.lanes&i&&(Ic(e,t),Ln(t,null,null,i),On()),r=e.memoizedState,n=t.memoizedState,r.parent!==s?(r={parent:s,cache:s},t.memoizedState=r,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=r),is(t,Ue,s)):(s=n.cache,is(t,Ue,s),s!==r.cache&&Yc(t,[Ue],i,!0))),lt(e,t,t.pendingProps.children,i),t.child;case 29:throw t.pendingProps}throw Error(M(156,t.tag))}function Ti(e){e.flags|=4}function Go(e,t,i,s,r){if((t=(e.mode&32)!==0)&&(t=!1),t){if(e.flags|=16777216,(r&335544128)===r)if(e.stateNode.complete)e.flags|=8192;else if(Dg())e.flags|=8192;else throw qs=ka,Mu}else e.flags&=-16777217}function bf(e,t){if(t.type!=="stylesheet"||t.state.loading&4)e.flags&=-16777217;else if(e.flags|=16777216,!Zg(t))if(Dg())e.flags|=8192;else throw qs=ka,Mu}function Ol(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag!==22?Mp():536870912,e.lanes|=t,Ur|=t)}function on(e,t){if(!ae)switch(e.tailMode){case"hidden":t=e.tail;for(var i=null;t!==null;)t.alternate!==null&&(i=t),t=t.sibling;i===null?e.tail=null:i.sibling=null;break;case"collapsed":i=e.tail;for(var s=null;i!==null;)i.alternate!==null&&(s=i),i=i.sibling;s===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:s.sibling=null}}function ve(e){var t=e.alternate!==null&&e.alternate.child===e.child,i=0,s=0;if(t)for(var r=e.child;r!==null;)i|=r.lanes|r.childLanes,s|=r.subtreeFlags&65011712,s|=r.flags&65011712,r.return=e,r=r.sibling;else for(r=e.child;r!==null;)i|=r.lanes|r.childLanes,s|=r.subtreeFlags,s|=r.flags,r.return=e,r=r.sibling;return e.subtreeFlags|=s,e.childLanes=i,t}function m1(e,t,i){var s=t.pendingProps;switch(ku(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return ve(t),null;case 1:return ve(t),null;case 3:return i=t.stateNode,s=null,e!==null&&(s=e.memoizedState.cache),t.memoizedState.cache!==s&&(t.flags|=2048),Ui(Ue),Nr(),i.pendingContext&&(i.context=i.pendingContext,i.pendingContext=null),(e===null||e.child===null)&&(rr(t)?Ti(t):e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,Uo())),ve(t),null;case 26:var r=t.type,n=t.memoizedState;return e===null?(Ti(t),n!==null?(ve(t),bf(t,n)):(ve(t),Go(t,r,null,s,i))):n?n!==e.memoizedState?(Ti(t),ve(t),bf(t,n)):(ve(t),t.flags&=-16777217):(e=e.memoizedProps,e!==s&&Ti(t),ve(t),Go(t,r,e,s,i)),null;case 27:if(Sa(t),i=ds.current,r=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==s&&Ti(t);else{if(!s){if(t.stateNode===null)throw Error(M(166));return ve(t),null}e=yi.current,rr(t)?$d(t):(e=Gg(r,s,i),t.stateNode=e,Ti(t))}return ve(t),null;case 5:if(Sa(t),r=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==s&&Ti(t);else{if(!s){if(t.stateNode===null)throw Error(M(166));return ve(t),null}if(n=yi.current,rr(t))$d(t);else{var l=qa(ds.current);switch(n){case 1:n=l.createElementNS("http://www.w3.org/2000/svg",r);break;case 2:n=l.createElementNS("http://www.w3.org/1998/Math/MathML",r);break;default:switch(r){case"svg":n=l.createElementNS("http://www.w3.org/2000/svg",r);break;case"math":n=l.createElementNS("http://www.w3.org/1998/Math/MathML",r);break;case"script":n=l.createElement("div"),n.innerHTML="<script><\/script>",n=n.removeChild(n.firstChild);break;case"select":n=typeof s.is=="string"?l.createElement("select",{is:s.is}):l.createElement("select"),s.multiple?n.multiple=!0:s.size&&(n.size=s.size);break;default:n=typeof s.is=="string"?l.createElement(r,{is:s.is}):l.createElement(r)}}n[ot]=t,n[Mt]=s;e:for(l=t.child;l!==null;){if(l.tag===5||l.tag===6)n.appendChild(l.stateNode);else if(l.tag!==4&&l.tag!==27&&l.child!==null){l.child.return=l,l=l.child;continue}if(l===t)break e;for(;l.sibling===null;){if(l.return===null||l.return===t)break e;l=l.return}l.sibling.return=l.return,l=l.sibling}t.stateNode=n;e:switch(dt(n,r,s),r){case"button":case"input":case"select":case"textarea":s=!!s.autoFocus;break e;case"img":s=!0;break e;default:s=!1}s&&Ti(t)}}return ve(t),Go(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,i),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==s&&Ti(t);else{if(typeof s!="string"&&t.stateNode===null)throw Error(M(166));if(e=ds.current,rr(t)){if(e=t.stateNode,i=t.memoizedProps,s=null,r=ct,r!==null)switch(r.tag){case 27:case 5:s=r.memoizedProps}e[ot]=t,e=!!(e.nodeValue===i||s!==null&&s.suppressHydrationWarning===!0||Yg(e.nodeValue,i)),e||ws(t,!0)}else e=qa(e).createTextNode(s),e[ot]=t,t.stateNode=e}return ve(t),null;case 31:if(i=t.memoizedState,e===null||e.memoizedState!==null){if(s=rr(t),i!==null){if(e===null){if(!s)throw Error(M(318));if(e=t.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(M(557));e[ot]=t}else Ws(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;ve(t),e=!1}else i=Uo(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=i),e=!0;if(!e)return t.flags&256?(Lt(t),t):(Lt(t),null);if(t.flags&128)throw Error(M(558))}return ve(t),null;case 13:if(s=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(r=rr(t),s!==null&&s.dehydrated!==null){if(e===null){if(!r)throw Error(M(318));if(r=t.memoizedState,r=r!==null?r.dehydrated:null,!r)throw Error(M(317));r[ot]=t}else Ws(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;ve(t),r=!1}else r=Uo(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=r),r=!0;if(!r)return t.flags&256?(Lt(t),t):(Lt(t),null)}return Lt(t),t.flags&128?(t.lanes=i,t):(i=s!==null,e=e!==null&&e.memoizedState!==null,i&&(s=t.child,r=null,s.alternate!==null&&s.alternate.memoizedState!==null&&s.alternate.memoizedState.cachePool!==null&&(r=s.alternate.memoizedState.cachePool.pool),n=null,s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(n=s.memoizedState.cachePool.pool),n!==r&&(s.flags|=2048)),i!==e&&i&&(t.child.flags|=8192),Ol(t,t.updateQueue),ve(t),null);case 4:return Nr(),e===null&&Ju(t.stateNode.containerInfo),ve(t),null;case 10:return Ui(t.type),ve(t),null;case 19:if(st(Oe),s=t.memoizedState,s===null)return ve(t),null;if(r=(t.flags&128)!==0,n=s.rendering,n===null)if(r)on(s,!1);else{if(Re!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(n=Da(e),n!==null){for(t.flags|=128,on(s,!1),e=n.updateQueue,t.updateQueue=e,Ol(t,e),t.subtreeFlags=0,e=i,i=t.child;i!==null;)nm(i,e),i=i.sibling;return ge(Oe,Oe.current&1|2),ae&&Ai(t,s.treeForkCount),t.child}e=e.sibling}s.tail!==null&&Ht()>Oa&&(t.flags|=128,r=!0,on(s,!1),t.lanes=4194304)}else{if(!r)if(e=Da(n),e!==null){if(t.flags|=128,r=!0,e=e.updateQueue,t.updateQueue=e,Ol(t,e),on(s,!0),s.tail===null&&s.tailMode==="hidden"&&!n.alternate&&!ae)return ve(t),null}else 2*Ht()-s.renderingStartTime>Oa&&i!==536870912&&(t.flags|=128,r=!0,on(s,!1),t.lanes=4194304);s.isBackwards?(n.sibling=t.child,t.child=n):(e=s.last,e!==null?e.sibling=n:t.child=n,s.last=n)}return s.tail!==null?(e=s.tail,s.rendering=e,s.tail=e.sibling,s.renderingStartTime=Ht(),e.sibling=null,i=Oe.current,ge(Oe,r?i&1|2:i&1),ae&&Ai(t,s.treeForkCount),e):(ve(t),null);case 22:case 23:return Lt(t),Ru(),s=t.memoizedState!==null,e!==null?e.memoizedState!==null!==s&&(t.flags|=8192):s&&(t.flags|=8192),s?i&536870912&&!(t.flags&128)&&(ve(t),t.subtreeFlags&6&&(t.flags|=8192)):ve(t),i=t.updateQueue,i!==null&&Ol(t,i.retryQueue),i=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(i=e.memoizedState.cachePool.pool),s=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(s=t.memoizedState.cachePool.pool),s!==i&&(t.flags|=2048),e!==null&&st(Us),null;case 24:return i=null,e!==null&&(i=e.memoizedState.cache),t.memoizedState.cache!==i&&(t.flags|=2048),Ui(Ue),ve(t),null;case 25:return null;case 30:return null}throw Error(M(156,t.tag))}function g1(e,t){switch(ku(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Ui(Ue),Nr(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return Sa(t),null;case 31:if(t.memoizedState!==null){if(Lt(t),t.alternate===null)throw Error(M(340));Ws()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(Lt(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(M(340));Ws()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return st(Oe),null;case 4:return Nr(),null;case 10:return Ui(t.type),null;case 22:case 23:return Lt(t),Ru(),e!==null&&st(Us),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return Ui(Ue),null;case 25:return null;default:return null}}function ng(e,t){switch(ku(t),t.tag){case 3:Ui(Ue),Nr();break;case 26:case 27:case 5:Sa(t);break;case 4:Nr();break;case 31:t.memoizedState!==null&&Lt(t);break;case 13:Lt(t);break;case 19:st(Oe);break;case 10:Ui(t.type);break;case 22:case 23:Lt(t),Ru(),e!==null&&st(Us);break;case 24:Ui(Ue)}}function pl(e,t){try{var i=t.updateQueue,s=i!==null?i.lastEffect:null;if(s!==null){var r=s.next;i=r;do{if((i.tag&e)===e){s=void 0;var n=i.create,l=i.inst;s=n(),l.destroy=s}i=i.next}while(i!==r)}}catch(a){de(t,t.return,a)}}function xs(e,t,i){try{var s=t.updateQueue,r=s!==null?s.lastEffect:null;if(r!==null){var n=r.next;s=n;do{if((s.tag&e)===e){var l=s.inst,a=l.destroy;if(a!==void 0){l.destroy=void 0,r=t;var o=i,c=a;try{c()}catch(_){de(r,o,_)}}}s=s.next}while(s!==n)}}catch(_){de(t,t.return,_)}}function lg(e){var t=e.updateQueue;if(t!==null){var i=e.stateNode;try{pm(t,i)}catch(s){de(e,e.return,s)}}}function ag(e,t,i){i.props=Xs(e.type,e.memoizedProps),i.state=e.memoizedState;try{i.componentWillUnmount()}catch(s){de(e,t,s)}}function jn(e,t){try{var i=e.ref;if(i!==null){switch(e.tag){case 26:case 27:case 5:var s=e.stateNode;break;case 30:s=e.stateNode;break;default:s=e.stateNode}typeof i=="function"?e.refCleanup=i(s):i.current=s}}catch(r){de(e,t,r)}}function vi(e,t){var i=e.ref,s=e.refCleanup;if(i!==null)if(typeof s=="function")try{s()}catch(r){de(e,t,r)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof i=="function")try{i(null)}catch(r){de(e,t,r)}else i.current=null}function og(e){var t=e.type,i=e.memoizedProps,s=e.stateNode;try{e:switch(t){case"button":case"input":case"select":case"textarea":i.autoFocus&&s.focus();break e;case"img":i.src?s.src=i.src:i.srcSet&&(s.srcset=i.srcSet)}}catch(r){de(e,e.return,r)}}function $o(e,t,i){try{var s=e.stateNode;U1(s,e.type,i,t),s[Mt]=t}catch(r){de(e,e.return,r)}}function cg(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&Ts(e.type)||e.tag===4}function Fo(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||cg(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.tag===27&&Ts(e.type)||e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function sh(e,t,i){var s=e.tag;if(s===5||s===6)e=e.stateNode,t?(i.nodeType===9?i.body:i.nodeName==="HTML"?i.ownerDocument.body:i).insertBefore(e,t):(t=i.nodeType===9?i.body:i.nodeName==="HTML"?i.ownerDocument.body:i,t.appendChild(e),i=i._reactRootContainer,i!=null||t.onclick!==null||(t.onclick=Li));else if(s!==4&&(s===27&&Ts(e.type)&&(i=e.stateNode,t=null),e=e.child,e!==null))for(sh(e,t,i),e=e.sibling;e!==null;)sh(e,t,i),e=e.sibling}function Na(e,t,i){var s=e.tag;if(s===5||s===6)e=e.stateNode,t?i.insertBefore(e,t):i.appendChild(e);else if(s!==4&&(s===27&&Ts(e.type)&&(i=e.stateNode),e=e.child,e!==null))for(Na(e,t,i),e=e.sibling;e!==null;)Na(e,t,i),e=e.sibling}function hg(e){var t=e.stateNode,i=e.memoizedProps;try{for(var s=e.type,r=t.attributes;r.length;)t.removeAttributeNode(r[0]);dt(t,s,i),t[ot]=e,t[Mt]=i}catch(n){de(e,e.return,n)}}var Ni=!1,He=!1,Zo=!1,Cf=typeof WeakSet=="function"?WeakSet:Set,Qe=null;function v1(e,t){if(e=e.containerInfo,hh=Ya,e=Zp(e),bu(e)){if("selectionStart"in e)var i={start:e.selectionStart,end:e.selectionEnd};else e:{i=(i=e.ownerDocument)&&i.defaultView||window;var s=i.getSelection&&i.getSelection();if(s&&s.rangeCount!==0){i=s.anchorNode;var r=s.anchorOffset,n=s.focusNode;s=s.focusOffset;try{i.nodeType,n.nodeType}catch{i=null;break e}var l=0,a=-1,o=-1,c=0,_=0,f=e,u=null;t:for(;;){for(var d;f!==i||r!==0&&f.nodeType!==3||(a=l+r),f!==n||s!==0&&f.nodeType!==3||(o=l+s),f.nodeType===3&&(l+=f.nodeValue.length),(d=f.firstChild)!==null;)u=f,f=d;for(;;){if(f===e)break t;if(u===i&&++c===r&&(a=l),u===n&&++_===s&&(o=l),(d=f.nextSibling)!==null)break;f=u,u=f.parentNode}f=d}i=a===-1||o===-1?null:{start:a,end:o}}else i=null}i=i||{start:0,end:0}}else i=null;for(uh={focusedElem:e,selectionRange:i},Ya=!1,Qe=t;Qe!==null;)if(t=Qe,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,Qe=e;else for(;Qe!==null;){switch(t=Qe,n=t.alternate,e=t.flags,t.tag){case 0:if(e&4&&(e=t.updateQueue,e=e!==null?e.events:null,e!==null))for(i=0;i<e.length;i++)r=e[i],r.ref.impl=r.nextImpl;break;case 11:case 15:break;case 1:if(e&1024&&n!==null){e=void 0,i=t,r=n.memoizedProps,n=n.memoizedState,s=i.stateNode;try{var g=Xs(i.type,r);e=s.getSnapshotBeforeUpdate(g,n),s.__reactInternalSnapshotBeforeUpdate=e}catch(y){de(i,i.return,y)}}break;case 3:if(e&1024){if(e=t.stateNode.containerInfo,i=e.nodeType,i===9)fh(e);else if(i===1)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":fh(e);break;default:e.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if(e&1024)throw Error(M(163))}if(e=t.sibling,e!==null){e.return=t.return,Qe=e;break}Qe=t.return}}function ug(e,t,i){var s=i.flags;switch(i.tag){case 0:case 11:case 15:Mi(e,i),s&4&&pl(5,i);break;case 1:if(Mi(e,i),s&4)if(e=i.stateNode,t===null)try{e.componentDidMount()}catch(l){de(i,i.return,l)}else{var r=Xs(i.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(r,t,e.__reactInternalSnapshotBeforeUpdate)}catch(l){de(i,i.return,l)}}s&64&&lg(i),s&512&&jn(i,i.return);break;case 3:if(Mi(e,i),s&64&&(e=i.updateQueue,e!==null)){if(t=null,i.child!==null)switch(i.child.tag){case 27:case 5:t=i.child.stateNode;break;case 1:t=i.child.stateNode}try{pm(e,t)}catch(l){de(i,i.return,l)}}break;case 27:t===null&&s&4&&hg(i);case 26:case 5:Mi(e,i),t===null&&s&4&&og(i),s&512&&jn(i,i.return);break;case 12:Mi(e,i);break;case 31:Mi(e,i),s&4&&_g(e,i);break;case 13:Mi(e,i),s&4&&pg(e,i),s&64&&(e=i.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(i=T1.bind(null,i),X1(e,i))));break;case 22:if(s=i.memoizedState!==null||Ni,!s){t=t!==null&&t.memoizedState!==null||He,r=Ni;var n=He;Ni=s,(He=t)&&!n?Ri(e,i,(i.subtreeFlags&8772)!==0):Mi(e,i),Ni=r,He=n}break;case 30:break;default:Mi(e,i)}}function dg(e){var t=e.alternate;t!==null&&(e.alternate=null,dg(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&pu(t)),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}var xe=null,kt=!1;function Di(e,t,i){for(i=i.child;i!==null;)fg(e,t,i),i=i.sibling}function fg(e,t,i){if(Ut&&typeof Ut.onCommitFiberUnmount=="function")try{Ut.onCommitFiberUnmount(ol,i)}catch{}switch(i.tag){case 26:He||vi(i,t),Di(e,t,i),i.memoizedState?i.memoizedState.count--:i.stateNode&&(i=i.stateNode,i.parentNode.removeChild(i));break;case 27:He||vi(i,t);var s=xe,r=kt;Ts(i.type)&&(xe=i.stateNode,kt=!1),Di(e,t,i),Pn(i.stateNode),xe=s,kt=r;break;case 5:He||vi(i,t);case 6:if(s=xe,r=kt,xe=null,Di(e,t,i),xe=s,kt=r,xe!==null)if(kt)try{(xe.nodeType===9?xe.body:xe.nodeName==="HTML"?xe.ownerDocument.body:xe).removeChild(i.stateNode)}catch(n){de(i,t,n)}else try{xe.removeChild(i.stateNode)}catch(n){de(i,t,n)}break;case 18:xe!==null&&(kt?(e=xe,Lf(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,i.stateNode),Wr(e)):Lf(xe,i.stateNode));break;case 4:s=xe,r=kt,xe=i.stateNode.containerInfo,kt=!0,Di(e,t,i),xe=s,kt=r;break;case 0:case 11:case 14:case 15:xs(2,i,t),He||xs(4,i,t),Di(e,t,i);break;case 1:He||(vi(i,t),s=i.stateNode,typeof s.componentWillUnmount=="function"&&ag(i,t,s)),Di(e,t,i);break;case 21:Di(e,t,i);break;case 22:He=(s=He)||i.memoizedState!==null,Di(e,t,i),He=s;break;default:Di(e,t,i)}}function _g(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{Wr(e)}catch(i){de(t,t.return,i)}}}function pg(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{Wr(e)}catch(i){de(t,t.return,i)}}function S1(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new Cf),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new Cf),t;default:throw Error(M(435,e.tag))}}function Ll(e,t){var i=S1(e);t.forEach(function(s){if(!i.has(s)){i.add(s);var r=D1.bind(null,e,s);s.then(r,r)}})}function wt(e,t){var i=t.deletions;if(i!==null)for(var s=0;s<i.length;s++){var r=i[s],n=e,l=t,a=l;e:for(;a!==null;){switch(a.tag){case 27:if(Ts(a.type)){xe=a.stateNode,kt=!1;break e}break;case 5:xe=a.stateNode,kt=!1;break e;case 3:case 4:xe=a.stateNode.containerInfo,kt=!0;break e}a=a.return}if(xe===null)throw Error(M(160));fg(n,l,r),xe=null,kt=!1,n=r.alternate,n!==null&&(n.return=null),r.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)mg(t,e),t=t.sibling}var hi=null;function mg(e,t){var i=e.alternate,s=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:wt(t,e),xt(e),s&4&&(xs(3,e,e.return),pl(3,e),xs(5,e,e.return));break;case 1:wt(t,e),xt(e),s&512&&(He||i===null||vi(i,i.return)),s&64&&Ni&&(e=e.updateQueue,e!==null&&(s=e.callbacks,s!==null&&(i=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=i===null?s:i.concat(s))));break;case 26:var r=hi;if(wt(t,e),xt(e),s&512&&(He||i===null||vi(i,i.return)),s&4){var n=i!==null?i.memoizedState:null;if(s=e.memoizedState,i===null)if(s===null)if(e.stateNode===null){e:{s=e.type,i=e.memoizedProps,r=r.ownerDocument||r;t:switch(s){case"title":n=r.getElementsByTagName("title")[0],(!n||n[ul]||n[ot]||n.namespaceURI==="http://www.w3.org/2000/svg"||n.hasAttribute("itemprop"))&&(n=r.createElement(s),r.head.insertBefore(n,r.querySelector("head > title"))),dt(n,s,i),n[ot]=e,it(n),s=n;break e;case"link":var l=Kf("link","href",r).get(s+(i.href||""));if(l){for(var a=0;a<l.length;a++)if(n=l[a],n.getAttribute("href")===(i.href==null||i.href===""?null:i.href)&&n.getAttribute("rel")===(i.rel==null?null:i.rel)&&n.getAttribute("title")===(i.title==null?null:i.title)&&n.getAttribute("crossorigin")===(i.crossOrigin==null?null:i.crossOrigin)){l.splice(a,1);break t}}n=r.createElement(s),dt(n,s,i),r.head.appendChild(n);break;case"meta":if(l=Kf("meta","content",r).get(s+(i.content||""))){for(a=0;a<l.length;a++)if(n=l[a],n.getAttribute("content")===(i.content==null?null:""+i.content)&&n.getAttribute("name")===(i.name==null?null:i.name)&&n.getAttribute("property")===(i.property==null?null:i.property)&&n.getAttribute("http-equiv")===(i.httpEquiv==null?null:i.httpEquiv)&&n.getAttribute("charset")===(i.charSet==null?null:i.charSet)){l.splice(a,1);break t}}n=r.createElement(s),dt(n,s,i),r.head.appendChild(n);break;default:throw Error(M(468,s))}n[ot]=e,it(n),s=n}e.stateNode=s}else Wf(r,e.type,e.stateNode);else e.stateNode=Pf(r,s,e.memoizedProps);else n!==s?(n===null?i.stateNode!==null&&(i=i.stateNode,i.parentNode.removeChild(i)):n.count--,s===null?Wf(r,e.type,e.stateNode):Pf(r,s,e.memoizedProps)):s===null&&e.stateNode!==null&&$o(e,e.memoizedProps,i.memoizedProps)}break;case 27:wt(t,e),xt(e),s&512&&(He||i===null||vi(i,i.return)),i!==null&&s&4&&$o(e,e.memoizedProps,i.memoizedProps);break;case 5:if(wt(t,e),xt(e),s&512&&(He||i===null||vi(i,i.return)),e.flags&32){r=e.stateNode;try{Lr(r,"")}catch(g){de(e,e.return,g)}}s&4&&e.stateNode!=null&&(r=e.memoizedProps,$o(e,r,i!==null?i.memoizedProps:r)),s&1024&&(Zo=!0);break;case 6:if(wt(t,e),xt(e),s&4){if(e.stateNode===null)throw Error(M(162));s=e.memoizedProps,i=e.stateNode;try{i.nodeValue=s}catch(g){de(e,e.return,g)}}break;case 3:if(na=null,r=hi,hi=Pa(t.containerInfo),wt(t,e),hi=r,xt(e),s&4&&i!==null&&i.memoizedState.isDehydrated)try{Wr(t.containerInfo)}catch(g){de(e,e.return,g)}Zo&&(Zo=!1,gg(e));break;case 4:s=hi,hi=Pa(e.stateNode.containerInfo),wt(t,e),xt(e),hi=s;break;case 12:wt(t,e),xt(e);break;case 31:wt(t,e),xt(e),s&4&&(s=e.updateQueue,s!==null&&(e.updateQueue=null,Ll(e,s)));break;case 13:wt(t,e),xt(e),e.child.flags&8192&&e.memoizedState!==null!=(i!==null&&i.memoizedState!==null)&&(_o=Ht()),s&4&&(s=e.updateQueue,s!==null&&(e.updateQueue=null,Ll(e,s)));break;case 22:r=e.memoizedState!==null;var o=i!==null&&i.memoizedState!==null,c=Ni,_=He;if(Ni=c||r,He=_||o,wt(t,e),He=_,Ni=c,xt(e),s&8192)e:for(t=e.stateNode,t._visibility=r?t._visibility&-2:t._visibility|1,r&&(i===null||o||Ni||He||Ns(e)),i=null,t=e;;){if(t.tag===5||t.tag===26){if(i===null){o=i=t;try{if(n=o.stateNode,r)l=n.style,typeof l.setProperty=="function"?l.setProperty("display","none","important"):l.display="none";else{a=o.stateNode;var f=o.memoizedProps.style,u=f!=null&&f.hasOwnProperty("display")?f.display:null;a.style.display=u==null||typeof u=="boolean"?"":(""+u).trim()}}catch(g){de(o,o.return,g)}}}else if(t.tag===6){if(i===null){o=t;try{o.stateNode.nodeValue=r?"":o.memoizedProps}catch(g){de(o,o.return,g)}}}else if(t.tag===18){if(i===null){o=t;try{var d=o.stateNode;r?zf(d,!0):zf(o.stateNode,!1)}catch(g){de(o,o.return,g)}}}else if((t.tag!==22&&t.tag!==23||t.memoizedState===null||t===e)&&t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break e;for(;t.sibling===null;){if(t.return===null||t.return===e)break e;i===t&&(i=null),t=t.return}i===t&&(i=null),t.sibling.return=t.return,t=t.sibling}s&4&&(s=e.updateQueue,s!==null&&(i=s.retryQueue,i!==null&&(s.retryQueue=null,Ll(e,i))));break;case 19:wt(t,e),xt(e),s&4&&(s=e.updateQueue,s!==null&&(e.updateQueue=null,Ll(e,s)));break;case 30:break;case 21:break;default:wt(t,e),xt(e)}}function xt(e){var t=e.flags;if(t&2){try{for(var i,s=e.return;s!==null;){if(cg(s)){i=s;break}s=s.return}if(i==null)throw Error(M(160));switch(i.tag){case 27:var r=i.stateNode,n=Fo(e);Na(e,n,r);break;case 5:var l=i.stateNode;i.flags&32&&(Lr(l,""),i.flags&=-33);var a=Fo(e);Na(e,a,l);break;case 3:case 4:var o=i.stateNode.containerInfo,c=Fo(e);sh(e,c,o);break;default:throw Error(M(161))}}catch(_){de(e,e.return,_)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function gg(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;gg(t),t.tag===5&&t.flags&1024&&t.stateNode.reset(),e=e.sibling}}function Mi(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)ug(e,t.alternate,t),t=t.sibling}function Ns(e){for(e=e.child;e!==null;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:xs(4,t,t.return),Ns(t);break;case 1:vi(t,t.return);var i=t.stateNode;typeof i.componentWillUnmount=="function"&&ag(t,t.return,i),Ns(t);break;case 27:Pn(t.stateNode);case 26:case 5:vi(t,t.return),Ns(t);break;case 22:t.memoizedState===null&&Ns(t);break;case 30:Ns(t);break;default:Ns(t)}e=e.sibling}}function Ri(e,t,i){for(i=i&&(t.subtreeFlags&8772)!==0,t=t.child;t!==null;){var s=t.alternate,r=e,n=t,l=n.flags;switch(n.tag){case 0:case 11:case 15:Ri(r,n,i),pl(4,n);break;case 1:if(Ri(r,n,i),s=n,r=s.stateNode,typeof r.componentDidMount=="function")try{r.componentDidMount()}catch(c){de(s,s.return,c)}if(s=n,r=s.updateQueue,r!==null){var a=s.stateNode;try{var o=r.shared.hiddenCallbacks;if(o!==null)for(r.shared.hiddenCallbacks=null,r=0;r<o.length;r++)_m(o[r],a)}catch(c){de(s,s.return,c)}}i&&l&64&&lg(n),jn(n,n.return);break;case 27:hg(n);case 26:case 5:Ri(r,n,i),i&&s===null&&l&4&&og(n),jn(n,n.return);break;case 12:Ri(r,n,i);break;case 31:Ri(r,n,i),i&&l&4&&_g(r,n);break;case 13:Ri(r,n,i),i&&l&4&&pg(r,n);break;case 22:n.memoizedState===null&&Ri(r,n,i),jn(n,n.return);break;case 30:break;default:Ri(r,n,i)}t=t.sibling}}function Xu(e,t){var i=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(i=e.memoizedState.cachePool.pool),e=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(e=t.memoizedState.cachePool.pool),e!==i&&(e!=null&&e.refCount++,i!=null&&fl(i))}function Gu(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&fl(e))}function oi(e,t,i,s){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)vg(e,t,i,s),t=t.sibling}function vg(e,t,i,s){var r=t.flags;switch(t.tag){case 0:case 11:case 15:oi(e,t,i,s),r&2048&&pl(9,t);break;case 1:oi(e,t,i,s);break;case 3:oi(e,t,i,s),r&2048&&(e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&fl(e)));break;case 12:if(r&2048){oi(e,t,i,s),e=t.stateNode;try{var n=t.memoizedProps,l=n.id,a=n.onPostCommit;typeof a=="function"&&a(l,t.alternate===null?"mount":"update",e.passiveEffectDuration,-0)}catch(o){de(t,t.return,o)}}else oi(e,t,i,s);break;case 31:oi(e,t,i,s);break;case 13:oi(e,t,i,s);break;case 23:break;case 22:n=t.stateNode,l=t.alternate,t.memoizedState!==null?n._visibility&2?oi(e,t,i,s):Hn(e,t):n._visibility&2?oi(e,t,i,s):(n._visibility|=2,hr(e,t,i,s,(t.subtreeFlags&10256)!==0||!1)),r&2048&&Xu(l,t);break;case 24:oi(e,t,i,s),r&2048&&Gu(t.alternate,t);break;default:oi(e,t,i,s)}}function hr(e,t,i,s,r){for(r=r&&((t.subtreeFlags&10256)!==0||!1),t=t.child;t!==null;){var n=e,l=t,a=i,o=s,c=l.flags;switch(l.tag){case 0:case 11:case 15:hr(n,l,a,o,r),pl(8,l);break;case 23:break;case 22:var _=l.stateNode;l.memoizedState!==null?_._visibility&2?hr(n,l,a,o,r):Hn(n,l):(_._visibility|=2,hr(n,l,a,o,r)),r&&c&2048&&Xu(l.alternate,l);break;case 24:hr(n,l,a,o,r),r&&c&2048&&Gu(l.alternate,l);break;default:hr(n,l,a,o,r)}t=t.sibling}}function Hn(e,t){if(t.subtreeFlags&10256)for(t=t.child;t!==null;){var i=e,s=t,r=s.flags;switch(s.tag){case 22:Hn(i,s),r&2048&&Xu(s.alternate,s);break;case 24:Hn(i,s),r&2048&&Gu(s.alternate,s);break;default:Hn(i,s)}t=t.sibling}}var Cn=8192;function nr(e,t,i){if(e.subtreeFlags&Cn)for(e=e.child;e!==null;)Sg(e,t,i),e=e.sibling}function Sg(e,t,i){switch(e.tag){case 26:nr(e,t,i),e.flags&Cn&&e.memoizedState!==null&&ny(i,hi,e.memoizedState,e.memoizedProps);break;case 5:nr(e,t,i);break;case 3:case 4:var s=hi;hi=Pa(e.stateNode.containerInfo),nr(e,t,i),hi=s;break;case 22:e.memoizedState===null&&(s=e.alternate,s!==null&&s.memoizedState!==null?(s=Cn,Cn=16777216,nr(e,t,i),Cn=s):nr(e,t,i));break;default:nr(e,t,i)}}function yg(e){var t=e.alternate;if(t!==null&&(e=t.child,e!==null)){t.child=null;do t=e.sibling,e.sibling=null,e=t;while(e!==null)}}function cn(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var i=0;i<t.length;i++){var s=t[i];Qe=s,Cg(s,e)}yg(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)bg(e),e=e.sibling}function bg(e){switch(e.tag){case 0:case 11:case 15:cn(e),e.flags&2048&&xs(9,e,e.return);break;case 3:cn(e);break;case 12:cn(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,sa(e)):cn(e);break;default:cn(e)}}function sa(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var i=0;i<t.length;i++){var s=t[i];Qe=s,Cg(s,e)}yg(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:xs(8,t,t.return),sa(t);break;case 22:i=t.stateNode,i._visibility&2&&(i._visibility&=-3,sa(t));break;default:sa(t)}e=e.sibling}}function Cg(e,t){for(;Qe!==null;){var i=Qe;switch(i.tag){case 0:case 11:case 15:xs(8,i,t);break;case 23:case 22:if(i.memoizedState!==null&&i.memoizedState.cachePool!==null){var s=i.memoizedState.cachePool.pool;s!=null&&s.refCount++}break;case 24:fl(i.memoizedState.cache)}if(s=i.child,s!==null)s.return=i,Qe=s;else e:for(i=e;Qe!==null;){s=Qe;var r=s.sibling,n=s.return;if(dg(s),s===i){Qe=null;break e}if(r!==null){r.return=n,Qe=r;break e}Qe=n}}}var y1={getCacheForType:function(e){var t=ut(Ue),i=t.data.get(e);return i===void 0&&(i=e(),t.data.set(e,i)),i},cacheSignal:function(){return ut(Ue).controller.signal}},b1=typeof WeakMap=="function"?WeakMap:Map,ce=0,me=null,ne=null,le=0,ue=0,Ot=null,os=!1,Fr=!1,$u=!1,Vi=0,Re=0,Es=0,Ps=0,Fu=0,jt=0,Ur=0,Un=null,Tt=null,rh=!1,_o=0,wg=0,Oa=1/0,La=null,ms=null,Ie=0,gs=null,qr=null,qi=0,nh=0,lh=null,xg=null,qn=0,ah=null;function Pt(){return ce&2&&le!==0?le&-le:X.T!==null?Qu():Np()}function Eg(){if(jt===0)if(!(le&536870912)||ae){var e=Tl;Tl<<=1,!(Tl&3932160)&&(Tl=262144),jt=e}else jt=536870912;return e=Wt.current,e!==null&&(e.flags|=32),jt}function Dt(e,t,i){(e===me&&(ue===2||ue===9)||e.cancelPendingCommit!==null)&&(Pr(e,0),cs(e,le,jt,!1)),hl(e,i),(!(ce&2)||e!==me)&&(e===me&&(!(ce&2)&&(Ps|=i),Re===4&&cs(e,le,jt,!1)),xi(e))}function kg(e,t,i){if(ce&6)throw Error(M(327));var s=!i&&(t&127)===0&&(t&e.expiredLanes)===0||cl(e,t),r=s?x1(e,t):Qo(e,t,!0),n=s;do{if(r===0){Fr&&!s&&cs(e,t,0,!1);break}else{if(i=e.current.alternate,n&&!C1(i)){r=Qo(e,t,!1),n=!1;continue}if(r===2){if(n=t,e.errorRecoveryDisabledLanes&n)var l=0;else l=e.pendingLanes&-536870913,l=l!==0?l:l&536870912?536870912:0;if(l!==0){t=l;e:{var a=e;r=Un;var o=a.current.memoizedState.isDehydrated;if(o&&(Pr(a,l).flags|=256),l=Qo(a,l,!1),l!==2){if($u&&!o){a.errorRecoveryDisabledLanes|=n,Ps|=n,r=4;break e}n=Tt,Tt=r,n!==null&&(Tt===null?Tt=n:Tt.push.apply(Tt,n))}r=l}if(n=!1,r!==2)continue}}if(r===1){Pr(e,0),cs(e,t,0,!0);break}e:{switch(s=e,n=r,n){case 0:case 1:throw Error(M(345));case 4:if((t&4194048)!==t)break;case 6:cs(s,t,jt,!os);break e;case 2:Tt=null;break;case 3:case 5:break;default:throw Error(M(329))}if((t&62914560)===t&&(r=_o+300-Ht(),10<r)){if(cs(s,t,jt,!os),io(s,0,!0)!==0)break e;qi=t,s.timeoutHandle=Ig(wf.bind(null,s,i,Tt,La,rh,t,jt,Ps,Ur,os,n,"Throttled",-0,0),r);break e}wf(s,i,Tt,La,rh,t,jt,Ps,Ur,os,n,null,-0,0)}}break}while(!0);xi(e)}function wf(e,t,i,s,r,n,l,a,o,c,_,f,u,d){if(e.timeoutHandle=-1,f=t.subtreeFlags,f&8192||(f&16785408)===16785408){f={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Li},Sg(t,n,f);var g=(n&62914560)===n?_o-Ht():(n&4194048)===n?wg-Ht():0;if(g=ly(f,g),g!==null){qi=n,e.cancelPendingCommit=g(Ef.bind(null,e,t,n,i,s,r,l,a,o,_,f,null,u,d)),cs(e,n,l,!c);return}}Ef(e,t,n,i,s,r,l,a,o)}function C1(e){for(var t=e;;){var i=t.tag;if((i===0||i===11||i===15)&&t.flags&16384&&(i=t.updateQueue,i!==null&&(i=i.stores,i!==null)))for(var s=0;s<i.length;s++){var r=i[s],n=r.getSnapshot;r=r.value;try{if(!Kt(n(),r))return!1}catch{return!1}}if(i=t.child,t.subtreeFlags&16384&&i!==null)i.return=t,t=i;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function cs(e,t,i,s){t&=~Fu,t&=~Ps,e.suspendedLanes|=t,e.pingedLanes&=~t,s&&(e.warmLanes|=t),s=e.expirationTimes;for(var r=t;0<r;){var n=31-qt(r),l=1<<n;s[n]=-1,r&=~l}i!==0&&Bp(e,i,t)}function po(){return ce&6?!0:(ml(0),!1)}function Zu(){if(ne!==null){if(ue===0)var e=ne.return;else e=ne,zi=er=null,zu(e),Mr=null,Fn=0,e=ne;for(;e!==null;)ng(e.alternate,e),e=e.return;ne=null}}function Pr(e,t){var i=e.timeoutHandle;i!==-1&&(e.timeoutHandle=-1,K1(i)),i=e.cancelPendingCommit,i!==null&&(e.cancelPendingCommit=null,i()),qi=0,Zu(),me=e,ne=i=Hi(e.current,null),le=t,ue=0,Ot=null,os=!1,Fr=cl(e,t),$u=!1,Ur=jt=Fu=Ps=Es=Re=0,Tt=Un=null,rh=!1,t&8&&(t|=t&32);var s=e.entangledLanes;if(s!==0)for(e=e.entanglements,s&=t;0<s;){var r=31-qt(s),n=1<<r;t|=e[r],s&=~n}return Vi=t,lo(),i}function Tg(e,t){ee=null,X.H=Qn,t===$r||t===oo?(t=ef(),ue=3):t===Mu?(t=ef(),ue=4):ue=t===Vu?8:t!==null&&typeof t=="object"&&typeof t.then=="function"?6:1,Ot=t,ne===null&&(Re=1,Ra(e,ei(t,e.current)))}function Dg(){var e=Wt.current;return e===null?!0:(le&4194048)===le?ii===null:(le&62914560)===le||le&536870912?e===ii:!1}function Mg(){var e=X.H;return X.H=Qn,e===null?Qn:e}function Bg(){var e=X.A;return X.A=y1,e}function za(){Re=4,os||(le&4194048)!==le&&Wt.current!==null||(Fr=!0),!(Es&134217727)&&!(Ps&134217727)||me===null||cs(me,le,jt,!1)}function Qo(e,t,i){var s=ce;ce|=2;var r=Mg(),n=Bg();(me!==e||le!==t)&&(La=null,Pr(e,t)),t=!1;var l=Re;e:do try{if(ue!==0&&ne!==null){var a=ne,o=Ot;switch(ue){case 8:Zu(),l=6;break e;case 3:case 2:case 9:case 6:Wt.current===null&&(t=!0);var c=ue;if(ue=0,Ot=null,wr(e,a,o,c),i&&Fr){l=0;break e}break;default:c=ue,ue=0,Ot=null,wr(e,a,o,c)}}w1(),l=Re;break}catch(_){Tg(e,_)}while(!0);return t&&e.shellSuspendCounter++,zi=er=null,ce=s,X.H=r,X.A=n,ne===null&&(me=null,le=0,lo()),l}function w1(){for(;ne!==null;)Rg(ne)}function x1(e,t){var i=ce;ce|=2;var s=Mg(),r=Bg();me!==e||le!==t?(La=null,Oa=Ht()+500,Pr(e,t)):Fr=cl(e,t);e:do try{if(ue!==0&&ne!==null){t=ne;var n=Ot;t:switch(ue){case 1:ue=0,Ot=null,wr(e,t,n,1);break;case 2:case 9:if(Jd(n)){ue=0,Ot=null,xf(t);break}t=function(){ue!==2&&ue!==9||me!==e||(ue=7),xi(e)},n.then(t,t);break e;case 3:ue=7;break e;case 4:ue=5;break e;case 7:Jd(n)?(ue=0,Ot=null,xf(t)):(ue=0,Ot=null,wr(e,t,n,7));break;case 5:var l=null;switch(ne.tag){case 26:l=ne.memoizedState;case 5:case 27:var a=ne;if(l?Zg(l):a.stateNode.complete){ue=0,Ot=null;var o=a.sibling;if(o!==null)ne=o;else{var c=a.return;c!==null?(ne=c,mo(c)):ne=null}break t}}ue=0,Ot=null,wr(e,t,n,5);break;case 6:ue=0,Ot=null,wr(e,t,n,6);break;case 8:Zu(),Re=6;break e;default:throw Error(M(462))}}E1();break}catch(_){Tg(e,_)}while(!0);return zi=er=null,X.H=s,X.A=r,ce=i,ne!==null?0:(me=null,le=0,lo(),Re)}function E1(){for(;ne!==null&&!G0();)Rg(ne)}function Rg(e){var t=rg(e.alternate,e,Vi);e.memoizedProps=e.pendingProps,t===null?mo(e):ne=t}function xf(e){var t=e,i=t.alternate;switch(t.tag){case 15:case 0:t=gf(i,t,t.pendingProps,t.type,void 0,le);break;case 11:t=gf(i,t,t.pendingProps,t.type.render,t.ref,le);break;case 5:zu(t);default:ng(i,t),t=ne=nm(t,Vi),t=rg(i,t,Vi)}e.memoizedProps=e.pendingProps,t===null?mo(e):ne=t}function wr(e,t,i,s){zi=er=null,zu(t),Mr=null,Fn=0;var r=t.return;try{if(f1(e,r,t,i,le)){Re=1,Ra(e,ei(i,e.current)),ne=null;return}}catch(n){if(r!==null)throw ne=r,n;Re=1,Ra(e,ei(i,e.current)),ne=null;return}t.flags&32768?(ae||s===1?e=!0:Fr||le&536870912?e=!1:(os=e=!0,(s===2||s===9||s===3||s===6)&&(s=Wt.current,s!==null&&s.tag===13&&(s.flags|=16384))),Ag(t,e)):mo(t)}function mo(e){var t=e;do{if(t.flags&32768){Ag(t,os);return}e=t.return;var i=m1(t.alternate,t,Vi);if(i!==null){ne=i;return}if(t=t.sibling,t!==null){ne=t;return}ne=t=e}while(t!==null);Re===0&&(Re=5)}function Ag(e,t){do{var i=g1(e.alternate,e);if(i!==null){i.flags&=32767,ne=i;return}if(i=e.return,i!==null&&(i.flags|=32768,i.subtreeFlags=0,i.deletions=null),!t&&(e=e.sibling,e!==null)){ne=e;return}ne=e=i}while(e!==null);Re=6,ne=null}function Ef(e,t,i,s,r,n,l,a,o){e.cancelPendingCommit=null;do go();while(Ie!==0);if(ce&6)throw Error(M(327));if(t!==null){if(t===e.current)throw Error(M(177));if(n=t.lanes|t.childLanes,n|=Cu,rS(e,i,n,l,a,o),e===me&&(ne=me=null,le=0),qr=t,gs=e,qi=i,nh=n,lh=r,xg=s,t.subtreeFlags&10256||t.flags&10256?(e.callbackNode=null,e.callbackPriority=0,M1(ya,function(){return jg(),null})):(e.callbackNode=null,e.callbackPriority=0),s=(t.flags&13878)!==0,t.subtreeFlags&13878||s){s=X.T,X.T=null,r=he.p,he.p=2,l=ce,ce|=4;try{v1(e,t,i)}finally{ce=l,he.p=r,X.T=s}}Ie=1,Ng(),Og(),Lg()}}function Ng(){if(Ie===1){Ie=0;var e=gs,t=qr,i=(t.flags&13878)!==0;if(t.subtreeFlags&13878||i){i=X.T,X.T=null;var s=he.p;he.p=2;var r=ce;ce|=4;try{mg(t,e);var n=uh,l=Zp(e.containerInfo),a=n.focusedElem,o=n.selectionRange;if(l!==a&&a&&a.ownerDocument&&Fp(a.ownerDocument.documentElement,a)){if(o!==null&&bu(a)){var c=o.start,_=o.end;if(_===void 0&&(_=c),"selectionStart"in a)a.selectionStart=c,a.selectionEnd=Math.min(_,a.value.length);else{var f=a.ownerDocument||document,u=f&&f.defaultView||window;if(u.getSelection){var d=u.getSelection(),g=a.textContent.length,y=Math.min(o.start,g),C=o.end===void 0?y:Math.min(o.end,g);!d.extend&&y>C&&(l=C,C=y,y=l);var m=Id(a,y),p=Id(a,C);if(m&&p&&(d.rangeCount!==1||d.anchorNode!==m.node||d.anchorOffset!==m.offset||d.focusNode!==p.node||d.focusOffset!==p.offset)){var v=f.createRange();v.setStart(m.node,m.offset),d.removeAllRanges(),y>C?(d.addRange(v),d.extend(p.node,p.offset)):(v.setEnd(p.node,p.offset),d.addRange(v))}}}}for(f=[],d=a;d=d.parentNode;)d.nodeType===1&&f.push({element:d,left:d.scrollLeft,top:d.scrollTop});for(typeof a.focus=="function"&&a.focus(),a=0;a<f.length;a++){var S=f[a];S.element.scrollLeft=S.left,S.element.scrollTop=S.top}}Ya=!!hh,uh=hh=null}finally{ce=r,he.p=s,X.T=i}}e.current=t,Ie=2}}function Og(){if(Ie===2){Ie=0;var e=gs,t=qr,i=(t.flags&8772)!==0;if(t.subtreeFlags&8772||i){i=X.T,X.T=null;var s=he.p;he.p=2;var r=ce;ce|=4;try{ug(e,t.alternate,t)}finally{ce=r,he.p=s,X.T=i}}Ie=3}}function Lg(){if(Ie===4||Ie===3){Ie=0,$0();var e=gs,t=qr,i=qi,s=xg;t.subtreeFlags&10256||t.flags&10256?Ie=5:(Ie=0,qr=gs=null,zg(e,e.pendingLanes));var r=e.pendingLanes;if(r===0&&(ms=null),_u(i),t=t.stateNode,Ut&&typeof Ut.onCommitFiberRoot=="function")try{Ut.onCommitFiberRoot(ol,t,void 0,(t.current.flags&128)===128)}catch{}if(s!==null){t=X.T,r=he.p,he.p=2,X.T=null;try{for(var n=e.onRecoverableError,l=0;l<s.length;l++){var a=s[l];n(a.value,{componentStack:a.stack})}}finally{X.T=t,he.p=r}}qi&3&&go(),xi(e),r=e.pendingLanes,i&261930&&r&42?e===ah?qn++:(qn=0,ah=e):qn=0,ml(0)}}function zg(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,fl(t)))}function go(){return Ng(),Og(),Lg(),jg()}function jg(){if(Ie!==5)return!1;var e=gs,t=nh;nh=0;var i=_u(qi),s=X.T,r=he.p;try{he.p=32>i?32:i,X.T=null,i=lh,lh=null;var n=gs,l=qi;if(Ie=0,qr=gs=null,qi=0,ce&6)throw Error(M(331));var a=ce;if(ce|=4,bg(n.current),vg(n,n.current,l,i),ce=a,ml(0,!1),Ut&&typeof Ut.onPostCommitFiberRoot=="function")try{Ut.onPostCommitFiberRoot(ol,n)}catch{}return!0}finally{he.p=r,X.T=s,zg(e,t)}}function kf(e,t,i){t=ei(i,t),t=eh(e.stateNode,t,2),e=ps(e,t,2),e!==null&&(hl(e,2),xi(e))}function de(e,t,i){if(e.tag===3)kf(e,e,i);else for(;t!==null;){if(t.tag===3){kf(t,e,i);break}else if(t.tag===1){var s=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof s.componentDidCatch=="function"&&(ms===null||!ms.has(s))){e=ei(i,e),i=Qm(2),s=ps(t,i,2),s!==null&&(Jm(i,s,t,e),hl(s,2),xi(s));break}}t=t.return}}function Jo(e,t,i){var s=e.pingCache;if(s===null){s=e.pingCache=new b1;var r=new Set;s.set(t,r)}else r=s.get(t),r===void 0&&(r=new Set,s.set(t,r));r.has(i)||($u=!0,r.add(i),e=k1.bind(null,e,t,i),t.then(e,e))}function k1(e,t,i){var s=e.pingCache;s!==null&&s.delete(t),e.pingedLanes|=e.suspendedLanes&i,e.warmLanes&=~i,me===e&&(le&i)===i&&(Re===4||Re===3&&(le&62914560)===le&&300>Ht()-_o?!(ce&2)&&Pr(e,0):Fu|=i,Ur===le&&(Ur=0)),xi(e)}function Hg(e,t){t===0&&(t=Mp()),e=Js(e,t),e!==null&&(hl(e,t),xi(e))}function T1(e){var t=e.memoizedState,i=0;t!==null&&(i=t.retryLane),Hg(e,i)}function D1(e,t){var i=0;switch(e.tag){case 31:case 13:var s=e.stateNode,r=e.memoizedState;r!==null&&(i=r.retryLane);break;case 19:s=e.stateNode;break;case 22:s=e.stateNode._retryCache;break;default:throw Error(M(314))}s!==null&&s.delete(t),Hg(e,i)}function M1(e,t){return du(e,t)}var ja=null,ur=null,oh=!1,Ha=!1,ec=!1,hs=0;function xi(e){e!==ur&&e.next===null&&(ur===null?ja=ur=e:ur=ur.next=e),Ha=!0,oh||(oh=!0,R1())}function ml(e,t){if(!ec&&Ha){ec=!0;do for(var i=!1,s=ja;s!==null;){if(e!==0){var r=s.pendingLanes;if(r===0)var n=0;else{var l=s.suspendedLanes,a=s.pingedLanes;n=(1<<31-qt(42|e)+1)-1,n&=r&~(l&~a),n=n&201326741?n&201326741|1:n?n|2:0}n!==0&&(i=!0,Tf(s,n))}else n=le,n=io(s,s===me?n:0,s.cancelPendingCommit!==null||s.timeoutHandle!==-1),!(n&3)||cl(s,n)||(i=!0,Tf(s,n));s=s.next}while(i);ec=!1}}function B1(){Ug()}function Ug(){Ha=oh=!1;var e=0;hs!==0&&P1()&&(e=hs);for(var t=Ht(),i=null,s=ja;s!==null;){var r=s.next,n=qg(s,t);n===0?(s.next=null,i===null?ja=r:i.next=r,r===null&&(ur=i)):(i=s,(e!==0||n&3)&&(Ha=!0)),s=r}Ie!==0&&Ie!==5||ml(e),hs!==0&&(hs=0)}function qg(e,t){for(var i=e.suspendedLanes,s=e.pingedLanes,r=e.expirationTimes,n=e.pendingLanes&-62914561;0<n;){var l=31-qt(n),a=1<<l,o=r[l];o===-1?(!(a&i)||a&s)&&(r[l]=sS(a,t)):o<=t&&(e.expiredLanes|=a),n&=~a}if(t=me,i=le,i=io(e,e===t?i:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),s=e.callbackNode,i===0||e===t&&(ue===2||ue===9)||e.cancelPendingCommit!==null)return s!==null&&s!==null&&Do(s),e.callbackNode=null,e.callbackPriority=0;if(!(i&3)||cl(e,i)){if(t=i&-i,t===e.callbackPriority)return t;switch(s!==null&&Do(s),_u(i)){case 2:case 8:i=Tp;break;case 32:i=ya;break;case 268435456:i=Dp;break;default:i=ya}return s=Pg.bind(null,e),i=du(i,s),e.callbackPriority=t,e.callbackNode=i,t}return s!==null&&s!==null&&Do(s),e.callbackPriority=2,e.callbackNode=null,2}function Pg(e,t){if(Ie!==0&&Ie!==5)return e.callbackNode=null,e.callbackPriority=0,null;var i=e.callbackNode;if(go()&&e.callbackNode!==i)return null;var s=le;return s=io(e,e===me?s:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),s===0?null:(kg(e,s,t),qg(e,Ht()),e.callbackNode!=null&&e.callbackNode===i?Pg.bind(null,e):null)}function Tf(e,t){if(go())return null;kg(e,t,!0)}function R1(){W1(function(){ce&6?du(kp,B1):Ug()})}function Qu(){if(hs===0){var e=zr;e===0&&(e=kl,kl<<=1,!(kl&261888)&&(kl=256)),hs=e}return hs}function Df(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:Gl(""+e)}function Mf(e,t){var i=t.ownerDocument.createElement("input");return i.name=t.name,i.value=t.value,e.id&&i.setAttribute("form",e.id),t.parentNode.insertBefore(i,t),e=new FormData(e),i.parentNode.removeChild(i),e}function A1(e,t,i,s,r){if(t==="submit"&&i&&i.stateNode===r){var n=Df((r[Mt]||null).action),l=s.submitter;l&&(t=(t=l[Mt]||null)?Df(t.formAction):l.getAttribute("formAction"),t!==null&&(n=t,l=null));var a=new so("action","action",null,s,r);e.push({event:a,listeners:[{instance:null,listener:function(){if(s.defaultPrevented){if(hs!==0){var o=l?Mf(r,l):new FormData(r);Qc(i,{pending:!0,data:o,method:r.method,action:n},null,o)}}else typeof n=="function"&&(a.preventDefault(),o=l?Mf(r,l):new FormData(r),Qc(i,{pending:!0,data:o,method:r.method,action:n},n,o))},currentTarget:r}]})}}for(var tc=0;tc<qc.length;tc++){var ic=qc[tc],N1=ic.toLowerCase(),O1=ic[0].toUpperCase()+ic.slice(1);ui(N1,"on"+O1)}ui(Jp,"onAnimationEnd");ui(em,"onAnimationIteration");ui(tm,"onAnimationStart");ui("dblclick","onDoubleClick");ui("focusin","onFocus");ui("focusout","onBlur");ui(FS,"onTransitionRun");ui(ZS,"onTransitionStart");ui(QS,"onTransitionCancel");ui(im,"onTransitionEnd");Or("onMouseEnter",["mouseout","mouseover"]);Or("onMouseLeave",["mouseout","mouseover"]);Or("onPointerEnter",["pointerout","pointerover"]);Or("onPointerLeave",["pointerout","pointerover"]);Fs("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));Fs("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));Fs("onBeforeInput",["compositionend","keypress","textInput","paste"]);Fs("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));Fs("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));Fs("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Jn="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(" "),L1=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Jn));function Kg(e,t){t=(t&4)!==0;for(var i=0;i<e.length;i++){var s=e[i],r=s.event;s=s.listeners;e:{var n=void 0;if(t)for(var l=s.length-1;0<=l;l--){var a=s[l],o=a.instance,c=a.currentTarget;if(a=a.listener,o!==n&&r.isPropagationStopped())break e;n=a,r.currentTarget=c;try{n(r)}catch(_){Ca(_)}r.currentTarget=null,n=o}else for(l=0;l<s.length;l++){if(a=s[l],o=a.instance,c=a.currentTarget,a=a.listener,o!==n&&r.isPropagationStopped())break e;n=a,r.currentTarget=c;try{n(r)}catch(_){Ca(_)}r.currentTarget=null,n=o}}}}function re(e,t){var i=t[Ac];i===void 0&&(i=t[Ac]=new Set);var s=e+"__bubble";i.has(s)||(Wg(t,e,2,!1),i.add(s))}function sc(e,t,i){var s=0;t&&(s|=4),Wg(i,e,s,t)}var zl="_reactListening"+Math.random().toString(36).slice(2);function Ju(e){if(!e[zl]){e[zl]=!0,Op.forEach(function(i){i!=="selectionchange"&&(L1.has(i)||sc(i,!1,e),sc(i,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[zl]||(t[zl]=!0,sc("selectionchange",!1,t))}}function Wg(e,t,i,s){switch(iv(t)){case 2:var r=cy;break;case 8:r=hy;break;default:r=sd}i=r.bind(null,t,i,e),r=void 0,!jc||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(r=!0),s?r!==void 0?e.addEventListener(t,i,{capture:!0,passive:r}):e.addEventListener(t,i,!0):r!==void 0?e.addEventListener(t,i,{passive:r}):e.addEventListener(t,i,!1)}function rc(e,t,i,s,r){var n=s;if(!(t&1)&&!(t&2)&&s!==null)e:for(;;){if(s===null)return;var l=s.tag;if(l===3||l===4){var a=s.stateNode.containerInfo;if(a===r)break;if(l===4)for(l=s.return;l!==null;){var o=l.tag;if((o===3||o===4)&&l.stateNode.containerInfo===r)return;l=l.return}for(;a!==null;){if(l=_r(a),l===null)return;if(o=l.tag,o===5||o===6||o===26||o===27){s=n=l;continue e}a=a.parentNode}}s=s.return}Kp(function(){var c=n,_=gu(i),f=[];e:{var u=sm.get(e);if(u!==void 0){var d=so,g=e;switch(e){case"keypress":if(Fl(i)===0)break e;case"keydown":case"keyup":d=DS;break;case"focusin":g="focus",d=No;break;case"focusout":g="blur",d=No;break;case"beforeblur":case"afterblur":d=No;break;case"click":if(i.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":d=zd;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":d=mS;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":d=RS;break;case Jp:case em:case tm:d=SS;break;case im:d=NS;break;case"scroll":case"scrollend":d=_S;break;case"wheel":d=LS;break;case"copy":case"cut":case"paste":d=bS;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":d=Hd;break;case"toggle":case"beforetoggle":d=jS}var y=(t&4)!==0,C=!y&&(e==="scroll"||e==="scrollend"),m=y?u!==null?u+"Capture":null:u;y=[];for(var p=c,v;p!==null;){var S=p;if(v=S.stateNode,S=S.tag,S!==5&&S!==26&&S!==27||v===null||m===null||(S=Vn(p,m),S!=null&&y.push(el(p,S,v))),C)break;p=p.return}0<y.length&&(u=new d(u,g,null,i,_),f.push({event:u,listeners:y}))}}if(!(t&7)){e:{if(u=e==="mouseover"||e==="pointerover",d=e==="mouseout"||e==="pointerout",u&&i!==zc&&(g=i.relatedTarget||i.fromElement)&&(_r(g)||g[Ir]))break e;if((d||u)&&(u=_.window===_?_:(u=_.ownerDocument)?u.defaultView||u.parentWindow:window,d?(g=i.relatedTarget||i.toElement,d=c,g=g?_r(g):null,g!==null&&(C=al(g),y=g.tag,g!==C||y!==5&&y!==27&&y!==6)&&(g=null)):(d=null,g=c),d!==g)){if(y=zd,S="onMouseLeave",m="onMouseEnter",p="mouse",(e==="pointerout"||e==="pointerover")&&(y=Hd,S="onPointerLeave",m="onPointerEnter",p="pointer"),C=d==null?u:yn(d),v=g==null?u:yn(g),u=new y(S,p+"leave",d,i,_),u.target=C,u.relatedTarget=v,S=null,_r(_)===c&&(y=new y(m,p+"enter",g,i,_),y.target=v,y.relatedTarget=C,S=y),C=S,d&&g)t:{for(y=z1,m=d,p=g,v=0,S=m;S;S=y(S))v++;S=0;for(var k=p;k;k=y(k))S++;for(;0<v-S;)m=y(m),v--;for(;0<S-v;)p=y(p),S--;for(;v--;){if(m===p||p!==null&&m===p.alternate){y=m;break t}m=y(m),p=y(p)}y=null}else y=null;d!==null&&Bf(f,u,d,y,!1),g!==null&&C!==null&&Bf(f,C,g,y,!0)}}e:{if(u=c?yn(c):window,d=u.nodeName&&u.nodeName.toLowerCase(),d==="select"||d==="input"&&u.type==="file")var j=Kd;else if(Pd(u))if(Gp)j=XS;else{j=VS;var O=YS}else d=u.nodeName,!d||d.toLowerCase()!=="input"||u.type!=="checkbox"&&u.type!=="radio"?c&&mu(c.elementType)&&(j=Kd):j=IS;if(j&&(j=j(e,c))){Xp(f,j,i,_);break e}O&&O(e,u,c),e==="focusout"&&c&&u.type==="number"&&c.memoizedProps.value!=null&&Lc(u,"number",u.value)}switch(O=c?yn(c):window,e){case"focusin":(Pd(O)||O.contentEditable==="true")&&(gr=O,Hc=c,Rn=null);break;case"focusout":Rn=Hc=gr=null;break;case"mousedown":Uc=!0;break;case"contextmenu":case"mouseup":case"dragend":Uc=!1,Xd(f,i,_);break;case"selectionchange":if($S)break;case"keydown":case"keyup":Xd(f,i,_)}var q;if(yu)e:{switch(e){case"compositionstart":var W="onCompositionStart";break e;case"compositionend":W="onCompositionEnd";break e;case"compositionupdate":W="onCompositionUpdate";break e}W=void 0}else mr?Vp(e,i)&&(W="onCompositionEnd"):e==="keydown"&&i.keyCode===229&&(W="onCompositionStart");W&&(Yp&&i.locale!=="ko"&&(mr||W!=="onCompositionStart"?W==="onCompositionEnd"&&mr&&(q=Wp()):(as=_,vu="value"in as?as.value:as.textContent,mr=!0)),O=Ua(c,W),0<O.length&&(W=new jd(W,e,null,i,_),f.push({event:W,listeners:O}),q?W.data=q:(q=Ip(i),q!==null&&(W.data=q)))),(q=US?qS(e,i):PS(e,i))&&(W=Ua(c,"onBeforeInput"),0<W.length&&(O=new jd("onBeforeInput","beforeinput",null,i,_),f.push({event:O,listeners:W}),O.data=q)),A1(f,e,c,i,_)}Kg(f,t)})}function el(e,t,i){return{instance:e,listener:t,currentTarget:i}}function Ua(e,t){for(var i=t+"Capture",s=[];e!==null;){var r=e,n=r.stateNode;if(r=r.tag,r!==5&&r!==26&&r!==27||n===null||(r=Vn(e,i),r!=null&&s.unshift(el(e,r,n)),r=Vn(e,t),r!=null&&s.push(el(e,r,n))),e.tag===3)return s;e=e.return}return[]}function z1(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function Bf(e,t,i,s,r){for(var n=t._reactName,l=[];i!==null&&i!==s;){var a=i,o=a.alternate,c=a.stateNode;if(a=a.tag,o!==null&&o===s)break;a!==5&&a!==26&&a!==27||c===null||(o=c,r?(c=Vn(i,n),c!=null&&l.unshift(el(i,c,o))):r||(c=Vn(i,n),c!=null&&l.push(el(i,c,o)))),i=i.return}l.length!==0&&e.push({event:t,listeners:l})}var j1=/\r\n?/g,H1=/\u0000|\uFFFD/g;function Rf(e){return(typeof e=="string"?e:""+e).replace(j1,`
|
|
49
|
-
`).replace(H1,"")}function Yg(e,t){return t=Rf(t),Rf(e)===t}function _e(e,t,i,s,r,n){switch(i){case"children":typeof s=="string"?t==="body"||t==="textarea"&&s===""||Lr(e,s):(typeof s=="number"||typeof s=="bigint")&&t!=="body"&&Lr(e,""+s);break;case"className":Ml(e,"class",s);break;case"tabIndex":Ml(e,"tabindex",s);break;case"dir":case"role":case"viewBox":case"width":case"height":Ml(e,i,s);break;case"style":Pp(e,s,n);break;case"data":if(t!=="object"){Ml(e,"data",s);break}case"src":case"href":if(s===""&&(t!=="a"||i!=="href")){e.removeAttribute(i);break}if(s==null||typeof s=="function"||typeof s=="symbol"||typeof s=="boolean"){e.removeAttribute(i);break}s=Gl(""+s),e.setAttribute(i,s);break;case"action":case"formAction":if(typeof s=="function"){e.setAttribute(i,"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 n=="function"&&(i==="formAction"?(t!=="input"&&_e(e,t,"name",r.name,r,null),_e(e,t,"formEncType",r.formEncType,r,null),_e(e,t,"formMethod",r.formMethod,r,null),_e(e,t,"formTarget",r.formTarget,r,null)):(_e(e,t,"encType",r.encType,r,null),_e(e,t,"method",r.method,r,null),_e(e,t,"target",r.target,r,null)));if(s==null||typeof s=="symbol"||typeof s=="boolean"){e.removeAttribute(i);break}s=Gl(""+s),e.setAttribute(i,s);break;case"onClick":s!=null&&(e.onclick=Li);break;case"onScroll":s!=null&&re("scroll",e);break;case"onScrollEnd":s!=null&&re("scrollend",e);break;case"dangerouslySetInnerHTML":if(s!=null){if(typeof s!="object"||!("__html"in s))throw Error(M(61));if(i=s.__html,i!=null){if(r.children!=null)throw Error(M(60));e.innerHTML=i}}break;case"multiple":e.multiple=s&&typeof s!="function"&&typeof s!="symbol";break;case"muted":e.muted=s&&typeof s!="function"&&typeof s!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(s==null||typeof s=="function"||typeof s=="boolean"||typeof s=="symbol"){e.removeAttribute("xlink:href");break}i=Gl(""+s),e.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",i);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":s!=null&&typeof s!="function"&&typeof s!="symbol"?e.setAttribute(i,""+s):e.removeAttribute(i);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":s&&typeof s!="function"&&typeof s!="symbol"?e.setAttribute(i,""):e.removeAttribute(i);break;case"capture":case"download":s===!0?e.setAttribute(i,""):s!==!1&&s!=null&&typeof s!="function"&&typeof s!="symbol"?e.setAttribute(i,s):e.removeAttribute(i);break;case"cols":case"rows":case"size":case"span":s!=null&&typeof s!="function"&&typeof s!="symbol"&&!isNaN(s)&&1<=s?e.setAttribute(i,s):e.removeAttribute(i);break;case"rowSpan":case"start":s==null||typeof s=="function"||typeof s=="symbol"||isNaN(s)?e.removeAttribute(i):e.setAttribute(i,s);break;case"popover":re("beforetoggle",e),re("toggle",e),Xl(e,"popover",s);break;case"xlinkActuate":ki(e,"http://www.w3.org/1999/xlink","xlink:actuate",s);break;case"xlinkArcrole":ki(e,"http://www.w3.org/1999/xlink","xlink:arcrole",s);break;case"xlinkRole":ki(e,"http://www.w3.org/1999/xlink","xlink:role",s);break;case"xlinkShow":ki(e,"http://www.w3.org/1999/xlink","xlink:show",s);break;case"xlinkTitle":ki(e,"http://www.w3.org/1999/xlink","xlink:title",s);break;case"xlinkType":ki(e,"http://www.w3.org/1999/xlink","xlink:type",s);break;case"xmlBase":ki(e,"http://www.w3.org/XML/1998/namespace","xml:base",s);break;case"xmlLang":ki(e,"http://www.w3.org/XML/1998/namespace","xml:lang",s);break;case"xmlSpace":ki(e,"http://www.w3.org/XML/1998/namespace","xml:space",s);break;case"is":Xl(e,"is",s);break;case"innerText":case"textContent":break;default:(!(2<i.length)||i[0]!=="o"&&i[0]!=="O"||i[1]!=="n"&&i[1]!=="N")&&(i=dS.get(i)||i,Xl(e,i,s))}}function ch(e,t,i,s,r,n){switch(i){case"style":Pp(e,s,n);break;case"dangerouslySetInnerHTML":if(s!=null){if(typeof s!="object"||!("__html"in s))throw Error(M(61));if(i=s.__html,i!=null){if(r.children!=null)throw Error(M(60));e.innerHTML=i}}break;case"children":typeof s=="string"?Lr(e,s):(typeof s=="number"||typeof s=="bigint")&&Lr(e,""+s);break;case"onScroll":s!=null&&re("scroll",e);break;case"onScrollEnd":s!=null&&re("scrollend",e);break;case"onClick":s!=null&&(e.onclick=Li);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Lp.hasOwnProperty(i))e:{if(i[0]==="o"&&i[1]==="n"&&(r=i.endsWith("Capture"),t=i.slice(2,r?i.length-7:void 0),n=e[Mt]||null,n=n!=null?n[i]:null,typeof n=="function"&&e.removeEventListener(t,n,r),typeof s=="function")){typeof n!="function"&&n!==null&&(i in e?e[i]=null:e.hasAttribute(i)&&e.removeAttribute(i)),e.addEventListener(t,s,r);break e}i in e?e[i]=s:s===!0?e.setAttribute(i,""):Xl(e,i,s)}}}function dt(e,t,i){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":re("error",e),re("load",e);var s=!1,r=!1,n;for(n in i)if(i.hasOwnProperty(n)){var l=i[n];if(l!=null)switch(n){case"src":s=!0;break;case"srcSet":r=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(M(137,t));default:_e(e,t,n,l,i,null)}}r&&_e(e,t,"srcSet",i.srcSet,i,null),s&&_e(e,t,"src",i.src,i,null);return;case"input":re("invalid",e);var a=n=l=r=null,o=null,c=null;for(s in i)if(i.hasOwnProperty(s)){var _=i[s];if(_!=null)switch(s){case"name":r=_;break;case"type":l=_;break;case"checked":o=_;break;case"defaultChecked":c=_;break;case"value":n=_;break;case"defaultValue":a=_;break;case"children":case"dangerouslySetInnerHTML":if(_!=null)throw Error(M(137,t));break;default:_e(e,t,s,_,i,null)}}Hp(e,n,a,o,c,l,r,!1);return;case"select":re("invalid",e),s=l=n=null;for(r in i)if(i.hasOwnProperty(r)&&(a=i[r],a!=null))switch(r){case"value":n=a;break;case"defaultValue":l=a;break;case"multiple":s=a;default:_e(e,t,r,a,i,null)}t=n,i=l,e.multiple=!!s,t!=null?kr(e,!!s,t,!1):i!=null&&kr(e,!!s,i,!0);return;case"textarea":re("invalid",e),n=r=s=null;for(l in i)if(i.hasOwnProperty(l)&&(a=i[l],a!=null))switch(l){case"value":s=a;break;case"defaultValue":r=a;break;case"children":n=a;break;case"dangerouslySetInnerHTML":if(a!=null)throw Error(M(91));break;default:_e(e,t,l,a,i,null)}qp(e,s,r,n);return;case"option":for(o in i)if(i.hasOwnProperty(o)&&(s=i[o],s!=null))switch(o){case"selected":e.selected=s&&typeof s!="function"&&typeof s!="symbol";break;default:_e(e,t,o,s,i,null)}return;case"dialog":re("beforetoggle",e),re("toggle",e),re("cancel",e),re("close",e);break;case"iframe":case"object":re("load",e);break;case"video":case"audio":for(s=0;s<Jn.length;s++)re(Jn[s],e);break;case"image":re("error",e),re("load",e);break;case"details":re("toggle",e);break;case"embed":case"source":case"link":re("error",e),re("load",e);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(c in i)if(i.hasOwnProperty(c)&&(s=i[c],s!=null))switch(c){case"children":case"dangerouslySetInnerHTML":throw Error(M(137,t));default:_e(e,t,c,s,i,null)}return;default:if(mu(t)){for(_ in i)i.hasOwnProperty(_)&&(s=i[_],s!==void 0&&ch(e,t,_,s,i,void 0));return}}for(a in i)i.hasOwnProperty(a)&&(s=i[a],s!=null&&_e(e,t,a,s,i,null))}function U1(e,t,i,s){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var r=null,n=null,l=null,a=null,o=null,c=null,_=null;for(d in i){var f=i[d];if(i.hasOwnProperty(d)&&f!=null)switch(d){case"checked":break;case"value":break;case"defaultValue":o=f;default:s.hasOwnProperty(d)||_e(e,t,d,null,s,f)}}for(var u in s){var d=s[u];if(f=i[u],s.hasOwnProperty(u)&&(d!=null||f!=null))switch(u){case"type":n=d;break;case"name":r=d;break;case"checked":c=d;break;case"defaultChecked":_=d;break;case"value":l=d;break;case"defaultValue":a=d;break;case"children":case"dangerouslySetInnerHTML":if(d!=null)throw Error(M(137,t));break;default:d!==f&&_e(e,t,u,d,s,f)}}Oc(e,l,a,o,c,_,n,r);return;case"select":d=l=a=u=null;for(n in i)if(o=i[n],i.hasOwnProperty(n)&&o!=null)switch(n){case"value":break;case"multiple":d=o;default:s.hasOwnProperty(n)||_e(e,t,n,null,s,o)}for(r in s)if(n=s[r],o=i[r],s.hasOwnProperty(r)&&(n!=null||o!=null))switch(r){case"value":u=n;break;case"defaultValue":a=n;break;case"multiple":l=n;default:n!==o&&_e(e,t,r,n,s,o)}t=a,i=l,s=d,u!=null?kr(e,!!i,u,!1):!!s!=!!i&&(t!=null?kr(e,!!i,t,!0):kr(e,!!i,i?[]:"",!1));return;case"textarea":d=u=null;for(a in i)if(r=i[a],i.hasOwnProperty(a)&&r!=null&&!s.hasOwnProperty(a))switch(a){case"value":break;case"children":break;default:_e(e,t,a,null,s,r)}for(l in s)if(r=s[l],n=i[l],s.hasOwnProperty(l)&&(r!=null||n!=null))switch(l){case"value":u=r;break;case"defaultValue":d=r;break;case"children":break;case"dangerouslySetInnerHTML":if(r!=null)throw Error(M(91));break;default:r!==n&&_e(e,t,l,r,s,n)}Up(e,u,d);return;case"option":for(var g in i)if(u=i[g],i.hasOwnProperty(g)&&u!=null&&!s.hasOwnProperty(g))switch(g){case"selected":e.selected=!1;break;default:_e(e,t,g,null,s,u)}for(o in s)if(u=s[o],d=i[o],s.hasOwnProperty(o)&&u!==d&&(u!=null||d!=null))switch(o){case"selected":e.selected=u&&typeof u!="function"&&typeof u!="symbol";break;default:_e(e,t,o,u,s,d)}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 y in i)u=i[y],i.hasOwnProperty(y)&&u!=null&&!s.hasOwnProperty(y)&&_e(e,t,y,null,s,u);for(c in s)if(u=s[c],d=i[c],s.hasOwnProperty(c)&&u!==d&&(u!=null||d!=null))switch(c){case"children":case"dangerouslySetInnerHTML":if(u!=null)throw Error(M(137,t));break;default:_e(e,t,c,u,s,d)}return;default:if(mu(t)){for(var C in i)u=i[C],i.hasOwnProperty(C)&&u!==void 0&&!s.hasOwnProperty(C)&&ch(e,t,C,void 0,s,u);for(_ in s)u=s[_],d=i[_],!s.hasOwnProperty(_)||u===d||u===void 0&&d===void 0||ch(e,t,_,u,s,d);return}}for(var m in i)u=i[m],i.hasOwnProperty(m)&&u!=null&&!s.hasOwnProperty(m)&&_e(e,t,m,null,s,u);for(f in s)u=s[f],d=i[f],!s.hasOwnProperty(f)||u===d||u==null&&d==null||_e(e,t,f,u,s,d)}function Af(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function q1(){if(typeof performance.getEntriesByType=="function"){for(var e=0,t=0,i=performance.getEntriesByType("resource"),s=0;s<i.length;s++){var r=i[s],n=r.transferSize,l=r.initiatorType,a=r.duration;if(n&&a&&Af(l)){for(l=0,a=r.responseEnd,s+=1;s<i.length;s++){var o=i[s],c=o.startTime;if(c>a)break;var _=o.transferSize,f=o.initiatorType;_&&Af(f)&&(o=o.responseEnd,l+=_*(o<a?1:(a-c)/(o-c)))}if(--s,t+=8*(n+l)/(r.duration/1e3),e++,10<e)break}}if(0<e)return t/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e=="number")?e:5}var hh=null,uh=null;function qa(e){return e.nodeType===9?e:e.ownerDocument}function Nf(e){switch(e){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function Vg(e,t){if(e===0)switch(t){case"svg":return 1;case"math":return 2;default:return 0}return e===1&&t==="foreignObject"?0:e}function dh(e,t){return e==="textarea"||e==="noscript"||typeof t.children=="string"||typeof t.children=="number"||typeof t.children=="bigint"||typeof t.dangerouslySetInnerHTML=="object"&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var nc=null;function P1(){var e=window.event;return e&&e.type==="popstate"?e===nc?!1:(nc=e,!0):(nc=null,!1)}var Ig=typeof setTimeout=="function"?setTimeout:void 0,K1=typeof clearTimeout=="function"?clearTimeout:void 0,Of=typeof Promise=="function"?Promise:void 0,W1=typeof queueMicrotask=="function"?queueMicrotask:typeof Of<"u"?function(e){return Of.resolve(null).then(e).catch(Y1)}:Ig;function Y1(e){setTimeout(function(){throw e})}function Ts(e){return e==="head"}function Lf(e,t){var i=t,s=0;do{var r=i.nextSibling;if(e.removeChild(i),r&&r.nodeType===8)if(i=r.data,i==="/$"||i==="/&"){if(s===0){e.removeChild(r),Wr(t);return}s--}else if(i==="$"||i==="$?"||i==="$~"||i==="$!"||i==="&")s++;else if(i==="html")Pn(e.ownerDocument.documentElement);else if(i==="head"){i=e.ownerDocument.head,Pn(i);for(var n=i.firstChild;n;){var l=n.nextSibling,a=n.nodeName;n[ul]||a==="SCRIPT"||a==="STYLE"||a==="LINK"&&n.rel.toLowerCase()==="stylesheet"||i.removeChild(n),n=l}}else i==="body"&&Pn(e.ownerDocument.body);i=r}while(i);Wr(t)}function zf(e,t){var i=e;e=0;do{var s=i.nextSibling;if(i.nodeType===1?t?(i._stashedDisplay=i.style.display,i.style.display="none"):(i.style.display=i._stashedDisplay||"",i.getAttribute("style")===""&&i.removeAttribute("style")):i.nodeType===3&&(t?(i._stashedText=i.nodeValue,i.nodeValue=""):i.nodeValue=i._stashedText||""),s&&s.nodeType===8)if(i=s.data,i==="/$"){if(e===0)break;e--}else i!=="$"&&i!=="$?"&&i!=="$~"&&i!=="$!"||e++;i=s}while(i)}function fh(e){var t=e.firstChild;for(t&&t.nodeType===10&&(t=t.nextSibling);t;){var i=t;switch(t=t.nextSibling,i.nodeName){case"HTML":case"HEAD":case"BODY":fh(i),pu(i);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(i.rel.toLowerCase()==="stylesheet")continue}e.removeChild(i)}}function V1(e,t,i,s){for(;e.nodeType===1;){var r=i;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!s&&(e.nodeName!=="INPUT"||e.type!=="hidden"))break}else if(s){if(!e[ul])switch(t){case"meta":if(!e.hasAttribute("itemprop"))break;return e;case"link":if(n=e.getAttribute("rel"),n==="stylesheet"&&e.hasAttribute("data-precedence"))break;if(n!==r.rel||e.getAttribute("href")!==(r.href==null||r.href===""?null:r.href)||e.getAttribute("crossorigin")!==(r.crossOrigin==null?null:r.crossOrigin)||e.getAttribute("title")!==(r.title==null?null:r.title))break;return e;case"style":if(e.hasAttribute("data-precedence"))break;return e;case"script":if(n=e.getAttribute("src"),(n!==(r.src==null?null:r.src)||e.getAttribute("type")!==(r.type==null?null:r.type)||e.getAttribute("crossorigin")!==(r.crossOrigin==null?null:r.crossOrigin))&&n&&e.hasAttribute("async")&&!e.hasAttribute("itemprop"))break;return e;default:return e}}else if(t==="input"&&e.type==="hidden"){var n=r.name==null?null:""+r.name;if(r.type==="hidden"&&e.getAttribute("name")===n)return e}else return e;if(e=si(e.nextSibling),e===null)break}return null}function I1(e,t,i){if(t==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!i||(e=si(e.nextSibling),e===null))return null;return e}function Xg(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!t||(e=si(e.nextSibling),e===null))return null;return e}function _h(e){return e.data==="$?"||e.data==="$~"}function ph(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function X1(e,t){var i=e.ownerDocument;if(e.data==="$~")e._reactRetry=t;else if(e.data!=="$?"||i.readyState!=="loading")t();else{var s=function(){t(),i.removeEventListener("DOMContentLoaded",s)};i.addEventListener("DOMContentLoaded",s),e._reactRetry=s}}function si(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t==="$"||t==="$!"||t==="$?"||t==="$~"||t==="&"||t==="F!"||t==="F")break;if(t==="/$"||t==="/&")return null}}return e}var mh=null;function jf(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var i=e.data;if(i==="/$"||i==="/&"){if(t===0)return si(e.nextSibling);t--}else i!=="$"&&i!=="$!"&&i!=="$?"&&i!=="$~"&&i!=="&"||t++}e=e.nextSibling}return null}function Hf(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var i=e.data;if(i==="$"||i==="$!"||i==="$?"||i==="$~"||i==="&"){if(t===0)return e;t--}else i!=="/$"&&i!=="/&"||t++}e=e.previousSibling}return null}function Gg(e,t,i){switch(t=qa(i),e){case"html":if(e=t.documentElement,!e)throw Error(M(452));return e;case"head":if(e=t.head,!e)throw Error(M(453));return e;case"body":if(e=t.body,!e)throw Error(M(454));return e;default:throw Error(M(451))}}function Pn(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);pu(e)}var ni=new Map,Uf=new Set;function Pa(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var Ii=he.d;he.d={f:G1,r:$1,D:F1,C:Z1,L:Q1,m:J1,X:ty,S:ey,M:iy};function G1(){var e=Ii.f(),t=po();return e||t}function $1(e){var t=Xr(e);t!==null&&t.tag===5&&t.type==="form"?Pm(t):Ii.r(e)}var Zr=typeof document>"u"?null:document;function $g(e,t,i){var s=Zr;if(s&&typeof t=="string"&&t){var r=Jt(t);r='link[rel="'+e+'"][href="'+r+'"]',typeof i=="string"&&(r+='[crossorigin="'+i+'"]'),Uf.has(r)||(Uf.add(r),e={rel:e,crossOrigin:i,href:t},s.querySelector(r)===null&&(t=s.createElement("link"),dt(t,"link",e),it(t),s.head.appendChild(t)))}}function F1(e){Ii.D(e),$g("dns-prefetch",e,null)}function Z1(e,t){Ii.C(e,t),$g("preconnect",e,t)}function Q1(e,t,i){Ii.L(e,t,i);var s=Zr;if(s&&e&&t){var r='link[rel="preload"][as="'+Jt(t)+'"]';t==="image"&&i&&i.imageSrcSet?(r+='[imagesrcset="'+Jt(i.imageSrcSet)+'"]',typeof i.imageSizes=="string"&&(r+='[imagesizes="'+Jt(i.imageSizes)+'"]')):r+='[href="'+Jt(e)+'"]';var n=r;switch(t){case"style":n=Kr(e);break;case"script":n=Qr(e)}ni.has(n)||(e=Ce({rel:"preload",href:t==="image"&&i&&i.imageSrcSet?void 0:e,as:t},i),ni.set(n,e),s.querySelector(r)!==null||t==="style"&&s.querySelector(gl(n))||t==="script"&&s.querySelector(vl(n))||(t=s.createElement("link"),dt(t,"link",e),it(t),s.head.appendChild(t)))}}function J1(e,t){Ii.m(e,t);var i=Zr;if(i&&e){var s=t&&typeof t.as=="string"?t.as:"script",r='link[rel="modulepreload"][as="'+Jt(s)+'"][href="'+Jt(e)+'"]',n=r;switch(s){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":n=Qr(e)}if(!ni.has(n)&&(e=Ce({rel:"modulepreload",href:e},t),ni.set(n,e),i.querySelector(r)===null)){switch(s){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(i.querySelector(vl(n)))return}s=i.createElement("link"),dt(s,"link",e),it(s),i.head.appendChild(s)}}}function ey(e,t,i){Ii.S(e,t,i);var s=Zr;if(s&&e){var r=Er(s).hoistableStyles,n=Kr(e);t=t||"default";var l=r.get(n);if(!l){var a={loading:0,preload:null};if(l=s.querySelector(gl(n)))a.loading=5;else{e=Ce({rel:"stylesheet",href:e,"data-precedence":t},i),(i=ni.get(n))&&ed(e,i);var o=l=s.createElement("link");it(o),dt(o,"link",e),o._p=new Promise(function(c,_){o.onload=c,o.onerror=_}),o.addEventListener("load",function(){a.loading|=1}),o.addEventListener("error",function(){a.loading|=2}),a.loading|=4,ra(l,t,s)}l={type:"stylesheet",instance:l,count:1,state:a},r.set(n,l)}}}function ty(e,t){Ii.X(e,t);var i=Zr;if(i&&e){var s=Er(i).hoistableScripts,r=Qr(e),n=s.get(r);n||(n=i.querySelector(vl(r)),n||(e=Ce({src:e,async:!0},t),(t=ni.get(r))&&td(e,t),n=i.createElement("script"),it(n),dt(n,"link",e),i.head.appendChild(n)),n={type:"script",instance:n,count:1,state:null},s.set(r,n))}}function iy(e,t){Ii.M(e,t);var i=Zr;if(i&&e){var s=Er(i).hoistableScripts,r=Qr(e),n=s.get(r);n||(n=i.querySelector(vl(r)),n||(e=Ce({src:e,async:!0,type:"module"},t),(t=ni.get(r))&&td(e,t),n=i.createElement("script"),it(n),dt(n,"link",e),i.head.appendChild(n)),n={type:"script",instance:n,count:1,state:null},s.set(r,n))}}function qf(e,t,i,s){var r=(r=ds.current)?Pa(r):null;if(!r)throw Error(M(446));switch(e){case"meta":case"title":return null;case"style":return typeof i.precedence=="string"&&typeof i.href=="string"?(t=Kr(i.href),i=Er(r).hoistableStyles,s=i.get(t),s||(s={type:"style",instance:null,count:0,state:null},i.set(t,s)),s):{type:"void",instance:null,count:0,state:null};case"link":if(i.rel==="stylesheet"&&typeof i.href=="string"&&typeof i.precedence=="string"){e=Kr(i.href);var n=Er(r).hoistableStyles,l=n.get(e);if(l||(r=r.ownerDocument||r,l={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},n.set(e,l),(n=r.querySelector(gl(e)))&&!n._p&&(l.instance=n,l.state.loading=5),ni.has(e)||(i={rel:"preload",as:"style",href:i.href,crossOrigin:i.crossOrigin,integrity:i.integrity,media:i.media,hrefLang:i.hrefLang,referrerPolicy:i.referrerPolicy},ni.set(e,i),n||sy(r,e,i,l.state))),t&&s===null)throw Error(M(528,""));return l}if(t&&s!==null)throw Error(M(529,""));return null;case"script":return t=i.async,i=i.src,typeof i=="string"&&t&&typeof t!="function"&&typeof t!="symbol"?(t=Qr(i),i=Er(r).hoistableScripts,s=i.get(t),s||(s={type:"script",instance:null,count:0,state:null},i.set(t,s)),s):{type:"void",instance:null,count:0,state:null};default:throw Error(M(444,e))}}function Kr(e){return'href="'+Jt(e)+'"'}function gl(e){return'link[rel="stylesheet"]['+e+"]"}function Fg(e){return Ce({},e,{"data-precedence":e.precedence,precedence:null})}function sy(e,t,i,s){e.querySelector('link[rel="preload"][as="style"]['+t+"]")?s.loading=1:(t=e.createElement("link"),s.preload=t,t.addEventListener("load",function(){return s.loading|=1}),t.addEventListener("error",function(){return s.loading|=2}),dt(t,"link",i),it(t),e.head.appendChild(t))}function Qr(e){return'[src="'+Jt(e)+'"]'}function vl(e){return"script[async]"+e}function Pf(e,t,i){if(t.count++,t.instance===null)switch(t.type){case"style":var s=e.querySelector('style[data-href~="'+Jt(i.href)+'"]');if(s)return t.instance=s,it(s),s;var r=Ce({},i,{"data-href":i.href,"data-precedence":i.precedence,href:null,precedence:null});return s=(e.ownerDocument||e).createElement("style"),it(s),dt(s,"style",r),ra(s,i.precedence,e),t.instance=s;case"stylesheet":r=Kr(i.href);var n=e.querySelector(gl(r));if(n)return t.state.loading|=4,t.instance=n,it(n),n;s=Fg(i),(r=ni.get(r))&&ed(s,r),n=(e.ownerDocument||e).createElement("link"),it(n);var l=n;return l._p=new Promise(function(a,o){l.onload=a,l.onerror=o}),dt(n,"link",s),t.state.loading|=4,ra(n,i.precedence,e),t.instance=n;case"script":return n=Qr(i.src),(r=e.querySelector(vl(n)))?(t.instance=r,it(r),r):(s=i,(r=ni.get(n))&&(s=Ce({},i),td(s,r)),e=e.ownerDocument||e,r=e.createElement("script"),it(r),dt(r,"link",s),e.head.appendChild(r),t.instance=r);case"void":return null;default:throw Error(M(443,t.type))}else t.type==="stylesheet"&&!(t.state.loading&4)&&(s=t.instance,t.state.loading|=4,ra(s,i.precedence,e));return t.instance}function ra(e,t,i){for(var s=i.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),r=s.length?s[s.length-1]:null,n=r,l=0;l<s.length;l++){var a=s[l];if(a.dataset.precedence===t)n=a;else if(n!==r)break}n?n.parentNode.insertBefore(e,n.nextSibling):(t=i.nodeType===9?i.head:i,t.insertBefore(e,t.firstChild))}function ed(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.title==null&&(e.title=t.title)}function td(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.integrity==null&&(e.integrity=t.integrity)}var na=null;function Kf(e,t,i){if(na===null){var s=new Map,r=na=new Map;r.set(i,s)}else r=na,s=r.get(i),s||(s=new Map,r.set(i,s));if(s.has(e))return s;for(s.set(e,null),i=i.getElementsByTagName(e),r=0;r<i.length;r++){var n=i[r];if(!(n[ul]||n[ot]||e==="link"&&n.getAttribute("rel")==="stylesheet")&&n.namespaceURI!=="http://www.w3.org/2000/svg"){var l=n.getAttribute(t)||"";l=e+l;var a=s.get(l);a?a.push(n):s.set(l,[n])}}return s}function Wf(e,t,i){e=e.ownerDocument||e,e.head.insertBefore(i,t==="title"?e.querySelector("head > title"):null)}function ry(e,t,i){if(i===1||t.itemProp!=null)return!1;switch(e){case"meta":case"title":return!0;case"style":if(typeof t.precedence!="string"||typeof t.href!="string"||t.href==="")break;return!0;case"link":if(typeof t.rel!="string"||typeof t.href!="string"||t.href===""||t.onLoad||t.onError)break;switch(t.rel){case"stylesheet":return e=t.disabled,typeof t.precedence=="string"&&e==null;default:return!0}case"script":if(t.async&&typeof t.async!="function"&&typeof t.async!="symbol"&&!t.onLoad&&!t.onError&&t.src&&typeof t.src=="string")return!0}return!1}function Zg(e){return!(e.type==="stylesheet"&&!(e.state.loading&3))}function ny(e,t,i,s){if(i.type==="stylesheet"&&(typeof s.media!="string"||matchMedia(s.media).matches!==!1)&&!(i.state.loading&4)){if(i.instance===null){var r=Kr(s.href),n=t.querySelector(gl(r));if(n){t=n._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(e.count++,e=Ka.bind(e),t.then(e,e)),i.state.loading|=4,i.instance=n,it(n);return}n=t.ownerDocument||t,s=Fg(s),(r=ni.get(r))&&ed(s,r),n=n.createElement("link"),it(n);var l=n;l._p=new Promise(function(a,o){l.onload=a,l.onerror=o}),dt(n,"link",s),i.instance=n}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(i,t),(t=i.state.preload)&&!(i.state.loading&3)&&(e.count++,i=Ka.bind(e),t.addEventListener("load",i),t.addEventListener("error",i))}}var lc=0;function ly(e,t){return e.stylesheets&&e.count===0&&la(e,e.stylesheets),0<e.count||0<e.imgCount?function(i){var s=setTimeout(function(){if(e.stylesheets&&la(e,e.stylesheets),e.unsuspend){var n=e.unsuspend;e.unsuspend=null,n()}},6e4+t);0<e.imgBytes&&lc===0&&(lc=62500*q1());var r=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&la(e,e.stylesheets),e.unsuspend)){var n=e.unsuspend;e.unsuspend=null,n()}},(e.imgBytes>lc?50:800)+t);return e.unsuspend=i,function(){e.unsuspend=null,clearTimeout(s),clearTimeout(r)}}:null}function Ka(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)la(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var Wa=null;function la(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,Wa=new Map,t.forEach(ay,e),Wa=null,Ka.call(e))}function ay(e,t){if(!(t.state.loading&4)){var i=Wa.get(e);if(i)var s=i.get(null);else{i=new Map,Wa.set(e,i);for(var r=e.querySelectorAll("link[data-precedence],style[data-precedence]"),n=0;n<r.length;n++){var l=r[n];(l.nodeName==="LINK"||l.getAttribute("media")!=="not all")&&(i.set(l.dataset.precedence,l),s=l)}s&&i.set(null,s)}r=t.instance,l=r.getAttribute("data-precedence"),n=i.get(l)||s,n===s&&i.set(null,r),i.set(l,r),this.count++,s=Ka.bind(this),r.addEventListener("load",s),r.addEventListener("error",s),n?n.parentNode.insertBefore(r,n.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(r,e.firstChild)),t.state.loading|=4}}var tl={$$typeof:Oi,Provider:null,Consumer:null,_currentValue:js,_currentValue2:js,_threadCount:0};function oy(e,t,i,s,r,n,l,a,o){this.tag=1,this.containerInfo=e,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=Mo(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Mo(0),this.hiddenUpdates=Mo(null),this.identifierPrefix=s,this.onUncaughtError=r,this.onCaughtError=n,this.onRecoverableError=l,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=o,this.incompleteTransitions=new Map}function Qg(e,t,i,s,r,n,l,a,o,c,_,f){return e=new oy(e,t,i,l,o,c,_,f,a),t=1,n===!0&&(t|=24),n=zt(3,null,null,t),e.current=n,n.stateNode=e,t=Tu(),t.refCount++,e.pooledCache=t,t.refCount++,n.memoizedState={element:s,isDehydrated:i,cache:t},Bu(n),e}function Jg(e){return e?(e=yr,e):yr}function ev(e,t,i,s,r,n){r=Jg(r),s.context===null?s.context=r:s.pendingContext=r,s=_s(t),s.payload={element:i},n=n===void 0?null:n,n!==null&&(s.callback=n),i=ps(e,s,t),i!==null&&(Dt(i,e,t),Nn(i,e,t))}function Yf(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var i=e.retryLane;e.retryLane=i!==0&&i<t?i:t}}function id(e,t){Yf(e,t),(e=e.alternate)&&Yf(e,t)}function tv(e){if(e.tag===13||e.tag===31){var t=Js(e,67108864);t!==null&&Dt(t,e,67108864),id(e,67108864)}}function Vf(e){if(e.tag===13||e.tag===31){var t=Pt();t=fu(t);var i=Js(e,t);i!==null&&Dt(i,e,t),id(e,t)}}var Ya=!0;function cy(e,t,i,s){var r=X.T;X.T=null;var n=he.p;try{he.p=2,sd(e,t,i,s)}finally{he.p=n,X.T=r}}function hy(e,t,i,s){var r=X.T;X.T=null;var n=he.p;try{he.p=8,sd(e,t,i,s)}finally{he.p=n,X.T=r}}function sd(e,t,i,s){if(Ya){var r=gh(s);if(r===null)rc(e,t,s,Va,i),If(e,s);else if(dy(r,e,t,i,s))s.stopPropagation();else if(If(e,s),t&4&&-1<uy.indexOf(e)){for(;r!==null;){var n=Xr(r);if(n!==null)switch(n.tag){case 3:if(n=n.stateNode,n.current.memoizedState.isDehydrated){var l=Rs(n.pendingLanes);if(l!==0){var a=n;for(a.pendingLanes|=2,a.entangledLanes|=2;l;){var o=1<<31-qt(l);a.entanglements[1]|=o,l&=~o}xi(n),!(ce&6)&&(Oa=Ht()+500,ml(0))}}break;case 31:case 13:a=Js(n,2),a!==null&&Dt(a,n,2),po(),id(n,2)}if(n=gh(s),n===null&&rc(e,t,s,Va,i),n===r)break;r=n}r!==null&&s.stopPropagation()}else rc(e,t,s,null,i)}}function gh(e){return e=gu(e),rd(e)}var Va=null;function rd(e){if(Va=null,e=_r(e),e!==null){var t=al(e);if(t===null)e=null;else{var i=t.tag;if(i===13){if(e=bp(t),e!==null)return e;e=null}else if(i===31){if(e=Cp(t),e!==null)return e;e=null}else if(i===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null)}}return Va=e,null}function iv(e){switch(e){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(F0()){case kp:return 2;case Tp:return 8;case ya:case Z0:return 32;case Dp:return 268435456;default:return 32}default:return 32}}var vh=!1,vs=null,Ss=null,ys=null,il=new Map,sl=new Map,ns=[],uy="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 If(e,t){switch(e){case"focusin":case"focusout":vs=null;break;case"dragenter":case"dragleave":Ss=null;break;case"mouseover":case"mouseout":ys=null;break;case"pointerover":case"pointerout":il.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":sl.delete(t.pointerId)}}function hn(e,t,i,s,r,n){return e===null||e.nativeEvent!==n?(e={blockedOn:t,domEventName:i,eventSystemFlags:s,nativeEvent:n,targetContainers:[r]},t!==null&&(t=Xr(t),t!==null&&tv(t)),e):(e.eventSystemFlags|=s,t=e.targetContainers,r!==null&&t.indexOf(r)===-1&&t.push(r),e)}function dy(e,t,i,s,r){switch(t){case"focusin":return vs=hn(vs,e,t,i,s,r),!0;case"dragenter":return Ss=hn(Ss,e,t,i,s,r),!0;case"mouseover":return ys=hn(ys,e,t,i,s,r),!0;case"pointerover":var n=r.pointerId;return il.set(n,hn(il.get(n)||null,e,t,i,s,r)),!0;case"gotpointercapture":return n=r.pointerId,sl.set(n,hn(sl.get(n)||null,e,t,i,s,r)),!0}return!1}function sv(e){var t=_r(e.target);if(t!==null){var i=al(t);if(i!==null){if(t=i.tag,t===13){if(t=bp(i),t!==null){e.blockedOn=t,Md(e.priority,function(){Vf(i)});return}}else if(t===31){if(t=Cp(i),t!==null){e.blockedOn=t,Md(e.priority,function(){Vf(i)});return}}else if(t===3&&i.stateNode.current.memoizedState.isDehydrated){e.blockedOn=i.tag===3?i.stateNode.containerInfo:null;return}}}e.blockedOn=null}function aa(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var i=gh(e.nativeEvent);if(i===null){i=e.nativeEvent;var s=new i.constructor(i.type,i);zc=s,i.target.dispatchEvent(s),zc=null}else return t=Xr(i),t!==null&&tv(t),e.blockedOn=i,!1;t.shift()}return!0}function Xf(e,t,i){aa(e)&&i.delete(t)}function fy(){vh=!1,vs!==null&&aa(vs)&&(vs=null),Ss!==null&&aa(Ss)&&(Ss=null),ys!==null&&aa(ys)&&(ys=null),il.forEach(Xf),sl.forEach(Xf)}function jl(e,t){e.blockedOn===t&&(e.blockedOn=null,vh||(vh=!0,Xe.unstable_scheduleCallback(Xe.unstable_NormalPriority,fy)))}var Hl=null;function Gf(e){Hl!==e&&(Hl=e,Xe.unstable_scheduleCallback(Xe.unstable_NormalPriority,function(){Hl===e&&(Hl=null);for(var t=0;t<e.length;t+=3){var i=e[t],s=e[t+1],r=e[t+2];if(typeof s!="function"){if(rd(s||i)===null)continue;break}var n=Xr(i);n!==null&&(e.splice(t,3),t-=3,Qc(n,{pending:!0,data:r,method:i.method,action:s},s,r))}}))}function Wr(e){function t(o){return jl(o,e)}vs!==null&&jl(vs,e),Ss!==null&&jl(Ss,e),ys!==null&&jl(ys,e),il.forEach(t),sl.forEach(t);for(var i=0;i<ns.length;i++){var s=ns[i];s.blockedOn===e&&(s.blockedOn=null)}for(;0<ns.length&&(i=ns[0],i.blockedOn===null);)sv(i),i.blockedOn===null&&ns.shift();if(i=(e.ownerDocument||e).$$reactFormReplay,i!=null)for(s=0;s<i.length;s+=3){var r=i[s],n=i[s+1],l=r[Mt]||null;if(typeof n=="function")l||Gf(i);else if(l){var a=null;if(n&&n.hasAttribute("formAction")){if(r=n,l=n[Mt]||null)a=l.formAction;else if(rd(r)!==null)continue}else a=l.action;typeof a=="function"?i[s+1]=a:(i.splice(s,3),s-=3),Gf(i)}}}function rv(){function e(n){n.canIntercept&&n.info==="react-transition"&&n.intercept({handler:function(){return new Promise(function(l){return r=l})},focusReset:"manual",scroll:"manual"})}function t(){r!==null&&(r(),r=null),s||setTimeout(i,20)}function i(){if(!s&&!navigation.transition){var n=navigation.currentEntry;n&&n.url!=null&&navigation.navigate(n.url,{state:n.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var s=!1,r=null;return navigation.addEventListener("navigate",e),navigation.addEventListener("navigatesuccess",t),navigation.addEventListener("navigateerror",t),setTimeout(i,100),function(){s=!0,navigation.removeEventListener("navigate",e),navigation.removeEventListener("navigatesuccess",t),navigation.removeEventListener("navigateerror",t),r!==null&&(r(),r=null)}}}function nd(e){this._internalRoot=e}vo.prototype.render=nd.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(M(409));var i=t.current,s=Pt();ev(i,s,e,t,null,null)};vo.prototype.unmount=nd.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;ev(e.current,2,null,e,null,null),po(),t[Ir]=null}};function vo(e){this._internalRoot=e}vo.prototype.unstable_scheduleHydration=function(e){if(e){var t=Np();e={blockedOn:null,target:e,priority:t};for(var i=0;i<ns.length&&t!==0&&t<ns[i].priority;i++);ns.splice(i,0,e),i===0&&sv(e)}};var $f=Sp.version;if($f!=="19.2.6")throw Error(M(527,$f,"19.2.6"));he.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(M(188)):(e=Object.keys(e).join(","),Error(M(268,e)));return e=W0(t),e=e!==null?wp(e):null,e=e===null?null:e.stateNode,e};var _y={bundleType:0,version:"19.2.6",rendererPackageName:"react-dom",currentDispatcherRef:X,reconcilerVersion:"19.2.6"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Ul=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Ul.isDisabled&&Ul.supportsFiber)try{ol=Ul.inject(_y),Ut=Ul}catch{}}eo.createRoot=function(e,t){if(!yp(e))throw Error(M(299));var i=!1,s="",r=$m,n=Fm,l=Zm;return t!=null&&(t.unstable_strictMode===!0&&(i=!0),t.identifierPrefix!==void 0&&(s=t.identifierPrefix),t.onUncaughtError!==void 0&&(r=t.onUncaughtError),t.onCaughtError!==void 0&&(n=t.onCaughtError),t.onRecoverableError!==void 0&&(l=t.onRecoverableError)),t=Qg(e,1,!1,null,null,i,s,null,r,n,l,rv),e[Ir]=t.current,Ju(e),new nd(t)};eo.hydrateRoot=function(e,t,i){if(!yp(e))throw Error(M(299));var s=!1,r="",n=$m,l=Fm,a=Zm,o=null;return i!=null&&(i.unstable_strictMode===!0&&(s=!0),i.identifierPrefix!==void 0&&(r=i.identifierPrefix),i.onUncaughtError!==void 0&&(n=i.onUncaughtError),i.onCaughtError!==void 0&&(l=i.onCaughtError),i.onRecoverableError!==void 0&&(a=i.onRecoverableError),i.formState!==void 0&&(o=i.formState)),t=Qg(e,1,!0,t,i??null,s,r,o,n,l,a,rv),t.context=Jg(null),i=t.current,s=Pt(),s=fu(s),r=_s(s),r.callback=null,ps(i,r,s),i=s,t.current.lanes=i,hl(t,i),xi(t),e[Ir]=t.current,Ju(e),new vo(t)};eo.version="19.2.6";function nv(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(nv)}catch(e){console.error(e)}}nv(),dp.exports=eo;var py=dp.exports;function my(e){return btoa(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}function oa(e,t){return e||(console.warn(`[evalution] Missing providerId for ${t}; prompt linking may not work.`),"")}function lv(e){if(e.kind==="primitive")return e.syntax==="number"?{kind:"primitive",value:0}:e.syntax==="boolean"?{kind:"primitive",value:!1}:{kind:"primitive",value:""};if(e.kind==="array")return{kind:"array",elements:[]};if(e.kind==="union"){const t=e.types.find(i=>i.kind==="constant");if(t&&t.kind==="constant")return{kind:"primitive",value:t.value};if(e.types.length>0)return lv(e.types[0])}return{kind:"primitive",value:void 0}}function ld(e,t){return`/api/prompts/${e.providerId}/${my(e.id)}/${t}`}async function li(e){if(!e.ok){const t=await e.json().catch(()=>({}));throw new Error(t.error??`Request failed: ${e.status}`)}}async function gy(){const e=await fetch("/api/setup-tasks");return await li(e),e.json()}async function vy(e,t){const i=await fetch(`/api/setup-tasks/${encodeURIComponent(e)}/steps/${encodeURIComponent(t)}/execute`,{method:"POST"});return await li(i),i.json()}async function Sy(){const e=await fetch("/api/providers");return await li(e),e.json()}async function Ff(e,t){const i=await fetch(`/api/providers/${e}/add-prompt`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});return await li(i),i.json()}async function yy(){const e=await fetch("/api/prompts");return await li(e),e.json()}async function by(e){const t=await fetch(`/api/providers/${e}/models`);return await li(t),t.json()}async function Cy(e){const t=await fetch(`/api/providers/${e}/model-parameters`);return await li(t),t.json()}async function wy(e,t){const i=await fetch(ld(e,"rename"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({newName:t})});return await li(i),i.json()}async function xy(e,t){const i=await fetch(ld(e,"update"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});return await li(i),i.json()}async function Ey(e,t){const i=await fetch(ld(e,"execute"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({functionParams:t})});return await li(i),i.json()}async function ky(){const e=await fetch("/api/traces");return await li(e),e.json()}async function Ty(e,t){const i=await fetch(`/api/traces/${encodeURIComponent(e)}/${encodeURIComponent(t)}`);return await li(i),i.json()}function Dy(e,t,i){const s=`/api/traces/${encodeURIComponent(e)}/${encodeURIComponent(t)}/events`,r=new EventSource(s);return r.onmessage=n=>{try{const l=JSON.parse(n.data);l!=null&&l.type&&l.type!=="connected"&&i(l)}catch{}},()=>r.close()}function My({onClose:e,onCreated:t}){const[i,s]=D.useState({type:"loading"}),[r,n]=D.useState({}),[l,a]=D.useState(null);D.useEffect(()=>{Sy().then(_=>{const f=_.filter(u=>u.hasAddPrompt);f.length===0?a("No providers support adding prompts"):f.length===1?o(f[0].id):s({type:"pick-provider",providers:f})}).catch(_=>a(_.message))},[]);async function o(_){s({type:"loading"}),a(null);try{const f=await Ff(_,{});if("fields"in f){const u={};for(const d of f.fields)d.defaultValue&&(u[d.name]=d.defaultValue);n(u),s({type:"form",providerId:_,context:f})}else t(f)}catch(f){a(f.message)}}async function c(_){if(_.preventDefault(),i.type!=="form")return;a(null),s({type:"submitting"});const f={};for(const[u,d]of Object.entries(r))d&&(f[u]=d);if(f.directory!==void 0&&f.fileName){const u=f.directory==="."?"":f.directory+"/";f.metadata={relativeFilePath:u+f.fileName},delete f.directory,delete f.fileName}try{const u=await Ff(i.providerId,f);if("fields"in u){const d={};for(const g of u.fields)g.defaultValue&&(d[g.name]=g.defaultValue);n({...d,...r}),s({type:"form",providerId:i.providerId,context:u})}else t(u)}catch(u){a(u.message),s({type:"form",providerId:i.providerId,context:i.context})}}return h.jsx("div",{className:"dialog-backdrop",onClick:e,children:h.jsxs("div",{className:"dialog",onClick:_=>_.stopPropagation(),children:[h.jsxs("div",{className:"dialog-header",children:[h.jsx("h3",{children:"New Prompt"}),h.jsx("button",{type:"button",className:"dialog-close",onClick:e,children:"×"})]}),h.jsxs("div",{className:"dialog-body",children:[l&&h.jsx("div",{className:"dialog-error",children:l}),i.type==="loading"&&h.jsx("div",{className:"dialog-status",children:"Loading..."}),i.type==="submitting"&&h.jsx("div",{className:"dialog-status",children:"Creating..."}),i.type==="pick-provider"&&h.jsx("div",{className:"dialog-providers",children:i.providers.map(_=>h.jsxs("button",{type:"button",className:"dialog-provider-btn",onClick:()=>o(_.id),children:[_.icon&&h.jsx("span",{className:"dialog-provider-icon",dangerouslySetInnerHTML:{__html:_.icon}}),h.jsxs("div",{children:[h.jsx("div",{className:"dialog-provider-name",children:_.displayName??_.id}),_.description&&h.jsx("div",{className:"dialog-provider-desc",children:_.description})]})]},_.id))}),i.type==="form"&&h.jsxs("form",{onSubmit:c,children:[i.context.fields.map(_=>{var f;return h.jsxs("div",{className:"dialog-field",children:[h.jsx("label",{htmlFor:`field-${_.name}`,children:_.label}),_.type==="select"?h.jsx("select",{id:`field-${_.name}`,value:r[_.name]??"",onChange:u=>n(d=>({...d,[_.name]:u.target.value})),required:_.required,children:(f=_.options)==null?void 0:f.map(u=>h.jsx("option",{value:u.value,children:u.label},u.value))}):h.jsx("input",{id:`field-${_.name}`,type:"text",value:r[_.name]??"",onChange:u=>n(d=>({...d,[_.name]:u.target.value})),placeholder:_.placeholder,required:_.required})]},_.name)}),h.jsxs("div",{className:"dialog-actions",children:[h.jsx("button",{type:"button",className:"dialog-btn-cancel",onClick:e,children:"Cancel"}),h.jsx("button",{type:"submit",className:"dialog-btn-create",children:"Create"})]})]})]})]})})}function av(e){if(e.kind!=="union")return null;const t=e.types.filter(s=>s.kind==="object");if(t.length!==e.types.length||t.length<2)return null;const i=t[0].properties;for(const s of i)if(t.every(n=>{const l=n.properties.find(a=>a.name===s.name);return l&&l.type.kind==="constant"})){const n=t.map(l=>({discriminatorValue:l.properties.find(o=>o.name===s.name).type.value,properties:l.properties.filter(o=>o.name!==s.name)}));return{discriminator:s.name,cases:n}}return null}function Ia(e){return e.displayValue!==void 0?e.displayValue:Ar(e)}function Ar(e){switch(e.kind){case"primitive":return e.value===null?"null":e.value===void 0?"undefined":typeof e.value=="string"?JSON.stringify(e.value):String(e.value);case"template":{let t="";for(const i of e.value)typeof i=="string"?t+=i.replace(/\\/g,"\\\\").replace(/`/g,"\\`").replace(/\$\{/g,"\\${"):t+="${"+i.expr+"}";return"`"+t+"`"}case"functionCall":{const t=e.args.map(Ar).join(", ");return`${e.callee}(${t})`}case"lambda":return`(${e.parameters.join(", ")}) => ${e.body}`;case"object":{const t=Object.entries(e.properties);return t.length===0?"{}":`{ ${t.map(([s,r])=>`${s}: ${Ar(r)}`).join(", ")} }`}case"array":case"tuple":return`[${e.elements.map(Ar).join(", ")}]`;case"raw":return e.sourceText}}function Sl(e){if(e.defaultValue)return`Default: ${Ar(e.defaultValue)}`}function By({value:e,onChange:t,propDef:i,className:s}){const r=(e==null?void 0:e.kind)==="primitive"&&typeof e.value=="string"?e.value:"";return h.jsx("input",{type:"text",value:r,onChange:n=>t({kind:"primitive",value:n.target.value}),placeholder:Sl(i),className:s,style:s?void 0:{width:"100%",padding:"4px 6px",background:"var(--proppy-input-bg, #fff)",color:"var(--proppy-input-color, inherit)",border:"1px solid var(--proppy-border, #ddd)",borderRadius:"3px",fontSize:"12px"}})}function Ry({value:e,onChange:t,propDef:i,className:s}){const r=(e==null?void 0:e.kind)==="primitive"&&typeof e.value=="number"?e.value:"";return h.jsx("input",{type:"number",value:r??"",onChange:n=>{const l=n.target.value;l===""&&i.optional?t({kind:"primitive",value:void 0}):t({kind:"primitive",value:l===""?0:Number(l)})},placeholder:Sl(i),className:s,style:s?void 0:{width:"100%",padding:"4px 6px",background:"var(--proppy-input-bg, #fff)",color:"var(--proppy-input-color, inherit)",border:"1px solid var(--proppy-border, #ddd)",borderRadius:"3px",fontSize:"12px"}})}function Ay({value:e,onChange:t,propDef:i,className:s}){var l;const r=((l=i.defaultValue)==null?void 0:l.kind)==="primitive"&&typeof i.defaultValue.value=="boolean"?i.defaultValue.value:!1,n=(e==null?void 0:e.kind)==="primitive"&&typeof e.value=="boolean"?e.value:r;return h.jsxs("select",{value:n?"true":"false",onChange:a=>t({kind:"primitive",value:a.target.value==="true"}),className:s,style:s?void 0:{width:"100%",padding:"4px 6px",background:"var(--proppy-input-bg, #fff)",color:"var(--proppy-input-color, inherit)",border:"1px solid var(--proppy-border, #ddd)",borderRadius:"3px",fontSize:"12px"},children:[h.jsx("option",{value:"true",children:"true"}),h.jsx("option",{value:"false",children:"false"})]})}function Ny(e){return e.kind!=="union"?[]:e.types.filter(t=>t.kind==="constant").map(t=>t.value)}function ov({value:e,onChange:t,propDef:i,className:s}){var a;const r=Ny(i.type),n=((a=i.defaultValue)==null?void 0:a.kind)==="primitive"?String(i.defaultValue.value):"",l=(e==null?void 0:e.kind)==="primitive"?String(e.value):n;return h.jsxs("select",{value:l||"",onChange:o=>t({kind:"primitive",value:o.target.value}),className:s,style:s?void 0:{width:"100%",padding:"4px 6px",background:"var(--proppy-input-bg, #fff)",color:"var(--proppy-input-color, inherit)",border:"1px solid var(--proppy-border, #ddd)",borderRadius:"3px",fontSize:"12px"},children:[i.optional&&h.jsx("option",{value:"",children:"-- Select --"}),r.map(o=>h.jsx("option",{value:String(o),children:String(o)},String(o)))]})}function Oy({value:e,onChange:t,propDef:i}){const s=(e==null?void 0:e.kind)==="primitive"&&typeof e.value=="string"?e.value:"";return h.jsx("input",{type:"datetime-local",value:s,onChange:r=>t({kind:"primitive",value:r.target.value}),placeholder:Sl(i),style:{width:"100%",padding:"4px 6px",background:"var(--proppy-input-bg, #fff)",color:"var(--proppy-input-color, inherit)",border:"1px solid var(--proppy-border, #ddd)",borderRadius:"3px",fontSize:"12px"}})}function Ly({value:e,onChange:t,propDef:i}){const s=i.type.kind==="function"?i.type.parameters:[],r=s.map(a=>`${a.name}${a.optional?"?":""}: ${a.type.syntax}`).join(", "),n=(e==null?void 0:e.kind)==="lambda"?e.body:"",l=Sl(i)||"Enter function body (without braces)";return h.jsxs("div",{children:[h.jsxs("div",{style:{fontSize:"11px",fontFamily:"monospace",color:"var(--proppy-text-secondary, #666)",marginBottom:"4px",padding:"4px 8px",background:"var(--proppy-button-bg, #f5f5f5)",borderRadius:"3px",border:"1px solid var(--proppy-border, #e0e0e0)"},children:["(",r,") =>"]}),h.jsx("textarea",{value:n,onChange:a=>t({kind:"lambda",parameters:s.map(o=>o.name),body:a.target.value}),placeholder:l,style:{width:"100%",padding:"6px 8px",background:"var(--proppy-input-bg, #fff)",color:"var(--proppy-input-color, inherit)",border:"1px solid var(--proppy-border, #ddd)",borderRadius:"4px",fontSize:"12px",fontFamily:"monospace",boxSizing:"border-box",minHeight:"60px",resize:"vertical"}})]})}function ad({value:e,onChange:t,propDef:i,className:s}){const r=e?Ar(e):"";return h.jsx("textarea",{value:r,onChange:n=>t({kind:"raw",sourceText:n.target.value}),placeholder:Sl(i),className:s,style:s?void 0:{width:"100%",padding:"4px 6px",background:"var(--proppy-input-bg, #fff)",color:"var(--proppy-input-color, inherit)",border:"1px solid var(--proppy-border, #ddd)",borderRadius:"3px",fontSize:"11px",fontFamily:"monospace",minHeight:"40px",resize:"vertical"}})}function cv({properties:e,value:t,onChange:i,plugins:s}){const r=(t==null?void 0:t.kind)==="object"?{...t.properties}:{},n=(l,a)=>{const o={...r,[l]:a};i({kind:"object",properties:o})};return h.jsx("div",{style:{border:"1px solid var(--proppy-border, #ddd)",borderRadius:"4px",padding:"8px",background:"var(--proppy-container-bg, #fafafa)",display:"flex",flexDirection:"column",gap:"8px"},children:e.map(l=>h.jsxs("div",{children:[h.jsxs("label",{style:{display:"block",fontSize:"11px",marginBottom:"2px",fontWeight:500,color:"var(--proppy-text-primary, inherit)"},children:[l.name,l.optional?"":" *",h.jsx("span",{style:{color:"var(--proppy-text-muted, #999)",fontWeight:"normal",marginLeft:"4px"},children:l.type.syntax})]}),l.description&&h.jsx("div",{style:{fontSize:"10px",color:"var(--proppy-text-secondary, #666)",marginBottom:"2px",fontStyle:"italic"},children:l.description}),h.jsx(Jr,{propDef:l,value:r[l.name],onChange:a=>n(l.name,a),plugins:s})]},l.name))})}function hv({elementType:e,value:t,onChange:i,plugins:s}){const r=(t==null?void 0:t.kind)==="array"?t.elements:[],n=()=>{i({kind:"array",elements:[...r,{kind:"primitive",value:""}]})},l=c=>{i({kind:"array",elements:r.filter((_,f)=>f!==c)})},a=(c,_)=>{const f=[...r];f[c]=_,i({kind:"array",elements:f})},o={name:"",type:e,optional:!1};return h.jsxs("div",{style:{border:"1px solid var(--proppy-border, #ddd)",borderRadius:"4px",padding:"8px",background:"var(--proppy-container-bg, #fafafa)"},children:[h.jsxs("div",{style:{marginBottom:"8px",fontSize:"11px",color:"var(--proppy-text-secondary, #666)"},children:["Array of ",e.syntax," (",r.length," item",r.length!==1?"s":"",")"]}),r.map((c,_)=>h.jsxs("div",{style:{display:"flex",gap:"4px",marginBottom:"4px"},children:[h.jsx("div",{style:{flex:1},children:h.jsx(Jr,{propDef:o,value:c,onChange:f=>a(_,f),plugins:s})}),h.jsx("button",{onClick:()=>l(_),style:{padding:"4px 8px",background:"var(--proppy-danger-bg, #fee)",color:"var(--proppy-danger-color, inherit)",border:"1px solid var(--proppy-danger-border, #fcc)",borderRadius:"3px",cursor:"pointer",fontSize:"12px"},children:"✕"})]},_)),h.jsx("button",{onClick:n,style:{width:"100%",padding:"6px",background:"var(--proppy-button-bg, #f0f0f0)",color:"var(--proppy-button-color, inherit)",border:"1px solid var(--proppy-border, #ddd)",borderRadius:"3px",cursor:"pointer",fontSize:"12px",marginTop:"4px"},children:"+ Add Item"})]})}function uv({types:e,value:t,onChange:i,plugins:s}){const r=(t==null?void 0:t.kind)==="tuple"?t.elements:[],n=(l,a)=>{const o=[...r];o[l]=a,i({kind:"tuple",elements:o})};return h.jsxs("div",{style:{border:"1px solid var(--proppy-border, #ddd)",borderRadius:"4px",padding:"8px",background:"var(--proppy-container-bg, #fafafa)"},children:[h.jsxs("div",{style:{marginBottom:"8px",fontSize:"11px",color:"var(--proppy-text-secondary, #666)"},children:["Tuple [",e.map(l=>l.syntax).join(", "),"]"]}),e.map((l,a)=>{const o={name:`[${a}]`,type:l,optional:!1};return h.jsxs("div",{style:{marginBottom:"8px"},children:[h.jsxs("label",{style:{display:"block",fontSize:"11px",marginBottom:"2px",fontWeight:500,color:"var(--proppy-text-primary, inherit)"},children:["[",a,"] ",l.syntax]}),h.jsx(Jr,{propDef:o,value:r[a],onChange:c=>n(a,c),plugins:s})]},a)})]})}function dv({discriminatedUnionInfo:e,value:t,onChange:i,plugins:s}){var f,u;const{discriminator:r,cases:n}=e,l=(t==null?void 0:t.kind)==="object"?t.properties:{},a=((f=l[r])==null?void 0:f.kind)==="primitive"?String(l[r].value):((u=n[0])==null?void 0:u.discriminatorValue)??"",o=n.find(d=>String(d.discriminatorValue)===a),c=d=>{i({kind:"object",properties:{[r]:{kind:"primitive",value:d}}})},_=(d,g)=>{const y={...l,[d]:g};i({kind:"object",properties:y})};return h.jsxs("div",{style:{border:"1px solid var(--proppy-border, #ddd)",borderRadius:"4px",padding:"8px",background:"var(--proppy-container-bg, #fafafa)",display:"flex",flexDirection:"column",gap:"8px"},children:[h.jsxs("div",{children:[h.jsxs("label",{style:{display:"block",fontSize:"11px",marginBottom:"2px",fontWeight:500,color:"var(--proppy-text-primary, inherit)"},children:[r," *"]}),h.jsx("select",{value:a,onChange:d=>c(d.target.value),style:{width:"100%",padding:"4px 6px",background:"var(--proppy-input-bg, #fff)",color:"var(--proppy-input-color, inherit)",border:"1px solid var(--proppy-border, #ddd)",borderRadius:"3px",fontSize:"12px"},children:n.map(d=>h.jsx("option",{value:String(d.discriminatorValue),children:String(d.discriminatorValue)},String(d.discriminatorValue)))})]}),o&&o.properties.length>0&&h.jsxs(h.Fragment,{children:[h.jsx("div",{style:{borderTop:"1px solid var(--proppy-border, #ddd)",margin:"4px 0"}}),o.properties.map(d=>h.jsxs("div",{children:[h.jsxs("label",{style:{display:"block",fontSize:"11px",marginBottom:"2px",fontWeight:500,color:"var(--proppy-text-primary, inherit)"},children:[d.name,d.optional?"":" *",h.jsx("span",{style:{color:"var(--proppy-text-muted, #999)",fontWeight:"normal",marginLeft:"4px"},children:d.type.syntax})]}),d.description&&h.jsx("div",{style:{fontSize:"10px",color:"var(--proppy-text-secondary, #666)",marginBottom:"2px",fontStyle:"italic"},children:d.description}),h.jsx(Jr,{propDef:d,value:l[d.name],onChange:g=>_(d.name,g),plugins:s})]},d.name))]})]})}class zy{constructor(){yd(this,"segments",[""])}appendString(t){const i=this.segments[this.segments.length-1];return typeof i=="string"?this.segments[this.segments.length-1]=i+t:this.segments.push(t),this}appendToken(t){return this.segments.push({expr:t}),this.segments.push(""),this}appendSegments(t){for(const i of t)typeof i=="string"?this.appendString(i):this.appendToken(i.expr);return this}build(){return this.segments}}function jy(e){return e.some(t=>typeof t!="string")?{kind:"template",value:e}:{kind:"primitive",value:e.join("")}}function Hy(e){return e.map(fv)}function fv(e){const t={name:e.name};return e.type.kind==="object"&&e.type.properties.length>0&&(t.children=e.type.properties.map(fv)),t}const lr=/[A-Za-z_$][A-Za-z0-9_$]*/y;function Uy(e){const t=e.trim();if(t==="")return null;lr.lastIndex=0;const i=lr.exec(t);if(!i||i.index!==0)return null;const s=[i[0]];let r=lr.lastIndex;for(;r<t.length;)if(t[r]==="."){lr.lastIndex=r+1;const n=lr.exec(t);if(!n||n.index!==r+1)return null;s.push(n[0]),r=lr.lastIndex}else if(t[r]==="["){const n=t[r+1];if(n!=='"'&&n!=="'")return null;let l=r+2,a="";for(;l<t.length&&t[l]!==n;)a+=t[l],l++;if(l>=t.length||t[l+1]!=="]")return null;s.push(a),r=l+2}else return null;return s}function qy(e,t){let i=t,s=null;for(const r of e){if(s=i.find(n=>n.name===r)??null,!s)return null;i=s.children??[]}return s}function Py(e,t){const i=/[A-Za-z0-9_$]*$/.exec(e)[0];let s=e.slice(0,e.length-i.length);const r=/(\.|\[\s*['"]?)\s*$/.exec(s);r&&(s=s.slice(0,s.length-r[0].length));let n;if(s.trim()==="")n=t;else{const o=Uy(s),c=o?qy(o,t):null;n=(c==null?void 0:c.children)??[]}const l=i.toLowerCase();return{candidates:n.filter(o=>o.name.toLowerCase().startsWith(l)),fragment:i}}function _v(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}function Ky(e){return _v(e).replace(/\n/g,"<br>")}function Wy(e){let t="";for(const i of e)if(typeof i=="string")t+=Ky(i);else{const s="${"+i.expr+"}";t+=`<span class="te-token">${_v(s)}</span>`}return t}function Zf(e){const t=new zy;function i(s){if(s.nodeType===Node.TEXT_NODE)t.appendString(s.textContent??"");else if(s instanceof HTMLElement)if(s.classList.contains("te-token")){const r=s.textContent??"",n=r.match(/^\$\{(.+)\}$/);n?t.appendToken(n[1]):t.appendString(r)}else if(s.tagName==="BR")t.appendString(`
|
|
48
|
+
`+s.stack}}var Lc=Object.prototype.hasOwnProperty,gu=Ie.unstable_scheduleCallback,Bo=Ie.unstable_cancelCallback,tS=Ie.unstable_shouldYield,iS=Ie.unstable_requestPaint,Ht=Ie.unstable_now,sS=Ie.unstable_getCurrentPriorityLevel,Ap=Ie.unstable_ImmediatePriority,Np=Ie.unstable_UserBlockingPriority,Ca=Ie.unstable_NormalPriority,rS=Ie.unstable_LowPriority,Op=Ie.unstable_IdlePriority,nS=Ie.log,lS=Ie.unstable_setDisableYieldValue,hl=null,Ut=null;function as(e){if(typeof nS=="function"&&lS(e),Ut&&typeof Ut.setStrictMode=="function")try{Ut.setStrictMode(hl,e)}catch{}}var qt=Math.clz32?Math.clz32:cS,aS=Math.log,oS=Math.LN2;function cS(e){return e>>>=0,e===0?32:31-(aS(e)/oS|0)|0}var Dl=256,Ml=262144,Rl=4194304;function As(e){var t=e&42;if(t!==0)return t;switch(e&-e){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 e&261888;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function no(e,t,i){var s=e.pendingLanes;if(s===0)return 0;var r=0,n=e.suspendedLanes,l=e.pingedLanes;e=e.warmLanes;var a=s&134217727;return a!==0?(s=a&~n,s!==0?r=As(s):(l&=a,l!==0?r=As(l):i||(i=a&~e,i!==0&&(r=As(i))))):(a=s&~n,a!==0?r=As(a):l!==0?r=As(l):i||(i=s&~e,i!==0&&(r=As(i)))),r===0?0:t!==0&&t!==r&&!(t&n)&&(n=r&-r,i=t&-t,n>=i||n===32&&(i&4194048)!==0)?t:r}function ul(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function hS(e,t){switch(e){case 1:case 2:case 4:case 8:case 64:return t+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 t+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 Lp(){var e=Rl;return Rl<<=1,!(Rl&62914560)&&(Rl=4194304),e}function Ao(e){for(var t=[],i=0;31>i;i++)t.push(e);return t}function dl(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function uS(e,t,i,s,r,n){var l=e.pendingLanes;e.pendingLanes=i,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=i,e.entangledLanes&=i,e.errorRecoveryDisabledLanes&=i,e.shellSuspendCounter=0;var a=e.entanglements,o=e.expirationTimes,c=e.hiddenUpdates;for(i=l&~i;0<i;){var u=31-qt(i),_=1<<u;a[u]=0,o[u]=-1;var f=c[u];if(f!==null)for(c[u]=null,u=0;u<f.length;u++){var d=f[u];d!==null&&(d.lane&=-536870913)}i&=~_}s!==0&&zp(e,s,0),n!==0&&r===0&&e.tag!==0&&(e.suspendedLanes|=n&~(l&~t))}function zp(e,t,i){e.pendingLanes|=t,e.suspendedLanes&=~t;var s=31-qt(t);e.entangledLanes|=t,e.entanglements[s]=e.entanglements[s]|1073741824|i&261930}function jp(e,t){var i=e.entangledLanes|=t;for(e=e.entanglements;i;){var s=31-qt(i),r=1<<s;r&t|e[s]&t&&(e[s]|=t),i&=~r}}function Hp(e,t){var i=t&-t;return i=i&42?1:vu(i),i&(e.suspendedLanes|t)?0:i}function vu(e){switch(e){case 2:e=1;break;case 8:e=4;break;case 32:e=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:e=128;break;case 268435456:e=134217728;break;default:e=0}return e}function Su(e){return e&=-e,2<e?8<e?e&134217727?32:268435456:8:2}function Up(){var e=he.p;return e!==0?e:(e=window.event,e===void 0?32:ov(e.type))}function Ld(e,t){var i=he.p;try{return he.p=e,t()}finally{he.p=i}}var Ts=Math.random().toString(36).slice(2),ct="__reactFiber$"+Ts,Rt="__reactProps$"+Ts,$r="__reactContainer$"+Ts,zc="__reactEvents$"+Ts,dS="__reactListeners$"+Ts,fS="__reactHandles$"+Ts,zd="__reactResources$"+Ts,fl="__reactMarker$"+Ts;function yu(e){delete e[ct],delete e[Rt],delete e[zc],delete e[dS],delete e[fS]}function pr(e){var t=e[ct];if(t)return t;for(var i=e.parentNode;i;){if(t=i[$r]||i[ct]){if(i=t.alternate,t.child!==null||i!==null&&i.child!==null)for(e=Yf(e);e!==null;){if(i=e[ct])return i;e=Yf(e)}return t}e=i,i=e.parentNode}return null}function Gr(e){if(e=e[ct]||e[$r]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function wn(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(M(33))}function Tr(e){var t=e[zd];return t||(t=e[zd]={hoistableStyles:new Map,hoistableScripts:new Map}),t}function tt(e){e[fl]=!0}var qp=new Set,Pp={};function Zs(e,t){zr(e,t),zr(e+"Capture",t)}function zr(e,t){for(Pp[e]=t,e=0;e<t.length;e++)qp.add(t[e])}var _S=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]*$"),jd={},Hd={};function pS(e){return Lc.call(Hd,e)?!0:Lc.call(jd,e)?!1:_S.test(e)?Hd[e]=!0:(jd[e]=!0,!1)}function Fl(e,t,i){if(pS(t))if(i===null)e.removeAttribute(t);else{switch(typeof i){case"undefined":case"function":case"symbol":e.removeAttribute(t);return;case"boolean":var s=t.toLowerCase().slice(0,5);if(s!=="data-"&&s!=="aria-"){e.removeAttribute(t);return}}e.setAttribute(t,""+i)}}function Bl(e,t,i){if(i===null)e.removeAttribute(t);else{switch(typeof i){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(t);return}e.setAttribute(t,""+i)}}function Ei(e,t,i,s){if(s===null)e.removeAttribute(i);else{switch(typeof s){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(i);return}e.setAttributeNS(t,i,""+s)}}function $t(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function Kp(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function mS(e,t,i){var s=Object.getOwnPropertyDescriptor(e.constructor.prototype,t);if(!e.hasOwnProperty(t)&&typeof s<"u"&&typeof s.get=="function"&&typeof s.set=="function"){var r=s.get,n=s.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return r.call(this)},set:function(l){i=""+l,n.call(this,l)}}),Object.defineProperty(e,t,{enumerable:s.enumerable}),{getValue:function(){return i},setValue:function(l){i=""+l},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function jc(e){if(!e._valueTracker){var t=Kp(e)?"checked":"value";e._valueTracker=mS(e,t,""+e[t])}}function Wp(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var i=t.getValue(),s="";return e&&(s=Kp(e)?e.checked?"true":"false":e.value),e=s,e!==i?(t.setValue(e),!0):!1}function xa(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}var gS=/[\n"\\]/g;function Zt(e){return e.replace(gS,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function Hc(e,t,i,s,r,n,l,a){e.name="",l!=null&&typeof l!="function"&&typeof l!="symbol"&&typeof l!="boolean"?e.type=l:e.removeAttribute("type"),t!=null?l==="number"?(t===0&&e.value===""||e.value!=t)&&(e.value=""+$t(t)):e.value!==""+$t(t)&&(e.value=""+$t(t)):l!=="submit"&&l!=="reset"||e.removeAttribute("value"),t!=null?Uc(e,l,$t(t)):i!=null?Uc(e,l,$t(i)):s!=null&&e.removeAttribute("value"),r==null&&n!=null&&(e.defaultChecked=!!n),r!=null&&(e.checked=r&&typeof r!="function"&&typeof r!="symbol"),a!=null&&typeof a!="function"&&typeof a!="symbol"&&typeof a!="boolean"?e.name=""+$t(a):e.removeAttribute("name")}function Yp(e,t,i,s,r,n,l,a){if(n!=null&&typeof n!="function"&&typeof n!="symbol"&&typeof n!="boolean"&&(e.type=n),t!=null||i!=null){if(!(n!=="submit"&&n!=="reset"||t!=null)){jc(e);return}i=i!=null?""+$t(i):"",t=t!=null?""+$t(t):i,a||t===e.value||(e.value=t),e.defaultValue=t}s=s??r,s=typeof s!="function"&&typeof s!="symbol"&&!!s,e.checked=a?e.checked:!!s,e.defaultChecked=!!s,l!=null&&typeof l!="function"&&typeof l!="symbol"&&typeof l!="boolean"&&(e.name=l),jc(e)}function Uc(e,t,i){t==="number"&&xa(e.ownerDocument)===e||e.defaultValue===""+i||(e.defaultValue=""+i)}function Dr(e,t,i,s){if(e=e.options,t){t={};for(var r=0;r<i.length;r++)t["$"+i[r]]=!0;for(i=0;i<e.length;i++)r=t.hasOwnProperty("$"+e[i].value),e[i].selected!==r&&(e[i].selected=r),r&&s&&(e[i].defaultSelected=!0)}else{for(i=""+$t(i),t=null,r=0;r<e.length;r++){if(e[r].value===i){e[r].selected=!0,s&&(e[r].defaultSelected=!0);return}t!==null||e[r].disabled||(t=e[r])}t!==null&&(t.selected=!0)}}function Vp(e,t,i){if(t!=null&&(t=""+$t(t),t!==e.value&&(e.value=t),i==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=i!=null?""+$t(i):""}function Ip(e,t,i,s){if(t==null){if(s!=null){if(i!=null)throw Error(M(92));if(bn(s)){if(1<s.length)throw Error(M(93));s=s[0]}i=s}i==null&&(i=""),t=i}i=$t(t),e.defaultValue=i,s=e.textContent,s===i&&s!==""&&s!==null&&(e.value=s),jc(e)}function jr(e,t){if(t){var i=e.firstChild;if(i&&i===e.lastChild&&i.nodeType===3){i.nodeValue=t;return}}e.textContent=t}var vS=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 Ud(e,t,i){var s=t.indexOf("--")===0;i==null||typeof i=="boolean"||i===""?s?e.setProperty(t,""):t==="float"?e.cssFloat="":e[t]="":s?e.setProperty(t,i):typeof i!="number"||i===0||vS.has(t)?t==="float"?e.cssFloat=i:e[t]=(""+i).trim():e[t]=i+"px"}function Xp(e,t,i){if(t!=null&&typeof t!="object")throw Error(M(62));if(e=e.style,i!=null){for(var s in i)!i.hasOwnProperty(s)||t!=null&&t.hasOwnProperty(s)||(s.indexOf("--")===0?e.setProperty(s,""):s==="float"?e.cssFloat="":e[s]="");for(var r in t)s=t[r],t.hasOwnProperty(r)&&i[r]!==s&&Ud(e,r,s)}else for(var n in t)t.hasOwnProperty(n)&&Ud(e,n,t[n])}function bu(e){if(e.indexOf("-")===-1)return!1;switch(e){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 SS=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"]]),yS=/^[\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 Zl(e){return yS.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function Oi(){}var qc=null;function wu(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var mr=null,Mr=null;function qd(e){var t=Gr(e);if(t&&(e=t.stateNode)){var i=e[Rt]||null;e:switch(e=t.stateNode,t.type){case"input":if(Hc(e,i.value,i.defaultValue,i.defaultValue,i.checked,i.defaultChecked,i.type,i.name),t=i.name,i.type==="radio"&&t!=null){for(i=e;i.parentNode;)i=i.parentNode;for(i=i.querySelectorAll('input[name="'+Zt(""+t)+'"][type="radio"]'),t=0;t<i.length;t++){var s=i[t];if(s!==e&&s.form===e.form){var r=s[Rt]||null;if(!r)throw Error(M(90));Hc(s,r.value,r.defaultValue,r.defaultValue,r.checked,r.defaultChecked,r.type,r.name)}}for(t=0;t<i.length;t++)s=i[t],s.form===e.form&&Wp(s)}break e;case"textarea":Vp(e,i.value,i.defaultValue);break e;case"select":t=i.value,t!=null&&Dr(e,!!i.multiple,t,!1)}}}var No=!1;function $p(e,t,i){if(No)return e(t,i);No=!0;try{var s=e(t);return s}finally{if(No=!1,(mr!==null||Mr!==null)&&(vo(),mr&&(t=mr,e=Mr,Mr=mr=null,qd(t),e)))for(t=0;t<e.length;t++)qd(e[t])}}function Xn(e,t){var i=e.stateNode;if(i===null)return null;var s=i[Rt]||null;if(s===null)return null;i=s[t];e:switch(t){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(s=!s.disabled)||(e=e.type,s=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!s;break e;default:e=!1}if(e)return null;if(i&&typeof i!="function")throw Error(M(231,t,typeof i));return i}var qi=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Pc=!1;if(qi)try{var an={};Object.defineProperty(an,"passive",{get:function(){Pc=!0}}),window.addEventListener("test",an,an),window.removeEventListener("test",an,an)}catch{Pc=!1}var os=null,Cu=null,Ql=null;function Gp(){if(Ql)return Ql;var e,t=Cu,i=t.length,s,r="value"in os?os.value:os.textContent,n=r.length;for(e=0;e<i&&t[e]===r[e];e++);var l=i-e;for(s=1;s<=l&&t[i-s]===r[n-s];s++);return Ql=r.slice(e,1<s?1-s:void 0)}function Jl(e){var t=e.keyCode;return"charCode"in e?(e=e.charCode,e===0&&t===13&&(e=13)):e=t,e===10&&(e=13),32<=e||e===13?e:0}function Al(){return!0}function Pd(){return!1}function Bt(e){function t(i,s,r,n,l){this._reactName=i,this._targetInst=r,this.type=s,this.nativeEvent=n,this.target=l,this.currentTarget=null;for(var a in e)e.hasOwnProperty(a)&&(i=e[a],this[a]=i?i(n):n[a]);return this.isDefaultPrevented=(n.defaultPrevented!=null?n.defaultPrevented:n.returnValue===!1)?Al:Pd,this.isPropagationStopped=Pd,this}return we(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var i=this.nativeEvent;i&&(i.preventDefault?i.preventDefault():typeof i.returnValue!="unknown"&&(i.returnValue=!1),this.isDefaultPrevented=Al)},stopPropagation:function(){var i=this.nativeEvent;i&&(i.stopPropagation?i.stopPropagation():typeof i.cancelBubble!="unknown"&&(i.cancelBubble=!0),this.isPropagationStopped=Al)},persist:function(){},isPersistent:Al}),t}var Qs={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},lo=Bt(Qs),_l=we({},Qs,{view:0,detail:0}),bS=Bt(_l),Oo,Lo,on,ao=we({},_l,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:xu,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return"movementX"in e?e.movementX:(e!==on&&(on&&e.type==="mousemove"?(Oo=e.screenX-on.screenX,Lo=e.screenY-on.screenY):Lo=Oo=0,on=e),Oo)},movementY:function(e){return"movementY"in e?e.movementY:Lo}}),Kd=Bt(ao),wS=we({},ao,{dataTransfer:0}),CS=Bt(wS),xS=we({},_l,{relatedTarget:0}),zo=Bt(xS),ES=we({},Qs,{animationName:0,elapsedTime:0,pseudoElement:0}),kS=Bt(ES),TS=we({},Qs,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),DS=Bt(TS),MS=we({},Qs,{data:0}),Wd=Bt(MS),RS={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},BS={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"},AS={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function NS(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=AS[e])?!!t[e]:!1}function xu(){return NS}var OS=we({},_l,{key:function(e){if(e.key){var t=RS[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=Jl(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?BS[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:xu,charCode:function(e){return e.type==="keypress"?Jl(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?Jl(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),LS=Bt(OS),zS=we({},ao,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Yd=Bt(zS),jS=we({},_l,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:xu}),HS=Bt(jS),US=we({},Qs,{propertyName:0,elapsedTime:0,pseudoElement:0}),qS=Bt(US),PS=we({},ao,{deltaX:function(e){return"deltaX"in e?e.deltaX:"wheelDeltaX"in e?-e.wheelDeltaX:0},deltaY:function(e){return"deltaY"in e?e.deltaY:"wheelDeltaY"in e?-e.wheelDeltaY:"wheelDelta"in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0}),KS=Bt(PS),WS=we({},Qs,{newState:0,oldState:0}),YS=Bt(WS),VS=[9,13,27,32],Eu=qi&&"CompositionEvent"in window,Bn=null;qi&&"documentMode"in document&&(Bn=document.documentMode);var IS=qi&&"TextEvent"in window&&!Bn,Fp=qi&&(!Eu||Bn&&8<Bn&&11>=Bn),Vd=" ",Id=!1;function Zp(e,t){switch(e){case"keyup":return VS.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Qp(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var gr=!1;function XS(e,t){switch(e){case"compositionend":return Qp(t);case"keypress":return t.which!==32?null:(Id=!0,Vd);case"textInput":return e=t.data,e===Vd&&Id?null:e;default:return null}}function $S(e,t){if(gr)return e==="compositionend"||!Eu&&Zp(e,t)?(e=Gp(),Ql=Cu=os=null,gr=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case"compositionend":return Fp&&t.locale!=="ko"?null:t.data;default:return null}}var GS={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 Xd(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!GS[e.type]:t==="textarea"}function Jp(e,t,i,s){mr?Mr?Mr.push(s):Mr=[s]:mr=s,t=Ka(t,"onChange"),0<t.length&&(i=new lo("onChange","change",null,i,s),e.push({event:i,listeners:t}))}var An=null,$n=null;function FS(e){$g(e,0)}function oo(e){var t=wn(e);if(Wp(t))return e}function $d(e,t){if(e==="change")return t}var em=!1;if(qi){var jo;if(qi){var Ho="oninput"in document;if(!Ho){var Gd=document.createElement("div");Gd.setAttribute("oninput","return;"),Ho=typeof Gd.oninput=="function"}jo=Ho}else jo=!1;em=jo&&(!document.documentMode||9<document.documentMode)}function Fd(){An&&(An.detachEvent("onpropertychange",tm),$n=An=null)}function tm(e){if(e.propertyName==="value"&&oo($n)){var t=[];Jp(t,$n,e,wu(e)),$p(FS,t)}}function ZS(e,t,i){e==="focusin"?(Fd(),An=t,$n=i,An.attachEvent("onpropertychange",tm)):e==="focusout"&&Fd()}function QS(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return oo($n)}function JS(e,t){if(e==="click")return oo(t)}function ey(e,t){if(e==="input"||e==="change")return oo(t)}function ty(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Kt=typeof Object.is=="function"?Object.is:ty;function Gn(e,t){if(Kt(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var i=Object.keys(e),s=Object.keys(t);if(i.length!==s.length)return!1;for(s=0;s<i.length;s++){var r=i[s];if(!Lc.call(t,r)||!Kt(e[r],t[r]))return!1}return!0}function Zd(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Qd(e,t){var i=Zd(e);e=0;for(var s;i;){if(i.nodeType===3){if(s=e+i.textContent.length,e<=t&&s>=t)return{node:i,offset:t-e};e=s}e:{for(;i;){if(i.nextSibling){i=i.nextSibling;break e}i=i.parentNode}i=void 0}i=Zd(i)}}function im(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?im(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function sm(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=xa(e.document);t instanceof e.HTMLIFrameElement;){try{var i=typeof t.contentWindow.location.href=="string"}catch{i=!1}if(i)e=t.contentWindow;else break;t=xa(e.document)}return t}function ku(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}var iy=qi&&"documentMode"in document&&11>=document.documentMode,vr=null,Kc=null,Nn=null,Wc=!1;function Jd(e,t,i){var s=i.window===i?i.document:i.nodeType===9?i:i.ownerDocument;Wc||vr==null||vr!==xa(s)||(s=vr,"selectionStart"in s&&ku(s)?s={start:s.selectionStart,end:s.selectionEnd}:(s=(s.ownerDocument&&s.ownerDocument.defaultView||window).getSelection(),s={anchorNode:s.anchorNode,anchorOffset:s.anchorOffset,focusNode:s.focusNode,focusOffset:s.focusOffset}),Nn&&Gn(Nn,s)||(Nn=s,s=Ka(Kc,"onSelect"),0<s.length&&(t=new lo("onSelect","select",null,t,i),e.push({event:t,listeners:s}),t.target=vr)))}function Ms(e,t){var i={};return i[e.toLowerCase()]=t.toLowerCase(),i["Webkit"+e]="webkit"+t,i["Moz"+e]="moz"+t,i}var Sr={animationend:Ms("Animation","AnimationEnd"),animationiteration:Ms("Animation","AnimationIteration"),animationstart:Ms("Animation","AnimationStart"),transitionrun:Ms("Transition","TransitionRun"),transitionstart:Ms("Transition","TransitionStart"),transitioncancel:Ms("Transition","TransitionCancel"),transitionend:Ms("Transition","TransitionEnd")},Uo={},rm={};qi&&(rm=document.createElement("div").style,"AnimationEvent"in window||(delete Sr.animationend.animation,delete Sr.animationiteration.animation,delete Sr.animationstart.animation),"TransitionEvent"in window||delete Sr.transitionend.transition);function Js(e){if(Uo[e])return Uo[e];if(!Sr[e])return e;var t=Sr[e],i;for(i in t)if(t.hasOwnProperty(i)&&i in rm)return Uo[e]=t[i];return e}var nm=Js("animationend"),lm=Js("animationiteration"),am=Js("animationstart"),sy=Js("transitionrun"),ry=Js("transitionstart"),ny=Js("transitioncancel"),om=Js("transitionend"),cm=new Map,Yc="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(" ");Yc.push("scrollEnd");function ci(e,t){cm.set(e,t),Zs(t,[e])}var Ea=typeof reportError=="function"?reportError:function(e){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var t=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof e=="object"&&e!==null&&typeof e.message=="string"?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",e);return}console.error(e)},It=[],yr=0,Tu=0;function co(){for(var e=yr,t=Tu=yr=0;t<e;){var i=It[t];It[t++]=null;var s=It[t];It[t++]=null;var r=It[t];It[t++]=null;var n=It[t];if(It[t++]=null,s!==null&&r!==null){var l=s.pending;l===null?r.next=r:(r.next=l.next,l.next=r),s.pending=r}n!==0&&hm(i,r,n)}}function ho(e,t,i,s){It[yr++]=e,It[yr++]=t,It[yr++]=i,It[yr++]=s,Tu|=s,e.lanes|=s,e=e.alternate,e!==null&&(e.lanes|=s)}function Du(e,t,i,s){return ho(e,t,i,s),ka(e)}function er(e,t){return ho(e,null,null,t),ka(e)}function hm(e,t,i){e.lanes|=i;var s=e.alternate;s!==null&&(s.lanes|=i);for(var r=!1,n=e.return;n!==null;)n.childLanes|=i,s=n.alternate,s!==null&&(s.childLanes|=i),n.tag===22&&(e=n.stateNode,e===null||e._visibility&1||(r=!0)),e=n,n=n.return;return e.tag===3?(n=e.stateNode,r&&t!==null&&(r=31-qt(i),e=n.hiddenUpdates,s=e[r],s===null?e[r]=[t]:s.push(t),t.lane=i|536870912),n):null}function ka(e){if(50<Kn)throw Kn=0,uh=null,Error(M(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var br={};function ly(e,t,i,s){this.tag=e,this.key=i,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=s,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function zt(e,t,i,s){return new ly(e,t,i,s)}function Mu(e){return e=e.prototype,!(!e||!e.isReactComponent)}function ji(e,t){var i=e.alternate;return i===null?(i=zt(e.tag,t,e.key,e.mode),i.elementType=e.elementType,i.type=e.type,i.stateNode=e.stateNode,i.alternate=e,e.alternate=i):(i.pendingProps=t,i.type=e.type,i.flags=0,i.subtreeFlags=0,i.deletions=null),i.flags=e.flags&65011712,i.childLanes=e.childLanes,i.lanes=e.lanes,i.child=e.child,i.memoizedProps=e.memoizedProps,i.memoizedState=e.memoizedState,i.updateQueue=e.updateQueue,t=e.dependencies,i.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},i.sibling=e.sibling,i.index=e.index,i.ref=e.ref,i.refCleanup=e.refCleanup,i}function um(e,t){e.flags&=65011714;var i=e.alternate;return i===null?(e.childLanes=0,e.lanes=t,e.child=null,e.subtreeFlags=0,e.memoizedProps=null,e.memoizedState=null,e.updateQueue=null,e.dependencies=null,e.stateNode=null):(e.childLanes=i.childLanes,e.lanes=i.lanes,e.child=i.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=i.memoizedProps,e.memoizedState=i.memoizedState,e.updateQueue=i.updateQueue,e.type=i.type,t=i.dependencies,e.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),e}function ea(e,t,i,s,r,n){var l=0;if(s=e,typeof e=="function")Mu(e)&&(l=1);else if(typeof e=="string")l=u1(e,i,vi.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case Bc:return e=zt(31,i,t,r),e.elementType=Bc,e.lanes=n,e;case fr:return Us(i.children,r,n,t);case Rp:l=8,r|=24;break;case Dc:return e=zt(12,i,t,r|2),e.elementType=Dc,e.lanes=n,e;case Mc:return e=zt(13,i,t,r),e.elementType=Mc,e.lanes=n,e;case Rc:return e=zt(19,i,t,r),e.elementType=Rc,e.lanes=n,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case Ni:l=10;break e;case Bp:l=9;break e;case pu:l=11;break e;case mu:l=14;break e;case es:l=16,s=null;break e}l=29,i=Error(M(130,e===null?"null":typeof e,"")),s=null}return t=zt(l,i,t,r),t.elementType=e,t.type=s,t.lanes=n,t}function Us(e,t,i,s){return e=zt(7,e,s,t),e.lanes=i,e}function qo(e,t,i){return e=zt(6,e,null,t),e.lanes=i,e}function dm(e){var t=zt(18,null,null,0);return t.stateNode=e,t}function Po(e,t,i){return t=zt(4,e.children!==null?e.children:[],e.key,t),t.lanes=i,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var ef=new WeakMap;function Qt(e,t){if(typeof e=="object"&&e!==null){var i=ef.get(e);return i!==void 0?i:(t={value:e,source:t,stack:Od(t)},ef.set(e,t),t)}return{value:e,source:t,stack:Od(t)}}var wr=[],Cr=0,Ta=null,Fn=0,Gt=[],Ft=0,Cs=null,_i=1,pi="";function Bi(e,t){wr[Cr++]=Fn,wr[Cr++]=Ta,Ta=e,Fn=t}function fm(e,t,i){Gt[Ft++]=_i,Gt[Ft++]=pi,Gt[Ft++]=Cs,Cs=e;var s=_i;e=pi;var r=32-qt(s)-1;s&=~(1<<r),i+=1;var n=32-qt(t)+r;if(30<n){var l=r-r%5;n=(s&(1<<l)-1).toString(32),s>>=l,r-=l,_i=1<<32-qt(t)+r|i<<r|s,pi=n+e}else _i=1<<n|i<<r|s,pi=e}function Ru(e){e.return!==null&&(Bi(e,1),fm(e,1,0))}function Bu(e){for(;e===Ta;)Ta=wr[--Cr],wr[Cr]=null,Fn=wr[--Cr],wr[Cr]=null;for(;e===Cs;)Cs=Gt[--Ft],Gt[Ft]=null,pi=Gt[--Ft],Gt[Ft]=null,_i=Gt[--Ft],Gt[Ft]=null}function _m(e,t){Gt[Ft++]=_i,Gt[Ft++]=pi,Gt[Ft++]=Cs,_i=t.id,pi=t.overflow,Cs=e}var ht=null,ye=null,ae=!1,_s=null,Jt=!1,Vc=Error(M(519));function xs(e){var t=Error(M(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Zn(Qt(t,e)),Vc}function tf(e){var t=e.stateNode,i=e.type,s=e.memoizedProps;switch(t[ct]=e,t[Rt]=s,i){case"dialog":re("cancel",t),re("close",t);break;case"iframe":case"object":case"embed":re("load",t);break;case"video":case"audio":for(i=0;i<tl.length;i++)re(tl[i],t);break;case"source":re("error",t);break;case"img":case"image":case"link":re("error",t),re("load",t);break;case"details":re("toggle",t);break;case"input":re("invalid",t),Yp(t,s.value,s.defaultValue,s.checked,s.defaultChecked,s.type,s.name,!0);break;case"select":re("invalid",t);break;case"textarea":re("invalid",t),Ip(t,s.value,s.defaultValue,s.children)}i=s.children,typeof i!="string"&&typeof i!="number"&&typeof i!="bigint"||t.textContent===""+i||s.suppressHydrationWarning===!0||Fg(t.textContent,i)?(s.popover!=null&&(re("beforetoggle",t),re("toggle",t)),s.onScroll!=null&&re("scroll",t),s.onScrollEnd!=null&&re("scrollend",t),s.onClick!=null&&(t.onclick=Oi),t=!0):t=!1,t||xs(e,!0)}function sf(e){for(ht=e.return;ht;)switch(ht.tag){case 5:case 31:case 13:Jt=!1;return;case 27:case 3:Jt=!0;return;default:ht=ht.return}}function nr(e){if(e!==ht)return!1;if(!ae)return sf(e),ae=!0,!1;var t=e.tag,i;if((i=t!==3&&t!==27)&&((i=t===5)&&(i=e.type,i=!(i!=="form"&&i!=="button")||mh(e.type,e.memoizedProps)),i=!i),i&&ye&&xs(e),sf(e),t===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(M(317));ye=Wf(e)}else if(t===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(M(317));ye=Wf(e)}else t===27?(t=ye,Ds(e.type)?(e=yh,yh=null,ye=e):ye=t):ye=ht?ti(e.stateNode.nextSibling):null;return!0}function Ys(){ye=ht=null,ae=!1}function Ko(){var e=_s;return e!==null&&(Dt===null?Dt=e:Dt.push.apply(Dt,e),_s=null),e}function Zn(e){_s===null?_s=[e]:_s.push(e)}var Ic=bi(null),tr=null,Li=null;function ss(e,t,i){ge(Ic,t._currentValue),t._currentValue=i}function Hi(e){e._currentValue=Ic.current,it(Ic)}function Xc(e,t,i){for(;e!==null;){var s=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,s!==null&&(s.childLanes|=t)):s!==null&&(s.childLanes&t)!==t&&(s.childLanes|=t),e===i)break;e=e.return}}function $c(e,t,i,s){var r=e.child;for(r!==null&&(r.return=e);r!==null;){var n=r.dependencies;if(n!==null){var l=r.child;n=n.firstContext;e:for(;n!==null;){var a=n;n=r;for(var o=0;o<t.length;o++)if(a.context===t[o]){n.lanes|=i,a=n.alternate,a!==null&&(a.lanes|=i),Xc(n.return,i,e),s||(l=null);break e}n=a.next}}else if(r.tag===18){if(l=r.return,l===null)throw Error(M(341));l.lanes|=i,n=l.alternate,n!==null&&(n.lanes|=i),Xc(l,i,e),l=null}else l=r.child;if(l!==null)l.return=r;else for(l=r;l!==null;){if(l===e){l=null;break}if(r=l.sibling,r!==null){r.return=l.return,l=r;break}l=l.return}r=l}}function Fr(e,t,i,s){e=null;for(var r=t,n=!1;r!==null;){if(!n){if(r.flags&524288)n=!0;else if(r.flags&262144)break}if(r.tag===10){var l=r.alternate;if(l===null)throw Error(M(387));if(l=l.memoizedProps,l!==null){var a=r.type;Kt(r.pendingProps.value,l.value)||(e!==null?e.push(a):e=[a])}}else if(r===ya.current){if(l=r.alternate,l===null)throw Error(M(387));l.memoizedState.memoizedState!==r.memoizedState.memoizedState&&(e!==null?e.push(sl):e=[sl])}r=r.return}e!==null&&$c(t,e,i,s),t.flags|=262144}function Da(e){for(e=e.firstContext;e!==null;){if(!Kt(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function Vs(e){tr=e,Li=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function dt(e){return pm(tr,e)}function Nl(e,t){return tr===null&&Vs(e),pm(e,t)}function pm(e,t){var i=t._currentValue;if(t={context:t,memoizedValue:i,next:null},Li===null){if(e===null)throw Error(M(308));Li=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else Li=Li.next=t;return i}var ay=typeof AbortController<"u"?AbortController:function(){var e=[],t=this.signal={aborted:!1,addEventListener:function(i,s){e.push(s)}};this.abort=function(){t.aborted=!0,e.forEach(function(i){return i()})}},oy=Ie.unstable_scheduleCallback,cy=Ie.unstable_NormalPriority,Ue={$$typeof:Ni,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Au(){return{controller:new ay,data:new Map,refCount:0}}function pl(e){e.refCount--,e.refCount===0&&oy(cy,function(){e.controller.abort()})}var On=null,Gc=0,Hr=0,Rr=null;function hy(e,t){if(On===null){var i=On=[];Gc=0,Hr=sd(),Rr={status:"pending",value:void 0,then:function(s){i.push(s)}}}return Gc++,t.then(rf,rf),t}function rf(){if(--Gc===0&&On!==null){Rr!==null&&(Rr.status="fulfilled");var e=On;On=null,Hr=0,Rr=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function uy(e,t){var i=[],s={status:"pending",value:null,reason:null,then:function(r){i.push(r)}};return e.then(function(){s.status="fulfilled",s.value=t;for(var r=0;r<i.length;r++)(0,i[r])(t)},function(r){for(s.status="rejected",s.reason=r,r=0;r<i.length;r++)(0,i[r])(void 0)}),s}var nf=X.S;X.S=function(e,t){Mg=Ht(),typeof t=="object"&&t!==null&&typeof t.then=="function"&&hy(e,t),nf!==null&&nf(e,t)};var qs=bi(null);function Nu(){var e=qs.current;return e!==null?e:me.pooledCache}function ta(e,t){t===null?ge(qs,qs.current):ge(qs,t.pool)}function mm(){var e=Nu();return e===null?null:{parent:Ue._currentValue,pool:e}}var Zr=Error(M(460)),Ou=Error(M(474)),uo=Error(M(542)),Ma={then:function(){}};function lf(e){return e=e.status,e==="fulfilled"||e==="rejected"}function gm(e,t,i){switch(i=e[i],i===void 0?e.push(t):i!==t&&(t.then(Oi,Oi),t=i),t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,of(e),e;default:if(typeof t.status=="string")t.then(Oi,Oi);else{if(e=me,e!==null&&100<e.shellSuspendCounter)throw Error(M(482));e=t,e.status="pending",e.then(function(s){if(t.status==="pending"){var r=t;r.status="fulfilled",r.value=s}},function(s){if(t.status==="pending"){var r=t;r.status="rejected",r.reason=s}})}switch(t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,of(e),e}throw Ps=t,Zr}}function Ns(e){try{var t=e._init;return t(e._payload)}catch(i){throw i!==null&&typeof i=="object"&&typeof i.then=="function"?(Ps=i,Zr):i}}var Ps=null;function af(){if(Ps===null)throw Error(M(459));var e=Ps;return Ps=null,e}function of(e){if(e===Zr||e===uo)throw Error(M(483))}var Br=null,Qn=0;function Ol(e){var t=Qn;return Qn+=1,Br===null&&(Br=[]),gm(Br,e,t)}function cn(e,t){t=t.props.ref,e.ref=t!==void 0?t:null}function Ll(e,t){throw t.$$typeof===Z0?Error(M(525)):(e=Object.prototype.toString.call(t),Error(M(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e)))}function vm(e){function t(m,p){if(e){var v=m.deletions;v===null?(m.deletions=[p],m.flags|=16):v.push(p)}}function i(m,p){if(!e)return null;for(;p!==null;)t(m,p),p=p.sibling;return null}function s(m){for(var p=new Map;m!==null;)m.key!==null?p.set(m.key,m):p.set(m.index,m),m=m.sibling;return p}function r(m,p){return m=ji(m,p),m.index=0,m.sibling=null,m}function n(m,p,v){return m.index=v,e?(v=m.alternate,v!==null?(v=v.index,v<p?(m.flags|=67108866,p):v):(m.flags|=67108866,p)):(m.flags|=1048576,p)}function l(m){return e&&m.alternate===null&&(m.flags|=67108866),m}function a(m,p,v,S){return p===null||p.tag!==6?(p=qo(v,m.mode,S),p.return=m,p):(p=r(p,v),p.return=m,p)}function o(m,p,v,S){var T=v.type;return T===fr?u(m,p,v.props.children,S,v.key):p!==null&&(p.elementType===T||typeof T=="object"&&T!==null&&T.$$typeof===es&&Ns(T)===p.type)?(p=r(p,v.props),cn(p,v),p.return=m,p):(p=ea(v.type,v.key,v.props,null,m.mode,S),cn(p,v),p.return=m,p)}function c(m,p,v,S){return p===null||p.tag!==4||p.stateNode.containerInfo!==v.containerInfo||p.stateNode.implementation!==v.implementation?(p=Po(v,m.mode,S),p.return=m,p):(p=r(p,v.children||[]),p.return=m,p)}function u(m,p,v,S,T){return p===null||p.tag!==7?(p=Us(v,m.mode,S,T),p.return=m,p):(p=r(p,v),p.return=m,p)}function _(m,p,v){if(typeof p=="string"&&p!==""||typeof p=="number"||typeof p=="bigint")return p=qo(""+p,m.mode,v),p.return=m,p;if(typeof p=="object"&&p!==null){switch(p.$$typeof){case Tl:return v=ea(p.type,p.key,p.props,null,m.mode,v),cn(v,p),v.return=m,v;case yn:return p=Po(p,m.mode,v),p.return=m,p;case es:return p=Ns(p),_(m,p,v)}if(bn(p)||ln(p))return p=Us(p,m.mode,v,null),p.return=m,p;if(typeof p.then=="function")return _(m,Ol(p),v);if(p.$$typeof===Ni)return _(m,Nl(m,p),v);Ll(m,p)}return null}function f(m,p,v,S){var T=p!==null?p.key:null;if(typeof v=="string"&&v!==""||typeof v=="number"||typeof v=="bigint")return T!==null?null:a(m,p,""+v,S);if(typeof v=="object"&&v!==null){switch(v.$$typeof){case Tl:return v.key===T?o(m,p,v,S):null;case yn:return v.key===T?c(m,p,v,S):null;case es:return v=Ns(v),f(m,p,v,S)}if(bn(v)||ln(v))return T!==null?null:u(m,p,v,S,null);if(typeof v.then=="function")return f(m,p,Ol(v),S);if(v.$$typeof===Ni)return f(m,p,Nl(m,v),S);Ll(m,v)}return null}function d(m,p,v,S,T){if(typeof S=="string"&&S!==""||typeof S=="number"||typeof S=="bigint")return m=m.get(v)||null,a(p,m,""+S,T);if(typeof S=="object"&&S!==null){switch(S.$$typeof){case Tl:return m=m.get(S.key===null?v:S.key)||null,o(p,m,S,T);case yn:return m=m.get(S.key===null?v:S.key)||null,c(p,m,S,T);case es:return S=Ns(S),d(m,p,v,S,T)}if(bn(S)||ln(S))return m=m.get(v)||null,u(p,m,S,T,null);if(typeof S.then=="function")return d(m,p,v,Ol(S),T);if(S.$$typeof===Ni)return d(m,p,v,Nl(p,S),T);Ll(p,S)}return null}function g(m,p,v,S){for(var T=null,j=null,O=p,L=p=0,U=null;O!==null&&L<v.length;L++){O.index>L?(U=O,O=null):U=O.sibling;var Y=f(m,O,v[L],S);if(Y===null){O===null&&(O=U);break}e&&O&&Y.alternate===null&&t(m,O),p=n(Y,p,L),j===null?T=Y:j.sibling=Y,j=Y,O=U}if(L===v.length)return i(m,O),ae&&Bi(m,L),T;if(O===null){for(;L<v.length;L++)O=_(m,v[L],S),O!==null&&(p=n(O,p,L),j===null?T=O:j.sibling=O,j=O);return ae&&Bi(m,L),T}for(O=s(O);L<v.length;L++)U=d(O,m,L,v[L],S),U!==null&&(e&&U.alternate!==null&&O.delete(U.key===null?L:U.key),p=n(U,p,L),j===null?T=U:j.sibling=U,j=U);return e&&O.forEach(function(A){return t(m,A)}),ae&&Bi(m,L),T}function y(m,p,v,S){if(v==null)throw Error(M(151));for(var T=null,j=null,O=p,L=p=0,U=null,Y=v.next();O!==null&&!Y.done;L++,Y=v.next()){O.index>L?(U=O,O=null):U=O.sibling;var A=f(m,O,Y.value,S);if(A===null){O===null&&(O=U);break}e&&O&&A.alternate===null&&t(m,O),p=n(A,p,L),j===null?T=A:j.sibling=A,j=A,O=U}if(Y.done)return i(m,O),ae&&Bi(m,L),T;if(O===null){for(;!Y.done;L++,Y=v.next())Y=_(m,Y.value,S),Y!==null&&(p=n(Y,p,L),j===null?T=Y:j.sibling=Y,j=Y);return ae&&Bi(m,L),T}for(O=s(O);!Y.done;L++,Y=v.next())Y=d(O,m,L,Y.value,S),Y!==null&&(e&&Y.alternate!==null&&O.delete(Y.key===null?L:Y.key),p=n(Y,p,L),j===null?T=Y:j.sibling=Y,j=Y);return e&&O.forEach(function(x){return t(m,x)}),ae&&Bi(m,L),T}function w(m,p,v,S){if(typeof v=="object"&&v!==null&&v.type===fr&&v.key===null&&(v=v.props.children),typeof v=="object"&&v!==null){switch(v.$$typeof){case Tl:e:{for(var T=v.key;p!==null;){if(p.key===T){if(T=v.type,T===fr){if(p.tag===7){i(m,p.sibling),S=r(p,v.props.children),S.return=m,m=S;break e}}else if(p.elementType===T||typeof T=="object"&&T!==null&&T.$$typeof===es&&Ns(T)===p.type){i(m,p.sibling),S=r(p,v.props),cn(S,v),S.return=m,m=S;break e}i(m,p);break}else t(m,p);p=p.sibling}v.type===fr?(S=Us(v.props.children,m.mode,S,v.key),S.return=m,m=S):(S=ea(v.type,v.key,v.props,null,m.mode,S),cn(S,v),S.return=m,m=S)}return l(m);case yn:e:{for(T=v.key;p!==null;){if(p.key===T)if(p.tag===4&&p.stateNode.containerInfo===v.containerInfo&&p.stateNode.implementation===v.implementation){i(m,p.sibling),S=r(p,v.children||[]),S.return=m,m=S;break e}else{i(m,p);break}else t(m,p);p=p.sibling}S=Po(v,m.mode,S),S.return=m,m=S}return l(m);case es:return v=Ns(v),w(m,p,v,S)}if(bn(v))return g(m,p,v,S);if(ln(v)){if(T=ln(v),typeof T!="function")throw Error(M(150));return v=T.call(v),y(m,p,v,S)}if(typeof v.then=="function")return w(m,p,Ol(v),S);if(v.$$typeof===Ni)return w(m,p,Nl(m,v),S);Ll(m,v)}return typeof v=="string"&&v!==""||typeof v=="number"||typeof v=="bigint"?(v=""+v,p!==null&&p.tag===6?(i(m,p.sibling),S=r(p,v),S.return=m,m=S):(i(m,p),S=qo(v,m.mode,S),S.return=m,m=S),l(m)):i(m,p)}return function(m,p,v,S){try{Qn=0;var T=w(m,p,v,S);return Br=null,T}catch(O){if(O===Zr||O===uo)throw O;var j=zt(29,O,null,m.mode);return j.lanes=S,j.return=m,j}finally{}}}var Is=vm(!0),Sm=vm(!1),ts=!1;function Lu(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Fc(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function ps(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function ms(e,t,i){var s=e.updateQueue;if(s===null)return null;if(s=s.shared,ce&2){var r=s.pending;return r===null?t.next=t:(t.next=r.next,r.next=t),s.pending=t,t=ka(e),hm(e,null,i),t}return ho(e,s,t,i),ka(e)}function Ln(e,t,i){if(t=t.updateQueue,t!==null&&(t=t.shared,(i&4194048)!==0)){var s=t.lanes;s&=e.pendingLanes,i|=s,t.lanes=i,jp(e,i)}}function Wo(e,t){var i=e.updateQueue,s=e.alternate;if(s!==null&&(s=s.updateQueue,i===s)){var r=null,n=null;if(i=i.firstBaseUpdate,i!==null){do{var l={lane:i.lane,tag:i.tag,payload:i.payload,callback:null,next:null};n===null?r=n=l:n=n.next=l,i=i.next}while(i!==null);n===null?r=n=t:n=n.next=t}else r=n=t;i={baseState:s.baseState,firstBaseUpdate:r,lastBaseUpdate:n,shared:s.shared,callbacks:s.callbacks},e.updateQueue=i;return}e=i.lastBaseUpdate,e===null?i.firstBaseUpdate=t:e.next=t,i.lastBaseUpdate=t}var Zc=!1;function zn(){if(Zc){var e=Rr;if(e!==null)throw e}}function jn(e,t,i,s){Zc=!1;var r=e.updateQueue;ts=!1;var n=r.firstBaseUpdate,l=r.lastBaseUpdate,a=r.shared.pending;if(a!==null){r.shared.pending=null;var o=a,c=o.next;o.next=null,l===null?n=c:l.next=c,l=o;var u=e.alternate;u!==null&&(u=u.updateQueue,a=u.lastBaseUpdate,a!==l&&(a===null?u.firstBaseUpdate=c:a.next=c,u.lastBaseUpdate=o))}if(n!==null){var _=r.baseState;l=0,u=c=o=null,a=n;do{var f=a.lane&-536870913,d=f!==a.lane;if(d?(le&f)===f:(s&f)===f){f!==0&&f===Hr&&(Zc=!0),u!==null&&(u=u.next={lane:0,tag:a.tag,payload:a.payload,callback:null,next:null});e:{var g=e,y=a;f=t;var w=i;switch(y.tag){case 1:if(g=y.payload,typeof g=="function"){_=g.call(w,_,f);break e}_=g;break e;case 3:g.flags=g.flags&-65537|128;case 0:if(g=y.payload,f=typeof g=="function"?g.call(w,_,f):g,f==null)break e;_=we({},_,f);break e;case 2:ts=!0}}f=a.callback,f!==null&&(e.flags|=64,d&&(e.flags|=8192),d=r.callbacks,d===null?r.callbacks=[f]:d.push(f))}else d={lane:f,tag:a.tag,payload:a.payload,callback:a.callback,next:null},u===null?(c=u=d,o=_):u=u.next=d,l|=f;if(a=a.next,a===null){if(a=r.shared.pending,a===null)break;d=a,a=d.next,d.next=null,r.lastBaseUpdate=d,r.shared.pending=null}}while(!0);u===null&&(o=_),r.baseState=o,r.firstBaseUpdate=c,r.lastBaseUpdate=u,n===null&&(r.shared.lanes=0),ks|=l,e.lanes=l,e.memoizedState=_}}function ym(e,t){if(typeof e!="function")throw Error(M(191,e));e.call(t)}function bm(e,t){var i=e.callbacks;if(i!==null)for(e.callbacks=null,e=0;e<i.length;e++)ym(i[e],t)}var Ur=bi(null),Ra=bi(0);function cf(e,t){e=Yi,ge(Ra,e),ge(Ur,t),Yi=e|t.baseLanes}function Qc(){ge(Ra,Yi),ge(Ur,Ur.current)}function zu(){Yi=Ra.current,it(Ur),it(Ra)}var Wt=bi(null),ei=null;function rs(e){var t=e.alternate;ge(Oe,Oe.current&1),ge(Wt,e),ei===null&&(t===null||Ur.current!==null||t.memoizedState!==null)&&(ei=e)}function Jc(e){ge(Oe,Oe.current),ge(Wt,e),ei===null&&(ei=e)}function wm(e){e.tag===22?(ge(Oe,Oe.current),ge(Wt,e),ei===null&&(ei=e)):ns()}function ns(){ge(Oe,Oe.current),ge(Wt,Wt.current)}function Lt(e){it(Wt),ei===e&&(ei=null),it(Oe)}var Oe=bi(0);function Ba(e){for(var t=e;t!==null;){if(t.tag===13){var i=t.memoizedState;if(i!==null&&(i=i.dehydrated,i===null||vh(i)||Sh(i)))return t}else if(t.tag===19&&(t.memoizedProps.revealOrder==="forwards"||t.memoizedProps.revealOrder==="backwards"||t.memoizedProps.revealOrder==="unstable_legacy-backwards"||t.memoizedProps.revealOrder==="together")){if(t.flags&128)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var Pi=0,ee=null,pe=null,je=null,Aa=!1,Ar=!1,Xs=!1,Na=0,Jn=0,Nr=null,dy=0;function Me(){throw Error(M(321))}function ju(e,t){if(t===null)return!1;for(var i=0;i<t.length&&i<e.length;i++)if(!Kt(e[i],t[i]))return!1;return!0}function Hu(e,t,i,s,r,n){return Pi=n,ee=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,X.H=e===null||e.memoizedState===null?Jm:Gu,Xs=!1,n=i(s,r),Xs=!1,Ar&&(n=xm(t,i,s,r)),Cm(e),n}function Cm(e){X.H=el;var t=pe!==null&&pe.next!==null;if(Pi=0,je=pe=ee=null,Aa=!1,Jn=0,Nr=null,t)throw Error(M(300));e===null||Pe||(e=e.dependencies,e!==null&&Da(e)&&(Pe=!0))}function xm(e,t,i,s){ee=e;var r=0;do{if(Ar&&(Nr=null),Jn=0,Ar=!1,25<=r)throw Error(M(301));if(r+=1,je=pe=null,e.updateQueue!=null){var n=e.updateQueue;n.lastEffect=null,n.events=null,n.stores=null,n.memoCache!=null&&(n.memoCache.index=0)}X.H=eg,n=t(i,s)}while(Ar);return n}function fy(){var e=X.H,t=e.useState()[0];return t=typeof t.then=="function"?ml(t):t,e=e.useState()[0],(pe!==null?pe.memoizedState:null)!==e&&(ee.flags|=1024),t}function Uu(){var e=Na!==0;return Na=0,e}function qu(e,t,i){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~i}function Pu(e){if(Aa){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}Aa=!1}Pi=0,je=pe=ee=null,Ar=!1,Jn=Na=0,Nr=null}function vt(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return je===null?ee.memoizedState=je=e:je=je.next=e,je}function Le(){if(pe===null){var e=ee.alternate;e=e!==null?e.memoizedState:null}else e=pe.next;var t=je===null?ee.memoizedState:je.next;if(t!==null)je=t,pe=e;else{if(e===null)throw ee.alternate===null?Error(M(467)):Error(M(310));pe=e,e={memoizedState:pe.memoizedState,baseState:pe.baseState,baseQueue:pe.baseQueue,queue:pe.queue,next:null},je===null?ee.memoizedState=je=e:je=je.next=e}return je}function fo(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function ml(e){var t=Jn;return Jn+=1,Nr===null&&(Nr=[]),e=gm(Nr,e,t),t=ee,(je===null?t.memoizedState:je.next)===null&&(t=t.alternate,X.H=t===null||t.memoizedState===null?Jm:Gu),e}function _o(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return ml(e);if(e.$$typeof===Ni)return dt(e)}throw Error(M(438,String(e)))}function Ku(e){var t=null,i=ee.updateQueue;if(i!==null&&(t=i.memoCache),t==null){var s=ee.alternate;s!==null&&(s=s.updateQueue,s!==null&&(s=s.memoCache,s!=null&&(t={data:s.data.map(function(r){return r.slice()}),index:0})))}if(t==null&&(t={data:[],index:0}),i===null&&(i=fo(),ee.updateQueue=i),i.memoCache=t,i=t.data[t.index],i===void 0)for(i=t.data[t.index]=Array(e),s=0;s<e;s++)i[s]=Q0;return t.index++,i}function Ki(e,t){return typeof t=="function"?t(e):t}function ia(e){var t=Le();return Wu(t,pe,e)}function Wu(e,t,i){var s=e.queue;if(s===null)throw Error(M(311));s.lastRenderedReducer=i;var r=e.baseQueue,n=s.pending;if(n!==null){if(r!==null){var l=r.next;r.next=n.next,n.next=l}t.baseQueue=r=n,s.pending=null}if(n=e.baseState,r===null)e.memoizedState=n;else{t=r.next;var a=l=null,o=null,c=t,u=!1;do{var _=c.lane&-536870913;if(_!==c.lane?(le&_)===_:(Pi&_)===_){var f=c.revertLane;if(f===0)o!==null&&(o=o.next={lane:0,revertLane:0,gesture:null,action:c.action,hasEagerState:c.hasEagerState,eagerState:c.eagerState,next:null}),_===Hr&&(u=!0);else if((Pi&f)===f){c=c.next,f===Hr&&(u=!0);continue}else _={lane:0,revertLane:c.revertLane,gesture:null,action:c.action,hasEagerState:c.hasEagerState,eagerState:c.eagerState,next:null},o===null?(a=o=_,l=n):o=o.next=_,ee.lanes|=f,ks|=f;_=c.action,Xs&&i(n,_),n=c.hasEagerState?c.eagerState:i(n,_)}else f={lane:_,revertLane:c.revertLane,gesture:c.gesture,action:c.action,hasEagerState:c.hasEagerState,eagerState:c.eagerState,next:null},o===null?(a=o=f,l=n):o=o.next=f,ee.lanes|=_,ks|=_;c=c.next}while(c!==null&&c!==t);if(o===null?l=n:o.next=a,!Kt(n,e.memoizedState)&&(Pe=!0,u&&(i=Rr,i!==null)))throw i;e.memoizedState=n,e.baseState=l,e.baseQueue=o,s.lastRenderedState=n}return r===null&&(s.lanes=0),[e.memoizedState,s.dispatch]}function Yo(e){var t=Le(),i=t.queue;if(i===null)throw Error(M(311));i.lastRenderedReducer=e;var s=i.dispatch,r=i.pending,n=t.memoizedState;if(r!==null){i.pending=null;var l=r=r.next;do n=e(n,l.action),l=l.next;while(l!==r);Kt(n,t.memoizedState)||(Pe=!0),t.memoizedState=n,t.baseQueue===null&&(t.baseState=n),i.lastRenderedState=n}return[n,s]}function Em(e,t,i){var s=ee,r=Le(),n=ae;if(n){if(i===void 0)throw Error(M(407));i=i()}else i=t();var l=!Kt((pe||r).memoizedState,i);if(l&&(r.memoizedState=i,Pe=!0),r=r.queue,Yu(Dm.bind(null,s,r,e),[e]),r.getSnapshot!==t||l||je!==null&&je.memoizedState.tag&1){if(s.flags|=2048,qr(9,{destroy:void 0},Tm.bind(null,s,r,i,t),null),me===null)throw Error(M(349));n||Pi&127||km(s,t,i)}return i}function km(e,t,i){e.flags|=16384,e={getSnapshot:t,value:i},t=ee.updateQueue,t===null?(t=fo(),ee.updateQueue=t,t.stores=[e]):(i=t.stores,i===null?t.stores=[e]:i.push(e))}function Tm(e,t,i,s){t.value=i,t.getSnapshot=s,Mm(t)&&Rm(e)}function Dm(e,t,i){return i(function(){Mm(t)&&Rm(e)})}function Mm(e){var t=e.getSnapshot;e=e.value;try{var i=t();return!Kt(e,i)}catch{return!0}}function Rm(e){var t=er(e,2);t!==null&&Mt(t,e,2)}function eh(e){var t=vt();if(typeof e=="function"){var i=e;if(e=i(),Xs){as(!0);try{i()}finally{as(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ki,lastRenderedState:e},t}function Bm(e,t,i,s){return e.baseState=i,Wu(e,pe,typeof s=="function"?s:Ki)}function _y(e,t,i,s,r){if(mo(e))throw Error(M(485));if(e=t.action,e!==null){var n={payload:r,action:e,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(l){n.listeners.push(l)}};X.T!==null?i(!0):n.isTransition=!1,s(n),i=t.pending,i===null?(n.next=t.pending=n,Am(t,n)):(n.next=i.next,t.pending=i.next=n)}}function Am(e,t){var i=t.action,s=t.payload,r=e.state;if(t.isTransition){var n=X.T,l={};X.T=l;try{var a=i(r,s),o=X.S;o!==null&&o(l,a),hf(e,t,a)}catch(c){th(e,t,c)}finally{n!==null&&l.types!==null&&(n.types=l.types),X.T=n}}else try{n=i(r,s),hf(e,t,n)}catch(c){th(e,t,c)}}function hf(e,t,i){i!==null&&typeof i=="object"&&typeof i.then=="function"?i.then(function(s){uf(e,t,s)},function(s){return th(e,t,s)}):uf(e,t,i)}function uf(e,t,i){t.status="fulfilled",t.value=i,Nm(t),e.state=i,t=e.pending,t!==null&&(i=t.next,i===t?e.pending=null:(i=i.next,t.next=i,Am(e,i)))}function th(e,t,i){var s=e.pending;if(e.pending=null,s!==null){s=s.next;do t.status="rejected",t.reason=i,Nm(t),t=t.next;while(t!==s)}e.action=null}function Nm(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function Om(e,t){return t}function df(e,t){if(ae){var i=me.formState;if(i!==null){e:{var s=ee;if(ae){if(ye){t:{for(var r=ye,n=Jt;r.nodeType!==8;){if(!n){r=null;break t}if(r=ti(r.nextSibling),r===null){r=null;break t}}n=r.data,r=n==="F!"||n==="F"?r:null}if(r){ye=ti(r.nextSibling),s=r.data==="F!";break e}}xs(s)}s=!1}s&&(t=i[0])}}return i=vt(),i.memoizedState=i.baseState=t,s={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Om,lastRenderedState:t},i.queue=s,i=Fm.bind(null,ee,s),s.dispatch=i,s=eh(!1),n=$u.bind(null,ee,!1,s.queue),s=vt(),r={state:t,dispatch:null,action:e,pending:null},s.queue=r,i=_y.bind(null,ee,r,n,i),r.dispatch=i,s.memoizedState=e,[t,i,!1]}function ff(e){var t=Le();return Lm(t,pe,e)}function Lm(e,t,i){if(t=Wu(e,t,Om)[0],e=ia(Ki)[0],typeof t=="object"&&t!==null&&typeof t.then=="function")try{var s=ml(t)}catch(l){throw l===Zr?uo:l}else s=t;t=Le();var r=t.queue,n=r.dispatch;return i!==t.memoizedState&&(ee.flags|=2048,qr(9,{destroy:void 0},py.bind(null,r,i),null)),[s,n,e]}function py(e,t){e.action=t}function _f(e){var t=Le(),i=pe;if(i!==null)return Lm(t,i,e);Le(),t=t.memoizedState,i=Le();var s=i.queue.dispatch;return i.memoizedState=e,[t,s,!1]}function qr(e,t,i,s){return e={tag:e,create:i,deps:s,inst:t,next:null},t=ee.updateQueue,t===null&&(t=fo(),ee.updateQueue=t),i=t.lastEffect,i===null?t.lastEffect=e.next=e:(s=i.next,i.next=e,e.next=s,t.lastEffect=e),e}function zm(){return Le().memoizedState}function sa(e,t,i,s){var r=vt();ee.flags|=e,r.memoizedState=qr(1|t,{destroy:void 0},i,s===void 0?null:s)}function po(e,t,i,s){var r=Le();s=s===void 0?null:s;var n=r.memoizedState.inst;pe!==null&&s!==null&&ju(s,pe.memoizedState.deps)?r.memoizedState=qr(t,n,i,s):(ee.flags|=e,r.memoizedState=qr(1|t,n,i,s))}function pf(e,t){sa(8390656,8,e,t)}function Yu(e,t){po(2048,8,e,t)}function my(e){ee.flags|=4;var t=ee.updateQueue;if(t===null)t=fo(),ee.updateQueue=t,t.events=[e];else{var i=t.events;i===null?t.events=[e]:i.push(e)}}function jm(e){var t=Le().memoizedState;return my({ref:t,nextImpl:e}),function(){if(ce&2)throw Error(M(440));return t.impl.apply(void 0,arguments)}}function Hm(e,t){return po(4,2,e,t)}function Um(e,t){return po(4,4,e,t)}function qm(e,t){if(typeof t=="function"){e=e();var i=t(e);return function(){typeof i=="function"?i():t(null)}}if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function Pm(e,t,i){i=i!=null?i.concat([e]):null,po(4,4,qm.bind(null,t,e),i)}function Vu(){}function Km(e,t){var i=Le();t=t===void 0?null:t;var s=i.memoizedState;return t!==null&&ju(t,s[1])?s[0]:(i.memoizedState=[e,t],e)}function Wm(e,t){var i=Le();t=t===void 0?null:t;var s=i.memoizedState;if(t!==null&&ju(t,s[1]))return s[0];if(s=e(),Xs){as(!0);try{e()}finally{as(!1)}}return i.memoizedState=[s,t],s}function Iu(e,t,i){return i===void 0||Pi&1073741824&&!(le&261930)?e.memoizedState=t:(e.memoizedState=i,e=Bg(),ee.lanes|=e,ks|=e,i)}function Ym(e,t,i,s){return Kt(i,t)?i:Ur.current!==null?(e=Iu(e,i,s),Kt(e,t)||(Pe=!0),e):!(Pi&42)||Pi&1073741824&&!(le&261930)?(Pe=!0,e.memoizedState=i):(e=Bg(),ee.lanes|=e,ks|=e,t)}function Vm(e,t,i,s,r){var n=he.p;he.p=n!==0&&8>n?n:8;var l=X.T,a={};X.T=a,$u(e,!1,t,i);try{var o=r(),c=X.S;if(c!==null&&c(a,o),o!==null&&typeof o=="object"&&typeof o.then=="function"){var u=uy(o,s);Hn(e,t,u,Pt(e))}else Hn(e,t,s,Pt(e))}catch(_){Hn(e,t,{then:function(){},status:"rejected",reason:_},Pt())}finally{he.p=n,l!==null&&a.types!==null&&(l.types=a.types),X.T=l}}function gy(){}function ih(e,t,i,s){if(e.tag!==5)throw Error(M(476));var r=Im(e).queue;Vm(e,r,t,Hs,i===null?gy:function(){return Xm(e),i(s)})}function Im(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:Hs,baseState:Hs,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ki,lastRenderedState:Hs},next:null};var i={};return t.next={memoizedState:i,baseState:i,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ki,lastRenderedState:i},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function Xm(e){var t=Im(e);t.next===null&&(t=e.alternate.memoizedState),Hn(e,t.next.queue,{},Pt())}function Xu(){return dt(sl)}function $m(){return Le().memoizedState}function Gm(){return Le().memoizedState}function vy(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var i=Pt();e=ps(i);var s=ms(t,e,i);s!==null&&(Mt(s,t,i),Ln(s,t,i)),t={cache:Au()},e.payload=t;return}t=t.return}}function Sy(e,t,i){var s=Pt();i={lane:s,revertLane:0,gesture:null,action:i,hasEagerState:!1,eagerState:null,next:null},mo(e)?Zm(t,i):(i=Du(e,t,i,s),i!==null&&(Mt(i,e,s),Qm(i,t,s)))}function Fm(e,t,i){var s=Pt();Hn(e,t,i,s)}function Hn(e,t,i,s){var r={lane:s,revertLane:0,gesture:null,action:i,hasEagerState:!1,eagerState:null,next:null};if(mo(e))Zm(t,r);else{var n=e.alternate;if(e.lanes===0&&(n===null||n.lanes===0)&&(n=t.lastRenderedReducer,n!==null))try{var l=t.lastRenderedState,a=n(l,i);if(r.hasEagerState=!0,r.eagerState=a,Kt(a,l))return ho(e,t,r,0),me===null&&co(),!1}catch{}finally{}if(i=Du(e,t,r,s),i!==null)return Mt(i,e,s),Qm(i,t,s),!0}return!1}function $u(e,t,i,s){if(s={lane:2,revertLane:sd(),gesture:null,action:s,hasEagerState:!1,eagerState:null,next:null},mo(e)){if(t)throw Error(M(479))}else t=Du(e,i,s,2),t!==null&&Mt(t,e,2)}function mo(e){var t=e.alternate;return e===ee||t!==null&&t===ee}function Zm(e,t){Ar=Aa=!0;var i=e.pending;i===null?t.next=t:(t.next=i.next,i.next=t),e.pending=t}function Qm(e,t,i){if(i&4194048){var s=t.lanes;s&=e.pendingLanes,i|=s,t.lanes=i,jp(e,i)}}var el={readContext:dt,use:_o,useCallback:Me,useContext:Me,useEffect:Me,useImperativeHandle:Me,useLayoutEffect:Me,useInsertionEffect:Me,useMemo:Me,useReducer:Me,useRef:Me,useState:Me,useDebugValue:Me,useDeferredValue:Me,useTransition:Me,useSyncExternalStore:Me,useId:Me,useHostTransitionStatus:Me,useFormState:Me,useActionState:Me,useOptimistic:Me,useMemoCache:Me,useCacheRefresh:Me};el.useEffectEvent=Me;var Jm={readContext:dt,use:_o,useCallback:function(e,t){return vt().memoizedState=[e,t===void 0?null:t],e},useContext:dt,useEffect:pf,useImperativeHandle:function(e,t,i){i=i!=null?i.concat([e]):null,sa(4194308,4,qm.bind(null,t,e),i)},useLayoutEffect:function(e,t){return sa(4194308,4,e,t)},useInsertionEffect:function(e,t){sa(4,2,e,t)},useMemo:function(e,t){var i=vt();t=t===void 0?null:t;var s=e();if(Xs){as(!0);try{e()}finally{as(!1)}}return i.memoizedState=[s,t],s},useReducer:function(e,t,i){var s=vt();if(i!==void 0){var r=i(t);if(Xs){as(!0);try{i(t)}finally{as(!1)}}}else r=t;return s.memoizedState=s.baseState=r,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:r},s.queue=e,e=e.dispatch=Sy.bind(null,ee,e),[s.memoizedState,e]},useRef:function(e){var t=vt();return e={current:e},t.memoizedState=e},useState:function(e){e=eh(e);var t=e.queue,i=Fm.bind(null,ee,t);return t.dispatch=i,[e.memoizedState,i]},useDebugValue:Vu,useDeferredValue:function(e,t){var i=vt();return Iu(i,e,t)},useTransition:function(){var e=eh(!1);return e=Vm.bind(null,ee,e.queue,!0,!1),vt().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,i){var s=ee,r=vt();if(ae){if(i===void 0)throw Error(M(407));i=i()}else{if(i=t(),me===null)throw Error(M(349));le&127||km(s,t,i)}r.memoizedState=i;var n={value:i,getSnapshot:t};return r.queue=n,pf(Dm.bind(null,s,n,e),[e]),s.flags|=2048,qr(9,{destroy:void 0},Tm.bind(null,s,n,i,t),null),i},useId:function(){var e=vt(),t=me.identifierPrefix;if(ae){var i=pi,s=_i;i=(s&~(1<<32-qt(s)-1)).toString(32)+i,t="_"+t+"R_"+i,i=Na++,0<i&&(t+="H"+i.toString(32)),t+="_"}else i=dy++,t="_"+t+"r_"+i.toString(32)+"_";return e.memoizedState=t},useHostTransitionStatus:Xu,useFormState:df,useActionState:df,useOptimistic:function(e){var t=vt();t.memoizedState=t.baseState=e;var i={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=i,t=$u.bind(null,ee,!0,i),i.dispatch=t,[e,t]},useMemoCache:Ku,useCacheRefresh:function(){return vt().memoizedState=vy.bind(null,ee)},useEffectEvent:function(e){var t=vt(),i={impl:e};return t.memoizedState=i,function(){if(ce&2)throw Error(M(440));return i.impl.apply(void 0,arguments)}}},Gu={readContext:dt,use:_o,useCallback:Km,useContext:dt,useEffect:Yu,useImperativeHandle:Pm,useInsertionEffect:Hm,useLayoutEffect:Um,useMemo:Wm,useReducer:ia,useRef:zm,useState:function(){return ia(Ki)},useDebugValue:Vu,useDeferredValue:function(e,t){var i=Le();return Ym(i,pe.memoizedState,e,t)},useTransition:function(){var e=ia(Ki)[0],t=Le().memoizedState;return[typeof e=="boolean"?e:ml(e),t]},useSyncExternalStore:Em,useId:$m,useHostTransitionStatus:Xu,useFormState:ff,useActionState:ff,useOptimistic:function(e,t){var i=Le();return Bm(i,pe,e,t)},useMemoCache:Ku,useCacheRefresh:Gm};Gu.useEffectEvent=jm;var eg={readContext:dt,use:_o,useCallback:Km,useContext:dt,useEffect:Yu,useImperativeHandle:Pm,useInsertionEffect:Hm,useLayoutEffect:Um,useMemo:Wm,useReducer:Yo,useRef:zm,useState:function(){return Yo(Ki)},useDebugValue:Vu,useDeferredValue:function(e,t){var i=Le();return pe===null?Iu(i,e,t):Ym(i,pe.memoizedState,e,t)},useTransition:function(){var e=Yo(Ki)[0],t=Le().memoizedState;return[typeof e=="boolean"?e:ml(e),t]},useSyncExternalStore:Em,useId:$m,useHostTransitionStatus:Xu,useFormState:_f,useActionState:_f,useOptimistic:function(e,t){var i=Le();return pe!==null?Bm(i,pe,e,t):(i.baseState=e,[e,i.queue.dispatch])},useMemoCache:Ku,useCacheRefresh:Gm};eg.useEffectEvent=jm;function Vo(e,t,i,s){t=e.memoizedState,i=i(s,t),i=i==null?t:we({},t,i),e.memoizedState=i,e.lanes===0&&(e.updateQueue.baseState=i)}var sh={enqueueSetState:function(e,t,i){e=e._reactInternals;var s=Pt(),r=ps(s);r.payload=t,i!=null&&(r.callback=i),t=ms(e,r,s),t!==null&&(Mt(t,e,s),Ln(t,e,s))},enqueueReplaceState:function(e,t,i){e=e._reactInternals;var s=Pt(),r=ps(s);r.tag=1,r.payload=t,i!=null&&(r.callback=i),t=ms(e,r,s),t!==null&&(Mt(t,e,s),Ln(t,e,s))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var i=Pt(),s=ps(i);s.tag=2,t!=null&&(s.callback=t),t=ms(e,s,i),t!==null&&(Mt(t,e,i),Ln(t,e,i))}};function mf(e,t,i,s,r,n,l){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(s,n,l):t.prototype&&t.prototype.isPureReactComponent?!Gn(i,s)||!Gn(r,n):!0}function gf(e,t,i,s){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(i,s),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(i,s),t.state!==e&&sh.enqueueReplaceState(t,t.state,null)}function $s(e,t){var i=t;if("ref"in t){i={};for(var s in t)s!=="ref"&&(i[s]=t[s])}if(e=e.defaultProps){i===t&&(i=we({},i));for(var r in e)i[r]===void 0&&(i[r]=e[r])}return i}function tg(e){Ea(e)}function ig(e){console.error(e)}function sg(e){Ea(e)}function Oa(e,t){try{var i=e.onUncaughtError;i(t.value,{componentStack:t.stack})}catch(s){setTimeout(function(){throw s})}}function vf(e,t,i){try{var s=e.onCaughtError;s(i.value,{componentStack:i.stack,errorBoundary:t.tag===1?t.stateNode:null})}catch(r){setTimeout(function(){throw r})}}function rh(e,t,i){return i=ps(i),i.tag=3,i.payload={element:null},i.callback=function(){Oa(e,t)},i}function rg(e){return e=ps(e),e.tag=3,e}function ng(e,t,i,s){var r=i.type.getDerivedStateFromError;if(typeof r=="function"){var n=s.value;e.payload=function(){return r(n)},e.callback=function(){vf(t,i,s)}}var l=i.stateNode;l!==null&&typeof l.componentDidCatch=="function"&&(e.callback=function(){vf(t,i,s),typeof r!="function"&&(gs===null?gs=new Set([this]):gs.add(this));var a=s.stack;this.componentDidCatch(s.value,{componentStack:a!==null?a:""})})}function yy(e,t,i,s,r){if(i.flags|=32768,s!==null&&typeof s=="object"&&typeof s.then=="function"){if(t=i.alternate,t!==null&&Fr(t,i,r,!0),i=Wt.current,i!==null){switch(i.tag){case 31:case 13:return ei===null?Ua():i.alternate===null&&Be===0&&(Be=3),i.flags&=-257,i.flags|=65536,i.lanes=r,s===Ma?i.flags|=16384:(t=i.updateQueue,t===null?i.updateQueue=new Set([s]):t.add(s),ic(e,s,r)),!1;case 22:return i.flags|=65536,s===Ma?i.flags|=16384:(t=i.updateQueue,t===null?(t={transitions:null,markerInstances:null,retryQueue:new Set([s])},i.updateQueue=t):(i=t.retryQueue,i===null?t.retryQueue=new Set([s]):i.add(s)),ic(e,s,r)),!1}throw Error(M(435,i.tag))}return ic(e,s,r),Ua(),!1}if(ae)return t=Wt.current,t!==null?(!(t.flags&65536)&&(t.flags|=256),t.flags|=65536,t.lanes=r,s!==Vc&&(e=Error(M(422),{cause:s}),Zn(Qt(e,i)))):(s!==Vc&&(t=Error(M(423),{cause:s}),Zn(Qt(t,i))),e=e.current.alternate,e.flags|=65536,r&=-r,e.lanes|=r,s=Qt(s,i),r=rh(e.stateNode,s,r),Wo(e,r),Be!==4&&(Be=2)),!1;var n=Error(M(520),{cause:s});if(n=Qt(n,i),Pn===null?Pn=[n]:Pn.push(n),Be!==4&&(Be=2),t===null)return!0;s=Qt(s,i),i=t;do{switch(i.tag){case 3:return i.flags|=65536,e=r&-r,i.lanes|=e,e=rh(i.stateNode,s,e),Wo(i,e),!1;case 1:if(t=i.type,n=i.stateNode,(i.flags&128)===0&&(typeof t.getDerivedStateFromError=="function"||n!==null&&typeof n.componentDidCatch=="function"&&(gs===null||!gs.has(n))))return i.flags|=65536,r&=-r,i.lanes|=r,r=rg(r),ng(r,e,i,s),Wo(i,r),!1}i=i.return}while(i!==null);return!1}var Fu=Error(M(461)),Pe=!1;function at(e,t,i,s){t.child=e===null?Sm(t,null,i,s):Is(t,e.child,i,s)}function Sf(e,t,i,s,r){i=i.render;var n=t.ref;if("ref"in s){var l={};for(var a in s)a!=="ref"&&(l[a]=s[a])}else l=s;return Vs(t),s=Hu(e,t,i,l,n,r),a=Uu(),e!==null&&!Pe?(qu(e,t,r),Wi(e,t,r)):(ae&&a&&Ru(t),t.flags|=1,at(e,t,s,r),t.child)}function yf(e,t,i,s,r){if(e===null){var n=i.type;return typeof n=="function"&&!Mu(n)&&n.defaultProps===void 0&&i.compare===null?(t.tag=15,t.type=n,lg(e,t,n,s,r)):(e=ea(i.type,null,s,t,t.mode,r),e.ref=t.ref,e.return=t,t.child=e)}if(n=e.child,!Zu(e,r)){var l=n.memoizedProps;if(i=i.compare,i=i!==null?i:Gn,i(l,s)&&e.ref===t.ref)return Wi(e,t,r)}return t.flags|=1,e=ji(n,s),e.ref=t.ref,e.return=t,t.child=e}function lg(e,t,i,s,r){if(e!==null){var n=e.memoizedProps;if(Gn(n,s)&&e.ref===t.ref)if(Pe=!1,t.pendingProps=s=n,Zu(e,r))e.flags&131072&&(Pe=!0);else return t.lanes=e.lanes,Wi(e,t,r)}return nh(e,t,i,s,r)}function ag(e,t,i,s){var r=s.children,n=e!==null?e.memoizedState:null;if(e===null&&t.stateNode===null&&(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),s.mode==="hidden"){if(t.flags&128){if(n=n!==null?n.baseLanes|i:i,e!==null){for(s=t.child=e.child,r=0;s!==null;)r=r|s.lanes|s.childLanes,s=s.sibling;s=r&~n}else s=0,t.child=null;return bf(e,t,n,i,s)}if(i&536870912)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&ta(t,n!==null?n.cachePool:null),n!==null?cf(t,n):Qc(),wm(t);else return s=t.lanes=536870912,bf(e,t,n!==null?n.baseLanes|i:i,i,s)}else n!==null?(ta(t,n.cachePool),cf(t,n),ns(),t.memoizedState=null):(e!==null&&ta(t,null),Qc(),ns());return at(e,t,r,i),t.child}function Cn(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function bf(e,t,i,s,r){var n=Nu();return n=n===null?null:{parent:Ue._currentValue,pool:n},t.memoizedState={baseLanes:i,cachePool:n},e!==null&&ta(t,null),Qc(),wm(t),e!==null&&Fr(e,t,s,!0),t.childLanes=r,null}function ra(e,t){return t=La({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function wf(e,t,i){return Is(t,e.child,null,i),e=ra(t,t.pendingProps),e.flags|=2,Lt(t),t.memoizedState=null,e}function by(e,t,i){var s=t.pendingProps,r=(t.flags&128)!==0;if(t.flags&=-129,e===null){if(ae){if(s.mode==="hidden")return e=ra(t,s),t.lanes=536870912,Cn(null,e);if(Jc(t),(e=ye)?(e=Jg(e,Jt),e=e!==null&&e.data==="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Cs!==null?{id:_i,overflow:pi}:null,retryLane:536870912,hydrationErrors:null},i=dm(e),i.return=t,t.child=i,ht=t,ye=null)):e=null,e===null)throw xs(t);return t.lanes=536870912,null}return ra(t,s)}var n=e.memoizedState;if(n!==null){var l=n.dehydrated;if(Jc(t),r)if(t.flags&256)t.flags&=-257,t=wf(e,t,i);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(M(558));else if(Pe||Fr(e,t,i,!1),r=(i&e.childLanes)!==0,Pe||r){if(s=me,s!==null&&(l=Hp(s,i),l!==0&&l!==n.retryLane))throw n.retryLane=l,er(e,l),Mt(s,e,l),Fu;Ua(),t=wf(e,t,i)}else e=n.treeContext,ye=ti(l.nextSibling),ht=t,ae=!0,_s=null,Jt=!1,e!==null&&_m(t,e),t=ra(t,s),t.flags|=4096;return t}return e=ji(e.child,{mode:s.mode,children:s.children}),e.ref=t.ref,t.child=e,e.return=t,e}function na(e,t){var i=t.ref;if(i===null)e!==null&&e.ref!==null&&(t.flags|=4194816);else{if(typeof i!="function"&&typeof i!="object")throw Error(M(284));(e===null||e.ref!==i)&&(t.flags|=4194816)}}function nh(e,t,i,s,r){return Vs(t),i=Hu(e,t,i,s,void 0,r),s=Uu(),e!==null&&!Pe?(qu(e,t,r),Wi(e,t,r)):(ae&&s&&Ru(t),t.flags|=1,at(e,t,i,r),t.child)}function Cf(e,t,i,s,r,n){return Vs(t),t.updateQueue=null,i=xm(t,s,i,r),Cm(e),s=Uu(),e!==null&&!Pe?(qu(e,t,n),Wi(e,t,n)):(ae&&s&&Ru(t),t.flags|=1,at(e,t,i,n),t.child)}function xf(e,t,i,s,r){if(Vs(t),t.stateNode===null){var n=br,l=i.contextType;typeof l=="object"&&l!==null&&(n=dt(l)),n=new i(s,n),t.memoizedState=n.state!==null&&n.state!==void 0?n.state:null,n.updater=sh,t.stateNode=n,n._reactInternals=t,n=t.stateNode,n.props=s,n.state=t.memoizedState,n.refs={},Lu(t),l=i.contextType,n.context=typeof l=="object"&&l!==null?dt(l):br,n.state=t.memoizedState,l=i.getDerivedStateFromProps,typeof l=="function"&&(Vo(t,i,l,s),n.state=t.memoizedState),typeof i.getDerivedStateFromProps=="function"||typeof n.getSnapshotBeforeUpdate=="function"||typeof n.UNSAFE_componentWillMount!="function"&&typeof n.componentWillMount!="function"||(l=n.state,typeof n.componentWillMount=="function"&&n.componentWillMount(),typeof n.UNSAFE_componentWillMount=="function"&&n.UNSAFE_componentWillMount(),l!==n.state&&sh.enqueueReplaceState(n,n.state,null),jn(t,s,n,r),zn(),n.state=t.memoizedState),typeof n.componentDidMount=="function"&&(t.flags|=4194308),s=!0}else if(e===null){n=t.stateNode;var a=t.memoizedProps,o=$s(i,a);n.props=o;var c=n.context,u=i.contextType;l=br,typeof u=="object"&&u!==null&&(l=dt(u));var _=i.getDerivedStateFromProps;u=typeof _=="function"||typeof n.getSnapshotBeforeUpdate=="function",a=t.pendingProps!==a,u||typeof n.UNSAFE_componentWillReceiveProps!="function"&&typeof n.componentWillReceiveProps!="function"||(a||c!==l)&&gf(t,n,s,l),ts=!1;var f=t.memoizedState;n.state=f,jn(t,s,n,r),zn(),c=t.memoizedState,a||f!==c||ts?(typeof _=="function"&&(Vo(t,i,_,s),c=t.memoizedState),(o=ts||mf(t,i,o,s,f,c,l))?(u||typeof n.UNSAFE_componentWillMount!="function"&&typeof n.componentWillMount!="function"||(typeof n.componentWillMount=="function"&&n.componentWillMount(),typeof n.UNSAFE_componentWillMount=="function"&&n.UNSAFE_componentWillMount()),typeof n.componentDidMount=="function"&&(t.flags|=4194308)):(typeof n.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=s,t.memoizedState=c),n.props=s,n.state=c,n.context=l,s=o):(typeof n.componentDidMount=="function"&&(t.flags|=4194308),s=!1)}else{n=t.stateNode,Fc(e,t),l=t.memoizedProps,u=$s(i,l),n.props=u,_=t.pendingProps,f=n.context,c=i.contextType,o=br,typeof c=="object"&&c!==null&&(o=dt(c)),a=i.getDerivedStateFromProps,(c=typeof a=="function"||typeof n.getSnapshotBeforeUpdate=="function")||typeof n.UNSAFE_componentWillReceiveProps!="function"&&typeof n.componentWillReceiveProps!="function"||(l!==_||f!==o)&&gf(t,n,s,o),ts=!1,f=t.memoizedState,n.state=f,jn(t,s,n,r),zn();var d=t.memoizedState;l!==_||f!==d||ts||e!==null&&e.dependencies!==null&&Da(e.dependencies)?(typeof a=="function"&&(Vo(t,i,a,s),d=t.memoizedState),(u=ts||mf(t,i,u,s,f,d,o)||e!==null&&e.dependencies!==null&&Da(e.dependencies))?(c||typeof n.UNSAFE_componentWillUpdate!="function"&&typeof n.componentWillUpdate!="function"||(typeof n.componentWillUpdate=="function"&&n.componentWillUpdate(s,d,o),typeof n.UNSAFE_componentWillUpdate=="function"&&n.UNSAFE_componentWillUpdate(s,d,o)),typeof n.componentDidUpdate=="function"&&(t.flags|=4),typeof n.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof n.componentDidUpdate!="function"||l===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof n.getSnapshotBeforeUpdate!="function"||l===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),t.memoizedProps=s,t.memoizedState=d),n.props=s,n.state=d,n.context=o,s=u):(typeof n.componentDidUpdate!="function"||l===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof n.getSnapshotBeforeUpdate!="function"||l===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),s=!1)}return n=s,na(e,t),s=(t.flags&128)!==0,n||s?(n=t.stateNode,i=s&&typeof i.getDerivedStateFromError!="function"?null:n.render(),t.flags|=1,e!==null&&s?(t.child=Is(t,e.child,null,r),t.child=Is(t,null,i,r)):at(e,t,i,r),t.memoizedState=n.state,e=t.child):e=Wi(e,t,r),e}function Ef(e,t,i,s){return Ys(),t.flags|=256,at(e,t,i,s),t.child}var Io={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Xo(e){return{baseLanes:e,cachePool:mm()}}function $o(e,t,i){return e=e!==null?e.childLanes&~i:0,t&&(e|=jt),e}function og(e,t,i){var s=t.pendingProps,r=!1,n=(t.flags&128)!==0,l;if((l=n)||(l=e!==null&&e.memoizedState===null?!1:(Oe.current&2)!==0),l&&(r=!0,t.flags&=-129),l=(t.flags&32)!==0,t.flags&=-33,e===null){if(ae){if(r?rs(t):ns(),(e=ye)?(e=Jg(e,Jt),e=e!==null&&e.data!=="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Cs!==null?{id:_i,overflow:pi}:null,retryLane:536870912,hydrationErrors:null},i=dm(e),i.return=t,t.child=i,ht=t,ye=null)):e=null,e===null)throw xs(t);return Sh(e)?t.lanes=32:t.lanes=536870912,null}var a=s.children;return s=s.fallback,r?(ns(),r=t.mode,a=La({mode:"hidden",children:a},r),s=Us(s,r,i,null),a.return=t,s.return=t,a.sibling=s,t.child=a,s=t.child,s.memoizedState=Xo(i),s.childLanes=$o(e,l,i),t.memoizedState=Io,Cn(null,s)):(rs(t),lh(t,a))}var o=e.memoizedState;if(o!==null&&(a=o.dehydrated,a!==null)){if(n)t.flags&256?(rs(t),t.flags&=-257,t=Go(e,t,i)):t.memoizedState!==null?(ns(),t.child=e.child,t.flags|=128,t=null):(ns(),a=s.fallback,r=t.mode,s=La({mode:"visible",children:s.children},r),a=Us(a,r,i,null),a.flags|=2,s.return=t,a.return=t,s.sibling=a,t.child=s,Is(t,e.child,null,i),s=t.child,s.memoizedState=Xo(i),s.childLanes=$o(e,l,i),t.memoizedState=Io,t=Cn(null,s));else if(rs(t),Sh(a)){if(l=a.nextSibling&&a.nextSibling.dataset,l)var c=l.dgst;l=c,s=Error(M(419)),s.stack="",s.digest=l,Zn({value:s,source:null,stack:null}),t=Go(e,t,i)}else if(Pe||Fr(e,t,i,!1),l=(i&e.childLanes)!==0,Pe||l){if(l=me,l!==null&&(s=Hp(l,i),s!==0&&s!==o.retryLane))throw o.retryLane=s,er(e,s),Mt(l,e,s),Fu;vh(a)||Ua(),t=Go(e,t,i)}else vh(a)?(t.flags|=192,t.child=e.child,t=null):(e=o.treeContext,ye=ti(a.nextSibling),ht=t,ae=!0,_s=null,Jt=!1,e!==null&&_m(t,e),t=lh(t,s.children),t.flags|=4096);return t}return r?(ns(),a=s.fallback,r=t.mode,o=e.child,c=o.sibling,s=ji(o,{mode:"hidden",children:s.children}),s.subtreeFlags=o.subtreeFlags&65011712,c!==null?a=ji(c,a):(a=Us(a,r,i,null),a.flags|=2),a.return=t,s.return=t,s.sibling=a,t.child=s,Cn(null,s),s=t.child,a=e.child.memoizedState,a===null?a=Xo(i):(r=a.cachePool,r!==null?(o=Ue._currentValue,r=r.parent!==o?{parent:o,pool:o}:r):r=mm(),a={baseLanes:a.baseLanes|i,cachePool:r}),s.memoizedState=a,s.childLanes=$o(e,l,i),t.memoizedState=Io,Cn(e.child,s)):(rs(t),i=e.child,e=i.sibling,i=ji(i,{mode:"visible",children:s.children}),i.return=t,i.sibling=null,e!==null&&(l=t.deletions,l===null?(t.deletions=[e],t.flags|=16):l.push(e)),t.child=i,t.memoizedState=null,i)}function lh(e,t){return t=La({mode:"visible",children:t},e.mode),t.return=e,e.child=t}function La(e,t){return e=zt(22,e,null,t),e.lanes=0,e}function Go(e,t,i){return Is(t,e.child,null,i),e=lh(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function kf(e,t,i){e.lanes|=t;var s=e.alternate;s!==null&&(s.lanes|=t),Xc(e.return,t,i)}function Fo(e,t,i,s,r,n){var l=e.memoizedState;l===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:s,tail:i,tailMode:r,treeForkCount:n}:(l.isBackwards=t,l.rendering=null,l.renderingStartTime=0,l.last=s,l.tail=i,l.tailMode=r,l.treeForkCount=n)}function cg(e,t,i){var s=t.pendingProps,r=s.revealOrder,n=s.tail;s=s.children;var l=Oe.current,a=(l&2)!==0;if(a?(l=l&1|2,t.flags|=128):l&=1,ge(Oe,l),at(e,t,s,i),s=ae?Fn:0,!a&&e!==null&&e.flags&128)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&kf(e,i,t);else if(e.tag===19)kf(e,i,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;e.sibling===null;){if(e.return===null||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}switch(r){case"forwards":for(i=t.child,r=null;i!==null;)e=i.alternate,e!==null&&Ba(e)===null&&(r=i),i=i.sibling;i=r,i===null?(r=t.child,t.child=null):(r=i.sibling,i.sibling=null),Fo(t,!1,r,i,n,s);break;case"backwards":case"unstable_legacy-backwards":for(i=null,r=t.child,t.child=null;r!==null;){if(e=r.alternate,e!==null&&Ba(e)===null){t.child=r;break}e=r.sibling,r.sibling=i,i=r,r=e}Fo(t,!0,i,null,n,s);break;case"together":Fo(t,!1,null,null,void 0,s);break;default:t.memoizedState=null}return t.child}function Wi(e,t,i){if(e!==null&&(t.dependencies=e.dependencies),ks|=t.lanes,!(i&t.childLanes))if(e!==null){if(Fr(e,t,i,!1),(i&t.childLanes)===0)return null}else return null;if(e!==null&&t.child!==e.child)throw Error(M(153));if(t.child!==null){for(e=t.child,i=ji(e,e.pendingProps),t.child=i,i.return=t;e.sibling!==null;)e=e.sibling,i=i.sibling=ji(e,e.pendingProps),i.return=t;i.sibling=null}return t.child}function Zu(e,t){return e.lanes&t?!0:(e=e.dependencies,!!(e!==null&&Da(e)))}function wy(e,t,i){switch(t.tag){case 3:ba(t,t.stateNode.containerInfo),ss(t,Ue,e.memoizedState.cache),Ys();break;case 27:case 5:Oc(t);break;case 4:ba(t,t.stateNode.containerInfo);break;case 10:ss(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,Jc(t),null;break;case 13:var s=t.memoizedState;if(s!==null)return s.dehydrated!==null?(rs(t),t.flags|=128,null):i&t.child.childLanes?og(e,t,i):(rs(t),e=Wi(e,t,i),e!==null?e.sibling:null);rs(t);break;case 19:var r=(e.flags&128)!==0;if(s=(i&t.childLanes)!==0,s||(Fr(e,t,i,!1),s=(i&t.childLanes)!==0),r){if(s)return cg(e,t,i);t.flags|=128}if(r=t.memoizedState,r!==null&&(r.rendering=null,r.tail=null,r.lastEffect=null),ge(Oe,Oe.current),s)break;return null;case 22:return t.lanes=0,ag(e,t,i,t.pendingProps);case 24:ss(t,Ue,e.memoizedState.cache)}return Wi(e,t,i)}function hg(e,t,i){if(e!==null)if(e.memoizedProps!==t.pendingProps)Pe=!0;else{if(!Zu(e,i)&&!(t.flags&128))return Pe=!1,wy(e,t,i);Pe=!!(e.flags&131072)}else Pe=!1,ae&&t.flags&1048576&&fm(t,Fn,t.index);switch(t.lanes=0,t.tag){case 16:e:{var s=t.pendingProps;if(e=Ns(t.elementType),t.type=e,typeof e=="function")Mu(e)?(s=$s(e,s),t.tag=1,t=xf(null,t,e,s,i)):(t.tag=0,t=nh(null,t,e,s,i));else{if(e!=null){var r=e.$$typeof;if(r===pu){t.tag=11,t=Sf(null,t,e,s,i);break e}else if(r===mu){t.tag=14,t=yf(null,t,e,s,i);break e}}throw t=Ac(e)||e,Error(M(306,t,""))}}return t;case 0:return nh(e,t,t.type,t.pendingProps,i);case 1:return s=t.type,r=$s(s,t.pendingProps),xf(e,t,s,r,i);case 3:e:{if(ba(t,t.stateNode.containerInfo),e===null)throw Error(M(387));s=t.pendingProps;var n=t.memoizedState;r=n.element,Fc(e,t),jn(t,s,null,i);var l=t.memoizedState;if(s=l.cache,ss(t,Ue,s),s!==n.cache&&$c(t,[Ue],i,!0),zn(),s=l.element,n.isDehydrated)if(n={element:s,isDehydrated:!1,cache:l.cache},t.updateQueue.baseState=n,t.memoizedState=n,t.flags&256){t=Ef(e,t,s,i);break e}else if(s!==r){r=Qt(Error(M(424)),t),Zn(r),t=Ef(e,t,s,i);break e}else{switch(e=t.stateNode.containerInfo,e.nodeType){case 9:e=e.body;break;default:e=e.nodeName==="HTML"?e.ownerDocument.body:e}for(ye=ti(e.firstChild),ht=t,ae=!0,_s=null,Jt=!0,i=Sm(t,null,s,i),t.child=i;i;)i.flags=i.flags&-3|4096,i=i.sibling}else{if(Ys(),s===r){t=Wi(e,t,i);break e}at(e,t,s,i)}t=t.child}return t;case 26:return na(e,t),e===null?(i=If(t.type,null,t.pendingProps,null))?t.memoizedState=i:ae||(i=t.type,e=t.pendingProps,s=Wa(fs.current).createElement(i),s[ct]=t,s[Rt]=e,ft(s,i,e),tt(s),t.stateNode=s):t.memoizedState=If(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return Oc(t),e===null&&ae&&(s=t.stateNode=ev(t.type,t.pendingProps,fs.current),ht=t,Jt=!0,r=ye,Ds(t.type)?(yh=r,ye=ti(s.firstChild)):ye=r),at(e,t,t.pendingProps.children,i),na(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&ae&&((r=s=ye)&&(s=Qy(s,t.type,t.pendingProps,Jt),s!==null?(t.stateNode=s,ht=t,ye=ti(s.firstChild),Jt=!1,r=!0):r=!1),r||xs(t)),Oc(t),r=t.type,n=t.pendingProps,l=e!==null?e.memoizedProps:null,s=n.children,mh(r,n)?s=null:l!==null&&mh(r,l)&&(t.flags|=32),t.memoizedState!==null&&(r=Hu(e,t,fy,null,null,i),sl._currentValue=r),na(e,t),at(e,t,s,i),t.child;case 6:return e===null&&ae&&((e=i=ye)&&(i=Jy(i,t.pendingProps,Jt),i!==null?(t.stateNode=i,ht=t,ye=null,e=!0):e=!1),e||xs(t)),null;case 13:return og(e,t,i);case 4:return ba(t,t.stateNode.containerInfo),s=t.pendingProps,e===null?t.child=Is(t,null,s,i):at(e,t,s,i),t.child;case 11:return Sf(e,t,t.type,t.pendingProps,i);case 7:return at(e,t,t.pendingProps,i),t.child;case 8:return at(e,t,t.pendingProps.children,i),t.child;case 12:return at(e,t,t.pendingProps.children,i),t.child;case 10:return s=t.pendingProps,ss(t,t.type,s.value),at(e,t,s.children,i),t.child;case 9:return r=t.type._context,s=t.pendingProps.children,Vs(t),r=dt(r),s=s(r),t.flags|=1,at(e,t,s,i),t.child;case 14:return yf(e,t,t.type,t.pendingProps,i);case 15:return lg(e,t,t.type,t.pendingProps,i);case 19:return cg(e,t,i);case 31:return by(e,t,i);case 22:return ag(e,t,i,t.pendingProps);case 24:return Vs(t),s=dt(Ue),e===null?(r=Nu(),r===null&&(r=me,n=Au(),r.pooledCache=n,n.refCount++,n!==null&&(r.pooledCacheLanes|=i),r=n),t.memoizedState={parent:s,cache:r},Lu(t),ss(t,Ue,r)):(e.lanes&i&&(Fc(e,t),jn(t,null,null,i),zn()),r=e.memoizedState,n=t.memoizedState,r.parent!==s?(r={parent:s,cache:s},t.memoizedState=r,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=r),ss(t,Ue,s)):(s=n.cache,ss(t,Ue,s),s!==r.cache&&$c(t,[Ue],i,!0))),at(e,t,t.pendingProps.children,i),t.child;case 29:throw t.pendingProps}throw Error(M(156,t.tag))}function ki(e){e.flags|=4}function Zo(e,t,i,s,r){if((t=(e.mode&32)!==0)&&(t=!1),t){if(e.flags|=16777216,(r&335544128)===r)if(e.stateNode.complete)e.flags|=8192;else if(Og())e.flags|=8192;else throw Ps=Ma,Ou}else e.flags&=-16777217}function Tf(e,t){if(t.type!=="stylesheet"||t.state.loading&4)e.flags&=-16777217;else if(e.flags|=16777216,!sv(t))if(Og())e.flags|=8192;else throw Ps=Ma,Ou}function zl(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag!==22?Lp():536870912,e.lanes|=t,Pr|=t)}function hn(e,t){if(!ae)switch(e.tailMode){case"hidden":t=e.tail;for(var i=null;t!==null;)t.alternate!==null&&(i=t),t=t.sibling;i===null?e.tail=null:i.sibling=null;break;case"collapsed":i=e.tail;for(var s=null;i!==null;)i.alternate!==null&&(s=i),i=i.sibling;s===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:s.sibling=null}}function ve(e){var t=e.alternate!==null&&e.alternate.child===e.child,i=0,s=0;if(t)for(var r=e.child;r!==null;)i|=r.lanes|r.childLanes,s|=r.subtreeFlags&65011712,s|=r.flags&65011712,r.return=e,r=r.sibling;else for(r=e.child;r!==null;)i|=r.lanes|r.childLanes,s|=r.subtreeFlags,s|=r.flags,r.return=e,r=r.sibling;return e.subtreeFlags|=s,e.childLanes=i,t}function Cy(e,t,i){var s=t.pendingProps;switch(Bu(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return ve(t),null;case 1:return ve(t),null;case 3:return i=t.stateNode,s=null,e!==null&&(s=e.memoizedState.cache),t.memoizedState.cache!==s&&(t.flags|=2048),Hi(Ue),Lr(),i.pendingContext&&(i.context=i.pendingContext,i.pendingContext=null),(e===null||e.child===null)&&(nr(t)?ki(t):e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,Ko())),ve(t),null;case 26:var r=t.type,n=t.memoizedState;return e===null?(ki(t),n!==null?(ve(t),Tf(t,n)):(ve(t),Zo(t,r,null,s,i))):n?n!==e.memoizedState?(ki(t),ve(t),Tf(t,n)):(ve(t),t.flags&=-16777217):(e=e.memoizedProps,e!==s&&ki(t),ve(t),Zo(t,r,e,s,i)),null;case 27:if(wa(t),i=fs.current,r=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==s&&ki(t);else{if(!s){if(t.stateNode===null)throw Error(M(166));return ve(t),null}e=vi.current,nr(t)?tf(t):(e=ev(r,s,i),t.stateNode=e,ki(t))}return ve(t),null;case 5:if(wa(t),r=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==s&&ki(t);else{if(!s){if(t.stateNode===null)throw Error(M(166));return ve(t),null}if(n=vi.current,nr(t))tf(t);else{var l=Wa(fs.current);switch(n){case 1:n=l.createElementNS("http://www.w3.org/2000/svg",r);break;case 2:n=l.createElementNS("http://www.w3.org/1998/Math/MathML",r);break;default:switch(r){case"svg":n=l.createElementNS("http://www.w3.org/2000/svg",r);break;case"math":n=l.createElementNS("http://www.w3.org/1998/Math/MathML",r);break;case"script":n=l.createElement("div"),n.innerHTML="<script><\/script>",n=n.removeChild(n.firstChild);break;case"select":n=typeof s.is=="string"?l.createElement("select",{is:s.is}):l.createElement("select"),s.multiple?n.multiple=!0:s.size&&(n.size=s.size);break;default:n=typeof s.is=="string"?l.createElement(r,{is:s.is}):l.createElement(r)}}n[ct]=t,n[Rt]=s;e:for(l=t.child;l!==null;){if(l.tag===5||l.tag===6)n.appendChild(l.stateNode);else if(l.tag!==4&&l.tag!==27&&l.child!==null){l.child.return=l,l=l.child;continue}if(l===t)break e;for(;l.sibling===null;){if(l.return===null||l.return===t)break e;l=l.return}l.sibling.return=l.return,l=l.sibling}t.stateNode=n;e:switch(ft(n,r,s),r){case"button":case"input":case"select":case"textarea":s=!!s.autoFocus;break e;case"img":s=!0;break e;default:s=!1}s&&ki(t)}}return ve(t),Zo(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,i),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==s&&ki(t);else{if(typeof s!="string"&&t.stateNode===null)throw Error(M(166));if(e=fs.current,nr(t)){if(e=t.stateNode,i=t.memoizedProps,s=null,r=ht,r!==null)switch(r.tag){case 27:case 5:s=r.memoizedProps}e[ct]=t,e=!!(e.nodeValue===i||s!==null&&s.suppressHydrationWarning===!0||Fg(e.nodeValue,i)),e||xs(t,!0)}else e=Wa(e).createTextNode(s),e[ct]=t,t.stateNode=e}return ve(t),null;case 31:if(i=t.memoizedState,e===null||e.memoizedState!==null){if(s=nr(t),i!==null){if(e===null){if(!s)throw Error(M(318));if(e=t.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(M(557));e[ct]=t}else Ys(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;ve(t),e=!1}else i=Ko(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=i),e=!0;if(!e)return t.flags&256?(Lt(t),t):(Lt(t),null);if(t.flags&128)throw Error(M(558))}return ve(t),null;case 13:if(s=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(r=nr(t),s!==null&&s.dehydrated!==null){if(e===null){if(!r)throw Error(M(318));if(r=t.memoizedState,r=r!==null?r.dehydrated:null,!r)throw Error(M(317));r[ct]=t}else Ys(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;ve(t),r=!1}else r=Ko(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=r),r=!0;if(!r)return t.flags&256?(Lt(t),t):(Lt(t),null)}return Lt(t),t.flags&128?(t.lanes=i,t):(i=s!==null,e=e!==null&&e.memoizedState!==null,i&&(s=t.child,r=null,s.alternate!==null&&s.alternate.memoizedState!==null&&s.alternate.memoizedState.cachePool!==null&&(r=s.alternate.memoizedState.cachePool.pool),n=null,s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(n=s.memoizedState.cachePool.pool),n!==r&&(s.flags|=2048)),i!==e&&i&&(t.child.flags|=8192),zl(t,t.updateQueue),ve(t),null);case 4:return Lr(),e===null&&rd(t.stateNode.containerInfo),ve(t),null;case 10:return Hi(t.type),ve(t),null;case 19:if(it(Oe),s=t.memoizedState,s===null)return ve(t),null;if(r=(t.flags&128)!==0,n=s.rendering,n===null)if(r)hn(s,!1);else{if(Be!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(n=Ba(e),n!==null){for(t.flags|=128,hn(s,!1),e=n.updateQueue,t.updateQueue=e,zl(t,e),t.subtreeFlags=0,e=i,i=t.child;i!==null;)um(i,e),i=i.sibling;return ge(Oe,Oe.current&1|2),ae&&Bi(t,s.treeForkCount),t.child}e=e.sibling}s.tail!==null&&Ht()>ja&&(t.flags|=128,r=!0,hn(s,!1),t.lanes=4194304)}else{if(!r)if(e=Ba(n),e!==null){if(t.flags|=128,r=!0,e=e.updateQueue,t.updateQueue=e,zl(t,e),hn(s,!0),s.tail===null&&s.tailMode==="hidden"&&!n.alternate&&!ae)return ve(t),null}else 2*Ht()-s.renderingStartTime>ja&&i!==536870912&&(t.flags|=128,r=!0,hn(s,!1),t.lanes=4194304);s.isBackwards?(n.sibling=t.child,t.child=n):(e=s.last,e!==null?e.sibling=n:t.child=n,s.last=n)}return s.tail!==null?(e=s.tail,s.rendering=e,s.tail=e.sibling,s.renderingStartTime=Ht(),e.sibling=null,i=Oe.current,ge(Oe,r?i&1|2:i&1),ae&&Bi(t,s.treeForkCount),e):(ve(t),null);case 22:case 23:return Lt(t),zu(),s=t.memoizedState!==null,e!==null?e.memoizedState!==null!==s&&(t.flags|=8192):s&&(t.flags|=8192),s?i&536870912&&!(t.flags&128)&&(ve(t),t.subtreeFlags&6&&(t.flags|=8192)):ve(t),i=t.updateQueue,i!==null&&zl(t,i.retryQueue),i=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(i=e.memoizedState.cachePool.pool),s=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(s=t.memoizedState.cachePool.pool),s!==i&&(t.flags|=2048),e!==null&&it(qs),null;case 24:return i=null,e!==null&&(i=e.memoizedState.cache),t.memoizedState.cache!==i&&(t.flags|=2048),Hi(Ue),ve(t),null;case 25:return null;case 30:return null}throw Error(M(156,t.tag))}function xy(e,t){switch(Bu(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Hi(Ue),Lr(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return wa(t),null;case 31:if(t.memoizedState!==null){if(Lt(t),t.alternate===null)throw Error(M(340));Ys()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(Lt(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(M(340));Ys()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return it(Oe),null;case 4:return Lr(),null;case 10:return Hi(t.type),null;case 22:case 23:return Lt(t),zu(),e!==null&&it(qs),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return Hi(Ue),null;case 25:return null;default:return null}}function ug(e,t){switch(Bu(t),t.tag){case 3:Hi(Ue),Lr();break;case 26:case 27:case 5:wa(t);break;case 4:Lr();break;case 31:t.memoizedState!==null&&Lt(t);break;case 13:Lt(t);break;case 19:it(Oe);break;case 10:Hi(t.type);break;case 22:case 23:Lt(t),zu(),e!==null&&it(qs);break;case 24:Hi(Ue)}}function gl(e,t){try{var i=t.updateQueue,s=i!==null?i.lastEffect:null;if(s!==null){var r=s.next;i=r;do{if((i.tag&e)===e){s=void 0;var n=i.create,l=i.inst;s=n(),l.destroy=s}i=i.next}while(i!==r)}}catch(a){de(t,t.return,a)}}function Es(e,t,i){try{var s=t.updateQueue,r=s!==null?s.lastEffect:null;if(r!==null){var n=r.next;s=n;do{if((s.tag&e)===e){var l=s.inst,a=l.destroy;if(a!==void 0){l.destroy=void 0,r=t;var o=i,c=a;try{c()}catch(u){de(r,o,u)}}}s=s.next}while(s!==n)}}catch(u){de(t,t.return,u)}}function dg(e){var t=e.updateQueue;if(t!==null){var i=e.stateNode;try{bm(t,i)}catch(s){de(e,e.return,s)}}}function fg(e,t,i){i.props=$s(e.type,e.memoizedProps),i.state=e.memoizedState;try{i.componentWillUnmount()}catch(s){de(e,t,s)}}function Un(e,t){try{var i=e.ref;if(i!==null){switch(e.tag){case 26:case 27:case 5:var s=e.stateNode;break;case 30:s=e.stateNode;break;default:s=e.stateNode}typeof i=="function"?e.refCleanup=i(s):i.current=s}}catch(r){de(e,t,r)}}function mi(e,t){var i=e.ref,s=e.refCleanup;if(i!==null)if(typeof s=="function")try{s()}catch(r){de(e,t,r)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof i=="function")try{i(null)}catch(r){de(e,t,r)}else i.current=null}function _g(e){var t=e.type,i=e.memoizedProps,s=e.stateNode;try{e:switch(t){case"button":case"input":case"select":case"textarea":i.autoFocus&&s.focus();break e;case"img":i.src?s.src=i.src:i.srcSet&&(s.srcset=i.srcSet)}}catch(r){de(e,e.return,r)}}function Qo(e,t,i){try{var s=e.stateNode;Iy(s,e.type,i,t),s[Rt]=t}catch(r){de(e,e.return,r)}}function pg(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&Ds(e.type)||e.tag===4}function Jo(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||pg(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.tag===27&&Ds(e.type)||e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function ah(e,t,i){var s=e.tag;if(s===5||s===6)e=e.stateNode,t?(i.nodeType===9?i.body:i.nodeName==="HTML"?i.ownerDocument.body:i).insertBefore(e,t):(t=i.nodeType===9?i.body:i.nodeName==="HTML"?i.ownerDocument.body:i,t.appendChild(e),i=i._reactRootContainer,i!=null||t.onclick!==null||(t.onclick=Oi));else if(s!==4&&(s===27&&Ds(e.type)&&(i=e.stateNode,t=null),e=e.child,e!==null))for(ah(e,t,i),e=e.sibling;e!==null;)ah(e,t,i),e=e.sibling}function za(e,t,i){var s=e.tag;if(s===5||s===6)e=e.stateNode,t?i.insertBefore(e,t):i.appendChild(e);else if(s!==4&&(s===27&&Ds(e.type)&&(i=e.stateNode),e=e.child,e!==null))for(za(e,t,i),e=e.sibling;e!==null;)za(e,t,i),e=e.sibling}function mg(e){var t=e.stateNode,i=e.memoizedProps;try{for(var s=e.type,r=t.attributes;r.length;)t.removeAttributeNode(r[0]);ft(t,s,i),t[ct]=e,t[Rt]=i}catch(n){de(e,e.return,n)}}var Ai=!1,He=!1,ec=!1,Df=typeof WeakSet=="function"?WeakSet:Set,Ze=null;function Ey(e,t){if(e=e.containerInfo,_h=Xa,e=sm(e),ku(e)){if("selectionStart"in e)var i={start:e.selectionStart,end:e.selectionEnd};else e:{i=(i=e.ownerDocument)&&i.defaultView||window;var s=i.getSelection&&i.getSelection();if(s&&s.rangeCount!==0){i=s.anchorNode;var r=s.anchorOffset,n=s.focusNode;s=s.focusOffset;try{i.nodeType,n.nodeType}catch{i=null;break e}var l=0,a=-1,o=-1,c=0,u=0,_=e,f=null;t:for(;;){for(var d;_!==i||r!==0&&_.nodeType!==3||(a=l+r),_!==n||s!==0&&_.nodeType!==3||(o=l+s),_.nodeType===3&&(l+=_.nodeValue.length),(d=_.firstChild)!==null;)f=_,_=d;for(;;){if(_===e)break t;if(f===i&&++c===r&&(a=l),f===n&&++u===s&&(o=l),(d=_.nextSibling)!==null)break;_=f,f=_.parentNode}_=d}i=a===-1||o===-1?null:{start:a,end:o}}else i=null}i=i||{start:0,end:0}}else i=null;for(ph={focusedElem:e,selectionRange:i},Xa=!1,Ze=t;Ze!==null;)if(t=Ze,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,Ze=e;else for(;Ze!==null;){switch(t=Ze,n=t.alternate,e=t.flags,t.tag){case 0:if(e&4&&(e=t.updateQueue,e=e!==null?e.events:null,e!==null))for(i=0;i<e.length;i++)r=e[i],r.ref.impl=r.nextImpl;break;case 11:case 15:break;case 1:if(e&1024&&n!==null){e=void 0,i=t,r=n.memoizedProps,n=n.memoizedState,s=i.stateNode;try{var g=$s(i.type,r);e=s.getSnapshotBeforeUpdate(g,n),s.__reactInternalSnapshotBeforeUpdate=e}catch(y){de(i,i.return,y)}}break;case 3:if(e&1024){if(e=t.stateNode.containerInfo,i=e.nodeType,i===9)gh(e);else if(i===1)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":gh(e);break;default:e.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if(e&1024)throw Error(M(163))}if(e=t.sibling,e!==null){e.return=t.return,Ze=e;break}Ze=t.return}}function gg(e,t,i){var s=i.flags;switch(i.tag){case 0:case 11:case 15:Di(e,i),s&4&&gl(5,i);break;case 1:if(Di(e,i),s&4)if(e=i.stateNode,t===null)try{e.componentDidMount()}catch(l){de(i,i.return,l)}else{var r=$s(i.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(r,t,e.__reactInternalSnapshotBeforeUpdate)}catch(l){de(i,i.return,l)}}s&64&&dg(i),s&512&&Un(i,i.return);break;case 3:if(Di(e,i),s&64&&(e=i.updateQueue,e!==null)){if(t=null,i.child!==null)switch(i.child.tag){case 27:case 5:t=i.child.stateNode;break;case 1:t=i.child.stateNode}try{bm(e,t)}catch(l){de(i,i.return,l)}}break;case 27:t===null&&s&4&&mg(i);case 26:case 5:Di(e,i),t===null&&s&4&&_g(i),s&512&&Un(i,i.return);break;case 12:Di(e,i);break;case 31:Di(e,i),s&4&&yg(e,i);break;case 13:Di(e,i),s&4&&bg(e,i),s&64&&(e=i.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(i=Oy.bind(null,i),e1(e,i))));break;case 22:if(s=i.memoizedState!==null||Ai,!s){t=t!==null&&t.memoizedState!==null||He,r=Ai;var n=He;Ai=s,(He=t)&&!n?Ri(e,i,(i.subtreeFlags&8772)!==0):Di(e,i),Ai=r,He=n}break;case 30:break;default:Di(e,i)}}function vg(e){var t=e.alternate;t!==null&&(e.alternate=null,vg(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&yu(t)),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}var xe=null,Tt=!1;function Ti(e,t,i){for(i=i.child;i!==null;)Sg(e,t,i),i=i.sibling}function Sg(e,t,i){if(Ut&&typeof Ut.onCommitFiberUnmount=="function")try{Ut.onCommitFiberUnmount(hl,i)}catch{}switch(i.tag){case 26:He||mi(i,t),Ti(e,t,i),i.memoizedState?i.memoizedState.count--:i.stateNode&&(i=i.stateNode,i.parentNode.removeChild(i));break;case 27:He||mi(i,t);var s=xe,r=Tt;Ds(i.type)&&(xe=i.stateNode,Tt=!1),Ti(e,t,i),Wn(i.stateNode),xe=s,Tt=r;break;case 5:He||mi(i,t);case 6:if(s=xe,r=Tt,xe=null,Ti(e,t,i),xe=s,Tt=r,xe!==null)if(Tt)try{(xe.nodeType===9?xe.body:xe.nodeName==="HTML"?xe.ownerDocument.body:xe).removeChild(i.stateNode)}catch(n){de(i,t,n)}else try{xe.removeChild(i.stateNode)}catch(n){de(i,t,n)}break;case 18:xe!==null&&(Tt?(e=xe,Pf(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,i.stateNode),Vr(e)):Pf(xe,i.stateNode));break;case 4:s=xe,r=Tt,xe=i.stateNode.containerInfo,Tt=!0,Ti(e,t,i),xe=s,Tt=r;break;case 0:case 11:case 14:case 15:Es(2,i,t),He||Es(4,i,t),Ti(e,t,i);break;case 1:He||(mi(i,t),s=i.stateNode,typeof s.componentWillUnmount=="function"&&fg(i,t,s)),Ti(e,t,i);break;case 21:Ti(e,t,i);break;case 22:He=(s=He)||i.memoizedState!==null,Ti(e,t,i),He=s;break;default:Ti(e,t,i)}}function yg(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{Vr(e)}catch(i){de(t,t.return,i)}}}function bg(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{Vr(e)}catch(i){de(t,t.return,i)}}function ky(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new Df),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new Df),t;default:throw Error(M(435,e.tag))}}function jl(e,t){var i=ky(e);t.forEach(function(s){if(!i.has(s)){i.add(s);var r=Ly.bind(null,e,s);s.then(r,r)}})}function xt(e,t){var i=t.deletions;if(i!==null)for(var s=0;s<i.length;s++){var r=i[s],n=e,l=t,a=l;e:for(;a!==null;){switch(a.tag){case 27:if(Ds(a.type)){xe=a.stateNode,Tt=!1;break e}break;case 5:xe=a.stateNode,Tt=!1;break e;case 3:case 4:xe=a.stateNode.containerInfo,Tt=!0;break e}a=a.return}if(xe===null)throw Error(M(160));Sg(n,l,r),xe=null,Tt=!1,n=r.alternate,n!==null&&(n.return=null),r.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)wg(t,e),t=t.sibling}var oi=null;function wg(e,t){var i=e.alternate,s=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:xt(t,e),Et(e),s&4&&(Es(3,e,e.return),gl(3,e),Es(5,e,e.return));break;case 1:xt(t,e),Et(e),s&512&&(He||i===null||mi(i,i.return)),s&64&&Ai&&(e=e.updateQueue,e!==null&&(s=e.callbacks,s!==null&&(i=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=i===null?s:i.concat(s))));break;case 26:var r=oi;if(xt(t,e),Et(e),s&512&&(He||i===null||mi(i,i.return)),s&4){var n=i!==null?i.memoizedState:null;if(s=e.memoizedState,i===null)if(s===null)if(e.stateNode===null){e:{s=e.type,i=e.memoizedProps,r=r.ownerDocument||r;t:switch(s){case"title":n=r.getElementsByTagName("title")[0],(!n||n[fl]||n[ct]||n.namespaceURI==="http://www.w3.org/2000/svg"||n.hasAttribute("itemprop"))&&(n=r.createElement(s),r.head.insertBefore(n,r.querySelector("head > title"))),ft(n,s,i),n[ct]=e,tt(n),s=n;break e;case"link":var l=$f("link","href",r).get(s+(i.href||""));if(l){for(var a=0;a<l.length;a++)if(n=l[a],n.getAttribute("href")===(i.href==null||i.href===""?null:i.href)&&n.getAttribute("rel")===(i.rel==null?null:i.rel)&&n.getAttribute("title")===(i.title==null?null:i.title)&&n.getAttribute("crossorigin")===(i.crossOrigin==null?null:i.crossOrigin)){l.splice(a,1);break t}}n=r.createElement(s),ft(n,s,i),r.head.appendChild(n);break;case"meta":if(l=$f("meta","content",r).get(s+(i.content||""))){for(a=0;a<l.length;a++)if(n=l[a],n.getAttribute("content")===(i.content==null?null:""+i.content)&&n.getAttribute("name")===(i.name==null?null:i.name)&&n.getAttribute("property")===(i.property==null?null:i.property)&&n.getAttribute("http-equiv")===(i.httpEquiv==null?null:i.httpEquiv)&&n.getAttribute("charset")===(i.charSet==null?null:i.charSet)){l.splice(a,1);break t}}n=r.createElement(s),ft(n,s,i),r.head.appendChild(n);break;default:throw Error(M(468,s))}n[ct]=e,tt(n),s=n}e.stateNode=s}else Gf(r,e.type,e.stateNode);else e.stateNode=Xf(r,s,e.memoizedProps);else n!==s?(n===null?i.stateNode!==null&&(i=i.stateNode,i.parentNode.removeChild(i)):n.count--,s===null?Gf(r,e.type,e.stateNode):Xf(r,s,e.memoizedProps)):s===null&&e.stateNode!==null&&Qo(e,e.memoizedProps,i.memoizedProps)}break;case 27:xt(t,e),Et(e),s&512&&(He||i===null||mi(i,i.return)),i!==null&&s&4&&Qo(e,e.memoizedProps,i.memoizedProps);break;case 5:if(xt(t,e),Et(e),s&512&&(He||i===null||mi(i,i.return)),e.flags&32){r=e.stateNode;try{jr(r,"")}catch(g){de(e,e.return,g)}}s&4&&e.stateNode!=null&&(r=e.memoizedProps,Qo(e,r,i!==null?i.memoizedProps:r)),s&1024&&(ec=!0);break;case 6:if(xt(t,e),Et(e),s&4){if(e.stateNode===null)throw Error(M(162));s=e.memoizedProps,i=e.stateNode;try{i.nodeValue=s}catch(g){de(e,e.return,g)}}break;case 3:if(oa=null,r=oi,oi=Ya(t.containerInfo),xt(t,e),oi=r,Et(e),s&4&&i!==null&&i.memoizedState.isDehydrated)try{Vr(t.containerInfo)}catch(g){de(e,e.return,g)}ec&&(ec=!1,Cg(e));break;case 4:s=oi,oi=Ya(e.stateNode.containerInfo),xt(t,e),Et(e),oi=s;break;case 12:xt(t,e),Et(e);break;case 31:xt(t,e),Et(e),s&4&&(s=e.updateQueue,s!==null&&(e.updateQueue=null,jl(e,s)));break;case 13:xt(t,e),Et(e),e.child.flags&8192&&e.memoizedState!==null!=(i!==null&&i.memoizedState!==null)&&(go=Ht()),s&4&&(s=e.updateQueue,s!==null&&(e.updateQueue=null,jl(e,s)));break;case 22:r=e.memoizedState!==null;var o=i!==null&&i.memoizedState!==null,c=Ai,u=He;if(Ai=c||r,He=u||o,xt(t,e),He=u,Ai=c,Et(e),s&8192)e:for(t=e.stateNode,t._visibility=r?t._visibility&-2:t._visibility|1,r&&(i===null||o||Ai||He||Os(e)),i=null,t=e;;){if(t.tag===5||t.tag===26){if(i===null){o=i=t;try{if(n=o.stateNode,r)l=n.style,typeof l.setProperty=="function"?l.setProperty("display","none","important"):l.display="none";else{a=o.stateNode;var _=o.memoizedProps.style,f=_!=null&&_.hasOwnProperty("display")?_.display:null;a.style.display=f==null||typeof f=="boolean"?"":(""+f).trim()}}catch(g){de(o,o.return,g)}}}else if(t.tag===6){if(i===null){o=t;try{o.stateNode.nodeValue=r?"":o.memoizedProps}catch(g){de(o,o.return,g)}}}else if(t.tag===18){if(i===null){o=t;try{var d=o.stateNode;r?Kf(d,!0):Kf(o.stateNode,!1)}catch(g){de(o,o.return,g)}}}else if((t.tag!==22&&t.tag!==23||t.memoizedState===null||t===e)&&t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break e;for(;t.sibling===null;){if(t.return===null||t.return===e)break e;i===t&&(i=null),t=t.return}i===t&&(i=null),t.sibling.return=t.return,t=t.sibling}s&4&&(s=e.updateQueue,s!==null&&(i=s.retryQueue,i!==null&&(s.retryQueue=null,jl(e,i))));break;case 19:xt(t,e),Et(e),s&4&&(s=e.updateQueue,s!==null&&(e.updateQueue=null,jl(e,s)));break;case 30:break;case 21:break;default:xt(t,e),Et(e)}}function Et(e){var t=e.flags;if(t&2){try{for(var i,s=e.return;s!==null;){if(pg(s)){i=s;break}s=s.return}if(i==null)throw Error(M(160));switch(i.tag){case 27:var r=i.stateNode,n=Jo(e);za(e,n,r);break;case 5:var l=i.stateNode;i.flags&32&&(jr(l,""),i.flags&=-33);var a=Jo(e);za(e,a,l);break;case 3:case 4:var o=i.stateNode.containerInfo,c=Jo(e);ah(e,c,o);break;default:throw Error(M(161))}}catch(u){de(e,e.return,u)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function Cg(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;Cg(t),t.tag===5&&t.flags&1024&&t.stateNode.reset(),e=e.sibling}}function Di(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)gg(e,t.alternate,t),t=t.sibling}function Os(e){for(e=e.child;e!==null;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:Es(4,t,t.return),Os(t);break;case 1:mi(t,t.return);var i=t.stateNode;typeof i.componentWillUnmount=="function"&&fg(t,t.return,i),Os(t);break;case 27:Wn(t.stateNode);case 26:case 5:mi(t,t.return),Os(t);break;case 22:t.memoizedState===null&&Os(t);break;case 30:Os(t);break;default:Os(t)}e=e.sibling}}function Ri(e,t,i){for(i=i&&(t.subtreeFlags&8772)!==0,t=t.child;t!==null;){var s=t.alternate,r=e,n=t,l=n.flags;switch(n.tag){case 0:case 11:case 15:Ri(r,n,i),gl(4,n);break;case 1:if(Ri(r,n,i),s=n,r=s.stateNode,typeof r.componentDidMount=="function")try{r.componentDidMount()}catch(c){de(s,s.return,c)}if(s=n,r=s.updateQueue,r!==null){var a=s.stateNode;try{var o=r.shared.hiddenCallbacks;if(o!==null)for(r.shared.hiddenCallbacks=null,r=0;r<o.length;r++)ym(o[r],a)}catch(c){de(s,s.return,c)}}i&&l&64&&dg(n),Un(n,n.return);break;case 27:mg(n);case 26:case 5:Ri(r,n,i),i&&s===null&&l&4&&_g(n),Un(n,n.return);break;case 12:Ri(r,n,i);break;case 31:Ri(r,n,i),i&&l&4&&yg(r,n);break;case 13:Ri(r,n,i),i&&l&4&&bg(r,n);break;case 22:n.memoizedState===null&&Ri(r,n,i),Un(n,n.return);break;case 30:break;default:Ri(r,n,i)}t=t.sibling}}function Qu(e,t){var i=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(i=e.memoizedState.cachePool.pool),e=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(e=t.memoizedState.cachePool.pool),e!==i&&(e!=null&&e.refCount++,i!=null&&pl(i))}function Ju(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&pl(e))}function li(e,t,i,s){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)xg(e,t,i,s),t=t.sibling}function xg(e,t,i,s){var r=t.flags;switch(t.tag){case 0:case 11:case 15:li(e,t,i,s),r&2048&&gl(9,t);break;case 1:li(e,t,i,s);break;case 3:li(e,t,i,s),r&2048&&(e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&pl(e)));break;case 12:if(r&2048){li(e,t,i,s),e=t.stateNode;try{var n=t.memoizedProps,l=n.id,a=n.onPostCommit;typeof a=="function"&&a(l,t.alternate===null?"mount":"update",e.passiveEffectDuration,-0)}catch(o){de(t,t.return,o)}}else li(e,t,i,s);break;case 31:li(e,t,i,s);break;case 13:li(e,t,i,s);break;case 23:break;case 22:n=t.stateNode,l=t.alternate,t.memoizedState!==null?n._visibility&2?li(e,t,i,s):qn(e,t):n._visibility&2?li(e,t,i,s):(n._visibility|=2,ur(e,t,i,s,(t.subtreeFlags&10256)!==0||!1)),r&2048&&Qu(l,t);break;case 24:li(e,t,i,s),r&2048&&Ju(t.alternate,t);break;default:li(e,t,i,s)}}function ur(e,t,i,s,r){for(r=r&&((t.subtreeFlags&10256)!==0||!1),t=t.child;t!==null;){var n=e,l=t,a=i,o=s,c=l.flags;switch(l.tag){case 0:case 11:case 15:ur(n,l,a,o,r),gl(8,l);break;case 23:break;case 22:var u=l.stateNode;l.memoizedState!==null?u._visibility&2?ur(n,l,a,o,r):qn(n,l):(u._visibility|=2,ur(n,l,a,o,r)),r&&c&2048&&Qu(l.alternate,l);break;case 24:ur(n,l,a,o,r),r&&c&2048&&Ju(l.alternate,l);break;default:ur(n,l,a,o,r)}t=t.sibling}}function qn(e,t){if(t.subtreeFlags&10256)for(t=t.child;t!==null;){var i=e,s=t,r=s.flags;switch(s.tag){case 22:qn(i,s),r&2048&&Qu(s.alternate,s);break;case 24:qn(i,s),r&2048&&Ju(s.alternate,s);break;default:qn(i,s)}t=t.sibling}}var xn=8192;function lr(e,t,i){if(e.subtreeFlags&xn)for(e=e.child;e!==null;)Eg(e,t,i),e=e.sibling}function Eg(e,t,i){switch(e.tag){case 26:lr(e,t,i),e.flags&xn&&e.memoizedState!==null&&d1(i,oi,e.memoizedState,e.memoizedProps);break;case 5:lr(e,t,i);break;case 3:case 4:var s=oi;oi=Ya(e.stateNode.containerInfo),lr(e,t,i),oi=s;break;case 22:e.memoizedState===null&&(s=e.alternate,s!==null&&s.memoizedState!==null?(s=xn,xn=16777216,lr(e,t,i),xn=s):lr(e,t,i));break;default:lr(e,t,i)}}function kg(e){var t=e.alternate;if(t!==null&&(e=t.child,e!==null)){t.child=null;do t=e.sibling,e.sibling=null,e=t;while(e!==null)}}function un(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var i=0;i<t.length;i++){var s=t[i];Ze=s,Dg(s,e)}kg(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)Tg(e),e=e.sibling}function Tg(e){switch(e.tag){case 0:case 11:case 15:un(e),e.flags&2048&&Es(9,e,e.return);break;case 3:un(e);break;case 12:un(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,la(e)):un(e);break;default:un(e)}}function la(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var i=0;i<t.length;i++){var s=t[i];Ze=s,Dg(s,e)}kg(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:Es(8,t,t.return),la(t);break;case 22:i=t.stateNode,i._visibility&2&&(i._visibility&=-3,la(t));break;default:la(t)}e=e.sibling}}function Dg(e,t){for(;Ze!==null;){var i=Ze;switch(i.tag){case 0:case 11:case 15:Es(8,i,t);break;case 23:case 22:if(i.memoizedState!==null&&i.memoizedState.cachePool!==null){var s=i.memoizedState.cachePool.pool;s!=null&&s.refCount++}break;case 24:pl(i.memoizedState.cache)}if(s=i.child,s!==null)s.return=i,Ze=s;else e:for(i=e;Ze!==null;){s=Ze;var r=s.sibling,n=s.return;if(vg(s),s===i){Ze=null;break e}if(r!==null){r.return=n,Ze=r;break e}Ze=n}}}var Ty={getCacheForType:function(e){var t=dt(Ue),i=t.data.get(e);return i===void 0&&(i=e(),t.data.set(e,i)),i},cacheSignal:function(){return dt(Ue).controller.signal}},Dy=typeof WeakMap=="function"?WeakMap:Map,ce=0,me=null,ne=null,le=0,ue=0,Ot=null,cs=!1,Qr=!1,ed=!1,Yi=0,Be=0,ks=0,Ks=0,td=0,jt=0,Pr=0,Pn=null,Dt=null,oh=!1,go=0,Mg=0,ja=1/0,Ha=null,gs=null,Ve=0,vs=null,Kr=null,Ui=0,ch=0,hh=null,Rg=null,Kn=0,uh=null;function Pt(){return ce&2&&le!==0?le&-le:X.T!==null?sd():Up()}function Bg(){if(jt===0)if(!(le&536870912)||ae){var e=Ml;Ml<<=1,!(Ml&3932160)&&(Ml=262144),jt=e}else jt=536870912;return e=Wt.current,e!==null&&(e.flags|=32),jt}function Mt(e,t,i){(e===me&&(ue===2||ue===9)||e.cancelPendingCommit!==null)&&(Wr(e,0),hs(e,le,jt,!1)),dl(e,i),(!(ce&2)||e!==me)&&(e===me&&(!(ce&2)&&(Ks|=i),Be===4&&hs(e,le,jt,!1)),wi(e))}function Ag(e,t,i){if(ce&6)throw Error(M(327));var s=!i&&(t&127)===0&&(t&e.expiredLanes)===0||ul(e,t),r=s?By(e,t):tc(e,t,!0),n=s;do{if(r===0){Qr&&!s&&hs(e,t,0,!1);break}else{if(i=e.current.alternate,n&&!My(i)){r=tc(e,t,!1),n=!1;continue}if(r===2){if(n=t,e.errorRecoveryDisabledLanes&n)var l=0;else l=e.pendingLanes&-536870913,l=l!==0?l:l&536870912?536870912:0;if(l!==0){t=l;e:{var a=e;r=Pn;var o=a.current.memoizedState.isDehydrated;if(o&&(Wr(a,l).flags|=256),l=tc(a,l,!1),l!==2){if(ed&&!o){a.errorRecoveryDisabledLanes|=n,Ks|=n,r=4;break e}n=Dt,Dt=r,n!==null&&(Dt===null?Dt=n:Dt.push.apply(Dt,n))}r=l}if(n=!1,r!==2)continue}}if(r===1){Wr(e,0),hs(e,t,0,!0);break}e:{switch(s=e,n=r,n){case 0:case 1:throw Error(M(345));case 4:if((t&4194048)!==t)break;case 6:hs(s,t,jt,!cs);break e;case 2:Dt=null;break;case 3:case 5:break;default:throw Error(M(329))}if((t&62914560)===t&&(r=go+300-Ht(),10<r)){if(hs(s,t,jt,!cs),no(s,0,!0)!==0)break e;Ui=t,s.timeoutHandle=Qg(Mf.bind(null,s,i,Dt,Ha,oh,t,jt,Ks,Pr,cs,n,"Throttled",-0,0),r);break e}Mf(s,i,Dt,Ha,oh,t,jt,Ks,Pr,cs,n,null,-0,0)}}break}while(!0);wi(e)}function Mf(e,t,i,s,r,n,l,a,o,c,u,_,f,d){if(e.timeoutHandle=-1,_=t.subtreeFlags,_&8192||(_&16785408)===16785408){_={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Oi},Eg(t,n,_);var g=(n&62914560)===n?go-Ht():(n&4194048)===n?Mg-Ht():0;if(g=f1(_,g),g!==null){Ui=n,e.cancelPendingCommit=g(Bf.bind(null,e,t,n,i,s,r,l,a,o,u,_,null,f,d)),hs(e,n,l,!c);return}}Bf(e,t,n,i,s,r,l,a,o)}function My(e){for(var t=e;;){var i=t.tag;if((i===0||i===11||i===15)&&t.flags&16384&&(i=t.updateQueue,i!==null&&(i=i.stores,i!==null)))for(var s=0;s<i.length;s++){var r=i[s],n=r.getSnapshot;r=r.value;try{if(!Kt(n(),r))return!1}catch{return!1}}if(i=t.child,t.subtreeFlags&16384&&i!==null)i.return=t,t=i;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function hs(e,t,i,s){t&=~td,t&=~Ks,e.suspendedLanes|=t,e.pingedLanes&=~t,s&&(e.warmLanes|=t),s=e.expirationTimes;for(var r=t;0<r;){var n=31-qt(r),l=1<<n;s[n]=-1,r&=~l}i!==0&&zp(e,i,t)}function vo(){return ce&6?!0:(vl(0),!1)}function id(){if(ne!==null){if(ue===0)var e=ne.return;else e=ne,Li=tr=null,Pu(e),Br=null,Qn=0,e=ne;for(;e!==null;)ug(e.alternate,e),e=e.return;ne=null}}function Wr(e,t){var i=e.timeoutHandle;i!==-1&&(e.timeoutHandle=-1,Gy(i)),i=e.cancelPendingCommit,i!==null&&(e.cancelPendingCommit=null,i()),Ui=0,id(),me=e,ne=i=ji(e.current,null),le=t,ue=0,Ot=null,cs=!1,Qr=ul(e,t),ed=!1,Pr=jt=td=Ks=ks=Be=0,Dt=Pn=null,oh=!1,t&8&&(t|=t&32);var s=e.entangledLanes;if(s!==0)for(e=e.entanglements,s&=t;0<s;){var r=31-qt(s),n=1<<r;t|=e[r],s&=~n}return Yi=t,co(),i}function Ng(e,t){ee=null,X.H=el,t===Zr||t===uo?(t=af(),ue=3):t===Ou?(t=af(),ue=4):ue=t===Fu?8:t!==null&&typeof t=="object"&&typeof t.then=="function"?6:1,Ot=t,ne===null&&(Be=1,Oa(e,Qt(t,e.current)))}function Og(){var e=Wt.current;return e===null?!0:(le&4194048)===le?ei===null:(le&62914560)===le||le&536870912?e===ei:!1}function Lg(){var e=X.H;return X.H=el,e===null?el:e}function zg(){var e=X.A;return X.A=Ty,e}function Ua(){Be=4,cs||(le&4194048)!==le&&Wt.current!==null||(Qr=!0),!(ks&134217727)&&!(Ks&134217727)||me===null||hs(me,le,jt,!1)}function tc(e,t,i){var s=ce;ce|=2;var r=Lg(),n=zg();(me!==e||le!==t)&&(Ha=null,Wr(e,t)),t=!1;var l=Be;e:do try{if(ue!==0&&ne!==null){var a=ne,o=Ot;switch(ue){case 8:id(),l=6;break e;case 3:case 2:case 9:case 6:Wt.current===null&&(t=!0);var c=ue;if(ue=0,Ot=null,xr(e,a,o,c),i&&Qr){l=0;break e}break;default:c=ue,ue=0,Ot=null,xr(e,a,o,c)}}Ry(),l=Be;break}catch(u){Ng(e,u)}while(!0);return t&&e.shellSuspendCounter++,Li=tr=null,ce=s,X.H=r,X.A=n,ne===null&&(me=null,le=0,co()),l}function Ry(){for(;ne!==null;)jg(ne)}function By(e,t){var i=ce;ce|=2;var s=Lg(),r=zg();me!==e||le!==t?(Ha=null,ja=Ht()+500,Wr(e,t)):Qr=ul(e,t);e:do try{if(ue!==0&&ne!==null){t=ne;var n=Ot;t:switch(ue){case 1:ue=0,Ot=null,xr(e,t,n,1);break;case 2:case 9:if(lf(n)){ue=0,Ot=null,Rf(t);break}t=function(){ue!==2&&ue!==9||me!==e||(ue=7),wi(e)},n.then(t,t);break e;case 3:ue=7;break e;case 4:ue=5;break e;case 7:lf(n)?(ue=0,Ot=null,Rf(t)):(ue=0,Ot=null,xr(e,t,n,7));break;case 5:var l=null;switch(ne.tag){case 26:l=ne.memoizedState;case 5:case 27:var a=ne;if(l?sv(l):a.stateNode.complete){ue=0,Ot=null;var o=a.sibling;if(o!==null)ne=o;else{var c=a.return;c!==null?(ne=c,So(c)):ne=null}break t}}ue=0,Ot=null,xr(e,t,n,5);break;case 6:ue=0,Ot=null,xr(e,t,n,6);break;case 8:id(),Be=6;break e;default:throw Error(M(462))}}Ay();break}catch(u){Ng(e,u)}while(!0);return Li=tr=null,X.H=s,X.A=r,ce=i,ne!==null?0:(me=null,le=0,co(),Be)}function Ay(){for(;ne!==null&&!tS();)jg(ne)}function jg(e){var t=hg(e.alternate,e,Yi);e.memoizedProps=e.pendingProps,t===null?So(e):ne=t}function Rf(e){var t=e,i=t.alternate;switch(t.tag){case 15:case 0:t=Cf(i,t,t.pendingProps,t.type,void 0,le);break;case 11:t=Cf(i,t,t.pendingProps,t.type.render,t.ref,le);break;case 5:Pu(t);default:ug(i,t),t=ne=um(t,Yi),t=hg(i,t,Yi)}e.memoizedProps=e.pendingProps,t===null?So(e):ne=t}function xr(e,t,i,s){Li=tr=null,Pu(t),Br=null,Qn=0;var r=t.return;try{if(yy(e,r,t,i,le)){Be=1,Oa(e,Qt(i,e.current)),ne=null;return}}catch(n){if(r!==null)throw ne=r,n;Be=1,Oa(e,Qt(i,e.current)),ne=null;return}t.flags&32768?(ae||s===1?e=!0:Qr||le&536870912?e=!1:(cs=e=!0,(s===2||s===9||s===3||s===6)&&(s=Wt.current,s!==null&&s.tag===13&&(s.flags|=16384))),Hg(t,e)):So(t)}function So(e){var t=e;do{if(t.flags&32768){Hg(t,cs);return}e=t.return;var i=Cy(t.alternate,t,Yi);if(i!==null){ne=i;return}if(t=t.sibling,t!==null){ne=t;return}ne=t=e}while(t!==null);Be===0&&(Be=5)}function Hg(e,t){do{var i=xy(e.alternate,e);if(i!==null){i.flags&=32767,ne=i;return}if(i=e.return,i!==null&&(i.flags|=32768,i.subtreeFlags=0,i.deletions=null),!t&&(e=e.sibling,e!==null)){ne=e;return}ne=e=i}while(e!==null);Be=6,ne=null}function Bf(e,t,i,s,r,n,l,a,o){e.cancelPendingCommit=null;do yo();while(Ve!==0);if(ce&6)throw Error(M(327));if(t!==null){if(t===e.current)throw Error(M(177));if(n=t.lanes|t.childLanes,n|=Tu,uS(e,i,n,l,a,o),e===me&&(ne=me=null,le=0),Kr=t,vs=e,Ui=i,ch=n,hh=r,Rg=s,t.subtreeFlags&10256||t.flags&10256?(e.callbackNode=null,e.callbackPriority=0,zy(Ca,function(){return Wg(),null})):(e.callbackNode=null,e.callbackPriority=0),s=(t.flags&13878)!==0,t.subtreeFlags&13878||s){s=X.T,X.T=null,r=he.p,he.p=2,l=ce,ce|=4;try{Ey(e,t,i)}finally{ce=l,he.p=r,X.T=s}}Ve=1,Ug(),qg(),Pg()}}function Ug(){if(Ve===1){Ve=0;var e=vs,t=Kr,i=(t.flags&13878)!==0;if(t.subtreeFlags&13878||i){i=X.T,X.T=null;var s=he.p;he.p=2;var r=ce;ce|=4;try{wg(t,e);var n=ph,l=sm(e.containerInfo),a=n.focusedElem,o=n.selectionRange;if(l!==a&&a&&a.ownerDocument&&im(a.ownerDocument.documentElement,a)){if(o!==null&&ku(a)){var c=o.start,u=o.end;if(u===void 0&&(u=c),"selectionStart"in a)a.selectionStart=c,a.selectionEnd=Math.min(u,a.value.length);else{var _=a.ownerDocument||document,f=_&&_.defaultView||window;if(f.getSelection){var d=f.getSelection(),g=a.textContent.length,y=Math.min(o.start,g),w=o.end===void 0?y:Math.min(o.end,g);!d.extend&&y>w&&(l=w,w=y,y=l);var m=Qd(a,y),p=Qd(a,w);if(m&&p&&(d.rangeCount!==1||d.anchorNode!==m.node||d.anchorOffset!==m.offset||d.focusNode!==p.node||d.focusOffset!==p.offset)){var v=_.createRange();v.setStart(m.node,m.offset),d.removeAllRanges(),y>w?(d.addRange(v),d.extend(p.node,p.offset)):(v.setEnd(p.node,p.offset),d.addRange(v))}}}}for(_=[],d=a;d=d.parentNode;)d.nodeType===1&&_.push({element:d,left:d.scrollLeft,top:d.scrollTop});for(typeof a.focus=="function"&&a.focus(),a=0;a<_.length;a++){var S=_[a];S.element.scrollLeft=S.left,S.element.scrollTop=S.top}}Xa=!!_h,ph=_h=null}finally{ce=r,he.p=s,X.T=i}}e.current=t,Ve=2}}function qg(){if(Ve===2){Ve=0;var e=vs,t=Kr,i=(t.flags&8772)!==0;if(t.subtreeFlags&8772||i){i=X.T,X.T=null;var s=he.p;he.p=2;var r=ce;ce|=4;try{gg(e,t.alternate,t)}finally{ce=r,he.p=s,X.T=i}}Ve=3}}function Pg(){if(Ve===4||Ve===3){Ve=0,iS();var e=vs,t=Kr,i=Ui,s=Rg;t.subtreeFlags&10256||t.flags&10256?Ve=5:(Ve=0,Kr=vs=null,Kg(e,e.pendingLanes));var r=e.pendingLanes;if(r===0&&(gs=null),Su(i),t=t.stateNode,Ut&&typeof Ut.onCommitFiberRoot=="function")try{Ut.onCommitFiberRoot(hl,t,void 0,(t.current.flags&128)===128)}catch{}if(s!==null){t=X.T,r=he.p,he.p=2,X.T=null;try{for(var n=e.onRecoverableError,l=0;l<s.length;l++){var a=s[l];n(a.value,{componentStack:a.stack})}}finally{X.T=t,he.p=r}}Ui&3&&yo(),wi(e),r=e.pendingLanes,i&261930&&r&42?e===uh?Kn++:(Kn=0,uh=e):Kn=0,vl(0)}}function Kg(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,pl(t)))}function yo(){return Ug(),qg(),Pg(),Wg()}function Wg(){if(Ve!==5)return!1;var e=vs,t=ch;ch=0;var i=Su(Ui),s=X.T,r=he.p;try{he.p=32>i?32:i,X.T=null,i=hh,hh=null;var n=vs,l=Ui;if(Ve=0,Kr=vs=null,Ui=0,ce&6)throw Error(M(331));var a=ce;if(ce|=4,Tg(n.current),xg(n,n.current,l,i),ce=a,vl(0,!1),Ut&&typeof Ut.onPostCommitFiberRoot=="function")try{Ut.onPostCommitFiberRoot(hl,n)}catch{}return!0}finally{he.p=r,X.T=s,Kg(e,t)}}function Af(e,t,i){t=Qt(i,t),t=rh(e.stateNode,t,2),e=ms(e,t,2),e!==null&&(dl(e,2),wi(e))}function de(e,t,i){if(e.tag===3)Af(e,e,i);else for(;t!==null;){if(t.tag===3){Af(t,e,i);break}else if(t.tag===1){var s=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof s.componentDidCatch=="function"&&(gs===null||!gs.has(s))){e=Qt(i,e),i=rg(2),s=ms(t,i,2),s!==null&&(ng(i,s,t,e),dl(s,2),wi(s));break}}t=t.return}}function ic(e,t,i){var s=e.pingCache;if(s===null){s=e.pingCache=new Dy;var r=new Set;s.set(t,r)}else r=s.get(t),r===void 0&&(r=new Set,s.set(t,r));r.has(i)||(ed=!0,r.add(i),e=Ny.bind(null,e,t,i),t.then(e,e))}function Ny(e,t,i){var s=e.pingCache;s!==null&&s.delete(t),e.pingedLanes|=e.suspendedLanes&i,e.warmLanes&=~i,me===e&&(le&i)===i&&(Be===4||Be===3&&(le&62914560)===le&&300>Ht()-go?!(ce&2)&&Wr(e,0):td|=i,Pr===le&&(Pr=0)),wi(e)}function Yg(e,t){t===0&&(t=Lp()),e=er(e,t),e!==null&&(dl(e,t),wi(e))}function Oy(e){var t=e.memoizedState,i=0;t!==null&&(i=t.retryLane),Yg(e,i)}function Ly(e,t){var i=0;switch(e.tag){case 31:case 13:var s=e.stateNode,r=e.memoizedState;r!==null&&(i=r.retryLane);break;case 19:s=e.stateNode;break;case 22:s=e.stateNode._retryCache;break;default:throw Error(M(314))}s!==null&&s.delete(t),Yg(e,i)}function zy(e,t){return gu(e,t)}var qa=null,dr=null,dh=!1,Pa=!1,sc=!1,us=0;function wi(e){e!==dr&&e.next===null&&(dr===null?qa=dr=e:dr=dr.next=e),Pa=!0,dh||(dh=!0,Hy())}function vl(e,t){if(!sc&&Pa){sc=!0;do for(var i=!1,s=qa;s!==null;){if(e!==0){var r=s.pendingLanes;if(r===0)var n=0;else{var l=s.suspendedLanes,a=s.pingedLanes;n=(1<<31-qt(42|e)+1)-1,n&=r&~(l&~a),n=n&201326741?n&201326741|1:n?n|2:0}n!==0&&(i=!0,Nf(s,n))}else n=le,n=no(s,s===me?n:0,s.cancelPendingCommit!==null||s.timeoutHandle!==-1),!(n&3)||ul(s,n)||(i=!0,Nf(s,n));s=s.next}while(i);sc=!1}}function jy(){Vg()}function Vg(){Pa=dh=!1;var e=0;us!==0&&$y()&&(e=us);for(var t=Ht(),i=null,s=qa;s!==null;){var r=s.next,n=Ig(s,t);n===0?(s.next=null,i===null?qa=r:i.next=r,r===null&&(dr=i)):(i=s,(e!==0||n&3)&&(Pa=!0)),s=r}Ve!==0&&Ve!==5||vl(e),us!==0&&(us=0)}function Ig(e,t){for(var i=e.suspendedLanes,s=e.pingedLanes,r=e.expirationTimes,n=e.pendingLanes&-62914561;0<n;){var l=31-qt(n),a=1<<l,o=r[l];o===-1?(!(a&i)||a&s)&&(r[l]=hS(a,t)):o<=t&&(e.expiredLanes|=a),n&=~a}if(t=me,i=le,i=no(e,e===t?i:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),s=e.callbackNode,i===0||e===t&&(ue===2||ue===9)||e.cancelPendingCommit!==null)return s!==null&&s!==null&&Bo(s),e.callbackNode=null,e.callbackPriority=0;if(!(i&3)||ul(e,i)){if(t=i&-i,t===e.callbackPriority)return t;switch(s!==null&&Bo(s),Su(i)){case 2:case 8:i=Np;break;case 32:i=Ca;break;case 268435456:i=Op;break;default:i=Ca}return s=Xg.bind(null,e),i=gu(i,s),e.callbackPriority=t,e.callbackNode=i,t}return s!==null&&s!==null&&Bo(s),e.callbackPriority=2,e.callbackNode=null,2}function Xg(e,t){if(Ve!==0&&Ve!==5)return e.callbackNode=null,e.callbackPriority=0,null;var i=e.callbackNode;if(yo()&&e.callbackNode!==i)return null;var s=le;return s=no(e,e===me?s:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),s===0?null:(Ag(e,s,t),Ig(e,Ht()),e.callbackNode!=null&&e.callbackNode===i?Xg.bind(null,e):null)}function Nf(e,t){if(yo())return null;Ag(e,t,!0)}function Hy(){Fy(function(){ce&6?gu(Ap,jy):Vg()})}function sd(){if(us===0){var e=Hr;e===0&&(e=Dl,Dl<<=1,!(Dl&261888)&&(Dl=256)),us=e}return us}function Of(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:Zl(""+e)}function Lf(e,t){var i=t.ownerDocument.createElement("input");return i.name=t.name,i.value=t.value,e.id&&i.setAttribute("form",e.id),t.parentNode.insertBefore(i,t),e=new FormData(e),i.parentNode.removeChild(i),e}function Uy(e,t,i,s,r){if(t==="submit"&&i&&i.stateNode===r){var n=Of((r[Rt]||null).action),l=s.submitter;l&&(t=(t=l[Rt]||null)?Of(t.formAction):l.getAttribute("formAction"),t!==null&&(n=t,l=null));var a=new lo("action","action",null,s,r);e.push({event:a,listeners:[{instance:null,listener:function(){if(s.defaultPrevented){if(us!==0){var o=l?Lf(r,l):new FormData(r);ih(i,{pending:!0,data:o,method:r.method,action:n},null,o)}}else typeof n=="function"&&(a.preventDefault(),o=l?Lf(r,l):new FormData(r),ih(i,{pending:!0,data:o,method:r.method,action:n},n,o))},currentTarget:r}]})}}for(var rc=0;rc<Yc.length;rc++){var nc=Yc[rc],qy=nc.toLowerCase(),Py=nc[0].toUpperCase()+nc.slice(1);ci(qy,"on"+Py)}ci(nm,"onAnimationEnd");ci(lm,"onAnimationIteration");ci(am,"onAnimationStart");ci("dblclick","onDoubleClick");ci("focusin","onFocus");ci("focusout","onBlur");ci(sy,"onTransitionRun");ci(ry,"onTransitionStart");ci(ny,"onTransitionCancel");ci(om,"onTransitionEnd");zr("onMouseEnter",["mouseout","mouseover"]);zr("onMouseLeave",["mouseout","mouseover"]);zr("onPointerEnter",["pointerout","pointerover"]);zr("onPointerLeave",["pointerout","pointerover"]);Zs("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));Zs("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));Zs("onBeforeInput",["compositionend","keypress","textInput","paste"]);Zs("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));Zs("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));Zs("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var tl="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(" "),Ky=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(tl));function $g(e,t){t=(t&4)!==0;for(var i=0;i<e.length;i++){var s=e[i],r=s.event;s=s.listeners;e:{var n=void 0;if(t)for(var l=s.length-1;0<=l;l--){var a=s[l],o=a.instance,c=a.currentTarget;if(a=a.listener,o!==n&&r.isPropagationStopped())break e;n=a,r.currentTarget=c;try{n(r)}catch(u){Ea(u)}r.currentTarget=null,n=o}else for(l=0;l<s.length;l++){if(a=s[l],o=a.instance,c=a.currentTarget,a=a.listener,o!==n&&r.isPropagationStopped())break e;n=a,r.currentTarget=c;try{n(r)}catch(u){Ea(u)}r.currentTarget=null,n=o}}}}function re(e,t){var i=t[zc];i===void 0&&(i=t[zc]=new Set);var s=e+"__bubble";i.has(s)||(Gg(t,e,2,!1),i.add(s))}function lc(e,t,i){var s=0;t&&(s|=4),Gg(i,e,s,t)}var Hl="_reactListening"+Math.random().toString(36).slice(2);function rd(e){if(!e[Hl]){e[Hl]=!0,qp.forEach(function(i){i!=="selectionchange"&&(Ky.has(i)||lc(i,!1,e),lc(i,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Hl]||(t[Hl]=!0,lc("selectionchange",!1,t))}}function Gg(e,t,i,s){switch(ov(t)){case 2:var r=m1;break;case 8:r=g1;break;default:r=od}i=r.bind(null,t,i,e),r=void 0,!Pc||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(r=!0),s?r!==void 0?e.addEventListener(t,i,{capture:!0,passive:r}):e.addEventListener(t,i,!0):r!==void 0?e.addEventListener(t,i,{passive:r}):e.addEventListener(t,i,!1)}function ac(e,t,i,s,r){var n=s;if(!(t&1)&&!(t&2)&&s!==null)e:for(;;){if(s===null)return;var l=s.tag;if(l===3||l===4){var a=s.stateNode.containerInfo;if(a===r)break;if(l===4)for(l=s.return;l!==null;){var o=l.tag;if((o===3||o===4)&&l.stateNode.containerInfo===r)return;l=l.return}for(;a!==null;){if(l=pr(a),l===null)return;if(o=l.tag,o===5||o===6||o===26||o===27){s=n=l;continue e}a=a.parentNode}}s=s.return}$p(function(){var c=n,u=wu(i),_=[];e:{var f=cm.get(e);if(f!==void 0){var d=lo,g=e;switch(e){case"keypress":if(Jl(i)===0)break e;case"keydown":case"keyup":d=LS;break;case"focusin":g="focus",d=zo;break;case"focusout":g="blur",d=zo;break;case"beforeblur":case"afterblur":d=zo;break;case"click":if(i.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":d=Kd;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":d=CS;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":d=HS;break;case nm:case lm:case am:d=kS;break;case om:d=qS;break;case"scroll":case"scrollend":d=bS;break;case"wheel":d=KS;break;case"copy":case"cut":case"paste":d=DS;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":d=Yd;break;case"toggle":case"beforetoggle":d=YS}var y=(t&4)!==0,w=!y&&(e==="scroll"||e==="scrollend"),m=y?f!==null?f+"Capture":null:f;y=[];for(var p=c,v;p!==null;){var S=p;if(v=S.stateNode,S=S.tag,S!==5&&S!==26&&S!==27||v===null||m===null||(S=Xn(p,m),S!=null&&y.push(il(p,S,v))),w)break;p=p.return}0<y.length&&(f=new d(f,g,null,i,u),_.push({event:f,listeners:y}))}}if(!(t&7)){e:{if(f=e==="mouseover"||e==="pointerover",d=e==="mouseout"||e==="pointerout",f&&i!==qc&&(g=i.relatedTarget||i.fromElement)&&(pr(g)||g[$r]))break e;if((d||f)&&(f=u.window===u?u:(f=u.ownerDocument)?f.defaultView||f.parentWindow:window,d?(g=i.relatedTarget||i.toElement,d=c,g=g?pr(g):null,g!==null&&(w=cl(g),y=g.tag,g!==w||y!==5&&y!==27&&y!==6)&&(g=null)):(d=null,g=c),d!==g)){if(y=Kd,S="onMouseLeave",m="onMouseEnter",p="mouse",(e==="pointerout"||e==="pointerover")&&(y=Yd,S="onPointerLeave",m="onPointerEnter",p="pointer"),w=d==null?f:wn(d),v=g==null?f:wn(g),f=new y(S,p+"leave",d,i,u),f.target=w,f.relatedTarget=v,S=null,pr(u)===c&&(y=new y(m,p+"enter",g,i,u),y.target=v,y.relatedTarget=w,S=y),w=S,d&&g)t:{for(y=Wy,m=d,p=g,v=0,S=m;S;S=y(S))v++;S=0;for(var T=p;T;T=y(T))S++;for(;0<v-S;)m=y(m),v--;for(;0<S-v;)p=y(p),S--;for(;v--;){if(m===p||p!==null&&m===p.alternate){y=m;break t}m=y(m),p=y(p)}y=null}else y=null;d!==null&&zf(_,f,d,y,!1),g!==null&&w!==null&&zf(_,w,g,y,!0)}}e:{if(f=c?wn(c):window,d=f.nodeName&&f.nodeName.toLowerCase(),d==="select"||d==="input"&&f.type==="file")var j=$d;else if(Xd(f))if(em)j=ey;else{j=QS;var O=ZS}else d=f.nodeName,!d||d.toLowerCase()!=="input"||f.type!=="checkbox"&&f.type!=="radio"?c&&bu(c.elementType)&&(j=$d):j=JS;if(j&&(j=j(e,c))){Jp(_,j,i,u);break e}O&&O(e,f,c),e==="focusout"&&c&&f.type==="number"&&c.memoizedProps.value!=null&&Uc(f,"number",f.value)}switch(O=c?wn(c):window,e){case"focusin":(Xd(O)||O.contentEditable==="true")&&(vr=O,Kc=c,Nn=null);break;case"focusout":Nn=Kc=vr=null;break;case"mousedown":Wc=!0;break;case"contextmenu":case"mouseup":case"dragend":Wc=!1,Jd(_,i,u);break;case"selectionchange":if(iy)break;case"keydown":case"keyup":Jd(_,i,u)}var L;if(Eu)e:{switch(e){case"compositionstart":var U="onCompositionStart";break e;case"compositionend":U="onCompositionEnd";break e;case"compositionupdate":U="onCompositionUpdate";break e}U=void 0}else gr?Zp(e,i)&&(U="onCompositionEnd"):e==="keydown"&&i.keyCode===229&&(U="onCompositionStart");U&&(Fp&&i.locale!=="ko"&&(gr||U!=="onCompositionStart"?U==="onCompositionEnd"&&gr&&(L=Gp()):(os=u,Cu="value"in os?os.value:os.textContent,gr=!0)),O=Ka(c,U),0<O.length&&(U=new Wd(U,e,null,i,u),_.push({event:U,listeners:O}),L?U.data=L:(L=Qp(i),L!==null&&(U.data=L)))),(L=IS?XS(e,i):$S(e,i))&&(U=Ka(c,"onBeforeInput"),0<U.length&&(O=new Wd("onBeforeInput","beforeinput",null,i,u),_.push({event:O,listeners:U}),O.data=L)),Uy(_,e,c,i,u)}$g(_,t)})}function il(e,t,i){return{instance:e,listener:t,currentTarget:i}}function Ka(e,t){for(var i=t+"Capture",s=[];e!==null;){var r=e,n=r.stateNode;if(r=r.tag,r!==5&&r!==26&&r!==27||n===null||(r=Xn(e,i),r!=null&&s.unshift(il(e,r,n)),r=Xn(e,t),r!=null&&s.push(il(e,r,n))),e.tag===3)return s;e=e.return}return[]}function Wy(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function zf(e,t,i,s,r){for(var n=t._reactName,l=[];i!==null&&i!==s;){var a=i,o=a.alternate,c=a.stateNode;if(a=a.tag,o!==null&&o===s)break;a!==5&&a!==26&&a!==27||c===null||(o=c,r?(c=Xn(i,n),c!=null&&l.unshift(il(i,c,o))):r||(c=Xn(i,n),c!=null&&l.push(il(i,c,o)))),i=i.return}l.length!==0&&e.push({event:t,listeners:l})}var Yy=/\r\n?/g,Vy=/\u0000|\uFFFD/g;function jf(e){return(typeof e=="string"?e:""+e).replace(Yy,`
|
|
49
|
+
`).replace(Vy,"")}function Fg(e,t){return t=jf(t),jf(e)===t}function _e(e,t,i,s,r,n){switch(i){case"children":typeof s=="string"?t==="body"||t==="textarea"&&s===""||jr(e,s):(typeof s=="number"||typeof s=="bigint")&&t!=="body"&&jr(e,""+s);break;case"className":Bl(e,"class",s);break;case"tabIndex":Bl(e,"tabindex",s);break;case"dir":case"role":case"viewBox":case"width":case"height":Bl(e,i,s);break;case"style":Xp(e,s,n);break;case"data":if(t!=="object"){Bl(e,"data",s);break}case"src":case"href":if(s===""&&(t!=="a"||i!=="href")){e.removeAttribute(i);break}if(s==null||typeof s=="function"||typeof s=="symbol"||typeof s=="boolean"){e.removeAttribute(i);break}s=Zl(""+s),e.setAttribute(i,s);break;case"action":case"formAction":if(typeof s=="function"){e.setAttribute(i,"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 n=="function"&&(i==="formAction"?(t!=="input"&&_e(e,t,"name",r.name,r,null),_e(e,t,"formEncType",r.formEncType,r,null),_e(e,t,"formMethod",r.formMethod,r,null),_e(e,t,"formTarget",r.formTarget,r,null)):(_e(e,t,"encType",r.encType,r,null),_e(e,t,"method",r.method,r,null),_e(e,t,"target",r.target,r,null)));if(s==null||typeof s=="symbol"||typeof s=="boolean"){e.removeAttribute(i);break}s=Zl(""+s),e.setAttribute(i,s);break;case"onClick":s!=null&&(e.onclick=Oi);break;case"onScroll":s!=null&&re("scroll",e);break;case"onScrollEnd":s!=null&&re("scrollend",e);break;case"dangerouslySetInnerHTML":if(s!=null){if(typeof s!="object"||!("__html"in s))throw Error(M(61));if(i=s.__html,i!=null){if(r.children!=null)throw Error(M(60));e.innerHTML=i}}break;case"multiple":e.multiple=s&&typeof s!="function"&&typeof s!="symbol";break;case"muted":e.muted=s&&typeof s!="function"&&typeof s!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(s==null||typeof s=="function"||typeof s=="boolean"||typeof s=="symbol"){e.removeAttribute("xlink:href");break}i=Zl(""+s),e.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",i);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":s!=null&&typeof s!="function"&&typeof s!="symbol"?e.setAttribute(i,""+s):e.removeAttribute(i);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":s&&typeof s!="function"&&typeof s!="symbol"?e.setAttribute(i,""):e.removeAttribute(i);break;case"capture":case"download":s===!0?e.setAttribute(i,""):s!==!1&&s!=null&&typeof s!="function"&&typeof s!="symbol"?e.setAttribute(i,s):e.removeAttribute(i);break;case"cols":case"rows":case"size":case"span":s!=null&&typeof s!="function"&&typeof s!="symbol"&&!isNaN(s)&&1<=s?e.setAttribute(i,s):e.removeAttribute(i);break;case"rowSpan":case"start":s==null||typeof s=="function"||typeof s=="symbol"||isNaN(s)?e.removeAttribute(i):e.setAttribute(i,s);break;case"popover":re("beforetoggle",e),re("toggle",e),Fl(e,"popover",s);break;case"xlinkActuate":Ei(e,"http://www.w3.org/1999/xlink","xlink:actuate",s);break;case"xlinkArcrole":Ei(e,"http://www.w3.org/1999/xlink","xlink:arcrole",s);break;case"xlinkRole":Ei(e,"http://www.w3.org/1999/xlink","xlink:role",s);break;case"xlinkShow":Ei(e,"http://www.w3.org/1999/xlink","xlink:show",s);break;case"xlinkTitle":Ei(e,"http://www.w3.org/1999/xlink","xlink:title",s);break;case"xlinkType":Ei(e,"http://www.w3.org/1999/xlink","xlink:type",s);break;case"xmlBase":Ei(e,"http://www.w3.org/XML/1998/namespace","xml:base",s);break;case"xmlLang":Ei(e,"http://www.w3.org/XML/1998/namespace","xml:lang",s);break;case"xmlSpace":Ei(e,"http://www.w3.org/XML/1998/namespace","xml:space",s);break;case"is":Fl(e,"is",s);break;case"innerText":case"textContent":break;default:(!(2<i.length)||i[0]!=="o"&&i[0]!=="O"||i[1]!=="n"&&i[1]!=="N")&&(i=SS.get(i)||i,Fl(e,i,s))}}function fh(e,t,i,s,r,n){switch(i){case"style":Xp(e,s,n);break;case"dangerouslySetInnerHTML":if(s!=null){if(typeof s!="object"||!("__html"in s))throw Error(M(61));if(i=s.__html,i!=null){if(r.children!=null)throw Error(M(60));e.innerHTML=i}}break;case"children":typeof s=="string"?jr(e,s):(typeof s=="number"||typeof s=="bigint")&&jr(e,""+s);break;case"onScroll":s!=null&&re("scroll",e);break;case"onScrollEnd":s!=null&&re("scrollend",e);break;case"onClick":s!=null&&(e.onclick=Oi);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Pp.hasOwnProperty(i))e:{if(i[0]==="o"&&i[1]==="n"&&(r=i.endsWith("Capture"),t=i.slice(2,r?i.length-7:void 0),n=e[Rt]||null,n=n!=null?n[i]:null,typeof n=="function"&&e.removeEventListener(t,n,r),typeof s=="function")){typeof n!="function"&&n!==null&&(i in e?e[i]=null:e.hasAttribute(i)&&e.removeAttribute(i)),e.addEventListener(t,s,r);break e}i in e?e[i]=s:s===!0?e.setAttribute(i,""):Fl(e,i,s)}}}function ft(e,t,i){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":re("error",e),re("load",e);var s=!1,r=!1,n;for(n in i)if(i.hasOwnProperty(n)){var l=i[n];if(l!=null)switch(n){case"src":s=!0;break;case"srcSet":r=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(M(137,t));default:_e(e,t,n,l,i,null)}}r&&_e(e,t,"srcSet",i.srcSet,i,null),s&&_e(e,t,"src",i.src,i,null);return;case"input":re("invalid",e);var a=n=l=r=null,o=null,c=null;for(s in i)if(i.hasOwnProperty(s)){var u=i[s];if(u!=null)switch(s){case"name":r=u;break;case"type":l=u;break;case"checked":o=u;break;case"defaultChecked":c=u;break;case"value":n=u;break;case"defaultValue":a=u;break;case"children":case"dangerouslySetInnerHTML":if(u!=null)throw Error(M(137,t));break;default:_e(e,t,s,u,i,null)}}Yp(e,n,a,o,c,l,r,!1);return;case"select":re("invalid",e),s=l=n=null;for(r in i)if(i.hasOwnProperty(r)&&(a=i[r],a!=null))switch(r){case"value":n=a;break;case"defaultValue":l=a;break;case"multiple":s=a;default:_e(e,t,r,a,i,null)}t=n,i=l,e.multiple=!!s,t!=null?Dr(e,!!s,t,!1):i!=null&&Dr(e,!!s,i,!0);return;case"textarea":re("invalid",e),n=r=s=null;for(l in i)if(i.hasOwnProperty(l)&&(a=i[l],a!=null))switch(l){case"value":s=a;break;case"defaultValue":r=a;break;case"children":n=a;break;case"dangerouslySetInnerHTML":if(a!=null)throw Error(M(91));break;default:_e(e,t,l,a,i,null)}Ip(e,s,r,n);return;case"option":for(o in i)if(i.hasOwnProperty(o)&&(s=i[o],s!=null))switch(o){case"selected":e.selected=s&&typeof s!="function"&&typeof s!="symbol";break;default:_e(e,t,o,s,i,null)}return;case"dialog":re("beforetoggle",e),re("toggle",e),re("cancel",e),re("close",e);break;case"iframe":case"object":re("load",e);break;case"video":case"audio":for(s=0;s<tl.length;s++)re(tl[s],e);break;case"image":re("error",e),re("load",e);break;case"details":re("toggle",e);break;case"embed":case"source":case"link":re("error",e),re("load",e);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(c in i)if(i.hasOwnProperty(c)&&(s=i[c],s!=null))switch(c){case"children":case"dangerouslySetInnerHTML":throw Error(M(137,t));default:_e(e,t,c,s,i,null)}return;default:if(bu(t)){for(u in i)i.hasOwnProperty(u)&&(s=i[u],s!==void 0&&fh(e,t,u,s,i,void 0));return}}for(a in i)i.hasOwnProperty(a)&&(s=i[a],s!=null&&_e(e,t,a,s,i,null))}function Iy(e,t,i,s){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var r=null,n=null,l=null,a=null,o=null,c=null,u=null;for(d in i){var _=i[d];if(i.hasOwnProperty(d)&&_!=null)switch(d){case"checked":break;case"value":break;case"defaultValue":o=_;default:s.hasOwnProperty(d)||_e(e,t,d,null,s,_)}}for(var f in s){var d=s[f];if(_=i[f],s.hasOwnProperty(f)&&(d!=null||_!=null))switch(f){case"type":n=d;break;case"name":r=d;break;case"checked":c=d;break;case"defaultChecked":u=d;break;case"value":l=d;break;case"defaultValue":a=d;break;case"children":case"dangerouslySetInnerHTML":if(d!=null)throw Error(M(137,t));break;default:d!==_&&_e(e,t,f,d,s,_)}}Hc(e,l,a,o,c,u,n,r);return;case"select":d=l=a=f=null;for(n in i)if(o=i[n],i.hasOwnProperty(n)&&o!=null)switch(n){case"value":break;case"multiple":d=o;default:s.hasOwnProperty(n)||_e(e,t,n,null,s,o)}for(r in s)if(n=s[r],o=i[r],s.hasOwnProperty(r)&&(n!=null||o!=null))switch(r){case"value":f=n;break;case"defaultValue":a=n;break;case"multiple":l=n;default:n!==o&&_e(e,t,r,n,s,o)}t=a,i=l,s=d,f!=null?Dr(e,!!i,f,!1):!!s!=!!i&&(t!=null?Dr(e,!!i,t,!0):Dr(e,!!i,i?[]:"",!1));return;case"textarea":d=f=null;for(a in i)if(r=i[a],i.hasOwnProperty(a)&&r!=null&&!s.hasOwnProperty(a))switch(a){case"value":break;case"children":break;default:_e(e,t,a,null,s,r)}for(l in s)if(r=s[l],n=i[l],s.hasOwnProperty(l)&&(r!=null||n!=null))switch(l){case"value":f=r;break;case"defaultValue":d=r;break;case"children":break;case"dangerouslySetInnerHTML":if(r!=null)throw Error(M(91));break;default:r!==n&&_e(e,t,l,r,s,n)}Vp(e,f,d);return;case"option":for(var g in i)if(f=i[g],i.hasOwnProperty(g)&&f!=null&&!s.hasOwnProperty(g))switch(g){case"selected":e.selected=!1;break;default:_e(e,t,g,null,s,f)}for(o in s)if(f=s[o],d=i[o],s.hasOwnProperty(o)&&f!==d&&(f!=null||d!=null))switch(o){case"selected":e.selected=f&&typeof f!="function"&&typeof f!="symbol";break;default:_e(e,t,o,f,s,d)}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 y in i)f=i[y],i.hasOwnProperty(y)&&f!=null&&!s.hasOwnProperty(y)&&_e(e,t,y,null,s,f);for(c in s)if(f=s[c],d=i[c],s.hasOwnProperty(c)&&f!==d&&(f!=null||d!=null))switch(c){case"children":case"dangerouslySetInnerHTML":if(f!=null)throw Error(M(137,t));break;default:_e(e,t,c,f,s,d)}return;default:if(bu(t)){for(var w in i)f=i[w],i.hasOwnProperty(w)&&f!==void 0&&!s.hasOwnProperty(w)&&fh(e,t,w,void 0,s,f);for(u in s)f=s[u],d=i[u],!s.hasOwnProperty(u)||f===d||f===void 0&&d===void 0||fh(e,t,u,f,s,d);return}}for(var m in i)f=i[m],i.hasOwnProperty(m)&&f!=null&&!s.hasOwnProperty(m)&&_e(e,t,m,null,s,f);for(_ in s)f=s[_],d=i[_],!s.hasOwnProperty(_)||f===d||f==null&&d==null||_e(e,t,_,f,s,d)}function Hf(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function Xy(){if(typeof performance.getEntriesByType=="function"){for(var e=0,t=0,i=performance.getEntriesByType("resource"),s=0;s<i.length;s++){var r=i[s],n=r.transferSize,l=r.initiatorType,a=r.duration;if(n&&a&&Hf(l)){for(l=0,a=r.responseEnd,s+=1;s<i.length;s++){var o=i[s],c=o.startTime;if(c>a)break;var u=o.transferSize,_=o.initiatorType;u&&Hf(_)&&(o=o.responseEnd,l+=u*(o<a?1:(a-c)/(o-c)))}if(--s,t+=8*(n+l)/(r.duration/1e3),e++,10<e)break}}if(0<e)return t/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e=="number")?e:5}var _h=null,ph=null;function Wa(e){return e.nodeType===9?e:e.ownerDocument}function Uf(e){switch(e){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function Zg(e,t){if(e===0)switch(t){case"svg":return 1;case"math":return 2;default:return 0}return e===1&&t==="foreignObject"?0:e}function mh(e,t){return e==="textarea"||e==="noscript"||typeof t.children=="string"||typeof t.children=="number"||typeof t.children=="bigint"||typeof t.dangerouslySetInnerHTML=="object"&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var oc=null;function $y(){var e=window.event;return e&&e.type==="popstate"?e===oc?!1:(oc=e,!0):(oc=null,!1)}var Qg=typeof setTimeout=="function"?setTimeout:void 0,Gy=typeof clearTimeout=="function"?clearTimeout:void 0,qf=typeof Promise=="function"?Promise:void 0,Fy=typeof queueMicrotask=="function"?queueMicrotask:typeof qf<"u"?function(e){return qf.resolve(null).then(e).catch(Zy)}:Qg;function Zy(e){setTimeout(function(){throw e})}function Ds(e){return e==="head"}function Pf(e,t){var i=t,s=0;do{var r=i.nextSibling;if(e.removeChild(i),r&&r.nodeType===8)if(i=r.data,i==="/$"||i==="/&"){if(s===0){e.removeChild(r),Vr(t);return}s--}else if(i==="$"||i==="$?"||i==="$~"||i==="$!"||i==="&")s++;else if(i==="html")Wn(e.ownerDocument.documentElement);else if(i==="head"){i=e.ownerDocument.head,Wn(i);for(var n=i.firstChild;n;){var l=n.nextSibling,a=n.nodeName;n[fl]||a==="SCRIPT"||a==="STYLE"||a==="LINK"&&n.rel.toLowerCase()==="stylesheet"||i.removeChild(n),n=l}}else i==="body"&&Wn(e.ownerDocument.body);i=r}while(i);Vr(t)}function Kf(e,t){var i=e;e=0;do{var s=i.nextSibling;if(i.nodeType===1?t?(i._stashedDisplay=i.style.display,i.style.display="none"):(i.style.display=i._stashedDisplay||"",i.getAttribute("style")===""&&i.removeAttribute("style")):i.nodeType===3&&(t?(i._stashedText=i.nodeValue,i.nodeValue=""):i.nodeValue=i._stashedText||""),s&&s.nodeType===8)if(i=s.data,i==="/$"){if(e===0)break;e--}else i!=="$"&&i!=="$?"&&i!=="$~"&&i!=="$!"||e++;i=s}while(i)}function gh(e){var t=e.firstChild;for(t&&t.nodeType===10&&(t=t.nextSibling);t;){var i=t;switch(t=t.nextSibling,i.nodeName){case"HTML":case"HEAD":case"BODY":gh(i),yu(i);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(i.rel.toLowerCase()==="stylesheet")continue}e.removeChild(i)}}function Qy(e,t,i,s){for(;e.nodeType===1;){var r=i;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!s&&(e.nodeName!=="INPUT"||e.type!=="hidden"))break}else if(s){if(!e[fl])switch(t){case"meta":if(!e.hasAttribute("itemprop"))break;return e;case"link":if(n=e.getAttribute("rel"),n==="stylesheet"&&e.hasAttribute("data-precedence"))break;if(n!==r.rel||e.getAttribute("href")!==(r.href==null||r.href===""?null:r.href)||e.getAttribute("crossorigin")!==(r.crossOrigin==null?null:r.crossOrigin)||e.getAttribute("title")!==(r.title==null?null:r.title))break;return e;case"style":if(e.hasAttribute("data-precedence"))break;return e;case"script":if(n=e.getAttribute("src"),(n!==(r.src==null?null:r.src)||e.getAttribute("type")!==(r.type==null?null:r.type)||e.getAttribute("crossorigin")!==(r.crossOrigin==null?null:r.crossOrigin))&&n&&e.hasAttribute("async")&&!e.hasAttribute("itemprop"))break;return e;default:return e}}else if(t==="input"&&e.type==="hidden"){var n=r.name==null?null:""+r.name;if(r.type==="hidden"&&e.getAttribute("name")===n)return e}else return e;if(e=ti(e.nextSibling),e===null)break}return null}function Jy(e,t,i){if(t==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!i||(e=ti(e.nextSibling),e===null))return null;return e}function Jg(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!t||(e=ti(e.nextSibling),e===null))return null;return e}function vh(e){return e.data==="$?"||e.data==="$~"}function Sh(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function e1(e,t){var i=e.ownerDocument;if(e.data==="$~")e._reactRetry=t;else if(e.data!=="$?"||i.readyState!=="loading")t();else{var s=function(){t(),i.removeEventListener("DOMContentLoaded",s)};i.addEventListener("DOMContentLoaded",s),e._reactRetry=s}}function ti(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t==="$"||t==="$!"||t==="$?"||t==="$~"||t==="&"||t==="F!"||t==="F")break;if(t==="/$"||t==="/&")return null}}return e}var yh=null;function Wf(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var i=e.data;if(i==="/$"||i==="/&"){if(t===0)return ti(e.nextSibling);t--}else i!=="$"&&i!=="$!"&&i!=="$?"&&i!=="$~"&&i!=="&"||t++}e=e.nextSibling}return null}function Yf(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var i=e.data;if(i==="$"||i==="$!"||i==="$?"||i==="$~"||i==="&"){if(t===0)return e;t--}else i!=="/$"&&i!=="/&"||t++}e=e.previousSibling}return null}function ev(e,t,i){switch(t=Wa(i),e){case"html":if(e=t.documentElement,!e)throw Error(M(452));return e;case"head":if(e=t.head,!e)throw Error(M(453));return e;case"body":if(e=t.body,!e)throw Error(M(454));return e;default:throw Error(M(451))}}function Wn(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);yu(e)}var si=new Map,Vf=new Set;function Ya(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var Vi=he.d;he.d={f:t1,r:i1,D:s1,C:r1,L:n1,m:l1,X:o1,S:a1,M:c1};function t1(){var e=Vi.f(),t=vo();return e||t}function i1(e){var t=Gr(e);t!==null&&t.tag===5&&t.type==="form"?Xm(t):Vi.r(e)}var Jr=typeof document>"u"?null:document;function tv(e,t,i){var s=Jr;if(s&&typeof t=="string"&&t){var r=Zt(t);r='link[rel="'+e+'"][href="'+r+'"]',typeof i=="string"&&(r+='[crossorigin="'+i+'"]'),Vf.has(r)||(Vf.add(r),e={rel:e,crossOrigin:i,href:t},s.querySelector(r)===null&&(t=s.createElement("link"),ft(t,"link",e),tt(t),s.head.appendChild(t)))}}function s1(e){Vi.D(e),tv("dns-prefetch",e,null)}function r1(e,t){Vi.C(e,t),tv("preconnect",e,t)}function n1(e,t,i){Vi.L(e,t,i);var s=Jr;if(s&&e&&t){var r='link[rel="preload"][as="'+Zt(t)+'"]';t==="image"&&i&&i.imageSrcSet?(r+='[imagesrcset="'+Zt(i.imageSrcSet)+'"]',typeof i.imageSizes=="string"&&(r+='[imagesizes="'+Zt(i.imageSizes)+'"]')):r+='[href="'+Zt(e)+'"]';var n=r;switch(t){case"style":n=Yr(e);break;case"script":n=en(e)}si.has(n)||(e=we({rel:"preload",href:t==="image"&&i&&i.imageSrcSet?void 0:e,as:t},i),si.set(n,e),s.querySelector(r)!==null||t==="style"&&s.querySelector(Sl(n))||t==="script"&&s.querySelector(yl(n))||(t=s.createElement("link"),ft(t,"link",e),tt(t),s.head.appendChild(t)))}}function l1(e,t){Vi.m(e,t);var i=Jr;if(i&&e){var s=t&&typeof t.as=="string"?t.as:"script",r='link[rel="modulepreload"][as="'+Zt(s)+'"][href="'+Zt(e)+'"]',n=r;switch(s){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":n=en(e)}if(!si.has(n)&&(e=we({rel:"modulepreload",href:e},t),si.set(n,e),i.querySelector(r)===null)){switch(s){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(i.querySelector(yl(n)))return}s=i.createElement("link"),ft(s,"link",e),tt(s),i.head.appendChild(s)}}}function a1(e,t,i){Vi.S(e,t,i);var s=Jr;if(s&&e){var r=Tr(s).hoistableStyles,n=Yr(e);t=t||"default";var l=r.get(n);if(!l){var a={loading:0,preload:null};if(l=s.querySelector(Sl(n)))a.loading=5;else{e=we({rel:"stylesheet",href:e,"data-precedence":t},i),(i=si.get(n))&&nd(e,i);var o=l=s.createElement("link");tt(o),ft(o,"link",e),o._p=new Promise(function(c,u){o.onload=c,o.onerror=u}),o.addEventListener("load",function(){a.loading|=1}),o.addEventListener("error",function(){a.loading|=2}),a.loading|=4,aa(l,t,s)}l={type:"stylesheet",instance:l,count:1,state:a},r.set(n,l)}}}function o1(e,t){Vi.X(e,t);var i=Jr;if(i&&e){var s=Tr(i).hoistableScripts,r=en(e),n=s.get(r);n||(n=i.querySelector(yl(r)),n||(e=we({src:e,async:!0},t),(t=si.get(r))&&ld(e,t),n=i.createElement("script"),tt(n),ft(n,"link",e),i.head.appendChild(n)),n={type:"script",instance:n,count:1,state:null},s.set(r,n))}}function c1(e,t){Vi.M(e,t);var i=Jr;if(i&&e){var s=Tr(i).hoistableScripts,r=en(e),n=s.get(r);n||(n=i.querySelector(yl(r)),n||(e=we({src:e,async:!0,type:"module"},t),(t=si.get(r))&&ld(e,t),n=i.createElement("script"),tt(n),ft(n,"link",e),i.head.appendChild(n)),n={type:"script",instance:n,count:1,state:null},s.set(r,n))}}function If(e,t,i,s){var r=(r=fs.current)?Ya(r):null;if(!r)throw Error(M(446));switch(e){case"meta":case"title":return null;case"style":return typeof i.precedence=="string"&&typeof i.href=="string"?(t=Yr(i.href),i=Tr(r).hoistableStyles,s=i.get(t),s||(s={type:"style",instance:null,count:0,state:null},i.set(t,s)),s):{type:"void",instance:null,count:0,state:null};case"link":if(i.rel==="stylesheet"&&typeof i.href=="string"&&typeof i.precedence=="string"){e=Yr(i.href);var n=Tr(r).hoistableStyles,l=n.get(e);if(l||(r=r.ownerDocument||r,l={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},n.set(e,l),(n=r.querySelector(Sl(e)))&&!n._p&&(l.instance=n,l.state.loading=5),si.has(e)||(i={rel:"preload",as:"style",href:i.href,crossOrigin:i.crossOrigin,integrity:i.integrity,media:i.media,hrefLang:i.hrefLang,referrerPolicy:i.referrerPolicy},si.set(e,i),n||h1(r,e,i,l.state))),t&&s===null)throw Error(M(528,""));return l}if(t&&s!==null)throw Error(M(529,""));return null;case"script":return t=i.async,i=i.src,typeof i=="string"&&t&&typeof t!="function"&&typeof t!="symbol"?(t=en(i),i=Tr(r).hoistableScripts,s=i.get(t),s||(s={type:"script",instance:null,count:0,state:null},i.set(t,s)),s):{type:"void",instance:null,count:0,state:null};default:throw Error(M(444,e))}}function Yr(e){return'href="'+Zt(e)+'"'}function Sl(e){return'link[rel="stylesheet"]['+e+"]"}function iv(e){return we({},e,{"data-precedence":e.precedence,precedence:null})}function h1(e,t,i,s){e.querySelector('link[rel="preload"][as="style"]['+t+"]")?s.loading=1:(t=e.createElement("link"),s.preload=t,t.addEventListener("load",function(){return s.loading|=1}),t.addEventListener("error",function(){return s.loading|=2}),ft(t,"link",i),tt(t),e.head.appendChild(t))}function en(e){return'[src="'+Zt(e)+'"]'}function yl(e){return"script[async]"+e}function Xf(e,t,i){if(t.count++,t.instance===null)switch(t.type){case"style":var s=e.querySelector('style[data-href~="'+Zt(i.href)+'"]');if(s)return t.instance=s,tt(s),s;var r=we({},i,{"data-href":i.href,"data-precedence":i.precedence,href:null,precedence:null});return s=(e.ownerDocument||e).createElement("style"),tt(s),ft(s,"style",r),aa(s,i.precedence,e),t.instance=s;case"stylesheet":r=Yr(i.href);var n=e.querySelector(Sl(r));if(n)return t.state.loading|=4,t.instance=n,tt(n),n;s=iv(i),(r=si.get(r))&&nd(s,r),n=(e.ownerDocument||e).createElement("link"),tt(n);var l=n;return l._p=new Promise(function(a,o){l.onload=a,l.onerror=o}),ft(n,"link",s),t.state.loading|=4,aa(n,i.precedence,e),t.instance=n;case"script":return n=en(i.src),(r=e.querySelector(yl(n)))?(t.instance=r,tt(r),r):(s=i,(r=si.get(n))&&(s=we({},i),ld(s,r)),e=e.ownerDocument||e,r=e.createElement("script"),tt(r),ft(r,"link",s),e.head.appendChild(r),t.instance=r);case"void":return null;default:throw Error(M(443,t.type))}else t.type==="stylesheet"&&!(t.state.loading&4)&&(s=t.instance,t.state.loading|=4,aa(s,i.precedence,e));return t.instance}function aa(e,t,i){for(var s=i.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),r=s.length?s[s.length-1]:null,n=r,l=0;l<s.length;l++){var a=s[l];if(a.dataset.precedence===t)n=a;else if(n!==r)break}n?n.parentNode.insertBefore(e,n.nextSibling):(t=i.nodeType===9?i.head:i,t.insertBefore(e,t.firstChild))}function nd(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.title==null&&(e.title=t.title)}function ld(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.integrity==null&&(e.integrity=t.integrity)}var oa=null;function $f(e,t,i){if(oa===null){var s=new Map,r=oa=new Map;r.set(i,s)}else r=oa,s=r.get(i),s||(s=new Map,r.set(i,s));if(s.has(e))return s;for(s.set(e,null),i=i.getElementsByTagName(e),r=0;r<i.length;r++){var n=i[r];if(!(n[fl]||n[ct]||e==="link"&&n.getAttribute("rel")==="stylesheet")&&n.namespaceURI!=="http://www.w3.org/2000/svg"){var l=n.getAttribute(t)||"";l=e+l;var a=s.get(l);a?a.push(n):s.set(l,[n])}}return s}function Gf(e,t,i){e=e.ownerDocument||e,e.head.insertBefore(i,t==="title"?e.querySelector("head > title"):null)}function u1(e,t,i){if(i===1||t.itemProp!=null)return!1;switch(e){case"meta":case"title":return!0;case"style":if(typeof t.precedence!="string"||typeof t.href!="string"||t.href==="")break;return!0;case"link":if(typeof t.rel!="string"||typeof t.href!="string"||t.href===""||t.onLoad||t.onError)break;switch(t.rel){case"stylesheet":return e=t.disabled,typeof t.precedence=="string"&&e==null;default:return!0}case"script":if(t.async&&typeof t.async!="function"&&typeof t.async!="symbol"&&!t.onLoad&&!t.onError&&t.src&&typeof t.src=="string")return!0}return!1}function sv(e){return!(e.type==="stylesheet"&&!(e.state.loading&3))}function d1(e,t,i,s){if(i.type==="stylesheet"&&(typeof s.media!="string"||matchMedia(s.media).matches!==!1)&&!(i.state.loading&4)){if(i.instance===null){var r=Yr(s.href),n=t.querySelector(Sl(r));if(n){t=n._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(e.count++,e=Va.bind(e),t.then(e,e)),i.state.loading|=4,i.instance=n,tt(n);return}n=t.ownerDocument||t,s=iv(s),(r=si.get(r))&&nd(s,r),n=n.createElement("link"),tt(n);var l=n;l._p=new Promise(function(a,o){l.onload=a,l.onerror=o}),ft(n,"link",s),i.instance=n}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(i,t),(t=i.state.preload)&&!(i.state.loading&3)&&(e.count++,i=Va.bind(e),t.addEventListener("load",i),t.addEventListener("error",i))}}var cc=0;function f1(e,t){return e.stylesheets&&e.count===0&&ca(e,e.stylesheets),0<e.count||0<e.imgCount?function(i){var s=setTimeout(function(){if(e.stylesheets&&ca(e,e.stylesheets),e.unsuspend){var n=e.unsuspend;e.unsuspend=null,n()}},6e4+t);0<e.imgBytes&&cc===0&&(cc=62500*Xy());var r=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&ca(e,e.stylesheets),e.unsuspend)){var n=e.unsuspend;e.unsuspend=null,n()}},(e.imgBytes>cc?50:800)+t);return e.unsuspend=i,function(){e.unsuspend=null,clearTimeout(s),clearTimeout(r)}}:null}function Va(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)ca(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var Ia=null;function ca(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,Ia=new Map,t.forEach(_1,e),Ia=null,Va.call(e))}function _1(e,t){if(!(t.state.loading&4)){var i=Ia.get(e);if(i)var s=i.get(null);else{i=new Map,Ia.set(e,i);for(var r=e.querySelectorAll("link[data-precedence],style[data-precedence]"),n=0;n<r.length;n++){var l=r[n];(l.nodeName==="LINK"||l.getAttribute("media")!=="not all")&&(i.set(l.dataset.precedence,l),s=l)}s&&i.set(null,s)}r=t.instance,l=r.getAttribute("data-precedence"),n=i.get(l)||s,n===s&&i.set(null,r),i.set(l,r),this.count++,s=Va.bind(this),r.addEventListener("load",s),r.addEventListener("error",s),n?n.parentNode.insertBefore(r,n.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(r,e.firstChild)),t.state.loading|=4}}var sl={$$typeof:Ni,Provider:null,Consumer:null,_currentValue:Hs,_currentValue2:Hs,_threadCount:0};function p1(e,t,i,s,r,n,l,a,o){this.tag=1,this.containerInfo=e,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=Ao(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Ao(0),this.hiddenUpdates=Ao(null),this.identifierPrefix=s,this.onUncaughtError=r,this.onCaughtError=n,this.onRecoverableError=l,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=o,this.incompleteTransitions=new Map}function rv(e,t,i,s,r,n,l,a,o,c,u,_){return e=new p1(e,t,i,l,o,c,u,_,a),t=1,n===!0&&(t|=24),n=zt(3,null,null,t),e.current=n,n.stateNode=e,t=Au(),t.refCount++,e.pooledCache=t,t.refCount++,n.memoizedState={element:s,isDehydrated:i,cache:t},Lu(n),e}function nv(e){return e?(e=br,e):br}function lv(e,t,i,s,r,n){r=nv(r),s.context===null?s.context=r:s.pendingContext=r,s=ps(t),s.payload={element:i},n=n===void 0?null:n,n!==null&&(s.callback=n),i=ms(e,s,t),i!==null&&(Mt(i,e,t),Ln(i,e,t))}function Ff(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var i=e.retryLane;e.retryLane=i!==0&&i<t?i:t}}function ad(e,t){Ff(e,t),(e=e.alternate)&&Ff(e,t)}function av(e){if(e.tag===13||e.tag===31){var t=er(e,67108864);t!==null&&Mt(t,e,67108864),ad(e,67108864)}}function Zf(e){if(e.tag===13||e.tag===31){var t=Pt();t=vu(t);var i=er(e,t);i!==null&&Mt(i,e,t),ad(e,t)}}var Xa=!0;function m1(e,t,i,s){var r=X.T;X.T=null;var n=he.p;try{he.p=2,od(e,t,i,s)}finally{he.p=n,X.T=r}}function g1(e,t,i,s){var r=X.T;X.T=null;var n=he.p;try{he.p=8,od(e,t,i,s)}finally{he.p=n,X.T=r}}function od(e,t,i,s){if(Xa){var r=bh(s);if(r===null)ac(e,t,s,$a,i),Qf(e,s);else if(S1(r,e,t,i,s))s.stopPropagation();else if(Qf(e,s),t&4&&-1<v1.indexOf(e)){for(;r!==null;){var n=Gr(r);if(n!==null)switch(n.tag){case 3:if(n=n.stateNode,n.current.memoizedState.isDehydrated){var l=As(n.pendingLanes);if(l!==0){var a=n;for(a.pendingLanes|=2,a.entangledLanes|=2;l;){var o=1<<31-qt(l);a.entanglements[1]|=o,l&=~o}wi(n),!(ce&6)&&(ja=Ht()+500,vl(0))}}break;case 31:case 13:a=er(n,2),a!==null&&Mt(a,n,2),vo(),ad(n,2)}if(n=bh(s),n===null&&ac(e,t,s,$a,i),n===r)break;r=n}r!==null&&s.stopPropagation()}else ac(e,t,s,null,i)}}function bh(e){return e=wu(e),cd(e)}var $a=null;function cd(e){if($a=null,e=pr(e),e!==null){var t=cl(e);if(t===null)e=null;else{var i=t.tag;if(i===13){if(e=Tp(t),e!==null)return e;e=null}else if(i===31){if(e=Dp(t),e!==null)return e;e=null}else if(i===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null)}}return $a=e,null}function ov(e){switch(e){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(sS()){case Ap:return 2;case Np:return 8;case Ca:case rS:return 32;case Op:return 268435456;default:return 32}default:return 32}}var wh=!1,Ss=null,ys=null,bs=null,rl=new Map,nl=new Map,ls=[],v1="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 Qf(e,t){switch(e){case"focusin":case"focusout":Ss=null;break;case"dragenter":case"dragleave":ys=null;break;case"mouseover":case"mouseout":bs=null;break;case"pointerover":case"pointerout":rl.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":nl.delete(t.pointerId)}}function dn(e,t,i,s,r,n){return e===null||e.nativeEvent!==n?(e={blockedOn:t,domEventName:i,eventSystemFlags:s,nativeEvent:n,targetContainers:[r]},t!==null&&(t=Gr(t),t!==null&&av(t)),e):(e.eventSystemFlags|=s,t=e.targetContainers,r!==null&&t.indexOf(r)===-1&&t.push(r),e)}function S1(e,t,i,s,r){switch(t){case"focusin":return Ss=dn(Ss,e,t,i,s,r),!0;case"dragenter":return ys=dn(ys,e,t,i,s,r),!0;case"mouseover":return bs=dn(bs,e,t,i,s,r),!0;case"pointerover":var n=r.pointerId;return rl.set(n,dn(rl.get(n)||null,e,t,i,s,r)),!0;case"gotpointercapture":return n=r.pointerId,nl.set(n,dn(nl.get(n)||null,e,t,i,s,r)),!0}return!1}function cv(e){var t=pr(e.target);if(t!==null){var i=cl(t);if(i!==null){if(t=i.tag,t===13){if(t=Tp(i),t!==null){e.blockedOn=t,Ld(e.priority,function(){Zf(i)});return}}else if(t===31){if(t=Dp(i),t!==null){e.blockedOn=t,Ld(e.priority,function(){Zf(i)});return}}else if(t===3&&i.stateNode.current.memoizedState.isDehydrated){e.blockedOn=i.tag===3?i.stateNode.containerInfo:null;return}}}e.blockedOn=null}function ha(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var i=bh(e.nativeEvent);if(i===null){i=e.nativeEvent;var s=new i.constructor(i.type,i);qc=s,i.target.dispatchEvent(s),qc=null}else return t=Gr(i),t!==null&&av(t),e.blockedOn=i,!1;t.shift()}return!0}function Jf(e,t,i){ha(e)&&i.delete(t)}function y1(){wh=!1,Ss!==null&&ha(Ss)&&(Ss=null),ys!==null&&ha(ys)&&(ys=null),bs!==null&&ha(bs)&&(bs=null),rl.forEach(Jf),nl.forEach(Jf)}function Ul(e,t){e.blockedOn===t&&(e.blockedOn=null,wh||(wh=!0,Ie.unstable_scheduleCallback(Ie.unstable_NormalPriority,y1)))}var ql=null;function e_(e){ql!==e&&(ql=e,Ie.unstable_scheduleCallback(Ie.unstable_NormalPriority,function(){ql===e&&(ql=null);for(var t=0;t<e.length;t+=3){var i=e[t],s=e[t+1],r=e[t+2];if(typeof s!="function"){if(cd(s||i)===null)continue;break}var n=Gr(i);n!==null&&(e.splice(t,3),t-=3,ih(n,{pending:!0,data:r,method:i.method,action:s},s,r))}}))}function Vr(e){function t(o){return Ul(o,e)}Ss!==null&&Ul(Ss,e),ys!==null&&Ul(ys,e),bs!==null&&Ul(bs,e),rl.forEach(t),nl.forEach(t);for(var i=0;i<ls.length;i++){var s=ls[i];s.blockedOn===e&&(s.blockedOn=null)}for(;0<ls.length&&(i=ls[0],i.blockedOn===null);)cv(i),i.blockedOn===null&&ls.shift();if(i=(e.ownerDocument||e).$$reactFormReplay,i!=null)for(s=0;s<i.length;s+=3){var r=i[s],n=i[s+1],l=r[Rt]||null;if(typeof n=="function")l||e_(i);else if(l){var a=null;if(n&&n.hasAttribute("formAction")){if(r=n,l=n[Rt]||null)a=l.formAction;else if(cd(r)!==null)continue}else a=l.action;typeof a=="function"?i[s+1]=a:(i.splice(s,3),s-=3),e_(i)}}}function hv(){function e(n){n.canIntercept&&n.info==="react-transition"&&n.intercept({handler:function(){return new Promise(function(l){return r=l})},focusReset:"manual",scroll:"manual"})}function t(){r!==null&&(r(),r=null),s||setTimeout(i,20)}function i(){if(!s&&!navigation.transition){var n=navigation.currentEntry;n&&n.url!=null&&navigation.navigate(n.url,{state:n.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var s=!1,r=null;return navigation.addEventListener("navigate",e),navigation.addEventListener("navigatesuccess",t),navigation.addEventListener("navigateerror",t),setTimeout(i,100),function(){s=!0,navigation.removeEventListener("navigate",e),navigation.removeEventListener("navigatesuccess",t),navigation.removeEventListener("navigateerror",t),r!==null&&(r(),r=null)}}}function hd(e){this._internalRoot=e}bo.prototype.render=hd.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(M(409));var i=t.current,s=Pt();lv(i,s,e,t,null,null)};bo.prototype.unmount=hd.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;lv(e.current,2,null,e,null,null),vo(),t[$r]=null}};function bo(e){this._internalRoot=e}bo.prototype.unstable_scheduleHydration=function(e){if(e){var t=Up();e={blockedOn:null,target:e,priority:t};for(var i=0;i<ls.length&&t!==0&&t<ls[i].priority;i++);ls.splice(i,0,e),i===0&&cv(e)}};var t_=Ep.version;if(t_!=="19.2.6")throw Error(M(527,t_,"19.2.6"));he.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(M(188)):(e=Object.keys(e).join(","),Error(M(268,e)));return e=F0(t),e=e!==null?Mp(e):null,e=e===null?null:e.stateNode,e};var b1={bundleType:0,version:"19.2.6",rendererPackageName:"react-dom",currentDispatcherRef:X,reconcilerVersion:"19.2.6"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Pl=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Pl.isDisabled&&Pl.supportsFiber)try{hl=Pl.inject(b1),Ut=Pl}catch{}}so.createRoot=function(e,t){if(!kp(e))throw Error(M(299));var i=!1,s="",r=tg,n=ig,l=sg;return t!=null&&(t.unstable_strictMode===!0&&(i=!0),t.identifierPrefix!==void 0&&(s=t.identifierPrefix),t.onUncaughtError!==void 0&&(r=t.onUncaughtError),t.onCaughtError!==void 0&&(n=t.onCaughtError),t.onRecoverableError!==void 0&&(l=t.onRecoverableError)),t=rv(e,1,!1,null,null,i,s,null,r,n,l,hv),e[$r]=t.current,rd(e),new hd(t)};so.hydrateRoot=function(e,t,i){if(!kp(e))throw Error(M(299));var s=!1,r="",n=tg,l=ig,a=sg,o=null;return i!=null&&(i.unstable_strictMode===!0&&(s=!0),i.identifierPrefix!==void 0&&(r=i.identifierPrefix),i.onUncaughtError!==void 0&&(n=i.onUncaughtError),i.onCaughtError!==void 0&&(l=i.onCaughtError),i.onRecoverableError!==void 0&&(a=i.onRecoverableError),i.formState!==void 0&&(o=i.formState)),t=rv(e,1,!0,t,i??null,s,r,o,n,l,a,hv),t.context=nv(null),i=t.current,s=Pt(),s=vu(s),r=ps(s),r.callback=null,ms(i,r,s),i=s,t.current.lanes=i,dl(t,i),wi(t),e[$r]=t.current,rd(e),new bo(t)};so.version="19.2.6";function uv(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(uv)}catch(e){console.error(e)}}uv(),vp.exports=so;var w1=vp.exports;const Er=new Map,C1=2e3;function dv(e,t,i){return`${e}:${t}:${i}`}function ud(e,t,i){const s=dv(e,t,i),r=Er.get(s);Er.set(s,{remaining:((r==null?void 0:r.remaining)??0)+1,expiresAt:Date.now()+C1})}function x1(e,t,i){const s=dv(e,t,i),r=Er.get(s);return r?r.expiresAt<Date.now()?(Er.delete(s),!1):(r.remaining<=1?Er.delete(s):Er.set(s,{remaining:r.remaining-1,expiresAt:r.expiresAt}),!0):!1}function E1(e){return btoa(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}function ua(e,t){return e||(console.warn(`[evalution] Missing providerId for ${t}; prompt linking may not work.`),"")}function fv(e){if(e.kind==="primitive")return e.syntax==="number"?{kind:"primitive",value:0}:e.syntax==="boolean"?{kind:"primitive",value:!1}:{kind:"primitive",value:""};if(e.kind==="array")return{kind:"array",elements:[]};if(e.kind==="union"){const t=e.types.find(i=>i.kind==="constant");if(t&&t.kind==="constant")return{kind:"primitive",value:t.value};if(e.types.length>0)return fv(e.types[0])}return{kind:"primitive",value:void 0}}function dd(e,t){return`/api/prompts/${e.providerId}/${E1(e.id)}/${t}`}async function ri(e){if(!e.ok){const t=await e.json().catch(()=>({}));throw new Error(t.error??`Request failed: ${e.status}`)}}async function k1(){const e=await fetch("/api/setup-tasks");return await ri(e),e.json()}async function T1(e,t){const i=await fetch(`/api/setup-tasks/${encodeURIComponent(e)}/steps/${encodeURIComponent(t)}/execute`,{method:"POST"});return await ri(i),i.json()}async function D1(){const e=await fetch("/api/providers");return await ri(e),e.json()}async function i_(e,t){const i=await fetch(`/api/providers/${e}/add-prompt`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});await ri(i);const s=await i.json();return s&&"id"in s&&ud("add",e,s.id),s}async function M1(){const e=await fetch("/api/prompts");return await ri(e),e.json()}async function R1(e){const t=await fetch(`/api/providers/${e}/models`);return await ri(t),t.json()}async function B1(e){const t=await fetch(`/api/providers/${e}/model-parameters`);return await ri(t),t.json()}async function A1(e,t){const i=e.id.lastIndexOf("#"),s=i>=0?`${e.id.slice(0,i+1)}${t}`:e.id;e.providerId&&ud("change",e.providerId,s);const r=await fetch(dd(e,"rename"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({newName:t})});return await ri(r),r.json()}async function N1(e,t){e.providerId&&ud("change",e.providerId,e.id);const i=await fetch(dd(e,"update"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});return await ri(i),i.json()}async function O1(e,t){const i=await fetch(dd(e,"execute"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({functionParams:t})});return await ri(i),i.json()}async function L1(){const e=await fetch("/api/traces");return await ri(e),e.json()}async function z1(e,t){const i=await fetch(`/api/traces/${encodeURIComponent(e)}/${encodeURIComponent(t)}`);return await ri(i),i.json()}function j1(e,t,i){const s=`/api/traces/${encodeURIComponent(e)}/${encodeURIComponent(t)}/events`,r=new EventSource(s);return r.onmessage=n=>{try{const l=JSON.parse(n.data);l!=null&&l.type&&l.type!=="connected"&&i(l)}catch{}},()=>r.close()}function H1({onClose:e,onCreated:t}){const[i,s]=k.useState({type:"loading"}),[r,n]=k.useState({}),[l,a]=k.useState(null);k.useEffect(()=>{D1().then(u=>{const _=u.filter(f=>f.hasAddPrompt);_.length===0?a("No providers support adding prompts"):_.length===1?o(_[0].id):s({type:"pick-provider",providers:_})}).catch(u=>a(u.message))},[]);async function o(u){s({type:"loading"}),a(null);try{const _=await i_(u,{});if("fields"in _){const f={};for(const d of _.fields)d.defaultValue&&(f[d.name]=d.defaultValue);n(f),s({type:"form",providerId:u,context:_})}else t(_)}catch(_){a(_.message)}}async function c(u){if(u.preventDefault(),i.type!=="form")return;a(null),s({type:"submitting"});const _={};for(const[f,d]of Object.entries(r))d&&(_[f]=d);if(_.directory!==void 0&&_.fileName){const f=_.directory==="."?"":_.directory+"/";_.metadata={relativeFilePath:f+_.fileName},delete _.directory,delete _.fileName}try{const f=await i_(i.providerId,_);if("fields"in f){const d={};for(const g of f.fields)g.defaultValue&&(d[g.name]=g.defaultValue);n({...d,...r}),s({type:"form",providerId:i.providerId,context:f})}else t(f)}catch(f){a(f.message),s({type:"form",providerId:i.providerId,context:i.context})}}return h.jsx("div",{className:"dialog-backdrop",onClick:e,children:h.jsxs("div",{className:"dialog",onClick:u=>u.stopPropagation(),children:[h.jsxs("div",{className:"dialog-header",children:[h.jsx("h3",{children:"New Prompt"}),h.jsx("button",{type:"button",className:"dialog-close",onClick:e,children:"×"})]}),h.jsxs("div",{className:"dialog-body",children:[l&&h.jsx("div",{className:"dialog-error",children:l}),i.type==="loading"&&h.jsx("div",{className:"dialog-status",children:"Loading..."}),i.type==="submitting"&&h.jsx("div",{className:"dialog-status",children:"Creating..."}),i.type==="pick-provider"&&h.jsx("div",{className:"dialog-providers",children:i.providers.map(u=>h.jsxs("button",{type:"button",className:"dialog-provider-btn",onClick:()=>o(u.id),children:[u.icon&&h.jsx("span",{className:"dialog-provider-icon",dangerouslySetInnerHTML:{__html:u.icon}}),h.jsxs("div",{children:[h.jsx("div",{className:"dialog-provider-name",children:u.displayName??u.id}),u.description&&h.jsx("div",{className:"dialog-provider-desc",children:u.description})]})]},u.id))}),i.type==="form"&&h.jsxs("form",{onSubmit:c,children:[i.context.fields.map(u=>{var _;return h.jsxs("div",{className:"dialog-field",children:[h.jsx("label",{htmlFor:`field-${u.name}`,children:u.label}),u.type==="select"?h.jsx("select",{id:`field-${u.name}`,value:r[u.name]??"",onChange:f=>n(d=>({...d,[u.name]:f.target.value})),required:u.required,children:(_=u.options)==null?void 0:_.map(f=>h.jsx("option",{value:f.value,children:f.label},f.value))}):h.jsx("input",{id:`field-${u.name}`,type:"text",value:r[u.name]??"",onChange:f=>n(d=>({...d,[u.name]:f.target.value})),placeholder:u.placeholder,required:u.required})]},u.name)}),h.jsxs("div",{className:"dialog-actions",children:[h.jsx("button",{type:"button",className:"dialog-btn-cancel",onClick:e,children:"Cancel"}),h.jsx("button",{type:"submit",className:"dialog-btn-create",children:"Create"})]})]})]})]})})}function _v(e){if(e.kind!=="union")return null;const t=e.types.filter(s=>s.kind==="object");if(t.length!==e.types.length||t.length<2)return null;const i=t[0].properties;for(const s of i)if(t.every(n=>{const l=n.properties.find(a=>a.name===s.name);return l&&l.type.kind==="constant"})){const n=t.map(l=>({discriminatorValue:l.properties.find(o=>o.name===s.name).type.value,properties:l.properties.filter(o=>o.name!==s.name)}));return{discriminator:s.name,cases:n}}return null}function Ga(e){return e.displayValue!==void 0?e.displayValue:Or(e)}function Or(e){switch(e.kind){case"primitive":return e.value===null?"null":e.value===void 0?"undefined":typeof e.value=="string"?JSON.stringify(e.value):String(e.value);case"template":{let t="";for(const i of e.value)typeof i=="string"?t+=i.replace(/\\/g,"\\\\").replace(/`/g,"\\`").replace(/\$\{/g,"\\${"):t+="${"+i.expr+"}";return"`"+t+"`"}case"functionCall":{const t=e.args.map(Or).join(", ");return`${e.callee}(${t})`}case"lambda":return`(${e.parameters.join(", ")}) => ${e.body}`;case"object":{const t=Object.entries(e.properties);return t.length===0?"{}":`{ ${t.map(([s,r])=>`${s}: ${Or(r)}`).join(", ")} }`}case"array":case"tuple":return`[${e.elements.map(Or).join(", ")}]`;case"raw":return e.sourceText}}function bl(e){if(e.defaultValue)return`Default: ${Or(e.defaultValue)}`}function U1({value:e,onChange:t,propDef:i,className:s}){const r=(e==null?void 0:e.kind)==="primitive"&&typeof e.value=="string"?e.value:"";return h.jsx("input",{type:"text",value:r,onChange:n=>t({kind:"primitive",value:n.target.value}),placeholder:bl(i),className:s,style:s?void 0:{width:"100%",padding:"4px 6px",background:"var(--proppy-input-bg, #fff)",color:"var(--proppy-input-color, inherit)",border:"1px solid var(--proppy-border, #ddd)",borderRadius:"3px",fontSize:"12px"}})}function q1({value:e,onChange:t,propDef:i,className:s}){const r=(e==null?void 0:e.kind)==="primitive"&&typeof e.value=="number"?e.value:"";return h.jsx("input",{type:"number",value:r??"",onChange:n=>{const l=n.target.value;l===""&&i.optional?t({kind:"primitive",value:void 0}):t({kind:"primitive",value:l===""?0:Number(l)})},placeholder:bl(i),className:s,style:s?void 0:{width:"100%",padding:"4px 6px",background:"var(--proppy-input-bg, #fff)",color:"var(--proppy-input-color, inherit)",border:"1px solid var(--proppy-border, #ddd)",borderRadius:"3px",fontSize:"12px"}})}function P1({value:e,onChange:t,propDef:i,className:s}){var l;const r=((l=i.defaultValue)==null?void 0:l.kind)==="primitive"&&typeof i.defaultValue.value=="boolean"?i.defaultValue.value:!1,n=(e==null?void 0:e.kind)==="primitive"&&typeof e.value=="boolean"?e.value:r;return h.jsxs("select",{value:n?"true":"false",onChange:a=>t({kind:"primitive",value:a.target.value==="true"}),className:s,style:s?void 0:{width:"100%",padding:"4px 6px",background:"var(--proppy-input-bg, #fff)",color:"var(--proppy-input-color, inherit)",border:"1px solid var(--proppy-border, #ddd)",borderRadius:"3px",fontSize:"12px"},children:[h.jsx("option",{value:"true",children:"true"}),h.jsx("option",{value:"false",children:"false"})]})}function K1(e){return e.kind!=="union"?[]:e.types.filter(t=>t.kind==="constant").map(t=>t.value)}function pv({value:e,onChange:t,propDef:i,className:s}){var a;const r=K1(i.type),n=((a=i.defaultValue)==null?void 0:a.kind)==="primitive"?String(i.defaultValue.value):"",l=(e==null?void 0:e.kind)==="primitive"?String(e.value):n;return h.jsxs("select",{value:l||"",onChange:o=>t({kind:"primitive",value:o.target.value}),className:s,style:s?void 0:{width:"100%",padding:"4px 6px",background:"var(--proppy-input-bg, #fff)",color:"var(--proppy-input-color, inherit)",border:"1px solid var(--proppy-border, #ddd)",borderRadius:"3px",fontSize:"12px"},children:[i.optional&&h.jsx("option",{value:"",children:"-- Select --"}),r.map(o=>h.jsx("option",{value:String(o),children:String(o)},String(o)))]})}function W1({value:e,onChange:t,propDef:i}){const s=(e==null?void 0:e.kind)==="primitive"&&typeof e.value=="string"?e.value:"";return h.jsx("input",{type:"datetime-local",value:s,onChange:r=>t({kind:"primitive",value:r.target.value}),placeholder:bl(i),style:{width:"100%",padding:"4px 6px",background:"var(--proppy-input-bg, #fff)",color:"var(--proppy-input-color, inherit)",border:"1px solid var(--proppy-border, #ddd)",borderRadius:"3px",fontSize:"12px"}})}function Y1({value:e,onChange:t,propDef:i}){const s=i.type.kind==="function"?i.type.parameters:[],r=s.map(a=>`${a.name}${a.optional?"?":""}: ${a.type.syntax}`).join(", "),n=(e==null?void 0:e.kind)==="lambda"?e.body:"",l=bl(i)||"Enter function body (without braces)";return h.jsxs("div",{children:[h.jsxs("div",{style:{fontSize:"11px",fontFamily:"monospace",color:"var(--proppy-text-secondary, #666)",marginBottom:"4px",padding:"4px 8px",background:"var(--proppy-button-bg, #f5f5f5)",borderRadius:"3px",border:"1px solid var(--proppy-border, #e0e0e0)"},children:["(",r,") =>"]}),h.jsx("textarea",{value:n,onChange:a=>t({kind:"lambda",parameters:s.map(o=>o.name),body:a.target.value}),placeholder:l,style:{width:"100%",padding:"6px 8px",background:"var(--proppy-input-bg, #fff)",color:"var(--proppy-input-color, inherit)",border:"1px solid var(--proppy-border, #ddd)",borderRadius:"4px",fontSize:"12px",fontFamily:"monospace",boxSizing:"border-box",minHeight:"60px",resize:"vertical"}})]})}function fd({value:e,onChange:t,propDef:i,className:s}){const r=e?Or(e):"";return h.jsx("textarea",{value:r,onChange:n=>t({kind:"raw",sourceText:n.target.value}),placeholder:bl(i),className:s,style:s?void 0:{width:"100%",padding:"4px 6px",background:"var(--proppy-input-bg, #fff)",color:"var(--proppy-input-color, inherit)",border:"1px solid var(--proppy-border, #ddd)",borderRadius:"3px",fontSize:"11px",fontFamily:"monospace",minHeight:"40px",resize:"vertical"}})}function mv({properties:e,value:t,onChange:i,plugins:s}){const r=(t==null?void 0:t.kind)==="object"?{...t.properties}:{},n=(l,a)=>{const o={...r,[l]:a};i({kind:"object",properties:o})};return h.jsx("div",{style:{border:"1px solid var(--proppy-border, #ddd)",borderRadius:"4px",padding:"8px",background:"var(--proppy-container-bg, #fafafa)",display:"flex",flexDirection:"column",gap:"8px"},children:e.map(l=>h.jsxs("div",{children:[h.jsxs("label",{style:{display:"block",fontSize:"11px",marginBottom:"2px",fontWeight:500,color:"var(--proppy-text-primary, inherit)"},children:[l.name,l.optional?"":" *",h.jsx("span",{style:{color:"var(--proppy-text-muted, #999)",fontWeight:"normal",marginLeft:"4px"},children:l.type.syntax})]}),l.description&&h.jsx("div",{style:{fontSize:"10px",color:"var(--proppy-text-secondary, #666)",marginBottom:"2px",fontStyle:"italic"},children:l.description}),h.jsx(tn,{propDef:l,value:r[l.name],onChange:a=>n(l.name,a),plugins:s})]},l.name))})}function gv({elementType:e,value:t,onChange:i,plugins:s}){const r=(t==null?void 0:t.kind)==="array"?t.elements:[],n=()=>{i({kind:"array",elements:[...r,{kind:"primitive",value:""}]})},l=c=>{i({kind:"array",elements:r.filter((u,_)=>_!==c)})},a=(c,u)=>{const _=[...r];_[c]=u,i({kind:"array",elements:_})},o={name:"",type:e,optional:!1};return h.jsxs("div",{style:{border:"1px solid var(--proppy-border, #ddd)",borderRadius:"4px",padding:"8px",background:"var(--proppy-container-bg, #fafafa)"},children:[h.jsxs("div",{style:{marginBottom:"8px",fontSize:"11px",color:"var(--proppy-text-secondary, #666)"},children:["Array of ",e.syntax," (",r.length," item",r.length!==1?"s":"",")"]}),r.map((c,u)=>h.jsxs("div",{style:{display:"flex",gap:"4px",marginBottom:"4px"},children:[h.jsx("div",{style:{flex:1},children:h.jsx(tn,{propDef:o,value:c,onChange:_=>a(u,_),plugins:s})}),h.jsx("button",{onClick:()=>l(u),style:{padding:"4px 8px",background:"var(--proppy-danger-bg, #fee)",color:"var(--proppy-danger-color, inherit)",border:"1px solid var(--proppy-danger-border, #fcc)",borderRadius:"3px",cursor:"pointer",fontSize:"12px"},children:"✕"})]},u)),h.jsx("button",{onClick:n,style:{width:"100%",padding:"6px",background:"var(--proppy-button-bg, #f0f0f0)",color:"var(--proppy-button-color, inherit)",border:"1px solid var(--proppy-border, #ddd)",borderRadius:"3px",cursor:"pointer",fontSize:"12px",marginTop:"4px"},children:"+ Add Item"})]})}function vv({types:e,value:t,onChange:i,plugins:s}){const r=(t==null?void 0:t.kind)==="tuple"?t.elements:[],n=(l,a)=>{const o=[...r];o[l]=a,i({kind:"tuple",elements:o})};return h.jsxs("div",{style:{border:"1px solid var(--proppy-border, #ddd)",borderRadius:"4px",padding:"8px",background:"var(--proppy-container-bg, #fafafa)"},children:[h.jsxs("div",{style:{marginBottom:"8px",fontSize:"11px",color:"var(--proppy-text-secondary, #666)"},children:["Tuple [",e.map(l=>l.syntax).join(", "),"]"]}),e.map((l,a)=>{const o={name:`[${a}]`,type:l,optional:!1};return h.jsxs("div",{style:{marginBottom:"8px"},children:[h.jsxs("label",{style:{display:"block",fontSize:"11px",marginBottom:"2px",fontWeight:500,color:"var(--proppy-text-primary, inherit)"},children:["[",a,"] ",l.syntax]}),h.jsx(tn,{propDef:o,value:r[a],onChange:c=>n(a,c),plugins:s})]},a)})]})}function Sv({discriminatedUnionInfo:e,value:t,onChange:i,plugins:s}){var _,f;const{discriminator:r,cases:n}=e,l=(t==null?void 0:t.kind)==="object"?t.properties:{},a=((_=l[r])==null?void 0:_.kind)==="primitive"?String(l[r].value):((f=n[0])==null?void 0:f.discriminatorValue)??"",o=n.find(d=>String(d.discriminatorValue)===a),c=d=>{i({kind:"object",properties:{[r]:{kind:"primitive",value:d}}})},u=(d,g)=>{const y={...l,[d]:g};i({kind:"object",properties:y})};return h.jsxs("div",{style:{border:"1px solid var(--proppy-border, #ddd)",borderRadius:"4px",padding:"8px",background:"var(--proppy-container-bg, #fafafa)",display:"flex",flexDirection:"column",gap:"8px"},children:[h.jsxs("div",{children:[h.jsxs("label",{style:{display:"block",fontSize:"11px",marginBottom:"2px",fontWeight:500,color:"var(--proppy-text-primary, inherit)"},children:[r," *"]}),h.jsx("select",{value:a,onChange:d=>c(d.target.value),style:{width:"100%",padding:"4px 6px",background:"var(--proppy-input-bg, #fff)",color:"var(--proppy-input-color, inherit)",border:"1px solid var(--proppy-border, #ddd)",borderRadius:"3px",fontSize:"12px"},children:n.map(d=>h.jsx("option",{value:String(d.discriminatorValue),children:String(d.discriminatorValue)},String(d.discriminatorValue)))})]}),o&&o.properties.length>0&&h.jsxs(h.Fragment,{children:[h.jsx("div",{style:{borderTop:"1px solid var(--proppy-border, #ddd)",margin:"4px 0"}}),o.properties.map(d=>h.jsxs("div",{children:[h.jsxs("label",{style:{display:"block",fontSize:"11px",marginBottom:"2px",fontWeight:500,color:"var(--proppy-text-primary, inherit)"},children:[d.name,d.optional?"":" *",h.jsx("span",{style:{color:"var(--proppy-text-muted, #999)",fontWeight:"normal",marginLeft:"4px"},children:d.type.syntax})]}),d.description&&h.jsx("div",{style:{fontSize:"10px",color:"var(--proppy-text-secondary, #666)",marginBottom:"2px",fontStyle:"italic"},children:d.description}),h.jsx(tn,{propDef:d,value:l[d.name],onChange:g=>u(d.name,g),plugins:s})]},d.name))]})]})}class V1{constructor(){kd(this,"segments",[""])}appendString(t){const i=this.segments[this.segments.length-1];return typeof i=="string"?this.segments[this.segments.length-1]=i+t:this.segments.push(t),this}appendToken(t){return this.segments.push({expr:t}),this.segments.push(""),this}appendSegments(t){for(const i of t)typeof i=="string"?this.appendString(i):this.appendToken(i.expr);return this}build(){return this.segments}}function I1(e){return e.some(t=>typeof t!="string")?{kind:"template",value:e}:{kind:"primitive",value:e.join("")}}function X1(e){return e.map(yv)}function yv(e){const t={name:e.name};return e.type.kind==="object"&&e.type.properties.length>0&&(t.children=e.type.properties.map(yv)),t}const ar=/[A-Za-z_$][A-Za-z0-9_$]*/y;function $1(e){const t=e.trim();if(t==="")return null;ar.lastIndex=0;const i=ar.exec(t);if(!i||i.index!==0)return null;const s=[i[0]];let r=ar.lastIndex;for(;r<t.length;)if(t[r]==="."){ar.lastIndex=r+1;const n=ar.exec(t);if(!n||n.index!==r+1)return null;s.push(n[0]),r=ar.lastIndex}else if(t[r]==="["){const n=t[r+1];if(n!=='"'&&n!=="'")return null;let l=r+2,a="";for(;l<t.length&&t[l]!==n;)a+=t[l],l++;if(l>=t.length||t[l+1]!=="]")return null;s.push(a),r=l+2}else return null;return s}function G1(e,t){let i=t,s=null;for(const r of e){if(s=i.find(n=>n.name===r)??null,!s)return null;i=s.children??[]}return s}function F1(e,t){const i=/[A-Za-z0-9_$]*$/.exec(e)[0];let s=e.slice(0,e.length-i.length);const r=/(\.|\[\s*['"]?)\s*$/.exec(s);r&&(s=s.slice(0,s.length-r[0].length));let n;if(s.trim()==="")n=t;else{const o=$1(s),c=o?G1(o,t):null;n=(c==null?void 0:c.children)??[]}const l=i.toLowerCase();return{candidates:n.filter(o=>o.name.toLowerCase().startsWith(l)),fragment:i}}function bv(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}function Z1(e){return bv(e).replace(/\n/g,"<br>")}function Q1(e){let t="";for(const i of e)if(typeof i=="string")t+=Z1(i);else{const s="${"+i.expr+"}";t+=`<span class="te-token">${bv(s)}</span>`}return t}function s_(e){const t=new V1;function i(s){if(s.nodeType===Node.TEXT_NODE)t.appendString(s.textContent??"");else if(s instanceof HTMLElement)if(s.classList.contains("te-token")){const r=s.textContent??"",n=r.match(/^(.*)\$\{(.+)\}(.*)$/s);if(n){const[,l,a,o]=n;l&&t.appendString(l),t.appendToken(a),o&&t.appendString(o)}else t.appendString(r)}else if(s.tagName==="BR")t.appendString(`
|
|
50
50
|
`);else if(s.tagName==="DIV"||s.tagName==="P"){for(const r of Array.from(s.childNodes))i(r);t.appendString(`
|
|
51
|
-
`)}else for(const r of Array.from(s.childNodes))i(r)}for(const s of Array.from(e.childNodes))i(s);return t.build()}function
|
|
52
|
-
`);return}
|
|
51
|
+
`)}else for(const r of Array.from(s.childNodes))i(r)}for(const s of Array.from(e.childNodes))i(s);return t.build()}function J1(e,t){if(e.length!==t.length)return!1;for(let i=0;i<e.length;i++){const s=e[i],r=t[i];if(typeof s=="string"||typeof r=="string"){if(s!==r)return!1}else if(s.expr!==r.expr)return!1}return!0}function eb(e){return(e==null?void 0:e.kind)==="template"?e.value:(e==null?void 0:e.kind)==="primitive"&&typeof e.value=="string"?[e.value]:[""]}function tb(e){var l;const t=window.getSelection();if(!t||t.rangeCount===0)return null;const i=t.getRangeAt(0);if(!e.contains(i.startContainer))return null;let s=0;const r=document.createTreeWalker(e,NodeFilter.SHOW_ALL);let n=r.nextNode();for(;n;){if(n===i.startContainer)return n.nodeType===Node.TEXT_NODE?s+i.startOffset:s;n.nodeType===Node.TEXT_NODE?s+=((l=n.textContent)==null?void 0:l.length)??0:n instanceof HTMLElement&&n.tagName==="BR"&&(s+=1),n=r.nextNode()}return s}function ib(e,t){var a;if(t===null)return;const i=window.getSelection();if(!i)return;let s=t;const r=document.createTreeWalker(e,NodeFilter.SHOW_ALL);let n=r.nextNode();for(;n;){if(n.nodeType===Node.TEXT_NODE){const o=((a=n.textContent)==null?void 0:a.length)??0;if(s<=o){const c=document.createRange();c.setStart(n,s),c.collapse(!0),i.removeAllRanges(),i.addRange(c);return}s-=o}else if(n instanceof HTMLElement&&n.tagName==="BR"){if(s<=1){const o=n.parentNode;if(!o)return;const c=Array.from(o.childNodes).indexOf(n),u=document.createRange();u.setStart(o,c+1),u.collapse(!0),i.removeAllRanges(),i.addRange(u);return}s-=1}n=r.nextNode()}const l=document.createRange();l.selectNodeContents(e),l.collapse(!1),i.removeAllRanges(),i.addRange(l)}function hc(e,t,i){var l;let s=0;const r=document.createTreeWalker(e,NodeFilter.SHOW_ALL);let n=r.nextNode();for(;n;){if(n===t)return s+(n.nodeType===Node.TEXT_NODE?i:0);n.nodeType===Node.TEXT_NODE?s+=((l=n.textContent)==null?void 0:l.length)??0:n instanceof HTMLElement&&n.tagName==="BR"&&(s+=1),n=r.nextNode()}return s}function fn(e){const t=window.getSelection();if(!t||t.rangeCount===0)return null;const i=t.getRangeAt(0);if(!i.collapsed)return null;const s=i.startContainer;if(s.nodeType!==Node.TEXT_NODE||!e.contains(s))return null;let r=s;for(;r&&r!==e;){if(r instanceof HTMLElement&&r.classList.contains("te-token"))return null;r=r.parentNode}const n=s.textContent??"",l=i.startOffset,a=n.slice(0,l),o=a.lastIndexOf("${");if(o===-1||a.slice(o+2).includes("}"))return null;const c=n.slice(l),u=c.indexOf("}"),_=c.indexOf("${");return u!==-1&&(_===-1||u<_)?null:{node:s,dollarOffset:o,caret:l,activeExpr:a.slice(o+2)}}function sb(e){const t=window.getSelection();if(t&&t.rangeCount){const s=t.getRangeAt(0),r=s.getClientRects(),n=r.length?r[0]:s.getBoundingClientRect();if(n&&(n.left||n.top||n.bottom))return{left:n.left,top:n.top,bottom:n.bottom}}const i=e.getBoundingClientRect();return{left:i.left,top:i.top,bottom:i.bottom}}const rb=new Set(["ArrowUp","ArrowDown","Enter","Tab","Escape"]);function nb(e,t){return e.length!==t.length?!1:e.every((i,s)=>{const r=t[s];return i.kind!==r.kind?!1:i.kind==="identifier"&&r.kind==="identifier"?i.node.name===r.node.name:!0})}function _d({value:e,onChange:t,propDef:i,className:s,placeholder:r,readOnly:n,onBlur:l}){const a=i.interpolatables??[],o=eb(e),c=k.useRef(null),u=k.useRef(o),_=k.useRef(!1),f=k.useRef(null),[d,g]=k.useState(null),y=(A,x)=>{if(!c.current)return;const C=x?tb(c.current):null,B=Q1(A);c.current.innerHTML!==B&&(c.current.innerHTML=B,x&&ib(c.current,C))};k.useLayoutEffect(()=>{y(o,!1)},[]),k.useEffect(()=>{!J1(o,u.current)&&c.current&&(u.current=o,y(o,!0))},[o]);const w=A=>{u.current=A,t(I1(A))},m=()=>{const A=c.current;if(!A)return;const x=fn(A);if(!x){f.current=null,_.current=!1,g(null);return}const C=hc(A,x.node,x.dollarOffset);if(f.current===C){g(null);return}f.current=null;const{candidates:B,fragment:D}=F1(x.activeExpr,a),b=B.length?[...B.map(E=>({kind:"identifier",node:E})),{kind:"insert-literal"}]:[{kind:"insert-token"},{kind:"insert-literal"}],N=sb(A);g(E=>{const V=E&&nb(E.items,b)?Math.min(E.index,b.length-1):0;return{items:b,index:V,fragmentLen:D.length,left:N.left,top:N.bottom}})},p=(A,x="")=>{const C=c.current,B=fn(C);if(!B)return;if(A.trim()===""){document.execCommand("insertText",!1,"}"+x),_.current=!1,f.current=null,g(null);return}const D=document.createRange();D.setStart(B.node,B.dollarOffset),D.setEnd(B.node,B.caret),D.deleteContents();const b=document.createElement("span");b.className="te-token",b.textContent="${"+A+"}",D.insertNode(b);const N=window.getSelection(),E=document.createRange();if(x){const V=document.createTextNode(x);b.parentNode.insertBefore(V,b.nextSibling),E.setStart(V,x.length)}else E.setStartAfter(b);E.collapse(!0),N&&(N.removeAllRanges(),N.addRange(E)),w(s_(C)),_.current=!1,f.current=null,g(null)},v=(A="")=>{const x=c.current;if(!x)return!1;const C=fn(x);return!C||C.activeExpr.trim()===""||f.current===hc(x,C.node,C.dollarOffset)?!1:(p(C.activeExpr,A),!0)},S=(A,x,C)=>{const B=window.getSelection();if(B&&B.rangeCount){const D=B.getRangeAt(0),b=document.createRange();b.setStart(D.startContainer,Math.max(0,D.startOffset-x)),b.setEnd(D.startContainer,D.startOffset),B.removeAllRanges(),B.addRange(b)}document.execCommand("insertText",!1,A.name),f.current=null,C?v():_.current=!0},T=(A,x,C)=>{if(A.kind==="identifier")S(A.node,x,C);else if(A.kind==="insert-token"){const B=fn(c.current);p((B==null?void 0:B.activeExpr)??"")}else{const B=c.current,D=fn(B);f.current=D?hc(B,D.node,D.dollarOffset):null,_.current=!1,g(null)}},j=()=>{const A=s_(c.current);y(A,!0),w(A),m()},O=A=>{A.preventDefault(),document.execCommand("insertText",!1,A.clipboardData.getData("text/plain"))},L=A=>{const x=A.key.length===1&&!A.ctrlKey&&!A.metaKey&&!A.altKey;if(d){const C=d.items.length;if(A.key==="ArrowDown"){A.preventDefault(),g({...d,index:(d.index+1)%C});return}if(A.key==="ArrowUp"){A.preventDefault(),g({...d,index:(d.index-1+C)%C});return}if(A.key==="Escape"){A.preventDefault(),g(null);return}if(A.key==="Enter"){A.preventDefault(),T(d.items[d.index],d.fragmentLen,!0);return}if(A.key==="Tab"){A.preventDefault(),T(d.items[d.index],d.fragmentLen,!1);return}}if(A.key==="}"){v()&&A.preventDefault();return}if(A.key===" "&&_.current&&v(" ")){A.preventDefault();return}if(A.key==="Enter"){A.preventDefault(),v()||document.execCommand("insertText",!1,`
|
|
52
|
+
`);return}x&&(_.current=!1)},U=A=>{rb.has(A.key)||m()},Y=()=>{g(null),_.current=!1,l==null||l()};return h.jsxs(h.Fragment,{children:[h.jsx("div",{ref:c,contentEditable:!n,suppressContentEditableWarning:!0,className:s,"data-placeholder":r,onInput:j,onPaste:O,onKeyDown:L,onKeyUp:U,onMouseUp:m,onBlur:Y,style:s?void 0:{width:"100%",padding:"4px 6px",background:"var(--proppy-input-bg, #fff)",color:"var(--proppy-input-color, inherit)",border:"1px solid var(--proppy-border, #ddd)",borderRadius:"3px",fontSize:"12px",minHeight:"24px",outline:"none",whiteSpace:"pre-wrap",wordBreak:"break-word"}}),d&&h.jsx("ul",{className:"te-suggest",style:{position:"fixed",left:d.left,top:d.top+4,zIndex:9999,margin:0,padding:4,listStyle:"none",minWidth:160,maxHeight:240,overflowY:"auto",background:"var(--proppy-menu-bg, #fff)",color:"var(--proppy-menu-color, inherit)",border:"1px solid var(--proppy-border, #ddd)",borderRadius:6,boxShadow:"0 4px 16px rgba(0,0,0,0.16)",fontSize:13},children:d.items.map((A,x)=>{var D;const C=A.kind!=="identifier",B=A.kind==="identifier"?A.node.name+((D=A.node.children)!=null&&D.length?" ›":""):A.kind==="insert-token"?"Insert token":"Insert as literal text";return h.jsx("li",{className:"te-suggest-item"+(x===d.index?" active":"")+(C?" te-suggest-action":""),onMouseDown:b=>{var E;b.preventDefault();const N=!(A.kind==="identifier"&&((E=A.node.children)!=null&&E.length));T(A,d.fragmentLen,N)},onMouseEnter:()=>g(b=>b&&{...b,index:x}),style:{padding:"4px 8px",borderRadius:4,cursor:"pointer",fontStyle:C?"italic":"normal",borderTop:C&&x>0&&d.items[x-1].kind==="identifier"?"1px solid var(--proppy-border, #eee)":void 0,background:x===d.index?"var(--proppy-menu-active-bg, #eef)":"transparent"},children:B},A.kind==="identifier"?A.node.name:A.kind)})})]})}function tn({value:e,onChange:t,propDef:i,plugins:s,className:r}){var a;const{type:n}=i;if(s){for(const o of s)if(o.match(n)){const c=o.component;return h.jsx(c,{propDef:i,value:e,onChange:t})}}if((e==null?void 0:e.kind)==="template"||n.syntax==="string"&&((a=i.interpolatables)!=null&&a.length))return h.jsx(_d,{propDef:i,value:e,onChange:t,className:r});if(n.kind==="function")return h.jsx(Y1,{propDef:i,value:e,onChange:t});if(n.kind==="array")return h.jsx(gv,{elementType:n.elementType,value:e,onChange:t,plugins:s});if(n.kind==="tuple")return h.jsx(vv,{types:n.types,value:e,onChange:t,plugins:s});const l=_v(n);return l?h.jsx(Sv,{discriminatedUnionInfo:l,value:e,onChange:t,plugins:s}):n.kind==="union"&&n.types.every(o=>o.kind==="constant")?h.jsx(pv,{propDef:i,value:e,onChange:t,className:r}):n.syntax==="Date"?h.jsx(W1,{propDef:i,value:e,onChange:t}):n.syntax==="string"?h.jsx(U1,{propDef:i,value:e,onChange:t,className:r}):n.syntax==="number"?h.jsx(q1,{propDef:i,value:e,onChange:t,className:r}):n.syntax==="boolean"?h.jsx(P1,{propDef:i,value:e,onChange:t,className:r}):n.kind==="object"&&n.properties.length>0?h.jsx(mv,{properties:n.properties,value:e,onChange:t,plugins:s}):h.jsx(fd,{propDef:i,value:e,onChange:t,className:r})}function lb({propType:e,value:t,onChange:i,plugins:s}){const r={name:"",type:e,optional:!1};if(e.kind==="array")return h.jsx(gv,{elementType:e.elementType,value:t,onChange:i,plugins:s});if(e.kind==="tuple")return h.jsx(vv,{types:e.types,value:t,onChange:i,plugins:s});const n=_v(e);return n?h.jsx(Sv,{discriminatedUnionInfo:n,value:t,onChange:i,plugins:s}):e.kind==="union"&&e.types.every(l=>l.kind==="constant")?h.jsx(pv,{propDef:r,value:t,onChange:i}):e.kind==="object"&&e.properties.length>0?h.jsx(mv,{properties:e.properties,value:t,onChange:i,plugins:s}):h.jsx(fd,{propDef:r,value:t,onChange:i})}function r_(e){const{type:t}=e;return t.kind==="union"&&t.types.every(i=>i.kind==="constant")||t.kind==="function"?!1:t.kind==="object"||t.kind==="union"||t.kind==="array"||t.kind==="tuple"}function ab({props:e,onChange:t,plugins:i}){const[s,r]=k.useState({}),n=c=>{r(u=>({...u,[c]:!u[c]}))},{definitions:l,values:a}=e,o=c=>{const u=r_(c),_=s[c.name],f=a==null?void 0:a[c.name];return u?_?h.jsx(fd,{propDef:c,value:f,onChange:d=>t(c.name,d)}):h.jsx(lb,{propType:c.type,value:f,onChange:d=>t(c.name,d),plugins:i}):h.jsx(tn,{propDef:c,value:f,onChange:d=>t(c.name,d),plugins:i})};return h.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"12px"},children:l.length>0?l.map(c=>{const u=r_(c),_=s[c.name];return h.jsxs("div",{children:[h.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"4px",flexWrap:"wrap",gap:"4px"},children:[h.jsxs("label",{style:{fontSize:"12px",fontWeight:500,color:"var(--proppy-text-primary, inherit)"},children:[c.name,c.optional?"":" *",h.jsx("span",{style:{color:"var(--proppy-text-muted, #999)",fontWeight:"normal",marginLeft:"4px"},children:c.type.syntax})]}),u&&h.jsx("button",{onClick:()=>n(c.name),style:{fontSize:"10px",padding:"2px 6px",background:"var(--proppy-button-bg, #f5f5f5)",color:"var(--proppy-button-color, inherit)",border:"1px solid var(--proppy-border, #ddd)",borderRadius:"3px",cursor:"pointer"},children:_?"Rich Editor":"JSON"})]}),c.description&&h.jsx("div",{style:{fontSize:"11px",color:"var(--proppy-text-secondary, #666)",marginBottom:"4px",fontStyle:"italic"},children:c.description}),o(c)]},c.name)}):h.jsx("p",{style:{fontSize:"12px",color:"var(--proppy-text-muted, #999)"},children:"No props defined"})})}async function da(e,t){var i;switch(e.kind){case"primitive":return e.value;case"template":{let s="";for(const r of e.value){if(typeof r=="string"){s+=r;continue}const n=ob(r.expr);if(!n.found)throw new Error(`Variable '${r.expr}' not found in scope for template string`);s+=String(n.value)}return s}case"object":{const s=await Promise.all(Object.entries(e.properties).map(async([r,n])=>[r,await da(n,t)]));return Object.fromEntries(s)}case"array":case"tuple":return Promise.all(e.elements.map(s=>da(s,t)));case"lambda":return new Function(...e.parameters,e.body);case"functionCall":{const s=((i=e.binding)==null?void 0:i.kind)==="import"?e.binding.spec:void 0;let r,n;if(!s)r=t==null?void 0:t[e.callee],n="scope";else{const a=await import(s.from);r=s.isDefault?a.default:a[s.name],n=s.from}if(typeof r!="function")throw new Error(`${(s==null?void 0:s.name)??e.callee} from '${n}' is not a function`);const l=await Promise.all(e.args.map(a=>da(a,t)));return r(...l)}case"raw":throw new Error("Cannot materialize raw value")}}function ob(e,t){return{found:!1}}function cb(e){return e.kind!=="raw"&&!(e.kind==="functionCall"&&!e.binding)}function hb(e){return!!e&&typeof e=="object"&&"kind"in e}function Yn(e,t){if(t===void 0)return e===void 0;if(!hb(e))return!1;switch(t.kind){case"primitive":case"template":return e.kind===t.kind&&e.value===t.value;case"functionCall":return e.kind==="functionCall"&&e.callee===t.callee&&e.args.length===t.args.length&&e.args.every((i,s)=>Yn(i,t.args[s]));case"lambda":return e.kind==="lambda"&&e.parameters.join(",")===t.parameters.join(",")&&e.body===t.body;case"object":{if(e.kind!=="object")return!1;const i=Object.keys(e.properties),s=Object.keys(t.properties);return i.length===s.length&&i.every(r=>r in t.properties&&Yn(e.properties[r],t.properties[r]))}case"array":case"tuple":return e.kind===t.kind&&e.elements.length===t.elements.length&&e.elements.every((i,s)=>Yn(i,t.elements[s]));case"raw":return e.kind==="raw"&&e.sourceText===t.sourceText;default:return!1}}const ub=`<!-- SPDX-License-Identifier: AGPL-3.0-only -->
|
|
53
53
|
<!-- Copyright (c) 2026 Alexander Corrado -->
|
|
54
54
|
|
|
55
55
|
<svg width="1em" height="1em" stroke-linejoin="round" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg">
|
|
@@ -57,7 +57,7 @@ Error generating stack: `+s.message+`
|
|
|
57
57
|
<path d="M11.375 0h-2.411L13.352 11.13h2.411L11.375 0ZM4.4 0 0 11.13h2.46l0.9-2.336h4.604l0.9 2.336h2.46L6.924 0H4.4Zm-0.244 6.723 1.506-3.909 1.506 3.909H4.156Z" fill="#d97706"/>
|
|
58
58
|
</g>
|
|
59
59
|
</svg>
|
|
60
|
-
`,
|
|
60
|
+
`,db=`<!-- SPDX-License-Identifier: AGPL-3.0-only -->
|
|
61
61
|
<!-- Copyright (c) 2026 Alexander Corrado -->
|
|
62
62
|
|
|
63
63
|
<svg width="1em" height="1em" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
@@ -66,21 +66,21 @@ Error generating stack: `+s.message+`
|
|
|
66
66
|
<path d="M5.84 14.09A6.68 6.68 0 0 1 5.5 12c0-.72.13-1.43.34-2.09V7.07H2.18A11 11 0 0 0 1 12c0 1.78.42 3.46 1.18 4.93l3.66-2.84Z" fill="#FBBC05"/>
|
|
67
67
|
<path d="M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53Z" fill="#EA4335"/>
|
|
68
68
|
</svg>
|
|
69
|
-
`,
|
|
69
|
+
`,fb=`<!-- SPDX-License-Identifier: AGPL-3.0-only -->
|
|
70
70
|
<!-- Copyright (c) 2026 Alexander Corrado -->
|
|
71
71
|
|
|
72
72
|
<svg width="1em" height="1em" stroke-linejoin="round" viewBox="0 0 16 16" class="pg-openai-icon" xmlns="http://www.w3.org/2000/svg">
|
|
73
73
|
<path d="M14.9449 6.54871C15.3128 5.45919 15.1861 4.26567 14.5978 3.27464C13.7131 1.75461 11.9345 0.972595 10.1974 1.3406C9.42464 0.481584 8.3144 -0.00692594 7.15045 7.42132e-05C5.37487 -0.00392587 3.79946 1.1241 3.2532 2.79113C2.11256 3.02164 1.12799 3.72615 0.551837 4.72468C-0.339497 6.24071 -0.1363 8.15175 1.05451 9.45178C0.686626 10.5413 0.813308 11.7348 1.40162 12.7258C2.28637 14.2459 4.06498 15.0279 5.80204 14.6599C6.5743 15.5189 7.68504 16.0074 8.849 15.9999C10.6256 16.0044 12.2015 14.8754 12.7478 13.2069C13.8884 12.9764 14.873 12.2718 15.4491 11.2733C16.3394 9.75728 16.1357 7.84774 14.9454 6.54771L14.9449 6.54871ZM8.85001 14.9544C8.13907 14.9554 7.45043 14.7099 6.90468 14.2604C6.92951 14.2474 6.97259 14.2239 7.00046 14.2069L10.2293 12.3668C10.3945 12.2743 10.4959 12.1008 10.4949 11.9133V7.42173L11.8595 8.19925C11.8742 8.20625 11.8838 8.22025 11.8858 8.23625V11.9558C11.8838 13.6099 10.5263 14.9509 8.85001 14.9544ZM2.32133 12.2028C1.9651 11.5958 1.8369 10.8843 1.95902 10.1938C1.98284 10.2078 2.02489 10.2333 2.05479 10.2503L5.28366 12.0903C5.44733 12.1848 5.65003 12.1848 5.81421 12.0903L9.75604 9.84429V11.3993C9.75705 11.4153 9.74945 11.4308 9.73678 11.4408L6.47295 13.3004C5.01915 14.1264 3.1625 13.6354 2.32184 12.2028H2.32133ZM1.47155 5.24819C1.82626 4.64017 2.38619 4.17516 3.05305 3.93366C3.05305 3.96116 3.05152 4.00966 3.05152 4.04366V7.72424C3.05051 7.91124 3.15186 8.08475 3.31654 8.17725L7.25838 10.4228L5.89376 11.2003C5.88008 11.2093 5.86285 11.2108 5.84765 11.2043L2.58331 9.34327C1.13255 8.51426 0.63494 6.68272 1.47104 5.24869L1.47155 5.24819ZM12.6834 7.82274L8.74157 5.57669L10.1062 4.79968C10.1199 4.79068 10.1371 4.78918 10.1523 4.79568L13.4166 6.65522C14.8699 7.48373 15.3681 9.31827 14.5284 10.7523C14.1732 11.3593 13.6138 11.8243 12.9474 12.0663V8.27575C12.9489 8.08875 12.8481 7.91574 12.6839 7.82274H12.6834ZM14.0414 5.8057C14.0176 5.7912 13.9756 5.7662 13.9457 5.7492L10.7168 3.90916C10.5531 3.81466 10.3504 3.81466 10.1863 3.90916L6.24442 6.15521V4.60017C6.2434 4.58417 6.251 4.56867 6.26367 4.55867L9.52751 2.70063C10.9813 1.87311 12.84 2.36563 13.6781 3.80066C14.0323 4.40667 14.1605 5.11618 14.0404 5.8057H14.0414ZM5.50257 8.57726L4.13744 7.79974C4.12275 7.79274 4.11312 7.77874 4.11109 7.76274V4.04316C4.11211 2.38713 5.47368 1.0451 7.15197 1.0461C7.86189 1.0461 8.54902 1.2921 9.09476 1.74011C9.06993 1.75311 9.02737 1.77661 8.99899 1.79361L5.77012 3.63365C5.60493 3.72615 5.50358 3.89916 5.50459 4.08666L5.50257 8.57626V8.57726ZM6.24391 7.00022L7.99972 5.9997L9.75553 6.99972V9.00027L7.99972 10.0003L6.24391 9.00027V7.00022Z" fill="currentColor"/>
|
|
74
74
|
</svg>
|
|
75
|
-
`,
|
|
75
|
+
`,_b=`<!-- SPDX-License-Identifier: AGPL-3.0-only -->
|
|
76
76
|
<!-- Copyright (c) 2026 Alexander Corrado -->
|
|
77
77
|
|
|
78
78
|
<svg viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg">
|
|
79
79
|
<rect class="vercel-square" width="100" height="100"/>
|
|
80
80
|
<path class="vercel-triangle" d="M50 28 76 72 24 72Z"/>
|
|
81
81
|
</svg>
|
|
82
|
-
`;function
|
|
83
|
-
`):[],a=l.length>1;return h.jsxs("div",{className:"pg-panel-card",children:[h.jsxs("div",{className:"pg-msg-header",style:{alignItems:"flex-start"},children:[h.jsxs("div",{style:{flex:1,minWidth:0},children:[h.jsx("span",{className:"pg-role-label",children:e.name}),l.length>0&&h.jsxs("div",{className:"pg-param-description",children:[r?e.description:l[0],a&&h.jsx("button",{type:"button",className:"pg-desc-toggle",onClick:()=>n(o=>!o),children:r?"less":"more"})]})]}),h.jsx("button",{type:"button",className:"pg-delete-msg",onClick:i,title:"Remove parameter",children:"×"})]}),h.jsx("div",{className:"pg-param-input-inline",children:h.jsx(Jr,{propDef:e,value:t,onChange:s,className:"pg-param-input"})})]})}function mb({prompt:e,modelParameters:t,addableParams:i,onUpdate:s,onClose:r}){return h.jsx("div",{className:"pg-modal-backdrop",onClick:r,children:h.jsxs("div",{className:"pg-modal",onClick:n=>n.stopPropagation(),children:[h.jsxs("div",{className:"pg-modal-header",children:[h.jsx("span",{className:"pg-modal-title",children:"Model settings"}),h.jsx("button",{type:"button",className:"pg-delete-msg",onClick:r,title:"Close",children:"×"})]}),h.jsx("div",{className:"pg-modal-body",children:e.modelParameters.length===0?h.jsx("div",{className:"pg-modal-empty",children:"No settings configured."}):e.modelParameters.map(n=>{const l=t.find(a=>a.name===n.def.name);return l?h.jsx(pb,{propDef:l,value:n.value,onDelete:()=>s({modelParameters:{[n.def.name]:null}}),onChange:a=>s({modelParameters:{[n.def.name]:a}})},n.def.name):h.jsxs("div",{className:"pg-panel-card",children:[h.jsxs("div",{className:"pg-msg-header",children:[h.jsx("span",{className:"pg-role-label",children:n.def.name}),n.value&&eb(n.value)&&h.jsx("button",{type:"button",className:"pg-delete-msg",onClick:()=>s({modelParameters:{[n.def.name]:null}}),title:"Remove",children:"×"})]}),h.jsx("div",{className:"pg-msg-content",style:{fontSize:13,color:"#9ca3af"},children:n.value!==void 0?Ia(n.value):""})]},n.def.name)})}),i.length>0&&h.jsx("div",{className:"pg-modal-footer",children:h.jsxs("div",{className:"pg-pill-btn pg-add-param-btn",children:["+ Add setting",h.jsxs("select",{className:"pg-model-overlay-select",value:"",onChange:n=>{if(!n.target.value)return;const l=i.find(a=>a.name===n.target.value);l&&s({modelParameters:{[l.name]:l.defaultValue??lv(l.type)}})},children:[h.jsx("option",{value:"",children:"Choose…"}),i.map(n=>h.jsx("option",{value:n.name,children:n.name},n.name))]})]})})]})})}function gb({prompt:e,onUpdate:t,modelCatalog:i}){const[s,r]=cd(e.messages),[n,l]=D.useState([]),[a,o]=D.useState(!1);D.useEffect(()=>{e.providerId&&Cy(e.providerId).then(l).catch(()=>{})},[e.providerId]);const c=D.useRef(null),_=D.useRef(null),f=m=>{r(m),c.current&&clearTimeout(c.current),c.current=setTimeout(()=>t({messages:m}),600)},u=m=>{_.current&&clearTimeout(_.current),_.current=setTimeout(()=>t({system:m}),600)},d=()=>{var S;const m=s[s.length-1];let p="user";(m==null?void 0:m.role)==="user"?p="assistant":(m==null?void 0:m.role)==="assistant"&&((S=m.toolCalls)!=null&&S.length)&&(p="tool");const v=[...s,{role:p,content:{kind:"primitive",value:""}}];r(v),t({messages:v})},g=new Set(e.modelParameters.map(m=>m.def.name)),y=i.models.length>0?n.filter(m=>!g.has(m.name)):[],C=D.useMemo(()=>({...db,interpolatables:Hy(e.functionParameters)}),[e.functionParameters]);return h.jsxs("div",{className:"pg-editor",children:[a&&h.jsx(mb,{prompt:e,modelParameters:n,addableParams:y,onUpdate:t,onClose:()=>o(!1)}),h.jsx("div",{className:"pg-panel",children:h.jsxs("div",{className:"pg-panel-model-row",children:[h.jsx(cb,{value:e.model,onChange:m=>t({model:m}),modelCatalog:i}),h.jsxs("div",{className:"pg-panel-model-row-actions",children:[h.jsx("button",{type:"button",className:"pg-pill-btn",onClick:()=>o(!0),children:"Settings"}),h.jsx("button",{type:"button",className:"pg-pill-btn",disabled:!0,children:"Tools"}),h.jsx("button",{type:"button",className:"pg-pill-btn",children:"Output type: Text ▾"})]})]})}),h.jsxs("div",{className:"pg-panel",children:[h.jsxs("div",{className:"pg-panel-body",children:[h.jsx(fb,{content:e.system,editable:e.systemEditable,propDef:C,onChange:u}),s.map((m,p)=>h.jsx(_b,{msg:m,propDef:C,onChange:v=>f(s.map((S,k)=>k===p?v:S)),onDelete:()=>f(s.filter((v,S)=>S!==p))},p))]}),h.jsx("div",{className:"pg-panel-footer",children:h.jsx("button",{type:"button",className:"pg-add-msg-btn",onClick:d,children:"+ Add message"})})]})]})}function vb({prompt:e,onExecuted:t}){const[i,s]=D.useState({}),[r,n]=D.useState(!1),[l,a]=D.useState(null),o=(u,d)=>{s(g=>({...g,[u]:d}))},c=async()=>{const u=[];for(const d of e.functionParameters){const g=i[d.name]??d.defaultValue;if(g===void 0){if(!d.optional)return a(`Parameter '${d.name}' is required`),null;u.push(void 0)}else u.push(await ca(g))}return u},_=async()=>{a(null);const u=await c();if(u){n(!0);try{const d=await Ey(e,u);t==null||t({...d,label:e.name})}catch(d){a(d.message)}finally{n(!1)}}},f=e.functionParameters.length;return h.jsxs("div",{className:"pg-exec-inner",children:[h.jsxs("div",{className:"pg-exec-header",children:[h.jsx("span",{className:"pg-exec-title",children:"Execute"}),f>0&&h.jsxs("span",{className:"pg-exec-param-count",children:[f," param",f!==1?"s":""]})]}),h.jsxs("div",{className:"pg-exec-body",children:[f>0&&h.jsx(Qy,{props:{definitions:e.functionParameters,values:i},onChange:o}),l&&h.jsxs("div",{className:"pg-exec-error",children:[l,h.jsx("button",{type:"button",className:"pg-dismiss",onClick:()=>a(null),children:"×"})]})]}),h.jsx("div",{className:"pg-exec-footer",children:h.jsx("button",{type:"button",className:"pg-run-btn",onClick:_,disabled:r,children:r?"…":"▶ Run"})})]})}const Sb={models:[]};function yb({prompt:e,onUpdate:t,onDirtyChange:i,onExecuted:s}){const[r,n]=D.useState(!1),[l,a]=D.useState(null),[o,c]=D.useState(Sb);D.useEffect(()=>{i(r)},[r,i]),D.useEffect(()=>{e.providerId&&by(e.providerId).then(c).catch(()=>{})},[e.providerId]);const _=async f=>{n(!0),a(null);try{t(await xy(e,f))}catch(u){a(u.message)}finally{n(!1)}};return h.jsxs("div",{className:"pg-playground-wrapper",children:[h.jsxs("div",{className:"pg-prompt-header",children:[h.jsxs("div",{className:"pg-prompt-header-identity",children:[h.jsx("span",{className:"pg-prompt-name",children:e.name}),e.treePath&&e.treePath.length>0&&h.jsx("span",{className:"pg-prompt-path",children:e.treePath.join("/")})]}),h.jsx("div",{className:"pg-prompt-header-right",children:l&&h.jsxs("div",{className:"pg-header-error",children:[l,h.jsx("button",{type:"button",className:"pg-dismiss",onClick:()=>a(null),children:"×"})]})})]}),h.jsxs("div",{className:"pg-content",children:[h.jsx("div",{className:"pg-editor-col",children:h.jsx(gb,{prompt:e,onUpdate:_,modelCatalog:o})}),h.jsx("div",{className:"pg-exec-col",children:h.jsx(vb,{prompt:e,onExecuted:s})})]})]})}function bb(e){const t={subdirs:{},files:{}};for(const i of e){const s=i.treePath;if(!s||s.length===0){const a=i.name;t.files[a]||(t.files[a]=[]),t.files[a].push(i);continue}const r=s[s.length-1],n=s.slice(0,-1);let l=t;for(const a of n)l.subdirs[a]||(l.subdirs[a]={subdirs:{},files:{}}),l=l.subdirs[a];l.files[r]||(l.files[r]=[]),l.files[r].push(i)}return t}function pv(e){const t=[],i=Object.keys(e.subdirs).sort(),s=Object.keys(e.files).sort();for(const r of i){let n=r,l=e.subdirs[r];for(;Object.keys(l.subdirs).length===1&&Object.keys(l.files).length===0;){const[a,o]=Object.entries(l.subdirs)[0];n+="/"+a,l=o}t.push({type:"dir",label:n,children:pv(l)})}for(const r of s)t.push({type:"file",label:r,prompts:e.files[r]});return t}function mv(e,t){const i=t.toLowerCase(),s=[];for(const r of e)if(r.type==="dir"){const n=mv(r.children,t);(n.length>0||r.label.toLowerCase().includes(i))&&s.push({...r,children:n.length>0?n:r.children})}else{const n=r.label.toLowerCase().includes(i),l=r.prompts.filter(a=>a.name.toLowerCase().includes(i));n?s.push(r):l.length>0&&s.push({...r,prompts:l})}return s}function gv({expanded:e}){return h.jsx("svg",{className:"tree-disclosure",width:"8",height:"8",viewBox:"0 0 8 8",fill:"currentColor",children:e?h.jsx("path",{d:"M1 2h6L4 6.5z"}):h.jsx("path",{d:"M2 1v6L6.5 4z"})})}function Cb(){return h.jsx("svg",{className:"tree-icon",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:h.jsx("path",{d:"M22 19a2 2 0 01-2 2H4a2 2 0 01-2-2V5a2 2 0 012-2h5l2 3h9a2 2 0 012 2z"})})}function vv(){return h.jsxs("svg",{className:"tree-icon",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[h.jsx("path",{d:"M14 2H6a2 2 0 00-2 2v16a2 2 0 002 2h12a2 2 0 002-2V8z"}),h.jsx("polyline",{points:"14 2 14 8 20 8"})]})}function wb(){return h.jsxs("svg",{width:"11",height:"11",viewBox:"0 0 11 11",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round",children:[h.jsx("circle",{cx:"4.5",cy:"4.5",r:"3"}),h.jsx("line",{x1:"7",y1:"7",x2:"9.5",y2:"9.5"})]})}function xb(){return h.jsxs("svg",{width:"11",height:"11",viewBox:"0 0 11 11",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",children:[h.jsx("line",{x1:"5.5",y1:"1.5",x2:"5.5",y2:"9.5"}),h.jsx("line",{x1:"1.5",y1:"5.5",x2:"9.5",y2:"5.5"})]})}function Eb({initialValue:e,onCommit:t,onCancel:i}){const[s,r]=D.useState(e),n=D.useRef(null);return D.useEffect(()=>{var l;(l=n.current)==null||l.select()},[]),h.jsx("input",{ref:n,className:"tree-rename-input",value:s,onChange:l=>r(l.target.value),onKeyDown:l=>{l.key==="Enter"&&(l.preventDefault(),s.trim()?t(s.trim()):i()),l.key==="Escape"&&(l.preventDefault(),i())},onBlur:()=>{s.trim()&&s.trim()!==e?t(s.trim()):i()},onClick:l=>l.stopPropagation()})}function e_({prompt:e,indent:t,selectedId:i,onSelect:s,renamingId:r,onStartRename:n,onCommitRename:l,onCancelRename:a}){const o=e.id===i,c=e.id===r;return h.jsxs("div",{className:`tree-row${o?" tree-row-selected":""}`,style:{paddingLeft:t},onClick:()=>s(oa(e.providerId,`selecting prompt ${e.id}`),e.id),onDoubleClick:_=>{_.stopPropagation(),n(e.id)},title:e.name,children:[h.jsx("span",{className:"tree-icon-prompt",children:h.jsx(vv,{})}),c?h.jsx(Eb,{initialValue:e.name,onCommit:_=>l(e.id,_),onCancel:a}):h.jsxs(h.Fragment,{children:[h.jsx("span",{className:"tree-row-label",children:e.name}),e.functionParameters.length>0&&h.jsxs("span",{className:"tree-row-params",children:["(",e.functionParameters.map(_=>_.name).join(", "),")"]})]})]})}function Sv({node:e,depth:t,...i}){const[s,r]=D.useState(!0),n=e.prompts.length>1,l=t*18;return n?h.jsxs("div",{children:[h.jsxs("div",{className:"tree-row",style:{paddingLeft:10+l},onClick:()=>r(a=>!a),title:e.label,children:[h.jsx(gv,{expanded:s}),h.jsx("span",{className:"tree-icon-file",children:h.jsx(vv,{})}),h.jsx("span",{className:"tree-row-label",children:e.label})]}),s&&e.prompts.map(a=>h.jsx(e_,{prompt:a,indent:10+l+18+16,...i},a.id))]}):h.jsx(e_,{prompt:e.prompts[0],indent:10+l+14,...i})}function yv({node:e,depth:t,...i}){const[s,r]=D.useState(!0),n=t*18;return h.jsxs("div",{children:[h.jsxs("div",{className:"tree-row",style:{paddingLeft:10+n},onClick:()=>r(l=>!l),title:e.label,children:[h.jsx(gv,{expanded:s}),h.jsx("span",{className:"tree-icon-folder",children:h.jsx(Cb,{})}),h.jsx("span",{className:"tree-row-label",children:e.label})]}),s&&h.jsx("div",{children:e.children.map((l,a)=>l.type==="dir"?h.jsx(yv,{node:l,depth:t+1,...i},a):h.jsx(Sv,{node:l,depth:t+1,...i},a))})]})}function kb({prompts:e,selectedId:t,onSelect:i,loading:s,error:r,onAddPrompt:n,onRenamePrompt:l}){const[a,o]=D.useState(""),[c,_]=D.useState(!1),[f,u]=D.useState(null),d=(m,p)=>{u(null),l==null||l(m,p)},g=D.useMemo(()=>{const m=bb(e),p=pv(m);return a?mv(p,a):p},[e,a]),y=h.jsxs("div",{className:"section-panel-header",children:[h.jsx("span",{children:"Prompts"}),h.jsxs("div",{className:"section-panel-header-actions",children:[h.jsx("button",{type:"button",className:"tree-toolbar-btn",title:"Toggle search",onClick:()=>{_(m=>(m&&o(""),!m))},children:h.jsx(wb,{})}),n&&h.jsx("button",{type:"button",className:"tree-toolbar-btn",onClick:n,title:"New prompt",children:h.jsx(xb,{})})]})]}),C=c&&h.jsx("div",{className:"tree-header-search",children:h.jsx("input",{type:"text",placeholder:"Filter",value:a,onChange:m=>o(m.target.value),autoFocus:!0})});return s?h.jsxs(h.Fragment,{children:[y,C,h.jsx("div",{className:"section-panel-body",children:h.jsx("div",{className:"tree-status",children:"Loading..."})})]}):r?h.jsxs(h.Fragment,{children:[y,C,h.jsx("div",{className:"section-panel-body",children:h.jsxs("div",{className:"tree-status tree-error",children:["Error: ",r]})})]}):e.length===0?h.jsxs(h.Fragment,{children:[y,C,h.jsx("div",{className:"section-panel-body",children:h.jsxs("div",{className:"tree-empty-state",children:[h.jsx("p",{children:"No prompts found."}),n&&h.jsx("button",{type:"button",className:"tree-add-prompt-btn",onClick:n,children:"Create a prompt"})]})})]}):h.jsxs(h.Fragment,{children:[y,C,h.jsx("div",{className:"section-panel-body file-tree",children:g.map((m,p)=>m.type==="dir"?h.jsx(yv,{node:m,depth:0,selectedId:t,onSelect:i,renamingId:f,onStartRename:u,onCommitRename:d,onCancelRename:()=>u(null)},p):h.jsx(Sv,{node:m,depth:0,selectedId:t,onSelect:i,renamingId:f,onStartRename:u,onCommitRename:d,onCancelRename:()=>u(null)},p))})]})}function Tb(){return h.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[h.jsx("path",{d:"M14 2H6a2 2 0 00-2 2v16a2 2 0 002 2h12a2 2 0 002-2V8z"}),h.jsx("polyline",{points:"14 2 14 8 20 8"})]})}function Db({id:e,name:t,icon:i,active:s,dirty:r,onClick:n,onClose:l,onDragStart:a,onDragEnd:o}){return h.jsxs("button",{type:"button",id:e,title:t,className:`tab${s?" tab-active":""}`,draggable:!0,onDragStart:a,onDragEnd:o,onClick:c=>{c.stopPropagation(),n()},children:[h.jsx("span",{className:"tab-icon",children:i??h.jsx(Tb,{})}),h.jsx("span",{className:"tab-label",children:t}),r?h.jsx("span",{className:"tab-dirty",children:"●"}):h.jsx("span",{className:"tab-close",onClick:l,children:"×"})]})}/**
|
|
82
|
+
`;function Kl({icon:e,size:t}){return h.jsx("span",{style:{display:"inline-flex",width:t,height:t,fontSize:t},dangerouslySetInnerHTML:{__html:e}})}function pb({provider:e,size:t}){const i=(e==null?void 0:e.charAt(0).toUpperCase())??"";return h.jsxs("svg",{width:t,height:t,viewBox:"0 0 24 24",children:[h.jsx("circle",{cx:"12",cy:"12",r:"11",fill:"#888"}),h.jsx("text",{x:"12",y:"16.5",textAnchor:"middle",fill:"white",fontSize:"13",fontWeight:"600",fontFamily:"system-ui, sans-serif",children:i})]})}const mb={OpenAI:({size:e})=>h.jsx(Kl,{icon:fb,size:e}),Anthropic:({size:e})=>h.jsx(Kl,{icon:ub,size:e}),Google:({size:e})=>h.jsx(Kl,{icon:db,size:e}),vercel:({size:e})=>h.jsx(Kl,{icon:_b,size:e})};function Ch({provider:e,size:t=24}){const i=e?mb[e]:void 0;return i?h.jsx(i,{size:t}):h.jsx(pb,{provider:e,size:t})}function gb({size:e=12}){return h.jsx("svg",{width:e,height:e,viewBox:"0 0 12 12",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",style:{flexShrink:0,pointerEvents:"none",color:"#9ca3af"},children:h.jsx("path",{d:"M2.5 4.5L6 8L9.5 4.5"})})}function uc({size:e=14}){return h.jsx("svg",{width:e,height:e,viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",style:{flexShrink:0,color:"currentColor"},children:h.jsx("path",{d:"M2.5 7.5L5.5 10.5L11.5 4"})})}function fa(e,t){switch(e.kind){case"primitive":return typeof e.value=="string"?{kind:"primitive",value:e.value.replace("$input",t)}:e;case"functionCall":return{...e,args:e.args.map(i=>fa(i,t))};case"object":return{kind:"object",properties:Object.fromEntries(Object.entries(e.properties).map(([i,s])=>[i,fa(s,t)]))};case"array":case"tuple":return{kind:e.kind,elements:e.elements.map(i=>fa(i,t))};default:return e}}function vb({value:e,onChange:t,modelCatalog:i}){var Y,A;const[s,r]=k.useState(!1),[n,l]=k.useState({}),a=k.useRef(null),o=k.useRef(null),[c,u]=k.useState({}),{modes:_,modelsByGroup:f,selectedModel:d}=k.useMemo(()=>{const x=Object.entries(i.modelValueTypes??{});let C;const B={};for(const D of i.models){for(const[N,E]of Object.entries(D.values))!C&&Yn(e,E)&&(C={...D,mode:N});const b=D.group??"";B[b]||(B[b]=[]),B[b].push(D)}return{modes:x,modelsByGroup:B,selectedModel:C}},[i,e]),[g,y]=k.useState(d?"":(e==null?void 0:e.kind)==="primitive"&&typeof e.value=="string"?e.value:""),[w,m]=k.useState((d==null?void 0:d.mode)??(g?"string":(Y=_[0])==null?void 0:Y[0]));k.useEffect(()=>{var x;w||m((d==null?void 0:d.mode)??((x=_[0])==null?void 0:x[0]))},[(A=_[0])==null?void 0:A[0]]);const p=e?Ga(e):void 0,v=(d==null?void 0:d.label)??p??void 0,S=k.useCallback(()=>{if(!a.current)return;const x=a.current.getBoundingClientRect();u({position:"fixed",top:x.bottom+4,left:x.left,width:x.width,zIndex:9999})},[]);k.useEffect(()=>{if(!s)return;S();const x=B=>{var b,N;const D=B.target;(b=a.current)!=null&&b.contains(D)||(N=o.current)!=null&&N.contains(D)||r(!1)},C=B=>{B.key==="Escape"&&r(!1)};return document.addEventListener("mousedown",x),document.addEventListener("keydown",C),window.addEventListener("scroll",S,!0),window.addEventListener("resize",S),()=>{document.removeEventListener("mousedown",x),document.removeEventListener("keydown",C),window.removeEventListener("scroll",S,!0),window.removeEventListener("resize",S)}},[s,S]);const T=(x,C=!0)=>{t(x),C&&r(!1)},j=x=>{var D,b,N;const C=(n[x]??"").trim();if(!C)return;const B=(N=(b=(D=i.groups)==null?void 0:D[x])==null?void 0:b.customValueTemplates)==null?void 0:N[w];if(B)return fa(B,C)},O=x=>{const C=j(x);C&&T(C,!0)},L=()=>{const x=g.trim();x&&T({kind:"primitive",value:x})},U=s&&xp.createPortal(h.jsxs("div",{className:"pg-model-picker-dropdown",ref:o,style:c,children:[_.length>1&&h.jsx("div",{className:"pg-mode-toggle",children:_.map(([x,C])=>h.jsx("button",{type:"button",className:"pg-mode-btn"+(w===x?" active":""),onClick:()=>m(x),title:C.description,children:C.label},x))}),Object.entries(f).map(([x,C])=>{var D,b,N;const B=!!((N=(b=(D=i.groups)==null?void 0:D[x])==null?void 0:b.customValueTemplates)!=null&&N[w]);return h.jsxs("div",{className:"pg-provider-group",children:[h.jsxs("div",{className:"pg-provider-group-header",children:[h.jsx(Ch,{provider:x,size:16}),h.jsx("span",{children:x})]}),C.map(E=>{const V=E.id===(d==null?void 0:d.id)&&d.mode===w,F=E.values[w];return F?h.jsxs("button",{type:"button",className:"pg-model-option"+(V?" selected":""),onClick:()=>T(F),children:[h.jsx("span",{className:"pg-model-option-check",children:V&&h.jsx(uc,{size:13})}),h.jsx("span",{className:"pg-model-option-label",children:E.label}),h.jsx("span",{className:"pg-model-option-source",children:Ga(F)})]},E.id):null}),B&&h.jsxs("div",{className:"pg-custom-model-row",children:[h.jsx("span",{className:"pg-model-option-check",children:!d&&Yn(e,j(x))&&h.jsx(uc,{size:13})}),h.jsx("input",{type:"text",placeholder:"Custom model ID…",value:n[x]??"",onChange:E=>l(V=>({...V,[x]:E.target.value})),onKeyDown:E=>{E.key==="Enter"&&O(x)}}),h.jsx("button",{type:"button",className:"pg-custom-model-use",onClick:()=>O(x),children:"Use"})]})]},x)}),w==="string"&&h.jsxs("div",{className:"pg-custom-gateway-row",children:[h.jsx("span",{className:"pg-model-option-check",children:!d&&(e==null?void 0:e.kind)==="primitive"&&e.value===g&&h.jsx(uc,{size:13})}),h.jsx("input",{type:"text",placeholder:"Custom model string…",value:g,onChange:x=>y(x.target.value),onKeyDown:x=>{x.key==="Enter"&&L()}}),h.jsx("button",{type:"button",className:"pg-custom-model-use",onClick:L,children:"Use"})]})]}),document.body);return h.jsxs("div",{className:"pg-panel-card pg-model-picker",children:[h.jsxs("button",{ref:a,className:"pg-model-picker-trigger",onClick:()=>r(!s),type:"button",title:p,children:[h.jsx(Ch,{provider:d==null?void 0:d.group,size:20}),h.jsx("span",{className:`pg-model-picker-label${v?"":" pg-placeholder"}`,children:v??"Select a model…"}),e&&d&&h.jsx("span",{className:"pg-model-picker-source",children:p}),h.jsx(gb,{size:14})]}),U]})}function dc(e){return JSON.stringify(e)??"undefined"}function pd(e,t=0,i){const[s,r]=k.useState(e),n=dc(e),l=k.useRef(n),a=k.useRef(n),o=k.useRef(!1);k.useEffect(()=>{const u=dc(e);if(u!==l.current){if(i!=null&&i.current){u===a.current&&(l.current=u,o.current=!1);return}if(o.current){u===a.current&&(l.current=u,o.current=!1);return}u!==l.current&&(l.current=u,a.current=u,r(e))}},[e,t,i]);const c=k.useCallback(u=>{const _=dc(u);a.current=_,o.current=_!==l.current,r(u)},[]);return[s,c]}function Sb({size:e=12}){return h.jsx("svg",{width:e,height:e,viewBox:"0 0 12 12",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",style:{flexShrink:0,pointerEvents:"none",color:"#9ca3af"},children:h.jsx("path",{d:"M2.5 4.5L6 8L9.5 4.5"})})}function yb({toolCalls:e,onChange:t}){return h.jsxs("div",{className:"pg-tool-calls",children:[e.map((i,s)=>h.jsxs("div",{className:"pg-tool-call",children:[h.jsxs("div",{className:"pg-tool-call-header",children:[h.jsx("span",{className:"pg-tool-call-label",children:"Tool call"}),h.jsx("button",{type:"button",className:"pg-delete-msg",onClick:()=>t(e.filter((r,n)=>n!==s)),title:"Remove tool call",children:"×"})]}),h.jsxs("div",{className:"pg-tool-call-fields",children:[h.jsx("input",{className:"pg-tool-name-input",placeholder:"function_name",value:i.toolName,onChange:r=>t(e.map((n,l)=>l===s?{...n,toolName:r.target.value}:n))}),h.jsx("input",{className:"pg-tool-args-input",placeholder:'{ "key": "value" }',value:i.args,onChange:r=>t(e.map((n,l)=>l===s?{...n,args:r.target.value}:n))})]})]},s)),h.jsx("button",{type:"button",className:"pg-add-tool-call-btn",onClick:()=>t([...e,{toolName:"",args:""}]),children:"+ Tool Call"})]})}const n_={system:"System message",user:"User",assistant:"AI",tool:"Tool Result"},bb={name:"_template",type:{kind:"primitive",syntax:"string"},optional:!1};function wb({content:e,editable:t,propDef:i,syncVersion:s,syncPausedRef:r,onChange:n}){const[l,a]=pd(e,s,r),o=k.useRef(n);o.current=n;const c=k.useCallback(u=>{a(u),o.current(u)},[a]);return h.jsxs("div",{className:"pg-panel-card",children:[h.jsx("div",{className:"pg-msg-header",children:h.jsx("span",{className:"pg-role-label",children:"System message"})}),t?h.jsx(_d,{propDef:i,value:l,onChange:c,className:"token-editor",placeholder:"System message…"}):h.jsx("div",{className:`pg-msg-content${e===void 0?" pg-placeholder":""}`,children:e!==void 0?Ga(e):"System message…"})]})}const Cb=k.memo(wb,(e,t)=>t.syncPausedRef.current&&e.editable===t.editable&&e.propDef===t.propDef&&e.syncPausedRef===t.syncPausedRef);function xb({msg:e,messageIndex:t,propDef:i,onChange:s,onDelete:r}){const[n,l]=pd(e.content),a=k.useRef(e),o=k.useRef(s);a.current=e,o.current=s;const c=k.useCallback(u=>{l(u),o.current({...a.current,content:u})},[l]);return h.jsxs("div",{className:"pg-panel-card","data-message-index":t,children:[h.jsxs("div",{className:"pg-msg-header",children:[h.jsxs("div",{className:"pg-role-wrapper",children:[h.jsx("span",{className:"pg-role-label",children:n_[e.role]??e.role}),h.jsx(Sb,{size:10}),h.jsx("select",{className:"pg-role-select",value:e.role,onChange:u=>s({...e,role:u.target.value}),children:Object.entries(n_).map(([u,_])=>h.jsx("option",{value:u,children:_},u))})]}),h.jsx("button",{type:"button",className:"pg-delete-msg",onClick:r,title:"Delete",children:"×"})]}),h.jsx(_d,{propDef:i,value:n,onChange:c,className:"token-editor"}),e.role==="assistant"&&h.jsx(yb,{toolCalls:e.toolCalls??[],onChange:u=>s({...e,toolCalls:u})})]})}function Eb({propDef:e,value:t,onDelete:i,onChange:s}){const[r,n]=k.useState(!1),l=e.description?e.description.split(`
|
|
83
|
+
`):[],a=l.length>1;return h.jsxs("div",{className:"pg-panel-card",children:[h.jsxs("div",{className:"pg-msg-header",style:{alignItems:"flex-start"},children:[h.jsxs("div",{style:{flex:1,minWidth:0},children:[h.jsx("span",{className:"pg-role-label",children:e.name}),l.length>0&&h.jsxs("div",{className:"pg-param-description",children:[r?e.description:l[0],a&&h.jsx("button",{type:"button",className:"pg-desc-toggle",onClick:()=>n(o=>!o),children:r?"less":"more"})]})]}),h.jsx("button",{type:"button",className:"pg-delete-msg",onClick:i,title:"Remove parameter",children:"×"})]}),h.jsx("div",{className:"pg-param-input-inline",children:h.jsx(tn,{propDef:e,value:t,onChange:s,className:"pg-param-input"})})]})}function kb({prompt:e,modelParameters:t,addableParams:i,onUpdate:s,onClose:r}){return h.jsx("div",{className:"pg-modal-backdrop",onClick:r,children:h.jsxs("div",{className:"pg-modal",onClick:n=>n.stopPropagation(),children:[h.jsxs("div",{className:"pg-modal-header",children:[h.jsx("span",{className:"pg-modal-title",children:"Model settings"}),h.jsx("button",{type:"button",className:"pg-delete-msg",onClick:r,title:"Close",children:"×"})]}),h.jsx("div",{className:"pg-modal-body",children:e.modelParameters.length===0?h.jsx("div",{className:"pg-modal-empty",children:"No settings configured."}):e.modelParameters.map(n=>{const l=t.find(a=>a.name===n.def.name);return l?h.jsx(Eb,{propDef:l,value:n.value,onDelete:()=>s({modelParameters:{[n.def.name]:null}}),onChange:a=>s({modelParameters:{[n.def.name]:a}})},n.def.name):h.jsxs("div",{className:"pg-panel-card",children:[h.jsxs("div",{className:"pg-msg-header",children:[h.jsx("span",{className:"pg-role-label",children:n.def.name}),n.value&&cb(n.value)&&h.jsx("button",{type:"button",className:"pg-delete-msg",onClick:()=>s({modelParameters:{[n.def.name]:null}}),title:"Remove",children:"×"})]}),h.jsx("div",{className:"pg-msg-content",style:{fontSize:13,color:"#9ca3af"},children:n.value!==void 0?Ga(n.value):""})]},n.def.name)})}),i.length>0&&h.jsx("div",{className:"pg-modal-footer",children:h.jsxs("div",{className:"pg-pill-btn pg-add-param-btn",children:["+ Add setting",h.jsxs("select",{className:"pg-model-overlay-select",value:"",onChange:n=>{if(!n.target.value)return;const l=i.find(a=>a.name===n.target.value);l&&s({modelParameters:{[l.name]:l.defaultValue??fv(l.type)}})},children:[h.jsx("option",{value:"",children:"Choose…"}),i.map(n=>h.jsx("option",{value:n.name,children:n.name},n.name))]})]})})]})})}function Tb({prompt:e,onUpdate:t,modelCatalog:i}){const s=k.useRef(!1),r=k.useRef(null),n=k.useRef(null),[l,a]=k.useState(0),[o,c]=pd(e.messages),[u,_]=k.useState([]),[f,d]=k.useState(!1),g=()=>{s.current=!0},y=L=>{L.currentTarget.contains(L.relatedTarget)||(s.current=!1,a(U=>U+1))};k.useEffect(()=>{e.providerId&&B1(e.providerId).then(_).catch(()=>{})},[e.providerId]);const w=k.useRef(null),m=k.useRef(null),p=L=>{c(L),w.current&&clearTimeout(w.current),w.current=setTimeout(()=>t({messages:L}),600)},v=L=>{m.current&&clearTimeout(m.current),m.current=setTimeout(()=>t({system:L}),600)},S=()=>{var A;const L=o[o.length-1];let U="user";(L==null?void 0:L.role)==="user"?U="assistant":(L==null?void 0:L.role)==="assistant"&&((A=L.toolCalls)!=null&&A.length)&&(U="tool");const Y=[...o,{role:U,content:{kind:"primitive",value:""}}];n.current=Y.length-1,c(Y),t({messages:Y})};k.useLayoutEffect(()=>{var U,Y;const L=n.current;L===null||L>=o.length||(n.current=null,(Y=(U=r.current)==null?void 0:U.querySelector(`[data-message-index="${L}"] .token-editor`))==null||Y.focus())},[o.length]);const T=new Set(e.modelParameters.map(L=>L.def.name)),j=i.models.length>0?u.filter(L=>!T.has(L.name)):[],O=k.useMemo(()=>({...bb,interpolatables:X1(e.functionParameters)}),[e.functionParameters]);return h.jsxs("div",{className:"pg-editor",children:[f&&h.jsx(kb,{prompt:e,modelParameters:u,addableParams:j,onUpdate:t,onClose:()=>d(!1)}),h.jsx("div",{className:"pg-panel",children:h.jsxs("div",{className:"pg-panel-model-row",children:[h.jsx(vb,{value:e.model,onChange:L=>t({model:L}),modelCatalog:i}),h.jsxs("div",{className:"pg-panel-model-row-actions",children:[h.jsx("button",{type:"button",className:"pg-pill-btn",onClick:()=>d(!0),children:"Settings"}),h.jsx("button",{type:"button",className:"pg-pill-btn",disabled:!0,children:"Tools"}),h.jsx("button",{type:"button",className:"pg-pill-btn",children:"Output type: Text ▾"})]})]})}),h.jsxs("div",{className:"pg-panel",children:[h.jsxs("div",{ref:r,className:"pg-panel-body",onFocus:g,onBlur:y,children:[h.jsx(Cb,{content:e.system,editable:e.systemEditable,propDef:O,syncVersion:l,syncPausedRef:s,onChange:v}),o.map((L,U)=>h.jsx(xb,{msg:L,messageIndex:U,propDef:O,onChange:Y=>p(o.map((A,x)=>x===U?Y:A)),onDelete:()=>p(o.filter((Y,A)=>A!==U))},U))]}),h.jsx("div",{className:"pg-panel-footer",children:h.jsx("button",{type:"button",className:"pg-add-msg-btn",onClick:S,children:"+ Add message"})})]})]})}const Db=k.memo(Tb);function Mb({prompt:e,onExecuted:t}){const[i,s]=k.useState({}),[r,n]=k.useState(!1),[l,a]=k.useState(null),o=(f,d)=>{s(g=>({...g,[f]:d}))},c=async()=>{const f=[];for(const d of e.functionParameters){const g=i[d.name]??d.defaultValue;if(g===void 0){if(!d.optional)return a(`Parameter '${d.name}' is required`),null;f.push(void 0)}else f.push(await da(g))}return f},u=async()=>{a(null);const f=await c();if(f){n(!0);try{const d=await O1(e,f);t==null||t({...d,label:e.name})}catch(d){a(d.message)}finally{n(!1)}}},_=e.functionParameters.length;return h.jsxs("div",{className:"pg-exec-inner",children:[h.jsxs("div",{className:"pg-exec-header",children:[h.jsx("span",{className:"pg-exec-title",children:"Execute"}),_>0&&h.jsxs("span",{className:"pg-exec-param-count",children:[_," param",_!==1?"s":""]})]}),h.jsxs("div",{className:"pg-exec-body",children:[_>0&&h.jsx(ab,{props:{definitions:e.functionParameters,values:i},onChange:o}),l&&h.jsxs("div",{className:"pg-exec-error",children:[l,h.jsx("button",{type:"button",className:"pg-dismiss",onClick:()=>a(null),children:"×"})]})]}),h.jsx("div",{className:"pg-exec-footer",children:h.jsx("button",{type:"button",className:"pg-run-btn",onClick:u,disabled:r,children:r?"…":"▶ Run"})})]})}const Rb={models:[]};function xh(e){return Array.isArray(e)?`[${e.map(xh).join(",")}]`:e&&typeof e=="object"?`{${Object.entries(e).filter(([,t])=>t!==void 0).sort(([t],[i])=>t.localeCompare(i)).map(([t,i])=>`${JSON.stringify(t)}:${xh(i)}`).join(",")}}`:JSON.stringify(e)??"undefined"}function Wl(e){return xh(e)}function Bb(e,t){let i=e;return"system"in t&&(i={...i},t.system==null?delete i.system:i.system=t.system),"messages"in t&&(i={...i,messages:t.messages??[]}),i}function Ab({prompt:e,onUpdate:t,onDirtyChange:i,onExecuted:s}){const[r,n]=k.useState(!1),[l,a]=k.useState(null),[o,c]=k.useState(Rb),u=k.useRef(e);k.useEffect(()=>{u.current=e},[e]),k.useEffect(()=>{i(r)},[r,i]),k.useEffect(()=>{e.providerId&&R1(e.providerId).then(c).catch(()=>{})},[e.providerId]);const _=k.useCallback(async f=>{const d=u.current,g=Bb(d,f);Wl(g)!==Wl(d)&&(u.current=g,t(g)),n(!0),a(null);try{const y=await N1(d,f);Wl(y)!==Wl(u.current)&&(u.current=y,t(y))}catch(y){a(y.message)}finally{n(!1)}},[t]);return h.jsxs("div",{className:"pg-playground-wrapper",children:[h.jsxs("div",{className:"pg-prompt-header",children:[h.jsxs("div",{className:"pg-prompt-header-identity",children:[h.jsx("span",{className:"pg-prompt-name",children:e.name}),e.treePath&&e.treePath.length>0&&h.jsx("span",{className:"pg-prompt-path",children:e.treePath.join("/")})]}),h.jsx("div",{className:"pg-prompt-header-right",children:l&&h.jsxs("div",{className:"pg-header-error",children:[l,h.jsx("button",{type:"button",className:"pg-dismiss",onClick:()=>a(null),children:"×"})]})})]}),h.jsxs("div",{className:"pg-content",children:[h.jsx("div",{className:"pg-editor-col",children:h.jsx(Db,{prompt:e,onUpdate:_,modelCatalog:o})}),h.jsx("div",{className:"pg-exec-col",children:h.jsx(Mb,{prompt:e,onExecuted:s})})]})]})}function Nb(e){const t={subdirs:{},files:{}};for(const i of e){const s=i.treePath;if(!s||s.length===0){const a=i.name;t.files[a]||(t.files[a]=[]),t.files[a].push(i);continue}const r=s[s.length-1],n=s.slice(0,-1);let l=t;for(const a of n)l.subdirs[a]||(l.subdirs[a]={subdirs:{},files:{}}),l=l.subdirs[a];l.files[r]||(l.files[r]=[]),l.files[r].push(i)}return t}function wv(e){const t=[],i=Object.keys(e.subdirs).sort(),s=Object.keys(e.files).sort();for(const r of i){let n=r,l=e.subdirs[r];for(;Object.keys(l.subdirs).length===1&&Object.keys(l.files).length===0;){const[a,o]=Object.entries(l.subdirs)[0];n+="/"+a,l=o}t.push({type:"dir",label:n,children:wv(l)})}for(const r of s)t.push({type:"file",label:r,prompts:e.files[r]});return t}function Cv(e,t){const i=t.toLowerCase(),s=[];for(const r of e)if(r.type==="dir"){const n=Cv(r.children,t);(n.length>0||r.label.toLowerCase().includes(i))&&s.push({...r,children:n.length>0?n:r.children})}else{const n=r.label.toLowerCase().includes(i),l=r.prompts.filter(a=>a.name.toLowerCase().includes(i));n?s.push(r):l.length>0&&s.push({...r,prompts:l})}return s}function xv({expanded:e}){return h.jsx("svg",{className:"tree-disclosure",width:"8",height:"8",viewBox:"0 0 8 8",fill:"currentColor",children:e?h.jsx("path",{d:"M1 2h6L4 6.5z"}):h.jsx("path",{d:"M2 1v6L6.5 4z"})})}function Ob(){return h.jsx("svg",{className:"tree-icon",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:h.jsx("path",{d:"M22 19a2 2 0 01-2 2H4a2 2 0 01-2-2V5a2 2 0 012-2h5l2 3h9a2 2 0 012 2z"})})}function Ev(){return h.jsxs("svg",{className:"tree-icon",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[h.jsx("path",{d:"M14 2H6a2 2 0 00-2 2v16a2 2 0 002 2h12a2 2 0 002-2V8z"}),h.jsx("polyline",{points:"14 2 14 8 20 8"})]})}function Lb(){return h.jsxs("svg",{width:"11",height:"11",viewBox:"0 0 11 11",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round",children:[h.jsx("circle",{cx:"4.5",cy:"4.5",r:"3"}),h.jsx("line",{x1:"7",y1:"7",x2:"9.5",y2:"9.5"})]})}function zb(){return h.jsxs("svg",{width:"11",height:"11",viewBox:"0 0 11 11",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",children:[h.jsx("line",{x1:"5.5",y1:"1.5",x2:"5.5",y2:"9.5"}),h.jsx("line",{x1:"1.5",y1:"5.5",x2:"9.5",y2:"5.5"})]})}function jb({initialValue:e,onCommit:t,onCancel:i}){const[s,r]=k.useState(e),n=k.useRef(null);return k.useEffect(()=>{var l;(l=n.current)==null||l.select()},[]),h.jsx("input",{ref:n,className:"tree-rename-input",value:s,onChange:l=>r(l.target.value),onKeyDown:l=>{l.key==="Enter"&&(l.preventDefault(),s.trim()?t(s.trim()):i()),l.key==="Escape"&&(l.preventDefault(),i())},onBlur:()=>{s.trim()&&s.trim()!==e?t(s.trim()):i()},onClick:l=>l.stopPropagation()})}function l_({prompt:e,indent:t,selectedId:i,onSelect:s,renamingId:r,onStartRename:n,onCommitRename:l,onCancelRename:a}){const o=e.id===i,c=e.id===r;return h.jsxs("div",{className:`tree-row${o?" tree-row-selected":""}`,style:{paddingLeft:t},onClick:()=>s(ua(e.providerId,`selecting prompt ${e.id}`),e.id),onDoubleClick:u=>{u.stopPropagation(),n(e.id)},title:e.name,children:[h.jsx("span",{className:"tree-icon-prompt",children:h.jsx(Ev,{})}),c?h.jsx(jb,{initialValue:e.name,onCommit:u=>l(e.id,u),onCancel:a}):h.jsxs(h.Fragment,{children:[h.jsx("span",{className:"tree-row-label",children:e.name}),e.functionParameters.length>0&&h.jsxs("span",{className:"tree-row-params",children:["(",e.functionParameters.map(u=>u.name).join(", "),")"]})]})]})}function kv({node:e,depth:t,...i}){const[s,r]=k.useState(!0),n=e.prompts.length>1,l=t*18;return n?h.jsxs("div",{children:[h.jsxs("div",{className:"tree-row",style:{paddingLeft:10+l},onClick:()=>r(a=>!a),title:e.label,children:[h.jsx(xv,{expanded:s}),h.jsx("span",{className:"tree-icon-file",children:h.jsx(Ev,{})}),h.jsx("span",{className:"tree-row-label",children:e.label})]}),s&&e.prompts.map(a=>h.jsx(l_,{prompt:a,indent:10+l+18+16,...i},a.id))]}):h.jsx(l_,{prompt:e.prompts[0],indent:10+l+14,...i})}function Tv({node:e,depth:t,...i}){const[s,r]=k.useState(!0),n=t*18;return h.jsxs("div",{children:[h.jsxs("div",{className:"tree-row",style:{paddingLeft:10+n},onClick:()=>r(l=>!l),title:e.label,children:[h.jsx(xv,{expanded:s}),h.jsx("span",{className:"tree-icon-folder",children:h.jsx(Ob,{})}),h.jsx("span",{className:"tree-row-label",children:e.label})]}),s&&h.jsx("div",{children:e.children.map((l,a)=>l.type==="dir"?h.jsx(Tv,{node:l,depth:t+1,...i},a):h.jsx(kv,{node:l,depth:t+1,...i},a))})]})}function Hb({prompts:e,selectedId:t,onSelect:i,loading:s,error:r,onAddPrompt:n,onRenamePrompt:l}){const[a,o]=k.useState(""),[c,u]=k.useState(!1),[_,f]=k.useState(null),d=(m,p)=>{f(null),l==null||l(m,p)},g=k.useMemo(()=>{const m=Nb(e),p=wv(m);return a?Cv(p,a):p},[e,a]),y=h.jsxs("div",{className:"section-panel-header",children:[h.jsx("span",{children:"Prompts"}),h.jsxs("div",{className:"section-panel-header-actions",children:[h.jsx("button",{type:"button",className:"tree-toolbar-btn",title:"Toggle search",onClick:()=>{u(m=>(m&&o(""),!m))},children:h.jsx(Lb,{})}),n&&h.jsx("button",{type:"button",className:"tree-toolbar-btn",onClick:n,title:"New prompt",children:h.jsx(zb,{})})]})]}),w=c&&h.jsx("div",{className:"tree-header-search",children:h.jsx("input",{type:"text",placeholder:"Filter",value:a,onChange:m=>o(m.target.value),autoFocus:!0})});return s?h.jsxs(h.Fragment,{children:[y,w,h.jsx("div",{className:"section-panel-body",children:h.jsx("div",{className:"tree-status",children:"Loading..."})})]}):r?h.jsxs(h.Fragment,{children:[y,w,h.jsx("div",{className:"section-panel-body",children:h.jsxs("div",{className:"tree-status tree-error",children:["Error: ",r]})})]}):e.length===0?h.jsxs(h.Fragment,{children:[y,w,h.jsx("div",{className:"section-panel-body",children:h.jsxs("div",{className:"tree-empty-state",children:[h.jsx("p",{children:"No prompts found."}),n&&h.jsx("button",{type:"button",className:"tree-add-prompt-btn",onClick:n,children:"Create a prompt"})]})})]}):h.jsxs(h.Fragment,{children:[y,w,h.jsx("div",{className:"section-panel-body file-tree",children:g.map((m,p)=>m.type==="dir"?h.jsx(Tv,{node:m,depth:0,selectedId:t,onSelect:i,renamingId:_,onStartRename:f,onCommitRename:d,onCancelRename:()=>f(null)},p):h.jsx(kv,{node:m,depth:0,selectedId:t,onSelect:i,renamingId:_,onStartRename:f,onCommitRename:d,onCancelRename:()=>f(null)},p))})]})}function Ub(){return h.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[h.jsx("path",{d:"M14 2H6a2 2 0 00-2 2v16a2 2 0 002 2h12a2 2 0 002-2V8z"}),h.jsx("polyline",{points:"14 2 14 8 20 8"})]})}function qb({id:e,name:t,icon:i,active:s,dirty:r,onClick:n,onClose:l,onDragStart:a,onDragEnd:o}){return h.jsxs("button",{type:"button",id:e,title:t,className:`tab${s?" tab-active":""}`,draggable:!0,onDragStart:a,onDragEnd:o,onClick:c=>{c.stopPropagation(),n()},children:[h.jsx("span",{className:"tab-icon",children:i??h.jsx(Ub,{})}),h.jsx("span",{className:"tab-label",children:t}),r?h.jsx("span",{className:"tab-dirty",children:"●"}):h.jsx("span",{className:"tab-close",onClick:l,children:"×"})]})}/**
|
|
84
84
|
* Copyright (c) 2014-2024 The xterm.js authors. All rights reserved.
|
|
85
85
|
* @license MIT
|
|
86
86
|
*
|
|
@@ -91,7 +91,7 @@ Error generating stack: `+s.message+`
|
|
|
91
91
|
* Fabrice Bellard's javascript vt100 for jslinux:
|
|
92
92
|
* http://bellard.org/jslinux/
|
|
93
93
|
* Copyright (c) 2011 Fabrice Bellard
|
|
94
|
-
*/var
|
|
94
|
+
*/var Pb=2,Kb=1,Wb=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(){var _;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)==null?void 0:_.width)||14,i=window.getComputedStyle(this._terminal.element.parentElement),s=parseInt(i.getPropertyValue("height")),r=Math.max(0,parseInt(i.getPropertyValue("width"))),n=window.getComputedStyle(this._terminal.element),l={top:parseInt(n.getPropertyValue("padding-top")),bottom:parseInt(n.getPropertyValue("padding-bottom")),right:parseInt(n.getPropertyValue("padding-right")),left:parseInt(n.getPropertyValue("padding-left"))},a=l.top+l.bottom,o=l.right+l.left,c=s-a,u=r-o-t;return{cols:Math.max(Pb,Math.floor(u/e.css.cell.width)),rows:Math.max(Kb,Math.floor(c/e.css.cell.height))}}};/**
|
|
95
95
|
* Copyright (c) 2014-2024 The xterm.js authors. All rights reserved.
|
|
96
96
|
* @license MIT
|
|
97
97
|
*
|
|
@@ -102,43 +102,43 @@ Error generating stack: `+s.message+`
|
|
|
102
102
|
* Fabrice Bellard's javascript vt100 for jslinux:
|
|
103
103
|
* http://bellard.org/jslinux/
|
|
104
104
|
* Copyright (c) 2011 Fabrice Bellard
|
|
105
|
-
*/var
|
|
105
|
+
*/var Dv=Object.defineProperty,Yb=Object.getOwnPropertyDescriptor,Vb=(e,t)=>{for(var i in t)Dv(e,i,{get:t[i],enumerable:!0})},Ae=(e,t,i,s)=>{for(var r=s>1?void 0:s?Yb(t,i):t,n=e.length-1,l;n>=0;n--)(l=e[n])&&(r=(s?l(t,i,r):l(r))||r);return s&&r&&Dv(t,i,r),r},q=(e,t)=>(i,s)=>t(i,s,e),a_="Terminal input",Eh={get:()=>a_,set:e=>a_=e},o_="Too much output to announce, navigate to rows manually to read",kh={get:()=>o_,set:e=>o_=e};function Ib(e){return e.replace(/\r?\n/g,"\r")}function Xb(e,t){return t?"\x1B[200~"+e+"\x1B[201~":e}function $b(e,t){e.clipboardData&&e.clipboardData.setData("text/plain",t.selectionText),e.preventDefault()}function Gb(e,t,i,s){if(e.stopPropagation(),e.clipboardData){let r=e.clipboardData.getData("text/plain");Mv(r,t,i,s)}}function Mv(e,t,i,s){e=Ib(e),e=Xb(e,i.decPrivateModes.bracketedPasteMode&&s.rawOptions.ignoreBracketedPasteMode!==!0),i.triggerDataEvent(e,!0),t.value=""}function Rv(e,t,i){let s=i.getBoundingClientRect(),r=e.clientX-s.left-10,n=e.clientY-s.top-10;t.style.width="20px",t.style.height="20px",t.style.left=`${r}px`,t.style.top=`${n}px`,t.style.zIndex="1000",t.focus()}function c_(e,t,i,s,r){Rv(e,t,i),r&&s.rightClickSelect(e),t.value=s.selectionText,t.select()}function is(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}function wo(e,t=0,i=e.length){let s="";for(let r=t;r<i;++r){let n=e[r];n>65535?(n-=65536,s+=String.fromCharCode((n>>10)+55296)+String.fromCharCode(n%1024+56320)):s+=String.fromCharCode(n)}return s}var Fb=class{constructor(){this._interim=0}clear(){this._interim=0}decode(e,t){let i=e.length;if(!i)return 0;let s=0,r=0;if(this._interim){let n=e.charCodeAt(r++);56320<=n&&n<=57343?t[s++]=(this._interim-55296)*1024+n-56320+65536:(t[s++]=this._interim,t[s++]=n),this._interim=0}for(let n=r;n<i;++n){let l=e.charCodeAt(n);if(55296<=l&&l<=56319){if(++n>=i)return this._interim=l,s;let a=e.charCodeAt(n);56320<=a&&a<=57343?t[s++]=(l-55296)*1024+a-56320+65536:(t[s++]=l,t[s++]=a);continue}l!==65279&&(t[s++]=l)}return s}},Zb=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(e,t){let i=e.length;if(!i)return 0;let s=0,r,n,l,a,o=0,c=0;if(this.interim[0]){let f=!1,d=this.interim[0];d&=(d&224)===192?31:(d&240)===224?15:7;let g=0,y;for(;(y=this.interim[++g]&63)&&g<4;)d<<=6,d|=y;let w=(this.interim[0]&224)===192?2:(this.interim[0]&240)===224?3:4,m=w-g;for(;c<m;){if(c>=i)return 0;if(y=e[c++],(y&192)!==128){c--,f=!0;break}else this.interim[g++]=y,d<<=6,d|=y&63}f||(w===2?d<128?c--:t[s++]=d:w===3?d<2048||d>=55296&&d<=57343||d===65279||(t[s++]=d):d<65536||d>1114111||(t[s++]=d)),this.interim.fill(0)}let u=i-4,_=c;for(;_<i;){for(;_<u&&!((r=e[_])&128)&&!((n=e[_+1])&128)&&!((l=e[_+2])&128)&&!((a=e[_+3])&128);)t[s++]=r,t[s++]=n,t[s++]=l,t[s++]=a,_+=4;if(r=e[_++],r<128)t[s++]=r;else if((r&224)===192){if(_>=i)return this.interim[0]=r,s;if(n=e[_++],(n&192)!==128){_--;continue}if(o=(r&31)<<6|n&63,o<128){_--;continue}t[s++]=o}else if((r&240)===224){if(_>=i)return this.interim[0]=r,s;if(n=e[_++],(n&192)!==128){_--;continue}if(_>=i)return this.interim[0]=r,this.interim[1]=n,s;if(l=e[_++],(l&192)!==128){_--;continue}if(o=(r&15)<<12|(n&63)<<6|l&63,o<2048||o>=55296&&o<=57343||o===65279)continue;t[s++]=o}else if((r&248)===240){if(_>=i)return this.interim[0]=r,s;if(n=e[_++],(n&192)!==128){_--;continue}if(_>=i)return this.interim[0]=r,this.interim[1]=n,s;if(l=e[_++],(l&192)!==128){_--;continue}if(_>=i)return this.interim[0]=r,this.interim[1]=n,this.interim[2]=l,s;if(a=e[_++],(a&192)!==128){_--;continue}if(o=(r&7)<<18|(n&63)<<12|(l&63)<<6|a&63,o<65536||o>1114111)continue;t[s++]=o}}return s}},Bv="",ds=" ",wl=class Av{constructor(){this.fg=0,this.bg=0,this.extended=new Fa}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 Av;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}},Fa=class Nv{constructor(t=0,i=0){this._ext=0,this._urlId=0,this._ext=t,this._urlId=i}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 Nv(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},ii=class Ov extends wl{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new Fa,this.combinedData=""}static fromCharData(t){let i=new Ov;return i.setFromCharData(t),i}isCombined(){return this.content&2097152}getWidth(){return this.content>>22}getChars(){return this.content&2097152?this.combinedData:this.content&2097151?is(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 i=!1;if(t[1].length>2)i=!0;else if(t[1].length===2){let s=t[1].charCodeAt(0);if(55296<=s&&s<=56319){let r=t[1].charCodeAt(1);56320<=r&&r<=57343?this.content=(s-55296)*1024+r-56320+65536|t[2]<<22:i=!0}else i=!0}else this.content=t[1].charCodeAt(0)|t[2]<<22;i&&(this.combinedData=t[1],this.content=2097152|t[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},h_="di$target",Th="di$dependencies",fc=new Map;function Qb(e){return e[Th]||[]}function st(e){if(fc.has(e))return fc.get(e);let t=function(i,s,r){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");Jb(t,i,r)};return t._id=e,fc.set(e,t),t}function Jb(e,t,i){t[h_]===t?t[Th].push({id:e,index:i}):(t[Th]=[{id:e,index:i}],t[h_]=t)}var bt=st("BufferService"),Lv=st("CoreMouseService"),ir=st("CoreService"),ew=st("CharsetService"),md=st("InstantiationService"),zv=st("LogService"),wt=st("OptionsService"),jv=st("OscLinkService"),tw=st("UnicodeService"),Cl=st("DecorationService"),Dh=class{constructor(e,t,i){this._bufferService=e,this._optionsService=t,this._oscLinkService=i}provideLinks(e,t){var u;let i=this._bufferService.buffer.lines.get(e-1);if(!i){t(void 0);return}let s=[],r=this._optionsService.rawOptions.linkHandler,n=new ii,l=i.getTrimmedLength(),a=-1,o=-1,c=!1;for(let _=0;_<l;_++)if(!(o===-1&&!i.hasContent(_))){if(i.loadCell(_,n),n.hasExtendedAttrs()&&n.extended.urlId)if(o===-1){o=_,a=n.extended.urlId;continue}else c=n.extended.urlId!==a;else o!==-1&&(c=!0);if(c||o!==-1&&_===l-1){let f=(u=this._oscLinkService.getLinkData(a))==null?void 0:u.uri;if(f){let d={start:{x:o+1,y:e},end:{x:_+(!c&&_===l-1?1:0),y:e}},g=!1;if(!(r!=null&&r.allowNonHttpProtocols))try{let y=new URL(f);["http:","https:"].includes(y.protocol)||(g=!0)}catch{g=!0}g||s.push({text:f,range:d,activate:(y,w)=>r?r.activate(y,w,d):iw(y,w),hover:(y,w)=>{var m;return(m=r==null?void 0:r.hover)==null?void 0:m.call(r,y,w,d)},leave:(y,w)=>{var m;return(m=r==null?void 0:r.leave)==null?void 0:m.call(r,y,w,d)}})}c=!1,n.hasExtendedAttrs()&&n.extended.urlId?(o=_,a=n.extended.urlId):(o=-1,a=-1)}}t(s)}};Dh=Ae([q(0,bt),q(1,wt),q(2,jv)],Dh);function iw(e,t){if(confirm(`Do you want to navigate to ${t}?
|
|
106
106
|
|
|
107
|
-
WARNING: This link could potentially be dangerous`)){let i=window.open();if(i){try{i.opener=null}catch{}i.location.href=t}else console.warn("Opening link blocked as opener could not be cleared")}}var
|
|
107
|
+
WARNING: This link could potentially be dangerous`)){let i=window.open();if(i){try{i.opener=null}catch{}i.location.href=t}else console.warn("Opening link blocked as opener could not be cleared")}}var Co=st("CharSizeService"),Ii=st("CoreBrowserService"),gd=st("MouseService"),Xi=st("RenderService"),sw=st("SelectionService"),Hv=st("CharacterJoinerService"),sn=st("ThemeService"),Uv=st("LinkProviderService"),rw=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?u_.isErrorNoTelemetry(e)?new u_(e.message+`
|
|
108
108
|
|
|
109
109
|
`+e.stack):new Error(e.message+`
|
|
110
110
|
|
|
111
|
-
`+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)}},Xb=new Ib;function ua(e){Gb(e)||Xb.onUnexpectedError(e)}var xh="Canceled";function Gb(e){return e instanceof $b?!0:e instanceof Error&&e.name===xh&&e.message===xh}var $b=class extends Error{constructor(){super(xh),this.name=this.message}};function Fb(e){return new Error(`Illegal argument: ${e}`)}var n_=class Eh extends Error{constructor(t){super(t),this.name="CodeExpectedError"}static fromError(t){if(t instanceof Eh)return t;let i=new Eh;return i.message=t.message,i.stack=t.stack,i}static isErrorNoTelemetry(t){return t.name==="CodeExpectedError"}},kh=class Nv extends Error{constructor(t){super(t||"An unexpected bug occurred."),Object.setPrototypeOf(this,Nv.prototype)}};function At(e,t=0){return e[e.length-(1+t)]}var Zb;(e=>{function t(n){return n<0}e.isLessThan=t;function i(n){return n<=0}e.isLessThanOrEqual=i;function s(n){return n>0}e.isGreaterThan=s;function r(n){return n===0}e.isNeitherLessOrGreaterThan=r,e.greaterThan=1,e.lessThan=-1,e.neitherLessOrGreaterThan=0})(Zb||(Zb={}));function Qb(e,t){let i=this,s=!1,r;return function(){return s||(s=!0,t||(r=e.apply(i,arguments))),r}}var Ov;(e=>{function t(S){return S&&typeof S=="object"&&typeof S[Symbol.iterator]=="function"}e.is=t;let i=Object.freeze([]);function s(){return i}e.empty=s;function*r(S){yield S}e.single=r;function n(S){return t(S)?S:r(S)}e.wrap=n;function l(S){return S||i}e.from=l;function*a(S){for(let k=S.length-1;k>=0;k--)yield S[k]}e.reverse=a;function o(S){return!S||S[Symbol.iterator]().next().done===!0}e.isEmpty=o;function c(S){return S[Symbol.iterator]().next().value}e.first=c;function _(S,k){let j=0;for(let O of S)if(k(O,j++))return!0;return!1}e.some=_;function f(S,k){for(let j of S)if(k(j))return j}e.find=f;function*u(S,k){for(let j of S)k(j)&&(yield j)}e.filter=u;function*d(S,k){let j=0;for(let O of S)yield k(O,j++)}e.map=d;function*g(S,k){let j=0;for(let O of S)yield*k(O,j++)}e.flatMap=g;function*y(...S){for(let k of S)yield*k}e.concat=y;function C(S,k,j){let O=j;for(let q of S)O=k(O,q);return O}e.reduce=C;function*m(S,k,j=S.length){for(k<0&&(k+=S.length),j<0?j+=S.length:j>S.length&&(j=S.length);k<j;k++)yield S[k]}e.slice=m;function p(S,k=Number.POSITIVE_INFINITY){let j=[];if(k===0)return[j,S];let O=S[Symbol.iterator]();for(let q=0;q<k;q++){let W=O.next();if(W.done)return[j,e.empty()];j.push(W.value)}return[j,{[Symbol.iterator](){return O}}]}e.consume=p;async function v(S){let k=[];for await(let j of S)k.push(j);return Promise.resolve(k)}e.asyncToArray=v})(Ov||(Ov={}));function Gs(e){if(Ov.is(e)){let t=[];for(let i of e)if(i)try{i.dispose()}catch(s){t.push(s)}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 Jb(...e){return Ee(()=>Gs(e))}function Ee(e){return{dispose:Qb(()=>{e()})}}var Lv=class zv{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{Gs(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?zv.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)}};Lv.DISABLE_DISPOSED_WARNING=!1;var bs=Lv,se=class{constructor(){this._store=new bs,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)}};se.None=Object.freeze({dispose(){}});var Yr=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(e){var t;this._isDisposed||e===this._value||((t=this._value)==null||t.dispose(),this._value=e)}clear(){this.value=void 0}dispose(){var e;this._isDisposed=!0,(e=this._value)==null||e.dispose(),this._value=void 0}clearAndLeak(){let e=this._value;return this._value=void 0,e}},ji=typeof window=="object"?window:globalThis,Th=class Dh{constructor(t){this.element=t,this.next=Dh.Undefined,this.prev=Dh.Undefined}};Th.Undefined=new Th(void 0);var ke=Th,l_=class{constructor(){this._first=ke.Undefined,this._last=ke.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===ke.Undefined}clear(){let e=this._first;for(;e!==ke.Undefined;){let t=e.next;e.prev=ke.Undefined,e.next=ke.Undefined,e=t}this._first=ke.Undefined,this._last=ke.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){let i=new ke(e);if(this._first===ke.Undefined)this._first=i,this._last=i;else if(t){let r=this._last;this._last=i,i.prev=r,r.next=i}else{let r=this._first;this._first=i,i.next=r,r.prev=i}this._size+=1;let s=!1;return()=>{s||(s=!0,this._remove(i))}}shift(){if(this._first!==ke.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==ke.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==ke.Undefined&&e.next!==ke.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===ke.Undefined&&e.next===ke.Undefined?(this._first=ke.Undefined,this._last=ke.Undefined):e.next===ke.Undefined?(this._last=this._last.prev,this._last.next=ke.Undefined):e.prev===ke.Undefined&&(this._first=this._first.next,this._first.prev=ke.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==ke.Undefined;)yield e.element,e=e.next}},e2=globalThis.performance&&typeof globalThis.performance.now=="function",t2=class jv{static create(t){return new jv(t)}constructor(t){this._now=e2&&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}},ht;(e=>{e.None=()=>se.None;function t(w,x){return f(w,()=>{},0,void 0,!0,void 0,x)}e.defer=t;function i(w){return(x,T=null,R)=>{let b=!1,N;return N=w(E=>{if(!b)return N?N.dispose():b=!0,x.call(T,E)},null,R),b&&N.dispose(),N}}e.once=i;function s(w,x,T){return c((R,b=null,N)=>w(E=>R.call(b,x(E)),null,N),T)}e.map=s;function r(w,x,T){return c((R,b=null,N)=>w(E=>{x(E),R.call(b,E)},null,N),T)}e.forEach=r;function n(w,x,T){return c((R,b=null,N)=>w(E=>x(E)&&R.call(b,E),null,N),T)}e.filter=n;function l(w){return w}e.signal=l;function a(...w){return(x,T=null,R)=>{let b=Jb(...w.map(N=>N(E=>x.call(T,E))));return _(b,R)}}e.any=a;function o(w,x,T,R){let b=T;return s(w,N=>(b=x(b,N),b),R)}e.reduce=o;function c(w,x){let T,R={onWillAddFirstListener(){T=w(b.fire,b)},onDidRemoveLastListener(){T==null||T.dispose()}},b=new z(R);return x==null||x.add(b),b.event}function _(w,x){return x instanceof Array?x.push(w):x&&x.add(w),w}function f(w,x,T=100,R=!1,b=!1,N,E){let K,Q,Ke,_t=0,$e,we={leakWarningThreshold:N,onWillAddFirstListener(){K=w(Ct=>{_t++,Q=x(Q,Ct),R&&!Ke&&(nt.fire(Q),Q=void 0),$e=()=>{let di=Q;Q=void 0,Ke=void 0,(!R||_t>1)&&nt.fire(di),_t=0},typeof T=="number"?(clearTimeout(Ke),Ke=setTimeout($e,T)):Ke===void 0&&(Ke=0,queueMicrotask($e))})},onWillRemoveListener(){b&&_t>0&&($e==null||$e())},onDidRemoveLastListener(){$e=void 0,K.dispose()}},nt=new z(we);return E==null||E.add(nt),nt.event}e.debounce=f;function u(w,x=0,T){return e.debounce(w,(R,b)=>R?(R.push(b),R):[b],x,void 0,!0,void 0,T)}e.accumulate=u;function d(w,x=(R,b)=>R===b,T){let R=!0,b;return n(w,N=>{let E=R||!x(N,b);return R=!1,b=N,E},T)}e.latch=d;function g(w,x,T){return[e.filter(w,x,T),e.filter(w,R=>!x(R),T)]}e.split=g;function y(w,x=!1,T=[],R){let b=T.slice(),N=w(Q=>{b?b.push(Q):K.fire(Q)});R&&R.add(N);let E=()=>{b==null||b.forEach(Q=>K.fire(Q)),b=null},K=new z({onWillAddFirstListener(){N||(N=w(Q=>K.fire(Q)),R&&R.add(N))},onDidAddFirstListener(){b&&(x?setTimeout(E):E())},onDidRemoveLastListener(){N&&N.dispose(),N=null}});return R&&R.add(K),K.event}e.buffer=y;function C(w,x){return(T,R,b)=>{let N=x(new p);return w(function(E){let K=N.evaluate(E);K!==m&&T.call(R,K)},void 0,b)}}e.chain=C;let m=Symbol("HaltChainable");class p{constructor(){this.steps=[]}map(x){return this.steps.push(x),this}forEach(x){return this.steps.push(T=>(x(T),T)),this}filter(x){return this.steps.push(T=>x(T)?T:m),this}reduce(x,T){let R=T;return this.steps.push(b=>(R=x(R,b),R)),this}latch(x=(T,R)=>T===R){let T=!0,R;return this.steps.push(b=>{let N=T||!x(b,R);return T=!1,R=b,N?b:m}),this}evaluate(x){for(let T of this.steps)if(x=T(x),x===m)break;return x}}function v(w,x,T=R=>R){let R=(...K)=>E.fire(T(...K)),b=()=>w.on(x,R),N=()=>w.removeListener(x,R),E=new z({onWillAddFirstListener:b,onDidRemoveLastListener:N});return E.event}e.fromNodeEventEmitter=v;function S(w,x,T=R=>R){let R=(...K)=>E.fire(T(...K)),b=()=>w.addEventListener(x,R),N=()=>w.removeEventListener(x,R),E=new z({onWillAddFirstListener:b,onDidRemoveLastListener:N});return E.event}e.fromDOMEventEmitter=S;function k(w){return new Promise(x=>i(w)(x))}e.toPromise=k;function j(w){let x=new z;return w.then(T=>{x.fire(T)},()=>{x.fire(void 0)}).finally(()=>{x.dispose()}),x.event}e.fromPromise=j;function O(w,x){return w(T=>x.fire(T))}e.forward=O;function q(w,x,T){return x(T),w(R=>x(R))}e.runAndSubscribe=q;class W{constructor(x,T){this._observable=x,this._counter=0,this._hasChanged=!1;let R={onWillAddFirstListener:()=>{x.addObserver(this)},onDidRemoveLastListener:()=>{x.removeObserver(this)}};this.emitter=new z(R),T&&T.add(this.emitter)}beginUpdate(x){this._counter++}handlePossibleChange(x){}handleChange(x,T){this._hasChanged=!0}endUpdate(x){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function V(w,x){return new W(w,x).emitter.event}e.fromObservable=V;function A(w){return(x,T,R)=>{let b=0,N=!1,E={beginUpdate(){b++},endUpdate(){b--,b===0&&(w.reportChanges(),N&&(N=!1,x.call(T)))},handlePossibleChange(){},handleChange(){N=!0}};w.addObserver(E),w.reportChanges();let K={dispose(){w.removeObserver(E)}};return R instanceof bs?R.add(K):Array.isArray(R)&&R.push(K),K}}e.fromObservableLight=A})(ht||(ht={}));var Mh=class Bh{constructor(t){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${t}_${Bh._idPool++}`,Bh.all.add(this)}start(t){this._stopWatch=new t2,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}}};Mh.all=new Set,Mh._idPool=0;var i2=Mh,s2=-1,Hv=class Uv{constructor(t,i,s=(Uv._idPool++).toString(16).padStart(3,"0")){this._errorHandler=t,this.threshold=i,this.name=s,this._warnCountdown=0}dispose(){var t;(t=this._stacks)==null||t.clear()}check(t,i){let s=this.threshold;if(s<=0||i<s)return;this._stacks||(this._stacks=new Map);let r=this._stacks.get(t.value)||0;if(this._stacks.set(t.value,r+1),this._warnCountdown-=1,this._warnCountdown<=0){this._warnCountdown=s*.5;let[n,l]=this.getMostFrequentStack(),a=`[${this.name}] potential listener LEAK detected, having ${i} listeners already. MOST frequent listener (${l}):`;console.warn(a),console.warn(n);let o=new l2(a,n);this._errorHandler(o)}return()=>{let n=this._stacks.get(t.value)||0;this._stacks.set(t.value,n-1)}}getMostFrequentStack(){if(!this._stacks)return;let t,i=0;for(let[s,r]of this._stacks)(!t||i<r)&&(t=[s,r],i=r);return t}};Hv._idPool=1;var r2=Hv,n2=class qv{constructor(t){this.value=t}static create(){let t=new Error;return new qv(t.stack??"")}print(){console.warn(this.value.split(`
|
|
111
|
+
`+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)}},nw=new rw;function _a(e){lw(e)||nw.onUnexpectedError(e)}var Mh="Canceled";function lw(e){return e instanceof aw?!0:e instanceof Error&&e.name===Mh&&e.message===Mh}var aw=class extends Error{constructor(){super(Mh),this.name=this.message}};function ow(e){return new Error(`Illegal argument: ${e}`)}var u_=class Rh extends Error{constructor(t){super(t),this.name="CodeExpectedError"}static fromError(t){if(t instanceof Rh)return t;let i=new Rh;return i.message=t.message,i.stack=t.stack,i}static isErrorNoTelemetry(t){return t.name==="CodeExpectedError"}},Bh=class qv extends Error{constructor(t){super(t||"An unexpected bug occurred."),Object.setPrototypeOf(this,qv.prototype)}};function At(e,t=0){return e[e.length-(1+t)]}var cw;(e=>{function t(n){return n<0}e.isLessThan=t;function i(n){return n<=0}e.isLessThanOrEqual=i;function s(n){return n>0}e.isGreaterThan=s;function r(n){return n===0}e.isNeitherLessOrGreaterThan=r,e.greaterThan=1,e.lessThan=-1,e.neitherLessOrGreaterThan=0})(cw||(cw={}));function hw(e,t){let i=this,s=!1,r;return function(){return s||(s=!0,t||(r=e.apply(i,arguments))),r}}var Pv;(e=>{function t(S){return S&&typeof S=="object"&&typeof S[Symbol.iterator]=="function"}e.is=t;let i=Object.freeze([]);function s(){return i}e.empty=s;function*r(S){yield S}e.single=r;function n(S){return t(S)?S:r(S)}e.wrap=n;function l(S){return S||i}e.from=l;function*a(S){for(let T=S.length-1;T>=0;T--)yield S[T]}e.reverse=a;function o(S){return!S||S[Symbol.iterator]().next().done===!0}e.isEmpty=o;function c(S){return S[Symbol.iterator]().next().value}e.first=c;function u(S,T){let j=0;for(let O of S)if(T(O,j++))return!0;return!1}e.some=u;function _(S,T){for(let j of S)if(T(j))return j}e.find=_;function*f(S,T){for(let j of S)T(j)&&(yield j)}e.filter=f;function*d(S,T){let j=0;for(let O of S)yield T(O,j++)}e.map=d;function*g(S,T){let j=0;for(let O of S)yield*T(O,j++)}e.flatMap=g;function*y(...S){for(let T of S)yield*T}e.concat=y;function w(S,T,j){let O=j;for(let L of S)O=T(O,L);return O}e.reduce=w;function*m(S,T,j=S.length){for(T<0&&(T+=S.length),j<0?j+=S.length:j>S.length&&(j=S.length);T<j;T++)yield S[T]}e.slice=m;function p(S,T=Number.POSITIVE_INFINITY){let j=[];if(T===0)return[j,S];let O=S[Symbol.iterator]();for(let L=0;L<T;L++){let U=O.next();if(U.done)return[j,e.empty()];j.push(U.value)}return[j,{[Symbol.iterator](){return O}}]}e.consume=p;async function v(S){let T=[];for await(let j of S)T.push(j);return Promise.resolve(T)}e.asyncToArray=v})(Pv||(Pv={}));function Gs(e){if(Pv.is(e)){let t=[];for(let i of e)if(i)try{i.dispose()}catch(s){t.push(s)}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 uw(...e){return Ee(()=>Gs(e))}function Ee(e){return{dispose:hw(()=>{e()})}}var Kv=class Wv{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{Gs(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?Wv.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)}};Kv.DISABLE_DISPOSED_WARNING=!1;var ws=Kv,se=class{constructor(){this._store=new ws,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)}};se.None=Object.freeze({dispose(){}});var Ir=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(e){var t;this._isDisposed||e===this._value||((t=this._value)==null||t.dispose(),this._value=e)}clear(){this.value=void 0}dispose(){var e;this._isDisposed=!0,(e=this._value)==null||e.dispose(),this._value=void 0}clearAndLeak(){let e=this._value;return this._value=void 0,e}},zi=typeof window=="object"?window:globalThis,Ah=class Nh{constructor(t){this.element=t,this.next=Nh.Undefined,this.prev=Nh.Undefined}};Ah.Undefined=new Ah(void 0);var ke=Ah,d_=class{constructor(){this._first=ke.Undefined,this._last=ke.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===ke.Undefined}clear(){let e=this._first;for(;e!==ke.Undefined;){let t=e.next;e.prev=ke.Undefined,e.next=ke.Undefined,e=t}this._first=ke.Undefined,this._last=ke.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){let i=new ke(e);if(this._first===ke.Undefined)this._first=i,this._last=i;else if(t){let r=this._last;this._last=i,i.prev=r,r.next=i}else{let r=this._first;this._first=i,i.next=r,r.prev=i}this._size+=1;let s=!1;return()=>{s||(s=!0,this._remove(i))}}shift(){if(this._first!==ke.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==ke.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==ke.Undefined&&e.next!==ke.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===ke.Undefined&&e.next===ke.Undefined?(this._first=ke.Undefined,this._last=ke.Undefined):e.next===ke.Undefined?(this._last=this._last.prev,this._last.next=ke.Undefined):e.prev===ke.Undefined&&(this._first=this._first.next,this._first.prev=ke.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==ke.Undefined;)yield e.element,e=e.next}},dw=globalThis.performance&&typeof globalThis.performance.now=="function",fw=class Yv{static create(t){return new Yv(t)}constructor(t){this._now=dw&&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}},ut;(e=>{e.None=()=>se.None;function t(x,C){return _(x,()=>{},0,void 0,!0,void 0,C)}e.defer=t;function i(x){return(C,B=null,D)=>{let b=!1,N;return N=x(E=>{if(!b)return N?N.dispose():b=!0,C.call(B,E)},null,D),b&&N.dispose(),N}}e.once=i;function s(x,C,B){return c((D,b=null,N)=>x(E=>D.call(b,C(E)),null,N),B)}e.map=s;function r(x,C,B){return c((D,b=null,N)=>x(E=>{C(E),D.call(b,E)},null,N),B)}e.forEach=r;function n(x,C,B){return c((D,b=null,N)=>x(E=>C(E)&&D.call(b,E),null,N),B)}e.filter=n;function l(x){return x}e.signal=l;function a(...x){return(C,B=null,D)=>{let b=uw(...x.map(N=>N(E=>C.call(B,E))));return u(b,D)}}e.any=a;function o(x,C,B,D){let b=B;return s(x,N=>(b=C(b,N),b),D)}e.reduce=o;function c(x,C){let B,D={onWillAddFirstListener(){B=x(b.fire,b)},onDidRemoveLastListener(){B==null||B.dispose()}},b=new H(D);return C==null||C.add(b),b.event}function u(x,C){return C instanceof Array?C.push(x):C&&C.add(x),x}function _(x,C,B=100,D=!1,b=!1,N,E){let V,F,rt,nt=0,$e,Ce={leakWarningThreshold:N,onWillAddFirstListener(){V=x(Ct=>{nt++,F=C(F,Ct),D&&!rt&&(lt.fire(F),F=void 0),$e=()=>{let Ci=F;F=void 0,rt=void 0,(!D||nt>1)&<.fire(Ci),nt=0},typeof B=="number"?(clearTimeout(rt),rt=setTimeout($e,B)):rt===void 0&&(rt=0,queueMicrotask($e))})},onWillRemoveListener(){b&&nt>0&&($e==null||$e())},onDidRemoveLastListener(){$e=void 0,V.dispose()}},lt=new H(Ce);return E==null||E.add(lt),lt.event}e.debounce=_;function f(x,C=0,B){return e.debounce(x,(D,b)=>D?(D.push(b),D):[b],C,void 0,!0,void 0,B)}e.accumulate=f;function d(x,C=(D,b)=>D===b,B){let D=!0,b;return n(x,N=>{let E=D||!C(N,b);return D=!1,b=N,E},B)}e.latch=d;function g(x,C,B){return[e.filter(x,C,B),e.filter(x,D=>!C(D),B)]}e.split=g;function y(x,C=!1,B=[],D){let b=B.slice(),N=x(F=>{b?b.push(F):V.fire(F)});D&&D.add(N);let E=()=>{b==null||b.forEach(F=>V.fire(F)),b=null},V=new H({onWillAddFirstListener(){N||(N=x(F=>V.fire(F)),D&&D.add(N))},onDidAddFirstListener(){b&&(C?setTimeout(E):E())},onDidRemoveLastListener(){N&&N.dispose(),N=null}});return D&&D.add(V),V.event}e.buffer=y;function w(x,C){return(B,D,b)=>{let N=C(new p);return x(function(E){let V=N.evaluate(E);V!==m&&B.call(D,V)},void 0,b)}}e.chain=w;let m=Symbol("HaltChainable");class p{constructor(){this.steps=[]}map(C){return this.steps.push(C),this}forEach(C){return this.steps.push(B=>(C(B),B)),this}filter(C){return this.steps.push(B=>C(B)?B:m),this}reduce(C,B){let D=B;return this.steps.push(b=>(D=C(D,b),D)),this}latch(C=(B,D)=>B===D){let B=!0,D;return this.steps.push(b=>{let N=B||!C(b,D);return B=!1,D=b,N?b:m}),this}evaluate(C){for(let B of this.steps)if(C=B(C),C===m)break;return C}}function v(x,C,B=D=>D){let D=(...V)=>E.fire(B(...V)),b=()=>x.on(C,D),N=()=>x.removeListener(C,D),E=new H({onWillAddFirstListener:b,onDidRemoveLastListener:N});return E.event}e.fromNodeEventEmitter=v;function S(x,C,B=D=>D){let D=(...V)=>E.fire(B(...V)),b=()=>x.addEventListener(C,D),N=()=>x.removeEventListener(C,D),E=new H({onWillAddFirstListener:b,onDidRemoveLastListener:N});return E.event}e.fromDOMEventEmitter=S;function T(x){return new Promise(C=>i(x)(C))}e.toPromise=T;function j(x){let C=new H;return x.then(B=>{C.fire(B)},()=>{C.fire(void 0)}).finally(()=>{C.dispose()}),C.event}e.fromPromise=j;function O(x,C){return x(B=>C.fire(B))}e.forward=O;function L(x,C,B){return C(B),x(D=>C(D))}e.runAndSubscribe=L;class U{constructor(C,B){this._observable=C,this._counter=0,this._hasChanged=!1;let D={onWillAddFirstListener:()=>{C.addObserver(this)},onDidRemoveLastListener:()=>{C.removeObserver(this)}};this.emitter=new H(D),B&&B.add(this.emitter)}beginUpdate(C){this._counter++}handlePossibleChange(C){}handleChange(C,B){this._hasChanged=!0}endUpdate(C){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function Y(x,C){return new U(x,C).emitter.event}e.fromObservable=Y;function A(x){return(C,B,D)=>{let b=0,N=!1,E={beginUpdate(){b++},endUpdate(){b--,b===0&&(x.reportChanges(),N&&(N=!1,C.call(B)))},handlePossibleChange(){},handleChange(){N=!0}};x.addObserver(E),x.reportChanges();let V={dispose(){x.removeObserver(E)}};return D instanceof ws?D.add(V):Array.isArray(D)&&D.push(V),V}}e.fromObservableLight=A})(ut||(ut={}));var Oh=class Lh{constructor(t){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${t}_${Lh._idPool++}`,Lh.all.add(this)}start(t){this._stopWatch=new fw,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}}};Oh.all=new Set,Oh._idPool=0;var _w=Oh,pw=-1,Vv=class Iv{constructor(t,i,s=(Iv._idPool++).toString(16).padStart(3,"0")){this._errorHandler=t,this.threshold=i,this.name=s,this._warnCountdown=0}dispose(){var t;(t=this._stacks)==null||t.clear()}check(t,i){let s=this.threshold;if(s<=0||i<s)return;this._stacks||(this._stacks=new Map);let r=this._stacks.get(t.value)||0;if(this._stacks.set(t.value,r+1),this._warnCountdown-=1,this._warnCountdown<=0){this._warnCountdown=s*.5;let[n,l]=this.getMostFrequentStack(),a=`[${this.name}] potential listener LEAK detected, having ${i} listeners already. MOST frequent listener (${l}):`;console.warn(a),console.warn(n);let o=new vw(a,n);this._errorHandler(o)}return()=>{let n=this._stacks.get(t.value)||0;this._stacks.set(t.value,n-1)}}getMostFrequentStack(){if(!this._stacks)return;let t,i=0;for(let[s,r]of this._stacks)(!t||i<r)&&(t=[s,r],i=r);return t}};Vv._idPool=1;var mw=Vv,gw=class Xv{constructor(t){this.value=t}static create(){let t=new Error;return new Xv(t.stack??"")}print(){console.warn(this.value.split(`
|
|
112
112
|
`).slice(2).join(`
|
|
113
|
-
`))}},l2=class extends Error{constructor(e,t){super(e),this.name="ListenerLeakError",this.stack=t}},a2=class extends Error{constructor(e,t){super(e),this.name="ListenerRefusalError",this.stack=t}},o2=0,hc=class{constructor(e){this.value=e,this.id=o2++}},c2=2,h2,z=class{constructor(e){var t,i,s,r;this._size=0,this._options=e,this._leakageMon=(t=this._options)!=null&&t.leakWarningThreshold?new r2((e==null?void 0:e.onListenerError)??ua,((i=this._options)==null?void 0:i.leakWarningThreshold)??s2):void 0,this._perfMon=(s=this._options)!=null&&s._profName?new i2(this._options._profName):void 0,this._deliveryQueue=(r=this._options)==null?void 0:r.deliveryQueue}dispose(){var e,t,i,s;this._disposed||(this._disposed=!0,((e=this._deliveryQueue)==null?void 0:e.current)===this&&this._deliveryQueue.reset(),this._listeners&&(this._listeners=void 0,this._size=0),(i=(t=this._options)==null?void 0:t.onDidRemoveLastListener)==null||i.call(t),(s=this._leakageMon)==null||s.dispose())}get event(){return this._event??(this._event=(e,t,i)=>{var l,a,o,c,_;if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let f=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(f);let u=this._leakageMon.getMostFrequentStack()??["UNKNOWN stack",-1],d=new a2(`${f}. HINT: Stack shows most frequent listener (${u[1]}-times)`,u[0]);return(((l=this._options)==null?void 0:l.onListenerError)||ua)(d),se.None}if(this._disposed)return se.None;t&&(e=e.bind(t));let s=new hc(e),r;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(s.stack=n2.create(),r=this._leakageMon.check(s.stack,this._size+1)),this._listeners?this._listeners instanceof hc?(this._deliveryQueue??(this._deliveryQueue=new u2),this._listeners=[this._listeners,s]):this._listeners.push(s):((o=(a=this._options)==null?void 0:a.onWillAddFirstListener)==null||o.call(a,this),this._listeners=s,(_=(c=this._options)==null?void 0:c.onDidAddFirstListener)==null||_.call(c,this)),this._size++;let n=Ee(()=>{r==null||r(),this._removeListener(s)});return i instanceof bs?i.add(n):Array.isArray(i)&&i.push(n),n}),this._event}_removeListener(e){var r,n,l,a;if((n=(r=this._options)==null?void 0:r.onWillRemoveListener)==null||n.call(r,this),!this._listeners)return;if(this._size===1){this._listeners=void 0,(a=(l=this._options)==null?void 0:l.onDidRemoveLastListener)==null||a.call(l,this),this._size=0;return}let t=this._listeners,i=t.indexOf(e);if(i===-1)throw console.log("disposed?",this._disposed),console.log("size?",this._size),console.log("arr?",JSON.stringify(this._listeners)),new Error("Attempted to dispose unknown listener");this._size--,t[i]=void 0;let s=this._deliveryQueue.current===this;if(this._size*c2<=t.length){let o=0;for(let c=0;c<t.length;c++)t[c]?t[o++]=t[c]:s&&(this._deliveryQueue.end--,o<this._deliveryQueue.i&&this._deliveryQueue.i--);t.length=o}}_deliver(e,t){var s;if(!e)return;let i=((s=this._options)==null?void 0:s.onListenerError)||ua;if(!i){e.value(t);return}try{e.value(t)}catch(r){i(r)}}_deliverQueue(e){let t=e.current._listeners;for(;e.i<e.end;)this._deliver(t[e.i++],e.value);e.reset()}fire(e){var t,i,s,r;if((t=this._deliveryQueue)!=null&&t.current&&(this._deliverQueue(this._deliveryQueue),(i=this._perfMon)==null||i.stop()),(s=this._perfMon)==null||s.start(this._size),this._listeners)if(this._listeners instanceof hc)this._deliver(this._listeners,e);else{let n=this._deliveryQueue;n.enqueue(this,e,this._listeners.length),this._deliverQueue(n)}(r=this._perfMon)==null||r.stop()}hasListeners(){return this._size>0}},u2=class{constructor(){this.i=-1,this.end=0}enqueue(e,t,i){this.i=0,this.end=i,this.current=e,this.value=t}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},Rh=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new z,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new z,this.onDidChangeFullscreen=this._onDidChangeFullscreen.event,this.mapWindowIdToFullScreen=new Map}getZoomLevel(t){return this.mapWindowIdToZoomLevel.get(this.getWindowId(t))??0}setZoomLevel(t,i){if(this.getZoomLevel(i)===t)return;let s=this.getWindowId(i);this.mapWindowIdToZoomLevel.set(s,t),this._onDidChangeZoomLevel.fire(s)}getZoomFactor(t){return this.mapWindowIdToZoomFactor.get(this.getWindowId(t))??1}setZoomFactor(t,i){this.mapWindowIdToZoomFactor.set(this.getWindowId(i),t)}setFullscreen(t,i){if(this.isFullscreen(i)===t)return;let s=this.getWindowId(i);this.mapWindowIdToFullScreen.set(s,t),this._onDidChangeFullscreen.fire(s)}isFullscreen(t){return!!this.mapWindowIdToFullScreen.get(this.getWindowId(t))}getWindowId(t){return t.vscodeWindowId}};Rh.INSTANCE=new Rh;var dd=Rh;function d2(e,t,i){typeof t=="string"&&(t=e.matchMedia(t)),t.addEventListener("change",i)}dd.INSTANCE.onDidChangeZoomLevel;function f2(e){return dd.INSTANCE.getZoomFactor(e)}dd.INSTANCE.onDidChangeFullscreen;var tn=typeof navigator=="object"?navigator.userAgent:"",Ah=tn.indexOf("Firefox")>=0,_2=tn.indexOf("AppleWebKit")>=0,fd=tn.indexOf("Chrome")>=0,p2=!fd&&tn.indexOf("Safari")>=0;tn.indexOf("Electron/")>=0;tn.indexOf("Android")>=0;var uc=!1;if(typeof ji.matchMedia=="function"){let e=ji.matchMedia("(display-mode: standalone) or (display-mode: window-controls-overlay)"),t=ji.matchMedia("(display-mode: fullscreen)");uc=e.matches,d2(ji,e,({matches:i})=>{uc&&t.matches||(uc=i)})}var xr="en",Nh=!1,Oh=!1,da=!1,Pv=!1,Pl,fa=xr,a_=xr,m2,ci,Ks=globalThis,at,ep;typeof Ks.vscode<"u"&&typeof Ks.vscode.process<"u"?at=Ks.vscode.process:typeof process<"u"&&typeof((ep=process==null?void 0:process.versions)==null?void 0:ep.node)=="string"&&(at=process);var tp,g2=typeof((tp=at==null?void 0:at.versions)==null?void 0:tp.electron)=="string",v2=g2&&(at==null?void 0:at.type)==="renderer",ip;if(typeof at=="object"){Nh=at.platform==="win32",Oh=at.platform==="darwin",da=at.platform==="linux",da&&at.env.SNAP&&at.env.SNAP_REVISION,at.env.CI||at.env.BUILD_ARTIFACTSTAGINGDIRECTORY,Pl=xr,fa=xr;let e=at.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);Pl=t.userLocale,a_=t.osLocale,fa=t.resolvedLanguage||xr,m2=(ip=t.languagePack)==null?void 0:ip.translationsConfigFile}catch{}Pv=!0}else typeof navigator=="object"&&!v2?(ci=navigator.userAgent,Nh=ci.indexOf("Windows")>=0,Oh=ci.indexOf("Macintosh")>=0,(ci.indexOf("Macintosh")>=0||ci.indexOf("iPad")>=0||ci.indexOf("iPhone")>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints>0,da=ci.indexOf("Linux")>=0,(ci==null?void 0:ci.indexOf("Mobi"))>=0,fa=globalThis._VSCODE_NLS_LANGUAGE||xr,Pl=navigator.language.toLowerCase(),a_=Pl):console.error("Unable to resolve platform.");var Kv=Nh,bi=Oh,S2=da,o_=Pv,Ci=ci,Fi=fa,y2;(e=>{function t(){return Fi}e.value=t;function i(){return Fi.length===2?Fi==="en":Fi.length>=3?Fi[0]==="e"&&Fi[1]==="n"&&Fi[2]==="-":!1}e.isDefaultVariant=i;function s(){return Fi==="en"}e.isDefault=s})(y2||(y2={}));var b2=typeof Ks.postMessage=="function"&&!Ks.importScripts;(()=>{if(b2){let e=[];Ks.addEventListener("message",i=>{if(i.data&&i.data.vscodeScheduleAsyncWork)for(let s=0,r=e.length;s<r;s++){let n=e[s];if(n.id===i.data.vscodeScheduleAsyncWork){e.splice(s,1),n.callback();return}}});let t=0;return i=>{let s=++t;e.push({id:s,callback:i}),Ks.postMessage({vscodeScheduleAsyncWork:s},"*")}}return e=>setTimeout(e)})();var C2=!!(Ci&&Ci.indexOf("Chrome")>=0);Ci&&Ci.indexOf("Firefox")>=0;!C2&&Ci&&Ci.indexOf("Safari")>=0;Ci&&Ci.indexOf("Edg/")>=0;Ci&&Ci.indexOf("Android")>=0;var ar=typeof navigator=="object"?navigator:{};o_||document.queryCommandSupported&&document.queryCommandSupported("copy")||ar&&ar.clipboard&&ar.clipboard.writeText,o_||ar&&ar.clipboard&&ar.clipboard.readText;var _d=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}},dc=new _d,c_=new _d,h_=new _d,w2=new Array(230),Wv;(e=>{function t(a){return dc.keyCodeToStr(a)}e.toString=t;function i(a){return dc.strToKeyCode(a)}e.fromString=i;function s(a){return c_.keyCodeToStr(a)}e.toUserSettingsUS=s;function r(a){return h_.keyCodeToStr(a)}e.toUserSettingsGeneral=r;function n(a){return c_.strToKeyCode(a)||h_.strToKeyCode(a)}e.fromUserSettings=n;function l(a){if(a>=98&&a<=113)return null;switch(a){case 16:return"Up";case 18:return"Down";case 15:return"Left";case 17:return"Right"}return dc.keyCodeToStr(a)}e.toElectronAccelerator=l})(Wv||(Wv={}));var x2=class Yv{constructor(t,i,s,r,n){this.ctrlKey=t,this.shiftKey=i,this.altKey=s,this.metaKey=r,this.keyCode=n}equals(t){return t instanceof Yv&&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",i=this.shiftKey?"1":"0",s=this.altKey?"1":"0",r=this.metaKey?"1":"0";return`K${t}${i}${s}${r}${this.keyCode}`}isModifierKey(){return this.keyCode===0||this.keyCode===5||this.keyCode===57||this.keyCode===6||this.keyCode===4}toKeybinding(){return new E2([this])}isDuplicateModifierCase(){return this.ctrlKey&&this.keyCode===5||this.shiftKey&&this.keyCode===4||this.altKey&&this.keyCode===6||this.metaKey&&this.keyCode===57}},E2=class{constructor(e){if(e.length===0)throw Fb("chords");this.chords=e}getHashCode(){let e="";for(let t=0,i=this.chords.length;t<i;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 k2(e){if(e.charCode){let i=String.fromCharCode(e.charCode).toUpperCase();return Wv.fromString(i)}let t=e.keyCode;if(t===3)return 7;if(Ah)switch(t){case 59:return 85;case 60:if(S2)return 97;break;case 61:return 86;case 107:return 109;case 109:return 111;case 173:return 88;case 224:if(bi)return 57;break}else if(_2&&(bi&&t===93||!bi&&t===92))return 57;return w2[t]||0}var T2=bi?256:2048,D2=512,M2=1024,B2=bi?2048:256,u_=class{constructor(e){var i;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=(i=t.getModifierState)==null?void 0:i.call(t,"AltGraph"),this.keyCode=k2(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|=T2),this.altKey&&(t|=D2),this.shiftKey&&(t|=M2),this.metaKey&&(t|=B2),t|=e,t}_computeKeyCodeChord(){let e=0;return this.keyCode!==5&&this.keyCode!==4&&this.keyCode!==6&&this.keyCode!==57&&(e=this.keyCode),new x2(this.ctrlKey,this.shiftKey,this.altKey,this.metaKey,e)}},d_=new WeakMap;function R2(e){if(!e.parent||e.parent===e)return null;try{let t=e.location,i=e.parent.location;if(t.origin!=="null"&&i.origin!=="null"&&t.origin!==i.origin)return null}catch{return null}return e.parent}var A2=class{static getSameOriginWindowChain(e){let t=d_.get(e);if(!t){t=[],d_.set(e,t);let i=e,s;do s=R2(i),s?t.push({window:new WeakRef(i),iframeElement:i.frameElement||null}):t.push({window:new WeakRef(i),iframeElement:null}),i=s;while(i)}return t.slice(0)}static getPositionOfChildWindowRelativeToAncestorWindow(e,t){if(!t||e===t)return{top:0,left:0};let i=0,s=0,r=this.getSameOriginWindowChain(e);for(let n of r){let l=n.window.deref();if(i+=(l==null?void 0:l.scrollY)??0,s+=(l==null?void 0:l.scrollX)??0,l===t||!n.iframeElement)break;let a=n.iframeElement.getBoundingClientRect();i+=a.top,s+=a.left}return{top:i,left:s}}},Kl=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 i=A2.getPositionOfChildWindowRelativeToAncestorWindow(e,t.view);this.posx-=i.left,this.posy-=i.top}preventDefault(){this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent.stopPropagation()}},f_=class{constructor(e,t=0,i=0){var r;this.browserEvent=e||null,this.target=e?e.target||e.targetNode||e.srcElement:null,this.deltaY=i,this.deltaX=t;let s=!1;if(fd){let n=navigator.userAgent.match(/Chrome\/(\d+)/);s=(n?parseInt(n[1]):123)<=122}if(e){let n=e,l=e,a=((r=e.view)==null?void 0:r.devicePixelRatio)||1;if(typeof n.wheelDeltaY<"u")s?this.deltaY=n.wheelDeltaY/(120*a):this.deltaY=n.wheelDeltaY/120;else if(typeof l.VERTICAL_AXIS<"u"&&l.axis===l.VERTICAL_AXIS)this.deltaY=-l.detail/3;else if(e.type==="wheel"){let o=e;o.deltaMode===o.DOM_DELTA_LINE?Ah&&!bi?this.deltaY=-e.deltaY/3:this.deltaY=-e.deltaY:this.deltaY=-e.deltaY/40}if(typeof n.wheelDeltaX<"u")p2&&Kv?this.deltaX=-(n.wheelDeltaX/120):s?this.deltaX=n.wheelDeltaX/(120*a):this.deltaX=n.wheelDeltaX/120;else if(typeof l.HORIZONTAL_AXIS<"u"&&l.axis===l.HORIZONTAL_AXIS)this.deltaX=-e.detail/3;else if(e.type==="wheel"){let o=e;o.deltaMode===o.DOM_DELTA_LINE?Ah&&!bi?this.deltaX=-e.deltaX/3:this.deltaX=-e.deltaX:this.deltaX=-e.deltaX/40}this.deltaY===0&&this.deltaX===0&&e.wheelDelta&&(s?this.deltaY=e.wheelDelta/(120*a):this.deltaY=e.wheelDelta/120)}}preventDefault(){var e;(e=this.browserEvent)==null||e.preventDefault()}stopPropagation(){var e;(e=this.browserEvent)==null||e.stopPropagation()}},Vv=Object.freeze(function(e,t){let i=setTimeout(e.bind(t),0);return{dispose(){clearTimeout(i)}}}),N2;(e=>{function t(i){return i===e.None||i===e.Cancelled||i instanceof O2?!0:!i||typeof i!="object"?!1:typeof i.isCancellationRequested=="boolean"&&typeof i.onCancellationRequested=="function"}e.isCancellationToken=t,e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:ht.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:Vv})})(N2||(N2={}));var O2=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?Vv:(this._emitter||(this._emitter=new z),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}},pd=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 kh("Calling 'cancelAndSet' on a disposed TimeoutTimer");this.cancel(),this._token=setTimeout(()=>{this._token=-1,e()},t)}setIfNotSet(e,t){if(this._isDisposed)throw new kh("Calling 'setIfNotSet' on a disposed TimeoutTimer");this._token===-1&&(this._token=setTimeout(()=>{this._token=-1,e()},t))}},L2=class{constructor(){this.disposable=void 0,this.isDisposed=!1}cancel(){var e;(e=this.disposable)==null||e.dispose(),this.disposable=void 0}cancelAndSet(e,t,i=globalThis){if(this.isDisposed)throw new kh("Calling 'cancelAndSet' on a disposed IntervalTimer");this.cancel();let s=i.setInterval(()=>{e()},t);this.disposable=Ee(()=>{i.clearInterval(s),this.disposable=void 0})}dispose(){this.cancel(),this.isDisposed=!0}},z2;(e=>{async function t(s){let r,n=await Promise.all(s.map(l=>l.then(a=>a,a=>{r||(r=a)})));if(typeof r<"u")throw r;return n}e.settled=t;function i(s){return new Promise(async(r,n)=>{try{await s(r,n)}catch(l){n(l)}})}e.withAsyncBody=i})(z2||(z2={}));var __=class Xt{static fromArray(t){return new Xt(i=>{i.emitMany(t)})}static fromPromise(t){return new Xt(async i=>{i.emitMany(await t)})}static fromPromises(t){return new Xt(async i=>{await Promise.all(t.map(async s=>i.emitOne(await s)))})}static merge(t){return new Xt(async i=>{await Promise.all(t.map(async s=>{for await(let r of s)i.emitOne(r)}))})}constructor(t,i){this._state=0,this._results=[],this._error=null,this._onReturn=i,this._onStateChanged=new z,queueMicrotask(async()=>{let s={emitOne:r=>this.emitOne(r),emitMany:r=>this.emitMany(r),reject:r=>this.reject(r)};try{await Promise.resolve(t(s)),this.resolve()}catch(r){this.reject(r)}finally{s.emitOne=void 0,s.emitMany=void 0,s.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 ht.toPromise(this._onStateChanged.event)}while(!0)},return:async()=>{var i;return(i=this._onReturn)==null||i.call(this),{done:!0,value:void 0}}}}static map(t,i){return new Xt(async s=>{for await(let r of t)s.emitOne(i(r))})}map(t){return Xt.map(this,t)}static filter(t,i){return new Xt(async s=>{for await(let r of t)i(r)&&s.emitOne(r)})}filter(t){return Xt.filter(this,t)}static coalesce(t){return Xt.filter(t,i=>!!i)}coalesce(){return Xt.coalesce(this)}static async toPromise(t){let i=[];for await(let s of t)i.push(s);return i}toPromise(){return Xt.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())}};__.EMPTY=__.fromArray([]);var{getWindow:Si,getWindowId:j2,onDidRegisterWindow:H2}=function(){let e=new Map,t={window:ji,disposables:new bs};e.set(ji.vscodeWindowId,t);let i=new z,s=new z,r=new z;function n(l,a){return(typeof l=="number"?e.get(l):void 0)??(a?t:void 0)}return{onDidRegisterWindow:i.event,onWillUnregisterWindow:r.event,onDidUnregisterWindow:s.event,registerWindow(l){if(e.has(l.vscodeWindowId))return se.None;let a=new bs,o={window:l,disposables:a.add(new bs)};return e.set(l.vscodeWindowId,o),a.add(Ee(()=>{e.delete(l.vscodeWindowId),s.fire(l)})),a.add(G(l,Ze.BEFORE_UNLOAD,()=>{r.fire(l)})),i.fire(o),a},getWindows(){return e.values()},getWindowsCount(){return e.size},getWindowId(l){return l.vscodeWindowId},hasWindow(l){return e.has(l)},getWindowById:n,getWindow(l){var c;let a=l;if((c=a==null?void 0:a.ownerDocument)!=null&&c.defaultView)return a.ownerDocument.defaultView.window;let o=l;return o!=null&&o.view?o.view.window:ji},getDocument(l){return Si(l).document}}}(),U2=class{constructor(e,t,i,s){this._node=e,this._type=t,this._handler=i,this._options=s||!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 G(e,t,i,s){return new U2(e,t,i,s)}var p_=function(e,t,i,s){return G(e,t,i,s)},md,q2=class extends L2{constructor(e){super(),this.defaultTarget=e&&Si(e)}cancelAndSet(e,t,i){return super.cancelAndSet(e,t,i??this.defaultTarget)}},m_=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){ua(e)}}static sort(e,t){return t.priority-e.priority}};(function(){let e=new Map,t=new Map,i=new Map,s=new Map,r=n=>{i.set(n,!1);let l=e.get(n)??[];for(t.set(n,l),e.set(n,[]),s.set(n,!0);l.length>0;)l.sort(m_.sort),l.shift().execute();s.set(n,!1)};md=(n,l,a=0)=>{let o=j2(n),c=new m_(l,a),_=e.get(o);return _||(_=[],e.set(o,_)),_.push(c),i.get(o)||(i.set(o,!0),n.requestAnimationFrame(()=>r(o))),c}})();function P2(e){let t=e.getBoundingClientRect(),i=Si(e);return{left:t.left+i.scrollX,top:t.top+i.scrollY,width:t.width,height:t.height}}var Ze={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"},K2=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=Et(e);this._maxWidth!==t&&(this._maxWidth=t,this.domNode.style.maxWidth=this._maxWidth)}setWidth(e){let t=Et(e);this._width!==t&&(this._width=t,this.domNode.style.width=this._width)}setHeight(e){let t=Et(e);this._height!==t&&(this._height=t,this.domNode.style.height=this._height)}setTop(e){let t=Et(e);this._top!==t&&(this._top=t,this.domNode.style.top=this._top)}setLeft(e){let t=Et(e);this._left!==t&&(this._left=t,this.domNode.style.left=this._left)}setBottom(e){let t=Et(e);this._bottom!==t&&(this._bottom=t,this.domNode.style.bottom=this._bottom)}setRight(e){let t=Et(e);this._right!==t&&(this._right=t,this.domNode.style.right=this._right)}setPaddingTop(e){let t=Et(e);this._paddingTop!==t&&(this._paddingTop=t,this.domNode.style.paddingTop=this._paddingTop)}setPaddingLeft(e){let t=Et(e);this._paddingLeft!==t&&(this._paddingLeft=t,this.domNode.style.paddingLeft=this._paddingLeft)}setPaddingBottom(e){let t=Et(e);this._paddingBottom!==t&&(this._paddingBottom=t,this.domNode.style.paddingBottom=this._paddingBottom)}setPaddingRight(e){let t=Et(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=Et(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=Et(e);this._lineHeight!==t&&(this._lineHeight=t,this.domNode.style.lineHeight=this._lineHeight)}setLetterSpacing(e){let t=Et(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 Et(e){return typeof e=="number"?`${e}px`:e}function Wn(e){return new K2(e)}var Iv=class{constructor(){this._hooks=new bs,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 i=this._onStopCallback;this._onStopCallback=null,e&&i&&i(t)}isMonitoring(){return!!this._pointerMoveCallback}startMonitoring(e,t,i,s,r){this.isMonitoring()&&this.stopMonitoring(!1),this._pointerMoveCallback=s,this._onStopCallback=r;let n=e;try{e.setPointerCapture(t),this._hooks.add(Ee(()=>{try{e.releasePointerCapture(t)}catch{}}))}catch{n=Si(e)}this._hooks.add(G(n,Ze.POINTER_MOVE,l=>{if(l.buttons!==i){this.stopMonitoring(!0);return}l.preventDefault(),this._pointerMoveCallback(l)})),this._hooks.add(G(n,Ze.POINTER_UP,l=>this.stopMonitoring(!0)))}};function W2(e,t,i){let s=null,r=null;if(typeof i.value=="function"?(s="value",r=i.value,r.length!==0&&console.warn("Memoize should only be used in functions with zero parameters")):typeof i.get=="function"&&(s="get",r=i.get),!r)throw new Error("not supported");let n=`$memoize$${t}`;i[s]=function(...l){return this.hasOwnProperty(n)||Object.defineProperty(this,n,{configurable:!1,enumerable:!1,writable:!1,value:r.apply(this,l)}),this[n]}}var pi;(e=>(e.Tap="-xterm-gesturetap",e.Change="-xterm-gesturechange",e.Start="-xterm-gesturestart",e.End="-xterm-gesturesend",e.Contextmenu="-xterm-gesturecontextmenu"))(pi||(pi={}));var wn=class ft extends se{constructor(){super(),this.dispatched=!1,this.targets=new l_,this.ignoreTargets=new l_,this.activeTouches={},this.handle=null,this._lastSetTapCountTime=0,this._register(ht.runAndSubscribe(H2,({window:t,disposables:i})=>{i.add(G(t.document,"touchstart",s=>this.onTouchStart(s),{passive:!1})),i.add(G(t.document,"touchend",s=>this.onTouchEnd(t,s))),i.add(G(t.document,"touchmove",s=>this.onTouchMove(s),{passive:!1}))},{window:ji,disposables:this._store}))}static addTarget(t){if(!ft.isTouchDevice())return se.None;ft.INSTANCE||(ft.INSTANCE=new ft);let i=ft.INSTANCE.targets.push(t);return Ee(i)}static ignoreTarget(t){if(!ft.isTouchDevice())return se.None;ft.INSTANCE||(ft.INSTANCE=new ft);let i=ft.INSTANCE.ignoreTargets.push(t);return Ee(i)}static isTouchDevice(){return"ontouchstart"in ji||navigator.maxTouchPoints>0}dispose(){this.handle&&(this.handle.dispose(),this.handle=null),super.dispose()}onTouchStart(t){let i=Date.now();this.handle&&(this.handle.dispose(),this.handle=null);for(let s=0,r=t.targetTouches.length;s<r;s++){let n=t.targetTouches.item(s);this.activeTouches[n.identifier]={id:n.identifier,initialTarget:n.target,initialTimeStamp:i,initialPageX:n.pageX,initialPageY:n.pageY,rollingTimestamps:[i],rollingPageX:[n.pageX],rollingPageY:[n.pageY]};let l=this.newGestureEvent(pi.Start,n.target);l.pageX=n.pageX,l.pageY=n.pageY,this.dispatchEvent(l)}this.dispatched&&(t.preventDefault(),t.stopPropagation(),this.dispatched=!1)}onTouchEnd(t,i){let s=Date.now(),r=Object.keys(this.activeTouches).length;for(let n=0,l=i.changedTouches.length;n<l;n++){let a=i.changedTouches.item(n);if(!this.activeTouches.hasOwnProperty(String(a.identifier))){console.warn("move of an UNKNOWN touch",a);continue}let o=this.activeTouches[a.identifier],c=Date.now()-o.initialTimeStamp;if(c<ft.HOLD_DELAY&&Math.abs(o.initialPageX-At(o.rollingPageX))<30&&Math.abs(o.initialPageY-At(o.rollingPageY))<30){let _=this.newGestureEvent(pi.Tap,o.initialTarget);_.pageX=At(o.rollingPageX),_.pageY=At(o.rollingPageY),this.dispatchEvent(_)}else if(c>=ft.HOLD_DELAY&&Math.abs(o.initialPageX-At(o.rollingPageX))<30&&Math.abs(o.initialPageY-At(o.rollingPageY))<30){let _=this.newGestureEvent(pi.Contextmenu,o.initialTarget);_.pageX=At(o.rollingPageX),_.pageY=At(o.rollingPageY),this.dispatchEvent(_)}else if(r===1){let _=At(o.rollingPageX),f=At(o.rollingPageY),u=At(o.rollingTimestamps)-o.rollingTimestamps[0],d=_-o.rollingPageX[0],g=f-o.rollingPageY[0],y=[...this.targets].filter(C=>o.initialTarget instanceof Node&&C.contains(o.initialTarget));this.inertia(t,y,s,Math.abs(d)/u,d>0?1:-1,_,Math.abs(g)/u,g>0?1:-1,f)}this.dispatchEvent(this.newGestureEvent(pi.End,o.initialTarget)),delete this.activeTouches[a.identifier]}this.dispatched&&(i.preventDefault(),i.stopPropagation(),this.dispatched=!1)}newGestureEvent(t,i){let s=document.createEvent("CustomEvent");return s.initEvent(t,!1,!0),s.initialTarget=i,s.tapCount=0,s}dispatchEvent(t){if(t.type===pi.Tap){let i=new Date().getTime(),s=0;i-this._lastSetTapCountTime>ft.CLEAR_TAP_COUNT_TIME?s=1:s=2,this._lastSetTapCountTime=i,t.tapCount=s}else(t.type===pi.Change||t.type===pi.Contextmenu)&&(this._lastSetTapCountTime=0);if(t.initialTarget instanceof Node){for(let s of this.ignoreTargets)if(s.contains(t.initialTarget))return;let i=[];for(let s of this.targets)if(s.contains(t.initialTarget)){let r=0,n=t.initialTarget;for(;n&&n!==s;)r++,n=n.parentElement;i.push([r,s])}i.sort((s,r)=>s[0]-r[0]);for(let[s,r]of i)r.dispatchEvent(t),this.dispatched=!0}}inertia(t,i,s,r,n,l,a,o,c){this.handle=md(t,()=>{let _=Date.now(),f=_-s,u=0,d=0,g=!0;r+=ft.SCROLL_FRICTION*f,a+=ft.SCROLL_FRICTION*f,r>0&&(g=!1,u=n*r*f),a>0&&(g=!1,d=o*a*f);let y=this.newGestureEvent(pi.Change);y.translationX=u,y.translationY=d,i.forEach(C=>C.dispatchEvent(y)),g||this.inertia(t,i,_,r,n,l+u,a,o,c+d)})}onTouchMove(t){let i=Date.now();for(let s=0,r=t.changedTouches.length;s<r;s++){let n=t.changedTouches.item(s);if(!this.activeTouches.hasOwnProperty(String(n.identifier))){console.warn("end of an UNKNOWN touch",n);continue}let l=this.activeTouches[n.identifier],a=this.newGestureEvent(pi.Change,l.initialTarget);a.translationX=n.pageX-At(l.rollingPageX),a.translationY=n.pageY-At(l.rollingPageY),a.pageX=n.pageX,a.pageY=n.pageY,this.dispatchEvent(a),l.rollingPageX.length>3&&(l.rollingPageX.shift(),l.rollingPageY.shift(),l.rollingTimestamps.shift()),l.rollingPageX.push(n.pageX),l.rollingPageY.push(n.pageY),l.rollingTimestamps.push(i)}this.dispatched&&(t.preventDefault(),t.stopPropagation(),this.dispatched=!1)}};wn.SCROLL_FRICTION=-.005,wn.HOLD_DELAY=700,wn.CLEAR_TAP_COUNT_TIME=400,Ae([W2],wn,"isTouchDevice",1);var Y2=wn,gd=class extends se{onclick(e,t){this._register(G(e,Ze.CLICK,i=>t(new Kl(Si(e),i))))}onmousedown(e,t){this._register(G(e,Ze.MOUSE_DOWN,i=>t(new Kl(Si(e),i))))}onmouseover(e,t){this._register(G(e,Ze.MOUSE_OVER,i=>t(new Kl(Si(e),i))))}onmouseleave(e,t){this._register(G(e,Ze.MOUSE_LEAVE,i=>t(new Kl(Si(e),i))))}onkeydown(e,t){this._register(G(e,Ze.KEY_DOWN,i=>t(new u_(i))))}onkeyup(e,t){this._register(G(e,Ze.KEY_UP,i=>t(new u_(i))))}oninput(e,t){this._register(G(e,Ze.INPUT,t))}onblur(e,t){this._register(G(e,Ze.BLUR,t))}onfocus(e,t){this._register(G(e,Ze.FOCUS,t))}onchange(e,t){this._register(G(e,Ze.CHANGE,t))}ignoreGesture(e){return Y2.ignoreTarget(e)}},g_=11,V2=class extends gd{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=g_+"px",this.domNode.style.height=g_+"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 Iv),this._register(p_(this.bgDomNode,Ze.POINTER_DOWN,t=>this._arrowPointerDown(t))),this._register(p_(this.domNode,Ze.POINTER_DOWN,t=>this._arrowPointerDown(t))),this._pointerdownRepeatTimer=this._register(new q2),this._pointerdownScheduleRepeatTimer=this._register(new pd)}_arrowPointerDown(e){if(!e.target||!(e.target instanceof Element))return;let t=()=>{this._pointerdownRepeatTimer.cancelAndSet(()=>this._onActivate(),1e3/24,Si(e))};this._onActivate(),this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancelAndSet(t,200),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,i=>{},()=>{this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancel()}),e.preventDefault()}},I2=class Lh{constructor(t,i,s,r,n,l,a){this._forceIntegerValues=t,this._scrollStateBrand=void 0,this._forceIntegerValues&&(i=i|0,s=s|0,r=r|0,n=n|0,l=l|0,a=a|0),this.rawScrollLeft=r,this.rawScrollTop=a,i<0&&(i=0),r+i>s&&(r=s-i),r<0&&(r=0),n<0&&(n=0),a+n>l&&(a=l-n),a<0&&(a=0),this.width=i,this.scrollWidth=s,this.scrollLeft=r,this.height=n,this.scrollHeight=l,this.scrollTop=a}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,i){return new Lh(this._forceIntegerValues,typeof t.width<"u"?t.width:this.width,typeof t.scrollWidth<"u"?t.scrollWidth:this.scrollWidth,i?this.rawScrollLeft:this.scrollLeft,typeof t.height<"u"?t.height:this.height,typeof t.scrollHeight<"u"?t.scrollHeight:this.scrollHeight,i?this.rawScrollTop:this.scrollTop)}withScrollPosition(t){return new Lh(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,i){let s=this.width!==t.width,r=this.scrollWidth!==t.scrollWidth,n=this.scrollLeft!==t.scrollLeft,l=this.height!==t.height,a=this.scrollHeight!==t.scrollHeight,o=this.scrollTop!==t.scrollTop;return{inSmoothScrolling:i,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:s,scrollWidthChanged:r,scrollLeftChanged:n,heightChanged:l,scrollHeightChanged:a,scrollTopChanged:o}}},X2=class extends se{constructor(e){super(),this._scrollableBrand=void 0,this._onScroll=this._register(new z),this.onScroll=this._onScroll.event,this._smoothScrollDuration=e.smoothScrollDuration,this._scheduleAtNextAnimationFrame=e.scheduleAtNextAnimationFrame,this._state=new I2(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){var s;let i=this._state.withScrollDimensions(e,t);this._setState(i,!!this._smoothScrolling),(s=this._smoothScrolling)==null||s.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 i=this._state.withScrollPosition(e);if(this._smoothScrolling.to.scrollLeft===i.scrollLeft&&this._smoothScrolling.to.scrollTop===i.scrollTop)return;let s;t?s=new S_(this._smoothScrolling.from,i,this._smoothScrolling.startTime,this._smoothScrolling.duration):s=this._smoothScrolling.combine(this._state,i,this._smoothScrollDuration),this._smoothScrolling.dispose(),this._smoothScrolling=s}else{let i=this._state.withScrollPosition(e);this._smoothScrolling=S_.start(this._state,i,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 i=this._state;i.equals(e)||(this._state=e,this._onScroll.fire(this._state.createScrollEvent(i,t)))}},v_=class{constructor(e,t,i){this.scrollLeft=e,this.scrollTop=t,this.isDone=i}};function fc(e,t){let i=t-e;return function(s){return e+i*F2(s)}}function G2(e,t,i){return function(s){return s<i?e(s/i):t((s-i)/(1-i))}}var S_=class zh{constructor(t,i,s,r){this.from=t,this.to=i,this.duration=r,this.startTime=s,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,i,s){if(Math.abs(t-i)>2.5*s){let r,n;return t<i?(r=t+.75*s,n=i-.75*s):(r=t-.75*s,n=i+.75*s),G2(fc(t,r),fc(n,i),.33)}return fc(t,i)}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 i=(t-this.startTime)/this.duration;if(i<1){let s=this.scrollLeft(i),r=this.scrollTop(i);return new v_(s,r,!1)}return new v_(this.to.scrollLeft,this.to.scrollTop,!0)}combine(t,i,s){return zh.start(t,i,s)}static start(t,i,s){s=s+10;let r=Date.now()-10;return new zh(t,i,r,s)}};function $2(e){return Math.pow(e,3)}function F2(e){return 1-$2(1-e)}var Z2=class extends se{constructor(e,t,i){super(),this._visibility=e,this._visibleClassName=t,this._invisibleClassName=i,this._domNode=null,this._isVisible=!1,this._isNeeded=!1,this._rawShouldBeVisible=!1,this._shouldBeVisible=!1,this._revealTimer=this._register(new pd)}setVisibility(e){this._visibility!==e&&(this._visibility=e,this._updateShouldBeVisible())}setShouldBeVisible(e){this._rawShouldBeVisible=e,this._updateShouldBeVisible()}_applyVisibilitySetting(){return this._visibility===2?!1:this._visibility===3?!0:this._rawShouldBeVisible}_updateShouldBeVisible(){let e=this._applyVisibilitySetting();this._shouldBeVisible!==e&&(this._shouldBeVisible=e,this.ensureVisibility())}setIsNeeded(e){this._isNeeded!==e&&(this._isNeeded=e,this.ensureVisibility())}setDomNode(e){this._domNode=e,this._domNode.setClassName(this._invisibleClassName),this.setShouldBeVisible(!1)}ensureVisibility(){if(!this._isNeeded){this._hide(!1);return}this._shouldBeVisible?this._reveal():this._hide(!0)}_reveal(){this._isVisible||(this._isVisible=!0,this._revealTimer.setIfNotSet(()=>{var e;(e=this._domNode)==null||e.setClassName(this._visibleClassName)},0))}_hide(e){var t;this._revealTimer.cancel(),this._isVisible&&(this._isVisible=!1,(t=this._domNode)==null||t.setClassName(this._invisibleClassName+(e?" fade":"")))}},Q2=140,Xv=class extends gd{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 Z2(e.visibility,"visible scrollbar "+e.extraScrollbarClassName,"invisible scrollbar "+e.extraScrollbarClassName)),this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._pointerMoveMonitor=this._register(new Iv),this._shouldRender=!0,this.domNode=Wn(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(G(this.domNode.domNode,Ze.POINTER_DOWN,t=>this._domNodePointerDown(t)))}_createArrow(e){let t=this._register(new V2(e));this.domNode.domNode.appendChild(t.bgDomNode),this.domNode.domNode.appendChild(t.domNode)}_createSlider(e,t,i,s){this.slider=Wn(document.createElement("div")),this.slider.setClassName("slider"),this.slider.setPosition("absolute"),this.slider.setTop(e),this.slider.setLeft(t),typeof i=="number"&&this.slider.setWidth(i),typeof s=="number"&&this.slider.setHeight(s),this.slider.setLayerHinting(!0),this.slider.setContain("strict"),this.domNode.domNode.appendChild(this.slider.domNode),this._register(G(this.slider.domNode,Ze.POINTER_DOWN,r=>{r.button===0&&(r.preventDefault(),this._sliderPointerDown(r))})),this.onclick(this.slider.domNode,r=>{r.leftButton&&r.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,i=t+this._scrollbarState.getSliderPosition(),s=t+this._scrollbarState.getSliderPosition()+this._scrollbarState.getSliderSize(),r=this._sliderPointerPosition(e);i<=r&&r<=s?e.button===0&&(e.preventDefault(),this._sliderPointerDown(e)):this._onPointerDown(e)}_onPointerDown(e){let t,i;if(e.target===this.domNode.domNode&&typeof e.offsetX=="number"&&typeof e.offsetY=="number")t=e.offsetX,i=e.offsetY;else{let r=P2(this.domNode.domNode);t=e.pageX-r.left,i=e.pageY-r.top}let s=this._pointerDownRelativePosition(t,i);this._setDesiredScrollPositionNow(this._scrollByPage?this._scrollbarState.getDesiredScrollPositionFromOffsetPaged(s):this._scrollbarState.getDesiredScrollPositionFromOffset(s)),e.button===0&&(e.preventDefault(),this._sliderPointerDown(e))}_sliderPointerDown(e){if(!e.target||!(e.target instanceof Element))return;let t=this._sliderPointerPosition(e),i=this._sliderOrthogonalPointerPosition(e),s=this._scrollbarState.clone();this.slider.toggleClassName("active",!0),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,r=>{let n=this._sliderOrthogonalPointerPosition(r),l=Math.abs(n-i);if(Kv&&l>Q2){this._setDesiredScrollPositionNow(s.getScrollPosition());return}let a=this._sliderPointerPosition(r)-t;this._setDesiredScrollPositionNow(s.getDesiredScrollPositionFromDelta(a))},()=>{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()}},Gv=class jh{constructor(t,i,s,r,n,l){this._scrollbarSize=Math.round(i),this._oppositeScrollbarSize=Math.round(s),this._arrowSize=Math.round(t),this._visibleSize=r,this._scrollSize=n,this._scrollPosition=l,this._computedAvailableSize=0,this._computedIsNeeded=!1,this._computedSliderSize=0,this._computedSliderRatio=0,this._computedSliderPosition=0,this._refreshComputedValues()}clone(){return new jh(this._arrowSize,this._scrollbarSize,this._oppositeScrollbarSize,this._visibleSize,this._scrollSize,this._scrollPosition)}setVisibleSize(t){let i=Math.round(t);return this._visibleSize!==i?(this._visibleSize=i,this._refreshComputedValues(),!0):!1}setScrollSize(t){let i=Math.round(t);return this._scrollSize!==i?(this._scrollSize=i,this._refreshComputedValues(),!0):!1}setScrollPosition(t){let i=Math.round(t);return this._scrollPosition!==i?(this._scrollPosition=i,this._refreshComputedValues(),!0):!1}setScrollbarSize(t){this._scrollbarSize=Math.round(t)}setOppositeScrollbarSize(t){this._oppositeScrollbarSize=Math.round(t)}static _computeValues(t,i,s,r,n){let l=Math.max(0,s-t),a=Math.max(0,l-2*i),o=r>0&&r>s;if(!o)return{computedAvailableSize:Math.round(l),computedIsNeeded:o,computedSliderSize:Math.round(a),computedSliderRatio:0,computedSliderPosition:0};let c=Math.round(Math.max(20,Math.floor(s*a/r))),_=(a-c)/(r-s),f=n*_;return{computedAvailableSize:Math.round(l),computedIsNeeded:o,computedSliderSize:Math.round(c),computedSliderRatio:_,computedSliderPosition:Math.round(f)}}_refreshComputedValues(){let t=jh._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 i=t-this._arrowSize-this._computedSliderSize/2;return Math.round(i/this._computedSliderRatio)}getDesiredScrollPositionFromOffsetPaged(t){if(!this._computedIsNeeded)return 0;let i=t-this._arrowSize,s=this._scrollPosition;return i<this._computedSliderPosition?s-=this._visibleSize:s+=this._visibleSize,s}getDesiredScrollPositionFromDelta(t){if(!this._computedIsNeeded)return 0;let i=this._computedSliderPosition+t;return Math.round(i/this._computedSliderRatio)}},J2=class extends Xv{constructor(e,t,i){let s=e.getScrollDimensions(),r=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:i,scrollbarState:new Gv(t.horizontalHasArrows?t.arrowSize:0,t.horizontal===2?0:t.horizontalScrollbarSize,t.vertical===2?0:t.verticalScrollbarSize,s.width,s.scrollWidth,r.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}},eC=class extends Xv{constructor(e,t,i){let s=e.getScrollDimensions(),r=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:i,scrollbarState:new Gv(t.verticalHasArrows?t.arrowSize:0,t.vertical===2?0:t.verticalScrollbarSize,0,s.height,s.scrollHeight,r.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}},tC=500,y_=50,iC=class{constructor(e,t,i){this.timestamp=e,this.deltaX=t,this.deltaY=i,this.score=0}},Hh=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,i=0,s=1,r=this._rear;do{let n=r===this._front?t:Math.pow(2,-s);if(t-=n,i+=this._memory[r].score*n,r===this._front)break;r=(this._capacity+r-1)%this._capacity,s++}while(!0);return i<=.5}acceptStandardWheelEvent(t){if(fd){let i=Si(t.browserEvent),s=f2(i);this.accept(Date.now(),t.deltaX*s,t.deltaY*s)}else this.accept(Date.now(),t.deltaX,t.deltaY)}accept(t,i,s){let r=null,n=new iC(t,i,s);this._front===-1&&this._rear===-1?(this._memory[0]=n,this._front=0,this._rear=0):(r=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]=n),n.score=this._computeScore(n,r)}_computeScore(t,i){if(Math.abs(t.deltaX)>0&&Math.abs(t.deltaY)>0)return 1;let s=.5;if((!this._isAlmostInt(t.deltaX)||!this._isAlmostInt(t.deltaY))&&(s+=.25),i){let r=Math.abs(t.deltaX),n=Math.abs(t.deltaY),l=Math.abs(i.deltaX),a=Math.abs(i.deltaY),o=Math.max(Math.min(r,l),1),c=Math.max(Math.min(n,a),1),_=Math.max(r,l),f=Math.max(n,a);_%o===0&&f%c===0&&(s-=.5)}return Math.min(Math.max(s,0),1)}_isAlmostInt(t){return Math.abs(Math.round(t)-t)<.01}};Hh.INSTANCE=new Hh;var sC=Hh,rC=class extends gd{constructor(e,t,i){super(),this._onScroll=this._register(new z),this.onScroll=this._onScroll.event,this._onWillScroll=this._register(new z),this.onWillScroll=this._onWillScroll.event,this._options=lC(t),this._scrollable=i,this._register(this._scrollable.onScroll(r=>{this._onWillScroll.fire(r),this._onDidScroll(r),this._onScroll.fire(r)}));let s={onMouseWheel:r=>this._onMouseWheel(r),onDragStart:()=>this._onDragStart(),onDragEnd:()=>this._onDragEnd()};this._verticalScrollbar=this._register(new eC(this._scrollable,this._options,s)),this._horizontalScrollbar=this._register(new J2(this._scrollable,this._options,s)),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=Wn(document.createElement("div")),this._leftShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._leftShadowDomNode.domNode),this._topShadowDomNode=Wn(document.createElement("div")),this._topShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._topShadowDomNode.domNode),this._topLeftShadowDomNode=Wn(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,r=>this._onMouseOver(r)),this.onmouseleave(this._listenOnDomNode,r=>this._onMouseLeave(r)),this._hideTimeout=this._register(new pd),this._isDragging=!1,this._mouseIsOver=!1,this._shouldRender=!0,this._revealOnScroll=!0}get options(){return this._options}dispose(){this._mouseWheelToDispose=Gs(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,bi&&(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 f_(e))}_setListeningToMouseWheel(e){if(this._mouseWheelToDispose.length>0!==e&&(this._mouseWheelToDispose=Gs(this._mouseWheelToDispose),e)){let t=i=>{this._onMouseWheel(new f_(i))};this._mouseWheelToDispose.push(G(this._listenOnDomNode,Ze.MOUSE_WHEEL,t,{passive:!1}))}}_onMouseWheel(e){var r;if((r=e.browserEvent)!=null&&r.defaultPrevented)return;let t=sC.INSTANCE;t.acceptStandardWheelEvent(e);let i=!1;if(e.deltaY||e.deltaX){let n=e.deltaY*this._options.mouseWheelScrollSensitivity,l=e.deltaX*this._options.mouseWheelScrollSensitivity;this._options.scrollPredominantAxis&&(this._options.scrollYToX&&l+n===0?l=n=0:Math.abs(n)>=Math.abs(l)?l=0:n=0),this._options.flipAxes&&([n,l]=[l,n]);let a=!bi&&e.browserEvent&&e.browserEvent.shiftKey;(this._options.scrollYToX||a)&&!l&&(l=n,n=0),e.browserEvent&&e.browserEvent.altKey&&(l=l*this._options.fastScrollSensitivity,n=n*this._options.fastScrollSensitivity);let o=this._scrollable.getFutureScrollPosition(),c={};if(n){let _=y_*n,f=o.scrollTop-(_<0?Math.floor(_):Math.ceil(_));this._verticalScrollbar.writeScrollPosition(c,f)}if(l){let _=y_*l,f=o.scrollLeft-(_<0?Math.floor(_):Math.ceil(_));this._horizontalScrollbar.writeScrollPosition(c,f)}c=this._scrollable.validateScrollPosition(c),(o.scrollLeft!==c.scrollLeft||o.scrollTop!==c.scrollTop)&&(this._options.mouseWheelSmoothScroll&&t.isPhysicalMouseWheel()?this._scrollable.setScrollPositionSmooth(c):this._scrollable.setScrollPositionNow(c),i=!0)}let s=i;!s&&this._options.alwaysConsumeMouseWheel&&(s=!0),!s&&this._options.consumeMouseWheelIfScrollbarIsNeeded&&(this._verticalScrollbar.isNeeded()||this._horizontalScrollbar.isNeeded())&&(s=!0),s&&(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,i=e.scrollLeft>0,s=i?" left":"",r=t?" top":"",n=i||t?" top-left-corner":"";this._leftShadowDomNode.setClassName(`shadow${s}`),this._topShadowDomNode.setClassName(`shadow${r}`),this._topLeftShadowDomNode.setClassName(`shadow${n}${r}${s}`)}}_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(),tC)}},nC=class extends rC{constructor(e,t,i){super(e,t,i)}setScrollPosition(e){e.reuseAnimation?this._scrollable.setScrollPositionSmooth(e,e.reuseAnimation):this._scrollable.setScrollPositionNow(e)}getScrollPosition(){return this._scrollable.getCurrentScrollPosition()}};function lC(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,bi&&(t.className+=" mac"),t}var Uh=class extends se{constructor(e,t,i,s,r,n,l,a){super(),this._bufferService=i,this._optionsService=l,this._renderService=a,this._onRequestScrollLines=this._register(new z),this.onRequestScrollLines=this._onRequestScrollLines.event,this._isSyncing=!1,this._isHandlingScroll=!1,this._suppressOnScrollHandler=!1;let o=this._register(new X2({forceIntegerValues:!1,smoothScrollDuration:this._optionsService.rawOptions.smoothScrollDuration,scheduleAtNextAnimationFrame:c=>md(s.window,c)}));this._register(this._optionsService.onSpecificOptionChange("smoothScrollDuration",()=>{o.setSmoothScrollDuration(this._optionsService.rawOptions.smoothScrollDuration)})),this._scrollableElement=this._register(new nC(t,{vertical:1,horizontal:2,useShadows:!1,mouseWheelSmoothScroll:!0,...this._getChangeOptions()},o)),this._register(this._optionsService.onMultipleOptionChange(["scrollSensitivity","fastScrollSensitivity","overviewRuler"],()=>this._scrollableElement.updateOptions(this._getChangeOptions()))),this._register(r.onProtocolChange(c=>{this._scrollableElement.updateOptions({handleMouseWheel:!(c&16)})})),this._scrollableElement.setScrollDimensions({height:0,scrollHeight:0}),this._register(ht.runAndSubscribe(n.onChangeColors,()=>{this._scrollableElement.getDomNode().style.backgroundColor=n.colors.background.css})),e.appendChild(this._scrollableElement.getDomNode()),this._register(Ee(()=>this._scrollableElement.getDomNode().remove())),this._styleElement=s.mainDocument.createElement("style"),t.appendChild(this._styleElement),this._register(Ee(()=>this._styleElement.remove())),this._register(ht.runAndSubscribe(n.onChangeColors,()=>{this._styleElement.textContent=[".xterm .xterm-scrollable-element > .scrollbar > .slider {",` background: ${n.colors.scrollbarSliderBackground.css};`,"}",".xterm .xterm-scrollable-element > .scrollbar > .slider:hover {",` background: ${n.colors.scrollbarSliderHoverBackground.css};`,"}",".xterm .xterm-scrollable-element > .scrollbar > .slider.active {",` background: ${n.colors.scrollbarSliderActiveBackground.css};`,"}"].join(`
|
|
114
|
-
`)})),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(c=>this._handleScroll(c)))}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(){var e;return{mouseWheelScrollSensitivity:this._optionsService.rawOptions.scrollSensitivity,fastScrollSensitivity:this._optionsService.rawOptions.fastScrollSensitivity,verticalScrollbarSize:((e=this._optionsService.rawOptions.overviewRuler)==null?void 0:e.width)||14}}queueSync(e){e!==void 0&&(this._latestYDisp=e),this._queuedAnimationFrame===void 0&&(this._queuedAnimationFrame=this._renderService.addRefreshCallback(()=>{this._queuedAnimationFrame=void 0,this._sync(this._latestYDisp)}))}_sync(e=this._bufferService.buffer.ydisp){!this._renderService||this._isSyncing||(this._isSyncing=!0,this._suppressOnScrollHandler=!0,this._scrollableElement.setScrollDimensions({height:this._renderService.dimensions.css.canvas.height,scrollHeight:this._renderService.dimensions.css.cell.height*this._bufferService.buffer.lines.length}),this._suppressOnScrollHandler=!1,e!==this._latestYDisp&&this._scrollableElement.setScrollPosition({scrollTop:e*this._renderService.dimensions.css.cell.height}),this._isSyncing=!1)}_handleScroll(e){if(!this._renderService||this._isHandlingScroll||this._suppressOnScrollHandler)return;this._isHandlingScroll=!0;let t=Math.round(e.scrollTop/this._renderService.dimensions.css.cell.height),i=t-this._bufferService.buffer.ydisp;i!==0&&(this._latestYDisp=t,this._onRequestScrollLines.fire(i)),this._isHandlingScroll=!1}};Uh=Ae([H(2,yt),H(3,Xi),H(4,Dv),H(5,en),H(6,bt),H(7,Gi)],Uh);var qh=class extends se{constructor(e,t,i,s,r){super(),this._screenElement=e,this._bufferService=t,this._coreBrowserService=i,this._decorationService=s,this._renderService=r,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(n=>this._removeDecoration(n))),this._register(Ee(()=>{this._container.remove(),this._decorationElements.clear()}))}_queueRefresh(){this._animationFrame===void 0&&(this._animationFrame=this._renderService.addRefreshCallback(()=>{this._doRefreshDecorations(),this._animationFrame=void 0}))}_doRefreshDecorations(){for(let e of this._decorationService.decorations)this._renderDecoration(e);this._dimensionsChanged=!1}_renderDecoration(e){this._refreshStyle(e),this._dimensionsChanged&&this._refreshXPosition(e)}_createElement(e){var s;let t=this._coreBrowserService.mainDocument.createElement("div");t.classList.add("xterm-decoration"),t.classList.toggle("xterm-decoration-top-layer",((s=e==null?void 0:e.options)==null?void 0:s.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 i=e.options.x??0;return i&&i>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 i=this._decorationElements.get(e);i||(i=this._createElement(e),e.element=i,this._decorationElements.set(e,i),this._container.appendChild(i),e.onDispose(()=>{this._decorationElements.delete(e),i.remove()})),i.style.display=this._altBufferIsActive?"none":"block",this._altBufferIsActive||(i.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,i.style.height=`${(e.options.height||1)*this._renderService.dimensions.css.cell.height}px`,i.style.top=`${t*this._renderService.dimensions.css.cell.height}px`,i.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`),e.onRenderEmitter.fire(i)}}_refreshXPosition(e,t=e.element){if(!t)return;let i=e.options.x??0;(e.options.anchor||"left")==="right"?t.style.right=i?`${i*this._renderService.dimensions.css.cell.width}px`:"":t.style.left=i?`${i*this._renderService.dimensions.css.cell.width}px`:""}_removeDecoration(e){var t;(t=this._decorationElements.get(e))==null||t.remove(),this._decorationElements.delete(e),e.dispose()}};qh=Ae([H(1,yt),H(2,Xi),H(3,bl),H(4,Gi)],qh);var aC=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,i){return t>=e.startBufferLine-this._linePadding[i||"full"]&&t<=e.endBufferLine+this._linePadding[i||"full"]}_addLineToZone(e,t){e.startBufferLine=Math.min(e.startBufferLine,t),e.endBufferLine=Math.max(e.endBufferLine,t)}},fi={full:0,left:0,center:0,right:0},Zi={full:0,left:0,center:0,right:0},dn={full:0,left:0,center:0,right:0},Ga=class extends se{constructor(e,t,i,s,r,n,l,a){var c;super(),this._viewportElement=e,this._screenElement=t,this._bufferService=i,this._decorationService=s,this._renderService=r,this._optionsService=n,this._themeService=l,this._coreBrowserService=a,this._colorZoneStore=new aC,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(),(c=this._viewportElement.parentElement)==null||c.insertBefore(this._canvas,this._viewportElement),this._register(Ee(()=>{var _;return(_=this._canvas)==null?void 0:_.remove()}));let o=this._canvas.getContext("2d");if(o)this._ctx=o;else throw new Error("Ctx cannot be null");this._register(this._decorationService.onDecorationRegistered(()=>this._queueRefresh(void 0,!0))),this._register(this._decorationService.onDecorationRemoved(()=>this._queueRefresh(void 0,!0))),this._register(this._renderService.onRenderedViewportChange(()=>this._queueRefresh())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._canvas.style.display=this._bufferService.buffer===this._bufferService.buffers.alt?"none":"block"})),this._register(this._bufferService.onScroll(()=>{this._lastKnownBufferLength!==this._bufferService.buffers.normal.lines.length&&(this._refreshDrawHeightConstants(),this._refreshColorZonePadding())})),this._register(this._renderService.onRender(()=>{(!this._containerHeight||this._containerHeight!==this._screenElement.clientHeight)&&(this._queueRefresh(!0),this._containerHeight=this._screenElement.clientHeight)})),this._register(this._coreBrowserService.onDprChange(()=>this._queueRefresh(!0))),this._register(this._optionsService.onSpecificOptionChange("overviewRuler",()=>this._queueRefresh(!0))),this._register(this._themeService.onChangeColors(()=>this._queueRefresh())),this._queueRefresh(!0)}get _width(){var e;return((e=this._optionsService.options.overviewRuler)==null?void 0:e.width)||0}_refreshDrawConstants(){let e=Math.floor((this._canvas.width-1)/3),t=Math.ceil((this._canvas.width-1)/3);Zi.full=this._canvas.width,Zi.left=e,Zi.center=t,Zi.right=e,this._refreshDrawHeightConstants(),dn.full=1,dn.left=1,dn.center=1+Zi.left,dn.right=1+Zi.left+Zi.center}_refreshDrawHeightConstants(){fi.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);fi.left=t,fi.center=t,fi.right=t}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*fi.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*fi.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*fi.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*fi.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(dn[e.position||"full"],Math.round((this._canvas.height-1)*(e.startBufferLine/this._bufferService.buffers.active.lines.length)-fi[e.position||"full"]/2),Zi[e.position||"full"],Math.round((this._canvas.height-1)*((e.endBufferLine-e.startBufferLine)/this._bufferService.buffers.active.lines.length)+fi[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}))}};Ga=Ae([H(2,yt),H(3,bl),H(4,Gi),H(5,bt),H(6,en),H(7,Xi)],Ga);var B;(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=`
|
|
115
|
-
`,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=""))(B||(B={}));var _a;(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=""))(_a||(_a={}));var $v;(e=>e.ST=`${B.ESC}\\`)($v||($v={}));var Ph=class{constructor(e,t,i,s,r,n){this._textarea=e,this._compositionView=t,this._bufferService=i,this._optionsService=s,this._coreService=r,this._renderService=n,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 i;t.start+=this._dataAlreadySent.length,this._isComposing?i=this._textarea.value.substring(t.start,this._compositionPosition.start):i=this._textarea.value.substring(t.start),i.length>0&&this._coreService.triggerDataEvent(i,!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,i=t.replace(e,"");this._dataAlreadySent=i,t.length>e.length?this._coreService.triggerDataEvent(i,!0):t.length<e.length?this._coreService.triggerDataEvent(`${B.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),i=this._renderService.dimensions.css.cell.height,s=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,r=t*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=r+"px",this._compositionView.style.top=s+"px",this._compositionView.style.height=i+"px",this._compositionView.style.lineHeight=i+"px",this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+"px";let n=this._compositionView.getBoundingClientRect();this._textarea.style.left=r+"px",this._textarea.style.top=s+"px",this._textarea.style.width=Math.max(n.width,1)+"px",this._textarea.style.height=Math.max(n.height,1)+"px",this._textarea.style.lineHeight=n.height+"px"}e||setTimeout(()=>this.updateCompositionElements(!0),0)}}};Ph=Ae([H(2,yt),H(3,bt),H(4,tr),H(5,Gi)],Ph);var Je=0,et=0,tt=0,Be=0,b_={css:"#00000000",rgba:0},qe;(e=>{function t(r,n,l,a){return a!==void 0?`#${Ms(r)}${Ms(n)}${Ms(l)}${Ms(a)}`:`#${Ms(r)}${Ms(n)}${Ms(l)}`}e.toCss=t;function i(r,n,l,a=255){return(r<<24|n<<16|l<<8|a)>>>0}e.toRgba=i;function s(r,n,l,a){return{css:e.toCss(r,n,l,a),rgba:e.toRgba(r,n,l,a)}}e.toColor=s})(qe||(qe={}));var Se;(e=>{function t(o,c){if(Be=(c.rgba&255)/255,Be===1)return{css:c.css,rgba:c.rgba};let _=c.rgba>>24&255,f=c.rgba>>16&255,u=c.rgba>>8&255,d=o.rgba>>24&255,g=o.rgba>>16&255,y=o.rgba>>8&255;Je=d+Math.round((_-d)*Be),et=g+Math.round((f-g)*Be),tt=y+Math.round((u-y)*Be);let C=qe.toCss(Je,et,tt),m=qe.toRgba(Je,et,tt);return{css:C,rgba:m}}e.blend=t;function i(o){return(o.rgba&255)===255}e.isOpaque=i;function s(o,c,_){let f=pa.ensureContrastRatio(o.rgba,c.rgba,_);if(f)return qe.toColor(f>>24&255,f>>16&255,f>>8&255)}e.ensureContrastRatio=s;function r(o){let c=(o.rgba|255)>>>0;return[Je,et,tt]=pa.toChannels(c),{css:qe.toCss(Je,et,tt),rgba:c}}e.opaque=r;function n(o,c){return Be=Math.round(c*255),[Je,et,tt]=pa.toChannels(o.rgba),{css:qe.toCss(Je,et,tt,Be),rgba:qe.toRgba(Je,et,tt,Be)}}e.opacity=n;function l(o,c){return Be=o.rgba&255,n(o,Be*c/255)}e.multiplyOpacity=l;function a(o){return[o.rgba>>24&255,o.rgba>>16&255,o.rgba>>8&255]}e.toColorRGB=a})(Se||(Se={}));var Te;(e=>{let t,i;try{let r=document.createElement("canvas");r.width=1,r.height=1;let n=r.getContext("2d",{willReadFrequently:!0});n&&(t=n,t.globalCompositeOperation="copy",i=t.createLinearGradient(0,0,1,1))}catch{}function s(r){if(r.match(/#[\da-f]{3,8}/i))switch(r.length){case 4:return Je=parseInt(r.slice(1,2).repeat(2),16),et=parseInt(r.slice(2,3).repeat(2),16),tt=parseInt(r.slice(3,4).repeat(2),16),qe.toColor(Je,et,tt);case 5:return Je=parseInt(r.slice(1,2).repeat(2),16),et=parseInt(r.slice(2,3).repeat(2),16),tt=parseInt(r.slice(3,4).repeat(2),16),Be=parseInt(r.slice(4,5).repeat(2),16),qe.toColor(Je,et,tt,Be);case 7:return{css:r,rgba:(parseInt(r.slice(1),16)<<8|255)>>>0};case 9:return{css:r,rgba:parseInt(r.slice(1),16)>>>0}}let n=r.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(n)return Je=parseInt(n[1]),et=parseInt(n[2]),tt=parseInt(n[3]),Be=Math.round((n[5]===void 0?1:parseFloat(n[5]))*255),qe.toColor(Je,et,tt,Be);if(!t||!i)throw new Error("css.toColor: Unsupported css format");if(t.fillStyle=i,t.fillStyle=r,typeof t.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(t.fillRect(0,0,1,1),[Je,et,tt,Be]=t.getImageData(0,0,1,1).data,Be!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:qe.toRgba(Je,et,tt,Be),css:r}}e.toColor=s})(Te||(Te={}));var mt;(e=>{function t(s){return i(s>>16&255,s>>8&255,s&255)}e.relativeLuminance=t;function i(s,r,n){let l=s/255,a=r/255,o=n/255,c=l<=.03928?l/12.92:Math.pow((l+.055)/1.055,2.4),_=a<=.03928?a/12.92:Math.pow((a+.055)/1.055,2.4),f=o<=.03928?o/12.92:Math.pow((o+.055)/1.055,2.4);return c*.2126+_*.7152+f*.0722}e.relativeLuminance2=i})(mt||(mt={}));var pa;(e=>{function t(l,a){if(Be=(a&255)/255,Be===1)return a;let o=a>>24&255,c=a>>16&255,_=a>>8&255,f=l>>24&255,u=l>>16&255,d=l>>8&255;return Je=f+Math.round((o-f)*Be),et=u+Math.round((c-u)*Be),tt=d+Math.round((_-d)*Be),qe.toRgba(Je,et,tt)}e.blend=t;function i(l,a,o){let c=mt.relativeLuminance(l>>8),_=mt.relativeLuminance(a>>8);if(Bi(c,_)<o){if(_<c){let d=s(l,a,o),g=Bi(c,mt.relativeLuminance(d>>8));if(g<o){let y=r(l,a,o),C=Bi(c,mt.relativeLuminance(y>>8));return g>C?d:y}return d}let f=r(l,a,o),u=Bi(c,mt.relativeLuminance(f>>8));if(u<o){let d=s(l,a,o),g=Bi(c,mt.relativeLuminance(d>>8));return u>g?f:d}return f}}e.ensureContrastRatio=i;function s(l,a,o){let c=l>>24&255,_=l>>16&255,f=l>>8&255,u=a>>24&255,d=a>>16&255,g=a>>8&255,y=Bi(mt.relativeLuminance2(u,d,g),mt.relativeLuminance2(c,_,f));for(;y<o&&(u>0||d>0||g>0);)u-=Math.max(0,Math.ceil(u*.1)),d-=Math.max(0,Math.ceil(d*.1)),g-=Math.max(0,Math.ceil(g*.1)),y=Bi(mt.relativeLuminance2(u,d,g),mt.relativeLuminance2(c,_,f));return(u<<24|d<<16|g<<8|255)>>>0}e.reduceLuminance=s;function r(l,a,o){let c=l>>24&255,_=l>>16&255,f=l>>8&255,u=a>>24&255,d=a>>16&255,g=a>>8&255,y=Bi(mt.relativeLuminance2(u,d,g),mt.relativeLuminance2(c,_,f));for(;y<o&&(u<255||d<255||g<255);)u=Math.min(255,u+Math.ceil((255-u)*.1)),d=Math.min(255,d+Math.ceil((255-d)*.1)),g=Math.min(255,g+Math.ceil((255-g)*.1)),y=Bi(mt.relativeLuminance2(u,d,g),mt.relativeLuminance2(c,_,f));return(u<<24|d<<16|g<<8|255)>>>0}e.increaseLuminance=r;function n(l){return[l>>24&255,l>>16&255,l>>8&255,l&255]}e.toChannels=n})(pa||(pa={}));function Ms(e){let t=e.toString(16);return t.length<2?"0"+t:t}function Bi(e,t){return e<t?(t+.05)/(e+.05):(e+.05)/(t+.05)}var oC=class extends yl{constructor(e,t,i){super(),this.content=0,this.combinedData="",this.fg=e.fg,this.bg=e.bg,this.combinedData=t,this._width=i}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()]}},$a=class{constructor(e){this._bufferService=e,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new ri}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 i=[],s=t.translateToString(!0),r=0,n=0,l=0,a=t.getFg(0),o=t.getBg(0);for(let c=0;c<t.getTrimmedLength();c++)if(t.loadCell(c,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==a||this._workCell.bg!==o){if(c-r>1){let _=this._getJoinedRanges(s,l,n,t,r);for(let f=0;f<_.length;f++)i.push(_[f])}r=c,l=n,a=this._workCell.fg,o=this._workCell.bg}n+=this._workCell.getChars().length||us.length}if(this._bufferService.cols-r>1){let c=this._getJoinedRanges(s,l,n,t,r);for(let _=0;_<c.length;_++)i.push(c[_])}return i}_getJoinedRanges(e,t,i,s,r){let n=e.substring(t,i),l=[];try{l=this._characterJoiners[0].handler(n)}catch(a){console.error(a)}for(let a=1;a<this._characterJoiners.length;a++)try{let o=this._characterJoiners[a].handler(n);for(let c=0;c<o.length;c++)$a._mergeRanges(l,o[c])}catch(o){console.error(o)}return this._stringRangesToCellRanges(l,s,r),l}_stringRangesToCellRanges(e,t,i){let s=0,r=!1,n=0,l=e[s];if(l){for(let a=i;a<this._bufferService.cols;a++){let o=t.getWidth(a),c=t.getString(a).length||us.length;if(o!==0){if(!r&&l[0]<=n&&(l[0]=a,r=!0),l[1]<=n){if(l[1]=a,l=e[++s],!l)break;l[0]<=n?(l[0]=a,r=!0):r=!1}n+=c}}l&&(l[1]=this._bufferService.cols)}}static _mergeRanges(e,t){let i=!1;for(let s=0;s<e.length;s++){let r=e[s];if(i){if(t[1]<=r[0])return e[s-1][1]=t[1],e;if(t[1]<=r[1])return e[s-1][1]=Math.max(t[1],r[1]),e.splice(s,1),e;e.splice(s,1),s--}else{if(t[1]<=r[0])return e.splice(s,0,t),e;if(t[1]<=r[1])return r[0]=Math.min(t[0],r[0]),e;t[0]<r[1]&&(r[0]=Math.min(t[0],r[0]),i=!0);continue}}return i?e[e.length-1][1]=t[1]:e.push(t),e}};$a=Ae([H(0,yt)],$a);function cC(e){return 57508<=e&&e<=57558}function hC(e){return 9472<=e&&e<=9631}function uC(e){return cC(e)||hC(e)}function dC(){return{css:{canvas:Wl(),cell:Wl()},device:{canvas:Wl(),cell:Wl(),char:{width:0,height:0,left:0,top:0}}}}function Wl(){return{width:0,height:0}}var Kh=class{constructor(e,t,i,s,r,n,l){this._document=e,this._characterJoinerService=t,this._optionsService=i,this._coreBrowserService=s,this._coreService=r,this._decorationService=n,this._themeService=l,this._workCell=new ri,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(e,t,i){this._selectionStart=e,this._selectionEnd=t,this._columnSelectMode=i}createRow(e,t,i,s,r,n,l,a,o,c,_){let f=[],u=this._characterJoinerService.getJoinedCharacters(t),d=this._themeService.colors,g=e.getNoBgTrimmedLength();i&&g<n+1&&(g=n+1);let y,C=0,m="",p=0,v=0,S=0,k=0,j=!1,O=0,q=!1,W=0,V=0,A=[],w=c!==-1&&_!==-1;for(let x=0;x<g;x++){e.loadCell(x,this._workCell);let T=this._workCell.getWidth();if(T===0)continue;let R=!1,b=x>=V,N=x,E=this._workCell;if(u.length>0&&x===u[0][0]&&b){let oe=u.shift(),Rt=this._isCellInSelection(oe[0],t);for(p=oe[0]+1;p<oe[1];p++)b&&(b=Rt===this._isCellInSelection(p,t));b&&(b=!i||n<oe[0]||n>=oe[1]),b?(R=!0,E=new oC(this._workCell,e.translateToString(!0,oe[0],oe[1]),oe[1]-oe[0]),N=oe[1]-1,T=E.getWidth()):V=oe[1]}let K=this._isCellInSelection(x,t),Q=i&&x===n,Ke=w&&x>=c&&x<=_,_t=!1;this._decorationService.forEachDecorationAtCell(x,t,void 0,oe=>{_t=!0});let $e=E.getChars()||us;if($e===" "&&(E.isUnderline()||E.isOverline())&&($e=" "),W=T*a-o.get($e,E.isBold(),E.isItalic()),!y)y=this._document.createElement("span");else if(C&&(K&&q||!K&&!q&&E.bg===v)&&(K&&q&&d.selectionForeground||E.fg===S)&&E.extended.ext===k&&Ke===j&&W===O&&!Q&&!R&&!_t&&b){E.isInvisible()?m+=us:m+=$e,C++;continue}else C&&(y.textContent=m),y=this._document.createElement("span"),C=0,m="";if(v=E.bg,S=E.fg,k=E.extended.ext,j=Ke,O=W,q=K,R&&n>=x&&n<=N&&(n=x),!this._coreService.isCursorHidden&&Q&&this._coreService.isCursorInitialized){if(A.push("xterm-cursor"),this._coreBrowserService.isFocused)l&&A.push("xterm-cursor-blink"),A.push(s==="bar"?"xterm-cursor-bar":s==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(r)switch(r){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(E.isBold()&&A.push("xterm-bold"),E.isItalic()&&A.push("xterm-italic"),E.isDim()&&A.push("xterm-dim"),E.isInvisible()?m=us:m=E.getChars()||us,E.isUnderline()&&(A.push(`xterm-underline-${E.extended.underlineStyle}`),m===" "&&(m=" "),!E.isUnderlineColorDefault()))if(E.isUnderlineColorRGB())y.style.textDecorationColor=`rgb(${yl.toColorRGB(E.getUnderlineColor()).join(",")})`;else{let oe=E.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&E.isBold()&&oe<8&&(oe+=8),y.style.textDecorationColor=d.ansi[oe].css}E.isOverline()&&(A.push("xterm-overline"),m===" "&&(m=" ")),E.isStrikethrough()&&A.push("xterm-strikethrough"),Ke&&(y.style.textDecoration="underline");let we=E.getFgColor(),nt=E.getFgColorMode(),Ct=E.getBgColor(),di=E.getBgColorMode(),ir=!!E.isInverse();if(ir){let oe=we;we=Ct,Ct=oe;let Rt=nt;nt=di,di=Rt}let Yt,Ei,Vt=!1;this._decorationService.forEachDecorationAtCell(x,t,void 0,oe=>{oe.options.layer!=="top"&&Vt||(oe.backgroundColorRGB&&(di=50331648,Ct=oe.backgroundColorRGB.rgba>>8&16777215,Yt=oe.backgroundColorRGB),oe.foregroundColorRGB&&(nt=50331648,we=oe.foregroundColorRGB.rgba>>8&16777215,Ei=oe.foregroundColorRGB),Vt=oe.options.layer==="top")}),!Vt&&K&&(Yt=this._coreBrowserService.isFocused?d.selectionBackgroundOpaque:d.selectionInactiveBackgroundOpaque,Ct=Yt.rgba>>8&16777215,di=50331648,Vt=!0,d.selectionForeground&&(nt=50331648,we=d.selectionForeground.rgba>>8&16777215,Ei=d.selectionForeground)),Vt&&A.push("xterm-decoration-top");let ai;switch(di){case 16777216:case 33554432:ai=d.ansi[Ct],A.push(`xterm-bg-${Ct}`);break;case 50331648:ai=qe.toColor(Ct>>16,Ct>>8&255,Ct&255),this._addStyle(y,`background-color:#${C_((Ct>>>0).toString(16),"0",6)}`);break;case 0:default:ir?(ai=d.foreground,A.push("xterm-bg-257")):ai=d.background}switch(Yt||E.isDim()&&(Yt=Se.multiplyOpacity(ai,.5)),nt){case 16777216:case 33554432:E.isBold()&&we<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(we+=8),this._applyMinimumContrast(y,ai,d.ansi[we],E,Yt,void 0)||A.push(`xterm-fg-${we}`);break;case 50331648:let oe=qe.toColor(we>>16&255,we>>8&255,we&255);this._applyMinimumContrast(y,ai,oe,E,Yt,Ei)||this._addStyle(y,`color:#${C_(we.toString(16),"0",6)}`);break;case 0:default:this._applyMinimumContrast(y,ai,d.foreground,E,Yt,Ei)||ir&&A.push("xterm-fg-257")}A.length&&(y.className=A.join(" "),A.length=0),!Q&&!R&&!_t&&b?C++:y.textContent=m,W!==this.defaultSpacing&&(y.style.letterSpacing=`${W}px`),f.push(y),x=N}return y&&C&&(y.textContent=m),f}_applyMinimumContrast(e,t,i,s,r,n){if(this._optionsService.rawOptions.minimumContrastRatio===1||uC(s.getCode()))return!1;let l=this._getContrastCache(s),a;if(!r&&!n&&(a=l.getColor(t.rgba,i.rgba)),a===void 0){let o=this._optionsService.rawOptions.minimumContrastRatio/(s.isDim()?2:1);a=Se.ensureContrastRatio(r||t,n||i,o),l.setColor((r||t).rgba,(n||i).rgba,a??null)}return a?(this._addStyle(e,`color:${a.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 i=this._selectionStart,s=this._selectionEnd;return!i||!s?!1:this._columnSelectMode?i[0]<=s[0]?e>=i[0]&&t>=i[1]&&e<s[0]&&t<=s[1]:e<i[0]&&t>=i[1]&&e>=s[0]&&t<=s[1]:t>i[1]&&t<s[1]||i[1]===s[1]&&t===i[1]&&e>=i[0]&&e<s[0]||i[1]<s[1]&&t===s[1]&&e<s[0]||i[1]<s[1]&&t===i[1]&&e>=i[0]}};Kh=Ae([H(1,Rv),H(2,bt),H(3,Xi),H(4,tr),H(5,bl),H(6,en)],Kh);function C_(e,t,i){for(;e.length<i;)e=t+e;return e}var fC=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 i=e.createElement("span");i.classList.add("xterm-char-measure-element");let s=e.createElement("span");s.classList.add("xterm-char-measure-element"),s.style.fontWeight="bold";let r=e.createElement("span");r.classList.add("xterm-char-measure-element"),r.style.fontStyle="italic";let n=e.createElement("span");n.classList.add("xterm-char-measure-element"),n.style.fontWeight="bold",n.style.fontStyle="italic",this._measureElements=[i,s,r,n],this._container.appendChild(i),this._container.appendChild(s),this._container.appendChild(r),this._container.appendChild(n),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,i,s){e===this._font&&t===this._fontSize&&i===this._weight&&s===this._weightBold||(this._font=e,this._fontSize=t,this._weight=i,this._weightBold=s,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${i}`,this._measureElements[1].style.fontWeight=`${s}`,this._measureElements[2].style.fontWeight=`${i}`,this._measureElements[3].style.fontWeight=`${s}`,this.clear())}get(e,t,i){let s=0;if(!t&&!i&&e.length===1&&(s=e.charCodeAt(0))<256){if(this._flat[s]!==-9999)return this._flat[s];let l=this._measure(e,0);return l>0&&(this._flat[s]=l),l}let r=e;t&&(r+="B"),i&&(r+="I");let n=this._holey.get(r);if(n===void 0){let l=0;t&&(l|=1),i&&(l|=2),n=this._measure(e,l),n>0&&this._holey.set(r,n)}return n}_measure(e,t){let i=this._measureElements[t];return i.textContent=e.repeat(32),i.offsetWidth/32}},_C=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,i,s=!1){if(this.selectionStart=t,this.selectionEnd=i,!t||!i||t[0]===i[0]&&t[1]===i[1]){this.clear();return}let r=e.buffers.active.ydisp,n=t[1]-r,l=i[1]-r,a=Math.max(n,0),o=Math.min(l,e.rows-1);if(a>=e.rows||o<0){this.clear();return}this.hasSelection=!0,this.columnSelectMode=s,this.viewportStartRow=n,this.viewportEndRow=l,this.viewportCappedStartRow=a,this.viewportCappedEndRow=o,this.startCol=t[0],this.endCol=i[0]}isCellSelected(e,t,i){return this.hasSelection?(i-=e.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?t>=this.startCol&&i>=this.viewportCappedStartRow&&t<this.endCol&&i<=this.viewportCappedEndRow:t<this.startCol&&i>=this.viewportCappedStartRow&&t>=this.endCol&&i<=this.viewportCappedEndRow:i>this.viewportStartRow&&i<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&i===this.viewportStartRow&&t>=this.startCol&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&i===this.viewportEndRow&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&i===this.viewportStartRow&&t>=this.startCol):!1}};function pC(){return new _C}var _c="xterm-dom-renderer-owner-",It="xterm-rows",Yl="xterm-fg-",w_="xterm-bg-",fn="xterm-focus",Vl="xterm-selection",mC=1,Wh=class extends se{constructor(e,t,i,s,r,n,l,a,o,c,_,f,u,d){super(),this._terminal=e,this._document=t,this._element=i,this._screenElement=s,this._viewportElement=r,this._helperContainer=n,this._linkifier2=l,this._charSizeService=o,this._optionsService=c,this._bufferService=_,this._coreService=f,this._coreBrowserService=u,this._themeService=d,this._terminalClass=mC++,this._rowElements=[],this._selectionRenderModel=pC(),this.onRequestRedraw=this._register(new z).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(It),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(Vl),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=dC(),this._updateDimensions(),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._themeService.onChangeColors(g=>this._injectCss(g))),this._injectCss(this._themeService.colors),this._rowFactory=a.createInstance(Kh,document),this._element.classList.add(_c+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this._register(this._linkifier2.onShowLinkUnderline(g=>this._handleLinkHover(g))),this._register(this._linkifier2.onHideLinkUnderline(g=>this._handleLinkLeave(g))),this._register(Ee(()=>{this._element.classList.remove(_c+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()})),this._widthCache=new fC(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 i of this._rowElements)i.style.width=`${this.dimensions.css.canvas.width}px`,i.style.height=`${this.dimensions.css.cell.height}px`,i.style.lineHeight=`${this.dimensions.css.cell.height}px`,i.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));let t=`${this._terminalSelector} .${It} 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} .${It} { 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} .${It} .xterm-dim { color: ${Se.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 i=`blink_underline_${this._terminalClass}`,s=`blink_bar_${this._terminalClass}`,r=`blink_block_${this._terminalClass}`;t+=`@keyframes ${i} { 50% { border-bottom-style: hidden; }}`,t+=`@keyframes ${s} { 50% { box-shadow: none; }}`,t+=`@keyframes ${r} { 0% { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css}; } 50% { background-color: inherit; color: ${e.cursor.css}; }}`,t+=`${this._terminalSelector} .${It}.${fn} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${i} 1s step-end infinite;}${this._terminalSelector} .${It}.${fn} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${s} 1s step-end infinite;}${this._terminalSelector} .${It}.${fn} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${r} 1s step-end infinite;}${this._terminalSelector} .${It} .xterm-cursor.xterm-cursor-block { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css};}${this._terminalSelector} .${It} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${e.cursor.css} !important; color: ${e.cursorAccent.css} !important;}${this._terminalSelector} .${It} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${e.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${It} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${e.cursor.css} inset;}${this._terminalSelector} .${It} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${e.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,t+=`${this._terminalSelector} .${Vl} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${Vl} div { position: absolute; background-color: ${e.selectionBackgroundOpaque.css};}${this._terminalSelector} .${Vl} div { position: absolute; background-color: ${e.selectionInactiveBackgroundOpaque.css};}`;for(let[n,l]of e.ansi.entries())t+=`${this._terminalSelector} .${Yl}${n} { color: ${l.css}; }${this._terminalSelector} .${Yl}${n}.xterm-dim { color: ${Se.multiplyOpacity(l,.5).css}; }${this._terminalSelector} .${w_}${n} { background-color: ${l.css}; }`;t+=`${this._terminalSelector} .${Yl}257 { color: ${Se.opaque(e.background).css}; }${this._terminalSelector} .${Yl}257.xterm-dim { color: ${Se.multiplyOpacity(Se.opaque(e.background),.5).css}; }${this._terminalSelector} .${w_}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 i=this._rowElements.length;i<=t;i++){let s=this._document.createElement("div");this._rowContainer.appendChild(s),this._rowElements.push(s)}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(fn),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(fn),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(e,t,i){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(e,t,i),this.renderRows(0,this._bufferService.rows-1),!e||!t||(this._selectionRenderModel.update(this._terminal,e,t,i),!this._selectionRenderModel.hasSelection))return;let s=this._selectionRenderModel.viewportStartRow,r=this._selectionRenderModel.viewportEndRow,n=this._selectionRenderModel.viewportCappedStartRow,l=this._selectionRenderModel.viewportCappedEndRow,a=this._document.createDocumentFragment();if(i){let o=e[0]>t[0];a.appendChild(this._createSelectionElement(n,o?t[0]:e[0],o?e[0]:t[0],l-n+1))}else{let o=s===n?e[0]:0,c=n===r?t[0]:this._bufferService.cols;a.appendChild(this._createSelectionElement(n,o,c));let _=l-n-1;if(a.appendChild(this._createSelectionElement(n+1,0,this._bufferService.cols,_)),n!==l){let f=r===l?t[0]:this._bufferService.cols;a.appendChild(this._createSelectionElement(l,0,f))}}this._selectionContainer.appendChild(a)}_createSelectionElement(e,t,i,s=1){let r=this._document.createElement("div"),n=t*this.dimensions.css.cell.width,l=this.dimensions.css.cell.width*(i-t);return n+l>this.dimensions.css.canvas.width&&(l=this.dimensions.css.canvas.width-n),r.style.height=`${s*this.dimensions.css.cell.height}px`,r.style.top=`${e*this.dimensions.css.cell.height}px`,r.style.left=`${n}px`,r.style.width=`${l}px`,r}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 i=this._bufferService.buffer,s=i.ybase+i.y,r=Math.min(i.x,this._bufferService.cols-1),n=this._coreService.decPrivateModes.cursorBlink??this._optionsService.rawOptions.cursorBlink,l=this._coreService.decPrivateModes.cursorStyle??this._optionsService.rawOptions.cursorStyle,a=this._optionsService.rawOptions.cursorInactiveStyle;for(let o=e;o<=t;o++){let c=o+i.ydisp,_=this._rowElements[o],f=i.lines.get(c);if(!_||!f)break;_.replaceChildren(...this._rowFactory.createRow(f,c,c===s,l,a,r,n,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${_c}${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,i,s,r,n){i<0&&(e=0),s<0&&(t=0);let l=this._bufferService.rows-1;i=Math.max(Math.min(i,l),0),s=Math.max(Math.min(s,l),0),r=Math.min(r,this._bufferService.cols);let a=this._bufferService.buffer,o=a.ybase+a.y,c=Math.min(a.x,r-1),_=this._optionsService.rawOptions.cursorBlink,f=this._optionsService.rawOptions.cursorStyle,u=this._optionsService.rawOptions.cursorInactiveStyle;for(let d=i;d<=s;++d){let g=d+a.ydisp,y=this._rowElements[d],C=a.lines.get(g);if(!y||!C)break;y.replaceChildren(...this._rowFactory.createRow(C,g,g===o,f,u,c,_,this.dimensions.css.cell.width,this._widthCache,n?d===i?e:0:-1,n?(d===s?t:r)-1:-1))}}};Wh=Ae([H(7,hd),H(8,yo),H(9,bt),H(10,yt),H(11,tr),H(12,Xi),H(13,en)],Wh);var Yh=class extends se{constructor(e,t,i){super(),this._optionsService=i,this.width=0,this.height=0,this._onCharSizeChange=this._register(new z),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this._register(new vC(this._optionsService))}catch{this._measureStrategy=this._register(new gC(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())}};Yh=Ae([H(2,bt)],Yh);var Fv=class extends se{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)}},gC=class extends Fv{constructor(e,t,i){super(),this._document=e,this._parentElement=t,this._optionsService=i,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}},vC=class extends Fv{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}},SC=class extends se{constructor(e,t,i){super(),this._textarea=e,this._window=t,this.mainDocument=i,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=this._register(new yC(this._window)),this._onDprChange=this._register(new z),this.onDprChange=this._onDprChange.event,this._onWindowChange=this._register(new z),this.onWindowChange=this._onWindowChange.event,this._register(this.onWindowChange(s=>this._screenDprMonitor.setWindow(s))),this._register(ht.forward(this._screenDprMonitor.onDprChange,this._onDprChange)),this._register(G(this._textarea,"focus",()=>this._isFocused=!0)),this._register(G(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}},yC=class extends se{constructor(e){super(),this._parentWindow=e,this._windowResizeListener=this._register(new Yr),this._onDprChange=this._register(new z),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this._register(Ee(()=>this.clearListener()))}setWindow(e){this._parentWindow=e,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=G(this._parentWindow,"resize",()=>this._setDprAndFireIfDiffers())}_setDprAndFireIfDiffers(){this._parentWindow.devicePixelRatio!==this._currentDevicePixelRatio&&this._onDprChange.fire(this._parentWindow.devicePixelRatio),this._updateDpr()}_updateDpr(){var e;this._outerListener&&((e=this._resolutionMediaMatchList)==null||e.removeListener(this._outerListener),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._resolutionMediaMatchList=this._parentWindow.matchMedia(`screen and (resolution: ${this._parentWindow.devicePixelRatio}dppx)`),this._resolutionMediaMatchList.addListener(this._outerListener))}clearListener(){!this._resolutionMediaMatchList||!this._outerListener||(this._resolutionMediaMatchList.removeListener(this._outerListener),this._resolutionMediaMatchList=void 0,this._outerListener=void 0)}},bC=class extends se{constructor(){super(),this.linkProviders=[],this._register(Ee(()=>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 vd(e,t,i){let s=i.getBoundingClientRect(),r=e.getComputedStyle(i),n=parseInt(r.getPropertyValue("padding-left")),l=parseInt(r.getPropertyValue("padding-top"));return[t.clientX-s.left-n,t.clientY-s.top-l]}function CC(e,t,i,s,r,n,l,a,o){if(!n)return;let c=vd(e,t,i);if(c)return c[0]=Math.ceil((c[0]+(o?l/2:0))/l),c[1]=Math.ceil(c[1]/a),c[0]=Math.min(Math.max(c[0],1),s+(o?1:0)),c[1]=Math.min(Math.max(c[1],1),r),c}var Vh=class{constructor(e,t){this._renderService=e,this._charSizeService=t}getCoords(e,t,i,s,r){return CC(window,e,t,i,s,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,r)}getMouseReportCoords(e,t){let i=vd(window,e,t);if(this._charSizeService.hasValidSize)return i[0]=Math.min(Math.max(i[0],0),this._renderService.dimensions.css.canvas.width-1),i[1]=Math.min(Math.max(i[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(i[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(i[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(i[0]),y:Math.floor(i[1])}}};Vh=Ae([H(0,Gi),H(1,yo)],Vh);var wC=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,i){this._rowCount=i,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=[]}},Zv={};Nb(Zv,{getSafariVersion:()=>EC,isChromeOS:()=>t0,isFirefox:()=>Qv,isIpad:()=>kC,isIphone:()=>TC,isLegacyEdge:()=>xC,isLinux:()=>Sd,isMac:()=>Fa,isNode:()=>bo,isSafari:()=>Jv,isWindows:()=>e0});var bo=typeof process<"u"&&"title"in process,Cl=bo?"node":navigator.userAgent,wl=bo?"node":navigator.platform,Qv=Cl.includes("Firefox"),xC=Cl.includes("Edge"),Jv=/^((?!chrome|android).)*safari/i.test(Cl);function EC(){if(!Jv)return 0;let e=Cl.match(/Version\/(\d+)/);return e===null||e.length<2?0:parseInt(e[1])}var Fa=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(wl),kC=wl==="iPad",TC=wl==="iPhone",e0=["Windows","Win16","Win32","WinCE"].includes(wl),Sd=wl.indexOf("Linux")>=0,t0=/\bCrOS\b/.test(Cl),i0=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,i=0,s=e.timeRemaining(),r=0;for(;this._i<this._tasks.length;){if(t=performance.now(),this._tasks[this._i]()||this._i++,t=Math.max(1,performance.now()-t),i=Math.max(t,i),r=e.timeRemaining(),i*1.5>r){s-t<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(s-t))}ms`),this._start();return}s=r}this.clear()}},DC=class extends i0{_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())}}},MC=class extends i0{_requestCallback(e){return requestIdleCallback(e)}_cancelCallback(e){cancelIdleCallback(e)}},Za=!bo&&"requestIdleCallback"in window?MC:DC,BC=class{constructor(){this._queue=new Za}set(e){this._queue.clear(),this._queue.enqueue(e)}flush(){this._queue.flush()}},Ih=class extends se{constructor(e,t,i,s,r,n,l,a,o){super(),this._rowCount=e,this._optionsService=i,this._charSizeService=s,this._coreService=r,this._coreBrowserService=a,this._renderer=this._register(new Yr),this._pausedResizeTask=new BC,this._observerDisposable=this._register(new Yr),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 z),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this._register(new z),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this._register(new z),this.onRender=this._onRender.event,this._onRefreshRequest=this._register(new z),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new wC((c,_)=>this._renderRows(c,_),this._coreBrowserService),this._register(this._renderDebouncer),this._syncOutputHandler=new RC(this._coreBrowserService,this._coreService,()=>this._fullRefresh()),this._register(Ee(()=>this._syncOutputHandler.dispose())),this._register(this._coreBrowserService.onDprChange(()=>this.handleDevicePixelRatioChange())),this._register(l.onResize(()=>this._fullRefresh())),this._register(l.buffers.onBufferActivate(()=>{var c;return(c=this._renderer.value)==null?void 0:c.clear()})),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._charSizeService.onCharSizeChange(()=>this.handleCharSizeChanged())),this._register(n.onDecorationRegistered(()=>this._fullRefresh())),this._register(n.onDecorationRemoved(()=>this._fullRefresh())),this._register(this._optionsService.onMultipleOptionChange(["customGlyphs","drawBoldTextInBrightColors","letterSpacing","lineHeight","fontFamily","fontSize","fontWeight","fontWeightBold","minimumContrastRatio","rescaleOverlappingGlyphs"],()=>{this.clear(),this.handleResize(l.cols,l.rows),this._fullRefresh()})),this._register(this._optionsService.onMultipleOptionChange(["cursorBlink","cursorStyle"],()=>this.refreshRows(l.buffer.y,l.buffer.y,!0))),this._register(o.onChangeColors(()=>this._fullRefresh())),this._registerIntersectionObserver(this._coreBrowserService.window,t),this._register(this._coreBrowserService.onWindowChange(c=>this._registerIntersectionObserver(c,t)))}get dimensions(){return this._renderer.value.dimensions}_registerIntersectionObserver(e,t){if("IntersectionObserver"in e){let i=new e.IntersectionObserver(s=>this._handleIntersectionChange(s[s.length-1]),{threshold:0});i.observe(t),this._observerDisposable.value=Ee(()=>i.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,i=!1){if(this._isPaused){this._needsFullRefresh=!0;return}if(this._coreService.decPrivateModes.synchronizedOutput){this._syncOutputHandler.bufferRows(e,t);return}let s=this._syncOutputHandler.flush();s&&(e=Math.min(e,s.start),t=Math.max(t,s.end)),i||(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(){var e,t;this._renderer.value&&((t=(e=this._renderer.value).clearTextureAtlas)==null||t.call(e),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(()=>{var i;return(i=this._renderer.value)==null?void 0:i.handleResize(e,t)}):this._renderer.value.handleResize(e,t),this._fullRefresh())}handleCharSizeChanged(){var e;(e=this._renderer.value)==null||e.handleCharSizeChanged()}handleBlur(){var e;(e=this._renderer.value)==null||e.handleBlur()}handleFocus(){var e;(e=this._renderer.value)==null||e.handleFocus()}handleSelectionChanged(e,t,i){var s;this._selectionState.start=e,this._selectionState.end=t,this._selectionState.columnSelectMode=i,(s=this._renderer.value)==null||s.handleSelectionChanged(e,t,i)}handleCursorMove(){var e;(e=this._renderer.value)==null||e.handleCursorMove()}clear(){var e;(e=this._renderer.value)==null||e.clear()}};Ih=Ae([H(2,bt),H(3,yo),H(4,tr),H(5,bl),H(6,yt),H(7,Xi),H(8,en)],Ih);var RC=class{constructor(e,t,i){this._coreBrowserService=e,this._coreService=t,this._onTimeout=i,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 AC(e,t,i,s){let r=i.buffer.x,n=i.buffer.y;if(!i.buffer.hasScrollback)return LC(r,n,e,t,i,s)+Co(n,t,i,s)+zC(r,n,e,t,i,s);let l;if(n===t)return l=r>e?"D":"C",nl(Math.abs(r-e),rl(l,s));l=n>t?"D":"C";let a=Math.abs(n-t),o=OC(n>t?e:r,i)+(a-1)*i.cols+1+NC(n>t?r:e);return nl(o,rl(l,s))}function NC(e,t){return e-1}function OC(e,t){return t.cols-e}function LC(e,t,i,s,r,n){return Co(t,s,r,n).length===0?"":nl(r0(e,t,e,t-$s(t,r),!1,r).length,rl("D",n))}function Co(e,t,i,s){let r=e-$s(e,i),n=t-$s(t,i),l=Math.abs(r-n)-jC(e,t,i);return nl(l,rl(s0(e,t),s))}function zC(e,t,i,s,r,n){let l;Co(t,s,r,n).length>0?l=s-$s(s,r):l=t;let a=s,o=HC(e,t,i,s,r,n);return nl(r0(e,l,i,a,o==="C",r).length,rl(o,n))}function jC(e,t,i){var l;let s=0,r=e-$s(e,i),n=t-$s(t,i);for(let a=0;a<Math.abs(r-n);a++){let o=s0(e,t)==="A"?-1:1;(l=i.buffer.lines.get(r+o*a))!=null&&l.isWrapped&&s++}return s}function $s(e,t){let i=0,s=t.buffer.lines.get(e),r=s==null?void 0:s.isWrapped;for(;r&&e>=0&&e<t.rows;)i++,s=t.buffer.lines.get(--e),r=s==null?void 0:s.isWrapped;return i}function HC(e,t,i,s,r,n){let l;return Co(i,s,r,n).length>0?l=s-$s(s,r):l=t,e<i&&l<=s||e>=i&&l<s?"C":"D"}function s0(e,t){return e>t?"A":"B"}function r0(e,t,i,s,r,n){let l=e,a=t,o="";for(;(l!==i||a!==s)&&a>=0&&a<n.buffer.lines.length;)l+=r?1:-1,r&&l>n.cols-1?(o+=n.buffer.translateBufferLineToString(a,!1,e,l),l=0,e=0,a++):!r&&l<0&&(o+=n.buffer.translateBufferLineToString(a,!1,0,e+1),l=n.cols-1,e=l,a--);return o+n.buffer.translateBufferLineToString(a,!1,e,l)}function rl(e,t){let i=t?"O":"[";return B.ESC+i+e}function nl(e,t){e=Math.floor(e);let i="";for(let s=0;s<e;s++)i+=t;return i}var UC=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 x_(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 pc=50,qC=15,PC=50,KC=500,WC=" ",YC=new RegExp(WC,"g"),Xh=class extends se{constructor(e,t,i,s,r,n,l,a,o){super(),this._element=e,this._screenElement=t,this._linkifier=i,this._bufferService=s,this._coreService=r,this._mouseService=n,this._optionsService=l,this._renderService=a,this._coreBrowserService=o,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new ri,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this._register(new z),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this._register(new z),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this._register(new z),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this._register(new z),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=c=>this._handleMouseMove(c),this._mouseUpListener=c=>this._handleMouseUp(c),this._coreService.onUserInput(()=>{this.hasSelection&&this.clearSelection()}),this._trimListener=this._bufferService.buffer.lines.onTrim(c=>this._handleTrim(c)),this._register(this._bufferService.buffers.onBufferActivate(c=>this._handleBufferActivate(c))),this.enable(),this._model=new UC(this._bufferService),this._activeSelectionMode=0,this._register(Ee(()=>{this._removeMouseDownListeners()})),this._register(this._bufferService.onResize(c=>{c.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 i=this._bufferService.buffer,s=[];if(this._activeSelectionMode===3){if(e[0]===t[0])return"";let r=e[0]<t[0]?e[0]:t[0],n=e[0]<t[0]?t[0]:e[0];for(let l=e[1];l<=t[1];l++){let a=i.translateBufferLineToString(l,!0,r,n);s.push(a)}}else{let r=e[1]===t[1]?t[0]:void 0;s.push(i.translateBufferLineToString(e[1],!0,e[0],r));for(let n=e[1]+1;n<=t[1]-1;n++){let l=i.lines.get(n),a=i.translateBufferLineToString(n,!0);l!=null&&l.isWrapped?s[s.length-1]+=a:s.push(a)}if(e[1]!==t[1]){let n=i.lines.get(t[1]),l=i.translateBufferLineToString(t[1],!0,0,t[0]);n&&n.isWrapped?s[s.length-1]+=l:s.push(l)}}return s.map(r=>r.replace(YC," ")).join(e0?`\r
|
|
113
|
+
`))}},vw=class extends Error{constructor(e,t){super(e),this.name="ListenerLeakError",this.stack=t}},Sw=class extends Error{constructor(e,t){super(e),this.name="ListenerRefusalError",this.stack=t}},yw=0,_c=class{constructor(e){this.value=e,this.id=yw++}},bw=2,ww,H=class{constructor(e){var t,i,s,r;this._size=0,this._options=e,this._leakageMon=(t=this._options)!=null&&t.leakWarningThreshold?new mw((e==null?void 0:e.onListenerError)??_a,((i=this._options)==null?void 0:i.leakWarningThreshold)??pw):void 0,this._perfMon=(s=this._options)!=null&&s._profName?new _w(this._options._profName):void 0,this._deliveryQueue=(r=this._options)==null?void 0:r.deliveryQueue}dispose(){var e,t,i,s;this._disposed||(this._disposed=!0,((e=this._deliveryQueue)==null?void 0:e.current)===this&&this._deliveryQueue.reset(),this._listeners&&(this._listeners=void 0,this._size=0),(i=(t=this._options)==null?void 0:t.onDidRemoveLastListener)==null||i.call(t),(s=this._leakageMon)==null||s.dispose())}get event(){return this._event??(this._event=(e,t,i)=>{var l,a,o,c,u;if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let _=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(_);let f=this._leakageMon.getMostFrequentStack()??["UNKNOWN stack",-1],d=new Sw(`${_}. HINT: Stack shows most frequent listener (${f[1]}-times)`,f[0]);return(((l=this._options)==null?void 0:l.onListenerError)||_a)(d),se.None}if(this._disposed)return se.None;t&&(e=e.bind(t));let s=new _c(e),r;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(s.stack=gw.create(),r=this._leakageMon.check(s.stack,this._size+1)),this._listeners?this._listeners instanceof _c?(this._deliveryQueue??(this._deliveryQueue=new Cw),this._listeners=[this._listeners,s]):this._listeners.push(s):((o=(a=this._options)==null?void 0:a.onWillAddFirstListener)==null||o.call(a,this),this._listeners=s,(u=(c=this._options)==null?void 0:c.onDidAddFirstListener)==null||u.call(c,this)),this._size++;let n=Ee(()=>{r==null||r(),this._removeListener(s)});return i instanceof ws?i.add(n):Array.isArray(i)&&i.push(n),n}),this._event}_removeListener(e){var r,n,l,a;if((n=(r=this._options)==null?void 0:r.onWillRemoveListener)==null||n.call(r,this),!this._listeners)return;if(this._size===1){this._listeners=void 0,(a=(l=this._options)==null?void 0:l.onDidRemoveLastListener)==null||a.call(l,this),this._size=0;return}let t=this._listeners,i=t.indexOf(e);if(i===-1)throw console.log("disposed?",this._disposed),console.log("size?",this._size),console.log("arr?",JSON.stringify(this._listeners)),new Error("Attempted to dispose unknown listener");this._size--,t[i]=void 0;let s=this._deliveryQueue.current===this;if(this._size*bw<=t.length){let o=0;for(let c=0;c<t.length;c++)t[c]?t[o++]=t[c]:s&&(this._deliveryQueue.end--,o<this._deliveryQueue.i&&this._deliveryQueue.i--);t.length=o}}_deliver(e,t){var s;if(!e)return;let i=((s=this._options)==null?void 0:s.onListenerError)||_a;if(!i){e.value(t);return}try{e.value(t)}catch(r){i(r)}}_deliverQueue(e){let t=e.current._listeners;for(;e.i<e.end;)this._deliver(t[e.i++],e.value);e.reset()}fire(e){var t,i,s,r;if((t=this._deliveryQueue)!=null&&t.current&&(this._deliverQueue(this._deliveryQueue),(i=this._perfMon)==null||i.stop()),(s=this._perfMon)==null||s.start(this._size),this._listeners)if(this._listeners instanceof _c)this._deliver(this._listeners,e);else{let n=this._deliveryQueue;n.enqueue(this,e,this._listeners.length),this._deliverQueue(n)}(r=this._perfMon)==null||r.stop()}hasListeners(){return this._size>0}},Cw=class{constructor(){this.i=-1,this.end=0}enqueue(e,t,i){this.i=0,this.end=i,this.current=e,this.value=t}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},zh=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new H,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new H,this.onDidChangeFullscreen=this._onDidChangeFullscreen.event,this.mapWindowIdToFullScreen=new Map}getZoomLevel(t){return this.mapWindowIdToZoomLevel.get(this.getWindowId(t))??0}setZoomLevel(t,i){if(this.getZoomLevel(i)===t)return;let s=this.getWindowId(i);this.mapWindowIdToZoomLevel.set(s,t),this._onDidChangeZoomLevel.fire(s)}getZoomFactor(t){return this.mapWindowIdToZoomFactor.get(this.getWindowId(t))??1}setZoomFactor(t,i){this.mapWindowIdToZoomFactor.set(this.getWindowId(i),t)}setFullscreen(t,i){if(this.isFullscreen(i)===t)return;let s=this.getWindowId(i);this.mapWindowIdToFullScreen.set(s,t),this._onDidChangeFullscreen.fire(s)}isFullscreen(t){return!!this.mapWindowIdToFullScreen.get(this.getWindowId(t))}getWindowId(t){return t.vscodeWindowId}};zh.INSTANCE=new zh;var vd=zh;function xw(e,t,i){typeof t=="string"&&(t=e.matchMedia(t)),t.addEventListener("change",i)}vd.INSTANCE.onDidChangeZoomLevel;function Ew(e){return vd.INSTANCE.getZoomFactor(e)}vd.INSTANCE.onDidChangeFullscreen;var rn=typeof navigator=="object"?navigator.userAgent:"",jh=rn.indexOf("Firefox")>=0,kw=rn.indexOf("AppleWebKit")>=0,Sd=rn.indexOf("Chrome")>=0,Tw=!Sd&&rn.indexOf("Safari")>=0;rn.indexOf("Electron/")>=0;rn.indexOf("Android")>=0;var pc=!1;if(typeof zi.matchMedia=="function"){let e=zi.matchMedia("(display-mode: standalone) or (display-mode: window-controls-overlay)"),t=zi.matchMedia("(display-mode: fullscreen)");pc=e.matches,xw(zi,e,({matches:i})=>{pc&&t.matches||(pc=i)})}var kr="en",Hh=!1,Uh=!1,pa=!1,$v=!1,Yl,ma=kr,f_=kr,Dw,ai,Ws=globalThis,ot,lp;typeof Ws.vscode<"u"&&typeof Ws.vscode.process<"u"?ot=Ws.vscode.process:typeof process<"u"&&typeof((lp=process==null?void 0:process.versions)==null?void 0:lp.node)=="string"&&(ot=process);var ap,Mw=typeof((ap=ot==null?void 0:ot.versions)==null?void 0:ap.electron)=="string",Rw=Mw&&(ot==null?void 0:ot.type)==="renderer",op;if(typeof ot=="object"){Hh=ot.platform==="win32",Uh=ot.platform==="darwin",pa=ot.platform==="linux",pa&&ot.env.SNAP&&ot.env.SNAP_REVISION,ot.env.CI||ot.env.BUILD_ARTIFACTSTAGINGDIRECTORY,Yl=kr,ma=kr;let e=ot.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);Yl=t.userLocale,f_=t.osLocale,ma=t.resolvedLanguage||kr,Dw=(op=t.languagePack)==null?void 0:op.translationsConfigFile}catch{}$v=!0}else typeof navigator=="object"&&!Rw?(ai=navigator.userAgent,Hh=ai.indexOf("Windows")>=0,Uh=ai.indexOf("Macintosh")>=0,(ai.indexOf("Macintosh")>=0||ai.indexOf("iPad")>=0||ai.indexOf("iPhone")>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints>0,pa=ai.indexOf("Linux")>=0,(ai==null?void 0:ai.indexOf("Mobi"))>=0,ma=globalThis._VSCODE_NLS_LANGUAGE||kr,Yl=navigator.language.toLowerCase(),f_=Yl):console.error("Unable to resolve platform.");var Gv=Hh,Si=Uh,Bw=pa,__=$v,yi=ai,Zi=ma,Aw;(e=>{function t(){return Zi}e.value=t;function i(){return Zi.length===2?Zi==="en":Zi.length>=3?Zi[0]==="e"&&Zi[1]==="n"&&Zi[2]==="-":!1}e.isDefaultVariant=i;function s(){return Zi==="en"}e.isDefault=s})(Aw||(Aw={}));var Nw=typeof Ws.postMessage=="function"&&!Ws.importScripts;(()=>{if(Nw){let e=[];Ws.addEventListener("message",i=>{if(i.data&&i.data.vscodeScheduleAsyncWork)for(let s=0,r=e.length;s<r;s++){let n=e[s];if(n.id===i.data.vscodeScheduleAsyncWork){e.splice(s,1),n.callback();return}}});let t=0;return i=>{let s=++t;e.push({id:s,callback:i}),Ws.postMessage({vscodeScheduleAsyncWork:s},"*")}}return e=>setTimeout(e)})();var Ow=!!(yi&&yi.indexOf("Chrome")>=0);yi&&yi.indexOf("Firefox")>=0;!Ow&&yi&&yi.indexOf("Safari")>=0;yi&&yi.indexOf("Edg/")>=0;yi&&yi.indexOf("Android")>=0;var or=typeof navigator=="object"?navigator:{};__||document.queryCommandSupported&&document.queryCommandSupported("copy")||or&&or.clipboard&&or.clipboard.writeText,__||or&&or.clipboard&&or.clipboard.readText;var yd=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}},mc=new yd,p_=new yd,m_=new yd,Lw=new Array(230),Fv;(e=>{function t(a){return mc.keyCodeToStr(a)}e.toString=t;function i(a){return mc.strToKeyCode(a)}e.fromString=i;function s(a){return p_.keyCodeToStr(a)}e.toUserSettingsUS=s;function r(a){return m_.keyCodeToStr(a)}e.toUserSettingsGeneral=r;function n(a){return p_.strToKeyCode(a)||m_.strToKeyCode(a)}e.fromUserSettings=n;function l(a){if(a>=98&&a<=113)return null;switch(a){case 16:return"Up";case 18:return"Down";case 15:return"Left";case 17:return"Right"}return mc.keyCodeToStr(a)}e.toElectronAccelerator=l})(Fv||(Fv={}));var zw=class Zv{constructor(t,i,s,r,n){this.ctrlKey=t,this.shiftKey=i,this.altKey=s,this.metaKey=r,this.keyCode=n}equals(t){return t instanceof Zv&&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",i=this.shiftKey?"1":"0",s=this.altKey?"1":"0",r=this.metaKey?"1":"0";return`K${t}${i}${s}${r}${this.keyCode}`}isModifierKey(){return this.keyCode===0||this.keyCode===5||this.keyCode===57||this.keyCode===6||this.keyCode===4}toKeybinding(){return new jw([this])}isDuplicateModifierCase(){return this.ctrlKey&&this.keyCode===5||this.shiftKey&&this.keyCode===4||this.altKey&&this.keyCode===6||this.metaKey&&this.keyCode===57}},jw=class{constructor(e){if(e.length===0)throw ow("chords");this.chords=e}getHashCode(){let e="";for(let t=0,i=this.chords.length;t<i;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 Hw(e){if(e.charCode){let i=String.fromCharCode(e.charCode).toUpperCase();return Fv.fromString(i)}let t=e.keyCode;if(t===3)return 7;if(jh)switch(t){case 59:return 85;case 60:if(Bw)return 97;break;case 61:return 86;case 107:return 109;case 109:return 111;case 173:return 88;case 224:if(Si)return 57;break}else if(kw&&(Si&&t===93||!Si&&t===92))return 57;return Lw[t]||0}var Uw=Si?256:2048,qw=512,Pw=1024,Kw=Si?2048:256,g_=class{constructor(e){var i;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=(i=t.getModifierState)==null?void 0:i.call(t,"AltGraph"),this.keyCode=Hw(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|=Uw),this.altKey&&(t|=qw),this.shiftKey&&(t|=Pw),this.metaKey&&(t|=Kw),t|=e,t}_computeKeyCodeChord(){let e=0;return this.keyCode!==5&&this.keyCode!==4&&this.keyCode!==6&&this.keyCode!==57&&(e=this.keyCode),new zw(this.ctrlKey,this.shiftKey,this.altKey,this.metaKey,e)}},v_=new WeakMap;function Ww(e){if(!e.parent||e.parent===e)return null;try{let t=e.location,i=e.parent.location;if(t.origin!=="null"&&i.origin!=="null"&&t.origin!==i.origin)return null}catch{return null}return e.parent}var Yw=class{static getSameOriginWindowChain(e){let t=v_.get(e);if(!t){t=[],v_.set(e,t);let i=e,s;do s=Ww(i),s?t.push({window:new WeakRef(i),iframeElement:i.frameElement||null}):t.push({window:new WeakRef(i),iframeElement:null}),i=s;while(i)}return t.slice(0)}static getPositionOfChildWindowRelativeToAncestorWindow(e,t){if(!t||e===t)return{top:0,left:0};let i=0,s=0,r=this.getSameOriginWindowChain(e);for(let n of r){let l=n.window.deref();if(i+=(l==null?void 0:l.scrollY)??0,s+=(l==null?void 0:l.scrollX)??0,l===t||!n.iframeElement)break;let a=n.iframeElement.getBoundingClientRect();i+=a.top,s+=a.left}return{top:i,left:s}}},Vl=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 i=Yw.getPositionOfChildWindowRelativeToAncestorWindow(e,t.view);this.posx-=i.left,this.posy-=i.top}preventDefault(){this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent.stopPropagation()}},S_=class{constructor(e,t=0,i=0){var r;this.browserEvent=e||null,this.target=e?e.target||e.targetNode||e.srcElement:null,this.deltaY=i,this.deltaX=t;let s=!1;if(Sd){let n=navigator.userAgent.match(/Chrome\/(\d+)/);s=(n?parseInt(n[1]):123)<=122}if(e){let n=e,l=e,a=((r=e.view)==null?void 0:r.devicePixelRatio)||1;if(typeof n.wheelDeltaY<"u")s?this.deltaY=n.wheelDeltaY/(120*a):this.deltaY=n.wheelDeltaY/120;else if(typeof l.VERTICAL_AXIS<"u"&&l.axis===l.VERTICAL_AXIS)this.deltaY=-l.detail/3;else if(e.type==="wheel"){let o=e;o.deltaMode===o.DOM_DELTA_LINE?jh&&!Si?this.deltaY=-e.deltaY/3:this.deltaY=-e.deltaY:this.deltaY=-e.deltaY/40}if(typeof n.wheelDeltaX<"u")Tw&&Gv?this.deltaX=-(n.wheelDeltaX/120):s?this.deltaX=n.wheelDeltaX/(120*a):this.deltaX=n.wheelDeltaX/120;else if(typeof l.HORIZONTAL_AXIS<"u"&&l.axis===l.HORIZONTAL_AXIS)this.deltaX=-e.detail/3;else if(e.type==="wheel"){let o=e;o.deltaMode===o.DOM_DELTA_LINE?jh&&!Si?this.deltaX=-e.deltaX/3:this.deltaX=-e.deltaX:this.deltaX=-e.deltaX/40}this.deltaY===0&&this.deltaX===0&&e.wheelDelta&&(s?this.deltaY=e.wheelDelta/(120*a):this.deltaY=e.wheelDelta/120)}}preventDefault(){var e;(e=this.browserEvent)==null||e.preventDefault()}stopPropagation(){var e;(e=this.browserEvent)==null||e.stopPropagation()}},Qv=Object.freeze(function(e,t){let i=setTimeout(e.bind(t),0);return{dispose(){clearTimeout(i)}}}),Vw;(e=>{function t(i){return i===e.None||i===e.Cancelled||i instanceof Iw?!0:!i||typeof i!="object"?!1:typeof i.isCancellationRequested=="boolean"&&typeof i.onCancellationRequested=="function"}e.isCancellationToken=t,e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:ut.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:Qv})})(Vw||(Vw={}));var Iw=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?Qv:(this._emitter||(this._emitter=new H),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}},bd=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 Bh("Calling 'cancelAndSet' on a disposed TimeoutTimer");this.cancel(),this._token=setTimeout(()=>{this._token=-1,e()},t)}setIfNotSet(e,t){if(this._isDisposed)throw new Bh("Calling 'setIfNotSet' on a disposed TimeoutTimer");this._token===-1&&(this._token=setTimeout(()=>{this._token=-1,e()},t))}},Xw=class{constructor(){this.disposable=void 0,this.isDisposed=!1}cancel(){var e;(e=this.disposable)==null||e.dispose(),this.disposable=void 0}cancelAndSet(e,t,i=globalThis){if(this.isDisposed)throw new Bh("Calling 'cancelAndSet' on a disposed IntervalTimer");this.cancel();let s=i.setInterval(()=>{e()},t);this.disposable=Ee(()=>{i.clearInterval(s),this.disposable=void 0})}dispose(){this.cancel(),this.isDisposed=!0}},$w;(e=>{async function t(s){let r,n=await Promise.all(s.map(l=>l.then(a=>a,a=>{r||(r=a)})));if(typeof r<"u")throw r;return n}e.settled=t;function i(s){return new Promise(async(r,n)=>{try{await s(r,n)}catch(l){n(l)}})}e.withAsyncBody=i})($w||($w={}));var y_=class Vt{static fromArray(t){return new Vt(i=>{i.emitMany(t)})}static fromPromise(t){return new Vt(async i=>{i.emitMany(await t)})}static fromPromises(t){return new Vt(async i=>{await Promise.all(t.map(async s=>i.emitOne(await s)))})}static merge(t){return new Vt(async i=>{await Promise.all(t.map(async s=>{for await(let r of s)i.emitOne(r)}))})}constructor(t,i){this._state=0,this._results=[],this._error=null,this._onReturn=i,this._onStateChanged=new H,queueMicrotask(async()=>{let s={emitOne:r=>this.emitOne(r),emitMany:r=>this.emitMany(r),reject:r=>this.reject(r)};try{await Promise.resolve(t(s)),this.resolve()}catch(r){this.reject(r)}finally{s.emitOne=void 0,s.emitMany=void 0,s.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 ut.toPromise(this._onStateChanged.event)}while(!0)},return:async()=>{var i;return(i=this._onReturn)==null||i.call(this),{done:!0,value:void 0}}}}static map(t,i){return new Vt(async s=>{for await(let r of t)s.emitOne(i(r))})}map(t){return Vt.map(this,t)}static filter(t,i){return new Vt(async s=>{for await(let r of t)i(r)&&s.emitOne(r)})}filter(t){return Vt.filter(this,t)}static coalesce(t){return Vt.filter(t,i=>!!i)}coalesce(){return Vt.coalesce(this)}static async toPromise(t){let i=[];for await(let s of t)i.push(s);return i}toPromise(){return Vt.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())}};y_.EMPTY=y_.fromArray([]);var{getWindow:gi,getWindowId:Gw,onDidRegisterWindow:Fw}=function(){let e=new Map,t={window:zi,disposables:new ws};e.set(zi.vscodeWindowId,t);let i=new H,s=new H,r=new H;function n(l,a){return(typeof l=="number"?e.get(l):void 0)??(a?t:void 0)}return{onDidRegisterWindow:i.event,onWillUnregisterWindow:r.event,onDidUnregisterWindow:s.event,registerWindow(l){if(e.has(l.vscodeWindowId))return se.None;let a=new ws,o={window:l,disposables:a.add(new ws)};return e.set(l.vscodeWindowId,o),a.add(Ee(()=>{e.delete(l.vscodeWindowId),s.fire(l)})),a.add($(l,Fe.BEFORE_UNLOAD,()=>{r.fire(l)})),i.fire(o),a},getWindows(){return e.values()},getWindowsCount(){return e.size},getWindowId(l){return l.vscodeWindowId},hasWindow(l){return e.has(l)},getWindowById:n,getWindow(l){var c;let a=l;if((c=a==null?void 0:a.ownerDocument)!=null&&c.defaultView)return a.ownerDocument.defaultView.window;let o=l;return o!=null&&o.view?o.view.window:zi},getDocument(l){return gi(l).document}}}(),Zw=class{constructor(e,t,i,s){this._node=e,this._type=t,this._handler=i,this._options=s||!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 $(e,t,i,s){return new Zw(e,t,i,s)}var b_=function(e,t,i,s){return $(e,t,i,s)},wd,Qw=class extends Xw{constructor(e){super(),this.defaultTarget=e&&gi(e)}cancelAndSet(e,t,i){return super.cancelAndSet(e,t,i??this.defaultTarget)}},w_=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){_a(e)}}static sort(e,t){return t.priority-e.priority}};(function(){let e=new Map,t=new Map,i=new Map,s=new Map,r=n=>{i.set(n,!1);let l=e.get(n)??[];for(t.set(n,l),e.set(n,[]),s.set(n,!0);l.length>0;)l.sort(w_.sort),l.shift().execute();s.set(n,!1)};wd=(n,l,a=0)=>{let o=Gw(n),c=new w_(l,a),u=e.get(o);return u||(u=[],e.set(o,u)),u.push(c),i.get(o)||(i.set(o,!0),n.requestAnimationFrame(()=>r(o))),c}})();function Jw(e){let t=e.getBoundingClientRect(),i=gi(e);return{left:t.left+i.scrollX,top:t.top+i.scrollY,width:t.width,height:t.height}}var Fe={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"},eC=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=kt(e);this._maxWidth!==t&&(this._maxWidth=t,this.domNode.style.maxWidth=this._maxWidth)}setWidth(e){let t=kt(e);this._width!==t&&(this._width=t,this.domNode.style.width=this._width)}setHeight(e){let t=kt(e);this._height!==t&&(this._height=t,this.domNode.style.height=this._height)}setTop(e){let t=kt(e);this._top!==t&&(this._top=t,this.domNode.style.top=this._top)}setLeft(e){let t=kt(e);this._left!==t&&(this._left=t,this.domNode.style.left=this._left)}setBottom(e){let t=kt(e);this._bottom!==t&&(this._bottom=t,this.domNode.style.bottom=this._bottom)}setRight(e){let t=kt(e);this._right!==t&&(this._right=t,this.domNode.style.right=this._right)}setPaddingTop(e){let t=kt(e);this._paddingTop!==t&&(this._paddingTop=t,this.domNode.style.paddingTop=this._paddingTop)}setPaddingLeft(e){let t=kt(e);this._paddingLeft!==t&&(this._paddingLeft=t,this.domNode.style.paddingLeft=this._paddingLeft)}setPaddingBottom(e){let t=kt(e);this._paddingBottom!==t&&(this._paddingBottom=t,this.domNode.style.paddingBottom=this._paddingBottom)}setPaddingRight(e){let t=kt(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=kt(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=kt(e);this._lineHeight!==t&&(this._lineHeight=t,this.domNode.style.lineHeight=this._lineHeight)}setLetterSpacing(e){let t=kt(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 kt(e){return typeof e=="number"?`${e}px`:e}function Vn(e){return new eC(e)}var Jv=class{constructor(){this._hooks=new ws,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 i=this._onStopCallback;this._onStopCallback=null,e&&i&&i(t)}isMonitoring(){return!!this._pointerMoveCallback}startMonitoring(e,t,i,s,r){this.isMonitoring()&&this.stopMonitoring(!1),this._pointerMoveCallback=s,this._onStopCallback=r;let n=e;try{e.setPointerCapture(t),this._hooks.add(Ee(()=>{try{e.releasePointerCapture(t)}catch{}}))}catch{n=gi(e)}this._hooks.add($(n,Fe.POINTER_MOVE,l=>{if(l.buttons!==i){this.stopMonitoring(!0);return}l.preventDefault(),this._pointerMoveCallback(l)})),this._hooks.add($(n,Fe.POINTER_UP,l=>this.stopMonitoring(!0)))}};function tC(e,t,i){let s=null,r=null;if(typeof i.value=="function"?(s="value",r=i.value,r.length!==0&&console.warn("Memoize should only be used in functions with zero parameters")):typeof i.get=="function"&&(s="get",r=i.get),!r)throw new Error("not supported");let n=`$memoize$${t}`;i[s]=function(...l){return this.hasOwnProperty(n)||Object.defineProperty(this,n,{configurable:!1,enumerable:!1,writable:!1,value:r.apply(this,l)}),this[n]}}var fi;(e=>(e.Tap="-xterm-gesturetap",e.Change="-xterm-gesturechange",e.Start="-xterm-gesturestart",e.End="-xterm-gesturesend",e.Contextmenu="-xterm-gesturecontextmenu"))(fi||(fi={}));var En=class _t extends se{constructor(){super(),this.dispatched=!1,this.targets=new d_,this.ignoreTargets=new d_,this.activeTouches={},this.handle=null,this._lastSetTapCountTime=0,this._register(ut.runAndSubscribe(Fw,({window:t,disposables:i})=>{i.add($(t.document,"touchstart",s=>this.onTouchStart(s),{passive:!1})),i.add($(t.document,"touchend",s=>this.onTouchEnd(t,s))),i.add($(t.document,"touchmove",s=>this.onTouchMove(s),{passive:!1}))},{window:zi,disposables:this._store}))}static addTarget(t){if(!_t.isTouchDevice())return se.None;_t.INSTANCE||(_t.INSTANCE=new _t);let i=_t.INSTANCE.targets.push(t);return Ee(i)}static ignoreTarget(t){if(!_t.isTouchDevice())return se.None;_t.INSTANCE||(_t.INSTANCE=new _t);let i=_t.INSTANCE.ignoreTargets.push(t);return Ee(i)}static isTouchDevice(){return"ontouchstart"in zi||navigator.maxTouchPoints>0}dispose(){this.handle&&(this.handle.dispose(),this.handle=null),super.dispose()}onTouchStart(t){let i=Date.now();this.handle&&(this.handle.dispose(),this.handle=null);for(let s=0,r=t.targetTouches.length;s<r;s++){let n=t.targetTouches.item(s);this.activeTouches[n.identifier]={id:n.identifier,initialTarget:n.target,initialTimeStamp:i,initialPageX:n.pageX,initialPageY:n.pageY,rollingTimestamps:[i],rollingPageX:[n.pageX],rollingPageY:[n.pageY]};let l=this.newGestureEvent(fi.Start,n.target);l.pageX=n.pageX,l.pageY=n.pageY,this.dispatchEvent(l)}this.dispatched&&(t.preventDefault(),t.stopPropagation(),this.dispatched=!1)}onTouchEnd(t,i){let s=Date.now(),r=Object.keys(this.activeTouches).length;for(let n=0,l=i.changedTouches.length;n<l;n++){let a=i.changedTouches.item(n);if(!this.activeTouches.hasOwnProperty(String(a.identifier))){console.warn("move of an UNKNOWN touch",a);continue}let o=this.activeTouches[a.identifier],c=Date.now()-o.initialTimeStamp;if(c<_t.HOLD_DELAY&&Math.abs(o.initialPageX-At(o.rollingPageX))<30&&Math.abs(o.initialPageY-At(o.rollingPageY))<30){let u=this.newGestureEvent(fi.Tap,o.initialTarget);u.pageX=At(o.rollingPageX),u.pageY=At(o.rollingPageY),this.dispatchEvent(u)}else if(c>=_t.HOLD_DELAY&&Math.abs(o.initialPageX-At(o.rollingPageX))<30&&Math.abs(o.initialPageY-At(o.rollingPageY))<30){let u=this.newGestureEvent(fi.Contextmenu,o.initialTarget);u.pageX=At(o.rollingPageX),u.pageY=At(o.rollingPageY),this.dispatchEvent(u)}else if(r===1){let u=At(o.rollingPageX),_=At(o.rollingPageY),f=At(o.rollingTimestamps)-o.rollingTimestamps[0],d=u-o.rollingPageX[0],g=_-o.rollingPageY[0],y=[...this.targets].filter(w=>o.initialTarget instanceof Node&&w.contains(o.initialTarget));this.inertia(t,y,s,Math.abs(d)/f,d>0?1:-1,u,Math.abs(g)/f,g>0?1:-1,_)}this.dispatchEvent(this.newGestureEvent(fi.End,o.initialTarget)),delete this.activeTouches[a.identifier]}this.dispatched&&(i.preventDefault(),i.stopPropagation(),this.dispatched=!1)}newGestureEvent(t,i){let s=document.createEvent("CustomEvent");return s.initEvent(t,!1,!0),s.initialTarget=i,s.tapCount=0,s}dispatchEvent(t){if(t.type===fi.Tap){let i=new Date().getTime(),s=0;i-this._lastSetTapCountTime>_t.CLEAR_TAP_COUNT_TIME?s=1:s=2,this._lastSetTapCountTime=i,t.tapCount=s}else(t.type===fi.Change||t.type===fi.Contextmenu)&&(this._lastSetTapCountTime=0);if(t.initialTarget instanceof Node){for(let s of this.ignoreTargets)if(s.contains(t.initialTarget))return;let i=[];for(let s of this.targets)if(s.contains(t.initialTarget)){let r=0,n=t.initialTarget;for(;n&&n!==s;)r++,n=n.parentElement;i.push([r,s])}i.sort((s,r)=>s[0]-r[0]);for(let[s,r]of i)r.dispatchEvent(t),this.dispatched=!0}}inertia(t,i,s,r,n,l,a,o,c){this.handle=wd(t,()=>{let u=Date.now(),_=u-s,f=0,d=0,g=!0;r+=_t.SCROLL_FRICTION*_,a+=_t.SCROLL_FRICTION*_,r>0&&(g=!1,f=n*r*_),a>0&&(g=!1,d=o*a*_);let y=this.newGestureEvent(fi.Change);y.translationX=f,y.translationY=d,i.forEach(w=>w.dispatchEvent(y)),g||this.inertia(t,i,u,r,n,l+f,a,o,c+d)})}onTouchMove(t){let i=Date.now();for(let s=0,r=t.changedTouches.length;s<r;s++){let n=t.changedTouches.item(s);if(!this.activeTouches.hasOwnProperty(String(n.identifier))){console.warn("end of an UNKNOWN touch",n);continue}let l=this.activeTouches[n.identifier],a=this.newGestureEvent(fi.Change,l.initialTarget);a.translationX=n.pageX-At(l.rollingPageX),a.translationY=n.pageY-At(l.rollingPageY),a.pageX=n.pageX,a.pageY=n.pageY,this.dispatchEvent(a),l.rollingPageX.length>3&&(l.rollingPageX.shift(),l.rollingPageY.shift(),l.rollingTimestamps.shift()),l.rollingPageX.push(n.pageX),l.rollingPageY.push(n.pageY),l.rollingTimestamps.push(i)}this.dispatched&&(t.preventDefault(),t.stopPropagation(),this.dispatched=!1)}};En.SCROLL_FRICTION=-.005,En.HOLD_DELAY=700,En.CLEAR_TAP_COUNT_TIME=400,Ae([tC],En,"isTouchDevice",1);var iC=En,Cd=class extends se{onclick(e,t){this._register($(e,Fe.CLICK,i=>t(new Vl(gi(e),i))))}onmousedown(e,t){this._register($(e,Fe.MOUSE_DOWN,i=>t(new Vl(gi(e),i))))}onmouseover(e,t){this._register($(e,Fe.MOUSE_OVER,i=>t(new Vl(gi(e),i))))}onmouseleave(e,t){this._register($(e,Fe.MOUSE_LEAVE,i=>t(new Vl(gi(e),i))))}onkeydown(e,t){this._register($(e,Fe.KEY_DOWN,i=>t(new g_(i))))}onkeyup(e,t){this._register($(e,Fe.KEY_UP,i=>t(new g_(i))))}oninput(e,t){this._register($(e,Fe.INPUT,t))}onblur(e,t){this._register($(e,Fe.BLUR,t))}onfocus(e,t){this._register($(e,Fe.FOCUS,t))}onchange(e,t){this._register($(e,Fe.CHANGE,t))}ignoreGesture(e){return iC.ignoreTarget(e)}},C_=11,sC=class extends Cd{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=C_+"px",this.domNode.style.height=C_+"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 Jv),this._register(b_(this.bgDomNode,Fe.POINTER_DOWN,t=>this._arrowPointerDown(t))),this._register(b_(this.domNode,Fe.POINTER_DOWN,t=>this._arrowPointerDown(t))),this._pointerdownRepeatTimer=this._register(new Qw),this._pointerdownScheduleRepeatTimer=this._register(new bd)}_arrowPointerDown(e){if(!e.target||!(e.target instanceof Element))return;let t=()=>{this._pointerdownRepeatTimer.cancelAndSet(()=>this._onActivate(),1e3/24,gi(e))};this._onActivate(),this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancelAndSet(t,200),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,i=>{},()=>{this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancel()}),e.preventDefault()}},rC=class qh{constructor(t,i,s,r,n,l,a){this._forceIntegerValues=t,this._scrollStateBrand=void 0,this._forceIntegerValues&&(i=i|0,s=s|0,r=r|0,n=n|0,l=l|0,a=a|0),this.rawScrollLeft=r,this.rawScrollTop=a,i<0&&(i=0),r+i>s&&(r=s-i),r<0&&(r=0),n<0&&(n=0),a+n>l&&(a=l-n),a<0&&(a=0),this.width=i,this.scrollWidth=s,this.scrollLeft=r,this.height=n,this.scrollHeight=l,this.scrollTop=a}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,i){return new qh(this._forceIntegerValues,typeof t.width<"u"?t.width:this.width,typeof t.scrollWidth<"u"?t.scrollWidth:this.scrollWidth,i?this.rawScrollLeft:this.scrollLeft,typeof t.height<"u"?t.height:this.height,typeof t.scrollHeight<"u"?t.scrollHeight:this.scrollHeight,i?this.rawScrollTop:this.scrollTop)}withScrollPosition(t){return new qh(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,i){let s=this.width!==t.width,r=this.scrollWidth!==t.scrollWidth,n=this.scrollLeft!==t.scrollLeft,l=this.height!==t.height,a=this.scrollHeight!==t.scrollHeight,o=this.scrollTop!==t.scrollTop;return{inSmoothScrolling:i,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:s,scrollWidthChanged:r,scrollLeftChanged:n,heightChanged:l,scrollHeightChanged:a,scrollTopChanged:o}}},nC=class extends se{constructor(e){super(),this._scrollableBrand=void 0,this._onScroll=this._register(new H),this.onScroll=this._onScroll.event,this._smoothScrollDuration=e.smoothScrollDuration,this._scheduleAtNextAnimationFrame=e.scheduleAtNextAnimationFrame,this._state=new rC(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){var s;let i=this._state.withScrollDimensions(e,t);this._setState(i,!!this._smoothScrolling),(s=this._smoothScrolling)==null||s.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 i=this._state.withScrollPosition(e);if(this._smoothScrolling.to.scrollLeft===i.scrollLeft&&this._smoothScrolling.to.scrollTop===i.scrollTop)return;let s;t?s=new E_(this._smoothScrolling.from,i,this._smoothScrolling.startTime,this._smoothScrolling.duration):s=this._smoothScrolling.combine(this._state,i,this._smoothScrollDuration),this._smoothScrolling.dispose(),this._smoothScrolling=s}else{let i=this._state.withScrollPosition(e);this._smoothScrolling=E_.start(this._state,i,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 i=this._state;i.equals(e)||(this._state=e,this._onScroll.fire(this._state.createScrollEvent(i,t)))}},x_=class{constructor(e,t,i){this.scrollLeft=e,this.scrollTop=t,this.isDone=i}};function gc(e,t){let i=t-e;return function(s){return e+i*oC(s)}}function lC(e,t,i){return function(s){return s<i?e(s/i):t((s-i)/(1-i))}}var E_=class Ph{constructor(t,i,s,r){this.from=t,this.to=i,this.duration=r,this.startTime=s,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,i,s){if(Math.abs(t-i)>2.5*s){let r,n;return t<i?(r=t+.75*s,n=i-.75*s):(r=t-.75*s,n=i+.75*s),lC(gc(t,r),gc(n,i),.33)}return gc(t,i)}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 i=(t-this.startTime)/this.duration;if(i<1){let s=this.scrollLeft(i),r=this.scrollTop(i);return new x_(s,r,!1)}return new x_(this.to.scrollLeft,this.to.scrollTop,!0)}combine(t,i,s){return Ph.start(t,i,s)}static start(t,i,s){s=s+10;let r=Date.now()-10;return new Ph(t,i,r,s)}};function aC(e){return Math.pow(e,3)}function oC(e){return 1-aC(1-e)}var cC=class extends se{constructor(e,t,i){super(),this._visibility=e,this._visibleClassName=t,this._invisibleClassName=i,this._domNode=null,this._isVisible=!1,this._isNeeded=!1,this._rawShouldBeVisible=!1,this._shouldBeVisible=!1,this._revealTimer=this._register(new bd)}setVisibility(e){this._visibility!==e&&(this._visibility=e,this._updateShouldBeVisible())}setShouldBeVisible(e){this._rawShouldBeVisible=e,this._updateShouldBeVisible()}_applyVisibilitySetting(){return this._visibility===2?!1:this._visibility===3?!0:this._rawShouldBeVisible}_updateShouldBeVisible(){let e=this._applyVisibilitySetting();this._shouldBeVisible!==e&&(this._shouldBeVisible=e,this.ensureVisibility())}setIsNeeded(e){this._isNeeded!==e&&(this._isNeeded=e,this.ensureVisibility())}setDomNode(e){this._domNode=e,this._domNode.setClassName(this._invisibleClassName),this.setShouldBeVisible(!1)}ensureVisibility(){if(!this._isNeeded){this._hide(!1);return}this._shouldBeVisible?this._reveal():this._hide(!0)}_reveal(){this._isVisible||(this._isVisible=!0,this._revealTimer.setIfNotSet(()=>{var e;(e=this._domNode)==null||e.setClassName(this._visibleClassName)},0))}_hide(e){var t;this._revealTimer.cancel(),this._isVisible&&(this._isVisible=!1,(t=this._domNode)==null||t.setClassName(this._invisibleClassName+(e?" fade":"")))}},hC=140,e0=class extends Cd{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 cC(e.visibility,"visible scrollbar "+e.extraScrollbarClassName,"invisible scrollbar "+e.extraScrollbarClassName)),this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._pointerMoveMonitor=this._register(new Jv),this._shouldRender=!0,this.domNode=Vn(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($(this.domNode.domNode,Fe.POINTER_DOWN,t=>this._domNodePointerDown(t)))}_createArrow(e){let t=this._register(new sC(e));this.domNode.domNode.appendChild(t.bgDomNode),this.domNode.domNode.appendChild(t.domNode)}_createSlider(e,t,i,s){this.slider=Vn(document.createElement("div")),this.slider.setClassName("slider"),this.slider.setPosition("absolute"),this.slider.setTop(e),this.slider.setLeft(t),typeof i=="number"&&this.slider.setWidth(i),typeof s=="number"&&this.slider.setHeight(s),this.slider.setLayerHinting(!0),this.slider.setContain("strict"),this.domNode.domNode.appendChild(this.slider.domNode),this._register($(this.slider.domNode,Fe.POINTER_DOWN,r=>{r.button===0&&(r.preventDefault(),this._sliderPointerDown(r))})),this.onclick(this.slider.domNode,r=>{r.leftButton&&r.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,i=t+this._scrollbarState.getSliderPosition(),s=t+this._scrollbarState.getSliderPosition()+this._scrollbarState.getSliderSize(),r=this._sliderPointerPosition(e);i<=r&&r<=s?e.button===0&&(e.preventDefault(),this._sliderPointerDown(e)):this._onPointerDown(e)}_onPointerDown(e){let t,i;if(e.target===this.domNode.domNode&&typeof e.offsetX=="number"&&typeof e.offsetY=="number")t=e.offsetX,i=e.offsetY;else{let r=Jw(this.domNode.domNode);t=e.pageX-r.left,i=e.pageY-r.top}let s=this._pointerDownRelativePosition(t,i);this._setDesiredScrollPositionNow(this._scrollByPage?this._scrollbarState.getDesiredScrollPositionFromOffsetPaged(s):this._scrollbarState.getDesiredScrollPositionFromOffset(s)),e.button===0&&(e.preventDefault(),this._sliderPointerDown(e))}_sliderPointerDown(e){if(!e.target||!(e.target instanceof Element))return;let t=this._sliderPointerPosition(e),i=this._sliderOrthogonalPointerPosition(e),s=this._scrollbarState.clone();this.slider.toggleClassName("active",!0),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,r=>{let n=this._sliderOrthogonalPointerPosition(r),l=Math.abs(n-i);if(Gv&&l>hC){this._setDesiredScrollPositionNow(s.getScrollPosition());return}let a=this._sliderPointerPosition(r)-t;this._setDesiredScrollPositionNow(s.getDesiredScrollPositionFromDelta(a))},()=>{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()}},t0=class Kh{constructor(t,i,s,r,n,l){this._scrollbarSize=Math.round(i),this._oppositeScrollbarSize=Math.round(s),this._arrowSize=Math.round(t),this._visibleSize=r,this._scrollSize=n,this._scrollPosition=l,this._computedAvailableSize=0,this._computedIsNeeded=!1,this._computedSliderSize=0,this._computedSliderRatio=0,this._computedSliderPosition=0,this._refreshComputedValues()}clone(){return new Kh(this._arrowSize,this._scrollbarSize,this._oppositeScrollbarSize,this._visibleSize,this._scrollSize,this._scrollPosition)}setVisibleSize(t){let i=Math.round(t);return this._visibleSize!==i?(this._visibleSize=i,this._refreshComputedValues(),!0):!1}setScrollSize(t){let i=Math.round(t);return this._scrollSize!==i?(this._scrollSize=i,this._refreshComputedValues(),!0):!1}setScrollPosition(t){let i=Math.round(t);return this._scrollPosition!==i?(this._scrollPosition=i,this._refreshComputedValues(),!0):!1}setScrollbarSize(t){this._scrollbarSize=Math.round(t)}setOppositeScrollbarSize(t){this._oppositeScrollbarSize=Math.round(t)}static _computeValues(t,i,s,r,n){let l=Math.max(0,s-t),a=Math.max(0,l-2*i),o=r>0&&r>s;if(!o)return{computedAvailableSize:Math.round(l),computedIsNeeded:o,computedSliderSize:Math.round(a),computedSliderRatio:0,computedSliderPosition:0};let c=Math.round(Math.max(20,Math.floor(s*a/r))),u=(a-c)/(r-s),_=n*u;return{computedAvailableSize:Math.round(l),computedIsNeeded:o,computedSliderSize:Math.round(c),computedSliderRatio:u,computedSliderPosition:Math.round(_)}}_refreshComputedValues(){let t=Kh._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 i=t-this._arrowSize-this._computedSliderSize/2;return Math.round(i/this._computedSliderRatio)}getDesiredScrollPositionFromOffsetPaged(t){if(!this._computedIsNeeded)return 0;let i=t-this._arrowSize,s=this._scrollPosition;return i<this._computedSliderPosition?s-=this._visibleSize:s+=this._visibleSize,s}getDesiredScrollPositionFromDelta(t){if(!this._computedIsNeeded)return 0;let i=this._computedSliderPosition+t;return Math.round(i/this._computedSliderRatio)}},uC=class extends e0{constructor(e,t,i){let s=e.getScrollDimensions(),r=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:i,scrollbarState:new t0(t.horizontalHasArrows?t.arrowSize:0,t.horizontal===2?0:t.horizontalScrollbarSize,t.vertical===2?0:t.verticalScrollbarSize,s.width,s.scrollWidth,r.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}},dC=class extends e0{constructor(e,t,i){let s=e.getScrollDimensions(),r=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:i,scrollbarState:new t0(t.verticalHasArrows?t.arrowSize:0,t.vertical===2?0:t.verticalScrollbarSize,0,s.height,s.scrollHeight,r.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}},fC=500,k_=50,_C=class{constructor(e,t,i){this.timestamp=e,this.deltaX=t,this.deltaY=i,this.score=0}},Wh=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,i=0,s=1,r=this._rear;do{let n=r===this._front?t:Math.pow(2,-s);if(t-=n,i+=this._memory[r].score*n,r===this._front)break;r=(this._capacity+r-1)%this._capacity,s++}while(!0);return i<=.5}acceptStandardWheelEvent(t){if(Sd){let i=gi(t.browserEvent),s=Ew(i);this.accept(Date.now(),t.deltaX*s,t.deltaY*s)}else this.accept(Date.now(),t.deltaX,t.deltaY)}accept(t,i,s){let r=null,n=new _C(t,i,s);this._front===-1&&this._rear===-1?(this._memory[0]=n,this._front=0,this._rear=0):(r=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]=n),n.score=this._computeScore(n,r)}_computeScore(t,i){if(Math.abs(t.deltaX)>0&&Math.abs(t.deltaY)>0)return 1;let s=.5;if((!this._isAlmostInt(t.deltaX)||!this._isAlmostInt(t.deltaY))&&(s+=.25),i){let r=Math.abs(t.deltaX),n=Math.abs(t.deltaY),l=Math.abs(i.deltaX),a=Math.abs(i.deltaY),o=Math.max(Math.min(r,l),1),c=Math.max(Math.min(n,a),1),u=Math.max(r,l),_=Math.max(n,a);u%o===0&&_%c===0&&(s-=.5)}return Math.min(Math.max(s,0),1)}_isAlmostInt(t){return Math.abs(Math.round(t)-t)<.01}};Wh.INSTANCE=new Wh;var pC=Wh,mC=class extends Cd{constructor(e,t,i){super(),this._onScroll=this._register(new H),this.onScroll=this._onScroll.event,this._onWillScroll=this._register(new H),this.onWillScroll=this._onWillScroll.event,this._options=vC(t),this._scrollable=i,this._register(this._scrollable.onScroll(r=>{this._onWillScroll.fire(r),this._onDidScroll(r),this._onScroll.fire(r)}));let s={onMouseWheel:r=>this._onMouseWheel(r),onDragStart:()=>this._onDragStart(),onDragEnd:()=>this._onDragEnd()};this._verticalScrollbar=this._register(new dC(this._scrollable,this._options,s)),this._horizontalScrollbar=this._register(new uC(this._scrollable,this._options,s)),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=Vn(document.createElement("div")),this._leftShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._leftShadowDomNode.domNode),this._topShadowDomNode=Vn(document.createElement("div")),this._topShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._topShadowDomNode.domNode),this._topLeftShadowDomNode=Vn(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,r=>this._onMouseOver(r)),this.onmouseleave(this._listenOnDomNode,r=>this._onMouseLeave(r)),this._hideTimeout=this._register(new bd),this._isDragging=!1,this._mouseIsOver=!1,this._shouldRender=!0,this._revealOnScroll=!0}get options(){return this._options}dispose(){this._mouseWheelToDispose=Gs(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,Si&&(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 S_(e))}_setListeningToMouseWheel(e){if(this._mouseWheelToDispose.length>0!==e&&(this._mouseWheelToDispose=Gs(this._mouseWheelToDispose),e)){let t=i=>{this._onMouseWheel(new S_(i))};this._mouseWheelToDispose.push($(this._listenOnDomNode,Fe.MOUSE_WHEEL,t,{passive:!1}))}}_onMouseWheel(e){var r;if((r=e.browserEvent)!=null&&r.defaultPrevented)return;let t=pC.INSTANCE;t.acceptStandardWheelEvent(e);let i=!1;if(e.deltaY||e.deltaX){let n=e.deltaY*this._options.mouseWheelScrollSensitivity,l=e.deltaX*this._options.mouseWheelScrollSensitivity;this._options.scrollPredominantAxis&&(this._options.scrollYToX&&l+n===0?l=n=0:Math.abs(n)>=Math.abs(l)?l=0:n=0),this._options.flipAxes&&([n,l]=[l,n]);let a=!Si&&e.browserEvent&&e.browserEvent.shiftKey;(this._options.scrollYToX||a)&&!l&&(l=n,n=0),e.browserEvent&&e.browserEvent.altKey&&(l=l*this._options.fastScrollSensitivity,n=n*this._options.fastScrollSensitivity);let o=this._scrollable.getFutureScrollPosition(),c={};if(n){let u=k_*n,_=o.scrollTop-(u<0?Math.floor(u):Math.ceil(u));this._verticalScrollbar.writeScrollPosition(c,_)}if(l){let u=k_*l,_=o.scrollLeft-(u<0?Math.floor(u):Math.ceil(u));this._horizontalScrollbar.writeScrollPosition(c,_)}c=this._scrollable.validateScrollPosition(c),(o.scrollLeft!==c.scrollLeft||o.scrollTop!==c.scrollTop)&&(this._options.mouseWheelSmoothScroll&&t.isPhysicalMouseWheel()?this._scrollable.setScrollPositionSmooth(c):this._scrollable.setScrollPositionNow(c),i=!0)}let s=i;!s&&this._options.alwaysConsumeMouseWheel&&(s=!0),!s&&this._options.consumeMouseWheelIfScrollbarIsNeeded&&(this._verticalScrollbar.isNeeded()||this._horizontalScrollbar.isNeeded())&&(s=!0),s&&(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,i=e.scrollLeft>0,s=i?" left":"",r=t?" top":"",n=i||t?" top-left-corner":"";this._leftShadowDomNode.setClassName(`shadow${s}`),this._topShadowDomNode.setClassName(`shadow${r}`),this._topLeftShadowDomNode.setClassName(`shadow${n}${r}${s}`)}}_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(),fC)}},gC=class extends mC{constructor(e,t,i){super(e,t,i)}setScrollPosition(e){e.reuseAnimation?this._scrollable.setScrollPositionSmooth(e,e.reuseAnimation):this._scrollable.setScrollPositionNow(e)}getScrollPosition(){return this._scrollable.getCurrentScrollPosition()}};function vC(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,Si&&(t.className+=" mac"),t}var Yh=class extends se{constructor(e,t,i,s,r,n,l,a){super(),this._bufferService=i,this._optionsService=l,this._renderService=a,this._onRequestScrollLines=this._register(new H),this.onRequestScrollLines=this._onRequestScrollLines.event,this._isSyncing=!1,this._isHandlingScroll=!1,this._suppressOnScrollHandler=!1;let o=this._register(new nC({forceIntegerValues:!1,smoothScrollDuration:this._optionsService.rawOptions.smoothScrollDuration,scheduleAtNextAnimationFrame:c=>wd(s.window,c)}));this._register(this._optionsService.onSpecificOptionChange("smoothScrollDuration",()=>{o.setSmoothScrollDuration(this._optionsService.rawOptions.smoothScrollDuration)})),this._scrollableElement=this._register(new gC(t,{vertical:1,horizontal:2,useShadows:!1,mouseWheelSmoothScroll:!0,...this._getChangeOptions()},o)),this._register(this._optionsService.onMultipleOptionChange(["scrollSensitivity","fastScrollSensitivity","overviewRuler"],()=>this._scrollableElement.updateOptions(this._getChangeOptions()))),this._register(r.onProtocolChange(c=>{this._scrollableElement.updateOptions({handleMouseWheel:!(c&16)})})),this._scrollableElement.setScrollDimensions({height:0,scrollHeight:0}),this._register(ut.runAndSubscribe(n.onChangeColors,()=>{this._scrollableElement.getDomNode().style.backgroundColor=n.colors.background.css})),e.appendChild(this._scrollableElement.getDomNode()),this._register(Ee(()=>this._scrollableElement.getDomNode().remove())),this._styleElement=s.mainDocument.createElement("style"),t.appendChild(this._styleElement),this._register(Ee(()=>this._styleElement.remove())),this._register(ut.runAndSubscribe(n.onChangeColors,()=>{this._styleElement.textContent=[".xterm .xterm-scrollable-element > .scrollbar > .slider {",` background: ${n.colors.scrollbarSliderBackground.css};`,"}",".xterm .xterm-scrollable-element > .scrollbar > .slider:hover {",` background: ${n.colors.scrollbarSliderHoverBackground.css};`,"}",".xterm .xterm-scrollable-element > .scrollbar > .slider.active {",` background: ${n.colors.scrollbarSliderActiveBackground.css};`,"}"].join(`
|
|
114
|
+
`)})),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(c=>this._handleScroll(c)))}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(){var e;return{mouseWheelScrollSensitivity:this._optionsService.rawOptions.scrollSensitivity,fastScrollSensitivity:this._optionsService.rawOptions.fastScrollSensitivity,verticalScrollbarSize:((e=this._optionsService.rawOptions.overviewRuler)==null?void 0:e.width)||14}}queueSync(e){e!==void 0&&(this._latestYDisp=e),this._queuedAnimationFrame===void 0&&(this._queuedAnimationFrame=this._renderService.addRefreshCallback(()=>{this._queuedAnimationFrame=void 0,this._sync(this._latestYDisp)}))}_sync(e=this._bufferService.buffer.ydisp){!this._renderService||this._isSyncing||(this._isSyncing=!0,this._suppressOnScrollHandler=!0,this._scrollableElement.setScrollDimensions({height:this._renderService.dimensions.css.canvas.height,scrollHeight:this._renderService.dimensions.css.cell.height*this._bufferService.buffer.lines.length}),this._suppressOnScrollHandler=!1,e!==this._latestYDisp&&this._scrollableElement.setScrollPosition({scrollTop:e*this._renderService.dimensions.css.cell.height}),this._isSyncing=!1)}_handleScroll(e){if(!this._renderService||this._isHandlingScroll||this._suppressOnScrollHandler)return;this._isHandlingScroll=!0;let t=Math.round(e.scrollTop/this._renderService.dimensions.css.cell.height),i=t-this._bufferService.buffer.ydisp;i!==0&&(this._latestYDisp=t,this._onRequestScrollLines.fire(i)),this._isHandlingScroll=!1}};Yh=Ae([q(2,bt),q(3,Ii),q(4,Lv),q(5,sn),q(6,wt),q(7,Xi)],Yh);var Vh=class extends se{constructor(e,t,i,s,r){super(),this._screenElement=e,this._bufferService=t,this._coreBrowserService=i,this._decorationService=s,this._renderService=r,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(n=>this._removeDecoration(n))),this._register(Ee(()=>{this._container.remove(),this._decorationElements.clear()}))}_queueRefresh(){this._animationFrame===void 0&&(this._animationFrame=this._renderService.addRefreshCallback(()=>{this._doRefreshDecorations(),this._animationFrame=void 0}))}_doRefreshDecorations(){for(let e of this._decorationService.decorations)this._renderDecoration(e);this._dimensionsChanged=!1}_renderDecoration(e){this._refreshStyle(e),this._dimensionsChanged&&this._refreshXPosition(e)}_createElement(e){var s;let t=this._coreBrowserService.mainDocument.createElement("div");t.classList.add("xterm-decoration"),t.classList.toggle("xterm-decoration-top-layer",((s=e==null?void 0:e.options)==null?void 0:s.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 i=e.options.x??0;return i&&i>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 i=this._decorationElements.get(e);i||(i=this._createElement(e),e.element=i,this._decorationElements.set(e,i),this._container.appendChild(i),e.onDispose(()=>{this._decorationElements.delete(e),i.remove()})),i.style.display=this._altBufferIsActive?"none":"block",this._altBufferIsActive||(i.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,i.style.height=`${(e.options.height||1)*this._renderService.dimensions.css.cell.height}px`,i.style.top=`${t*this._renderService.dimensions.css.cell.height}px`,i.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`),e.onRenderEmitter.fire(i)}}_refreshXPosition(e,t=e.element){if(!t)return;let i=e.options.x??0;(e.options.anchor||"left")==="right"?t.style.right=i?`${i*this._renderService.dimensions.css.cell.width}px`:"":t.style.left=i?`${i*this._renderService.dimensions.css.cell.width}px`:""}_removeDecoration(e){var t;(t=this._decorationElements.get(e))==null||t.remove(),this._decorationElements.delete(e),e.dispose()}};Vh=Ae([q(1,bt),q(2,Ii),q(3,Cl),q(4,Xi)],Vh);var SC=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,i){return t>=e.startBufferLine-this._linePadding[i||"full"]&&t<=e.endBufferLine+this._linePadding[i||"full"]}_addLineToZone(e,t){e.startBufferLine=Math.min(e.startBufferLine,t),e.endBufferLine=Math.max(e.endBufferLine,t)}},ui={full:0,left:0,center:0,right:0},Qi={full:0,left:0,center:0,right:0},_n={full:0,left:0,center:0,right:0},Za=class extends se{constructor(e,t,i,s,r,n,l,a){var c;super(),this._viewportElement=e,this._screenElement=t,this._bufferService=i,this._decorationService=s,this._renderService=r,this._optionsService=n,this._themeService=l,this._coreBrowserService=a,this._colorZoneStore=new SC,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(),(c=this._viewportElement.parentElement)==null||c.insertBefore(this._canvas,this._viewportElement),this._register(Ee(()=>{var u;return(u=this._canvas)==null?void 0:u.remove()}));let o=this._canvas.getContext("2d");if(o)this._ctx=o;else throw new Error("Ctx cannot be null");this._register(this._decorationService.onDecorationRegistered(()=>this._queueRefresh(void 0,!0))),this._register(this._decorationService.onDecorationRemoved(()=>this._queueRefresh(void 0,!0))),this._register(this._renderService.onRenderedViewportChange(()=>this._queueRefresh())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._canvas.style.display=this._bufferService.buffer===this._bufferService.buffers.alt?"none":"block"})),this._register(this._bufferService.onScroll(()=>{this._lastKnownBufferLength!==this._bufferService.buffers.normal.lines.length&&(this._refreshDrawHeightConstants(),this._refreshColorZonePadding())})),this._register(this._renderService.onRender(()=>{(!this._containerHeight||this._containerHeight!==this._screenElement.clientHeight)&&(this._queueRefresh(!0),this._containerHeight=this._screenElement.clientHeight)})),this._register(this._coreBrowserService.onDprChange(()=>this._queueRefresh(!0))),this._register(this._optionsService.onSpecificOptionChange("overviewRuler",()=>this._queueRefresh(!0))),this._register(this._themeService.onChangeColors(()=>this._queueRefresh())),this._queueRefresh(!0)}get _width(){var e;return((e=this._optionsService.options.overviewRuler)==null?void 0:e.width)||0}_refreshDrawConstants(){let e=Math.floor((this._canvas.width-1)/3),t=Math.ceil((this._canvas.width-1)/3);Qi.full=this._canvas.width,Qi.left=e,Qi.center=t,Qi.right=e,this._refreshDrawHeightConstants(),_n.full=1,_n.left=1,_n.center=1+Qi.left,_n.right=1+Qi.left+Qi.center}_refreshDrawHeightConstants(){ui.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);ui.left=t,ui.center=t,ui.right=t}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*ui.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*ui.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*ui.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*ui.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(_n[e.position||"full"],Math.round((this._canvas.height-1)*(e.startBufferLine/this._bufferService.buffers.active.lines.length)-ui[e.position||"full"]/2),Qi[e.position||"full"],Math.round((this._canvas.height-1)*((e.endBufferLine-e.startBufferLine)/this._bufferService.buffers.active.lines.length)+ui[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}))}};Za=Ae([q(2,bt),q(3,Cl),q(4,Xi),q(5,wt),q(6,sn),q(7,Ii)],Za);var R;(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=`
|
|
115
|
+
`,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=""))(R||(R={}));var ga;(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=""))(ga||(ga={}));var i0;(e=>e.ST=`${R.ESC}\\`)(i0||(i0={}));var Ih=class{constructor(e,t,i,s,r,n){this._textarea=e,this._compositionView=t,this._bufferService=i,this._optionsService=s,this._coreService=r,this._renderService=n,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 i;t.start+=this._dataAlreadySent.length,this._isComposing?i=this._textarea.value.substring(t.start,this._compositionPosition.start):i=this._textarea.value.substring(t.start),i.length>0&&this._coreService.triggerDataEvent(i,!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,i=t.replace(e,"");this._dataAlreadySent=i,t.length>e.length?this._coreService.triggerDataEvent(i,!0):t.length<e.length?this._coreService.triggerDataEvent(`${R.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),i=this._renderService.dimensions.css.cell.height,s=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,r=t*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=r+"px",this._compositionView.style.top=s+"px",this._compositionView.style.height=i+"px",this._compositionView.style.lineHeight=i+"px",this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+"px";let n=this._compositionView.getBoundingClientRect();this._textarea.style.left=r+"px",this._textarea.style.top=s+"px",this._textarea.style.width=Math.max(n.width,1)+"px",this._textarea.style.height=Math.max(n.height,1)+"px",this._textarea.style.lineHeight=n.height+"px"}e||setTimeout(()=>this.updateCompositionElements(!0),0)}}};Ih=Ae([q(2,bt),q(3,wt),q(4,ir),q(5,Xi)],Ih);var Qe=0,Je=0,et=0,Re=0,T_={css:"#00000000",rgba:0},qe;(e=>{function t(r,n,l,a){return a!==void 0?`#${Rs(r)}${Rs(n)}${Rs(l)}${Rs(a)}`:`#${Rs(r)}${Rs(n)}${Rs(l)}`}e.toCss=t;function i(r,n,l,a=255){return(r<<24|n<<16|l<<8|a)>>>0}e.toRgba=i;function s(r,n,l,a){return{css:e.toCss(r,n,l,a),rgba:e.toRgba(r,n,l,a)}}e.toColor=s})(qe||(qe={}));var Se;(e=>{function t(o,c){if(Re=(c.rgba&255)/255,Re===1)return{css:c.css,rgba:c.rgba};let u=c.rgba>>24&255,_=c.rgba>>16&255,f=c.rgba>>8&255,d=o.rgba>>24&255,g=o.rgba>>16&255,y=o.rgba>>8&255;Qe=d+Math.round((u-d)*Re),Je=g+Math.round((_-g)*Re),et=y+Math.round((f-y)*Re);let w=qe.toCss(Qe,Je,et),m=qe.toRgba(Qe,Je,et);return{css:w,rgba:m}}e.blend=t;function i(o){return(o.rgba&255)===255}e.isOpaque=i;function s(o,c,u){let _=va.ensureContrastRatio(o.rgba,c.rgba,u);if(_)return qe.toColor(_>>24&255,_>>16&255,_>>8&255)}e.ensureContrastRatio=s;function r(o){let c=(o.rgba|255)>>>0;return[Qe,Je,et]=va.toChannels(c),{css:qe.toCss(Qe,Je,et),rgba:c}}e.opaque=r;function n(o,c){return Re=Math.round(c*255),[Qe,Je,et]=va.toChannels(o.rgba),{css:qe.toCss(Qe,Je,et,Re),rgba:qe.toRgba(Qe,Je,et,Re)}}e.opacity=n;function l(o,c){return Re=o.rgba&255,n(o,Re*c/255)}e.multiplyOpacity=l;function a(o){return[o.rgba>>24&255,o.rgba>>16&255,o.rgba>>8&255]}e.toColorRGB=a})(Se||(Se={}));var Te;(e=>{let t,i;try{let r=document.createElement("canvas");r.width=1,r.height=1;let n=r.getContext("2d",{willReadFrequently:!0});n&&(t=n,t.globalCompositeOperation="copy",i=t.createLinearGradient(0,0,1,1))}catch{}function s(r){if(r.match(/#[\da-f]{3,8}/i))switch(r.length){case 4:return Qe=parseInt(r.slice(1,2).repeat(2),16),Je=parseInt(r.slice(2,3).repeat(2),16),et=parseInt(r.slice(3,4).repeat(2),16),qe.toColor(Qe,Je,et);case 5:return Qe=parseInt(r.slice(1,2).repeat(2),16),Je=parseInt(r.slice(2,3).repeat(2),16),et=parseInt(r.slice(3,4).repeat(2),16),Re=parseInt(r.slice(4,5).repeat(2),16),qe.toColor(Qe,Je,et,Re);case 7:return{css:r,rgba:(parseInt(r.slice(1),16)<<8|255)>>>0};case 9:return{css:r,rgba:parseInt(r.slice(1),16)>>>0}}let n=r.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(n)return Qe=parseInt(n[1]),Je=parseInt(n[2]),et=parseInt(n[3]),Re=Math.round((n[5]===void 0?1:parseFloat(n[5]))*255),qe.toColor(Qe,Je,et,Re);if(!t||!i)throw new Error("css.toColor: Unsupported css format");if(t.fillStyle=i,t.fillStyle=r,typeof t.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(t.fillRect(0,0,1,1),[Qe,Je,et,Re]=t.getImageData(0,0,1,1).data,Re!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:qe.toRgba(Qe,Je,et,Re),css:r}}e.toColor=s})(Te||(Te={}));var gt;(e=>{function t(s){return i(s>>16&255,s>>8&255,s&255)}e.relativeLuminance=t;function i(s,r,n){let l=s/255,a=r/255,o=n/255,c=l<=.03928?l/12.92:Math.pow((l+.055)/1.055,2.4),u=a<=.03928?a/12.92:Math.pow((a+.055)/1.055,2.4),_=o<=.03928?o/12.92:Math.pow((o+.055)/1.055,2.4);return c*.2126+u*.7152+_*.0722}e.relativeLuminance2=i})(gt||(gt={}));var va;(e=>{function t(l,a){if(Re=(a&255)/255,Re===1)return a;let o=a>>24&255,c=a>>16&255,u=a>>8&255,_=l>>24&255,f=l>>16&255,d=l>>8&255;return Qe=_+Math.round((o-_)*Re),Je=f+Math.round((c-f)*Re),et=d+Math.round((u-d)*Re),qe.toRgba(Qe,Je,et)}e.blend=t;function i(l,a,o){let c=gt.relativeLuminance(l>>8),u=gt.relativeLuminance(a>>8);if(Mi(c,u)<o){if(u<c){let d=s(l,a,o),g=Mi(c,gt.relativeLuminance(d>>8));if(g<o){let y=r(l,a,o),w=Mi(c,gt.relativeLuminance(y>>8));return g>w?d:y}return d}let _=r(l,a,o),f=Mi(c,gt.relativeLuminance(_>>8));if(f<o){let d=s(l,a,o),g=Mi(c,gt.relativeLuminance(d>>8));return f>g?_:d}return _}}e.ensureContrastRatio=i;function s(l,a,o){let c=l>>24&255,u=l>>16&255,_=l>>8&255,f=a>>24&255,d=a>>16&255,g=a>>8&255,y=Mi(gt.relativeLuminance2(f,d,g),gt.relativeLuminance2(c,u,_));for(;y<o&&(f>0||d>0||g>0);)f-=Math.max(0,Math.ceil(f*.1)),d-=Math.max(0,Math.ceil(d*.1)),g-=Math.max(0,Math.ceil(g*.1)),y=Mi(gt.relativeLuminance2(f,d,g),gt.relativeLuminance2(c,u,_));return(f<<24|d<<16|g<<8|255)>>>0}e.reduceLuminance=s;function r(l,a,o){let c=l>>24&255,u=l>>16&255,_=l>>8&255,f=a>>24&255,d=a>>16&255,g=a>>8&255,y=Mi(gt.relativeLuminance2(f,d,g),gt.relativeLuminance2(c,u,_));for(;y<o&&(f<255||d<255||g<255);)f=Math.min(255,f+Math.ceil((255-f)*.1)),d=Math.min(255,d+Math.ceil((255-d)*.1)),g=Math.min(255,g+Math.ceil((255-g)*.1)),y=Mi(gt.relativeLuminance2(f,d,g),gt.relativeLuminance2(c,u,_));return(f<<24|d<<16|g<<8|255)>>>0}e.increaseLuminance=r;function n(l){return[l>>24&255,l>>16&255,l>>8&255,l&255]}e.toChannels=n})(va||(va={}));function Rs(e){let t=e.toString(16);return t.length<2?"0"+t:t}function Mi(e,t){return e<t?(t+.05)/(e+.05):(e+.05)/(t+.05)}var yC=class extends wl{constructor(e,t,i){super(),this.content=0,this.combinedData="",this.fg=e.fg,this.bg=e.bg,this.combinedData=t,this._width=i}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()]}},Qa=class{constructor(e){this._bufferService=e,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new ii}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 i=[],s=t.translateToString(!0),r=0,n=0,l=0,a=t.getFg(0),o=t.getBg(0);for(let c=0;c<t.getTrimmedLength();c++)if(t.loadCell(c,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==a||this._workCell.bg!==o){if(c-r>1){let u=this._getJoinedRanges(s,l,n,t,r);for(let _=0;_<u.length;_++)i.push(u[_])}r=c,l=n,a=this._workCell.fg,o=this._workCell.bg}n+=this._workCell.getChars().length||ds.length}if(this._bufferService.cols-r>1){let c=this._getJoinedRanges(s,l,n,t,r);for(let u=0;u<c.length;u++)i.push(c[u])}return i}_getJoinedRanges(e,t,i,s,r){let n=e.substring(t,i),l=[];try{l=this._characterJoiners[0].handler(n)}catch(a){console.error(a)}for(let a=1;a<this._characterJoiners.length;a++)try{let o=this._characterJoiners[a].handler(n);for(let c=0;c<o.length;c++)Qa._mergeRanges(l,o[c])}catch(o){console.error(o)}return this._stringRangesToCellRanges(l,s,r),l}_stringRangesToCellRanges(e,t,i){let s=0,r=!1,n=0,l=e[s];if(l){for(let a=i;a<this._bufferService.cols;a++){let o=t.getWidth(a),c=t.getString(a).length||ds.length;if(o!==0){if(!r&&l[0]<=n&&(l[0]=a,r=!0),l[1]<=n){if(l[1]=a,l=e[++s],!l)break;l[0]<=n?(l[0]=a,r=!0):r=!1}n+=c}}l&&(l[1]=this._bufferService.cols)}}static _mergeRanges(e,t){let i=!1;for(let s=0;s<e.length;s++){let r=e[s];if(i){if(t[1]<=r[0])return e[s-1][1]=t[1],e;if(t[1]<=r[1])return e[s-1][1]=Math.max(t[1],r[1]),e.splice(s,1),e;e.splice(s,1),s--}else{if(t[1]<=r[0])return e.splice(s,0,t),e;if(t[1]<=r[1])return r[0]=Math.min(t[0],r[0]),e;t[0]<r[1]&&(r[0]=Math.min(t[0],r[0]),i=!0);continue}}return i?e[e.length-1][1]=t[1]:e.push(t),e}};Qa=Ae([q(0,bt)],Qa);function bC(e){return 57508<=e&&e<=57558}function wC(e){return 9472<=e&&e<=9631}function CC(e){return bC(e)||wC(e)}function xC(){return{css:{canvas:Il(),cell:Il()},device:{canvas:Il(),cell:Il(),char:{width:0,height:0,left:0,top:0}}}}function Il(){return{width:0,height:0}}var Xh=class{constructor(e,t,i,s,r,n,l){this._document=e,this._characterJoinerService=t,this._optionsService=i,this._coreBrowserService=s,this._coreService=r,this._decorationService=n,this._themeService=l,this._workCell=new ii,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(e,t,i){this._selectionStart=e,this._selectionEnd=t,this._columnSelectMode=i}createRow(e,t,i,s,r,n,l,a,o,c,u){let _=[],f=this._characterJoinerService.getJoinedCharacters(t),d=this._themeService.colors,g=e.getNoBgTrimmedLength();i&&g<n+1&&(g=n+1);let y,w=0,m="",p=0,v=0,S=0,T=0,j=!1,O=0,L=!1,U=0,Y=0,A=[],x=c!==-1&&u!==-1;for(let C=0;C<g;C++){e.loadCell(C,this._workCell);let B=this._workCell.getWidth();if(B===0)continue;let D=!1,b=C>=Y,N=C,E=this._workCell;if(f.length>0&&C===f[0][0]&&b){let oe=f.shift(),Gi=this._isCellInSelection(oe[0],t);for(p=oe[0]+1;p<oe[1];p++)b&&(b=Gi===this._isCellInSelection(p,t));b&&(b=!i||n<oe[0]||n>=oe[1]),b?(D=!0,E=new yC(this._workCell,e.translateToString(!0,oe[0],oe[1]),oe[1]-oe[0]),N=oe[1]-1,B=E.getWidth()):Y=oe[1]}let V=this._isCellInSelection(C,t),F=i&&C===n,rt=x&&C>=c&&C<=u,nt=!1;this._decorationService.forEachDecorationAtCell(C,t,void 0,oe=>{nt=!0});let $e=E.getChars()||ds;if($e===" "&&(E.isUnderline()||E.isOverline())&&($e=" "),U=B*a-o.get($e,E.isBold(),E.isItalic()),!y)y=this._document.createElement("span");else if(w&&(V&&L||!V&&!L&&E.bg===v)&&(V&&L&&d.selectionForeground||E.fg===S)&&E.extended.ext===T&&rt===j&&U===O&&!F&&!D&&!nt&&b){E.isInvisible()?m+=ds:m+=$e,w++;continue}else w&&(y.textContent=m),y=this._document.createElement("span"),w=0,m="";if(v=E.bg,S=E.fg,T=E.extended.ext,j=rt,O=U,L=V,D&&n>=C&&n<=N&&(n=C),!this._coreService.isCursorHidden&&F&&this._coreService.isCursorInitialized){if(A.push("xterm-cursor"),this._coreBrowserService.isFocused)l&&A.push("xterm-cursor-blink"),A.push(s==="bar"?"xterm-cursor-bar":s==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(r)switch(r){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(E.isBold()&&A.push("xterm-bold"),E.isItalic()&&A.push("xterm-italic"),E.isDim()&&A.push("xterm-dim"),E.isInvisible()?m=ds:m=E.getChars()||ds,E.isUnderline()&&(A.push(`xterm-underline-${E.extended.underlineStyle}`),m===" "&&(m=" "),!E.isUnderlineColorDefault()))if(E.isUnderlineColorRGB())y.style.textDecorationColor=`rgb(${wl.toColorRGB(E.getUnderlineColor()).join(",")})`;else{let oe=E.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&E.isBold()&&oe<8&&(oe+=8),y.style.textDecorationColor=d.ansi[oe].css}E.isOverline()&&(A.push("xterm-overline"),m===" "&&(m=" ")),E.isStrikethrough()&&A.push("xterm-strikethrough"),rt&&(y.style.textDecoration="underline");let Ce=E.getFgColor(),lt=E.getFgColorMode(),Ct=E.getBgColor(),Ci=E.getBgColorMode(),sr=!!E.isInverse();if(sr){let oe=Ce;Ce=Ct,Ct=oe;let Gi=lt;lt=Ci,Ci=Gi}let ni,$i,hi=!1;this._decorationService.forEachDecorationAtCell(C,t,void 0,oe=>{oe.options.layer!=="top"&&hi||(oe.backgroundColorRGB&&(Ci=50331648,Ct=oe.backgroundColorRGB.rgba>>8&16777215,ni=oe.backgroundColorRGB),oe.foregroundColorRGB&&(lt=50331648,Ce=oe.foregroundColorRGB.rgba>>8&16777215,$i=oe.foregroundColorRGB),hi=oe.options.layer==="top")}),!hi&&V&&(ni=this._coreBrowserService.isFocused?d.selectionBackgroundOpaque:d.selectionInactiveBackgroundOpaque,Ct=ni.rgba>>8&16777215,Ci=50331648,hi=!0,d.selectionForeground&&(lt=50331648,Ce=d.selectionForeground.rgba>>8&16777215,$i=d.selectionForeground)),hi&&A.push("xterm-decoration-top");let pt;switch(Ci){case 16777216:case 33554432:pt=d.ansi[Ct],A.push(`xterm-bg-${Ct}`);break;case 50331648:pt=qe.toColor(Ct>>16,Ct>>8&255,Ct&255),this._addStyle(y,`background-color:#${D_((Ct>>>0).toString(16),"0",6)}`);break;case 0:default:sr?(pt=d.foreground,A.push("xterm-bg-257")):pt=d.background}switch(ni||E.isDim()&&(ni=Se.multiplyOpacity(pt,.5)),lt){case 16777216:case 33554432:E.isBold()&&Ce<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(Ce+=8),this._applyMinimumContrast(y,pt,d.ansi[Ce],E,ni,void 0)||A.push(`xterm-fg-${Ce}`);break;case 50331648:let oe=qe.toColor(Ce>>16&255,Ce>>8&255,Ce&255);this._applyMinimumContrast(y,pt,oe,E,ni,$i)||this._addStyle(y,`color:#${D_(Ce.toString(16),"0",6)}`);break;case 0:default:this._applyMinimumContrast(y,pt,d.foreground,E,ni,$i)||sr&&A.push("xterm-fg-257")}A.length&&(y.className=A.join(" "),A.length=0),!F&&!D&&!nt&&b?w++:y.textContent=m,U!==this.defaultSpacing&&(y.style.letterSpacing=`${U}px`),_.push(y),C=N}return y&&w&&(y.textContent=m),_}_applyMinimumContrast(e,t,i,s,r,n){if(this._optionsService.rawOptions.minimumContrastRatio===1||CC(s.getCode()))return!1;let l=this._getContrastCache(s),a;if(!r&&!n&&(a=l.getColor(t.rgba,i.rgba)),a===void 0){let o=this._optionsService.rawOptions.minimumContrastRatio/(s.isDim()?2:1);a=Se.ensureContrastRatio(r||t,n||i,o),l.setColor((r||t).rgba,(n||i).rgba,a??null)}return a?(this._addStyle(e,`color:${a.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 i=this._selectionStart,s=this._selectionEnd;return!i||!s?!1:this._columnSelectMode?i[0]<=s[0]?e>=i[0]&&t>=i[1]&&e<s[0]&&t<=s[1]:e<i[0]&&t>=i[1]&&e>=s[0]&&t<=s[1]:t>i[1]&&t<s[1]||i[1]===s[1]&&t===i[1]&&e>=i[0]&&e<s[0]||i[1]<s[1]&&t===s[1]&&e<s[0]||i[1]<s[1]&&t===i[1]&&e>=i[0]}};Xh=Ae([q(1,Hv),q(2,wt),q(3,Ii),q(4,ir),q(5,Cl),q(6,sn)],Xh);function D_(e,t,i){for(;e.length<i;)e=t+e;return e}var EC=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 i=e.createElement("span");i.classList.add("xterm-char-measure-element");let s=e.createElement("span");s.classList.add("xterm-char-measure-element"),s.style.fontWeight="bold";let r=e.createElement("span");r.classList.add("xterm-char-measure-element"),r.style.fontStyle="italic";let n=e.createElement("span");n.classList.add("xterm-char-measure-element"),n.style.fontWeight="bold",n.style.fontStyle="italic",this._measureElements=[i,s,r,n],this._container.appendChild(i),this._container.appendChild(s),this._container.appendChild(r),this._container.appendChild(n),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,i,s){e===this._font&&t===this._fontSize&&i===this._weight&&s===this._weightBold||(this._font=e,this._fontSize=t,this._weight=i,this._weightBold=s,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${i}`,this._measureElements[1].style.fontWeight=`${s}`,this._measureElements[2].style.fontWeight=`${i}`,this._measureElements[3].style.fontWeight=`${s}`,this.clear())}get(e,t,i){let s=0;if(!t&&!i&&e.length===1&&(s=e.charCodeAt(0))<256){if(this._flat[s]!==-9999)return this._flat[s];let l=this._measure(e,0);return l>0&&(this._flat[s]=l),l}let r=e;t&&(r+="B"),i&&(r+="I");let n=this._holey.get(r);if(n===void 0){let l=0;t&&(l|=1),i&&(l|=2),n=this._measure(e,l),n>0&&this._holey.set(r,n)}return n}_measure(e,t){let i=this._measureElements[t];return i.textContent=e.repeat(32),i.offsetWidth/32}},kC=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,i,s=!1){if(this.selectionStart=t,this.selectionEnd=i,!t||!i||t[0]===i[0]&&t[1]===i[1]){this.clear();return}let r=e.buffers.active.ydisp,n=t[1]-r,l=i[1]-r,a=Math.max(n,0),o=Math.min(l,e.rows-1);if(a>=e.rows||o<0){this.clear();return}this.hasSelection=!0,this.columnSelectMode=s,this.viewportStartRow=n,this.viewportEndRow=l,this.viewportCappedStartRow=a,this.viewportCappedEndRow=o,this.startCol=t[0],this.endCol=i[0]}isCellSelected(e,t,i){return this.hasSelection?(i-=e.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?t>=this.startCol&&i>=this.viewportCappedStartRow&&t<this.endCol&&i<=this.viewportCappedEndRow:t<this.startCol&&i>=this.viewportCappedStartRow&&t>=this.endCol&&i<=this.viewportCappedEndRow:i>this.viewportStartRow&&i<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&i===this.viewportStartRow&&t>=this.startCol&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&i===this.viewportEndRow&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&i===this.viewportStartRow&&t>=this.startCol):!1}};function TC(){return new kC}var vc="xterm-dom-renderer-owner-",Yt="xterm-rows",Xl="xterm-fg-",M_="xterm-bg-",pn="xterm-focus",$l="xterm-selection",DC=1,$h=class extends se{constructor(e,t,i,s,r,n,l,a,o,c,u,_,f,d){super(),this._terminal=e,this._document=t,this._element=i,this._screenElement=s,this._viewportElement=r,this._helperContainer=n,this._linkifier2=l,this._charSizeService=o,this._optionsService=c,this._bufferService=u,this._coreService=_,this._coreBrowserService=f,this._themeService=d,this._terminalClass=DC++,this._rowElements=[],this._selectionRenderModel=TC(),this.onRequestRedraw=this._register(new H).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(Yt),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($l),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=xC(),this._updateDimensions(),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._themeService.onChangeColors(g=>this._injectCss(g))),this._injectCss(this._themeService.colors),this._rowFactory=a.createInstance(Xh,document),this._element.classList.add(vc+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this._register(this._linkifier2.onShowLinkUnderline(g=>this._handleLinkHover(g))),this._register(this._linkifier2.onHideLinkUnderline(g=>this._handleLinkLeave(g))),this._register(Ee(()=>{this._element.classList.remove(vc+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()})),this._widthCache=new EC(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 i of this._rowElements)i.style.width=`${this.dimensions.css.canvas.width}px`,i.style.height=`${this.dimensions.css.cell.height}px`,i.style.lineHeight=`${this.dimensions.css.cell.height}px`,i.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));let t=`${this._terminalSelector} .${Yt} 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} .${Yt} { 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} .${Yt} .xterm-dim { color: ${Se.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 i=`blink_underline_${this._terminalClass}`,s=`blink_bar_${this._terminalClass}`,r=`blink_block_${this._terminalClass}`;t+=`@keyframes ${i} { 50% { border-bottom-style: hidden; }}`,t+=`@keyframes ${s} { 50% { box-shadow: none; }}`,t+=`@keyframes ${r} { 0% { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css}; } 50% { background-color: inherit; color: ${e.cursor.css}; }}`,t+=`${this._terminalSelector} .${Yt}.${pn} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${i} 1s step-end infinite;}${this._terminalSelector} .${Yt}.${pn} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${s} 1s step-end infinite;}${this._terminalSelector} .${Yt}.${pn} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${r} 1s step-end infinite;}${this._terminalSelector} .${Yt} .xterm-cursor.xterm-cursor-block { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css};}${this._terminalSelector} .${Yt} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${e.cursor.css} !important; color: ${e.cursorAccent.css} !important;}${this._terminalSelector} .${Yt} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${e.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${Yt} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${e.cursor.css} inset;}${this._terminalSelector} .${Yt} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${e.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,t+=`${this._terminalSelector} .${$l} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${$l} div { position: absolute; background-color: ${e.selectionBackgroundOpaque.css};}${this._terminalSelector} .${$l} div { position: absolute; background-color: ${e.selectionInactiveBackgroundOpaque.css};}`;for(let[n,l]of e.ansi.entries())t+=`${this._terminalSelector} .${Xl}${n} { color: ${l.css}; }${this._terminalSelector} .${Xl}${n}.xterm-dim { color: ${Se.multiplyOpacity(l,.5).css}; }${this._terminalSelector} .${M_}${n} { background-color: ${l.css}; }`;t+=`${this._terminalSelector} .${Xl}257 { color: ${Se.opaque(e.background).css}; }${this._terminalSelector} .${Xl}257.xterm-dim { color: ${Se.multiplyOpacity(Se.opaque(e.background),.5).css}; }${this._terminalSelector} .${M_}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 i=this._rowElements.length;i<=t;i++){let s=this._document.createElement("div");this._rowContainer.appendChild(s),this._rowElements.push(s)}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(pn),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(pn),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(e,t,i){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(e,t,i),this.renderRows(0,this._bufferService.rows-1),!e||!t||(this._selectionRenderModel.update(this._terminal,e,t,i),!this._selectionRenderModel.hasSelection))return;let s=this._selectionRenderModel.viewportStartRow,r=this._selectionRenderModel.viewportEndRow,n=this._selectionRenderModel.viewportCappedStartRow,l=this._selectionRenderModel.viewportCappedEndRow,a=this._document.createDocumentFragment();if(i){let o=e[0]>t[0];a.appendChild(this._createSelectionElement(n,o?t[0]:e[0],o?e[0]:t[0],l-n+1))}else{let o=s===n?e[0]:0,c=n===r?t[0]:this._bufferService.cols;a.appendChild(this._createSelectionElement(n,o,c));let u=l-n-1;if(a.appendChild(this._createSelectionElement(n+1,0,this._bufferService.cols,u)),n!==l){let _=r===l?t[0]:this._bufferService.cols;a.appendChild(this._createSelectionElement(l,0,_))}}this._selectionContainer.appendChild(a)}_createSelectionElement(e,t,i,s=1){let r=this._document.createElement("div"),n=t*this.dimensions.css.cell.width,l=this.dimensions.css.cell.width*(i-t);return n+l>this.dimensions.css.canvas.width&&(l=this.dimensions.css.canvas.width-n),r.style.height=`${s*this.dimensions.css.cell.height}px`,r.style.top=`${e*this.dimensions.css.cell.height}px`,r.style.left=`${n}px`,r.style.width=`${l}px`,r}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 i=this._bufferService.buffer,s=i.ybase+i.y,r=Math.min(i.x,this._bufferService.cols-1),n=this._coreService.decPrivateModes.cursorBlink??this._optionsService.rawOptions.cursorBlink,l=this._coreService.decPrivateModes.cursorStyle??this._optionsService.rawOptions.cursorStyle,a=this._optionsService.rawOptions.cursorInactiveStyle;for(let o=e;o<=t;o++){let c=o+i.ydisp,u=this._rowElements[o],_=i.lines.get(c);if(!u||!_)break;u.replaceChildren(...this._rowFactory.createRow(_,c,c===s,l,a,r,n,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${vc}${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,i,s,r,n){i<0&&(e=0),s<0&&(t=0);let l=this._bufferService.rows-1;i=Math.max(Math.min(i,l),0),s=Math.max(Math.min(s,l),0),r=Math.min(r,this._bufferService.cols);let a=this._bufferService.buffer,o=a.ybase+a.y,c=Math.min(a.x,r-1),u=this._optionsService.rawOptions.cursorBlink,_=this._optionsService.rawOptions.cursorStyle,f=this._optionsService.rawOptions.cursorInactiveStyle;for(let d=i;d<=s;++d){let g=d+a.ydisp,y=this._rowElements[d],w=a.lines.get(g);if(!y||!w)break;y.replaceChildren(...this._rowFactory.createRow(w,g,g===o,_,f,c,u,this.dimensions.css.cell.width,this._widthCache,n?d===i?e:0:-1,n?(d===s?t:r)-1:-1))}}};$h=Ae([q(7,md),q(8,Co),q(9,wt),q(10,bt),q(11,ir),q(12,Ii),q(13,sn)],$h);var Gh=class extends se{constructor(e,t,i){super(),this._optionsService=i,this.width=0,this.height=0,this._onCharSizeChange=this._register(new H),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this._register(new RC(this._optionsService))}catch{this._measureStrategy=this._register(new MC(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())}};Gh=Ae([q(2,wt)],Gh);var s0=class extends se{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)}},MC=class extends s0{constructor(e,t,i){super(),this._document=e,this._parentElement=t,this._optionsService=i,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}},RC=class extends s0{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}},BC=class extends se{constructor(e,t,i){super(),this._textarea=e,this._window=t,this.mainDocument=i,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=this._register(new AC(this._window)),this._onDprChange=this._register(new H),this.onDprChange=this._onDprChange.event,this._onWindowChange=this._register(new H),this.onWindowChange=this._onWindowChange.event,this._register(this.onWindowChange(s=>this._screenDprMonitor.setWindow(s))),this._register(ut.forward(this._screenDprMonitor.onDprChange,this._onDprChange)),this._register($(this._textarea,"focus",()=>this._isFocused=!0)),this._register($(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}},AC=class extends se{constructor(e){super(),this._parentWindow=e,this._windowResizeListener=this._register(new Ir),this._onDprChange=this._register(new H),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this._register(Ee(()=>this.clearListener()))}setWindow(e){this._parentWindow=e,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=$(this._parentWindow,"resize",()=>this._setDprAndFireIfDiffers())}_setDprAndFireIfDiffers(){this._parentWindow.devicePixelRatio!==this._currentDevicePixelRatio&&this._onDprChange.fire(this._parentWindow.devicePixelRatio),this._updateDpr()}_updateDpr(){var e;this._outerListener&&((e=this._resolutionMediaMatchList)==null||e.removeListener(this._outerListener),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._resolutionMediaMatchList=this._parentWindow.matchMedia(`screen and (resolution: ${this._parentWindow.devicePixelRatio}dppx)`),this._resolutionMediaMatchList.addListener(this._outerListener))}clearListener(){!this._resolutionMediaMatchList||!this._outerListener||(this._resolutionMediaMatchList.removeListener(this._outerListener),this._resolutionMediaMatchList=void 0,this._outerListener=void 0)}},NC=class extends se{constructor(){super(),this.linkProviders=[],this._register(Ee(()=>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 xd(e,t,i){let s=i.getBoundingClientRect(),r=e.getComputedStyle(i),n=parseInt(r.getPropertyValue("padding-left")),l=parseInt(r.getPropertyValue("padding-top"));return[t.clientX-s.left-n,t.clientY-s.top-l]}function OC(e,t,i,s,r,n,l,a,o){if(!n)return;let c=xd(e,t,i);if(c)return c[0]=Math.ceil((c[0]+(o?l/2:0))/l),c[1]=Math.ceil(c[1]/a),c[0]=Math.min(Math.max(c[0],1),s+(o?1:0)),c[1]=Math.min(Math.max(c[1],1),r),c}var Fh=class{constructor(e,t){this._renderService=e,this._charSizeService=t}getCoords(e,t,i,s,r){return OC(window,e,t,i,s,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,r)}getMouseReportCoords(e,t){let i=xd(window,e,t);if(this._charSizeService.hasValidSize)return i[0]=Math.min(Math.max(i[0],0),this._renderService.dimensions.css.canvas.width-1),i[1]=Math.min(Math.max(i[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(i[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(i[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(i[0]),y:Math.floor(i[1])}}};Fh=Ae([q(0,Xi),q(1,Co)],Fh);var LC=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,i){this._rowCount=i,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=[]}},r0={};Vb(r0,{getSafariVersion:()=>jC,isChromeOS:()=>o0,isFirefox:()=>n0,isIpad:()=>HC,isIphone:()=>UC,isLegacyEdge:()=>zC,isLinux:()=>Ed,isMac:()=>Ja,isNode:()=>xo,isSafari:()=>l0,isWindows:()=>a0});var xo=typeof process<"u"&&"title"in process,xl=xo?"node":navigator.userAgent,El=xo?"node":navigator.platform,n0=xl.includes("Firefox"),zC=xl.includes("Edge"),l0=/^((?!chrome|android).)*safari/i.test(xl);function jC(){if(!l0)return 0;let e=xl.match(/Version\/(\d+)/);return e===null||e.length<2?0:parseInt(e[1])}var Ja=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(El),HC=El==="iPad",UC=El==="iPhone",a0=["Windows","Win16","Win32","WinCE"].includes(El),Ed=El.indexOf("Linux")>=0,o0=/\bCrOS\b/.test(xl),c0=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,i=0,s=e.timeRemaining(),r=0;for(;this._i<this._tasks.length;){if(t=performance.now(),this._tasks[this._i]()||this._i++,t=Math.max(1,performance.now()-t),i=Math.max(t,i),r=e.timeRemaining(),i*1.5>r){s-t<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(s-t))}ms`),this._start();return}s=r}this.clear()}},qC=class extends c0{_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())}}},PC=class extends c0{_requestCallback(e){return requestIdleCallback(e)}_cancelCallback(e){cancelIdleCallback(e)}},eo=!xo&&"requestIdleCallback"in window?PC:qC,KC=class{constructor(){this._queue=new eo}set(e){this._queue.clear(),this._queue.enqueue(e)}flush(){this._queue.flush()}},Zh=class extends se{constructor(e,t,i,s,r,n,l,a,o){super(),this._rowCount=e,this._optionsService=i,this._charSizeService=s,this._coreService=r,this._coreBrowserService=a,this._renderer=this._register(new Ir),this._pausedResizeTask=new KC,this._observerDisposable=this._register(new Ir),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 H),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this._register(new H),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this._register(new H),this.onRender=this._onRender.event,this._onRefreshRequest=this._register(new H),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new LC((c,u)=>this._renderRows(c,u),this._coreBrowserService),this._register(this._renderDebouncer),this._syncOutputHandler=new WC(this._coreBrowserService,this._coreService,()=>this._fullRefresh()),this._register(Ee(()=>this._syncOutputHandler.dispose())),this._register(this._coreBrowserService.onDprChange(()=>this.handleDevicePixelRatioChange())),this._register(l.onResize(()=>this._fullRefresh())),this._register(l.buffers.onBufferActivate(()=>{var c;return(c=this._renderer.value)==null?void 0:c.clear()})),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._charSizeService.onCharSizeChange(()=>this.handleCharSizeChanged())),this._register(n.onDecorationRegistered(()=>this._fullRefresh())),this._register(n.onDecorationRemoved(()=>this._fullRefresh())),this._register(this._optionsService.onMultipleOptionChange(["customGlyphs","drawBoldTextInBrightColors","letterSpacing","lineHeight","fontFamily","fontSize","fontWeight","fontWeightBold","minimumContrastRatio","rescaleOverlappingGlyphs"],()=>{this.clear(),this.handleResize(l.cols,l.rows),this._fullRefresh()})),this._register(this._optionsService.onMultipleOptionChange(["cursorBlink","cursorStyle"],()=>this.refreshRows(l.buffer.y,l.buffer.y,!0))),this._register(o.onChangeColors(()=>this._fullRefresh())),this._registerIntersectionObserver(this._coreBrowserService.window,t),this._register(this._coreBrowserService.onWindowChange(c=>this._registerIntersectionObserver(c,t)))}get dimensions(){return this._renderer.value.dimensions}_registerIntersectionObserver(e,t){if("IntersectionObserver"in e){let i=new e.IntersectionObserver(s=>this._handleIntersectionChange(s[s.length-1]),{threshold:0});i.observe(t),this._observerDisposable.value=Ee(()=>i.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,i=!1){if(this._isPaused){this._needsFullRefresh=!0;return}if(this._coreService.decPrivateModes.synchronizedOutput){this._syncOutputHandler.bufferRows(e,t);return}let s=this._syncOutputHandler.flush();s&&(e=Math.min(e,s.start),t=Math.max(t,s.end)),i||(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(){var e,t;this._renderer.value&&((t=(e=this._renderer.value).clearTextureAtlas)==null||t.call(e),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(()=>{var i;return(i=this._renderer.value)==null?void 0:i.handleResize(e,t)}):this._renderer.value.handleResize(e,t),this._fullRefresh())}handleCharSizeChanged(){var e;(e=this._renderer.value)==null||e.handleCharSizeChanged()}handleBlur(){var e;(e=this._renderer.value)==null||e.handleBlur()}handleFocus(){var e;(e=this._renderer.value)==null||e.handleFocus()}handleSelectionChanged(e,t,i){var s;this._selectionState.start=e,this._selectionState.end=t,this._selectionState.columnSelectMode=i,(s=this._renderer.value)==null||s.handleSelectionChanged(e,t,i)}handleCursorMove(){var e;(e=this._renderer.value)==null||e.handleCursorMove()}clear(){var e;(e=this._renderer.value)==null||e.clear()}};Zh=Ae([q(2,wt),q(3,Co),q(4,ir),q(5,Cl),q(6,bt),q(7,Ii),q(8,sn)],Zh);var WC=class{constructor(e,t,i){this._coreBrowserService=e,this._coreService=t,this._onTimeout=i,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 YC(e,t,i,s){let r=i.buffer.x,n=i.buffer.y;if(!i.buffer.hasScrollback)return XC(r,n,e,t,i,s)+Eo(n,t,i,s)+$C(r,n,e,t,i,s);let l;if(n===t)return l=r>e?"D":"C",al(Math.abs(r-e),ll(l,s));l=n>t?"D":"C";let a=Math.abs(n-t),o=IC(n>t?e:r,i)+(a-1)*i.cols+1+VC(n>t?r:e);return al(o,ll(l,s))}function VC(e,t){return e-1}function IC(e,t){return t.cols-e}function XC(e,t,i,s,r,n){return Eo(t,s,r,n).length===0?"":al(u0(e,t,e,t-Fs(t,r),!1,r).length,ll("D",n))}function Eo(e,t,i,s){let r=e-Fs(e,i),n=t-Fs(t,i),l=Math.abs(r-n)-GC(e,t,i);return al(l,ll(h0(e,t),s))}function $C(e,t,i,s,r,n){let l;Eo(t,s,r,n).length>0?l=s-Fs(s,r):l=t;let a=s,o=FC(e,t,i,s,r,n);return al(u0(e,l,i,a,o==="C",r).length,ll(o,n))}function GC(e,t,i){var l;let s=0,r=e-Fs(e,i),n=t-Fs(t,i);for(let a=0;a<Math.abs(r-n);a++){let o=h0(e,t)==="A"?-1:1;(l=i.buffer.lines.get(r+o*a))!=null&&l.isWrapped&&s++}return s}function Fs(e,t){let i=0,s=t.buffer.lines.get(e),r=s==null?void 0:s.isWrapped;for(;r&&e>=0&&e<t.rows;)i++,s=t.buffer.lines.get(--e),r=s==null?void 0:s.isWrapped;return i}function FC(e,t,i,s,r,n){let l;return Eo(i,s,r,n).length>0?l=s-Fs(s,r):l=t,e<i&&l<=s||e>=i&&l<s?"C":"D"}function h0(e,t){return e>t?"A":"B"}function u0(e,t,i,s,r,n){let l=e,a=t,o="";for(;(l!==i||a!==s)&&a>=0&&a<n.buffer.lines.length;)l+=r?1:-1,r&&l>n.cols-1?(o+=n.buffer.translateBufferLineToString(a,!1,e,l),l=0,e=0,a++):!r&&l<0&&(o+=n.buffer.translateBufferLineToString(a,!1,0,e+1),l=n.cols-1,e=l,a--);return o+n.buffer.translateBufferLineToString(a,!1,e,l)}function ll(e,t){let i=t?"O":"[";return R.ESC+i+e}function al(e,t){e=Math.floor(e);let i="";for(let s=0;s<e;s++)i+=t;return i}var ZC=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 R_(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 Sc=50,QC=15,JC=50,e2=500,t2=" ",i2=new RegExp(t2,"g"),Qh=class extends se{constructor(e,t,i,s,r,n,l,a,o){super(),this._element=e,this._screenElement=t,this._linkifier=i,this._bufferService=s,this._coreService=r,this._mouseService=n,this._optionsService=l,this._renderService=a,this._coreBrowserService=o,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new ii,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this._register(new H),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this._register(new H),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this._register(new H),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this._register(new H),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=c=>this._handleMouseMove(c),this._mouseUpListener=c=>this._handleMouseUp(c),this._coreService.onUserInput(()=>{this.hasSelection&&this.clearSelection()}),this._trimListener=this._bufferService.buffer.lines.onTrim(c=>this._handleTrim(c)),this._register(this._bufferService.buffers.onBufferActivate(c=>this._handleBufferActivate(c))),this.enable(),this._model=new ZC(this._bufferService),this._activeSelectionMode=0,this._register(Ee(()=>{this._removeMouseDownListeners()})),this._register(this._bufferService.onResize(c=>{c.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 i=this._bufferService.buffer,s=[];if(this._activeSelectionMode===3){if(e[0]===t[0])return"";let r=e[0]<t[0]?e[0]:t[0],n=e[0]<t[0]?t[0]:e[0];for(let l=e[1];l<=t[1];l++){let a=i.translateBufferLineToString(l,!0,r,n);s.push(a)}}else{let r=e[1]===t[1]?t[0]:void 0;s.push(i.translateBufferLineToString(e[1],!0,e[0],r));for(let n=e[1]+1;n<=t[1]-1;n++){let l=i.lines.get(n),a=i.translateBufferLineToString(n,!0);l!=null&&l.isWrapped?s[s.length-1]+=a:s.push(a)}if(e[1]!==t[1]){let n=i.lines.get(t[1]),l=i.translateBufferLineToString(t[1],!0,0,t[0]);n&&n.isWrapped?s[s.length-1]+=l:s.push(l)}}return s.map(r=>r.replace(i2," ")).join(a0?`\r
|
|
116
116
|
`:`
|
|
117
|
-
`)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(e){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._refresh())),Sd&&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),i=this._model.finalSelectionStart,s=this._model.finalSelectionEnd;return!i||!s||!t?!1:this._areCoordsInSelection(t,i,s)}isCellInSelection(e,t){let i=this._model.finalSelectionStart,s=this._model.finalSelectionEnd;return!i||!s?!1:this._areCoordsInSelection([e,t],i,s)}_areCoordsInSelection(e,t,i){return e[1]>t[1]&&e[1]<i[1]||t[1]===i[1]&&e[1]===t[1]&&e[0]>=t[0]&&e[0]<i[0]||t[1]<i[1]&&e[1]===i[1]&&e[0]<i[0]||t[1]<i[1]&&e[1]===t[1]&&e[0]>=t[0]}_selectWordAtCursor(e,t){var r,n;let i=(n=(r=this._linkifier.currentLink)==null?void 0:r.link)==null?void 0:n.range;if(i)return this._model.selectionStart=[i.start.x-1,i.start.y-1],this._model.selectionStartLength=x_(i,this._bufferService.cols),this._model.selectionEnd=void 0,!0;let s=this._getMouseBufferCoords(e);return s?(this._selectWordAt(s,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=vd(this._coreBrowserService.window,e,this._screenElement)[1],i=this._renderService.dimensions.css.canvas.height;return t>=0&&t<=i?0:(t>i&&(t-=i),t=Math.min(Math.max(t,-pc),pc),t/=pc,t/Math.abs(t)+Math.round(t*(qC-1)))}shouldForceSelection(e){return Fa?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(),PC)}_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&&!(Fa&&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 i=this._bufferService.buffer;if(this._model.selectionEnd[1]<i.lines.length){let s=i.lines.get(this._model.selectionEnd[1]);s&&s.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<KC&&e.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){let i=this._mouseService.getCoords(e,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(i&&i[0]!==void 0&&i[1]!==void 0){let s=AC(i[0]-1,i[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(s,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd,i=!!e&&!!t&&(e[0]!==t[0]||e[1]!==t[1]);if(!i){this._oldHasSelection&&this._fireOnSelectionChange(e,t,i);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,i)}_fireOnSelectionChange(e,t,i){this._oldSelectionStart=e,this._oldSelectionEnd=t,this._oldHasSelection=i,this._onSelectionChange.fire()}_handleBufferActivate(e){this.clearSelection(),this._trimListener.dispose(),this._trimListener=e.activeBuffer.lines.onTrim(t=>this._handleTrim(t))}_convertViewportColToCharacterIndex(e,t){let i=t;for(let s=0;t>=s;s++){let r=e.loadCell(s,this._workCell).getChars().length;this._workCell.getWidth()===0?i--:r>1&&t!==s&&(i+=r-1)}return i}setSelection(e,t,i){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[e,t],this._model.selectionStartLength=i,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(e){this._isClickInSelection(e)||(this._selectWordAtCursor(e,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(e,t,i=!0,s=!0){if(e[0]>=this._bufferService.cols)return;let r=this._bufferService.buffer,n=r.lines.get(e[1]);if(!n)return;let l=r.translateBufferLineToString(e[1],!1),a=this._convertViewportColToCharacterIndex(n,e[0]),o=a,c=e[0]-a,_=0,f=0,u=0,d=0;if(l.charAt(a)===" "){for(;a>0&&l.charAt(a-1)===" ";)a--;for(;o<l.length&&l.charAt(o+1)===" ";)o++}else{let C=e[0],m=e[0];n.getWidth(C)===0&&(_++,C--),n.getWidth(m)===2&&(f++,m++);let p=n.getString(m).length;for(p>1&&(d+=p-1,o+=p-1);C>0&&a>0&&!this._isCharWordSeparator(n.loadCell(C-1,this._workCell));){n.loadCell(C-1,this._workCell);let v=this._workCell.getChars().length;this._workCell.getWidth()===0?(_++,C--):v>1&&(u+=v-1,a-=v-1),a--,C--}for(;m<n.length&&o+1<l.length&&!this._isCharWordSeparator(n.loadCell(m+1,this._workCell));){n.loadCell(m+1,this._workCell);let v=this._workCell.getChars().length;this._workCell.getWidth()===2?(f++,m++):v>1&&(d+=v-1,o+=v-1),o++,m++}}o++;let g=a+c-_+u,y=Math.min(this._bufferService.cols,o-a+_+f-u-d);if(!(!t&&l.slice(a,o).trim()==="")){if(i&&g===0&&n.getCodePoint(0)!==32){let C=r.lines.get(e[1]-1);if(C&&n.isWrapped&&C.getCodePoint(this._bufferService.cols-1)!==32){let m=this._getWordAt([this._bufferService.cols-1,e[1]-1],!1,!0,!1);if(m){let p=this._bufferService.cols-m.start;g-=p,y+=p}}}if(s&&g+y===this._bufferService.cols&&n.getCodePoint(this._bufferService.cols-1)!==32){let C=r.lines.get(e[1]+1);if(C!=null&&C.isWrapped&&C.getCodePoint(0)!==32){let m=this._getWordAt([0,e[1]+1],!1,!1,!0);m&&(y+=m.length)}}return{start:g,length:y}}}_selectWordAt(e,t){let i=this._getWordAt(e,t);if(i){for(;i.start<0;)i.start+=this._bufferService.cols,e[1]--;this._model.selectionStart=[i.start,e[1]],this._model.selectionStartLength=i.length}}_selectToWordAt(e){let t=this._getWordAt(e,!0);if(t){let i=e[1];for(;t.start<0;)t.start+=this._bufferService.cols,i--;if(!this._model.areSelectionValuesReversed())for(;t.start+t.length>this._bufferService.cols;)t.length-=this._bufferService.cols,i++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?t.start:t.start+t.length,i]}}_isCharWordSeparator(e){return e.getWidth()===0?!1:this._optionsService.rawOptions.wordSeparator.indexOf(e.getChars())>=0}_selectLineAt(e){let t=this._bufferService.buffer.getWrappedRangeForLine(e),i={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=x_(i,this._bufferService.cols)}};Xh=Ae([H(3,yt),H(4,tr),H(5,ud),H(6,bt),H(7,Gi),H(8,Xi)],Xh);var E_=class{constructor(){this._data={}}set(e,t,i){this._data[e]||(this._data[e]={}),this._data[e][t]=i}get(e,t){return this._data[e]?this._data[e][t]:void 0}clear(){this._data={}}},k_=class{constructor(){this._color=new E_,this._css=new E_}setCss(e,t,i){this._css.set(e,t,i)}getCss(e,t){return this._css.get(e,t)}setColor(e,t,i){this._color.set(e,t,i)}getColor(e,t){return this._color.get(e,t)}clear(){this._color.clear(),this._css.clear()}},Ye=Object.freeze((()=>{let e=[Te.toColor("#2e3436"),Te.toColor("#cc0000"),Te.toColor("#4e9a06"),Te.toColor("#c4a000"),Te.toColor("#3465a4"),Te.toColor("#75507b"),Te.toColor("#06989a"),Te.toColor("#d3d7cf"),Te.toColor("#555753"),Te.toColor("#ef2929"),Te.toColor("#8ae234"),Te.toColor("#fce94f"),Te.toColor("#729fcf"),Te.toColor("#ad7fa8"),Te.toColor("#34e2e2"),Te.toColor("#eeeeec")],t=[0,95,135,175,215,255];for(let i=0;i<216;i++){let s=t[i/36%6|0],r=t[i/6%6|0],n=t[i%6];e.push({css:qe.toCss(s,r,n),rgba:qe.toRgba(s,r,n)})}for(let i=0;i<24;i++){let s=8+i*10;e.push({css:qe.toCss(s,s,s),rgba:qe.toRgba(s,s,s)})}return e})()),Os=Te.toColor("#ffffff"),xn=Te.toColor("#000000"),T_=Te.toColor("#ffffff"),D_=xn,_n={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117},VC=Os,Gh=class extends se{constructor(e){super(),this._optionsService=e,this._contrastCache=new k_,this._halfContrastCache=new k_,this._onChangeColors=this._register(new z),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:Os,background:xn,cursor:T_,cursorAccent:D_,selectionForeground:void 0,selectionBackgroundTransparent:_n,selectionBackgroundOpaque:Se.blend(xn,_n),selectionInactiveBackgroundTransparent:_n,selectionInactiveBackgroundOpaque:Se.blend(xn,_n),scrollbarSliderBackground:Se.opacity(Os,.2),scrollbarSliderHoverBackground:Se.opacity(Os,.4),scrollbarSliderActiveBackground:Se.opacity(Os,.5),overviewRulerBorder:Os,ansi:Ye.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=fe(e.foreground,Os),t.background=fe(e.background,xn),t.cursor=Se.blend(t.background,fe(e.cursor,T_)),t.cursorAccent=Se.blend(t.background,fe(e.cursorAccent,D_)),t.selectionBackgroundTransparent=fe(e.selectionBackground,_n),t.selectionBackgroundOpaque=Se.blend(t.background,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundTransparent=fe(e.selectionInactiveBackground,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundOpaque=Se.blend(t.background,t.selectionInactiveBackgroundTransparent),t.selectionForeground=e.selectionForeground?fe(e.selectionForeground,b_):void 0,t.selectionForeground===b_&&(t.selectionForeground=void 0),Se.isOpaque(t.selectionBackgroundTransparent)&&(t.selectionBackgroundTransparent=Se.opacity(t.selectionBackgroundTransparent,.3)),Se.isOpaque(t.selectionInactiveBackgroundTransparent)&&(t.selectionInactiveBackgroundTransparent=Se.opacity(t.selectionInactiveBackgroundTransparent,.3)),t.scrollbarSliderBackground=fe(e.scrollbarSliderBackground,Se.opacity(t.foreground,.2)),t.scrollbarSliderHoverBackground=fe(e.scrollbarSliderHoverBackground,Se.opacity(t.foreground,.4)),t.scrollbarSliderActiveBackground=fe(e.scrollbarSliderActiveBackground,Se.opacity(t.foreground,.5)),t.overviewRulerBorder=fe(e.overviewRulerBorder,VC),t.ansi=Ye.slice(),t.ansi[0]=fe(e.black,Ye[0]),t.ansi[1]=fe(e.red,Ye[1]),t.ansi[2]=fe(e.green,Ye[2]),t.ansi[3]=fe(e.yellow,Ye[3]),t.ansi[4]=fe(e.blue,Ye[4]),t.ansi[5]=fe(e.magenta,Ye[5]),t.ansi[6]=fe(e.cyan,Ye[6]),t.ansi[7]=fe(e.white,Ye[7]),t.ansi[8]=fe(e.brightBlack,Ye[8]),t.ansi[9]=fe(e.brightRed,Ye[9]),t.ansi[10]=fe(e.brightGreen,Ye[10]),t.ansi[11]=fe(e.brightYellow,Ye[11]),t.ansi[12]=fe(e.brightBlue,Ye[12]),t.ansi[13]=fe(e.brightMagenta,Ye[13]),t.ansi[14]=fe(e.brightCyan,Ye[14]),t.ansi[15]=fe(e.brightWhite,Ye[15]),e.extendedAnsi){let i=Math.min(t.ansi.length-16,e.extendedAnsi.length);for(let s=0;s<i;s++)t.ansi[s+16]=fe(e.extendedAnsi[s],Ye[s+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()}}};Gh=Ae([H(0,bt)],Gh);function fe(e,t){if(e!==void 0)try{return Te.toColor(e)}catch{}return t}var IC=class{constructor(...e){this._entries=new Map;for(let[t,i]of e)this.set(t,i)}set(e,t){let i=this._entries.get(e);return this._entries.set(e,t),i}forEach(e){for(let[t,i]of this._entries.entries())e(t,i)}has(e){return this._entries.has(e)}get(e){return this._entries.get(e)}},XC=class{constructor(){this._services=new IC,this._services.set(hd,this)}setService(e,t){this._services.set(e,t)}getService(e){return this._services.get(e)}createInstance(e,...t){let i=qb(e).sort((n,l)=>n.index-l.index),s=[];for(let n of i){let l=this._services.get(n.id);if(!l)throw new Error(`[createInstance] ${e.name} depends on UNKNOWN service ${n.id._id}.`);s.push(l)}let r=i.length>0?i[0].index:t.length;if(t.length!==r)throw new Error(`[createInstance] First service dependency of ${e.name} at position ${r+1} conflicts with ${t.length} static arguments`);return new e(...t,...s)}},GC={trace:0,debug:1,info:2,warn:3,error:4,off:5},$C="xterm.js: ",$h=class extends se{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=GC[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,i){this._evalLazyOptionalParams(i),e.call(console,(this._optionsService.options.logger?"":$C)+t,...i)}trace(e,...t){var i;this._logLevel<=0&&this._log(((i=this._optionsService.options.logger)==null?void 0:i.trace.bind(this._optionsService.options.logger))??console.log,e,t)}debug(e,...t){var i;this._logLevel<=1&&this._log(((i=this._optionsService.options.logger)==null?void 0:i.debug.bind(this._optionsService.options.logger))??console.log,e,t)}info(e,...t){var i;this._logLevel<=2&&this._log(((i=this._optionsService.options.logger)==null?void 0:i.info.bind(this._optionsService.options.logger))??console.info,e,t)}warn(e,...t){var i;this._logLevel<=3&&this._log(((i=this._optionsService.options.logger)==null?void 0:i.warn.bind(this._optionsService.options.logger))??console.warn,e,t)}error(e,...t){var i;this._logLevel<=4&&this._log(((i=this._optionsService.options.logger)==null?void 0:i.error.bind(this._optionsService.options.logger))??console.error,e,t)}};$h=Ae([H(0,bt)],$h);var M_=class extends se{constructor(e){super(),this._maxLength=e,this.onDeleteEmitter=this._register(new z),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this._register(new z),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this._register(new z),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 i=0;i<Math.min(e,this.length);i++)t[i]=this._array[this._getCyclicIndex(i)];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,...i){if(t){for(let s=e;s<this._length-t;s++)this._array[this._getCyclicIndex(s)]=this._array[this._getCyclicIndex(s+t)];this._length-=t,this.onDeleteEmitter.fire({index:e,amount:t})}for(let s=this._length-1;s>=e;s--)this._array[this._getCyclicIndex(s+i.length)]=this._array[this._getCyclicIndex(s)];for(let s=0;s<i.length;s++)this._array[this._getCyclicIndex(e+s)]=i[s];if(i.length&&this.onInsertEmitter.fire({index:e,amount:i.length}),this._length+i.length>this._maxLength){let s=this._length+i.length-this._maxLength;this._startIndex+=s,this._length=this._maxLength,this.onTrimEmitter.fire(s)}else this._length+=i.length}trimStart(e){e>this._length&&(e=this._length),this._startIndex+=e,this._length-=e,this.onTrimEmitter.fire(e)}shiftElements(e,t,i){if(!(t<=0)){if(e<0||e>=this._length)throw new Error("start argument out of range");if(e+i<0)throw new Error("Cannot shift elements in list beyond index 0");if(i>0){for(let r=t-1;r>=0;r--)this.set(e+r+i,this.get(e+r));let s=e+t+i-this._length;if(s>0)for(this._length+=s;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let s=0;s<t;s++)this.set(e+s+i,this.get(e+s))}}_getCyclicIndex(e){return(this._startIndex+e)%this._maxLength}},ie=3,ze=Object.freeze(new yl),Il=0,mc=2,En=class n0{constructor(t,i,s=!1){this.isWrapped=s,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(t*ie);let r=i||ri.fromCharData([0,xv,1,0]);for(let n=0;n<t;++n)this.setCell(n,r);this.length=t}get(t){let i=this._data[t*ie+0],s=i&2097151;return[this._data[t*ie+1],i&2097152?this._combined[t]:s?ts(s):"",i>>22,i&2097152?this._combined[t].charCodeAt(this._combined[t].length-1):s]}set(t,i){this._data[t*ie+1]=i[0],i[1].length>1?(this._combined[t]=i[1],this._data[t*ie+0]=t|2097152|i[2]<<22):this._data[t*ie+0]=i[1].charCodeAt(0)|i[2]<<22}getWidth(t){return this._data[t*ie+0]>>22}hasWidth(t){return this._data[t*ie+0]&12582912}getFg(t){return this._data[t*ie+1]}getBg(t){return this._data[t*ie+2]}hasContent(t){return this._data[t*ie+0]&4194303}getCodePoint(t){let i=this._data[t*ie+0];return i&2097152?this._combined[t].charCodeAt(this._combined[t].length-1):i&2097151}isCombined(t){return this._data[t*ie+0]&2097152}getString(t){let i=this._data[t*ie+0];return i&2097152?this._combined[t]:i&2097151?ts(i&2097151):""}isProtected(t){return this._data[t*ie+2]&536870912}loadCell(t,i){return Il=t*ie,i.content=this._data[Il+0],i.fg=this._data[Il+1],i.bg=this._data[Il+2],i.content&2097152&&(i.combinedData=this._combined[t]),i.bg&268435456&&(i.extended=this._extendedAttrs[t]),i}setCell(t,i){i.content&2097152&&(this._combined[t]=i.combinedData),i.bg&268435456&&(this._extendedAttrs[t]=i.extended),this._data[t*ie+0]=i.content,this._data[t*ie+1]=i.fg,this._data[t*ie+2]=i.bg}setCellFromCodepoint(t,i,s,r){r.bg&268435456&&(this._extendedAttrs[t]=r.extended),this._data[t*ie+0]=i|s<<22,this._data[t*ie+1]=r.fg,this._data[t*ie+2]=r.bg}addCodepointToCell(t,i,s){let r=this._data[t*ie+0];r&2097152?this._combined[t]+=ts(i):r&2097151?(this._combined[t]=ts(r&2097151)+ts(i),r&=-2097152,r|=2097152):r=i|1<<22,s&&(r&=-12582913,r|=s<<22),this._data[t*ie+0]=r}insertCells(t,i,s){if(t%=this.length,t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,s),i<this.length-t){let r=new ri;for(let n=this.length-t-i-1;n>=0;--n)this.setCell(t+i+n,this.loadCell(t+n,r));for(let n=0;n<i;++n)this.setCell(t+n,s)}else for(let r=t;r<this.length;++r)this.setCell(r,s);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,s)}deleteCells(t,i,s){if(t%=this.length,i<this.length-t){let r=new ri;for(let n=0;n<this.length-t-i;++n)this.setCell(t+n,this.loadCell(t+i+n,r));for(let n=this.length-i;n<this.length;++n)this.setCell(n,s)}else for(let r=t;r<this.length;++r)this.setCell(r,s);t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,s),this.getWidth(t)===0&&!this.hasContent(t)&&this.setCellFromCodepoint(t,0,1,s)}replaceCells(t,i,s,r=!1){if(r){for(t&&this.getWidth(t-1)===2&&!this.isProtected(t-1)&&this.setCellFromCodepoint(t-1,0,1,s),i<this.length&&this.getWidth(i-1)===2&&!this.isProtected(i)&&this.setCellFromCodepoint(i,0,1,s);t<i&&t<this.length;)this.isProtected(t)||this.setCell(t,s),t++;return}for(t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,s),i<this.length&&this.getWidth(i-1)===2&&this.setCellFromCodepoint(i,0,1,s);t<i&&t<this.length;)this.setCell(t++,s)}resize(t,i){if(t===this.length)return this._data.length*4*mc<this._data.buffer.byteLength;let s=t*ie;if(t>this.length){if(this._data.buffer.byteLength>=s*4)this._data=new Uint32Array(this._data.buffer,0,s);else{let r=new Uint32Array(s);r.set(this._data),this._data=r}for(let r=this.length;r<t;++r)this.setCell(r,i)}else{this._data=this._data.subarray(0,s);let r=Object.keys(this._combined);for(let l=0;l<r.length;l++){let a=parseInt(r[l],10);a>=t&&delete this._combined[a]}let n=Object.keys(this._extendedAttrs);for(let l=0;l<n.length;l++){let a=parseInt(n[l],10);a>=t&&delete this._extendedAttrs[a]}}return this.length=t,s*4*mc<this._data.buffer.byteLength}cleanupMemory(){if(this._data.length*4*mc<this._data.buffer.byteLength){let t=new Uint32Array(this._data.length);return t.set(this._data),this._data=t,1}return 0}fill(t,i=!1){if(i){for(let s=0;s<this.length;++s)this.isProtected(s)||this.setCell(s,t);return}this._combined={},this._extendedAttrs={};for(let s=0;s<this.length;++s)this.setCell(s,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 i in t._combined)this._combined[i]=t._combined[i];this._extendedAttrs={};for(let i in t._extendedAttrs)this._extendedAttrs[i]=t._extendedAttrs[i];this.isWrapped=t.isWrapped}clone(){let t=new n0(0);t._data=new Uint32Array(this._data),t.length=this.length;for(let i in this._combined)t._combined[i]=this._combined[i];for(let i in this._extendedAttrs)t._extendedAttrs[i]=this._extendedAttrs[i];return t.isWrapped=this.isWrapped,t}getTrimmedLength(){for(let t=this.length-1;t>=0;--t)if(this._data[t*ie+0]&4194303)return t+(this._data[t*ie+0]>>22);return 0}getNoBgTrimmedLength(){for(let t=this.length-1;t>=0;--t)if(this._data[t*ie+0]&4194303||this._data[t*ie+2]&50331648)return t+(this._data[t*ie+0]>>22);return 0}copyCellsFrom(t,i,s,r,n){let l=t._data;if(n)for(let o=r-1;o>=0;o--){for(let c=0;c<ie;c++)this._data[(s+o)*ie+c]=l[(i+o)*ie+c];l[(i+o)*ie+2]&268435456&&(this._extendedAttrs[s+o]=t._extendedAttrs[i+o])}else for(let o=0;o<r;o++){for(let c=0;c<ie;c++)this._data[(s+o)*ie+c]=l[(i+o)*ie+c];l[(i+o)*ie+2]&268435456&&(this._extendedAttrs[s+o]=t._extendedAttrs[i+o])}let a=Object.keys(t._combined);for(let o=0;o<a.length;o++){let c=parseInt(a[o],10);c>=i&&(this._combined[c-i+s]=t._combined[c])}}translateToString(t,i,s,r){i=i??0,s=s??this.length,t&&(s=Math.min(s,this.getTrimmedLength())),r&&(r.length=0);let n="";for(;i<s;){let l=this._data[i*ie+0],a=l&2097151,o=l&2097152?this._combined[i]:a?ts(a):us;if(n+=o,r)for(let c=0;c<o.length;++c)r.push(i);i+=l>>22||1}return r&&r.push(i),n}};function FC(e,t,i,s,r,n){let l=[];for(let a=0;a<e.length-1;a++){let o=a,c=e.get(++o);if(!c.isWrapped)continue;let _=[e.get(a)];for(;o<e.length&&c.isWrapped;)_.push(c),c=e.get(++o);if(!n&&s>=a&&s<o){a+=_.length-1;continue}let f=0,u=ll(_,f,t),d=1,g=0;for(;d<_.length;){let C=ll(_,d,t),m=C-g,p=i-u,v=Math.min(m,p);_[f].copyCellsFrom(_[d],g,u,v,!1),u+=v,u===i&&(f++,u=0),g+=v,g===C&&(d++,g=0),u===0&&f!==0&&_[f-1].getWidth(i-1)===2&&(_[f].copyCellsFrom(_[f-1],i-1,u++,1,!1),_[f-1].setCell(i-1,r))}_[f].replaceCells(u,i,r);let y=0;for(let C=_.length-1;C>0&&(C>f||_[C].getTrimmedLength()===0);C--)y++;y>0&&(l.push(a+_.length-y),l.push(y)),a+=_.length-1}return l}function ZC(e,t){let i=[],s=0,r=t[s],n=0;for(let l=0;l<e.length;l++)if(r===l){let a=t[++s];e.onDeleteEmitter.fire({index:l-n,amount:a}),l+=a-1,n+=a,r=t[++s]}else i.push(l);return{layout:i,countRemoved:n}}function QC(e,t){let i=[];for(let s=0;s<t.length;s++)i.push(e.get(t[s]));for(let s=0;s<i.length;s++)e.set(s,i[s]);e.length=t.length}function JC(e,t,i){let s=[],r=e.map((o,c)=>ll(e,c,t)).reduce((o,c)=>o+c),n=0,l=0,a=0;for(;a<r;){if(r-a<i){s.push(r-a);break}n+=i;let o=ll(e,l,t);n>o&&(n-=o,l++);let c=e[l].getWidth(n-1)===2;c&&n--;let _=c?i-1:i;s.push(_),a+=_}return s}function ll(e,t,i){if(t===e.length-1)return e[t].getTrimmedLength();let s=!e[t].hasContent(i-1)&&e[t].getWidth(i-1)===1,r=e[t+1].getWidth(0)===2;return s&&r?i-1:i}var l0=class a0{constructor(t){this.line=t,this.isDisposed=!1,this._disposables=[],this._id=a0._nextId++,this._onDispose=this.register(new z),this.onDispose=this._onDispose.event}get id(){return this._id}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),Gs(this._disposables),this._disposables.length=0)}register(t){return this._disposables.push(t),t}};l0._nextId=1;var ew=l0,Ge={},Ls=Ge.B;Ge[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:"≥","{":"π","|":"≠","}":"£","~":"·"};Ge.A={"#":"£"};Ge.B=void 0;Ge[4]={"#":"£","@":"¾","[":"ij","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"};Ge.C=Ge[5]={"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};Ge.R={"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"};Ge.Q={"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"};Ge.K={"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"};Ge.Y={"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"};Ge.E=Ge[6]={"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"};Ge.Z={"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"};Ge.H=Ge[7]={"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};Ge["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"};var B_=4294967295,R_=class{constructor(e,t,i){this._hasScrollback=e,this._optionsService=t,this._bufferService=i,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=ze.clone(),this.savedCharset=Ls,this.markers=[],this._nullCell=ri.fromCharData([0,xv,1,0]),this._whitespaceCell=ri.fromCharData([0,us,1,32]),this._isClearing=!1,this._memoryCleanupQueue=new Za,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new M_(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 Xa),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 Xa),this._whitespaceCell}getBlankLine(e,t){return new En(this._bufferService.cols,this.getNullCell(e),t)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){let e=this.ybase+this.y-this.ydisp;return e>=0&&e<this._rows}_getCorrectBufferLength(e){if(!this._hasScrollback)return e;let t=e+this._optionsService.rawOptions.scrollback;return t>B_?B_:t}fillViewportRows(e){if(this.lines.length===0){e===void 0&&(e=ze);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 M_(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(e,t){let i=this.getNullCell(ze),s=0,r=this._getCorrectBufferLength(t);if(r>this.lines.maxLength&&(this.lines.maxLength=r),this.lines.length>0){if(this._cols<e)for(let l=0;l<this.lines.length;l++)s+=+this.lines.get(l).resize(e,i);let n=0;if(this._rows<t)for(let l=this._rows;l<t;l++)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 En(e,i)):this.ybase>0&&this.lines.length<=this.ybase+this.y+n+1?(this.ybase--,n++,this.ydisp>0&&this.ydisp--):this.lines.push(new En(e,i)));else for(let l=this._rows;l>t;l--)this.lines.length>t+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(r<this.lines.maxLength){let l=this.lines.length-r;l>0&&(this.lines.trimStart(l),this.ybase=Math.max(this.ybase-l,0),this.ydisp=Math.max(this.ydisp-l,0),this.savedY=Math.max(this.savedY-l,0)),this.lines.maxLength=r}this.x=Math.min(this.x,e-1),this.y=Math.min(this.y,t-1),n&&(this.y+=n),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 n=0;n<this.lines.length;n++)s+=+this.lines.get(n).resize(e,i);this._cols=e,this._rows=t,this._memoryCleanupQueue.clear(),s>.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 i=this._optionsService.rawOptions.reflowCursorLine,s=FC(this.lines,this._cols,e,this.ybase+this.y,this.getNullCell(ze),i);if(s.length>0){let r=ZC(this.lines,s);QC(this.lines,r.layout),this._reflowLargerAdjustViewport(e,t,r.countRemoved)}}_reflowLargerAdjustViewport(e,t,i){let s=this.getNullCell(ze),r=i;for(;r-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<t&&this.lines.push(new En(e,s))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-i,0)}_reflowSmaller(e,t){let i=this._optionsService.rawOptions.reflowCursorLine,s=this.getNullCell(ze),r=[],n=0;for(let l=this.lines.length-1;l>=0;l--){let a=this.lines.get(l);if(!a||!a.isWrapped&&a.getTrimmedLength()<=e)continue;let o=[a];for(;a.isWrapped&&l>0;)a=this.lines.get(--l),o.unshift(a);if(!i){let v=this.ybase+this.y;if(v>=l&&v<l+o.length)continue}let c=o[o.length-1].getTrimmedLength(),_=JC(o,this._cols,e),f=_.length-o.length,u;this.ybase===0&&this.y!==this.lines.length-1?u=Math.max(0,this.y-this.lines.maxLength+f):u=Math.max(0,this.lines.length-this.lines.maxLength+f);let d=[];for(let v=0;v<f;v++){let S=this.getBlankLine(ze,!0);d.push(S)}d.length>0&&(r.push({start:l+o.length+n,newLines:d}),n+=d.length),o.push(...d);let g=_.length-1,y=_[g];y===0&&(g--,y=_[g]);let C=o.length-f-1,m=c;for(;C>=0;){let v=Math.min(m,y);if(o[g]===void 0)break;if(o[g].copyCellsFrom(o[C],m-v,y-v,v,!0),y-=v,y===0&&(g--,y=_[g]),m-=v,m===0){C--;let S=Math.max(C,0);m=ll(o,S,this._cols)}}for(let v=0;v<o.length;v++)_[v]<e&&o[v].setCell(_[v],s);let p=f-u;for(;p-- >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+n)-t&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+f,this.ybase+t-1)}if(r.length>0){let l=[],a=[];for(let y=0;y<this.lines.length;y++)a.push(this.lines.get(y));let o=this.lines.length,c=o-1,_=0,f=r[_];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+n);let u=0;for(let y=Math.min(this.lines.maxLength-1,o+n-1);y>=0;y--)if(f&&f.start>c+u){for(let C=f.newLines.length-1;C>=0;C--)this.lines.set(y--,f.newLines[C]);y++,l.push({index:c+1,amount:f.newLines.length}),u+=f.newLines.length,f=r[++_]}else this.lines.set(y,a[c--]);let d=0;for(let y=l.length-1;y>=0;y--)l[y].index+=d,this.lines.onInsertEmitter.fire(l[y]),d+=l[y].amount;let g=Math.max(0,o+n-this.lines.maxLength);g>0&&this.lines.onTrimEmitter.fire(g)}}translateBufferLineToString(e,t,i=0,s){let r=this.lines.get(e);return r?r.translateToString(t,i,s):""}getWrappedRangeForLine(e){let t=e,i=e;for(;t>0&&this.lines.get(t).isWrapped;)t--;for(;i+1<this.lines.length&&this.lines.get(i+1).isWrapped;)i++;return{first:t,last:i}}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 ew(e);return this.markers.push(t),t.register(this.lines.onTrim(i=>{t.line-=i,t.line<0&&t.dispose()})),t.register(this.lines.onInsert(i=>{t.line>=i.index&&(t.line+=i.amount)})),t.register(this.lines.onDelete(i=>{t.line>=i.index&&t.line<i.index+i.amount&&t.dispose(),t.line>i.index&&(t.line-=i.amount)})),t.register(t.onDispose(()=>this._removeMarker(t))),t}_removeMarker(e){this._isClearing||this.markers.splice(this.markers.indexOf(e),1)}},tw=class extends se{constructor(e,t){super(),this._optionsService=e,this._bufferService=t,this._onBufferActivate=this._register(new z),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 R_(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new R_(!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)}},o0=2,c0=1,Fh=class extends se{constructor(e){super(),this.isUserScrolling=!1,this._onResize=this._register(new z),this.onResize=this._onResize.event,this._onScroll=this._register(new z),this.onScroll=this._onScroll.event,this.cols=Math.max(e.rawOptions.cols||0,o0),this.rows=Math.max(e.rawOptions.rows||0,c0),this.buffers=this._register(new tw(e,this)),this._register(this.buffers.onBufferActivate(t=>{this._onScroll.fire(t.activeBuffer.ydisp)}))}get buffer(){return this.buffers.active}resize(e,t){let i=this.cols!==e,s=this.rows!==t;this.cols=e,this.rows=t,this.buffers.resize(e,t),this._onResize.fire({cols:e,rows:t,colsChanged:i,rowsChanged:s})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(e,t=!1){let i=this.buffer,s;s=this._cachedBlankLine,(!s||s.length!==this.cols||s.getFg(0)!==e.fg||s.getBg(0)!==e.bg)&&(s=i.getBlankLine(e,t),this._cachedBlankLine=s),s.isWrapped=t;let r=i.ybase+i.scrollTop,n=i.ybase+i.scrollBottom;if(i.scrollTop===0){let l=i.lines.isFull;n===i.lines.length-1?l?i.lines.recycle().copyFrom(s):i.lines.push(s.clone()):i.lines.splice(n+1,0,s.clone()),l?this.isUserScrolling&&(i.ydisp=Math.max(i.ydisp-1,0)):(i.ybase++,this.isUserScrolling||i.ydisp++)}else{let l=n-r+1;i.lines.shiftElements(r+1,l-1,-1),i.lines.set(n,s.clone())}this.isUserScrolling||(i.ydisp=i.ybase),this._onScroll.fire(i.ydisp)}scrollLines(e,t){let i=this.buffer;if(e<0){if(i.ydisp===0)return;this.isUserScrolling=!0}else e+i.ydisp>=i.ybase&&(this.isUserScrolling=!1);let s=i.ydisp;i.ydisp=Math.max(Math.min(i.ydisp+e,i.ybase),0),s!==i.ydisp&&(t||this._onScroll.fire(i.ydisp))}};Fh=Ae([H(0,bt)],Fh);var or={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:Fa,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRuler:{}},iw=["normal","bold","100","200","300","400","500","600","700","800","900"],sw=class extends se{constructor(e){super(),this._onOptionChange=this._register(new z),this.onOptionChange=this._onOptionChange.event;let t={...or};for(let i in e)if(i in t)try{let s=e[i];t[i]=this._sanitizeAndValidateOption(i,s)}catch(s){console.error(s)}this.rawOptions=t,this.options={...t},this._setupOptions(),this._register(Ee(()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null}))}onSpecificOptionChange(e,t){return this.onOptionChange(i=>{i===e&&t(this.rawOptions[e])})}onMultipleOptionChange(e,t){return this.onOptionChange(i=>{e.indexOf(i)!==-1&&t()})}_setupOptions(){let e=i=>{if(!(i in or))throw new Error(`No option with key "${i}"`);return this.rawOptions[i]},t=(i,s)=>{if(!(i in or))throw new Error(`No option with key "${i}"`);s=this._sanitizeAndValidateOption(i,s),this.rawOptions[i]!==s&&(this.rawOptions[i]=s,this._onOptionChange.fire(i))};for(let i in this.rawOptions){let s={get:e.bind(this,i),set:t.bind(this,i)};Object.defineProperty(this.options,i,s)}}_sanitizeAndValidateOption(e,t){switch(e){case"cursorStyle":if(t||(t=or[e]),!rw(t))throw new Error(`"${t}" is not a valid value for ${e}`);break;case"wordSeparator":t||(t=or[e]);break;case"fontWeight":case"fontWeightBold":if(typeof t=="number"&&1<=t&&t<=1e3)break;t=iw.includes(t)?t:or[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 rw(e){return e==="block"||e==="underline"||e==="bar"}function kn(e,t=5){if(typeof e!="object")return e;let i=Array.isArray(e)?[]:{};for(let s in e)i[s]=t<=1?e[s]:e[s]&&kn(e[s],t-1);return i}var A_=Object.freeze({insertMode:!1}),N_=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,cursorBlink:void 0,cursorStyle:void 0,origin:!1,reverseWraparound:!1,sendFocus:!1,synchronizedOutput:!1,wraparound:!0}),Zh=class extends se{constructor(e,t,i){super(),this._bufferService=e,this._logService=t,this._optionsService=i,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this._register(new z),this.onData=this._onData.event,this._onUserInput=this._register(new z),this.onUserInput=this._onUserInput.event,this._onBinary=this._register(new z),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this._register(new z),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=kn(A_),this.decPrivateModes=kn(N_)}reset(){this.modes=kn(A_),this.decPrivateModes=kn(N_)}triggerDataEvent(e,t=!1){if(this._optionsService.rawOptions.disableStdin)return;let i=this._bufferService.buffer;t&&this._optionsService.rawOptions.scrollOnUserInput&&i.ybase!==i.ydisp&&this._onRequestScrollToBottom.fire(),t&&this._onUserInput.fire(),this._logService.debug(`sending data "${e}"`),this._logService.trace("sending data (codes)",()=>e.split("").map(s=>s.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))}};Zh=Ae([H(0,yt),H(1,Mv),H(2,bt)],Zh);var O_={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 gc(e,t){let i=(e.ctrl?16:0)|(e.shift?4:0)|(e.alt?8:0);return e.button===4?(i|=64,i|=e.action):(i|=e.button&3,e.button&4&&(i|=64),e.button&8&&(i|=128),e.action===32?i|=32:e.action===0&&!t&&(i|=3)),i}var vc=String.fromCharCode,L_={DEFAULT:e=>{let t=[gc(e,!1)+32,e.col+32,e.row+32];return t[0]>255||t[1]>255||t[2]>255?"":`\x1B[M${vc(t[0])}${vc(t[1])}${vc(t[2])}`},SGR:e=>{let t=e.action===0&&e.button!==4?"m":"M";return`\x1B[<${gc(e,!0)};${e.col};${e.row}${t}`},SGR_PIXELS:e=>{let t=e.action===0&&e.button!==4?"m":"M";return`\x1B[<${gc(e,!0)};${e.x};${e.y}${t}`}},Qh=class extends se{constructor(e,t,i){super(),this._bufferService=e,this._coreService=t,this._optionsService=i,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._wheelPartialScroll=0,this._onProtocolChange=this._register(new z),this.onProtocolChange=this._onProtocolChange.event;for(let s of Object.keys(O_))this.addProtocol(s,O_[s]);for(let s of Object.keys(L_))this.addEncoding(s,L_[s]);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,i){if(e.deltaY===0||e.shiftKey||t===void 0||i===void 0)return 0;let s=t/i,r=this._applyScrollModifier(e.deltaY,e);return e.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(r/=s+0,Math.abs(e.deltaY)<50&&(r*=.3),this._wheelPartialScroll+=r,r=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):e.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(r*=this._bufferService.rows),r}_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,i){if(i){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)}};Qh=Ae([H(0,yt),H(1,tr),H(2,bt)],Qh);var Sc=[[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]],nw=[[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]],Ve;function lw(e,t){let i=0,s=t.length-1,r;if(e<t[0][0]||e>t[s][1])return!1;for(;s>=i;)if(r=i+s>>1,e>t[r][1])i=r+1;else if(e<t[r][0])s=r-1;else return!0;return!1}var aw=class{constructor(){if(this.version="6",!Ve){Ve=new Uint8Array(65536),Ve.fill(1),Ve[0]=0,Ve.fill(0,1,32),Ve.fill(0,127,160),Ve.fill(2,4352,4448),Ve[9001]=2,Ve[9002]=2,Ve.fill(2,11904,42192),Ve[12351]=1,Ve.fill(2,44032,55204),Ve.fill(2,63744,64256),Ve.fill(2,65040,65050),Ve.fill(2,65072,65136),Ve.fill(2,65280,65377),Ve.fill(2,65504,65511);for(let e=0;e<Sc.length;++e)Ve.fill(0,Sc[e][0],Sc[e][1]+1)}}wcwidth(e){return e<32?0:e<127?1:e<65536?Ve[e]:lw(e,nw)?0:e>=131072&&e<=196605||e>=196608&&e<=262141?2:1}charProperties(e,t){let i=this.wcwidth(e),s=i===0&&t!==0;if(s){let r=zs.extractWidth(t);r===0?s=!1:r>i&&(i=r)}return zs.createPropertyValue(0,i,s)}},zs=class ma{constructor(){this._providers=Object.create(null),this._active="",this._onChange=new z,this.onChange=this._onChange.event;let t=new aw;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,i,s=!1){return(t&16777215)<<3|(i&3)<<1|(s?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 i=0,s=0,r=t.length;for(let n=0;n<r;++n){let l=t.charCodeAt(n);if(55296<=l&&l<=56319){if(++n>=r)return i+this.wcwidth(l);let c=t.charCodeAt(n);56320<=c&&c<=57343?l=(l-55296)*1024+c-56320+65536:i+=this.wcwidth(c)}let a=this.charProperties(l,s),o=ma.extractWidth(a);ma.extractShouldJoin(a)&&(o-=ma.extractWidth(s)),i+=o,s=a}return i}charProperties(t,i){return this._activeProvider.charProperties(t,i)}},ow=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 z_(e){var s;let t=(s=e.buffer.lines.get(e.buffer.ybase+e.buffer.y-1))==null?void 0:s.get(e.cols-1),i=e.buffer.lines.get(e.buffer.ybase+e.buffer.y);i&&t&&(i.isWrapped=t[3]!==0&&t[3]!==32)}var pn=2147483647,cw=256,h0=class Jh{constructor(t=32,i=32){if(this.maxLength=t,this.maxSubParamsLength=i,i>cw)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(t),this.length=0,this._subParams=new Int32Array(i),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(t),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}static fromArray(t){let i=new Jh;if(!t.length)return i;for(let s=Array.isArray(t[0])?1:0;s<t.length;++s){let r=t[s];if(Array.isArray(r))for(let n=0;n<r.length;++n)i.addSubParam(r[n]);else i.addParam(r)}return i}clone(){let t=new Jh(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 i=0;i<this.length;++i){t.push(this.params[i]);let s=this._subParamsIdx[i]>>8,r=this._subParamsIdx[i]&255;r-s>0&&t.push(Array.prototype.slice.call(this._subParams,s,r))}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>pn?pn: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>pn?pn:t,this._subParamsIdx[this.length-1]++}}hasSubParams(t){return(this._subParamsIdx[t]&255)-(this._subParamsIdx[t]>>8)>0}getSubParams(t){let i=this._subParamsIdx[t]>>8,s=this._subParamsIdx[t]&255;return s-i>0?this._subParams.subarray(i,s):null}getSubParamsAll(){let t={};for(let i=0;i<this.length;++i){let s=this._subParamsIdx[i]>>8,r=this._subParamsIdx[i]&255;r-s>0&&(t[i]=this._subParams.slice(s,r))}return t}addDigit(t){let i;if(this._rejectDigits||!(i=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;let s=this._digitIsSub?this._subParams:this.params,r=s[i-1];s[i-1]=~r?Math.min(r*10+t,pn):t}},mn=[],hw=class{constructor(){this._state=0,this._active=mn,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 i=this._handlers[e];return i.push(t),{dispose:()=>{let s=i.indexOf(t);s!==-1&&i.splice(s,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=mn}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=mn,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||mn,!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,i){if(!this._active.length)this._handlerFb(this._id,"PUT",So(e,t,i));else for(let s=this._active.length-1;s>=0;s--)this._active[s].put(e,t,i)}start(){this.reset(),this._state=1}put(e,t,i){if(this._state!==3){if(this._state===1)for(;t<i;){let s=e[t++];if(s===59){this._state=2,this._start();break}if(s<48||57<s){this._state=3;return}this._id===-1&&(this._id=0),this._id=this._id*10+s-48}this._state===2&&i-t>0&&this._put(e,t,i)}}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 i=!1,s=this._active.length-1,r=!1;if(this._stack.paused&&(s=this._stack.loopPosition-1,i=t,r=this._stack.fallThrough,this._stack.paused=!1),!r&&i===!1){for(;s>=0&&(i=this._active[s].end(e),i!==!0);s--)if(i instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=s,this._stack.fallThrough=!1,i;s--}for(;s>=0;s--)if(i=this._active[s].end(!1),i instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=s,this._stack.fallThrough=!0,i}this._active=mn,this._id=-1,this._state=0}}},Nt=class{constructor(e){this._handler=e,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(e,t,i){this._hitLimit||(this._data+=So(e,t,i),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(i=>(this._data="",this._hitLimit=!1,i));return this._data="",this._hitLimit=!1,t}},gn=[],uw=class{constructor(){this._handlers=Object.create(null),this._active=gn,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=gn}registerHandler(e,t){this._handlers[e]===void 0&&(this._handlers[e]=[]);let i=this._handlers[e];return i.push(t),{dispose:()=>{let s=i.indexOf(t);s!==-1&&i.splice(s,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=gn,this._ident=0}hook(e,t){if(this.reset(),this._ident=e,this._active=this._handlers[e]||gn,!this._active.length)this._handlerFb(this._ident,"HOOK",t);else for(let i=this._active.length-1;i>=0;i--)this._active[i].hook(t)}put(e,t,i){if(!this._active.length)this._handlerFb(this._ident,"PUT",So(e,t,i));else for(let s=this._active.length-1;s>=0;s--)this._active[s].put(e,t,i)}unhook(e,t=!0){if(!this._active.length)this._handlerFb(this._ident,"UNHOOK",e);else{let i=!1,s=this._active.length-1,r=!1;if(this._stack.paused&&(s=this._stack.loopPosition-1,i=t,r=this._stack.fallThrough,this._stack.paused=!1),!r&&i===!1){for(;s>=0&&(i=this._active[s].unhook(e),i!==!0);s--)if(i instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=s,this._stack.fallThrough=!1,i;s--}for(;s>=0;s--)if(i=this._active[s].unhook(!1),i instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=s,this._stack.fallThrough=!0,i}this._active=gn,this._ident=0}},Tn=new h0;Tn.addParam(0);var j_=class{constructor(e){this._handler=e,this._data="",this._params=Tn,this._hitLimit=!1}hook(e){this._params=e.length>1||e.params[0]?e.clone():Tn,this._data="",this._hitLimit=!1}put(e,t,i){this._hitLimit||(this._data+=So(e,t,i),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(i=>(this._params=Tn,this._data="",this._hitLimit=!1,i));return this._params=Tn,this._data="",this._hitLimit=!1,t}},dw=class{constructor(e){this.table=new Uint8Array(e)}setDefault(e,t){this.table.fill(e<<4|t)}add(e,t,i,s){this.table[t<<8|e]=i<<4|s}addMany(e,t,i,s){for(let r=0;r<e.length;r++)this.table[t<<8|e[r]]=i<<4|s}},$t=160,fw=function(){let e=new dw(4095),t=Array.apply(null,Array(256)).map((a,o)=>o),i=(a,o)=>t.slice(a,o),s=i(32,127),r=i(0,24);r.push(25),r.push.apply(r,i(28,32));let n=i(0,14),l;e.setDefault(1,0),e.addMany(s,0,2,0);for(l in n)e.addMany([24,26,153,154],l,3,0),e.addMany(i(128,144),l,3,0),e.addMany(i(144,152),l,3,0),e.add(156,l,0,0),e.add(27,l,11,1),e.add(157,l,4,8),e.addMany([152,158,159],l,0,7),e.add(155,l,11,3),e.add(144,l,11,9);return e.addMany(r,0,3,0),e.addMany(r,1,3,1),e.add(127,1,0,1),e.addMany(r,8,0,8),e.addMany(r,3,3,3),e.add(127,3,0,3),e.addMany(r,4,3,4),e.add(127,4,0,4),e.addMany(r,6,3,6),e.addMany(r,5,3,5),e.add(127,5,0,5),e.addMany(r,2,3,2),e.add(127,2,0,2),e.add(93,1,4,8),e.addMany(s,8,5,8),e.add(127,8,5,8),e.addMany([156,27,24,26,7],8,6,0),e.addMany(i(28,32),8,0,8),e.addMany([88,94,95],1,0,7),e.addMany(s,7,0,7),e.addMany(r,7,0,7),e.add(156,7,0,0),e.add(127,7,0,7),e.add(91,1,11,3),e.addMany(i(64,127),3,7,0),e.addMany(i(48,60),3,8,4),e.addMany([60,61,62,63],3,9,4),e.addMany(i(48,60),4,8,4),e.addMany(i(64,127),4,7,0),e.addMany([60,61,62,63],4,0,6),e.addMany(i(32,64),6,0,6),e.add(127,6,0,6),e.addMany(i(64,127),6,0,0),e.addMany(i(32,48),3,9,5),e.addMany(i(32,48),5,9,5),e.addMany(i(48,64),5,0,6),e.addMany(i(64,127),5,7,0),e.addMany(i(32,48),4,9,5),e.addMany(i(32,48),1,9,2),e.addMany(i(32,48),2,9,2),e.addMany(i(48,127),2,10,0),e.addMany(i(48,80),1,10,0),e.addMany(i(81,88),1,10,0),e.addMany([89,90,92],1,10,0),e.addMany(i(96,127),1,10,0),e.add(80,1,11,9),e.addMany(r,9,0,9),e.add(127,9,0,9),e.addMany(i(28,32),9,0,9),e.addMany(i(32,48),9,9,12),e.addMany(i(48,60),9,8,10),e.addMany([60,61,62,63],9,9,10),e.addMany(r,11,0,11),e.addMany(i(32,128),11,0,11),e.addMany(i(28,32),11,0,11),e.addMany(r,10,0,10),e.add(127,10,0,10),e.addMany(i(28,32),10,0,10),e.addMany(i(48,60),10,8,10),e.addMany([60,61,62,63],10,0,11),e.addMany(i(32,48),10,9,12),e.addMany(r,12,0,12),e.add(127,12,0,12),e.addMany(i(28,32),12,0,12),e.addMany(i(32,48),12,9,12),e.addMany(i(48,64),12,0,11),e.addMany(i(64,127),12,12,13),e.addMany(i(64,127),10,12,13),e.addMany(i(64,127),9,12,13),e.addMany(r,13,13,13),e.addMany(s,13,13,13),e.add(127,13,0,13),e.addMany([27,156,24,26],13,14,0),e.add($t,0,2,0),e.add($t,8,5,8),e.add($t,6,0,6),e.add($t,11,0,11),e.add($t,13,13,13),e}(),_w=class extends se{constructor(e=fw){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 h0,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(t,i,s)=>{},this._executeHandlerFb=t=>{},this._csiHandlerFb=(t,i)=>{},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(Ee(()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)})),this._oscParser=this._register(new hw),this._dcsParser=this._register(new uw),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},()=>!0)}_identifier(e,t=[64,126]){let i=0;if(e.prefix){if(e.prefix.length>1)throw new Error("only one byte as prefix supported");if(i=e.prefix.charCodeAt(0),i&&60>i||i>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 r=0;r<e.intermediates.length;++r){let n=e.intermediates.charCodeAt(r);if(32>n||n>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");i<<=8,i|=n}}if(e.final.length!==1)throw new Error("final must be a single byte");let s=e.final.charCodeAt(0);if(t[0]>s||s>t[1])throw new Error(`final must be in range ${t[0]} .. ${t[1]}`);return i<<=8,i|=s,i}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 i=this._identifier(e,[48,126]);this._escHandlers[i]===void 0&&(this._escHandlers[i]=[]);let s=this._escHandlers[i];return s.push(t),{dispose:()=>{let r=s.indexOf(t);r!==-1&&s.splice(r,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 i=this._identifier(e);this._csiHandlers[i]===void 0&&(this._csiHandlers[i]=[]);let s=this._csiHandlers[i];return s.push(t),{dispose:()=>{let r=s.indexOf(t);r!==-1&&s.splice(r,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,i,s,r){this._parseStack.state=e,this._parseStack.handlers=t,this._parseStack.handlerPos=i,this._parseStack.transition=s,this._parseStack.chunkPos=r}parse(e,t,i){let s=0,r=0,n=0,l;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,n=this._parseStack.chunkPos+1;else{if(i===void 0||this._parseStack.state===1)throw this._parseStack.state=1,new Error("improper continuation due to previous async handler, giving up parsing");let a=this._parseStack.handlers,o=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(i===!1&&o>-1){for(;o>=0&&(l=a[o](this._params),l!==!0);o--)if(l instanceof Promise)return this._parseStack.handlerPos=o,l}this._parseStack.handlers=[];break;case 4:if(i===!1&&o>-1){for(;o>=0&&(l=a[o](),l!==!0);o--)if(l instanceof Promise)return this._parseStack.handlerPos=o,l}this._parseStack.handlers=[];break;case 6:if(s=e[this._parseStack.chunkPos],l=this._dcsParser.unhook(s!==24&&s!==26,i),l)return l;s===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(s=e[this._parseStack.chunkPos],l=this._oscParser.end(s!==24&&s!==26,i),l)return l;s===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break}this._parseStack.state=0,n=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=this._parseStack.transition&15}for(let a=n;a<t;++a){switch(s=e[a],r=this._transitions.table[this.currentState<<8|(s<160?s:$t)],r>>4){case 2:for(let u=a+1;;++u){if(u>=t||(s=e[u])<32||s>126&&s<$t){this._printHandler(e,a,u),a=u-1;break}if(++u>=t||(s=e[u])<32||s>126&&s<$t){this._printHandler(e,a,u),a=u-1;break}if(++u>=t||(s=e[u])<32||s>126&&s<$t){this._printHandler(e,a,u),a=u-1;break}if(++u>=t||(s=e[u])<32||s>126&&s<$t){this._printHandler(e,a,u),a=u-1;break}}break;case 3:this._executeHandlers[s]?this._executeHandlers[s]():this._executeHandlerFb(s),this.precedingJoinState=0;break;case 0:break;case 1:if(this._errorHandler({position:a,code:s,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:let o=this._csiHandlers[this._collect<<8|s],c=o?o.length-1:-1;for(;c>=0&&(l=o[c](this._params),l!==!0);c--)if(l instanceof Promise)return this._preserveStack(3,o,c,r,a),l;c<0&&this._csiHandlerFb(this._collect<<8|s,this._params),this.precedingJoinState=0;break;case 8:do switch(s){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(s-48)}while(++a<t&&(s=e[a])>47&&s<60);a--;break;case 9:this._collect<<=8,this._collect|=s;break;case 10:let _=this._escHandlers[this._collect<<8|s],f=_?_.length-1:-1;for(;f>=0&&(l=_[f](),l!==!0);f--)if(l instanceof Promise)return this._preserveStack(4,_,f,r,a),l;f<0&&this._escHandlerFb(this._collect<<8|s),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|s,this._params);break;case 13:for(let u=a+1;;++u)if(u>=t||(s=e[u])===24||s===26||s===27||s>127&&s<$t){this._dcsParser.put(e,a,u),a=u-1;break}break;case 14:if(l=this._dcsParser.unhook(s!==24&&s!==26),l)return this._preserveStack(6,[],0,r,a),l;s===27&&(r|=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 u=a+1;;u++)if(u>=t||(s=e[u])<32||s>127&&s<$t){this._oscParser.put(e,a,u),a=u-1;break}break;case 6:if(l=this._oscParser.end(s!==24&&s!==26),l)return this._preserveStack(5,[],0,r,a),l;s===27&&(r|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break}this.currentState=r&15}}},pw=/^([\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})$/,mw=/^[\da-f]+$/;function H_(e){if(!e)return;let t=e.toLowerCase();if(t.indexOf("rgb:")===0){t=t.slice(4);let i=pw.exec(t);if(i){let s=i[1]?15:i[4]?255:i[7]?4095:65535;return[Math.round(parseInt(i[1]||i[4]||i[7]||i[10],16)/s*255),Math.round(parseInt(i[2]||i[5]||i[8]||i[11],16)/s*255),Math.round(parseInt(i[3]||i[6]||i[9]||i[12],16)/s*255)]}}else if(t.indexOf("#")===0&&(t=t.slice(1),mw.exec(t)&&[3,6,9,12].includes(t.length))){let i=t.length/3,s=[0,0,0];for(let r=0;r<3;++r){let n=parseInt(t.slice(i*r,i*r+i),16);s[r]=i===1?n<<4:i===2?n:i===3?n>>4:n>>8}return s}}function yc(e,t){let i=e.toString(16),s=i.length<2?"0"+i:i;switch(t){case 4:return i[0];case 8:return s;case 12:return(s+s).slice(0,3);default:return s+s}}function gw(e,t=16){let[i,s,r]=e;return`rgb:${yc(i,t)}/${yc(s,t)}/${yc(r,t)}`}var vw={"(":0,")":1,"*":2,"+":3,"-":1,".":2},Qi=131072,U_=10;function q_(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 P_=5e3,K_=0,Sw=class extends se{constructor(e,t,i,s,r,n,l,a,o=new _w){super(),this._bufferService=e,this._charsetService=t,this._coreService=i,this._logService=s,this._optionsService=r,this._oscLinkService=n,this._coreMouseService=l,this._unicodeService=a,this._parser=o,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new Hb,this._utf8Decoder=new Ub,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=ze.clone(),this._eraseAttrDataInternal=ze.clone(),this._onRequestBell=this._register(new z),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this._register(new z),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this._register(new z),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this._register(new z),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this._register(new z),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this._register(new z),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this._register(new z),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this._register(new z),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this._register(new z),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this._register(new z),this.onLineFeed=this._onLineFeed.event,this._onScroll=this._register(new z),this.onScroll=this._onScroll.event,this._onTitleChange=this._register(new z),this.onTitleChange=this._onTitleChange.event,this._onColor=this._register(new z),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 eu(this._bufferService),this._activeBuffer=this._bufferService.buffer,this._register(this._bufferService.buffers.onBufferActivate(c=>this._activeBuffer=c.activeBuffer)),this._parser.setCsiHandlerFallback((c,_)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(c),params:_.toArray()})}),this._parser.setEscHandlerFallback(c=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(c)})}),this._parser.setExecuteHandlerFallback(c=>{this._logService.debug("Unknown EXECUTE code: ",{code:c})}),this._parser.setOscHandlerFallback((c,_,f)=>{this._logService.debug("Unknown OSC code: ",{identifier:c,action:_,data:f})}),this._parser.setDcsHandlerFallback((c,_,f)=>{_==="HOOK"&&(f=f.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(c),action:_,payload:f})}),this._parser.setPrintHandler((c,_,f)=>this.print(c,_,f)),this._parser.registerCsiHandler({final:"@"},c=>this.insertChars(c)),this._parser.registerCsiHandler({intermediates:" ",final:"@"},c=>this.scrollLeft(c)),this._parser.registerCsiHandler({final:"A"},c=>this.cursorUp(c)),this._parser.registerCsiHandler({intermediates:" ",final:"A"},c=>this.scrollRight(c)),this._parser.registerCsiHandler({final:"B"},c=>this.cursorDown(c)),this._parser.registerCsiHandler({final:"C"},c=>this.cursorForward(c)),this._parser.registerCsiHandler({final:"D"},c=>this.cursorBackward(c)),this._parser.registerCsiHandler({final:"E"},c=>this.cursorNextLine(c)),this._parser.registerCsiHandler({final:"F"},c=>this.cursorPrecedingLine(c)),this._parser.registerCsiHandler({final:"G"},c=>this.cursorCharAbsolute(c)),this._parser.registerCsiHandler({final:"H"},c=>this.cursorPosition(c)),this._parser.registerCsiHandler({final:"I"},c=>this.cursorForwardTab(c)),this._parser.registerCsiHandler({final:"J"},c=>this.eraseInDisplay(c,!1)),this._parser.registerCsiHandler({prefix:"?",final:"J"},c=>this.eraseInDisplay(c,!0)),this._parser.registerCsiHandler({final:"K"},c=>this.eraseInLine(c,!1)),this._parser.registerCsiHandler({prefix:"?",final:"K"},c=>this.eraseInLine(c,!0)),this._parser.registerCsiHandler({final:"L"},c=>this.insertLines(c)),this._parser.registerCsiHandler({final:"M"},c=>this.deleteLines(c)),this._parser.registerCsiHandler({final:"P"},c=>this.deleteChars(c)),this._parser.registerCsiHandler({final:"S"},c=>this.scrollUp(c)),this._parser.registerCsiHandler({final:"T"},c=>this.scrollDown(c)),this._parser.registerCsiHandler({final:"X"},c=>this.eraseChars(c)),this._parser.registerCsiHandler({final:"Z"},c=>this.cursorBackwardTab(c)),this._parser.registerCsiHandler({final:"`"},c=>this.charPosAbsolute(c)),this._parser.registerCsiHandler({final:"a"},c=>this.hPositionRelative(c)),this._parser.registerCsiHandler({final:"b"},c=>this.repeatPrecedingCharacter(c)),this._parser.registerCsiHandler({final:"c"},c=>this.sendDeviceAttributesPrimary(c)),this._parser.registerCsiHandler({prefix:">",final:"c"},c=>this.sendDeviceAttributesSecondary(c)),this._parser.registerCsiHandler({final:"d"},c=>this.linePosAbsolute(c)),this._parser.registerCsiHandler({final:"e"},c=>this.vPositionRelative(c)),this._parser.registerCsiHandler({final:"f"},c=>this.hVPosition(c)),this._parser.registerCsiHandler({final:"g"},c=>this.tabClear(c)),this._parser.registerCsiHandler({final:"h"},c=>this.setMode(c)),this._parser.registerCsiHandler({prefix:"?",final:"h"},c=>this.setModePrivate(c)),this._parser.registerCsiHandler({final:"l"},c=>this.resetMode(c)),this._parser.registerCsiHandler({prefix:"?",final:"l"},c=>this.resetModePrivate(c)),this._parser.registerCsiHandler({final:"m"},c=>this.charAttributes(c)),this._parser.registerCsiHandler({final:"n"},c=>this.deviceStatus(c)),this._parser.registerCsiHandler({prefix:"?",final:"n"},c=>this.deviceStatusPrivate(c)),this._parser.registerCsiHandler({intermediates:"!",final:"p"},c=>this.softReset(c)),this._parser.registerCsiHandler({intermediates:" ",final:"q"},c=>this.setCursorStyle(c)),this._parser.registerCsiHandler({final:"r"},c=>this.setScrollRegion(c)),this._parser.registerCsiHandler({final:"s"},c=>this.saveCursor(c)),this._parser.registerCsiHandler({final:"t"},c=>this.windowOptions(c)),this._parser.registerCsiHandler({final:"u"},c=>this.restoreCursor(c)),this._parser.registerCsiHandler({intermediates:"'",final:"}"},c=>this.insertColumns(c)),this._parser.registerCsiHandler({intermediates:"'",final:"~"},c=>this.deleteColumns(c)),this._parser.registerCsiHandler({intermediates:'"',final:"q"},c=>this.selectProtected(c)),this._parser.registerCsiHandler({intermediates:"$",final:"p"},c=>this.requestMode(c,!0)),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},c=>this.requestMode(c,!1)),this._parser.setExecuteHandler(B.BEL,()=>this.bell()),this._parser.setExecuteHandler(B.LF,()=>this.lineFeed()),this._parser.setExecuteHandler(B.VT,()=>this.lineFeed()),this._parser.setExecuteHandler(B.FF,()=>this.lineFeed()),this._parser.setExecuteHandler(B.CR,()=>this.carriageReturn()),this._parser.setExecuteHandler(B.BS,()=>this.backspace()),this._parser.setExecuteHandler(B.HT,()=>this.tab()),this._parser.setExecuteHandler(B.SO,()=>this.shiftOut()),this._parser.setExecuteHandler(B.SI,()=>this.shiftIn()),this._parser.setExecuteHandler(_a.IND,()=>this.index()),this._parser.setExecuteHandler(_a.NEL,()=>this.nextLine()),this._parser.setExecuteHandler(_a.HTS,()=>this.tabSet()),this._parser.registerOscHandler(0,new Nt(c=>(this.setTitle(c),this.setIconName(c),!0))),this._parser.registerOscHandler(1,new Nt(c=>this.setIconName(c))),this._parser.registerOscHandler(2,new Nt(c=>this.setTitle(c))),this._parser.registerOscHandler(4,new Nt(c=>this.setOrReportIndexedColor(c))),this._parser.registerOscHandler(8,new Nt(c=>this.setHyperlink(c))),this._parser.registerOscHandler(10,new Nt(c=>this.setOrReportFgColor(c))),this._parser.registerOscHandler(11,new Nt(c=>this.setOrReportBgColor(c))),this._parser.registerOscHandler(12,new Nt(c=>this.setOrReportCursorColor(c))),this._parser.registerOscHandler(104,new Nt(c=>this.restoreIndexedColor(c))),this._parser.registerOscHandler(110,new Nt(c=>this.restoreFgColor(c))),this._parser.registerOscHandler(111,new Nt(c=>this.restoreBgColor(c))),this._parser.registerOscHandler(112,new Nt(c=>this.restoreCursorColor(c))),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 c in Ge)this._parser.registerEscHandler({intermediates:"(",final:c},()=>this.selectCharset("("+c)),this._parser.registerEscHandler({intermediates:")",final:c},()=>this.selectCharset(")"+c)),this._parser.registerEscHandler({intermediates:"*",final:c},()=>this.selectCharset("*"+c)),this._parser.registerEscHandler({intermediates:"+",final:c},()=>this.selectCharset("+"+c)),this._parser.registerEscHandler({intermediates:"-",final:c},()=>this.selectCharset("-"+c)),this._parser.registerEscHandler({intermediates:".",final:c},()=>this.selectCharset("."+c)),this._parser.registerEscHandler({intermediates:"/",final:c},()=>this.selectCharset("/"+c));this._parser.registerEscHandler({intermediates:"#",final:"8"},()=>this.screenAlignmentPattern()),this._parser.setErrorHandler(c=>(this._logService.error("Parsing error: ",c),c)),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new j_((c,_)=>this.requestStatusString(c,_)))}getAttrData(){return this._curAttrData}_preserveStack(e,t,i,s){this._parseStack.paused=!0,this._parseStack.cursorStartX=e,this._parseStack.cursorStartY=t,this._parseStack.decodedLength=i,this._parseStack.position=s}_logSlowResolvingAsync(e){this._logService.logLevel<=3&&Promise.race([e,new Promise((t,i)=>setTimeout(()=>i("#SLOW_TIMEOUT"),P_))]).catch(t=>{if(t!=="#SLOW_TIMEOUT")throw t;console.warn(`async parser handler taking longer than ${P_} ms`)})}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(e,t){let i,s=this._activeBuffer.x,r=this._activeBuffer.y,n=0,l=this._parseStack.paused;if(l){if(i=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,t))return this._logSlowResolvingAsync(i),i;s=this._parseStack.cursorStartX,r=this._parseStack.cursorStartY,this._parseStack.paused=!1,e.length>Qi&&(n=this._parseStack.position+Qi)}if(this._logService.logLevel<=1&&this._logService.debug(`parsing data ${typeof e=="string"?` "${e}"`:` "${Array.prototype.map.call(e,c=>String.fromCharCode(c)).join("")}"`}`),this._logService.logLevel===0&&this._logService.trace("parsing data (codes)",typeof e=="string"?e.split("").map(c=>c.charCodeAt(0)):e),this._parseBuffer.length<e.length&&this._parseBuffer.length<Qi&&(this._parseBuffer=new Uint32Array(Math.min(e.length,Qi))),l||this._dirtyRowTracker.clearRange(),e.length>Qi)for(let c=n;c<e.length;c+=Qi){let _=c+Qi<e.length?c+Qi:e.length,f=typeof e=="string"?this._stringDecoder.decode(e.substring(c,_),this._parseBuffer):this._utf8Decoder.decode(e.subarray(c,_),this._parseBuffer);if(i=this._parser.parse(this._parseBuffer,f))return this._preserveStack(s,r,f,c),this._logSlowResolvingAsync(i),i}else if(!l){let c=typeof e=="string"?this._stringDecoder.decode(e,this._parseBuffer):this._utf8Decoder.decode(e,this._parseBuffer);if(i=this._parser.parse(this._parseBuffer,c))return this._preserveStack(s,r,c,0),this._logSlowResolvingAsync(i),i}(this._activeBuffer.x!==s||this._activeBuffer.y!==r)&&this._onCursorMove.fire();let a=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),o=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);o<this._bufferService.rows&&this._onRequestRefreshRows.fire({start:Math.min(o,this._bufferService.rows-1),end:Math.min(a,this._bufferService.rows-1)})}print(e,t,i){let s,r,n=this._charsetService.charset,l=this._optionsService.rawOptions.screenReaderMode,a=this._bufferService.cols,o=this._coreService.decPrivateModes.wraparound,c=this._coreService.modes.insertMode,_=this._curAttrData,f=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&i-t>0&&f.getWidth(this._activeBuffer.x-1)===2&&f.setCellFromCodepoint(this._activeBuffer.x-1,0,1,_);let u=this._parser.precedingJoinState;for(let d=t;d<i;++d){if(s=e[d],s<127&&n){let m=n[String.fromCharCode(s)];m&&(s=m.charCodeAt(0))}let g=this._unicodeService.charProperties(s,u);r=zs.extractWidth(g);let y=zs.extractShouldJoin(g),C=y?zs.extractWidth(u):0;if(u=g,l&&this._onA11yChar.fire(ts(s)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+r-C>a){if(o){let m=f,p=this._activeBuffer.x-C;for(this._activeBuffer.x=C,this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData(),!0)):(this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!0),f=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),C>0&&f instanceof En&&f.copyCellsFrom(m,p,0,C,!1);p<a;)m.setCellFromCodepoint(p++,0,1,_)}else if(this._activeBuffer.x=a-1,r===2)continue}if(y&&this._activeBuffer.x){let m=f.getWidth(this._activeBuffer.x-1)?1:2;f.addCodepointToCell(this._activeBuffer.x-m,s,r);for(let p=r-C;--p>=0;)f.setCellFromCodepoint(this._activeBuffer.x++,0,0,_);continue}if(c&&(f.insertCells(this._activeBuffer.x,r-C,this._activeBuffer.getNullCell(_)),f.getWidth(a-1)===2&&f.setCellFromCodepoint(a-1,0,1,_)),f.setCellFromCodepoint(this._activeBuffer.x++,s,r,_),r>0)for(;--r;)f.setCellFromCodepoint(this._activeBuffer.x++,0,0,_)}this._parser.precedingJoinState=u,this._activeBuffer.x<a&&i-t>0&&f.getWidth(this._activeBuffer.x)===0&&!f.hasContent(this._activeBuffer.x)&&f.setCellFromCodepoint(this._activeBuffer.x,0,1,_),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(e,t){return e.final==="t"&&!e.prefix&&!e.intermediates?this._parser.registerCsiHandler(e,i=>q_(i.params[0],this._optionsService.rawOptions.windowOptions)?t(i):!0):this._parser.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._parser.registerDcsHandler(e,new j_(t))}registerEscHandler(e,t){return this._parser.registerEscHandler(e,t)}registerOscHandler(e,t){return this._parser.registerOscHandler(e,new Nt(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(){var e;if(!this._coreService.decPrivateModes.reverseWraparound)return this._restrictCursor(),this._activeBuffer.x>0&&this._activeBuffer.x--,!0;if(this._restrictCursor(this._bufferService.cols),this._activeBuffer.x>0)this._activeBuffer.x--;else if(this._activeBuffer.x===0&&this._activeBuffer.y>this._activeBuffer.scrollTop&&this._activeBuffer.y<=this._activeBuffer.scrollBottom&&((e=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y))!=null&&e.isWrapped)){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);t.hasWidth(this._activeBuffer.x)&&!t.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,i,s=!1,r=!1){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);n.replaceCells(t,i,this._activeBuffer.getNullCell(this._eraseAttrData()),r),s&&(n.isWrapped=!1)}_resetBufferLine(e,t=!1){let i=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);i&&(i.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),t),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+e),i.isWrapped=!1)}eraseInDisplay(e,t=!1){var s;this._restrictCursor(this._bufferService.cols);let i;switch(e.params[0]){case 0:for(i=this._activeBuffer.y,this._dirtyRowTracker.markDirty(i),this._eraseInBufferLine(i++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,t);i<this._bufferService.rows;i++)this._resetBufferLine(i,t);this._dirtyRowTracker.markDirty(i);break;case 1:for(i=this._activeBuffer.y,this._dirtyRowTracker.markDirty(i),this._eraseInBufferLine(i,0,this._activeBuffer.x+1,!0,t),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(i+1).isWrapped=!1);i--;)this._resetBufferLine(i,t);this._dirtyRowTracker.markDirty(0);break;case 2:if(this._optionsService.rawOptions.scrollOnEraseInDisplay){for(i=this._bufferService.rows,this._dirtyRowTracker.markRangeDirty(0,i-1);i--&&!((s=this._activeBuffer.lines.get(this._activeBuffer.ybase+i))!=null&&s.getTrimmedLength()););for(;i>=0;i--)this._bufferService.scroll(this._eraseAttrData())}else{for(i=this._bufferService.rows,this._dirtyRowTracker.markDirty(i-1);i--;)this._resetBufferLine(i,t);this._dirtyRowTracker.markDirty(0)}break;case 3:let r=this._activeBuffer.lines.length-this._bufferService.rows;r>0&&(this._activeBuffer.lines.trimStart(r),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-r,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-r,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 i=this._activeBuffer.ybase+this._activeBuffer.y,s=this._bufferService.rows-1-this._activeBuffer.scrollBottom,r=this._bufferService.rows-1+this._activeBuffer.ybase-s+1;for(;t--;)this._activeBuffer.lines.splice(r-1,1),this._activeBuffer.lines.splice(i,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}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 i=this._activeBuffer.ybase+this._activeBuffer.y,s;for(s=this._bufferService.rows-1-this._activeBuffer.scrollBottom,s=this._bufferService.rows-1+this._activeBuffer.ybase-s;t--;)this._activeBuffer.lines.splice(i,1),this._activeBuffer.lines.splice(s,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(ze));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 i=this._activeBuffer.scrollTop;i<=this._activeBuffer.scrollBottom;++i){let s=this._activeBuffer.lines.get(this._activeBuffer.ybase+i);s.deleteCells(0,t,this._activeBuffer.getNullCell(this._eraseAttrData())),s.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 i=this._activeBuffer.scrollTop;i<=this._activeBuffer.scrollBottom;++i){let s=this._activeBuffer.lines.get(this._activeBuffer.ybase+i);s.insertCells(0,t,this._activeBuffer.getNullCell(this._eraseAttrData())),s.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 i=this._activeBuffer.scrollTop;i<=this._activeBuffer.scrollBottom;++i){let s=this._activeBuffer.lines.get(this._activeBuffer.ybase+i);s.insertCells(this._activeBuffer.x,t,this._activeBuffer.getNullCell(this._eraseAttrData())),s.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 i=this._activeBuffer.scrollTop;i<=this._activeBuffer.scrollBottom;++i){let s=this._activeBuffer.lines.get(this._activeBuffer.ybase+i);s.deleteCells(this._activeBuffer.x,t,this._activeBuffer.getNullCell(this._eraseAttrData())),s.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 i=e.params[0]||1,s=zs.extractWidth(t),r=this._activeBuffer.x-s,n=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(r),l=new Uint32Array(n.length*i),a=0;for(let c=0;c<n.length;){let _=n.codePointAt(c)||0;l[a++]=_,c+=_>65535?2:1}let o=a;for(let c=1;c<i;++c)l.copyWithin(o,0,a),o+=a;return this.print(l,0,o),!0}sendDeviceAttributesPrimary(e){return e.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(B.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(B.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(e){return e.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(B.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(B.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(e.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(B.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,Ls),this._charsetService.setgCharset(1,Ls),this._charsetService.setgCharset(2,Ls),this._charsetService.setgCharset(3,Ls);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){(y=>(y[y.NOT_RECOGNIZED=0]="NOT_RECOGNIZED",y[y.SET=1]="SET",y[y.RESET=2]="RESET",y[y.PERMANENTLY_SET=3]="PERMANENTLY_SET",y[y.PERMANENTLY_RESET=4]="PERMANENTLY_RESET"))(void 0||(i={}));let s=this._coreService.decPrivateModes,{activeProtocol:r,activeEncoding:n}=this._coreMouseService,l=this._coreService,{buffers:a,cols:o}=this._bufferService,{active:c,alt:_}=a,f=this._optionsService.rawOptions,u=(y,C)=>(l.triggerDataEvent(`${B.ESC}[${t?"":"?"}${y};${C}$y`),!0),d=y=>y?1:2,g=e.params[0];return t?g===2?u(g,4):g===4?u(g,d(l.modes.insertMode)):g===12?u(g,3):g===20?u(g,d(f.convertEol)):u(g,0):g===1?u(g,d(s.applicationCursorKeys)):g===3?u(g,f.windowOptions.setWinLines?o===80?2:o===132?1:0:0):g===6?u(g,d(s.origin)):g===7?u(g,d(s.wraparound)):g===8?u(g,3):g===9?u(g,d(r==="X10")):g===12?u(g,d(f.cursorBlink)):g===25?u(g,d(!l.isCursorHidden)):g===45?u(g,d(s.reverseWraparound)):g===66?u(g,d(s.applicationKeypad)):g===67?u(g,4):g===1e3?u(g,d(r==="VT200")):g===1002?u(g,d(r==="DRAG")):g===1003?u(g,d(r==="ANY")):g===1004?u(g,d(s.sendFocus)):g===1005?u(g,4):g===1006?u(g,d(n==="SGR")):g===1015?u(g,4):g===1016?u(g,d(n==="SGR_PIXELS")):g===1048?u(g,1):g===47||g===1047||g===1049?u(g,d(c===_)):g===2004?u(g,d(s.bracketedPasteMode)):g===2026?u(g,d(s.synchronizedOutput)):u(g,0)}_updateAttrColor(e,t,i,s,r){return t===2?(e|=50331648,e&=-16777216,e|=yl.fromColorRGB([i,s,r])):t===5&&(e&=-50331904,e|=33554432|i&255),e}_extractColor(e,t,i){let s=[0,0,-1,0,0,0],r=0,n=0;do{if(s[n+r]=e.params[t+n],e.hasSubParams(t+n)){let l=e.getSubParams(t+n),a=0;do s[1]===5&&(r=1),s[n+a+1+r]=l[a];while(++a<l.length&&a+n+1+r<s.length);break}if(s[1]===5&&n+r>=2||s[1]===2&&n+r>=5)break;s[1]&&(r=1)}while(++n+t<e.length&&n+r<s.length);for(let l=2;l<s.length;++l)s[l]===-1&&(s[l]=0);switch(s[0]){case 38:i.fg=this._updateAttrColor(i.fg,s[1],s[3],s[4],s[5]);break;case 48:i.bg=this._updateAttrColor(i.bg,s[1],s[3],s[4],s[5]);break;case 58:i.extended=i.extended.clone(),i.extended.underlineColor=this._updateAttrColor(i.extended.underlineColor,s[1],s[3],s[4],s[5])}return n}_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=ze.fg,e.bg=ze.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,i,s=this._curAttrData;for(let r=0;r<t;r++)i=e.params[r],i>=30&&i<=37?(s.fg&=-50331904,s.fg|=16777216|i-30):i>=40&&i<=47?(s.bg&=-50331904,s.bg|=16777216|i-40):i>=90&&i<=97?(s.fg&=-50331904,s.fg|=16777216|i-90|8):i>=100&&i<=107?(s.bg&=-50331904,s.bg|=16777216|i-100|8):i===0?this._processSGR0(s):i===1?s.fg|=134217728:i===3?s.bg|=67108864:i===4?(s.fg|=268435456,this._processUnderline(e.hasSubParams(r)?e.getSubParams(r)[0]:1,s)):i===5?s.fg|=536870912:i===7?s.fg|=67108864:i===8?s.fg|=1073741824:i===9?s.fg|=2147483648:i===2?s.bg|=134217728:i===21?this._processUnderline(2,s):i===22?(s.fg&=-134217729,s.bg&=-134217729):i===23?s.bg&=-67108865:i===24?(s.fg&=-268435457,this._processUnderline(0,s)):i===25?s.fg&=-536870913:i===27?s.fg&=-67108865:i===28?s.fg&=-1073741825:i===29?s.fg&=2147483647:i===39?(s.fg&=-67108864,s.fg|=ze.fg&16777215):i===49?(s.bg&=-67108864,s.bg|=ze.bg&16777215):i===38||i===48||i===58?r+=this._extractColor(e,r,s):i===53?s.bg|=1073741824:i===55?s.bg&=-1073741825:i===59?(s.extended=s.extended.clone(),s.extended.underlineColor=-1,s.updateExtended()):i===100?(s.fg&=-67108864,s.fg|=ze.fg&16777215,s.bg&=-67108864,s.bg|=ze.bg&16777215):this._logService.debug("Unknown SGR attribute: %d.",i);return!0}deviceStatus(e){switch(e.params[0]){case 5:this._coreService.triggerDataEvent(`${B.ESC}[0n`);break;case 6:let t=this._activeBuffer.y+1,i=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${B.ESC}[${t};${i}R`);break}return!0}deviceStatusPrivate(e){switch(e.params[0]){case 6:let t=this._activeBuffer.y+1,i=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${B.ESC}[?${t};${i}R`);break}return!0}softReset(e){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=ze.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 i=t%2===1;this._coreService.decPrivateModes.cursorBlink=i}return!0}setScrollRegion(e){let t=e.params[0]||1,i;return(e.length<2||(i=e.params[1])>this._bufferService.rows||i===0)&&(i=this._bufferService.rows),i>t&&(this._activeBuffer.scrollTop=t-1,this._activeBuffer.scrollBottom=i-1,this._setCursor(0,0)),!0}windowOptions(e){if(!q_(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(`${B.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:(t===0||t===2)&&(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>U_&&this._windowTitleStack.shift()),(t===0||t===1)&&(this._iconNameStack.push(this._iconName),this._iconNameStack.length>U_&&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=[],i=e.split(";");for(;i.length>1;){let s=i.shift(),r=i.shift();if(/^\d+$/.exec(s)){let n=parseInt(s);if(W_(n))if(r==="?")t.push({type:0,index:n});else{let l=H_(r);l&&t.push({type:1,index:n,color:l})}}}return t.length&&this._onColor.fire(t),!0}setHyperlink(e){let t=e.indexOf(";");if(t===-1)return!0;let i=e.slice(0,t).trim(),s=e.slice(t+1);return s?this._createHyperlink(i,s):i.trim()?!1:this._finishHyperlink()}_createHyperlink(e,t){this._getCurrentLinkId()&&this._finishHyperlink();let i=e.split(":"),s,r=i.findIndex(n=>n.startsWith("id="));return r!==-1&&(s=i[r].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:s,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 i=e.split(";");for(let s=0;s<i.length&&!(t>=this._specialColors.length);++s,++t)if(i[s]==="?")this._onColor.fire([{type:0,index:this._specialColors[t]}]);else{let r=H_(i[s]);r&&this._onColor.fire([{type:1,index:this._specialColors[t],color:r}])}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=[],i=e.split(";");for(let s=0;s<i.length;++s)if(/^\d+$/.exec(i[s])){let r=parseInt(i[s]);W_(r)&&t.push({type:2,index:r})}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,Ls),!0}selectCharset(e){return e.length!==2?(this.selectDefaultCharset(),!0):(e[0]==="/"||this._charsetService.setgCharset(vw[e[0]],Ge[e[1]]||Ls),!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=ze.clone(),this._eraseAttrDataInternal=ze.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 ri;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 i=this._activeBuffer.ybase+this._activeBuffer.y+t,s=this._activeBuffer.lines.get(i);s&&(s.fill(e),s.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(e,t){let i=l=>(this._coreService.triggerDataEvent(`${B.ESC}${l}${B.ESC}\\`),!0),s=this._bufferService.buffer,r=this._optionsService.rawOptions;return i(e==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:e==='"p'?'P1$r61;1"p':e==="r"?`P1$r${s.scrollTop+1};${s.scrollBottom+1}r`:e==="m"?"P1$r0m":e===" q"?`P1$r${{block:2,underline:4,bar:6}[r.cursorStyle]-(r.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(e,t){this._dirtyRowTracker.markRangeDirty(e,t)}},eu=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&&(K_=e,e=t,t=K_),e<this.start&&(this.start=e),t>this.end&&(this.end=t)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};eu=Ae([H(0,yt)],eu);function W_(e){return 0<=e&&e<256}var yw=5e7,Y_=12,bw=50,Cw=class extends se{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 z),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 i;for(;i=this._writeBuffer.shift();){this._action(i);let s=this._callbacks.shift();s&&s()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(e,t){if(this._pendingData>yw)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 i=e||performance.now();for(;this._writeBuffer.length>this._bufferOffset;){let s=this._writeBuffer[this._bufferOffset],r=this._action(s,t);if(r){let l=a=>performance.now()-i>=Y_?setTimeout(()=>this._innerWrite(0,a)):this._innerWrite(i,a);r.catch(a=>(queueMicrotask(()=>{throw a}),Promise.resolve(!1))).then(l);return}let n=this._callbacks[this._bufferOffset];if(n&&n(),this._bufferOffset++,this._pendingData-=s.length,performance.now()-i>=Y_)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>bw&&(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()}},tu=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 a=t.addMarker(t.ybase+t.y),o={data:e,id:this._nextId++,lines:[a]};return a.onDispose(()=>this._removeMarkerFromLink(o,a)),this._dataByLinkId.set(o.id,o),o.id}let i=e,s=this._getEntryIdKey(i),r=this._entriesWithId.get(s);if(r)return this.addLineToLink(r.id,t.ybase+t.y),r.id;let n=t.addMarker(t.ybase+t.y),l={id:this._nextId++,key:this._getEntryIdKey(i),data:i,lines:[n]};return n.onDispose(()=>this._removeMarkerFromLink(l,n)),this._entriesWithId.set(l.key,l),this._dataByLinkId.set(l.id,l),l.id}addLineToLink(e,t){let i=this._dataByLinkId.get(e);if(i&&i.lines.every(s=>s.line!==t)){let s=this._bufferService.buffer.addMarker(t);i.lines.push(s),s.onDispose(()=>this._removeMarkerFromLink(i,s))}}getLinkData(e){var t;return(t=this._dataByLinkId.get(e))==null?void 0:t.data}_getEntryIdKey(e){return`${e.id};;${e.uri}`}_removeMarkerFromLink(e,t){let i=e.lines.indexOf(t);i!==-1&&(e.lines.splice(i,1),e.lines.length===0&&(e.data.id!==void 0&&this._entriesWithId.delete(e.key),this._dataByLinkId.delete(e.id)))}};tu=Ae([H(0,yt)],tu);var V_=!1,ww=class extends se{constructor(e){super(),this._windowsWrappingHeuristics=this._register(new Yr),this._onBinary=this._register(new z),this.onBinary=this._onBinary.event,this._onData=this._register(new z),this.onData=this._onData.event,this._onLineFeed=this._register(new z),this.onLineFeed=this._onLineFeed.event,this._onResize=this._register(new z),this.onResize=this._onResize.event,this._onWriteParsed=this._register(new z),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this._register(new z),this._instantiationService=new XC,this.optionsService=this._register(new sw(e)),this._instantiationService.setService(bt,this.optionsService),this._bufferService=this._register(this._instantiationService.createInstance(Fh)),this._instantiationService.setService(yt,this._bufferService),this._logService=this._register(this._instantiationService.createInstance($h)),this._instantiationService.setService(Mv,this._logService),this.coreService=this._register(this._instantiationService.createInstance(Zh)),this._instantiationService.setService(tr,this.coreService),this.coreMouseService=this._register(this._instantiationService.createInstance(Qh)),this._instantiationService.setService(Dv,this.coreMouseService),this.unicodeService=this._register(this._instantiationService.createInstance(zs)),this._instantiationService.setService(Wb,this.unicodeService),this._charsetService=this._instantiationService.createInstance(ow),this._instantiationService.setService(Kb,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(tu),this._instantiationService.setService(Bv,this._oscLinkService),this._inputHandler=this._register(new Sw(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this._register(ht.forward(this._inputHandler.onLineFeed,this._onLineFeed)),this._register(this._inputHandler),this._register(ht.forward(this._bufferService.onResize,this._onResize)),this._register(ht.forward(this.coreService.onData,this._onData)),this._register(ht.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 Cw((t,i)=>this._inputHandler.parse(t,i))),this._register(ht.forward(this._writeBuffer.onWriteParsed,this._onWriteParsed))}get onScroll(){return this._onScrollApi||(this._onScrollApi=this._register(new z),this._onScroll.event(e=>{var t;(t=this._onScrollApi)==null||t.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&&!V_&&(this._logService.warn("writeSync is unreliable and will be removed soon."),V_=!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,o0),t=Math.max(t,c0),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(z_.bind(null,this._bufferService))),e.push(this.registerCsiHandler({final:"H"},()=>(z_(this._bufferService),!1))),this._windowsWrappingHeuristics.value=Ee(()=>{for(let t of e)t.dispose()})}}},xw={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 Ew(e,t,i,s){var l;let r={type:0,cancel:!1,key:void 0},n=(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?r.key=B.ESC+"OA":r.key=B.ESC+"[A":e.key==="UIKeyInputLeftArrow"?t?r.key=B.ESC+"OD":r.key=B.ESC+"[D":e.key==="UIKeyInputRightArrow"?t?r.key=B.ESC+"OC":r.key=B.ESC+"[C":e.key==="UIKeyInputDownArrow"&&(t?r.key=B.ESC+"OB":r.key=B.ESC+"[B");break;case 8:r.key=e.ctrlKey?"\b":B.DEL,e.altKey&&(r.key=B.ESC+r.key);break;case 9:if(e.shiftKey){r.key=B.ESC+"[Z";break}r.key=B.HT,r.cancel=!0;break;case 13:r.key=e.altKey?B.ESC+B.CR:B.CR,r.cancel=!0;break;case 27:r.key=B.ESC,e.altKey&&(r.key=B.ESC+B.ESC),r.cancel=!0;break;case 37:if(e.metaKey)break;n?r.key=B.ESC+"[1;"+(n+1)+"D":t?r.key=B.ESC+"OD":r.key=B.ESC+"[D";break;case 39:if(e.metaKey)break;n?r.key=B.ESC+"[1;"+(n+1)+"C":t?r.key=B.ESC+"OC":r.key=B.ESC+"[C";break;case 38:if(e.metaKey)break;n?r.key=B.ESC+"[1;"+(n+1)+"A":t?r.key=B.ESC+"OA":r.key=B.ESC+"[A";break;case 40:if(e.metaKey)break;n?r.key=B.ESC+"[1;"+(n+1)+"B":t?r.key=B.ESC+"OB":r.key=B.ESC+"[B";break;case 45:!e.shiftKey&&!e.ctrlKey&&(r.key=B.ESC+"[2~");break;case 46:n?r.key=B.ESC+"[3;"+(n+1)+"~":r.key=B.ESC+"[3~";break;case 36:n?r.key=B.ESC+"[1;"+(n+1)+"H":t?r.key=B.ESC+"OH":r.key=B.ESC+"[H";break;case 35:n?r.key=B.ESC+"[1;"+(n+1)+"F":t?r.key=B.ESC+"OF":r.key=B.ESC+"[F";break;case 33:e.shiftKey?r.type=2:e.ctrlKey?r.key=B.ESC+"[5;"+(n+1)+"~":r.key=B.ESC+"[5~";break;case 34:e.shiftKey?r.type=3:e.ctrlKey?r.key=B.ESC+"[6;"+(n+1)+"~":r.key=B.ESC+"[6~";break;case 112:n?r.key=B.ESC+"[1;"+(n+1)+"P":r.key=B.ESC+"OP";break;case 113:n?r.key=B.ESC+"[1;"+(n+1)+"Q":r.key=B.ESC+"OQ";break;case 114:n?r.key=B.ESC+"[1;"+(n+1)+"R":r.key=B.ESC+"OR";break;case 115:n?r.key=B.ESC+"[1;"+(n+1)+"S":r.key=B.ESC+"OS";break;case 116:n?r.key=B.ESC+"[15;"+(n+1)+"~":r.key=B.ESC+"[15~";break;case 117:n?r.key=B.ESC+"[17;"+(n+1)+"~":r.key=B.ESC+"[17~";break;case 118:n?r.key=B.ESC+"[18;"+(n+1)+"~":r.key=B.ESC+"[18~";break;case 119:n?r.key=B.ESC+"[19;"+(n+1)+"~":r.key=B.ESC+"[19~";break;case 120:n?r.key=B.ESC+"[20;"+(n+1)+"~":r.key=B.ESC+"[20~";break;case 121:n?r.key=B.ESC+"[21;"+(n+1)+"~":r.key=B.ESC+"[21~";break;case 122:n?r.key=B.ESC+"[23;"+(n+1)+"~":r.key=B.ESC+"[23~";break;case 123:n?r.key=B.ESC+"[24;"+(n+1)+"~":r.key=B.ESC+"[24~";break;default:if(e.ctrlKey&&!e.shiftKey&&!e.altKey&&!e.metaKey)e.keyCode>=65&&e.keyCode<=90?r.key=String.fromCharCode(e.keyCode-64):e.keyCode===32?r.key=B.NUL:e.keyCode>=51&&e.keyCode<=55?r.key=String.fromCharCode(e.keyCode-51+27):e.keyCode===56?r.key=B.DEL:e.keyCode===219?r.key=B.ESC:e.keyCode===220?r.key=B.FS:e.keyCode===221&&(r.key=B.GS);else if((!i||s)&&e.altKey&&!e.metaKey){let a=(l=xw[e.keyCode])==null?void 0:l[e.shiftKey?1:0];if(a)r.key=B.ESC+a;else if(e.keyCode>=65&&e.keyCode<=90){let o=e.ctrlKey?e.keyCode-64:e.keyCode+32,c=String.fromCharCode(o);e.shiftKey&&(c=c.toUpperCase()),r.key=B.ESC+c}else if(e.keyCode===32)r.key=B.ESC+(e.ctrlKey?B.NUL:" ");else if(e.key==="Dead"&&e.code.startsWith("Key")){let o=e.code.slice(3,4);e.shiftKey||(o=o.toLowerCase()),r.key=B.ESC+o,r.cancel=!0}}else i&&!e.altKey&&!e.ctrlKey&&!e.shiftKey&&e.metaKey?e.keyCode===65&&(r.type=1):e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.keyCode>=48&&e.key.length===1?r.key=e.key:e.key&&e.ctrlKey&&(e.key==="_"&&(r.key=B.US),e.key==="@"&&(r.key=B.NUL));break}return r}var Ne=0,kw=class{constructor(e){this._getKey=e,this._array=[],this._insertedValues=[],this._flushInsertedTask=new Za,this._isFlushingInserted=!1,this._deletedIndices=[],this._flushDeletedTask=new Za,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((r,n)=>this._getKey(r)-this._getKey(n)),t=0,i=0,s=new Array(this._array.length+this._insertedValues.length);for(let r=0;r<s.length;r++)i>=this._array.length||this._getKey(e[t])<=this._getKey(this._array[i])?(s[r]=e[t],t++):s[r]=this._array[i++];this._array=s,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||(Ne=this._search(t),Ne===-1)||this._getKey(this._array[Ne])!==t)return!1;do if(this._array[Ne]===e)return this._deletedIndices.length===0&&this._flushDeletedTask.enqueue(()=>this._flushDeleted()),this._deletedIndices.push(Ne),!0;while(++Ne<this._array.length&&this._getKey(this._array[Ne])===t);return!1}_flushDeleted(){this._isFlushingDeleted=!0;let e=this._deletedIndices.sort((r,n)=>r-n),t=0,i=new Array(this._array.length-e.length),s=0;for(let r=0;r<this._array.length;r++)e[t]===r?t++:i[s++]=this._array[r];this._array=i,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&&(Ne=this._search(e),!(Ne<0||Ne>=this._array.length)&&this._getKey(this._array[Ne])===e))do yield this._array[Ne];while(++Ne<this._array.length&&this._getKey(this._array[Ne])===e)}forEachByKey(e,t){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(Ne=this._search(e),!(Ne<0||Ne>=this._array.length)&&this._getKey(this._array[Ne])===e))do t(this._array[Ne]);while(++Ne<this._array.length&&this._getKey(this._array[Ne])===e)}values(){return this._flushCleanupInserted(),this._flushCleanupDeleted(),[...this._array].values()}_search(e){let t=0,i=this._array.length-1;for(;i>=t;){let s=t+i>>1,r=this._getKey(this._array[s]);if(r>e)i=s-1;else if(r<e)t=s+1;else{for(;s>0&&this._getKey(this._array[s-1])===e;)s--;return s}}return t}},bc=0,I_=0,Tw=class extends se{constructor(){super(),this._decorations=new kw(e=>e==null?void 0:e.marker.line),this._onDecorationRegistered=this._register(new z),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this._register(new z),this.onDecorationRemoved=this._onDecorationRemoved.event,this._register(Ee(()=>this.reset()))}get decorations(){return this._decorations.values()}registerDecoration(e){if(e.marker.isDisposed)return;let t=new Dw(e);if(t){let i=t.marker.onDispose(()=>t.dispose()),s=t.onDispose(()=>{s.dispose(),t&&(this._decorations.delete(t)&&this._onDecorationRemoved.fire(t),i.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,i){let s=0,r=0;for(let n of this._decorations.getKeyIterator(t))s=n.options.x??0,r=s+(n.options.width??1),e>=s&&e<r&&(!i||(n.options.layer??"bottom")===i)&&(yield n)}forEachDecorationAtCell(e,t,i,s){this._decorations.forEachByKey(t,r=>{bc=r.options.x??0,I_=bc+(r.options.width??1),e>=bc&&e<I_&&(!i||(r.options.layer??"bottom")===i)&&s(r)})}},Dw=class extends bs{constructor(e){super(),this.options=e,this.onRenderEmitter=this.add(new z),this.onRender=this.onRenderEmitter.event,this._onDispose=this.add(new z),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=Te.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this.options.foregroundColor?this._cachedFg=Te.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}dispose(){this._onDispose.fire(),super.dispose()}},Mw=1e3,Bw=class{constructor(e,t=Mw){this._renderCallback=e,this._debounceThresholdMS=t,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(e,t,i){this._rowCount=i,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 s=performance.now();if(s-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=s,this._innerRefresh();else if(!this._additionalRefreshRequested){let r=s-this._lastRefreshMs,n=this._debounceThresholdMS-r;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout(()=>{this._lastRefreshMs=performance.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0},n)}}_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)}},X_=20,Qa=class extends se{constructor(e,t,i,s){super(),this._terminal=e,this._coreBrowserService=i,this._renderService=s,this._rowColumns=new WeakMap,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce="";let r=this._coreBrowserService.mainDocument;this._accessibilityContainer=r.createElement("div"),this._accessibilityContainer.classList.add("xterm-accessibility"),this._rowContainer=r.createElement("div"),this._rowContainer.setAttribute("role","list"),this._rowContainer.classList.add("xterm-accessibility-tree"),this._rowElements=[];for(let n=0;n<this._terminal.rows;n++)this._rowElements[n]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[n]);if(this._topBoundaryFocusListener=n=>this._handleBoundaryFocus(n,0),this._bottomBoundaryFocusListener=n=>this._handleBoundaryFocus(n,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=r.createElement("div"),this._liveRegion.classList.add("live-region"),this._liveRegion.setAttribute("aria-live","assertive"),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this._register(new Bw(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(n=>this._handleResize(n.rows))),this._register(this._terminal.onRender(n=>this._refreshRows(n.start,n.end))),this._register(this._terminal.onScroll(()=>this._refreshRows())),this._register(this._terminal.onA11yChar(n=>this._handleChar(n))),this._register(this._terminal.onLineFeed(()=>this._handleChar(`
|
|
118
|
-
`))),this._register(this._terminal.onA11yTab(n=>this._handleTab(n))),this._register(this._terminal.onKey(n=>this._handleKey(n.key))),this._register(this._terminal.onBlur(()=>this._clearLiveRegion())),this._register(this._renderService.onDimensionsChange(()=>this._refreshRowsDimensions())),this._register(
|
|
119
|
-
`&&(this._liveRegionLineCount++,this._liveRegionLineCount===X_+1&&(this._liveRegion.textContent+=bh.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 i=this._terminal.buffer,s=i.lines.length.toString();for(let r=e;r<=t;r++){let n=i.lines.get(i.ydisp+r),l=[],a=(n==null?void 0:n.translateToString(!0,void 0,void 0,l))||"",o=(i.ydisp+r+1).toString(),c=this._rowElements[r];c&&(a.length===0?(c.textContent=" ",this._rowColumns.set(c,[0,1])):(c.textContent=a,this._rowColumns.set(c,l)),c.setAttribute("aria-posinset",o),c.setAttribute("aria-setsize",s),this._alignRowWidth(c))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(e,t){let i=e.target,s=this._rowElements[t===0?1:this._rowElements.length-2],r=i.getAttribute("aria-posinset"),n=t===0?"1":`${this._terminal.buffer.lines.length}`;if(r===n||e.relatedTarget!==s)return;let l,a;if(t===0?(l=i,a=this._rowElements.pop(),this._rowContainer.removeChild(a)):(l=this._rowElements.shift(),a=i,this._rowContainer.removeChild(l)),l.removeEventListener("focus",this._topBoundaryFocusListener),a.removeEventListener("focus",this._bottomBoundaryFocusListener),t===0){let o=this._createAccessibilityTreeNode();this._rowElements.unshift(o),this._rowContainer.insertAdjacentElement("afterbegin",o)}else{let o=this._createAccessibilityTreeNode();this._rowElements.push(o),this._rowContainer.appendChild(o)}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(){var a;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},i={node:e.focusNode,offset:e.focusOffset};if((t.node.compareDocumentPosition(i.node)&Node.DOCUMENT_POSITION_PRECEDING||t.node===i.node&&t.offset>i.offset)&&([t,i]=[i,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 s=this._rowElements.slice(-1)[0];if(i.node.compareDocumentPosition(s)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(i={node:s,offset:((a=s.textContent)==null?void 0:a.length)??0}),!this._rowContainer.contains(i.node))return;let r=({node:o,offset:c})=>{let _=o instanceof Text?o.parentNode:o,f=parseInt(_==null?void 0:_.getAttribute("aria-posinset"),10)-1;if(isNaN(f))return console.warn("row is invalid. Race condition?"),null;let u=this._rowColumns.get(_);if(!u)return console.warn("columns is null. Race condition?"),null;let d=c<u.length?u[c]:u.slice(-1)[0]+1;return d>=this._terminal.cols&&(++f,d=0),{row:f,column:d}},n=r(t),l=r(i);if(!(!n||!l)){if(n.row>l.row||n.row===l.row&&n.column>=l.column)throw new Error("invalid range");this._terminal.select(n.column,n.row,(l.row-n.row)*this._terminal.cols-n.column+l.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){var r,n;e.style.transform="";let t=e.getBoundingClientRect().width,i=(n=(r=this._rowColumns.get(e))==null?void 0:r.slice(-1))==null?void 0:n[0];if(!i)return;let s=i*this._renderService.dimensions.css.cell.width;e.style.transform=`scaleX(${s/t})`}};Qa=Ae([H(1,hd),H(2,Xi),H(3,Gi)],Qa);var iu=class extends se{constructor(e,t,i,s,r){super(),this._element=e,this._mouseService=t,this._renderService=i,this._bufferService=s,this._linkProviderService=r,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this._register(new z),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this._register(new z),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this._register(Ee(()=>{var n;Gs(this._linkCacheDisposables),this._linkCacheDisposables.length=0,this._lastMouseEvent=void 0,(n=this._activeProviderReplies)==null||n.clear()})),this._register(this._bufferService.onResize(()=>{this._clearCurrentLink(),this._wasResized=!0})),this._register(G(this._element,"mouseleave",()=>{this._isMouseOut=!0,this._clearCurrentLink()})),this._register(G(this._element,"mousemove",this._handleMouseMove.bind(this))),this._register(G(this._element,"mousedown",this._handleMouseDown.bind(this))),this._register(G(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 i=e.composedPath();for(let s=0;s<i.length;s++){let r=i[s];if(r.classList.contains("xterm"))break;if(r.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){var s,r;(!this._activeProviderReplies||!t)&&((s=this._activeProviderReplies)==null||s.forEach(n=>{n==null||n.forEach(l=>{l.link.dispose&&l.link.dispose()})}),this._activeProviderReplies=new Map,this._activeLine=e.y);let i=!1;for(let[n,l]of this._linkProviderService.linkProviders.entries())t?(r=this._activeProviderReplies)!=null&&r.get(n)&&(i=this._checkLinkProviderResult(n,e,i)):l.provideLinks(e.y,a=>{var c,_;if(this._isMouseOut)return;let o=a==null?void 0:a.map(f=>({link:f}));(c=this._activeProviderReplies)==null||c.set(n,o),i=this._checkLinkProviderResult(n,e,i),((_=this._activeProviderReplies)==null?void 0:_.size)===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(e.y,this._activeProviderReplies)})}_removeIntersectingLinks(e,t){let i=new Set;for(let s=0;s<t.size;s++){let r=t.get(s);if(r)for(let n=0;n<r.length;n++){let l=r[n],a=l.link.range.start.y<e?0:l.link.range.start.x,o=l.link.range.end.y>e?this._bufferService.cols:l.link.range.end.x;for(let c=a;c<=o;c++){if(i.has(c)){r.splice(n--,1);break}i.add(c)}}}}_checkLinkProviderResult(e,t,i){var n;if(!this._activeProviderReplies)return i;let s=this._activeProviderReplies.get(e),r=!1;for(let l=0;l<e;l++)(!this._activeProviderReplies.has(l)||this._activeProviderReplies.get(l))&&(r=!0);if(!r&&s){let l=s.find(a=>this._linkAtPosition(a.link,t));l&&(i=!0,this._handleNewLink(l))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!i)for(let l=0;l<this._activeProviderReplies.size;l++){let a=(n=this._activeProviderReplies.get(l))==null?void 0:n.find(o=>this._linkAtPosition(o.link,t));if(a){i=!0,this._handleNewLink(a);break}}return i}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(e){if(!this._currentLink)return;let t=this._positionFromMouseEvent(e,this._element,this._mouseService);t&&this._mouseDownLink&&Rw(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,Gs(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:()=>{var i,s;return(s=(i=this._currentLink)==null?void 0:i.state)==null?void 0:s.decorations.pointerCursor},set:i=>{var s;(s=this._currentLink)!=null&&s.state&&this._currentLink.state.decorations.pointerCursor!==i&&(this._currentLink.state.decorations.pointerCursor=i,this._currentLink.state.isHovered&&this._element.classList.toggle("xterm-cursor-pointer",i))}},underline:{get:()=>{var i,s;return(s=(i=this._currentLink)==null?void 0:i.state)==null?void 0:s.decorations.underline},set:i=>{var s,r,n;(s=this._currentLink)!=null&&s.state&&((n=(r=this._currentLink)==null?void 0:r.state)==null?void 0:n.decorations.underline)!==i&&(this._currentLink.state.decorations.underline=i,this._currentLink.state.isHovered&&this._fireUnderlineEvent(e.link,i))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange(i=>{if(!this._currentLink)return;let s=i.start===0?0:i.start+1+this._bufferService.buffer.ydisp,r=this._bufferService.buffer.ydisp+1+i.end;if(this._currentLink.link.range.start.y>=s&&this._currentLink.link.range.end.y<=r&&(this._clearCurrentLink(s,r),this._lastMouseEvent)){let n=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);n&&this._askForLink(n,!1)}})))}_linkHover(e,t,i){var s;(s=this._currentLink)!=null&&s.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(i,t.text)}_fireUnderlineEvent(e,t){let i=e.range,s=this._bufferService.buffer.ydisp,r=this._createLinkUnderlineEvent(i.start.x-1,i.start.y-s-1,i.end.x,i.end.y-s-1,void 0);(t?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(r)}_linkLeave(e,t,i){var s;(s=this._currentLink)!=null&&s.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(i,t.text)}_linkAtPosition(e,t){let i=e.range.start.y*this._bufferService.cols+e.range.start.x,s=e.range.end.y*this._bufferService.cols+e.range.end.x,r=t.y*this._bufferService.cols+t.x;return i<=r&&r<=s}_positionFromMouseEvent(e,t,i){let s=i.getCoords(e,t,this._bufferService.cols,this._bufferService.rows);if(s)return{x:s[0],y:s[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(e,t,i,s,r){return{x1:e,y1:t,x2:i,y2:s,cols:this._bufferService.cols,fg:r}}};iu=Ae([H(1,ud),H(2,Gi),H(3,yt),H(4,Av)],iu);function Rw(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 Aw=class extends ww{constructor(e={}){super(e),this._linkifier=this._register(new Yr),this.browser=Zv,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this._register(new Yr),this._onCursorMove=this._register(new z),this.onCursorMove=this._onCursorMove.event,this._onKey=this._register(new z),this.onKey=this._onKey.event,this._onRender=this._register(new z),this.onRender=this._onRender.event,this._onSelectionChange=this._register(new z),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this._register(new z),this.onTitleChange=this._onTitleChange.event,this._onBell=this._register(new z),this.onBell=this._onBell.event,this._onFocus=this._register(new z),this._onBlur=this._register(new z),this._onA11yCharEmitter=this._register(new z),this._onA11yTabEmitter=this._register(new z),this._onWillOpen=this._register(new z),this._setup(),this._decorationService=this._instantiationService.createInstance(Tw),this._instantiationService.setService(bl,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(bC),this._instantiationService.setService(Av,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(wh)),this._register(this._inputHandler.onRequestBell(()=>this._onBell.fire())),this._register(this._inputHandler.onRequestRefreshRows(t=>this.refresh((t==null?void 0:t.start)??0,(t==null?void 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(ht.forward(this._inputHandler.onCursorMove,this._onCursorMove)),this._register(ht.forward(this._inputHandler.onTitleChange,this._onTitleChange)),this._register(ht.forward(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this._register(ht.forward(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this._register(this._bufferService.onResize(t=>this._afterResize(t.cols,t.rows))),this._register(Ee(()=>{var t,i;this._customKeyEventHandler=void 0,(i=(t=this.element)==null?void 0:t.parentNode)==null||i.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 i,s="";switch(t.index){case 256:i="foreground",s="10";break;case 257:i="background",s="11";break;case 258:i="cursor",s="12";break;default:i="ansi",s="4;"+t.index}switch(t.type){case 0:let r=Se.toColorRGB(i==="ansi"?this._themeService.colors.ansi[t.index]:this._themeService.colors[i]);this.coreService.triggerDataEvent(`${B.ESC}]${s};${gw(r)}${$v.ST}`);break;case 1:if(i==="ansi")this._themeService.modifyColors(n=>n.ansi[t.index]=qe.toColor(...t.color));else{let n=i;this._themeService.modifyColors(l=>l[n]=qe.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(Qa,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(e){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(B.ESC+"[I"),this.element.classList.add("focus"),this._showCursor(),this._onFocus.fire()}blur(){var e;return(e=this.textarea)==null?void 0:e.blur()}_handleTextAreaBlur(){this.textarea.value="",this.refresh(this.buffer.y,this.buffer.y),this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(B.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 i=Math.min(this.buffer.x,this.cols-1),s=this._renderService.dimensions.css.cell.height,r=t.getWidth(i),n=this._renderService.dimensions.css.cell.width*r,l=this.buffer.y*this._renderService.dimensions.css.cell.height,a=i*this._renderService.dimensions.css.cell.width;this.textarea.style.left=a+"px",this.textarea.style.top=l+"px",this.textarea.style.width=n+"px",this.textarea.style.height=s+"px",this.textarea.style.lineHeight=s+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this._register(G(this.element,"copy",t=>{this.hasSelection()&&zb(t,this._selectionService)}));let e=t=>jb(t,this.textarea,this.coreService,this.optionsService);this._register(G(this.textarea,"paste",e)),this._register(G(this.element,"paste",e)),Qv?this._register(G(this.element,"mousedown",t=>{t.button===2&&s_(t,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})):this._register(G(this.element,"contextmenu",t=>{s_(t,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})),Sd&&this._register(G(this.element,"auxclick",t=>{t.button===1&&wv(t,this.textarea,this.screenElement)}))}_bindKeys(){this._register(G(this.textarea,"keyup",e=>this._keyUp(e),!0)),this._register(G(this.textarea,"keydown",e=>this._keyDown(e),!0)),this._register(G(this.textarea,"keypress",e=>this._keyPress(e),!0)),this._register(G(this.textarea,"compositionstart",()=>this._compositionHelper.compositionstart())),this._register(G(this.textarea,"compositionupdate",e=>this._compositionHelper.compositionupdate(e))),this._register(G(this.textarea,"compositionend",()=>this._compositionHelper.compositionend())),this._register(G(this.textarea,"input",e=>this._inputEvent(e),!0)),this._register(this.onRender(()=>this._compositionHelper.updateCompositionElements()))}open(e){var r;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"),((r=this.element)==null?void 0:r.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(G(this.screenElement,"mousemove",n=>this.updateCursorStyle(n))),this._helperContainer=this._document.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),t.appendChild(this.screenElement);let i=this.textarea=this._document.createElement("textarea");this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",yh.get()),t0||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",()=>i.readOnly=this.optionsService.rawOptions.disableStdin)),this.textarea.readOnly=this.optionsService.rawOptions.disableStdin,this._coreBrowserService=this._register(this._instantiationService.createInstance(SC,this.textarea,e.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(Xi,this._coreBrowserService),this._register(G(this.textarea,"focus",n=>this._handleTextAreaFocus(n))),this._register(G(this.textarea,"blur",()=>this._handleTextAreaBlur())),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(Yh,this._document,this._helperContainer),this._instantiationService.setService(yo,this._charSizeService),this._themeService=this._instantiationService.createInstance(Gh),this._instantiationService.setService(en,this._themeService),this._characterJoinerService=this._instantiationService.createInstance($a),this._instantiationService.setService(Rv,this._characterJoinerService),this._renderService=this._register(this._instantiationService.createInstance(Ih,this.rows,this.screenElement)),this._instantiationService.setService(Gi,this._renderService),this._register(this._renderService.onRenderedViewportChange(n=>this._onRender.fire(n))),this.onResize(n=>this._renderService.resize(n.cols,n.rows)),this._compositionView=this._document.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(Ph,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(Vh),this._instantiationService.setService(ud,this._mouseService);let s=this._linkifier.value=this._register(this._instantiationService.createInstance(iu,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(Uh,this.element,this.screenElement)),this._register(this._viewport.onRequestScrollLines(n=>{super.scrollLines(n,!1),this.refresh(0,this.rows-1)})),this._selectionService=this._register(this._instantiationService.createInstance(Xh,this.element,this.screenElement,s)),this._instantiationService.setService(Vb,this._selectionService),this._register(this._selectionService.onRequestScrollLines(n=>this.scrollLines(n.amount,n.suppressScrollEvent))),this._register(this._selectionService.onSelectionChange(()=>this._onSelectionChange.fire())),this._register(this._selectionService.onRequestRedraw(n=>this._renderService.handleSelectionChanged(n.start,n.end,n.columnSelectMode))),this._register(this._selectionService.onLinuxMouseSelection(n=>{this.textarea.value=n,this.textarea.focus(),this.textarea.select()})),this._register(ht.any(this._onScroll.event,this._inputHandler.onScroll)(()=>{var n;this._selectionService.refresh(),(n=this._viewport)==null||n.queueSync()})),this._register(this._instantiationService.createInstance(qh,this.screenElement)),this._register(G(this.element,"mousedown",n=>this._selectionService.handleMouseDown(n))),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(Qa,this)),this._register(this.optionsService.onSpecificOptionChange("screenReaderMode",n=>this._handleScreenReaderModeOptionChange(n))),this.options.overviewRuler.width&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(Ga,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRuler",n=>{!this._overviewRulerRenderer&&n&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(Ga,this._viewportElement,this.screenElement)))}),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(Wh,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){let e=this,t=this.element;function i(n){var c,_,f,u,d;let l=e._mouseService.getMouseReportCoords(n,e.screenElement);if(!l)return!1;let a,o;switch(n.overrideType||n.type){case"mousemove":o=32,n.buttons===void 0?(a=3,n.button!==void 0&&(a=n.button<3?n.button:3)):a=n.buttons&1?0:n.buttons&4?1:n.buttons&2?2:3;break;case"mouseup":o=0,a=n.button<3?n.button:3;break;case"mousedown":o=1,a=n.button<3?n.button:3;break;case"wheel":if(e._customWheelEventHandler&&e._customWheelEventHandler(n)===!1)return!1;let g=n.deltaY;if(g===0||e.coreMouseService.consumeWheelEvent(n,(u=(f=(_=(c=e._renderService)==null?void 0:c.dimensions)==null?void 0:_.device)==null?void 0:f.cell)==null?void 0:u.height,(d=e._coreBrowserService)==null?void 0:d.dpr)===0)return!1;o=g<0?0:1,a=4;break;default:return!1}return o===void 0||a===void 0||a>4?!1:e.coreMouseService.triggerMouseEvent({col:l.col,row:l.row,x:l.x,y:l.y,button:a,action:o,ctrl:n.ctrlKey,alt:n.altKey,shift:n.shiftKey})}let s={mouseup:null,wheel:null,mousedrag:null,mousemove:null},r={mouseup:n=>(i(n),n.buttons||(this._document.removeEventListener("mouseup",s.mouseup),s.mousedrag&&this._document.removeEventListener("mousemove",s.mousedrag)),this.cancel(n)),wheel:n=>(i(n),this.cancel(n,!0)),mousedrag:n=>{n.buttons&&i(n)},mousemove:n=>{n.buttons||i(n)}};this._register(this.coreMouseService.onProtocolChange(n=>{n?(this.optionsService.rawOptions.logLevel==="debug"&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(n)),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()),n&8?s.mousemove||(t.addEventListener("mousemove",r.mousemove),s.mousemove=r.mousemove):(t.removeEventListener("mousemove",s.mousemove),s.mousemove=null),n&16?s.wheel||(t.addEventListener("wheel",r.wheel,{passive:!1}),s.wheel=r.wheel):(t.removeEventListener("wheel",s.wheel),s.wheel=null),n&2?s.mouseup||(s.mouseup=r.mouseup):(this._document.removeEventListener("mouseup",s.mouseup),s.mouseup=null),n&4?s.mousedrag||(s.mousedrag=r.mousedrag):(this._document.removeEventListener("mousemove",s.mousedrag),s.mousedrag=null)})),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this._register(G(t,"mousedown",n=>{if(n.preventDefault(),this.focus(),!(!this.coreMouseService.areMouseEventsActive||this._selectionService.shouldForceSelection(n)))return i(n),s.mouseup&&this._document.addEventListener("mouseup",s.mouseup),s.mousedrag&&this._document.addEventListener("mousemove",s.mousedrag),this.cancel(n)})),this._register(G(t,"wheel",n=>{var l,a,o,c,_;if(!s.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(n)===!1)return!1;if(!this.buffer.hasScrollback){if(n.deltaY===0)return!1;if(e.coreMouseService.consumeWheelEvent(n,(c=(o=(a=(l=e._renderService)==null?void 0:l.dimensions)==null?void 0:a.device)==null?void 0:o.cell)==null?void 0:c.height,(_=e._coreBrowserService)==null?void 0:_.dpr)===0)return this.cancel(n,!0);let f=B.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(n.deltaY<0?"A":"B");return this.coreService.triggerDataEvent(f,!0),this.cancel(n,!0)}}},{passive:!1}))}refresh(e,t){var i;(i=this._renderService)==null||i.refreshRows(e,t)}updateCursorStyle(e){var t;(t=this._selectionService)!=null&&t.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){Cv(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,i){this._selectionService.setSelection(e,t,i)}getSelection(){return this._selectionService?this._selectionService.selectionText:""}getSelectionPosition(){if(!(!this._selectionService||!this._selectionService.hasSelection))return{start:{x:this._selectionService.selectionStart[0],y:this._selectionService.selectionStart[1]},end:{x:this._selectionService.selectionEnd[0],y:this._selectionService.selectionEnd[1]}}}clearSelection(){var e;(e=this._selectionService)==null||e.clearSelection()}selectAll(){var e;(e=this._selectionService)==null||e.selectAll()}selectLines(e,t){var i;(i=this._selectionService)==null||i.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 i=Ew(e,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(e),i.type===3||i.type===2){let s=this.rows-1;return this.scrollLines(i.type===2?-s:s),this.cancel(e,!0)}if(i.type===1&&this.selectAll(),this._isThirdLevelShift(this.browser,e)||(i.cancel&&this.cancel(e,!0),!i.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((i.key===B.ETX||i.key===B.CR)&&(this.textarea.value=""),this._onKey.fire({key:i.key,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(i.key,!0),!this.optionsService.rawOptions.screenReaderMode||e.altKey||e.ctrlKey)return this.cancel(e,!0);this._keyDownHandled=!0}_isThirdLevelShift(e,t){let i=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"?i:i&&(!t.keyCode||t.keyCode>47)}_keyUp(e){this._keyDownSeen=!1,!(this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)&&(Nw(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){var i;(i=this._charSizeService)==null||i.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(ze));this._onScroll.fire({position:this.buffer.ydisp}),this.refresh(0,this.rows-1)}}reset(){var t;this.options.rows=this.rows,this.options.cols=this.cols;let e=this._customKeyEventHandler;this._setup(),super.reset(),(t=this._selectionService)==null||t.reset(),this._decorationService.reset(),this._customKeyEventHandler=e,this.refresh(0,this.rows-1)}clearTextureAtlas(){var e;(e=this._renderService)==null||e.clearTextureAtlas()}_reportFocus(){var e;(e=this.element)!=null&&e.classList.contains("focus")?this.coreService.triggerDataEvent(B.ESC+"[I"):this.coreService.triggerDataEvent(B.ESC+"[O")}_reportWindowsOptions(e){if(this._renderService)switch(e){case 0:let t=this._renderService.dimensions.css.canvas.width.toFixed(0),i=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${B.ESC}[4;${i};${t}t`);break;case 1:let s=this._renderService.dimensions.css.cell.width.toFixed(0),r=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${B.ESC}[6;${r};${s}t`);break}}cancel(e,t){if(!(!this.options.cancelEvents&&!t))return e.preventDefault(),e.stopPropagation(),!1}};function Nw(e){return e.keyCode===16||e.keyCode===17||e.keyCode===18}var Ow=class{constructor(){this._addons=[]}dispose(){for(let e=this._addons.length-1;e>=0;e--)this._addons[e].instance.dispose()}loadAddon(e,t){let i={instance:t,dispose:t.dispose,isDisposed:!1};this._addons.push(i),t.dispose=()=>this._wrappedAddonDispose(i),t.activate(e)}_wrappedAddonDispose(e){if(e.isDisposed)return;let t=-1;for(let i=0;i<this._addons.length;i++)if(this._addons[i]===e){t=i;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)}},Lw=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 ri)}translateToString(e,t,i){return this._line.translateToString(e,t,i)}},G_=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 Lw(t)}getNullCell(){return new ri}},zw=class extends se{constructor(e){super(),this._core=e,this._onBufferChange=this._register(new z),this.onBufferChange=this._onBufferChange.event,this._normal=new G_(this._core.buffers.normal,"normal"),this._alternate=new G_(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)}},jw=class{constructor(e){this._core=e}registerCsiHandler(e,t){return this._core.registerCsiHandler(e,i=>t(i.toArray()))}addCsiHandler(e,t){return this.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._core.registerDcsHandler(e,(i,s)=>t(i,s.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)}},Hw=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}},Uw=["cols","rows"],_i=0,qw=class extends se{constructor(e){super(),this._core=this._register(new Aw(e)),this._addonManager=this._register(new Ow),this._publicOptions={...this._core.options};let t=s=>this._core.options[s],i=(s,r)=>{this._checkReadonlyOptions(s),this._core.options[s]=r};for(let s in this._core.options){let r={get:t.bind(this,s),set:i.bind(this,s)};Object.defineProperty(this._publicOptions,s,r)}}_checkReadonlyOptions(e){if(Uw.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 jw(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new Hw(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 zw(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,i){this._verifyIntegers(e,t,i),this._core.select(e,t,i)}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
|
|
120
|
-
`,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
|
|
121
|
-
`),l.write(`\x1B[1m$ ${i}\x1B[0m`);const d=()=>(o(),JSON.stringify({type:"start",cols:l.cols,rows:l.rows})),g=()=>{c||(c=!0,
|
|
117
|
+
`)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(e){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._refresh())),Ed&&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),i=this._model.finalSelectionStart,s=this._model.finalSelectionEnd;return!i||!s||!t?!1:this._areCoordsInSelection(t,i,s)}isCellInSelection(e,t){let i=this._model.finalSelectionStart,s=this._model.finalSelectionEnd;return!i||!s?!1:this._areCoordsInSelection([e,t],i,s)}_areCoordsInSelection(e,t,i){return e[1]>t[1]&&e[1]<i[1]||t[1]===i[1]&&e[1]===t[1]&&e[0]>=t[0]&&e[0]<i[0]||t[1]<i[1]&&e[1]===i[1]&&e[0]<i[0]||t[1]<i[1]&&e[1]===t[1]&&e[0]>=t[0]}_selectWordAtCursor(e,t){var r,n;let i=(n=(r=this._linkifier.currentLink)==null?void 0:r.link)==null?void 0:n.range;if(i)return this._model.selectionStart=[i.start.x-1,i.start.y-1],this._model.selectionStartLength=R_(i,this._bufferService.cols),this._model.selectionEnd=void 0,!0;let s=this._getMouseBufferCoords(e);return s?(this._selectWordAt(s,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=xd(this._coreBrowserService.window,e,this._screenElement)[1],i=this._renderService.dimensions.css.canvas.height;return t>=0&&t<=i?0:(t>i&&(t-=i),t=Math.min(Math.max(t,-Sc),Sc),t/=Sc,t/Math.abs(t)+Math.round(t*(QC-1)))}shouldForceSelection(e){return Ja?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(),JC)}_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&&!(Ja&&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 i=this._bufferService.buffer;if(this._model.selectionEnd[1]<i.lines.length){let s=i.lines.get(this._model.selectionEnd[1]);s&&s.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<e2&&e.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){let i=this._mouseService.getCoords(e,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(i&&i[0]!==void 0&&i[1]!==void 0){let s=YC(i[0]-1,i[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(s,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd,i=!!e&&!!t&&(e[0]!==t[0]||e[1]!==t[1]);if(!i){this._oldHasSelection&&this._fireOnSelectionChange(e,t,i);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,i)}_fireOnSelectionChange(e,t,i){this._oldSelectionStart=e,this._oldSelectionEnd=t,this._oldHasSelection=i,this._onSelectionChange.fire()}_handleBufferActivate(e){this.clearSelection(),this._trimListener.dispose(),this._trimListener=e.activeBuffer.lines.onTrim(t=>this._handleTrim(t))}_convertViewportColToCharacterIndex(e,t){let i=t;for(let s=0;t>=s;s++){let r=e.loadCell(s,this._workCell).getChars().length;this._workCell.getWidth()===0?i--:r>1&&t!==s&&(i+=r-1)}return i}setSelection(e,t,i){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[e,t],this._model.selectionStartLength=i,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(e){this._isClickInSelection(e)||(this._selectWordAtCursor(e,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(e,t,i=!0,s=!0){if(e[0]>=this._bufferService.cols)return;let r=this._bufferService.buffer,n=r.lines.get(e[1]);if(!n)return;let l=r.translateBufferLineToString(e[1],!1),a=this._convertViewportColToCharacterIndex(n,e[0]),o=a,c=e[0]-a,u=0,_=0,f=0,d=0;if(l.charAt(a)===" "){for(;a>0&&l.charAt(a-1)===" ";)a--;for(;o<l.length&&l.charAt(o+1)===" ";)o++}else{let w=e[0],m=e[0];n.getWidth(w)===0&&(u++,w--),n.getWidth(m)===2&&(_++,m++);let p=n.getString(m).length;for(p>1&&(d+=p-1,o+=p-1);w>0&&a>0&&!this._isCharWordSeparator(n.loadCell(w-1,this._workCell));){n.loadCell(w-1,this._workCell);let v=this._workCell.getChars().length;this._workCell.getWidth()===0?(u++,w--):v>1&&(f+=v-1,a-=v-1),a--,w--}for(;m<n.length&&o+1<l.length&&!this._isCharWordSeparator(n.loadCell(m+1,this._workCell));){n.loadCell(m+1,this._workCell);let v=this._workCell.getChars().length;this._workCell.getWidth()===2?(_++,m++):v>1&&(d+=v-1,o+=v-1),o++,m++}}o++;let g=a+c-u+f,y=Math.min(this._bufferService.cols,o-a+u+_-f-d);if(!(!t&&l.slice(a,o).trim()==="")){if(i&&g===0&&n.getCodePoint(0)!==32){let w=r.lines.get(e[1]-1);if(w&&n.isWrapped&&w.getCodePoint(this._bufferService.cols-1)!==32){let m=this._getWordAt([this._bufferService.cols-1,e[1]-1],!1,!0,!1);if(m){let p=this._bufferService.cols-m.start;g-=p,y+=p}}}if(s&&g+y===this._bufferService.cols&&n.getCodePoint(this._bufferService.cols-1)!==32){let w=r.lines.get(e[1]+1);if(w!=null&&w.isWrapped&&w.getCodePoint(0)!==32){let m=this._getWordAt([0,e[1]+1],!1,!1,!0);m&&(y+=m.length)}}return{start:g,length:y}}}_selectWordAt(e,t){let i=this._getWordAt(e,t);if(i){for(;i.start<0;)i.start+=this._bufferService.cols,e[1]--;this._model.selectionStart=[i.start,e[1]],this._model.selectionStartLength=i.length}}_selectToWordAt(e){let t=this._getWordAt(e,!0);if(t){let i=e[1];for(;t.start<0;)t.start+=this._bufferService.cols,i--;if(!this._model.areSelectionValuesReversed())for(;t.start+t.length>this._bufferService.cols;)t.length-=this._bufferService.cols,i++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?t.start:t.start+t.length,i]}}_isCharWordSeparator(e){return e.getWidth()===0?!1:this._optionsService.rawOptions.wordSeparator.indexOf(e.getChars())>=0}_selectLineAt(e){let t=this._bufferService.buffer.getWrappedRangeForLine(e),i={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=R_(i,this._bufferService.cols)}};Qh=Ae([q(3,bt),q(4,ir),q(5,gd),q(6,wt),q(7,Xi),q(8,Ii)],Qh);var B_=class{constructor(){this._data={}}set(e,t,i){this._data[e]||(this._data[e]={}),this._data[e][t]=i}get(e,t){return this._data[e]?this._data[e][t]:void 0}clear(){this._data={}}},A_=class{constructor(){this._color=new B_,this._css=new B_}setCss(e,t,i){this._css.set(e,t,i)}getCss(e,t){return this._css.get(e,t)}setColor(e,t,i){this._color.set(e,t,i)}getColor(e,t){return this._color.get(e,t)}clear(){this._color.clear(),this._css.clear()}},We=Object.freeze((()=>{let e=[Te.toColor("#2e3436"),Te.toColor("#cc0000"),Te.toColor("#4e9a06"),Te.toColor("#c4a000"),Te.toColor("#3465a4"),Te.toColor("#75507b"),Te.toColor("#06989a"),Te.toColor("#d3d7cf"),Te.toColor("#555753"),Te.toColor("#ef2929"),Te.toColor("#8ae234"),Te.toColor("#fce94f"),Te.toColor("#729fcf"),Te.toColor("#ad7fa8"),Te.toColor("#34e2e2"),Te.toColor("#eeeeec")],t=[0,95,135,175,215,255];for(let i=0;i<216;i++){let s=t[i/36%6|0],r=t[i/6%6|0],n=t[i%6];e.push({css:qe.toCss(s,r,n),rgba:qe.toRgba(s,r,n)})}for(let i=0;i<24;i++){let s=8+i*10;e.push({css:qe.toCss(s,s,s),rgba:qe.toRgba(s,s,s)})}return e})()),Ls=Te.toColor("#ffffff"),kn=Te.toColor("#000000"),N_=Te.toColor("#ffffff"),O_=kn,mn={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117},s2=Ls,Jh=class extends se{constructor(e){super(),this._optionsService=e,this._contrastCache=new A_,this._halfContrastCache=new A_,this._onChangeColors=this._register(new H),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:Ls,background:kn,cursor:N_,cursorAccent:O_,selectionForeground:void 0,selectionBackgroundTransparent:mn,selectionBackgroundOpaque:Se.blend(kn,mn),selectionInactiveBackgroundTransparent:mn,selectionInactiveBackgroundOpaque:Se.blend(kn,mn),scrollbarSliderBackground:Se.opacity(Ls,.2),scrollbarSliderHoverBackground:Se.opacity(Ls,.4),scrollbarSliderActiveBackground:Se.opacity(Ls,.5),overviewRulerBorder:Ls,ansi:We.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=fe(e.foreground,Ls),t.background=fe(e.background,kn),t.cursor=Se.blend(t.background,fe(e.cursor,N_)),t.cursorAccent=Se.blend(t.background,fe(e.cursorAccent,O_)),t.selectionBackgroundTransparent=fe(e.selectionBackground,mn),t.selectionBackgroundOpaque=Se.blend(t.background,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundTransparent=fe(e.selectionInactiveBackground,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundOpaque=Se.blend(t.background,t.selectionInactiveBackgroundTransparent),t.selectionForeground=e.selectionForeground?fe(e.selectionForeground,T_):void 0,t.selectionForeground===T_&&(t.selectionForeground=void 0),Se.isOpaque(t.selectionBackgroundTransparent)&&(t.selectionBackgroundTransparent=Se.opacity(t.selectionBackgroundTransparent,.3)),Se.isOpaque(t.selectionInactiveBackgroundTransparent)&&(t.selectionInactiveBackgroundTransparent=Se.opacity(t.selectionInactiveBackgroundTransparent,.3)),t.scrollbarSliderBackground=fe(e.scrollbarSliderBackground,Se.opacity(t.foreground,.2)),t.scrollbarSliderHoverBackground=fe(e.scrollbarSliderHoverBackground,Se.opacity(t.foreground,.4)),t.scrollbarSliderActiveBackground=fe(e.scrollbarSliderActiveBackground,Se.opacity(t.foreground,.5)),t.overviewRulerBorder=fe(e.overviewRulerBorder,s2),t.ansi=We.slice(),t.ansi[0]=fe(e.black,We[0]),t.ansi[1]=fe(e.red,We[1]),t.ansi[2]=fe(e.green,We[2]),t.ansi[3]=fe(e.yellow,We[3]),t.ansi[4]=fe(e.blue,We[4]),t.ansi[5]=fe(e.magenta,We[5]),t.ansi[6]=fe(e.cyan,We[6]),t.ansi[7]=fe(e.white,We[7]),t.ansi[8]=fe(e.brightBlack,We[8]),t.ansi[9]=fe(e.brightRed,We[9]),t.ansi[10]=fe(e.brightGreen,We[10]),t.ansi[11]=fe(e.brightYellow,We[11]),t.ansi[12]=fe(e.brightBlue,We[12]),t.ansi[13]=fe(e.brightMagenta,We[13]),t.ansi[14]=fe(e.brightCyan,We[14]),t.ansi[15]=fe(e.brightWhite,We[15]),e.extendedAnsi){let i=Math.min(t.ansi.length-16,e.extendedAnsi.length);for(let s=0;s<i;s++)t.ansi[s+16]=fe(e.extendedAnsi[s],We[s+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()}}};Jh=Ae([q(0,wt)],Jh);function fe(e,t){if(e!==void 0)try{return Te.toColor(e)}catch{}return t}var r2=class{constructor(...e){this._entries=new Map;for(let[t,i]of e)this.set(t,i)}set(e,t){let i=this._entries.get(e);return this._entries.set(e,t),i}forEach(e){for(let[t,i]of this._entries.entries())e(t,i)}has(e){return this._entries.has(e)}get(e){return this._entries.get(e)}},n2=class{constructor(){this._services=new r2,this._services.set(md,this)}setService(e,t){this._services.set(e,t)}getService(e){return this._services.get(e)}createInstance(e,...t){let i=Qb(e).sort((n,l)=>n.index-l.index),s=[];for(let n of i){let l=this._services.get(n.id);if(!l)throw new Error(`[createInstance] ${e.name} depends on UNKNOWN service ${n.id._id}.`);s.push(l)}let r=i.length>0?i[0].index:t.length;if(t.length!==r)throw new Error(`[createInstance] First service dependency of ${e.name} at position ${r+1} conflicts with ${t.length} static arguments`);return new e(...t,...s)}},l2={trace:0,debug:1,info:2,warn:3,error:4,off:5},a2="xterm.js: ",eu=class extends se{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=l2[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,i){this._evalLazyOptionalParams(i),e.call(console,(this._optionsService.options.logger?"":a2)+t,...i)}trace(e,...t){var i;this._logLevel<=0&&this._log(((i=this._optionsService.options.logger)==null?void 0:i.trace.bind(this._optionsService.options.logger))??console.log,e,t)}debug(e,...t){var i;this._logLevel<=1&&this._log(((i=this._optionsService.options.logger)==null?void 0:i.debug.bind(this._optionsService.options.logger))??console.log,e,t)}info(e,...t){var i;this._logLevel<=2&&this._log(((i=this._optionsService.options.logger)==null?void 0:i.info.bind(this._optionsService.options.logger))??console.info,e,t)}warn(e,...t){var i;this._logLevel<=3&&this._log(((i=this._optionsService.options.logger)==null?void 0:i.warn.bind(this._optionsService.options.logger))??console.warn,e,t)}error(e,...t){var i;this._logLevel<=4&&this._log(((i=this._optionsService.options.logger)==null?void 0:i.error.bind(this._optionsService.options.logger))??console.error,e,t)}};eu=Ae([q(0,wt)],eu);var L_=class extends se{constructor(e){super(),this._maxLength=e,this.onDeleteEmitter=this._register(new H),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this._register(new H),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this._register(new H),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 i=0;i<Math.min(e,this.length);i++)t[i]=this._array[this._getCyclicIndex(i)];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,...i){if(t){for(let s=e;s<this._length-t;s++)this._array[this._getCyclicIndex(s)]=this._array[this._getCyclicIndex(s+t)];this._length-=t,this.onDeleteEmitter.fire({index:e,amount:t})}for(let s=this._length-1;s>=e;s--)this._array[this._getCyclicIndex(s+i.length)]=this._array[this._getCyclicIndex(s)];for(let s=0;s<i.length;s++)this._array[this._getCyclicIndex(e+s)]=i[s];if(i.length&&this.onInsertEmitter.fire({index:e,amount:i.length}),this._length+i.length>this._maxLength){let s=this._length+i.length-this._maxLength;this._startIndex+=s,this._length=this._maxLength,this.onTrimEmitter.fire(s)}else this._length+=i.length}trimStart(e){e>this._length&&(e=this._length),this._startIndex+=e,this._length-=e,this.onTrimEmitter.fire(e)}shiftElements(e,t,i){if(!(t<=0)){if(e<0||e>=this._length)throw new Error("start argument out of range");if(e+i<0)throw new Error("Cannot shift elements in list beyond index 0");if(i>0){for(let r=t-1;r>=0;r--)this.set(e+r+i,this.get(e+r));let s=e+t+i-this._length;if(s>0)for(this._length+=s;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let s=0;s<t;s++)this.set(e+s+i,this.get(e+s))}}_getCyclicIndex(e){return(this._startIndex+e)%this._maxLength}},ie=3,ze=Object.freeze(new wl),Gl=0,yc=2,Tn=class d0{constructor(t,i,s=!1){this.isWrapped=s,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(t*ie);let r=i||ii.fromCharData([0,Bv,1,0]);for(let n=0;n<t;++n)this.setCell(n,r);this.length=t}get(t){let i=this._data[t*ie+0],s=i&2097151;return[this._data[t*ie+1],i&2097152?this._combined[t]:s?is(s):"",i>>22,i&2097152?this._combined[t].charCodeAt(this._combined[t].length-1):s]}set(t,i){this._data[t*ie+1]=i[0],i[1].length>1?(this._combined[t]=i[1],this._data[t*ie+0]=t|2097152|i[2]<<22):this._data[t*ie+0]=i[1].charCodeAt(0)|i[2]<<22}getWidth(t){return this._data[t*ie+0]>>22}hasWidth(t){return this._data[t*ie+0]&12582912}getFg(t){return this._data[t*ie+1]}getBg(t){return this._data[t*ie+2]}hasContent(t){return this._data[t*ie+0]&4194303}getCodePoint(t){let i=this._data[t*ie+0];return i&2097152?this._combined[t].charCodeAt(this._combined[t].length-1):i&2097151}isCombined(t){return this._data[t*ie+0]&2097152}getString(t){let i=this._data[t*ie+0];return i&2097152?this._combined[t]:i&2097151?is(i&2097151):""}isProtected(t){return this._data[t*ie+2]&536870912}loadCell(t,i){return Gl=t*ie,i.content=this._data[Gl+0],i.fg=this._data[Gl+1],i.bg=this._data[Gl+2],i.content&2097152&&(i.combinedData=this._combined[t]),i.bg&268435456&&(i.extended=this._extendedAttrs[t]),i}setCell(t,i){i.content&2097152&&(this._combined[t]=i.combinedData),i.bg&268435456&&(this._extendedAttrs[t]=i.extended),this._data[t*ie+0]=i.content,this._data[t*ie+1]=i.fg,this._data[t*ie+2]=i.bg}setCellFromCodepoint(t,i,s,r){r.bg&268435456&&(this._extendedAttrs[t]=r.extended),this._data[t*ie+0]=i|s<<22,this._data[t*ie+1]=r.fg,this._data[t*ie+2]=r.bg}addCodepointToCell(t,i,s){let r=this._data[t*ie+0];r&2097152?this._combined[t]+=is(i):r&2097151?(this._combined[t]=is(r&2097151)+is(i),r&=-2097152,r|=2097152):r=i|1<<22,s&&(r&=-12582913,r|=s<<22),this._data[t*ie+0]=r}insertCells(t,i,s){if(t%=this.length,t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,s),i<this.length-t){let r=new ii;for(let n=this.length-t-i-1;n>=0;--n)this.setCell(t+i+n,this.loadCell(t+n,r));for(let n=0;n<i;++n)this.setCell(t+n,s)}else for(let r=t;r<this.length;++r)this.setCell(r,s);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,s)}deleteCells(t,i,s){if(t%=this.length,i<this.length-t){let r=new ii;for(let n=0;n<this.length-t-i;++n)this.setCell(t+n,this.loadCell(t+i+n,r));for(let n=this.length-i;n<this.length;++n)this.setCell(n,s)}else for(let r=t;r<this.length;++r)this.setCell(r,s);t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,s),this.getWidth(t)===0&&!this.hasContent(t)&&this.setCellFromCodepoint(t,0,1,s)}replaceCells(t,i,s,r=!1){if(r){for(t&&this.getWidth(t-1)===2&&!this.isProtected(t-1)&&this.setCellFromCodepoint(t-1,0,1,s),i<this.length&&this.getWidth(i-1)===2&&!this.isProtected(i)&&this.setCellFromCodepoint(i,0,1,s);t<i&&t<this.length;)this.isProtected(t)||this.setCell(t,s),t++;return}for(t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,s),i<this.length&&this.getWidth(i-1)===2&&this.setCellFromCodepoint(i,0,1,s);t<i&&t<this.length;)this.setCell(t++,s)}resize(t,i){if(t===this.length)return this._data.length*4*yc<this._data.buffer.byteLength;let s=t*ie;if(t>this.length){if(this._data.buffer.byteLength>=s*4)this._data=new Uint32Array(this._data.buffer,0,s);else{let r=new Uint32Array(s);r.set(this._data),this._data=r}for(let r=this.length;r<t;++r)this.setCell(r,i)}else{this._data=this._data.subarray(0,s);let r=Object.keys(this._combined);for(let l=0;l<r.length;l++){let a=parseInt(r[l],10);a>=t&&delete this._combined[a]}let n=Object.keys(this._extendedAttrs);for(let l=0;l<n.length;l++){let a=parseInt(n[l],10);a>=t&&delete this._extendedAttrs[a]}}return this.length=t,s*4*yc<this._data.buffer.byteLength}cleanupMemory(){if(this._data.length*4*yc<this._data.buffer.byteLength){let t=new Uint32Array(this._data.length);return t.set(this._data),this._data=t,1}return 0}fill(t,i=!1){if(i){for(let s=0;s<this.length;++s)this.isProtected(s)||this.setCell(s,t);return}this._combined={},this._extendedAttrs={};for(let s=0;s<this.length;++s)this.setCell(s,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 i in t._combined)this._combined[i]=t._combined[i];this._extendedAttrs={};for(let i in t._extendedAttrs)this._extendedAttrs[i]=t._extendedAttrs[i];this.isWrapped=t.isWrapped}clone(){let t=new d0(0);t._data=new Uint32Array(this._data),t.length=this.length;for(let i in this._combined)t._combined[i]=this._combined[i];for(let i in this._extendedAttrs)t._extendedAttrs[i]=this._extendedAttrs[i];return t.isWrapped=this.isWrapped,t}getTrimmedLength(){for(let t=this.length-1;t>=0;--t)if(this._data[t*ie+0]&4194303)return t+(this._data[t*ie+0]>>22);return 0}getNoBgTrimmedLength(){for(let t=this.length-1;t>=0;--t)if(this._data[t*ie+0]&4194303||this._data[t*ie+2]&50331648)return t+(this._data[t*ie+0]>>22);return 0}copyCellsFrom(t,i,s,r,n){let l=t._data;if(n)for(let o=r-1;o>=0;o--){for(let c=0;c<ie;c++)this._data[(s+o)*ie+c]=l[(i+o)*ie+c];l[(i+o)*ie+2]&268435456&&(this._extendedAttrs[s+o]=t._extendedAttrs[i+o])}else for(let o=0;o<r;o++){for(let c=0;c<ie;c++)this._data[(s+o)*ie+c]=l[(i+o)*ie+c];l[(i+o)*ie+2]&268435456&&(this._extendedAttrs[s+o]=t._extendedAttrs[i+o])}let a=Object.keys(t._combined);for(let o=0;o<a.length;o++){let c=parseInt(a[o],10);c>=i&&(this._combined[c-i+s]=t._combined[c])}}translateToString(t,i,s,r){i=i??0,s=s??this.length,t&&(s=Math.min(s,this.getTrimmedLength())),r&&(r.length=0);let n="";for(;i<s;){let l=this._data[i*ie+0],a=l&2097151,o=l&2097152?this._combined[i]:a?is(a):ds;if(n+=o,r)for(let c=0;c<o.length;++c)r.push(i);i+=l>>22||1}return r&&r.push(i),n}};function o2(e,t,i,s,r,n){let l=[];for(let a=0;a<e.length-1;a++){let o=a,c=e.get(++o);if(!c.isWrapped)continue;let u=[e.get(a)];for(;o<e.length&&c.isWrapped;)u.push(c),c=e.get(++o);if(!n&&s>=a&&s<o){a+=u.length-1;continue}let _=0,f=ol(u,_,t),d=1,g=0;for(;d<u.length;){let w=ol(u,d,t),m=w-g,p=i-f,v=Math.min(m,p);u[_].copyCellsFrom(u[d],g,f,v,!1),f+=v,f===i&&(_++,f=0),g+=v,g===w&&(d++,g=0),f===0&&_!==0&&u[_-1].getWidth(i-1)===2&&(u[_].copyCellsFrom(u[_-1],i-1,f++,1,!1),u[_-1].setCell(i-1,r))}u[_].replaceCells(f,i,r);let y=0;for(let w=u.length-1;w>0&&(w>_||u[w].getTrimmedLength()===0);w--)y++;y>0&&(l.push(a+u.length-y),l.push(y)),a+=u.length-1}return l}function c2(e,t){let i=[],s=0,r=t[s],n=0;for(let l=0;l<e.length;l++)if(r===l){let a=t[++s];e.onDeleteEmitter.fire({index:l-n,amount:a}),l+=a-1,n+=a,r=t[++s]}else i.push(l);return{layout:i,countRemoved:n}}function h2(e,t){let i=[];for(let s=0;s<t.length;s++)i.push(e.get(t[s]));for(let s=0;s<i.length;s++)e.set(s,i[s]);e.length=t.length}function u2(e,t,i){let s=[],r=e.map((o,c)=>ol(e,c,t)).reduce((o,c)=>o+c),n=0,l=0,a=0;for(;a<r;){if(r-a<i){s.push(r-a);break}n+=i;let o=ol(e,l,t);n>o&&(n-=o,l++);let c=e[l].getWidth(n-1)===2;c&&n--;let u=c?i-1:i;s.push(u),a+=u}return s}function ol(e,t,i){if(t===e.length-1)return e[t].getTrimmedLength();let s=!e[t].hasContent(i-1)&&e[t].getWidth(i-1)===1,r=e[t+1].getWidth(0)===2;return s&&r?i-1:i}var f0=class _0{constructor(t){this.line=t,this.isDisposed=!1,this._disposables=[],this._id=_0._nextId++,this._onDispose=this.register(new H),this.onDispose=this._onDispose.event}get id(){return this._id}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),Gs(this._disposables),this._disposables.length=0)}register(t){return this._disposables.push(t),t}};f0._nextId=1;var d2=f0,Xe={},zs=Xe.B;Xe[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:"≥","{":"π","|":"≠","}":"£","~":"·"};Xe.A={"#":"£"};Xe.B=void 0;Xe[4]={"#":"£","@":"¾","[":"ij","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"};Xe.C=Xe[5]={"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};Xe.R={"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"};Xe.Q={"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"};Xe.K={"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"};Xe.Y={"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"};Xe.E=Xe[6]={"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"};Xe.Z={"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"};Xe.H=Xe[7]={"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};Xe["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"};var z_=4294967295,j_=class{constructor(e,t,i){this._hasScrollback=e,this._optionsService=t,this._bufferService=i,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=ze.clone(),this.savedCharset=zs,this.markers=[],this._nullCell=ii.fromCharData([0,Bv,1,0]),this._whitespaceCell=ii.fromCharData([0,ds,1,32]),this._isClearing=!1,this._memoryCleanupQueue=new eo,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new L_(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 Fa),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 Fa),this._whitespaceCell}getBlankLine(e,t){return new Tn(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>z_?z_:t}fillViewportRows(e){if(this.lines.length===0){e===void 0&&(e=ze);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 L_(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(e,t){let i=this.getNullCell(ze),s=0,r=this._getCorrectBufferLength(t);if(r>this.lines.maxLength&&(this.lines.maxLength=r),this.lines.length>0){if(this._cols<e)for(let l=0;l<this.lines.length;l++)s+=+this.lines.get(l).resize(e,i);let n=0;if(this._rows<t)for(let l=this._rows;l<t;l++)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 Tn(e,i)):this.ybase>0&&this.lines.length<=this.ybase+this.y+n+1?(this.ybase--,n++,this.ydisp>0&&this.ydisp--):this.lines.push(new Tn(e,i)));else for(let l=this._rows;l>t;l--)this.lines.length>t+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(r<this.lines.maxLength){let l=this.lines.length-r;l>0&&(this.lines.trimStart(l),this.ybase=Math.max(this.ybase-l,0),this.ydisp=Math.max(this.ydisp-l,0),this.savedY=Math.max(this.savedY-l,0)),this.lines.maxLength=r}this.x=Math.min(this.x,e-1),this.y=Math.min(this.y,t-1),n&&(this.y+=n),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 n=0;n<this.lines.length;n++)s+=+this.lines.get(n).resize(e,i);this._cols=e,this._rows=t,this._memoryCleanupQueue.clear(),s>.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 i=this._optionsService.rawOptions.reflowCursorLine,s=o2(this.lines,this._cols,e,this.ybase+this.y,this.getNullCell(ze),i);if(s.length>0){let r=c2(this.lines,s);h2(this.lines,r.layout),this._reflowLargerAdjustViewport(e,t,r.countRemoved)}}_reflowLargerAdjustViewport(e,t,i){let s=this.getNullCell(ze),r=i;for(;r-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<t&&this.lines.push(new Tn(e,s))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-i,0)}_reflowSmaller(e,t){let i=this._optionsService.rawOptions.reflowCursorLine,s=this.getNullCell(ze),r=[],n=0;for(let l=this.lines.length-1;l>=0;l--){let a=this.lines.get(l);if(!a||!a.isWrapped&&a.getTrimmedLength()<=e)continue;let o=[a];for(;a.isWrapped&&l>0;)a=this.lines.get(--l),o.unshift(a);if(!i){let v=this.ybase+this.y;if(v>=l&&v<l+o.length)continue}let c=o[o.length-1].getTrimmedLength(),u=u2(o,this._cols,e),_=u.length-o.length,f;this.ybase===0&&this.y!==this.lines.length-1?f=Math.max(0,this.y-this.lines.maxLength+_):f=Math.max(0,this.lines.length-this.lines.maxLength+_);let d=[];for(let v=0;v<_;v++){let S=this.getBlankLine(ze,!0);d.push(S)}d.length>0&&(r.push({start:l+o.length+n,newLines:d}),n+=d.length),o.push(...d);let g=u.length-1,y=u[g];y===0&&(g--,y=u[g]);let w=o.length-_-1,m=c;for(;w>=0;){let v=Math.min(m,y);if(o[g]===void 0)break;if(o[g].copyCellsFrom(o[w],m-v,y-v,v,!0),y-=v,y===0&&(g--,y=u[g]),m-=v,m===0){w--;let S=Math.max(w,0);m=ol(o,S,this._cols)}}for(let v=0;v<o.length;v++)u[v]<e&&o[v].setCell(u[v],s);let p=_-f;for(;p-- >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+n)-t&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+_,this.ybase+t-1)}if(r.length>0){let l=[],a=[];for(let y=0;y<this.lines.length;y++)a.push(this.lines.get(y));let o=this.lines.length,c=o-1,u=0,_=r[u];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+n);let f=0;for(let y=Math.min(this.lines.maxLength-1,o+n-1);y>=0;y--)if(_&&_.start>c+f){for(let w=_.newLines.length-1;w>=0;w--)this.lines.set(y--,_.newLines[w]);y++,l.push({index:c+1,amount:_.newLines.length}),f+=_.newLines.length,_=r[++u]}else this.lines.set(y,a[c--]);let d=0;for(let y=l.length-1;y>=0;y--)l[y].index+=d,this.lines.onInsertEmitter.fire(l[y]),d+=l[y].amount;let g=Math.max(0,o+n-this.lines.maxLength);g>0&&this.lines.onTrimEmitter.fire(g)}}translateBufferLineToString(e,t,i=0,s){let r=this.lines.get(e);return r?r.translateToString(t,i,s):""}getWrappedRangeForLine(e){let t=e,i=e;for(;t>0&&this.lines.get(t).isWrapped;)t--;for(;i+1<this.lines.length&&this.lines.get(i+1).isWrapped;)i++;return{first:t,last:i}}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 d2(e);return this.markers.push(t),t.register(this.lines.onTrim(i=>{t.line-=i,t.line<0&&t.dispose()})),t.register(this.lines.onInsert(i=>{t.line>=i.index&&(t.line+=i.amount)})),t.register(this.lines.onDelete(i=>{t.line>=i.index&&t.line<i.index+i.amount&&t.dispose(),t.line>i.index&&(t.line-=i.amount)})),t.register(t.onDispose(()=>this._removeMarker(t))),t}_removeMarker(e){this._isClearing||this.markers.splice(this.markers.indexOf(e),1)}},f2=class extends se{constructor(e,t){super(),this._optionsService=e,this._bufferService=t,this._onBufferActivate=this._register(new H),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 j_(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new j_(!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)}},p0=2,m0=1,tu=class extends se{constructor(e){super(),this.isUserScrolling=!1,this._onResize=this._register(new H),this.onResize=this._onResize.event,this._onScroll=this._register(new H),this.onScroll=this._onScroll.event,this.cols=Math.max(e.rawOptions.cols||0,p0),this.rows=Math.max(e.rawOptions.rows||0,m0),this.buffers=this._register(new f2(e,this)),this._register(this.buffers.onBufferActivate(t=>{this._onScroll.fire(t.activeBuffer.ydisp)}))}get buffer(){return this.buffers.active}resize(e,t){let i=this.cols!==e,s=this.rows!==t;this.cols=e,this.rows=t,this.buffers.resize(e,t),this._onResize.fire({cols:e,rows:t,colsChanged:i,rowsChanged:s})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(e,t=!1){let i=this.buffer,s;s=this._cachedBlankLine,(!s||s.length!==this.cols||s.getFg(0)!==e.fg||s.getBg(0)!==e.bg)&&(s=i.getBlankLine(e,t),this._cachedBlankLine=s),s.isWrapped=t;let r=i.ybase+i.scrollTop,n=i.ybase+i.scrollBottom;if(i.scrollTop===0){let l=i.lines.isFull;n===i.lines.length-1?l?i.lines.recycle().copyFrom(s):i.lines.push(s.clone()):i.lines.splice(n+1,0,s.clone()),l?this.isUserScrolling&&(i.ydisp=Math.max(i.ydisp-1,0)):(i.ybase++,this.isUserScrolling||i.ydisp++)}else{let l=n-r+1;i.lines.shiftElements(r+1,l-1,-1),i.lines.set(n,s.clone())}this.isUserScrolling||(i.ydisp=i.ybase),this._onScroll.fire(i.ydisp)}scrollLines(e,t){let i=this.buffer;if(e<0){if(i.ydisp===0)return;this.isUserScrolling=!0}else e+i.ydisp>=i.ybase&&(this.isUserScrolling=!1);let s=i.ydisp;i.ydisp=Math.max(Math.min(i.ydisp+e,i.ybase),0),s!==i.ydisp&&(t||this._onScroll.fire(i.ydisp))}};tu=Ae([q(0,wt)],tu);var cr={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:Ja,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRuler:{}},_2=["normal","bold","100","200","300","400","500","600","700","800","900"],p2=class extends se{constructor(e){super(),this._onOptionChange=this._register(new H),this.onOptionChange=this._onOptionChange.event;let t={...cr};for(let i in e)if(i in t)try{let s=e[i];t[i]=this._sanitizeAndValidateOption(i,s)}catch(s){console.error(s)}this.rawOptions=t,this.options={...t},this._setupOptions(),this._register(Ee(()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null}))}onSpecificOptionChange(e,t){return this.onOptionChange(i=>{i===e&&t(this.rawOptions[e])})}onMultipleOptionChange(e,t){return this.onOptionChange(i=>{e.indexOf(i)!==-1&&t()})}_setupOptions(){let e=i=>{if(!(i in cr))throw new Error(`No option with key "${i}"`);return this.rawOptions[i]},t=(i,s)=>{if(!(i in cr))throw new Error(`No option with key "${i}"`);s=this._sanitizeAndValidateOption(i,s),this.rawOptions[i]!==s&&(this.rawOptions[i]=s,this._onOptionChange.fire(i))};for(let i in this.rawOptions){let s={get:e.bind(this,i),set:t.bind(this,i)};Object.defineProperty(this.options,i,s)}}_sanitizeAndValidateOption(e,t){switch(e){case"cursorStyle":if(t||(t=cr[e]),!m2(t))throw new Error(`"${t}" is not a valid value for ${e}`);break;case"wordSeparator":t||(t=cr[e]);break;case"fontWeight":case"fontWeightBold":if(typeof t=="number"&&1<=t&&t<=1e3)break;t=_2.includes(t)?t:cr[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 m2(e){return e==="block"||e==="underline"||e==="bar"}function Dn(e,t=5){if(typeof e!="object")return e;let i=Array.isArray(e)?[]:{};for(let s in e)i[s]=t<=1?e[s]:e[s]&&Dn(e[s],t-1);return i}var H_=Object.freeze({insertMode:!1}),U_=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,cursorBlink:void 0,cursorStyle:void 0,origin:!1,reverseWraparound:!1,sendFocus:!1,synchronizedOutput:!1,wraparound:!0}),iu=class extends se{constructor(e,t,i){super(),this._bufferService=e,this._logService=t,this._optionsService=i,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this._register(new H),this.onData=this._onData.event,this._onUserInput=this._register(new H),this.onUserInput=this._onUserInput.event,this._onBinary=this._register(new H),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this._register(new H),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=Dn(H_),this.decPrivateModes=Dn(U_)}reset(){this.modes=Dn(H_),this.decPrivateModes=Dn(U_)}triggerDataEvent(e,t=!1){if(this._optionsService.rawOptions.disableStdin)return;let i=this._bufferService.buffer;t&&this._optionsService.rawOptions.scrollOnUserInput&&i.ybase!==i.ydisp&&this._onRequestScrollToBottom.fire(),t&&this._onUserInput.fire(),this._logService.debug(`sending data "${e}"`),this._logService.trace("sending data (codes)",()=>e.split("").map(s=>s.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))}};iu=Ae([q(0,bt),q(1,zv),q(2,wt)],iu);var q_={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 bc(e,t){let i=(e.ctrl?16:0)|(e.shift?4:0)|(e.alt?8:0);return e.button===4?(i|=64,i|=e.action):(i|=e.button&3,e.button&4&&(i|=64),e.button&8&&(i|=128),e.action===32?i|=32:e.action===0&&!t&&(i|=3)),i}var wc=String.fromCharCode,P_={DEFAULT:e=>{let t=[bc(e,!1)+32,e.col+32,e.row+32];return t[0]>255||t[1]>255||t[2]>255?"":`\x1B[M${wc(t[0])}${wc(t[1])}${wc(t[2])}`},SGR:e=>{let t=e.action===0&&e.button!==4?"m":"M";return`\x1B[<${bc(e,!0)};${e.col};${e.row}${t}`},SGR_PIXELS:e=>{let t=e.action===0&&e.button!==4?"m":"M";return`\x1B[<${bc(e,!0)};${e.x};${e.y}${t}`}},su=class extends se{constructor(e,t,i){super(),this._bufferService=e,this._coreService=t,this._optionsService=i,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._wheelPartialScroll=0,this._onProtocolChange=this._register(new H),this.onProtocolChange=this._onProtocolChange.event;for(let s of Object.keys(q_))this.addProtocol(s,q_[s]);for(let s of Object.keys(P_))this.addEncoding(s,P_[s]);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,i){if(e.deltaY===0||e.shiftKey||t===void 0||i===void 0)return 0;let s=t/i,r=this._applyScrollModifier(e.deltaY,e);return e.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(r/=s+0,Math.abs(e.deltaY)<50&&(r*=.3),this._wheelPartialScroll+=r,r=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):e.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(r*=this._bufferService.rows),r}_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,i){if(i){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)}};su=Ae([q(0,bt),q(1,ir),q(2,wt)],su);var Cc=[[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]],g2=[[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]],Ye;function v2(e,t){let i=0,s=t.length-1,r;if(e<t[0][0]||e>t[s][1])return!1;for(;s>=i;)if(r=i+s>>1,e>t[r][1])i=r+1;else if(e<t[r][0])s=r-1;else return!0;return!1}var S2=class{constructor(){if(this.version="6",!Ye){Ye=new Uint8Array(65536),Ye.fill(1),Ye[0]=0,Ye.fill(0,1,32),Ye.fill(0,127,160),Ye.fill(2,4352,4448),Ye[9001]=2,Ye[9002]=2,Ye.fill(2,11904,42192),Ye[12351]=1,Ye.fill(2,44032,55204),Ye.fill(2,63744,64256),Ye.fill(2,65040,65050),Ye.fill(2,65072,65136),Ye.fill(2,65280,65377),Ye.fill(2,65504,65511);for(let e=0;e<Cc.length;++e)Ye.fill(0,Cc[e][0],Cc[e][1]+1)}}wcwidth(e){return e<32?0:e<127?1:e<65536?Ye[e]:v2(e,g2)?0:e>=131072&&e<=196605||e>=196608&&e<=262141?2:1}charProperties(e,t){let i=this.wcwidth(e),s=i===0&&t!==0;if(s){let r=js.extractWidth(t);r===0?s=!1:r>i&&(i=r)}return js.createPropertyValue(0,i,s)}},js=class Sa{constructor(){this._providers=Object.create(null),this._active="",this._onChange=new H,this.onChange=this._onChange.event;let t=new S2;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,i,s=!1){return(t&16777215)<<3|(i&3)<<1|(s?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 i=0,s=0,r=t.length;for(let n=0;n<r;++n){let l=t.charCodeAt(n);if(55296<=l&&l<=56319){if(++n>=r)return i+this.wcwidth(l);let c=t.charCodeAt(n);56320<=c&&c<=57343?l=(l-55296)*1024+c-56320+65536:i+=this.wcwidth(c)}let a=this.charProperties(l,s),o=Sa.extractWidth(a);Sa.extractShouldJoin(a)&&(o-=Sa.extractWidth(s)),i+=o,s=a}return i}charProperties(t,i){return this._activeProvider.charProperties(t,i)}},y2=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 K_(e){var s;let t=(s=e.buffer.lines.get(e.buffer.ybase+e.buffer.y-1))==null?void 0:s.get(e.cols-1),i=e.buffer.lines.get(e.buffer.ybase+e.buffer.y);i&&t&&(i.isWrapped=t[3]!==0&&t[3]!==32)}var gn=2147483647,b2=256,g0=class ru{constructor(t=32,i=32){if(this.maxLength=t,this.maxSubParamsLength=i,i>b2)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(t),this.length=0,this._subParams=new Int32Array(i),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(t),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}static fromArray(t){let i=new ru;if(!t.length)return i;for(let s=Array.isArray(t[0])?1:0;s<t.length;++s){let r=t[s];if(Array.isArray(r))for(let n=0;n<r.length;++n)i.addSubParam(r[n]);else i.addParam(r)}return i}clone(){let t=new ru(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 i=0;i<this.length;++i){t.push(this.params[i]);let s=this._subParamsIdx[i]>>8,r=this._subParamsIdx[i]&255;r-s>0&&t.push(Array.prototype.slice.call(this._subParams,s,r))}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>gn?gn: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>gn?gn:t,this._subParamsIdx[this.length-1]++}}hasSubParams(t){return(this._subParamsIdx[t]&255)-(this._subParamsIdx[t]>>8)>0}getSubParams(t){let i=this._subParamsIdx[t]>>8,s=this._subParamsIdx[t]&255;return s-i>0?this._subParams.subarray(i,s):null}getSubParamsAll(){let t={};for(let i=0;i<this.length;++i){let s=this._subParamsIdx[i]>>8,r=this._subParamsIdx[i]&255;r-s>0&&(t[i]=this._subParams.slice(s,r))}return t}addDigit(t){let i;if(this._rejectDigits||!(i=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;let s=this._digitIsSub?this._subParams:this.params,r=s[i-1];s[i-1]=~r?Math.min(r*10+t,gn):t}},vn=[],w2=class{constructor(){this._state=0,this._active=vn,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 i=this._handlers[e];return i.push(t),{dispose:()=>{let s=i.indexOf(t);s!==-1&&i.splice(s,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=vn}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=vn,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||vn,!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,i){if(!this._active.length)this._handlerFb(this._id,"PUT",wo(e,t,i));else for(let s=this._active.length-1;s>=0;s--)this._active[s].put(e,t,i)}start(){this.reset(),this._state=1}put(e,t,i){if(this._state!==3){if(this._state===1)for(;t<i;){let s=e[t++];if(s===59){this._state=2,this._start();break}if(s<48||57<s){this._state=3;return}this._id===-1&&(this._id=0),this._id=this._id*10+s-48}this._state===2&&i-t>0&&this._put(e,t,i)}}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 i=!1,s=this._active.length-1,r=!1;if(this._stack.paused&&(s=this._stack.loopPosition-1,i=t,r=this._stack.fallThrough,this._stack.paused=!1),!r&&i===!1){for(;s>=0&&(i=this._active[s].end(e),i!==!0);s--)if(i instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=s,this._stack.fallThrough=!1,i;s--}for(;s>=0;s--)if(i=this._active[s].end(!1),i instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=s,this._stack.fallThrough=!0,i}this._active=vn,this._id=-1,this._state=0}}},Nt=class{constructor(e){this._handler=e,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(e,t,i){this._hitLimit||(this._data+=wo(e,t,i),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(i=>(this._data="",this._hitLimit=!1,i));return this._data="",this._hitLimit=!1,t}},Sn=[],C2=class{constructor(){this._handlers=Object.create(null),this._active=Sn,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=Sn}registerHandler(e,t){this._handlers[e]===void 0&&(this._handlers[e]=[]);let i=this._handlers[e];return i.push(t),{dispose:()=>{let s=i.indexOf(t);s!==-1&&i.splice(s,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=Sn,this._ident=0}hook(e,t){if(this.reset(),this._ident=e,this._active=this._handlers[e]||Sn,!this._active.length)this._handlerFb(this._ident,"HOOK",t);else for(let i=this._active.length-1;i>=0;i--)this._active[i].hook(t)}put(e,t,i){if(!this._active.length)this._handlerFb(this._ident,"PUT",wo(e,t,i));else for(let s=this._active.length-1;s>=0;s--)this._active[s].put(e,t,i)}unhook(e,t=!0){if(!this._active.length)this._handlerFb(this._ident,"UNHOOK",e);else{let i=!1,s=this._active.length-1,r=!1;if(this._stack.paused&&(s=this._stack.loopPosition-1,i=t,r=this._stack.fallThrough,this._stack.paused=!1),!r&&i===!1){for(;s>=0&&(i=this._active[s].unhook(e),i!==!0);s--)if(i instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=s,this._stack.fallThrough=!1,i;s--}for(;s>=0;s--)if(i=this._active[s].unhook(!1),i instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=s,this._stack.fallThrough=!0,i}this._active=Sn,this._ident=0}},Mn=new g0;Mn.addParam(0);var W_=class{constructor(e){this._handler=e,this._data="",this._params=Mn,this._hitLimit=!1}hook(e){this._params=e.length>1||e.params[0]?e.clone():Mn,this._data="",this._hitLimit=!1}put(e,t,i){this._hitLimit||(this._data+=wo(e,t,i),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(i=>(this._params=Mn,this._data="",this._hitLimit=!1,i));return this._params=Mn,this._data="",this._hitLimit=!1,t}},x2=class{constructor(e){this.table=new Uint8Array(e)}setDefault(e,t){this.table.fill(e<<4|t)}add(e,t,i,s){this.table[t<<8|e]=i<<4|s}addMany(e,t,i,s){for(let r=0;r<e.length;r++)this.table[t<<8|e[r]]=i<<4|s}},Xt=160,E2=function(){let e=new x2(4095),t=Array.apply(null,Array(256)).map((a,o)=>o),i=(a,o)=>t.slice(a,o),s=i(32,127),r=i(0,24);r.push(25),r.push.apply(r,i(28,32));let n=i(0,14),l;e.setDefault(1,0),e.addMany(s,0,2,0);for(l in n)e.addMany([24,26,153,154],l,3,0),e.addMany(i(128,144),l,3,0),e.addMany(i(144,152),l,3,0),e.add(156,l,0,0),e.add(27,l,11,1),e.add(157,l,4,8),e.addMany([152,158,159],l,0,7),e.add(155,l,11,3),e.add(144,l,11,9);return e.addMany(r,0,3,0),e.addMany(r,1,3,1),e.add(127,1,0,1),e.addMany(r,8,0,8),e.addMany(r,3,3,3),e.add(127,3,0,3),e.addMany(r,4,3,4),e.add(127,4,0,4),e.addMany(r,6,3,6),e.addMany(r,5,3,5),e.add(127,5,0,5),e.addMany(r,2,3,2),e.add(127,2,0,2),e.add(93,1,4,8),e.addMany(s,8,5,8),e.add(127,8,5,8),e.addMany([156,27,24,26,7],8,6,0),e.addMany(i(28,32),8,0,8),e.addMany([88,94,95],1,0,7),e.addMany(s,7,0,7),e.addMany(r,7,0,7),e.add(156,7,0,0),e.add(127,7,0,7),e.add(91,1,11,3),e.addMany(i(64,127),3,7,0),e.addMany(i(48,60),3,8,4),e.addMany([60,61,62,63],3,9,4),e.addMany(i(48,60),4,8,4),e.addMany(i(64,127),4,7,0),e.addMany([60,61,62,63],4,0,6),e.addMany(i(32,64),6,0,6),e.add(127,6,0,6),e.addMany(i(64,127),6,0,0),e.addMany(i(32,48),3,9,5),e.addMany(i(32,48),5,9,5),e.addMany(i(48,64),5,0,6),e.addMany(i(64,127),5,7,0),e.addMany(i(32,48),4,9,5),e.addMany(i(32,48),1,9,2),e.addMany(i(32,48),2,9,2),e.addMany(i(48,127),2,10,0),e.addMany(i(48,80),1,10,0),e.addMany(i(81,88),1,10,0),e.addMany([89,90,92],1,10,0),e.addMany(i(96,127),1,10,0),e.add(80,1,11,9),e.addMany(r,9,0,9),e.add(127,9,0,9),e.addMany(i(28,32),9,0,9),e.addMany(i(32,48),9,9,12),e.addMany(i(48,60),9,8,10),e.addMany([60,61,62,63],9,9,10),e.addMany(r,11,0,11),e.addMany(i(32,128),11,0,11),e.addMany(i(28,32),11,0,11),e.addMany(r,10,0,10),e.add(127,10,0,10),e.addMany(i(28,32),10,0,10),e.addMany(i(48,60),10,8,10),e.addMany([60,61,62,63],10,0,11),e.addMany(i(32,48),10,9,12),e.addMany(r,12,0,12),e.add(127,12,0,12),e.addMany(i(28,32),12,0,12),e.addMany(i(32,48),12,9,12),e.addMany(i(48,64),12,0,11),e.addMany(i(64,127),12,12,13),e.addMany(i(64,127),10,12,13),e.addMany(i(64,127),9,12,13),e.addMany(r,13,13,13),e.addMany(s,13,13,13),e.add(127,13,0,13),e.addMany([27,156,24,26],13,14,0),e.add(Xt,0,2,0),e.add(Xt,8,5,8),e.add(Xt,6,0,6),e.add(Xt,11,0,11),e.add(Xt,13,13,13),e}(),k2=class extends se{constructor(e=E2){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 g0,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(t,i,s)=>{},this._executeHandlerFb=t=>{},this._csiHandlerFb=(t,i)=>{},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(Ee(()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)})),this._oscParser=this._register(new w2),this._dcsParser=this._register(new C2),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},()=>!0)}_identifier(e,t=[64,126]){let i=0;if(e.prefix){if(e.prefix.length>1)throw new Error("only one byte as prefix supported");if(i=e.prefix.charCodeAt(0),i&&60>i||i>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 r=0;r<e.intermediates.length;++r){let n=e.intermediates.charCodeAt(r);if(32>n||n>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");i<<=8,i|=n}}if(e.final.length!==1)throw new Error("final must be a single byte");let s=e.final.charCodeAt(0);if(t[0]>s||s>t[1])throw new Error(`final must be in range ${t[0]} .. ${t[1]}`);return i<<=8,i|=s,i}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 i=this._identifier(e,[48,126]);this._escHandlers[i]===void 0&&(this._escHandlers[i]=[]);let s=this._escHandlers[i];return s.push(t),{dispose:()=>{let r=s.indexOf(t);r!==-1&&s.splice(r,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 i=this._identifier(e);this._csiHandlers[i]===void 0&&(this._csiHandlers[i]=[]);let s=this._csiHandlers[i];return s.push(t),{dispose:()=>{let r=s.indexOf(t);r!==-1&&s.splice(r,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,i,s,r){this._parseStack.state=e,this._parseStack.handlers=t,this._parseStack.handlerPos=i,this._parseStack.transition=s,this._parseStack.chunkPos=r}parse(e,t,i){let s=0,r=0,n=0,l;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,n=this._parseStack.chunkPos+1;else{if(i===void 0||this._parseStack.state===1)throw this._parseStack.state=1,new Error("improper continuation due to previous async handler, giving up parsing");let a=this._parseStack.handlers,o=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(i===!1&&o>-1){for(;o>=0&&(l=a[o](this._params),l!==!0);o--)if(l instanceof Promise)return this._parseStack.handlerPos=o,l}this._parseStack.handlers=[];break;case 4:if(i===!1&&o>-1){for(;o>=0&&(l=a[o](),l!==!0);o--)if(l instanceof Promise)return this._parseStack.handlerPos=o,l}this._parseStack.handlers=[];break;case 6:if(s=e[this._parseStack.chunkPos],l=this._dcsParser.unhook(s!==24&&s!==26,i),l)return l;s===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(s=e[this._parseStack.chunkPos],l=this._oscParser.end(s!==24&&s!==26,i),l)return l;s===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break}this._parseStack.state=0,n=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=this._parseStack.transition&15}for(let a=n;a<t;++a){switch(s=e[a],r=this._transitions.table[this.currentState<<8|(s<160?s:Xt)],r>>4){case 2:for(let f=a+1;;++f){if(f>=t||(s=e[f])<32||s>126&&s<Xt){this._printHandler(e,a,f),a=f-1;break}if(++f>=t||(s=e[f])<32||s>126&&s<Xt){this._printHandler(e,a,f),a=f-1;break}if(++f>=t||(s=e[f])<32||s>126&&s<Xt){this._printHandler(e,a,f),a=f-1;break}if(++f>=t||(s=e[f])<32||s>126&&s<Xt){this._printHandler(e,a,f),a=f-1;break}}break;case 3:this._executeHandlers[s]?this._executeHandlers[s]():this._executeHandlerFb(s),this.precedingJoinState=0;break;case 0:break;case 1:if(this._errorHandler({position:a,code:s,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:let o=this._csiHandlers[this._collect<<8|s],c=o?o.length-1:-1;for(;c>=0&&(l=o[c](this._params),l!==!0);c--)if(l instanceof Promise)return this._preserveStack(3,o,c,r,a),l;c<0&&this._csiHandlerFb(this._collect<<8|s,this._params),this.precedingJoinState=0;break;case 8:do switch(s){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(s-48)}while(++a<t&&(s=e[a])>47&&s<60);a--;break;case 9:this._collect<<=8,this._collect|=s;break;case 10:let u=this._escHandlers[this._collect<<8|s],_=u?u.length-1:-1;for(;_>=0&&(l=u[_](),l!==!0);_--)if(l instanceof Promise)return this._preserveStack(4,u,_,r,a),l;_<0&&this._escHandlerFb(this._collect<<8|s),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|s,this._params);break;case 13:for(let f=a+1;;++f)if(f>=t||(s=e[f])===24||s===26||s===27||s>127&&s<Xt){this._dcsParser.put(e,a,f),a=f-1;break}break;case 14:if(l=this._dcsParser.unhook(s!==24&&s!==26),l)return this._preserveStack(6,[],0,r,a),l;s===27&&(r|=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 f=a+1;;f++)if(f>=t||(s=e[f])<32||s>127&&s<Xt){this._oscParser.put(e,a,f),a=f-1;break}break;case 6:if(l=this._oscParser.end(s!==24&&s!==26),l)return this._preserveStack(5,[],0,r,a),l;s===27&&(r|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break}this.currentState=r&15}}},T2=/^([\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})$/,D2=/^[\da-f]+$/;function Y_(e){if(!e)return;let t=e.toLowerCase();if(t.indexOf("rgb:")===0){t=t.slice(4);let i=T2.exec(t);if(i){let s=i[1]?15:i[4]?255:i[7]?4095:65535;return[Math.round(parseInt(i[1]||i[4]||i[7]||i[10],16)/s*255),Math.round(parseInt(i[2]||i[5]||i[8]||i[11],16)/s*255),Math.round(parseInt(i[3]||i[6]||i[9]||i[12],16)/s*255)]}}else if(t.indexOf("#")===0&&(t=t.slice(1),D2.exec(t)&&[3,6,9,12].includes(t.length))){let i=t.length/3,s=[0,0,0];for(let r=0;r<3;++r){let n=parseInt(t.slice(i*r,i*r+i),16);s[r]=i===1?n<<4:i===2?n:i===3?n>>4:n>>8}return s}}function xc(e,t){let i=e.toString(16),s=i.length<2?"0"+i:i;switch(t){case 4:return i[0];case 8:return s;case 12:return(s+s).slice(0,3);default:return s+s}}function M2(e,t=16){let[i,s,r]=e;return`rgb:${xc(i,t)}/${xc(s,t)}/${xc(r,t)}`}var R2={"(":0,")":1,"*":2,"+":3,"-":1,".":2},Ji=131072,V_=10;function I_(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 X_=5e3,$_=0,B2=class extends se{constructor(e,t,i,s,r,n,l,a,o=new k2){super(),this._bufferService=e,this._charsetService=t,this._coreService=i,this._logService=s,this._optionsService=r,this._oscLinkService=n,this._coreMouseService=l,this._unicodeService=a,this._parser=o,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new Fb,this._utf8Decoder=new Zb,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=ze.clone(),this._eraseAttrDataInternal=ze.clone(),this._onRequestBell=this._register(new H),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this._register(new H),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this._register(new H),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this._register(new H),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this._register(new H),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this._register(new H),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this._register(new H),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this._register(new H),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this._register(new H),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this._register(new H),this.onLineFeed=this._onLineFeed.event,this._onScroll=this._register(new H),this.onScroll=this._onScroll.event,this._onTitleChange=this._register(new H),this.onTitleChange=this._onTitleChange.event,this._onColor=this._register(new H),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 nu(this._bufferService),this._activeBuffer=this._bufferService.buffer,this._register(this._bufferService.buffers.onBufferActivate(c=>this._activeBuffer=c.activeBuffer)),this._parser.setCsiHandlerFallback((c,u)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(c),params:u.toArray()})}),this._parser.setEscHandlerFallback(c=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(c)})}),this._parser.setExecuteHandlerFallback(c=>{this._logService.debug("Unknown EXECUTE code: ",{code:c})}),this._parser.setOscHandlerFallback((c,u,_)=>{this._logService.debug("Unknown OSC code: ",{identifier:c,action:u,data:_})}),this._parser.setDcsHandlerFallback((c,u,_)=>{u==="HOOK"&&(_=_.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(c),action:u,payload:_})}),this._parser.setPrintHandler((c,u,_)=>this.print(c,u,_)),this._parser.registerCsiHandler({final:"@"},c=>this.insertChars(c)),this._parser.registerCsiHandler({intermediates:" ",final:"@"},c=>this.scrollLeft(c)),this._parser.registerCsiHandler({final:"A"},c=>this.cursorUp(c)),this._parser.registerCsiHandler({intermediates:" ",final:"A"},c=>this.scrollRight(c)),this._parser.registerCsiHandler({final:"B"},c=>this.cursorDown(c)),this._parser.registerCsiHandler({final:"C"},c=>this.cursorForward(c)),this._parser.registerCsiHandler({final:"D"},c=>this.cursorBackward(c)),this._parser.registerCsiHandler({final:"E"},c=>this.cursorNextLine(c)),this._parser.registerCsiHandler({final:"F"},c=>this.cursorPrecedingLine(c)),this._parser.registerCsiHandler({final:"G"},c=>this.cursorCharAbsolute(c)),this._parser.registerCsiHandler({final:"H"},c=>this.cursorPosition(c)),this._parser.registerCsiHandler({final:"I"},c=>this.cursorForwardTab(c)),this._parser.registerCsiHandler({final:"J"},c=>this.eraseInDisplay(c,!1)),this._parser.registerCsiHandler({prefix:"?",final:"J"},c=>this.eraseInDisplay(c,!0)),this._parser.registerCsiHandler({final:"K"},c=>this.eraseInLine(c,!1)),this._parser.registerCsiHandler({prefix:"?",final:"K"},c=>this.eraseInLine(c,!0)),this._parser.registerCsiHandler({final:"L"},c=>this.insertLines(c)),this._parser.registerCsiHandler({final:"M"},c=>this.deleteLines(c)),this._parser.registerCsiHandler({final:"P"},c=>this.deleteChars(c)),this._parser.registerCsiHandler({final:"S"},c=>this.scrollUp(c)),this._parser.registerCsiHandler({final:"T"},c=>this.scrollDown(c)),this._parser.registerCsiHandler({final:"X"},c=>this.eraseChars(c)),this._parser.registerCsiHandler({final:"Z"},c=>this.cursorBackwardTab(c)),this._parser.registerCsiHandler({final:"`"},c=>this.charPosAbsolute(c)),this._parser.registerCsiHandler({final:"a"},c=>this.hPositionRelative(c)),this._parser.registerCsiHandler({final:"b"},c=>this.repeatPrecedingCharacter(c)),this._parser.registerCsiHandler({final:"c"},c=>this.sendDeviceAttributesPrimary(c)),this._parser.registerCsiHandler({prefix:">",final:"c"},c=>this.sendDeviceAttributesSecondary(c)),this._parser.registerCsiHandler({final:"d"},c=>this.linePosAbsolute(c)),this._parser.registerCsiHandler({final:"e"},c=>this.vPositionRelative(c)),this._parser.registerCsiHandler({final:"f"},c=>this.hVPosition(c)),this._parser.registerCsiHandler({final:"g"},c=>this.tabClear(c)),this._parser.registerCsiHandler({final:"h"},c=>this.setMode(c)),this._parser.registerCsiHandler({prefix:"?",final:"h"},c=>this.setModePrivate(c)),this._parser.registerCsiHandler({final:"l"},c=>this.resetMode(c)),this._parser.registerCsiHandler({prefix:"?",final:"l"},c=>this.resetModePrivate(c)),this._parser.registerCsiHandler({final:"m"},c=>this.charAttributes(c)),this._parser.registerCsiHandler({final:"n"},c=>this.deviceStatus(c)),this._parser.registerCsiHandler({prefix:"?",final:"n"},c=>this.deviceStatusPrivate(c)),this._parser.registerCsiHandler({intermediates:"!",final:"p"},c=>this.softReset(c)),this._parser.registerCsiHandler({intermediates:" ",final:"q"},c=>this.setCursorStyle(c)),this._parser.registerCsiHandler({final:"r"},c=>this.setScrollRegion(c)),this._parser.registerCsiHandler({final:"s"},c=>this.saveCursor(c)),this._parser.registerCsiHandler({final:"t"},c=>this.windowOptions(c)),this._parser.registerCsiHandler({final:"u"},c=>this.restoreCursor(c)),this._parser.registerCsiHandler({intermediates:"'",final:"}"},c=>this.insertColumns(c)),this._parser.registerCsiHandler({intermediates:"'",final:"~"},c=>this.deleteColumns(c)),this._parser.registerCsiHandler({intermediates:'"',final:"q"},c=>this.selectProtected(c)),this._parser.registerCsiHandler({intermediates:"$",final:"p"},c=>this.requestMode(c,!0)),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},c=>this.requestMode(c,!1)),this._parser.setExecuteHandler(R.BEL,()=>this.bell()),this._parser.setExecuteHandler(R.LF,()=>this.lineFeed()),this._parser.setExecuteHandler(R.VT,()=>this.lineFeed()),this._parser.setExecuteHandler(R.FF,()=>this.lineFeed()),this._parser.setExecuteHandler(R.CR,()=>this.carriageReturn()),this._parser.setExecuteHandler(R.BS,()=>this.backspace()),this._parser.setExecuteHandler(R.HT,()=>this.tab()),this._parser.setExecuteHandler(R.SO,()=>this.shiftOut()),this._parser.setExecuteHandler(R.SI,()=>this.shiftIn()),this._parser.setExecuteHandler(ga.IND,()=>this.index()),this._parser.setExecuteHandler(ga.NEL,()=>this.nextLine()),this._parser.setExecuteHandler(ga.HTS,()=>this.tabSet()),this._parser.registerOscHandler(0,new Nt(c=>(this.setTitle(c),this.setIconName(c),!0))),this._parser.registerOscHandler(1,new Nt(c=>this.setIconName(c))),this._parser.registerOscHandler(2,new Nt(c=>this.setTitle(c))),this._parser.registerOscHandler(4,new Nt(c=>this.setOrReportIndexedColor(c))),this._parser.registerOscHandler(8,new Nt(c=>this.setHyperlink(c))),this._parser.registerOscHandler(10,new Nt(c=>this.setOrReportFgColor(c))),this._parser.registerOscHandler(11,new Nt(c=>this.setOrReportBgColor(c))),this._parser.registerOscHandler(12,new Nt(c=>this.setOrReportCursorColor(c))),this._parser.registerOscHandler(104,new Nt(c=>this.restoreIndexedColor(c))),this._parser.registerOscHandler(110,new Nt(c=>this.restoreFgColor(c))),this._parser.registerOscHandler(111,new Nt(c=>this.restoreBgColor(c))),this._parser.registerOscHandler(112,new Nt(c=>this.restoreCursorColor(c))),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 c in Xe)this._parser.registerEscHandler({intermediates:"(",final:c},()=>this.selectCharset("("+c)),this._parser.registerEscHandler({intermediates:")",final:c},()=>this.selectCharset(")"+c)),this._parser.registerEscHandler({intermediates:"*",final:c},()=>this.selectCharset("*"+c)),this._parser.registerEscHandler({intermediates:"+",final:c},()=>this.selectCharset("+"+c)),this._parser.registerEscHandler({intermediates:"-",final:c},()=>this.selectCharset("-"+c)),this._parser.registerEscHandler({intermediates:".",final:c},()=>this.selectCharset("."+c)),this._parser.registerEscHandler({intermediates:"/",final:c},()=>this.selectCharset("/"+c));this._parser.registerEscHandler({intermediates:"#",final:"8"},()=>this.screenAlignmentPattern()),this._parser.setErrorHandler(c=>(this._logService.error("Parsing error: ",c),c)),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new W_((c,u)=>this.requestStatusString(c,u)))}getAttrData(){return this._curAttrData}_preserveStack(e,t,i,s){this._parseStack.paused=!0,this._parseStack.cursorStartX=e,this._parseStack.cursorStartY=t,this._parseStack.decodedLength=i,this._parseStack.position=s}_logSlowResolvingAsync(e){this._logService.logLevel<=3&&Promise.race([e,new Promise((t,i)=>setTimeout(()=>i("#SLOW_TIMEOUT"),X_))]).catch(t=>{if(t!=="#SLOW_TIMEOUT")throw t;console.warn(`async parser handler taking longer than ${X_} ms`)})}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(e,t){let i,s=this._activeBuffer.x,r=this._activeBuffer.y,n=0,l=this._parseStack.paused;if(l){if(i=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,t))return this._logSlowResolvingAsync(i),i;s=this._parseStack.cursorStartX,r=this._parseStack.cursorStartY,this._parseStack.paused=!1,e.length>Ji&&(n=this._parseStack.position+Ji)}if(this._logService.logLevel<=1&&this._logService.debug(`parsing data ${typeof e=="string"?` "${e}"`:` "${Array.prototype.map.call(e,c=>String.fromCharCode(c)).join("")}"`}`),this._logService.logLevel===0&&this._logService.trace("parsing data (codes)",typeof e=="string"?e.split("").map(c=>c.charCodeAt(0)):e),this._parseBuffer.length<e.length&&this._parseBuffer.length<Ji&&(this._parseBuffer=new Uint32Array(Math.min(e.length,Ji))),l||this._dirtyRowTracker.clearRange(),e.length>Ji)for(let c=n;c<e.length;c+=Ji){let u=c+Ji<e.length?c+Ji:e.length,_=typeof e=="string"?this._stringDecoder.decode(e.substring(c,u),this._parseBuffer):this._utf8Decoder.decode(e.subarray(c,u),this._parseBuffer);if(i=this._parser.parse(this._parseBuffer,_))return this._preserveStack(s,r,_,c),this._logSlowResolvingAsync(i),i}else if(!l){let c=typeof e=="string"?this._stringDecoder.decode(e,this._parseBuffer):this._utf8Decoder.decode(e,this._parseBuffer);if(i=this._parser.parse(this._parseBuffer,c))return this._preserveStack(s,r,c,0),this._logSlowResolvingAsync(i),i}(this._activeBuffer.x!==s||this._activeBuffer.y!==r)&&this._onCursorMove.fire();let a=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),o=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);o<this._bufferService.rows&&this._onRequestRefreshRows.fire({start:Math.min(o,this._bufferService.rows-1),end:Math.min(a,this._bufferService.rows-1)})}print(e,t,i){let s,r,n=this._charsetService.charset,l=this._optionsService.rawOptions.screenReaderMode,a=this._bufferService.cols,o=this._coreService.decPrivateModes.wraparound,c=this._coreService.modes.insertMode,u=this._curAttrData,_=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&i-t>0&&_.getWidth(this._activeBuffer.x-1)===2&&_.setCellFromCodepoint(this._activeBuffer.x-1,0,1,u);let f=this._parser.precedingJoinState;for(let d=t;d<i;++d){if(s=e[d],s<127&&n){let m=n[String.fromCharCode(s)];m&&(s=m.charCodeAt(0))}let g=this._unicodeService.charProperties(s,f);r=js.extractWidth(g);let y=js.extractShouldJoin(g),w=y?js.extractWidth(f):0;if(f=g,l&&this._onA11yChar.fire(is(s)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+r-w>a){if(o){let m=_,p=this._activeBuffer.x-w;for(this._activeBuffer.x=w,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),_=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),w>0&&_ instanceof Tn&&_.copyCellsFrom(m,p,0,w,!1);p<a;)m.setCellFromCodepoint(p++,0,1,u)}else if(this._activeBuffer.x=a-1,r===2)continue}if(y&&this._activeBuffer.x){let m=_.getWidth(this._activeBuffer.x-1)?1:2;_.addCodepointToCell(this._activeBuffer.x-m,s,r);for(let p=r-w;--p>=0;)_.setCellFromCodepoint(this._activeBuffer.x++,0,0,u);continue}if(c&&(_.insertCells(this._activeBuffer.x,r-w,this._activeBuffer.getNullCell(u)),_.getWidth(a-1)===2&&_.setCellFromCodepoint(a-1,0,1,u)),_.setCellFromCodepoint(this._activeBuffer.x++,s,r,u),r>0)for(;--r;)_.setCellFromCodepoint(this._activeBuffer.x++,0,0,u)}this._parser.precedingJoinState=f,this._activeBuffer.x<a&&i-t>0&&_.getWidth(this._activeBuffer.x)===0&&!_.hasContent(this._activeBuffer.x)&&_.setCellFromCodepoint(this._activeBuffer.x,0,1,u),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(e,t){return e.final==="t"&&!e.prefix&&!e.intermediates?this._parser.registerCsiHandler(e,i=>I_(i.params[0],this._optionsService.rawOptions.windowOptions)?t(i):!0):this._parser.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._parser.registerDcsHandler(e,new W_(t))}registerEscHandler(e,t){return this._parser.registerEscHandler(e,t)}registerOscHandler(e,t){return this._parser.registerOscHandler(e,new Nt(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(){var e;if(!this._coreService.decPrivateModes.reverseWraparound)return this._restrictCursor(),this._activeBuffer.x>0&&this._activeBuffer.x--,!0;if(this._restrictCursor(this._bufferService.cols),this._activeBuffer.x>0)this._activeBuffer.x--;else if(this._activeBuffer.x===0&&this._activeBuffer.y>this._activeBuffer.scrollTop&&this._activeBuffer.y<=this._activeBuffer.scrollBottom&&((e=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y))!=null&&e.isWrapped)){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);t.hasWidth(this._activeBuffer.x)&&!t.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,i,s=!1,r=!1){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);n.replaceCells(t,i,this._activeBuffer.getNullCell(this._eraseAttrData()),r),s&&(n.isWrapped=!1)}_resetBufferLine(e,t=!1){let i=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);i&&(i.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),t),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+e),i.isWrapped=!1)}eraseInDisplay(e,t=!1){var s;this._restrictCursor(this._bufferService.cols);let i;switch(e.params[0]){case 0:for(i=this._activeBuffer.y,this._dirtyRowTracker.markDirty(i),this._eraseInBufferLine(i++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,t);i<this._bufferService.rows;i++)this._resetBufferLine(i,t);this._dirtyRowTracker.markDirty(i);break;case 1:for(i=this._activeBuffer.y,this._dirtyRowTracker.markDirty(i),this._eraseInBufferLine(i,0,this._activeBuffer.x+1,!0,t),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(i+1).isWrapped=!1);i--;)this._resetBufferLine(i,t);this._dirtyRowTracker.markDirty(0);break;case 2:if(this._optionsService.rawOptions.scrollOnEraseInDisplay){for(i=this._bufferService.rows,this._dirtyRowTracker.markRangeDirty(0,i-1);i--&&!((s=this._activeBuffer.lines.get(this._activeBuffer.ybase+i))!=null&&s.getTrimmedLength()););for(;i>=0;i--)this._bufferService.scroll(this._eraseAttrData())}else{for(i=this._bufferService.rows,this._dirtyRowTracker.markDirty(i-1);i--;)this._resetBufferLine(i,t);this._dirtyRowTracker.markDirty(0)}break;case 3:let r=this._activeBuffer.lines.length-this._bufferService.rows;r>0&&(this._activeBuffer.lines.trimStart(r),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-r,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-r,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 i=this._activeBuffer.ybase+this._activeBuffer.y,s=this._bufferService.rows-1-this._activeBuffer.scrollBottom,r=this._bufferService.rows-1+this._activeBuffer.ybase-s+1;for(;t--;)this._activeBuffer.lines.splice(r-1,1),this._activeBuffer.lines.splice(i,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}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 i=this._activeBuffer.ybase+this._activeBuffer.y,s;for(s=this._bufferService.rows-1-this._activeBuffer.scrollBottom,s=this._bufferService.rows-1+this._activeBuffer.ybase-s;t--;)this._activeBuffer.lines.splice(i,1),this._activeBuffer.lines.splice(s,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(ze));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 i=this._activeBuffer.scrollTop;i<=this._activeBuffer.scrollBottom;++i){let s=this._activeBuffer.lines.get(this._activeBuffer.ybase+i);s.deleteCells(0,t,this._activeBuffer.getNullCell(this._eraseAttrData())),s.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 i=this._activeBuffer.scrollTop;i<=this._activeBuffer.scrollBottom;++i){let s=this._activeBuffer.lines.get(this._activeBuffer.ybase+i);s.insertCells(0,t,this._activeBuffer.getNullCell(this._eraseAttrData())),s.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 i=this._activeBuffer.scrollTop;i<=this._activeBuffer.scrollBottom;++i){let s=this._activeBuffer.lines.get(this._activeBuffer.ybase+i);s.insertCells(this._activeBuffer.x,t,this._activeBuffer.getNullCell(this._eraseAttrData())),s.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 i=this._activeBuffer.scrollTop;i<=this._activeBuffer.scrollBottom;++i){let s=this._activeBuffer.lines.get(this._activeBuffer.ybase+i);s.deleteCells(this._activeBuffer.x,t,this._activeBuffer.getNullCell(this._eraseAttrData())),s.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 i=e.params[0]||1,s=js.extractWidth(t),r=this._activeBuffer.x-s,n=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(r),l=new Uint32Array(n.length*i),a=0;for(let c=0;c<n.length;){let u=n.codePointAt(c)||0;l[a++]=u,c+=u>65535?2:1}let o=a;for(let c=1;c<i;++c)l.copyWithin(o,0,a),o+=a;return this.print(l,0,o),!0}sendDeviceAttributesPrimary(e){return e.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(R.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(R.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(e){return e.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(R.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(R.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(e.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(R.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,zs),this._charsetService.setgCharset(1,zs),this._charsetService.setgCharset(2,zs),this._charsetService.setgCharset(3,zs);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){(y=>(y[y.NOT_RECOGNIZED=0]="NOT_RECOGNIZED",y[y.SET=1]="SET",y[y.RESET=2]="RESET",y[y.PERMANENTLY_SET=3]="PERMANENTLY_SET",y[y.PERMANENTLY_RESET=4]="PERMANENTLY_RESET"))(void 0||(i={}));let s=this._coreService.decPrivateModes,{activeProtocol:r,activeEncoding:n}=this._coreMouseService,l=this._coreService,{buffers:a,cols:o}=this._bufferService,{active:c,alt:u}=a,_=this._optionsService.rawOptions,f=(y,w)=>(l.triggerDataEvent(`${R.ESC}[${t?"":"?"}${y};${w}$y`),!0),d=y=>y?1:2,g=e.params[0];return t?g===2?f(g,4):g===4?f(g,d(l.modes.insertMode)):g===12?f(g,3):g===20?f(g,d(_.convertEol)):f(g,0):g===1?f(g,d(s.applicationCursorKeys)):g===3?f(g,_.windowOptions.setWinLines?o===80?2:o===132?1:0:0):g===6?f(g,d(s.origin)):g===7?f(g,d(s.wraparound)):g===8?f(g,3):g===9?f(g,d(r==="X10")):g===12?f(g,d(_.cursorBlink)):g===25?f(g,d(!l.isCursorHidden)):g===45?f(g,d(s.reverseWraparound)):g===66?f(g,d(s.applicationKeypad)):g===67?f(g,4):g===1e3?f(g,d(r==="VT200")):g===1002?f(g,d(r==="DRAG")):g===1003?f(g,d(r==="ANY")):g===1004?f(g,d(s.sendFocus)):g===1005?f(g,4):g===1006?f(g,d(n==="SGR")):g===1015?f(g,4):g===1016?f(g,d(n==="SGR_PIXELS")):g===1048?f(g,1):g===47||g===1047||g===1049?f(g,d(c===u)):g===2004?f(g,d(s.bracketedPasteMode)):g===2026?f(g,d(s.synchronizedOutput)):f(g,0)}_updateAttrColor(e,t,i,s,r){return t===2?(e|=50331648,e&=-16777216,e|=wl.fromColorRGB([i,s,r])):t===5&&(e&=-50331904,e|=33554432|i&255),e}_extractColor(e,t,i){let s=[0,0,-1,0,0,0],r=0,n=0;do{if(s[n+r]=e.params[t+n],e.hasSubParams(t+n)){let l=e.getSubParams(t+n),a=0;do s[1]===5&&(r=1),s[n+a+1+r]=l[a];while(++a<l.length&&a+n+1+r<s.length);break}if(s[1]===5&&n+r>=2||s[1]===2&&n+r>=5)break;s[1]&&(r=1)}while(++n+t<e.length&&n+r<s.length);for(let l=2;l<s.length;++l)s[l]===-1&&(s[l]=0);switch(s[0]){case 38:i.fg=this._updateAttrColor(i.fg,s[1],s[3],s[4],s[5]);break;case 48:i.bg=this._updateAttrColor(i.bg,s[1],s[3],s[4],s[5]);break;case 58:i.extended=i.extended.clone(),i.extended.underlineColor=this._updateAttrColor(i.extended.underlineColor,s[1],s[3],s[4],s[5])}return n}_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=ze.fg,e.bg=ze.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,i,s=this._curAttrData;for(let r=0;r<t;r++)i=e.params[r],i>=30&&i<=37?(s.fg&=-50331904,s.fg|=16777216|i-30):i>=40&&i<=47?(s.bg&=-50331904,s.bg|=16777216|i-40):i>=90&&i<=97?(s.fg&=-50331904,s.fg|=16777216|i-90|8):i>=100&&i<=107?(s.bg&=-50331904,s.bg|=16777216|i-100|8):i===0?this._processSGR0(s):i===1?s.fg|=134217728:i===3?s.bg|=67108864:i===4?(s.fg|=268435456,this._processUnderline(e.hasSubParams(r)?e.getSubParams(r)[0]:1,s)):i===5?s.fg|=536870912:i===7?s.fg|=67108864:i===8?s.fg|=1073741824:i===9?s.fg|=2147483648:i===2?s.bg|=134217728:i===21?this._processUnderline(2,s):i===22?(s.fg&=-134217729,s.bg&=-134217729):i===23?s.bg&=-67108865:i===24?(s.fg&=-268435457,this._processUnderline(0,s)):i===25?s.fg&=-536870913:i===27?s.fg&=-67108865:i===28?s.fg&=-1073741825:i===29?s.fg&=2147483647:i===39?(s.fg&=-67108864,s.fg|=ze.fg&16777215):i===49?(s.bg&=-67108864,s.bg|=ze.bg&16777215):i===38||i===48||i===58?r+=this._extractColor(e,r,s):i===53?s.bg|=1073741824:i===55?s.bg&=-1073741825:i===59?(s.extended=s.extended.clone(),s.extended.underlineColor=-1,s.updateExtended()):i===100?(s.fg&=-67108864,s.fg|=ze.fg&16777215,s.bg&=-67108864,s.bg|=ze.bg&16777215):this._logService.debug("Unknown SGR attribute: %d.",i);return!0}deviceStatus(e){switch(e.params[0]){case 5:this._coreService.triggerDataEvent(`${R.ESC}[0n`);break;case 6:let t=this._activeBuffer.y+1,i=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${R.ESC}[${t};${i}R`);break}return!0}deviceStatusPrivate(e){switch(e.params[0]){case 6:let t=this._activeBuffer.y+1,i=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${R.ESC}[?${t};${i}R`);break}return!0}softReset(e){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=ze.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 i=t%2===1;this._coreService.decPrivateModes.cursorBlink=i}return!0}setScrollRegion(e){let t=e.params[0]||1,i;return(e.length<2||(i=e.params[1])>this._bufferService.rows||i===0)&&(i=this._bufferService.rows),i>t&&(this._activeBuffer.scrollTop=t-1,this._activeBuffer.scrollBottom=i-1,this._setCursor(0,0)),!0}windowOptions(e){if(!I_(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(`${R.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:(t===0||t===2)&&(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>V_&&this._windowTitleStack.shift()),(t===0||t===1)&&(this._iconNameStack.push(this._iconName),this._iconNameStack.length>V_&&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=[],i=e.split(";");for(;i.length>1;){let s=i.shift(),r=i.shift();if(/^\d+$/.exec(s)){let n=parseInt(s);if(G_(n))if(r==="?")t.push({type:0,index:n});else{let l=Y_(r);l&&t.push({type:1,index:n,color:l})}}}return t.length&&this._onColor.fire(t),!0}setHyperlink(e){let t=e.indexOf(";");if(t===-1)return!0;let i=e.slice(0,t).trim(),s=e.slice(t+1);return s?this._createHyperlink(i,s):i.trim()?!1:this._finishHyperlink()}_createHyperlink(e,t){this._getCurrentLinkId()&&this._finishHyperlink();let i=e.split(":"),s,r=i.findIndex(n=>n.startsWith("id="));return r!==-1&&(s=i[r].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:s,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 i=e.split(";");for(let s=0;s<i.length&&!(t>=this._specialColors.length);++s,++t)if(i[s]==="?")this._onColor.fire([{type:0,index:this._specialColors[t]}]);else{let r=Y_(i[s]);r&&this._onColor.fire([{type:1,index:this._specialColors[t],color:r}])}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=[],i=e.split(";");for(let s=0;s<i.length;++s)if(/^\d+$/.exec(i[s])){let r=parseInt(i[s]);G_(r)&&t.push({type:2,index:r})}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,zs),!0}selectCharset(e){return e.length!==2?(this.selectDefaultCharset(),!0):(e[0]==="/"||this._charsetService.setgCharset(R2[e[0]],Xe[e[1]]||zs),!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=ze.clone(),this._eraseAttrDataInternal=ze.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 ii;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 i=this._activeBuffer.ybase+this._activeBuffer.y+t,s=this._activeBuffer.lines.get(i);s&&(s.fill(e),s.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(e,t){let i=l=>(this._coreService.triggerDataEvent(`${R.ESC}${l}${R.ESC}\\`),!0),s=this._bufferService.buffer,r=this._optionsService.rawOptions;return i(e==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:e==='"p'?'P1$r61;1"p':e==="r"?`P1$r${s.scrollTop+1};${s.scrollBottom+1}r`:e==="m"?"P1$r0m":e===" q"?`P1$r${{block:2,underline:4,bar:6}[r.cursorStyle]-(r.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(e,t){this._dirtyRowTracker.markRangeDirty(e,t)}},nu=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&&($_=e,e=t,t=$_),e<this.start&&(this.start=e),t>this.end&&(this.end=t)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};nu=Ae([q(0,bt)],nu);function G_(e){return 0<=e&&e<256}var A2=5e7,F_=12,N2=50,O2=class extends se{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 H),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 i;for(;i=this._writeBuffer.shift();){this._action(i);let s=this._callbacks.shift();s&&s()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(e,t){if(this._pendingData>A2)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 i=e||performance.now();for(;this._writeBuffer.length>this._bufferOffset;){let s=this._writeBuffer[this._bufferOffset],r=this._action(s,t);if(r){let l=a=>performance.now()-i>=F_?setTimeout(()=>this._innerWrite(0,a)):this._innerWrite(i,a);r.catch(a=>(queueMicrotask(()=>{throw a}),Promise.resolve(!1))).then(l);return}let n=this._callbacks[this._bufferOffset];if(n&&n(),this._bufferOffset++,this._pendingData-=s.length,performance.now()-i>=F_)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>N2&&(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()}},lu=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 a=t.addMarker(t.ybase+t.y),o={data:e,id:this._nextId++,lines:[a]};return a.onDispose(()=>this._removeMarkerFromLink(o,a)),this._dataByLinkId.set(o.id,o),o.id}let i=e,s=this._getEntryIdKey(i),r=this._entriesWithId.get(s);if(r)return this.addLineToLink(r.id,t.ybase+t.y),r.id;let n=t.addMarker(t.ybase+t.y),l={id:this._nextId++,key:this._getEntryIdKey(i),data:i,lines:[n]};return n.onDispose(()=>this._removeMarkerFromLink(l,n)),this._entriesWithId.set(l.key,l),this._dataByLinkId.set(l.id,l),l.id}addLineToLink(e,t){let i=this._dataByLinkId.get(e);if(i&&i.lines.every(s=>s.line!==t)){let s=this._bufferService.buffer.addMarker(t);i.lines.push(s),s.onDispose(()=>this._removeMarkerFromLink(i,s))}}getLinkData(e){var t;return(t=this._dataByLinkId.get(e))==null?void 0:t.data}_getEntryIdKey(e){return`${e.id};;${e.uri}`}_removeMarkerFromLink(e,t){let i=e.lines.indexOf(t);i!==-1&&(e.lines.splice(i,1),e.lines.length===0&&(e.data.id!==void 0&&this._entriesWithId.delete(e.key),this._dataByLinkId.delete(e.id)))}};lu=Ae([q(0,bt)],lu);var Z_=!1,L2=class extends se{constructor(e){super(),this._windowsWrappingHeuristics=this._register(new Ir),this._onBinary=this._register(new H),this.onBinary=this._onBinary.event,this._onData=this._register(new H),this.onData=this._onData.event,this._onLineFeed=this._register(new H),this.onLineFeed=this._onLineFeed.event,this._onResize=this._register(new H),this.onResize=this._onResize.event,this._onWriteParsed=this._register(new H),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this._register(new H),this._instantiationService=new n2,this.optionsService=this._register(new p2(e)),this._instantiationService.setService(wt,this.optionsService),this._bufferService=this._register(this._instantiationService.createInstance(tu)),this._instantiationService.setService(bt,this._bufferService),this._logService=this._register(this._instantiationService.createInstance(eu)),this._instantiationService.setService(zv,this._logService),this.coreService=this._register(this._instantiationService.createInstance(iu)),this._instantiationService.setService(ir,this.coreService),this.coreMouseService=this._register(this._instantiationService.createInstance(su)),this._instantiationService.setService(Lv,this.coreMouseService),this.unicodeService=this._register(this._instantiationService.createInstance(js)),this._instantiationService.setService(tw,this.unicodeService),this._charsetService=this._instantiationService.createInstance(y2),this._instantiationService.setService(ew,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(lu),this._instantiationService.setService(jv,this._oscLinkService),this._inputHandler=this._register(new B2(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this._register(ut.forward(this._inputHandler.onLineFeed,this._onLineFeed)),this._register(this._inputHandler),this._register(ut.forward(this._bufferService.onResize,this._onResize)),this._register(ut.forward(this.coreService.onData,this._onData)),this._register(ut.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 O2((t,i)=>this._inputHandler.parse(t,i))),this._register(ut.forward(this._writeBuffer.onWriteParsed,this._onWriteParsed))}get onScroll(){return this._onScrollApi||(this._onScrollApi=this._register(new H),this._onScroll.event(e=>{var t;(t=this._onScrollApi)==null||t.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&&!Z_&&(this._logService.warn("writeSync is unreliable and will be removed soon."),Z_=!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,p0),t=Math.max(t,m0),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(K_.bind(null,this._bufferService))),e.push(this.registerCsiHandler({final:"H"},()=>(K_(this._bufferService),!1))),this._windowsWrappingHeuristics.value=Ee(()=>{for(let t of e)t.dispose()})}}},z2={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 j2(e,t,i,s){var l;let r={type:0,cancel:!1,key:void 0},n=(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?r.key=R.ESC+"OA":r.key=R.ESC+"[A":e.key==="UIKeyInputLeftArrow"?t?r.key=R.ESC+"OD":r.key=R.ESC+"[D":e.key==="UIKeyInputRightArrow"?t?r.key=R.ESC+"OC":r.key=R.ESC+"[C":e.key==="UIKeyInputDownArrow"&&(t?r.key=R.ESC+"OB":r.key=R.ESC+"[B");break;case 8:r.key=e.ctrlKey?"\b":R.DEL,e.altKey&&(r.key=R.ESC+r.key);break;case 9:if(e.shiftKey){r.key=R.ESC+"[Z";break}r.key=R.HT,r.cancel=!0;break;case 13:r.key=e.altKey?R.ESC+R.CR:R.CR,r.cancel=!0;break;case 27:r.key=R.ESC,e.altKey&&(r.key=R.ESC+R.ESC),r.cancel=!0;break;case 37:if(e.metaKey)break;n?r.key=R.ESC+"[1;"+(n+1)+"D":t?r.key=R.ESC+"OD":r.key=R.ESC+"[D";break;case 39:if(e.metaKey)break;n?r.key=R.ESC+"[1;"+(n+1)+"C":t?r.key=R.ESC+"OC":r.key=R.ESC+"[C";break;case 38:if(e.metaKey)break;n?r.key=R.ESC+"[1;"+(n+1)+"A":t?r.key=R.ESC+"OA":r.key=R.ESC+"[A";break;case 40:if(e.metaKey)break;n?r.key=R.ESC+"[1;"+(n+1)+"B":t?r.key=R.ESC+"OB":r.key=R.ESC+"[B";break;case 45:!e.shiftKey&&!e.ctrlKey&&(r.key=R.ESC+"[2~");break;case 46:n?r.key=R.ESC+"[3;"+(n+1)+"~":r.key=R.ESC+"[3~";break;case 36:n?r.key=R.ESC+"[1;"+(n+1)+"H":t?r.key=R.ESC+"OH":r.key=R.ESC+"[H";break;case 35:n?r.key=R.ESC+"[1;"+(n+1)+"F":t?r.key=R.ESC+"OF":r.key=R.ESC+"[F";break;case 33:e.shiftKey?r.type=2:e.ctrlKey?r.key=R.ESC+"[5;"+(n+1)+"~":r.key=R.ESC+"[5~";break;case 34:e.shiftKey?r.type=3:e.ctrlKey?r.key=R.ESC+"[6;"+(n+1)+"~":r.key=R.ESC+"[6~";break;case 112:n?r.key=R.ESC+"[1;"+(n+1)+"P":r.key=R.ESC+"OP";break;case 113:n?r.key=R.ESC+"[1;"+(n+1)+"Q":r.key=R.ESC+"OQ";break;case 114:n?r.key=R.ESC+"[1;"+(n+1)+"R":r.key=R.ESC+"OR";break;case 115:n?r.key=R.ESC+"[1;"+(n+1)+"S":r.key=R.ESC+"OS";break;case 116:n?r.key=R.ESC+"[15;"+(n+1)+"~":r.key=R.ESC+"[15~";break;case 117:n?r.key=R.ESC+"[17;"+(n+1)+"~":r.key=R.ESC+"[17~";break;case 118:n?r.key=R.ESC+"[18;"+(n+1)+"~":r.key=R.ESC+"[18~";break;case 119:n?r.key=R.ESC+"[19;"+(n+1)+"~":r.key=R.ESC+"[19~";break;case 120:n?r.key=R.ESC+"[20;"+(n+1)+"~":r.key=R.ESC+"[20~";break;case 121:n?r.key=R.ESC+"[21;"+(n+1)+"~":r.key=R.ESC+"[21~";break;case 122:n?r.key=R.ESC+"[23;"+(n+1)+"~":r.key=R.ESC+"[23~";break;case 123:n?r.key=R.ESC+"[24;"+(n+1)+"~":r.key=R.ESC+"[24~";break;default:if(e.ctrlKey&&!e.shiftKey&&!e.altKey&&!e.metaKey)e.keyCode>=65&&e.keyCode<=90?r.key=String.fromCharCode(e.keyCode-64):e.keyCode===32?r.key=R.NUL:e.keyCode>=51&&e.keyCode<=55?r.key=String.fromCharCode(e.keyCode-51+27):e.keyCode===56?r.key=R.DEL:e.keyCode===219?r.key=R.ESC:e.keyCode===220?r.key=R.FS:e.keyCode===221&&(r.key=R.GS);else if((!i||s)&&e.altKey&&!e.metaKey){let a=(l=z2[e.keyCode])==null?void 0:l[e.shiftKey?1:0];if(a)r.key=R.ESC+a;else if(e.keyCode>=65&&e.keyCode<=90){let o=e.ctrlKey?e.keyCode-64:e.keyCode+32,c=String.fromCharCode(o);e.shiftKey&&(c=c.toUpperCase()),r.key=R.ESC+c}else if(e.keyCode===32)r.key=R.ESC+(e.ctrlKey?R.NUL:" ");else if(e.key==="Dead"&&e.code.startsWith("Key")){let o=e.code.slice(3,4);e.shiftKey||(o=o.toLowerCase()),r.key=R.ESC+o,r.cancel=!0}}else i&&!e.altKey&&!e.ctrlKey&&!e.shiftKey&&e.metaKey?e.keyCode===65&&(r.type=1):e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.keyCode>=48&&e.key.length===1?r.key=e.key:e.key&&e.ctrlKey&&(e.key==="_"&&(r.key=R.US),e.key==="@"&&(r.key=R.NUL));break}return r}var Ne=0,H2=class{constructor(e){this._getKey=e,this._array=[],this._insertedValues=[],this._flushInsertedTask=new eo,this._isFlushingInserted=!1,this._deletedIndices=[],this._flushDeletedTask=new eo,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((r,n)=>this._getKey(r)-this._getKey(n)),t=0,i=0,s=new Array(this._array.length+this._insertedValues.length);for(let r=0;r<s.length;r++)i>=this._array.length||this._getKey(e[t])<=this._getKey(this._array[i])?(s[r]=e[t],t++):s[r]=this._array[i++];this._array=s,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||(Ne=this._search(t),Ne===-1)||this._getKey(this._array[Ne])!==t)return!1;do if(this._array[Ne]===e)return this._deletedIndices.length===0&&this._flushDeletedTask.enqueue(()=>this._flushDeleted()),this._deletedIndices.push(Ne),!0;while(++Ne<this._array.length&&this._getKey(this._array[Ne])===t);return!1}_flushDeleted(){this._isFlushingDeleted=!0;let e=this._deletedIndices.sort((r,n)=>r-n),t=0,i=new Array(this._array.length-e.length),s=0;for(let r=0;r<this._array.length;r++)e[t]===r?t++:i[s++]=this._array[r];this._array=i,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&&(Ne=this._search(e),!(Ne<0||Ne>=this._array.length)&&this._getKey(this._array[Ne])===e))do yield this._array[Ne];while(++Ne<this._array.length&&this._getKey(this._array[Ne])===e)}forEachByKey(e,t){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(Ne=this._search(e),!(Ne<0||Ne>=this._array.length)&&this._getKey(this._array[Ne])===e))do t(this._array[Ne]);while(++Ne<this._array.length&&this._getKey(this._array[Ne])===e)}values(){return this._flushCleanupInserted(),this._flushCleanupDeleted(),[...this._array].values()}_search(e){let t=0,i=this._array.length-1;for(;i>=t;){let s=t+i>>1,r=this._getKey(this._array[s]);if(r>e)i=s-1;else if(r<e)t=s+1;else{for(;s>0&&this._getKey(this._array[s-1])===e;)s--;return s}}return t}},Ec=0,Q_=0,U2=class extends se{constructor(){super(),this._decorations=new H2(e=>e==null?void 0:e.marker.line),this._onDecorationRegistered=this._register(new H),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this._register(new H),this.onDecorationRemoved=this._onDecorationRemoved.event,this._register(Ee(()=>this.reset()))}get decorations(){return this._decorations.values()}registerDecoration(e){if(e.marker.isDisposed)return;let t=new q2(e);if(t){let i=t.marker.onDispose(()=>t.dispose()),s=t.onDispose(()=>{s.dispose(),t&&(this._decorations.delete(t)&&this._onDecorationRemoved.fire(t),i.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,i){let s=0,r=0;for(let n of this._decorations.getKeyIterator(t))s=n.options.x??0,r=s+(n.options.width??1),e>=s&&e<r&&(!i||(n.options.layer??"bottom")===i)&&(yield n)}forEachDecorationAtCell(e,t,i,s){this._decorations.forEachByKey(t,r=>{Ec=r.options.x??0,Q_=Ec+(r.options.width??1),e>=Ec&&e<Q_&&(!i||(r.options.layer??"bottom")===i)&&s(r)})}},q2=class extends ws{constructor(e){super(),this.options=e,this.onRenderEmitter=this.add(new H),this.onRender=this.onRenderEmitter.event,this._onDispose=this.add(new H),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=Te.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this.options.foregroundColor?this._cachedFg=Te.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}dispose(){this._onDispose.fire(),super.dispose()}},P2=1e3,K2=class{constructor(e,t=P2){this._renderCallback=e,this._debounceThresholdMS=t,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(e,t,i){this._rowCount=i,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 s=performance.now();if(s-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=s,this._innerRefresh();else if(!this._additionalRefreshRequested){let r=s-this._lastRefreshMs,n=this._debounceThresholdMS-r;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout(()=>{this._lastRefreshMs=performance.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0},n)}}_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)}},J_=20,to=class extends se{constructor(e,t,i,s){super(),this._terminal=e,this._coreBrowserService=i,this._renderService=s,this._rowColumns=new WeakMap,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce="";let r=this._coreBrowserService.mainDocument;this._accessibilityContainer=r.createElement("div"),this._accessibilityContainer.classList.add("xterm-accessibility"),this._rowContainer=r.createElement("div"),this._rowContainer.setAttribute("role","list"),this._rowContainer.classList.add("xterm-accessibility-tree"),this._rowElements=[];for(let n=0;n<this._terminal.rows;n++)this._rowElements[n]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[n]);if(this._topBoundaryFocusListener=n=>this._handleBoundaryFocus(n,0),this._bottomBoundaryFocusListener=n=>this._handleBoundaryFocus(n,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=r.createElement("div"),this._liveRegion.classList.add("live-region"),this._liveRegion.setAttribute("aria-live","assertive"),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this._register(new K2(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(n=>this._handleResize(n.rows))),this._register(this._terminal.onRender(n=>this._refreshRows(n.start,n.end))),this._register(this._terminal.onScroll(()=>this._refreshRows())),this._register(this._terminal.onA11yChar(n=>this._handleChar(n))),this._register(this._terminal.onLineFeed(()=>this._handleChar(`
|
|
118
|
+
`))),this._register(this._terminal.onA11yTab(n=>this._handleTab(n))),this._register(this._terminal.onKey(n=>this._handleKey(n.key))),this._register(this._terminal.onBlur(()=>this._clearLiveRegion())),this._register(this._renderService.onDimensionsChange(()=>this._refreshRowsDimensions())),this._register($(r,"selectionchange",()=>this._handleSelectionChange())),this._register(this._coreBrowserService.onDprChange(()=>this._refreshRowsDimensions())),this._refreshRowsDimensions(),this._refreshRows(),this._register(Ee(()=>{this._accessibilityContainer.remove(),this._rowElements.length=0}))}_handleTab(e){for(let t=0;t<e;t++)this._handleChar(" ")}_handleChar(e){this._liveRegionLineCount<J_+1&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==e&&(this._charsToAnnounce+=e):this._charsToAnnounce+=e,e===`
|
|
119
|
+
`&&(this._liveRegionLineCount++,this._liveRegionLineCount===J_+1&&(this._liveRegion.textContent+=kh.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 i=this._terminal.buffer,s=i.lines.length.toString();for(let r=e;r<=t;r++){let n=i.lines.get(i.ydisp+r),l=[],a=(n==null?void 0:n.translateToString(!0,void 0,void 0,l))||"",o=(i.ydisp+r+1).toString(),c=this._rowElements[r];c&&(a.length===0?(c.textContent=" ",this._rowColumns.set(c,[0,1])):(c.textContent=a,this._rowColumns.set(c,l)),c.setAttribute("aria-posinset",o),c.setAttribute("aria-setsize",s),this._alignRowWidth(c))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(e,t){let i=e.target,s=this._rowElements[t===0?1:this._rowElements.length-2],r=i.getAttribute("aria-posinset"),n=t===0?"1":`${this._terminal.buffer.lines.length}`;if(r===n||e.relatedTarget!==s)return;let l,a;if(t===0?(l=i,a=this._rowElements.pop(),this._rowContainer.removeChild(a)):(l=this._rowElements.shift(),a=i,this._rowContainer.removeChild(l)),l.removeEventListener("focus",this._topBoundaryFocusListener),a.removeEventListener("focus",this._bottomBoundaryFocusListener),t===0){let o=this._createAccessibilityTreeNode();this._rowElements.unshift(o),this._rowContainer.insertAdjacentElement("afterbegin",o)}else{let o=this._createAccessibilityTreeNode();this._rowElements.push(o),this._rowContainer.appendChild(o)}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(){var a;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},i={node:e.focusNode,offset:e.focusOffset};if((t.node.compareDocumentPosition(i.node)&Node.DOCUMENT_POSITION_PRECEDING||t.node===i.node&&t.offset>i.offset)&&([t,i]=[i,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 s=this._rowElements.slice(-1)[0];if(i.node.compareDocumentPosition(s)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(i={node:s,offset:((a=s.textContent)==null?void 0:a.length)??0}),!this._rowContainer.contains(i.node))return;let r=({node:o,offset:c})=>{let u=o instanceof Text?o.parentNode:o,_=parseInt(u==null?void 0:u.getAttribute("aria-posinset"),10)-1;if(isNaN(_))return console.warn("row is invalid. Race condition?"),null;let f=this._rowColumns.get(u);if(!f)return console.warn("columns is null. Race condition?"),null;let d=c<f.length?f[c]:f.slice(-1)[0]+1;return d>=this._terminal.cols&&(++_,d=0),{row:_,column:d}},n=r(t),l=r(i);if(!(!n||!l)){if(n.row>l.row||n.row===l.row&&n.column>=l.column)throw new Error("invalid range");this._terminal.select(n.column,n.row,(l.row-n.row)*this._terminal.cols-n.column+l.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){var r,n;e.style.transform="";let t=e.getBoundingClientRect().width,i=(n=(r=this._rowColumns.get(e))==null?void 0:r.slice(-1))==null?void 0:n[0];if(!i)return;let s=i*this._renderService.dimensions.css.cell.width;e.style.transform=`scaleX(${s/t})`}};to=Ae([q(1,md),q(2,Ii),q(3,Xi)],to);var au=class extends se{constructor(e,t,i,s,r){super(),this._element=e,this._mouseService=t,this._renderService=i,this._bufferService=s,this._linkProviderService=r,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this._register(new H),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this._register(new H),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this._register(Ee(()=>{var n;Gs(this._linkCacheDisposables),this._linkCacheDisposables.length=0,this._lastMouseEvent=void 0,(n=this._activeProviderReplies)==null||n.clear()})),this._register(this._bufferService.onResize(()=>{this._clearCurrentLink(),this._wasResized=!0})),this._register($(this._element,"mouseleave",()=>{this._isMouseOut=!0,this._clearCurrentLink()})),this._register($(this._element,"mousemove",this._handleMouseMove.bind(this))),this._register($(this._element,"mousedown",this._handleMouseDown.bind(this))),this._register($(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 i=e.composedPath();for(let s=0;s<i.length;s++){let r=i[s];if(r.classList.contains("xterm"))break;if(r.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){var s,r;(!this._activeProviderReplies||!t)&&((s=this._activeProviderReplies)==null||s.forEach(n=>{n==null||n.forEach(l=>{l.link.dispose&&l.link.dispose()})}),this._activeProviderReplies=new Map,this._activeLine=e.y);let i=!1;for(let[n,l]of this._linkProviderService.linkProviders.entries())t?(r=this._activeProviderReplies)!=null&&r.get(n)&&(i=this._checkLinkProviderResult(n,e,i)):l.provideLinks(e.y,a=>{var c,u;if(this._isMouseOut)return;let o=a==null?void 0:a.map(_=>({link:_}));(c=this._activeProviderReplies)==null||c.set(n,o),i=this._checkLinkProviderResult(n,e,i),((u=this._activeProviderReplies)==null?void 0:u.size)===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(e.y,this._activeProviderReplies)})}_removeIntersectingLinks(e,t){let i=new Set;for(let s=0;s<t.size;s++){let r=t.get(s);if(r)for(let n=0;n<r.length;n++){let l=r[n],a=l.link.range.start.y<e?0:l.link.range.start.x,o=l.link.range.end.y>e?this._bufferService.cols:l.link.range.end.x;for(let c=a;c<=o;c++){if(i.has(c)){r.splice(n--,1);break}i.add(c)}}}}_checkLinkProviderResult(e,t,i){var n;if(!this._activeProviderReplies)return i;let s=this._activeProviderReplies.get(e),r=!1;for(let l=0;l<e;l++)(!this._activeProviderReplies.has(l)||this._activeProviderReplies.get(l))&&(r=!0);if(!r&&s){let l=s.find(a=>this._linkAtPosition(a.link,t));l&&(i=!0,this._handleNewLink(l))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!i)for(let l=0;l<this._activeProviderReplies.size;l++){let a=(n=this._activeProviderReplies.get(l))==null?void 0:n.find(o=>this._linkAtPosition(o.link,t));if(a){i=!0,this._handleNewLink(a);break}}return i}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(e){if(!this._currentLink)return;let t=this._positionFromMouseEvent(e,this._element,this._mouseService);t&&this._mouseDownLink&&W2(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,Gs(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:()=>{var i,s;return(s=(i=this._currentLink)==null?void 0:i.state)==null?void 0:s.decorations.pointerCursor},set:i=>{var s;(s=this._currentLink)!=null&&s.state&&this._currentLink.state.decorations.pointerCursor!==i&&(this._currentLink.state.decorations.pointerCursor=i,this._currentLink.state.isHovered&&this._element.classList.toggle("xterm-cursor-pointer",i))}},underline:{get:()=>{var i,s;return(s=(i=this._currentLink)==null?void 0:i.state)==null?void 0:s.decorations.underline},set:i=>{var s,r,n;(s=this._currentLink)!=null&&s.state&&((n=(r=this._currentLink)==null?void 0:r.state)==null?void 0:n.decorations.underline)!==i&&(this._currentLink.state.decorations.underline=i,this._currentLink.state.isHovered&&this._fireUnderlineEvent(e.link,i))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange(i=>{if(!this._currentLink)return;let s=i.start===0?0:i.start+1+this._bufferService.buffer.ydisp,r=this._bufferService.buffer.ydisp+1+i.end;if(this._currentLink.link.range.start.y>=s&&this._currentLink.link.range.end.y<=r&&(this._clearCurrentLink(s,r),this._lastMouseEvent)){let n=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);n&&this._askForLink(n,!1)}})))}_linkHover(e,t,i){var s;(s=this._currentLink)!=null&&s.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(i,t.text)}_fireUnderlineEvent(e,t){let i=e.range,s=this._bufferService.buffer.ydisp,r=this._createLinkUnderlineEvent(i.start.x-1,i.start.y-s-1,i.end.x,i.end.y-s-1,void 0);(t?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(r)}_linkLeave(e,t,i){var s;(s=this._currentLink)!=null&&s.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(i,t.text)}_linkAtPosition(e,t){let i=e.range.start.y*this._bufferService.cols+e.range.start.x,s=e.range.end.y*this._bufferService.cols+e.range.end.x,r=t.y*this._bufferService.cols+t.x;return i<=r&&r<=s}_positionFromMouseEvent(e,t,i){let s=i.getCoords(e,t,this._bufferService.cols,this._bufferService.rows);if(s)return{x:s[0],y:s[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(e,t,i,s,r){return{x1:e,y1:t,x2:i,y2:s,cols:this._bufferService.cols,fg:r}}};au=Ae([q(1,gd),q(2,Xi),q(3,bt),q(4,Uv)],au);function W2(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 Y2=class extends L2{constructor(e={}){super(e),this._linkifier=this._register(new Ir),this.browser=r0,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this._register(new Ir),this._onCursorMove=this._register(new H),this.onCursorMove=this._onCursorMove.event,this._onKey=this._register(new H),this.onKey=this._onKey.event,this._onRender=this._register(new H),this.onRender=this._onRender.event,this._onSelectionChange=this._register(new H),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this._register(new H),this.onTitleChange=this._onTitleChange.event,this._onBell=this._register(new H),this.onBell=this._onBell.event,this._onFocus=this._register(new H),this._onBlur=this._register(new H),this._onA11yCharEmitter=this._register(new H),this._onA11yTabEmitter=this._register(new H),this._onWillOpen=this._register(new H),this._setup(),this._decorationService=this._instantiationService.createInstance(U2),this._instantiationService.setService(Cl,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(NC),this._instantiationService.setService(Uv,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(Dh)),this._register(this._inputHandler.onRequestBell(()=>this._onBell.fire())),this._register(this._inputHandler.onRequestRefreshRows(t=>this.refresh((t==null?void 0:t.start)??0,(t==null?void 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(ut.forward(this._inputHandler.onCursorMove,this._onCursorMove)),this._register(ut.forward(this._inputHandler.onTitleChange,this._onTitleChange)),this._register(ut.forward(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this._register(ut.forward(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this._register(this._bufferService.onResize(t=>this._afterResize(t.cols,t.rows))),this._register(Ee(()=>{var t,i;this._customKeyEventHandler=void 0,(i=(t=this.element)==null?void 0:t.parentNode)==null||i.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 i,s="";switch(t.index){case 256:i="foreground",s="10";break;case 257:i="background",s="11";break;case 258:i="cursor",s="12";break;default:i="ansi",s="4;"+t.index}switch(t.type){case 0:let r=Se.toColorRGB(i==="ansi"?this._themeService.colors.ansi[t.index]:this._themeService.colors[i]);this.coreService.triggerDataEvent(`${R.ESC}]${s};${M2(r)}${i0.ST}`);break;case 1:if(i==="ansi")this._themeService.modifyColors(n=>n.ansi[t.index]=qe.toColor(...t.color));else{let n=i;this._themeService.modifyColors(l=>l[n]=qe.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(to,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(e){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(R.ESC+"[I"),this.element.classList.add("focus"),this._showCursor(),this._onFocus.fire()}blur(){var e;return(e=this.textarea)==null?void 0:e.blur()}_handleTextAreaBlur(){this.textarea.value="",this.refresh(this.buffer.y,this.buffer.y),this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(R.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 i=Math.min(this.buffer.x,this.cols-1),s=this._renderService.dimensions.css.cell.height,r=t.getWidth(i),n=this._renderService.dimensions.css.cell.width*r,l=this.buffer.y*this._renderService.dimensions.css.cell.height,a=i*this._renderService.dimensions.css.cell.width;this.textarea.style.left=a+"px",this.textarea.style.top=l+"px",this.textarea.style.width=n+"px",this.textarea.style.height=s+"px",this.textarea.style.lineHeight=s+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this._register($(this.element,"copy",t=>{this.hasSelection()&&$b(t,this._selectionService)}));let e=t=>Gb(t,this.textarea,this.coreService,this.optionsService);this._register($(this.textarea,"paste",e)),this._register($(this.element,"paste",e)),n0?this._register($(this.element,"mousedown",t=>{t.button===2&&c_(t,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})):this._register($(this.element,"contextmenu",t=>{c_(t,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})),Ed&&this._register($(this.element,"auxclick",t=>{t.button===1&&Rv(t,this.textarea,this.screenElement)}))}_bindKeys(){this._register($(this.textarea,"keyup",e=>this._keyUp(e),!0)),this._register($(this.textarea,"keydown",e=>this._keyDown(e),!0)),this._register($(this.textarea,"keypress",e=>this._keyPress(e),!0)),this._register($(this.textarea,"compositionstart",()=>this._compositionHelper.compositionstart())),this._register($(this.textarea,"compositionupdate",e=>this._compositionHelper.compositionupdate(e))),this._register($(this.textarea,"compositionend",()=>this._compositionHelper.compositionend())),this._register($(this.textarea,"input",e=>this._inputEvent(e),!0)),this._register(this.onRender(()=>this._compositionHelper.updateCompositionElements()))}open(e){var r;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"),((r=this.element)==null?void 0:r.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($(this.screenElement,"mousemove",n=>this.updateCursorStyle(n))),this._helperContainer=this._document.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),t.appendChild(this.screenElement);let i=this.textarea=this._document.createElement("textarea");this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",Eh.get()),o0||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",()=>i.readOnly=this.optionsService.rawOptions.disableStdin)),this.textarea.readOnly=this.optionsService.rawOptions.disableStdin,this._coreBrowserService=this._register(this._instantiationService.createInstance(BC,this.textarea,e.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(Ii,this._coreBrowserService),this._register($(this.textarea,"focus",n=>this._handleTextAreaFocus(n))),this._register($(this.textarea,"blur",()=>this._handleTextAreaBlur())),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(Gh,this._document,this._helperContainer),this._instantiationService.setService(Co,this._charSizeService),this._themeService=this._instantiationService.createInstance(Jh),this._instantiationService.setService(sn,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(Qa),this._instantiationService.setService(Hv,this._characterJoinerService),this._renderService=this._register(this._instantiationService.createInstance(Zh,this.rows,this.screenElement)),this._instantiationService.setService(Xi,this._renderService),this._register(this._renderService.onRenderedViewportChange(n=>this._onRender.fire(n))),this.onResize(n=>this._renderService.resize(n.cols,n.rows)),this._compositionView=this._document.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(Ih,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(Fh),this._instantiationService.setService(gd,this._mouseService);let s=this._linkifier.value=this._register(this._instantiationService.createInstance(au,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(Yh,this.element,this.screenElement)),this._register(this._viewport.onRequestScrollLines(n=>{super.scrollLines(n,!1),this.refresh(0,this.rows-1)})),this._selectionService=this._register(this._instantiationService.createInstance(Qh,this.element,this.screenElement,s)),this._instantiationService.setService(sw,this._selectionService),this._register(this._selectionService.onRequestScrollLines(n=>this.scrollLines(n.amount,n.suppressScrollEvent))),this._register(this._selectionService.onSelectionChange(()=>this._onSelectionChange.fire())),this._register(this._selectionService.onRequestRedraw(n=>this._renderService.handleSelectionChanged(n.start,n.end,n.columnSelectMode))),this._register(this._selectionService.onLinuxMouseSelection(n=>{this.textarea.value=n,this.textarea.focus(),this.textarea.select()})),this._register(ut.any(this._onScroll.event,this._inputHandler.onScroll)(()=>{var n;this._selectionService.refresh(),(n=this._viewport)==null||n.queueSync()})),this._register(this._instantiationService.createInstance(Vh,this.screenElement)),this._register($(this.element,"mousedown",n=>this._selectionService.handleMouseDown(n))),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(to,this)),this._register(this.optionsService.onSpecificOptionChange("screenReaderMode",n=>this._handleScreenReaderModeOptionChange(n))),this.options.overviewRuler.width&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(Za,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRuler",n=>{!this._overviewRulerRenderer&&n&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(Za,this._viewportElement,this.screenElement)))}),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance($h,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){let e=this,t=this.element;function i(n){var c,u,_,f,d;let l=e._mouseService.getMouseReportCoords(n,e.screenElement);if(!l)return!1;let a,o;switch(n.overrideType||n.type){case"mousemove":o=32,n.buttons===void 0?(a=3,n.button!==void 0&&(a=n.button<3?n.button:3)):a=n.buttons&1?0:n.buttons&4?1:n.buttons&2?2:3;break;case"mouseup":o=0,a=n.button<3?n.button:3;break;case"mousedown":o=1,a=n.button<3?n.button:3;break;case"wheel":if(e._customWheelEventHandler&&e._customWheelEventHandler(n)===!1)return!1;let g=n.deltaY;if(g===0||e.coreMouseService.consumeWheelEvent(n,(f=(_=(u=(c=e._renderService)==null?void 0:c.dimensions)==null?void 0:u.device)==null?void 0:_.cell)==null?void 0:f.height,(d=e._coreBrowserService)==null?void 0:d.dpr)===0)return!1;o=g<0?0:1,a=4;break;default:return!1}return o===void 0||a===void 0||a>4?!1:e.coreMouseService.triggerMouseEvent({col:l.col,row:l.row,x:l.x,y:l.y,button:a,action:o,ctrl:n.ctrlKey,alt:n.altKey,shift:n.shiftKey})}let s={mouseup:null,wheel:null,mousedrag:null,mousemove:null},r={mouseup:n=>(i(n),n.buttons||(this._document.removeEventListener("mouseup",s.mouseup),s.mousedrag&&this._document.removeEventListener("mousemove",s.mousedrag)),this.cancel(n)),wheel:n=>(i(n),this.cancel(n,!0)),mousedrag:n=>{n.buttons&&i(n)},mousemove:n=>{n.buttons||i(n)}};this._register(this.coreMouseService.onProtocolChange(n=>{n?(this.optionsService.rawOptions.logLevel==="debug"&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(n)),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()),n&8?s.mousemove||(t.addEventListener("mousemove",r.mousemove),s.mousemove=r.mousemove):(t.removeEventListener("mousemove",s.mousemove),s.mousemove=null),n&16?s.wheel||(t.addEventListener("wheel",r.wheel,{passive:!1}),s.wheel=r.wheel):(t.removeEventListener("wheel",s.wheel),s.wheel=null),n&2?s.mouseup||(s.mouseup=r.mouseup):(this._document.removeEventListener("mouseup",s.mouseup),s.mouseup=null),n&4?s.mousedrag||(s.mousedrag=r.mousedrag):(this._document.removeEventListener("mousemove",s.mousedrag),s.mousedrag=null)})),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this._register($(t,"mousedown",n=>{if(n.preventDefault(),this.focus(),!(!this.coreMouseService.areMouseEventsActive||this._selectionService.shouldForceSelection(n)))return i(n),s.mouseup&&this._document.addEventListener("mouseup",s.mouseup),s.mousedrag&&this._document.addEventListener("mousemove",s.mousedrag),this.cancel(n)})),this._register($(t,"wheel",n=>{var l,a,o,c,u;if(!s.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(n)===!1)return!1;if(!this.buffer.hasScrollback){if(n.deltaY===0)return!1;if(e.coreMouseService.consumeWheelEvent(n,(c=(o=(a=(l=e._renderService)==null?void 0:l.dimensions)==null?void 0:a.device)==null?void 0:o.cell)==null?void 0:c.height,(u=e._coreBrowserService)==null?void 0:u.dpr)===0)return this.cancel(n,!0);let _=R.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(n.deltaY<0?"A":"B");return this.coreService.triggerDataEvent(_,!0),this.cancel(n,!0)}}},{passive:!1}))}refresh(e,t){var i;(i=this._renderService)==null||i.refreshRows(e,t)}updateCursorStyle(e){var t;(t=this._selectionService)!=null&&t.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){Mv(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,i){this._selectionService.setSelection(e,t,i)}getSelection(){return this._selectionService?this._selectionService.selectionText:""}getSelectionPosition(){if(!(!this._selectionService||!this._selectionService.hasSelection))return{start:{x:this._selectionService.selectionStart[0],y:this._selectionService.selectionStart[1]},end:{x:this._selectionService.selectionEnd[0],y:this._selectionService.selectionEnd[1]}}}clearSelection(){var e;(e=this._selectionService)==null||e.clearSelection()}selectAll(){var e;(e=this._selectionService)==null||e.selectAll()}selectLines(e,t){var i;(i=this._selectionService)==null||i.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 i=j2(e,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(e),i.type===3||i.type===2){let s=this.rows-1;return this.scrollLines(i.type===2?-s:s),this.cancel(e,!0)}if(i.type===1&&this.selectAll(),this._isThirdLevelShift(this.browser,e)||(i.cancel&&this.cancel(e,!0),!i.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((i.key===R.ETX||i.key===R.CR)&&(this.textarea.value=""),this._onKey.fire({key:i.key,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(i.key,!0),!this.optionsService.rawOptions.screenReaderMode||e.altKey||e.ctrlKey)return this.cancel(e,!0);this._keyDownHandled=!0}_isThirdLevelShift(e,t){let i=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"?i:i&&(!t.keyCode||t.keyCode>47)}_keyUp(e){this._keyDownSeen=!1,!(this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)&&(V2(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){var i;(i=this._charSizeService)==null||i.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(ze));this._onScroll.fire({position:this.buffer.ydisp}),this.refresh(0,this.rows-1)}}reset(){var t;this.options.rows=this.rows,this.options.cols=this.cols;let e=this._customKeyEventHandler;this._setup(),super.reset(),(t=this._selectionService)==null||t.reset(),this._decorationService.reset(),this._customKeyEventHandler=e,this.refresh(0,this.rows-1)}clearTextureAtlas(){var e;(e=this._renderService)==null||e.clearTextureAtlas()}_reportFocus(){var e;(e=this.element)!=null&&e.classList.contains("focus")?this.coreService.triggerDataEvent(R.ESC+"[I"):this.coreService.triggerDataEvent(R.ESC+"[O")}_reportWindowsOptions(e){if(this._renderService)switch(e){case 0:let t=this._renderService.dimensions.css.canvas.width.toFixed(0),i=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${R.ESC}[4;${i};${t}t`);break;case 1:let s=this._renderService.dimensions.css.cell.width.toFixed(0),r=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${R.ESC}[6;${r};${s}t`);break}}cancel(e,t){if(!(!this.options.cancelEvents&&!t))return e.preventDefault(),e.stopPropagation(),!1}};function V2(e){return e.keyCode===16||e.keyCode===17||e.keyCode===18}var I2=class{constructor(){this._addons=[]}dispose(){for(let e=this._addons.length-1;e>=0;e--)this._addons[e].instance.dispose()}loadAddon(e,t){let i={instance:t,dispose:t.dispose,isDisposed:!1};this._addons.push(i),t.dispose=()=>this._wrappedAddonDispose(i),t.activate(e)}_wrappedAddonDispose(e){if(e.isDisposed)return;let t=-1;for(let i=0;i<this._addons.length;i++)if(this._addons[i]===e){t=i;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)}},X2=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 ii)}translateToString(e,t,i){return this._line.translateToString(e,t,i)}},ep=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 X2(t)}getNullCell(){return new ii}},$2=class extends se{constructor(e){super(),this._core=e,this._onBufferChange=this._register(new H),this.onBufferChange=this._onBufferChange.event,this._normal=new ep(this._core.buffers.normal,"normal"),this._alternate=new ep(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)}},G2=class{constructor(e){this._core=e}registerCsiHandler(e,t){return this._core.registerCsiHandler(e,i=>t(i.toArray()))}addCsiHandler(e,t){return this.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._core.registerDcsHandler(e,(i,s)=>t(i,s.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)}},F2=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}},Z2=["cols","rows"],di=0,Q2=class extends se{constructor(e){super(),this._core=this._register(new Y2(e)),this._addonManager=this._register(new I2),this._publicOptions={...this._core.options};let t=s=>this._core.options[s],i=(s,r)=>{this._checkReadonlyOptions(s),this._core.options[s]=r};for(let s in this._core.options){let r={get:t.bind(this,s),set:i.bind(this,s)};Object.defineProperty(this._publicOptions,s,r)}}_checkReadonlyOptions(e){if(Z2.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 G2(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new F2(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 $2(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,i){this._verifyIntegers(e,t,i),this._core.select(e,t,i)}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
|
|
120
|
+
`,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 Eh.get()},set promptLabel(e){Eh.set(e)},get tooMuchOutput(){return kh.get()},set tooMuchOutput(e){kh.set(e)}}}_verifyIntegers(...e){for(di of e)if(di===1/0||isNaN(di)||di%1!==0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...e){for(di of e)if(di&&(di===1/0||isNaN(di)||di%1!==0||di<0))throw new Error("This API only accepts positive integers")}};const J2="https://evalut.io/n/docs/config",ou="evalution:setup-step-done";function ex(e){return e.kind==="install_package"?`npm i ${e.package}`:e.command}function tx(e,t){const i=location.protocol==="https:"?"wss":"ws",s=new URLSearchParams({taskId:e,stepId:t});return`${i}://${location.host}/api/terminal?${s}`}function ix({taskId:e,stepId:t,command:i}){const s=k.useRef(null);return k.useEffect(()=>{const r=s.current;if(!r)return;const n=getComputedStyle(r),l=new Q2({cursorBlink:!0,fontFamily:"ui-monospace, SFMono-Regular, Menlo, Consolas, monospace",fontSize:13,theme:{background:n.getPropertyValue("--panel-bg").trim()||"#1e1e1e",foreground:n.getPropertyValue("--panel-text").trim()||"#eaeaea",cursor:n.getPropertyValue("--panel-text").trim()||"#eaeaea"}}),a=new Wb;l.loadAddon(a),l.open(r);const o=()=>{try{a.fit()}catch{}};o(),requestAnimationFrame(o),l.focus();let c=!1,u=!1,_=!1;const f=new WebSocket(tx(e,t));l.write(`\x1B[2m# Press Return to run, or close this tab to skip.\x1B[0m\r
|
|
121
|
+
`),l.write(`\x1B[1m$ ${i}\x1B[0m`);const d=()=>(o(),JSON.stringify({type:"start",cols:l.cols,rows:l.rows})),g=()=>{c||(c=!0,f.readyState===WebSocket.OPEN?f.send(d()):u=!0)};f.onopen=()=>{u&&f.send(d())},f.onmessage=p=>{const v=JSON.parse(p.data);switch(v.type){case"data":l.write(v.data);break;case"error":l.write(`\r
|
|
122
122
|
\x1B[31m${v.message}\x1B[0m\r
|
|
123
|
-
`);break;case"exit":
|
|
123
|
+
`);break;case"exit":_=!0,l.write(v.code===0?`\r
|
|
124
124
|
\x1B[32m✓ Completed successfully.\x1B[0m\r
|
|
125
125
|
`:`\r
|
|
126
126
|
\x1B[31m✗ Exited with code ${v.code}.\x1B[0m\r
|
|
127
|
-
`),v.code===0&&window.dispatchEvent(new CustomEvent(
|
|
127
|
+
`),v.code===0&&window.dispatchEvent(new CustomEvent(ou,{detail:{taskId:e,stepId:t}}));break}},f.onclose=()=>{_||l.write(`\r
|
|
128
128
|
\x1B[2m(disconnected)\x1B[0m\r
|
|
129
129
|
`)};const y=l.onData(p=>{if(!c){(p==="\r"||p===`
|
|
130
130
|
`)&&(l.write(`\r
|
|
131
|
-
`),g());return}
|
|
131
|
+
`),g());return}f.readyState===WebSocket.OPEN&&f.send(JSON.stringify({type:"input",data:p}))}),w=l.onResize(({cols:p,rows:v})=>{c&&f.readyState===WebSocket.OPEN&&f.send(JSON.stringify({type:"resize",cols:p,rows:v}))}),m=new ResizeObserver(o);return m.observe(r),()=>{m.disconnect(),y.dispose(),w.dispose(),f.close(),l.dispose()}},[e,t,i]),h.jsx("div",{className:"terminal-view",ref:s})}const sx=e=>`${e.providerId}:${e.id}`;function rx(e){return e<1e3?`${Math.round(e)}ms`:`${(e/1e3).toFixed(2)}s`}function nx(e){return new Date(e).toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit",second:"2-digit"})}function lx({traces:e,loading:t,error:i,selectedTraceKey:s,onSelect:r}){return t?h.jsxs(h.Fragment,{children:[h.jsx("div",{className:"section-panel-header",children:"Traces"}),h.jsx("div",{className:"section-panel-body",children:h.jsx("div",{className:"tree-status",children:"Loading..."})})]}):i?h.jsxs(h.Fragment,{children:[h.jsx("div",{className:"section-panel-header",children:"Traces"}),h.jsx("div",{className:"section-panel-body",children:h.jsxs("div",{className:"tree-status tree-error",children:["Error: ",i]})})]}):e.length===0?h.jsxs(h.Fragment,{children:[h.jsx("div",{className:"section-panel-header",children:"Traces"}),h.jsx("div",{className:"section-panel-body",children:h.jsxs("div",{className:"tree-empty-state",children:[h.jsx("p",{children:"No traces yet."}),h.jsx("p",{className:"trace-list-hint",children:"Run a prompt to create one."})]})})]}):h.jsxs(h.Fragment,{children:[h.jsx("div",{className:"section-panel-header",children:"Traces"}),h.jsx("div",{className:"section-panel-body trace-list",children:e.map(n=>{const l=sx(n),a=l===s,o=n.endTime!==void 0?n.endTime-n.startTime:void 0;return h.jsxs("div",{className:`trace-list-row${a?" trace-list-row-selected":""}`,onClick:()=>r(n),title:n.name,children:[h.jsxs("div",{className:"trace-list-row-top",children:[h.jsx("span",{className:`trace-status-dot trace-status-${n.status}`}),h.jsx("span",{className:"trace-list-name",children:n.name})]}),h.jsxs("div",{className:"trace-list-row-meta",children:[h.jsx("span",{children:nx(n.startTime)}),h.jsxs("span",{children:[n.spanCount," span",n.spanCount===1?"":"s"]}),h.jsx("span",{children:o!==void 0?rx(o):"running…"})]})]},l)})})]})}function ax({providerId:e,traceId:t,initialSpanId:i,onOpenPrompt:s}){const[r,n]=k.useState({trace:null,spans:[]}),[l,a]=k.useState(i??null),[o,c]=k.useState(null);k.useEffect(()=>{let d=!1;z1(e,t).then(y=>{d||n({trace:y.trace,spans:y.spans})}).catch(y=>{d||c(y.message)});const g=j1(e,t,y=>{n(w=>ox(w,y))});return()=>{d=!0,g()}},[e,t]);const u=k.useMemo(()=>cx(r.spans),[r.spans]),_=k.useMemo(()=>hx(r.trace,r.spans),[r.trace,r.spans]);if(o)return h.jsxs("div",{className:"trace-view trace-view-error",children:["Error: ",o]});if(!r.trace)return h.jsx("div",{className:"trace-view",children:h.jsx("div",{className:"trace-view-loading",children:"Loading trace…"})});const f=Math.max(1,_.end-_.start);return h.jsxs("div",{className:"trace-view",children:[h.jsxs("div",{className:"trace-view-header",children:[h.jsxs("div",{className:"trace-view-title",children:[h.jsx("span",{className:`trace-status-dot trace-status-${r.trace.status}`}),h.jsx("span",{children:r.trace.name}),h.jsx("span",{className:"trace-view-timestamp",children:ux(r.trace.startTime)})]}),h.jsxs("div",{className:"trace-view-meta",children:[h.jsxs("span",{children:[r.spans.length," span",r.spans.length===1?"":"s"]}),h.jsx("span",{children:tp(f)})]})]}),h.jsx("div",{className:"trace-waterfall",children:u.map(d=>{var Y;const g=d.span,y=g.startTime-_.start,w=g.endTime??_.end,m=w-_.start,p=y/f*100,v=Math.max(.5,(m-y)/f*100),S=g.id===l,T=g.endTime===void 0,j=T?void 0:w-g.startTime,O=g.status==="error",L=!!((Y=g.prompt)!=null&&Y.providerId&&s),U=L?()=>s(g.prompt):void 0;return h.jsxs("div",{className:`trace-row${S?" trace-row-expanded":""}${O?" trace-row-error":""}`,children:[h.jsxs("div",{className:"trace-row-main",children:[h.jsxs("div",{className:"trace-row-label",style:{paddingLeft:d.depth*16},children:[h.jsx("button",{type:"button",className:"trace-row-disclosure",onClick:()=>a(S?null:g.id),"aria-label":S?"Collapse":"Expand",children:h.jsx(_x,{expanded:S})}),h.jsx(fx,{visible:O}),g.kind!=="DEFAULT"&&h.jsx(dx,{kind:g.kind}),h.jsx("span",{className:`trace-row-name${L?" trace-row-name-linked":""}`,onClick:U,children:g.name}),L&&h.jsx("button",{type:"button",className:"trace-row-prompt-btn",onClick:U,title:"Open prompt",children:h.jsx(px,{})})]}),h.jsx("div",{className:"trace-row-duration",children:j!==void 0?tp(j):T?"…":""}),h.jsx("div",{className:"trace-row-bar-track",children:h.jsx("div",{className:`trace-row-bar trace-row-bar-${g.kind}${T?" trace-row-bar-running":""}`,style:{left:`${p}%`,width:`${v}%`}})})]}),S&&h.jsx("div",{className:"trace-row-details",children:h.jsx(mx,{span:g})})]},g.id)})})]})}function ox(e,t){switch(t.type){case"span-start":case"span-end":case"span-update":{const i=e.spans.findIndex(r=>r.id===t.span.id),s=i>=0?e.spans.map((r,n)=>n===i?t.span:r):[...e.spans,t.span];return{...e,spans:s}}case"trace-update":case"trace-end":return{...e,trace:t.trace};default:return e}}function cx(e){const t=new Map;for(const r of e){const n=t.get(r.parentId)??[];n.push(r),t.set(r.parentId,n)}for(const r of t.values())r.sort((n,l)=>n.startTime-l.startTime);const i=[],s=(r,n)=>{const l=t.get(r)??[];for(const a of l)i.push({span:a,depth:n}),s(a.id,n+1)};return s(void 0,0),i}function hx(e,t){if(!e)return{start:0,end:1};let i=e.startTime,s=e.endTime??e.startTime;for(const r of t){r.startTime<i&&(i=r.startTime);const n=r.endTime??r.startTime;n>s&&(s=n)}return s<=i&&(s=i+1),{start:i,end:s}}function ux(e){return new Date(e).toLocaleString(void 0,{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit",second:"2-digit"})}function tp(e){return e<1?"<1ms":e<1e3?`${Math.round(e)}ms`:`${(e/1e3).toFixed(2)}s`}function dx({kind:e}){return h.jsx("span",{className:`span-kind-pill span-kind-${e}`,children:e})}function fx({visible:e}){return h.jsxs("svg",{className:"span-error-icon",viewBox:"0 0 16 16",fill:"none","aria-label":e?"Error":void 0,"aria-hidden":!e,style:{visibility:e?"visible":"hidden"},children:[h.jsx("path",{d:"M7.06 2.8 1.8 12.2A1 1 0 0 0 2.7 13.7h10.6a1 1 0 0 0 .9-1.5L9.0 2.8a1.15 1.15 0 0 0-1.94 0Z",stroke:"currentColor",strokeWidth:"1.2",strokeLinejoin:"round"}),h.jsx("path",{d:"M8 6.5v3M8 11v.5",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round"})]})}function _x({expanded:e}){return h.jsx("svg",{className:`trace-disclosure-icon${e?" trace-disclosure-icon-open":""}`,width:"10",height:"10",viewBox:"0 0 10 10",fill:"none","aria-hidden":!0,children:h.jsx("path",{d:"M2.5 3.5 5 6.5l2.5-3",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}function px(){return h.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[h.jsx("path",{d:"M14 2H6a2 2 0 00-2 2v16a2 2 0 002 2h12a2 2 0 002-2V8z"}),h.jsx("polyline",{points:"14 2 14 8 20 8"}),h.jsx("line",{x1:"16",y1:"13",x2:"8",y2:"13"}),h.jsx("line",{x1:"16",y1:"17",x2:"8",y2:"17"}),h.jsx("line",{x1:"10",y1:"9",x2:"8",y2:"9"})]})}function mx({span:e}){var i,s;const t=[];if(t.push({label:"ID",value:h.jsx("code",{children:e.id})}),t.push({label:"Kind",value:e.kind}),e.status&&t.push({label:"Status",value:e.status}),e.errorMessage&&t.push({label:"Error",value:h.jsx("pre",{className:"span-details-error",children:e.errorMessage})}),e.llm){const{llm:r}=e;r.provider&&t.push({label:"Provider",value:r.provider}),r.model&&t.push({label:"Model",value:r.model}),(r.promptTokens!==void 0||r.completionTokens!==void 0)&&t.push({label:"Tokens",value:`${r.promptTokens??0} in · ${r.completionTokens??0} out · ${r.totalTokens??(r.promptTokens??0)+(r.completionTokens??0)} total`}),r.cost!==void 0&&t.push({label:"Cost",value:`$${r.cost.toFixed(5)}`}),r.modelParameters&&t.push({label:"Model Parameters",value:h.jsx("pre",{className:"span-details-json",children:JSON.stringify(r.modelParameters,null,2)})})}return e.attributes&&t.push({label:"Attributes",value:h.jsx("pre",{className:"span-details-json",children:JSON.stringify(e.attributes,null,2)})}),h.jsxs("div",{className:"span-details",children:[h.jsx("dl",{className:"span-details-list",children:t.map((r,n)=>h.jsxs("div",{className:"span-details-row",children:[h.jsx("dt",{children:r.label}),h.jsx("dd",{children:r.value})]},n))}),((i=e.llm)==null?void 0:i.messages)&&e.llm.messages.length>0&&h.jsxs("div",{className:"span-details-section",children:[h.jsx("div",{className:"span-details-section-title",children:"Input"}),e.llm.messages.map((r,n)=>h.jsxs("div",{className:"span-message",children:[h.jsx("div",{className:"span-message-role",children:r.role}),h.jsx("div",{className:"span-message-content",children:r.content})]},n))]}),((s=e.llm)==null?void 0:s.output)&&h.jsxs("div",{className:"span-details-section",children:[h.jsx("div",{className:"span-details-section-title",children:"Output"}),h.jsx("div",{className:"span-message-content",children:e.llm.output})]})]})}const gx="https://evalut.io/n/docs/prompts";function vx({onCreatePrompt:e}){return h.jsxs("div",{className:"setup-allset",children:[h.jsx("h3",{children:"You're all set! 🎉"}),h.jsx("p",{className:"welcome-subtitle",children:"Create your first prompt to start iterating, or browse the docs to see what's possible."}),h.jsx("a",{className:"welcome-link",href:gx,target:"_blank",rel:"noreferrer",children:"Read the docs ↗"}),h.jsx("div",{className:"setup-actions",children:h.jsx("button",{type:"button",className:"welcome-btn-primary",onClick:e,children:"Create New Prompt"})})]})}const Sx=`<!-- SPDX-License-Identifier: AGPL-3.0-only -->
|
|
132
132
|
<!-- Copyright (c) 2026 Alexander Corrado -->
|
|
133
133
|
|
|
134
134
|
<svg width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg">
|
|
135
135
|
<polyline points="20 6 9 17 4 12"/>
|
|
136
136
|
</svg>
|
|
137
|
-
`,
|
|
137
|
+
`,yx=`<!-- SPDX-License-Identifier: AGPL-3.0-only -->
|
|
138
138
|
<!-- Copyright (c) 2026 Alexander Corrado -->
|
|
139
139
|
|
|
140
140
|
<svg width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg">
|
|
141
141
|
<rect x="9" y="9" width="13" height="13" rx="2" ry="2"/>
|
|
142
142
|
<path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"/>
|
|
143
143
|
</svg>
|
|
144
|
-
`;function F_({text:e,multiline:t,children:i}){const[s,r]=D.useState(!1),n=D.useCallback(async()=>{try{await navigator.clipboard.writeText(e),r(!0),setTimeout(()=>r(!1),1500)}catch{}},[e]);return h.jsxs("div",{className:`copy-box${t?" copy-box-multiline":""}`,children:[t?h.jsx("pre",{children:e}):h.jsx("span",{className:"copy-box-text",children:i??e}),h.jsx("button",{type:"button",className:"copy-box-btn",onClick:n,title:s?"Copied!":"Copy to clipboard","aria-label":s?"Copied":"Copy to clipboard",children:h.jsx("span",{dangerouslySetInnerHTML:{__html:s?ax:ox}})})]})}const Cc="https://evalut.io/n/docs/setup.md",cx="https://evalut.io/n/docs/other-sdk";function hx({onOpenTerminal:e}){const[t,i]=D.useState([]),[s,r]=D.useState(null),[n,l]=D.useState(new Set),[a,o]=D.useState(new Set),[c,_]=D.useState(new Set),[f,u]=D.useState({});D.useEffect(()=>{let p=!1;return gy().then(v=>{p||(i(v),r(S=>{var k;return S??((k=v[0])==null?void 0:k.id)??null}))}).catch(()=>{}),()=>{p=!0}},[]),D.useEffect(()=>{const p=v=>{const{stepId:S}=v.detail;_(k=>new Set(k).add(S))};return window.addEventListener(su,p),()=>window.removeEventListener(su,p)},[]);const d=t.find(p=>p.id===s),g=(p,v)=>(p.completed||c.has(p.id))&&(p.kind!=="create_config"||v<d.steps.length-1),y=(p,v)=>a.has(p.id)||p.kind==="create_config"&&(p.completed||c.has(p.id))&&v===d.steps.length-1,C=p=>l(v=>{const S=new Set(v);return S.has(p)?S.delete(p):S.add(p),S}),m=async p=>{if(d){o(v=>new Set(v).add(p.id)),u(v=>{const{[p.id]:S,...k}=v;return k});try{await vy(d.id,p.id),_(v=>new Set(v).add(p.id))}catch(v){u(S=>({...S,[p.id]:v.message}))}finally{o(v=>{const S=new Set(v);return S.delete(p.id),S})}}};return h.jsxs("div",{className:"setup-split",children:[h.jsxs("section",{className:"setup-pane",children:[h.jsx("h3",{children:"Set up with a coding agent"}),h.jsx("p",{className:"welcome-subtitle",children:"Paste this prompt into your coding agent and let it wire up Evalution for you:"}),h.jsxs(F_,{text:`Fetch ${Cc}`,children:["Fetch"," ",h.jsx("a",{className:"welcome-link",href:Cc,target:"_blank",rel:"noopener",children:Cc})]})]}),h.jsx("div",{className:"setup-divider",children:h.jsx("span",{children:"or set up manually"})}),h.jsxs("section",{className:"setup-pane",children:[h.jsx("h3",{children:"Manual setup"}),h.jsx("div",{className:"welcome-field",children:h.jsxs("div",{className:"setup-sdk-options",role:"group","aria-label":"AI SDK",children:[t.map(p=>h.jsxs("button",{type:"button",className:`setup-sdk-option${p.id===s?" setup-sdk-option-selected":""}`,"aria-pressed":p.id===s,onClick:()=>r(p.id),children:[h.jsx("span",{className:"setup-sdk-icon","aria-hidden":"true",children:h.jsx(Sh,{provider:p.icon,size:20})}),h.jsx("span",{children:p.label})]},p.id)),h.jsx("a",{className:"setup-sdk-option setup-sdk-option-link",href:cx,target:"_blank",rel:"noopener",children:"Other"})]})}),d&&h.jsx("ol",{className:"setup-steps",children:d.steps.map((p,v)=>h.jsxs("li",{className:`setup-step${g(p,v)?" setup-step-done":""}${y(p,v)?" setup-step-running":""}`,children:[h.jsxs("div",{className:"setup-step-row",children:[h.jsx("span",{className:"setup-step-label",children:ux(p)}),h.jsx("span",{className:"setup-step-action",children:dx(p,{done:g(p,v),running:y(p,v),expanded:n.has(p.id),onCreate:()=>m(p),onRun:()=>{if(p.kind==="create_config"||!d)return;const S=p.kind==="install_package"?`Install ${p.package}`:p.label;e==null||e(d.id,p.id,Kw(p),S)},onToggleExpand:()=>C(p.id)})})]}),p.kind==="create_config"&&n.has(p.id)&&h.jsxs("div",{className:"setup-config-snippet",children:[h.jsx(F_,{text:p.contents,multiline:!0}),h.jsx("a",{className:"welcome-link setup-config-docs",href:Pw,target:"_blank",rel:"noopener",children:"Config docs ↗"})]}),f[p.id]&&h.jsx("div",{className:"setup-file-status setup-file-error",children:f[p.id]})]},p.id))})]})]})}function ux(e){switch(e.kind){case"create_config":return h.jsxs(h.Fragment,{children:["Create config: ",h.jsx("code",{children:e.path})]});case"install_package":return h.jsxs(h.Fragment,{children:["Install package: ",h.jsx("code",{children:e.package})]});case"run_command":return h.jsxs(h.Fragment,{children:["Run ",h.jsx("code",{children:e.command})]})}}function dx(e,t){return e.kind==="create_config"?h.jsxs(h.Fragment,{children:[h.jsx("button",{type:"button",className:"setup-step-expand welcome-link",onClick:t.onToggleExpand,children:t.expanded?"Hide":"Show"}),t.done?h.jsx("span",{className:"setup-step-status setup-file-created",children:"Created"}):h.jsx("button",{type:"button",className:"welcome-link",onClick:t.onCreate,disabled:t.running,children:t.running?"Creating…":"Create"})]}):e.kind==="install_package"&&t.done?h.jsx("span",{className:"setup-step-status setup-file-created",children:"Installed"}):h.jsx("button",{type:"button",className:"welcome-link",onClick:t.onRun,children:e.kind==="install_package"?"Install":"Run"})}const u0="all-set",fx=[{id:"setup",title:"Set up project",Component:hx},{id:u0,title:"You're all set",Component:lx}];function _x({onCreatePrompt:e,onOpenTerminal:t,configured:i=!1,steps:s=fx}){const r=s.findIndex(u=>u.id===u0),[n,l]=D.useState(i&&r>=0?r:0);D.useEffect(()=>{i&&r>=0&&l(r)},[i,r]);const a=s[n],o=n===0,c=n===s.length-1,_=()=>l(u=>Math.min(u+1,s.length-1)),f=a.Component;return h.jsx("div",{className:"welcome",children:h.jsxs("div",{className:"welcome-card",children:[h.jsxs("header",{className:"welcome-header",children:[h.jsx("img",{className:"welcome-logo",src:"/favicon.svg",width:"36",height:"49",alt:""}),h.jsx("ol",{className:"welcome-progress",children:s.map((u,d)=>{const g=d===n?"active":d<n?"done":"todo",y=d<n&&!!u.canReturn;return h.jsx("li",{className:`welcome-progress-${g}`,children:y?h.jsxs("button",{type:"button",className:"welcome-progress-btn",onClick:()=>l(d),children:[h.jsx("span",{className:"welcome-progress-dot",children:d+1}),h.jsx("span",{className:"welcome-progress-label",children:u.title})]}):h.jsxs(h.Fragment,{children:[s.length>1&&h.jsx("span",{className:"welcome-progress-dot",children:d+1}),h.jsx("span",{className:"welcome-progress-label",children:u.title})]})},u.id)})})]}),h.jsx("div",{className:"welcome-step-body",children:h.jsx(f,{onNext:_,isFirst:o,isLast:c,onCreatePrompt:e,onOpenTerminal:t})})]})})}function px(e,t){return e.id===t.id&&e.providerId===t.providerId}function mx(){const[e,t]=D.useState([]),[i,s]=D.useState(!0),[r,n]=D.useState(null),l=D.useCallback(async()=>{try{s(!0),n(null),t(await yy())}catch(o){n(o.message)}finally{s(!1)}},[]);D.useEffect(()=>{l()},[l]);const a=D.useCallback(o=>{t(c=>{let _=!1;const f=c.map(u=>px(u,o)?(_=!0,o):u);return _?f:[...c,o]})},[]);return{prompts:e,loading:i,error:r,refetch:l,patchPrompt:a}}function Z_({initial:e,min:t=0,max:i=1/0,direction:s="horizontal",storageKey:r}){const[n,l]=D.useState(()=>{if(r)try{const C=localStorage.getItem(r);if(C){const m=JSON.parse(C);if(m&&typeof m=="object")return m}}catch{}return e}),a=D.useRef(n);a.current=n;const o=C=>{r&&localStorage.setItem(r,JSON.stringify(C))},c=C=>{a.current=C,l(C),o(C)},_=D.useRef(null),f=D.useRef(0),u=D.useRef(0);return D.useEffect(()=>{const C=p=>{if(!_.current)return;const v=s==="horizontal"?p.clientX:p.clientY,S=Math.max(t,Math.min(i,u.current+(v-f.current)));c({...a.current,[_.current]:S})},m=()=>{_.current=null};return window.addEventListener("mousemove",C),window.addEventListener("mouseup",m),()=>{window.removeEventListener("mousemove",C),window.removeEventListener("mouseup",m)}},[s,t,i]),{sizes:n,getOnMouseDown:(C,m)=>p=>{_.current=C,f.current=s==="horizontal"?p.clientX:p.clientY,u.current=m,p.preventDefault()},setSize:(C,m)=>c({...a.current,[C]:m}),deleteSize:C=>{const{[C]:m,...p}=a.current;c(p)}}}function gx(e,t){D.useEffect(()=>{const i=new EventSource("/api/events");return i.onopen=()=>t==null?void 0:t(),i.onmessage=s=>{try{const r=JSON.parse(s.data);e(r)}catch(r){console.error("Failed to parse SSE message:",r)}},i.onerror=s=>{console.error("SSE error:",s)},()=>{i.close()}},[e,t])}function vx(){const[e,t]=D.useState([]),[i,s]=D.useState(!0),[r,n]=D.useState(null),l=D.useCallback(async()=>{try{n(null);const a=await ky();a.sort((o,c)=>c.startTime-o.startTime),t(a)}catch(a){n(a.message)}finally{s(!1)}},[]);return D.useEffect(()=>{l()},[l]),{traces:e,loading:i,error:r,refetch:l}}const d0="welcome",De=e=>e.type==="prompt"?`prompt:${e.providerId}:${e.promptId}`:e.type==="trace"?`trace:${e.providerId}:${e.traceId}`:e.type==="terminal"?`terminal:${e.id}`:d0;let Sx=0,yx=0;const ru=()=>`pane${++yx}`,Q_=ru();function bx(){return h.jsx("img",{src:"/favicon.svg",width:"22",height:"30",alt:"evalution logo",style:{display:"block"}})}function J_(){return h.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",children:[h.jsx("line",{x1:"4",y1:"6",x2:"14",y2:"6"}),h.jsx("line",{x1:"8",y1:"12",x2:"20",y2:"12"}),h.jsx("line",{x1:"6",y1:"18",x2:"16",y2:"18"})]})}function Cx(){return h.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",children:[h.jsx("path",{d:"M14 2H6a2 2 0 00-2 2v16a2 2 0 002 2h12a2 2 0 002-2V8z"}),h.jsx("polyline",{points:"14 2 14 8 20 8"}),h.jsx("line",{x1:"16",y1:"13",x2:"8",y2:"13"}),h.jsx("line",{x1:"16",y1:"17",x2:"8",y2:"17"}),h.jsx("line",{x1:"10",y1:"9",x2:"8",y2:"9"})]})}function wx(){return h.jsx("span",{className:"welcome-tab-emoji",role:"img","aria-label":"Welcome",children:"👋"})}function xx(){return h.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",children:[h.jsx("polyline",{points:"4 17 10 11 4 5"}),h.jsx("line",{x1:"12",y1:"19",x2:"20",y2:"19"})]})}function Ex(){return h.jsxs("svg",{width:"11",height:"11",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[h.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2"}),h.jsx("line",{x1:"12",y1:"3",x2:"12",y2:"21"})]})}function kx(){const{prompts:e,loading:t,error:i,refetch:s,patchPrompt:r}=mx(),{traces:n,refetch:l}=vx(),[a,o]=D.useState([{id:Q_,tabs:[],activeTabKey:null}]),[c,_]=D.useState(Q_),[f,u]=D.useState(""),[d,g]=D.useState(!1),[y,C]=D.useState("prompts"),[m,p]=D.useState(!1),[v,S]=D.useState(!0),[k,j]=D.useState(null),[O,q]=D.useState(new Set),W=D.useRef(new Set),V=D.useRef(null),A=Z_({initial:{w:224},min:120,max:600,storageKey:"sidebar-width"}),w=Z_({initial:{},min:150,storageKey:"pane-widths"}),x=D.useRef(null),T=D.useRef(null),R=D.useCallback(()=>{fetch("/api/config",{cache:"no-store"}).then(L=>L.json()).then(L=>{u(L.rootPath),g(!!L.configured)}).catch(()=>{})},[]);D.useEffect(()=>{R()},[R]);const b=D.useCallback(L=>{L.type==="prompt-changed"?s():L.type==="trace-changed"&&l()},[s,l]),N=D.useCallback(()=>{R(),s()},[R,s]);gx(b,N),D.useEffect(()=>{if(t)return;const L=new Set(e.map(Y=>`${Y.providerId}:${Y.id}`));o(Y=>Y.map(J=>{const U=J.tabs.filter(P=>P.type!=="prompt"||L.has(`${P.providerId}:${P.promptId}`));if(U.length===J.tabs.length)return J;const I=U.some(P=>De(P)===J.activeTabKey);return{...J,tabs:U,activeTabKey:I?J.activeTabKey:U.at(-1)?De(U.at(-1)):null}}))},[e,t]),D.useEffect(()=>{if(t)return;o(Y=>{const J=Y.some(U=>U.tabs.some(I=>I.type==="welcome"));return e.length===0?J?Y:Y.map((U,I)=>I===0?{...U,tabs:[{type:"welcome"},...U.tabs],activeTabKey:d0}:U):J?Y.map(U=>{const I=U.tabs.filter(te=>te.type!=="welcome"),P=I.some(te=>De(te)===U.activeTabKey);return{...U,tabs:I,activeTabKey:P?U.activeTabKey:I.at(-1)?De(I.at(-1)):null}}):Y});const L=V.current;e.length===0?S(!1):L===0&&S(!0),V.current=e.length},[t,e.length]);const E=D.useCallback((L,Y)=>{q(J=>{const U=new Set(J);return Y?U.add(L):U.delete(L),W.current=U,U})},[]);D.useEffect(()=>{const L=Y=>{W.current.size>0&&(Y.preventDefault(),Y.returnValue="")};return window.addEventListener("beforeunload",L),()=>window.removeEventListener("beforeunload",L)},[]);const K=(L,Y)=>{const J={type:"prompt",providerId:L,promptId:Y},U=De(J);o(I=>I.map(P=>P.id!==c?P:{...P,tabs:P.tabs.some(te=>De(te)===U)?P.tabs:[...P.tabs,J],activeTabKey:U}))},Q=(L,Y,J)=>{const U={type:"trace",providerId:L,traceId:Y,rootSpanId:"",label:J},I=De(U);o(P=>{const te=P.find($=>$.tabs.some(F=>De(F)===I));return te?(_(te.id),P.map($=>$.id===te.id?{...$,activeTabKey:I}:$)):P.map($=>$.id!==c?$:{...$,tabs:[...$.tabs,U],activeTabKey:I})})},Ke=(L,Y)=>{const J=De(Y);o(U=>{var Fe,We,sr;const I=U.find(pt=>pt.tabs.some(sn=>De(sn)===J));if(I)return _(I.id),U.map(pt=>pt.id===I.id?{...pt,activeTabKey:J}:pt);const P=U.findIndex(pt=>pt.id===L);if(P<0)return U;let te=((Fe=U[P+1])==null?void 0:Fe.id)??((We=U[P-1])==null?void 0:We.id),$=U;if(!te){const pt=ru();te=pt;const sn=(sr=x.current)==null?void 0:sr.querySelector(`[data-pane="${L}"]`),p0=(sn==null?void 0:sn.getBoundingClientRect().width)??400;w.setSize(L,Math.max(200,Math.floor(p0/2))),$=[...U],$.splice(P+1,0,{id:pt,tabs:[],activeTabKey:null})}const F=te;return _(F),$.map(pt=>pt.id===F?{...pt,tabs:[...pt.tabs,Y],activeTabKey:J}:pt)})},_t=(L,Y,J,U,I)=>{const P={type:"terminal",id:`t${++Sx}`,taskId:Y,stepId:J,command:U,label:I??U};Ke(L,P)},$e=(L,Y)=>{const U={type:"prompt",providerId:oa(Y.providerId,`opening prompt ${Y.id} from trace`),promptId:Y.id};Ke(L,U)},we=(L,Y)=>{const{tracerProviderId:J,traceId:U,rootSpanId:I,label:P}=Y;Ke(L,{type:"trace",providerId:J,traceId:U,rootSpanId:I,label:P})},nt=(L,Y,J)=>{J.stopPropagation(),E(Y,!1),o(U=>{const I=U.find(F=>F.id===L),P=I.tabs.filter(F=>De(F)!==Y);if(P.length===0&&U.length>1){const F=U.filter(We=>We.id!==L),Fe=U.findIndex(We=>We.id===L);return _(F[Math.min(Fe,F.length-1)].id),w.deleteSize(L),F}const te=I.tabs.findIndex(F=>De(F)===Y),$=P[Math.min(te,P.length-1)]?De(P[Math.min(te,P.length-1)]):null;return U.map(F=>F.id===L?{...F,tabs:P,activeTabKey:$}:F)})},Ct=L=>{var P;const Y=ru(),J=(P=x.current)==null?void 0:P.querySelector(`[data-pane="${L}"]`),U=(J==null?void 0:J.getBoundingClientRect().width)??400,I=Math.max(200,Math.floor(U/2));w.setSize(L,I),o(te=>{const $=te.findIndex(Fe=>Fe.id===L),F=[...te];return F.splice($+1,0,{id:Y,tabs:[],activeTabKey:null}),F}),_(Y)},di=(L,Y,J)=>{L!==J&&(o(U=>{const I=U.find($=>$.id===L),P=I.tabs.find($=>De($)===Y);if(!P)return U;const te=I.tabs.filter($=>De($)!==Y);return te.length===0&&U.length>1?(w.deleteSize(L),U.filter(F=>F.id!==L).map(F=>{if(F.id===J){const Fe=F.tabs.some(We=>De(We)===Y);return{...F,tabs:Fe?F.tabs:[...F.tabs,P],activeTabKey:Y}}return F})):U.map($=>{if($.id===L){const F=$.activeTabKey===Y,Fe=$.tabs.findIndex(We=>De(We)===Y);return{...$,tabs:te,activeTabKey:F?te[Math.min(Fe,te.length-1)]?De(te[Math.min(Fe,te.length-1)]):null:$.activeTabKey}}if($.id===J){const F=$.tabs.some(Fe=>De(Fe)===Y);return{...$,tabs:F?$.tabs:[...$.tabs,P],activeTabKey:Y}}return $})}),_(J))},ir="~/Library/Mobile Documents/com~apple~CloudDocs",Yt=f.replace(/^\/Users\/[^/]+/,"~"),Ei=Yt.startsWith(ir),Vt=Ei?Yt.slice(ir.length)||"/":Yt,ai=Ei?`iCloud Drive${Vt!=="/"?Vt:""}`:Vt;D.useEffect(()=>{f&&(document.title=ai)},[ai,f]);const oe=a.find(L=>L.id===c)??a[0],Rt=(oe==null?void 0:oe.tabs.find(L=>De(L)===oe.activeTabKey))??null,f0=(Rt==null?void 0:Rt.type)==="prompt"?Rt.promptId:null,_0=(Rt==null?void 0:Rt.type)==="trace"?`${Rt.providerId}:${Rt.traceId}`:null,wo=A.sizes.w;return h.jsxs("div",{className:"app",children:[h.jsxs("div",{className:"app-titlebar",children:[h.jsx("div",{className:"app-titlebar-icon",children:h.jsx(bx,{})}),f&&v&&h.jsxs("span",{className:"header-path",children:[Ei&&h.jsx("svg",{className:"icloud-icon",width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round",children:h.jsx("path",{d:"M18 10h-1.26A8 8 0 109 20h9a5 5 0 000-10z"})}),Ei&&h.jsx("span",{children:"iCloud Drive"}),Vt&&Vt!=="/"&&Vt]})]}),h.jsxs("div",{className:"app-main",children:[h.jsx("div",{className:"icon-strip",children:h.jsxs("nav",{className:"icon-nav",children:[h.jsx("button",{type:"button",className:`icon-nav-btn ${y==="prompts"&&v?"active":""}`,onClick:()=>{y==="prompts"&&v?S(!1):(C("prompts"),S(!0))},title:"Prompts",children:h.jsx(Cx,{})}),h.jsx("button",{type:"button",className:`icon-nav-btn ${y==="traces"&&v?"active":""}`,onClick:()=>{y==="traces"&&v?S(!1):(C("traces"),S(!0))},title:"Traces",children:h.jsx(J_,{})})]})}),h.jsxs("div",{className:"content-area",children:[h.jsxs("div",{className:"content-header",children:[h.jsx("div",{className:"content-header-spacer",style:{width:v?wo+4:14}}),a.map((L,Y)=>{const U=Y===a.length-1?void 0:w.sizes[L.id],I=!v&&Y===0?14:0;return h.jsxs(D.Fragment,{children:[Y>0&&h.jsx("div",{className:"pane-resize-divider",onMouseDown:w.getOnMouseDown(a[Y-1].id,w.sizes[a[Y-1].id]??200)}),h.jsxs("div",{className:`pane-tabbar${L.id===k?" pane-drop-target":""}`,style:U!==void 0?{width:U-I,flexShrink:0}:{flex:1},onDragOver:P=>{P.preventDefault(),j(L.id)},onDragLeave:P=>{P.currentTarget.contains(P.relatedTarget)||j(null)},onDrop:()=>{j(null),T.current&&di(T.current.paneId,T.current.key,L.id)},children:[h.jsx("div",{className:"pane-tabs-scroll",children:L.tabs.map(P=>{var Fe;const te=De(P),$=P.type==="prompt"?((Fe=e.find(We=>We.id===P.promptId&&We.providerId===P.providerId))==null?void 0:Fe.name)??P.promptId:P.type==="trace"||P.type==="terminal"?P.label:"Welcome",F=P.type==="trace"?h.jsx(J_,{}):P.type==="welcome"?h.jsx(wx,{}):P.type==="terminal"?h.jsx(xx,{}):void 0;return h.jsx(Db,{name:$,icon:F,active:te===L.activeTabKey,dirty:O.has(te),onClick:()=>{_(L.id),o(We=>We.map(sr=>sr.id===L.id?{...sr,activeTabKey:te}:sr))},onClose:We=>nt(L.id,te,We),onDragStart:()=>{T.current={paneId:L.id,key:te}},onDragEnd:()=>{T.current=null}},te)})}),h.jsx("button",{type:"button",className:"tab-split-btn",onClick:()=>Ct(L.id),title:"Split pane",children:h.jsx(Ex,{})})]})]},L.id)})]}),h.jsxs("div",{className:"content-card",ref:x,children:[v&&h.jsxs(h.Fragment,{children:[h.jsxs("aside",{className:"section-panel",style:{width:wo},children:[y==="prompts"&&h.jsx(kb,{prompts:e,selectedId:f0,onSelect:K,loading:t,error:i,onAddPrompt:()=>p(!0),onRenamePrompt:async(L,Y)=>{const J=e.find(I=>I.id===L);if(!J)return;const U=await wy(J,Y).catch(()=>null);U&&(s(),K(oa(U.providerId??J.providerId,`selecting renamed prompt ${U.id}`),U.id))}}),y==="traces"&&h.jsx(Gw,{traces:n,loading:!1,error:null,selectedTraceKey:_0,onSelect:L=>Q(L.providerId,L.id,L.name)})]}),h.jsx("div",{className:"resize-handle",onMouseDown:A.getOnMouseDown("w",wo)})]}),a.map((L,Y)=>{const U=Y===a.length-1?void 0:w.sizes[L.id];return h.jsxs(D.Fragment,{children:[Y>0&&h.jsx("div",{className:"resize-handle",onMouseDown:w.getOnMouseDown(a[Y-1].id,w.sizes[a[Y-1].id]??200)}),h.jsxs("main",{className:"main-content","data-pane":L.id,style:U!==void 0?{width:U,flexShrink:0}:{flex:1},onClick:()=>_(L.id),onDragOver:I=>I.preventDefault(),onDrop:()=>{T.current&&di(T.current.paneId,T.current.key,L.id)},children:[L.tabs.length===0&&h.jsx("div",{className:"empty-state",children:h.jsx("img",{src:"/favicon.svg",alt:"",style:{width:96,height:96,opacity:.18}})}),L.tabs.map(I=>{const P=De(I),te=P===L.activeTabKey?{display:"contents"}:{display:"none"};if(I.type==="welcome")return h.jsx("div",{style:te,children:h.jsx(_x,{configured:d,onCreatePrompt:()=>p(!0),onOpenTerminal:($,F,Fe,We)=>_t(L.id,$,F,Fe,We)})},P);if(I.type==="terminal")return h.jsx("div",{style:te,children:h.jsx(Yw,{taskId:I.taskId,stepId:I.stepId,command:I.command})},P);if(I.type==="prompt"){const $=e.find(F=>F.id===I.promptId&&F.providerId===I.providerId)??null;return $?h.jsx("div",{style:te,children:h.jsx(yb,{prompt:$,onUpdate:r,onDirtyChange:F=>E(P,F),onExecuted:F=>we(L.id,F)})},P):null}return h.jsx("div",{style:te,children:h.jsx($w,{providerId:I.providerId,traceId:I.traceId,initialSpanId:I.rootSpanId||void 0,onOpenPrompt:$=>$e(L.id,$)})},P)})]})]},L.id)})]})]})]}),m&&h.jsx(My,{onClose:()=>p(!1),onCreated:L=>{p(!1),s(),K(oa(L.providerId,`selecting created prompt ${L.id}`),L.id)}})]})}const Tx=py.createRoot(document.getElementById("root"));Tx.render(h.jsx(j0.StrictMode,{children:h.jsx(kx,{})}));
|
|
144
|
+
`;function ip({text:e,multiline:t,children:i}){const[s,r]=k.useState(!1),n=k.useCallback(async()=>{try{await navigator.clipboard.writeText(e),r(!0),setTimeout(()=>r(!1),1500)}catch{}},[e]);return h.jsxs("div",{className:`copy-box${t?" copy-box-multiline":""}`,children:[t?h.jsx("pre",{children:e}):h.jsx("span",{className:"copy-box-text",children:i??e}),h.jsx("button",{type:"button",className:"copy-box-btn",onClick:n,title:s?"Copied!":"Copy to clipboard","aria-label":s?"Copied":"Copy to clipboard",children:h.jsx("span",{dangerouslySetInnerHTML:{__html:s?Sx:yx}})})]})}const kc="https://evalut.io/n/docs/setup.md",bx="https://github.com/chkn/evalution/issues/new?template=sdk-request.yml";function wx({onOpenTerminal:e}){const[t,i]=k.useState([]),[s,r]=k.useState(null),[n,l]=k.useState(new Set),[a,o]=k.useState(new Set),[c,u]=k.useState(new Set),[_,f]=k.useState({});k.useEffect(()=>{let p=!1;return k1().then(v=>{p||(i(v),r(S=>{var T;return S??((T=v[0])==null?void 0:T.id)??null}))}).catch(()=>{}),()=>{p=!0}},[]),k.useEffect(()=>{const p=v=>{const{stepId:S}=v.detail;u(T=>new Set(T).add(S))};return window.addEventListener(ou,p),()=>window.removeEventListener(ou,p)},[]);const d=t.find(p=>p.id===s),g=(p,v)=>(p.completed||c.has(p.id))&&(p.kind!=="create_config"||v<d.steps.length-1),y=(p,v)=>a.has(p.id)||p.kind==="create_config"&&(p.completed||c.has(p.id))&&v===d.steps.length-1,w=p=>l(v=>{const S=new Set(v);return S.has(p)?S.delete(p):S.add(p),S}),m=async p=>{if(d){o(v=>new Set(v).add(p.id)),f(v=>{const{[p.id]:S,...T}=v;return T});try{await T1(d.id,p.id),u(v=>new Set(v).add(p.id))}catch(v){f(S=>({...S,[p.id]:v.message}))}finally{o(v=>{const S=new Set(v);return S.delete(p.id),S})}}};return h.jsxs("div",{className:"setup-split",children:[h.jsxs("section",{className:"setup-pane",children:[h.jsx("h3",{children:"Set up with a coding agent"}),h.jsx("p",{className:"welcome-subtitle",children:"Paste this prompt into your coding agent and let it wire up Evalution for you:"}),h.jsxs(ip,{text:`Fetch ${kc}`,children:["Fetch"," ",h.jsx("a",{className:"welcome-link",href:kc,target:"_blank",rel:"noopener",children:kc})]})]}),h.jsx("div",{className:"setup-divider",children:h.jsx("span",{children:"or set up manually"})}),h.jsxs("section",{className:"setup-pane",children:[h.jsx("h3",{children:"Manual setup"}),h.jsx("div",{className:"welcome-field",children:h.jsxs("div",{className:"setup-sdk-options",role:"group","aria-label":"AI SDK",children:[t.map(p=>h.jsxs("button",{type:"button",className:`setup-sdk-option${p.id===s?" setup-sdk-option-selected":""}`,"aria-pressed":p.id===s,onClick:()=>r(p.id),children:[h.jsx("span",{className:"setup-sdk-icon","aria-hidden":"true",children:h.jsx(Ch,{provider:p.icon,size:20})}),h.jsx("span",{children:p.label})]},p.id)),h.jsx("a",{className:"setup-sdk-option setup-sdk-option-link",href:bx,target:"_blank",rel:"noopener",children:"Other"})]})}),d&&h.jsx("ol",{className:"setup-steps",children:d.steps.map((p,v)=>h.jsxs("li",{className:`setup-step${g(p,v)?" setup-step-done":""}${y(p,v)?" setup-step-running":""}`,children:[h.jsxs("div",{className:"setup-step-row",children:[h.jsx("span",{className:"setup-step-label",children:Cx(p)}),h.jsx("span",{className:"setup-step-action",children:xx(p,{done:g(p,v),running:y(p,v),expanded:n.has(p.id),onCreate:()=>m(p),onRun:()=>{if(p.kind==="create_config"||!d)return;const S=p.kind==="install_package"?`Install ${p.package}`:p.label;e==null||e(d.id,p.id,ex(p),S)},onToggleExpand:()=>w(p.id)})})]}),p.kind==="create_config"&&n.has(p.id)&&h.jsxs("div",{className:"setup-config-snippet",children:[h.jsx(ip,{text:p.contents,multiline:!0}),h.jsx("a",{className:"welcome-link setup-config-docs",href:J2,target:"_blank",rel:"noopener",children:"Config docs ↗"})]}),_[p.id]&&h.jsx("div",{className:"setup-file-status setup-file-error",children:_[p.id]})]},p.id))})]})]})}function Cx(e){switch(e.kind){case"create_config":return h.jsxs(h.Fragment,{children:["Create config: ",h.jsx("code",{children:e.path})]});case"install_package":return h.jsxs(h.Fragment,{children:["Install package: ",h.jsx("code",{children:e.package})]});case"run_command":return h.jsxs(h.Fragment,{children:["Run ",h.jsx("code",{children:e.command})]})}}function xx(e,t){return e.kind==="create_config"?h.jsxs(h.Fragment,{children:[h.jsx("button",{type:"button",className:"setup-step-expand welcome-link",onClick:t.onToggleExpand,children:t.expanded?"Hide":"Show"}),t.done?h.jsx("span",{className:"setup-step-status setup-file-created",children:"Created"}):h.jsx("button",{type:"button",className:"welcome-link",onClick:t.onCreate,disabled:t.running,children:t.running?"Creating…":"Create"})]}):e.kind==="install_package"&&t.done?h.jsx("span",{className:"setup-step-status setup-file-created",children:"Installed"}):h.jsx("button",{type:"button",className:"welcome-link",onClick:t.onRun,children:e.kind==="install_package"?"Install":"Run"})}const v0="all-set",Ex=[{id:"setup",title:"Set up project",Component:wx},{id:v0,title:"You're all set",Component:vx}];function kx({onCreatePrompt:e,onOpenTerminal:t,configured:i=!1,steps:s=Ex}){const r=s.findIndex(f=>f.id===v0),[n,l]=k.useState(i&&r>=0?r:0);k.useEffect(()=>{i&&r>=0&&l(r)},[i,r]);const a=s[n],o=n===0,c=n===s.length-1,u=()=>l(f=>Math.min(f+1,s.length-1)),_=a.Component;return h.jsx("div",{className:"welcome",children:h.jsxs("div",{className:"welcome-card",children:[h.jsxs("header",{className:"welcome-header",children:[h.jsx("img",{className:"welcome-logo",src:"/favicon.svg",width:"36",height:"49",alt:""}),h.jsx("ol",{className:"welcome-progress",children:s.map((f,d)=>{const g=d===n?"active":d<n?"done":"todo",y=d<n&&!!f.canReturn;return h.jsx("li",{className:`welcome-progress-${g}`,children:y?h.jsxs("button",{type:"button",className:"welcome-progress-btn",onClick:()=>l(d),children:[h.jsx("span",{className:"welcome-progress-dot",children:d+1}),h.jsx("span",{className:"welcome-progress-label",children:f.title})]}):h.jsxs(h.Fragment,{children:[s.length>1&&h.jsx("span",{className:"welcome-progress-dot",children:d+1}),h.jsx("span",{className:"welcome-progress-label",children:f.title})]})},f.id)})})]}),h.jsx("div",{className:"welcome-step-body",children:h.jsx(_,{onNext:u,isFirst:o,isLast:c,onCreatePrompt:e,onOpenTerminal:t})})]})})}function Tx(e,t){return e.id===t.id&&e.providerId===t.providerId}function Dx(){const[e,t]=k.useState([]),[i,s]=k.useState(!0),[r,n]=k.useState(null),l=k.useCallback(async()=>{try{s(!0),n(null),t(await M1())}catch(o){n(o.message)}finally{s(!1)}},[]);k.useEffect(()=>{l()},[l]);const a=k.useCallback(o=>{t(c=>{let u=!1;const _=c.map(f=>Tx(f,o)?(u=!0,o):f);return u?_:[...c,o]})},[]);return{prompts:e,loading:i,error:r,refetch:l,patchPrompt:a}}function sp({initial:e,min:t=0,max:i=1/0,direction:s="horizontal",storageKey:r}){const[n,l]=k.useState(()=>{if(r)try{const w=localStorage.getItem(r);if(w){const m=JSON.parse(w);if(m&&typeof m=="object")return m}}catch{}return e}),a=k.useRef(n);a.current=n;const o=w=>{r&&localStorage.setItem(r,JSON.stringify(w))},c=w=>{a.current=w,l(w),o(w)},u=k.useRef(null),_=k.useRef(0),f=k.useRef(0);return k.useEffect(()=>{const w=p=>{if(!u.current)return;const v=s==="horizontal"?p.clientX:p.clientY,S=Math.max(t,Math.min(i,f.current+(v-_.current)));c({...a.current,[u.current]:S})},m=()=>{u.current=null};return window.addEventListener("mousemove",w),window.addEventListener("mouseup",m),()=>{window.removeEventListener("mousemove",w),window.removeEventListener("mouseup",m)}},[s,t,i]),{sizes:n,getOnMouseDown:(w,m)=>p=>{u.current=w,_.current=s==="horizontal"?p.clientX:p.clientY,f.current=m,p.preventDefault()},setSize:(w,m)=>c({...a.current,[w]:m}),deleteSize:w=>{const{[w]:m,...p}=a.current;c(p)}}}function Mx(e,t){k.useEffect(()=>{const i=new EventSource("/api/events");return i.onopen=()=>t==null?void 0:t(),i.onmessage=s=>{try{const r=JSON.parse(s.data);e(r)}catch(r){console.error("Failed to parse SSE message:",r)}},i.onerror=s=>{console.error("SSE error:",s)},()=>{i.close()}},[e,t])}function Rx(){const[e,t]=k.useState([]),[i,s]=k.useState(!0),[r,n]=k.useState(null),l=k.useCallback(async()=>{try{n(null);const a=await L1();a.sort((o,c)=>c.startTime-o.startTime),t(a)}catch(a){n(a.message)}finally{s(!1)}},[]);return k.useEffect(()=>{l()},[l]),{traces:e,loading:i,error:r,refetch:l}}const S0="welcome",De=e=>e.type==="prompt"?`prompt:${e.providerId}:${e.promptId}`:e.type==="trace"?`trace:${e.providerId}:${e.traceId}`:e.type==="terminal"?`terminal:${e.id}`:S0;let Bx=0,Ax=0;const cu=()=>`pane${++Ax}`,rp=cu();function Nx(){return h.jsx("img",{src:"/favicon.svg",width:"22",height:"30",alt:"evalution logo",style:{display:"block"}})}function np(){return h.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",children:[h.jsx("line",{x1:"4",y1:"6",x2:"14",y2:"6"}),h.jsx("line",{x1:"8",y1:"12",x2:"20",y2:"12"}),h.jsx("line",{x1:"6",y1:"18",x2:"16",y2:"18"})]})}function Ox(){return h.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",children:[h.jsx("path",{d:"M14 2H6a2 2 0 00-2 2v16a2 2 0 002 2h12a2 2 0 002-2V8z"}),h.jsx("polyline",{points:"14 2 14 8 20 8"}),h.jsx("line",{x1:"16",y1:"13",x2:"8",y2:"13"}),h.jsx("line",{x1:"16",y1:"17",x2:"8",y2:"17"}),h.jsx("line",{x1:"10",y1:"9",x2:"8",y2:"9"})]})}function Lx(){return h.jsx("span",{className:"welcome-tab-emoji",role:"img","aria-label":"Welcome",children:"👋"})}function zx(){return h.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",children:[h.jsx("polyline",{points:"4 17 10 11 4 5"}),h.jsx("line",{x1:"12",y1:"19",x2:"20",y2:"19"})]})}function jx(){return h.jsxs("svg",{width:"11",height:"11",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[h.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2"}),h.jsx("line",{x1:"12",y1:"3",x2:"12",y2:"21"})]})}function Hx(){const{prompts:e,loading:t,error:i,refetch:s,patchPrompt:r}=Dx(),{traces:n,refetch:l}=Rx(),[a,o]=k.useState([{id:rp,tabs:[],activeTabKey:null}]),[c,u]=k.useState(rp),[_,f]=k.useState(""),[d,g]=k.useState(!1),[y,w]=k.useState("prompts"),[m,p]=k.useState(!1),[v,S]=k.useState(()=>new URLSearchParams(window.location.search).get("expand")!=="true"),[T,j]=k.useState(null),[O,L]=k.useState(new Set),U=k.useRef(new Set),Y=k.useRef(null),A=k.useRef(!1),x=sp({initial:{w:224},min:120,max:600,storageKey:"sidebar-width"}),C=sp({initial:{},min:150,storageKey:"pane-widths"}),B=k.useRef(null),D=k.useRef(null),b=k.useCallback(()=>{fetch("/api/config",{cache:"no-store"}).then(z=>z.json()).then(z=>{f(z.rootPath),g(!!z.configured)}).catch(()=>{})},[]);k.useEffect(()=>{b()},[b]);const N=k.useCallback(z=>{if(z.type==="prompt-changed"){if(x1(z.event.type,z.providerId,z.event.promptId))return;s()}else z.type==="trace-changed"&&l()},[s,l]),E=k.useCallback(()=>{b(),s()},[b,s]);Mx(N,E),k.useEffect(()=>{if(t)return;const z=new Set(e.map(W=>`${W.providerId}:${W.id}`));o(W=>W.map(Q=>{const P=Q.tabs.filter(K=>K.type!=="prompt"||z.has(`${K.providerId}:${K.promptId}`));if(P.length===Q.tabs.length)return Q;const I=P.some(K=>De(K)===Q.activeTabKey);return{...Q,tabs:P,activeTabKey:I?Q.activeTabKey:P.at(-1)?De(P.at(-1)):null}}))},[e,t]),k.useEffect(()=>{if(t)return;o(W=>{const Q=W.some(P=>P.tabs.some(I=>I.type==="welcome"));return e.length===0?Q?W:W.map((P,I)=>I===0?{...P,tabs:[{type:"welcome"},...P.tabs],activeTabKey:S0}:P):Q?W.map(P=>{const I=P.tabs.filter(te=>te.type!=="welcome"),K=I.some(te=>De(te)===P.activeTabKey);return{...P,tabs:I,activeTabKey:K?P.activeTabKey:I.at(-1)?De(I.at(-1)):null}}):W});const z=Y.current;e.length===0?S(!1):z===0&&S(!0),Y.current=e.length},[t,e.length]);const V=k.useCallback((z,W)=>{L(Q=>{const P=new Set(Q);return W?P.add(z):P.delete(z),U.current=P,P})},[]);k.useEffect(()=>{const z=W=>{U.current.size>0&&(W.preventDefault(),W.returnValue="")};return window.addEventListener("beforeunload",z),()=>window.removeEventListener("beforeunload",z)},[]);const F=(z,W)=>{const Q={type:"prompt",providerId:z,promptId:W},P=De(Q);o(I=>I.map(K=>K.id!==c?K:{...K,tabs:K.tabs.some(te=>De(te)===P)?K.tabs:[...K.tabs,Q],activeTabKey:P}))};k.useEffect(()=>{if(t||A.current)return;const z=new URLSearchParams(window.location.search).get("prompt"),W=z?e.find(Q=>Q.id===z):void 0;W!=null&&W.providerId&&F(W.providerId,W.id),A.current=!0},[t,e]);const rt=(z,W,Q)=>{const P={type:"trace",providerId:z,traceId:W,rootSpanId:"",label:Q},I=De(P);o(K=>{const te=K.find(G=>G.tabs.some(Z=>De(Z)===I));return te?(u(te.id),K.map(G=>G.id===te.id?{...G,activeTabKey:I}:G)):K.map(G=>G.id!==c?G:{...G,tabs:[...G.tabs,P],activeTabKey:I})})},nt=(z,W)=>{const Q=De(W);o(P=>{var Ge,Ke,rr;const I=P.find(mt=>mt.tabs.some(nn=>De(nn)===Q));if(I)return u(I.id),P.map(mt=>mt.id===I.id?{...mt,activeTabKey:Q}:mt);const K=P.findIndex(mt=>mt.id===z);if(K<0)return P;let te=((Ge=P[K+1])==null?void 0:Ge.id)??((Ke=P[K-1])==null?void 0:Ke.id),G=P;if(!te){const mt=cu();te=mt;const nn=(rr=B.current)==null?void 0:rr.querySelector(`[data-pane="${z}"]`),w0=(nn==null?void 0:nn.getBoundingClientRect().width)??400;C.setSize(z,Math.max(200,Math.floor(w0/2))),G=[...P],G.splice(K+1,0,{id:mt,tabs:[],activeTabKey:null})}const Z=te;return u(Z),G.map(mt=>mt.id===Z?{...mt,tabs:[...mt.tabs,W],activeTabKey:Q}:mt)})},$e=(z,W,Q,P,I)=>{const K={type:"terminal",id:`t${++Bx}`,taskId:W,stepId:Q,command:P,label:I??P};nt(z,K)},Ce=(z,W)=>{const P={type:"prompt",providerId:ua(W.providerId,`opening prompt ${W.id} from trace`),promptId:W.id};nt(z,P)},lt=(z,W)=>{const{tracerProviderId:Q,traceId:P,rootSpanId:I,label:K}=W;nt(z,{type:"trace",providerId:Q,traceId:P,rootSpanId:I,label:K})},Ct=(z,W,Q)=>{Q.stopPropagation(),V(W,!1),o(P=>{const I=P.find(Z=>Z.id===z),K=I.tabs.filter(Z=>De(Z)!==W);if(K.length===0&&P.length>1){const Z=P.filter(Ke=>Ke.id!==z),Ge=P.findIndex(Ke=>Ke.id===z);return u(Z[Math.min(Ge,Z.length-1)].id),C.deleteSize(z),Z}const te=I.tabs.findIndex(Z=>De(Z)===W),G=K[Math.min(te,K.length-1)]?De(K[Math.min(te,K.length-1)]):null;return P.map(Z=>Z.id===z?{...Z,tabs:K,activeTabKey:G}:Z)})},Ci=z=>{var K;const W=cu(),Q=(K=B.current)==null?void 0:K.querySelector(`[data-pane="${z}"]`),P=(Q==null?void 0:Q.getBoundingClientRect().width)??400,I=Math.max(200,Math.floor(P/2));C.setSize(z,I),o(te=>{const G=te.findIndex(Ge=>Ge.id===z),Z=[...te];return Z.splice(G+1,0,{id:W,tabs:[],activeTabKey:null}),Z}),u(W)},sr=(z,W,Q)=>{z!==Q&&(o(P=>{const I=P.find(G=>G.id===z),K=I.tabs.find(G=>De(G)===W);if(!K)return P;const te=I.tabs.filter(G=>De(G)!==W);return te.length===0&&P.length>1?(C.deleteSize(z),P.filter(Z=>Z.id!==z).map(Z=>{if(Z.id===Q){const Ge=Z.tabs.some(Ke=>De(Ke)===W);return{...Z,tabs:Ge?Z.tabs:[...Z.tabs,K],activeTabKey:W}}return Z})):P.map(G=>{if(G.id===z){const Z=G.activeTabKey===W,Ge=G.tabs.findIndex(Ke=>De(Ke)===W);return{...G,tabs:te,activeTabKey:Z?te[Math.min(Ge,te.length-1)]?De(te[Math.min(Ge,te.length-1)]):null:G.activeTabKey}}if(G.id===Q){const Z=G.tabs.some(Ge=>De(Ge)===W);return{...G,tabs:Z?G.tabs:[...G.tabs,K],activeTabKey:W}}return G})}),u(Q))},ni="~/Library/Mobile Documents/com~apple~CloudDocs",$i=_.replace(/^\/Users\/[^/]+/,"~"),hi=$i.startsWith(ni),pt=hi?$i.slice(ni.length)||"/":$i,oe=hi?`iCloud Drive${pt!=="/"?pt:""}`:pt;k.useEffect(()=>{_&&(document.title=oe)},[oe,_]);const Gi=a.find(z=>z.id===c)??a[0],xi=(Gi==null?void 0:Gi.tabs.find(z=>De(z)===Gi.activeTabKey))??null,y0=(xi==null?void 0:xi.type)==="prompt"?xi.promptId:null,b0=(xi==null?void 0:xi.type)==="trace"?`${xi.providerId}:${xi.traceId}`:null,ko=x.sizes.w;return h.jsxs("div",{className:"app",children:[h.jsxs("div",{className:"app-titlebar",children:[h.jsx("div",{className:"app-titlebar-icon",children:h.jsx(Nx,{})}),_&&v&&h.jsxs("span",{className:"header-path",children:[hi&&h.jsx("svg",{className:"icloud-icon",width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round",children:h.jsx("path",{d:"M18 10h-1.26A8 8 0 109 20h9a5 5 0 000-10z"})}),hi&&h.jsx("span",{children:"iCloud Drive"}),pt&&pt!=="/"&&pt]})]}),h.jsxs("div",{className:"app-main",children:[h.jsx("div",{className:"icon-strip",children:h.jsxs("nav",{className:"icon-nav",children:[h.jsx("button",{type:"button",className:`icon-nav-btn ${y==="prompts"&&v?"active":""}`,onClick:()=>{y==="prompts"&&v?S(!1):(w("prompts"),S(!0))},title:"Prompts",children:h.jsx(Ox,{})}),h.jsx("button",{type:"button",className:`icon-nav-btn ${y==="traces"&&v?"active":""}`,onClick:()=>{y==="traces"&&v?S(!1):(w("traces"),S(!0))},title:"Traces",children:h.jsx(np,{})})]})}),h.jsxs("div",{className:"content-area",children:[h.jsxs("div",{className:"content-header",children:[h.jsx("div",{className:"content-header-spacer",style:{width:v?ko+4:14}}),a.map((z,W)=>{const P=W===a.length-1?void 0:C.sizes[z.id],I=!v&&W===0?14:0;return h.jsxs(k.Fragment,{children:[W>0&&h.jsx("div",{className:"pane-resize-divider",onMouseDown:C.getOnMouseDown(a[W-1].id,C.sizes[a[W-1].id]??200)}),h.jsxs("div",{className:`pane-tabbar${z.id===T?" pane-drop-target":""}`,style:P!==void 0?{width:P-I,flexShrink:0}:{flex:1},onDragOver:K=>{K.preventDefault(),j(z.id)},onDragLeave:K=>{K.currentTarget.contains(K.relatedTarget)||j(null)},onDrop:()=>{j(null),D.current&&sr(D.current.paneId,D.current.key,z.id)},children:[h.jsx("div",{className:"pane-tabs-scroll",children:z.tabs.map(K=>{var Ge;const te=De(K),G=K.type==="prompt"?((Ge=e.find(Ke=>Ke.id===K.promptId&&Ke.providerId===K.providerId))==null?void 0:Ge.name)??K.promptId:K.type==="trace"||K.type==="terminal"?K.label:"Welcome",Z=K.type==="trace"?h.jsx(np,{}):K.type==="welcome"?h.jsx(Lx,{}):K.type==="terminal"?h.jsx(zx,{}):void 0;return h.jsx(qb,{name:G,icon:Z,active:te===z.activeTabKey,dirty:O.has(te),onClick:()=>{u(z.id),o(Ke=>Ke.map(rr=>rr.id===z.id?{...rr,activeTabKey:te}:rr))},onClose:Ke=>Ct(z.id,te,Ke),onDragStart:()=>{D.current={paneId:z.id,key:te}},onDragEnd:()=>{D.current=null}},te)})}),h.jsx("button",{type:"button",className:"tab-split-btn",onClick:()=>Ci(z.id),title:"Split pane",children:h.jsx(jx,{})})]})]},z.id)})]}),h.jsxs("div",{className:"content-card",ref:B,children:[v&&h.jsxs(h.Fragment,{children:[h.jsxs("aside",{className:"section-panel",style:{width:ko},children:[y==="prompts"&&h.jsx(Hb,{prompts:e,selectedId:y0,onSelect:F,loading:t,error:i,onAddPrompt:()=>p(!0),onRenamePrompt:async(z,W)=>{const Q=e.find(I=>I.id===z);if(!Q)return;const P=await A1(Q,W).catch(()=>null);P&&(s(),F(ua(P.providerId??Q.providerId,`selecting renamed prompt ${P.id}`),P.id))}}),y==="traces"&&h.jsx(lx,{traces:n,loading:!1,error:null,selectedTraceKey:b0,onSelect:z=>rt(z.providerId,z.id,z.name)})]}),h.jsx("div",{className:"resize-handle",onMouseDown:x.getOnMouseDown("w",ko)})]}),a.map((z,W)=>{const P=W===a.length-1?void 0:C.sizes[z.id];return h.jsxs(k.Fragment,{children:[W>0&&h.jsx("div",{className:"resize-handle",onMouseDown:C.getOnMouseDown(a[W-1].id,C.sizes[a[W-1].id]??200)}),h.jsxs("main",{className:"main-content","data-pane":z.id,style:P!==void 0?{width:P,flexShrink:0}:{flex:1},onClick:()=>u(z.id),onDragOver:I=>I.preventDefault(),onDrop:()=>{D.current&&sr(D.current.paneId,D.current.key,z.id)},children:[z.tabs.length===0&&h.jsx("div",{className:"empty-state",children:h.jsx("img",{src:"/favicon.svg",alt:"",style:{width:96,height:96,opacity:.18}})}),z.tabs.map(I=>{const K=De(I),te=K===z.activeTabKey?{display:"contents"}:{display:"none"};if(I.type==="welcome")return h.jsx("div",{style:te,children:h.jsx(kx,{configured:d,onCreatePrompt:()=>p(!0),onOpenTerminal:(G,Z,Ge,Ke)=>$e(z.id,G,Z,Ge,Ke)})},K);if(I.type==="terminal")return h.jsx("div",{style:te,children:h.jsx(ix,{taskId:I.taskId,stepId:I.stepId,command:I.command})},K);if(I.type==="prompt"){const G=e.find(Z=>Z.id===I.promptId&&Z.providerId===I.providerId)??null;return G?h.jsx("div",{style:te,children:h.jsx(Ab,{prompt:G,onUpdate:r,onDirtyChange:Z=>V(K,Z),onExecuted:Z=>lt(z.id,Z)})},K):null}return h.jsx("div",{style:te,children:h.jsx(ax,{providerId:I.providerId,traceId:I.traceId,initialSpanId:I.rootSpanId||void 0,onOpenPrompt:G=>Ce(z.id,G)})},K)})]})]},z.id)})]})]})]}),m&&h.jsx(H1,{onClose:()=>p(!1),onCreated:z=>{p(!1),s(),F(ua(z.providerId,`selecting created prompt ${z.id}`),z.id)}})]})}const Ux=w1.createRoot(document.getElementById("root"));Ux.render(h.jsx(Y0.StrictMode,{children:h.jsx(Hx,{})}));
|